Skip to content

Commit 5255e17

Browse files
committed
Backed out 6 changesets (bug 1489301) for Linting opt failure at /builds/worker/checkouts/gecko/dom/bindings/parser/WebIDL.py
Backed out changeset 1c0823540b44 (bug 1489301) Backed out changeset 529524df76a6 (bug 1489301) Backed out changeset f34bc8a40bec (bug 1489301) Backed out changeset 168cf9cea716 (bug 1489301) Backed out changeset 19ca10fa3772 (bug 1489301) Backed out changeset ff8fb091198e (bug 1489301)
1 parent 10810d7 commit 5255e17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+107
-104
lines changed

dom/base/nsGlobalWindowInner.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,8 +3095,7 @@ nsGlobalWindowInner::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aName
30953095
nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
30963096
{
30973097
// For now, have to deal with XPConnect objects here.
3098-
nsGlobalWindowInner* win = xpc::WindowOrNull(aObj);
3099-
return win && win->IsChromeWindow() &&
3098+
return xpc::WindowOrNull(aObj)->IsChromeWindow() &&
31003099
nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal();
31013100
}
31023101

dom/base/test/chrome/file_bug1139964.xul

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1139964
3232
ppm.removeMessageListener(msgName, processListener);
3333
ok(m.data.hasPromise, "ProcessGlobal should have Promise object in the global scope!");
3434
ok(m.data.hasTextEncoder, "ProcessGlobal should have TextEncoder object in the global scope!");
35-
ok(m.data.hasWindow, "ProcessGlobal should have Window object in the global scope!");
35+
ok(!m.data.hasWindow, "ProcessGlobal should not have Window object in the global scope!");
3636
3737
messageManager.addMessageListener(msgName, tabListener)
3838
messageManager.loadFrameScript("data:,(" + mmScriptForPromiseTest.toString() + ")()", true);
@@ -42,7 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1139964
4242
messageManager.removeMessageListener(msgName, tabListener);
4343
ok(m.data.hasPromise, "TabChildGlobal should have Promise object in the global scope!");
4444
ok(m.data.hasTextEncoder, "TabChildGlobal should have TextEncoder object in the global scope!");
45-
ok(m.data.hasWindow, "TabChildGlobal should have Window object in the global scope!");
45+
ok(!m.data.hasWindow, "TabChildGlobal should not have Window object in the global scope!");
4646
4747
opener.setTimeout("done()", 0);
4848
window.close();

dom/bindings/Codegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17199,7 +17199,7 @@ def ResolveSystemBinding(config):
1719917199
curr = CGList([], "\n")
1720017200

1720117201
descriptors = config.getDescriptors(hasInterfaceObject=True,
17202-
isExposedInWindow=True,
17202+
isExposedInSystemGlobals=True,
1720317203
register=True)
1720417204
properties = [desc.name for desc in descriptors]
1720517205

@@ -17244,7 +17244,7 @@ def ResolveSystemBinding(config):
1724417244
defineIncludes = [CGHeaders.getDeclarationFilename(desc.interface)
1724517245
for desc in config.getDescriptors(hasInterfaceObject=True,
1724617246
register=True,
17247-
isExposedInWindow=True)]
17247+
isExposedInSystemGlobals=True)]
1724817248
defineIncludes.append("nsThreadUtils.h") # For NS_IsMainThread
1724917249
defineIncludes.append("js/Id.h") # For jsid
1725017250
defineIncludes.append("mozilla/dom/WebIDLGlobalNameHash.h")

dom/bindings/Configuration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def getDescriptors(self, **filters):
250250
getter = lambda x: x.interface.isExposedInWorkerDebugger()
251251
elif key == 'isExposedInAnyWorklet':
252252
getter = lambda x: x.interface.isExposedInAnyWorklet()
253+
elif key == 'isExposedInSystemGlobals':
254+
getter = lambda x: x.interface.isExposedInSystemGlobals()
253255
elif key == 'isExposedInWindow':
254256
getter = lambda x: x.interface.isExposedInWindow()
255257
else:

dom/bindings/parser/WebIDL.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,6 @@ def lookupIdentifier(self, identifier):
327327
assert identifier.scope == self
328328
return self._lookupIdentifier(identifier)
329329

