Bug 1578173 part 3. Remove ChromeConstructor. r=edgar

Differential Revision: https://phabricator.services.mozilla.com/D45390

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-09-11 21:04:12 +00:00
Родитель 5d31299907
Коммит 122af58092
6 изменённых файлов: 26 добавлений и 99 удалений

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

@ -1714,7 +1714,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
[self.location])
self._noInterfaceObject = True
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "HTMLConstructor":
if identifier == "Constructor" and not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
@ -1723,10 +1723,6 @@ class IDLInterface(IDLInterfaceOrNamespace):
raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list",
[attr.location])
if identifier == "ChromeConstructor" and not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if identifier == "HTMLConstructor":
if not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
@ -1745,7 +1741,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
retType = IDLWrapperType(self.location, self)
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
if identifier == "Constructor" or identifier == "HTMLConstructor":
name = "constructor"
allowForbidden = True
else:
@ -1761,11 +1757,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
# indicate otherwise).
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("Throws",))])
if identifier == "ChromeConstructor":
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("ChromeOnly",))])
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
if identifier == "Constructor" or identifier == "HTMLConstructor":
method.resolve(self)
else:
# We need to detect conflicts for NamedConstructors across

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

@ -108,22 +108,7 @@ def WebIDLTest(parser, harness):
parser = parser.reset()
parser.parse("""
[ChromeConstructor()]
interface TestChromeConstructor {
};
""")
results = parser.finish()
harness.check(len(results), 1, "Should be one production")
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestChromeConstructor::constructor",
"constructor", [("TestChromeConstructor (Wrapper)", [])],
chromeOnly=True)
parser = parser.reset()
parser.parse("""
interface TestChromeConstructor {
interface TestChromeOnlyConstructor {
[ChromeOnly] constructor();
};
""")
@ -132,8 +117,8 @@ def WebIDLTest(parser, harness):
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestChromeConstructor::constructor",
"constructor", [("TestChromeConstructor (Wrapper)", [])],
checkMethod(results[0].ctor(), "::TestChromeOnlyConstructor::constructor",
"constructor", [("TestChromeOnlyConstructor (Wrapper)", [])],
chromeOnly=True)
parser = parser.reset()
@ -155,16 +140,16 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Constructor(),
ChromeConstructor(DOMString a)]
interface TestChromeConstructor {
interface TestChromeOnlyConstructor {
constructor()
[ChromeOnly] constructor(DOMString a);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a Constructor and a ChromeConstructor")
harness.ok(threw, "Can't have both a constructor and a ChromeOnly constructor")
# Test HTMLConstructor with argument
parser = parser.reset()
@ -324,65 +309,6 @@ def WebIDLTest(parser, harness):
"Can't have both a HTMLConstructor and a throwing constructor "
"operation")
# Test HTMLConstructor and ChromeConstructor
parser = parser.reset()
threw = False
try:
parser.parse("""
[ChromeConstructor,
HTMLConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
ChromeConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[ChromeConstructor(DOMString a),
HTMLConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
ChromeConstructor(DOMString a)]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
# Test HTMLConstructor and [ChromeOnly] constructor operation
parser = parser.reset()
threw = False

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

@ -13,9 +13,11 @@
interface Principal;
[Exposed=(Window,Worker),
ChromeConstructor(CacheStorageNamespace namespace, Principal principal),
Pref="dom.caches.enabled"]
interface CacheStorage {
[Throws, ChromeOnly]
constructor(CacheStorageNamespace namespace, Principal principal);
[NewObject]
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options = {});
[NewObject]

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

@ -16,10 +16,12 @@
* https://microsoftedge.github.io/directory-upload/proposal.html#directory-interface
*/
// This chromeConstructor is used by the MockFilePicker for testing only.
[ChromeConstructor(DOMString path),
Exposed=(Window,Worker)]
[Exposed=(Window,Worker)]
interface Directory {
// This ChromeOnly constructor is used by the MockFilePicker for testing only.
[Throws, ChromeOnly]
constructor(DOMString path);
/*
* The leaf name of the directory.
*/

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

@ -22,9 +22,11 @@ interface PushManagerImpl {
Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
};
[Exposed=(Window,Worker), Pref="dom.push.enabled",
ChromeConstructor(DOMString scope)]
[Exposed=(Window,Worker), Pref="dom.push.enabled"]
interface PushManager {
[Throws, ChromeOnly]
constructor(DOMString scope);
[Throws, UseCounter]
Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
[Throws]

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

@ -39,10 +39,12 @@ dictionary PushSubscriptionInit
BufferSource? appServerKey;
};
[Exposed=(Window,Worker), Pref="dom.push.enabled",
ChromeConstructor(PushSubscriptionInit initDict)]
[Exposed=(Window,Worker), Pref="dom.push.enabled"]
interface PushSubscription
{
[Throws, ChromeOnly]
constructor(PushSubscriptionInit initDict);
readonly attribute USVString endpoint;
readonly attribute PushSubscriptionOptions options;
[Throws]