Commit Graph

68 Commits

Author SHA1 Message Date
Boris Zbarsky
00cd5d4380 Bug 1619112 part 5. Stop accepting nsAString in ErrorResult error-throwing. r=smaug
Callers should pass in UTF-8, since that's what the JS engine ends up with in the end anyway.

The various URL changes are because NS_NewURI converts incoming nsAString to
UTF-8 anyway.  So we might as well do that up-front and then use the UTF-8
string for both the NS_NewURI call and the error-reporting if it fails.

Differential Revision: https://phabricator.services.mozilla.com/D65543

--HG--
extra : moz-landing-system : lando
2020-03-06 21:08:02 +00:00
Yaron Tausky
5c6bfb7d9a Bug 1610692 - Move call that can run content code out of constructor. r=dom-workers-and-storage-reviewers,asuth
ServiceWorkerRegistration::UpdateState can call content code, which
in turn can result in the registrations getting deleted. This
commit moves the call outside the constructor, so the
registration's creator has a chance to get a proper RefPtr to it.

Differential Revision: https://phabricator.services.mozilla.com/D61706

--HG--
extra : moz-landing-system : lando
2020-02-20 13:06:18 +00:00
Boris Zbarsky
6c66fa85a4 Bug 1615022 part 2. Require an rvalue reference to reject a Promise with an ErrorResult. r=farre,kvark
The rejection process consumes the ErrorResult, so an rvalue reference is the honest thing here.

Differential Revision: https://phabricator.services.mozilla.com/D62632

--HG--
extra : moz-landing-system : lando
2020-02-14 15:42:30 +00:00
Simon Giesecke
b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
shindli
91aa0518dd Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Perry Jiang
044d7a6a91 Bug 1604943 - ServiceWorkerRegistration.update should capture newest worker script URL at call-time r=dom-workers-and-storage-reviewers,asuth
- Cleaned up some comments.
- Changed some const nsACString& parameter types to nsCString to accept r-value
  and l-value nsCStrings.

Differential Revision: https://phabricator.services.mozilla.com/D58877

--HG--
extra : moz-landing-system : lando
2020-01-08 03:21:27 +00:00
Gabriele Svelto
ace6d1063f Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-06 09:24:56 +00:00
Dorel Luca
a381d5c96d Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto
bc9290f767 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-04 15:01:19 +00:00
Andrew Sutherland
cb0f2f4a10 Bug 1587794 - Do not assume global exists. r=perry
This is effectively a reversion of the change made in
https://hg.mozilla.org/mozilla-central/rev/89c938649297#l1.39 when
DOMMozPromiseRequestHolder was introduced.  I've tried to add some
comments to contextualize what's happening there and why it differs
from other similar callsites.

Longer term we might move to just deleting the underlying actor when
we are disconnected.  Those actors were written assuming an
execution model where letting either end delete the actor would result
in intentional process crashes when a message was received for a
destroyed actor.  That is no longer the case.

Differential Revision: https://phabricator.services.mozilla.com/D49671

--HG--
extra : moz-landing-system : lando
2019-10-17 22:52:35 +00:00
Perry Jiang
8ce0bdf419 Bug 1231213 - Update the update algorithm to better match the spec r=asuth
- Throw a TypeError when a registration isn't found in the "scope to registration map"
- Synchronously (before enqueuing a job) check for an existing newest worker
- Synchronously check if an installing worker is attempting to update itself

Differential Revision: https://phabricator.services.mozilla.com/D41618

