Closed
Bug 667077
Opened 12 years ago
Closed 12 years ago
btoa function is not defined in frame scripts
Categories
(Core :: IPC, defect)
Tracking
()
RESOLVED
FIXED
mozilla8
Tracking | Status | |
---|---|---|
fennec | - | --- |
People
(Reporter: Felipe, Assigned: jdm)
References
()
Details
(Keywords: dev-doc-complete, Whiteboard: [inbound])
Attachments
(2 files, 3 obsolete files)
1.08 KB,
patch
|
mfinkle
:
review+
|
Details | Diff | Splinter Review |
11.64 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #622224 +++ The "btoa" function running in the frame script (see bug URL) sometimes works and sometimes is undefined. I haven't found the right pattern yet. The function is called from a OnLocationChange listener, and when I open a url with a <iframe> (like "data:text/html,<iframe>" ) it always happen, but I'm not sure that's the only case.
Reporter | ||
Comment 1•12 years ago
|
||
This is spewing a warning in debug builds so this should make it easier to see where that's coming from
Attachment #541817 -
Flags: review?(mark.finkle)
FWIW, you might be able to work around this by using |content.btoa()|. That wouldn't have worked for bug 622224. But we should fix this anyway.
Comment 3•12 years ago
|
||
Comment on attachment 541817 [details] [diff] [review] Debug Try cjones' idea too
Attachment #541817 -
Flags: review?(mark.finkle) → review+
Reporter | ||
Comment 4•12 years ago
|
||
the warning is flooding the logs during some mochi-4, and we can't use content.btoa because that could be an untrusted function. This happens because btoa is not part of the frame script context, and I think the function call never worked there. cjones said that the real solution is to add atob/btoa for frame scripts, this is a patch for it.
Attachment #541923 -
Flags: review?(Olli.Pettay)
Reporter | ||
Comment 5•12 years ago
|
||
with uuid rev'ed
Attachment #541923 -
Attachment is obsolete: true
Attachment #541924 -
Flags: review?(Olli.Pettay)
Attachment #541923 -
Flags: review?(Olli.Pettay)
Comment 6•12 years ago
|
||
Comment on attachment 541924 [details] [diff] [review] Add atob/btoa to frame scripts Could you add nsContentUtils::Btoa/Atob, which would do exactly what nsGlobalWindow::Btoa/Atob do now and call the nsContentUtils methods in nsGlobalWindow and in message manager code. And this needs some tests.
Attachment #541924 -
Flags: review?(Olli.Pettay) → review-
Reporter | ||
Updated•12 years ago
|
Summary: btoa function is sometimes not defined in frame scripts → btoa function is not defined in frame scripts
This makes me wonder if http://mxr.mozilla.org/mozilla-central/source/mobile/chrome/content/bindings/browser.js#366 has ever worked. I noticed it spamming while running the mochitest-browser-chrome tests.
Assignee | ||
Comment 8•12 years ago
|
||
Scratch that itch.
Attachment #548556 -
Flags: review?(Olli.Pettay)
Assignee | ||
Updated•12 years ago
|
Attachment #548556 -
Attachment description: "btoa function is not defined in frame scripts" [ → Add atob/btoa to frame scripts
Assignee | ||
Updated•12 years ago
|
Attachment #541924 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → josh
Comment 9•12 years ago
|
||
Comment on attachment 548556 [details] [diff] [review] Add atob/btoa to frame scripts Could you remove Is8bit from nsGlobalWindow and expose also it in nsContentUtils?
Attachment #548556 -
Flags: review?(Olli.Pettay) → review-
Assignee | ||
Comment 10•12 years ago
|
||
Darn, forgot to save nsGlobalWindow after removing Is8Bit last time.
Attachment #548561 -
Flags: review?(Olli.Pettay)
Assignee | ||
Updated•12 years ago
|
Attachment #548556 -
Attachment is obsolete: true
Comment 11•12 years ago
|
||
Comment on attachment 548561 [details] [diff] [review] Add atob/btoa to frame scripts. >+ // for each character in this chunk... >+ while (c < fragmentEnd) >+ if (*c++ & EIGHT_BIT) >+ return PR_FALSE; I know you're just moving code, but could you please fix the coding style. while (expr) { stmt; } and same with if
Attachment #548561 -
Flags: review?(Olli.Pettay) → review+
Assignee | ||
Comment 12•12 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/91aa25a681a5
Whiteboard: [inbound]
Comment 13•12 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/91aa25a681a5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Comment 14•12 years ago
|
||
dev-doc-needed: I didn't find existing documentation for frame scripts, but there should be a page listing the things (like globals, events) available to frame scripts.
Keywords: dev-doc-needed
Assignee | ||
Comment 15•12 years ago
|
||
That would be https://developer.mozilla.org/en/The_message_manager . Good point.
Assignee | ||
Updated•12 years ago
|
Keywords: dev-doc-needed → dev-doc-complete
Comment 16•12 years ago
|
||
Thanks! (Tweaked that page to mention "frame scripts", since googling that term doesn't find many useful results right now.)
You need to log in
before you can comment on or make changes to this bug.
Description
•