Closed
Bug 707564
Opened 13 years ago
Closed 11 years ago
force the properties onto navigator in the enumerate hook
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: fabrice, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
1.06 KB,
patch
|
gal
:
review+
|
Details | Diff | Splinter Review |
3.66 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
13.70 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
10.75 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
navigator properties that are added with the JavaScript-navigator-property category should be enumerated on the navigator object
Updated•13 years ago
|
Version: unspecified → Trunk
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #783663 -
Flags: review?(fabrice)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #783665 -
Flags: review?(bugs)
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #783666 -
Flags: review?(bugs)
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #783667 -
Flags: review?(bugs)
Updated•11 years ago
|
Attachment #783663 -
Flags: review?(fabrice) → review+
Updated•11 years ago
|
Attachment #783665 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 5•11 years ago
|
||
Try run: https://tbpl.mozilla.org/?tree=Try&rev=ce48e9675973
Comment 6•11 years ago
|
||
Comment on attachment 783666 [details] [diff] [review] part 3. Give WebIDL bindings with NewResolve hooks Enumerate hooks as well, so enumerating them correctly resolves all the properties. I don't understand this. Why do we want those properties to be own properties? Shouldn't they be getters(/setters?) in prototype and that way enumerable? Clearing r? for now.
Attachment #783666 -
Flags: review?(bugs)
Updated•11 years ago
|
Attachment #783667 -
Flags: review?(bugs)
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 783666 [details] [diff] [review] part 3. Give WebIDL bindings with NewResolve hooks Enumerate hooks as well, so enumerating them correctly resolves all the properties. We just want to be consistent. The resolve hook resolves these as own properties, so the enumerate hook should enumerate them. Long-term we do want the navigator category stuff to be on the proto somehow, but we just haven't figured out how. At the point at which we manage to do that, we'll almost certainly no longer need this code or a resolve hook at all: setting up Navigator.prototype would just enumerate the prop names and set up accessors.
Attachment #783666 -
Flags: review?(bugs)
Assignee | ||
Comment 8•11 years ago
|
||
Comment on attachment 783667 [details] [diff] [review] part 4. Teach WebIDL Xrays about the GetOwnProperties methods on WebIDL objects that have NewResolve. Again, this is just being consistent with the resolve hook's behavior.
Attachment #783667 -
Flags: review?(bugs)
Comment 9•11 years ago
|
||
Thanks for explaining. I'll try to review these still today.
Comment 10•11 years ago
|
||
Comment on attachment 783666 [details] [diff] [review] part 3. Give WebIDL bindings with NewResolve hooks Enumerate hooks as well, so enumerating them correctly resolves all the properties. nsScriptNameSpaceManager *nameSpaceManager -> nsScriptNameSpaceManager* nameSpaceManager In the test could you try also for-in.
Attachment #783666 -
Flags: review?(bugs) → review+
Comment 11•11 years ago
|
||
Comment on attachment 783667 [details] [diff] [review] part 4. Teach WebIDL Xrays about the GetOwnProperties methods on WebIDL objects that have NewResolve. >+class CGEnumerateOwnPropertiesViaGetOwnPropertyNames(CGAbstractBindingMethod): >+ """ >+ An implementation of Xray EnumerateOwnProperties stuff for things >+ that have a newresolve hook. >+ """ >+ def __init__(self, descriptor): >+ args = [Argument('JSContext*', 'cx'), >+ Argument('JS::Handle<JSObject*>', 'wrapper'), >+ Argument('JS::Handle<JSObject*>', 'obj'), >+ Argument('JS::AutoIdVector&', 'props')] Not about this bug, but the generated code, and I believe even the codegen itself would be easier to read if aFoo style was used for parameters. >+ CGAbstractBindingMethod.__init__(self, descriptor, >+ "EnumerateOwnPropertiesViaGetOwnPropertyNames", >+ args, getThisObj="", >+ callArgs="", returnType="bool") >+ def generate_code(self): >+ return CGIndenter(CGGeneric( >+ "nsAutoTArray<nsString, 8> names;\n" >+ "ErrorResult rv;\n" >+ "self->GetOwnPropertyNames(cx, names, rv);\n" >+ "rv.WouldReportJSException();\n" >+ "if (rv.Failed()) {\n" >+ ' return ThrowMethodFailedWithDetails<true>(cx, rv, "%s", "enumerate");\n' >+ "}\n" >+ '// OK to pass "obj" as "proxy" because it\'s ignored if\n' >+ "// shadowPrototypeProperties is true\n" >+ "return DOMProxyHandler::AppendNamedPropertyIds(cx, JS::NullPtr(), names, true, nullptr, props);")) well, you don't pass obj, and nullptr makes more sense anyway. Remove the comment. >+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=707564">Mozilla Bug 707564</a> >+<p id="display"></p> >+<div id="content" style="display: none"> >+<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_bug707564.html"></iframe> >+</div> >+<pre id="test"> >+<script type="application/javascript"> >+ >+/** Test for Bug 775543 **/ >+function test() >+{ >+ var props = Object.getOwnPropertyNames(XPCNativeWrapper(document.getElementById("t").contentWindow.navigator)); >+ isnot(props.indexOf("mozApps"), -1, >+ "Should enumerate a mozApps property on navigator xray"); Could you test for-in, and perhaps also some expando property. I need to still understand how CGEnumerateOwnPropertiesViaGetOwnPropertyNames is actually about XRay
Comment 12•11 years ago
|
||
Ah, http://mxr.mozilla.org/mozilla-central/source/dom/bindings/DOMJSClass.h#126 helps
Comment 13•11 years ago
|
||
Comment on attachment 783667 [details] [diff] [review] part 4. Teach WebIDL Xrays about the GetOwnProperties methods on WebIDL objects that have NewResolve. Please file a bug about making Navigator stuff to use prototype.
Attachment #783667 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 14•11 years ago
|
||
> In the test could you try also for-in. Will do. > the generated code, and I believe even the codegen itself would be > easier to read if aFoo style was used for parameters. Let's take that up with peterv when he gets back. ;) > well, you don't pass obj, and nullptr makes more sense anyway. Remove the comment. Done; it was left over from a previous patch version. > Could you test for-in, and perhaps also some expando property. I can test for/in. For the expando bit you mean test that it's not present?
Assignee | ||
Comment 15•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ddad646a1d86 https://hg.mozilla.org/integration/mozilla-inbound/rev/5e13fb5ddfae https://hg.mozilla.org/integration/mozilla-inbound/rev/db968c9c8831 https://hg.mozilla.org/integration/mozilla-inbound/rev/54e8477f4415
Flags: in-testsuite+
Target Milestone: --- → mozilla25
Assignee | ||
Comment 16•11 years ago
|
||
And https://hg.mozilla.org/integration/mozilla-inbound/rev/aab25110bbc3 to deal with jsapi merge bustage.
Assignee | ||
Comment 17•11 years ago
|
||
And https://hg.mozilla.org/integration/mozilla-inbound/rev/0868beaeab71 to deal with push notifications code not following the JS-implemented webidl contract.
Comment 18•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ddad646a1d86 https://hg.mozilla.org/mozilla-central/rev/5e13fb5ddfae https://hg.mozilla.org/mozilla-central/rev/db968c9c8831 https://hg.mozilla.org/mozilla-central/rev/54e8477f4415 https://hg.mozilla.org/mozilla-central/rev/aab25110bbc3 https://hg.mozilla.org/mozilla-central/rev/0868beaeab71
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•