Backed out changesets 916dbe7cf99d and 4ae3b6ea1d85 (bug 1104623) for intermittent leaks in the newly-added test.

This commit is contained in:
Ryan VanderMeulen 2014-12-08 13:11:49 -05:00
parent 8cf278a5ca
commit b0e92e85c9
6 changed files with 27 additions and 119 deletions

View File

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

View File

@ -17,7 +17,7 @@ typedef unsigned long nsSecurityFlags;
/**
* 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
{
/**
@ -156,7 +156,7 @@ interface nsILoadInfo : nsISupports
* The contentPolicyType of the channel, used for security checks
* like Mixed Content Blocking and Content Security Policy.
*/
readonly attribute nsContentPolicyType contentPolicyType;
readonly attribute nsContentPolicyType contentPolicyType;
%{ C++
inline nsContentPolicyType GetContentPolicyType()
@ -173,11 +173,5 @@ interface nsILoadInfo : nsISupports
* 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.
*/
readonly attribute nsIURI baseURI;
/**
* A C++-friendly version of baseURI.
*/
[noscript, notxpcom, nostdcall, binaryname(BaseURI)]
nsIURI binaryBaseURI();
readonly attribute nsIURI baseURI;
};

View File

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

View File

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

View File

@ -1,48 +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 blob = new tab.linkedBrowser.contentWindow.Blob(['onmessage = function() { postMessage(true); }']);
ok(blob, "Blob has been created");
let blobURL = tab.linkedBrowser.contentWindow.URL.createObjectURL(blob);
ok(blobURL, "Blob URL has been created");
let worker = new tab.linkedBrowser.contentWindow.Worker(blobURL);
ok(worker, "Worker has been created");
worker.onerror = function(error) {
ok(false, "Worker.onerror:" + error.message);
gBrowser.removeTab(tab);
finish();
}
worker.onmessage = function() {
ok(true, "Worker.onmessage");
gBrowser.removeTab(tab);
finish();
}
worker.postMessage(true);
});
}

View File

@ -200,17 +200,13 @@ NS_NewFileURI(nsIURI* *result,
inline nsresult
NS_NewChannelInternal(nsIChannel** outChannel,
nsIURI* aUri,
nsINode* aRequestingNode,
nsIPrincipal* aRequestingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType,
nsIURI* aBaseURI = nullptr,
nsILoadInfo* aLoadInfo,
nsILoadGroup* aLoadGroup = nullptr,
nsIInterfaceRequestor* aCallbacks = nullptr,
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
nsIIOService* aIoService = nullptr)
{
NS_ASSERTION(aLoadInfo, "Can not create channel without aLoadInfo!");
NS_ENSURE_ARG_POINTER(outChannel);
nsCOMPtr<nsIIOService> grip;
@ -238,31 +234,11 @@ NS_NewChannelInternal(nsIChannel** outChannel,
rv = channel->SetLoadFlags(aLoadFlags | (normalLoadFlags & nsIChannel::LOAD_REPLACE));
NS_ENSURE_SUCCESS(rv, rv);
}
// 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);
channel->SetLoadInfo(aLoadInfo);
// If we're sandboxed, make sure to clear any owner the channel
// might already have.
if (loadInfo->GetLoadingSandboxed()) {
if (aLoadInfo->GetLoadingSandboxed()) {
channel->SetOwner(nullptr);
}
@ -273,27 +249,31 @@ NS_NewChannelInternal(nsIChannel** outChannel,
inline nsresult
NS_NewChannelInternal(nsIChannel** outChannel,
nsIURI* aUri,
nsILoadInfo* aLoadInfo,
nsINode* aRequestingNode,
nsIPrincipal* aRequestingPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType,
nsILoadGroup* aLoadGroup = nullptr,
nsIInterfaceRequestor* aCallbacks = nullptr,
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
nsIIOService* aIoService = nullptr)
{
MOZ_ASSERT(aLoadInfo, "Can not create a channel without a loadInfo");
nsresult rv = NS_NewChannelInternal(outChannel,
aUri,
aLoadInfo->LoadingNode(),
aLoadInfo->LoadingPrincipal(),
aLoadInfo->TriggeringPrincipal(),
aLoadInfo->GetSecurityFlags(),
aLoadInfo->GetContentPolicyType(),
aLoadInfo->BaseURI(),
aLoadGroup,
aCallbacks,
aLoadFlags,
aIoService);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
NS_ASSERTION(aRequestingPrincipal, "Can not create channel without a requesting Principal!");
nsCOMPtr<nsILoadInfo> loadInfo =
new mozilla::LoadInfo(aRequestingPrincipal, aTriggeringPrincipal,
aRequestingNode, aSecurityFlags, aContentPolicyType);
if (!loadInfo) {
return NS_ERROR_UNEXPECTED;
}
return NS_NewChannelInternal(outChannel,
aUri,
loadInfo,
aLoadGroup,
aCallbacks,
aLoadFlags,
aIoService);
}
inline nsresult /*NS_NewChannelWithNodeAndTriggeringPrincipal */
@ -317,7 +297,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
aTriggeringPrincipal,
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags,
@ -344,7 +323,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
aTriggeringPrincipal,
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags,
@ -370,7 +348,6 @@ NS_NewChannel(nsIChannel** outChannel,
nullptr, // aTriggeringPrincipal
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags,
@ -395,7 +372,6 @@ NS_NewChannel(nsIChannel** outChannel,
nullptr, // aTriggeringPrincipal
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags,
@ -430,7 +406,6 @@ NS_OpenURIInternal(nsIInputStream** outStream,
aTriggeringPrincipal,
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags,
@ -987,7 +962,6 @@ NS_NewStreamLoaderInternal(nsIStreamLoader** outStream,
nullptr, // aTriggeringPrincipal
aSecurityFlags,
aContentPolicyType,
nullptr, // aBaseURI
aLoadGroup,
aCallbacks,
aLoadFlags);