Closed Bug 1189235 Opened 9 years ago Closed 9 years ago

use originAttribute for ServiceWorkerRegistrar

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
FxOS-S6 (04Sep)
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: dimi, Assigned: dimi)

References

Details

Attachments

(1 file, 4 obsolete files)

As mentioned in Bug 1163254, we will use originAttribute instead of appid and browserId. And also according to bug 1167100 comment 1 and comment 2, we will need some work in ServiceWorkerRegistrar.cpp
Assignee: nobody → dlee
Blocks: 1167100
Status: NEW → ASSIGNED
Hi Ben, In current flow, when the version of registrar is different, it will return error directly[1]. In this bug I will write origin attribute to registrar and change the version to 2. How do you think we should handle the version conflict ? just return error like what we implement now? or do some special handling to make version 1 registrar can still be read correctly? [1]https://dxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerRegistrar.cpp#309
Flags: needinfo?(bkelly)
Attached patch WIP patch (obsolete) (deleted) — Splinter Review
Long term we need to be migrating the registration file when we add a new version. Since we haven't shipped SW yet, though, I think we can just wipe the current file and start over. (Note, if we don't get the change in before the next branch merge we need a migration since we're shipping SW+push in 42.) Andrea, what do you think?
Flags: needinfo?(bkelly) → needinfo?(amarchesini)
Attached patch WIP patch v2 (obsolete) (deleted) — Splinter Review
Remove write appid and browserId
Attachment #8642265 - Attachment is obsolete: true
Target Milestone: --- → FxOS-S5 (21Aug)
bkelly, you are right. We have a version number of this file for this reason. But, I agree, we can ignore the migration since SW has not been shipped yet.
Flags: needinfo?(amarchesini)
Attached patch Patch V3 (obsolete) (deleted) — Splinter Review
According to comment 3 and comment 5, this patch doesn't do registration file migration.
Attachment #8642980 - Attachment is obsolete: true
Attachment #8646275 - Flags: feedback?(allstars.chh)
Comment on attachment 8646275 [details] [diff] [review] Patch V3 Review of attachment 8646275 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/workers/ServiceWorkerRegistrar.cpp @@ +321,5 @@ > if (NS_WARN_IF(!hasMoreLines)) { \ > return NS_ERROR_FAILURE; \ > } > > + nsAutoCString originAttributesSuffix; suffix is enough @@ +547,5 @@ > const mozilla::ipc::ContentPrincipalInfo& cInfo = > info.get_ContentPrincipalInfo(); > > + OriginAttributes attrs(cInfo.appId(), cInfo.isInBrowserElement()); > + nsAutoCString originAttributesSuffix; too
Attachment #8646275 - Flags: feedback?(allstars.chh) → feedback+
Attached patch Patch v4 (obsolete) (deleted) — Splinter Review
Address yoshi's comment
Attachment #8646275 - Attachment is obsolete: true
Attachment #8647432 - Flags: review?(bkelly)
Comment on attachment 8647432 [details] [diff] [review] Patch v4 Review of attachment 8647432 [details] [diff] [review]: ----------------------------------------------------------------- I'm sorry, I don't know the registration code at all. I think Andrea would be a better reviewer here.
Attachment #8647432 - Flags: review?(bkelly) → review?(amarchesini)
Comment on attachment 8647432 [details] [diff] [review] Patch v4 Review of attachment 8647432 [details] [diff] [review]: ----------------------------------------------------------------- You have to update the gtest too: dom/workers/test/gtest/TestReadWrite.cpp ::: dom/workers/ServiceWorkerRegistrar.h @@ +15,5 @@ > #include "nsString.h" > #include "nsTArray.h" > > #define SERVICEWORKERREGISTRAR_FILE "serviceworker.txt" > +#define SERVICEWORKERREGISTRAR_VERSION "2" don't change the version. Otherwise you have to support migration from 1 to 2.
Attachment #8647432 - Flags: review?(amarchesini) → review-
(In reply to Andrea Marchesini (:baku) from comment #10) > don't change the version. Otherwise you have to support migration from 1 to > 2. Don't we need to wipe the old file somehow? How does that work without changing the version?
Hi Andrea, If we don't change the version, how do SW distinguish old version and new version ? Do you mean we don't handle this case and expect it will fail somewhere inside |ServiceWorkerRegistrar::ReadData|? I thought the plan about ignoring the migration is when the version is different, we just delete the old one[1]. [1]https://dxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerRegistrar.cpp#251
Flags: needinfo?(amarchesini)
> [1]https://dxr.mozilla.org/mozilla-central/source/dom/workers/ > ServiceWorkerRegistrar.cpp#251 Do we have SW enabled in non-nightly builds? If yes, then change it to version 2. Otherwise I don't see the point to increase the version.
Flags: needinfo?(amarchesini)
Andrea, but even for nightly users... leaving the version unchanged causes the file to be corrupt, right? That seems bad... Also, we have shipped service workers for push in firefox 42.
Flags: needinfo?(amarchesini)
OK. dlee, can you submit a new patch with version changed + gtest updates?
Flags: needinfo?(amarchesini) → needinfo?(dlee)
Attached patch Patch v5 (deleted) — Splinter Review
Attachment #8647432 - Attachment is obsolete: true
Flags: needinfo?(dlee)
Attachment #8650384 - Flags: review?(amarchesini)
Attachment #8650384 - Flags: review?(amarchesini) → review+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: FxOS-S5 (21Aug) → FxOS-S6 (04Sep)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: