mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 580030 - the error handler fails silently after a page reload, r=gavin
This commit is contained in:
parent
0ab719f773
commit
c83a2ddfc2
@ -1733,15 +1733,19 @@ HeadsUpDisplay.prototype = {
|
|||||||
makeHTMLNode:
|
makeHTMLNode:
|
||||||
function HUD_makeHTMLNode(aTag)
|
function HUD_makeHTMLNode(aTag)
|
||||||
{
|
{
|
||||||
try {
|
var element;
|
||||||
return this.HTMLFactory(aTag);
|
|
||||||
|
if (this.HTMLFactory) {
|
||||||
|
element = this.HTMLFactory(aTag);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
else {
|
||||||
var ns = ELEMENT_NS;
|
var ns = ELEMENT_NS;
|
||||||
var nsUri = ELEMENT_NS_URI;
|
var nsUri = ELEMENT_NS_URI;
|
||||||
var tag = ns + aTag;
|
var tag = ns + aTag;
|
||||||
return this.chromeDocument.createElementNS(nsUri, tag);
|
element = this.chromeDocument.createElementNS(nsUri, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return element;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +56,7 @@ _BROWSER_TEST_PAGES = \
|
|||||||
test-observe-http-ajax.html \
|
test-observe-http-ajax.html \
|
||||||
test-data.json \
|
test-data.json \
|
||||||
test-property-provider.html \
|
test-property-provider.html \
|
||||||
|
test-error.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_BROWSER_TEST_FILES)
|
libs:: $(_BROWSER_TEST_FILES)
|
||||||
|
@ -66,6 +66,8 @@ const TEST_FILTER_URI = "http://example.com/browser/toolkit/components/console/h
|
|||||||
|
|
||||||
const TEST_PROPERTY_PROVIDER_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-property-provider.html";
|
const TEST_PROPERTY_PROVIDER_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-property-provider.html";
|
||||||
|
|
||||||
|
const TEST_ERROR_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-error.html";
|
||||||
|
|
||||||
function noCacheUriSpec(aUriSpec) {
|
function noCacheUriSpec(aUriSpec) {
|
||||||
return aUriSpec + "?_=" + Date.now();
|
return aUriSpec + "?_=" + Date.now();
|
||||||
}
|
}
|
||||||
@ -591,12 +593,55 @@ function testPageReload() {
|
|||||||
is(typeof console.error, "function", "console.error is a function");
|
is(typeof console.error, "function", "console.error is a function");
|
||||||
is(typeof console.exception, "function", "console.exception is a function");
|
is(typeof console.exception, "function", "console.exception is a function");
|
||||||
|
|
||||||
testEnd();
|
testErrorOnPageReload();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
content.location.reload();
|
content.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testErrorOnPageReload() {
|
||||||
|
// see bug 580030: the error handler fails silently after page reload.
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=580030
|
||||||
|
|
||||||
|
var pageReloaded = false;
|
||||||
|
browser.addEventListener("DOMContentLoaded", function onDOMLoad() {
|
||||||
|
if (!pageReloaded) {
|
||||||
|
pageReloaded = true;
|
||||||
|
content.location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.removeEventListener("DOMContentLoaded", onDOMLoad, false);
|
||||||
|
|
||||||
|
// dispatch a click event to the button in the test page.
|
||||||
|
var contentDocument = browser.contentDocument.wrappedJSObject;
|
||||||
|
var button = contentDocument.getElementsByTagName("button")[0];
|
||||||
|
var clickEvent = contentDocument.createEvent("MouseEvents");
|
||||||
|
clickEvent.initMouseEvent("click", true, true,
|
||||||
|
browser.contentWindow.wrappedJSObject, 0, 0, 0, 0, 0, false, false,
|
||||||
|
false, false, 0, null);
|
||||||
|
|
||||||
|
var successMsg = "Found the error message after page reload";
|
||||||
|
var errMsg = "Could not get the error message after page reload";
|
||||||
|
|
||||||
|
var display = HUDService.getDisplayByURISpec(content.location.href);
|
||||||
|
var outputNode = display.querySelectorAll(".hud-output-node")[0];
|
||||||
|
|
||||||
|
button.addEventListener("click", function onClickHandler() {
|
||||||
|
button.removeEventListener("click", onClickHandler, false);
|
||||||
|
|
||||||
|
testLogEntry(outputNode, "fooBazBaz",
|
||||||
|
{ success: successMsg, err: errMsg });
|
||||||
|
|
||||||
|
testEnd();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
button.dispatchEvent(clickEvent);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
content.location.href = TEST_ERROR_URI;
|
||||||
|
}
|
||||||
|
|
||||||
function testEnd() {
|
function testEnd() {
|
||||||
// testUnregister();
|
// testUnregister();
|
||||||
executeSoon(function () {
|
executeSoon(function () {
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title>Console error test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Heads Up Display - error test</h1>
|
||||||
|
<p><button>generate error</button></p>
|
||||||
|
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
var button = document.getElementsByTagName("button")[0];
|
||||||
|
|
||||||
|
button.addEventListener("click", function () {
|
||||||
|
fooBazBaz.bar();
|
||||||
|
}, false);
|
||||||
|
// --></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user