Bug 1333117. We should ensure, at build-time, that partial interfaces are defined in the same file as the interface they extend, since our build system doesn't really support correct dep builds if they're placed in a different file. r=qdot

This commit is contained in:
Boris Zbarsky 2017-01-24 16:11:30 -05:00
Родитель 6e1985e035
Коммит b1b6ca681a
8 изменённых файлов: 100 добавлений и 62 удалений

Просмотреть файл

@ -45,7 +45,8 @@ class Configuration(DescriptorProvider):
# Our build system doesn't support dep build involving
# addition/removal of "implements" statements that appear in a
# different .webidl file than their LHS interface. Make sure we
# don't have any of those.
# don't have any of those. See similar block below for partial
# interfaces!
#
# But whitelist a RHS that is LegacyQueryInterface,
# since people shouldn't be adding any of those.
@ -66,6 +67,33 @@ class Configuration(DescriptorProvider):
if not thing.isInterface() and not thing.isNamespace():
continue
iface = thing
# Our build system doesn't support dep builds involving
# addition/removal of partial interfaces that appear in a different
# .webidl file than the interface they are extending. Make sure we
# don't have any of those. See similar block above for "implements"
# statements!
if not iface.isExternal():
for partialIface in iface.getPartialInterfaces():
if (partialIface.filename() != iface.filename() and
# Unfortunately, NavigatorProperty does exactly the
# thing we're trying to prevent here. I'm not sure how
# to deal with that, short of effectively requiring a
# clobber when NavigatorProperty is added/removed and
# whitelisting the things it outputs here as
# restrictively as I can.
(partialIface.identifier.name != "Navigator" or
len(partialIface.members) != 1 or
partialIface.members[0].location != partialIface.location or
partialIface.members[0].identifier.location.filename() !=
"<builtin>")):
raise TypeError(
"The binding build system doesn't really support "
"partial interfaces which don't appear in the "
"file in which the interface they are extending is "
"defined. Don't do this.\n"
"%s\n"
"%s" %
(partialIface.location, iface.location))
self.interfaces[iface.identifier.name] = iface
if iface.identifier.name not in config:
# Completely skip consequential interfaces with no descriptor

Просмотреть файл

@ -1480,6 +1480,10 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
assert self.identifier.name == partial.identifier.name
self._partialInterfaces.append(partial)
def getPartialInterfaces(self):
# Don't let people mutate our guts.
return list(self._partialInterfaces)
def getJSImplementation(self):
classId = self.getExtendedAttribute("JSImplementation")
if not classId:

Просмотреть файл

@ -171,3 +171,51 @@ interface BrowserElementPrivileged {
DOMRequest getWebManifest();
};
// Bits needed for BrowserElementAudioChannel.
partial interface BrowserElementPrivileged {
[Pure, Cached, Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
readonly attribute sequence<BrowserElementAudioChannel> allowedAudioChannels;
/**
* Mutes all audio in this browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void mute();
/**
* Unmutes all audio in this browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void unmute();
/**
* Obtains whether or not the browser is muted.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
DOMRequest getMuted();
/**
* Sets the volume for the browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void setVolume(float volume);
/**
* Gets the volume for the browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
DOMRequest getVolume();
};

Просмотреть файл

@ -28,50 +28,3 @@ interface BrowserElementAudioChannel : EventTarget {
[Throws]
DOMRequest isActive();
};
partial interface BrowserElementPrivileged {
[Pure, Cached, Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
readonly attribute sequence<BrowserElementAudioChannel> allowedAudioChannels;
/**
* Mutes all audio in this browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void mute();
/**
* Unmutes all audio in this browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void unmute();
/**
* Obtains whether or not the browser is muted.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
DOMRequest getMuted();
/**
* Sets the volume for the browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
void setVolume(float volume);
/**
* Gets the volume for the browser.
*/
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
DOMRequest getVolume();
};

Просмотреть файл

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://notifications.spec.whatwg.org/
* https://notifications.spec.whatwg.org/
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
@ -96,10 +96,3 @@ enum NotificationDirection {
"ltr",
"rtl"
};
partial interface ServiceWorkerRegistration {
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
Promise<void> showNotification(DOMString title, optional NotificationOptions options);
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter);
};

Просмотреть файл

@ -20,8 +20,3 @@ interface NotificationEvent : ExtendableEvent {
dictionary NotificationEventInit : ExtendableEventInit {
required Notification notification;
};
partial interface ServiceWorkerGlobalScope {
attribute EventHandler onnotificationclick;
attribute EventHandler onnotificationclose;
};

Просмотреть файл

@ -5,6 +5,8 @@
*
* The origin of this IDL file is
* http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
* http://w3c.github.io/push-api/
* https://notifications.spec.whatwg.org/
*
* You are granted a license to use, reproduce and create derivative works of
* this document.
@ -34,3 +36,8 @@ partial interface ServiceWorkerGlobalScope {
attribute EventHandler onpushsubscriptionchange;
};
// https://notifications.spec.whatwg.org/
partial interface ServiceWorkerGlobalScope {
attribute EventHandler onnotificationclick;
attribute EventHandler onnotificationclose;
};

Просмотреть файл

@ -5,7 +5,8 @@
*
* The origin of this IDL file is
* http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
*
* https://w3c.github.io/push-api/
* https://notifications.spec.whatwg.org/
*/
[Func="mozilla::dom::ServiceWorkerRegistration::Visible",
@ -27,7 +28,16 @@ interface ServiceWorkerRegistration : EventTarget {
attribute EventHandler onupdatefound;
};
// https://w3c.github.io/push-api/
partial interface ServiceWorkerRegistration {
[Throws, Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
readonly attribute PushManager pushManager;
};
// https://notifications.spec.whatwg.org/
partial interface ServiceWorkerRegistration {
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
Promise<void> showNotification(DOMString title, optional NotificationOptions options);
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter);
};