Closed
Bug 1156397
Opened 9 years ago
Closed 9 years ago
Small bugs in webpush PushService
Categories
(Core :: DOM: Push Subscriptions, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: dragana, Assigned: dragana)
References
Details
Attachments
(1 file, 3 obsolete files)
5.06 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
The line:
http://mxr.mozilla.org/mozilla-central/source/dom/push/PushService.jsm#385
does not look wright. Should be record
I will use this bug to fix if i find other problems.
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Comment 2•9 years ago
|
||
Call:
http://mxr.mozilla.org/mozilla-central/source/dom/workers/ServiceWorkerManager.cpp#1543
does not work because the first argument cannot be nullptr it must be nsIDocument.
Suggestion from:
https://bugzilla.mozilla.org/show_bug.cgi?id=1038811#c64
target->DispatchTrustedEvent(NS_LITERAL_STRING("..."));
does not work because DOMEventTargetHelper is not thread safe....
I am not familiar with this code, I will leave the ExtendableEvent for now
Comment 3•9 years ago
|
||
Comment on attachment 8595444 [details] [diff] [review]
bug_1156397_v1.patch
Review of attachment 8595444 [details] [diff] [review]:
-----------------------------------------------------------------
nsm, can you look at the swm changes?
::: dom/interfaces/base/nsIServiceWorkerManager.idl
@@ -122,5 @@
> // of nsIServiceWorkerInfo.
> nsIArray getAllRegistrations();
>
> void sendPushEvent(in ACString scope, in DOMString data);
> - void sendPushSubscriptionChangedEvent(in ACString scope);
update the uuid of this interface.
::: dom/push/PushService.jsm
@@ +1330,2 @@
>
> + // TODO -- test needed. E10s support needed.
while you're here, you can drop the "E10s support needed." of this comment. It should work in e10s.
Attachment #8595444 -
Flags: review?(nsm.nikhil)
Comment on attachment 8595444 [details] [diff] [review]
bug_1156397_v1.patch
Review of attachment 8595444 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/workers/ServiceWorkerManager.cpp
@@ +1536,5 @@
> WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
> {
> MOZ_ASSERT(aWorkerPrivate);
> + GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper());
> + nsCOMPtr<EventTarget> owner = do_QueryInterface(globalObj.GetAsSupports());
If the intent is to capture https://github.com/w3c/push-api/issues/132, please add a link to the issue, since the spec still keeps this a simple event. Also file a followup for implementing the part where we respect waitUntil() and put the bug number here. Thanks!
There is some duplication here, and globalObj is not used. How about:
nsRefPtr<EventTarget> target = aWorkerPrivate->GlobalScope();
and pass target to ExtendableEvent::Constructor and also use it below for DispatchDOMEvent.
@@ +1548,2 @@
>
> nsRefPtr<EventTarget> target = do_QueryObject(aWorkerPrivate->GlobalScope());
Not required.
Attachment #8595444 -
Flags: review?(nsm.nikhil) → review+
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Attachment #8596206 -
Flags: review?(bobbyholley)
Comment on attachment 8596206 [details] [diff] [review]
interdiff
sorry, wrong bug.
Attachment #8596206 -
Attachment is obsolete: true
Attachment #8596206 -
Flags: review?(bobbyholley)
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #4)
> Comment on attachment 8595444 [details] [diff] [review]
> bug_1156397_v1.patch
>
> Review of attachment 8595444 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/workers/ServiceWorkerManager.cpp
> @@ +1536,5 @@
> > WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
> > {
> > MOZ_ASSERT(aWorkerPrivate);
> > + GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper());
> > + nsCOMPtr<EventTarget> owner = do_QueryInterface(globalObj.GetAsSupports());
>
> If the intent is to capture https://github.com/w3c/push-api/issues/132,
> please add a link to the issue, since the spec still keeps this a simple
> event. Also file a followup for implementing the part where we respect
> waitUntil() and put the bug number here. Thanks!
Actually that was not my intention, I just did not know how to do it properly, because I am very new to dom code.
But I have figured it out.
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8595444 -
Attachment is obsolete: true
Attachment #8596658 -
Flags: review?(nsm.nikhil)
Assignee | ||
Updated•9 years ago
|
Assignee: nsm.nikhil → dd.mozilla
Comment on attachment 8596658 [details] [diff] [review]
bug_1156397_v1.patch
Review of attachment 8596658 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with comments once you explain or remove the Throw() call.
::: dom/workers/ServiceWorkerManager.cpp
@@ +1537,5 @@
> {
> MOZ_ASSERT(aWorkerPrivate);
>
> + WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope();
> +
Nit: Trailing whitespace.
@@ +1541,5 @@
> +
> + nsCOMPtr<nsIDOMEvent> event;
> + nsresult rv =
> + NS_NewDOMEvent(getter_AddRefs(event), globalScope, nullptr, nullptr);
> + if (NS_FAILED(rv)) {
if (NS_WARN_IF(NS_FAILED(rv)) {
@@ +1542,5 @@
> + nsCOMPtr<nsIDOMEvent> event;
> + nsresult rv =
> + NS_NewDOMEvent(getter_AddRefs(event), globalScope, nullptr, nullptr);
> + if (NS_FAILED(rv)) {
> + Throw(aCx, rv);
See comment below about throw.
@@ +1547,5 @@
> + return false;
> + }
> +
> + rv = event->InitEvent(NS_LITERAL_STRING("pushsubscriptionchange"), false, false);
> + if (NS_FAILED(rv)) {
if (NS_WARN_IF(NS_FAILED(rv)) {
@@ +1548,5 @@
> + }
> +
> + rv = event->InitEvent(NS_LITERAL_STRING("pushsubscriptionchange"), false, false);
> + if (NS_FAILED(rv)) {
> + Throw(aCx, rv);
Where does this Throw() function come from and what does it do? If there was a failure, just returning is fine.
Attachment #8596658 -
Flags: review?(nsm.nikhil) → review+
Assignee | ||
Comment 10•9 years ago
|
||
Attachment #8596658 -
Attachment is obsolete: true
Attachment #8597470 -
Flags: review+
Assignee | ||
Comment 11•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 12•9 years ago
|
||
Keywords: checkin-needed
Comment 13•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•