Commit graph

493 commits

Author SHA1 Message Date
Kershaw Chang
8f95e3fca6 Bug 1808323 - Add telemetry for the page load time and the time to first paint for sites that supports Early Hints response, r=manuel,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D165966
2023-05-02 08:08:44 +00:00
sunil mayya
ddaba9c7bb Bug 1823502 - do not drop auth header for HSTS and internal redirects. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D173523
2023-03-28 00:56:23 +00:00
Emilio Cobos Álvarez
91e6e4c5d4 Bug 1823686 - Share URLExtraData between SVG attribute mapping and style attribute. r=smaug
I don't think there's ever a way these should differ.

Got some include hell from removing ReferrerInfo.h from Document.h but
hopefully should be straight-forward to review.

Depends on D173154

Differential Revision: https://phabricator.services.mozilla.com/D173155
2023-03-22 14:54:43 +00:00
sunil mayya
3ae22e6d6f Bug 1817980 - replace ReferrerInfo::IsCrossOriginRequest with nsScriptSecurityManager::CheckSameOriginURI for determining cross-origin redirects. r=necko-reviewers,valentin
Since Bug 1802086, we strip authentication headers when redirected to a cross-origin page. However, the api   ReferrerInfo::IsCrossOriginRequest  used for determining whether a request is cross-origin cannot be used as it compares the triggering principal's uri with the redirected channel's uri. This comparison might sometimes yield to false positives.
For e.g consider the following scenario:
1. Load `https://example.org/` and send the following fetch request from browser console
```
fetch("https://test.com/some_location", {
  "headers": {
    "Authorization": "Token foo"
  }
});
```
2. Server responds with  a redirect to https://test.com/another_location

In the above scenario, the api ReferrerInfo::IsCrossOriginRequest  will yield the above request as cross origin since the triggering principal uri here is example.com. Hence, this will be treated as cross-origin redirect resulting in removal of auth headers.

Thus ReferrerInfo::IsCrossOriginRequest  has been replaced with nsScriptSecurityManager::CheckSameOriginURI  where we directly compare the origins for the two requests.

Differential Revision: https://phabricator.services.mozilla.com/D170868
2023-02-28 12:06:36 +00:00
Ho Cheung
68d6709804 Bug 1777218 - Remove unused XMLHTTPRequestMainThread::SetRequestObserver() r=manuel
Remove unused XMLHTTPRequestMainThread::SetRequestObserver() in code

Differential Revision: https://phabricator.services.mozilla.com/D167347
2023-01-23 12:55:30 +00:00
sunil mayya
cb305f0962 Bug 1802086 - remove auth header from redirected cross-origin requests. r=necko-reviewers,smaug,valentin
The change also updates WPT based on the discussions here https://github.com/web-platform-tests/wpt/pull/37145/files#r1042166622

Differential Revision: https://phabricator.services.mozilla.com/D163904
2023-01-17 16:13:51 +00:00
Dan Robertson
d349734f89 Bug 1771423 - Set Content-Type to an empty string for an blob with no type. r=kershaw,smaug,Gijs
Set the Content-Type to an empty string for an blob when the type was not
given. Ensure that the channel Content-Type is not overriden in the case
that it was previously set and the blob type is not valid.

Differential Revision: https://phabricator.services.mozilla.com/D147481
2022-11-14 15:26:36 +00:00
Narcis Beleuzu
533f673e9e Backed out 4 changesets (bug 1697421) for e.g. breaking Tampermonkey userscripts (bug 1798149). CLOSED TREE
Backed out changeset 0ec0d4234b77 (bug 1697421)
Backed out changeset b1c8d75d49ef (bug 1697421)
Backed out changeset ca500b60941e (bug 1697421)
Backed out changeset 5979ac92fa24 (bug 1697421)
2022-11-03 17:15:23 +02:00
sunil mayya
5bc9f5b9ac Bug 1790311 - update handling of request headers in Fetch/XHR. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D157729
2022-10-24 09:17:22 +00:00
sunil mayya
08d3766f45 Bug 1697421 - Make XMLHttpRequest/fetch to support multiple content-length and content-type headers. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D154864
2022-09-20 11:07:44 +00:00
Iulian Moraru
d8b071ca4d Backed out 3 changesets (bug 1697421) for causing mochitest failures on test_webassembly_compile.html. CLOSED TREE
Backed out changeset 65d4f5822383 (bug 1697421)
Backed out changeset cda8626f9ccc (bug 1697421)
Backed out changeset fe6151585dec (bug 1697421)
2022-09-16 01:19:21 +03:00
sunil mayya
daac079226 Bug 1697421 - Make XMLHttpRequest/fetch to support multiple content-length and content-type headers. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D154864
2022-09-15 15:19:12 +00:00
Norisz Fay
dff4f6d15e Backed out 2 changesets (bug 1771423) for causing webcompat regressions CLOSED TREE
Backed out changeset c1d1be434427 (bug 1771423)
Backed out changeset 2b7d886f374f (bug 1771423)
2022-09-13 16:26:16 +03:00
Kershaw Chang
d164608d66 Bug 1760580 - P2: Provide a reason when request is cancelled with NS_BINDING_ABORTED, r=necko-reviewers,media-playback-reviewers,valentin,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D156071
2022-09-08 09:11:19 +00:00
Olli Pettay
93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Dan Robertson
27907e8f9a Bug 1771423 - Set Content-Type to an empty string for an empty blob with no type. r=kershaw,smaug,necko-reviewers
Set the Content-Type to an empty string for an blob when the type was not
given. Ensure that the channel Content-Type is not overriden in the case
that it was previously set and the blob type is not valid.