330-
def addIfaceGlobalNames(self, interfaceName, globalNames):
331-
"""Record the global names (from |globalNames|) that can be used in
332-
[Exposed] to expose things in a global named |interfaceName|"""
333-
self.globalNames.update(globalNames)
334-
for name in globalNames:
335-
self.globalNameMapping[name].add(interfaceName)
336-
337330

338331
class IDLIdentifier(IDLObject):
339332
def __init__(self, location, scope, name):
@@ -511,10 +504,8 @@ def isExposedInWindow(self):
511504
return 'Window' in self.exposureSet
512505

513506
def isExposedOnMainThread(self):
514-
return self.isExposedInWindow()
515-
516-
def isExposedOffMainThread(self):
517-
return len(self.exposureSet - {'Window'}) > 0
507+
return (self.isExposedInWindow() or
508+
self.isExposedInSystemGlobals())
518509

519510
def isExposedInAnyWorker(self):
520511
return len(self.getWorkerExposureSet()) > 0
@@ -525,6 +516,9 @@ def isExposedInWorkerDebugger(self):
525516
def isExposedInAnyWorklet(self):
526517
return len(self.getWorkletExposureSet()) > 0
527518

519+
def isExposedInSystemGlobals(self):
520+
return 'BackstagePass' in self.exposureSet
521+
528522
def isExposedInSomeButNotAllWorkers(self):
529523
"""
530524
Returns true if the Exposed extended attribute for this interface
@@ -1329,9 +1323,10 @@ def checkDuplicateNames(member, name, attributeName):
13291323
checkDuplicateNames(member, bindingAlias, "BindingAlias")
13301324

13311325

1332-
if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread():
1333-
raise WebIDLError("[Pref] used on an interface that is not "
1334-
"main-thread-only",
1326+
if (self.getExtendedAttribute("Pref") and
1327+
self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])):
1328+
raise WebIDLError("[Pref] used on an interface that is not %s-only" %
1329+
self.parentScope.primaryGlobalName,
13351330
[self.location])
13361331

13371332
# Conditional exposure makes no sense for interfaces with no
@@ -1715,8 +1710,9 @@ def addExtendedAttributes(self, attrs):
17151710
self.globalNames = attr.args()
17161711
else:
17171712
self.globalNames = [self.identifier.name]
1718-
self.parentScope.addIfaceGlobalNames(self.identifier.name,
1719-
self.globalNames)
1713+
self.parentScope.globalNames.update(self.globalNames)
1714+
for globalName in self.globalNames:
1715+
self.parentScope.globalNameMapping[globalName].add(self.identifier.name)
17201716
self._isOnGlobalProtoChain = True
17211717
elif identifier == "PrimaryGlobal":
17221718
if not attr.noArguments():
@@ -1729,8 +1725,8 @@ def addExtendedAttributes(self, attrs):
17291725
self.parentScope.primaryGlobalAttr.location])
17301726
self.parentScope.primaryGlobalAttr = attr
17311727
self.parentScope.primaryGlobalName = self.identifier.name
1732-
self.parentScope.addIfaceGlobalNames(self.identifier.name,
1733-
[self.identifier.name])
1728+
self.parentScope.globalNames.add(self.identifier.name)
1729+
self.parentScope.globalNameMapping[self.identifier.name].add(self.identifier.name)
17341730
self._isOnGlobalProtoChain = True
17351731
elif identifier == "SecureContext":
17361732
if not attr.noArguments():
@@ -3576,9 +3572,10 @@ def finish(self, scope):
35763572
IDLExposureMixins.finish(self, scope)
35773573

35783574
def validate(self):
3579-
if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread():
3575+
if (self.getExtendedAttribute("Pref") and
3576+
self.exposureSet != set([self._globalScope.primaryGlobalName])):
35803577
raise WebIDLError("[Pref] used on an interface member that is not "
3581-
"main-thread-only",
3578+
"%s-only" % self._globalScope.primaryGlobalName,
35823579
[self.location])
35833580

35843581
if self.isAttr() or self.isMethod():
@@ -6899,13 +6896,16 @@ def __init__(self, outputdir='', lexer=None):
68996896
logger.reportGrammarErrors()
69006897

69016898
self._globalScope = IDLScope(BuiltinLocation("<Global Scope>"), None, None)
6902-
69036899
# To make our test harness work, pretend like we have a primary global already.
69046900
# Note that we _don't_ set _globalScope.primaryGlobalAttr,
69056901
# so we'll still be able to detect multiple PrimaryGlobal extended attributes.
69066902
self._globalScope.primaryGlobalName = "FakeTestPrimaryGlobal"
6907-
self._globalScope.addIfaceGlobalNames("FakeTestPrimaryGlobal", ["FakeTestPrimaryGlobal"])
6908-
6903+
self._globalScope.globalNames.add("FakeTestPrimaryGlobal")
6904+
self._globalScope.globalNameMapping["FakeTestPrimaryGlobal"].add("FakeTestPrimaryGlobal")
6905+
# And we add the special-cased "System" global name, which
6906+
# doesn't have any corresponding interfaces.
6907+
self._globalScope.globalNames.add("System")
6908+
self._globalScope.globalNameMapping["System"].add("BackstagePass")
69096909
self._installBuiltins(self._globalScope)
69106910
self._productions = []
69116911

dom/chrome-webidl/BrowsingContext.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
interface nsIDocShell;
77

8-
[Exposed=Window, ChromeOnly]
8+
[Exposed=(Window, System), ChromeOnly]
99
interface BrowsingContext {
1010
readonly attribute BrowsingContext? parent;
1111

dom/chrome-webidl/ChannelWrapper.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum MozContentPolicyType {
4141
* A thin wrapper around nsIChannel and nsIHttpChannel that allows JS
4242
* callers to access them without XPConnect overhead.
4343
*/
44-
[ChromeOnly, Exposed=Window]
44+
[ChromeOnly, Exposed=System]
4545
interface ChannelWrapper : EventTarget {
4646
/**
4747
* Returns the wrapper instance for the given channel. The same wrapper is

dom/chrome-webidl/ChromeUtils.webidl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* C++ callers use a fast path, and never call the JSAPI or WebIDL methods of
1515
* this object.
1616
*/
17-
[ChromeOnly, Exposed=Window]
17+
[ChromeOnly, Exposed=(Window,System)]
1818
interface MozQueryInterface {
1919
[Throws]
2020
legacycaller any (IID aIID);
@@ -25,7 +25,7 @@ interface MozQueryInterface {
2525
* This is exposed in all the system globals where we can expose stuff by
2626
* default, so should only include methods that are **thread-safe**.
2727
*/
28-
[ChromeOnly, Exposed=(Window,Worker)]
28+
[ChromeOnly, Exposed=(Window,System,Worker)]
2929
namespace ChromeUtils {
3030
/**
3131
* Serialize a snapshot of the heap graph, as seen by |JS::ubi::Node| and
@@ -148,7 +148,7 @@ namespace ChromeUtils {
148148
* Additional ChromeUtils methods that are _not_ thread-safe, and hence not
149149
* exposed in workers.
150150
*/
151-
[Exposed=Window]
151+
[Exposed=(Window,System)]
152152
partial namespace ChromeUtils {
153153
/**
154154
* A helper that converts OriginAttributesDictionary to a opaque suffix string.

dom/chrome-webidl/DominatorTree.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef unsigned long long NodeSize;
3838
* its retained size is therefore significant (assuming no external
3939
* references into the tree).
4040
*/
41-
[ChromeOnly, Exposed=(Window,Worker)]
41+
[ChromeOnly, Exposed=(Window,System,Worker)]
4242
interface DominatorTree {
4343
/**
4444
* The `NodeId` for the root of the dominator tree. This is a "meta-root" in

dom/chrome-webidl/HeapSnapshot.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* A HeapSnapshot represents a snapshot of the heap graph
99
*/
10-
[ChromeOnly, Exposed=(Window,Worker)]
10+
[ChromeOnly, Exposed=(Window,System,Worker)]
1111
interface HeapSnapshot {
1212
/**
1313
* A time stamp of when the heap snapshot was taken, if available. Units are

0 commit comments

Comments
 (0)