Closed
Bug 484305
Opened 16 years ago
Closed 11 years ago
Workers: loaded scripts may be decoded using wrong text encoding.
Categories
(Core :: DOM: Workers, defect)
Core
DOM: Workers
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: dimich, Assigned: nsm)
Details
Attachments
(3 files, 2 obsolete files)
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090310 Minefield/3.2a1pre
Discussion in whatwg mail list clarifies that content of the scripts loaded as a result of 'new Worker(url)' or 'importScripts(url)' should be decoded using UTF-8 or the encoding specified in Content-Type http header, if present.
FF decodes the scripts using the encoding of the parent document. This is correct for <script> tag, but not for Workers.
Reproducible: Always
Reporter | ||
Comment 1•16 years ago
|
||
Comment 2•16 years ago
|
||
Isn't this a duplicate of bug 482388?
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Reporter | ||
Comment 3•16 years ago
|
||
Attached test file - download both repro.html and repro-worker.js and open repro.html.
The test itself is encoded using KOI8-r encoding (Russian). It has a test string to verify the encoding. The test spawns a worker from the file which contains the same test string encoded in both KOI8-R and UTF-8. The UTF-8 one should match because the script should be decoded using UTF-8 encoding by default.
Actual result: the KOI8-R matches because the scritp is decoded using the encoding of the parent document.
Reporter | ||
Comment 4•16 years ago
|
||
(In reply to comment #2)
> Isn't this a duplicate of bug 482388?
No, because that one is about which encoding to use for the URL query portion that gets sent to the server.
This one is about which encoding to use while decoding the received script.
Sounds similar, but it might be the different places in code are affected.
Assignee | ||
Comment 5•11 years ago
|
||
Passes bug test case.
Attachment #814609 -
Flags: review?(bent.mozilla)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → nsm.nikhil
Updated•11 years ago
|
Component: DOM → DOM: Workers
Comment on attachment 814609 [details] [diff] [review]
Worker scripts should always be decoded as UTF-8.
Review of attachment 814609 [details] [diff] [review]:
-----------------------------------------------------------------
This looks great. Can we please have a test before this gets checked in?
::: dom/workers/ScriptLoader.cpp
@@ +439,5 @@
> nsIDocument* parentDoc = mWorkerPrivate->GetDocument();
>
> // Use the regular nsScriptLoader for this grunt work! Should be just fine
> // because we're running on the main thread.
> + // NOTE: Unlike <script> tags, Worker scripts are always decoded as UTF-8,
Nit: Adding 'NOTE:' to a comment is a little redundant. You're noting it already ;)
Attachment #814609 -
Flags: review?(bent.mozilla) → review+
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 7•11 years ago
|
||
Updated to add test case based on original failure example.
Assignee | ||
Updated•11 years ago
|
Attachment #814609 -
Attachment is obsolete: true
Assignee | ||
Comment 8•11 years ago
|
||
Fixed test document.inputEncoding check.
Assignee | ||
Updated•11 years ago
|
Attachment #815114 -
Attachment is obsolete: true
Assignee | ||
Comment 9•11 years ago
|
||
Comment on attachment 815132 [details] [diff] [review]
Worker scripts should always be decoded as UTF-8.
Waiting for try-server results before checkin.
Attachment #815132 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 10•11 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•