Closed Bug 1473492 Opened 6 years ago Closed 6 years ago

Possibly dead code in Codegen.py

Categories

(Core :: DOM: Bindings (WebIDL), enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: jandem, Assigned: bzbarsky)

References

Details

Attachments

(3 files)

The code snippets in this branch are not emitted for any bindings, according to searchfox: https://searchfox.org/mozilla-central/rev/6ef785903fee6c0b16a1eab79d722373d940fd78/dom/bindings/Codegen.py#8515-8517 Is this expected? Should we remove/keep?
I'm interested in this because there's a js::GetGlobalForObjectCrossCompartment call there. Easy to convert but if we can remove it that's even better :)
Flags: needinfo?(bzbarsky)
Looks like this code became dead in bug 1451516. Specifically, the only way to reach this code is for someone to call CGAbstractBindingMethod.__init__ without passing in a value for getThisObj, or passing an explicit None. We have calls to CGAbstractBindingMethod.__init__ from the following places: CGLegacyCallHook, CGEnumerateHook, CGResolveOwnPropertyViaResolve, CGEnumerateOwnPropertiesViaGetOwnPropertyNames, CGJSImplClearCachedValueMethod. All of these except CGJSImplClearCachedValueMethod pass a value for getThisObj. And CGJSImplClearCachedValueMethod never appears on a global's proto chain, because we never have globals inheriting from JS-implemented interfaces. That said, CGJSImplClearCachedValueMethod is dead code outside of tests anyway; it was initially added for JS-implemented APIs with cached attributes, but all of those were b2g-specific and have since been removed. Given that JS-implemented webidl is deprecated, I'm going to just go ahead and remove the complexity.
Assignee: nobody → bzbarsky
Flags: needinfo?(bzbarsky)
Attachment #8990093 - Flags: review?(continuation) → review+
Comment on attachment 8990094 [details] [diff] [review] part 2. Disallow [Cached] on JS-implemented interfaces Review of attachment 8990094 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/test/TestJSImplGen.webidl @@ +40,5 @@ > void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); > void passNullableByte(byte? arg); > void passOptionalNullableByte(optional byte? arg); > void passVariadicByte(byte... arg); > + // [Cached] not supported in JS-implemented WebIDL. Should these comments be "is not" instead of "not"?
Attachment #8990094 - Flags: review?(continuation) → review+
> Should these comments be "is not" instead of "not"? Sure. Fixed.
Attachment #8990095 - Flags: review?(continuation) → review+
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/1ebaffb961ac part 1. Remove support for clearing cached attributes on JS-implemented webidl object. r=mccr8 https://hg.mozilla.org/integration/mozilla-inbound/rev/6231278eb5bd part 2. Disallow [Cached] on JS-implemented interfaces. r=mccr8 https://hg.mozilla.org/integration/mozilla-inbound/rev/02d78ee0198c part 3. Make the getThisObj argument of CGAbstractBindingMethod required. r=mccr8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: