Status

Connected Devices
Project Link
2 years ago
8 months ago

People

(Reporter: fabrice, Assigned: fabrice, NeedInfo)

Tracking

Details

Attachments

(1 attachment, 6 obsolete attachments)

(Assignee)

Description

2 years ago
Created attachment 8754132 [details] [diff] [review]
jsworkers.patch
(Assignee)

Comment 1

2 years ago
Created attachment 8754184 [details] [diff] [review]
jsworkers.patch
Attachment #8754132 - Attachment is obsolete: true
(Assignee)

Comment 2

2 years ago
http://bitsparrow.io/ may provide an easy way to serialize and deserialize messages between Rust and JS.
(Assignee)

Comment 3

2 years ago
Created attachment 8754225 [details] [diff] [review]
jsworkers.patch

Now with very basic ws setup...
Attachment #8754184 - Attachment is obsolete: true
(Assignee)

Comment 4

2 years ago
Created attachment 8761884 [details] [diff] [review]
jsworkers.patch
Attachment #8754225 - Attachment is obsolete: true
(Assignee)

Comment 5

a year ago
Created attachment 8763038 [details] [diff] [review]
jsworkers.patch
Assignee: nobody → fabrice
Attachment #8761884 - Attachment is obsolete: true
(Assignee)

Comment 6

a year ago
Created attachment 8766858 [details] [diff] [review]
jsworkers.patch

Rebased to build on current m-c
Attachment #8763038 - Attachment is obsolete: true
(Assignee)

Comment 7

a year ago
Baku, in this patch there are changes to worker code in:
diff --git a/dom/webidl/Worker.webidl b/dom/webidl/Worker.webidl
diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h

The goal is to add an optional argument to the ChromeWorker() constructor to specify in which user context we want to run the worker. I'm setting the principal on the WorkerLoadInfo by building a codebasePrincipal but that doesn't seem to work. Any idea what I should do?
(Assignee)

Updated

a year ago
Flags: needinfo?(amarchesini)
(Assignee)

Updated

a year ago
Summary: Basic gecko app → Basic jsworkers gecko app
Comment on attachment 8766858 [details] [diff] [review]
jsworkers.patch

Review of attachment 8766858 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/workers/WorkerPrivate.cpp
@@ +4115,5 @@
> +  if (NS_WARN_IF(NS_FAILED(rv))) {
> +    return nullptr;
> +  }
> +
> +  GetLoadInfo(aGlobal.Context(), nullptr, parent, aScriptURL,

2 things here:

1. GetLoadInfo starts the loading of the script and it creates the principal. So, mPrincipal+attrs should be set into GetLoadInfo.
2. This should return a security error, right? because of https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerPrivate.cpp#4291
Flags: needinfo?(amarchesini)
(Assignee)

Comment 9

a year ago
Right, I made changes to set the principal in GetLoadInfo, and that part works. But we fail later when we check that the loadContext and the loadInfo match, which makes sense since my loading context is a chrome page.

Instead of keep doing terrible hacks I feel I need to have a clean way to create a context to load some local content (a resource:// or chrome:// url) and make it look like it was loaded from a different, remote URL, including https support. This phony page will itself load the worker, and that needs to be same-origin to work. We also need to set the right userContext on this load context.

Baku, any idea if that's doable and where I should start?
Flags: needinfo?(amarchesini)
Comment hidden (spam)
(Assignee)

Comment 11

a year ago
Created attachment 8779064 [details] [diff] [review]
jsworkers.patch
Attachment #8766858 - Attachment is obsolete: true
(Assignee)

Updated

a year ago
Flags: needinfo?(amarchesini)

Comment 12

11 months ago
Fabrice - can this bug be closed now?
Flags: needinfo?(fabrice)
You need to log in before you can comment on or make changes to this bug.