forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge autoland to mozilla-central. a=merge
- Loading branch information
Showing
157 changed files
with
2,278 additions
and
1,879 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
67 changes: 67 additions & 0 deletions
67
browser/components/extensions/test/browser/browser_ext_contentscript_sender_url.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,67 @@ | ||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ | ||
/* vim: set sts=2 sw=2 et tw=80: */ | ||
"use strict"; | ||
|
||
add_task(async function test_sender_url() { | ||
let extension = ExtensionTestUtils.loadExtension({ | ||
manifest: { | ||
content_scripts: [ | ||
{ | ||
matches: ["http://mochi.test/*"], | ||
run_at: "document_start", | ||
js: ["script.js"], | ||
}, | ||
], | ||
}, | ||
|
||
background() { | ||
browser.runtime.onMessage.addListener((msg, sender) => { | ||
browser.test.log("Message received."); | ||
browser.test.sendMessage("sender.url", sender.url); | ||
}); | ||
}, | ||
|
||
files: { | ||
"script.js"() { | ||
browser.test.log("Content script loaded."); | ||
browser.runtime.sendMessage(0); | ||
}, | ||
}, | ||
}); | ||
|
||
const image = | ||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/ctxmenu-image.png"; | ||
|
||
// Bug is only visible and test only works without Fission, | ||
// or with Fission but without BFcache in parent. | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [["fission.bfcacheInParent", false]], | ||
}); | ||
|
||
function awaitNewTab() { | ||
return BrowserTestUtils.waitForLocationChange(gBrowser, "about:newtab"); | ||
} | ||
|
||
await extension.startup(); | ||
|
||
await BrowserTestUtils.withNewTab({ gBrowser }, async browser => { | ||
let newTab = awaitNewTab(); | ||
BrowserTestUtils.loadURI(browser, "about:newtab"); | ||
await newTab; | ||
|
||
BrowserTestUtils.loadURI(browser, image); | ||
let url = await extension.awaitMessage("sender.url"); | ||
is(url, image, `Correct sender.url: ${url}`); | ||
|
||
let wentBack = awaitNewTab(); | ||
await browser.goBack(); | ||
await wentBack; | ||
|
||
await browser.goForward(); | ||
url = await extension.awaitMessage("sender.url"); | ||
is(url, image, `Correct sender.url: ${url}`); | ||
}); | ||
|
||
await extension.unload(); | ||
await SpecialPowers.popPrefEnv(); | ||
}); |
Oops, something went wrong.