зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1638007 - Replace WebRequest.jsm with ^headers^ in browser_default_image_filename_redirect.js r=mixedpuppy
This test doesn't need to use WebRequest.jsm, so remove the dependency. Differential Revision: https://phabricator.services.mozilla.com/D77173
This commit is contained in:
Родитель
123b578237
Коммит
b4673f78af
|
@ -26,8 +26,6 @@ support-files =
|
|||
image.jpg
|
||||
image_page.html
|
||||
silentAudioTrack.webm
|
||||
doggy.png
|
||||
firebird.png
|
||||
|
||||
[browser_autoplay_policy.js]
|
||||
support-files =
|
||||
|
@ -109,6 +107,10 @@ run-if = e10s && crashreporter
|
|||
[browser_datetime_datepicker.js]
|
||||
[browser_default_image_filename.js]
|
||||
[browser_default_image_filename_redirect.js]
|
||||
support-files =
|
||||
doggy.png
|
||||
firebird.png
|
||||
firebird.png^headers^
|
||||
[browser_f7_caret_browsing.js]
|
||||
[browser_findbar.js]
|
||||
skip-if = os == "linux" && bits == 64 && os_version = "18.04" # Bug 1614739
|
||||
|
|
|
@ -6,27 +6,12 @@
|
|||
* doggy.png in file picker dialog.
|
||||
*/
|
||||
|
||||
let { WebRequest } = ChromeUtils.import(
|
||||
"resource://gre/modules/WebRequest.jsm"
|
||||
);
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
add_task(async function() {
|
||||
// This URL will redirect to doggy.png.
|
||||
const URL_FIREBIRD =
|
||||
"http://mochi.test:8888/browser/toolkit/content/tests/browser/firebird.png";
|
||||
const URL_DOGGY =
|
||||
"http://mochi.test:8888/browser/toolkit/content/tests/browser/doggy.png";
|
||||
function redirect(requestDetails) {
|
||||
info("Redirecting: " + requestDetails.url);
|
||||
return {
|
||||
redirectUrl: URL_DOGGY,
|
||||
};
|
||||
}
|
||||
WebRequest.onBeforeRequest.addListener(
|
||||
redirect,
|
||||
{ urls: new MatchPatternSet(["http://*/*firebird.png"]) },
|
||||
["blocking"]
|
||||
);
|
||||
|
||||
await BrowserTestUtils.withNewTab(URL_FIREBIRD, async function(browser) {
|
||||
// Click image to show context menu.
|
||||
|
@ -65,6 +50,4 @@ add_task(async function() {
|
|||
contextMenu.hidePopup();
|
||||
await popupHiddenPromise;
|
||||
});
|
||||
|
||||
WebRequest.onBeforeRequest.removeListener(redirect);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
HTTP 302 Found
|
||||
Location: doggy.png
|
Загрузка…
Ссылка в новой задаче