From 1603e714238becc793f45b199a5d2155d5f7dc68 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Tue, 10 Sep 2019 01:55:01 +0300 Subject: [PATCH 1/3] Bug 1296365 - Show extension name instead of URI in popup windows r=mixedpuppy Reviewers: mixedpuppy Reviewed By: mixedpuppy Bug #: 1296365 Differential Revision: https://phabricator.services.mozilla.com/D45213 --HG-- extra : rebase_source : 348a996d09f03798a75bc98f2828326c6c14b81f extra : histedit_source : 4235913832b36e9be9bb605f336ff213edd47156 --- browser/base/content/tabbrowser.js | 21 +++++-- .../extensions/test/browser/browser.ini | 1 + .../browser_ext_windows_popup_title.js | 55 +++++++++++++++++++ 3 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 917333c0780e8..5e7c135c71408 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -988,14 +988,25 @@ // XXX https://bugzilla.mozilla.org/show_bug.cgi?id=22183#c239 try { if (docElement.getAttribute("chromehidden").includes("location")) { - var uri = Services.uriFixup.createExposableURI(aBrowser.currentURI); - if (uri.scheme == "about") { - newTitle = uri.spec + sep + newTitle; + const uri = Services.uriFixup.createExposableURI(aBrowser.currentURI); + if (uri.scheme === "about") { + newTitle = `${uri.spec}${sep}${newTitle}`; + } else if (uri.scheme === "moz-extension") { + const ext = WebExtensionPolicy.getByHostname(uri.host); + if (ext && ext.name) { + const prefix = document.querySelector("#urlbar-label-extension") + .value; + newTitle = `${prefix} (${ext.name})${sep}${newTitle}`; + } else { + newTitle = `${uri.prePath}${sep}${newTitle}`; + } } else { - newTitle = uri.prePath + sep + newTitle; + newTitle = `${uri.prePath}${sep}${newTitle}`; } } - } catch (e) {} + } catch (e) { + // ignored + } return newTitle; }, diff --git a/toolkit/components/extensions/test/browser/browser.ini b/toolkit/components/extensions/test/browser/browser.ini index 0319951431336..768695ec27c8a 100644 --- a/toolkit/components/extensions/test/browser/browser.ini +++ b/toolkit/components/extensions/test/browser/browser.ini @@ -39,3 +39,4 @@ skip-if = verify [browser_ext_themes_findbar.js] [browser_ext_themes_warnings.js] [browser_ext_themes_highlight.js] +[browser_ext_windows_popup_title.js] diff --git a/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js b/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js new file mode 100644 index 0000000000000..88b7b7871453c --- /dev/null +++ b/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js @@ -0,0 +1,55 @@ +"use strict"; + +// Check that extension popup windows contain the name of the extension +// as well as the title of the loaded document, but not the URL. +add_task(async function test_popup_title() { + const name = "custom_title_number_9_please"; + const docTitle = "popup-test-title"; + + const extension = ExtensionTestUtils.loadExtension({ + manifest: { + name, + permissions: [], + }, + + async background() { + let { id } = await browser.windows.create({ + url: "/index.html", + type: "popup", + }); + + // Called after the outer test code checks the actual window title. + browser.test.onMessage.addListener(() => { + browser.windows.remove(id); + browser.test.notifyPass("popup-window-title"); + }); + + browser.test.sendMessage("check-title", { id }); + }, + files: { + "index.html": `${docTitle}`, + }, + }); + + extension.onMessage("check-title", ({ id }) => { + const { + document: { title }, + } = Services.wm.getOuterWindowWithId(id); + + ok(title.includes(name), "poup title must include extension name"); + ok( + title.includes(docTitle), + "popup title must include extension document title" + ); + ok( + !title.includes("moz-extension:"), + "popup title must not include extension URL" + ); + + extension.sendMessage("all-done"); + }); + + await extension.startup(); + await extension.awaitFinish("popup-window-title"); + await extension.unload(); +}); From 3b51a38a17932079dcdd7d9e7f22c8cd67b269e8 Mon Sep 17 00:00:00 2001 From: Csoregi Natalia Date: Tue, 10 Sep 2019 03:48:29 +0300 Subject: [PATCH 2/3] Backed out changeset 9b3b556ca3d5 (bug 1296365) for failures on browser_ext_windows_popup_title.js. --- browser/base/content/tabbrowser.js | 21 ++----- .../extensions/test/browser/browser.ini | 1 - .../browser_ext_windows_popup_title.js | 55 ------------------- 3 files changed, 5 insertions(+), 72 deletions(-) delete mode 100644 toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 5e7c135c71408..917333c0780e8 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -988,25 +988,14 @@ // XXX https://bugzilla.mozilla.org/show_bug.cgi?id=22183#c239 try { if (docElement.getAttribute("chromehidden").includes("location")) { - const uri = Services.uriFixup.createExposableURI(aBrowser.currentURI); - if (uri.scheme === "about") { - newTitle = `${uri.spec}${sep}${newTitle}`; - } else if (uri.scheme === "moz-extension") { - const ext = WebExtensionPolicy.getByHostname(uri.host); - if (ext && ext.name) { - const prefix = document.querySelector("#urlbar-label-extension") - .value; - newTitle = `${prefix} (${ext.name})${sep}${newTitle}`; - } else { - newTitle = `${uri.prePath}${sep}${newTitle}`; - } + var uri = Services.uriFixup.createExposableURI(aBrowser.currentURI); + if (uri.scheme == "about") { + newTitle = uri.spec + sep + newTitle; } else { - newTitle = `${uri.prePath}${sep}${newTitle}`; + newTitle = uri.prePath + sep + newTitle; } } - } catch (e) { - // ignored - } + } catch (e) {} return newTitle; }, diff --git a/toolkit/components/extensions/test/browser/browser.ini b/toolkit/components/extensions/test/browser/browser.ini index 768695ec27c8a..0319951431336 100644 --- a/toolkit/components/extensions/test/browser/browser.ini +++ b/toolkit/components/extensions/test/browser/browser.ini @@ -39,4 +39,3 @@ skip-if = verify [browser_ext_themes_findbar.js] [browser_ext_themes_warnings.js] [browser_ext_themes_highlight.js] -[browser_ext_windows_popup_title.js] diff --git a/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js b/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js deleted file mode 100644 index 88b7b7871453c..0000000000000 --- a/toolkit/components/extensions/test/browser/browser_ext_windows_popup_title.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -// Check that extension popup windows contain the name of the extension -// as well as the title of the loaded document, but not the URL. -add_task(async function test_popup_title() { - const name = "custom_title_number_9_please"; - const docTitle = "popup-test-title"; - - const extension = ExtensionTestUtils.loadExtension({ - manifest: { - name, - permissions: [], - }, - - async background() { - let { id } = await browser.windows.create({ - url: "/index.html", - type: "popup", - }); - - // Called after the outer test code checks the actual window title. - browser.test.onMessage.addListener(() => { - browser.windows.remove(id); - browser.test.notifyPass("popup-window-title"); - }); - - browser.test.sendMessage("check-title", { id }); - }, - files: { - "index.html": `${docTitle}`, - }, - }); - - extension.onMessage("check-title", ({ id }) => { - const { - document: { title }, - } = Services.wm.getOuterWindowWithId(id); - - ok(title.includes(name), "poup title must include extension name"); - ok( - title.includes(docTitle), - "popup title must include extension document title" - ); - ok( - !title.includes("moz-extension:"), - "popup title must not include extension URL" - ); - - extension.sendMessage("all-done"); - }); - - await extension.startup(); - await extension.awaitFinish("popup-window-title"); - await extension.unload(); -}); From 17db683395c3a6cadfe9e6702e07356e5da6e624 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Tue, 10 Sep 2019 03:52:39 +0300 Subject: [PATCH 3/3] Bug 1579576 - Fix browser_dbg_rr_breakpoints-07.js. r=bhackett Reviewers: bhackett Reviewed By: bhackett Bug #: 1579576 Differential Revision: https://phabricator.services.mozilla.com/D45237 --HG-- extra : rebase_source : 0cd551281b3d161f6916420babdc208571c26a46 --- devtools/client/debugger/src/actions/breakpoints/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/devtools/client/debugger/src/actions/breakpoints/index.js b/devtools/client/debugger/src/actions/breakpoints/index.js index c601437562558..6f1101708ba25 100644 --- a/devtools/client/debugger/src/actions/breakpoints/index.js +++ b/devtools/client/debugger/src/actions/breakpoints/index.js @@ -149,11 +149,10 @@ export function toggleBreakpointsAtLine( export function removeAllBreakpoints(cx: Context) { return async ({ dispatch, getState }: ThunkArgs) => { const breakpointList = getBreakpointsList(getState()); - dispatch({ type: "REMOVE_BREAKPOINTS" }); - - return Promise.all( + await Promise.all( breakpointList.map(bp => dispatch(removeBreakpoint(cx, bp))) ); + dispatch({ type: "REMOVE_BREAKPOINTS" }); }; }