--HG--
extra : moz-landing-system : lando
2019-08-15 17:27:51 +00:00
Dorel Luca
73975f1d28 Backed out 22 changesets (bug 1231213) for Browser-chrome failures on /workers/remoteworkers/RemoteWorkerChild.cpp
Backed out changeset 7e09ad9ceea6 (bug 1231213)
Backed out changeset a275eb0b1a19 (bug 1231213)
Backed out changeset 906b80778539 (bug 1231213)
Backed out changeset 6a40ab6852cb (bug 1231213)
Backed out changeset 216591953f97 (bug 1231213)
Backed out changeset 1de357bc1921 (bug 1231213)
Backed out changeset 8e3fedf6502a (bug 1231213)
Backed out changeset 1b9a8b022fce (bug 1231213)
Backed out changeset 85df1959eb98 (bug 1231213)
Backed out changeset 666bf4260046 (bug 1231213)
Backed out changeset 0b03a19a6dc1 (bug 1231213)
Backed out changeset 11f010e6d6e7 (bug 1231213)
Backed out changeset 6ed55807374f (bug 1231213)
Backed out changeset 395062aef2ec (bug 1231213)
Backed out changeset bacf8499ba7b (bug 1231213)
Backed out changeset bf5d60c7a85a (bug 1231213)
Backed out changeset cd434b787ce6 (bug 1231213)
Backed out changeset ee4565104217 (bug 1231213)
Backed out changeset 581653ef33dd (bug 1231213)
Backed out changeset 2d5628a0e52d (bug 1231213)
Backed out changeset 3449c2eba4c6 (bug 1231213)
Backed out changeset ae221b628899 (bug 1231213)
2019-08-15 01:04:46 +03:00
Perry Jiang
bbd591602f Bug 1231213 - Update the update algorithm to better match the spec r=asuth
- Throw a TypeError when a registration isn't found in the "scope to registration map"
- Synchronously (before enqueuing a job) check for an existing newest worker
- Synchronously check if an installing worker is attempting to update itself

Differential Revision: https://phabricator.services.mozilla.com/D41618

--HG--
extra : moz-landing-system : lando
2019-08-14 16:20:54 +00:00
Cosmin Sabou
85a8083871 Backed out 22 changesets (bug 1231213) for build bustages on /mozilla/Attributes.h CLOSED TREE
Backed out changeset 4a45f2c447fd (bug 1231213)
Backed out changeset bcb4d348a847 (bug 1231213)
Backed out changeset ae78ac86cc86 (bug 1231213)
Backed out changeset d681c92a7f05 (bug 1231213)
Backed out changeset 1ac9661e7fb4 (bug 1231213)
Backed out changeset 796c617b989f (bug 1231213)
Backed out changeset c46b31113adb (bug 1231213)
Backed out changeset ea7334da65d9 (bug 1231213)
Backed out changeset 6e9273940bf5 (bug 1231213)
Backed out changeset 7df0e0ff9a82 (bug 1231213)
Backed out changeset 12aba06d169c (bug 1231213)
Backed out changeset e7d6d8d64e8a (bug 1231213)
Backed out changeset 097a29f3ff9a (bug 1231213)
Backed out changeset 1b7169b75760 (bug 1231213)
Backed out changeset 0fd1fd7c3f06 (bug 1231213)
Backed out changeset 3d539eb7faff (bug 1231213)
Backed out changeset 419f9bb7be3c (bug 1231213)
Backed out changeset caede0e4e888 (bug 1231213)
Backed out changeset 778eade5085d (bug 1231213)
Backed out changeset a84b262ff6f8 (bug 1231213)
Backed out changeset 97328368da02 (bug 1231213)
Backed out changeset 9c845d7e3b29 (bug 1231213)
2019-08-14 00:10:48 +03:00
Perry Jiang
7c2c13bdfa Bug 1231213 - Update the update algorithm to better match the spec r=asuth
- Throw a TypeError when a registration isn't found in the "scope to registration map"
- Synchronously (before enqueuing a job) check for an existing newest worker
- Synchronously check if an installing worker is attempting to update itself

Differential Revision: https://phabricator.services.mozilla.com/D41618

