mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 300992 - implement readystatechange event. r=smaug, sr=jst
This commit is contained in:
parent
8bad154a2f
commit
cc4019ac75
@ -495,6 +495,7 @@ nsContentUtils::InitializeEventTable() {
|
||||
{ nsGkAtoms::onunload, NS_PAGE_UNLOAD,
|
||||
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
|
||||
{ nsGkAtoms::onhashchange, NS_HASHCHANGE, EventNameType_HTMLXUL, NS_EVENT },
|
||||
{ nsGkAtoms::onreadystatechange, NS_READYSTATECHANGE, EventNameType_HTMLXUL },
|
||||
{ nsGkAtoms::onbeforeunload, NS_BEFORE_PAGE_UNLOAD, EventNameType_HTMLXUL, NS_EVENT },
|
||||
{ nsGkAtoms::onabort, NS_IMAGE_ABORT,
|
||||
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
|
||||
|
@ -70,6 +70,7 @@
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsPLDOMEvent.h"
|
||||
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsDOMAttribute.h"
|
||||
@ -7318,7 +7319,12 @@ void
|
||||
nsDocument::SetReadyStateInternal(ReadyState rs)
|
||||
{
|
||||
mReadyState = rs;
|
||||
// TODO fire "readystatechange"
|
||||
|
||||
nsRefPtr<nsPLDOMEvent> plevent =
|
||||
new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE);
|
||||
if (plevent) {
|
||||
plevent->RunDOMEventWhenSafe();
|
||||
}
|
||||
}
|
||||
|
||||
nsIDocument::ReadyState
|
||||
|
@ -679,6 +679,7 @@ GK_ATOM(onpopuphidden, "onpopuphidden")
|
||||
GK_ATOM(onpopuphiding, "onpopuphiding")
|
||||
GK_ATOM(onpopupshowing, "onpopupshowing")
|
||||
GK_ATOM(onpopupshown, "onpopupshown")
|
||||
GK_ATOM(onreadystatechange, "onreadystatechange")
|
||||
GK_ATOM(onRequest, "onRequest")
|
||||
GK_ATOM(onreset, "onreset")
|
||||
GK_ATOM(onresize, "onresize")
|
||||
|
@ -394,6 +394,7 @@ _TEST_FILES2 = \
|
||||
test_html_colors_quirks.html \
|
||||
test_html_colors_standards.html \
|
||||
test_bug571390.xul \
|
||||
test_bug300992.html \
|
||||
test_websocket_hello.html \
|
||||
file_websocket_hello_wsh.py \
|
||||
test_ws_basic_tests.html \
|
||||
|
46
content/base/test/test_bug300992.html
Normal file
46
content/base/test/test_bug300992.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=300992
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 300992</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300992">Mozilla Bug 300992</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 300992 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var i = 0;
|
||||
var states = ['loading',
|
||||
'interactive1', 'interactive2',
|
||||
'complete1', 'complete2'];
|
||||
|
||||
is(document.readyState, states[i++], 'initial readyState');
|
||||
document.onreadystatechange = function (event) {
|
||||
is(document.readyState + '1', states[i++], 'readystatechange event "on" handler');
|
||||
};
|
||||
document.addEventListener('readystatechange', function(event) {
|
||||
is(document.readyState + '2', states[i++], 'readystatechange event document listener');
|
||||
}, false);
|
||||
window.addEventListener('readystatechange', function(event) {
|
||||
ok(false, 'window listener', 'readystatechange event should not bubble to window');
|
||||
}, false);
|
||||
setTimeout(function() {
|
||||
is(i, states.length, 'readystatechange event count');
|
||||
SimpleTest.finish();
|
||||
}, 1000);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -59,8 +59,9 @@
|
||||
static const char* const sEventNames[] = {
|
||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||
"mouseout", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "popstate", "beforeunload", "unload", "hashchange",
|
||||
"abort", "error", "submit", "reset", "change", "select", "input", "text",
|
||||
"focus", "blur", "load", "popstate", "beforeunload", "unload",
|
||||
"hashchange", "readystatechange", "abort", "error",
|
||||
"submit", "reset", "change", "select", "input", "text",
|
||||
"compositionstart", "compositionend", "popupshowing", "popupshown",
|
||||
"popuphiding", "popuphidden", "close", "command", "broadcast", "commandupdate",
|
||||
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture",
|
||||
@ -1100,6 +1101,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
||||
return sEventNames[eDOMEvents_unload];
|
||||
case NS_HASHCHANGE:
|
||||
return sEventNames[eDOMEvents_hashchange];
|
||||
case NS_READYSTATECHANGE:
|
||||
return sEventNames[eDOMEvents_readystatechange];
|
||||
case NS_IMAGE_ABORT:
|
||||
return sEventNames[eDOMEvents_abort];
|
||||
case NS_LOAD_ERROR:
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
eDOMEvents_beforeunload,
|
||||
eDOMEvents_unload,
|
||||
eDOMEvents_hashchange,
|
||||
eDOMEvents_readystatechange,
|
||||
eDOMEvents_abort,
|
||||
eDOMEvents_error,
|
||||
eDOMEvents_submit,
|
||||
|
@ -1532,6 +1532,7 @@ jsval nsDOMClassInfo::sOnpopstate_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnbeforeunload_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnunload_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnhashchange_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnreadystatechange_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnpageshow_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnpagehide_id = JSVAL_VOID;
|
||||
jsval nsDOMClassInfo::sOnabort_id = JSVAL_VOID;
|
||||
@ -1733,6 +1734,7 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
|
||||
SET_JSVAL_TO_STRING(sOnbeforeunload_id, cx, "onbeforeunload");
|
||||
SET_JSVAL_TO_STRING(sOnunload_id, cx, "onunload");
|
||||
SET_JSVAL_TO_STRING(sOnhashchange_id, cx, "onhashchange");
|
||||
SET_JSVAL_TO_STRING(sOnreadystatechange_id, cx, "onreadystatechange");
|
||||
SET_JSVAL_TO_STRING(sOnpageshow_id, cx, "onpageshow");
|
||||
SET_JSVAL_TO_STRING(sOnpagehide_id, cx, "onpagehide");
|
||||
SET_JSVAL_TO_STRING(sOnabort_id, cx, "onabort");
|
||||
@ -4709,6 +4711,7 @@ nsDOMClassInfo::ShutDown()
|
||||
sOnbeforeunload_id = JSVAL_VOID;
|
||||
sOnunload_id = JSVAL_VOID;
|
||||
sOnhashchange_id = JSVAL_VOID;
|
||||
sOnreadystatechange_id = JSVAL_VOID;
|
||||
sOnpageshow_id = JSVAL_VOID;
|
||||
sOnpagehide_id = JSVAL_VOID;
|
||||
sOnabort_id = JSVAL_VOID;
|
||||
@ -7646,7 +7649,8 @@ nsEventReceiverSH::ReallyIsEventName(jsval id, jschar aFirstChar)
|
||||
id == sOnmouseup_id ||
|
||||
id == sOnmousedown_id);
|
||||
case 'r' :
|
||||
return (id == sOnreset_id ||
|
||||
return (id == sOnreadystatechange_id ||
|
||||
id == sOnreset_id ||
|
||||
id == sOnresize_id);
|
||||
case 's' :
|
||||
return (id == sOnscroll_id ||
|
||||
|
@ -321,6 +321,7 @@ protected:
|
||||
static jsval sOnbeforeunload_id;
|
||||
static jsval sOnunload_id;
|
||||
static jsval sOnhashchange_id;
|
||||
static jsval sOnreadystatechange_id;
|
||||
static jsval sOnpageshow_id;
|
||||
static jsval sOnpagehide_id;
|
||||
static jsval sOnabort_id;
|
||||
|
@ -246,6 +246,7 @@ class nsHashKey;
|
||||
#define NS_POPSTATE (NS_STREAM_EVENT_START + 5)
|
||||
#define NS_BEFORE_PAGE_UNLOAD (NS_STREAM_EVENT_START + 6)
|
||||
#define NS_PAGE_RESTORE (NS_STREAM_EVENT_START + 7)
|
||||
#define NS_READYSTATECHANGE (NS_STREAM_EVENT_START + 8)
|
||||
|
||||
#define NS_FORM_EVENT_START 1200
|
||||
#define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
|
||||
|
@ -1201,6 +1201,7 @@ case _value: eventName.AssignWithConversion(_name) ; break
|
||||
_ASSIGN_eventName(NS_POPSTATE,"NS_POPSTATE");
|
||||
_ASSIGN_eventName(NS_PAGE_UNLOAD,"NS_PAGE_UNLOAD");
|
||||
_ASSIGN_eventName(NS_HASHCHANGE,"NS_HASHCHANGE");
|
||||
_ASSIGN_eventName(NS_READYSTATECHANGE,"NS_READYSTATECHANGE");
|
||||
_ASSIGN_eventName(NS_PAINT,"NS_PAINT");
|
||||
_ASSIGN_eventName(NS_XUL_BROADCAST, "NS_XUL_BROADCAST");
|
||||
_ASSIGN_eventName(NS_XUL_COMMAND_UPDATE, "NS_XUL_COMMAND_UPDATE");
|
||||
|
Loading…
Reference in New Issue
Block a user