author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 13 Nov 2012 00:26:55 -0800 | |
changeset 113069 | 2378c3dd095d6a27e5ae93a2f8bfbdabb8098045 |
parent 113068 | a1e3296bcd218d8e284e800acbe71325eaeab0b1 |
child 113070 | 92cb4a2c1ed4d51eb37d9ccf467fa7abacdd5772 |
push id | 17925 |
push user | bzbarsky@mozilla.com |
push date | Tue, 13 Nov 2012 08:27:11 +0000 |
treeherder | mozilla-inbound@92cb4a2c1ed4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | peterv |
bugs | 810520 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/bindings/Codegen.py | file | annotate | diff | comparison | revisions | |
dom/tests/mochitest/chrome/test_sandbox_bindings.xul | file | annotate | diff | comparison | revisions |
--- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1022,21 +1022,18 @@ class PropertyDefiner: if chrome: if self.hasChromeOnly(): return "sChrome" + self.name else: if self.hasNonChromeOnly(): return "s" + self.name return "nullptr" def usedForXrays(self): - # We only need Xrays for methods, attributes and constants, but in - # workers there are no Xrays. - return (self.name is "Methods" or self.name is "Attributes" or - self.name is "UnforgeableAttributes" or - self.name is "Constants") and not self.descriptor.workers + # No Xrays in workers. + return not self.descriptor.workers def __str__(self): # We only need to generate id arrays for things that will end # up used via ResolveProperty or EnumerateProperties. str = self.generateArray(self.regular, self.variableName(False), self.usedForXrays()) if self.hasChromeOnly(): str += self.generateArray(self.chrome, self.variableName(True), @@ -1359,36 +1356,38 @@ class CGNativeProperties(CGList): def generateNativeProperties(name, chrome): def check(p): return p.hasChromeOnly() if chrome else p.hasNonChromeOnly() nativeProps = [] for array in properties.arrayNames(): propertyArray = getattr(properties, array) if check(propertyArray): - if descriptor.workers: - props = "%(name)s, nullptr, %(name)s_specs" + if propertyArray.usedForXrays(): + ids = "%(name)s_ids" else: - if propertyArray.usedForXrays(): - ids = "%(name)s_ids" - else: - ids = "nullptr" - props = "%(name)s, " + ids + ", %(name)s_specs" + ids = "nullptr" + props = "%(name)s, " + ids + ", %(name)s_specs" props = (props % { 'name': propertyArray.variableName(chrome) }) else: props = "nullptr, nullptr, nullptr" nativeProps.append(CGGeneric(props)) return CGWrapper(CGIndenter(CGList(nativeProps, ",\n")), pre="static const NativeProperties %s = {\n" % name, post="\n};") - - regular = generateNativeProperties("sNativeProperties", False) - chrome = generateNativeProperties("sChromeOnlyNativeProperties", True) - CGList.__init__(self, [regular, chrome], "\n\n") + + nativeProperties = [] + if properties.hasNonChromeOnly(): + nativeProperties.append( + generateNativeProperties("sNativeProperties", False)) + if properties.hasChromeOnly(): + nativeProperties.append( + generateNativeProperties("sChromeOnlyNativeProperties", True)) + CGList.__init__(self, nativeProperties, "\n\n") def declare(self): return "" class CGCreateInterfaceObjectsMethod(CGAbstractMethod): """ Generate the CreateInterfaceObjects method for an interface descriptor.
--- a/dom/tests/mochitest/chrome/test_sandbox_bindings.xul +++ b/dom/tests/mochitest/chrome/test_sandbox_bindings.xul @@ -176,16 +176,26 @@ https://bugzilla.mozilla.org/show_bug.cg "'constructor' property should not be enumerable on proto directly"); props = Object.getOwnPropertyNames(proto); isnot(props.indexOf("constructor"), -1, "'constructor' property should be an own property name on proto"); } catch (e) { ok(false, "NodeList.prototype manipulation via an Xray shouldn't throw" + e); } + try { + var url = Components.utils.evalInSandbox("URL", sandbox); + for (var i in url) { + url[i]; + } + ok(true, "We didn't crash!"); + } catch (e) { + ok(false, "URL interface object manipulation via an Xray shouldn't throw" + e); + } + SimpleTest.finish(); } SimpleTest.waitForExplicitFinish(); addLoadEvent(doTest); ]]> </script> </window>