Closed Bug 1418376 Opened 7 years ago Closed 7 years ago

report a message to the web console if we block service workers due to storage configuration

Categories

(Core :: DOM: Service Workers, enhancement, P2)

57 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: bkelly, Assigned: tt)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

Since I added code to block service workers when storage is disabled in bug 1336364 we have gotten a number of bugs by people confused by this.  We should log a message to the web console to clarify what is going on for developers.
Priority: -- → P2
Tom, do you have bandwidth to take this?
Flags: needinfo?(ttung)
Sure, I'll work on this after fixing the bug 1222008
Assignee: nobody → ttung
Flags: needinfo?(ttung)
Hi Ben,

There are seven if-statements [1] where the service worker checks the permission of StorageAccess. However, I don't think web developers are able to call GetServiceWorkerRegistrationInfo()[2]. Thus, I only report six of them to the web console and add testcases for them. I make them report to the console while failing.

Could you help me to review the patch? Thanks!

[1] https://searchfox.org/mozilla-central/search?q=StorageAccess&case=false&regexp=false&path=dom%2Fworkers
[2] https://searchfox.org/mozilla-central/source/dom/workers/ServiceWorkerManager.cpp#2029
Attachment #8934388 - Flags: review?(bkelly)
Comment on attachment 8934388 [details] [diff] [review]
Bug 1418376: Report to the console if a service worker is blocked because the storage is not fully allow. r?bkelly

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

Awesome, thank you!  Great to have a test for this as well.

r=me with one minor message text comment addressed.

::: dom/locales/en-US/chrome/dom/dom.properties
@@ +221,5 @@
>  ServiceWorkerRegisterNetworkError=Failed to register/update a ServiceWorker for scope ‘%1$S’: Load failed with status %2$S for script ‘%3$S’.
>  # LOCALIZATION NOTE: Do not translate "ServiceWorker". %1$S is a URL representing the scope of the ServiceWorker, %2$S is a MIME Media Type like "text/plain" and %3$S is a URL.
>  ServiceWorkerRegisterMimeTypeError=Failed to register/update a ServiceWorker for scope ‘%1$S’: Bad Content-Type of ‘%2$S’ received for script ‘%3$S’.  Must be ‘text/javascript’, ‘application/x-javascript’, or ‘application/javascript’.
> +# LOCALIZATION NOTE: Do not translate "ServiceWorker". %S is a URL representing the scope of the ServiceWorker.
> +ServiceWorkerRegisterStorageError=Failed to register/update a ServiceWorker for scope ‘%S’: The storage access is not fully allowed.

Can you rephrase "The storage access is not fully allowed" to something like:

  Storage access is restricted in this context due to user settings or private browsing mode.

Here and in the other messages.
Attachment #8934388 - Flags: review?(bkelly) → review+
Thanks for the review! I address the comment.
Attachment #8934388 - Attachment is obsolete: true
Attachment #8934776 - Flags: review+
(In reply to Tom Tung [:tt] from comment #6)
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=445fd4575e4a5ff9e88ae9e92e2923f3c79ef0c4

Try shows that I should use another encoding for "'"

try with the fix:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=be72c36740bb0c939b4d37257b39bd742e878ed9&selectedJob=150097452
Attached patch interdiff.patch (obsolete) — Splinter Review
Ben, the previous try result shows that I should use "’" instead of "'". Would you mind reviewing it? Thanks! 

I'll apply this change to the attachment 8934776 [details] [diff] [review] once it gets r+.
Attachment #8935213 - Flags: review?(bkelly)
Attachment #8935213 - Flags: review?(bkelly) → review+
Thanks for the review!
Attachment #8934776 - Attachment is obsolete: true
Attachment #8935213 - Attachment is obsolete: true
Attachment #8935220 - Flags: review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/eae544da26b6ea225e3f402c1bd62085cf1c7ec1
Bug 1418376: Report to the console if a service worker is blocked because the storage is not fully allow. r=bkelly
https://hg.mozilla.org/mozilla-central/rev/eae544da26b6
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Blocks: 1424212
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: