зеркало из https://github.com/mozilla/pjs.git
Bug 430276, new XMLHttpRequest() after document.write throws an exception, patch2, r+sr=jst, a=beltzner
This commit is contained in:
Родитель
49cf7082a4
Коммит
93242f36db
|
@ -4785,10 +4785,19 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
||||||
|
|
||||||
nsCOMPtr<nsIJSNativeInitializer> initializer(do_QueryInterface(native));
|
nsCOMPtr<nsIJSNativeInitializer> initializer(do_QueryInterface(native));
|
||||||
if (initializer) {
|
if (initializer) {
|
||||||
|
// Initialize object using the current inner window, but only if
|
||||||
|
// the caller can access it.
|
||||||
nsCOMPtr<nsPIDOMWindow> owner = do_QueryReferent(aWeakOwner);
|
nsCOMPtr<nsPIDOMWindow> owner = do_QueryReferent(aWeakOwner);
|
||||||
NS_ENSURE_STATE(owner && owner->GetOuterWindow() &&
|
nsPIDOMWindow* outerWindow = owner ? owner->GetOuterWindow() : nsnull;
|
||||||
owner->GetOuterWindow()->GetCurrentInnerWindow() == owner);
|
nsPIDOMWindow* currentInner =
|
||||||
rv = initializer->Initialize(owner, cx, obj, argc, argv);
|
outerWindow ? outerWindow->GetCurrentInnerWindow() : nsnull;
|
||||||
|
if (!currentInner ||
|
||||||
|
(owner != currentInner &&
|
||||||
|
!nsContentUtils::CanCallerAccess(currentInner))) {
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = initializer->Initialize(currentInner, cx, obj, argc, argv);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ _TEST_FILES = \
|
||||||
test_bug414291.html \
|
test_bug414291.html \
|
||||||
test_bug430276.html \
|
test_bug430276.html \
|
||||||
iframe_bug430276.html \
|
iframe_bug430276.html \
|
||||||
|
iframe_bug430276-2.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_TEST_FILES)
|
libs:: $(_TEST_FILES)
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title></title>
|
||||||
|
<script type="application/javascript">
|
||||||
|
new XMLHttpRequest();
|
||||||
|
function runTest() {
|
||||||
|
document.open();
|
||||||
|
var succeeded = true;
|
||||||
|
try {
|
||||||
|
new XMLHttpRequest();
|
||||||
|
} catch(e) {
|
||||||
|
succeeded = false;
|
||||||
|
}
|
||||||
|
window.parent.ok(succeeded, "Creating XMLHttpRequest failed!");
|
||||||
|
window.parent.SimpleTest.finish();
|
||||||
|
document.close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="runTest()">
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -12,7 +12,7 @@
|
||||||
succeeded = false;
|
succeeded = false;
|
||||||
}
|
}
|
||||||
window.parent.ok(succeeded, "Creating XMLHttpRequest failed!");
|
window.parent.ok(succeeded, "Creating XMLHttpRequest failed!");
|
||||||
window.parent.SimpleTest.finish();
|
window.parent.nextTest();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -25,6 +25,11 @@ function startTest() {
|
||||||
.setAttribute("src", "iframe_bug430276.html");
|
.setAttribute("src", "iframe_bug430276.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextTest() {
|
||||||
|
document.getElementById("testFrame")
|
||||||
|
.setAttribute("src", "iframe_bug430276-2.html");
|
||||||
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addLoadEvent(startTest);
|
addLoadEvent(startTest);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче