Closed Bug 1184439 Opened 9 years ago Closed 6 years ago

"Deep Freeze" the manifest object in DOMApplication instances

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: timdream, Unassigned)

References

Details

Attachments

(2 files, 1 obsolete file)

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.
Assignee: nobody → timdream
Status: NEW → ASSIGNED
Attached patch bug1184439.patch (obsolete) — Splinter Review
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)
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)
Depends on: 1186213
Attached patch Patch v1Splinter Review
Attachment #8635962 - Attachment is obsolete: true
Attachment #8640934 - Flags: review?(fabrice)
I've manually verified bug 1186213 did what's desirable here. Thanks Bobby! https://treeherder.mozilla.org/#/jobs?repo=try&revision=cfe7c949d26b
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+
Attached patch Patch for commitSplinter Review
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+
(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...
(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.
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.
Let's go back to this bug if and only if there is enough traction to fix this.
Assignee: timdream → nobody
Status: ASSIGNED → NEW
Product: Core → Core Graveyard
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.

Attachment

General

Created:
Updated:
Size: