feat(script): add CrossOrigin*able attributes to Window and Location's members

This commit is contained in:
yvt 2021-07-10 21:43:37 +09:00
parent 863c90acd8
commit 1d970b1351
2 changed files with 19 additions and 16 deletions

View file

@ -4,7 +4,8 @@
// https://html.spec.whatwg.org/multipage/#location
[Exposed=Window, Unforgeable] interface Location {
[Throws] stringifier attribute USVString href;
[Throws, CrossOriginWritable]
stringifier attribute USVString href;
[Throws] readonly attribute USVString origin;
[Throws] attribute USVString protocol;
[Throws] attribute USVString host;
@ -15,7 +16,8 @@
[Throws] attribute USVString hash;
[Throws] void assign(USVString url);
[Throws] void replace(USVString url);
[Throws, CrossOriginCallable]
void replace(USVString url);
[Throws] void reload();
//[SameObject] readonly attribute USVString[] ancestorOrigins;

View file

@ -6,13 +6,14 @@
[Global=Window, Exposed=Window /*, LegacyUnenumerableNamedProperties */]
/*sealed*/ interface Window : GlobalScope {
// the current browsing context
[Unforgeable] readonly attribute WindowProxy window;
[BinaryName="Self_", Replaceable] readonly attribute WindowProxy self;
[Unforgeable, CrossOriginReadable] readonly attribute WindowProxy window;
[BinaryName="Self_", Replaceable, CrossOriginReadable] readonly attribute WindowProxy self;
[Unforgeable] readonly attribute Document document;
attribute DOMString name;
[PutForwards=href, Unforgeable] readonly attribute Location location;
[PutForwards=href, Unforgeable, CrossOriginReadable, CrossOriginWritable]
readonly attribute Location location;
readonly attribute History history;
[Pref="dom.customelements.enabled"]
readonly attribute CustomElementRegistry customElements;
@ -23,22 +24,22 @@
//[Replaceable] readonly attribute BarProp statusbar;
//[Replaceable] readonly attribute BarProp toolbar;
attribute DOMString status;
void close();
readonly attribute boolean closed;
[CrossOriginCallable] void close();
[CrossOriginReadable] readonly attribute boolean closed;
void stop();
//void focus();
//void blur();
//[CrossOriginCallable] void focus();
//[CrossOriginCallable] void blur();
// other browsing contexts
[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
[Replaceable, CrossOriginReadable] readonly attribute WindowProxy frames;
[Replaceable, CrossOriginReadable] readonly attribute unsigned long length;
// Note that this can return null in the case that the browsing context has been discarded.
// https://github.com/whatwg/html/issues/2115
[Unforgeable] readonly attribute WindowProxy? top;
attribute any opener;
[Unforgeable, CrossOriginReadable] readonly attribute WindowProxy? top;
[CrossOriginReadable] attribute any opener;
// Note that this can return null in the case that the browsing context has been discarded.
// https://github.com/whatwg/html/issues/2115
[Replaceable] readonly attribute WindowProxy? parent;
[Replaceable, CrossOriginReadable] readonly attribute WindowProxy? parent;
readonly attribute Element? frameElement;
[Throws] WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank",
optional DOMString features = "");
@ -63,9 +64,9 @@
unsigned long requestAnimationFrame(FrameRequestCallback callback);
void cancelAnimationFrame(unsigned long handle);
[Throws]
[Throws, CrossOriginCallable]
void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
[Throws]
[Throws, CrossOriginCallable]
void postMessage(any message, optional WindowPostMessageOptions options = {});
// also has obsolete members