Depends on D147568

Differential Revision: https://phabricator.services.mozilla.com/D147481
2022-08-15 13:52:12 +00:00
Nika Layzell
c15823d075 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
criss
c6b2c5db61 Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell
b3c13bf114 Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Kagami Sascha Rosylight
f08333eddf Bug 1768189 - Part 45: Apply modernize-concat-nested-namespaces to dom/xhr/XMLHttpRequest.cpp ... r=andi
Depends on D145780

Differential Revision: https://phabricator.services.mozilla.com/D145781
2022-05-09 20:41:21 +00:00
Jan Rio Krause
057785b6d5 Bug 1519200 - Remove NS_ERROR_FILE_TARGET_DOES_NOT_EXIST in favor of NS_ERROR_FILE_NOT_FOUND. r=xpcom-reviewers,nika,dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D77575
2022-04-05 15:17:03 +00:00
Randell Jesup
703bd76404 Bug 1744043: Clean up nsJAR r=nika,valentin,extension-reviewers,robwu
Differential Revision: https://phabricator.services.mozilla.com/D132794
2022-03-24 13:54:56 +00:00
Gijs Kruitbosch
0dbedb88cc Bug 1760328, r=nika,smaug
Differential Revision: https://phabricator.services.mozilla.com/D141544
2022-03-21 14:10:19 +00:00
Marian-Vasile Laza
7852c208be Backed out 2 changesets (bug 1754063, bug 1744043) for causing xpcshell failures on test_ext_clear_cached_resources.js. CLOSED TREE
Backed out changeset faf305b1b14d (bug 1754063)
Backed out changeset 24ee1c0756ae (bug 1744043)
2022-03-08 09:08:23 -08:00
Randell Jesup
da56412fd6 Bug 1744043: Clean up nsJAR r=nika,valentin
Differential Revision: https://phabricator.services.mozilla.com/D132794
2022-03-08 13:57:56 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Jens Stutte
fe88e4a9c2 Bug 1751535: Add CanSend to XHRMainThread and check it before touching our state. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136871
2022-01-26 14:40:03 +00:00
Matthew Gaudet
bc10b96605 Bug 1748888 - Add ErrorResult parameter to PromiseNativeHandler callbacks r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D136423
2022-01-20 19:11:39 +00:00
Olli Pettay
f3d8d04ae4 Bug 1723281, mark XHR load being an error load when send() fails, r=kershaw
Noticed similar issue with the blob uri, so fixed that in this patch too.
Tests are in the next patch.

InitiateFetch() call a bit later handles the marking for some other error cases.