--HG--
extra : moz-landing-system : lando
2019-08-13 19:57:48 +00:00
Cosmin Sabou
f870af790d Backed out 22 changesets (bug 1231213) for build bustages on RemoteWorkerChild.cpp. CLOSED TREE
Backed out changeset 06dba269fcfe (bug 1231213)
Backed out changeset 20b1ec70a6d0 (bug 1231213)
Backed out changeset be99adfb84ab (bug 1231213)
Backed out changeset 8cb30e5ef8d7 (bug 1231213)
Backed out changeset bdeff3d76292 (bug 1231213)
Backed out changeset 783bd2856798 (bug 1231213)
Backed out changeset e52869704d4d (bug 1231213)
Backed out changeset df97ea0bbe79 (bug 1231213)
Backed out changeset 822ade495b97 (bug 1231213)
Backed out changeset 06281fe76994 (bug 1231213)
Backed out changeset c8c1d3aa27c6 (bug 1231213)
Backed out changeset b96a12cd2c73 (bug 1231213)
Backed out changeset a1dcf2ea83be (bug 1231213)
Backed out changeset 6e2934410f95 (bug 1231213)
Backed out changeset d4ffae32539b (bug 1231213)
Backed out changeset d99f2cbe0ed2 (bug 1231213)
Backed out changeset 3bbea49c6d03 (bug 1231213)
Backed out changeset dac29b0340ce (bug 1231213)
Backed out changeset 0591a2a0cc41 (bug 1231213)
Backed out changeset afc3b2b9d472 (bug 1231213)
Backed out changeset 89fffd7b8740 (bug 1231213)
Backed out changeset 30b9a65a6294 (bug 1231213)
2019-08-13 21:30:20 +03:00
Perry Jiang
9163cf2417 Bug 1231213 - Update the update algorithm to better match the spec r=asuth
- Throw a TypeError when a registration isn't found in the "scope to registration map"
- Synchronously (before enqueuing a job) check for an existing newest worker
- Synchronously check if an installing worker is attempting to update itself

Differential Revision: https://phabricator.services.mozilla.com/D41618

--HG--
extra : moz-landing-system : lando
2019-08-13 04:57:36 +00:00
Narcis Beleuzu
f53affe1cb Backed out 22 changesets (bug 1231213) for build bustages on RemoteWorkerChild.cpp . CLOSED TREE
Backed out changeset 6f25a7e73fe2 (bug 1231213)
Backed out changeset 5e88c3855fb6 (bug 1231213)
Backed out changeset a78d7b3e44af (bug 1231213)
Backed out changeset eb7f3a9b0a42 (bug 1231213)
Backed out changeset 87575a180ad5 (bug 1231213)
Backed out changeset 4e8369314e87 (bug 1231213)
Backed out changeset 039c34bc043c (bug 1231213)
Backed out changeset 0528ab68d94e (bug 1231213)
Backed out changeset 670e7d61d95c (bug 1231213)
Backed out changeset d61b9d65bd0a (bug 1231213)
Backed out changeset 9042ea694d40 (bug 1231213)
Backed out changeset bc0607e0d50b (bug 1231213)
Backed out changeset 196ee18781cb (bug 1231213)
Backed out changeset 4b588dec466b (bug 1231213)
Backed out changeset be6031a6fca7 (bug 1231213)
Backed out changeset 12e04c22f52f (bug 1231213)
Backed out changeset fd146f327f2d (bug 1231213)
Backed out changeset f2af7b66f50d (bug 1231213)
Backed out changeset 71d93fc98d3f (bug 1231213)
Backed out changeset 280271806864 (bug 1231213)
Backed out changeset ca4e828345a2 (bug 1231213)
Backed out changeset e41b984510ad (bug 1231213)
2019-08-13 07:47:05 +03:00
Perry Jiang
da4c995001 Bug 1231213 - Update the update algorithm to better match the spec r=asuth
- Throw a TypeError when a registration isn't found in the "scope to registration map"
- Synchronously (before enqueuing a job) check for an existing newest worker
- Synchronously check if an installing worker is attempting to update itself

Differential Revision: https://phabricator.services.mozilla.com/D41618

--HG--
extra : moz-landing-system : lando
2019-08-13 04:04:49 +00:00
Perry Jiang
fd594632c3 Bug 1569725 - Check for active Service Worker with ServiceWorkerRegistrationDescriptor r=asuth
The previous implementation checked for a registration's active worker on the
main thread using `ServiceWorkerManager::GetRegistration`. This has two
problems:
- `ServiceWorkerManager` can't be relied upon in parent-intercept mode, and
- `SWM:GetRegistration` won't return the registration if `.unregister()` has
been called.

Differential Revision: https://phabricator.services.mozilla.com/D40104

--HG--
extra : moz-landing-system : lando
2019-08-01 17:14:53 +00:00
Perry Jiang
96edc2a092 Bug 1557244 - Disallow resurrection of unregistered ServiceWorkerRegistrations r=asuth
- Remove `ServiceWorkerRegistration`s' pending uninstall flag.

