Closed Bug 961208 Opened 6 years ago Closed 6 years ago

Change WebIDL DoNewResolve hooks to take a JSPropertyDescriptor

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Whiteboard: [qa-])

Attachments

(2 files, 1 obsolete file)

Then they can easily control what property flags should be used for the property.
Comment on attachment 8361933 [details] [diff] [review]
part 1.  When doing a DoNewResolve for Xrays, pass the Xray, not the underlying object, to DoNewResolve, in case people want to do permissions checks on the object.

Review of attachment 8361933 [details] [diff] [review]:
-----------------------------------------------------------------

Navigator and ObjectLoadingContent seem fine. Are those the only two?
Attachment #8361933 - Flags: review?(bobbyholley+bmo) → review+
Comment on attachment 8361934 [details] [diff] [review]
part 2.  Change the WebIDL DoNewResolve hook signature to take a JSPropertyDescriptor.

Review of attachment 8361934 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/Codegen.py
@@ +6004,4 @@
>                  "  return true;\n"
>                  "}\n"
> +                "if (!JS_DefinePropertyById(cx, obj, id, desc.value(),\n"
> +                "                           desc.getter(), desc.setter(),\n"

Note that this will cause the class getter to be invoked, if one exists (if you want no getter, you need to pass JS_PropertyStub). But this isn't a behavioral change, and is probably fine.
Attachment #8361934 - Flags: review?(bobbyholley+bmo) → review+
> Navigator and ObjectLoadingContent seem fine. Are those the only two?

So far, yes.

> Note that this will cause the class getter to be invoked, if one exists

Yeah, these are WebIDL objects, so they never have those.  ;)
Attachment #8361934 - Attachment is obsolete: true
Comment on attachment 8363094 [details] [diff] [review]
part 2.  Change the WebIDL DoNewResolve hook signature to take a JSPropertyDescriptor.

Review of attachment 8363094 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/Codegen.py
@@ +6004,5 @@
>                  "  return true;\n"
>                  "}\n"
> +                "// If desc.value() is undefined, then the DoNewResolve call\n"
> +                "// has already defined it on the object.  Don't try to also\n"
> +                "// define it.\n"

I'm assuming more comments will come later when we hook this stuff up for window?
Attachment #8363094 - Flags: review?(bobbyholley+bmo) → review+
Whiteboard: [qa-]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.