Closed Bug 632064 Opened 14 years ago Closed 13 years ago

remove/deprecate JS_GetScopeChain in lieu of JS_GetGlobalForScopeChain

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: luke, Assigned: luke)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

mxr shoes that 100% of the uses of JS_GetScopeChain in Mozilla are to get at the scope chain's global. (Is there any other valid thing to do with it? Hopefully not implement some form of dynamic name lookup.) Since JS_GetGlobalForScopeChain is what everybody wants (and its more efficient in more than one way), can we nix JS_GetScopeChain or deprecate it and just have it return JS_GetGlobalForScopeChain? My motivation is that the less leaky API will give us more flexibility (bug 631135 is a weak example) and, when we get around to the scope chain overhaul (bug ?), scope chains won't be objects (while global objects clearly will). Simple patch. Will ask on the listserv if no immediate objections.
(In reply to comment #0) > (bug 631135 is a weak example) Hah, 1 hour later it becomes a strong example (end of bug 631135 comment 23).
Waldo's on it!
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Luke: bug 511781 is not the bug you have in mind.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
D'oh!
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → DUPLICATE
Bug 511781 never got fixed, but it will be fixed by compartment-per-global, so I'll fix this bug now.
Assignee: general → luke
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Blocks: 659577
Attached patch rmSplinter Review
This patch also fixes some annoying && || warnings.
Attachment #563462 - Flags: review?(mrbkap)
The assumption of this patch is that, whatever E4X wants to find on the scope chain, it causes a call-obj to be created and put on the scope chain, hence the lazy call-obj creation done by GetScopeChain is unnecessary. Is that correct Igor?
Attachment #564690 - Flags: review?(igor)
Comment on attachment 564690 [details] [diff] [review] rm xml uses of GetScopeChain Review of attachment 564690 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsxml.cpp @@ +1762,5 @@ > > { > Parser parser(cx); > if (parser.init(chars, length, filename, lineno, cx->findVersion())) { > + JSObject *scopeChain = GetCurrentScopeChain(cx); IIRC this scope chain can be replaced by the global. If so, then we can fold the GetCurrentScopeChain into js_GetDefaultXMLNamespace. But this can wait another bug.
Attachment #564690 - Flags: review?(igor) → review+
Attachment #563462 - Flags: review?(mrbkap) → review+
Keywords: dev-doc-needed
Status: REOPENED → RESOLVED
Closed: 14 years ago13 years ago
Resolution: --- → FIXED
Short notice at https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_GetScopeChain, that suggests using JS_GetGlobalForScopeChain. Added entry to 1.8.7 release notes.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: