mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1407891: Test navigation for right-click view-image on data:image/svg. r=bz
This commit is contained in:
parent
6584da597b
commit
1ea20715d4
@ -9,3 +9,6 @@ support-files =
|
||||
[browser_test_data_text_csv.js]
|
||||
support-files =
|
||||
file_data_text_csv.html
|
||||
[browser_test_view_image_data_navigation.js]
|
||||
support-files =
|
||||
file_view_image_data_navigation.html
|
||||
|
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
const TEST_PAGE = getRootDirectory(gTestPath) + "file_view_image_data_navigation.html";
|
||||
|
||||
add_task(async function test_principal_right_click_open_link_in_new_tab() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.data_uri.block_toplevel_data_uri_navigations", true]],
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab(TEST_PAGE, async function(browser) {
|
||||
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true);
|
||||
|
||||
// simulate right-click->view-image
|
||||
BrowserTestUtils.waitForEvent(document, "popupshown", false, event => {
|
||||
// These are operations that must be executed synchronously with the event.
|
||||
document.getElementById("context-viewimage").doCommand();
|
||||
event.target.hidePopup();
|
||||
return true;
|
||||
});
|
||||
BrowserTestUtils.synthesizeMouseAtCenter("#testimage",
|
||||
{ type: "contextmenu", button: 2 },
|
||||
gBrowser.selectedBrowser);
|
||||
await loadPromise;
|
||||
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
|
||||
ok(content.document.location.toString().startsWith("data:image/svg+xml;"),
|
||||
"data:image/svg navigation allowed through right-click view-image")
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Bug 1407891: Test navigation for right-click view-image on data:image/svg</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<img id="testimage" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg=="></img>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user