Bug 768842 - Inform the <iframe mozbrowser> embedder when Gecko displays an error page. r=mounir

This commit is contained in:
Justin Lebar 2012-07-02 08:21:58 -04:00
Родитель 9a64c367a1
Коммит 9b540124cd
6 изменённых файлов: 65 добавлений и 0 удалений

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

@ -512,6 +512,14 @@ BrowserElementChild.prototype = {
if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
sendAsyncMsg('loadend');
if (status == Cr.NS_OK) {
return;
}
// TODO See nsDocShell::DisplayLoadError for a list of all the error
// codes (the status param) we should eventually handle here.
sendAsyncMsg('error', {type: 'other'});
}
},

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

@ -148,6 +148,7 @@ function BrowserElementParent(frameLoader) {
addMessageListener("iconchange", this._fireEventFromMsg);
addMessageListener("close", this._fireEventFromMsg);
addMessageListener("securitychange", this._fireEventFromMsg);
addMessageListener("error", this._fireEventFromMsg);
addMessageListener("get-mozapp-manifest-url", this._sendMozAppManifestURL);
addMessageListener("keyevent", this._fireKeyEvent);
addMessageListener("showmodalprompt", this._handleShowModalPrompt);

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

@ -28,6 +28,8 @@ _TEST_FILES = \
test_browserElement_inproc_LoadEvents.html \
browserElement_DataURI.js \
test_browserElement_inproc_DataURI.html \
browserElement_ErrorSecurity.js \
test_browserElement_inproc_ErrorSecurity.html \
browserElement_Titlechange.js \
test_browserElement_inproc_Titlechange.html \
browserElement_TopBarrier.js \
@ -77,6 +79,7 @@ ifneq ($(OS_ARCH),WINNT)
_TEST_FILES += \
test_browserElement_oop_LoadEvents.html \
test_browserElement_oop_DataURI.html \
test_browserElement_oop_ErrorSecurity.html \
test_browserElement_oop_Titlechange.html \
test_browserElement_oop_TopBarrier.html \
test_browserElement_oop_Iconchange.html \

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

@ -0,0 +1,27 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 764718 - Test that mozbrowsererror works for a security error.
"use strict";
SimpleTest.waitForExplicitFinish();
function runTest() {
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addToWhitelist();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
iframe.addEventListener("mozbrowsererror", function(e) {
ok(true, "Got mozbrowsererror event.");
ok(e.detail.type, "Event's detail has a |type| param.");
SimpleTest.finish();
});
iframe.src = "https://expired.example.com";
document.body.appendChild(iframe);
}
runTest();

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

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for mozbrowser</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_ErrorSecurity.js">
</script>
</body>
</html>

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

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for mozbrowser</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_ErrorSecurity.js">
</script>
</body>
</html>