mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Auto merge of #23637 - gterzian:continue-message-port, r=jdm
Continue message port <!-- Please describe your changes on the following line: --> Fixes #7457. Fixes #12715. Fixes #12717. Fixes #16095. Fixes #18969. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23637) <!-- Reviewable:end -->
This commit is contained in:
commit
a905916ede
113 changed files with 2792 additions and 787 deletions
|
@ -5,9 +5,9 @@
|
|||
// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
|
||||
[Global=(Worker,DedicatedWorker), Exposed=DedicatedWorker]
|
||||
/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
|
||||
[Throws]
|
||||
void postMessage(any message/*, optional sequence<Transferable> transfer*/);
|
||||
attribute EventHandler onmessage;
|
||||
[Throws] void postMessage(any message, sequence<object> transfer);
|
||||
[Throws] void postMessage(any message, optional PostMessageOptions options = {});
|
||||
attribute EventHandler onmessage;
|
||||
|
||||
void close();
|
||||
};
|
||||
|
|
|
@ -25,7 +25,8 @@ interface DissimilarOriginWindow : GlobalScope {
|
|||
|
||||
void close();
|
||||
readonly attribute boolean closed;
|
||||
[Throws] void postMessage(any message, DOMString targetOrigin);
|
||||
[Throws] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer /*= []*/);
|
||||
[Throws] void postMessage(any message, optional WindowPostMessageOptions options = {});
|
||||
attribute any opener;
|
||||
void blur();
|
||||
void focus();
|
||||
|
|
|
@ -12,7 +12,7 @@ interface ExtendableMessageEvent : ExtendableEvent {
|
|||
readonly attribute DOMString origin;
|
||||
readonly attribute DOMString lastEventId;
|
||||
// [SameObject] readonly attribute (Client or ServiceWorker /*or MessagePort*/)? source;
|
||||
// readonly attribute FrozenArray<MessagePort>? ports;
|
||||
readonly attribute /*FrozenArray<MessagePort>*/any ports;
|
||||
};
|
||||
|
||||
dictionary ExtendableMessageEventInit : ExtendableEventInit {
|
||||
|
|
14
components/script/dom/webidls/MessageChannel.webidl
Normal file
14
components/script/dom/webidls/MessageChannel.webidl
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* The origin of this IDL file is:
|
||||
* https://html.spec.whatwg.org/multipage/#messagechannel
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface MessageChannel {
|
||||
[Throws] constructor();
|
||||
readonly attribute MessagePort port1;
|
||||
readonly attribute MessagePort port2;
|
||||
};
|
|
@ -12,7 +12,7 @@ interface MessageEvent : Event {
|
|||
// FIXME(#22617): WindowProxy is not exposed in Worker globals
|
||||
readonly attribute object? source;
|
||||
//readonly attribute (WindowProxy or MessagePort)? source;
|
||||
//readonly attribute MessagePort[]? ports;
|
||||
readonly attribute /*FrozenArray<MessagePort>*/any ports;
|
||||
};
|
||||
|
||||
dictionary MessageEventInit : EventInit {
|
||||
|
@ -22,5 +22,7 @@ dictionary MessageEventInit : EventInit {
|
|||
//DOMString channel;
|
||||
Window? source;
|
||||
//(WindowProxy or MessagePort)? source;
|
||||
//sequence<MessagePort> ports;
|
||||
sequence<MessagePort> ports;
|
||||
};
|
||||
|
||||
typedef (/*WindowProxy or */MessagePort or ServiceWorker) MessageEventSource;
|
||||
|
|
23
components/script/dom/webidls/MessagePort.webidl
Normal file
23
components/script/dom/webidls/MessagePort.webidl
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* The origin of this IDL file is:
|
||||
* https://html.spec.whatwg.org/multipage/#messageport
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface MessagePort : EventTarget {
|
||||
[Throws] void postMessage(any message, sequence<object> transfer /*= []*/);
|
||||
[Throws] void postMessage(any message, optional PostMessageOptions options = {});
|
||||
void start();
|
||||
void close();
|
||||
|
||||
// event handlers
|
||||
attribute EventHandler onmessage;
|
||||
attribute EventHandler onmessageerror;
|
||||
};
|
||||
|
||||
dictionary PostMessageOptions {
|
||||
sequence<object> transfer;
|
||||
};
|
|
@ -7,7 +7,8 @@
|
|||
interface ServiceWorker : EventTarget {
|
||||
readonly attribute USVString scriptURL;
|
||||
readonly attribute ServiceWorkerState state;
|
||||
[Throws] void postMessage(any message/*, optional sequence<object> transfer = []*/);
|
||||
[Throws] void postMessage(any message, sequence<object> transfer);
|
||||
[Throws] void postMessage(any message, optional PostMessageOptions options = {});
|
||||
|
||||
// event
|
||||
attribute EventHandler onstatechange;
|
||||
|
|
|
@ -63,9 +63,10 @@
|
|||
unsigned long requestAnimationFrame(FrameRequestCallback callback);
|
||||
void cancelAnimationFrame(unsigned long handle);
|
||||
|
||||
//void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
|
||||
[Throws]
|
||||
void postMessage(any message, DOMString targetOrigin);
|
||||
void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer /*= []*/);
|
||||
[Throws]
|
||||
void postMessage(any message, optional WindowPostMessageOptions options = {});
|
||||
|
||||
// also has obsolete members
|
||||
};
|
||||
|
@ -173,3 +174,8 @@ partial interface Window {
|
|||
[Pref="css.animations.testing.enabled"]
|
||||
readonly attribute unsigned long runningAnimationCount;
|
||||
};
|
||||
|
||||
dictionary WindowPostMessageOptions {
|
||||
USVString targetOrigin = "/";
|
||||
sequence<object> transfer;
|
||||
};
|
||||
|
|
|
@ -14,8 +14,8 @@ interface Worker : EventTarget {
|
|||
[Throws] constructor(USVString scriptURL, optional WorkerOptions options = {});
|
||||
void terminate();
|
||||
|
||||
[Throws] void postMessage(any message/*, sequence<object> transfer*/);
|
||||
// void postMessage(any message, optional PostMessageOptions options);
|
||||
[Throws] void postMessage(any message, sequence<object> transfer);
|
||||
[Throws] void postMessage(any message, optional PostMessageOptions options = {});
|
||||
attribute EventHandler onmessage;
|
||||
attribute EventHandler onmessageerror;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue