Commit Graph

356 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
71bf77b3fe Bug 1904442 - Rename GlobalTeardownObserver::GetOwner to GetOwnerWindow. r=smaug,media-playback-reviewers,dom-storage-reviewers,aosmond,padenot,asuth
Also HasOrHasHadOwner to HasOrHasHadOwnerWindow.

Differential Revision: https://phabricator.services.mozilla.com/D214772
2024-07-01 11:49:59 +00:00
Eden Chuang
feb314e721 Bug 1894231 - P3 Remove WorkerPrivate* in WorkerMainThreadRunnable. r=dom-worker-reviewers,extension-reviewers,smaug,rpl
Remove mWorkerPrivate from WorkerMainThreadRunnable. Instead, using a ThreadSafeWorkerRef to keep Worker alive until the created syncLoop is destroyed.

In general, WorkerMainThreadRunnable::mWorkerPrivate is only used for dispatching the MainThreadStopSyncLoopRunnable back to the Worker thread. Because of the syncLoop, the Worker is supposed to be kept alive until the created syncLoop is destroyed.

RefPtr<ThreadSafeWorkerRef> WorkerMainThreadRunnable::mWorkerRef is introduced to ensure a valid WorkerPrivate during WorkerMainThreadRunnable's execution.

WorkerMainThreadRunnable::mWorkerRef is allocated just before creating a syncLoop in WorkerMainThreadRunnable::Dispatch. And released after the created syncLoop::Run() finishes.

Depends on D212556

Differential Revision: https://phabricator.services.mozilla.com/D212557
2024-06-24 22:20:51 +00:00
Kagami Sascha Rosylight
1de92415a3 Bug 1902096 - Remove notification.prompt.testing prefs r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D213670
2024-06-18 13:59:05 +00:00
Kagami Sascha Rosylight
0800b9244a Bug 1892705 - Persist fully resolved icon URL r=asuth,hsingh
The resolved URL is passed to alert service as expected already, and this patch makes sure Notification object itself stores the resolved URL as the spec says.

Safari and Chrome already conform to the spec.

Removing test_notification_get as it's now covered by WPT and modifying notification_worker as WPT doesn't cover dedicated workers yet (as testdriver limitation makes it hard).

Differential Revision: https://phabricator.services.mozilla.com/D208132
2024-06-10 16:56:18 +00:00
Stanca Serban
9326497fac Backed out changeset 1b26a4176031 (bug 1892705) for causing multiple failures. CLOSED TREE 2024-06-10 14:46:04 +03:00
Kagami Sascha Rosylight
35252f609c Bug 1892705 - Persist fully resolved icon URL r=asuth
The resolved URL is passed to alert service as expected already, and this patch makes sure Notification object itself stores the resolved URL as the spec says.

Safari and Chrome already conform to the spec.

Removing test_notification_get as it's now covered by WPT and modifying notification_worker as WPT doesn't cover dedicated workers yet (as testdriver limitation makes it hard).

Differential Revision: https://phabricator.services.mozilla.com/D208132
2024-06-10 10:15:53 +00:00
Kagami Sascha Rosylight
4d67b6f815 Bug 1894039 - Part 1: Use BindingUtils functions for enums r=asuth
This unfortunately adds some ASCII-to-UTF16 conversion because:

1. Enums use nsLiteralCString internally
2. nsAlertsService expects nsString. (macOS and Windows expects UTF16 while libnotify expects UTF8)
3. ServiceWorker events currently expect nsString. Fixing this requires touching quite some files and I filed bug 1894240 for that.

Differential Revision: https://phabricator.services.mozilla.com/D208920
2024-05-14 14:13:28 +00:00
Harveer Singh
455487e2e6 Bug 1882176: PBM notifications support.r=saschanaz,asuth,geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D207551
2024-05-06 23:53:27 +00:00
Kagami Sascha Rosylight
8bd54b2382 Bug 1879112 - Check permission earlier and mark as closed if failed r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D201140
2024-04-22 16:59:56 +00:00
Eden Chuang
a718e4758f Bug 1769913 - P3 Remove WorkerRunnable::mWorkerPrivate. r=dom-worker-reviewers,asuth
WorkerRunnable no longer keeps a raw pointer(mWorkerPrivate) for the associated WorkerPrivate in this patch.
Removing the WorkerRunnable::mWorkerPrivate needs to fix the following problems.

