anchor.diff:     * parse the code. If it can't, it resets the design to an empty one.
      */
     Future setCode(String code) {
  -    code = code.replaceAll('"', r'\"').replaceAll('\n', r'\n');
  +    // Escape all special charachters and enclose in double-quotes.
  +    code = JSON.encode(code);
       // Just in case we are called too early, wait until the webview is ready.
       return _webviewReady.future.then((_) {
         // TODO(ussuri): This doesn't work without a delay:
  
positive.code:       // asynchronously returns the result via a chrome.runtime.sendMessage,
        // received and handled by [_designProxyListener], which completes the
        // [_codeExported] completer with the code string.
        _executeScriptInWebview('''
            window.postMessage({action: 'export_code'}, '*');
        ''');
      });
  
negative.code:       return new Timer(new Duration(milliseconds: 500), () {
          // The request is received and handled by the JS proxy script injected
          // into [_webview>] by [_injectDesignerProxy].
          return _executeScriptInWebview(r'''
              window.postMessage(
                  {action: 'import_code', code: ''' + code + r'''}, '*');
          ''');
        });
      });
  