mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 21:58:41 +02:00
Automatic update from web-platform-tests
RestrictDeviceSensorEventsToSecureContexts by default.
Turn on the flag by default to restrict Device{Orientation|Motion}Events
to secure origins.
Intent to remove: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/5yqfAXibz1I
Bug: 932078
Change-Id: I8f46a90a12375b734ba3d9a89b835c754960ef48
Reviewed-on: https://chromium-review.googlesource.com/c/1486091
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635954}
--
wpt-commits: 78b3d93dec577480b0ac4aaae26dbf55555e4709
wpt-pr: 15563
--HG--
rename : testing/web-platform/tests/dom/nodes/Document-createEvent.html => testing/web-platform/tests/dom/nodes/Document-createEvent.https.html
rename : testing/web-platform/tests/orientation-event/idlharness.window.js => testing/web-platform/tests/orientation-event/idlharness.https.window.js
164 lines
5.1 KiB
HTML
164 lines
5.1 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Document.createEvent</title>
|
|
<link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="Document-createEvent.js"></script>
|
|
<div id="log"></div>
|
|
<script>
|
|
function testAlias(arg, iface) {
|
|
var ev;
|
|
test(function() {
|
|
ev = document.createEvent(arg);
|
|
assert_equals(Object.getPrototypeOf(ev), window[iface].prototype);
|
|
}, arg + " should be an alias for " + iface + ".");
|
|
test(function() {
|
|
assert_equals(ev.type, "",
|
|
"type should be initialized to the empty string");
|
|
assert_equals(ev.target, null,
|
|
"target should be initialized to null");
|
|
assert_equals(ev.currentTarget, null,
|
|
"currentTarget should be initialized to null");
|
|
assert_equals(ev.eventPhase, 0,
|
|
"eventPhase should be initialized to NONE (0)");
|
|
assert_equals(ev.bubbles, false,
|
|
"bubbles should be initialized to false");
|
|
assert_equals(ev.cancelable, false,
|
|
"cancelable should be initialized to false");
|
|
assert_equals(ev.defaultPrevented, false,
|
|
"defaultPrevented should be initialized to false");
|
|
assert_equals(ev.isTrusted, false,
|
|
"isTrusted should be initialized to false");
|
|
}, "createEvent('" + arg + "') should be initialized correctly.");
|
|
}
|
|
for (var alias in aliases) {
|
|
var iface = aliases[alias];
|
|
testAlias(alias, iface);
|
|
testAlias(alias.toLowerCase(), iface);
|
|
testAlias(alias.toUpperCase(), iface);
|
|
|
|
if (alias[alias.length - 1] != "s") {
|
|
var plural = alias + "s";
|
|
if (!(plural in aliases)) {
|
|
test(function () {
|
|
assert_throws("NOT_SUPPORTED_ERR", function () {
|
|
var evt = document.createEvent(plural);
|
|
});
|
|
}, 'Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "' + plural + '"');
|
|
}
|
|
}
|
|
}
|
|
|
|
test(function() {
|
|
assert_throws("NOT_SUPPORTED_ERR", function() {
|
|
var evt = document.createEvent("foo");
|
|
});
|
|
assert_throws("NOT_SUPPORTED_ERR", function() {
|
|
// 'LATIN CAPITAL LETTER I WITH DOT ABOVE' (U+0130)
|
|
var evt = document.createEvent("U\u0130Event");
|
|
});
|
|
assert_throws("NOT_SUPPORTED_ERR", function() {
|
|
// 'LATIN SMALL LETTER DOTLESS I' (U+0131)
|
|
var evt = document.createEvent("U\u0131Event");
|
|
});
|
|
}, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
|
|
|
|
/*
|
|
* The following are event interfaces which do actually exist, but must still
|
|
* throw since they're absent from the table in the spec for
|
|
* document.createEvent(). This list is not exhaustive, but includes all
|
|
* interfaces that it is known some UA does or did not throw for.
|
|
*/
|
|
var someNonCreateableEvents = [
|
|
"AnimationEvent",
|
|
"AnimationPlaybackEvent",
|
|
"AnimationPlayerEvent",
|
|
"ApplicationCacheErrorEvent",
|
|
"AudioProcessingEvent",
|
|
"AutocompleteErrorEvent",
|
|
"BeforeInstallPromptEvent",
|
|
"BlobEvent",
|
|
"ClipboardEvent",
|
|
"CloseEvent",
|
|
"CommandEvent",
|
|
"DataContainerEvent",
|
|
"ErrorEvent",
|
|
"ExtendableEvent",
|
|
"ExtendableMessageEvent",
|
|
"FetchEvent",
|
|
"FontFaceSetLoadEvent",
|
|
"GamepadEvent",
|
|
"GeofencingEvent",
|
|
"IDBVersionChangeEvent",
|
|
"InstallEvent",
|
|
"KeyEvent",
|
|
"MIDIConnectionEvent",
|
|
"MIDIMessageEvent",
|
|
"MediaEncryptedEvent",
|
|
"MediaKeyEvent",
|
|
"MediaKeyMessageEvent",
|
|
"MediaQueryListEvent",
|
|
"MediaStreamEvent",
|
|
"MediaStreamTrackEvent",
|
|
"MouseScrollEvent",
|
|
"MutationEvent",
|
|
"NotificationEvent",
|
|
"NotifyPaintEvent",
|
|
"OfflineAudioCompletionEvent",
|
|
"OrientationEvent",
|
|
"PageTransition", // Yes, with no "Event"
|
|
"PageTransitionEvent",
|
|
"PointerEvent",
|
|
"PopStateEvent",
|
|
"PopUpEvent",
|
|
"PresentationConnectionAvailableEvent",
|
|
"PresentationConnectionCloseEvent",
|
|
"ProgressEvent",
|
|
"PromiseRejectionEvent",
|
|
"PushEvent",
|
|
"RTCDTMFToneChangeEvent",
|
|
"RTCDataChannelEvent",
|
|
"RTCIceCandidateEvent",
|
|
"RelatedEvent",
|
|
"ResourceProgressEvent",
|
|
"SVGEvent",
|
|
"SVGZoomEvent",
|
|
"ScrollAreaEvent",
|
|
"SecurityPolicyViolationEvent",
|
|
"ServicePortConnectEvent",
|
|
"ServiceWorkerMessageEvent",
|
|
"SimpleGestureEvent",
|
|
"SpeechRecognitionError",
|
|
"SpeechRecognitionEvent",
|
|
"SpeechSynthesisEvent",
|
|
"SyncEvent",
|
|
"TimeEvent",
|
|
"TrackEvent",
|
|
"TransitionEvent",
|
|
"WebGLContextEvent",
|
|
"WebKitAnimationEvent",
|
|
"WebKitTransitionEvent",
|
|
"WheelEvent",
|
|
"XULCommandEvent",
|
|
];
|
|
someNonCreateableEvents.forEach(function (eventInterface) {
|
|
// SVGEvents is allowed, but not SVGEvent. Make sure we only test if it's
|
|
// not whitelisted.
|
|
if (!(eventInterface in aliases)) {
|
|
test(function () {
|
|
assert_throws("NOT_SUPPORTED_ERR", function () {
|
|
var evt = document.createEvent(eventInterface);
|
|
});
|
|
}, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventInterface + '"');
|
|
}
|
|
|
|
if (!(eventInterface + "s" in aliases)) {
|
|
test(function () {
|
|
assert_throws("NOT_SUPPORTED_ERR", function () {
|
|
var evt = document.createEvent(eventInterface + "s");
|
|
});
|
|
}, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "' + eventInterface + 's"');
|
|
}
|
|
});
|
|
</script>
|