Bug 1017988 part 8. Add [Exposed] extended attributes as needed. r=khuey

This commit is contained in:
Boris Zbarsky 2014-08-04 22:20:34 -04:00
parent b2466b701e
commit c8e06d5e53
35 changed files with 83 additions and 38 deletions

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[NoInterfaceObject]
[NoInterfaceObject, Exposed=(Window,Worker)]
interface AbstractWorker {
attribute EventHandler onerror;
};

View File

@ -4,7 +4,8 @@
* 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/. */
[ChromeOnly]
[ChromeOnly,
Exposed=(Window,Worker)]
interface Console {
void log(any... data);
void info(any... data);

View File

@ -15,7 +15,8 @@
interface StackFrame;
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window,Worker)]
interface ExceptionMembers
{
// A custom message set by the thrower. LenientThis so it can be
@ -72,7 +73,8 @@ Exception implements ExceptionMembers;
// XXXkhuey this is an 'exception', not an interface, but we don't have any
// parser or codegen mechanisms for dealing with exceptions.
[ExceptionClass]
[ExceptionClass,
Exposed=(Window, Worker)]
interface DOMException {
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical

View File

@ -12,7 +12,8 @@ typedef (DOMString or unsigned long) DataStoreKey;
// JS codes implemented by the DataStoreImpl WebIDL.
[Func="Navigator::HasDataStoreSupport",
ChromeConstructor]
ChromeConstructor,
Exposed=(Window,Worker)]
interface DataStore : EventTarget {
// Returns the label of the DataSource.
[GetterThrows]
@ -66,7 +67,8 @@ partial interface DataStore {
// JS codes implemented by the DataStoreCursorImpl WebIDL.
[Pref="dom.datastore.enabled",
ChromeConstructor]
ChromeConstructor,
Exposed=(Window,Worker)]
interface DataStoreCursor {
// the DataStore
[GetterThrows]

View File

@ -13,7 +13,8 @@
*/
[Global=(Worker,DedicatedWorker),
Func="mozilla::dom::workers::DedicatedWorkerGlobalScope::Visible"]
Func="mozilla::dom::workers::DedicatedWorkerGlobalScope::Visible",
Exposed=DedicatedWorker]
interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
[Throws]
void postMessage(any message, optional sequence<any> transfer);

View File

@ -10,7 +10,8 @@
* liability, trademark and document use rules apply.
*/
[Constructor(DOMString type, optional EventInit eventInitDict)]
[Constructor(DOMString type, optional EventInit eventInitDict),
Exposed=(Window,Worker)]
interface Event {
[Pure]
readonly attribute DOMString type;

View File

@ -10,6 +10,7 @@
* liability, trademark and document use rules apply.
*/
[Exposed=(Window,Worker)]
interface EventTarget {
/* Passing null for wantsUntrusted means "default behavior", which
differs in content and chrome. In content that default boolean

View File

@ -12,7 +12,8 @@
interface Blob;
[Constructor]
[Constructor,
Exposed=Worker]
interface FileReaderSync {
// Synchronously return strings

View File

@ -19,7 +19,7 @@ enum HeadersGuardEnum {
};
[Constructor(optional HeadersInit init),
// FIXME: Exposed=Window,Worker,
Exposed=(Window,Worker),
Func="mozilla::dom::Headers::PrefEnabled"]
interface Headers {
[Throws] void append(ByteString name, ByteString value);

View File

@ -11,7 +11,8 @@
*/
[Constructor(unsigned long sw, unsigned long sh),
Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh)]
Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh),
Exposed=(Window,Worker)]
interface ImageData {
[Constant]
readonly attribute unsigned long width;

View File

@ -10,7 +10,11 @@
// While not explicitly restricted to ServiceWorkerGlobalScope, it probably
// should be. https://github.com/slightlyoff/ServiceWorker/issues/254
[Constructor(DOMString type, optional InstallEventInit eventInitDict),
Func="mozilla::dom::workers::ServiceWorkerEventsVisible"]
Func="mozilla::dom::workers::ServiceWorkerEventsVisible",
// XXXbz I have no idea where this should be exposed. The spec makes
// no sense. But since it returns a ServiceWorker and that's only
// exposed in Window, let's say Window.
Exposed=Window]
interface InstallEvent : InstallPhaseEvent {
// The currently active worker for this scope when this worker is asked to
// install itself.

View File

@ -10,7 +10,8 @@
// While not explicitly restricted to ServiceWorkerGlobalScope, it probably
// should be. https://github.com/slightlyoff/ServiceWorker/issues/254
[Constructor(DOMString type, optional EventInit eventInitDict),
Func="mozilla::dom::workers::ServiceWorkerEventsVisible"]
Func="mozilla::dom::workers::ServiceWorkerEventsVisible",
Exposed=(ServiceWorker,Window)]
interface InstallPhaseEvent : Event {
// https://github.com/slightlyoff/ServiceWorker/issues/261
void waitUntil(Promise<any> p);

View File

@ -7,10 +7,14 @@
interface nsISupports;
interface IID;
[NoInterfaceObject]
[NoInterfaceObject,
// Need Exposed here, because this is a mixin onto things like Event
// that are exposed in workers.
Exposed=(Window,Worker)]
interface LegacyQueryInterface {
// Legacy QueryInterface, only exposed to chrome or XBL code on the
// main thread.
[Exposed=Window]
nsISupports queryInterface(IID iid);
};

View File

@ -9,7 +9,8 @@
interface WindowProxy;
[Constructor(DOMString type, optional MessageEventInit eventInitDict)]
[Constructor(DOMString type, optional MessageEventInit eventInitDict),
Exposed=(Window,Worker)]
interface MessageEvent : Event {
/**
* Custom data associated with this event.

View File

@ -7,6 +7,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging
*/
[Exposed=(Window,Worker)]
interface MessagePort : EventTarget {
[Throws]
void postMessage(any message, optional sequence<Transferable> transferable);

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[NoInterfaceObject, ArrayClass]
[NoInterfaceObject, ArrayClass, Exposed=(Window,Worker)]
interface MessagePortList {
readonly attribute unsigned long length;
getter MessagePort? item(unsigned long index);

View File

@ -30,7 +30,7 @@ Navigator implements NavigatorContentUtils;
Navigator implements NavigatorStorageUtils;
Navigator implements NavigatorFeatures;
[NoInterfaceObject]
[NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorID {
// WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
[Constant]
@ -53,10 +53,11 @@ interface NavigatorID {
[NoInterfaceObject]
interface NavigatorLanguage {
readonly attribute DOMString? language;
[Pure, Cached, Frozen] readonly attribute sequence<DOMString> languages;
[Pure, Cached, Frozen]
readonly attribute sequence<DOMString> languages;
};
[NoInterfaceObject]
[NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorOnLine {
readonly attribute boolean onLine;
};
@ -120,7 +121,8 @@ interface NavigatorBattery {
Navigator implements NavigatorBattery;
// https://wiki.mozilla.org/WebAPI/DataStore
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window,Worker)]
interface NavigatorDataStore {
[Throws, NewObject, Func="Navigator::HasDataStoreSupport"]
Promise<sequence<DataStore>> getDataStores(DOMString name,

View File

@ -16,7 +16,8 @@ callback PromiseInit = void (object resolve, object reject);
callback AnyCallback = any (any value);
// REMOVE THE RELEVANT ENTRY FROM test_interfaces.html WHEN THIS IS IMPLEMENTED IN JS.
[Constructor(PromiseInit init)]
[Constructor(PromiseInit init),
Exposed=(Window,Worker)]
// Need to escape "Promise" so it's treated as an identifier.
interface _Promise {
// TODO bug 875289 - static Promise fulfill(any value);

View File

@ -10,7 +10,10 @@
// Still unclear what should be subclassed.
// https://github.com/slightlyoff/ServiceWorker/issues/189
[Pref="dom.serviceWorkers.enabled"]
[Pref="dom.serviceWorkers.enabled",
// XXXbz I have no idea where this should be exposed. The spec makes
// no sense. But since it's got a pref, let's say window.
Exposed=Window]
interface ServiceWorker : EventTarget {
readonly attribute DOMString scope;
readonly attribute DOMString url;

View File

@ -14,7 +14,8 @@
// ServiceWorkerGlobalScope (itself).
[Global=(Worker,ServiceWorker),
Func="mozilla::dom::workers::ServiceWorkerGlobalScope::Visible",
Pref="dom.serviceWorkers.enabled"]
Pref="dom.serviceWorkers.enabled",
Exposed=ServiceWorker]
interface ServiceWorkerGlobalScope : WorkerGlobalScope {
// FIXME(nsm): Bug 982725
// readonly attribute CacheList caches;

View File

@ -13,7 +13,8 @@
*/
[Global=(Worker,SharedWorker),
Func="mozilla::dom::workers::SharedWorkerGlobalScope::Visible"]
Func="mozilla::dom::workers::SharedWorkerGlobalScope::Visible",
Exposed=SharedWorker]
interface SharedWorkerGlobalScope : WorkerGlobalScope {
readonly attribute DOMString name;
attribute EventHandler onconnect;

View File

@ -10,7 +10,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options)]
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options),
Exposed=(Window,Worker)]
interface TextDecoder {
[Constant]
readonly attribute DOMString encoding;

View File

@ -10,7 +10,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
[Constructor(optional DOMString utfLabel = "utf-8")]
[Constructor(optional DOMString utfLabel = "utf-8"),
Exposed=(Window,Worker)]
interface TextEncoder {
[Constant]
readonly attribute DOMString encoding;

View File

@ -14,7 +14,8 @@
// [Constructor(DOMString url, optional (URL or DOMString) base = "about:blank")]
[Constructor(DOMString url, URL base),
Constructor(DOMString url, optional DOMString base = "about:blank")]
Constructor(DOMString url, optional DOMString base = "about:blank"),
Exposed=(Window,Worker)]
interface URL {
};
URL implements URLUtils;

View File

@ -14,7 +14,8 @@
*/
[Constructor(optional DOMString init = ""),
Constructor(URLSearchParams init)]
Constructor(URLSearchParams init),
Exposed=(Window,Worker)]
interface URLSearchParams {
void append(DOMString name, DOMString value);
void delete(DOMString name);

View File

@ -13,7 +13,8 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window, Worker)]
interface URLUtilsNoSearchParams {
// Bug 824857: no support for stringifier attributes yet.
// stringifier attribute DOMString href;
@ -47,7 +48,8 @@ interface URLUtilsNoSearchParams {
stringifier;
};
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window, Worker)]
interface URLUtils : URLUtilsNoSearchParams
{
attribute URLSearchParams searchParams;

View File

@ -13,7 +13,8 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window, Worker)]
interface URLUtilsReadOnly {
stringifier;
readonly attribute DOMString href;

View File

@ -90,7 +90,7 @@ Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
[NoInterfaceObject, Exposed=(Window,Worker)]
interface WindowTimers {
[Throws] long setTimeout(Function handler, optional long timeout = 0, any... arguments);
[Throws] long setTimeout(DOMString handler, optional long timeout = 0, any... unused);
@ -102,7 +102,7 @@ interface WindowTimers {
Window implements WindowTimers;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
[NoInterfaceObject, Exposed=(Window,Worker)]
interface WindowBase64 {
[Throws] DOMString btoa(DOMString btoa);
[Throws] DOMString atob(DOMString atob);

View File

@ -13,7 +13,8 @@
*/
[Constructor(DOMString scriptURL),
Func="mozilla::dom::workers::WorkerPrivate::WorkerAvailable"]
Func="mozilla::dom::workers::WorkerPrivate::WorkerAvailable",
Exposed=(Window,Worker)]
interface Worker : EventTarget {
void terminate();
@ -26,6 +27,7 @@ interface Worker : EventTarget {
Worker implements AbstractWorker;
[Constructor(DOMString scriptURL),
Func="mozilla::dom::workers::ChromeWorkerPrivate::WorkerAvailable"]
Func="mozilla::dom::workers::ChromeWorkerPrivate::WorkerAvailable",
Exposed=(Window,Worker)]
interface ChromeWorker : Worker {
};

View File

@ -12,6 +12,7 @@
* this document.
*/
[Exposed=Worker]
interface WorkerGlobalScope : EventTarget {
readonly attribute WorkerGlobalScope self;

View File

@ -12,5 +12,6 @@
* this document.
*/
[Exposed=Worker]
interface WorkerLocation { };
WorkerLocation implements URLUtilsReadOnly;

View File

@ -2,6 +2,8 @@
* 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/. */
[Exposed=Worker]
interface WorkerNavigator {
};

View File

@ -54,7 +54,8 @@ dictionary MozXMLHttpRequestParameters
// things like this:
// c = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP")
// To handle that, we need a constructor that takes a string.
Constructor(DOMString ignored)]
Constructor(DOMString ignored),
Exposed=(Window,Worker)]
interface XMLHttpRequest : XMLHttpRequestEventTarget {
// event handler
attribute EventHandler onreadystatechange;
@ -129,7 +130,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
[Throws]
readonly attribute DOMString? responseText;
[Throws=MainThread]
[Throws=MainThread, Exposed=Window]
readonly attribute Document? responseXML;
// Mozilla-specific stuff

View File

@ -10,7 +10,8 @@
* liability, trademark and document use rules apply.
*/
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=(Window,Worker)]
interface XMLHttpRequestEventTarget : EventTarget {
// event handlers
[SetterThrows=Workers, GetterThrows=Workers]

View File

@ -10,6 +10,7 @@
* liability, trademark and document use rules apply.
*/
[Exposed=(Window,Worker)]
interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
};