Closed
Bug 1198934
Opened 9 years ago
Closed 9 years ago
Error: Accessing TypedArray data over Xrays is slow, and forbidden
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(firefox44 fixed)
RESOLVED
FIXED
FxOS-S9 (16Oct)
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: madrid.crespo, Assigned: bholley)
Details
Attachments
(2 files)
12.23 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
1.13 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 Build ID: 20150824030206 Steps to reproduce: I was trying to use NFC in a Firefox OS addon, and It worked okay, but after playing with mozSettings, it started to return the following error: E/GeckoConsole( 210): [JavaScript Error: "Error: Accessing TypedArray data over Xrays is slow, and forbidden in order to encourage performant code. To copy TypedArrays across origin boundaries, consider using Components.utils.cloneInto()." {file: "app://{955fa431-548a-41ae-b20b-01fdf0988c42}/scripts/nfc.js" line: 111}] This is my diff: https://github.com/CodingFree/NFC-Sleep/commit/7a6a7a2cd7f130872e0aff8273c9128e89324754#diff-d6c5855a62cf32a4dadbc2831f0f295f
Comment 1•9 years ago
|
||
Bobby, here's where the sandbox used to inject the add-on script is created: https://mxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionContent.jsm#211 Of course the add-on can't Cu.cloneInto()...
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 2•9 years ago
|
||
(In reply to [:fabrice] Fabrice Desré from comment #1) > Bobby, here's where the sandbox used to inject the add-on script is created: > https://mxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ > ExtensionContent.jsm#211 > > Of course the add-on can't Cu.cloneInto()... Actually it can - just pass { wantExportHelpers: true }
Flags: needinfo?(bobbyholley)
Comment 3•9 years ago
|
||
But we don't want to expose that to WebExtensions content scripts, right?
Reporter | ||
Comment 4•9 years ago
|
||
Bobby, is there any way to avoid or fix that error by my side? Any suggestion?
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 5•9 years ago
|
||
Sorry for the delay, just getting back from PTO. Hm. So in an ideal world, the Xray caller would be getting its own TypedArray in its own compartment, and then we wouldn't have to deal with this Xrays-to-TypedArray business. However, that's bug 946906, which we haven't done yet. Given that this NFC stuff is all [Constant], we might be able to do something simpler than bug 946906, and just cache the value on the XrayWrapper somehow. Definitely doable, but would require some work. In the mean time, and in terms of a more general approach, it seems like we can basically do one of the following: (1) Expose cloning to WebExtensions (2) Encourage such authors to use .wrappedJSObject. Adrian, this would solve your problem in the interim, but I'm pretty sure Bill wants to forbid .wrappedJSObject, because it's not possible to do anything like it in other engines. Bill, do you want to weigh in here? (3) Nothing, and limp along with this feature gap.
Flags: needinfo?(bobbyholley) → needinfo?(wmccloskey)
Well, given that the extension here is already b2g-specific, it doesn't seem that horrible to do something Mozilla-specific. However, the point of WebExtensions is to be a stable API for add-on authors. That's not going to happen if we ask them to use internal stuff like this. If there's something future-proof that we can do here, that would be great. I don't really understand what's going on in this code, though, so I can't recommend anything specific.
Flags: needinfo?(wmccloskey)
Reporter | ||
Comment 7•9 years ago
|
||
I have fixed it using wrappedJSObject: https://github.com/CodingFree/NFC-Sleep/commit/c83b069a39b05ba7463d042d49ab9d019dc31c83#diff-cd1c8566e1d50ad0a9d20af048ddcaebL77 Thanks!
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8673875 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 9•9 years ago
|
||
Bill, I'm not sure where to flip the sandbox bit for WebExtensions content scripts. Can you point me to it?
Flags: needinfo?(wmccloskey)
Sure, here it is: http://mxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionContent.jsm#218
Flags: needinfo?(wmccloskey)
Assignee | ||
Comment 11•9 years ago
|
||
Attachment #8673881 -
Flags: review?(wmccloskey)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → bobbyholley
Comment on attachment 8673875 [details] [diff] [review] Support special-case WebExtension behavior for TypedArrays. v1 Review of attachment 8673875 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #8673875 -
Flags: review?(wmccloskey) → review+
Attachment #8673881 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 13•9 years ago
|
||
I renamed it form 'isWebExtensionsContentScript' to 'isWebExtensionContentScript', which seems better.
Comment 14•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/de3d8a5f6537 https://hg.mozilla.org/integration/mozilla-inbound/rev/fe814c656647
Comment 15•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/de3d8a5f6537 https://hg.mozilla.org/mozilla-central/rev/fe814c656647
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S9 (16Oct)
You need to log in
before you can comment on or make changes to this bug.
Description
•