Closed Bug 1104311 Opened 10 years ago Closed 2 years ago

Firefox navigators strip spacing (space) chars on data: URI scheme based webworkers

Categories

(Core :: Networking, defect, P2)

33 Branch
x86_64
Windows 8.1
defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: lcf.vs, Assigned: valentin)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Build ID: 20141113143407

Steps to reproduce:

I'm trying to create an on-the-fly webworker, without encoding like this :

var worker;

worker = new Worker(
  'data:application/javascript,'
  + 'var e=function () {'
    + 'console.log(vare.toString());'
  +'};'
  
  +'this.onmessage=vare;'
);

worker.postMessage(1);


Actual results:

Yeah, i know, i call  an undeclared method, it's all the problem...

But, to my surprise, my worker works!

It's because my worker data is evaluated like : 'vare=function...'


Expected results:

Let the spaces :D
Confirmed on Firefox 33.1, 33.1.1 & Firefox Developer Edition 35.0a2
Severity: normal → major
This is a known behavior of the data: protocol handler: it strips out whitespace from data: URIs whose MIME type is not text/* and doesn't contain "xml".

We should test what other UAs do.  If none of them have this behavior (for non-base64, at least), then we should probably just drop it too.
Status: UNCONFIRMED → NEW
Component: General → Networking
Ever confirmed: true
Flags: needinfo?(jduell.mcbugs)
Summary: Firefox navigators strip spacing chars on data URI scheme based webworkers → Firefox navigators strip spacing (space) chars on data: URI scheme based webworkers
Valentin loves URI bugs :)  

Valentin, when you get some spare cycles, test this out on other browsers and let's see if we want to change our behavior here.
Flags: needinfo?(valentin.gosu)
Assignee: nobody → valentin.gosu
Flags: needinfo?(valentin.gosu)
I thought the removal of unescaped newlines was generic across URL schemes. It being dependent upon a non-generic bit seems rather bad.

(I think other browsers opted not to support data URLs for workers. Not sure if we should follow.)
Flags: needinfo?(jduell.mcbugs)
> I thought the removal of unescaped newlines was generic across URL schemes.

Hmm...  Maybe it is.  Certainly this:

  <iframe src="javascript:ale
rt(5)"></iframe>

alerts 5.  However, this bug is not just about newlines, but also spaces.  And this:

  <iframe src="javascript:ale rt(5)"></iframe>

does not alert 5.

> I think other browsers opted not to support data URLs for workers

You don't need workers to test this.  Just do this:

  <iframe src="data:application/javascript,var x"></iframe>

and you will see that in Safari the space between "var" and "x" is not stripped but in Firefox and Chrome it is.  IE11 doesn't load the iframe from a data: URI at all as far as I can tell.
Flags: needinfo?(annevk)
In my humble opinion, the question is not really about what is happening elsewhere ... but:

Is there any real reasons which explains that spaces stripping?
bz, in Chrome var x = new URL("data:application/javascript,var x") will preserve the space. I think have special processing like that just for the data URL scheme is best avoided if we can get away with it.
Flags: needinfo?(annevk)
OK, but can you explain to me what Chrome is doing with the <iframe> testcase, then?

> I think have special processing like that just for the data URL scheme is best avoided

I agree, but I also think we should change our behavior here at most once.  Which means figuring out the behavior we want before we make any changes, if we plan to change things.
> OK, but can you explain to me what Chrome is doing with the <iframe>
> testcase, then?

Not really. It seems like a bug. And does not happen with e.g. text/html or application/xml.
Whiteboard: [necko-would-take]
Assignee: valentin.gosu → nobody
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5

Hi Lcf.vs,

I'm looking at old bugs to see if they are still reproducible.

Is this issue still happening on your end? If yes, could you provide us with at test page where we can reproduce it?

Thanks in advance,
Virginia

Flags: needinfo?(lcf.vs)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:dragana, since the bug has high severity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lcf.vs) → needinfo?(dd.mozilla)
Flags: needinfo?(dd.mozilla)

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --
Assignee: nobody → valentin.gosu
Blocks: url
Severity: -- → S3
Priority: P5 → P2
Whiteboard: [necko-would-take] → [necko-triaged]
Blocks: 1797846
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/d2922261c8c1
Stop stripping spaces from data URLs r=necko-reviewers,sunil,jesup

Backed out for causing build bustages on nsDataHandler.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/checkouts/gecko/netwerk/protocol/data/nsDataHandler.cpp:63:18: error: use of undeclared identifier 'StaticPrefs'; did you mean 'mozilla::StaticPrefs'?
Flags: needinfo?(valentin.gosu)
Flags: needinfo?(valentin.gosu)
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/10883f7ad411
Stop stripping spaces from data URLs r=necko-reviewers,sunil,jesup

Backed out for causing wpt failures on data-uri.htm.

Push with failures

Failure log

Backout link

[task 2022-10-28T13:27:25.924Z] 13:27:25     INFO - TEST-START | /xhr/data-uri.htm
[task 2022-10-28T13:27:25.929Z] 13:27:25     INFO - Closing window 94aeed71-56a0-4395-a433-392d1639bcc8
[task 2022-10-28T13:27:25.945Z] 13:27:25     INFO - PID 27338 | [Child 28827, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:500
[task 2022-10-28T13:27:26.006Z] 13:27:26     INFO - PID 27338 | [Child 27495, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:500
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - 
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - TEST-PASS | /xhr/data-uri.htm | XHR method GET with MIME type text/plain 
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - TEST-PASS | /xhr/data-uri.htm | XHR method GET with MIME type text/plain (base64) 
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - TEST-PASS | /xhr/data-uri.htm | XHR method GET with MIME type text/html 
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - TEST-PASS | /xhr/data-uri.htm | XHR method GET with MIME type text/html;charset=UTF-8 
[task 2022-10-28T13:27:26.283Z] 13:27:26     INFO - TEST-UNEXPECTED-PASS | /xhr/data-uri.htm | XHR method GET with MIME type image/png - expected FAIL
[task 2022-10-28T13:27:26.284Z] 13:27:26     INFO - TEST-INFO | expected FAIL
[task 2022-10-28T13:27:26.286Z] 13:27:26     INFO - .....
[task 2022-10-28T13:27:26.287Z] 13:27:26     INFO - TEST-OK | /xhr/data-uri.htm | took 359ms
[task 2022-10-28T13:27:26.289Z] 13:27:26     INFO - PID 27338 | 1666963646284	Marionette	INFO	Stopped listening on port 33599
[task 2022-10-28T13:27:26.333Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.334Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.341Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.345Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.348Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.348Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.353Z] 13:27:26     INFO - PID 27338 | [Child 27466, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:44
[task 2022-10-28T13:27:26.432Z] 13:27:26     INFO - PID 27338 | [Parent 27338, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:500
[task 2022-10-28T13:27:26.457Z] 13:27:26     INFO - PID 27338 | [Child 28827, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:500
[task 2022-10-28T13:27:26.461Z] 13:27:26     INFO - PID 27338 | [Parent 27338, Compositor] WARNING: Possibly dropping task posted to updater thread: file /builds/worker/checkouts/gecko/gfx/layers/apz/src/APZUpdater.cpp:371
[task 2022-10-28T13:27:26.482Z] 13:27:26     INFO - PID 27338 | [Parent 27338, IPDL Background] WARNING: IPC Connection Error: [Parent][PBackgroundParent] RunMessage(msgname=PRemoteWorkerService::Msg___delete__) Channel closing: too late to send/recv, messages will be lost: file /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1883
[task 2022-10-28T13:27:26.485Z] 13:27:26     INFO - PID 27338 | [Parent 27338, Compositor] WARNING: IPC Connection Error: [Parent][PCompositorManagerParent] RunMessage(msgname=PCompositorBridge::Msg___delete__) Channel closing: too late to send/recv, messages will be lost: file /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1883
[task 2022-10-28T13:27:26.485Z] 13:27:26     INFO - PID 27338 | [Parent 27338, Compositor] WARNING: IPC Connection Error: [Parent][PImageBridgeParent] RunMessage(msgname=PImageBridge::Msg_WillClose) Channel closing: too late to send/recv, messages will be lost: file /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1883
[task 2022-10-28T13:27:26.521Z] 13:27:26     INFO - PID 27338 | [Parent 27338, Socket Thread] WARNING: cannot post event if not initialized: file /builds/worker/checkouts/gecko/netwerk/protocol/http/nsHttpConnectionMgr.cpp:197
Flags: needinfo?(valentin.gosu)
Flags: needinfo?(valentin.gosu)
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/75dd9daa738f
Stop stripping spaces from data URLs r=necko-reviewers,sunil,jesup
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: