From e261b9ea12485ef91ad24774d51e2a3831bb7aec Mon Sep 17 00:00:00 2001 From: bridiver Date: Thu, 15 Jun 2017 19:04:39 -0700 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20add=20the=20tab=20to=20tab=20st?= =?UTF-8?q?ate=20until=20the=20tab=5Fhelper=20has=20updated=20the=20values?= =?UTF-8?q?=20fix=20https://github.com/brave/browser-laptop/issues/9506=20?= =?UTF-8?q?along=20with=20https://github.com/brave/muon/commit/4189da5f457?= =?UTF-8?q?b577ad374ef1a52d619ef2bfbe042=20change=20is=20backwards=20compa?= =?UTF-8?q?tible=20and=20muon=20commit=20is=20not=20required=20for=20mergi?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/browser/tabs.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/app/browser/tabs.js b/app/browser/tabs.js index ee230eb8bd2..1889b01b924 100644 --- a/app/browser/tabs.js +++ b/app/browser/tabs.js @@ -364,19 +364,16 @@ const api = { let displayURL = newTab.getURL() let location = displayURL || 'about:blank' - const openerTabId = !source.isDestroyed() ? source.getId() : -1 - let newTabValue = getTabValue(newTab.getId()) let rendererInitiated = false if (source.isGuest()) { rendererInitiated = true } - let index - if (parseInt(newTabValue.get('index')) > -1) { - index = newTabValue.get('index') - } + const tabId = newTab.getId() + updateWebContents(tabId, newTab) + let newTabValue = getTabValue(newTab.getId()) let windowId if (newTabValue && parseInt(newTabValue.get('windowId')) > -1) { @@ -386,6 +383,11 @@ const api = { windowId = hostWebContents.getOwnerBrowserWindow().id } + let index + if (parseInt(newTabValue.get('index')) > -1) { + index = newTabValue.get('index') + } + const frameOpts = { location, displayURL, @@ -397,14 +399,17 @@ const api = { openerTabId, disposition, index, - tabId: newTabValue.get('id'), + tabId, unloaded: !!newTabValue.get('discarded') } + appActions.tabCreated(newTabValue) + if (disposition === 'new-window' || disposition === 'new-popup') { const windowOpts = makeImmutable(size) appActions.newWindow(makeImmutable(frameOpts), windowOpts) } else { + // TODO(bridiver) - use tabCreated in place of newWebContentsAdded appActions.newWebContentsAdded(windowId, frameOpts, newTabValue) } }) @@ -476,13 +481,6 @@ const api = { windowActions.gotResponseDetails(tabId, {status, newURL, originalURL, httpResponseCode, requestMethod, referrer, headers, resourceType}) } }) - - updateWebContents(tabId, tab) - - let tabValue = getTabValue(tabId) - if (tabValue) { - appActions.tabCreated(tabValue) - } }) process.on('on-tab-created', (tab, options) => {