Differential Revision: https://phabricator.services.mozilla.com/D130201
2021-11-08 18:36:45 +00:00
ssummar
0992acc367 Bug 1603127 - Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D129920
2021-11-08 08:14:00 +00:00
Cristian Tuns
71486b8924 Backed out changeset 7e8e3747c3f8 (bug 1603127) for causing toolchains build bustages (Bug 1739589). CLOSED TREE 2021-11-05 07:23:45 -04:00
ssummar
508562cc85 Bug 1603127 - Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D129920
2021-11-05 05:33:58 +00:00
ssummar
51c0ff21e5 Bug 1626517 - Replaced mozilla::Unused with mozilla::Ignore in mozilla::Decoder/mozilla::Encoder calls. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D129022
2021-10-25 12:31:41 +00:00
Jens Stutte
2c7cda331d Bug 1731564: Use motivated SpinEventLoopUntil inside dom/*. r=smaug
Depends on D126714

Differential Revision: https://phabricator.services.mozilla.com/D126957
2021-10-07 08:06:11 +00:00
Marian-Vasile Laza
18fb16c542 Backed out 18 changesets (bug 1731564) for causing build bustages on SpinEventLoopUntil. CLOSED TREE
Backed out changeset 0464dbdc8584 (bug 1731564)
Backed out changeset 0d996df13545 (bug 1731564)
Backed out changeset 5630a0e7a109 (bug 1731564)
Backed out changeset 37b41d187cdb (bug 1731564)
Backed out changeset d37700fa60b6 (bug 1731564)
Backed out changeset b0ce7db44b99 (bug 1731564)
Backed out changeset aa5ec3aa1535 (bug 1731564)
Backed out changeset 73b648f1fa70 (bug 1731564)
Backed out changeset bb8fb0f9833e (bug 1731564)
Backed out changeset 0d8905144f5d (bug 1731564)
Backed out changeset 2cfb094a1ec3 (bug 1731564)
Backed out changeset 78d3b0257a6a (bug 1731564)
Backed out changeset e9d32926e93c (bug 1731564)
Backed out changeset 874cab520ce5 (bug 1731564)
Backed out changeset d8071cc32bd9 (bug 1731564)
Backed out changeset 283c5393cbbc (bug 1731564)
Backed out changeset 317bc38e3de5 (bug 1731564)
Backed out changeset 53e3f4862439 (bug 1731564)
2021-10-07 00:09:19 +03:00
Jens Stutte
f764763e98 Bug 1731564: Use motivated SpinEventLoopUntil inside dom/*. r=smaug
Depends on D126714

Differential Revision: https://phabricator.services.mozilla.com/D126957
2021-10-06 19:45:12 +00:00
Cosmin Sabou
e2e44b6376 Backed out changeset c6819fdea3a5 (bug 1695216) for causing XMLHttpRequestWorker related crashes. CLOSED TREE 2021-09-23 20:25:21 +03:00
Nihanth Subramanya
b3c27b86d4 Bug 1695216 - XMLHttpRequest should reset response upon network errors. r=annevk,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D124989
2021-09-23 16:28:23 +00:00
Marian-Vasile Laza
6cd781871d Backed out changeset 914436169022 (bug 1695216) for causing build bustages. 2021-09-23 16:04:34 +03:00
Nihanth Subramanya
9f3565b9fb Bug 1695216 - XMLHttpRequest should reset response upon receiving a bad chunk. r=annevk,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D124989
2021-09-23 12:02:09 +00:00
Edgar Chen
e016ae9d81 Bug 1730117 - Part 1: Make sync XHR suppress event handling for the nested in-process documents; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D125187
2021-09-22 14:50:55 +00:00
Sandor Molnar
8bb72e737f Backed out 2 changesets (bug 1730117) for causing wpt failures in no_window_open_when_term_nesting_level_nonzero. CLOSED TREE
Backed out changeset bafc4ddc87f6 (bug 1730117)
Backed out changeset 27a1d92e550c (bug 1730117)
2021-09-21 18:00:06 +03:00
Edgar Chen
e0ba65d8f8 Bug 1730117 - Part 1: Make sync XHR suppress event handling for the nested in-process documents; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D125187
2021-09-21 11:39:45 +00:00
Butkovits Atila
a3bbc4c745 Backed out 2 changesets (bug 1730117) for causing failures at test_suppressed_events_nested_iframe.html. CLOSED TREE
Backed out changeset 649984f4a939 (bug 1730117)
Backed out changeset 37a35b6b54b4 (bug 1730117)
2021-09-21 00:38:17 +03:00
Edgar Chen
d10e28e072 Bug 1730117 - Part 1: Make sync XHR suppress event handling for the nested in-process documents; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D125187
2021-09-20 19:23:52 +00:00
criss
26582cd2d7 Backed out changeset 70e4ed1cfc05 (bug 1725876) for causing failures on navigating-across-documents/010.html. CLOSED TREE 2021-09-20 14:45:10 +03:00
Kershaw Chang
413d4417d9 Bug 1725876 - Make sure mFlagSyncLooping be cleared in XMLHttpRequestMainThread::OnStopRequest, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D125822
2021-09-20 10:38:06 +00:00
Kershaw Chang
690f2ebcaf Bug 1714224 - Cancel sync timeout timer after mFlagSyncLooping is set to false, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D118350
2021-06-23 21:00:06 +00:00
Landry Breuil
1a9dbc0daa Bug 1714022 - add missing ScopeExit header r=edgar
Fixes build failure on Tier3:
src/m-c/dom/xhr/XMLHttpRequestMainThread.cpp:3050:22: error: use of undeclared identifier 'MakeScopeExit'
 auto scopeExit = MakeScopeExit([&] {
regressed by bug 1712930

Differential Revision: https://phabricator.services.mozilla.com/D116560
2021-06-02 07:46:55 +00:00
Edgar Chen
c80e2f09d3 Bug 1712930 - Part 7: Get rid of NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED; r=smaug,perftest-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D116081
2021-06-01 13:10:48 +00:00