Closed Bug 1274093 Opened 8 years ago Closed 6 years ago

Basic jsworkers gecko app

Categories

(Connected Devices Graveyard :: Project Link, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: fabrice, Assigned: fabrice)

Details

Attachments

(1 file, 6 obsolete files)

Attached patch jsworkers.patch (obsolete) — Splinter Review
      No description provided.
Attached patch jsworkers.patch (obsolete) — Splinter Review
Attachment #8754132 - Attachment is obsolete: true
http://bitsparrow.io/ may provide an easy way to serialize and deserialize messages between Rust and JS.
Attached patch jsworkers.patch (obsolete) — Splinter Review
Now with very basic ws setup...
Attachment #8754184 - Attachment is obsolete: true
Attached patch jsworkers.patch (obsolete) — Splinter Review
Attachment #8754225 - Attachment is obsolete: true
Attached patch jsworkers.patch (obsolete) — Splinter Review
Assignee: nobody → fabrice
Attachment #8761884 - Attachment is obsolete: true
Attached patch jsworkers.patch (obsolete) — Splinter Review
Rebased to build on current m-c
Attachment #8763038 - Attachment is obsolete: true
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?
Flags: needinfo?(amarchesini)
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)
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)
Attached patch jsworkers.patchSplinter Review
Attachment #8766858 - Attachment is obsolete: true
Flags: needinfo?(amarchesini)
Fabrice - can this bug be closed now?
Flags: needinfo?(fabrice)
Resolving per https://bugzilla.mozilla.org/show_bug.cgi?id=1361198
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Flags: needinfo?(fabrice)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: