Closed
Bug 1389949
Opened 6 years ago
Closed 6 years ago
Make NPObjWrapper a proxy object
Categories
(Core Graveyard :: Plug-ins, enhancement)
Core Graveyard
Plug-ins
Tracking
(firefox57 fixed)
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
27.09 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
We want to remove the getProperty and setProperty ClassOps, see bug 1389510. There are only a few uses left, one of them is NPObjWrapper. NPObjWrapper acts like a proxy (forwarding property gets/sets to the underlying plugin object) and so we should just make it an actual proxy object. I'm happy with how this turned out, most of the class hooks map well to the proxy traps and we don't need that many code changes. All tests pass and I tested the Flash plugin on a number of websites, including the YouTube flash player, and everything works fine. Bill, flagging you as reviewer because you're familiar with the JS API and have reviewed plugin code before, but feel free to redirect.
Attachment #8896772 -
Flags: review?(wmccloskey)
Comment on attachment 8896772 [details] [diff] [review] Patch Review of attachment 8896772 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/plugins/base/nsJSNPRuntime.cpp @@ +172,5 @@ > + > + bool defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, > + JS::Handle<JS::PropertyDescriptor> desc, > + JS::ObjectOpResult& result) const override { > + ::JS_ReportErrorASCII(cx, "Trying to add unsupported property on NPObject!"); This seems like a difference from the old scheme. Previously, wouldn't Object.defineProperty have succeeded if the property was one that the plugin supported and it was just modifying the value? Maybe that's fine. I have no idea how this stuff is used in practice.
Attachment #8896772 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 2•6 years ago
|
||
Thanks for the review! (In reply to Bill McCloskey (:billm) from comment #1) > This seems like a difference from the old scheme. Previously, wouldn't > Object.defineProperty have succeeded if the property was one that the plugin > supported and it was just modifying the value? Looking at the code, I don't think we call the setProperty hook when *defining* a property. We do call addProperty (which would succeed in this case). My best guess is we would then just define a native data property on the object, bypassing setProperty, pretty weird.
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/09ece3c8484a Make NPObjWrapper a JS proxy object. r=billm
Comment 4•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/09ece3c8484a
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Updated•1 year ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•