1. Thread assertions in WorkerRunnable::Dispatch()

To fix this problem, the associated WorkerPrivate is as a parameter and passed to WorkerRunnable::Dispatch() for the dispatching thread assertions. This associated WorkerPrivate is also propagated to PreDispatch() and PostDispatch() for the children classes of WorkerRunnable()

2. Get the associated WorkerPrivate in WorkerRunnable::Run() for environment setup(GlobabObject, JSContext setting for the runnable)

- For WorkerThreadRunnable

Since WorkerThreadRunnable is supposed to run on the worker thread, it does not need to keep a raw pointer to WorkerPrivate as its class member. GetCurrentThreadWorkerPrivate() should always get the correct WorkerPrivate for WorkerThreadRunnable.

- For WorkerParentThreadRunnable

WorkerParentRef is introduced to keep a RefPtr<WorkerPrivate> for WorkerParentThreadRunnable instead of using a raw pointer.
Checking the associated WorkerPrivate existence by WorkerParentRef at the beginning of WorkerParentThreadRunnable::Run(). If the Worker has already shut down, WorkerParentThreadRunnable cannot do anything with the associated WorkerPrivate, so WorkerParentThreadRunnable::Run() will return NS_OK directly but with a warning.

The associated WorkerPrivate is also passed into WorkerRun(), PreRun(), and PostRun(), so the majority of implementations of child classes of WorkerRunnable do not need to be changed.

If there are any cases in which the child classes of WorkerThreadRunnable/WorkerParentThreadRunnable want to keep the associated WorkerPrivate, they should use WorkerRefs instead of raw pointers.

Depends on D205679

Differential Revision: https://phabricator.services.mozilla.com/D207039
2024-04-19 09:41:58 +00:00
Eden Chuang
f9b64790d7 Bug 1769913 - P1 Make WorkerRunnable to be a base class for runnables on Worker thread and Worker's parent thread. r=dom-worker-reviewers,asuth
This is the first step in splitting the parent thread runnable out of WorkerRunnable.

To reuse the runnable dispatching codes in Worker, we still need a base class for runnable on the worker thread and the parent thread.

In this patch, we rename the original WorkerRunnable to WorkerThreadRunnable and make WorkerRunnable to be WorkerThreadRunnable's parent class.

In the second patch, we will create WorkerParentThreadRunnable and its sub-classes, split from WorkerThreadRunnable for runnable on the Worker's parent thread.

And in the third patch, we will re-structure the content of WorkerParentThreadRunnable to remove unnecessary members.

Differential Revision: https://phabricator.services.mozilla.com/D205178
2024-04-19 09:41:57 +00:00
Kagami Sascha Rosylight
3b3e3ad05b Bug 1879934 - Observe window events only for non-persistent notifications r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D201627
2024-03-02 01:06:12 +00:00
Sandor Molnar
bf0112a5e0 Backed out 2 changesets (bug 1879112, bug 1879934) for causing assertion failures @ widget/windows/ToastNotification.cpp
Backed out changeset 2b3b6edc0cff (bug 1879112)
Backed out changeset 3dd0aa903d7f (bug 1879934)
2024-03-01 20:25:16 +02:00
Kagami Sascha Rosylight
6fa527337a Bug 1879112 - Check permission earlier and mark as closed if failed r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D201140
2024-03-01 11:27:53 +00:00
Kagami Sascha Rosylight
7c6c821a28 Bug 1879934 - Observe window events only for non-persistent notifications r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D201627
2024-03-01 11:27:52 +00:00
Jens Stutte
f3c15c2cc5 Bug 1880233 - Add names to MainThreadWorkerRunnable derived runnables. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D201812
2024-02-14 16:13:24 +00:00
Kagami Sascha Rosylight
4e5a954374 Bug 1874958 - Do not call CreateAndShow with the default permission r=asuth
Somehow we ended up throwing if it's explicitly denied. Now it throws error with the default permission too.

