Bug 1880914 - Move BrowserOpenAddonsMgr. r=Gijs,extension-reviewers,settings-reviewers,firefox-desktop-core-reviewers ,home-newtab-reviewers,robwu,thecount
Differential Revision: https://phabricator.services.mozilla.com/D207110
This commit is contained in:
@@ -1107,7 +1107,7 @@ var BrowserAddonUI = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const win = await BrowserOpenAddonsMgr("addons://list/extension");
|
const win = await this.openAddonsMgr("addons://list/extension");
|
||||||
|
|
||||||
win.openAbuseReport({ addonId, reportEntryPoint });
|
win.openAbuseReport({ addonId, reportEntryPoint });
|
||||||
},
|
},
|
||||||
@@ -1137,7 +1137,85 @@ var BrowserAddonUI = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserOpenAddonsMgr("addons://detail/" + encodeURIComponent(addon.id));
|
this.openAddonsMgr("addons://detail/" + encodeURIComponent(addon.id));
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open about:addons page by given view id.
|
||||||
|
* @param {String} aView
|
||||||
|
* View id of page that will open.
|
||||||
|
* e.g. "addons://discover/"
|
||||||
|
* @param {Object} options
|
||||||
|
* {
|
||||||
|
* selectTabByViewId: If true, if there is the tab opening page having
|
||||||
|
* same view id, select the tab. Else if the current
|
||||||
|
* page is blank, load on it. Otherwise, open a new
|
||||||
|
* tab, then load on it.
|
||||||
|
* If false, if there is the tab opening
|
||||||
|
* about:addoons page, select the tab and load page
|
||||||
|
* for view id on it. Otherwise, leave the loading
|
||||||
|
* behavior to switchToTabHavingURI().
|
||||||
|
* If no options, handles as false.
|
||||||
|
* }
|
||||||
|
* @returns {Promise} When the Promise resolves, returns window object loaded the
|
||||||
|
* view id.
|
||||||
|
*/
|
||||||
|
openAddonsMgr(aView, { selectTabByViewId = false } = {}) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let emWindow;
|
||||||
|
let browserWindow;
|
||||||
|
|
||||||
|
const receivePong = function (aSubject) {
|
||||||
|
const browserWin = aSubject.browsingContext.topChromeWindow;
|
||||||
|
if (!emWindow || browserWin == window /* favor the current window */) {
|
||||||
|
if (
|
||||||
|
selectTabByViewId &&
|
||||||
|
aSubject.gViewController.currentViewId !== aView
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emWindow = aSubject;
|
||||||
|
browserWindow = browserWin;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Services.obs.addObserver(receivePong, "EM-pong");
|
||||||
|
Services.obs.notifyObservers(null, "EM-ping");
|
||||||
|
Services.obs.removeObserver(receivePong, "EM-pong");
|
||||||
|
|
||||||
|
if (emWindow) {
|
||||||
|
if (aView && !selectTabByViewId) {
|
||||||
|
emWindow.loadView(aView);
|
||||||
|
}
|
||||||
|
let tab = browserWindow.gBrowser.getTabForBrowser(
|
||||||
|
emWindow.docShell.chromeEventHandler
|
||||||
|
);
|
||||||
|
browserWindow.gBrowser.selectedTab = tab;
|
||||||
|
emWindow.focus();
|
||||||
|
resolve(emWindow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectTabByViewId) {
|
||||||
|
const target = isBlankPageURL(gBrowser.currentURI.spec)
|
||||||
|
? "current"
|
||||||
|
: "tab";
|
||||||
|
openTrustedLinkIn("about:addons", target);
|
||||||
|
} else {
|
||||||
|
// This must be a new load, else the ping/pong would have
|
||||||
|
// found the window above.
|
||||||
|
switchToTabHavingURI("about:addons", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Services.obs.addObserver(function observer(aSubject, aTopic) {
|
||||||
|
Services.obs.removeObserver(observer, aTopic);
|
||||||
|
if (aView) {
|
||||||
|
aSubject.loadView(aView);
|
||||||
|
}
|
||||||
|
aSubject.focus();
|
||||||
|
resolve(aSubject);
|
||||||
|
}, "EM-loaded");
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1551,7 +1629,7 @@ var gUnifiedExtensions = {
|
|||||||
} else {
|
} else {
|
||||||
viewID = "addons://list/extension";
|
viewID = "addons://list/extension";
|
||||||
}
|
}
|
||||||
await BrowserOpenAddonsMgr(viewID);
|
await BrowserAddonUI.openAddonsMgr(viewID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -970,7 +970,7 @@ var BrowserPageActions = {
|
|||||||
this._contextAction = null;
|
this._contextAction = null;
|
||||||
|
|
||||||
let viewID = "addons://detail/" + encodeURIComponent(action.extensionID);
|
let viewID = "addons://detail/" + encodeURIComponent(action.extensionID);
|
||||||
window.BrowserOpenAddonsMgr(viewID);
|
window.BrowserAddonUI.openAddonsMgr(viewID);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
<command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers');"/>
|
<command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers');"/>
|
||||||
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
|
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
|
||||||
<command id="Tools:Downloads" oncommand="BrowserCommands.downloadsUI();"/>
|
<command id="Tools:Downloads" oncommand="BrowserCommands.downloadsUI();"/>
|
||||||
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
|
<command id="Tools:Addons" oncommand="BrowserAddonUI.openAddonsMgr();"/>
|
||||||
<command id="Tools:Sanitize" oncommand="Sanitizer.showUI(window);"/>
|
<command id="Tools:Sanitize" oncommand="Sanitizer.showUI(window);"/>
|
||||||
<command id="Tools:PrivateBrowsing"
|
<command id="Tools:PrivateBrowsing"
|
||||||
oncommand="OpenBrowserWindow({private: true});"/>
|
oncommand="OpenBrowserWindow({private: true});"/>
|
||||||
|
|||||||
@@ -7613,84 +7613,6 @@ var MailIntegration = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Open about:addons page by given view id.
|
|
||||||
* @param {String} aView
|
|
||||||
* View id of page that will open.
|
|
||||||
* e.g. "addons://discover/"
|
|
||||||
* @param {Object} options
|
|
||||||
* {
|
|
||||||
* selectTabByViewId: If true, if there is the tab opening page having
|
|
||||||
* same view id, select the tab. Else if the current
|
|
||||||
* page is blank, load on it. Otherwise, open a new
|
|
||||||
* tab, then load on it.
|
|
||||||
* If false, if there is the tab opening
|
|
||||||
* about:addoons page, select the tab and load page
|
|
||||||
* for view id on it. Otherwise, leave the loading
|
|
||||||
* behavior to switchToTabHavingURI().
|
|
||||||
* If no options, handles as false.
|
|
||||||
* }
|
|
||||||
* @returns {Promise} When the Promise resolves, returns window object loaded the
|
|
||||||
* view id.
|
|
||||||
*/
|
|
||||||
function BrowserOpenAddonsMgr(aView, { selectTabByViewId = false } = {}) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
let emWindow;
|
|
||||||
let browserWindow;
|
|
||||||
|
|
||||||
var receivePong = function (aSubject) {
|
|
||||||
let browserWin = aSubject.browsingContext.topChromeWindow;
|
|
||||||
if (!emWindow || browserWin == window /* favor the current window */) {
|
|
||||||
if (
|
|
||||||
selectTabByViewId &&
|
|
||||||
aSubject.gViewController.currentViewId !== aView
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
emWindow = aSubject;
|
|
||||||
browserWindow = browserWin;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Services.obs.addObserver(receivePong, "EM-pong");
|
|
||||||
Services.obs.notifyObservers(null, "EM-ping");
|
|
||||||
Services.obs.removeObserver(receivePong, "EM-pong");
|
|
||||||
|
|
||||||
if (emWindow) {
|
|
||||||
if (aView && !selectTabByViewId) {
|
|
||||||
emWindow.loadView(aView);
|
|
||||||
}
|
|
||||||
let tab = browserWindow.gBrowser.getTabForBrowser(
|
|
||||||
emWindow.docShell.chromeEventHandler
|
|
||||||
);
|
|
||||||
browserWindow.gBrowser.selectedTab = tab;
|
|
||||||
emWindow.focus();
|
|
||||||
resolve(emWindow);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectTabByViewId) {
|
|
||||||
const target = isBlankPageURL(gBrowser.currentURI.spec)
|
|
||||||
? "current"
|
|
||||||
: "tab";
|
|
||||||
openTrustedLinkIn("about:addons", target);
|
|
||||||
} else {
|
|
||||||
// This must be a new load, else the ping/pong would have
|
|
||||||
// found the window above.
|
|
||||||
switchToTabHavingURI("about:addons", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Services.obs.addObserver(function observer(aSubject, aTopic) {
|
|
||||||
Services.obs.removeObserver(observer, aTopic);
|
|
||||||
if (aView) {
|
|
||||||
aSubject.loadView(aView);
|
|
||||||
}
|
|
||||||
aSubject.focus();
|
|
||||||
resolve(aSubject);
|
|
||||||
}, "EM-loaded");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function AddKeywordForSearchField() {
|
function AddKeywordForSearchField() {
|
||||||
if (!gContextMenu) {
|
if (!gContextMenu) {
|
||||||
throw new Error("Context menu doesn't seem to be open.");
|
throw new Error("Context menu doesn't seem to be open.");
|
||||||
|
|||||||
@@ -92,7 +92,6 @@
|
|||||||
"WindowIsClosing",
|
"WindowIsClosing",
|
||||||
"warnAboutClosingWindow",
|
"warnAboutClosingWindow",
|
||||||
"MailIntegration",
|
"MailIntegration",
|
||||||
"BrowserOpenAddonsMgr",
|
|
||||||
"AddKeywordForSearchField",
|
"AddKeywordForSearchField",
|
||||||
"restoreLastClosedTabOrWindowOrSession",
|
"restoreLastClosedTabOrWindowOrSession",
|
||||||
"undoCloseTab",
|
"undoCloseTab",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ add_task(async function testBlankTabReusedAboutAddons() {
|
|||||||
is(browser, gBrowser.selectedBrowser, "New tab is selected");
|
is(browser, gBrowser.selectedBrowser, "New tab is selected");
|
||||||
|
|
||||||
// Opening about:addons shouldn't change the selected tab.
|
// Opening about:addons shouldn't change the selected tab.
|
||||||
BrowserOpenAddonsMgr();
|
BrowserAddonUI.openAddonsMgr();
|
||||||
|
|
||||||
is(browser, gBrowser.selectedBrowser, "No new tab was opened");
|
is(browser, gBrowser.selectedBrowser, "No new tab was opened");
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ add_task(async function test_sideloading() {
|
|||||||
// Close the hamburger menu and go directly to the addons manager
|
// Close the hamburger menu and go directly to the addons manager
|
||||||
await gCUITestUtils.hideMainMenu();
|
await gCUITestUtils.hideMainMenu();
|
||||||
|
|
||||||
win = await BrowserOpenAddonsMgr(VIEW);
|
win = await BrowserAddonUI.openAddonsMgr(VIEW);
|
||||||
await waitAboutAddonsViewLoaded(win.document);
|
await waitAboutAddonsViewLoaded(win.document);
|
||||||
|
|
||||||
// about:addons addon entry element.
|
// about:addons addon entry element.
|
||||||
@@ -293,7 +293,7 @@ add_task(async function test_sideloading() {
|
|||||||
// Close the hamburger menu and go to the detail page for this addon
|
// Close the hamburger menu and go to the detail page for this addon
|
||||||
await gCUITestUtils.hideMainMenu();
|
await gCUITestUtils.hideMainMenu();
|
||||||
|
|
||||||
win = await BrowserOpenAddonsMgr(
|
win = await BrowserAddonUI.openAddonsMgr(
|
||||||
`addons://detail/${encodeURIComponent(ID3)}`
|
`addons://detail/${encodeURIComponent(ID3)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ async function installFile(filename) {
|
|||||||
MockFilePicker.setFiles([file]);
|
MockFilePicker.setFiles([file]);
|
||||||
MockFilePicker.afterOpenCallback = MockFilePicker.cleanup;
|
MockFilePicker.afterOpenCallback = MockFilePicker.cleanup;
|
||||||
|
|
||||||
let { document } = await BrowserOpenAddonsMgr("addons://list/extension");
|
let { document } = await BrowserAddonUI.openAddonsMgr(
|
||||||
|
"addons://list/extension"
|
||||||
|
);
|
||||||
|
|
||||||
// Do the install...
|
// Do the install...
|
||||||
await waitAboutAddonsViewLoaded(document);
|
await waitAboutAddonsViewLoaded(document);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async function testUpdateNoPrompt(
|
|||||||
is(addon.version, initialVersion, "Version 1 of the addon is installed");
|
is(addon.version, initialVersion, "Version 1 of the addon is installed");
|
||||||
|
|
||||||
// Go to Extensions in about:addons
|
// Go to Extensions in about:addons
|
||||||
let win = await BrowserOpenAddonsMgr("addons://list/extension");
|
let win = await BrowserAddonUI.openAddonsMgr("addons://list/extension");
|
||||||
|
|
||||||
await waitAboutAddonsViewLoaded(win.document);
|
await waitAboutAddonsViewLoaded(win.document);
|
||||||
|
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ async function interactiveUpdateTest(autoUpdate, checkFn) {
|
|||||||
ok(addon, "Addon was installed");
|
ok(addon, "Addon was installed");
|
||||||
is(addon.version, "1.0", "Version 1 of the addon is installed");
|
is(addon.version, "1.0", "Version 1 of the addon is installed");
|
||||||
|
|
||||||
let win = await BrowserOpenAddonsMgr("addons://list/extension");
|
let win = await BrowserAddonUI.openAddonsMgr("addons://list/extension");
|
||||||
|
|
||||||
await waitAboutAddonsViewLoaded(win.document);
|
await waitAboutAddonsViewLoaded(win.document);
|
||||||
|
|
||||||
|
|||||||
@@ -1630,7 +1630,9 @@ BrowserGlue.prototype = {
|
|||||||
"unsignedAddonsDisabled.learnMore.accesskey"
|
"unsignedAddonsDisabled.learnMore.accesskey"
|
||||||
),
|
),
|
||||||
callback() {
|
callback() {
|
||||||
win.BrowserOpenAddonsMgr("addons://list/extension?unsigned=true");
|
win.BrowserAddonUI.openAddonsMgr(
|
||||||
|
"addons://list/extension?unsigned=true"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1376,7 +1376,7 @@ CustomizeMode.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
openAddonsManagerThemes() {
|
openAddonsManagerThemes() {
|
||||||
this.window.BrowserOpenAddonsMgr("addons://list/theme");
|
this.window.BrowserAddonUI.openAddonsMgr("addons://list/theme");
|
||||||
},
|
},
|
||||||
|
|
||||||
getMoreThemes(aEvent) {
|
getMoreThemes(aEvent) {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<toolbarbutton id="unified-extensions-manage-extensions"
|
<toolbarbutton id="unified-extensions-manage-extensions"
|
||||||
class="subviewbutton panel-subview-footer-button unified-extensions-manage-extensions"
|
class="subviewbutton panel-subview-footer-button unified-extensions-manage-extensions"
|
||||||
data-l10n-id="unified-extensions-manage-extensions"
|
data-l10n-id="unified-extensions-manage-extensions"
|
||||||
oncommand="BrowserOpenAddonsMgr('addons://list/extension');" />
|
oncommand="BrowserAddonUI.openAddonsMgr('addons://list/extension');" />
|
||||||
</panelview>
|
</panelview>
|
||||||
</panelmultiview>
|
</panelmultiview>
|
||||||
</panel>
|
</panel>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ add_task(async function test_addon_install() {
|
|||||||
|
|
||||||
add_task(async function test_addon_locked() {
|
add_task(async function test_addon_locked() {
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||||
const win = await BrowserOpenAddonsMgr("addons://list/extension");
|
const win = await BrowserAddonUI.openAddonsMgr("addons://list/extension");
|
||||||
|
|
||||||
await isExtensionLocked(win, ADDON_ID);
|
await isExtensionLocked(win, ADDON_ID);
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ add_task(async function test_addon_install() {
|
|||||||
|
|
||||||
add_task(async function test_addon_locked_update_disabled() {
|
add_task(async function test_addon_locked_update_disabled() {
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||||
const win = await BrowserOpenAddonsMgr(
|
const win = await BrowserAddonUI.openAddonsMgr(
|
||||||
"addons://detail/" + encodeURIComponent(ADDON_ID)
|
"addons://detail/" + encodeURIComponent(ADDON_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ global.openOptionsPage = extension => {
|
|||||||
extension.id
|
extension.id
|
||||||
)}/preferences`;
|
)}/preferences`;
|
||||||
|
|
||||||
return window.BrowserOpenAddonsMgr(viewId);
|
return window.BrowserAddonUI.openAddonsMgr(viewId);
|
||||||
};
|
};
|
||||||
|
|
||||||
global.makeWidgetId = id => {
|
global.makeWidgetId = id => {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class AboutPreferences {
|
|||||||
break;
|
break;
|
||||||
// This is used to open the web extension settings page for an extension
|
// This is used to open the web extension settings page for an extension
|
||||||
case at.OPEN_WEBEXT_SETTINGS:
|
case at.OPEN_WEBEXT_SETTINGS:
|
||||||
action._target.browser.ownerGlobal.BrowserOpenAddonsMgr(
|
action._target.browser.ownerGlobal.BrowserAddonUI.openAddonsMgr(
|
||||||
`addons://detail/${encodeURIComponent(action.data)}`
|
`addons://detail/${encodeURIComponent(action.data)}`
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,17 +54,21 @@ describe("AboutPreferences Feed", () => {
|
|||||||
instance.onAction(action);
|
instance.onAction(action);
|
||||||
assert.calledOnce(action._target.browser.ownerGlobal.openPreferences);
|
assert.calledOnce(action._target.browser.ownerGlobal.openPreferences);
|
||||||
});
|
});
|
||||||
it("should call .BrowserOpenAddonsMgr with the extension id on OPEN_WEBEXT_SETTINGS", () => {
|
it("should call .BrowserAddonUI.openAddonsMgr with the extension id on OPEN_WEBEXT_SETTINGS", () => {
|
||||||
const action = {
|
const action = {
|
||||||
type: at.OPEN_WEBEXT_SETTINGS,
|
type: at.OPEN_WEBEXT_SETTINGS,
|
||||||
data: "foo",
|
data: "foo",
|
||||||
_target: {
|
_target: {
|
||||||
browser: { ownerGlobal: { BrowserOpenAddonsMgr: sinon.spy() } },
|
browser: {
|
||||||
|
ownerGlobal: {
|
||||||
|
BrowserAddonUI: { openAddonsMgr: sinon.spy() },
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
instance.onAction(action);
|
instance.onAction(action);
|
||||||
assert.calledWith(
|
assert.calledWith(
|
||||||
action._target.browser.ownerGlobal.BrowserOpenAddonsMgr,
|
action._target.browser.ownerGlobal.BrowserAddonUI.openAddonsMgr,
|
||||||
"addons://detail/foo"
|
"addons://detail/foo"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4202,7 +4202,7 @@ const AppearanceChooser = {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
break;
|
break;
|
||||||
case "web-appearance-manage-themes-link":
|
case "web-appearance-manage-themes-link":
|
||||||
window.browsingContext.topChromeWindow.BrowserOpenAddonsMgr(
|
window.browsingContext.topChromeWindow.BrowserAddonUI.openAddonsMgr(
|
||||||
"addons://list/theme"
|
"addons://list/theme"
|
||||||
);
|
);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ function init_all() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mainWindow = window.browsingContext.topChromeWindow;
|
let mainWindow = window.browsingContext.topChromeWindow;
|
||||||
mainWindow.BrowserOpenAddonsMgr();
|
mainWindow.BrowserAddonUI.openAddonsMgr();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ let openUrl = url => {
|
|||||||
let openAddonsUrl = url => {
|
let openAddonsUrl = url => {
|
||||||
return () => {
|
return () => {
|
||||||
let window = lazy.BrowserWindowTracker.getTopWindow();
|
let window = lazy.BrowserWindowTracker.getTopWindow();
|
||||||
window.BrowserOpenAddonsMgr(url, { selectTabByViewId: true });
|
window.BrowserAddonUI.openAddonsMgr(url, { selectTabByViewId: true });
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ export var ExtensionsUI = {
|
|||||||
|
|
||||||
showAddonsManager(tabbrowser, strings, icon) {
|
showAddonsManager(tabbrowser, strings, icon) {
|
||||||
let global = tabbrowser.selectedBrowser.ownerGlobal;
|
let global = tabbrowser.selectedBrowser.ownerGlobal;
|
||||||
return global
|
return global.BrowserAddonUI.openAddonsMgr("addons://list/extension").then(
|
||||||
.BrowserOpenAddonsMgr("addons://list/extension")
|
aomWin => {
|
||||||
.then(aomWin => {
|
|
||||||
let aomBrowser = aomWin.docShell.chromeEventHandler;
|
let aomBrowser = aomWin.docShell.chromeEventHandler;
|
||||||
return this.showPermissionsPrompt(aomBrowser, strings, icon);
|
return this.showPermissionsPrompt(aomBrowser, strings, icon);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
showSideloaded(tabbrowser, addon) {
|
showSideloaded(tabbrowser, addon) {
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ var Control = {
|
|||||||
// We've clicked on the extensions process, open or reuse window.
|
// We've clicked on the extensions process, open or reuse window.
|
||||||
let parentWin =
|
let parentWin =
|
||||||
window.docShell.browsingContext.embedderElement.ownerGlobal;
|
window.docShell.browsingContext.embedderElement.ownerGlobal;
|
||||||
parentWin.BrowserOpenAddonsMgr();
|
parentWin.BrowserAddonUI.openAddonsMgr();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Otherwise, proceed.
|
// Otherwise, proceed.
|
||||||
|
|||||||
@@ -1260,7 +1260,7 @@ add_task(async function testGoBackButtonIsDisabledWhenHistoryIsEmpty() {
|
|||||||
// When we have a fresh new tab, `about:addons` is opened in it.
|
// When we have a fresh new tab, `about:addons` is opened in it.
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, null);
|
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, null);
|
||||||
// Simulate a click on "Manage extension" from a context menu.
|
// Simulate a click on "Manage extension" from a context menu.
|
||||||
let win = await BrowserOpenAddonsMgr(viewID);
|
let win = await BrowserAddonUI.openAddonsMgr(viewID);
|
||||||
await assertBackButtonIsDisabled(win);
|
await assertBackButtonIsDisabled(win);
|
||||||
|
|
||||||
BrowserTestUtils.removeTab(tab);
|
BrowserTestUtils.removeTab(tab);
|
||||||
@@ -1288,7 +1288,7 @@ add_task(async function testGoBackButtonIsDisabledWhenHistoryIsEmptyInNewTab() {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
// Simulate a click on "Manage extension" from a context menu.
|
// Simulate a click on "Manage extension" from a context menu.
|
||||||
let win = await BrowserOpenAddonsMgr(viewID);
|
let win = await BrowserAddonUI.openAddonsMgr(viewID);
|
||||||
let addonsTab = await addonsTabLoaded;
|
let addonsTab = await addonsTabLoaded;
|
||||||
await assertBackButtonIsDisabled(win);
|
await assertBackButtonIsDisabled(win);
|
||||||
|
|
||||||
@@ -1309,7 +1309,7 @@ add_task(async function testGoBackButtonIsDisabledAfterBrowserBackButton() {
|
|||||||
// When we have a fresh new tab, `about:addons` is opened in it.
|
// When we have a fresh new tab, `about:addons` is opened in it.
|
||||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, null);
|
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, null);
|
||||||
// Simulate a click on "Manage extension" from a context menu.
|
// Simulate a click on "Manage extension" from a context menu.
|
||||||
let win = await BrowserOpenAddonsMgr(viewID);
|
let win = await BrowserAddonUI.openAddonsMgr(viewID);
|
||||||
await assertBackButtonIsDisabled(win);
|
await assertBackButtonIsDisabled(win);
|
||||||
|
|
||||||
// Navigate to the extensions list.
|
// Navigate to the extensions list.
|
||||||
|
|||||||
Reference in New Issue
Block a user