Backed out changesets c63a0dc3e90f and 5b53df2993fa (bug 1104623) for leaks.

--HG--
extra : rebase_source : cb4ed2e9e43d8d937f75561534f26081e694c964
This commit is contained in:
Ryan VanderMeulen 2014-12-11 13:12:08 -05:00
Родитель 7453d8f97d
Коммит 9e63d16fb6
6 изменённых файлов: 27 добавлений и 122 удалений

Просмотреть файл

@ -122,10 +122,4 @@ LoadInfo::GetBaseURI(nsIURI** aBaseURI)
return NS_OK; return NS_OK;
} }
nsIURI*
LoadInfo::BaseURI()
{
return mBaseURI;
}
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -17,7 +17,7 @@ typedef unsigned long nsSecurityFlags;
/** /**
* An nsILoadOwner represents per-load information about who started the load. * An nsILoadOwner represents per-load information about who started the load.
*/ */
[scriptable, builtinclass, uuid(768a1f20-57d4-462a-812a-41c04e5d1e19)] [scriptable, builtinclass, uuid(da363267-236d-49bf-83a2-33da8d892728)]
interface nsILoadInfo : nsISupports interface nsILoadInfo : nsISupports
{ {
/** /**
@ -156,7 +156,7 @@ interface nsILoadInfo : nsISupports
* The contentPolicyType of the channel, used for security checks * The contentPolicyType of the channel, used for security checks
* like Mixed Content Blocking and Content Security Policy. * like Mixed Content Blocking and Content Security Policy.
*/ */
readonly attribute nsContentPolicyType contentPolicyType; readonly attribute nsContentPolicyType contentPolicyType;
%{ C++ %{ C++
inline nsContentPolicyType GetContentPolicyType() inline nsContentPolicyType GetContentPolicyType()
@ -173,11 +173,5 @@ interface nsILoadInfo : nsISupports
* This attribute may be null. The value of this attribute may be * This attribute may be null. The value of this attribute may be
* ignored if the base URI can be inferred by the channel's URI. * ignored if the base URI can be inferred by the channel's URI.
*/ */
readonly attribute nsIURI baseURI; readonly attribute nsIURI baseURI;
/**
* A C++-friendly version of baseURI.
*/
[noscript, notxpcom, nostdcall, binaryname(BaseURI)]
nsIURI binaryBaseURI();
}; };

Просмотреть файл

@ -107,5 +107,3 @@ MOCHITEST_MANIFESTS += [
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini'] XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

Просмотреть файл

@ -1,4 +0,0 @@
[DEFAULT]
[browser_bug1104623.js]
run-if = buildapp == 'browser'

Просмотреть файл

@ -1,51 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function whenBrowserLoaded(aBrowser, aCallback) {
aBrowser.addEventListener("load", function onLoad(event) {
if (event.target == aBrowser.contentDocument) {
aBrowser.removeEventListener("load", onLoad, true);
executeSoon(aCallback);
}
}, true);
}
function test() {
waitForExplicitFinish();
let testURL = "chrome://mochitests/content/chrome/dom/base/test/file_empty.html";
let tab = gBrowser.addTab(testURL);
gBrowser.selectedTab = tab;
whenBrowserLoaded(tab.linkedBrowser, function() {
let doc = tab.linkedBrowser.contentDocument;
let contentWin = tab.linkedBrowser.contentWindow;
let blob = new contentWin.Blob(['onmessage = function() { postMessage(true); }']);
ok(blob, "Blob has been created");
let blobURL = contentWin.URL.createObjectURL(blob);
ok(blobURL, "Blob URL has been created");
let worker = new contentWin.Worker(blobURL);
ok(worker, "Worker has been created");
worker.onerror = function(error) {
ok(false, "Worker.onerror:" + error.message);
contentWin.URL.revokeObjectURL(blob);
gBrowser.removeTab(tab);
executeSoon(finish);
}
worker.onmessage = function() {
ok(true, "Worker.onmessage");
contentWin.URL.revokeObjectURL(blob);
gBrowser.removeTab(tab);
executeSoon(finish);
}
worker.postMessage(true);
});
}

Просмотреть файл

@ -200,17 +200,13 @@ NS_NewFileURI(nsIURI* *result,
inline nsresult inline nsresult
NS_NewChannelInternal(nsIChannel** outChannel, NS_NewChannelInternal(nsIChannel** outChannel,
nsIURI* aUri, nsIURI* aUri,
nsINode* aRequestingNode, nsILoadInfo* aLoadInfo,
nsIPrincipal* aRequestingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType,
nsIURI* aBaseURI = nullptr,
nsILoadGroup* aLoadGroup = nullptr, nsILoadGroup* aLoadGroup = nullptr,
nsIInterfaceRequestor* aCallbacks = nullptr, nsIInterfaceRequestor* aCallbacks = nullptr,
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
nsIIOService* aIoService = nullptr) nsIIOService* aIoService = nullptr)
{ {
NS_ASSERTION(aLoadInfo, "Can not create channel without aLoadInfo!");
NS_ENSURE_ARG_POINTER(outChannel); NS_ENSURE_ARG_POINTER(outChannel);
nsCOMPtr<nsIIOService> grip; nsCOMPtr<nsIIOService> grip;
@ -238,31 +234,11 @@ NS_NewChannelInternal(nsIChannel** outChannel,
rv = channel->SetLoadFlags(aLoadFlags | (normalLoadFlags & nsIChannel::LOAD_REPLACE)); rv = channel->SetLoadFlags(aLoadFlags | (normalLoadFlags & nsIChannel::LOAD_REPLACE));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
channel->SetLoadInfo(aLoadInfo);
// Some channels might already have a loadInfo attached at this
// point (see bug 1104623). We have to make sure to update
// security flags in such cases before we set the loadinfo.
// Once bug 1087442 lands, this problem disappears because we
// attach the loadinfo in each individual protocol handler.
nsCOMPtr<nsILoadInfo> loadInfo;
channel->GetLoadInfo(getter_AddRefs(loadInfo));
if (loadInfo) {
aSecurityFlags |= loadInfo->GetSecurityFlags();
}
// create a new Loadinfo with the potentially updated securityFlags
loadInfo =
new mozilla::LoadInfo(aRequestingPrincipal, aTriggeringPrincipal,
aRequestingNode, aSecurityFlags,
aContentPolicyType, aBaseURI);
if (!loadInfo) {
return NS_ERROR_UNEXPECTED;
}
channel->SetLoadInfo(loadInfo);
// If we're sandboxed, make sure to clear any owner the channel // If we're sandboxed, make sure to clear any owner the channel
// might already have. // might already have.
if (loadInfo->GetLoadingSandboxed()) { if (aLoadInfo->GetLoadingSandboxed()) {
channel->SetOwner(nullptr); channel->SetOwner(nullptr);
} }
@ -273,27 +249,31 @@ NS_NewChannelInternal(nsIChannel** outChannel,
inline nsresult inline nsresult
NS_NewChannelInternal(nsIChannel** outChannel, NS_NewChannelInternal(nsIChannel** outChannel,
nsIURI* aUri, nsIURI* aUri,
nsILoadInfo* aLoadInfo, nsINode* aRequestingNode,
nsIPrincipal* aRequestingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType,
nsILoadGroup* aLoadGroup = nullptr, nsILoadGroup* aLoadGroup = nullptr,
nsIInterfaceRequestor* aCallbacks = nullptr, nsIInterfaceRequestor* aCallbacks = nullptr,
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL, nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
nsIIOService* aIoService = nullptr) nsIIOService* aIoService = nullptr)
{ {
MOZ_ASSERT(aLoadInfo, "Can not create a channel without a loadInfo"); NS_ASSERTION(aRequestingPrincipal, "Can not create channel without a requesting Principal!");
nsresult rv = NS_NewChannelInternal(outChannel,
aUri, nsCOMPtr<nsILoadInfo> loadInfo =
aLoadInfo->LoadingNode(), new mozilla::LoadInfo(aRequestingPrincipal, aTriggeringPrincipal,
aLoadInfo->LoadingPrincipal(), aRequestingNode, aSecurityFlags, aContentPolicyType);
aLoadInfo->TriggeringPrincipal(), if (!loadInfo) {
aLoadInfo->GetSecurityFlags(), return NS_ERROR_UNEXPECTED;
aLoadInfo->GetContentPolicyType(), }
aLoadInfo->BaseURI(), return NS_NewChannelInternal(outChannel,
aLoadGroup, aUri,
aCallbacks, loadInfo,
aLoadFlags, aLoadGroup,
aIoService); aCallbacks,
NS_ENSURE_SUCCESS(rv, rv); aLoadFlags,
return NS_OK; aIoService);
} }
inline nsresult /*NS_NewChannelWithNodeAndTriggeringPrincipal */ inline nsresult /*NS_NewChannelWithNodeAndTriggeringPrincipal */
@ -317,7 +297,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
aTriggeringPrincipal, aTriggeringPrincipal,
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags, aLoadFlags,
@ -344,7 +323,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
aTriggeringPrincipal, aTriggeringPrincipal,
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags, aLoadFlags,
@ -370,7 +348,6 @@ NS_NewChannel(nsIChannel** outChannel,
nullptr, // aTriggeringPrincipal nullptr, // aTriggeringPrincipal
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags, aLoadFlags,
@ -395,7 +372,6 @@ NS_NewChannel(nsIChannel** outChannel,
nullptr, // aTriggeringPrincipal nullptr, // aTriggeringPrincipal
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags, aLoadFlags,
@ -430,7 +406,6 @@ NS_OpenURIInternal(nsIInputStream** outStream,
aTriggeringPrincipal, aTriggeringPrincipal,
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags, aLoadFlags,
@ -987,7 +962,6 @@ NS_NewStreamLoaderInternal(nsIStreamLoader** outStream,
nullptr, // aTriggeringPrincipal nullptr, // aTriggeringPrincipal
aSecurityFlags, aSecurityFlags,
aContentPolicyType, aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup, aLoadGroup,
aCallbacks, aCallbacks,
aLoadFlags); aLoadFlags);