Differential Revision: https://phabricator.services.mozilla.com/D200826
2024-02-07 08:58:40 +00:00
Eden Chuang
78ed732fd3 Bug 1873573 - Rename PromiseWorkerProxy::WorkerPromise() to GetWorkerPromise(). r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D199323
2024-01-26 10:48:56 +00:00
hsingh
f8288450c0 Bug 1864520: Allow notification in PBM with pref enabled.r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D193801
2023-11-22 13:44:58 +00:00
Eden Chuang
5ca02c8ea0 Bug 1836700 - Remove BusyCount of WorkerPrivate. r=asuth,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D182718
2023-11-13 04:00:40 +00:00
Kagami Sascha Rosylight
a09445f989 Bug 1860516 - Part 2: Use QMResult for Notification::ConstructFromFields r=asuth
... which also fix the error check being too late. (SetStoredState should happen after the check)

Differential Revision: https://phabricator.services.mozilla.com/D191748
2023-10-27 12:26:06 +00:00
Kagami Sascha Rosylight
3c16a5c771 Bug 1860516 - Part 1: Remove unused headers from Notification.cpp/h r=asuth
... at least the ones that clangd complains about.

Differential Revision: https://phabricator.services.mozilla.com/D191747
2023-10-27 12:26:06 +00:00
Natalia Csoregi
1a69294ce8 Backed out 2 changesets (bug 1860516) for causing notification failures. CLOSED TREE
Backed out changeset ad8b502ca767 (bug 1860516)
Backed out changeset 2b2f71e3690a (bug 1860516)
2023-10-25 21:14:33 +03:00
Kagami Sascha Rosylight
26e2891330 Bug 1860516 - Part 2: Use QMResult for Notification::ConstructFromFields r=asuth
... which also fix the error check being too late. (SetStoredState should happen after the check)

Depends on D191747

Differential Revision: https://phabricator.services.mozilla.com/D191748
2023-10-25 15:56:07 +00:00
Kagami Sascha Rosylight
c67b3a51a8 Bug 1860516 - Part 1: Remove unused headers from Notification.cpp/h r=asuth
... at least the ones that clangd complains about.

Differential Revision: https://phabricator.services.mozilla.com/D191747
2023-10-25 15:56:07 +00:00
Emilio Cobos Álvarez
d02e297b2d Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Eden Chuang
4d5ce68c8f Bug 1850843 - Keeping doing nothing for NotificationWorkerRunnable when the worker is dying. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D187433
2023-09-05 11:22:24 +00:00
Markus Stange
755a0de1c3 Bug 1851263 - Rename nsIGlobalObject::AsInnerWindow to GetAsInnerWindow because it can return null. r=smaug
This is also the name that was originally suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=218415#c53 .

Differential Revision: https://phabricator.services.mozilla.com/D187340
2023-09-04 04:06:30 +00:00
hsingh
7c1dbb1413 Bug 1843046: Do not allow notifications in private window.r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D184064
2023-08-15 20:48:13 +00:00
Iulian Moraru
748ef0f987 Backed out 2 changesets (bug 1843046) for causing android linting failures. CLOSED TREE
Backed out changeset 31e28d290422 (bug 1843046)
Backed out changeset 5e8b64d6b91a (bug 1843046)
2023-08-14 17:46:58 +03:00
hsingh
814d4d9a6d Bug 1843046: Do not allow notifications in private window.r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D184064
2023-08-14 14:06:04 +00:00
Iulian Moraru
c748816264 Backed out changeset 308fde20a1b1 (bug 1843046) for causing geckoview-junit failures related to notifications. CLOSED TREE 2023-08-14 16:55:24 +03:00
hsingh
69bebf041c Bug 1843046: Do not allow notifications in private window.r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D184064
2023-08-14 12:29:54 +00:00
Peter Van der Beken
c10814e75a Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre
Differential Revision: https://phabricator.services.mozilla.com/D184973
2023-08-02 20:41:48 +00:00
Sandor Molnar
591eb826a5 Backed out changeset b21c8906db6d (bug 1843046) for causing gv-junit failures in WebNotificationTest CLOSED TREE 2023-08-02 16:47:16 +03:00
hsingh
fa6a705ab5 Bug 1843046: Do not allow notifications in private window.r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D184064
2023-08-02 12:56:27 +00:00
Gregory Pappas
c0b9bdb31b Bug 1587045 - Remove dom.webnotifications.allowinsecure pref r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D183817
2023-07-18 16:20:15 +00:00
Sandor Molnar
dc913b494f Backed out changeset b12f2488fd46 (bug 1587045) for causing mochitest failures in dom/notification/test/mochitest/test_notification_insecure_context.html CLOSED TREE 2023-07-18 13:05:18 +03:00
Gregory Pappas
e64abd601a Bug 1842457 - Remove dom.webnotifications.serviceworker.enabled pref r=webidl,dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183821
2023-07-18 08:01:33 +00:00
Gregory Pappas
34966c92ae Bug 1587045 - Remove dom.webnotifications.allowinsecure pref r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D183817
2023-07-18 07:21:16 +00:00
Nika Layzell
30c48eac49 Bug 1839920 - Rename Get{ASCII,UTF}Origin to GetWebExposedOriginSerialization, r=smaug,necko-reviewers,anti-tracking-reviewers,bvandersloot,jesup
This should make uses of the type more clearly indicating where the
origin came from, and should help avoid potential confusion between this
origin and nsIPrincipal::origin in new code.

