forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge mozilla-inboudn to mozilla-central a=merge
- Loading branch information
Showing
624 changed files
with
14,304 additions
and
6,403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage_uninstall.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ | ||
/* vim: set sts=2 sw=2 et tw=80: */ | ||
"use strict"; | ||
|
||
function* loadExtension(options) { | ||
let extension = ExtensionTestUtils.loadExtension({ | ||
useAddonManager: "temporary", | ||
|
||
manifest: Object.assign({ | ||
"permissions": ["tabs"], | ||
}, options.manifest), | ||
|
||
files: { | ||
"options.html": `<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="options.js" type="text/javascript"></script> | ||
</head> | ||
</html>`, | ||
|
||
"options.js": function() { | ||
browser.runtime.sendMessage("options.html"); | ||
browser.runtime.onMessage.addListener((msg, sender, respond) => { | ||
if (msg == "ping") { | ||
respond("pong"); | ||
} | ||
}); | ||
}, | ||
}, | ||
|
||
background: options.background, | ||
}); | ||
|
||
yield extension.startup(); | ||
|
||
return extension; | ||
} | ||
|
||
add_task(function* test_inline_options_uninstall() { | ||
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/"); | ||
|
||
let extension = yield loadExtension({ | ||
manifest: { | ||
"options_ui": { | ||
"page": "options.html", | ||
}, | ||
}, | ||
|
||
background: function() { | ||
let _optionsPromise; | ||
let awaitOptions = () => { | ||
browser.test.assertFalse(_optionsPromise, "Should not be awaiting options already"); | ||
|
||
return new Promise(resolve => { | ||
_optionsPromise = {resolve}; | ||
}); | ||
}; | ||
|
||
browser.runtime.onMessage.addListener((msg, sender) => { | ||
if (msg == "options.html") { | ||
if (_optionsPromise) { | ||
_optionsPromise.resolve(sender.tab); | ||
_optionsPromise = null; | ||
} else { | ||
browser.test.fail("Saw unexpected options page load"); | ||
} | ||
} | ||
}); | ||
|
||
let firstTab; | ||
browser.tabs.query({currentWindow: true, active: true}).then(tabs => { | ||
firstTab = tabs[0].id; | ||
|
||
browser.test.log("Open options page. Expect fresh load."); | ||
return Promise.all([ | ||
browser.runtime.openOptionsPage(), | ||
awaitOptions(), | ||
]); | ||
}).then(([, tab]) => { | ||
browser.test.assertEq("about:addons", tab.url, "Tab contains AddonManager"); | ||
browser.test.assertTrue(tab.active, "Tab is active"); | ||
browser.test.assertTrue(tab.id != firstTab, "Tab is a new tab"); | ||
|
||
browser.test.sendMessage("options-ui-open"); | ||
}).catch(error => { | ||
browser.test.fail(`Error: ${error} :: ${error.stack}`); | ||
}); | ||
}, | ||
}); | ||
|
||
yield extension.awaitMessage("options-ui-open"); | ||
yield extension.unload(); | ||
|
||
is(gBrowser.selectedBrowser.currentURI.spec, "about:addons", | ||
"Add-on manager tab should still be open"); | ||
|
||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); | ||
|
||
yield BrowserTestUtils.removeTab(tab); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.