From c0669cb46e7524e0bb8c07443ac0ba21ee244814 Mon Sep 17 00:00:00 2001 From: Neil Craig Date: Thu, 27 Apr 2017 20:19:17 +0100 Subject: [PATCH 01/18] Update touch-bar.md Add a simple example of running the example code as it might not be obvious to people who've not used Electron. Hopefully it makes sense :-) --- docs/api/touch-bar.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/api/touch-bar.md b/docs/api/touch-bar.md index 0a0827a2b2fa..371982fc2b47 100644 --- a/docs/api/touch-bar.md +++ b/docs/api/touch-bar.md @@ -138,3 +138,11 @@ app.once('ready', () => { window.setTouchBar(touchBar) }) ``` +### Running the above example +To run the example above, you'll need to (assuming you've got a terminal open in the dirtectory you want to run the example): + +1. Save the above file to your computer, named as touchbar.js +2. Install electron via e.g. `npm install electron` +3. Run the example inside electron: `./node_modules/.bin/electron touchbar.js` + +You should then see a new electron window and the app running in your touchbar (or touchbar emulator). From c26605c384ecc8d2342fe134ed84e5ee006d2ebc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 27 Apr 2017 14:22:56 -0700 Subject: [PATCH 02/18] Minor edits to example guide --- docs/api/touch-bar.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/api/touch-bar.md b/docs/api/touch-bar.md index 371982fc2b47..8f1b8732f8b4 100644 --- a/docs/api/touch-bar.md +++ b/docs/api/touch-bar.md @@ -138,11 +138,13 @@ app.once('ready', () => { window.setTouchBar(touchBar) }) ``` + ### Running the above example + To run the example above, you'll need to (assuming you've got a terminal open in the dirtectory you want to run the example): -1. Save the above file to your computer, named as touchbar.js -2. Install electron via e.g. `npm install electron` -3. Run the example inside electron: `./node_modules/.bin/electron touchbar.js` +1. Save the above file to your computer as `touchbar.js` +2. Install Electron via `npm install electron` +3. Run the example inside Electron: `./node_modules/.bin/electron touchbar.js` -You should then see a new electron window and the app running in your touchbar (or touchbar emulator). +You should then see a new Electron window and the app running in your touch bar (or touch bar emulator). From 19b6ba044b523580d60046e199ecd6ca025e78ef Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 28 Apr 2017 11:21:53 -0300 Subject: [PATCH 03/18] Fix context leak in ObjectLifeMonitor. The RemoteObjectFreer class is keeping the context alive even when the window is closed. For electron applications that use sandbox, this will cause a memory leak every time a new window is created with `window.open`. Close #9191 --- atom/common/api/object_life_monitor.cc | 3 +-- atom/common/api/object_life_monitor.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/atom/common/api/object_life_monitor.cc b/atom/common/api/object_life_monitor.cc index cd5537e8874c..cc68130d34bd 100644 --- a/atom/common/api/object_life_monitor.cc +++ b/atom/common/api/object_life_monitor.cc @@ -12,8 +12,7 @@ namespace atom { ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate, v8::Local target) - : context_(isolate, isolate->GetCurrentContext()), - target_(isolate, target), + : target_(isolate, target), weak_ptr_factory_(this) { target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter); } diff --git a/atom/common/api/object_life_monitor.h b/atom/common/api/object_life_monitor.h index 73030864b933..e047960e8130 100644 --- a/atom/common/api/object_life_monitor.h +++ b/atom/common/api/object_life_monitor.h @@ -22,7 +22,6 @@ class ObjectLifeMonitor { static void OnObjectGC(const v8::WeakCallbackInfo& data); static void Free(const v8::WeakCallbackInfo& data); - v8::Global context_; v8::Global target_; base::WeakPtrFactory weak_ptr_factory_; From f974a6bda9a32487bb021cb6ec221f5100a770c1 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Tue, 4 Apr 2017 01:33:51 +0530 Subject: [PATCH 04/18] browser: make destruction of webContents async --- atom/browser/api/atom_api_web_contents.cc | 15 +++++++++++---- atom/browser/api/atom_api_web_contents.h | 2 +- atom/browser/api/atom_api_window.cc | 2 +- atom/browser/common_web_contents_delegate.cc | 9 +++++++-- atom/browser/common_web_contents_delegate.h | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index d3e7bae2e412..7cb8574efb40 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -417,15 +417,22 @@ WebContents::~WebContents() { guest_delegate_->Destroy(); RenderViewDeleted(web_contents()->GetRenderViewHost()); - DestroyWebContents(); + + if (type_ == BROWSER_WINDOW && owner_window()) { + owner_window()->CloseContents(nullptr); + } else if (type_ == WEB_VIEW) { + DestroyWebContents(false /* async */); + } else { + DestroyWebContents(true /* async */); + } } } -void WebContents::DestroyWebContents() { +void WebContents::DestroyWebContents(bool async) { // This event is only for internal use, which is emitted when WebContents is // being destroyed. Emit("will-destroy"); - ResetManagedWebContents(); + ResetManagedWebContents(async); } bool WebContents::DidAddMessageToConsole(content::WebContents* source, @@ -477,7 +484,7 @@ void WebContents::AddNewContents(content::WebContents* source, if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture, initial_rect.x(), initial_rect.y(), initial_rect.width(), initial_rect.height())) { - api_web_contents->DestroyWebContents(); + api_web_contents->DestroyWebContents(false /* async */); } } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 1301ed15f7fa..2289cdb4a45b 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -78,7 +78,7 @@ class WebContents : public mate::TrackableObject, v8::Local prototype); // Notifies to destroy any guest web contents before destroying self. - void DestroyWebContents(); + void DestroyWebContents(bool async); int64_t GetID() const; int GetProcessID() const; diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 72b8e33ef7b5..6862915f9cf2 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -173,7 +173,7 @@ void Window::WillDestroyNativeObject() { } void Window::OnWindowClosed() { - api_web_contents_->DestroyWebContents(); + api_web_contents_->DestroyWebContents(true /* async */); RemoveFromWeakMap(); window_->RemoveObserver(this); diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index a10f959dce90..282fa92de69e 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -188,8 +188,13 @@ void CommonWebContentsDelegate::SetOwnerWindow( } } -void CommonWebContentsDelegate::ResetManagedWebContents() { - web_contents_.reset(); +void CommonWebContentsDelegate::ResetManagedWebContents(bool async) { + if (async) { + base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, + web_contents_.release()); + } else { + web_contents_.reset(); + } } content::WebContents* CommonWebContentsDelegate::GetWebContents() const { diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index 27209411c72b..d1d26314966e 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -112,7 +112,7 @@ class CommonWebContentsDelegate #endif // Destroy the managed InspectableWebContents object. - void ResetManagedWebContents(); + void ResetManagedWebContents(bool async); private: // Callback for when DevToolsSaveToFile has completed. From 9e3b8ade12213e9ae870ea6bd4834c5cbca34f50 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 5 Apr 2017 11:52:11 +0530 Subject: [PATCH 05/18] invoke WebContentsDestroyed manually when destruction path is async --- atom/browser/api/atom_api_web_contents.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 7cb8574efb40..70af26290eca 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -418,12 +418,18 @@ WebContents::~WebContents() { RenderViewDeleted(web_contents()->GetRenderViewHost()); - if (type_ == BROWSER_WINDOW && owner_window()) { - owner_window()->CloseContents(nullptr); - } else if (type_ == WEB_VIEW) { + if (type_ == WEB_VIEW) { DestroyWebContents(false /* async */); } else { - DestroyWebContents(true /* async */); + if (type_ == BROWSER_WINDOW && owner_window()) { + owner_window()->CloseContents(nullptr); + } else { + DestroyWebContents(true /* async */); + } + // The WebContentsDestroyed will not be called automatically because we + // destroy the webContents in the next tick. So we have to manually + // call it here to make sure "destroyed" event is emitted. + WebContentsDestroyed(); } } } From e4524ce42e164158b61c384220397e515c911838 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 5 Apr 2017 12:00:36 +0530 Subject: [PATCH 06/18] add spec --- spec/api-browser-window-spec.js | 63 +++++++++++++++++++++++++++++++ spec/api-web-contents-spec.js | 66 +++++++++++++++++++++++++++++++++ spec/static/main.js | 21 +++++++++++ 3 files changed, 150 insertions(+) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 5998768bd72f..86bf9bdcc880 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -86,6 +86,38 @@ describe('BrowserWindow module', function () { }) describe('BrowserWindow.close()', function () { + let server + + before(function (done) { + server = http.createServer((request, response) => { + switch (request.url) { + case '/404': + response.statusCode = '404' + response.end() + break + case '/301': + response.statusCode = '301' + response.setHeader('Location', '/200') + response.end() + break + case '/200': + response.statusCode = '200' + response.end('hello') + break + default: + done('unsupported endpoint') + } + }).listen(0, '127.0.0.1', () => { + server.url = 'http://127.0.0.1:' + server.address().port + done() + }) + }) + + after(function () { + server.close() + server = null + }) + it('should emit unload handler', function (done) { w.webContents.on('did-finish-load', function () { w.close() @@ -109,6 +141,37 @@ describe('BrowserWindow module', function () { }) w.loadURL('file://' + path.join(fixtures, 'api', 'beforeunload-false.html')) }) + + it('should not crash when invoked synchronously inside navigation observer', function (done) { + const events = [ + { name: 'did-start-loading', url: `${server.url}/200` }, + { name: 'did-get-redirect-request', url: `${server.url}/301` }, + { name: 'did-get-response-details', url: `${server.url}/200` }, + { name: 'dom-ready', url: `${server.url}/200` }, + { name: 'did-stop-loading', url: `${server.url}/200` }, + { name: 'did-finish-load', url: `${server.url}/200` }, + { name: 'did-frame-finish-load', url: `${server.url}/200` }, + { name: 'did-fail-load', url: `${server.url}/404` } + ] + const responseEvent = 'window-webContents-destroyed' + + function* genNavigationEvent () { + let eventOptions = null + while ((eventOptions = events.shift()) && events.length) { + let w = new BrowserWindow({show: false}) + eventOptions.id = w.id + eventOptions.responseEvent = responseEvent + ipcRenderer.send('test-webcontents-navigation-observer', eventOptions) + yield 1 + } + } + + let gen = genNavigationEvent() + ipcRenderer.on(responseEvent, function () { + if (!gen.next().value) done() + }) + gen.next() + }) }) describe('window.close()', function () { diff --git a/spec/api-web-contents-spec.js b/spec/api-web-contents-spec.js index f081b3900944..7eac9d3e0e96 100644 --- a/spec/api-web-contents-spec.js +++ b/spec/api-web-contents-spec.js @@ -542,4 +542,70 @@ describe('webContents module', function () { }) }) }) + + describe('destroy()', () => { + let server + + before(function (done) { + server = http.createServer((request, response) => { + switch (request.url) { + case '/404': + response.statusCode = '404' + response.end() + break + case '/301': + response.statusCode = '301' + response.setHeader('Location', '/200') + response.end() + break + case '/200': + response.statusCode = '200' + response.end('hello') + break + default: + done('unsupported endpoint') + } + }).listen(0, '127.0.0.1', () => { + server.url = 'http://127.0.0.1:' + server.address().port + done() + }) + }) + + after(function () { + server.close() + server = null + }) + + it('should not crash when invoked synchronously inside navigation observer', (done) => { + const events = [ + { name: 'did-start-loading', url: `${server.url}/200` }, + { name: 'did-get-redirect-request', url: `${server.url}/301` }, + { name: 'did-get-response-details', url: `${server.url}/200` }, + { name: 'dom-ready', url: `${server.url}/200` }, + { name: 'did-stop-loading', url: `${server.url}/200` }, + { name: 'did-finish-load', url: `${server.url}/200` }, + // FIXME: Multiple Emit calls inside an observer assume that object + // will be alive till end of the observer. Synchronous `destroy` api + // violates this contract and crashes. + // { name: 'did-frame-finish-load', url: `${server.url}/200` }, + { name: 'did-fail-load', url: `${server.url}/404` } + ] + const responseEvent = 'webcontents-destroyed' + + function* genNavigationEvent () { + let eventOptions = null + while ((eventOptions = events.shift()) && events.length) { + eventOptions.responseEvent = responseEvent + ipcRenderer.send('test-webcontents-navigation-observer', eventOptions) + yield 1 + } + } + + let gen = genNavigationEvent() + ipcRenderer.on(responseEvent, () => { + if (!gen.next().value) done() + }) + gen.next() + }) + }) }) diff --git a/spec/static/main.js b/spec/static/main.js index 7e56da623bf8..ba31b61ae07d 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -338,6 +338,27 @@ ipcMain.on('crash-service-pid', (event, pid) => { event.returnValue = null }) +ipcMain.on('test-webcontents-navigation-observer', (event, options) => { + let contents = null + let destroy = () => {} + if (options.id) { + const w = BrowserWindow.fromId(options.id) + contents = w.webContents + destroy = () => w.close() + } else { + contents = webContents.create() + destroy = () => contents.destroy() + } + + contents.once(options.name, () => destroy()) + + contents.once('destroyed', () => { + event.sender.send(options.responseEvent) + }) + + contents.loadURL(options.url) +}) + // Suspend listeners until the next event and then restore them const suspendListeners = (emitter, eventName, callback) => { const listeners = emitter.listeners(eventName) From 5e976be43bcf459c2ce8f5283609a464cf6da865 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 5 Apr 2017 16:57:33 +0530 Subject: [PATCH 07/18] remove page-title-updated workaround for #3380 --- atom/browser/api/atom_api_web_contents.cc | 6 ++---- lib/browser/api/browser-window.js | 6 +----- lib/browser/api/web-contents.js | 7 ------- spec/api-browser-window-spec.js | 5 +++++ 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 70af26290eca..4dd3d51fe0a2 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -829,10 +829,8 @@ void WebContents::DidFinishNavigation( void WebContents::TitleWasSet(content::NavigationEntry* entry, bool explicit_set) { - if (entry) - Emit("-page-title-updated", entry->GetTitle(), explicit_set); - else - Emit("-page-title-updated", "", explicit_set); + auto title = entry ? entry->GetTitle() : base::string16(); + Emit("page-title-updated", title, explicit_set); } void WebContents::DidUpdateFaviconURL( diff --git a/lib/browser/api/browser-window.js b/lib/browser/api/browser-window.js index 4b3f70139f0d..49a134f39415 100644 --- a/lib/browser/api/browser-window.js +++ b/lib/browser/api/browser-window.js @@ -76,13 +76,9 @@ BrowserWindow.prototype._init = function () { // Change window title to page title. this.webContents.on('page-title-updated', (event, title) => { - // The page-title-updated event is not emitted immediately (see #3645), so - // when the callback is called the BrowserWindow might have been closed. - if (this.isDestroyed()) return - // Route the event to BrowserWindow. this.emit('page-title-updated', event, title) - if (!event.defaultPrevented) this.setTitle(title) + if (!this.isDestroyed() && !event.defaultPrevented) this.setTitle(title) }) // Sometimes the webContents doesn't get focus when window is shown, so we diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 6af96e175715..c49c1be8ba64 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -268,13 +268,6 @@ WebContents.prototype._init = function () { this.reload() }) - // Delays the page-title-updated event to next tick. - this.on('-page-title-updated', function (...args) { - setImmediate(() => { - this.emit('page-title-updated', ...args) - }) - }) - app.emit('web-contents-created', {}, this) } diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 86bf9bdcc880..34db4a6ae79a 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -104,6 +104,10 @@ describe('BrowserWindow module', function () { response.statusCode = '200' response.end('hello') break + case '/title': + response.statusCode = '200' + response.end('Hello') + break default: done('unsupported endpoint') } @@ -148,6 +152,7 @@ describe('BrowserWindow module', function () { { name: 'did-get-redirect-request', url: `${server.url}/301` }, { name: 'did-get-response-details', url: `${server.url}/200` }, { name: 'dom-ready', url: `${server.url}/200` }, + { name: 'page-title-updated', url: `${server.url}/title` }, { name: 'did-stop-loading', url: `${server.url}/200` }, { name: 'did-finish-load', url: `${server.url}/200` }, { name: 'did-frame-finish-load', url: `${server.url}/200` }, From c68f41b8d837f21e8cf2a5d9c09b2a475a0230ef Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 19 Apr 2017 21:54:04 +0530 Subject: [PATCH 08/18] destroy new window webContents asynchronously --- atom/browser/api/atom_api_web_contents.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4dd3d51fe0a2..a06ec2244dde 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -490,7 +490,7 @@ void WebContents::AddNewContents(content::WebContents* source, if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture, initial_rect.x(), initial_rect.y(), initial_rect.width(), initial_rect.height())) { - api_web_contents->DestroyWebContents(false /* async */); + api_web_contents->DestroyWebContents(true /* async */); } } From 0476e2fd3d64724f881d7afd2976e69f8eaaf990 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 19 Apr 2017 22:07:12 +0530 Subject: [PATCH 09/18] destroy browserView webContents asynchronously --- atom/browser/api/atom_api_browser_view.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_browser_view.cc b/atom/browser/api/atom_api_browser_view.cc index dc17fce9e9a3..d37d2df41c5b 100644 --- a/atom/browser/api/atom_api_browser_view.cc +++ b/atom/browser/api/atom_api_browser_view.cc @@ -75,7 +75,7 @@ void BrowserView::Init(v8::Isolate* isolate, } BrowserView::~BrowserView() { - api_web_contents_->DestroyWebContents(); + api_web_contents_->DestroyWebContents(true /* async */); } // static From 3c58d50f8792652853cec84efdf385da323e763e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 26 Apr 2017 10:44:16 -0700 Subject: [PATCH 10/18] Add failing spec for targetOrigin handling --- spec/chromium-spec.js | 34 +++++++++++++++++++ .../pages/window-opener-targetOrigin.html | 18 ++++++++++ 2 files changed, 52 insertions(+) create mode 100644 spec/fixtures/pages/window-opener-targetOrigin.html diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index d5d1b3f4782a..67448276443b 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -1,4 +1,5 @@ const assert = require('assert') +const fs = require('fs') const http = require('http') const path = require('path') const ws = require('ws') @@ -618,6 +619,39 @@ describe('chromium feature', function () { }) document.body.appendChild(webview) }) + + describe('targetOrigin argument', function () { + let serverURL + let server + + beforeEach(function (done) { + server = http.createServer(function (req, res) { + res.writeHead(200) + const filePath = path.join(fixtures, 'pages', 'window-opener-targetOrigin.html') + res.end(fs.readFileSync(filePath, 'utf8')) + }) + server.listen(0, '127.0.0.1', function () { + serverURL = `http://127.0.0.1:${server.address().port}` + done() + }) + }) + + afterEach(function () { + server.close() + }) + + it('delivers messages that match the origin', function (done) { + let b + listener = function (event) { + window.removeEventListener('message', listener) + b.close() + assert.equal(event.data, 'second message') + done() + } + window.addEventListener('message', listener) + b = window.open(serverURL, '', 'show=no') + }) + }) }) describe('creating a Uint8Array under browser side', function () { diff --git a/spec/fixtures/pages/window-opener-targetOrigin.html b/spec/fixtures/pages/window-opener-targetOrigin.html new file mode 100644 index 000000000000..c4a19fdca2b2 --- /dev/null +++ b/spec/fixtures/pages/window-opener-targetOrigin.html @@ -0,0 +1,18 @@ + + + + + From fa4ec11a1213280c64fe8afc55af56c6e4ab9698 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 26 Apr 2017 10:53:54 -0700 Subject: [PATCH 11/18] Use isSameOrigin helper when posting message --- lib/browser/guest-window-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/guest-window-manager.js b/lib/browser/guest-window-manager.js index e668a3114a5f..ecf4093dcf06 100644 --- a/lib/browser/guest-window-manager.js +++ b/lib/browser/guest-window-manager.js @@ -309,7 +309,7 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', function (event, // The W3C does not seem to have word on how postMessage should work when the // origins do not match, so we do not do |canAccessWindow| check here since // postMessage across origins is useful and not harmful. - if (guestContents.getURL().indexOf(targetOrigin) === 0 || targetOrigin === '*') { + if (targetOrigin === '*' || isSameOrigin(guestContents.getURL(), targetOrigin)) { const sourceId = event.sender.id guestContents.send('ELECTRON_GUEST_WINDOW_POSTMESSAGE', sourceId, message, sourceOrigin) } From efc62629efb5cd2acac7584c5c45513f8f3806ec Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 26 Apr 2017 10:55:38 -0700 Subject: [PATCH 12/18] Fix typo in fixture comment --- spec/fixtures/pages/window-opener-targetOrigin.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/pages/window-opener-targetOrigin.html b/spec/fixtures/pages/window-opener-targetOrigin.html index c4a19fdca2b2..c1f708818411 100644 --- a/spec/fixtures/pages/window-opener-targetOrigin.html +++ b/spec/fixtures/pages/window-opener-targetOrigin.html @@ -3,7 +3,7 @@