зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1595985 - Add browser.urlbar.closeView webextension API. r=mak,mixedpuppy
This is based on D52612 Differential Revision: https://phabricator.services.mozilla.com/D52792 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8c26b2ef56
Коммит
28e518c9d3
|
@ -135,6 +135,11 @@ this.urlbar = class extends ExtensionAPI {
|
|||
getAPI(context) {
|
||||
return {
|
||||
urlbar: {
|
||||
closeView() {
|
||||
let window = windowTracker.getTopNormalWindow(context);
|
||||
window.gURLBar.view.close();
|
||||
},
|
||||
|
||||
focus(select = false) {
|
||||
let window = windowTracker.getTopNormalWindow(context);
|
||||
if (select) {
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
}
|
||||
},
|
||||
"functions": [
|
||||
{
|
||||
"name": "closeView",
|
||||
"type": "function",
|
||||
"async": true,
|
||||
"description": "Closes the urlbar view in the current window.",
|
||||
"parameters": []
|
||||
},
|
||||
{
|
||||
"name": "focus",
|
||||
"type": "function",
|
||||
|
|
|
@ -424,3 +424,24 @@ add_task(async function focusSelectTrue() {
|
|||
|
||||
await ext.unload();
|
||||
});
|
||||
|
||||
// Tests the closeView function.
|
||||
add_task(async function closeView() {
|
||||
await UrlbarTestUtils.promiseAutocompleteResultPopup({
|
||||
window,
|
||||
waitForFocus,
|
||||
value: "test",
|
||||
});
|
||||
|
||||
let ext = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: ["urlbar"],
|
||||
},
|
||||
isPrivileged: true,
|
||||
background: () => {
|
||||
browser.urlbar.closeView();
|
||||
},
|
||||
});
|
||||
await UrlbarTestUtils.promisePopupClose(window, () => ext.startup());
|
||||
await ext.unload();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче