Closed
Bug 1184439
Opened 10 years ago
Closed 6 years ago
"Deep Freeze" the manifest object in DOMApplication instances
Categories
(Core Graveyard :: DOM: Apps, defect)
Core Graveyard
DOM: Apps
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: timdream, Unassigned)
References
Details
Attachments
(2 files, 1 obsolete file)
1.03 KB,
patch
|
fabrice
:
review+
|
Details | Diff | Splinter Review |
1.03 KB,
patch
|
timdream
:
review+
|
Details | Diff | Splinter Review |
Please see bug 1176184 comment 12 and related discussion titled "Should the entire JS structure be Object.freeze()'d if it's exposed through a read only property?" in dev-platform.
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → timdream
Status: NEW → ASSIGNED
Reporter | ||
Comment 1•10 years ago
|
||
Hi :bholley,
Could you help me on this? The goal of this patch is to prevent content script from modify the JS structure in-place exposed from DOMApplication#manifest, since App API will remove it at a time unknown to content.
When I apply this patch, I will be hit by this error.
https://dxr.mozilla.org/mozilla-central/source/js/xpconnect/wrappers/XrayWrapper.cpp#1820
This is implemented in bug 789897. It looks like it says DOM API properties ("reflectors"? Not sure about the term) should always be extendable by content script? This is entirely opposite to what I want to achieve here.
Could you tell me if I understand this comment correctly and maybe suggest alternative approach to achieve my goal? Thanks!
Flags: needinfo?(bobbyholley)
Comment 2•10 years ago
|
||
If you're hitting this code, it means that the object you're trying to freeze (perhaps recursively) is an XrayWrapper (see [1]).
Presumably you want to freeze the underlying object, right? You could do Object.freeze(cloned.wrappedJSObject), but it seems like something we should support in cloneInto. I'll write a patch.
[1] https://developer.mozilla.org/en-US/docs/Xray_vision
Flags: needinfo?(bobbyholley)
Reporter | ||
Comment 3•10 years ago
|
||
Attachment #8635962 -
Attachment is obsolete: true
Attachment #8640934 -
Flags: review?(fabrice)
Reporter | ||
Comment 4•10 years ago
|
||
I've manually verified bug 1186213 did what's desirable here. Thanks Bobby!
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cfe7c949d26b
Comment 5•10 years ago
|
||
Comment on attachment 8640934 [details] [diff] [review]
Patch v1
Review of attachment 8640934 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/apps/AppsServiceChild.jsm
@@ +44,5 @@
> }
>
> let winObjs = this._cache[aManifestURL];
> if (!(aInnerWindowID in winObjs)) {
> + // Clone a deep frozen version of the manifest so contant couldn't modify
nit: s/contant/content
Attachment #8640934 -
Flags: review?(fabrice) → review+
Reporter | ||
Comment 6•10 years ago
|
||
Need to wait for Gij to turn green before check-in.
I don't think there is anywhere in Gaia that could have modified the manifest in-place, but I might be wrong and it's good if we could caught it before check-in.
Attachment #8641465 -
Flags: review+
Reporter | ||
Comment 7•10 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (slow response; please ni? to queue) from comment #6)
> Created attachment 8641465 [details] [diff] [review]
> Patch for commit
>
> Need to wait for Gij to turn green before check-in.
>
> I don't think there is anywhere in Gaia that could have modified the
> manifest in-place, but I might be wrong and it's good if we could caught it
> before check-in.
... my local phone build indeed break the phone. It can't even reach home screen app.
Will look further tomorrow...
Reporter | ||
Comment 8•10 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (slow response; please ni? to queue) from comment #7)
> ... my local phone build indeed break the phone. It can't even reach home
> screen app.
>
> Will look further tomorrow...
No. Wrong patch.
Reporter | ||
Comment 9•10 years ago
|
||
Looks like in-place editing of manifest object is not something myself can fix. I've sent an email to dev-gaia so everyone can agree which way we should move forward.
Reporter | ||
Comment 10•10 years ago
|
||
Let's go back to this bug if and only if there is enough traction to fix this.
Assignee: timdream → nobody
Status: ASSIGNED → NEW
Updated•7 years ago
|
Product: Core → Core Graveyard
Comment 11•6 years ago
|
||
Core Graveyard / DOM: Apps is inactive. Closing all bugs in this component.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•