зеркало из https://github.com/mozilla/gecko-dev.git
Bug 804446 - Disable the javascript: protocol when it is entered in the location bar of browser in Firefox OS, r=bz
This commit is contained in:
Родитель
45ac26374f
Коммит
66d6229c8f
|
@ -481,11 +481,19 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
|||
|
||||
loadInfo->SetReferrer(referrer);
|
||||
|
||||
// Default flags:
|
||||
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
||||
|
||||
// Flags for browser frame:
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
flags = nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
|
||||
}
|
||||
|
||||
// Kick off the load...
|
||||
bool tmpState = mNeedsAsyncDestroy;
|
||||
mNeedsAsyncDestroy = true;
|
||||
rv = mDocShell->LoadURI(mURIToLoad, loadInfo,
|
||||
nsIWebNavigation::LOAD_FLAGS_NONE, false);
|
||||
rv = mDocShell->LoadURI(mURIToLoad, loadInfo, flags, false);
|
||||
mNeedsAsyncDestroy = tmpState;
|
||||
mURIToLoad = nullptr;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -144,6 +144,9 @@ MOCHITEST_FILES = \
|
|||
file_wyciwyg.html \
|
||||
browserElement_ExposableURI.js \
|
||||
test_browserElement_inproc_ExposableURI.html \
|
||||
browserElement_FrameWrongURI.js \
|
||||
test_browserElement_inproc_FrameWrongURI.html \
|
||||
file_browserElement_FrameWrongURI.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
|
@ -208,6 +211,7 @@ MOCHITEST_FILES += \
|
|||
test_browserElement_oop_DOMRequestError.html \
|
||||
test_browserElement_oop_AppFramePermission.html \
|
||||
test_browserElement_oop_ExposableURI.html \
|
||||
test_browserElement_oop_FrameWrongURI.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
endif #}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 804446 - Test that window.open(javascript:..) works with <iframe mozbrowser>.
|
||||
|
||||
"use strict";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
var iframeJS = document.createElement('iframe');
|
||||
iframeJS.mozbrowser = true;
|
||||
|
||||
iframeJS.addEventListener('mozbrowserloadstart', function(e) {
|
||||
ok(false, "This should not happen!");
|
||||
});
|
||||
|
||||
iframeJS.addEventListener('mozbrowserloadend', function(e) {
|
||||
ok(false, "This should not happen!");
|
||||
});
|
||||
|
||||
iframeJS.src = 'javascript:alert("Foo");';
|
||||
document.body.appendChild(iframeJS);
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
|
||||
var gotPopup = false;
|
||||
iframe.addEventListener('mozbrowseropenwindow', function(e) {
|
||||
is(gotPopup, false, 'Should get just one popup.');
|
||||
gotPopup = true;
|
||||
|
||||
document.body.appendChild(e.detail.frameElement);
|
||||
});
|
||||
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
ok(gotPopup, 'Got mozbrowseropenwindow event before showmodalprompt event.');
|
||||
if (e.detail.message.indexOf("success") == 0) {
|
||||
ok(true, e.detail.message);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
else {
|
||||
ok(false, "Got invalid message: " + e.detail.message);
|
||||
}
|
||||
});
|
||||
|
||||
iframe.src = 'file_browserElement_FrameWrongURI.html';
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
runTest();
|
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
function testSucceeded() { alert("success"); }
|
||||
function callback() { return "<script>opener.testSucceeded()</" + "script>"; }
|
||||
var w = window.open("javascript:opener.callback();");
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test of browser element.</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_FrameWrongURI.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test of browser element.</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_FrameWrongURI.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1054,7 +1054,8 @@ TabChild::RecvLoadURL(const nsCString& uri)
|
|||
SetProcessNameToAppName();
|
||||
|
||||
nsresult rv = mWebNav->LoadURI(NS_ConvertUTF8toUTF16(uri).get(),
|
||||
nsIWebNavigation::LOAD_FLAGS_NONE,
|
||||
nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER,
|
||||
NULL, NULL, NULL);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("mWebNav->LoadURI failed. Eating exception, what else can I do?");
|
||||
|
|
Загрузка…
Ссылка в новой задаче