- Rename `ServiceWorkerRegistrationListener`'s `RegistrationRemoved` method to
  `RegistrationCleared`; registrations are no longer necessarily consider
  invalid when they are removed from the "scope to registration map", but rather
  when they're both removed from the map and not controlling clients (at which
  point `Clear` is called).

- Maintain the invariant that no `ServiceWorkerRegistrationInfo` in
  `ServiceWorkerManager::RegistrationDataPerPrincipal::mInfos` (i.e. the "scope
  to registration map") is in the unregistered state. Assertions check this in
  `ServiceWorkerManager::AddScopeAndRegistration` and
  `ServiceWorkerRegistrationInfo::SetUnregistered`.

- Fix some incorrect web platform tests.

Differential Revision: https://phabricator.services.mozilla.com/D38684

--HG--
extra : moz-landing-system : lando
2019-07-26 18:41:48 +00:00
Ryan Hunt
00e98538aa Bug 1523969 part 6 - Move method definition inline comments to new line in 'dom/'. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D21106

--HG--
extra : rebase_source : ea3f51c2c11247114deccbc86e90fb02b8a97257
2019-02-25 16:05:29 -06:00
Sylvestre Ledru
265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Blake Kaplan
13fc0d95f9 Bug 1510809 - Fire updatefound correctly for SWC.register r=asuth
Currently, we are required to fire updatefound in three cases:

  * When a "soft" update finds an update.
  * When a call to ServiceWorkerRegistration.update finds an update.
  * When ServiceWorkerContainer.register registers a ServiceWorker.

In the first case, there are no requirements on the timing of the event. For
the second two cases, however, the promise returned by update or register
needs to resolve before updatefound is dispatched. We hack around the first
case by explicitly counting the calls to update and only dispatching
updatefound when the final promise resolves. In the case of SWC.register, the
ServiceWorkerRegistration object might not even exist when it notices that we
need to fire updatefound, which suggests that we need some code to tell it
when to fire the event; except that in the soft update case, there is no
obvious place to do so. So, the easiest way to resolve this is to have the
parent process tell the ServiceWorkerRegistration when to fire updatefound
itself. This way, we don't rely on any tricky timing and everything is
consistent with itself.

Differential Revision: https://phabricator.services.mozilla.com/D13368

--HG--
extra : moz-landing-system : lando
2018-11-29 23:06:32 +00:00
Andrew Sutherland
812da7fa44 Bug 1472303 - Backed out changeset 8a40d04dfcbb. r=asuth
The logic here to move our check was right, but our check was wrong.
Also, we landed a test that checked for our wrong implementation.

We need to correct our implementation and re-think the test.  The
right test might just be a mochitest, possibly with some Firefox-only
hooks involved.

--HG--
extra : rebase_source : 4d6b9a120adcee835f626098e8547c440a39f595
2018-08-24 10:24:28 -04:00
Blake Kaplan
1f4f71fbc2 Bug 1472303 - Block self-update from top level scripts. r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D3221

--HG--
extra : moz-landing-system : lando
2018-08-22 20:00:19 +00:00
Blake Kaplan
4188ff378b Bug 1473074 - Don't assume these are non-null. r=asuth
I guess because, in the old world, registrations were propagated everywhere we
could end up in a state with an old ServiceWorkerRegistrationInfo while our
ServiceWorkerRegistration thought that everything was up to date. I think that
what should eventually happen will be that when we eventually get our updated
Info, we'll update the state of the ServiceWorkerRegistration accordingly and
things should work themselves out.

Differential Revision: https://phabricator.services.mozilla.com/D2077

--HG--
extra : moz-landing-system : lando
2018-07-11 21:11:01 +00:00
Ben Kelly
e486332066 Bug 1459209 P4 Scaffold RemoteServiceWorkerRegistrationImpl to connect the binding registration to the actor. r=mrbkap
--HG--
extra : rebase_source : 6e113ac5ead01a50d8dcdd5c0124c42901b84c5e
2018-07-09 16:02:39 -07:00
Ben Kelly
d2e065fc4e Bug 1472005 Don't resolve ready promise until the registration has reached the right state version. r=mrbkap 2018-07-05 13:13:48 -04:00
Ben Kelly
4405c076b5 Bug 1471929 P3 Remove the old updatefound infrastructure in favor of always updating the registration state and auto-dispatch. r=mrbkap 2018-07-05 13:13:48 -04:00
Ben Kelly
d7514a28d7 Bug 1471929 P2 Delay dispatching updatefound events until any pending update() promises resolve. r=mrbkap 2018-07-05 13:13:47 -04:00
Ben Kelly
31107e3988 Bug 1471929 P1 Automatically fire updatefound events when the ServiceWorkerRegistration gets a new installing worker. r=mrbkap 2018-07-05 13:13:47 -04:00
Ben Kelly
1ab4221865 Bug 1471912 Set ServiceWorker objects to redundant state when RegistrationRemoved() is called. r=mrbkap 2018-07-05 13:13:47 -04:00
Ben Kelly
fd8f441dbc Bug 1472008 Make ServiceWorkerRegistration.unregister() resolve false instead of rejecting for most errors. r=mrbkap 2018-06-28 14:18:00 +03:00
Ben Kelly
aa573bca77 Bug 1462772 P4 Route ServiceWorker state changes through the ServiceWorkerRegistration. r=mrbkap 2018-07-02 07:44:18 -07:00
Jeff Gilbert
5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
Ben Kelly
cf73683dcf Bug 1466681 P6 Make ServiceWorkerRegistration::Inner::Unregister() use callbacks instead of MozPromise. r=asuth 2018-06-15 12:21:33 -07:00
Ben Kelly
d9f9837869 Bug 1466681 P5 Make ServiceWorkerRegistration::Inner::Update() use callbacks instead of MozPromise. r=asuth 2018-06-15 12:21:33 -07:00
Ben Kelly
ebb0ae9748 Bug 1455695 P5 Remove unused ErrorResult argument from ServiceWorkerRegistration::Inner::Update(). r=baku 2018-04-30 07:55:02 -07:00
Ben Kelly
08c921af9d Bug 1455695 P4 Remove ServiceWorkerRegistration::Inner::GetNotifications(). r=baku 2018-04-30 07:55:01 -07:00
Ben Kelly
5ff559131c Bug 1455695 P3 Remove ServiceWorkerRegistration::Inner::ShowNotification(). r=baku 2018-04-30 07:55:01 -07:00
Ben Kelly
788509ed4f Bug 1455695 P2 Remove ServiceWorkerRegistration::Inner::GetPushManager(). r=baku 2018-04-30 07:55:01 -07:00
Ben Kelly
01ca898a1d Bug 1455695 P1 Make ServiceWorkerRegistration::Inner::Unregister() use MozPromise. r=baku 2018-04-30 07:55:01 -07:00
Ben Kelly
5da710f4ea Bug 1456466 P5 Make ServiceWorkerRegistration::Update() use DOMMozPromiseRequestHolder. r=baku 2018-04-26 13:52:30 -07:00
Ben Kelly
c4abfe7ba3 Bug 1456466 P4 Make service worker MozPromise types reject with CopyableErrorResult. r=baku 2018-04-26 13:52:30 -07:00
Ben Kelly
9368ba6249 Bug 1456466 P2 Make ServiceWorkerRegistration::Inner::Update() use MozPromise and IPC-safe types. r=baku 2018-04-26 13:52:28 -07:00
Ben Kelly
4d9ff997d3 Bug 1450274 P2 Make ServiceWorkerRegistration use DETH::KeepAliveIfHasListenersFor(). r=asuth 2018-04-10 11:00:56 -07:00
Andrea Marchesini
330807a747 Bug 1445554 - Remove the raw pointer WorkerPrivate from ServiceWorkerRegistrationImpl, r=catalinb 2018-03-15 08:57:05 +01:00
Ben Kelly
d4faed071a Bug 1438211 P6 Add an integer identifier to each ServiceWorkerRegistrationDescriptor. r=asuth
--HG--
extra : rebase_source : b61dc3d41d0ad73e5465a1f598fd09195120b9e4
2018-03-02 13:02:50 -08:00