This new name is long, but explicit. The string returned from this
function corresponds to the "serialization of an origin" from the WHATWG
html spec:
https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin

Differential Revision: https://phabricator.services.mozilla.com/D181794
2023-06-27 19:59:15 +00:00
Eden Chuang
c0e52c0de6 Bug 1839231 - Checking nsIGlobalObject::IsDying() before dispatching Notification Event on Worker. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D181629
2023-06-26 11:11:17 +00:00
Eden Chuang
b1c66d53bf Bug 1800659 - P2 remove nsICancelableRunnable inheriting form WorkerRunnable. r=asuth
This patch is only remove the inheriting, but keeping Cancel() implmentation.
The Cancel() is needed in some special cases, such as Worker enters Canceling when WorkerScope is not created.

Depends on D176915

Differential Revision: https://phabricator.services.mozilla.com/D173850
2023-06-06 06:36:50 +00:00
Ho Cheung
a30250dff0 Bug 1689565 - Part 1: Remove Notification.get() r=saschanaz
Remove Notification.get() in the code

Differential Revision: https://phabricator.services.mozilla.com/D167236
2023-01-30 12:50:51 +00:00
Nika Layzell
3652956b7b Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Sandor Molnar
f236c54e45 Backed out 6 changesets (bug 1809752, bug 1809753) for causing perma failures in browser/components/firefoxview/tests/browser/browser_feature_callout_position.js
Backed out changeset ea05784d74c4 (bug 1809753)
Backed out changeset 7c9b20eebcc8 (bug 1809753)
Backed out changeset d0267ac2256d (bug 1809753)
Backed out changeset aa9f2971bd6f (bug 1809753)
Backed out changeset f0d9fcfaa6f8 (bug 1809752)
Backed out changeset 6d58c799cffe (bug 1809752)
2023-01-17 03:19:24 +02:00
Nika Layzell
d61ced88a2 Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Nicholas Rishel
35c2c30aae Bug 1787004 - Fix notifications not closing when notification.close() is called. r=nalexander,geckoview-reviewers,smaug,jonalmeida
This adds context to `CloseAlert()` such that explicitly closing the notification e.g. `notification.close()` can be differentiated from a tab or window implicitly closing the notification. This is necessary as we want notifications to persist after a tab or window is closed for Windows.

This change in behavior is necessary to match user expectations. Users expect notifications to persist in the system tray and do not expect notifications to be lost due to a tab being closed. The content of the message is more important than the interaction in that lens. This change is also necessary for parity with Chrome.

Differential Revision: https://phabricator.services.mozilla.com/D161024
2023-01-06 18:36:23 +00:00
Edgar Chen
72b07044d2 Bug 1708354 - Disallow showing notification from cross-origin iframes; r=smaug
We disallow notification permission requests from cross-origin iframes (see bug 1560741).
It makes sense that we also disallow showing notification from cross-origin iframes,
even if user has granted the notification permission on that origin.

Differential Revision: https://phabricator.services.mozilla.com/D158147
2022-09-29 09:00:29 +00:00
Csoregi Natalia
3b59ec0740 Backed out changeset a75c8ba68f39 (bug 1708354) for causing test_notification_tag.html failures. CLOSED TREE 2022-09-28 11:56:02 +03:00