mirror of
https://github.com/servo/servo.git
synced 2025-07-28 17:50:37 +01:00
Support [LegacyWindowAlias]
This commit is contained in:
parent
118a9ecdfe
commit
e81b678645
9 changed files with 32 additions and 33 deletions
|
@ -2925,13 +2925,14 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
||||||
|
|
||||||
properties should be a PropertyArrays instance.
|
properties should be a PropertyArrays instance.
|
||||||
"""
|
"""
|
||||||
def __init__(self, descriptor, properties, haveUnscopables):
|
def __init__(self, descriptor, properties, haveUnscopables, haveLegacyWindowAliases):
|
||||||
args = [Argument('SafeJSContext', 'cx'), Argument('HandleObject', 'global'),
|
args = [Argument('SafeJSContext', 'cx'), Argument('HandleObject', 'global'),
|
||||||
Argument('*mut ProtoOrIfaceArray', 'cache')]
|
Argument('*mut ProtoOrIfaceArray', 'cache')]
|
||||||
CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args,
|
CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args,
|
||||||
unsafe=True)
|
unsafe=True)
|
||||||
self.properties = properties
|
self.properties = properties
|
||||||
self.haveUnscopables = haveUnscopables
|
self.haveUnscopables = haveUnscopables
|
||||||
|
self.haveLegacyWindowAliases = haveLegacyWindowAliases
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
name = self.descriptor.interface.identifier.name
|
name = self.descriptor.interface.identifier.name
|
||||||
|
@ -2990,7 +2991,8 @@ assert!(!prototype_proto.is_null());""" % getPrototypeProto)]
|
||||||
|
|
||||||
properties = {
|
properties = {
|
||||||
"id": name,
|
"id": name,
|
||||||
"unscopables": "unscopable_names" if self.haveUnscopables else "&[]"
|
"unscopables": "unscopable_names" if self.haveUnscopables else "&[]",
|
||||||
|
"legacyWindowAliases": "legacy_window_aliases" if self.haveLegacyWindowAliases else "&[]"
|
||||||
}
|
}
|
||||||
for arrayName in self.properties.arrayNames():
|
for arrayName in self.properties.arrayNames():
|
||||||
array = getattr(self.properties, arrayName)
|
array = getattr(self.properties, arrayName)
|
||||||
|
@ -3058,6 +3060,7 @@ create_noncallback_interface_object(cx,
|
||||||
prototype.handle(),
|
prototype.handle(),
|
||||||
%(name)s,
|
%(name)s,
|
||||||
%(length)s,
|
%(length)s,
|
||||||
|
%(legacyWindowAliases)s,
|
||||||
interface.handle_mut());
|
interface.handle_mut());
|
||||||
assert!(!interface.is_null());""" % properties))
|
assert!(!interface.is_null());""" % properties))
|
||||||
if self.descriptor.shouldCacheConstructor():
|
if self.descriptor.shouldCacheConstructor():
|
||||||
|
@ -6266,6 +6269,15 @@ class CGDescriptor(CGThing):
|
||||||
if descriptor.weakReferenceable:
|
if descriptor.weakReferenceable:
|
||||||
cgThings.append(CGWeakReferenceableTrait(descriptor))
|
cgThings.append(CGWeakReferenceableTrait(descriptor))
|
||||||
|
|
||||||
|
legacyWindowAliases = descriptor.interface.legacyWindowAliases
|
||||||
|
haveLegacyWindowAliases = len(legacyWindowAliases) != 0
|
||||||
|
if haveLegacyWindowAliases:
|
||||||
|
cgThings.append(
|
||||||
|
CGList([CGGeneric("const legacy_window_aliases: &'static [&'static [u8]] = &["),
|
||||||
|
CGIndenter(CGList([CGGeneric(str_to_const_array(name)) for
|
||||||
|
name in legacyWindowAliases], ",\n")),
|
||||||
|
CGGeneric("];\n")], "\n"))
|
||||||
|
|
||||||
cgThings.append(CGGeneric(str(properties)))
|
cgThings.append(CGGeneric(str(properties)))
|
||||||
|
|
||||||
if not descriptor.interface.getExtendedAttribute("Inline"):
|
if not descriptor.interface.getExtendedAttribute("Inline"):
|
||||||
|
@ -6287,7 +6299,8 @@ class CGDescriptor(CGThing):
|
||||||
cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
|
cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
|
||||||
reexports.append('DefineDOMInterface')
|
reexports.append('DefineDOMInterface')
|
||||||
cgThings.append(CGConstructorEnabled(descriptor))
|
cgThings.append(CGConstructorEnabled(descriptor))
|
||||||
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables))
|
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables,
|
||||||
|
haveLegacyWindowAliases))
|
||||||
|
|
||||||
cgThings = generate_imports(config, CGList(cgThings, '\n'), [descriptor])
|
cgThings = generate_imports(config, CGList(cgThings, '\n'), [descriptor])
|
||||||
cgThings = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name),
|
cgThings = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name),
|
||||||
|
@ -7453,6 +7466,8 @@ class GlobalGenRoots():
|
||||||
for d in config.getDescriptors(hasInterfaceObject=True, isInline=False):
|
for d in config.getDescriptors(hasInterfaceObject=True, isInline=False):
|
||||||
binding = toBindingNamespace(d.name)
|
binding = toBindingNamespace(d.name)
|
||||||
pairs.append((d.name, binding, binding))
|
pairs.append((d.name, binding, binding))
|
||||||
|
for alias in d.interface.legacyWindowAliases:
|
||||||
|
pairs.append((alias, binding, binding))
|
||||||
for ctor in d.interface.namedConstructors:
|
for ctor in d.interface.namedConstructors:
|
||||||
pairs.append((ctor.identifier.name, binding, binding))
|
pairs.append((ctor.identifier.name, binding, binding))
|
||||||
pairs.sort(key=operator.itemgetter(0))
|
pairs.sort(key=operator.itemgetter(0))
|
||||||
|
|
|
@ -238,6 +238,7 @@ pub fn create_noncallback_interface_object(
|
||||||
interface_prototype_object: HandleObject,
|
interface_prototype_object: HandleObject,
|
||||||
name: &[u8],
|
name: &[u8],
|
||||||
length: u32,
|
length: u32,
|
||||||
|
legacy_window_alias_names: &[&[u8]],
|
||||||
rval: MutableHandleObject,
|
rval: MutableHandleObject,
|
||||||
) {
|
) {
|
||||||
create_object(
|
create_object(
|
||||||
|
@ -260,6 +261,12 @@ pub fn create_noncallback_interface_object(
|
||||||
define_name(cx, rval.handle(), name);
|
define_name(cx, rval.handle(), name);
|
||||||
define_length(cx, rval.handle(), i32::try_from(length).expect("overflow"));
|
define_length(cx, rval.handle(), i32::try_from(length).expect("overflow"));
|
||||||
define_on_global_object(cx, global, name, rval.handle());
|
define_on_global_object(cx, global, name, rval.handle());
|
||||||
|
|
||||||
|
if is_exposed_in(global, Globals::WINDOW) {
|
||||||
|
for legacy_window_alias in legacy_window_alias_names {
|
||||||
|
define_on_global_object(cx, global, legacy_window_alias, rval.handle());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create and define the named constructors of a non-callback interface.
|
/// Create and define the named constructors of a non-callback interface.
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
* related or neighboring rights to this work.
|
* related or neighboring rights to this work.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker),
|
||||||
|
LegacyWindowAlias=WebKitCSSMatrix]
|
||||||
interface DOMMatrix : DOMMatrixReadOnly {
|
interface DOMMatrix : DOMMatrixReadOnly {
|
||||||
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
|
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#url
|
// https://url.spec.whatwg.org/#url
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker),
|
||||||
|
LegacyWindowAlias=webkitURL]
|
||||||
interface URL {
|
interface URL {
|
||||||
[Throws] constructor(USVString url, optional USVString base);
|
[Throws] constructor(USVString url, optional USVString base);
|
||||||
[SetterThrows]
|
[SetterThrows]
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
[WebKitCSSMatrix.html]
|
|
||||||
[Equivalence test]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Property descriptor for WebKitCSSMatrix]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
[idlharness.any.html]
|
|
||||||
[idlharness]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Testing Symbol.iterator property of iterable interface URLSearchParams]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[URL interface: legacy window alias]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
||||||
[idlharness.any.worker.html]
|
|
||||||
[idlharness]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Testing Symbol.iterator property of iterable interface URLSearchParams]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -18966,11 +18966,11 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/interfaces.html": [
|
"mozilla/interfaces.html": [
|
||||||
"7aed97b42d8fe974ea489db66905d9fbc0edb84d",
|
"1207eaa2d8ff55e0c2216086b5a2c90a41ff78cf",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/interfaces.js": [
|
"mozilla/interfaces.js": [
|
||||||
"26db0c23e544d38f02b9573ffaa44bf5dee8370a",
|
"f1854a3ae00493554006ad2c483489f4be8450a6",
|
||||||
"support"
|
"support"
|
||||||
],
|
],
|
||||||
"mozilla/interfaces.worker.js": [
|
"mozilla/interfaces.worker.js": [
|
||||||
|
|
|
@ -244,6 +244,7 @@ test_interfaces([
|
||||||
"WebGLObject",
|
"WebGLObject",
|
||||||
"WebGLActiveInfo",
|
"WebGLActiveInfo",
|
||||||
"WebGLShaderPrecisionFormat",
|
"WebGLShaderPrecisionFormat",
|
||||||
|
"WebKitCSSMatrix",
|
||||||
"WebSocket",
|
"WebSocket",
|
||||||
"WheelEvent",
|
"WheelEvent",
|
||||||
"Window",
|
"Window",
|
||||||
|
|
|
@ -45,7 +45,6 @@ function test_interfaces(interfaceNamesInGlobalScope) {
|
||||||
"Uint32Array",
|
"Uint32Array",
|
||||||
"Uint8Array",
|
"Uint8Array",
|
||||||
"Uint8ClampedArray",
|
"Uint8ClampedArray",
|
||||||
"Uint8ClampedArray",
|
|
||||||
"WeakMap",
|
"WeakMap",
|
||||||
"WeakSet",
|
"WeakSet",
|
||||||
"WebAssembly",
|
"WebAssembly",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue