mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1473492 part 1. Remove support for clearing cached attributes on JS-implemented webidl object. r=mccr8
This more or less backs out bug 963382.
This commit is contained in:
parent
b3566f60bb
commit
ba8705c5c6
@ -2234,10 +2234,6 @@ def MakeClearCachedValueNativeName(member):
|
||||
return "ClearCached%sValue" % MakeNativeName(member.identifier.name)
|
||||
|
||||
|
||||
def MakeJSImplClearCachedValueNativeName(member):
|
||||
return "_" + MakeClearCachedValueNativeName(member)
|
||||
|
||||
|
||||
def IDLToCIdentifier(name):
|
||||
return name.replace("-", "_")
|
||||
|
||||
@ -2434,17 +2430,6 @@ class MethodDefiner(PropertyDefiner):
|
||||
"flags": "0",
|
||||
"condition": MemberCondition()
|
||||
})
|
||||
elif not unforgeable:
|
||||
for m in clearableCachedAttrs(descriptor):
|
||||
attrName = MakeNativeName(m.identifier.name)
|
||||
self.chrome.append({
|
||||
"name": "_clearCached%sValue" % attrName,
|
||||
"nativeName": MakeJSImplClearCachedValueNativeName(m),
|
||||
"methodInfo": False,
|
||||
"length": "0",
|
||||
"flags": "0",
|
||||
"condition": MemberCondition()
|
||||
})
|
||||
|
||||
self.unforgeable = unforgeable
|
||||
|
||||
@ -12418,11 +12403,6 @@ class CGDescriptor(CGThing):
|
||||
if descriptor.concrete and descriptor.wrapperCache and not descriptor.proxy:
|
||||
cgThings.append(CGClassObjectMovedHook(descriptor))
|
||||
|
||||
# Generate the _ClearCachedFooValue methods before the property arrays that use them.
|
||||
if descriptor.interface.isJSImplemented():
|
||||
for m in clearableCachedAttrs(descriptor):
|
||||
cgThings.append(CGJSImplClearCachedValueMethod(descriptor, m))
|
||||
|
||||
properties = PropertyArrays(descriptor)
|
||||
cgThings.append(CGGeneric(define=str(properties)))
|
||||
cgThings.append(CGNativeProperties(descriptor, properties))
|
||||
@ -13938,11 +13918,7 @@ class CGBindingRoot(CGThing):
|
||||
# interface object might have a ChromeOnly constructor.
|
||||
(desc.interface.hasInterfaceObject() and
|
||||
(desc.interface.isJSImplemented() or
|
||||
(ctor and isChromeOnly(ctor)))) or
|
||||
# JS-implemented interfaces with clearable cached
|
||||
# attrs have chromeonly _clearFoo methods.
|
||||
(desc.interface.isJSImplemented() and
|
||||
any(clearableCachedAttrs(desc))))
|
||||
(ctor and isChromeOnly(ctor)))))
|
||||
|
||||
# XXXkhuey ugly hack but this is going away soon.
|
||||
bindingHeaders['xpcprivate.h'] = webIDLFile.endswith("EventTarget.webidl")
|
||||
@ -15130,27 +15106,6 @@ def callbackSetterName(attr, descriptor):
|
||||
descriptor.binaryNameFor(attr.identifier.name))
|
||||
|
||||
|
||||
class CGJSImplClearCachedValueMethod(CGAbstractBindingMethod):
|
||||
def __init__(self, descriptor, attr):
|
||||
if attr.getExtendedAttribute("StoreInSlot"):
|
||||
raise TypeError("[StoreInSlot] is not supported for JS-implemented WebIDL. See bug 1056325.")
|
||||
|
||||
CGAbstractBindingMethod.__init__(self, descriptor,
|
||||
MakeJSImplClearCachedValueNativeName(attr),
|
||||
JSNativeArguments())
|
||||
self.attr = attr
|
||||
|
||||
def generate_code(self):
|
||||
return CGGeneric(fill(
|
||||
"""
|
||||
${bindingNamespace}::${fnName}(self);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
""",
|
||||
bindingNamespace=toBindingNamespace(self.descriptor.name),
|
||||
fnName=MakeClearCachedValueNativeName(self.attr)))
|
||||
|
||||
|
||||
class CGJSImplGetter(CGJSImplMember):
|
||||
"""
|
||||
Class for generating code for the getters of attributes for a JS-implemented
|
||||
|
@ -23,7 +23,6 @@ TestInterfaceJS.prototype = {
|
||||
this._anyArg = anyArg;
|
||||
this._objectArg = objectArg;
|
||||
this._dictionaryArg = dictionaryArg;
|
||||
this._cachedAttr = 15;
|
||||
},
|
||||
|
||||
get anyArg() { return this._anyArg; },
|
||||
@ -54,10 +53,6 @@ TestInterfaceJS.prototype = {
|
||||
pingPongNullableUnion: function(x) { return x; },
|
||||
returnBadUnion: function(x) { return 3; },
|
||||
|
||||
get cachedAttr() { return this._cachedAttr; },
|
||||
setCachedAttr: function(n) { this._cachedAttr = n; },
|
||||
clearCachedAttrCache: function () { this.__DOM_IMPL__._clearCachedCachedAttrValue(); },
|
||||
|
||||
testSequenceOverload: function(arg) {},
|
||||
testSequenceUnion: function(arg) {},
|
||||
|
||||
|
@ -20,8 +20,6 @@ support-files =
|
||||
[test_bug862092.html]
|
||||
[test_bug1036214.html]
|
||||
skip-if = debug == false
|
||||
[test_bug963382.html]
|
||||
skip-if = debug == false
|
||||
[test_bug1041646.html]
|
||||
[test_bug1123875.html]
|
||||
[test_barewordGetsWindow.html]
|
||||
|
@ -1,43 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=963382
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 963382</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for clearing cache attributes in JS-implemented WebIDL implementations. **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
|
||||
|
||||
function go() {
|
||||
var t = new TestInterfaceJS();
|
||||
|
||||
// Test [Cached] attribute clearing.
|
||||
is(t.cachedAttr, 15, "Initial value of number");
|
||||
|
||||
t.setCachedAttr(3);
|
||||
is(t.cachedAttr, 15, "Setting the number on the inner JS object should not affect cached value");
|
||||
|
||||
t.clearCachedAttrCache();
|
||||
is(t.cachedAttr, 3, "Setting the number on the inner JS object should affect cached value after clearing the cache.");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=963382">Mozilla Bug 963382</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -38,11 +38,6 @@ interface TestInterfaceJS : EventTarget {
|
||||
(TestInterfaceJS or long)? pingPongNullableUnion((TestInterfaceJS or long)? something);
|
||||
(Location or TestInterfaceJS) returnBadUnion();
|
||||
|
||||
[Cached, Pure]
|
||||
readonly attribute short cachedAttr;
|
||||
void setCachedAttr(short n);
|
||||
void clearCachedAttrCache();
|
||||
|
||||
// Test for sequence overloading and union behavior
|
||||
void testSequenceOverload(sequence<DOMString> arg);
|
||||
void testSequenceOverload(DOMString arg);
|
||||
|
Loading…
Reference in New Issue
Block a user