From f9b60ff8e2c37068f4360036addeb29447c95beb Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 20 Feb 2018 13:43:19 +0100 Subject: [PATCH] Fix for FF58 bug #1402110 Bundled page loaded using browser.windows.create won't show contents unless resized. See https://bugzilla.mozilla.org/show_bug.cgi?id=1402110 --- add-on/src/lib/ipfs-proxy/request-access.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/add-on/src/lib/ipfs-proxy/request-access.js b/add-on/src/lib/ipfs-proxy/request-access.js index eeb0b4c34..9cdbdb65e 100644 --- a/add-on/src/lib/ipfs-proxy/request-access.js +++ b/add-on/src/lib/ipfs-proxy/request-access.js @@ -18,12 +18,17 @@ function createRequestAccess (browser, screen) { const top = Math.round(((screen.width / 2) - (width / 2)) + currentWin.left) const left = Math.round(((screen.height / 2) - (height / 2)) + currentWin.top) - const { tabs } = await browser.windows.create({ url, width, height, top, left, type: 'popup' }) + const dialogWindow = await browser.windows.create({ url, width, height, top, left, type: 'popup' }) + const dialogTabId = dialogWindow.tabs[0].id + // Fix for Fx57 bug where bundled page loaded using + // browser.windows.create won't show contents unless resized. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1402110 + await browser.windows.update(dialogWindow.id, {width: dialogWindow.width + 1}) // Resolves with { allow, wildcard } - const userResponse = getUserResponse(tabs[0].id, scope, permission, opts) + const userResponse = getUserResponse(dialogTabId, scope, permission, opts) // Never resolves, might reject if user closes the tab - const userTabRemoved = getUserTabRemoved(tabs[0].id, scope, permission) + const userTabRemoved = getUserTabRemoved(dialogTabId, scope, permission) let response @@ -35,7 +40,7 @@ function createRequestAccess (browser, screen) { userResponse.destroy() } - await browser.tabs.remove(tabs[0].id) + await browser.tabs.remove(dialogTabId) return response }