Closed
Bug 1270601
Opened 9 years ago
Closed 8 years ago
Implement support for the proposed "namespace" IDL syntax
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Whiteboard: btpp-active)
Attachments
(3 files, 2 obsolete files)
30.86 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
11.53 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
7.20 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
The idea is that this:
namespace console {
// stuff
};
should act more or less like this:
interface console {
// static stuff
};
with the following differences:
1) typeof console === "object", not "function". The call/construct hooks
should be null.
2) console.prototype === undefined. I think we may already end up doing this
for static-only stuff if we mark it abstract, fwiw.
3) console.__proto__ == Object.prototype.
Updated•9 years ago
|
Whiteboard: btpp-active
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8749392 -
Flags: review?(peterv)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8749393 -
Flags: review?(peterv)
Assignee | ||
Comment 3•9 years ago
|
||
Andrea, with those two patches you should be able to do:
[ClassString="Console"]
namespace console {
....
};
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8752243 -
Flags: review?(peterv)
Assignee | ||
Updated•9 years ago
|
Attachment #8749392 -
Attachment is obsolete: true
Attachment #8749392 -
Flags: review?(peterv)
Assignee | ||
Comment 5•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8749393 -
Attachment is obsolete: true
Attachment #8749393 -
Flags: review?(peterv)
Assignee | ||
Updated•9 years ago
|
Attachment #8752244 -
Flags: review?(peterv)
Comment 7•9 years ago
|
||
Comment on attachment 8752243 [details] [diff] [review]
Now with support for partial namespace too, per spec updates
Review of attachment 8752243 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/parser/WebIDL.py
@@ +800,5 @@
> + # Just mark all our methods/attributes as static. The other
> + # option is to duplicate the relevant InterfaceMembers
> + # production bits but modified to produce static stuff to
> + # start with, but that sounds annoying.
> + m.forceStatic()
Would it make sense to do this in IDLNamespace's __init__?
@@ +1360,4 @@
>
> def addExtendedAttributes(self, attrs):
> + # Note that this is only used by IDLInterface. We could
> + # consider moving this there...
Yeah, I think we should do that.
@@ +5437,5 @@
> + if not nonPartialObject:
> + nonPartialObject = nonPartialConstructor(
> + # No members, False for isKnownNonPartial
> + *(nonPartialConstructorArgs + [[], False]))
> + partialInterface = IDLPartialInterface(*(partialConstructorArgs +
Might make sense to rename IDLPartialInterface (since it's now used for namespace too)?
::: dom/bindings/parser/tests/test_namespace.py
@@ +144,5 @@
> + results = parser.finish()
> + except Exception, x:
> + threw = True
> + harness.ok(threw, "Should have thrown.")
> +
Trailing whitespace.
@@ +182,5 @@
> + results = parser.finish()
> + except Exception, x:
> + threw = True
> + harness.ok(threw, "Should have thrown.")
> +
Trailing whitespace.
@@ +220,5 @@
> + results = parser.finish()
> + except Exception, x:
> + threw = True
> + harness.ok(threw, "Should have thrown.")
> +
Trailing whitespace.
Attachment #8752243 -
Flags: review?(peterv) → review+
Updated•9 years ago
|
Attachment #8752244 -
Flags: review?(peterv) → review+
Updated•9 years ago
|
Flags: needinfo?(peterv)
Assignee | ||
Comment 8•9 years ago
|
||
Additional patch to deal with the compat issues described at https://github.com/whatwg/console/issues/3#issuecomment-219549472
Assignee | ||
Updated•9 years ago
|
Attachment #8758313 -
Flags: review?(peterv)
Assignee | ||
Comment 9•9 years ago
|
||
> Would it make sense to do this in IDLNamespace's __init__?
That makes partial stuff hard: the members of partials are just stored on those partials until we get to IDLInterfaceOrNamespace.finish.
> Yeah, I think we should do that.
Done.
> Might make sense to rename IDLPartialInterface (since it's now used for namespace too)?
Done, IDLPartialInterfaceOrNamespace.
Fixed the trailing whitespace.
Comment 10•9 years ago
|
||
Comment on attachment 8758313 [details] [diff] [review]
part 3. Add a way to annotate and IDL namespace as needing a new plain object as its prototype, because using Object.prototype as the prototype of 'console' is not web-compatible
Review of attachment 8758313 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/BindingUtils.h
@@ +3274,5 @@
>
> +namespace binding_detail {
> +inline
> +JSObject*
> +GetHackedNamespaceProtoObject(JSContext* aCx, JS::Handle<JSObject*> aForObj)
Can we not name the second argument, to make it clear it's unused?
Attachment #8758313 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 11•9 years ago
|
||
> Can we not name the second argument, to make it clear it's unused?
Done.
Comment 12•9 years ago
|
||
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9482e25918a3
part 1. Add Web IDL parser support for IDL namespace syntax. r=peterv
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d761dc47c2d
part 2. Add codegen support for IDL namespaces. r=peterv
https://hg.mozilla.org/integration/mozilla-inbound/rev/508c43bf5578
part 3. Add a way to annotate and IDL namespace as needing a new plain object as its prototype, because using Object.prototype as the prototype of 'console' is not web-compatible. r=peterv
Comment 13•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9482e25918a3
https://hg.mozilla.org/mozilla-central/rev/1d761dc47c2d
https://hg.mozilla.org/mozilla-central/rev/508c43bf5578
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
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
•