зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576842 [wpt PR 18690] - Remove stale dedicated-workers.idl in favor of dom.idl + html.idl, a=testonly
Automatic update from web-platform-tests Remove stale dedicated-workers.idl in favor of dom.idl + html.idl dedicated-workers.idl hasn't been updated in a long time, and has definitions from DOM and HTML. The dom.idl and html.idl files are synced with reffy-reports regularly, so just use those. Moves the `WorkerLocation` coverage to HTML's idlharness.js test. -- wpt-commits: ddaab2cf6795cbfa77efdae981b8c494b47e7518 wpt-pr: 18690
This commit is contained in:
Родитель
b5ad577f0c
Коммит
1ca7a555b7
|
@ -8,6 +8,7 @@ idl_test(
|
|||
["dom", "cssom", "touch-events", "uievents"],
|
||||
idlArray => {
|
||||
idlArray.add_objects({
|
||||
WorkerLocation: ['self.location'],
|
||||
WorkerNavigator: ['self.navigator'],
|
||||
WebSocket: ['new WebSocket("ws://foo")'],
|
||||
CloseEvent: ['new CloseEvent("close")'],
|
||||
|
|
|
@ -1,133 +0,0 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// DOM
|
||||
// -----------------------------------------------------------------------------
|
||||
[Constructor(), Exposed=(Window,Worker)]
|
||||
interface EventTarget {
|
||||
void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options);
|
||||
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
|
||||
boolean dispatchEvent(Event event);
|
||||
};
|
||||
|
||||
callback interface EventListener {
|
||||
void handleEvent(Event event);
|
||||
};
|
||||
|
||||
dictionary EventListenerOptions {
|
||||
boolean capture = false;
|
||||
};
|
||||
|
||||
dictionary AddEventListenerOptions : EventListenerOptions {
|
||||
boolean passive = false;
|
||||
boolean once = false;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// HTML
|
||||
// -----------------------------------------------------------------------------
|
||||
[TreatNonCallableAsNull]
|
||||
callback EventHandlerNonNull = any (Event event);
|
||||
typedef EventHandlerNonNull? EventHandler;
|
||||
|
||||
[TreatNonCallableAsNull]
|
||||
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
|
||||
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
|
||||
|
||||
[Exposed=Worker]
|
||||
interface WorkerGlobalScope : EventTarget {
|
||||
readonly attribute WorkerGlobalScope self;
|
||||
readonly attribute WorkerLocation location;
|
||||
readonly attribute WorkerNavigator navigator;
|
||||
void importScripts(USVString... urls);
|
||||
|
||||
attribute OnErrorEventHandler onerror;
|
||||
attribute EventHandler onlanguagechange;
|
||||
attribute EventHandler onoffline;
|
||||
attribute EventHandler ononline;
|
||||
attribute EventHandler onrejectionhandled;
|
||||
attribute EventHandler onunhandledrejection;
|
||||
};
|
||||
|
||||
[Global=(Worker,DedicatedWorker),Exposed=DedicatedWorker]
|
||||
interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
|
||||
[Replaceable] readonly attribute DOMString name;
|
||||
|
||||
void postMessage(any message, optional sequence<object> transfer = []);
|
||||
|
||||
void close();
|
||||
|
||||
attribute EventHandler onmessage;
|
||||
attribute EventHandler onmessageerror;
|
||||
};
|
||||
|
||||
typedef (DOMString or Function) TimerHandler;
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin WindowOrWorkerGlobalScope {
|
||||
[Replaceable] readonly attribute USVString origin;
|
||||
|
||||
// base64 utility methods
|
||||
DOMString btoa(DOMString data);
|
||||
DOMString atob(DOMString data);
|
||||
|
||||
// timers
|
||||
long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments);
|
||||
void clearTimeout(optional long handle = 0);
|
||||
long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
|
||||
void clearInterval(optional long handle = 0);
|
||||
|
||||
// ImageBitmap
|
||||
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options);
|
||||
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
|
||||
};
|
||||
WorkerGlobalScope includes WindowOrWorkerGlobalScope;
|
||||
|
||||
[Exposed=Worker]
|
||||
interface WorkerNavigator {};
|
||||
WorkerNavigator includes NavigatorID;
|
||||
WorkerNavigator includes NavigatorLanguage;
|
||||
WorkerNavigator includes NavigatorOnLine;
|
||||
WorkerNavigator includes NavigatorConcurrentHardware;
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin NavigatorID {
|
||||
readonly attribute DOMString appCodeName; // constant "Mozilla"
|
||||
readonly attribute DOMString appName; // constant "Netscape"
|
||||
readonly attribute DOMString appVersion;
|
||||
readonly attribute DOMString platform;
|
||||
readonly attribute DOMString product; // constant "Gecko"
|
||||
[Exposed=Window] readonly attribute DOMString productSub;
|
||||
readonly attribute DOMString userAgent;
|
||||
[Exposed=Window] readonly attribute DOMString vendor;
|
||||
[Exposed=Window] readonly attribute DOMString vendorSub; // constant ""
|
||||
|
||||
// also has additional members in a partial interface
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin NavigatorLanguage {
|
||||
readonly attribute DOMString language;
|
||||
readonly attribute FrozenArray<DOMString> languages;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin NavigatorOnLine {
|
||||
readonly attribute boolean onLine;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface mixin NavigatorConcurrentHardware {
|
||||
readonly attribute unsigned long long hardwareConcurrency;
|
||||
};
|
||||
|
||||
[Exposed=Worker]
|
||||
interface WorkerLocation {
|
||||
stringifier readonly attribute USVString href;
|
||||
readonly attribute USVString origin;
|
||||
readonly attribute USVString protocol;
|
||||
readonly attribute USVString host;
|
||||
readonly attribute USVString hostname;
|
||||
readonly attribute USVString port;
|
||||
readonly attribute USVString pathname;
|
||||
readonly attribute USVString search;
|
||||
readonly attribute USVString hash;
|
||||
};
|
|
@ -7,7 +7,7 @@
|
|||
'use strict';
|
||||
|
||||
// NOTE: affected when 'resources/interfaces-worker.sub.js' srcs change:
|
||||
// const srcs = ['dom', 'html', 'service-workers', 'dedicated-workers'];
|
||||
// const srcs = ['dom', 'html', 'service-workers'];
|
||||
service_worker_test(
|
||||
'resources/interfaces-worker.sub.js',
|
||||
'Interfaces and attributes in ServiceWorkerGlobalScope');
|
||||
|
|
|
@ -5,8 +5,8 @@ importScripts('/resources/WebIDLParser.js');
|
|||
importScripts('/resources/idlharness.js');
|
||||
|
||||
promise_test(async (t) => {
|
||||
const srcs = ['dom', 'html', 'service-workers', 'dedicated-workers'];
|
||||
const [dom, html, serviceWorkerIdl, dedicated] = await Promise.all(
|
||||
const srcs = ['dom', 'html', 'service-workers'];
|
||||
const [dom, html, serviceWorkerIdl] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
var idlArray = new IdlArray();
|
||||
|
@ -24,7 +24,6 @@ promise_test(async (t) => {
|
|||
'Cache',
|
||||
'CacheStorage',
|
||||
]});
|
||||
idlArray.add_dependency_idls(dedicated);
|
||||
idlArray.add_dependency_idls(dom);
|
||||
idlArray.add_dependency_idls(html);
|
||||
idlArray.add_objects({
|
||||
|
|
|
@ -6,6 +6,9 @@ These are the workers (`Worker`, `SharedWorker`) tests for the
|
|||
See also
|
||||
[testharness.js API > Web Workers](https://web-platform-tests.org/writing-tests/testharness-api.html#web-workers).
|
||||
|
||||
Note that because workers are defined in the HTML Standard, the idlharness.js
|
||||
tests are in [/html/dom]([/html/dom) instead of here.
|
||||
|
||||
## Writing `*.any.js`
|
||||
|
||||
The easiest and most recommended way to write tests for workers
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.onload = function() {
|
||||
var idlArray = new IdlArray();
|
||||
var idls = request.responseText;
|
||||
idlArray.add_idls(idls);
|
||||
idlArray.add_objects({
|
||||
DedicatedWorkerGlobalScope: ['self'],
|
||||
WorkerNavigator: ['self.navigator'],
|
||||
WorkerLocation: ['self.location'],
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
};
|
||||
request.open("GET", "/interfaces/dedicated-workers.idl");
|
||||
request.send();
|
Загрузка…
Ссылка в новой задаче