зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1626573) for causing lint failures CLOSED TREE
Backed out changeset 0d461e174640 (bug 1626573) Backed out changeset 00443a958bbc (bug 1626573)
This commit is contained in:
Родитель
bc16b67843
Коммит
130b66d511
|
@ -16,8 +16,6 @@ support-files =
|
|||
|
||||
[browser_canvas_view_image.js]
|
||||
[browser_contextmenu_touch.js]
|
||||
[browser_contextmenu_loadblobinnewtab.js]
|
||||
support-files = browser_contextmenu_loadblobinnewtab.html
|
||||
skip-if = true # Bug 1424433, disable due to very high frequency failure rate also on Windows 10
|
||||
[browser_contextmenu_linkopen.js]
|
||||
[browser_contextmenu_iframe.js]
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
|
||||
<body onload="add_content()">
|
||||
<p>This example creates a typed array containing the ASCII codes for the space character through the letter Z, then
|
||||
converts it to an object URL.A link to open that object URL is created. Click the link to see the decoded object
|
||||
URL.</p>
|
||||
<br />
|
||||
<br />
|
||||
<a id='blob-url-link'>Open the array URL</a>
|
||||
<br />
|
||||
<br />
|
||||
<a id='blob-url-referrer-link'>Open the URL that fetches the URL above</a>
|
||||
|
||||
<script>
|
||||
function typedArrayToURL(typedArray, mimeType) {
|
||||
return URL.createObjectURL(new Blob([typedArray.buffer], { type: mimeType }))
|
||||
}
|
||||
|
||||
function add_content() {
|
||||
const bytes = new Uint8Array(59);
|
||||
|
||||
for (let i = 0;i < 59;i++) {
|
||||
bytes[i] = 32 + i;
|
||||
}
|
||||
|
||||
const url = typedArrayToURL(bytes, 'text/plain');
|
||||
document.getElementById('blob-url-link').href = url;
|
||||
|
||||
const ref_url = URL.createObjectURL(new Blob([`
|
||||
<script>
|
||||
fetch("${url}", {headers: {'Content-Type': 'text/plain'}})
|
||||
.then((response) => {
|
||||
response.text().then((textData) => {
|
||||
var pre = document.createElement("pre");
|
||||
pre.textContent = textData.trim();
|
||||
document.body.appendChild(pre);
|
||||
});
|
||||
});
|
||||
<\/script>
|
||||
`], { type: 'text/html' }));
|
||||
|
||||
document.getElementById('blob-url-referrer-link').href = ref_url;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,67 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const RESOURCE_LINK =
|
||||
getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"https://example.com"
|
||||
) + "browser_contextmenu_loadblobinnewtab.html";
|
||||
|
||||
const blobDataAsString = `!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ`;
|
||||
|
||||
// Helper method to open link in new tab and return the content of the first <pre> under <body>
|
||||
// Link is selected by using string argument 'selector' as id
|
||||
async function open_in_new_tab_and_return_content(selector) {
|
||||
const loaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, RESOURCE_LINK);
|
||||
await loaded;
|
||||
|
||||
let generatedBlobURL = await ContentTask.spawn(gBrowser.selectedBrowser, { selector }, async args => {
|
||||
return content.document.getElementById(args.selector).href;
|
||||
});
|
||||
|
||||
const contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
is(contextMenu.state, "closed", "checking if context menu is closed");
|
||||
|
||||
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter('#' + selector, { type: "contextmenu", button: 2 }, gBrowser.selectedBrowser);
|
||||
await awaitPopupShown;
|
||||
|
||||
let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden");
|
||||
|
||||
const openPromise = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
generatedBlobURL,
|
||||
false
|
||||
);
|
||||
|
||||
document.getElementById("context-openlinkintab").doCommand();
|
||||
|
||||
await openPromise;
|
||||
|
||||
let newTab = await BrowserTestUtils.switchTab(gBrowser, gBrowser.tabs[1]);
|
||||
|
||||
contextMenu.hidePopup();
|
||||
await awaitPopupHidden;
|
||||
|
||||
let blobDataFromContent = await ContentTask.spawn(gBrowser.selectedBrowser, null, async function () {
|
||||
return content.document.body.firstElementChild.innerText.trim();
|
||||
});
|
||||
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
|
||||
return blobDataFromContent;
|
||||
}
|
||||
|
||||
add_task(async function test_rightclick_open_bloburl_in_new_tab() {
|
||||
let blobDataFromLoadedPage = await open_in_new_tab_and_return_content('blob-url-link');
|
||||
is(blobDataFromLoadedPage, blobDataAsString, "Should be the same");
|
||||
});
|
||||
|
||||
add_task(async function test_rightclick_open_bloburl_referrer_in_new_tab() {
|
||||
let blobDataFromLoadedPage = await open_in_new_tab_and_return_content('blob-url-referrer-link');
|
||||
is(blobDataFromLoadedPage, blobDataAsString, "Should be the same");
|
||||
});
|
|
@ -1423,8 +1423,6 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
|
|||
}
|
||||
|
||||
if (ContentParent* cp = Canonical()->GetContentParent()) {
|
||||
cp->TransmitBlobDataIfBlobURL(aLoadState->URI(),
|
||||
aLoadState->TriggeringPrincipal());
|
||||
Unused << cp->SendLoadURI(this, aLoadState, aSetNavigating);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5499,18 +5499,6 @@ void ContentParent::TransmitBlobURLsForPrincipal(nsIPrincipal* aPrincipal) {
|
|||
}
|
||||
}
|
||||
|
||||
void ContentParent::TransmitBlobDataIfBlobURL(nsIURI* aURI,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
MOZ_ASSERT(aURI);
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
|
||||
if (!IsBlobURI(aURI)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TransmitBlobURLsForPrincipal(aPrincipal);
|
||||
}
|
||||
|
||||
void ContentParent::EnsurePermissionsByKey(const nsCString& aKey,
|
||||
const nsCString& aOrigin) {
|
||||
// NOTE: Make sure to initialize the permission manager before updating the
|
||||
|
|
|
@ -624,19 +624,6 @@ class ContentParent final
|
|||
|
||||
nsresult TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
// This function is called in BrowsingContext immediately before IPC call to
|
||||
// load a URI. If aURI is a BlobURL, this method transmits all BlobURLs for
|
||||
// aPrincipal that were previously not transmitted. This allows for opening a
|
||||
// locally created BlobURL in a new tab.
|
||||
//
|
||||
// The reason all previously untransmitted Blobs are transmitted is that the
|
||||
// current BlobURL could contain html code, referring to another untransmitted
|
||||
// BlobURL.
|
||||
//
|
||||
// Should eventually be made obsolete by broader design changes that only
|
||||
// store BlobURLs in the parent process.
|
||||
void TransmitBlobDataIfBlobURL(nsIURI* aURI, nsIPrincipal* aPrincipal);
|
||||
|
||||
void OnCompositorDeviceReset() override;
|
||||
|
||||
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
|
||||
|
|
Загрузка…
Ссылка в новой задаче