Closed
Bug 880367
Opened 12 years ago
Closed 11 years ago
Add support for [ChromeOnly] interface objects
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: bent.mozilla, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 3 obsolete files)
2.64 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
5.29 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
15.83 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
Add support for [ChromeOnly] interface objects. I need this for ChromeWorker, for example.
Updated•12 years ago
|
Blocks: ParisBindings
Assignee | ||
Comment 1•12 years ago
|
||
What should happen with "content.ChromeWorker" in chrome code? Should it just come back undefined?
That is, should we unwrap Xrays before doing the "is chrome?" check?
Assignee | ||
Comment 2•12 years ago
|
||
OK, so I have patches. I have read the resulting codegen, but I have not tested them at runtime.... I assume bent will add some tests.
Assignee | ||
Comment 3•12 years ago
|
||
Bobby, can you look over the xpcpublic and classinfo changes wrt Xray stuff?
Attachment #759357 -
Flags: review?(bugs)
Attachment #759357 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bzbarsky
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #759358 -
Flags: review?(bugs)
Assignee | ||
Comment 5•12 years ago
|
||
Attachment #759359 -
Flags: review?(bugs)
Assignee | ||
Comment 6•12 years ago
|
||
Oh, and the point is that content.ChromeWorker should end up undefined, which is why we unwrap the Xray _before_ the enabled check.
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #759563 -
Flags: review?(bugs)
Attachment #759563 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Updated•11 years ago
|
Attachment #759357 -
Attachment is obsolete: true
Attachment #759357 -
Flags: review?(bugs)
Attachment #759357 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 8•11 years ago
|
||
Attachment #759571 -
Flags: review?(bugs)
Attachment #759571 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Updated•11 years ago
|
Attachment #759563 -
Attachment is obsolete: true
Attachment #759563 -
Flags: review?(bugs)
Attachment #759563 -
Flags: review?(bobbyholley+bmo)
Comment 9•11 years ago
|
||
Comment on attachment 759358 [details] [diff] [review]
part 2. Make ordering of named constructors in codegen deterministic. ran into this when looking at the diff in codegen from part 1.
Looks fine, but could you improve the comment saying why deterministic ordering is needed.
Attachment #759358 -
Flags: review?(bugs) → review+
Comment 10•11 years ago
|
||
Comment on attachment 759571 [details] [diff] [review]
Part 1 really building
> union {
> mozilla::dom::DefineInterface mDefineDOMInterface; // for window
> mozilla::dom::ConstructNavigatorProperty mConstructNavigatorProperty; // for navigator
> };
>- mozilla::dom::PrefEnabled mPrefEnabled; // May be null if not pref controlled
>+ // May be null if enabled unconditionally
>+ mozilla::dom::ConstructorEnabled mConstructorEnabled;
I'd prefer having * explicitly in this kind of member variable indicating that in can be null.
Same with parameters pointing to a function
Attachment #759571 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 11•11 years ago
|
||
> I'd prefer having * explicitly in this kind of member variable
Wouldn't that make it a pointer to a function pointer? That seems pretty odd...
Comment 12•11 years ago
|
||
Oh, why :: with ConstructorEnabled? Just because of that odd coding style of DOMCI?
Assignee | ||
Comment 13•11 years ago
|
||
> Oh, why :: with ConstructorEnabled?
Because there is a static function DOMCI called ConstructorEnabled and also the mozilla::dom::ConstructorEnabled typedef and the bareword reference is ambiguous.
Comment 14•11 years ago
|
||
Comment on attachment 759359 [details] [diff] [review]
part 3. Add support for [ChromeOnly] on interface objects.
...looking still part 1 again, but if no need comments, it should be ok.
Attachment #759359 -
Flags: review?(bugs) → review+
Comment 15•11 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #13)
Can you explain what the difference is between the existing ConstructorEnabled stuff (which checks mChromeOnly) and the new stuff? Preferably in comments somewhere?
> Because there is a static function DOMCI called ConstructorEnabled and also
> the mozilla::dom::ConstructorEnabled typedef and the bareword reference is
> ambiguous.
Can we rename one of them?
Assignee | ||
Comment 16•11 years ago
|
||
> Can we rename one of them?
We can, but why? Especially given that the DOMCI version is presumably on its way out with the rest of classinfo...
I will add comments about the mChromeOnly bits.
Assignee | ||
Comment 17•11 years ago
|
||
Talked to bholley and the static method will become OldBindingConstructorEnabled.
Assignee | ||
Comment 18•11 years ago
|
||
Attachment #760039 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Updated•11 years ago
|
Attachment #759571 -
Attachment is obsolete: true
Attachment #759571 -
Flags: review?(bobbyholley+bmo)
Comment 19•11 years ago
|
||
Comment on attachment 759358 [details] [diff] [review]
part 2. Make ordering of named constructors in codegen deterministic. ran into this when looking at the diff in codegen from part 1.
Review of attachment 759358 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/parser/WebIDL.py
@@ +508,5 @@
> self._callback = False
> self._finished = False
> self.members = []
> + # namedConstructors needs deterministic ordering
> + self.namedConstructors = list()
Nit: []
Comment 20•11 years ago
|
||
Comment on attachment 760039 [details] [diff] [review]
part 1. Change the "enabled" callback for WebIDL constructors to take a JSContext* and the object the constructor will be defined on.
Review of attachment 760039 [details] [diff] [review]:
-----------------------------------------------------------------
r=bholley on the nsDOMClassInfo bits.
::: dom/base/nsDOMClassInfo.cpp
@@ +4075,5 @@
> mozilla::dom::DefineInterface define =
> name_struct->mDefineDOMInterface;
> if (define) {
> if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor &&
> + !OldBindingConstructorEnabled(name_struct, aWin)) {
{ on new line, I think
@@ +4096,5 @@
> + if (name_struct->mConstructorEnabled &&
> + !(*name_struct->mConstructorEnabled)(cx, global)) {
> + return NS_OK;
> + }
> +
Needs some commenting explaining how we don't want to define unenabled interfaces on Xrays even when they're enabled for the caller.
@@ +4975,5 @@
> JSAutoCompartment ac(cx, naviObj);
> +
> + if (name_struct->mConstructorEnabled &&
> + !(*name_struct->mConstructorEnabled)(cx, naviObj)) {
> + return NS_OK;
Commenting here as well.
Attachment #760039 -
Flags: review?(bobbyholley+bmo) → review+
Assignee | ||
Comment 21•11 years ago
|
||
> { on new line, I think
We don't do that in this file....
> Needs some commenting explaining how we don't want to define unenabled interfaces on
> Xrays even when they're enabled for the caller.
Done, both places.
https://hg.mozilla.org/integration/mozilla-inbound/rev/a96d87d45173
https://hg.mozilla.org/integration/mozilla-inbound/rev/653f259d5d99
https://hg.mozilla.org/integration/mozilla-inbound/rev/7bf20eaca9ff
and documented at https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#ChromeOnly
Flags: in-testsuite?
Target Milestone: --- → mozilla24
Comment 22•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a96d87d45173
https://hg.mozilla.org/mozilla-central/rev/653f259d5d99
https://hg.mozilla.org/mozilla-central/rev/7bf20eaca9ff
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•