зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 9fae2a07dd43 (bug 1333838) for wplint failures a=backout
MozReview-Commit-ID: D6FEaIbDpMq --HG-- extra : rebase_source : c33688ef80e6d00aed81498ff7899c578398d70b
This commit is contained in:
Родитель
a309057692
Коммит
200a7e4e9a
|
@ -162,14 +162,13 @@ JSEventHandler::HandleEvent(nsIDOMEvent* aEvent)
|
|||
RefPtr<OnErrorEventHandlerNonNull> handler =
|
||||
mTypedHandler.OnErrorEventHandler();
|
||||
ErrorResult rv;
|
||||
JS::Rooted<JS::Value> retval(RootingCx());
|
||||
handler->Call(mTarget, msgOrEvent, fileName, lineNumber,
|
||||
columnNumber, error, &retval, rv);
|
||||
bool handled = handler->Call(mTarget, msgOrEvent, fileName, lineNumber,
|
||||
columnNumber, error, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
if (retval.isBoolean() && retval.toBoolean()) {
|
||||
if (handled) {
|
||||
event->PreventDefaultInternal(isChromeHandler);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -15,11 +15,13 @@ callback EventHandlerNonNull = any (Event event);
|
|||
typedef EventHandlerNonNull? EventHandler;
|
||||
|
||||
[TreatNonObjectAsNull]
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23489
|
||||
//callback OnBeforeUnloadEventHandlerNonNull = DOMString (Event event);
|
||||
callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
|
||||
typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
|
||||
|
||||
[TreatNonObjectAsNull]
|
||||
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
|
||||
callback OnErrorEventHandlerNonNull = boolean ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
|
||||
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
|
||||
|
||||
[NoInterfaceObject]
|
||||
|
|
|
@ -94701,12 +94701,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"html/webappapis/scripting/events/eventhandler-cancellation.html": [
|
||||
[
|
||||
"/html/webappapis/scripting/events/eventhandler-cancellation.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"html/webappapis/scripting/events/inline-event-handler-ordering.html": [
|
||||
[
|
||||
"/html/webappapis/scripting/events/inline-event-handler-ordering.html",
|
||||
|
@ -175768,10 +175762,6 @@
|
|||
"8d4d0bfdf447591695ac134cd243277ea2326c84",
|
||||
"testharness"
|
||||
],
|
||||
"html/webappapis/scripting/events/eventhandler-cancellation.html": [
|
||||
"79b4a278f0e35646cfdffeebf8f0523e2772bc9b",
|
||||
"testharness"
|
||||
],
|
||||
"html/webappapis/scripting/events/inline-event-handler-ordering.html": [
|
||||
"0bf73411e0a015a81aefc1327d4c7ef1ca824a56",
|
||||
"testharness"
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title></title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<!-- A window to work with that won't trigger the harness exception detection
|
||||
when we fire "error" events at it -->
|
||||
<iframe style="display: none"></iframe>
|
||||
<script>
|
||||
test(function() {
|
||||
var blob = new Blob([""]);
|
||||
// Most targets disabled for now until
|
||||
// https://github.com/whatwg/html/issues/2296 is sorted out.
|
||||
var targets = [ frames[0] /*, document, document.documentElement,
|
||||
new Worker(URL.createObjectURL(blob) */ ];
|
||||
// Event constructors also mostly disabled until
|
||||
// https://github.com/whatwg/html/issues/2296 is sorted out.
|
||||
var eventCtors = [ /* Event, */ ErrorEvent /*, MouseEvent */ ];
|
||||
var values = [true, false, "", "abc", {}, 0, 1, -1, null, undefined,
|
||||
2.5, NaN, Infinity, Symbol.toStringTag ];
|
||||
// Event types also mostly disabled pending
|
||||
// https://github.com/whatwg/html/issues/2296
|
||||
var eventTypes = [ "error"/*, "click", "load"*/ ];
|
||||
|
||||
// Variables that keep track of which subtest we're running.
|
||||
var curTarget;
|
||||
var curValue;
|
||||
var curCtor;
|
||||
var curType;
|
||||
|
||||
function defaultPreventedTester(event) {
|
||||
var expectedValue;
|
||||
if (curTarget === frames[0] &&
|
||||
curCtor === ErrorEvent &&
|
||||
curValue === true &&
|
||||
curType == "error") {
|
||||
expectedValue = true;
|
||||
} else {
|
||||
// This will need adjusting once we allow more targets and event
|
||||
// constructors above!
|
||||
expectedValue = false;
|
||||
}
|
||||
var valueRepr;
|
||||
if (typeof curValue == "string") {
|
||||
valueRepr = '"' + curValue + '"';
|
||||
} else {
|
||||
valueRepr = String(curValue);
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(event.defaultPrevented, expectedValue);
|
||||
}, "Returning " + valueRepr +
|
||||
" from " + String(curTarget) + "'s on" + curType +
|
||||
" event handler while " + curCtor.name +
|
||||
" is firing should" +
|
||||
(expectedValue ? "" : " not") +
|
||||
" cancel the event");
|
||||
}
|
||||
|
||||
for (curCtor of eventCtors) {
|
||||
for (curTarget of targets) {
|
||||
for (curType of eventTypes) {
|
||||
for (curValue of values) {
|
||||
// We have to make sure that defaultPreventedTester is added after
|
||||
// our event handler.
|
||||
curTarget["on" + curType] = function() { return curValue; }
|
||||
curTarget.addEventListener(curType, defaultPreventedTester);
|
||||
var e = new curCtor(curType, { cancelable: true });
|
||||
curTarget.dispatchEvent(e);
|
||||
curTarget["on" + curType] = null;
|
||||
curTarget.removeEventListener(curType, defaultPreventedTester);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "event handler cancellation behavior");
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче