Commit Graph

511 Commits

Author SHA1 Message Date
Thomas Wisniewski
489aea0550 Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 23:41:24 +00:00
Narcis Beleuzu
701fed4368 Backed out changeset f96e24bbd71c (bug 1845006) for bustages on nsDataHandler.cpp 2023-08-02 22:39:40 +03:00
Thomas Wisniewski
453464c0ca Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 16:33:41 +00:00
Cristina Horotan
8c78774d7d Backed out changeset 8d98996f824c (bug 1845006) for causing build bustage at FetchDriver.cpp CLOSED TREE 2023-08-02 17:22:58 +03:00
Thomas Wisniewski
4faa886152 Bug 1845006 - store the fully-serialized MimeType on data url channels so XHR and fetch may use it for content-type response headers, and clean up the data url parsing code to better match the spec. r=kershaw,sunil,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D184713
2023-08-02 13:39:48 +00:00
Thomas Wisniewski
1ffb72e885 Bug 1784880 - Support range requests on blob URLs in fetch/XMLHttpRequest; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D184281
2023-08-01 18:50:37 +00:00
Cristian Tuns
8acd1060a3 Backed out changeset 384e4f88f047 (bug 1784880) for causing wpt failures in parsedepth.html CLOSED TREE 2023-08-01 05:41:04 -04:00
Thomas Wisniewski
21f4de34c5 Bug 1784880 - Support range requests on blob URLs in fetch/XMLHttpRequest; r=dlrobertson,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D184281
2023-08-01 02:48:47 +00:00
Logan Rosen
37080886fa Bug 1843815 - Improve link for sync XHR warning. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D183699
2023-07-26 09:18:01 +00:00
Thomas Wisniewski
0412a44244 Bug 1695216 - Follow the XMLHttpRequest spec more closely for network and other errors; r=kershaw,sunil
- clear the response on network failure (bad chunks, etc).
- throw the expected error for abort/timeout/error for sync XHR failures.

Differential Revision: https://phabricator.services.mozilla.com/D183782
2023-07-21 02:41:22 +00:00
Thomas Wisniewski
55a011c8ab Bug 1576602 - fetch response body should be empty for HEAD/CONNECT requests, per spec; r=kershaw,sunil
Differential Revision: https://phabricator.services.mozilla.com/D183434
2023-07-19 02:44:01 +00:00
Gregory Pappas
5d4acf4d8f Bug 1842468 - Remove dom.xhr.standard_content_type_normalization pref r=dom-core,edgar
Differential Revision: https://phabricator.services.mozilla.com/D183798
2023-07-18 16:11:35 +00:00
André Bargull
0326e13101 Bug 1841314 - Part 6: Add marker to NewArrayBufferWithContents. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D182644
2023-07-06 20:51:00 +00:00
Sandor Molnar
8f7bcab6f5 Backed out 7 changesets (bug 1841314) for causing hazard failures. CLOSED TREE
Backed out changeset 82a53d6ea95a (bug 1841314)
Backed out changeset 524607b471a2 (bug 1841314)
Backed out changeset ce128e10bddb (bug 1841314)
Backed out changeset cdae4fbbdaff (bug 1841314)
Backed out changeset f1035b6c08fe (bug 1841314)
Backed out changeset 5897ad8ef181 (bug 1841314)
Backed out changeset 09618a767080 (bug 1841314)
2023-07-06 16:59:47 +03:00
André Bargull
922836287d Bug 1841314 - Part 6: Add marker to NewArrayBufferWithContents. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D182644
2023-07-06 12:26:54 +00:00
Cristina Horotan
8f230bf05e Backed out 7 changesets (bug 1841314) for causing hazard failures at js.cpp CLOSED TREE
Backed out changeset becc2fa2c186 (bug 1841314)
Backed out changeset e5b723317177 (bug 1841314)
Backed out changeset 61ae850b25e5 (bug 1841314)
Backed out changeset 9ff320c779b8 (bug 1841314)
Backed out changeset debf1172f794 (bug 1841314)
Backed out changeset 8ac4fa317006 (bug 1841314)
Backed out changeset eccacbb3b620 (bug 1841314)
2023-07-06 15:11:47 +03:00
André Bargull
f5c5fc31e1 Bug 1841314 - Part 6: Add marker to NewArrayBufferWithContents. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D182644
2023-07-06 11:41:18 +00:00
dylan
0e594e415f Bug 1811837 - removed instances of mInLoadProgressEvent r=manuel
Differential Revision: https://phabricator.services.mozilla.com/D177403
2023-05-09 07:40:26 +00:00
Kershaw Chang
f446ba9e37 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
231604e35b 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
8dabbf6590 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
6160bd9c95 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
bc7fd13e94 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
c188fc8ec6 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
09dd7e4a03 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
36751ba263 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
a592f5e8c6 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
50819075d1 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
960f060852 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
a373a42921 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
3a7109d26f 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
bd7389a309 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
048bd344c4 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
cdd3c2a693 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
63a28ee824 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
c1b045ddda 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
c1e4a1e52c 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
a0df3062ce 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
3fe00f5de7 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
902e82c0b6 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
da9ca2f9c6 Bug 1760328, r=nika,smaug
Differential Revision: https://phabricator.services.mozilla.com/D141544
2022-03-21 14:10:19 +00:00
Marian-Vasile Laza
11a28c9714 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
d113688326 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
35a175aa33 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
4808ccda70 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
108063d593 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
29fa6bf125 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
43e270e58d 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
3b4f87f69c Backed out changeset 7e8e3747c3f8 (bug 1603127) for causing toolchains build bustages (Bug 1739589). CLOSED TREE 2021-11-05 07:23:45 -04:00
ssummar
f2f04d2ae8 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