зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e5c1679a3856 (bug 906276) on a CLOSED TREE
This commit is contained in:
Родитель
72d048c060
Коммит
2b68b6a2a5
|
@ -761,7 +761,6 @@ nsDocShell::nsDocShell():
|
|||
mAllowMedia(true),
|
||||
mAllowDNSPrefetch(true),
|
||||
mAllowWindowControl(true),
|
||||
mAllowContentRetargeting(true),
|
||||
mCreatingDocument(false),
|
||||
mUseErrorPages(false),
|
||||
mObserveErrorPages(true),
|
||||
|
@ -2347,20 +2346,6 @@ NS_IMETHODIMP nsDocShell::SetAllowWindowControl(bool aAllowWindowControl)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAllowContentRetargeting(bool* aAllowContentRetargeting)
|
||||
{
|
||||
*aAllowContentRetargeting = mAllowContentRetargeting;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting)
|
||||
{
|
||||
mAllowContentRetargeting = aAllowContentRetargeting;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
||||
{
|
||||
|
@ -2884,8 +2869,6 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
|
|||
{
|
||||
SetAllowWindowControl(value);
|
||||
}
|
||||
SetAllowContentRetargeting(
|
||||
parentAsDocShell->GetAllowContentRetargeting());
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value)))
|
||||
{
|
||||
SetIsActive(value);
|
||||
|
@ -7800,8 +7783,6 @@ nsDocShell::RestoreFromHistory()
|
|||
bool allowDNSPrefetch;
|
||||
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
|
||||
|
||||
bool allowContentRetargeting = childShell->GetAllowContentRetargeting();
|
||||
|
||||
// this.AddChild(child) calls child.SetDocLoaderParent(this), meaning
|
||||
// that the child inherits our state. Among other things, this means
|
||||
// that the child inherits our mIsActive and mInPrivateBrowsing, which
|
||||
|
@ -7815,7 +7796,6 @@ nsDocShell::RestoreFromHistory()
|
|||
childShell->SetAllowImages(allowImages);
|
||||
childShell->SetAllowMedia(allowMedia);
|
||||
childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
|
||||
childShell->SetAllowContentRetargeting(allowContentRetargeting);
|
||||
|
||||
rv = childShell->BeginRestore(nullptr, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -9883,14 +9863,9 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel,
|
|||
|
||||
(void) aChannel->SetLoadFlags(loadFlags);
|
||||
|
||||
uint32_t openFlags = 0;
|
||||
if (mLoadType == LOAD_LINK) {
|
||||
openFlags |= nsIURILoader::IS_CONTENT_PREFERRED;
|
||||
}
|
||||
if (!mAllowContentRetargeting) {
|
||||
openFlags |= nsIURILoader::DONT_RETARGET;
|
||||
}
|
||||
rv = aURILoader->OpenURI(aChannel, openFlags, this);
|
||||
rv = aURILoader->OpenURI(aChannel,
|
||||
(mLoadType == LOAD_LINK),
|
||||
this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -812,7 +812,6 @@ protected:
|
|||
bool mAllowMedia;
|
||||
bool mAllowDNSPrefetch;
|
||||
bool mAllowWindowControl;
|
||||
bool mAllowContentRetargeting;
|
||||
bool mCreatingDocument; // (should be) debugging only
|
||||
bool mUseErrorPages;
|
||||
bool mObserveErrorPages;
|
||||
|
|
|
@ -42,7 +42,7 @@ interface nsIVariant;
|
|||
interface nsIPrivacyTransitionObserver;
|
||||
interface nsIReflowObserver;
|
||||
|
||||
[scriptable, builtinclass, uuid(4bb2261b-4c13-44a4-ace3-fc2eec17cc34)]
|
||||
[scriptable, builtinclass, uuid(365e7446-6c4b-45ae-ae08-b7b401900093)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
|
@ -258,13 +258,6 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
*/
|
||||
attribute boolean allowWindowControl;
|
||||
|
||||
/**
|
||||
* True if the docshell allows its content to be handled by a content listener
|
||||
* other than the docshell itself, including the external helper app service,
|
||||
* and false otherwise. Defaults to true.
|
||||
*/
|
||||
[infallible] attribute boolean allowContentRetargeting;
|
||||
|
||||
/**
|
||||
* Get an enumerator over this docShell and its children.
|
||||
*
|
||||
|
|
|
@ -25,7 +25,6 @@ MOCHITEST_FILES = \
|
|||
582176_dummy.html \
|
||||
582176_xml.xml \
|
||||
582176_xslt.xsl \
|
||||
allowContentRetargeting.sjs \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
|
@ -101,7 +100,6 @@ MOCHITEST_CHROME_FILES = \
|
|||
generic.html \
|
||||
test_bug846906.xul \
|
||||
bug846906.html \
|
||||
test_allowContentRetargeting.html \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function handleRequest(req, resp) {
|
||||
resp.setHeader("Content-Type", "application/octet-stream", false);
|
||||
resp.write("hi");
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runNextTest);
|
||||
|
||||
var TEST_URL = "http://mochi.test:8888/tests/docshell/test/chrome/allowContentRetargeting.sjs";
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
function runNextTest() {
|
||||
var test = tests.shift();
|
||||
if (!test) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
test();
|
||||
}
|
||||
|
||||
var tests = [
|
||||
|
||||
// Set allowContentRetargeting = false, load a downloadable URL, verify the
|
||||
// downloadable stops loading.
|
||||
function basic() {
|
||||
var iframe = insertIframe();
|
||||
docshellForWindow(iframe.contentWindow).allowContentRetargeting = false;
|
||||
loadIframe(iframe);
|
||||
},
|
||||
|
||||
// Set allowContentRetargeting = false on parent docshell, load a downloadable
|
||||
// URL, verify the downloadable stops loading.
|
||||
function inherit() {
|
||||
var docshell = docshellForWindow(window);
|
||||
docshell.allowContentRetargeting = false;
|
||||
loadIframe(insertIframe());
|
||||
},
|
||||
];
|
||||
|
||||
function docshellForWindow(win) {
|
||||
return win.
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIWebNavigation).
|
||||
QueryInterface(Ci.nsIDocShell);
|
||||
}
|
||||
|
||||
function insertIframe() {
|
||||
var iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
return iframe;
|
||||
}
|
||||
|
||||
function loadIframe(iframe) {
|
||||
iframe.setAttribute("src", TEST_URL);
|
||||
docshellForWindow(iframe.contentWindow).
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIWebProgress).
|
||||
addProgressListener(progressListener,
|
||||
Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
|
||||
}
|
||||
|
||||
var progressListener = {
|
||||
onStateChange: function (webProgress, req, flags, status) {
|
||||
if (!(flags & Ci.nsIWebProgressListener.STATE_STOP))
|
||||
return;
|
||||
is(Components.isSuccessCode(status), false,
|
||||
"Downloadable should have failed to load");
|
||||
document.querySelector("iframe").remove();
|
||||
runNextTest();
|
||||
},
|
||||
|
||||
QueryInterface: function (iid) {
|
||||
var iids = [
|
||||
Ci.nsIWebProgressListener,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsISupports,
|
||||
];
|
||||
if (iids.some(function (i) { return iid.equals(i); }))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display">
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -92,8 +92,7 @@ function runNextTest()
|
|||
httpserver.identity.primaryPort +
|
||||
set.serverPath);
|
||||
let uriloader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
|
||||
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED,
|
||||
new WindowContext());
|
||||
uriloader.openURI(channel, true, new WindowContext());
|
||||
}
|
||||
|
||||
// sends the responses for the files. sends the same content twice if we resume
|
||||
|
|
|
@ -115,8 +115,7 @@ function runNextTest()
|
|||
httpserver.identity.primaryPort +
|
||||
set.serverURL);
|
||||
let uriloader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
|
||||
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED,
|
||||
new WindowContext());
|
||||
uriloader.openURI(channel, true, new WindowContext());
|
||||
}
|
||||
|
||||
// sends the responses for the files. sends the same content twice if we resume
|
||||
|
|
|
@ -1137,8 +1137,6 @@ function openURL(aURL)
|
|||
var channel = Services.io.newChannelFromURI(uri);
|
||||
var uriLoader = Components.classes["@mozilla.org/uriloader;1"]
|
||||
.getService(Components.interfaces.nsIURILoader);
|
||||
uriLoader.openURI(channel,
|
||||
Components.interfaces.nsIURILoader.IS_CONTENT_PREFERRED,
|
||||
uriListener);
|
||||
uriLoader.openURI(channel, true, uriListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ interface nsIInterfaceRequestor;
|
|||
* or helper app. Or it may hand the url off to an OS registered
|
||||
* application.
|
||||
*/
|
||||
[scriptable, uuid(8762c4e7-be35-4958-9b81-a05685bb516d)]
|
||||
[scriptable, uuid(2f7e8051-f1c9-4bcc-8584-9cfd5849e343)]
|
||||
interface nsIURILoader : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -78,9 +78,9 @@ interface nsIURILoader : nsISupports
|
|||
* The channel that should be opened. This must not be asyncOpen'd yet!
|
||||
* If a loadgroup is set on the channel, it will get replaced with a
|
||||
* different one.
|
||||
* @param aFlags
|
||||
* Combination (bitwise OR) of the flags specified above. 0 indicates
|
||||
* default handling.
|
||||
* @param aIsContentPreferred
|
||||
* Should the content be displayed in a container that prefers the
|
||||
* content-type, or will any container do.
|
||||
* @param aWindowContext
|
||||
* If you are running the url from a doc shell or a web shell, this is
|
||||
* your window context. If you have a content listener you want to
|
||||
|
@ -90,7 +90,7 @@ interface nsIURILoader : nsISupports
|
|||
* <b>Must not be null!</b>
|
||||
*/
|
||||
void openURI(in nsIChannel aChannel,
|
||||
in unsigned long aFlags,
|
||||
in boolean aIsContentPreferred,
|
||||
in nsIInterfaceRequestor aWindowContext);
|
||||
|
||||
/**
|
||||
|
|
|
@ -753,7 +753,7 @@ NS_IMETHODIMP nsURILoader::UnRegisterContentListener(nsIURIContentListener * aCo
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
|
||||
uint32_t aFlags,
|
||||
bool aIsContentPreferred,
|
||||
nsIInterfaceRequestor *aWindowContext)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(channel);
|
||||
|
@ -770,7 +770,7 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
|
|||
|
||||
nsCOMPtr<nsIStreamListener> loader;
|
||||
nsresult rv = OpenChannel(channel,
|
||||
aFlags,
|
||||
aIsContentPreferred ? IS_CONTENT_PREFERRED : 0,
|
||||
aWindowContext,
|
||||
false,
|
||||
getter_AddRefs(loader));
|
||||
|
|
|
@ -86,13 +86,12 @@ nsWebHandlerApp.prototype = {
|
|||
// load the channel
|
||||
var uriLoader = Cc["@mozilla.org/uriloader;1"].
|
||||
getService(Ci.nsIURILoader);
|
||||
// XXX ideally, whether to pass the IS_CONTENT_PREFERRED flag should be
|
||||
// passed in from above. Practically, the flag is probably a reasonable
|
||||
// XXX ideally, aIsContentPreferred (the second param) should really be
|
||||
// passed in from above. Practically, true is probably a reasonable
|
||||
// default since browsers don't care much, and link click is likely to be
|
||||
// the more interesting case for non-browser apps. See
|
||||
// <https://bugzilla.mozilla.org/show_bug.cgi?id=392957#c9> for details.
|
||||
uriLoader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED,
|
||||
aWindowContext);
|
||||
uriLoader.openURI(channel, true, aWindowContext);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ function runChildTestSet(set)
|
|||
sendCommand('\
|
||||
let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null);\
|
||||
let channel = ioservice.newChannelFromURI(uri); \
|
||||
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext()); \
|
||||
uriloader.openURI(channel, true, new WindowContext()); \
|
||||
');
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче