Browse Source

fix: ipcRemote.sendSync regression after moving away from JSON for return values (#13997)

trop[bot] 6 years ago
parent
commit
3d89185396

+ 1 - 2
lib/isolated_renderer/init.js

@@ -3,7 +3,6 @@
 'use strict'
 
 const {send, sendSync} = binding
-const {parse} = JSON
 
 const ipcRenderer = {
   send (...args) {
@@ -11,7 +10,7 @@ const ipcRenderer = {
   },
 
   sendSync (...args) {
-    return parse(sendSync('ipc-message-sync', args))
+    return sendSync('ipc-message-sync', args)[0]
   },
 
   // No-ops since events aren't received

+ 1 - 0
spec/api-browser-window-spec.js

@@ -3072,6 +3072,7 @@ describe('BrowserWindow module', () => {
         typeofFunctionApply: 'function'
       },
       pageContext: {
+        openedLocation: '',
         preloadProperty: 'undefined',
         pageProperty: 'string',
         typeofRequire: 'undefined',

+ 2 - 0
spec/fixtures/api/isolated.html

@@ -9,9 +9,11 @@
       Function.prototype.apply = true
 
       const opened = window.open()
+      const openedLocation = opened.location
       opened.close()
 
       window.postMessage({
+        openedLocation,
         preloadProperty: typeof window.foo,
         pageProperty: typeof window.hello,
         typeofRequire: typeof require,

+ 1 - 0
spec/webview-spec.js

@@ -527,6 +527,7 @@ describe('<webview> tag', function () {
           typeofFunctionApply: 'function'
         },
         pageContext: {
+          openedLocation: '',
           preloadProperty: 'undefined',
           pageProperty: 'string',
           typeofRequire: 'undefined',