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.
Bug 1875100 - Propagate top level activeness automatically to top des…
…cendants. r=nika,tabbrowser-reviewers,mconley,extension-reviewers,robwu,geckoview-reviewers,owlish,kaya For that, opt in tabbrowser and the shopping sidebar to manual activeness management. Differential Revision: https://phabricator.services.mozilla.com/D198942
- Loading branch information
Showing
18 changed files
with
239 additions
and
79 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
79 changes: 79 additions & 0 deletions
79
browser/components/extensions/test/browser/browser_ext_optionsPage_activity.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,79 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
add_task(async function test_options_activity() { | ||
async function backgroundScript() { | ||
browser.runtime.openOptionsPage(); | ||
} | ||
|
||
function optionsScript() { | ||
browser.test.sendMessage("options-page:loaded", document.documentURI); | ||
} | ||
|
||
let extension = ExtensionTestUtils.loadExtension({ | ||
useAddonManager: "temporary", | ||
|
||
manifest: { | ||
options_ui: { | ||
page: "options.html", | ||
}, | ||
}, | ||
files: { | ||
"options.html": `<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="options.js" type="text/javascript"></script> | ||
</head> | ||
<body style="height: 100px;"> | ||
<h1>Extensions Options</h1> | ||
<a href="https://example.com/options-page-link">options page link</a> | ||
</body> | ||
</html>`, | ||
"options.js": optionsScript, | ||
}, | ||
background: backgroundScript, | ||
}); | ||
|
||
const aboutAddonsTab = await BrowserTestUtils.openNewForegroundTab( | ||
gBrowser, | ||
"about:addons" | ||
); | ||
|
||
await extension.startup(); | ||
|
||
await extension.awaitMessage("options-page:loaded"); | ||
|
||
const optionsBrowser = getInlineOptionsBrowser(gBrowser.selectedBrowser); | ||
|
||
ok( | ||
!optionsBrowser.ownerDocument.hidden, | ||
"Parent should be active since it's in the foreground" | ||
); | ||
ok( | ||
optionsBrowser.docShellIsActive, | ||
"Should be active since we're in the foreground" | ||
); | ||
|
||
let parentVisibilityChange = BrowserTestUtils.waitForEvent( | ||
optionsBrowser.ownerDocument, | ||
"visibilitychange" | ||
); | ||
const aboutBlankTab = await BrowserTestUtils.openNewForegroundTab( | ||
gBrowser, | ||
"about:blank" | ||
); | ||
|
||
await parentVisibilityChange; | ||
ok( | ||
!optionsBrowser.docShellIsActive, | ||
"Should become inactive since parent was backgrounded" | ||
); | ||
|
||
BrowserTestUtils.removeTab(aboutBlankTab); | ||
BrowserTestUtils.removeTab(aboutAddonsTab); | ||
|
||
await extension.unload(); | ||
}); |
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
Oops, something went wrong.