Pier Angelo Vendrame pushed to branch tor-browser-115.28.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
6ffceaac
by Valentin Gosu at 2025-10-08T14:15:40+02:00
-
beca59e1
by Jonathan Kew at 2025-10-08T14:15:44+02:00
-
db14671a
by Christian Holler (:decoder) at 2025-10-08T14:15:45+02:00
13 changed files:
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_copy_entire_message.js
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_copy_message_with_async_stacktrace.js
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_copy_message_with_framework_stacktrace.js
- devtools/client/webconsole/test/browser/browser_webconsole_context_menu_export_console_output.js
- devtools/client/webconsole/test/browser/browser_webconsole_css_error_impacted_elements.js
- devtools/client/webconsole/test/browser/browser_webconsole_filter_by_input.js
- devtools/shared/commands/resource/tests/browser_resources_css_messages.js
- dom/tests/browser/set-samesite-cookies-and-redirect.sjs
- gfx/2d/RecordingTypes.h
- gfx/thebes/gfxFont.cpp
- gfx/thebes/gfxFontEntry.h
- modules/libpref/init/StaticPrefList.yaml
- netwerk/streamconv/converters/nsUnknownDecoder.cpp
Changes:
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | const httpServer = createTestHTTPServer();
|
| 7 | 7 | httpServer.registerPathHandler(`/`, function (request, response) {
|
| 8 | + response.setHeader("Content-Type", "text/html");
|
|
| 8 | 9 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 9 | 10 | response.write(`
|
| 10 | 11 | <meta charset=utf8>
|
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | const httpServer = createTestHTTPServer();
|
| 10 | 10 | httpServer.registerPathHandler(`/`, function (request, response) {
|
| 11 | + response.setHeader("Content-Type", "text/html");
|
|
| 11 | 12 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 12 | 13 | response.write(`<script type="text/javascript" src="test.js"></script>`);
|
| 13 | 14 | });
|
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | const httpServer = createTestHTTPServer();
|
| 7 | 7 | httpServer.registerPathHandler(`/`, function (request, response) {
|
| 8 | + response.setHeader("Content-Type", "text/html");
|
|
| 8 | 9 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 9 | 10 | response.write(`
|
| 10 | 11 | <meta charset=utf8>
|
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | const httpServer = createTestHTTPServer();
|
| 7 | 7 | httpServer.registerPathHandler(`/`, function (request, response) {
|
| 8 | 8 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 9 | + response.setHeader("Content-Type", "text/html");
|
|
| 9 | 10 | response.write(`
|
| 10 | 11 | <html>
|
| 11 | 12 | <head>
|
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | const httpServer = createTestHTTPServer();
|
| 8 | 8 | httpServer.registerPathHandler(`/`, function (request, response) {
|
| 9 | 9 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 10 | + response.setHeader("Content-Type", "text/html");
|
|
| 10 | 11 | response.write(`
|
| 11 | 12 | <html>
|
| 12 | 13 | <head>
|
| ... | ... | @@ -207,6 +207,7 @@ function createServerAndGetTestUrl() { |
| 207 | 207 | "/" + HTML_FILENAME,
|
| 208 | 208 | function (request, response) {
|
| 209 | 209 | response.setStatusLine(request.httpVersion, 200, "OK");
|
| 210 | + response.setHeader("Content-Type", "text/html");
|
|
| 210 | 211 | response.write(HTML_CONTENT);
|
| 211 | 212 | }
|
| 212 | 213 | );
|
| ... | ... | @@ -12,6 +12,7 @@ const { MESSAGE_CATEGORY } = require("resource://devtools/shared/constants.js"); |
| 12 | 12 | const httpServer = createTestHTTPServer();
|
| 13 | 13 | httpServer.registerPathHandler(`/test_css_messages.html`, (req, res) => {
|
| 14 | 14 | res.setStatusLine(req.httpVersion, 200, "OK");
|
| 15 | + res.setHeader("Content-Type", "text/html");
|
|
| 15 | 16 | res.write(`<meta charset=utf8>
|
| 16 | 17 | <style>
|
| 17 | 18 | html {
|
| ... | ... | @@ -17,6 +17,7 @@ function handleRequest(request, response) { |
| 17 | 17 | "strictHeader=true; path=/; SameSite=Strict",
|
| 18 | 18 | true
|
| 19 | 19 | );
|
| 20 | + response.setHeader("Content-Type", "text/html");
|
|
| 20 | 21 | response.write(`
|
| 21 | 22 | <head>
|
| 22 | 23 | <meta http-equiv='set-cookie' content='laxMeta=true; path=/; SameSite=Lax'>
|
| ... | ... | @@ -33,6 +34,7 @@ function handleRequest(request, response) { |
| 33 | 34 | let baseURI =
|
| 34 | 35 | "https://example.org/" +
|
| 35 | 36 | request.path.replace(/[a-z-]*\.sjs/, "mimeme.sjs?type=");
|
| 37 | + response.setHeader("Content-Type", "text/html");
|
|
| 36 | 38 | response.write(`
|
| 37 | 39 | <link rel="stylesheet" type="text/css" href="${baseURI}css">
|
| 38 | 40 | <iframe src="${baseURI}html"></iframe>
|
| ... | ... | @@ -70,9 +70,16 @@ void ReadElement(S& aStream, T& aElement) { |
| 70 | 70 | template <class S, class T>
|
| 71 | 71 | void ReadElementConstrained(S& aStream, T& aElement, const T& aMinValue,
|
| 72 | 72 | const T& aMaxValue) {
|
| 73 | - ElementStreamFormat<S, T>::Read(aStream, aElement);
|
|
| 74 | - if (aElement < aMinValue || aElement > aMaxValue) {
|
|
| 73 | + std::underlying_type_t<T> value = 0;
|
|
| 74 | + ReadElement(aStream, value);
|
|
| 75 | + |
|
| 76 | + auto minInt = static_cast<std::underlying_type_t<T>>(aMinValue);
|
|
| 77 | + auto maxInt = static_cast<std::underlying_type_t<T>>(aMaxValue);
|
|
| 78 | + |
|
| 79 | + if (value < minInt || value > maxInt) {
|
|
| 75 | 80 | aStream.SetIsBad();
|
| 81 | + } else {
|
|
| 82 | + aElement = static_cast<T>(value);
|
|
| 76 | 83 | }
|
| 77 | 84 | }
|
| 78 | 85 | template <class S, class T>
|
| ... | ... | @@ -1378,6 +1378,7 @@ void gfxFont::CheckForFeaturesInvolvingSpace() const { |
| 1378 | 1378 | flags = flags | gfxFontEntry::SpaceFeatures::HasFeatures;
|
| 1379 | 1379 | uint32_t index = static_cast<uint32_t>(s) >> 5;
|
| 1380 | 1380 | uint32_t bit = static_cast<uint32_t>(s) & 0x1f;
|
| 1381 | + MutexAutoLock lock(mFontEntry->mFeatureInfoLock);
|
|
| 1381 | 1382 | if (isDefaultFeature) {
|
| 1382 | 1383 | mFontEntry->mDefaultSubSpaceFeatures[index] |= (1 << bit);
|
| 1383 | 1384 | } else {
|
| ... | ... | @@ -1391,8 +1392,11 @@ void gfxFont::CheckForFeaturesInvolvingSpace() const { |
| 1391 | 1392 | // spaces in default features of default script?
|
| 1392 | 1393 | // ==> can't use word cache, skip GPOS analysis
|
| 1393 | 1394 | bool canUseWordCache = true;
|
| 1394 | - if (HasSubstitution(mFontEntry->mDefaultSubSpaceFeatures, Script::COMMON)) {
|
|
| 1395 | - canUseWordCache = false;
|
|
| 1395 | + {
|
|
| 1396 | + MutexAutoLock lock(mFontEntry->mFeatureInfoLock);
|
|
| 1397 | + if (HasSubstitution(mFontEntry->mDefaultSubSpaceFeatures, Script::COMMON)) {
|
|
| 1398 | + canUseWordCache = false;
|
|
| 1399 | + }
|
|
| 1396 | 1400 | }
|
| 1397 | 1401 | |
| 1398 | 1402 | // GPOS lookups - distinguish kerning from non-kerning features
|
| ... | ... | @@ -1411,6 +1415,7 @@ void gfxFont::CheckForFeaturesInvolvingSpace() const { |
| 1411 | 1415 | }
|
| 1412 | 1416 | |
| 1413 | 1417 | if (MOZ_UNLIKELY(log)) {
|
| 1418 | + MutexAutoLock lock(mFontEntry->mFeatureInfoLock);
|
|
| 1414 | 1419 | TimeDuration elapsed = TimeStamp::Now() - start;
|
| 1415 | 1420 | LOG_FONTINIT((
|
| 1416 | 1421 | "(fontinit-spacelookups) font: %s - "
|
| ... | ... | @@ -1445,6 +1450,7 @@ bool gfxFont::HasSubstitutionRulesWithSpaceLookups(Script aRunScript) const { |
| 1445 | 1450 | }
|
| 1446 | 1451 | |
| 1447 | 1452 | // default features have space lookups ==> true
|
| 1453 | + MutexAutoLock lock(mFontEntry->mFeatureInfoLock);
|
|
| 1448 | 1454 | if (HasSubstitution(mFontEntry->mDefaultSubSpaceFeatures, Script::COMMON) ||
|
| 1449 | 1455 | HasSubstitution(mFontEntry->mDefaultSubSpaceFeatures, aRunScript)) {
|
| 1450 | 1456 | return true;
|
| ... | ... | @@ -592,9 +592,10 @@ class gfxFontEntry { |
| 592 | 592 | |
| 593 | 593 | // bitvector of substitution space features per script, one each
|
| 594 | 594 | // for default and non-default features
|
| 595 | - uint32_t mDefaultSubSpaceFeatures[(int(Script::NUM_SCRIPT_CODES) + 31) / 32];
|
|
| 596 | - uint32_t
|
|
| 597 | - mNonDefaultSubSpaceFeatures[(int(Script::NUM_SCRIPT_CODES) + 31) / 32];
|
|
| 595 | + uint32_t mDefaultSubSpaceFeatures[(int(Script::NUM_SCRIPT_CODES) + 31) /
|
|
| 596 | + 32] MOZ_GUARDED_BY(mFeatureInfoLock);
|
|
| 597 | + uint32_t mNonDefaultSubSpaceFeatures[(int(Script::NUM_SCRIPT_CODES) + 31) /
|
|
| 598 | + 32] MOZ_GUARDED_BY(mFeatureInfoLock);
|
|
| 598 | 599 | |
| 599 | 600 | mozilla::Atomic<uint32_t> mUVSOffset;
|
| 600 | 601 |
| ... | ... | @@ -12833,6 +12833,14 @@ |
| 12833 | 12833 | value: true
|
| 12834 | 12834 | mirror: always
|
| 12835 | 12835 | |
| 12836 | +# If true, it will include extra tags to be sniffed by nsUnknownDecoder
|
|
| 12837 | +# These tags were previously sniffed by Firefox for legacy/webcompat but
|
|
| 12838 | +# are not part of the MIME sniffing spec.
|
|
| 12839 | +- name: network.mimesniff.extra_moz_html_tags
|
|
| 12840 | + type: RelaxedAtomicBool
|
|
| 12841 | + value: false
|
|
| 12842 | + mirror: always
|
|
| 12843 | + |
|
| 12836 | 12844 | # The maximum count that we allow socket prrocess to crash. If this count is
|
| 12837 | 12845 | # reached, we won't use networking over socket process.
|
| 12838 | 12846 | - name: network.max_socket_process_failed_count
|
| ... | ... | @@ -492,6 +492,7 @@ void nsUnknownDecoder::DetermineContentType(nsIRequest* aRequest) { |
| 492 | 492 | #endif
|
| 493 | 493 | }
|
| 494 | 494 | |
| 495 | +// https://mimesniff.spec.whatwg.org/#identifying-a-resource-with-an-unknown-mime-type
|
|
| 495 | 496 | bool nsUnknownDecoder::SniffForHTML(nsIRequest* aRequest) {
|
| 496 | 497 | MutexAutoLock lock(mMutex);
|
| 497 | 498 | |
| ... | ... | @@ -517,34 +518,44 @@ bool nsUnknownDecoder::SniffForHTML(nsIRequest* aRequest) { |
| 517 | 518 | return false;
|
| 518 | 519 | }
|
| 519 | 520 | |
| 520 | - // If we seem to be SGML or XML and we got down here, just pretend we're HTML
|
|
| 521 | - if (*str == '!' || *str == '?') {
|
|
| 522 | - mContentType = TEXT_HTML;
|
|
| 521 | + uint32_t bufSize = end - str;
|
|
| 522 | + nsDependentCSubstring substr(str, bufSize);
|
|
| 523 | + |
|
| 524 | + if (StringBeginsWith(substr, "?xml"_ns)) {
|
|
| 525 | + mContentType = TEXT_XML;
|
|
| 523 | 526 | return true;
|
| 524 | 527 | }
|
| 525 | 528 | |
| 526 | - uint32_t bufSize = end - str;
|
|
| 527 | 529 | // We use sizeof(_tagstr) below because that's the length of _tagstr
|
| 528 | 530 | // with the one char " " or ">" appended.
|
| 529 | -#define MATCHES_TAG(_tagstr) \
|
|
| 530 | - (bufSize >= sizeof(_tagstr) && \
|
|
| 531 | - (nsCRT::strncasecmp(str, _tagstr " ", sizeof(_tagstr)) == 0 || \
|
|
| 532 | - nsCRT::strncasecmp(str, _tagstr ">", sizeof(_tagstr)) == 0))
|
|
| 531 | +#define MATCHES_TAG(_tagstr) \
|
|
| 532 | + (substr.Length() >= sizeof(_tagstr) && \
|
|
| 533 | + StringBeginsWith(substr, _tagstr##_ns, \
|
|
| 534 | + nsCaseInsensitiveCStringComparator) && \
|
|
| 535 | + (substr[sizeof(_tagstr) - 1] == ' ' || substr[sizeof(_tagstr) - 1] == '>'))
|
|
| 533 | 536 | |
| 534 | - if (MATCHES_TAG("html") || MATCHES_TAG("frameset") || MATCHES_TAG("body") ||
|
|
| 537 | + if (MATCHES_TAG("!DOCTYPE HTML") || MATCHES_TAG("html") ||
|
|
| 535 | 538 | MATCHES_TAG("head") || MATCHES_TAG("script") || MATCHES_TAG("iframe") ||
|
| 536 | - MATCHES_TAG("a") || MATCHES_TAG("img") || MATCHES_TAG("table") ||
|
|
| 537 | - MATCHES_TAG("title") || MATCHES_TAG("link") || MATCHES_TAG("base") ||
|
|
| 538 | - MATCHES_TAG("style") || MATCHES_TAG("div") || MATCHES_TAG("p") ||
|
|
| 539 | - MATCHES_TAG("font") || MATCHES_TAG("applet") || MATCHES_TAG("meta") ||
|
|
| 540 | - MATCHES_TAG("center") || MATCHES_TAG("form") || MATCHES_TAG("isindex") ||
|
|
| 541 | - MATCHES_TAG("h1") || MATCHES_TAG("h2") || MATCHES_TAG("h3") ||
|
|
| 542 | - MATCHES_TAG("h4") || MATCHES_TAG("h5") || MATCHES_TAG("h6") ||
|
|
| 543 | - MATCHES_TAG("b") || MATCHES_TAG("pre")) {
|
|
| 539 | + MATCHES_TAG("h1") || MATCHES_TAG("div") || MATCHES_TAG("font") ||
|
|
| 540 | + MATCHES_TAG("table") || MATCHES_TAG("a") || MATCHES_TAG("style") ||
|
|
| 541 | + MATCHES_TAG("title") || MATCHES_TAG("b") || MATCHES_TAG("body") ||
|
|
| 542 | + MATCHES_TAG("br") || MATCHES_TAG("p") || MATCHES_TAG("!--")) {
|
|
| 544 | 543 | mContentType = TEXT_HTML;
|
| 545 | 544 | return true;
|
| 546 | 545 | }
|
| 547 | 546 | |
| 547 | + if (StaticPrefs::network_mimesniff_extra_moz_html_tags()) {
|
|
| 548 | + if (MATCHES_TAG("frameset") || MATCHES_TAG("img") || MATCHES_TAG("link") ||
|
|
| 549 | + MATCHES_TAG("base") || MATCHES_TAG("applet") || MATCHES_TAG("meta") ||
|
|
| 550 | + MATCHES_TAG("center") || MATCHES_TAG("form") ||
|
|
| 551 | + MATCHES_TAG("isindex") || MATCHES_TAG("h2") || MATCHES_TAG("h3") ||
|
|
| 552 | + MATCHES_TAG("h4") || MATCHES_TAG("h5") || MATCHES_TAG("h6") ||
|
|
| 553 | + MATCHES_TAG("pre")) {
|
|
| 554 | + mContentType = TEXT_HTML;
|
|
| 555 | + return true;
|
|
| 556 | + }
|
|
| 557 | + }
|
|
| 558 | + |
|
| 548 | 559 | #undef MATCHES_TAG
|
| 549 | 560 | |
| 550 | 561 | return false;
|