Compare commits

...
Author SHA1 Message Date
Moonchild 6b18be917d [js] Avoid OOB array copy. 2026-10-26 10:17:14 +01:00
Moonchild 037cc5f614 [NSS] Remove emSign roots (eMudhra compromise)
This brings our certdata in line with NSS 3.131.1
2026-10-24 14:17:27 +02:00
Moonchild 4a68bbbd53 [NSS] Update certdata to Sept 2026 status. 2026-10-24 14:17:13 +02:00
Moonchild 5762097bc2 Update SQLite lib to 3.54.1 2026-10-24 14:16:54 +02:00
Moonchild e86caa48f5 [XPCOM] Lock during nsComponentManager memory reports 2026-10-24 14:15:59 +02:00
Moonchild 612a8991df Update executable extensions list 2026-10-24 14:15:54 +02:00
Moonchild 5c991eadc0 Clarify lowercase policy in extension list for possible future maintainers of the list.
This is added in light of common mixed-case spelling for some contemporary
file extensions. Withough explicitly mentioning the casing policy this could lead
to errors if new extensions get added by maintainers.
2026-10-24 14:15:49 +02:00
Moonchild 38e09d2368 Update executable extensions list 2026-10-24 14:15:43 +02:00
Moonchild 8fea2ad823 [layout] Ensure frame table is valid after adjusting selection. 2026-10-24 14:15:37 +02:00
Moonchild c4339b14dc Use strong ref for animation mutation observer batch targets.
We can control the scope of AnimationMutationBatch for each animation
function. However, this is tedious and prone to being overlooked, so we
use nsCOMPtr to hold the targets instead.

This is a devtool feature (ChromeOnly) so it shouldn't have much impact
on the performance for the common use case.
2026-10-24 14:15:31 +02:00
Moonchild bae7a6ec8f [gfx] Prevent feTile rect calculations from overflowing 2026-10-24 14:15:25 +02:00
Moonchild d42616bb12 Remove the URI_LOADABLE_BY_ANYONE flag from the jar: protocol. 2026-10-24 14:15:04 +02:00
Moonchild 5f290d1097 Disable :has() pseudo on release by default
Since we don't have a solution for the performance issues for this yet,
and the perf issues are a serious QoL problem for all users on many sites.
2026-10-04 02:23:25 +02:00
Moonchild a0b10f4375 Issue #3197 - Make strict subtree form element checking preffed.
Resolves #3197
2026-10-03 21:22:00 +02:00
Moonchild 1d7ba07673 Issue #3196 - Handle BigInt objects in js::Unbox()
Resolves #3196
2026-10-03 21:21:53 +02:00
Moonchild f51bc72a14 [DOM] Don't leak elements with animated classes. 2026-10-03 21:21:46 +02:00
Moonchild e8644b494f [network] Prevent NTLM login attempt with empty credentials. 2026-10-03 21:21:38 +02:00
Andrew McCreight 0acf5cb1a1 Bug 2068346 - Unwrap a copy in GetJSValFromKeyPathString. 2026-10-03 21:21:31 +02:00
Moonchild f2d027343a Backport an upstream libvpx VP8 fix 2026-10-03 21:21:26 +02:00
Moonchild eaf2a4ac4b Minor formatting cleanup. 2026-10-03 21:21:16 +02:00
Moonchild aa6a599aa4 [network] Modernize MIME header parsing module.
- Use nsCStrings instead of char*
- More thorough checking for NUL characters
- Use the more modern utility includes
2026-10-03 21:21:05 +02:00
Moonchild f385a5e06c No issue - Add sanity check to JSScript::traceChildren
This verifies if objects to be traced are still valid, to prevent
GC barriers on dead/released objects. This should avoid some crashes.
2026-10-03 21:20:50 +02:00
Moonchild 559e0dbdc5 Issue #3192 - Add null check on group_ for isSingleton()
The value being monitored is a valid object, but its associated
ObjectGroup might have become invalid.

Resolves #3192
2026-10-03 21:20:42 +02:00
Moonchild e59e88bfd5 [DOM] Fix XSLT children processing.
This was an off-by-1 placement resulting in XSLT children processing
not working.
2026-09-21 11:26:39 +02:00
Moonchild 7e3d96909f [js] Fix issues in WeakRef deref() leading to crashes.
On rare occasions, reloading busy sites with WeakRef API usage would cause
CTDs. Digging into this it seems because of early teardown and/or dangling
pointers on WeakRef objects, causing `deref()` to crash.

This adds some null checks and avoids barriers on potentially invalid
WeakRef objects in the `deref()` implementation.
2026-09-19 14:51:09 +02:00
Maurice Dauer d294c31da1 Bug 2058069 - Compare formats before adopting a managed surface in Image9. 2026-09-19 14:51:02 +02:00
Jan-Niklas Jaeschke d699633e82 Bug 2058417 - Use the normalized format consistently in DataTransfer::SetDataAtInternal. 2026-09-19 14:50:55 +02:00
Moonchild 7079db6476 [embedding] Fix ChromeTooltipListener. 2026-09-19 14:50:48 +02:00
Moonchild e938cb015b [widget] Hold a reference to nsDataObj in callbacks.
As the comment in `WaitForCompletion` explains, it does a SpinEventLoopUntil
as part of CStream callbacks, and the CStream can be unregistered during that,
which is fine, but we need to hold a strong reference first since we use
the object afterward.  The reference in `WaitForCompletion` is technically
redundant but makes future uses safer and admits a comment that future clients
may actually heed.

This also adds an unrelated missing null check while we're here.
2026-09-19 14:50:42 +02:00
Moonchild 15893d9ebc [DOM] Bail on unexpected structural errors. 2026-09-19 14:50:35 +02:00
Moonchild 0f45bf39af [network] NTLM should always prompt for credentials if the host is not in trusted-uris. 2026-09-19 14:50:29 +02:00
Moonchild 23398d176b [a11y] Uncache subtree of hidden accessible when it is coalesced. 2026-09-19 14:50:23 +02:00
Basilisk-Dev 7809ecf653 Issue #3176 - Fix excessive :has() restyles when typing
Avoid restyling entire parent subtrees for changes that only affect a
child or sibling selector. Skip unrelated class changes, cache selector
dependencies, and avoid searching sibling subtrees that cannot match.

This improves typing performance on Gitea.
2026-09-19 14:49:44 +02:00
Basilisk-Dev 43d19989d4 No Issue - Fix out-of-range float to int32 conversions
Check the range before casting to int32_t. The old code had undefined
behavior that caused incorrect JavaScript numbers on LoongArch and broke
Anubis challenges.
2026-09-19 14:49:37 +02:00
Moonchild 81fce269f5 Revert "Issue #3176 - Pref off :has() by default on release"
This reverts commit aa066876a0.
2026-09-12 15:38:01 +02:00
Basilisk-Dev 03bdba053e Issue #3176 - Avoid :has() restyles for unrelated attribute changes
Track attribute names and class tokens used by relative selectors. Check classes before and after attribute updates so removing a watched class still invalidates its anchors, while unrelated changes avoid broad subtree restyles.

Preserve conservative handling of implicit pseudo-class attribute dependencies and explicit attribute selectors. Validated with a full build, runtime restyle counts, and 22 correctness checks.
2026-09-12 15:37:42 +02:00
Basilisk-Dev 5088774087 Issue #3176 - Reduce :has() restyle and selector matching overhead
Track state dependencies inside relative selectors to avoid restyling for unrelated state changes. Restrict parent dependency markers to sibling selectors while preserving outer sibling invalidation, and limit simple child and sibling searches to their candidate elements.
2026-09-12 15:37:24 +02:00
Andy c4d42aaeff Drop Dangling Plus Sign from 4c097ec9 2026-09-11 08:19:20 +02:00
Andy 5b5d7841a6 Remove Georgian Special Casing Skip
Cherry-Picked from BZ 1716482 and BZ 2000225 part 12.
2026-09-11 08:19:11 +02:00
Andy b5e48c5458 Include Cleanup
Cherry-picked from BZ 1999722.
2026-09-11 08:19:05 +02:00
Andy 714c06d255 Update ICU Build Flags
Skip BREAK_ITERATION and MF2.
MF2 Cherry-picked from BZ 1927706 Part 3.
2026-09-11 08:19:00 +02:00
Andy 42c59e0781 Update Likely Subtags for UTS 35
Cherry-picked from BZ 1927706 Part 6.
2026-09-11 08:18:55 +02:00
Andy a877a69089 Add RW fallback for non Gnu-C Compilers or Solaris 2026-09-11 08:18:47 +02:00
Andy 98a7463135 Move ICU Data to ReadOnly Section
This is adapted from BZ 1970788 (for Windows) and... some prior bug for Lin/Mac.
2026-09-11 08:18:41 +02:00
Basilisk-Dev 6cdcc60623 Improve typing performance on complex pages
Avoid redundant line lookups and preserve cached inline background state while painting fragmented inline content. This prevents per-keystroke repaint work from growing badly on long pages.

Ported from aab43246c5 (Mozilla bug 1539366).
2026-09-11 08:17:27 +02:00
Amelia Hart c4e2909bdc Remove obsoleted NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED 2026-09-11 08:17:10 +02:00
Amelia Hart 8f1b4387b4 Prevent potential leak of IndexedDB mDatabaseActor 2026-09-11 08:17:03 +02:00
Amelia Hart a7bc4e7c97 Prevent Fetch Request/Response from leaking mSignal 2026-09-11 08:16:56 +02:00
Amelia Hart 62e29a58b0 Make cycle collector aware of Timeout's mTimer. 2026-09-11 08:16:50 +02:00
Amelia Hart 3ede95de79 Implement cycle collection support for the Visual Viewport API 2026-09-11 08:16:44 +02:00
Amelia Hart fce465d3a6 Avoid triggering read barrier in DumpHeap and when collecting stats 2026-09-11 08:16:38 +02:00
Amelia Hart 71edc1fbf5 Assert GCRuntime::enter/leaveUnsafe region is main-thread only 2026-09-11 08:16:25 +02:00
Amelia Hart 53e4ec00ef Allow incremental GC when keepAtoms is set
This is a port of BZ 1213977 that should improve performance when parsing
large web-sites by reducing the amount of non-incremental (large) GCing.
2026-09-11 08:16:19 +02:00
Moonchild aa066876a0 Issue #3176 - Pref off :has() by default on release 2026-09-11 08:14:52 +02:00
Moonchild ae54d6c3d2 Issue #2473 - Follow-up: Pref the :has() selector. 2026-09-11 08:13:29 +02:00
Moonchild f69237e99c Merge branch 'master' into release 2026-09-03 15:26:51 +02:00
Moonchild a8fdbd677e [editor] Hold a strong ref. 2026-09-03 11:12:41 +02:00
Moonchild 5316be7d85 [DOM] Hold a strong ref to the composed document in nsFocusManager. 2026-09-02 19:37:51 +02:00
Moonchild ea9d3699b0 [network] Reject NUL bytes in chunked trailer and chunk-size lines.
Compliance with RFC 9110 section 5.5 - NUL is illegal in a chunk-size or
trailer field line.
2026-09-02 13:29:36 +02:00
Moonchild d0c059a3fd [widget] Only resolve non-filesystem picker results as shell libraries.
A genuine shell library is a virtual item with no filesystem path.  A
.library-ms file is an ordinary file whose XML can name any local directory.

filedialog::GetFolderResults was passing whatever IFileDialog::GetResult
returned to IShellLibrary::LoadLibraryFromItem and, on success, replacing it
with the library's embedded default save folder.

Gating the resolution on the item being affirmatively not a filesystem object
keeps real libraries selectable and resolving as before, while a .library-ms
file "resolves" to itself -- the .library-ms file, not its target.
2026-09-02 12:04:07 +02:00
Moonchild 3a285b8da5 Issue #3172 - Correct the issue reference in code.
See commit 0f0cbed455 for the code changes.
2026-09-02 11:03:37 +02:00
Moonchild d823df1bbb [DOM media] Reset CORS mode as-appropriate. 2026-09-02 00:35:43 +02:00
Moonchild a45c04623e Merge branch 'master' into release
# Conflicts:
#	devtools/client/jsonview/converter-child.js
#	js/src/jsprf.cpp
#	security/nss/coreconf/coreconf.dep
#	security/nss/lib/nss/nss.h
#	security/nss/lib/softoken/softkver.h
#	security/nss/lib/util/nssutil.h
2026-09-01 16:46:52 +02:00
Moonchild 0f0cbed455 Issue #3050 - Reduce parsing contention by limiting JS parser threads to 2. 2026-09-01 16:21:58 +02:00
Moonchild a7a133659a [widget] Set file picker default response to cancel.
While this apparently doesn't work in all flavors of GTK+, it's beneficial
if it does work, so it can't hurt to attempt, just to try and do what
we can about some wetware failure cases.
2026-09-01 16:18:26 +02:00
Moonchild 3a5a5501b9 Merge branch 'nss-3.126-port' 2026-08-27 13:55:59 +02:00
Moonchild 6b6b1828b9 NSS version bump to 3.90.14.0 (UXP) 2026-08-27 13:55:37 +02:00
John Schanck c42c56f40e Bug 2027388 - add defensive check on pk11_HandUnwrap key size. 2026-08-27 13:53:08 +02:00
Moonchild bada47c3e0 Bug 2029794 - handle NSSCertificate identity changing in __CERT_AddTempCertToPerm 2026-08-27 13:47:05 +02:00
Benjamin Beurdouche 896bdd4e87 Bug 2029750 - Reject undersized IV and key SECItems in PBES2 cipher dispatchers. 2026-08-27 12:43:11 +02:00
Benjamin Beurdouche 5faff628ca Bug 2029289 - fix off-by-one offset in pk11_buildNickname cert_id branch. 2026-08-27 12:37:01 +02:00
Moonchild 331f1d1716 Bug 2027380 - pass offset-adjusted pointer to SEC_ASN1GetSubtemplate in QuickDER call sites. 2026-08-27 09:40:51 +02:00
Moonchild 4c19b0c79b [DOM] Clear mDocumentChildren after XSLT branch consumes it in DidBuildModel. 2026-08-26 23:02:13 +02:00
Moonchild bb777d838d [DOM] Remove content from parent node before appending.
SetDocElement needs to do the same.
2026-08-26 22:57:42 +02:00
Moonchild cfd6c45250 [DOM] Remove content from parent node before appending. 2026-08-26 18:52:13 +02:00
Moonchild 04cc0dbd19 No issue - remove duplicate HTMLWin32ObjectAccessible from build.
This removes the make warnings when building. We shouldn't need this if
the plugin system is disabled.
Verified this builds correctly when NPAPI is disabled in mozconfig.
2026-08-26 15:18:00 +02:00
Olli Pettay 8e1b937e5f Bug 2058622 - Validate selected options entries. 2026-08-26 12:03:27 +02:00
Moonchild 51e966f1c1 [parser] Only check for high surrogates when intending to avoid split pair. 2026-08-26 10:45:06 +02:00
Moonchild f69570b516 [gfx] Skia: Port grey mode pixelspace fix. 2026-08-25 20:54:32 +02:00
Moonchild fb39488301 Merge pull request 'Resolve various assertions in debug builds' (#3171) from Jazzzny/UXP:assertions into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/3171
2026-08-25 14:27:53 +00:00
Moonchild 5a3c14e2d3 [DOM] Improve MediaInfo/Data a little.
Only use ImageRect if explicitly set.
Reset the picture region when the decoder adopts a new image size from the stream.
Constrain the picture rectangle to the image buffer when building a video frame.
2026-08-24 15:02:06 +02:00
Moonchild a203222136 Merge pull request 'Prevent recursion of callbacks in PressShell.' (#3169) from restyle-recursion-fix into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/3169
2026-08-24 01:51:42 +00:00
Moonchild f77b3dad07 Merge pull request 'Improve LoongArch64 Ion JIT and add SIMD groundwork' (#3170) from Basilisk-Dev/UXP-contrib:loongarch-jit-simd into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/3170
2026-08-23 22:28:46 +00:00
Jazzzny 7d622afa70 Resolve various assertions in debug builds 2026-08-22 13:32:31 -04:00
Moonchild c22826727d [image] Simplify and further improve handling of destroying raster images.
Follow-up to [1842de878f]
2026-08-22 12:23:46 +02:00
Moonchild 8beee33f4c Bug 2057204 - use the right AddSystemEventListener variant with nsFileControlFrame::mMouseListener 2026-08-22 11:32:02 +02:00
Basilisk-Dev 0f0aeca2d5 Issue #3049 - Pass LoongArch64 SIMD args in vector registers 2026-08-21 22:41:08 -04:00
Basilisk-Dev 7e68ab76c8 Issue #3049 - Enable LoongArch64 SIMD codegen support 2026-08-21 22:41:08 -04:00
Basilisk-Dev 3984aba71e Issue #3049 - Add LoongArch64 LSX float vector helpers 2026-08-21 22:41:08 -04:00
Basilisk-Dev 81b9be16b3 Issue #3049 - Add LoongArch64 LSX compare and shift helpers 2026-08-21 22:41:08 -04:00
Basilisk-Dev cc636f5606 Issue #3049 - Add LoongArch64 LSX lane helpers 2026-08-21 22:41:08 -04:00
Basilisk-Dev 67716d3e77 Issue #3049 - Add LoongArch64 LSX arithmetic helpers 2026-08-21 22:41:08 -04:00
Basilisk-Dev 47671c9622 Issue #3049 - Add LoongArch64 SIMD constant loads 2026-08-21 22:41:07 -04:00
Basilisk-Dev 5f19acf3dc Issue #3049 - Track LoongArch64 SIMD return registers 2026-08-21 22:41:07 -04:00
Basilisk-Dev 271789ceff Issue #3049 - Handle LoongArch64 SIMD moves 2026-08-21 22:41:07 -04:00
Basilisk-Dev 124c914f35 Issue #3049 - Add LoongArch64 LSX vector move helpers 2026-08-21 22:41:07 -04:00
Basilisk-Dev 8499ba651d Issue #3049 - Add LoongArch64 LSX vector load stores 2026-08-21 22:41:07 -04:00
Basilisk-Dev 4a825adf7d Issue #3049 - Account for LoongArch64 SIMD FP aliases 2026-08-21 22:41:07 -04:00
Basilisk-Dev e6ff828ac7 Issue #3049 - Represent LoongArch64 SIMD register aliases 2026-08-21 22:41:07 -04:00
Basilisk-Dev 90031251c1 Issue #3049 - Make LoongArch64 FP saves SIMD-ready 2026-08-21 22:41:07 -04:00
Basilisk-Dev 059e6407d3 Issue #3049 - Prepare LoongArch64 ABI for SIMD arguments 2026-08-21 22:41:06 -04:00
Basilisk-Dev 46d37a2d26 Issue #3049 - Honor LoongArch64 FP ABI register fallback 2026-08-21 22:41:06 -04:00
Basilisk-Dev 3b5f764740 Issue #3049 - Improve LoongArch64 branch and trap handling 2026-08-21 18:07:08 -04:00
Basilisk-Dev 934d61ba05 Issue #3049 - Handle LoongArch64 subtract overflow edge case 2026-08-21 17:49:20 -04:00
Basilisk-Dev d609be5e04 Issue #3049 - Implement LoongArch64 int64 high-word wrapping 2026-08-21 17:48:07 -04:00
Moonchild 8e2a07c696 Revert "[parser] Restrict subtree root check to DOM image elements only."
As it turns out, the reported regression was actually noncompliant HTML
and the initial implementation was correct.

This reverts commit 9aa9d182c7.
2026-08-11 17:38:31 +02:00
Moonchild 9aa9d182c7 [parser] Restrict subtree root check to DOM image elements only.
This was too broadly applied, resulting in named form elements not being
accessible through the DOM tree if not in the same subtree root.
2026-08-11 07:43:56 +02:00
Moonchild b4bb6051e9 Revert "Bug 2033848 - Use non-default response ID for GTK file picker accept button. r=stransky"
This reverts commit 789e976ace.
2026-08-11 07:37:29 +02:00
Moonchild 53bf5b5a21 Bump NSS (UXP) patch level. 2026-07-28 15:51:54 +02:00
John Schanck 07b2881965 Bug 2043887 - guard against integer overflow in CERT_Hexify. 2026-07-28 15:51:45 +02:00
Benjamin Beurdouche ca1b7c2595 Bug 2027353 - clamp input.len to testString size in pk11_mergeSecretKey. 2026-07-28 15:51:41 +02:00
Benjamin Beurdouche a0d8eeb768 Bug 2029433 - Bounds-check wrap index in PK11_GetWrapKey to match PK11_SetWrapKey. 2026-07-28 15:51:34 +02:00
Anna Weine 278ce9a272 Bug 2028954 - CERT_DecodeAVAValue — Integer Overflow in Output Buffer Sizing. 2026-07-28 15:51:29 +02:00
Moonchild 9367b64f2a Bug 2027364 - Set tail pointer to null in static slot lists when deallocating. 2026-07-28 15:51:24 +02:00
John Schanck 080247cf2f Bug 2032110 - fix two integer overflows on LLP64 systems. 2026-07-28 15:51:19 +02:00
John Schanck 95bf9478c7 Bug 2030102 - avoid leaving a dangling ss->sec.ci.sid on allocation failure. 2026-07-28 15:51:13 +02:00
Maurice Dauer 4ae3149d2e Bug 2027325 - Reject empty nickname in PK11_TraverseCertsForNicknameInSlot. 2026-07-28 15:51:08 +02:00
Moonchild 9bf01636f1 Bug 2030563 - Validate CKA_CERTIFICATE_TYPE ulValueLen in nss_cert_type_from_ck_attrib. 2026-07-28 15:51:03 +02:00
Benjamin Beurdouche e48fe8e307 Bug 2029807 - Guard padding read against empty output in SEC_PKCS7DecryptContents. 2026-07-28 15:50:56 +02:00
Benjamin Beurdouche 27c12ad698 Bug 2027346 - validate encoded EC params length and tag in SECKEY_ECParamsToKeySize/BasePointOrderLen. 2026-07-28 15:50:51 +02:00
Benjamin Beurdouche 612ddb64e5 Bug 2027371 - rewrite labelLen bound in tls13_HkdfExpandLabelGeneral to avoid unsigned overflow. 2026-07-28 15:50:46 +02:00
Benjamin Beurdouche c6c8421a2a Bug 2027373 - guard space subtraction in ssl_CallCustomExtensionSenders. 2026-07-28 15:50:41 +02:00
Benjamin Beurdouche f9859d226c Bug 2029901 - Guard against keySize overflow in IKE PRF/PRF+ output sizing. 2026-07-28 15:50:36 +02:00
Benjamin Beurdouche 7c0e60c4f1 Bug 2027362 - bound usageCount in PK11_UnwrapPrivKey to keyTemplate capacity. 2026-07-28 15:50:27 +02:00
Benjamin Beurdouche e06ef010c4 Bug 2027349 - reject empty nickname in PK11_TraverseCertsForNicknameInSlot. 2026-07-28 15:50:20 +02:00
Moonchild 3935cd9ed3 [network] Fix CacheEntry::mDoomCallback data race. 2026-07-28 15:49:52 +02:00
Moonchild f781824676 [layout] Fix nsFrameSetFrame primary frame handling of replicated children. 2026-07-28 15:49:40 +02:00
Moonchild 5a231d5bf9 [DOM media] Perform more thorough checks on video regions. 2026-07-28 15:49:19 +02:00
az 02302031dd Bug 2045742 2026-07-28 15:49:11 +02:00
Andrew McCreight b59b350424 Bug 2049523 - Make ToJSValue for float consistent with double. 2026-07-28 15:48:56 +02:00
Moonchild 99b8669d0a Fix comment (nit) 2026-07-28 15:48:49 +02:00
Randell Jesup 919fbff2ec Bug 2029734: Flush before calling sctp_process_init() 2026-07-28 15:48:10 +02:00
Moonchild 4977713834 [image] Make sure the image was fully and cleanly decoded before finalizing its animation state as complete. 2026-07-28 15:48:01 +02:00
Moonchild 1f8bd8cf45 [parser] Associate image elements with form only if the form and the intended parent are in the same tree. 2026-07-28 15:47:55 +02:00
Moonchild 8f6bacf33e [DOM media] Stop accepting audio samples with too low sample rates.
This sets the floor to 8kHz audio, which is generally considered to be
the lowest acceptable "phone quality"/"walkie-talkie" audio rate.
Audio outside the range will refuse to decode after this commit and give
a console error.
This avoids a whole class of potential bugs.
2026-07-28 15:47:27 +02:00
Moonchild a79a1b55a1 [layout] Add corner-case correctness check in DottedCornerFinder::FindBestOverlap. 2026-07-28 15:47:21 +02:00
Moonchild fa4d389b91 [network] Add usrsctp TSN gap check. 2026-07-28 15:47:08 +02:00
Moonchild 36b884ff7f [js] Clamp length of regexp captures array for dollar substitution. 2026-07-28 15:46:52 +02:00
Moonchild f3a7e60608 [js] Initialize BaselineFrame return value slot in OnLeaveBaselineFrame. 2026-07-28 15:46:45 +02:00
Moonchild a8405c5667 [DOM] Make parser update form owner properly 2026-07-28 15:46:39 +02:00
Moonchild 829354fb65 [gfx] Hold a strong ref during GetFontAt lookup. 2026-07-28 15:46:33 +02:00
Moonchild 4be7883908 [gfx] Add bounds checks and limit reverse scanning of ligature data. 2026-07-28 15:46:27 +02:00
Moonchild 2f77b246b3 No issue - Use strnlen instead of strnlen_s.
Apparently, GCC doesn't like the _s variants.
2026-07-28 15:46:08 +02:00
Moonchild ddf950f5ed [js] Guard against OOB string sizes in internal Printf 2026-07-28 15:45:28 +02:00
Basilisk-Dev ad98fe5130 Issue #3140 - implement URL.parse() 2026-07-14 23:08:55 +02:00
Moonchild 659c690d5b Issue #3129 - Add palette_neon_intrinsics.c to moz.build 2026-06-23 08:11:16 +02:00
Moonchild f1dc542b0b Issue #3122 - Put base paths in the json viewer client deps.
The dependency modules are requested early. Seems CSP can block baseURL
on these networking requests, so add the base manually to the resource
paths to prevent network requests before the html base element is
resolved and active.
2026-06-22 18:54:00 +02:00
Moonchild 0c5437c80b Apply (hopefully for the last time before 2.0.x) APNG support code.
This commit also removes MOZCHANGES (old and irrelevant information)
This commit also adds a new readme.
2026-06-21 14:23:55 +02:00
Moonchild db9881b854 Fresh import of libpng 1.6.58 2026-06-21 14:23:47 +02:00
Moonchild c5a37cad2e Bump NSS version for adopted changes. 2026-06-21 14:23:40 +02:00
Moonchild dd97244289 [DOM] Clean up WebGL transform feedback validation. 2026-06-21 14:23:07 +02:00
John Schanck 5372fed15c Bug 2030564 - add defensive input validation to sftk_compute_ANSI_X9_63_kdf. 2026-06-21 14:22:56 +02:00
John Schanck 37a8909357 Bug 2030366 - avoid race with module unloading in NSSTrustDomain_FindTokensByURI. 2026-06-21 14:22:48 +02:00
John Schanck 18f4069d8d Bug 2029403 - avoid PORT_Strdup in ssl_DecodeResumptionToken. 2026-06-21 14:22:27 +02:00
Julian Descottes 78c01f1b3f [devtools] Consistently show filepicker on first save action from StyleEditor.
Bug 2038133
2026-06-21 14:22:18 +02:00
Moonchild f946c969a2 Issue #3127 - Add trademark notice to the tree.
Resolves #3127
2026-06-21 14:22:11 +02:00
Moonchild 2dfa2b7c19 [network] Make HttpBaseChannel::mLoadFlags atomic. 2026-06-21 14:21:44 +02:00
Moonchild 8b88dd736a [gfx] Check more offsets during CFF subsetting.
Also fixes a bunch of whitespace (TAB -> spaces)
2026-06-21 14:21:33 +02:00
Moonchild b9fd964fec [DOM] Avoid over-optimizing some getter/function calls. 2026-06-21 14:21:25 +02:00
Moonchild 9c74a819e4 [parser] Better align with spec definition of adding nodes. 2026-06-21 14:21:18 +02:00
Moonchild f700453cb1 No issue - Use ImmGCPtr for module meta data visits.
This should make module GCs less touchy.
2026-06-21 14:20:42 +02:00
Moonchild 4ea0375575 [DOM media] Zero-initialize ThreadSharedFloatArrayBufferList. 2026-06-21 14:20:33 +02:00
Kui-Feng Lee 7071894a52 Bug 2033848 - Use non-default response ID for GTK file picker accept button. r=stransky
Replace GTK_RESPONSE_ACCEPT (-3) with a non-negative application-defined
response ID (kFilePickerAccept = 0) for the accept button in the GTK file
chooser dialog, and remove the gtk_dialog_set_default_response() call.

GTK treats buttons with negative built-in response IDs as candidates for
the dialog's default widget, which activates on Enter key press. By using
a non-negative ID and not calling set_default_response(), the accept button
is no longer pre-selected, preventing a page from tricking the user into
confirming a file upload by holding Enter before the dialog appears.

GTK's file chooser internally emits GTK_RESPONSE_ACCEPT via file_activated_cb
when the user double-clicks a file, so we keep that case in DoneNonPortal()
alongside kFilePickerAccept.
2026-06-21 14:20:22 +02:00
John Schanck 0f471cfde7 Bug 2023478 - improve handling of escape sequences in pk11uri_ParseAttributes. 2026-06-21 14:20:15 +02:00
Moonchild a8cc198e79 [DOM] Reject too large mLength in MutableBlobStorage::WriteRunnable. 2026-06-21 14:20:09 +02:00
John Schanck 477b1010fe Bug 2030570 - use correct data for ID comparison in transfer_uri_certs_to_collection. 2026-06-21 14:20:02 +02:00
Moonchild 8722bc3693 [network] Make keep-alive pref Atomic. 2026-06-21 14:19:53 +02:00
John Schanck e31e3802a0 Bug 2029765 - avoid refcount over-release in nssTokenObjectCache error path [@ nssToken_Destroy]. 2026-06-21 14:19:46 +02:00
Nicolas B. Pierron 723d95295e Bug 2029066 - Remove Sinking of Live instructions.
Instruction sinking was made possible by the introduction of recover
instructions, which are moving instructions to be executed on bailout, but this
is only possible for instructions which are not used.

This feature, which is now removed, was made to sink instructions which are
live, but only in a small set of branches, by moving the computation of these
instructions to bailout paths, and to the concerned if branches.

The current implementation never delivered and remained as dead-code for
multiple years, without having a firm benefit on performance oriented
benchmarks.

Thus, this change removes the part of the Sink optimization which deals with
live instructions but keeps the part of the Sink optimization which deals with
instructions which are only used on bailout paths.
2026-06-21 14:19:37 +02:00
John Schanck 91b3b6fdc8 Bug 2029803 - add defensive info->len check in PK11_HPKE_SetupS and PK11_HPKE_SetupR. 2026-06-21 14:19:18 +02:00
Moonchild 34a901430d Issue #3122 - Exclude local resources from <base> CSP checks.
This avoids local-resource <base> URLs being restricted/nullified by
remote CSP. This aligns the CSP handling with direct requests.

Resolves #3122
2026-06-14 10:52:53 +02:00
Moonchild 83826f1f34 Issue #3111 - Clean up logic in SweepFinalizationRegistries.
Resolves #3111
2026-06-09 18:07:37 +02:00
Moonchild 3562ba1235 [DOM] Provide more silent audio processing frames. 2026-06-05 12:39:58 +02:00
Moonchild 1cc002018f Revert "Bug 2027433 Treat null input channels as zero in InterleaveAndConvertBuffer()"
This reverts commit e76fc5637a.
2026-06-05 11:38:27 +02:00
Moonchild 352863cab4 Revert "Bug 2027433 Treat null input channels as zero in AudioChannelsDownMix()"
This reverts commit ddd016a6f8.
2026-06-05 11:38:22 +02:00
Moonchild d69570b62b Revert "Bug 2027433 use nullptr for silent up-mix channels"
This reverts commit 5309640d6c.
2026-06-05 11:38:14 +02:00
Moonchild 26c44d4869 Issue #3109 - Use CSS' internal length clamp value instead. 2026-05-30 10:44:40 +02:00
Moonchild f10fc4489c Issue #3109 - Clamp border-radius value to Int32.MaxValue
This avoids artifacts from out-of-bounds values.
Resolves #3109
2026-05-30 10:44:32 +02:00
Moonchild 3450ed2282 Merge branch 'master' into release 2026-05-26 14:16:41 +02:00
Moonchild 967e985c5f Merge branch 'master' into release 2026-05-26 09:32:40 +02:00
Moonchild d6915b9014 Merge branch 'master' into release 2026-05-25 06:08:13 +02:00
Moonchild 304e6d045d Merge branch 'master' into release
# Conflicts:
#	dom/media/webm/WebMDemuxer.cpp
2026-05-24 10:11:40 +02:00
Moonchild 4dea7f04dc [gfx] Add sanity checks in ANGLE D3D11 renderer. 2026-04-29 15:06:03 +02:00
Moonchild 7cc35f1195 [DOM] Do not interrupt worker execution if already scheduled. 2026-04-29 15:05:56 +02:00
Moonchild afd0648631 [DOM] Validate size in FileReader. 2026-04-29 15:05:17 +02:00
Moonchild 6524bfee21 [DOM/media] Add some sanity checks to MP3 demuxer.
Note: `vbr.NumAudioFrames()` is already checked in `vbr.IsComplete()`
2026-04-29 15:05:11 +02:00
Iain Ireland de8c2d1762 Bug 2029806: Handle ill-formed UTF16 2026-04-29 15:05:06 +02:00
Karl Tomlinson 5309640d6c Bug 2027433 use nullptr for silent up-mix channels 2026-04-29 15:05:01 +02:00
Karl Tomlinson ddd016a6f8 Bug 2027433 Treat null input channels as zero in AudioChannelsDownMix() 2026-04-29 15:04:55 +02:00
Karl Tomlinson e76fc5637a Bug 2027433 Treat null input channels as zero in InterleaveAndConvertBuffer()
The loop nesting is inverted so as not to add a null check to the inner
loop, but this change would also have some impact on cache use:

* The loop ordering might perhaps not be the ideal for two channels and
large sample counts, for example, because it means going through the
output/largest buffer twice.
* It does, however, avoid pathological situations of iterating across
planar channel buffers, likely to load set-associative cache lines if
the channel buffers are page aligned, due to having 1024 (or somewhat
fewer) floats, for example.
2026-04-29 15:04:49 +02:00
Moonchild 62110dcf7f Revert "[DOM] Ensure the GC sees consistent states while adopting DOM nodes."
This reverts commit 7664a83451.
2026-04-28 17:39:16 +02:00
Moonchild c597f4de77 [NSS] Restore dropped 'S' :P 2026-04-26 17:06:16 +02:00
Moonchild fe4b55154b [NSS] Update NSS version for release.
Add (UXP) to the version display string to signify this is our variant of
NSS 3.90 to avoid confusion with the 3.90 branch used in Firefox 115 ESR.
This version has backported considerably more fixes than Mozilla's NSS.
2026-04-26 15:56:47 +02:00
Moonchild d9f4319bfd [parser] Handle foster parenting properly. 2026-04-26 15:56:36 +02:00
Moonchild ec7baced6c [media] Spot-fix for ffvpx handling of bad video data. 2026-04-26 15:56:28 +02:00
Moonchild 5ed591c3d7 [image] Don't do unnecessary work if the image is being destroyed. 2026-04-26 15:56:21 +02:00
Iain Ireland 32859868d6 Bug 2029727: Update RegExpStatics data after realloc 2026-04-26 15:56:09 +02:00
Moonchild 4ab80fceb4 [gfx] OTS/HB: Correct bounds checks. 2026-04-26 15:56:00 +02:00
Moonchild 4e25cc130f [js] Use isElement in UnmappedArgSetter to check if the argument was marked as deleted.
This is more consistent with `UnmappedArgGetter` and better handles the
case where the property was marked deleted in `RareArgumentsData` but not
actually deleted from the object due to OOM. Unfortunately this scenario
is hard to prevent because the property is marked as deleted in the
`ArgumentsObject::obj_delProperty` class hook and after that
`NativeDeleteProperty` tries to remove the property and this can fail.
2026-04-26 15:55:52 +02:00
Dennis Jackson f1b56f6512 Bug 2029323 - Improve size calculations in CMS content buffering 2026-04-26 15:55:38 +02:00
John Schanck b5d6c427ad Bug 2029425 - Heap use-after-free in cert_VerifyCertChainOld via dangling certsList[] entry on NameConstraints violation. 2026-04-26 15:55:29 +02:00
Moonchild 9a900503ea [image] Hold a strong ref on mInnerImage when requesting a refresh. 2026-04-26 15:55:22 +02:00
Moonchild f6296891bf [DOM] Add some death grips to TextTrackManager. 2026-04-26 15:55:17 +02:00
Moonchild bbd16ed644 [DOM/media] Use extended channel data as-appropriate. 2026-04-26 15:55:11 +02:00
John Schanck 8f6cd1cfcd Bug 2030135 - improve error handling in PK11_ImportPrivateKeyInfoAndReturnKey 2026-04-26 15:55:06 +02:00
Moonchild 70a3532f49 Revert "[gfx] Use local statics for harfbuzz callback pointers"
This reverts commit 60a96d9cd2.
2026-04-26 15:54:57 +02:00
Moonchild c160edb49b No issue - Update our in-tree brotli library to 1.2.0+
This includes a minor patch to encode.c to work around the "static init"
check that actually doesn't do anything in its default state, but, due to
compiler subtleties in handling duplicate object names, would not be able
to link brotli.exe because it would refuse to expose all symbols for
duplicate objects (a later one would just be ignored).
Unsure how clang does this but it's not portable across compilers.
(we need the brotli.exe tool for resource package compression)
2026-04-26 15:54:50 +02:00
John Schanck 32f0e6d1e6 Bug 2029462 - store email on subject cache_entry in NSS trust domain.
remove_email_entry used cert->email of the last-destroyed cert to locate
the hash entry to clean up. If that cert had no email, the entry was
silently skipped, leaving a dangling subjectList pointer after the arena
was freed. Store the registration-time email on the subject cache_entry
(mirroring ce->nickname) and thread it through remove_subject_entry so
removal always uses the correct email regardless of destruction order.
2026-04-26 15:54:36 +02:00
Moonchild 8c6098ed9e [security] Ensure DispatchToMainThreadAndWait isn't interrupted.
In some cases, `lock.wait()` can be interrupted by spurious wake-ups
before processing is done. To ensure things are, in fact, synchronous,
loop over `wait()` until it is actually done.
2026-04-26 15:54:26 +02:00
Timothy Nikkel 5f70302bfc Bug 2029291. 2026-04-26 15:54:16 +02:00
Jan de Mooij f1cc25409a Bug 2029317 - Create RareArgumentsData before mutating the arguments object in MappedArgumentsObject::obj_defineProperty. 2026-04-26 15:54:10 +02:00
Jan-Ivar Bruaroey 1bb67f87d1 Bug 2029423 - Reset post_proc state. 2026-04-26 15:53:55 +02:00
Andy Leiserson 6f89be191d Bug 2029427 - Fix format string 2026-04-26 15:53:50 +02:00
Moonchild f453aac0eb [gfx] Explicitly cast calculation to int32. 2026-04-26 15:53:42 +02:00
Moonchild abc2e56e6a [gfx] Port libyuv upstream bounds check. 2026-04-26 15:53:31 +02:00
Simon Farre 2f2c86599f Bug 2025973 - Use value-semantics for txExecutionState::TemplateRule
TemplateRule is a wrapper around references mostly and can for the
purposes of this function be copied to the stack, given that
TemplateRule::mModeNsId is not mutated there.
2026-04-26 15:53:24 +02:00
Dennis Jackson a52e68f04d [NSS] Clarify extension negotiation mechanism for TLS Handshakes. 2026-04-26 15:53:16 +02:00
Moonchild ee256eda09 [js] Only allow strings as function name. 2026-04-26 15:53:07 +02:00
Olli Pettay adbedd87a3 Bug 2025370 - Properly handle error case in EventListenerManager::GetTypedEventHandler 2026-04-26 15:52:46 +02:00
Moonchild 4f94981ad9 [DOM/XSLT] Don't use txXPathNode by reference.
Follow-up to previous XSLT fixes.
2026-04-26 15:52:36 +02:00
Moonchild fb15e11ef3 [gfx] Stop using binary arithmetic in software filtering.
There was some weird binary arithmetic to artificially clamp values in
calculations for dot products. (multiply by (x >= 0)...)
Switch to `std::clamp()` on the initial value instead.
2026-04-26 15:52:31 +02:00
Tom Schuster b0e1570535 Bug 2025332 - ErrorResult should call ClearUnionData more. 2026-04-26 15:52:26 +02:00
Karl Tomlinson b370042040 Bug 2025483 update mBeginProcessing even on speex_resampler_set_rate() error 2026-04-26 15:52:20 +02:00
Moonchild 60daf77274 [NSS] Deep copy profile data in CERT_FindSMimeProfile. 2026-04-26 15:52:15 +02:00
Moonchild 4f9ed77789 [DOM/XSLT] Prevent circular indexing
Added additional flag to txIndexedKeyHashEntry to signal whether or not
this entry is already in the process of indexing.

The XSL specs 3.0 talk about recursion being fine, but circularity not
being ok, which is the case when a key is already being looked up.
2026-04-26 15:52:04 +02:00
Moonchild c819a0b3c8 No issue - Deduplicate HTMLAllCollection::GetSupportedNames code.
This was duplicated with a minor difference from the code present in
nsContentList::GetSupportedNames.
2026-04-26 15:51:57 +02:00
Moonchild 104f493044 [NSS] Reject excessively large ASN.1 SEQUENCE OF in quickder. 2026-04-26 15:51:14 +02:00
Moonchild ccfb3fc5db [DOM] Avoid leaks in nsXMLPrettyPrinter. 2026-04-26 15:51:05 +02:00
Moonchild 9fa543c9f4 [DOM/WebCrypto] Reject absurdly large salt values. 2026-04-26 15:51:00 +02:00
Moonchild 1d18178eda [DOM] Add a death grip and use locals in BaseMediaResource::ModifyLoadFlags. 2026-04-26 15:50:54 +02:00
Moonchild 8a6b1f309b [DOM] Add a SequenceRooter to ConsoleProfile. 2026-04-26 15:50:48 +02:00
Moonchild a60ab0def7 [widget] Improve clearing of data during clipboard operations. 2026-04-26 15:50:40 +02:00
Daniel Holbert 6276177e20 Bug 2026293: Block scripts when initiating async scrollbar activity. 2026-04-26 15:50:33 +02:00
Moonchild 6c4e8f1466 [accessibility] Hold a strong ref to mParent in AccIterator. 2026-04-26 15:50:22 +02:00
Moonchild 19a4ae248b [gfx] Don't return dummy surfaces. 2026-04-26 15:50:16 +02:00
Moonchild 744212dbf3 [webrtc] Fix off-by-one comparison. 2026-04-26 15:50:10 +02:00
Simon Farre a46fbd6ead Bug 2025971 - Use txSingleNodeContext getter of owned txXPathNode.
eContext gets a copy of aNode. The function should use that one's member
as it's not a shared reference, which we can't know the life time of.
2026-04-26 15:50:04 +02:00
Moonchild bb39100caf Bug 2025976 - Follow-up: Make txXPathNode() a public class member. 2026-04-26 15:49:51 +02:00
Moonchild a27a4e4b60 [DOM/XSLT] Re-fetch index entry. 2026-04-26 15:49:45 +02:00
Simon Farre 490cf03fba Bug 2025976 - Make txxPathNode be a value instead of reference.
txxPathNode has value semantics (it's a smart pointer + uint32_t index;
two different objects of this instance with the same contents are the same
thing).

Increase correctness by making a copy instead of a reference.
2026-04-26 15:49:40 +02:00
Moonchild e93191409e [NSS] Improve input validation in DSAU signature decoding 2026-04-26 15:49:33 +02:00
Moonchild 5cfdaf4ad4 [image] Hold a strong ref on error. 2026-04-26 15:49:28 +02:00
Moonchild 7664a83451 [DOM] Ensure the GC sees consistent states while adopting DOM nodes.
This should prevent some intermittent CC crashes when the wrapper cache
has an incorrect state.
2026-04-26 15:49:22 +02:00
Moonchild f449e1fd7d [DOM] Improve CC/WrapperCache for nursery objects. 2026-04-26 15:49:16 +02:00
Moonchild bbd4a99be2 [network] Ensure UDPSocket remains alive during CloseWithReason. 2026-04-26 15:49:11 +02:00
Moonchild 4ae471baf9 [network] Hold strong ref in nsSyncStreamListener::Available. 2026-04-26 15:49:01 +02:00
Moonchild 4d41b5df11 [network] Force NUL termination in ToStringBuffer AF_LOCAL.
Also reject AF_LOCAL in IPC reader (just in case).
2026-04-26 15:48:54 +02:00
Moonchild 01188c1465 [webrtc] Hold a self-ref on behalf of sigslot, just in case.
Also, stop using these PC_AUTO_ENTER_API_CALL... macros
in functions that aren't actually JS API.
2026-04-26 15:48:41 +02:00
Moonchild 7eac3090a5 [DOM] Fix access to shared RuntimeService::mNavigatorProperties. 2026-04-26 15:48:28 +02:00
Moonchild e9bb602131 Issue #3060 - Align cookie magic prefix handling with the updated spec.
This adds `__Http-` and `__Host-Http-` magic prefixes, and aligns
our checks with RFC6265bis.

Resolves #3060
2026-04-26 15:48:16 +02:00
Moonchild ddc8b21705 [network] Handle WebSocketChannel::IsPersistentFramePtr correctly. 2026-04-26 15:47:59 +02:00
Moonchild 6209d33f4e [network] Hold strong ref in nsDownloader::OnDataAvailable. 2026-04-26 15:47:50 +02:00
Moonchild cbaace24c0 [DOM] Add a death grip. 2026-04-26 15:47:44 +02:00
Moonchild 051951ef00 [network] Use locals for VisitHeader 2026-04-26 15:47:38 +02:00
Moonchild a9062b8710 [DOM] Update some DOM canvas checks. 2026-04-26 15:47:14 +02:00
Moonchild 18c656ebba Issue #3058 - Part 1: Fix arithmetic issue in ConvertYCbCrToRGB32
The more complex part can be landed later.
2026-04-26 15:46:58 +02:00
Moonchild 9220d05de2 [NSS] Fix memory leak in NSC_GenerateKey error path. 2026-04-26 15:46:43 +02:00
Moonchild fdd286d190 [NSS] Protect rwSessionCount with slotLock.
Previously, SFTKSlot.rwSessionCount was incremented and decremented
atomically, which meant that there was no way to synchronize reads from it
in NSC_GetTokenInfo. This patch removes the atomic operations but protects
rwSessionCount with SFTKSlot.slotLock.
SFTKSlot.sessionCount is already protected in this way, so this should
have no performance impact.
2026-04-26 15:46:29 +02:00
Moonchild 4fa8a8ce1d [NSS] Fix potential integer underflow in tls 1.3.
Fix integer underflow in tls13_AEAD when ciphertext is shorter than tag.
2026-04-26 15:46:24 +02:00
Moonchild d5e853a25b [media] Check alpha data pointer instead of length.
`nestegg_packet_additional_data()` can return a non-zero length with a
null-pointer after failure to parse an ID_BLOCK_ADDITIONAL element.
See upstream bug https://github.com/mozilla/nestegg/issues/76
2026-04-26 15:46:18 +02:00
Moonchild 6ea3635847 [network] use nsCOMPtr for mRequest in Base Channel's ScopedRequestSuspender 2026-04-26 15:46:09 +02:00
Moonchild 0ea3d42a38 Issue #2946 - Follow-up: Sanity-check WMF video properties.
Not sure where else to put this under, but it's a WMF HWA related check,
so filing it as a follow-up here to recent work.
Also tag #2949
2026-04-26 15:45:50 +02:00
Moonchild a024df6124 [DOM] More consistently use already-calculated image properties. 2026-04-26 15:45:33 +02:00
Moonchild 11a80021f4 [layout] Minor frame scroll improvements. 2026-04-26 15:45:26 +02:00
Moonchild 301873c751 [XPCOM] Update list of executable extensions on Windows. 2026-04-26 15:45:18 +02:00
Moonchild 90986caee8 [NSS] ensure permittedSubtrees don't match wildcards that could be outside
the permitted tree.
2026-04-26 15:45:12 +02:00
Moonchild 778d93ac49 [network] Ignore non-compliant http server header. 2026-04-03 07:38:32 +02:00
Moonchild f9ba08fa11 [NSS] Update NSS to 3.90.9.1 (custom) 2026-04-03 07:38:24 +02:00
Moonchild 95911aa2ce [gfx] Use local statics for harfbuzz callback pointers
This ensures thread-safe initialization.
2026-04-03 07:38:10 +02:00
Moonchild ccbea05142 [XPCOM] Add more validation to SnappyUncompressInputStream 2026-04-03 07:37:56 +02:00
Moonchild 867c957ceb No issue - Add convolver sanity check 2026-04-03 07:37:41 +02:00
Moonchild 0d2ff3ee65 Merge branch 'master' into release 2026-03-28 19:02:37 +01:00
Moonchild 14122475be Issue #2981 - Add nullcheck in GetPointerCapabilities (uplift)
Uplift to release.
2026-03-09 11:32:39 +01:00
Moonchild d881e7ed56 Merge branch 'master' into release 2026-03-01 23:37:59 +01:00
Moonchild 9b0054c55f Merge branch 'master' into release 2026-02-27 19:28:35 +01:00
Moonchild baeae97784 Merge branch 'master' into release 2026-02-27 07:08:35 +01:00
Moonchild 0324bfa219 Re-sync master to release.
Post-merge synchronization to bypass rebase-shenanigans after backouts.
2026-02-24 17:25:53 +01:00
Moonchild b279fd025b Merge branch 'master' into release
# Conflicts:
#	js/src/jit/CodeGenerator.cpp
#	js/src/jit/arm/Lowering-arm.cpp
#	js/src/jit/arm64/Lowering-arm64.cpp
#	js/src/jit/mips32/Lowering-mips32.cpp
#	js/src/jit/mips64/Lowering-mips64.cpp
#	js/src/jit/shared/LIR-shared.h
#	js/src/jit/x64/Lowering-x64.cpp
#	js/src/jit/x86/Lowering-x86.cpp
#	mfbt/Xoroshiro128PlusPlusRNG.h
#	parser/expat/lib/xmlparse.c
2026-02-24 14:37:42 +01:00
Francis Dominic Fajardo f31546817a Issue #2828 - Follow-up: Simplify rule node tracking and ensure rule walker state isn't reset for the first child processor (uplift)
Styles contained in NAC shouldn't be tracked with their own rule node (as opposed to what was done in https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2859) because it causes precedence issues. This should now more closely imitate the original behavior where NAC and regular document styles (at least, the "unlayered" layer) are grouped together.

This also gets rid of the manual last rule node checks against null, since they are now consistently handled by the separate function.
2026-01-25 14:44:49 +01:00
Moonchild f272382a9c Revert "Issue #2895 - Part 1: Replace XorShift128+ with Xoroshiro128++"
This reverts commit c90df0c332.
2026-01-21 10:18:46 +01:00
Moonchild aa8af9d7f8 Revert "Issue #2895 - Part 2: Remove incorrect debug asserts."
This reverts commit 97786271f9.
2026-01-21 10:18:38 +01:00
Moonchild e1f03ae019 Revert "Issue #2895 - Part 1b: Update license block."
This reverts commit 12821ae90a.
2026-01-21 10:18:08 +01:00
Moonchild f316bc6535 Revert "Issue #2895 - Follow-up: Fix JIT code generator for 32-bit targets."
This reverts commit 8112ed2e6c.
2026-01-21 10:17:51 +01:00
Moonchild 82e4c66520 Revert "Issue #2889 - Part 0: Relocate Mozilla-specific files from Expat source."
This reverts commit f93d0fadf2.
2026-01-21 10:04:52 +01:00
Moonchild 3c923e0467 Revert "Issue #2889 - Part 1: Prepare Mozilla's changes and extensions for Expat 2.6.4."
This reverts commit 6c7850482f.
2026-01-21 10:04:44 +01:00
Moonchild 866985ac88 Revert "Issue #2889 - Part 2: Import Expat 2.6.4 source."
This reverts commit e7cacf4642.
2026-01-21 10:04:37 +01:00
Moonchild ba772b40ad Revert "Issue #2889 - Part 3: Apply Mozilla's patches to Expat 2.6.4."
This reverts commit 2ae8833092.
2026-01-21 10:04:29 +01:00
Moonchild 7a86f0e1b7 Revert "Issue #2889 - Part 4: Fix build and runtime issues."
This reverts commit ef1532cab2.
2026-01-21 10:04:22 +01:00
Moonchild 7e9286f2d8 Revert "Issue #2889 - Follow-up: Avoid conflicts with system version of libexpat"
This reverts commit e284ffab6c.
2026-01-21 10:04:14 +01:00
Moonchild b0d1e365ec Revert "Issue #2889 - Follow-up: void methods shouldn't return a value."
This reverts commit 647a1ab5f0.
2026-01-21 10:04:07 +01:00
Moonchild dbd5a2cbf4 Revert "Issue #2889 - Part 5: Rewrite patches for Expat 2.7.3."
This reverts commit 0f1faad9a3.
2026-01-21 10:03:58 +01:00
Moonchild d60fb1d5c0 Revert "Issue #2889 - Part 6: Import Expat 2.7.3 source."
This reverts commit 627fdf8fe4.
2026-01-21 10:03:49 +01:00
Moonchild 29c91fcdba Revert "Issue #2889 - Part 7: Apply patches to Expat 2.7.3."
This reverts commit 112abdc25a.
2026-01-21 10:03:40 +01:00
Moonchild fe65674f3f Revert "Issue #2889 - Follow-up: Allow generate_hash_secret_salt to be used." 2026-01-21 10:03:24 +01:00
Moonchild a3a6b5ed7e Revert "Issue #2889 - Follow-up: Adjust Expat 2.7.3 local patches for removal of 3rd patch."
This reverts commit 073378ec92.
2026-01-21 10:01:44 +01:00
Moonchild d2de8658a7 Revert "Issue #2889 - Follow-up: Remove fix for BZ 569229."
This reverts commit a22613d3e0.
2026-01-21 10:01:37 +01:00
Moonchild be785b4783 Merge branch 'master' into release
This resyncs platform to master, overwriting more recent backouts from
the release branch.
2026-01-16 23:16:32 +01:00
Moonchild 70e34941c4 [devtools] Remove newline kludge from "Copy as cURL" on Windows 2025-10-15 19:46:52 +02:00
Moonchild 545d52572d Revert "Issue #2828 - Part 1: Build and store the array of layer name tokens in the layer at-rules"
This reverts commit 253ec6706a.
2025-10-08 23:24:27 +02:00
Moonchild dfa0736b49 Revert "Issue #2828 - Part 2: Collect and hold rule cascade data per cascade layer"
This reverts commit a91b385f68.
2025-10-08 23:24:20 +02:00
Moonchild c7bb5664d9 Revert "Issue #2828 - Part 3: Refactor selector matching and rule cascade data into separate files/classes"
This reverts commit 211aa6d652.
2025-10-08 23:24:13 +02:00
Moonchild 6bbc6f3417 Revert "Issue #2828 - Part 4: Move cache key storage to ResolvedRuleCascades"
This reverts commit 202e354f87.
2025-10-08 23:24:07 +02:00
Moonchild 631169a312 Revert "Issue #2828 - Part 5: Implement child rule processors"
This reverts commit bc45ec4f57.
2025-10-08 23:24:02 +02:00
Moonchild 427b3312a6 Revert "Issue #2828 - Part 6: Assert rules were added to the rule cascade data"
This reverts commit be7a231579.
2025-10-08 23:23:56 +02:00
Moonchild 2287b0b57a Revert "Issue #2828 - Part 7: Walk child rule processors separately and ensure inverted cascade layer order is enforced for important rules"
This reverts commit c3e12fe822.
2025-10-08 23:23:50 +02:00
Moonchild 56aaba09b1 Revert "Issue #2828 - Part 8: Extract RuleProcessorGroup (formerly ResolvedRuleCascades) into separate file"
This reverts commit 5fda071898.
2025-10-08 23:23:45 +02:00
Moonchild 332938fef3 Revert "Issue #2828 - Part 9: Rename CascadeEnumData to CascadeLayer"
This reverts commit ebb0ae456c.
2025-10-08 23:23:39 +02:00
Moonchild 13710f7a06 Revert "Issue #2828 – Part 10: Clean up cascade layer constructor"
This reverts commit 047458a002.
2025-10-08 23:23:33 +02:00
Moonchild 530693099b Revert "Issue #2828 - Part 11: Detach weighted rule data from cascade layer"
This reverts commit b1c19137ad.
2025-10-08 23:23:28 +02:00
Moonchild f68aa7ea88 Revert "Issue #2828 - Part 12: Implement cascade layer SizeOfIncludingThis"
This reverts commit 5ef79e303f.
2025-10-08 23:23:23 +02:00
Moonchild 5bdaee5e40 Revert "Issue #2828 - Part 13: Exclude strong layers-related code from release builds"
This reverts commit e82fa3450a.
2025-10-08 23:23:18 +02:00
Moonchild 1b465bc2e2 Revert "Issue #2828 - Part 14: Clobber required for CSS rule processor refactoring"
This reverts commit 038c5a95fc.
2025-10-08 23:23:12 +02:00
Moonchild e455021bea Revert "Issue #2835 - Part 1: Expose nsCSSRuleProcessor::CascadeSheet"
This reverts commit 618f62e753.
2025-10-08 23:23:02 +02:00
Moonchild 4fe1246bcc Revert "Issue #2835 - Part 2: Implement processing of import rules based on order of appearance"
This reverts commit 2ba24302d9.
2025-10-08 23:22:57 +02:00
Moonchild 59b4ac4d5f Revert "Issue #2835 - Follow-up: Guard against import rules with no attached style sheet"
This reverts commit 5fccc6ec3d.
2025-10-08 23:22:42 +02:00
Moonchild de641fedfe Merge branch 'master' into release 2025-10-02 21:21:39 +02:00
Moonchild cb99fabcc0 Merge branch 'master' into release 2025-09-24 10:33:48 +02:00
Moonchild f996ea12c2 Merge branch 'master' into release 2025-09-19 21:04:01 +02:00
Moonchild 4e7fb3e0ea Merge branch 'master' into release 2025-09-18 13:15:14 +02:00
Moonchild e7cbbbef0f Merge branch 'master' into release 2025-09-14 11:54:15 +02:00
Moonchild a181078981 Revert "[gfx] Guard against possible race via gfxFontEntry::GetFontTable."
This reverts commit 98ddf30155.
2025-08-27 15:54:15 +02:00
Moonchild 987a662b51 [NSS] Avoid leak in pkcs12 decoder. 2025-08-20 16:26:17 +02:00
Moonchild 77e3e14e55 [js] Error-check pthread calls
These calls return error states (int) that weren't checked for success.
Failures here are fatal, so using MOZ_RELEASE_ASSERT to safely crash.
2025-08-20 16:26:10 +02:00
Moonchild 98ddf30155 [gfx] Guard against possible race via gfxFontEntry::GetFontTable. 2025-08-20 16:26:03 +02:00
Moonchild 83da5c58a2 Issue #2850 - Alias :focus-visible to :-moz-focusring
Band-aid to have it be parsed as valid with reasonably-expected behaviour.
2025-08-17 10:46:32 +02:00
Moonchild 7136ae45a7 [DOM] Simplify <object> scheme check code and fix plugin handling.
Trying to do a positive check on nested URIs apparently doesn't work,
but the handling could be simplified to just check for non-null mURI
instead - this also fixes plugin loading (which broke with the previous
check).
2025-07-31 10:44:08 +02:00
Moonchild 97d3d61749 [DOM] Fix crash in <object> scheme checking code.
If a website would nor supply a URI for object loading code, the browser
would crash on a null deref.
This reintroduces the nestedURI check to make sure we have a valid URI.
2025-07-30 09:29:51 +02:00
Sergey Larin 9c8bf1fe5d No Issue - Disable VSX extensions (uplift)
There is no detection script for them as for AltiVec, and
it's breaking older machines (PowerMac G5 in particular).
2025-07-25 16:57:09 +02:00
Sergey Larin d1cc6ff3cb Issue #2777 - Fix ffvpx build on PPC64 (uplift) 2025-07-25 16:55:27 +02:00
Moonchild db76d74820 [DOM] Make object loading use an explicit scheme whitelist. 2025-07-25 14:23:45 +02:00
Moonchild 8fdd9d52f9 [network] Stop accepting nameless cookies. 2025-07-25 14:23:34 +02:00
Moonchild d42797f587 [js] Align br_table limits with V8/Gecko. 2025-07-25 14:23:18 +02:00
Moonchild 6b9c1f6ab8 [gfx] Hold a stronger reference to gfxFontEntry. 2025-07-25 14:23:10 +02:00
Moonchild 4aedc96db2 No issue - Adjust CSP URI reporting more closely with the spec.
According to the W3C discussion we should allow websocket URIs to be
reported aside from http/https/ftp ones.
This rewrites things slightly and updates comments to clarify.
We do retain the non-standard reduction to origin only in case the
report is for cross-origin URIs (stops leaking full URIs to the CSP
reported destination).
See https://github.com/w3c/webappsec-csp/issues/735
2025-07-25 14:22:58 +02:00
Francis Dominic Fajardo 234830da1e Issue #2826 - Set up fontconfig on XRE startup (GTK only) 2025-07-25 14:22:35 +02:00
Moonchild 244b95968f Issue #2720 - Follow-up: Use temp value for duplicate color stop 2025-07-25 14:20:13 +02:00
Moonchild 810cd553b5 [devtools] Further improve special character escaping in "copy as curl".
Follow-up to 15335ce39d

Trying to cross-platform sanitize causes issues escaping too much and
as a result mangling the curl commands that get spit out.
This reverts previously added Windows-specific escaping on POSIX and
vice versa.
Since we do not offer cross-platform copying as a curl command in devtools
anyway, it makes little sense to sanitize for the O.S. we're not running on
as we would not be using the command processor in such environments that
could trip over characters for the other O.S. This was previously added
as a defense-in-depth in case we would start offering this, but I see no
real reason to do so, anyway.

Also decided to in-line comments for readability instead of a bulleted
list in the function head.

Mozilla has taken similar steps because of fall-out, but they do offer
cross-platform "copy as curl" for corner cases, so they will have to
find solutions for a problem we won't have.
2025-07-08 22:57:28 +02:00
Basilisk-dev e52eaa961c Issue #2773 - Allow building FFVPX on all architectures (uplift)
Resolves build bustage.
2025-07-03 20:16:10 +02:00
Moonchild b7827091b8 Merge branch 'master' into release 2025-06-26 14:26:02 +02:00
Moonchild 2e344377b5 Merge branch 'master' into release
# Conflicts:
#	devtools/client/shared/curl.js
#	security/nss/lib/ckfw/builtins/certdata.txt
#	security/nss/lib/nss/nss.h
#	security/nss/lib/softoken/softkver.h
#	security/nss/lib/util/nssutil.h
2025-06-24 17:08:59 +02:00
Moonchild 15335ce39d [devtools] Improve special character escaping for curl 2025-05-29 17:28:44 +02:00
Moonchild 14b03e1f8c No issue - Set device contrast to an acceptable value if OOB.
On Mac and Win+DW, enhanced device contrast can possibly not be set.
This throws Skia for a loop by passing in an OOB scalar to its init.
Work around this by setting an accepted average value that helps
prevent font wash-out while not causing fringing.
2025-05-29 17:28:30 +02:00
Moonchild 0968b94e5c No issue - Force C++ run-time type information on protobuf (uplift)
Protobuf uses `dynamic_cast` on polymorphic types which cannot be
inferred properly at compile-time, which can lead to unexpected behavior.
As a code safety measure, enable C++ RTTI for protobuf.
2025-05-29 17:27:29 +02:00
Moonchild ba6b2258aa No issue - Don't support modulo math space in ExtractLinearSum. (uplift) 2025-05-20 00:56:35 +02:00
Moonchild 1e1715ff11 No issue - Fix promise combinator function state. (uplift) 2025-05-19 22:50:48 +02:00
Brian Smith c93381fa79 No Issue - Fixes for building with LLVM 19 (uplift).
Fix a conflict with libc++ 19 and the old Mozilla (re)alloc macros.
LLVM 18+ does not allow std::char_traits<unsigned char> so avoid it.
https://bugzilla.mozilla.org/show_bug.cgi?id=1849070
Partial NSS upgrade to replace ByteString with a class.
https://bugzilla.mozilla.org/show_bug.cgi?id=1851092
2025-05-07 13:01:33 +02:00
Moonchild 65b0a59757 [devtools] Escape some more characters for copying as cURL on Posix. 2025-04-30 15:01:54 +02:00
Moonchild c785639043 [NSS] Update NSS version to 3.90.7 2025-04-30 15:01:48 +02:00
Moonchild 512c259822 [NSS] Update built-in data 2025-04-30 15:01:42 +02:00
Moonchild 90fea6f0d4 [NSS] Improve locking in nssPKIObject_GetInstances. 2025-04-30 15:01:35 +02:00
Moonchild d892468fd0 Issue #2731 - Fix crashes on unknown BigInt types in JIT (uplift)
This only works around the unknown type crashes but doesn't actually fix
attempts at using 64-bit BigInts in Ion.
Resolves #2731
2025-04-22 15:27:34 +02:00
Moonchild 81ab98b329 Merge branch 'master' into release 2025-04-04 20:37:42 +02:00
Moonchild 3f1cacd3e6 Merge branch 'master' into release 2025-04-03 10:22:24 +02:00
Moonchild 6e41e01a29 No issue - fix some minor link issues in about:rights
Privacy was moved to a subdir. Also replacing http with https because
that is what everyone expects by default.
2025-03-07 15:43:13 +01:00
Moonchild 9ce81488d4 No issue - Update Twemoji font to unicode 15.1.3 2025-03-07 02:06:25 +01:00
Moonchild 25bc2630d9 [js] Disable potentially unsafe attempts at recovering JIT operations. 2025-03-06 20:18:39 +01:00
Moonchild e5b69418a0 No Issue - NULL crash fix in nsExternalResourceMap::PendingLoad::OnDataAvailable
Curiously, we should have had this at our fork point (as it was backported
by Mozilla to 52.5.2) by apparently Tobin's import wasn't actually 52.6.0.
:-/
2025-03-06 20:18:24 +01:00
Shadow 229a69be5f Update js/src/wasm/WasmIonCompile.cpp
Bug 1328639 , wasm , Simplify block-value popping in Ion compilation
2025-03-06 20:18:07 +01:00
Moonchild 7f2561312a [layout] Always reserve 64 bits for frame property value
This ensures frame property values can always be stored even in edge cases
on 32-bit machines (where a void ptr is half the width).
2025-02-18 21:42:59 +01:00
Moonchild 93d11a07f9 Issue #2694 - Improve nested grid layout performance by caching.
This improves performance by caching the grid items' block axis
measurement, avoiding potentially exponential calculations and reflows.
Resolves #2694
2025-02-18 16:57:20 +01:00
Moonchild 8e5e24c4c6 Issue #2693 - Disable CSP reporting by default in the platform.
This is a temporary measure to work around CF OOM situations.
Reporting is desirable normally so webmasters get alerted to CSP issues,
and this should be flipped back on once we can.
2025-02-18 10:13:35 +01:00
Moonchild 517ee6754c [DOM] Honor security.csp.reporting.enabled pref in more places. 2025-02-18 10:13:28 +01:00
Moonchild 47690c287c No issue - avoid potential underflow in StructuredClone.
Prevents potential loop-around if there's bogus internal Map data.
2025-02-18 10:13:19 +01:00
Moonchild 364b95170e Merge branch 'master' into release 2025-02-05 23:36:07 +01:00
Moonchild 407006d673 Merge branch 'master' into release 2025-02-05 18:33:29 +01:00
Moonchild 2d60605cc6 Merge branch 'master' into release
# Conflicts:
#	netwerk/cookie/nsCookieService.cpp
2025-02-03 19:13:42 +01:00
Moonchild 2d1129eb7e [network] Don't try to use non-existing connections. 2025-01-13 20:29:31 +01:00
Moonchild 495b4980e7 [DOM] Convert cleanup of FlushCurrentWord() to a ScopeExit task.
Ensures consistent cleanup even if early exit due to OOM.
2025-01-10 15:55:10 +01:00
Moonchild ad480be112 [DOM] Slightly extend lifetime of data in Structured Clone operations. 2025-01-10 15:54:44 +01:00
Moonchild a06001c022 [network] Verify connection NPN against negotiated NPN. 2025-01-10 15:54:35 +01:00
Moonchild 6cbda74aeb Issue #2670 - Compute baseDomain when cookies are read from the database
baseDomain is used as a key for cookies in a hashmap. For cookie
operations to work properly, the baseDomain generation must be reliable.
This is, however, not the case, because the result can change by updates
to the public suffix list (PSL).

Since the stored baseDomain is not reliable, the value must be recomputed
when the database is read. This causes a minor performance hit but is
needed if we want to keep abreast of PSL changes without clobbering the
cookies database.

Resolves #2670
2024-12-24 22:12:33 +01:00
Moonchild 576fbdf490 Issue #2672 - Follow-up: Remove unused telemetry variable. 2024-12-24 22:12:24 +01:00
Moonchild 52b00c38ea Issue #2672 - Part 4: Prevent db access while rebuilding is underway. 2024-12-24 22:12:15 +01:00
Moonchild 8ec56f459b Issue #2672 - Part 3: Ensure thread lifetimes are in tandem. 2024-12-24 22:12:05 +01:00
Moonchild 5cbe423461 Issue #2672 - Part 2: Auto-close syncConn for edge cases. 2024-12-24 22:11:59 +01:00
Moonchild 369fbba750 Issue #2672 - Part 1: Load nsCookieService OMT and use sync reads.
No more lazy-loading on the main thread, thanks. Everyone needs this.
2024-12-24 22:11:52 +01:00
Martok 8e3c35efc6 Issue #1787 - Follow-up: remove no longer used AppClearDataObserver. 2024-12-24 22:11:37 +01:00
Moonchild b3b852b877 Merge branch 'master' into release 2024-12-04 11:10:21 +01:00
Moonchild d5c6e20e9e Merge branch 'master' into release 2024-12-01 20:52:12 +01:00
Moonchild 89b36775fb Merge branch 'master' into release 2024-11-29 10:21:36 +01:00
Karl Tomlinson df16df5693 Bug 1920800 - Remove oldImages from check for flushed old principal handle
The logic should be equivalent when frame IDs on aImages are contiguously
increasing from IDs on previously set frames.

There are currently no callers passing empty aImages, but the logic in this
case would now be as described in the documentation of
UpdatePrincipalHandleForFrameID():

> We will notify mElement that aPrincipalHandle has been applied when all
> FrameIDs prior to aFrameID have been flushed out.
2024-10-31 11:44:56 +01:00
Moonchild aa1fd576ac Issue #2648 - Inherit the content disposition of the multipart response 2024-10-30 10:54:11 +01:00
Moonchild 2512188ca7 Issue #2648 - Apply CSP to documents sent through multipart/x-mixed-replace 2024-10-30 10:54:04 +01:00
Moonchild 89e88ca6a0 Merge branch 'master' into release 2024-10-02 19:45:47 +02:00
Moonchild 2697dd162f [js xpconnect] Fix error handling in xpc::CreateSandboxObject 2024-09-05 10:13:09 +02:00
Moonchild 53a4179c4a [js] Simplify with-env handling in FetchName 2024-09-05 10:13:01 +02:00
Moonchild a120731ddd [DOM] Stop exposing NotifyPaintEvent to web content.
There's no reason this should be available to the web, as it's an
indicator of browser internals.
2024-09-05 10:12:55 +02:00
Moonchild bda611a41a Revert "Issue #2523 - Part 1 - Import headers from FFmpeg 7.0"
This reverts commit 27bb48deaf.
2024-09-03 13:03:20 +02:00
Moonchild 5a02a4a1a4 Revert "Issue #2523 - Part 2 - Update audio & video decoders to work with FFmpeg 7.0"
This reverts commit 7dbc24a739.
2024-09-03 13:03:12 +02:00
Moonchild e59f358b45 Revert "Issue #2527 - Part 1 - Remove old FFmpeg and LibAV headers"
This reverts commit b970fc412a.
2024-09-03 13:02:55 +02:00
Moonchild 90c9535b39 Revert "Issue #2527 - Part 2 - Remove support for libavcodec < 58"
This reverts commit 738c6a740a.
2024-09-03 13:02:46 +02:00
Moonchild ad778bbfdb Revert "Issue #2527 - Part 3 - Remove additional checks for LibAV"
This reverts commit b0f872c919.
2024-09-03 13:02:31 +02:00
Moonchild 8868552b24 Merge branch 'master' into release 2024-08-09 19:35:34 +02:00
Moonchild 66826eb487 Merge branch 'master' into release 2024-08-09 19:18:02 +02:00
Moonchild 39127b5ee9 Merge branch 'master' into release 2024-08-09 16:18:50 +02:00
Moonchild 80cff816a8 Merge branch 'master' into release 2024-08-09 15:56:36 +02:00
Moonchild e9dda8dafa Merge branch 'master' into release
# Conflicts:
#	security/nss/doc/rst/releases/index.rst
#	security/nss/lib/nss/nss.h
#	security/nss/lib/softoken/softkver.h
#	security/nss/lib/util/nssutil.h
2024-08-07 20:13:00 +02:00
Moonchild 11fc818dfb [DOM/network] Disable DNS prefetching if document nodePrincipal is systemPrincipal 2024-07-10 10:54:53 +02:00
Moonchild 84ed844e3f [IPC] Clean up control flow in WaitableEvent. 2024-07-10 10:54:43 +02:00
Moonchild 50af804f1c [network] Add additional cookie setting checks.
Added checks for sub-document navigations from cross-site to same-site in
third-party checks when setting a cookie.
2024-07-10 10:54:37 +02:00
Moonchild 82ce93bce9 No issue - Update SQLite to 3.46.0 2024-07-10 10:54:24 +02:00
Moonchild 228abc8259 No issue - Update NSS to 3.90.3 2024-07-10 10:54:17 +02:00
Moonchild 1692fa5291 Issue #2045 - Temporarily force hidden elements to be actually hidden.
For the time being, because we don't have `revert` yet, we should force
normally hidden elements to be hidden, so they aren't revealed by sites
using the bad practice of `*{ }` style blanking rules but then using
`revert` to re-hide them.
2024-07-10 10:54:02 +02:00
Moonchild bb58c6ae38 Issue #2541 - Deal with empty LineNameList in CSS grid templates.
Resolves #2541
2024-07-02 01:39:01 +02:00
Moonchild 4f58dc27f9 Re-synchronize branches, picking up 2 commits that were not correctly merged. 2024-06-16 12:32:02 +02:00
Moonchild fc5324b9f7 Issue #2532 - Align dialog submission triggered by form.submit() with the spec.
Submission in click handler of submit button should not be deferred
per https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-dialog

See Bug 1719872
2024-06-15 17:56:37 +02:00
Moonchild 561f65aabf Issue #2532 - Prevent unwanted text selection when backdrop is clicked. 2024-06-15 17:56:31 +02:00
Moonchild 9acfe36b95 Issue #2532 - Don't do PreventDefault for escape key if <select> dropdown is not shown
We always use PreventDefault for <select> element, which is problematic if modal
dialog is on as it prevents cancelling the dialog. We fix it by not blocking the
default action if <select> is not shown.

See Bug 1649278
2024-06-15 17:56:25 +02:00
Moonchild ce495cbd85 Issue #2532 - Fix a null pointer crash while doing dialog form submission
See Bug 1652699
2024-06-15 17:56:20 +02:00
Moonchild c44020f188 Issue #2532 - Default pref check to true 2024-06-15 17:56:15 +02:00
Moonchild 35e7a695af Issue #2532 - Implement form[method=dialog]
See bug 1557303
2024-06-15 17:56:08 +02:00
Moonchild 7a55055d22 Merge branch 'master' into release 2024-06-13 21:31:39 +02:00
Moonchild 061900b87f [gfx] Use calloc for cairo font-creation functions. 2024-05-23 13:48:18 +02:00
Moonchild abe32f7309 [gfx] Ensure font entry's unitsPerEm and font extents are initialized when gfxFont is created. 2024-05-23 13:48:11 +02:00
Moonchild 7bfd4c7fe7 [DOM] Clean up ReportLoadError and normalize error messages. 2024-05-23 13:48:04 +02:00
Moonchild 859d6a3e2c [gfx] Clear mSharedBlobData if blob creation failed. 2024-05-23 13:47:58 +02:00
Moonchild c2f05f99af [network] Make http digest auth cnonce length configurable. 2024-05-23 13:47:50 +02:00
Moonchild 55b33fb02b Merge branch 'master' into release 2024-04-19 22:05:10 +02:00
Moonchild c247e40d41 Revert "Update NSS to 3.90.2"
This reverts commit b1cb7e0a8f.
2024-03-23 07:45:56 +01:00
Moonchild 05c58f159d Revert "Undo build system change from NSS update to fix missing command-line utils."
This reverts commit 67d5fefcf2.
2024-03-23 07:45:40 +01:00
Moonchild 67d5fefcf2 Undo build system change from NSS update to fix missing command-line utils. 2024-03-21 21:53:57 +01:00
Moonchild aad017be9e [MFBT] Make move assignment of RefPtr have the same behavior as nsCOMPtr 2024-03-20 19:52:30 +01:00
Moonchild 4543dbf3ff [parser] Specialize AddAttributes for <html>/<body>. 2024-03-20 19:52:24 +01:00
Moonchild b1cb7e0a8f Update NSS to 3.90.2 2024-03-20 19:52:08 +01:00
Moonchild 1c6d21c97d [network] Block set-cookie from multipart/x-mixed-replace 2024-02-22 23:20:07 +01:00
Eitan Isaacson fc42fb38c9 [layout] Process pairs in coord list in PolyArea.
Range -1 assures the array is even with a step size of 2, avoiding lone
value processing.
2024-02-22 23:19:59 +01:00
Jens Stutte 618068c15b [DOM] Check if WorkerRunnable::Run runs on top of WorkerThreadPrimaryRunnable::Run in a worker thread. 2024-02-22 23:19:53 +01:00
FranklinDM 808516a0a8 No issue - Replacing location might throw NS_ERROR_UNEXPECTED while the developer tools window is being destroyed 2024-02-22 23:19:45 +01:00
FranklinDM 7d6b806040 No issue - Remove leftover doorhanger code from the developer tools
Partially based on reverting https://bugzilla.mozilla.org/show_bug.cgi?id=1078539
2024-02-22 23:19:38 +01:00
Martok 6b4e2c9d73 Issue #2453 - Follow-Up: Use hard-coded minimum timer interval in workers.
From the spec: "If nesting level is greater than 5, and timeout is less than 4, then set timeout to 4.",
therefore not having it user-configurable doesn't really break anything.
2024-02-22 23:19:20 +01:00
Moonchild 787883f6a4 Disable URL-paste content loading by default.
See https://repo.palemoon.org/MoonchildProductions/Pale-Moon/issues/1957
2024-02-22 23:18:36 +01:00
Moonchild 7f02753c04 Issue #2465 - Do not use our in-tree metrics hints if using system-cairo
Use a somewhat equivalent font-options instance when using the
system-supplied cairo lib, instead of our in-tree extension.

Resolves #2465
2024-02-07 21:40:55 +01:00
Moonchild 8fa38b3445 Issue #618 - Follow-up: Fix missed constant refactor preventing ExportEntries from working. 2024-02-07 21:40:29 +01:00
Moonchild 541c5f9f45 Merge branch 'master' into release 2024-01-25 15:55:20 +01:00
Moonchild 4b6bd4976a Merge branch 'master' into release
# Conflicts:
#	modules/libpref/init/all.js
2024-01-25 09:09:51 +01:00
Moonchild a0843d52b4 Revert "[XPCOM] Compare return value of readlink in nsLocalFileUnix::GetNativeTarget"
This reverts commit 188f61505f.
2023-12-21 14:03:31 +01:00
Kershaw Chang 977a8cbed8 Bug 1736385 - Make sure thread is alive in CacheIOThread::ThreadFunc 2023-12-21 11:44:50 +01:00
Moonchild 1e85085305 [dom] Better handling of aborted websocket workers.
Catch the case where we are in worker-shutdown but are still connecting
and make filing and closing connections a bit more robust with a RefPtr.
2023-12-21 11:44:42 +01:00
Barret Rennie 188f61505f [XPCOM] Compare return value of readlink in nsLocalFileUnix::GetNativeTarget 2023-12-21 11:44:32 +01:00
Moonchild a514d7f6a4 [layout] Always check against fragment length in nsTextFrame 2023-12-21 11:44:21 +01:00
Moonchild 47c2c75ceb Bug 1868901 2023-12-21 11:44:12 +01:00
Moonchild 7082ec8a9a No issue - Allow redirects for requests that require preflight
Spec update, see Bug 1312864
2023-12-21 11:43:58 +01:00
Brian Smith 2907a84362 Issue #2387 - Remove a missed AddRef() which could cause leaks.
Update comments explaining how the reference counting works.
2023-12-10 23:58:08 +01:00
Brian Smith b8d1ee05c3 Issue #2387 - Collection of fixes related to a crash while canceling a dynamic import.
Add AddRef/Release hooks for embedding's script or module private value and set this script source object where appropriate.
https://bugzilla.mozilla.org/show_bug.cgi?id=1519140 Partial, no Value passing changes.
Clear the list of dynamic import requests after cancelling them in ScriptLoader::ParsingComplete as we do for other requests.
https://bugzilla.mozilla.org/show_bug.cgi?id=1291535
ScriptLoader::OnStreamComplete never returns a failure.
https://bugzilla.mozilla.org/show_bug.cgi?id=1627275
Also cancel the correct kind of parser for Modules.
2023-12-10 23:57:54 +01:00
Moonchild 0b625e624a [DOM] Fix double-free crash in MessagePort.cpp 2023-12-10 17:02:28 +01:00
Moonchild a4da712f91 Issue #2281 - Exclude throw wrapping on modern libcpp.
As discussed.
2023-11-25 18:17:35 +01:00
Moonchild 185f124e87 Issue #2381 - Remove system-nspr/nss leftovers (release port) 2023-11-25 17:15:01 +01:00
Moonchild 8633077691 [WebGL] Flip the validation state for gl_KHR_no_validation.
The original state was inverted due to confusion due to a double
negative (not:no_error).
This validation should only be enabled on Windows (for now).
Future tracking and discussion in BZ 1862039
2023-11-24 12:24:55 +01:00
Moonchild 39a1899045 [DOM] Improve MessagePort state machine. 2023-11-24 12:24:32 +01:00
Moonchild 4dc011a187 [Network] Fix relative URL path starting with multiple slashes 2023-11-24 12:24:19 +01:00
Moonchild ccb12e1dda [DOM] Check if rootDoc is secure context for web compat 2023-11-24 12:24:04 +01:00
Moonchild 63f0d3e295 [WebGL] Turn on more validation/error checking in webgl (when not on Win) 2023-11-24 12:23:49 +01:00
Moonchild 09d598c496 Revert "No Issue - add mutex in EventSource"
This reverts commit 10b3237e52.

Apparently causes deadlocks in Linux.
2023-11-15 12:22:11 +01:00
Moonchild 7e60482d80 No issue - Stop supporting data: scheme in SVG <use> elements. 2023-11-14 12:42:58 +01:00
Moonchild 10b3237e52 No Issue - add mutex in EventSource
Potentially avoids a gc crash when load is high.
2023-11-14 12:42:26 +01:00
athenian200 99af7cc028 Issue #1824 - Support SunOS Linker mapfiles.
Generating OS-appropriate mapfiles from a provided SYMBOL_FILE is
apparently required to work with newer ffvpx. Nothing else in our
codebase actually seemed to require it. Also seems to reduce the amount
of console spam I see relating to symbol visibility during the build
process, and I think it even makes libxul.so link a bit faster.
2023-11-04 01:47:00 -05:00
athenian200 76b360b5d1 Issue #1824 - Move to GCC 10.
It seems to work, but it is a lot slower than compiling with GCC 7.
2023-11-04 01:38:20 -05:00
Moonchild 4001b58a3e [DOM] For now, use C++11 static_asserts only.
Single-param static_assert is C++17 or later.
Follow-up to 3d92b82125
2023-10-27 14:20:10 +02:00
Moonchild 134a8aac87 Issue #35 - Follow-up: undo locale changes so they aren't pre-processed.
Pre-processing loses our localization notes and licensing headers for
l10n which is not a good thing. It's not a big deal having a few unused
strings in these files in the resulting locales.
2023-10-26 22:47:13 +02:00
Moonchild 3e2e48872a Merge branch 'master' into release 2023-10-25 22:51:58 +02:00
Moonchild 622b43cbc5 Merge branch 'master' into release 2023-10-25 22:49:37 +02:00
Moonchild 75b44ef620 Merge branch 'master' into release
# Conflicts:
#	js/src/wasm/WasmBinaryIterator.cpp
#	media/libvpx/vp8/encoder/onyx_if.c
2023-10-05 23:43:10 +02:00
Basilisk-Dev 00084ea49c Cherry-pick upstream libvpx fix
Backport of https://hg.mozilla.org/releases/mozilla-esr115/rev/5241232a3292943bd59ff1704eab60fee3cbc9d1
Addresses CVE-2023-5217
2023-09-28 16:18:01 +02:00
Moonchild b6fae24296 [network] Refactor TransactionObserver::OnDataAvailable() 2023-09-27 21:55:28 +02:00
André Bargull 13c6b7422d [js] Handle dead wrappers 2023-09-27 21:55:19 +02:00
Moonchild 24f2e663cd Restore incorrect SIMD Op removals. 2023-09-25 10:48:42 +02:00
Brian Smith f96b155988 Issue #2313 - Implement WebAssembly sign extension opcodes. (uplift) 2023-09-25 10:46:25 +02:00
Brian Smith d5cc24e916 Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Doubles in Ion. 2023-09-20 03:34:06 +02:00
Brian Smith 8eba271c5f Issue #2308 & #1240 Follow-up - Replace JSOP_POS in ++/-- with JSOP_TONUMERIC.
https://bugzilla.mozilla.org/show_bug.cgi?id=1519135
2023-09-20 03:33:57 +02:00
Brian Smith 19955c82b3 Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Ion on Intel32/64. 2023-09-20 03:33:50 +02:00
Brian Smith 80ae8aec7c Issue #2308 & #1240 Follow-up - Add BigInt support to JSOP_INC and JSOP_DEC.
https://bugzilla.mozilla.org/show_bug.cgi?id=1526309
2023-09-20 03:33:41 +02:00
Brian Smith d8441d7c81 Issue #2308 & #1240 Follow-up - Introduce new increment and decrement operations.
https://bugzilla.mozilla.org/show_bug.cgi?id=1508521
2023-09-20 03:33:33 +02:00
Brian Smith c2446f2478 Issue #2308 - Fix JSON BigInt regressions.
https://bugzilla.mozilla.org/show_bug.cgi?id=1522433
2023-09-20 03:33:23 +02:00
Brian Smith 6efb7a1904 Issue #2282 - Performance observer safety checks.
Both fixes from later revisions, without the Dispatch API changes.
2023-09-20 03:33:14 +02:00
Brian Smith fa0b03a10f Issue #2026 Follow-up: Fill in missing BigInt64 cases in js::IsTypedArrayConstructor().
Hopefully fixes RSA errors on ProtonMail.
2023-09-20 03:32:41 +02:00
Moonchild 3ae2972950 Issue #2309 - Cherry-pick upstream libwebp fix.
Backport of: https://chromium.googlesource.com/webm/libwebp.git/+/2af26267cdfcb63a88e5c74a85927a12d6ca1d76

Resolves #2309
2023-09-13 10:22:50 +02:00
Moonchild 2d48de9998 Merge branch 'master' into release 2023-09-01 15:44:29 +02:00
Moonchild 3b029cdfe4 Merge branch 'master' into release 2023-07-15 16:01:39 +02:00
Moonchild ea9077a8a5 Merge branch 'master' into release 2023-07-07 19:41:06 +02:00
Moonchild b4af6b6265 No issue - Set the default for incremental cycle collector to be off.
Negative performance impact if enabled.
2023-06-05 21:17:24 +02:00
Moonchild ae1d53ceb1 Issue #2257 - Remove rematerialized frames after bailouts and exceptions.
This ensures that rematerialized frames used by the devtools debugger
are properly removed so that no stale data is used during bailouts.
2023-06-05 21:17:13 +02:00
Brian Smith c3f4709d5e Issue #2252 - Prevent crash when attempting to load a script with execution disallowed.
This issue is due to the ExecutionContext added in Issue #1691 not handling GetScript()
in a context where script execution is not allowed.  This expressed itself in crashes when
playing MP4s with the NoScript extension installed and enabled.
2023-06-05 21:16:57 +02:00
FranklinDM a7bb3fc175 Issue #1592 - Follow-up: Ensure topmost scope marker is cleaned up 2023-06-05 21:16:43 +02:00
FranklinDM 6a0203f25f Issue #2250 - Part 2: Ignore the ancestor filter assertion if rule matching is restricted or if the current element is under a shadow host
This only affects debug builds.
2023-06-05 21:16:31 +02:00
FranklinDM b0dfcb147f Issue #2250 - Part 1: Return early if the element being tested for is likely an ancestor and does not have an assigned slot 2023-06-05 21:16:22 +02:00
Job Bautista 06fd4c9357 Issue #2221 - Follow-up: Simplify jit_ioncheck{1|2|3}_deunified_sources assignment. 2023-06-05 21:15:52 +02:00
Job Bautista b9ea7fd9ee Issue #2221 - Follow-up: Ensure jit_ioncheck{1|2|3}_deunified_sources is defined.
Should fix build bustage in armhf, as well as prevent bustage in mips32.
2023-06-05 21:15:33 +02:00
Moonchild 58308a5c7a Merge branch 'master' into release
# Conflicts:
#	python/mozbuild/mozpack/dmg.py
2023-05-11 17:35:14 +02:00
Brian Smith 88c7d54975 No Issue - Fix FreeBSD build failure with WebRTC enabled. (release uplift)
Tag #2227
2023-05-01 22:12:11 +02:00
Timothy Valldeperas eadb5678b3 Issue #2175 - Fix build bustage in WebRTC. (release uplift)
Resolves #2227
2023-05-01 19:04:57 +02:00
Moonchild 54e3e60796 Revert "[devtools] Don't allow sourcemap URLs to redirect"
This reverts commit 2a05494abe.
2023-04-17 10:25:45 +02:00
Moonchild 2a05494abe [devtools] Don't allow sourcemap URLs to redirect 2023-04-13 10:54:34 +02:00
Moonchild bc89e58def [network] Improve checks while parsing MIME parameters. 2023-04-13 10:54:27 +02:00
Moonchild 3a009b97f6 Issue #1911 - Follow-up: Filter out illegal characters in more locations. 2023-04-13 10:54:10 +02:00
Moonchild a105f6d5e9 No issue - Fix off-by-one of kLargeDatasetSize 2023-04-13 10:54:02 +02:00
Sandra 5db241c0c0 Increase size of data over which we write the data to disk rather than keep it around in memory 2023-04-13 10:53:53 +02:00
Sandra d38dca10e5 Use nsAnonymousTemporaryFile for clipboard cache
Base on https://github.com/mozilla/gecko-dev/commit/ecc04a9245b409d7eed7df63ba733cd2073180de
2023-04-13 10:53:14 +02:00
Moonchild 54fc723126 Issue #2180 - Follow-up: Move sentinel check up a bit. 2023-04-02 15:39:05 +02:00
Moonchild 9b8ca17ee4 Issue #2180 - Add pref to control NSS TLS 1.3 protocol downgrade sentinel 2023-04-02 15:38:57 +02:00
Moonchild cddc95b39b Issue #2176 - Don't reconstruct the parent when tearing down
display:contents nodes with pseudo-elements.

We need to use StyleChildrenIterator which iterates over them, instead.
This is a bit of a hack but we can't always have our cake.

We need to be a bit careful though, since ::before and ::after are owned
by their own frame, and thus could be unbound from the tree or even dead
after removing the frame.

This basically ports bugs 1435566 and 1438467
2023-04-02 15:38:31 +02:00
Moonchild 5676529793 Issue #2171 - Skip over shadow nodes that don't have an owning node.
Resolves #2171
2023-04-02 15:37:44 +02:00
Moonchild ce68156cf4 Revert "[widget] Linux GTK3: Detach accessible from moz_container before it's deleted"
This reverts commit 465a18f342.
Resolves #2168
2023-03-18 19:57:56 +01:00
Moonchild 5032ad9593 Issue #2117 - Follow-up: Run precomplete cmd during package staging
We rely on this for all OSes except Mac where precomplete should not
be in the root (it uses Mozilla's fallback packaging that places it in
$RESPATH)
2023-03-17 22:11:30 +01:00
Moonchild b55f765f2e Issue #1911 - Follow-up: Filter out illegal file extensions also.
We already did this for file names, just not extensions.
2023-03-17 12:02:55 +01:00
Moonchild 856078d435 [widget] Linux GTK3: Detach accessible from moz_container before it's deleted 2023-03-17 12:02:46 +01:00
Moonchild c74c262d2f [GFX] Add some sanity checks and clamps to SurfaceData calculations. 2023-03-17 12:02:38 +01:00
Moonchild 787e29e374 No Issue - Ensure more OsiSpace
ensureOsiSpace(); was very much under-used. This adds more instances
where it makes sense to ensure Osi space before placing masm calls.
2023-03-17 12:02:31 +01:00
FranklinDM e439896c9b Issue #2148 - Shrink Vector from (usually) four pointers in size to three
when no inline storage is used.

See Bug 1338374
2023-03-17 12:02:20 +01:00
FranklinDM 15b508f1fb Issue #2148 - Make Vector not use AlignedStorage for its inline element storage
See Bug 1338374 1/2
2023-03-17 12:02:12 +01:00
Job Bautista 5651ebfc76 Issue #2148 - Discard RegExpShared data tables when discarding regexp JIT code.
Based on Mozilla bug 1378736's part 2.
Should fix the double-free.
Follow-up for #2083
2023-03-17 12:02:04 +01:00
Job Bautista 593bfc1ce8 Issue #2148 - Don't null out RegExpObject -> RegExpShared pointer on GC.
Follow-up for issue #2083.
Taken from Mozilla bug 1378736.
2023-03-17 12:01:50 +01:00
Brian Smith 28953cda7a Issue #2160 - Initial support for notarizing during DMG package.
Added --with-macbundle-idenity configure option to set a codesign identity.
If no identity is set or cross-compiling from Linux no codesigning will be
done. Currently doing a full deep bundle v2 sign, instead of limited v1.
2023-03-15 15:10:52 +01:00
Moonchild 516f3f545d Merge branch 'master' into release
# Conflicts:
#	CLOBBER
#	js/src/vm/RegExpObject.cpp
#	security/nss/lib/nss/nss.h
#	security/nss/lib/pkcs12/p12d.c
#	security/nss/lib/softoken/softkver.h
#	security/nss/lib/util/nssutil.h
2023-03-13 13:11:20 +01:00
Moonchild 83aff65a42 Force clobber 2023-02-19 17:53:31 +01:00
Moonchild 5bd97df957 [NSS] Update NSS to 3.52.9 to pick up fixes. 2023-02-19 17:51:26 +01:00
Moonchild 8772711181 [DOM] Check whether module load request was already cancelled when a load fails 2023-02-19 17:51:18 +01:00
Moonchild dc9526f4c6 [widget] Properly test for and handle errors in target-surface creation
and mapping.
2023-02-19 17:51:10 +01:00
Moonchild 9ab36e7ae0 Issue #2103 - Fix typo in RegExp Parser
This corrects the typo where the left-hand character would determine if
the right-hand character would be added or not.

Resolves #2103
2023-02-02 10:50:47 +01:00
Job Bautista e8d30841e7 Issue #2091 - Parse \p{Extended_Pictographic} too.
This is essentially a follow up to Issue #1286. We already have
 UCHAR_EXTENDED_PICTOGRAPHIC in our in-tree ICU, so there's no reason to comment
 this case out.
2023-01-27 05:01:53 +01:00
Martok 9faf29374e Issue #2093 - Trace HeapPtr<RegExpShared::groupsTemplate_> for GC move/compact events, regression from #2072 2023-01-26 20:11:28 +01:00
Moonchild 75e4818d36 Merge branch 'master' into release 2023-01-19 00:42:00 +01:00
Moonchild a65144e9e0 Fix merge conflicts. 2023-01-13 12:55:52 +01:00
Moonchild 4f29548526 Merge branch 'master' into release
# Conflicts:
#	image/decoders/nsJXLDecoder.cpp
#	js/src/irregexp/NativeRegExpMacroAssembler.cpp
#	js/src/irregexp/RegExpAST.h
#	js/src/irregexp/RegExpEngine.cpp
#	js/src/irregexp/RegExpParser.cpp
#	js/src/irregexp/RegExpParser.h
#	xpcom/io/nsLocalFileUnix.cpp
2023-01-13 12:11:56 +01:00
Moonchild 528db2cbd8 Issue #1818 - Remove obsolete path hack in widget code. 2022-12-16 09:13:48 +00:00
Moonchild 84e6bcc1e6 [network] Align cookie checks with RFC 6265 (bis) 2022-12-16 09:13:38 +00:00
Moonchild 0dc9ff518d [libjar] Add some extra sanity checks to our Zip reader. 2022-12-16 09:13:25 +00:00
Moonchild a2e3bd44aa [network] move some generic websocket code to the baseclass 2022-12-16 09:13:09 +00:00
Moonchild 163a0e7caf Revert "Issue #1279 - Implement regular expressions lookbehind (v2)"
This reverts commit d10e8a5b06.
2022-12-15 09:11:02 +00:00
Moonchild 49a86db5f3 Issue #2040 - Pre-multiply the alpha values in our JXL decode buffer. (uplift)
Using selective calculation (only if not opaque) and fast integer
math here should optimize well in compilers.
2022-12-15 09:09:19 +00:00
Moonchild 2640953d8b Issue #2019 - Follow-up: Make nsPluginInstanceOwner also listen to keypress events in the system event group.
nsPluginInstanceOwner only listens to keypress events in the default event group.
However, in our changed operating mode, keypress events are not fired in the
default event group if the key does not result in something printable.
This means that nsPluginInstanceOwner should also listen to keypress events
in the system event group and should handle each keypress that way, but
only once. I.e., if a printable keypress event is received in the system event
group, it should be ignored, since it would've already been handled in the
default event group in that case.
2022-11-26 18:18:09 +00:00
Moonchild 7eb7d67f7a Issue #2033 - Temporary fix of R<->B channel swap.
We have a BGR/RGB channel ordering mismatch here. to at least
provide proper display, a quick&dirty byte swap on the output
buffer will fix this for now, but we should look into seeing where
the surface mismatch is caused.
std::swap() should optimize pretty well in any of the used
compilers, but if necessary, a full buffer ASM routine can be
slotted in (although on current hardware I doubt this will be
even noticeable as it is)
2022-11-26 02:43:18 +00:00
Moonchild e28860ba7f Revert "[XPCOM] Deal with lstat potentially lying in nsLocalFileUnix."
This reverts commit c127f58ef3.
2022-11-20 14:14:48 +00:00
Moonchild 49a96b1d91 Merge branch 'master' into release 2022-11-19 20:15:23 +00:00
Moonchild 3130812693 Merge branch 'master' into release 2022-11-12 18:34:07 +00:00
Moonchild 71ae69aea8 [WebGL] Implement webgl.max-size-per-texture-mib 2022-10-26 14:50:05 +00:00
Moonchild 9e34d697c7 [XPCOM] Fix Base64 off-by-one issue and safeguard against this mistake in the future. 2022-10-26 14:49:55 +00:00
Moonchild 8fa9125d02 [No issue] Hold some strong references on nsRefreshDriver 2022-10-26 14:49:46 +00:00
Brian Smith 4b4488c3e4 Issue #2022 - Part 2 - Add Ventura version detection.
Also add Monterey and Ventura to the graphics driver blocklist.
2022-10-26 14:49:33 +00:00
Brian Smith 248db7d301 Issue #2022 - Part 1 - Fix transparent windows on MacOS 13 Ventura.
During the BaseWindow creation contenView is nil on Ventura...
So create a NSView with the requested dimensions and set is as the contenView.
2022-10-26 14:49:23 +00:00
Moonchild e199f2949b [No issue] Ensure LockImpl::Try() returns the correct bool value. 2022-10-26 14:45:39 +00:00
Moonchild 456b5450a4 Issue #2010 - Ensure raw tagnames are safe exiting internalEntityParser
This resolves #2010
2022-09-28 13:50:10 +00:00
Moonchild d8e629c4a3 Merge branch 'master' into release 2022-09-27 20:12:40 +00:00
Moonchild 4898c4f297 Merge branch 'master' into release 2022-09-24 12:16:59 +00:00
Moonchild 7cd578bbc6 Merge branch 'master' into release 2022-09-22 13:16:48 +00:00
Moonchild 1e91df628a Merge branch 'master' into release 2022-09-22 11:52:16 +00:00
Moonchild b110549cbd Merge branch 'master' into release 2022-07-27 06:07:45 +00:00
Moonchild 971047835a Merge branch 'master' into release
# Conflicts:
#	config/milestone.txt
#	toolkit/mozapps/extensions/internal/XPIProvider.jsm
2022-07-25 20:47:06 +00:00
Moonchild dd4d9eb032 [XPCOM] Crash safely when TArray replacements are OOB.
In the unlikely event of TArray element replacement calls are OOB, crash safely
with a debug breakpoint instead of corrupting memory.
2022-07-03 15:49:44 +00:00
Moonchild 8b94f1e480 [DOM] use the sanitizer to restrict href in svg:use to fragment-only URLs 2022-07-03 15:49:34 +00:00
Moonchild c89610a5c7 [network] Clear PAC loader when the load failed 2022-07-03 15:49:23 +00:00
Moonchild 217963cbed Update NSS to 3.52.7 2022-07-03 15:49:14 +00:00
Moonchild c4f4e18340 [DOM media] Remove potentially unsafe type accesses when debug logging 2022-07-03 15:49:04 +00:00
Moonchild 8a7c0e7345 [network] Clean up and update the list of external protocol handlers. 2022-07-03 15:48:54 +00:00
Moonchild 52e304d450 Issue #1053 - Follow-up: Correct conditional define on POSIX systems. (uplift)
This conditional was incorrectly changed when removing Android support.
This potentially causes issues on Linux systems by not using pthreads correctly,
which may lead to high idle CPU usage.
2022-06-28 13:28:20 +00:00
Moonchild cfc0eeca53 Revert "Issue #1909 - Guard against empty update manifest URL"
This reverts commit d7fadcdef9.
2022-06-07 11:59:07 +00:00
Moonchild ebd3dd9228 Merge branch 'master' into release 2022-06-03 21:50:44 +00:00
Moonchild cb40e4e7ef Merge branch 'master' into release 2022-06-01 13:54:11 +00:00
Moonchild 662dba55fd Merge branch 'master' into release 2022-05-29 11:13:44 +00:00
Moonchild 8760ce023c Issue #1895 - Implement queueMicroTask(callback()) (uplift) 2022-05-07 14:40:14 +00:00
Moonchild b86e148bb7 Roll back milestone version to release. 2022-05-06 12:43:43 +00:00
Moonchild 9e83721e5e Merge branch 'master' into release 2022-05-06 12:43:00 +00:00
Moonchild dc2d6c2e60 Revert "No Issue - Make content-type on JAR channels behave the same as HTTP channels."
This reverts commit 425677ada7.
2022-05-03 17:38:19 +00:00
Moonchild 4ada6f6762 Update 7zSD for v31 2022-05-03 17:38:12 +00:00
121 changed files with 24078 additions and 13728 deletions

No files matched your search

@@ -276,6 +276,7 @@ NotificationController::DropMutationEvent(AccTreeMutationEvent* aEvent)
MOZ_ASSERT(hideEvent);
if (hideEvent->NeedsShutdown()) {
mDocument->UncacheChildrenInSubtree(aEvent->GetAccessible());
mDocument->ShutdownChildrenInSubtree(aEvent->GetAccessible());
}
}
+2
View File
@@ -1307,6 +1307,8 @@ DocAccessible::UnbindFromDocument(Accessible* aAccessible)
{
NS_ASSERTION(mAccessibleCache.GetWeak(aAccessible->UniqueID()),
"Unbinding the unbound accessible!");
MOZ_ASSERT(!mARIAOwnsHash.Contains(aAccessible),
"Container still lingering in mARIAOwnsHash");
// Fire focus event on accessible having DOM focus if active item was removed
// from the tree.
-1
View File
@@ -23,7 +23,6 @@ SOURCES += [
'DocAccessibleWrap.cpp',
'EnumVariant.cpp',
'HTMLTableAccessibleWrap.cpp',
'HTMLWin32ObjectAccessible.cpp',
'HyperTextAccessibleWrap.cpp',
'ImageAccessibleWrap.cpp',
'IUnknownImpl.cpp',
+1 -1
View File
@@ -26,6 +26,6 @@
global DATA_SYMBOL
%endif
SECTION .rodata align=16
SECTION .rodata data readable align=16
DATA_SYMBOL:
incbin ICU_DATA_FILE
+6
View File
@@ -6,7 +6,13 @@
.section .note.GNU-stack,"",%progbits
#endif
.global ICU_DATA_SYMBOL
#if defined(__APPLE__)
.const
#elif defined(__GNUC__) && !defined(XP_SOLARIS)
.section .rodata
#else
.data
#endif
.balign 16
ICU_DATA_SYMBOL:
.incbin ICU_DATA_FILE
+2
View File
@@ -17,6 +17,8 @@ DEFINES.update(
UCONFIG_NO_LEGACY_CONVERSION = True,
UCONFIG_NO_TRANSLITERATION = True,
UCONFIG_NO_REGULAR_EXPRESSIONS = True,
UCONFIG_NO_BREAK_ITERATION = True,
UCONFIG_NO_MF2 = True,
# We don't need to pass data to and from legacy char* APIs.
U_CHARSET_IS_UTF8 = True,
+17230 -8908
View File
File diff suppressed because it is too large. Load diff
+969 -295
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -31,6 +31,7 @@ public:
void
Unfollow();
/* Should this be WeakRef? */
RefPtr<AbortSignal> mFollowingSignal;
};
+2
View File
@@ -40,12 +40,14 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(Timeout)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Timeout)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTimer)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPrincipal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mScriptHandler)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Timeout)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrincipal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mScriptHandler)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+16
View File
@@ -25,6 +25,22 @@ VisualViewport::~VisualViewport()
{
}
NS_IMPL_CYCLE_COLLECTION_CLASS(VisualViewport)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(VisualViewport,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(VisualViewport,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(VisualViewport)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(VisualViewport, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(VisualViewport, DOMEventTargetHelper)
/* virtual */
JSObject*
VisualViewport::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+3
View File
@@ -21,6 +21,9 @@ class VisualViewport final: public mozilla::DOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(VisualViewport, DOMEventTargetHelper)
explicit VisualViewport(nsPIDOMWindowInner* aWindow);
explicit VisualViewport(nsIGlobalObject* aGlobal);
+19 -6
View File
@@ -695,7 +695,7 @@ nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
!MayContainRelevantNodes(aContainer) ||
(!aFirstNewContent->HasChildren() &&
!aFirstNewContent->GetNextSibling() &&
!MatchSelf(aFirstNewContent))) {
!MatchSelf<MatchSelfMode::Insertion>(aFirstNewContent))) {
return;
}
@@ -731,7 +731,7 @@ nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
// The new stuff is somewhere in the middle of our list; check
// whether we need to invalidate
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
if (MatchSelf(cur)) {
if (MatchSelf<MatchSelfMode::Insertion>(cur)) {
// Uh-oh. We're gonna have to add elements into the middle
// of our list. That's not worth the effort.
SetDirty();
@@ -788,7 +788,7 @@ nsContentList::ContentInserted(nsIDocument *aDocument,
if (mState != LIST_DIRTY &&
MayContainRelevantNodes(NODE_FROM(aContainer, aDocument)) &&
nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) &&
MatchSelf(aChild)) {
MatchSelf<MatchSelfMode::Insertion>(aChild)) {
SetDirty();
}
@@ -808,7 +808,7 @@ nsContentList::ContentRemoved(nsIDocument *aDocument,
if (mState != LIST_DIRTY &&
MayContainRelevantNodes(NODE_FROM(aContainer, aDocument)) &&
nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) &&
MatchSelf(aChild)) {
MatchSelf<MatchSelfMode::Removal>(aChild)) {
SetDirty();
}
@@ -853,6 +853,7 @@ nsContentList::Match(Element *aElement)
ni->Equals(mXMLMatchAtom, mMatchNameSpaceId);
}
template <nsContentList::MatchSelfMode Mode>
bool
nsContentList::MatchSelf(nsIContent *aContent)
{
@@ -864,8 +865,20 @@ nsContentList::MatchSelf(nsIContent *aContent)
return false;
}
if (Match(aContent->AsElement()))
auto matches = [&](Element* aElement) {
if (Match(aElement)) {
return true;
}
if constexpr (Mode == MatchSelfMode::Removal) {
return mFunc == nsContentUtils::MatchClassNames &&
aElement->IsSVGElement() && aElement->MayHaveClass();
}
return false;
};
if (matches(aContent->AsElement())) {
return true;
}
if (!mDeep)
return false;
@@ -873,7 +886,7 @@ nsContentList::MatchSelf(nsIContent *aContent)
for (nsIContent* cur = aContent->GetFirstChild();
cur;
cur = cur->GetNextNode(aContent)) {
if (cur->IsElement() && Match(cur->AsElement())) {
if (cur->IsElement() && matches(cur->AsElement())) {
return true;
}
}
+10
View File
@@ -367,6 +367,15 @@ protected:
* @return whether we match
*/
bool Match(mozilla::dom::Element *aElement);
enum class MatchSelfMode : uint8_t {
Insertion,
// Also accept SVG elements that may have a class. SMIL can change their
// class without notification, so they can be in the list without
// matching now. Needed when aContent leaves the subtree.
Removal,
};
/**
* See if anything in the subtree rooted at aContent, including
* aContent itself, matches our criterion.
@@ -374,6 +383,7 @@ protected:
* @param aContent the root of the subtree to match against
* @return whether we match something in the tree rooted at aContent
*/
template <MatchSelfMode Mode>
bool MatchSelf(nsIContent *aContent);
/**
+4 -3
View File
@@ -2073,6 +2073,10 @@ public:
aClasses);
}
static bool MatchClassNames(mozilla::dom::Element* aElement,
int32_t aNamespaceID,
nsIAtom* aAtom, void* aData);
/**
* Returns a presshell for this document, if there is one. This will be
* aDoc's direct presshell if there is one, otherwise we'll look at all
@@ -3012,9 +3016,6 @@ private:
static void DropFragmentParsers();
static bool MatchClassNames(mozilla::dom::Element* aElement,
int32_t aNamespaceID,
nsIAtom* aAtom, void* aData);
static void DestroyClassNameArray(void* aData);
static void* AllocClassMatchingInfo(nsINode* aRootNode,
const nsString* aClasses);
+1 -1
View File
@@ -921,7 +921,7 @@ private:
// List of nodes referred to by mEntryTable so we can sort them
// For a specific pseudo element, we use its parent element as the
// batch target, so they will be put in the same EntryArray.
nsTArray<nsINode*> mBatchTargets;
nsTArray<nsCOMPtr<nsINode>> mBatchTargets;
};
inline
+2 -1
View File
@@ -1738,8 +1738,9 @@ nsFocusManager::Blur(nsPIDOMWindowOuter* aWindowToClear,
if (mActiveWindow)
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
nsCOMPtr<nsIDocument> doc = content->GetComposedDoc();
SendFocusOrBlurEvent(eBlur, presShell,
content->GetComposedDoc(), content, 1,
doc, content, 1,
false, false, aContentToFocus);
}
+2
View File
@@ -2176,6 +2176,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHistory)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCustomElements)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVisualViewport)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSessionStorage)
@@ -2254,6 +2255,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHistory)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCustomElements)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVisualViewport)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocalStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSessionStorage)
if (tmp->mApplicationCache) {
+6 -3
View File
@@ -682,16 +682,19 @@ DataTransfer::SetDataAtInternal(const nsAString& aFormat, nsIVariant* aData,
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
nsAutoString format;
GetRealFormat(aFormat, format);
// Don't allow the custom type to be assigned.
if (aFormat.EqualsLiteral(kCustomTypesMime)) {
if (format.EqualsLiteral(kCustomTypesMime)) {
return NS_ERROR_TYPE_ERR;
}
if (!PrincipalMaySetData(aFormat, aData, aSubjectPrincipal)) {
if (!PrincipalMaySetData(format, aData, aSubjectPrincipal)) {
return NS_ERROR_DOM_SECURITY_ERR;
}
return SetDataWithPrincipal(aFormat, aData, aIndex, aSubjectPrincipal);
return SetDataWithPrincipal(format, aData, aIndex, aSubjectPrincipal);
}
void
+2 -1
View File
@@ -29,18 +29,19 @@ using namespace workers;
NS_IMPL_CYCLE_COLLECTING_ADDREF(Request)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Request)
NS_IMPL_CYCLE_COLLECTION_CLASS(Request)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Request)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHeaders)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSignal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Request)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHeaders)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Request)
+2 -1
View File
@@ -30,12 +30,12 @@ namespace dom {
NS_IMPL_CYCLE_COLLECTING_ADDREF(Response)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Response)
NS_IMPL_CYCLE_COLLECTION_CLASS(Response)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Response)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHeaders)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSignal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFetchStreamReader)
tmp->mReadableStreamBody = nullptr;
@@ -47,6 +47,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Response)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mHeaders)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFetchStreamReader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+4
View File
@@ -1132,6 +1132,7 @@ void HTMLMediaElement::AbortExistingLoads()
RemoveMediaElementFromURITable();
mLoadingSrc = nullptr;
mCORSMode = CORS_NONE;
mMediaSource = nullptr;
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING ||
@@ -1370,6 +1371,9 @@ void HTMLMediaElement::SelectResource()
// If we have a 'src' attribute, use that exclusively.
nsAutoString src;
if (mSrcAttrStream) {
// Media provider objects use local mode, so a previous URL load's CORS
// mode does not apply.
mCORSMode = CORS_NONE;
SetupSrcMediaStreamPlayback(mSrcAttrStream);
} else if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
nsCOMPtr<nsIURI> uri;
+5 -5
View File
@@ -117,11 +117,6 @@ public:
int32_t Index();
protected:
virtual ~HTMLOptionElement();
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
/**
* Get the select content element that contains this option, this
* intentionally does not return nsresult, all we care about is if
@@ -129,6 +124,11 @@ protected:
*/
HTMLSelectElement* GetSelect();
protected:
virtual ~HTMLOptionElement();
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
bool mSelectedChanged;
bool mIsSelected;
+3 -3
View File
@@ -732,10 +732,10 @@ bool
HTMLSelectElement::MatchSelectedOptions(Element* aElement,
int32_t /* unused */,
nsIAtom* /* unused */,
void* /* unused*/)
void* aData)
{
HTMLOptionElement* option = HTMLOptionElement::FromContent(aElement);
return option && option->Selected();
return option && option->Selected() && option->GetSelect() == static_cast<HTMLSelectElement*>(aData);
}
nsIHTMLCollection*
@@ -743,7 +743,7 @@ HTMLSelectElement::SelectedOptions()
{
if (!mSelectedOptions) {
mSelectedOptions = new nsContentList(this, MatchSelectedOptions, nullptr,
nullptr, /* deep */ true);
this, /* deep */ true);
}
return mSelectedOptions;
}
+25
View File
@@ -1415,6 +1415,7 @@ BackgroundFactoryRequestChild::BackgroundFactoryRequestChild(
uint64_t aRequestedVersion)
: BackgroundRequestChildBase(aOpenRequest)
, mFactory(aFactory)
, mDatabaseActor(nullptr)
, mRequestedVersion(aRequestedVersion)
, mIsDeleteOp(aIsDeleteOp)
{
@@ -1439,6 +1440,15 @@ BackgroundFactoryRequestChild::GetOpenDBRequest() const
return static_cast<IDBOpenDBRequest*>(mRequest.get());
}
void
BackgroundFactoryRequestChild::SetDatabaseActor(BackgroundDatabaseChild* aActor)
{
AssertIsOnOwningThread();
MOZ_ASSERT(!aActor || !mDatabaseActor);
mDatabaseActor = aActor;
}
bool
BackgroundFactoryRequestChild::HandleResponse(nsresult aResponse)
{
@@ -1450,6 +1460,11 @@ BackgroundFactoryRequestChild::HandleResponse(nsresult aResponse)
DispatchErrorEvent(mRequest, aResponse);
if (mDatabaseActor) {
mDatabaseActor->ReleaseDOMObject();
MOZ_ASSERT(!mDatabaseActor);
}
return true;
}
@@ -1468,6 +1483,7 @@ BackgroundFactoryRequestChild::HandleResponse(
IDBDatabase* database = databaseActor->GetDOMObject();
if (!database) {
databaseActor->EnsureDOMObject();
MOZ_ASSERT(mDatabaseActor);
database = databaseActor->GetDOMObject();
MOZ_ASSERT(database);
@@ -1475,6 +1491,8 @@ BackgroundFactoryRequestChild::HandleResponse(
MOZ_ASSERT(!database->IsClosed());
}
MOZ_ASSERT(mDatabaseActor == databaseActor);
if (database->IsClosed()) {
// If the database was closed already, which is only possible if we fired an
// "upgradeneeded" event, then we shouldn't fire a "success" event here.
@@ -1487,6 +1505,7 @@ BackgroundFactoryRequestChild::HandleResponse(
}
databaseActor->ReleaseDOMObject();
MOZ_ASSERT(!mDatabaseActor);
return true;
}
@@ -1507,6 +1526,8 @@ BackgroundFactoryRequestChild::HandleResponse(
DispatchSuccessEvent(&helper, successEvent);
MOZ_ASSERT(!mDatabaseActor);
return true;
}
@@ -1737,6 +1758,8 @@ BackgroundDatabaseChild::EnsureDOMObject()
mDatabase = mTemporaryStrongDatabase;
mSpec.forget();
mOpenRequestActor->SetDatabaseActor(this);
}
void
@@ -1748,6 +1771,8 @@ BackgroundDatabaseChild::ReleaseDOMObject()
MOZ_ASSERT(mOpenRequestActor);
MOZ_ASSERT(mDatabase == mTemporaryStrongDatabase);
mOpenRequestActor->SetDatabaseActor(nullptr);
mOpenRequestActor = nullptr;
// This may be the final reference to the IDBDatabase object so we may end up
+17
View File
@@ -254,6 +254,20 @@ class BackgroundFactoryRequestChild final
friend class PermissionRequestParent;
RefPtr<IDBFactory> mFactory;
// Normally when opening of a database is successful, we receive a database
// actor in request response, so we can use it to call ReleaseDOMObject()
// which clears temporary strong reference to IDBDatabase.
// However, when there's an error, we don't receive a database actor and
// IDBRequest::mTransaction is already cleared (must be). So the only way how
// to call ReleaseDOMObject() is to have a back-reference to database actor.
// This creates a weak ref cycle between
// BackgroundFactoryRequestChild (using mDatabaseActor member) and
// BackgroundDatabaseChild actor (using mOpenRequestActor member).
// mDatabaseActor is set in EnsureDOMObject() and cleared in
// ReleaseDOMObject().
BackgroundDatabaseChild* mDatabaseActor;
const uint64_t mRequestedVersion;
const bool mIsDeleteOp;
@@ -271,6 +285,9 @@ private:
// Only destroyed by BackgroundFactoryChild.
~BackgroundFactoryRequestChild();
void
SetDatabaseActor(BackgroundDatabaseChild* aActor);
bool
HandleResponse(nsresult aResponse);
+3 -1
View File
@@ -138,7 +138,9 @@ GetJSValFromKeyPathString(JSContext* aCx,
// only through getters but we still want to support them for key
// extraction. So they need to be handled manually.
Blob* blob;
if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, &obj, blob))) {
// UNWRAP_OBJECT calls might mutate this.
JS::Rooted<JSObject*> blobObj(aCx, obj);
if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, &blobObj, blob))) {
if (token.EqualsLiteral("size")) {
ErrorResult rv;
uint64_t size = blob->GetSize(rv);
+4
View File
@@ -265,6 +265,10 @@ VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
return false;
}
if (!ValidateBufferAndPicture(aBuffer, aPicture)) {
return false;
}
PlanarYCbCrData data = ConstructPlanarYCbCrData(aInfo, aBuffer, aPicture);
aVideoImage->SetDelayedConversion(true);
+21 -7
View File
@@ -187,7 +187,7 @@ public:
{
}
explicit VideoInfo(int32_t aWidth, int32_t aHeight)
VideoInfo(int32_t aWidth, int32_t aHeight)
: VideoInfo(nsIntSize(aWidth, aHeight))
{
}
@@ -201,7 +201,6 @@ public:
, mCodecSpecificConfig(new MediaByteBuffer)
, mExtraData(new MediaByteBuffer)
, mRotation(kDegree_0)
, mImageRect(nsIntRect(nsIntPoint(), aSize))
{
}
@@ -263,15 +262,28 @@ public:
nsIntRect ImageRect() const
{
if (mImageRect.width < 0 || mImageRect.height < 0) {
if (!mImageRect) {
return nsIntRect(0, 0, mImage.width, mImage.height);
}
return mImageRect;
return *mImageRect;
}
void SetImageRect(const nsIntRect& aRect)
{
mImageRect = aRect;
mImageRect = Some(aRect);
}
void ResetImageRect() {
mImageRect.reset();
}
// Adopts an image size decoded from the bitstream. The picture rectangle is
// expressed relative to the image size, so a change in size invalidates it
// and it is discarded; an unchanged size keeps the existing rectangle.
void AdoptImageSize(const gfx::IntSize& aImage) {
if (mImage != aImage) {
ResetImageRect();
}
mImage = aImage;
}
// Returned the crop rectangle scaled to aWidth/aHeight size relative to
@@ -332,9 +344,11 @@ public:
uint8_t mBitDepth = 8;
private:
friend struct IPC::ParamTraits<VideoInfo>;
// mImage may be cropped; currently only used with the WebM container.
// A negative width or height indicate that no cropping is to occur.
nsIntRect mImageRect;
// If unset, no cropping is to occur.
Maybe<nsIntRect> mImageRect;
// Indicates whether or not frames may contain alpha information.
bool mAlphaPresent = false;
+2 -3
View File
@@ -25,7 +25,7 @@ namespace IPC {
WriteParam(aMsg, aParam.mDisplay);
WriteParam(aMsg, aParam.mStereoMode);
WriteParam(aMsg, aParam.mImage);
WriteParam(aMsg, aParam.ImageRect());
WriteParam(aMsg, aParam.mImageRect);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
@@ -35,8 +35,7 @@ namespace IPC {
ReadParam(aMsg, aIter, &aResult->mDisplay) &&
ReadParam(aMsg, aIter, &aResult->mStereoMode) &&
ReadParam(aMsg, aIter, &aResult->mImage) &&
ReadParam(aMsg, aIter, &imageRect)) {
aResult->SetImageRect(imageRect);
ReadParam(aMsg, aIter, &aResult->mImageRect)) {
return true;
}
return false;
@@ -847,12 +847,15 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
RefPtr<layers::PlanarYCbCrImage> image =
new IMFYCbCrImage(buffer, twoDBuffer);
VideoData::SetVideoDataToImage(image,
mVideoInfo,
b,
pictureRegion,
false);
if (!VideoData::SetVideoDataToImage(image,
mVideoInfo,
b,
pictureRegion,
false)) {
LOG("CreateBasicVideoFrame: failed to set video data to image (shmem path)");
return E_FAIL;
}
RefPtr<VideoData> v =
VideoData::CreateFromImage(mVideoInfo,
aStreamOffset,
@@ -307,8 +307,7 @@ H264Converter::UpdateConfigFromExtraData(MediaByteBuffer* aExtraData)
if (mp4_demuxer::H264::DecodeSPSFromExtraData(aExtraData, spsdata) &&
spsdata.pic_width > 0 && spsdata.pic_height > 0) {
mp4_demuxer::H264::EnsureSPSIsSane(spsdata);
mCurrentConfig.mImage.width = spsdata.pic_width;
mCurrentConfig.mImage.height = spsdata.pic_height;
mCurrentConfig.AdoptImageSize(gfx::IntSize(spsdata.pic_width, spsdata.pic_height));
mCurrentConfig.mDisplay.width = spsdata.display_width;
mCurrentConfig.mDisplay.height = spsdata.display_height;
}
+14 -2
View File
@@ -295,11 +295,11 @@ nsXMLContentSink::DidBuildModel(bool aTerminated)
}
mXSLTProcessor->SetSourceContentModel(mDocument, mDocumentChildren);
mDocumentChildren.Clear();
// Since the processor now holds a reference to us we drop our reference
// to it to avoid owning cycles
mXSLTProcessor = nullptr;
}
else {
} else {
// Kick off layout for non-XSLT transformed documents.
// Check if we want to prettyprint
@@ -881,6 +881,12 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
if (!mDocumentChildren.IsEmpty()) {
for (nsIContent* child : mDocumentChildren) {
if (MOZ_UNLIKELY(child->GetParentNode())) {
child->Remove();
if (MOZ_UNLIKELY(child->GetParentNode())) {
return false;
}
}
mDocument->AppendChildTo(child, false);
}
mDocumentChildren.Clear();
@@ -991,6 +997,12 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
if (!SetDocElement(nameSpaceID, localName, content) && appendContent) {
NS_ENSURE_TRUE(parent, NS_ERROR_UNEXPECTED);
if (MOZ_UNLIKELY(content->GetParentNode())) {
content->Remove();
if (MOZ_UNLIKELY(content->GetParentNode())) {
return NS_ERROR_UNEXPECTED;
}
}
parent->AppendChildTo(content, false);
}
}
+1 -1
View File
@@ -5159,7 +5159,7 @@ HTMLEditor::IsAcceptableInputEvent(WidgetGUIEvent* aGUIEvent)
// If the event is a mouse event, we need to check if the target content is
// the focused editing host or its descendant.
if (aGUIEvent->AsMouseEventBase()) {
nsIContent* editingHost = GetActiveEditingHost();
RefPtr<nsIContent> editingHost = GetActiveEditingHost();
// If there is no active editing host, we cannot handle the mouse event
// correctly.
if (!editingHost) {
+5 -2
View File
@@ -1082,6 +1082,9 @@ ChromeTooltipListener::ChromeTooltipListener(nsWebBrowser* aInBrowser,
ChromeTooltipListener::~ChromeTooltipListener()
{
if (mTooltipTimer) {
mTooltipTimer->Cancel();
}
}
// Hook up things to the chrome like context menus and tooltips, if the chrome
@@ -1329,7 +1332,7 @@ void
ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer,
void* aChromeTooltipListener)
{
auto self = static_cast<ChromeTooltipListener*>(aChromeTooltipListener);
RefPtr<ChromeTooltipListener> self = static_cast<ChromeTooltipListener*>(aChromeTooltipListener);
if (self && self->mPossibleTooltipNode) {
// The actual coordinates we want to put the tooltip at are relative to the
// toplevel docshell of our mWebBrowser. We know what the screen
@@ -1374,7 +1377,7 @@ ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer,
self->mPossibleTooltipNode, getter_Copies(tooltipText),
getter_Copies(directionText), &textFound);
if (textFound) {
if (self->mPossibleTooltipNode && textFound) {
nsString tipText(tooltipText);
nsString dirText(directionText);
LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
+15 -6
View File
@@ -1554,8 +1554,7 @@ FilterNodeTileSoftware::SetAttribute(uint32_t aIndex,
const IntRect &aSourceRect)
{
MOZ_ASSERT(aIndex == ATT_TILE_SOURCE_RECT);
mSourceRect = IntRect(int32_t(aSourceRect.x), int32_t(aSourceRect.y),
int32_t(aSourceRect.width), int32_t(aSourceRect.height));
mSourceRect = aSourceRect;
Invalidate();
}
@@ -1595,14 +1594,24 @@ FilterNodeTileSoftware::Render(const IntRect& aRect)
typedef std::map<IntRect, RefPtr<DataSourceSurface>, CompareIntRects> InputMap;
InputMap inputs;
auto IntRectToInt64Rect = [](const IntRect& aRect) {
return RectTyped<UnknownUnits, int64_t>(aRect.X(), aRect.Y(), aRect.Width(),
aRect.Height());
};
IntPoint startIndex = TileIndex(mSourceRect, aRect.TopLeft());
IntPoint endIndex = TileIndex(mSourceRect, aRect.BottomRight());
for (int32_t ix = startIndex.x; ix <= endIndex.x; ix++) {
for (int32_t iy = startIndex.y; iy <= endIndex.y; iy++) {
IntPoint sourceToDestOffset(ix * mSourceRect.width,
iy * mSourceRect.height);
IntRect destRect = aRect.Intersect(mSourceRect + sourceToDestOffset);
IntRect srcRect = destRect - sourceToDestOffset;
auto sourceToDestOffset = PointTyped<UnknownUnits, int64_t>(
ix * mSourceRect.Width(), iy * mSourceRect.Height());
auto destRect64 = IntRectToInt64Rect(aRect).Intersect(
IntRectToInt64Rect(mSourceRect) + sourceToDestOffset);
auto srcRect64 = destRect64 - sourceToDestOffset;
IntRect destRect, srcRect;
if (!destRect64.ToIntRect(&destRect) || !srcRect64.ToIntRect(&srcRect)) {
return nullptr;
}
if (srcRect.IsEmpty()) {
continue;
}
@@ -358,7 +358,8 @@ gl::Error Image9::setManagedSurface(IDirect3DSurface9 *surface)
surface->GetDesc(&desc);
ASSERT(desc.Pool == D3DPOOL_MANAGED);
if ((GLsizei)desc.Width == mWidth && (GLsizei)desc.Height == mHeight)
if ((GLsizei)desc.Width == mWidth && (GLsizei)desc.Height == mHeight &&
desc.Format == mD3DFormat)
{
if (mSurface)
{
@@ -40,7 +40,7 @@ static void SK_BLITBWMASK_NAME(const SkPixmap& dst, const SkMask& srcMask,
const uint8_t* bits = srcMask.getAddr1(cx, cy);
SK_BLITBWMASK_DEVTYPE* device = dst.SK_BLITBWMASK_GETADDR(cx, cy);
if (cx == maskLeft && clip.fRight == srcMask.fBounds.fRight)
if (cx == maskLeft && clip.fRight == srcMask.fBounds.fRight && (clip.width() & 7) == 0)
{
do {
SK_BLITBWMASK_DEVTYPE* dst = device;
+5 -6
View File
@@ -702,17 +702,16 @@ void SkScalerContext_CairoFT::generateMetrics(SkGlyph* glyph)
case FT_GLYPH_FORMAT_BITMAP:
if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA) {
glyph->fMaskFormat = SkMask::kARGB32_Format;
}
if (isLCD(fRec)) {
fRec.fMaskFormat = SkMask::kA8_Format;
} else if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ||
isLCD(fRec)) {
glyph->fMaskFormat = SkMask::kA8_Format;
}
if (fHaveShape) {
// Ensure filtering is preserved when the bitmap is transformed.
// Otherwise, the result will look horrifically aliased.
if (fRec.fMaskFormat == SkMask::kBW_Format) {
fRec.fMaskFormat = SkMask::kA8_Format;
if (glyph->fMaskFormat == SkMask::kBW_Format) {
glyph->fMaskFormat = SkMask::kA8_Format;
}
// Apply the shape matrix to the glyph's bounding box.
+9 -9
View File
@@ -94,8 +94,6 @@ RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
//******************************************************************************
RasterImage::~RasterImage()
{
mIsBeingDestroyed = true;
// Make sure our SourceBuffer is marked as complete. This will ensure that any
// outstanding decoders terminate.
if (!mSourceBuffer->IsComplete()) {
@@ -431,15 +429,17 @@ RasterImage::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey)
{
MOZ_ASSERT(mProgressTracker);
if (mIsBeingDestroyed) {
return;
}
bool animatedFramesDiscarded = aSurfaceKey.Playback() == PlaybackType::eAnimated;
RefPtr<RasterImage> image = this;
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
image->OnSurfaceDiscardedInternal(animatedFramesDiscarded);
RefPtr<ProgressTracker> progressTracker = mProgressTracker;
NS_DispatchToMainThread(NS_NewRunnableFunction(
[progressTracker, animatedFramesDiscarded]() -> void {
RefPtr<Image> image = progressTracker->GetImage();
if (!image) {
return;
}
static_cast<RasterImage*>(image.get())
->OnSurfaceDiscardedInternal(animatedFramesDiscarded);
}));
}
-3
View File
@@ -17,7 +17,6 @@
#ifndef mozilla_image_RasterImage_h
#define mozilla_image_RasterImage_h
#include "mozilla/Atomics.h"
#include "Image.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
@@ -403,8 +402,6 @@ private: // data
// This is currently only used for statistics
int32_t mDecodeCount;
Atomic<bool> mIsBeingDestroyed{false};
// A weak pointer to our ImageContainer, which stays alive only as long as
// the layer system needs it.
WeakPtr<layers::ImageContainer> mImageContainer;
+1
View File
@@ -214,6 +214,7 @@ def update_data_file(topsrcdir):
'-DUCONFIG_NO_TRANSLITERATION ' +
'-DUCONFIG_NO_REGULAR_EXPRESSIONS ' +
'-DUCONFIG_NO_BREAK_ITERATION ' +
'-DUCONFIG_NO_MF2 ' +
'-DU_CHARSET_IS_UTF8')
})
-1
View File
@@ -7,7 +7,6 @@
#include "nsIInputStream.h"
#include "nsReadLine.h"
#include "nsStreamUtils.h"
#include <algorithm>
#include "mozilla/dom/EncodingUtils.h"
using mozilla::dom::EncodingUtils;
@@ -184,17 +184,8 @@ sub genTest {
<p>
__END__
foreach my $key (sort { $a <=> $b } keys %$hash) {
# Bug 1476304: we exclude Georgian letters U+10D0..10FF because of lack
# of widespread font support for the corresponding Mtavruli characters
# at this time (July 2018).
# This condition is to be removed once the major platforms ship with
# fonts that support U+1C90..1CBF.
my $skippedGeorgian = $whichMapping eq "upper" && $key >= 0x10D0 && $key <= 0x10FF;
print OUT "<!-- " if $skippedGeorgian;
printf OUT "&#x%04X;", $key;
print OUT " -->" if $skippedGeorgian;
print OUT " <!-- $charName{$key} -->" if exists $charName{$key};
print OUT " <!-- Temporarily skipped, see bug 1476304. -->" if $skippedGeorgian;
print OUT "\n";
}
print OUT <<__END__;
@@ -220,17 +211,8 @@ __END__
<p>
__END__
foreach my $key (sort { $a <=> $b } keys %$hash) {
# Bug 1476304: we exclude Georgian letters U+10D0..10FF because of lack
# of widespread font support for the corresponding Mtavruli characters
# at this time (July 2018).
# This condition is to be removed once the major platforms ship with
# fonts that support U+1C90..1CBF.
my $skippedGeorgian = $whichMapping eq "upper" && $key >= 0x10D0 && $key <= 0x10FF;
print OUT "<!-- " if $skippedGeorgian;
print OUT join('', map { sprintf("&#x%s;", $_) } split(/ /, $hash->{$key}));
print OUT " -->" if $skippedGeorgian;
print OUT " <!-- $charName{$key} -->" if exists $charName{$key};
print OUT " <!-- Temporarily skipped, see bug 1476304. -->" if $skippedGeorgian;
print OUT "\n";
}
print OUT <<__END__;
+1 -3
View File
@@ -54,8 +54,6 @@ class MOZ_NON_PARAM JS_PUBLIC_API(ProfilingFrameIterator)
// activation (if any) comes around.
void* savedPrevJitTop_;
JS::AutoCheckCannotGC nogc_;
static const unsigned StorageSpace = 8 * sizeof(void*);
alignas(void*) unsigned char storage_[StorageSpace];
@@ -144,7 +142,7 @@ class MOZ_NON_PARAM JS_PUBLIC_API(ProfilingFrameIterator)
void iteratorConstruct();
void iteratorDestroy();
bool iteratorDone();
};
} JS_HAZ_GC_INVALIDATED;
JS_FRIEND_API(bool)
IsProfilingEnabledForContext(JSContext* cx);
+8 -2
View File
@@ -69,7 +69,11 @@ WeakRef_deref_impl(JSContext* cx, const CallArgs& args)
}
if (data->isObject()) {
JSObject* target = data->objectTarget.get();
// Use unbarrieredGet() to avoid barriers on potentially invalid memory.
JSObject* target = data->objectTarget.unbarrieredGet();
// Ensure pointer is not null.
// During WeakRef deref, if the target was collected, it will be nullptr.
if (target) {
RootedValue kept(cx, ObjectValue(*target));
if (!cx->runtime()->addWeakRefKeptObject(cx, kept))
@@ -80,7 +84,9 @@ WeakRef_deref_impl(JSContext* cx, const CallArgs& args)
}
} else {
MOZ_ASSERT(data->isSymbol());
JS::Symbol* target = data->symbolTarget.get();
JS::Symbol* target = data->symbolTarget.unbarrieredGet();
// Ensure pointer is not null.
if (target) {
RootedValue kept(cx, SymbolValue(target));
if (!cx->runtime()->addWeakRefKeptObject(cx, kept))
+2 -3
View File
@@ -1235,10 +1235,9 @@ def writeCLDRLanguageTagLikelySubtagsTest(println, data, url):
# Step 2: Lookup.
searches = ((language, script, region),
(language, None, region),
(language, script, None),
(language, None, None),
("und", script, None))
(language, None, region),
(language, None, None))
search = next(search for search in searches if search in likely_subtags)
(language_s, script_s, region_s) = search
+6 -1
View File
@@ -714,13 +714,18 @@ class GCRuntime
#endif // DEBUG
bool isInsideUnsafeRegion() { return inUnsafeRegion != 0; }
void enterUnsafeRegion() { ++inUnsafeRegion; }
void enterUnsafeRegion() {
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
++inUnsafeRegion;
}
void leaveUnsafeRegion() {
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
MOZ_ASSERT(inUnsafeRegion > 0);
--inUnsafeRegion;
}
void verifyIsSafeToGC() {
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
MOZ_DIAGNOSTIC_ASSERT(!isInsideUnsafeRegion(),
"[AutoAssertNoGC] possible GC in GC-unsafe region");
}
+6 -6
View File
@@ -19,7 +19,7 @@ using namespace js;
using namespace js::gc;
static void
IterateCompartmentsArenasCells(JSContext* cx, Zone* zone, void* data,
IterateCompartmentsArenasCellsUnbarriered(JSContext* cx, Zone* zone, void* data,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
IterateCellCallback cellCallback)
@@ -34,14 +34,14 @@ IterateCompartmentsArenasCells(JSContext* cx, Zone* zone, void* data,
for (ArenaIter aiter(zone, thingKind); !aiter.done(); aiter.next()) {
Arena* arena = aiter.get();
(*arenaCallback)(cx, data, arena, traceKind, thingSize);
for (ArenaCellIter iter(arena); !iter.done(); iter.next())
for (ArenaCellIterUnbarriered iter(arena); !iter.done(); iter.next())
(*cellCallback)(cx, data, iter.getCell(), traceKind, thingSize);
}
}
}
void
js::IterateZonesCompartmentsArenasCells(JSContext* cx, void* data,
js::IterateHeapUnbarriered(JSContext* cx, void* data,
IterateZoneCallback zoneCallback,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
@@ -51,13 +51,13 @@ js::IterateZonesCompartmentsArenasCells(JSContext* cx, void* data,
for (ZonesIter zone(cx, WithAtoms); !zone.done(); zone.next()) {
(*zoneCallback)(cx, data, zone);
IterateCompartmentsArenasCells(cx, zone, data,
IterateCompartmentsArenasCellsUnbarriered(cx, zone, data,
compartmentCallback, arenaCallback, cellCallback);
}
}
void
js::IterateZoneCompartmentsArenasCells(JSContext* cx, Zone* zone, void* data,
js::IterateHeapUnbarrieredForZone(JSContext* cx, Zone* zone, void* data,
IterateZoneCallback zoneCallback,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
@@ -66,7 +66,7 @@ js::IterateZoneCompartmentsArenasCells(JSContext* cx, Zone* zone, void* data,
AutoPrepareForTracing prop(cx, WithAtoms);
(*zoneCallback)(cx, data, zone);
IterateCompartmentsArenasCells(cx, zone, data,
IterateCompartmentsArenasCellsUnbarriered(cx, zone, data,
compartmentCallback, arenaCallback, cellCallback);
}
@@ -16,6 +16,11 @@
namespace js {
namespace jit {
static uint32_t CountPhysBits(FloatRegisters::SetType bits) {
MOZ_ASSERT((bits & ~FloatRegisters::AllPhysMask) == 0);
return mozilla::CountPopulation32(uint32_t(bits));
}
Registers::Code Registers::FromName(const char* name) {
for (size_t i = 0; i < TotalPhys; i++) {
if (strcmp(GetName(i), name) == 0) {
@@ -37,43 +42,47 @@ FloatRegisters::Code FloatRegisters::FromName(const char* name) {
}
FloatRegisterSet FloatRegister::ReduceSetForPush(const FloatRegisterSet& s) {
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
SetType bits = s.bits();
LiveFloatRegisterSet ret;
for (FloatRegisterIterator iter(s); iter.more(); ++iter) {
ret.addUnchecked(FromCode((*iter).encoding()));
}
return ret.set();
// Exclude registers already represented by a wider alias. Higher alias banks
// are wider, so preserve only the widest live view of each physical register.
bits &= ~(bits >> (1 * FloatRegisters::TotalPhys));
bits &= ~(bits >> (2 * FloatRegisters::TotalPhys));
return FloatRegisterSet(bits);
}
uint32_t FloatRegister::GetSizeInBytes(const FloatRegisterSet& s) {
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
return s.size() * sizeof(double);
return s.size() * sizeof(FloatRegisters::RegisterContent);
}
uint32_t FloatRegister::GetPushSizeInBytes(const FloatRegisterSet& s) {
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
SetType all = s.bits();
SetType set128b =
(all >> (uint32_t(FloatRegisters::Simd128) * FloatRegisters::TotalPhys)) &
FloatRegisters::AllPhysMask;
SetType doubleSet =
(all >> (uint32_t(FloatRegisters::Double) * FloatRegisters::TotalPhys)) &
FloatRegisters::AllPhysMask;
SetType singleSet =
(all >> (uint32_t(FloatRegisters::Single) * FloatRegisters::TotalPhys)) &
FloatRegisters::AllPhysMask;
return s.size() * sizeof(double);
SetType set64b = doubleSet & ~set128b;
SetType set32b = singleSet & ~set64b & ~set128b;
return CountPhysBits(set128b) * (4 * sizeof(int32_t)) +
CountPhysBits(set64b) * sizeof(double) +
CountPhysBits(set32b) * sizeof(float);
}
uint32_t FloatRegister::getRegisterDumpOffsetInBytes() {
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
return encoding() * sizeof(double);
return encoding() * sizeof(FloatRegisters::RegisterContent);
}
bool CPUFlagsHaveBeenComputed() {
// TODO(loongarch64): Add CPU flags support.
// The LoongArch64 backend does not currently gate code generation on
// optional CPU features.
return true;
}
@@ -249,9 +249,9 @@ class FloatRegisters {
// Eight bits: (invalid << 7) | (kind << 5) | encoding
typedef uint8_t Code;
typedef FPRegisterID Encoding;
typedef uint64_t SetType;
typedef unsigned __int128 SetType;
enum Kind : uint8_t { Double, Single, NumTypes };
enum Kind : uint8_t { Double, Single, Simd128, NumTypes };
static constexpr Code Invalid = 0x80;
@@ -285,7 +285,11 @@ class FloatRegisters {
<< (uint32_t(Single) * TotalPhys);
static const SetType SpreadDouble = SetType(1)
<< (uint32_t(Double) * TotalPhys);
static const SetType Spread = SpreadSingle | SpreadDouble;
static const SetType SpreadSimd128 = SetType(1)
<< (uint32_t(Simd128) * TotalPhys);
static const SetType SpreadScalar = SpreadSingle | SpreadDouble;
static const SetType SpreadVector = SpreadSimd128;
static const SetType Spread = SpreadScalar | SpreadVector;
static const SetType AllPhysMask = ((SetType(1) << TotalPhys) - 1);
static const SetType AllMask = AllPhysMask * Spread;
@@ -293,13 +297,16 @@ class FloatRegisters {
static const SetType AllDoubleMask = AllPhysMask * SpreadDouble;
static const SetType NoneMask = SetType(0);
// TODO(loongarch64): Much less than ARM64 here.
// LoongArch64 callee-saved floating-point registers are f24-f31.
static const SetType NonVolatileMask =
SetType((1 << FloatRegisters::f24) | (1 << FloatRegisters::f25) |
(1 << FloatRegisters::f26) | (1 << FloatRegisters::f27) |
(1 << FloatRegisters::f28) | (1 << FloatRegisters::f29) |
(1 << FloatRegisters::f30) | (1 << FloatRegisters::f31)) *
Spread;
((SetType(1) << FloatRegisters::f24) |
(SetType(1) << FloatRegisters::f25) |
(SetType(1) << FloatRegisters::f26) |
(SetType(1) << FloatRegisters::f27) |
(SetType(1) << FloatRegisters::f28) |
(SetType(1) << FloatRegisters::f29) |
(SetType(1) << FloatRegisters::f30) |
(SetType(1) << FloatRegisters::f31)) * Spread;
static const SetType VolatileMask = AllMask & ~NonVolatileMask;
@@ -317,6 +324,8 @@ class FloatRegisters {
union RegisterContent {
float s;
double d;
int32_t i4[4];
float s4[4];
};
static constexpr Encoding encoding(Code c) {
@@ -359,26 +368,35 @@ struct FloatRegister {
typedef Codes::SetType SetType;
static uint32_t SetSize(SetType x) {
static_assert(sizeof(SetType) == 8, "SetType must be 64 bits");
static_assert(sizeof(SetType) == 16, "SetType must be 128 bits");
x |= x >> FloatRegisters::TotalPhys;
x |= x >> (2 * FloatRegisters::TotalPhys);
x &= FloatRegisters::AllPhysMask;
return mozilla::CountPopulation32(x);
}
static uint32_t FirstBit(SetType x) {
static_assert(sizeof(SetType) == 8, "SetType");
return mozilla::CountTrailingZeroes64(x);
MOZ_ASSERT(x != 0);
uint64_t low = uint64_t(x);
if (low) {
return mozilla::CountTrailingZeroes64(low);
}
return 64 + mozilla::CountTrailingZeroes64(uint64_t(x >> 64));
}
static uint32_t LastBit(SetType x) {
static_assert(sizeof(SetType) == 8, "SetType");
return 63 - mozilla::CountLeadingZeroes64(x);
MOZ_ASSERT(x != 0);
uint64_t high = uint64_t(x >> 64);
if (high) {
return 127 - mozilla::CountLeadingZeroes64(high);
}
return 63 - mozilla::CountLeadingZeroes64(uint64_t(x));
}
private:
// These fields only hold valid values: an invalid register is always
// represented as a valid encoding and kind with the invalid_ bit set.
uint8_t encoding_; // 32 encodings
uint8_t kind_; // Double, Single; more later
uint8_t kind_; // Double, Single, Simd128
bool invalid_;
typedef Codes::Kind Kind;
@@ -387,6 +405,8 @@ struct FloatRegister {
union RegisterContent {
float s;
double d;
int32_t i4[4];
float s4[4];
};
constexpr FloatRegister(Encoding encoding, Kind kind)
@@ -417,7 +437,7 @@ struct FloatRegister {
}
bool isSimd128() const {
MOZ_ASSERT(!invalid_);
return false;
return kind_ == FloatRegisters::Simd128;
}
bool isInvalid() const { return invalid_; }
@@ -430,13 +450,19 @@ struct FloatRegister {
return FloatRegister(Encoding(encoding_), FloatRegisters::Double);
}
FloatRegister doubleOverlay() const { return asDouble(); }
FloatRegister asSimd128() const { MOZ_CRASH(); }
FloatRegister asSimd128() const {
MOZ_ASSERT(!invalid_);
return FloatRegister(Encoding(encoding_), FloatRegisters::Simd128);
}
constexpr uint32_t size() const {
MOZ_ASSERT(!invalid_);
if (kind_ == FloatRegisters::Double) {
return sizeof(double);
}
if (kind_ == FloatRegisters::Simd128) {
return 4 * sizeof(int32_t);
}
MOZ_ASSERT(kind_ == FloatRegisters::Single);
return sizeof(float);
}
+598 -17
View File
@@ -49,11 +49,6 @@ void js::jit::PatchJump(CodeLocationJump& jump_, CodeLocationLabel label,
// Note this is used for inter-wasm calls and may pass arguments and results
// in floating point registers even if the system ABI does not.
// TODO(loongarch64): Inconsistent with LoongArch's calling convention.
// LoongArch floating-point parameters calling convention:
// The first eight floating-point parameters should be passed in f0-f7, and
// the other floating point parameters will be passed like integer parameters.
// But we just pass the other floating-point parameters on stack here.
ABIArg ABIArgGenerator::next(MIRType type) {
switch (type) {
case MIRType::Int32:
@@ -70,16 +65,40 @@ ABIArg ABIArgGenerator::next(MIRType type) {
}
case MIRType::Float32:
case MIRType::Double: {
if (floatRegIndex_ == NumFloatArgRegs) {
if (floatRegIndex_ < NumFloatArgRegs) {
current_ = ABIArg(FloatRegister(
FloatRegisters::Encoding(floatRegIndex_ + f0.encoding()),
type == MIRType::Double ? FloatRegisters::Double
: FloatRegisters::Single));
floatRegIndex_++;
break;
}
if (intRegIndex_ == NumIntArgRegs) {
current_ = ABIArg(stackOffset_);
stackOffset_ += sizeof(double);
break;
}
current_ = ABIArg(FloatRegister(
FloatRegisters::Encoding(floatRegIndex_ + f0.encoding()),
type == MIRType::Double ? FloatRegisters::Double
: FloatRegisters::Single));
floatRegIndex_++;
current_ = ABIArg(Register::FromCode(intRegIndex_ + a0.encoding()));
intRegIndex_++;
break;
}
case MIRType::Int8x16:
case MIRType::Int16x8:
case MIRType::Int32x4:
case MIRType::Float32x4:
case MIRType::Bool8x16:
case MIRType::Bool16x8:
case MIRType::Bool32x4: {
if (floatRegIndex_ < NumFloatArgRegs) {
current_ = ABIArg(FloatRegister(
FloatRegisters::Encoding(floatRegIndex_ + f0.encoding()),
FloatRegisters::Simd128));
floatRegIndex_++;
break;
}
stackOffset_ = AlignBytes(stackOffset_, SimdMemoryAlignment);
current_ = ABIArg(stackOffset_);
stackOffset_ += Simd128DataSize;
break;
}
default:
@@ -334,8 +353,19 @@ void AssemblerLOONGARCH64::WriteInstStatic(uint32_t x, uint32_t* dest) {
}
BufferOffset AssemblerLOONGARCH64::haltingAlign(int alignment) {
// TODO(loongarch64): Implement a proper halting align.
return nopAlign(alignment);
BufferOffset ret;
MOZ_ASSERT(m_buffer.isAligned(4));
MOZ_ASSERT((alignment & (alignment - 1)) == 0);
while (size() & (alignment - 1)) {
BufferOffset tmp(size());
as_break(WASM_TRAP);
if (!ret.assigned()) {
ret = tmp;
}
}
return ret;
}
BufferOffset AssemblerLOONGARCH64::nopAlign(int alignment) {
@@ -436,10 +466,30 @@ InstImm AssemblerLOONGARCH64::getBranchCode(JumpOrCall jumpOrCall) {
}
InstImm AssemblerLOONGARCH64::getBranchCode(Register rj, Register rd, Condition c) {
// beq, bne
MOZ_ASSERT(c == AssemblerLOONGARCH64::Equal || c == AssemblerLOONGARCH64::NotEqual);
return InstImm(c == AssemblerLOONGARCH64::Equal ? op_beq : op_bne, BOffImm16(0),
rj, rd);
switch (c) {
case AssemblerLOONGARCH64::Equal:
return InstImm(op_beq, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::NotEqual:
return InstImm(op_bne, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::Above:
return InstImm(op_bltu, BOffImm16(0), rd, rj);
case AssemblerLOONGARCH64::AboveOrEqual:
return InstImm(op_bgeu, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::Below:
return InstImm(op_bltu, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::BelowOrEqual:
return InstImm(op_bgeu, BOffImm16(0), rd, rj);
case AssemblerLOONGARCH64::GreaterThan:
return InstImm(op_blt, BOffImm16(0), rd, rj);
case AssemblerLOONGARCH64::GreaterThanOrEqual:
return InstImm(op_bge, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::LessThan:
return InstImm(op_blt, BOffImm16(0), rj, rd);
case AssemblerLOONGARCH64::LessThanOrEqual:
return InstImm(op_bge, BOffImm16(0), rd, rj);
default:
MOZ_CRASH("Condition not supported.");
}
}
InstImm AssemblerLOONGARCH64::getBranchCode(Register rj, Condition c) {
@@ -1010,6 +1060,118 @@ BufferOffset AssemblerLOONGARCH64::as_st_d(Register rd, Register rj, int32_t si1
return writeInst(InstImm(op_st_d, si12, rj, rd, 12).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vld(FloatRegister vd, Register rj,
int32_t si12) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(is_intN(si12, 12));
spew("vld %3s,%3s,0x%x", vd.name(), rj.name(), si12);
return writeInst(InstImm(op_vld, si12, rj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vst(FloatRegister vd, Register rj,
int32_t si12) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(is_intN(si12, 12));
spew("vst %3s,%3s,0x%x", vd.name(), rj.name(), si12);
return writeInst(InstImm(op_vst, si12, rj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_clt_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.clt.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_clt_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_ceq_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.ceq.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_ceq_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_cle_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.cle.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_cle_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_cun_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.cun.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_cun_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_cult_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.cult.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_cult_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_cule_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.cule.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_cule_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfcmp_cune_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfcmp.cune.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfcmp_cune_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vbitsel_v(FloatRegister vd,
FloatRegister vj,
FloatRegister vk,
FloatRegister va) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
MOZ_ASSERT(va.isSimd128());
spew("vbitsel.v %3s,%3s,%3s,%3s", vd.name(), vj.name(), vk.name(),
va.name());
return writeInst(InstReg(op_vbitsel_v, va, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vshuf_b(FloatRegister vd,
FloatRegister vj,
FloatRegister vk,
FloatRegister va) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
MOZ_ASSERT(va.isSimd128());
spew("vshuf.b %3s,%3s,%3s,%3s", vd.name(), vj.name(), vk.name(),
va.name());
return writeInst(InstReg(op_vshuf_b, va, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_ldx_b(Register rd, Register rj, Register rk) {
spew("ldx_b %3s,%3s,%3s", rd.name(), rj.name(), rk.name());
return writeInst(InstReg(op_ldx_b, rk, rj, rd).encode());
@@ -1068,6 +1230,425 @@ BufferOffset AssemblerLOONGARCH64::as_stx_d(Register rd, Register rj, Register r
return writeInst(InstReg(op_stx_d, rk, rj, rd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vldx(FloatRegister vd, Register rj,
Register rk) {
MOZ_ASSERT(vd.isSimd128());
spew("vldx %3s,%3s,%3s", vd.name(), rj.name(), rk.name());
return writeInst(InstReg(op_vldx, rk, rj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vstx(FloatRegister vd, Register rj,
Register rk) {
MOZ_ASSERT(vd.isSimd128());
spew("vstx %3s,%3s,%3s", vd.name(), rj.name(), rk.name());
return writeInst(InstReg(op_vstx, rk, rj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vseq_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vseq.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vseq_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsle_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsle.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsle_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsle_wu(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsle.wu %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsle_wu, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vslt_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vslt.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vslt_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vslt_wu(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vslt.wu %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vslt_wu, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vadd_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vadd.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vadd_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsub_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsub.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsub_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vmax_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vmax.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vmax_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vmin_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vmin.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vmin_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vmax_wu(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vmax.wu %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vmax_wu, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vmin_wu(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vmin.wu %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vmin_wu, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vmul_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vmul.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vmul_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsll_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsll.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsll_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsrl_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsrl.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsrl_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vsra_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vsra.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vsra_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vilvl_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vilvl.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vilvl_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vilvh_w(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vilvh.w %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vilvh_w, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vand_v(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vand.v %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vand_v, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vor_v(FloatRegister vd, FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vor.v %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vor_v, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vxor_v(FloatRegister vd, FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vxor.v %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vxor_v, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vnor_v(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vnor.v %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vnor_v, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vandn_v(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vandn.v %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vandn_v, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfadd_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfadd.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfadd_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfsub_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfsub.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfsub_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfmul_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfmul.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfmul_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfmax_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfmax.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfmax_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vfmin_s(FloatRegister vd,
FloatRegister vj,
FloatRegister vk) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(vk.isSimd128());
spew("vfmin.s %3s,%3s,%3s", vd.name(), vj.name(), vk.name());
return writeInst(InstReg(op_vfmin_s, vk, vj, vd).encode());
}
BufferOffset AssemblerLOONGARCH64::as_vneg_w(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vneg.w %3s,%3s", vd.name(), vj.name());
return writeInst(op_vneg_w | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vfsqrt_s(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vfsqrt.s %3s,%3s", vd.name(), vj.name());
return writeInst(op_vfsqrt_s | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vfrecip_s(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vfrecip.s %3s,%3s", vd.name(), vj.name());
return writeInst(op_vfrecip_s | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vfrsqrt_s(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vfrsqrt.s %3s,%3s", vd.name(), vj.name());
return writeInst(op_vfrsqrt_s | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vfrint_s(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vfrint.s %3s,%3s", vd.name(), vj.name());
return writeInst(op_vfrint_s | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vffint_s_w(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vffint.s.w %3s,%3s", vd.name(), vj.name());
return writeInst(op_vffint_s_w | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vftint_w_s(FloatRegister vd,
FloatRegister vj) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
spew("vftint.w.s %3s,%3s", vd.name(), vj.name());
return writeInst(op_vftint_w_s | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vreplgr2vr_w(FloatRegister vd,
Register rj) {
MOZ_ASSERT(vd.isSimd128());
spew("vreplgr2vr.w %3s,%3s", vd.name(), rj.name());
return writeInst(op_vreplgr2vr_w | RJ(rj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vreplvei_w(FloatRegister vd,
FloatRegister vj,
uint32_t lane) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(lane < 4);
spew("vreplvei.w %3s,%3s,%u", vd.name(), vj.name(), lane);
return writeInst(op_vreplvei_w | (lane << RKShift) | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vinsgr2vr_w(FloatRegister vd,
Register rj,
uint32_t lane) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(lane < 4);
spew("vinsgr2vr.w %3s,%3s,%u", vd.name(), rj.name(), lane);
return writeInst(op_vinsgr2vr_w | (lane << RKShift) | RJ(rj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vpickve2gr_w(Register rd,
FloatRegister vj,
uint32_t lane) {
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(lane < 4);
spew("vpickve2gr.w %3s,%3s,%u", rd.name(), vj.name(), lane);
return writeInst(op_vpickve2gr_w | (lane << RKShift) | FJ(vj) | RD(rd));
}
BufferOffset AssemblerLOONGARCH64::as_vpickve2gr_wu(Register rd,
FloatRegister vj,
uint32_t lane) {
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(lane < 4);
spew("vpickve2gr.wu %3s,%3s,%u", rd.name(), vj.name(), lane);
return writeInst(op_vpickve2gr_wu | (lane << RKShift) | FJ(vj) | RD(rd));
}
BufferOffset AssemblerLOONGARCH64::as_vslli_w(FloatRegister vd,
FloatRegister vj,
uint32_t imm) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(imm < 32);
spew("vslli.w %3s,%3s,%u", vd.name(), vj.name(), imm);
return writeInst(op_vslli_w | (imm << RKShift) | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vsrli_w(FloatRegister vd,
FloatRegister vj,
uint32_t imm) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(imm < 32);
spew("vsrli.w %3s,%3s,%u", vd.name(), vj.name(), imm);
return writeInst(op_vsrli_w | (imm << RKShift) | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vsrai_w(FloatRegister vd,
FloatRegister vj,
uint32_t imm) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(vj.isSimd128());
MOZ_ASSERT(imm < 32);
spew("vsrai.w %3s,%3s,%u", vd.name(), vj.name(), imm);
return writeInst(op_vsrai_w | (imm << RKShift) | FJ(vj) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_vldi(FloatRegister vd, int32_t imm) {
MOZ_ASSERT(vd.isSimd128());
MOZ_ASSERT(is_intN(imm, 13));
spew("vldi %3s,%d", vd.name(), imm);
return writeInst(op_vldi | ((imm & Imm13Mask) << Imm13Shift) | FD(vd));
}
BufferOffset AssemblerLOONGARCH64::as_ldptr_w(Register rd, Register rj,
int32_t si14) {
MOZ_ASSERT(is_intN(si14, 16) && ((si14 & 0x3) == 0));
+147 -12
View File
@@ -101,7 +101,8 @@ static constexpr Register64 ReturnReg64(ReturnReg);
static constexpr FloatRegister ReturnFloat32Reg{FloatRegisters::f0,
FloatRegisters::Single};
static constexpr FloatRegister ReturnDoubleReg = f0;
static constexpr FloatRegister ReturnSimd128Reg = InvalidFloatReg;
static constexpr FloatRegister ReturnSimd128Reg{FloatRegisters::f0,
FloatRegisters::Simd128};
static constexpr Register ScratchRegister = t7;
static constexpr Register SecondScratchReg = t8;
@@ -121,7 +122,8 @@ struct SecondScratchRegisterScope : public AutoRegisterScope {
static constexpr FloatRegister ScratchFloat32Reg{FloatRegisters::f23,
FloatRegisters::Single};
static constexpr FloatRegister ScratchDoubleReg = f23;
static constexpr FloatRegister ScratchSimd128Reg = InvalidFloatReg;
static constexpr FloatRegister ScratchSimd128Reg{FloatRegisters::f23,
FloatRegisters::Simd128};
struct ScratchFloat32Scope : public AutoFloatRegisterScope {
explicit ScratchFloat32Scope(MacroAssembler& masm)
@@ -226,11 +228,20 @@ static constexpr Register WasmJitEntryReturnScratch = t1;
static constexpr uint32_t ABIStackAlignment = 16;
static constexpr uint32_t CodeAlignment = 16;
// Does this architecture support SIMD conversions between Uint32x4 and
// Float32x4?
static constexpr bool SupportsUint32x4FloatConversions = false;
// Does this architecture support comparisons of unsigned integer vectors?
static constexpr bool SupportsUint8x16Compares = false;
static constexpr bool SupportsUint16x8Compares = false;
static constexpr bool SupportsUint32x4Compares = false;
// This boolean indicates whether we support SIMD instructions flavoured for
// this architecture or not. Rather than a method in the LIRGenerator, it is
// here such that it is accessible from the entire codebase. Once full support
// for SIMD is reached on all tier-1 platforms, this constant can be deleted.
static constexpr bool SupportsSimd = false;
static constexpr bool SupportsSimd = true;
static constexpr uint32_t JitStackAlignment = 16;
static constexpr uint32_t JitStackValueAlignment =
@@ -239,8 +250,8 @@ static_assert(JitStackAlignment % sizeof(Value) == 0 &&
JitStackValueAlignment >= 1,
"Stack alignment should be a non-zero multiple of sizeof(Value)");
// TODO(loongarch64): this is just a filler to prevent a build failure. The
// LoongArch SIMD alignment requirements still need to be explored.
// LoongArch LSX SIMD vectors are 128 bits wide, so use 16-byte alignment for
// SIMD constants and wasm stack alignment even while SIMD codegen is disabled.
static constexpr uint32_t SimdMemoryAlignment = 16;
static_assert(CodeAlignment % SimdMemoryAlignment == 0,
@@ -260,9 +271,8 @@ static constexpr uint32_t WasmCheckedTailEntryOffset = 16u;
static constexpr Scale ScalePointer = TimesEight;
// TODO(loongarch64): Add LoongArch instruction types description.
// LoongArch instruction encoding constants.
// LoongArch instruction encoding constants. The assembler models the encodings
// used by this backend as register, immediate, and jump instruction records.
static const uint32_t RJShift = 5;
static const uint32_t RJBits = 5;
static const uint32_t RKShift = 10;
@@ -303,6 +313,8 @@ static const uint32_t Imm6Shift = 10;
static const uint32_t Imm6Bits = 6;
static const uint32_t Imm12Shift = 10;
static const uint32_t Imm12Bits = 12;
static const uint32_t Imm13Shift = 5;
static const uint32_t Imm13Bits = 13;
static const uint32_t Imm14Shift = 10;
static const uint32_t Imm14Bits = 14;
static const uint32_t Imm15Shift = 0;
@@ -333,6 +345,7 @@ static const uint32_t CODEMask = (1 << CODEBits) - 1;
static const uint32_t Imm5Mask = (1 << Imm5Bits) - 1;
static const uint32_t Imm6Mask = (1 << Imm6Bits) - 1;
static const uint32_t Imm12Mask = (1 << Imm12Bits) - 1;
static const uint32_t Imm13Mask = (1 << Imm13Bits) - 1;
static const uint32_t Imm14Mask = (1 << Imm14Bits) - 1;
static const uint32_t Imm15Mask = (1 << Imm15Bits) - 1;
static const uint32_t Imm16Mask = (1 << Imm16Bits) - 1;
@@ -344,11 +357,11 @@ static const uint32_t BOffImm21Mask = ((1 << Imm21Bits) - 1) << Imm21Shift;
static const uint32_t BOffImm26Mask = ((1 << Imm26Bits) - 1) << Imm26Shift;
static const uint32_t RegMask = Registers::Total - 1;
// TODO(loongarch64) Change to syscall?
static const uint32_t MAX_BREAK_CODE = 1024 - 1;
// Use LoongArch BRK for wasm traps and debug breakpoints. Signal handling code
// decodes the BRK immediate to recover the wasm trap kind.
static const uint32_t WASM_TRAP = 6; // BRK_OVERFLOW
// TODO(loongarch64) Change to LoongArch instruction type.
class Instruction;
class InstReg;
class InstImm;
@@ -428,6 +441,17 @@ enum OpcodeField {
op_fst_s = 0xadU << 22,
op_fld_d = 0xaeU << 22,
op_fst_d = 0xafU << 22,
op_vld = 0x2c000000,
op_vst = 0x2c400000,
op_vfcmp_clt_s = 0x0c510000,
op_vfcmp_ceq_s = 0x0c520000,
op_vfcmp_cle_s = 0x0c530000,
op_vfcmp_cun_s = 0x0c540000,
op_vfcmp_cult_s = 0x0c550000,
op_vfcmp_cule_s = 0x0c570000,
op_vfcmp_cune_s = 0x0c5c0000,
op_vbitsel_v = 0x0d100000,
op_vshuf_b = 0x0d500000,
op_bstr_w = 0x3U << 21, // BSTRINS_W & BSTRPICK_W
op_fmadd_s = 0x81U << 20,
op_fmadd_d = 0x82U << 20,
@@ -530,6 +554,51 @@ enum OpcodeField {
op_fldx_d = 0x7068U << 15,
op_fstx_s = 0x7070U << 15,
op_fstx_d = 0x7078U << 15,
op_vldx = 0x38400000,
op_vstx = 0x38440000,
op_vseq_w = 0x70010000,
op_vsle_w = 0x70030000,
op_vsle_wu = 0x70050000,
op_vslt_w = 0x70070000,
op_vslt_wu = 0x70090000,
op_vadd_w = 0x700b0000,
op_vsub_w = 0x700d0000,
op_vmax_w = 0x70710000,
op_vmin_w = 0x70730000,
op_vmax_wu = 0x70750000,
op_vmin_wu = 0x70770000,
op_vmul_w = 0x70850000,
op_vsll_w = 0x70e90000,
op_vsrl_w = 0x70eb0000,
op_vsra_w = 0x70ed0000,
op_vilvl_w = 0x711b0000,
op_vilvh_w = 0x711d0000,
op_vand_v = 0x71260000,
op_vor_v = 0x71268000,
op_vxor_v = 0x71270000,
op_vnor_v = 0x71278000,
op_vandn_v = 0x71280000,
op_vfadd_s = 0x71308000,
op_vfsub_s = 0x71328000,
op_vfmul_s = 0x71388000,
op_vfmax_s = 0x713c8000,
op_vfmin_s = 0x713e8000,
op_vneg_w = 0x729c3800,
op_vfsqrt_s = 0x729ce400,
op_vfrecip_s = 0x729cf400,
op_vfrsqrt_s = 0x729d0400,
op_vfrint_s = 0x729d3400,
op_vffint_s_w = 0x729e0000,
op_vftint_w_s = 0x729e3000,
op_vreplgr2vr_w = 0x729f0800,
op_vreplvei_w = 0x72f7e000,
op_vinsgr2vr_w = 0x72ebe000,
op_vpickve2gr_w = 0x72efe000,
op_vpickve2gr_wu = 0x72f3e000,
op_vslli_w = 0x732c8000,
op_vsrli_w = 0x73308000,
op_vsrai_w = 0x73348000,
op_vldi = 0x73e00000,
op_amswap_w = 0x70c0U << 15,
op_amswap_d = 0x70c1U << 15,
op_amadd_w = 0x70c2U << 15,
@@ -866,7 +935,8 @@ class LOONGBufferWithExecutableCopy : public LOONGBuffer {
class AssemblerLOONGARCH64 : public AssemblerShared {
public:
// TODO(loongarch64): Should we remove these conditions here?
// Keep the shared condition vocabulary so shared MacroAssembler and
// CodeGenerator code can lower comparisons without per-use remapping.
enum Condition {
Equal,
NotEqual,
@@ -1251,6 +1321,26 @@ class AssemblerLOONGARCH64 : public AssemblerShared {
BufferOffset as_st_h(Register rd, Register rj, int32_t si12);
BufferOffset as_st_w(Register rd, Register rj, int32_t si12);
BufferOffset as_st_d(Register rd, Register rj, int32_t si12);
BufferOffset as_vld(FloatRegister vd, Register rj, int32_t si12);
BufferOffset as_vst(FloatRegister vd, Register rj, int32_t si12);
BufferOffset as_vfcmp_clt_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_ceq_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_cle_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_cun_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_cult_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_cule_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vfcmp_cune_s(FloatRegister vd, FloatRegister vj,
FloatRegister vk);
BufferOffset as_vbitsel_v(FloatRegister vd, FloatRegister vj,
FloatRegister vk, FloatRegister va);
BufferOffset as_vshuf_b(FloatRegister vd, FloatRegister vj, FloatRegister vk,
FloatRegister va);
BufferOffset as_ldx_b(Register rd, Register rj, Register rk);
BufferOffset as_ldx_h(Register rd, Register rj, Register rk);
@@ -1263,6 +1353,51 @@ class AssemblerLOONGARCH64 : public AssemblerShared {
BufferOffset as_stx_h(Register rd, Register rj, Register rk);
BufferOffset as_stx_w(Register rd, Register rj, Register rk);
BufferOffset as_stx_d(Register rd, Register rj, Register rk);
BufferOffset as_vldx(FloatRegister vd, Register rj, Register rk);
BufferOffset as_vstx(FloatRegister vd, Register rj, Register rk);
BufferOffset as_vseq_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsle_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsle_wu(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vslt_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vslt_wu(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vadd_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsub_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vmax_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vmin_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vmax_wu(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vmin_wu(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vmul_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsll_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsrl_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vsra_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vilvl_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vilvh_w(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vand_v(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vor_v(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vxor_v(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vnor_v(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vandn_v(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vfadd_s(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vfsub_s(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vfmul_s(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vfmax_s(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vfmin_s(FloatRegister vd, FloatRegister vj, FloatRegister vk);
BufferOffset as_vneg_w(FloatRegister vd, FloatRegister vj);
BufferOffset as_vfsqrt_s(FloatRegister vd, FloatRegister vj);
BufferOffset as_vfrecip_s(FloatRegister vd, FloatRegister vj);
BufferOffset as_vfrsqrt_s(FloatRegister vd, FloatRegister vj);
BufferOffset as_vfrint_s(FloatRegister vd, FloatRegister vj);
BufferOffset as_vffint_s_w(FloatRegister vd, FloatRegister vj);
BufferOffset as_vftint_w_s(FloatRegister vd, FloatRegister vj);
BufferOffset as_vreplgr2vr_w(FloatRegister vd, Register rj);
BufferOffset as_vreplvei_w(FloatRegister vd, FloatRegister vj, uint32_t lane);
BufferOffset as_vinsgr2vr_w(FloatRegister vd, Register rj, uint32_t lane);
BufferOffset as_vpickve2gr_w(Register rd, FloatRegister vj, uint32_t lane);
BufferOffset as_vpickve2gr_wu(Register rd, FloatRegister vj, uint32_t lane);
BufferOffset as_vslli_w(FloatRegister vd, FloatRegister vj, uint32_t imm);
BufferOffset as_vsrli_w(FloatRegister vd, FloatRegister vj, uint32_t imm);
BufferOffset as_vsrai_w(FloatRegister vd, FloatRegister vj, uint32_t imm);
BufferOffset as_vldi(FloatRegister vd, int32_t imm);
BufferOffset as_ldptr_w(Register rd, Register rj, int32_t si14);
BufferOffset as_ldptr_d(Register rd, Register rj, int32_t si14);
@@ -1479,7 +1614,7 @@ class AssemblerLOONGARCH64 : public AssemblerShared {
return false;
#endif
}
static bool SupportsSimd() { return false; }
static bool SupportsSimd() { return true; }
static bool SupportsUnalignedAccesses() { return true; }
static bool SupportsFastUnalignedFPAccesses() { return true; }
@@ -833,7 +833,14 @@ CodeGeneratorLoongArch64::visitWrapInt64ToInt32(LWrapInt64ToInt32* lir)
else
masm.ma_sll(output, ToRegister(input), Imm32(0));
} else {
MOZ_CRASH("Not implemented.");
if (input->isMemory())
masm.load32(Address(ToAddress(input).base,
ToAddress(input).offset + sizeof(int32_t)),
output);
else {
masm.ma_dsrl(output, ToRegister(input), Imm32(32));
masm.ma_sll(output, output, Imm32(0));
}
}
}
@@ -1010,15 +1017,37 @@ CodeGeneratorLoongArch64::visitTestI64AndBranch(LTestI64AndBranch* lir)
emitBranch(input.reg, Imm32(0), Assembler::NonZero, ifTrue, ifFalse);
}
void
CodeGeneratorLoongArch64::visitWasmStackArg(LWasmStackArg* ins)
{
MIRType type = ins->mir()->input()->type();
if (IsSimdType(type)) {
MOZ_ASSERT(ins->arg()->isFloatReg());
Address dst(StackPointer, ins->mir()->spOffset());
FloatRegister src = ToFloatRegister(ins->arg()).asSimd128();
if (type == MIRType::Float32x4)
masm.storeAlignedSimd128Float(src, dst);
else
masm.storeAlignedSimd128Int(src, dst);
return;
}
CodeGeneratorMIPSShared::visitWasmStackArg(ins);
}
void
CodeGeneratorLoongArch64::setReturnDoubleRegs(LiveRegisterSet* regs)
{
MOZ_ASSERT(ReturnFloat32Reg.encoding() == FloatRegisters::f0);
MOZ_ASSERT(ReturnDoubleReg.encoding() == FloatRegisters::f0);
MOZ_ASSERT(ReturnSimd128Reg.encoding() == FloatRegisters::f0);
FloatRegister f1 = { FloatRegisters::f1, FloatRegisters::Single };
regs->add(ReturnFloat32Reg);
regs->add(f1);
regs->add(ReturnDoubleReg);
regs->add(ReturnSimd128Reg);
}
void
@@ -65,6 +65,7 @@ class CodeGeneratorLoongArch64 : public CodeGeneratorMIPSShared
void visitWasmUnalignedLoadI64(LWasmUnalignedLoadI64* lir);
void visitWasmStoreI64(LWasmStoreI64* ins);
void visitWasmUnalignedStoreI64(LWasmUnalignedStoreI64* ins);
void visitWasmStackArg(LWasmStackArg* ins);
void visitWasmLoadGlobalVarI64(LWasmLoadGlobalVarI64* ins);
void visitWasmStoreGlobalVarI64(LWasmStoreGlobalVarI64* ins);
void visitWasmSelectI64(LWasmSelectI64* ins);
@@ -6,6 +6,8 @@
#include "jit/loongarch64/MacroAssembler-loongarch64.h"
#include <cstring>
#include "jsmath.h"
#include "jit/Bailouts.h"
@@ -955,8 +957,13 @@ void MacroAssemblerLOONGARCH64::ma_subPtrTestOverflow(Register rd, Register rj,
void MacroAssemblerLOONGARCH64::ma_subPtrTestOverflow(Register rd, Register rj,
Imm32 imm, Label* overflow) {
// TODO(loongarch64): Check subPtrTestOverflow
MOZ_ASSERT(imm.value != INT32_MIN);
if (imm.value == INT32_MIN) {
SecondScratchRegisterScope scratch2(asMasm());
ma_li(scratch2, imm);
ma_subPtrTestOverflow(rd, rj, scratch2, overflow);
return;
}
ma_addPtrTestOverflow(rd, rj, Imm32(-imm.value), overflow);
}
@@ -1294,10 +1301,20 @@ void MacroAssemblerLOONGARCH64::ma_cmp_set(Register rd, Register rj, ImmPtr imm,
void MacroAssemblerLOONGARCH64::ma_cmp_set(Register rd, Address address, Imm32 imm,
Condition c) {
// TODO(loongarch64): 32-bit ma_cmp_set?
SecondScratchRegisterScope scratch2(asMasm());
ma_ld_w(scratch2, address);
ma_cmp_set(rd, Register(scratch2), imm, c);
switch (c) {
case Above:
case AboveOrEqual:
case Below:
case BelowOrEqual:
ma_ld_wu(scratch2, address);
ma_cmp_set(rd, Register(scratch2), ImmWord(uint32_t(imm.value)), c);
break;
default:
ma_ld_w(scratch2, address);
ma_cmp_set(rd, Register(scratch2), imm, c);
break;
}
}
void MacroAssemblerLOONGARCH64::ma_cmp_set(Register rd, Address address,
@@ -1384,6 +1401,36 @@ void MacroAssemblerLOONGARCH64::ma_fst_d(FloatRegister src, Address address) {
}
}
void MacroAssemblerLOONGARCH64::ma_vld(FloatRegister dest, Address address) {
MOZ_ASSERT(dest.isSimd128());
int32_t offset = address.offset;
Register base = address.base;
if (is_intN(offset, 12)) {
as_vld(dest, base, offset);
} else {
ScratchRegisterScope scratch(asMasm());
MOZ_ASSERT(base != scratch);
ma_li(scratch, Imm32(offset));
as_vldx(dest, base, scratch);
}
}
void MacroAssemblerLOONGARCH64::ma_vst(FloatRegister src, Address address) {
MOZ_ASSERT(src.isSimd128());
int32_t offset = address.offset;
Register base = address.base;
if (is_intN(offset, 12)) {
as_vst(src, base, offset);
} else {
ScratchRegisterScope scratch(asMasm());
MOZ_ASSERT(base != scratch);
ma_li(scratch, Imm32(offset));
as_vstx(src, base, scratch);
}
}
void MacroAssemblerLOONGARCH64::ma_pop(FloatRegister f) {
if (f.isDouble()) {
as_fld_d(f, StackPointer, 0);
@@ -1847,12 +1894,19 @@ void MacroAssemblerLOONGARCH64::storeUnalignedFloat32(
}
// Branches when done from within loongarch-specific code.
// TODO(loongarch64) Optimize ma_b
void MacroAssemblerLOONGARCH64::ma_b(Register lhs, Register rhs, Label* label,
Condition c, JumpKind jumpKind) {
switch (c) {
case Equal:
case NotEqual:
case Above:
case AboveOrEqual:
case Below:
case BelowOrEqual:
case GreaterThan:
case GreaterThanOrEqual:
case LessThan:
case LessThanOrEqual:
asMasm().branchWithCode(getBranchCode(lhs, rhs, c), label, jumpKind);
break;
case Always:
@@ -1865,12 +1919,8 @@ void MacroAssemblerLOONGARCH64::ma_b(Register lhs, Register rhs, Label* label,
MOZ_ASSERT(lhs == rhs);
asMasm().branchWithCode(getBranchCode(lhs, c), label, jumpKind);
break;
default: {
Condition cond = ma_cmp(ScratchRegister, lhs, rhs, c);
asMasm().branchWithCode(getBranchCode(ScratchRegister, cond), label,
jumpKind);
break;
}
default:
MOZ_CRASH("Invalid condition.");
}
}
@@ -2046,6 +2096,12 @@ void MacroAssemblerLOONGARCH64::ma_fst_s(FloatRegister ft, BaseIndex address) {
asMasm().ma_fst_s(ft, Address(scratch2, address.offset));
}
void MacroAssemblerLOONGARCH64::ma_vst(FloatRegister ft, BaseIndex address) {
SecondScratchRegisterScope scratch2(asMasm());
asMasm().computeScaledAddress(address, scratch2);
asMasm().ma_vst(ft, Address(scratch2, address.offset));
}
void MacroAssemblerLOONGARCH64::ma_fld_d(FloatRegister ft, const BaseIndex& src) {
SecondScratchRegisterScope scratch2(asMasm());
asMasm().computeScaledAddress(src, scratch2);
@@ -2058,6 +2114,12 @@ void MacroAssemblerLOONGARCH64::ma_fld_s(FloatRegister ft, const BaseIndex& src)
asMasm().ma_fld_s(ft, Address(scratch2, src.offset));
}
void MacroAssemblerLOONGARCH64::ma_vld(FloatRegister ft, const BaseIndex& src) {
SecondScratchRegisterScope scratch2(asMasm());
asMasm().computeScaledAddress(src, scratch2);
asMasm().ma_vld(ft, Address(scratch2, src.offset));
}
void MacroAssemblerLOONGARCH64::ma_bc_s(FloatRegister lhs, FloatRegister rhs,
Label* label, DoubleCondition c,
JumpKind jumpKind, FPConditionBit fcc) {
@@ -2390,6 +2452,390 @@ void MacroAssemblerLOONGARCH64::loadFloat32(const BaseIndex& src,
asMasm().ma_fld_s(dest, src);
}
void MacroAssemblerLOONGARCH64::loadUnalignedSimd128Float(const Address& src,
FloatRegister dest) {
asMasm().ma_vld(dest.asSimd128(), src);
}
void MacroAssemblerLOONGARCH64::loadUnalignedSimd128Float(const BaseIndex& src,
FloatRegister dest) {
asMasm().ma_vld(dest.asSimd128(), src);
}
void MacroAssemblerLOONGARCH64::storeUnalignedSimd128Float(FloatRegister src,
const Address& dest) {
asMasm().ma_vst(src.asSimd128(), dest);
}
void MacroAssemblerLOONGARCH64::storeUnalignedSimd128Float(FloatRegister src,
const BaseIndex& dest) {
asMasm().ma_vst(src.asSimd128(), dest);
}
void MacroAssemblerLOONGARCH64::loadConstantSimd128Int(const SimdConstant& v,
FloatRegister dest) {
uint64_t words[2];
memcpy(words, v.bytes(), sizeof(words));
ma_add_d(StackPointer, StackPointer, Imm32(-Simd128DataSize));
{
ScratchRegisterScope scratch(asMasm());
ma_li(scratch, ImmWord(words[0]));
ma_st_d(scratch, Address(StackPointer, 0));
ma_li(scratch, ImmWord(words[1]));
ma_st_d(scratch, Address(StackPointer, sizeof(uint64_t)));
}
loadAlignedSimd128Int(Address(StackPointer, 0), dest);
ma_add_d(StackPointer, StackPointer, Imm32(Simd128DataSize));
}
void MacroAssemblerLOONGARCH64::loadConstantSimd128Float(const SimdConstant& v,
FloatRegister dest) {
loadConstantSimd128Int(v, dest);
}
void MacroAssemblerLOONGARCH64::moveSimd128Float(FloatRegister src,
FloatRegister dest) {
src = src.asSimd128();
dest = dest.asSimd128();
if (src == dest) {
return;
}
as_vor_v(dest, src, src);
}
void MacroAssemblerLOONGARCH64::zeroSimd128Float(FloatRegister dest) {
dest = dest.asSimd128();
as_vxor_v(dest, dest, dest);
}
void MacroAssemblerLOONGARCH64::createInt32x4(Register lane0, Register lane1,
Register lane2, Register lane3,
FloatRegister dest) {
dest = dest.asSimd128();
as_vreplgr2vr_w(dest, lane0);
as_vinsgr2vr_w(dest, lane1, 1);
as_vinsgr2vr_w(dest, lane2, 2);
as_vinsgr2vr_w(dest, lane3, 3);
}
void MacroAssemblerLOONGARCH64::splatX4(Register input, FloatRegister output) {
as_vreplgr2vr_w(output.asSimd128(), input);
}
void MacroAssemblerLOONGARCH64::splatX4(FloatRegister input,
FloatRegister output) {
as_vreplvei_w(output.asSimd128(), input.asSimd128(), 0);
}
void MacroAssemblerLOONGARCH64::extractLaneInt32x4(FloatRegister input,
Register output,
unsigned lane) {
as_vpickve2gr_w(output, input.asSimd128(), lane);
}
void MacroAssemblerLOONGARCH64::extractLaneFloat32x4(FloatRegister input,
FloatRegister output,
unsigned lane,
bool canonicalize) {
ScratchRegisterScope scratch(asMasm());
as_vpickve2gr_w(scratch, input.asSimd128(), lane);
moveToFloat32(scratch, output);
if (canonicalize) {
asMasm().canonicalizeFloat(output);
}
}
void MacroAssemblerLOONGARCH64::insertLaneSimdInt(FloatRegister input,
Register value,
FloatRegister output,
unsigned lane,
unsigned numLanes) {
MOZ_ASSERT(numLanes == 4);
if (input != output) {
moveSimd128Int(input, output);
}
as_vinsgr2vr_w(output.asSimd128(), value, lane);
}
void MacroAssemblerLOONGARCH64::insertLaneFloat32x4(FloatRegister input,
FloatRegister value,
FloatRegister output,
unsigned lane) {
if (input != output) {
moveSimd128Float(input, output);
}
ScratchRegisterScope scratch(asMasm());
moveFromFloat32(value, scratch);
as_vinsgr2vr_w(output.asSimd128(), scratch, lane);
}
void MacroAssemblerLOONGARCH64::addInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vadd_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::subInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vsub_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::mulInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vmul_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::minInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vmin_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::maxInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vmax_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::minUint32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vmin_wu(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::maxUint32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vmax_wu(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::negInt32x4(FloatRegister input,
FloatRegister dest) {
as_vneg_w(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::shiftLeftInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vsll_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::shiftRightInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vsra_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::unsignedShiftRightInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vsrl_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::shiftLeftInt32x4(FloatRegister lhs, Imm32 rhs,
FloatRegister dest) {
as_vslli_w(dest.asSimd128(), lhs.asSimd128(), rhs.value & 31);
}
void MacroAssemblerLOONGARCH64::shiftRightInt32x4(FloatRegister lhs, Imm32 rhs,
FloatRegister dest) {
as_vsrai_w(dest.asSimd128(), lhs.asSimd128(), rhs.value & 31);
}
void MacroAssemblerLOONGARCH64::unsignedShiftRightInt32x4(FloatRegister lhs,
Imm32 rhs,
FloatRegister dest) {
as_vsrli_w(dest.asSimd128(), lhs.asSimd128(), rhs.value & 31);
}
void MacroAssemblerLOONGARCH64::compareInt32x4Equal(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vseq_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareInt32x4LessThan(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vslt_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareInt32x4LessThanOrEqual(
FloatRegister lhs, FloatRegister rhs, FloatRegister dest) {
as_vsle_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareUint32x4LessThan(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vslt_wu(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareUint32x4LessThanOrEqual(
FloatRegister lhs, FloatRegister rhs, FloatRegister dest) {
as_vsle_wu(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::addFloat32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfadd_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::subFloat32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfsub_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::mulFloat32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfmul_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::minFloat32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfmin_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::maxFloat32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfmax_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::sqrtFloat32x4(FloatRegister input,
FloatRegister dest) {
as_vfsqrt_s(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::reciprocalApproximationFloat32x4(
FloatRegister input, FloatRegister dest) {
as_vfrecip_s(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::reciprocalSqrtApproximationFloat32x4(
FloatRegister input, FloatRegister dest) {
as_vfrsqrt_s(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::roundFloat32x4(FloatRegister input,
FloatRegister dest) {
as_vfrint_s(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::convertInt32x4ToFloat32x4(FloatRegister input,
FloatRegister dest) {
as_vffint_s_w(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::convertFloat32x4ToInt32x4(FloatRegister input,
FloatRegister dest) {
as_vftint_w_s(dest.asSimd128(), input.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4Equal(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfcmp_ceq_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4NotEqual(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfcmp_cune_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4LessThan(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfcmp_clt_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4LessThanOrEqual(
FloatRegister lhs, FloatRegister rhs, FloatRegister dest) {
as_vfcmp_cle_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4Unordered(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vfcmp_cun_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4UnorderedLessThan(
FloatRegister lhs, FloatRegister rhs, FloatRegister dest) {
as_vfcmp_cult_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::compareFloat32x4UnorderedLessThanOrEqual(
FloatRegister lhs, FloatRegister rhs, FloatRegister dest) {
as_vfcmp_cule_s(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::interleaveLowInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vilvl_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::interleaveHighInt32x4(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vilvh_w(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitselectSimd128(FloatRegister mask,
FloatRegister onTrue,
FloatRegister onFalse,
FloatRegister dest) {
as_vbitsel_v(dest.asSimd128(), onFalse.asSimd128(), onTrue.asSimd128(),
mask.asSimd128());
}
void MacroAssemblerLOONGARCH64::shuffleBytesSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister control,
FloatRegister dest) {
as_vshuf_b(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128(),
control.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitwiseAndSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vand_v(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitwiseOrSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vor_v(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitwiseXorSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vxor_v(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitwiseNorSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vnor_v(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::bitwiseAndNotSimd128(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest) {
as_vandn_v(dest.asSimd128(), lhs.asSimd128(), rhs.asSimd128());
}
void MacroAssemblerLOONGARCH64::wasmLoadImpl(const wasm::MemoryAccessDesc& access,
Register memoryBase, Register ptr,
Register ptrScratch,
@@ -2516,7 +2962,8 @@ void MacroAssemblerLOONGARCH64Compat::wasmLoadI64Impl(
as_ldx_w(output.reg, memoryBase, ptr);
break;
case Scalar::Uint32:
// TODO(loongarch64): Why need zero-extension here?
// Uint32 loads must clear the upper 32 bits before the value is consumed
// by 64-bit wasm operations.
as_ldx_wu(output.reg, memoryBase, ptr);
break;
case Scalar::Int64:
@@ -2617,14 +3064,18 @@ void MacroAssembler::PushRegsInMask(LiveRegisterSet set) {
storePtr(*iter, Address(StackPointer, diff));
}
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
for (FloatRegisterBackwardIterator iter(set.fpus().reduceSetForPush());
iter.more(); ++iter) {
diff -= sizeof(double);
storeDouble(*iter, Address(StackPointer, diff));
FloatRegister reg = *iter;
diff -= reg.size();
if (reg.isSingle()) {
storeFloat32(reg, Address(StackPointer, diff));
} else if (reg.isSimd128()) {
storeUnalignedSimd128Float(reg, Address(StackPointer, diff));
} else {
MOZ_ASSERT(reg.isDouble());
storeDouble(reg, Address(StackPointer, diff));
}
}
MOZ_ASSERT(diff == 0);
}
@@ -2642,15 +3093,19 @@ void MacroAssembler::PopRegsInMaskIgnore(LiveRegisterSet set,
}
}
#ifdef ENABLE_WASM_SIMD
# error "Needs more careful logic if SIMD is enabled"
#endif
for (FloatRegisterBackwardIterator iter(set.fpus().reduceSetForPush());
iter.more(); ++iter) {
diff -= sizeof(double);
FloatRegister reg = *iter;
diff -= reg.size();
if (!ignore.has(*iter)) {
loadDouble(Address(StackPointer, diff), *iter);
if (reg.isSingle()) {
loadFloat32(Address(StackPointer, diff), reg);
} else if (reg.isSimd128()) {
loadUnalignedSimd128Float(Address(StackPointer, diff), reg);
} else {
MOZ_ASSERT(reg.isDouble());
loadDouble(Address(StackPointer, diff), reg);
}
}
}
MOZ_ASSERT(diff == 0);
@@ -199,6 +199,8 @@ class MacroAssemblerLOONGARCH64 : public Assembler {
void ma_fld_d(FloatRegister ft, Address address);
void ma_fst_d(FloatRegister ft, Address address);
void ma_fst_s(FloatRegister ft, Address address);
void ma_vld(FloatRegister vt, Address address);
void ma_vst(FloatRegister vt, Address address);
void ma_pop(FloatRegister f);
void ma_push(FloatRegister f);
@@ -451,9 +453,11 @@ class MacroAssemblerLOONGARCH64 : public Assembler {
void ma_fst_d(FloatRegister src, BaseIndex address);
void ma_fst_s(FloatRegister src, BaseIndex address);
void ma_vst(FloatRegister src, BaseIndex address);
void ma_fld_d(FloatRegister dest, const BaseIndex& src);
void ma_fld_s(FloatRegister dest, const BaseIndex& src);
void ma_vld(FloatRegister dest, const BaseIndex& src);
// FP branches
void ma_bc_s(FloatRegister lhs, FloatRegister rhs, Label* label,
@@ -631,6 +635,139 @@ class MacroAssemblerLOONGARCH64 : public Assembler {
void loadFloat32(const Address& addr, FloatRegister dest);
void loadFloat32(const BaseIndex& src, FloatRegister dest);
void loadUnalignedSimd128Float(const Address& src, FloatRegister dest);
void loadUnalignedSimd128Float(const BaseIndex& src, FloatRegister dest);
void storeUnalignedSimd128Float(FloatRegister src, const Address& dest);
void storeUnalignedSimd128Float(FloatRegister src, const BaseIndex& dest);
void loadAlignedSimd128Float(const Address& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void loadAlignedSimd128Float(const BaseIndex& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void storeAlignedSimd128Float(FloatRegister src, const Address& dest) {
storeUnalignedSimd128Float(src, dest);
}
void storeAlignedSimd128Float(FloatRegister src, const BaseIndex& dest) {
storeUnalignedSimd128Float(src, dest);
}
void loadConstantSimd128Float(const SimdConstant& v, FloatRegister dest);
void loadConstantSimd128Int(const SimdConstant& v, FloatRegister dest);
void moveSimd128Float(FloatRegister src, FloatRegister dest);
void moveSimd128Int(FloatRegister src, FloatRegister dest) {
moveSimd128Float(src, dest);
}
void zeroSimd128Float(FloatRegister dest);
void zeroSimd128Int(FloatRegister dest) { zeroSimd128Float(dest); }
void createInt32x4(Register lane0, Register lane1, Register lane2,
Register lane3, FloatRegister dest);
void splatX4(Register input, FloatRegister output);
void splatX4(FloatRegister input, FloatRegister output);
void extractLaneInt32x4(FloatRegister input, Register output, unsigned lane);
void extractLaneFloat32x4(FloatRegister input, FloatRegister output,
unsigned lane, bool canonicalize);
void insertLaneSimdInt(FloatRegister input, Register value,
FloatRegister output, unsigned lane,
unsigned numLanes);
void insertLaneFloat32x4(FloatRegister input, FloatRegister value,
FloatRegister output, unsigned lane);
void addInt32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void subInt32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void mulInt32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void minInt32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void maxInt32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void minUint32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void maxUint32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void negInt32x4(FloatRegister input, FloatRegister dest);
void shiftLeftInt32x4(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void shiftRightInt32x4(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void unsignedShiftRightInt32x4(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void shiftLeftInt32x4(FloatRegister lhs, Imm32 rhs, FloatRegister dest);
void shiftRightInt32x4(FloatRegister lhs, Imm32 rhs, FloatRegister dest);
void unsignedShiftRightInt32x4(FloatRegister lhs, Imm32 rhs,
FloatRegister dest);
void compareInt32x4Equal(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareInt32x4LessThan(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareInt32x4LessThanOrEqual(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareUint32x4LessThan(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareUint32x4LessThanOrEqual(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void addFloat32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void subFloat32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void mulFloat32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void minFloat32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void maxFloat32x4(FloatRegister lhs, FloatRegister rhs, FloatRegister dest);
void sqrtFloat32x4(FloatRegister input, FloatRegister dest);
void reciprocalApproximationFloat32x4(FloatRegister input, FloatRegister dest);
void reciprocalSqrtApproximationFloat32x4(FloatRegister input,
FloatRegister dest);
void roundFloat32x4(FloatRegister input, FloatRegister dest);
void convertInt32x4ToFloat32x4(FloatRegister input, FloatRegister dest);
void convertFloat32x4ToInt32x4(FloatRegister input, FloatRegister dest);
void compareFloat32x4Equal(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4NotEqual(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4LessThan(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4LessThanOrEqual(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4Unordered(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4UnorderedLessThan(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void compareFloat32x4UnorderedLessThanOrEqual(FloatRegister lhs,
FloatRegister rhs,
FloatRegister dest);
void interleaveLowInt32x4(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void interleaveHighInt32x4(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void bitselectSimd128(FloatRegister mask, FloatRegister onTrue,
FloatRegister onFalse, FloatRegister dest);
void shuffleBytesSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister control, FloatRegister dest);
void bitwiseAndSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void bitwiseOrSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void bitwiseXorSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void bitwiseNorSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void bitwiseAndNotSimd128(FloatRegister lhs, FloatRegister rhs,
FloatRegister dest);
void loadUnalignedSimd128Int(const Address& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void loadUnalignedSimd128Int(const BaseIndex& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void loadAlignedSimd128Int(const Address& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void loadAlignedSimd128Int(const BaseIndex& src, FloatRegister dest) {
loadUnalignedSimd128Float(src, dest);
}
void storeUnalignedSimd128Int(FloatRegister src, const Address& dest) {
storeUnalignedSimd128Float(src, dest);
}
void storeUnalignedSimd128Int(FloatRegister src, const BaseIndex& dest) {
storeUnalignedSimd128Float(src, dest);
}
void storeAlignedSimd128Int(FloatRegister src, const Address& dest) {
storeUnalignedSimd128Float(src, dest);
}
void storeAlignedSimd128Int(FloatRegister src, const BaseIndex& dest) {
storeUnalignedSimd128Float(src, dest);
}
protected:
void wasmLoadImpl(const wasm::MemoryAccessDesc& access, Register memoryBase,
@@ -10,6 +10,75 @@
using namespace js;
using namespace js::jit;
Address
MoveEmitterLoongArch64::cycleSlot(uint32_t slot, uint32_t subslot) const
{
int32_t offset = masm.framePushed() - pushedAtCycle_;
MOZ_ASSERT(Imm16::IsInSignedRange(offset));
return Address(StackPointer, offset + slot * Simd128DataSize + subslot);
}
void
MoveEmitterLoongArch64::emit(const MoveResolver& moves)
{
if (moves.numCycles()) {
masm.reserveStack(moves.numCycles() * Simd128DataSize);
pushedAtCycle_ = masm.framePushed();
}
for (size_t i = 0; i < moves.numMoves(); i++)
emit(moves.getMove(i));
}
void
MoveEmitterLoongArch64::emit(const MoveOp& move)
{
const MoveOperand& from = move.from();
const MoveOperand& to = move.to();
if (move.isCycleEnd() && move.isCycleBegin()) {
breakCycle(from, to, move.endCycleType(), move.cycleBeginSlot());
completeCycle(from, to, move.type(), move.cycleEndSlot());
return;
}
if (move.isCycleEnd()) {
MOZ_ASSERT(inCycle_);
completeCycle(from, to, move.type(), move.cycleEndSlot());
MOZ_ASSERT(inCycle_ > 0);
inCycle_--;
return;
}
if (move.isCycleBegin()) {
breakCycle(from, to, move.endCycleType(), move.cycleBeginSlot());
inCycle_++;
}
switch (move.type()) {
case MoveOp::FLOAT32:
emitFloat32Move(from, to);
break;
case MoveOp::DOUBLE:
emitDoubleMove(from, to);
break;
case MoveOp::INT32:
emitInt32Move(from, to);
break;
case MoveOp::GENERAL:
emitMove(from, to);
break;
case MoveOp::SIMD128INT:
emitSimd128IntMove(from, to);
break;
case MoveOp::SIMD128FLOAT:
emitSimd128FloatMove(from, to);
break;
default:
MOZ_CRASH("Unexpected move type");
}
}
void
MoveEmitterLoongArch64::breakCycle(const MoveOperand& from, const MoveOperand& to,
MoveOp::Type type, uint32_t slotId)
@@ -33,6 +102,24 @@ MoveEmitterLoongArch64::breakCycle(const MoveOperand& from, const MoveOperand& t
masm.storeDouble(to.floatReg(), cycleSlot(slotId));
}
break;
case MoveOp::SIMD128INT:
if (to.isMemory()) {
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Int(getAdjustedAddress(to), temp);
masm.storeAlignedSimd128Int(temp, cycleSlot(slotId));
} else {
masm.storeAlignedSimd128Int(to.floatReg(), cycleSlot(slotId));
}
break;
case MoveOp::SIMD128FLOAT:
if (to.isMemory()) {
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Float(getAdjustedAddress(to), temp);
masm.storeAlignedSimd128Float(temp, cycleSlot(slotId));
} else {
masm.storeAlignedSimd128Float(to.floatReg(), cycleSlot(slotId));
}
break;
case MoveOp::INT32:
if (to.isMemory()) {
Register temp = tempReg();
@@ -81,6 +168,24 @@ MoveEmitterLoongArch64::completeCycle(const MoveOperand& from, const MoveOperand
masm.loadDouble(cycleSlot(slotId), to.floatReg());
}
break;
case MoveOp::SIMD128INT:
if (to.isMemory()) {
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Int(cycleSlot(slotId), temp);
masm.storeAlignedSimd128Int(temp, getAdjustedAddress(to));
} else {
masm.loadAlignedSimd128Int(cycleSlot(slotId), to.floatReg());
}
break;
case MoveOp::SIMD128FLOAT:
if (to.isMemory()) {
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Float(cycleSlot(slotId), temp);
masm.storeAlignedSimd128Float(temp, getAdjustedAddress(to));
} else {
masm.loadAlignedSimd128Float(cycleSlot(slotId), to.floatReg());
}
break;
case MoveOp::INT32:
MOZ_ASSERT(slotId == 0);
if (to.isMemory()) {
@@ -108,6 +213,56 @@ MoveEmitterLoongArch64::completeCycle(const MoveOperand& from, const MoveOperand
}
}
void
MoveEmitterLoongArch64::emitSimd128IntMove(const MoveOperand& from, const MoveOperand& to)
{
MOZ_ASSERT_IF(from.isFloatReg(), from.floatReg().isSimd128());
MOZ_ASSERT_IF(to.isFloatReg(), to.floatReg().isSimd128());
if (from.isFloatReg()) {
if (to.isFloatReg()) {
masm.moveSimd128Int(from.floatReg(), to.floatReg());
} else {
MOZ_ASSERT(to.isMemory());
masm.storeAlignedSimd128Int(from.floatReg(), getAdjustedAddress(to));
}
} else if (to.isFloatReg()) {
MOZ_ASSERT(from.isMemory());
masm.loadAlignedSimd128Int(getAdjustedAddress(from), to.floatReg());
} else {
MOZ_ASSERT(from.isMemory());
MOZ_ASSERT(to.isMemory());
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Int(getAdjustedAddress(from), temp);
masm.storeAlignedSimd128Int(temp, getAdjustedAddress(to));
}
}
void
MoveEmitterLoongArch64::emitSimd128FloatMove(const MoveOperand& from, const MoveOperand& to)
{
MOZ_ASSERT_IF(from.isFloatReg(), from.floatReg().isSimd128());
MOZ_ASSERT_IF(to.isFloatReg(), to.floatReg().isSimd128());
if (from.isFloatReg()) {
if (to.isFloatReg()) {
masm.moveSimd128Float(from.floatReg(), to.floatReg());
} else {
MOZ_ASSERT(to.isMemory());
masm.storeAlignedSimd128Float(from.floatReg(), getAdjustedAddress(to));
}
} else if (to.isFloatReg()) {
MOZ_ASSERT(from.isMemory());
masm.loadAlignedSimd128Float(getAdjustedAddress(from), to.floatReg());
} else {
MOZ_ASSERT(from.isMemory());
MOZ_ASSERT(to.isMemory());
FloatRegister temp = ScratchSimd128Reg;
masm.loadAlignedSimd128Float(getAdjustedAddress(from), temp);
masm.storeAlignedSimd128Float(temp, getAdjustedAddress(to));
}
}
void
MoveEmitterLoongArch64::emitDoubleMove(const MoveOperand& from, const MoveOperand& to)
{
@@ -13,7 +13,13 @@ namespace jit {
class MoveEmitterLoongArch64 : public MoveEmitterMIPSShared
{
Address cycleSlot(uint32_t slot, uint32_t subslot = 0) const;
void emitDoubleMove(const MoveOperand& from, const MoveOperand& to);
void emitSimd128IntMove(const MoveOperand& from, const MoveOperand& to);
void emitSimd128FloatMove(const MoveOperand& from, const MoveOperand& to);
void emit(const MoveOp& move);
void breakCycle(const MoveOperand& from, const MoveOperand& to,
MoveOp::Type type, uint32_t slot);
void completeCycle(const MoveOperand& from, const MoveOperand& to,
@@ -23,6 +29,8 @@ class MoveEmitterLoongArch64 : public MoveEmitterMIPSShared
MoveEmitterLoongArch64(MacroAssembler& masm)
: MoveEmitterMIPSShared(masm)
{ }
void emit(const MoveResolver& moves);
};
typedef MoveEmitterLoongArch64 MoveEmitter;
+3 -2
View File
@@ -85,8 +85,9 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator* gen, LIRGraph* graph, Mac
MOZ_ASSERT(graph->argumentSlotCount() == 0);
frameDepth_ += gen->wasmMaxStackArgBytes();
static_assert(!SupportsSimd, "we need padding so that local slots are SIMD-aligned and "
"the stack must be kept SIMD-aligned too.");
if (SupportsSimd) {
frameDepth_ = AlignBytes(frameDepth_, SimdMemoryAlignment);
}
if (gen->performsCall()) {
// An MWasmCall does not align the stack pointer at calls sites but
+22 -2
View File
@@ -902,8 +902,28 @@ namespace js {
// scheduledForDestruction will be set on the compartment, which will cause
// some extra GC activity to try to free the compartment.
template<typename T> inline void SetMaybeAliveFlag(T* thing) {}
template<> inline void SetMaybeAliveFlag(JSObject* thing) {thing->compartment()->maybeAlive = true;}
template<> inline void SetMaybeAliveFlag(JSScript* thing) {thing->compartment()->maybeAlive = true;}
template<> inline void SetMaybeAliveFlag(JSObject* thing) {
// During GC marking of WeakRefs, 'thing' might be an invalid/dangling
// pointer. Verify compartment is accessible.
if (MOZ_LIKELY(thing)) {
JSCompartment* comp = thing->compartment();
if (MOZ_LIKELY(comp)) {
comp->maybeAlive = true;
}
}
}
template<> inline void SetMaybeAliveFlag(JSScript* thing) {
// During GC marking of WeakRefs, 'thing' might be an invalid/dangling
// pointer. Verify compartment is accessible.
if (MOZ_LIKELY(thing)) {
JSCompartment* comp = thing->compartment();
if (MOZ_LIKELY(comp)) {
comp->maybeAlive = true;
}
}
}
inline js::Handle<js::GlobalObject*>
ExclusiveContext::global() const
+1 -1
View File
@@ -1148,7 +1148,7 @@ js::DumpHeap(JSContext* cx, FILE* fp, js::DumpHeapNurseryBehaviour nurseryBehavi
fprintf(dtrc.output, "==========\n");
dtrc.prefix = "> ";
IterateZonesCompartmentsArenasCells(cx, &dtrc,
IterateHeapUnbarriered(cx, &dtrc,
DumpHeapVisitZone,
DumpHeapVisitCompartment,
DumpHeapVisitArena,
+19 -10
View File
@@ -3646,14 +3646,22 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAcces
}
/*
* Atoms are not in the cross-compartment map. So if there are any
* zones that are not being collected, we are not allowed to collect
* atoms. Otherwise, the non-collected zones could contain pointers
* to atoms that we would miss.
* Atoms are not in the cross-compartment map. If there are any zones that
* are not being collected then we cannot collect the atoms zone, otherwise
* the non-collected zones could contain pointers to atoms that we would
* miss.
*
* keepAtoms() will only change on the main thread, which we are currently
* on. If the value of keepAtoms() changes between GC slices, then we'll
* cancel the incremental GC. See IsIncrementalGCSafe.
* If keepAtoms() is true then either an instance of AutoKeepAtoms is
* currently on the stack or parsing is currently happening on another
* thread. In either case we don't have information about which atoms are
* roots, so we must skip collecting atoms.
*
* Note that only affects the first slice of an incremental GC since root
* marking is completed before we return to the mutator.
*
* Off-main-thread parsing is inhibited after the start of GC which prevents
* races between creating atoms during parsing and sweeping atoms on the
* main thread.
*/
if (isFull && !rt->keepAtoms()) {
@@ -5610,9 +5618,6 @@ gc::IsIncrementalGCUnsafe(JSRuntime* rt)
{
MOZ_ASSERT(!rt->mainThread.suppressGC);
if (rt->keepAtoms())
return gc::AbortReason::KeepAtomsSet;
if (!rt->gc.isIncrementalGCAllowed())
return gc::AbortReason::IncrementalDisabled;
@@ -5786,6 +5791,10 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason::
State prevState = incrementalState;
// We don't allow off-main-thread parsing to start while we're doing an
// incremental GC.
MOZ_ASSERT_IF(rt->activeGCInAtomsZone(), !rt->exclusiveThreadsPresent());
if (nonincrementalByAPI) {
// Reset any in progress incremental GC if this was triggered via the
// API. This isn't required for correctness, but sometimes during tests
+6 -3
View File
@@ -56,7 +56,7 @@ enum class State {
D(None) \
D(NonIncrementalRequested) \
D(AbortRequested) \
D(KeepAtomsSet) \
D(Unused1) \
D(IncrementalDisabled) \
D(ModeChange) \
D(MallocBytesTrigger) \
@@ -1065,9 +1065,12 @@ typedef void (*IterateCellCallback)(JSRuntime* rt, void* data, void* thing,
* This function calls |zoneCallback| on every zone, |compartmentCallback| on
* every compartment, |arenaCallback| on every in-use arena, and |cellCallback|
* on every in-use cell in the GC heap.
*
* Note that no read barrier is triggered on the cells passed to cellCallback,
* so no these pointers must not escape the callback.
*/
extern void
IterateZonesCompartmentsArenasCells(JSContext* cx, void* data,
IterateHeapUnbarriered(JSContext* cx, void* data,
IterateZoneCallback zoneCallback,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
@@ -1078,7 +1081,7 @@ IterateZonesCompartmentsArenasCells(JSContext* cx, void* data,
* single zone.
*/
extern void
IterateZoneCompartmentsArenasCells(JSContext* cx, Zone* zone, void* data,
IterateHeapUnbarrieredForZone(JSContext* cx, Zone* zone, void* data,
IterateZoneCallback zoneCallback,
JSIterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
+8 -2
View File
@@ -147,8 +147,6 @@ class ArenaCellIterImpl
void init(Arena* arena, CellIterNeedsBarrier mayNeedBarrier) {
MOZ_ASSERT(!initialized);
MOZ_ASSERT(arena);
MOZ_ASSERT_IF(!mayNeedBarrier,
CurrentThreadIsPerformingGC() || CurrentThreadIsGCSweeping());
initialized = true;
AllocKind kind = arena->getAllocKind();
firstThingOffset = Arena::firstThingOffset(kind);
@@ -236,6 +234,14 @@ class ArenaCellIterUnderFinalize : public ArenaCellIterImpl
}
};
class ArenaCellIterUnbarriered : public ArenaCellIterImpl
{
public:
explicit ArenaCellIterUnbarriered(Arena* arena)
: ArenaCellIterImpl(arena, CellIterDoesntNeedBarrier)
{}
};
template <typename T>
class ZoneCellIter;
+2
View File
@@ -3940,6 +3940,8 @@ js::Unbox(JSContext* cx, HandleObject obj, MutableHandleValue vp)
vp.setString(obj->as<StringObject>().unbox());
else if (obj->is<DateObject>())
vp.set(obj->as<DateObject>().UTCTime());
else if (obj->is<BigIntObject>())
vp.setBigInt(obj->as<BigIntObject>().unbox());
else
vp.setUndefined();
+3 -7
View File
@@ -158,6 +158,8 @@ class JSObject : public js::gc::Cell
* object will have its group constructed lazily as needed by analysis.
*/
bool isSingleton() const {
// In some cases, group_ might be null.
if (!group_) return false;
return group_->singleton();
}
@@ -895,10 +897,6 @@ GetElementNoGC(JSContext* cx, JSObject* obj, JSObject* receiver, uint32_t index,
* try. Long story short, if you just want bog-standard assignment, pass
* `ObjectValue(*obj)` as receiver. Or better, use one of the signatures that
* doesn't have a receiver parameter.
*
* Callers pass obj != receiver e.g. when a proxy is involved, obj is the
* proxy's target, and the proxy is using SetProperty to finish an assignment
* that started out as `receiver[id] = v`, by delegating it to obj.
*/
inline bool
SetProperty(JSContext* cx, HandleObject obj, HandleId id, HandleValue v,
@@ -1269,9 +1267,7 @@ FromPropertyDescriptorToObject(JSContext* cx, Handle<JS::PropertyDescriptor> des
extern bool
IsDelegate(JSContext* cx, HandleObject obj, const Value& v, bool* result);
// obj is a JSObject*, but we root it immediately up front. We do it
// that way because we need a Rooted temporary in this method anyway.
extern bool
bool
IsDelegateOfObject(JSContext* cx, HandleObject protoObj, JSObject* obj, bool* result);
/* Wrap boolean, number or string as Boolean, Number or String object. */
+3 -1
View File
@@ -3954,7 +3954,9 @@ JSScript::traceChildren(JSTracer* trc)
if (hasObjects()) {
ObjectArray* objarray = objects();
TraceRange(trc, objarray->length, objarray->vector, "objects");
if (objarray && objarray->length > 0 && objarray->vector) {
TraceRange(trc, objarray->length, objarray->vector, "objects");
}
}
MOZ_ASSERT_IF(sourceObject(), MaybeForwarded(sourceObject())->compartment() == compartment());
+8 -1
View File
@@ -940,7 +940,14 @@ GlobalHelperThreadState::maxParseThreads() const
if (IsHelperThreadSimulatingOOM(js::oom::THREAD_TYPE_PARSE))
return 1;
// Use the number of logical processors in a system.
return cpuCount;
if (cpuCount < 4)
return 2;
//return cpuCount - 2;
// XXX Issue #3172 XXX
// For the time being, return a hard-coded value of 2 on all targets and CPUs.
// It's unclear where the contention happens, but it has shown to be detrimental
// especially on *nixes and older hardware.
return 2;
}
size_t
+2 -2
View File
@@ -770,7 +770,7 @@ CollectRuntimeStatsHelper(JSContext* cx, RuntimeStats* rtStats, ObjectPrivateVis
StatsClosure closure(rtStats, opv, anonymize);
if (!closure.init())
return false;
IterateZonesCompartmentsArenasCells(cx, &closure,
IterateHeapUnbarriered(cx, &closure,
StatsZoneCallback,
StatsCompartmentCallback,
StatsArenaCallback,
@@ -916,7 +916,7 @@ AddSizeOfTab(JSContext* cx, HandleObject obj, MallocSizeOf mallocSizeOf, ObjectP
StatsClosure closure(&rtStats, opv, /* anonymize = */ false);
if (!closure.init())
return false;
IterateZoneCompartmentsArenasCells(cx, zone, &closure,
IterateHeapUnbarrieredForZone(cx, zone, &closure,
StatsZoneCallback,
StatsCompartmentCallback,
StatsArenaCallback,
+9 -7
View File
@@ -1373,16 +1373,18 @@ intrinsic_MoveTypedArrayElements(JSContext* cx, unsigned argc, Value* vp)
MOZ_ASSERT((UINT32_MAX >> ElementShift) >= count);
uint32_t byteSize = count << ElementShift;
#ifdef DEBUG
{
uint32_t viewByteLength = tarray->byteLength();
MOZ_ASSERT(byteSize <= viewByteLength);
MOZ_ASSERT(byteDest < viewByteLength);
MOZ_ASSERT(byteSrc < viewByteLength);
MOZ_ASSERT(byteDest <= viewByteLength - byteSize);
MOZ_ASSERT(byteSrc <= viewByteLength - byteSize);
if (byteSize > viewByteLength ||
byteDest >= viewByteLength ||
byteSrc >= viewByteLength ||
byteDest > viewByteLength - byteSize ||
byteSrc > viewByteLength - byteSize) {
JS_ReportErrorNumberASCII(
cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_OUT_OF_BOUNDS);
return false;
}
}
#endif
SharedMem<uint8_t*> data = tarray->viewDataEither().cast<uint8_t*>();
jit::AtomicOperations::memmoveSafeWhenRacy(data + byteDest, data + byteSrc, byteSize);
+1 -2
View File
@@ -1740,8 +1740,7 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSContext* cx, const Register
: rt_(cx),
sampleBufferGen_(sampleBufferGen),
activation_(nullptr),
savedPrevJitTop_(nullptr),
nogc_(cx)
savedPrevJitTop_(nullptr)
{
if (!cx->spsProfiler.enabled())
MOZ_CRASH("ProfilingFrameIterator called when spsProfiler not enabled for runtime.");
-1
View File
@@ -1059,7 +1059,6 @@ wasm::GenerateInterruptExit(MacroAssembler& masm, Label* throwLabel)
// jump scratch to resume execution.
masm.subFromStackPtr(Imm32(sizeof(intptr_t)));
masm.setFramePushed(0);
static_assert(!SupportsSimd, "high lanes of SIMD registers need to be saved too.");
masm.PushRegsInMask(AllRegsExceptSP);
// Save the unaligned stack pointer in a non-volatile register, then align
+64 -26
View File
@@ -261,7 +261,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
ContentStateChangedInternal(aElement, aStateMask, &changeHint, &restyleHint);
PostRestyleEvent(aElement, restyleHint, changeHint);
RestyleForHasPseudoClassChange(aElement);
RestyleForHasPseudoClassChange(aElement, aStateMask);
}
// Forwarded nsIMutationObserver method, to handle restyling.
@@ -282,6 +282,12 @@ RestyleManager::AttributeWillChange(Element* aElement,
aNewValue,
rsdata);
PostRestyleEvent(aElement, rshint, nsChangeHint(0), &rsdata);
// Class values are preparsed by Element before this notification. Compare
// membership now: AttributeChanged need not receive the previous value.
if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::_class) {
RestyleForHasPseudoClassChange(aElement, EventStates(), aAttribute,
aNewValue, true);
}
}
// Forwarded nsIMutationObserver method, to handle restyling (and
@@ -373,30 +379,68 @@ RestyleManager::AttributeChanged(Element* aElement,
aOldValue,
rsdata);
PostRestyleEvent(aElement, rshint, hint, &rsdata);
RestyleForHasPseudoClassChange(aElement);
if (aNameSpaceID != kNameSpaceID_None || aAttribute != nsGkAtoms::_class) {
RestyleForHasPseudoClassChange(aElement, EventStates(), aAttribute);
}
}
bool
RestyleManager::RestyleForHasPseudoClassChange(nsINode* aNode)
void
RestyleManager::RestyleForHasPseudoClassChange(nsINode* aNode,
EventStates aStateMask,
nsIAtom* aAttribute,
const nsAttrValue* aNewClasses,
bool aCompareClasses)
{
Element* affectedRoot = nullptr;
MOZ_ASSERT(!aAttribute || aNode->IsElement());
if (!aNode->OwnerDoc()->GetProperty(nsGkAtoms::hasSelectorDependency)) {
return;
}
using Dependency = nsCSSRuleUtils::HasSelectorDependency;
auto restyleAnchor = [&](Element* aAnchor, Dependency* aDependency) {
nsRestyleHint hint = eRestyle_Subtree;
if (aDependency->mRestyleLaterSiblings) {
hint = nsRestyleHint(hint | eRestyle_LaterSiblings);
}
PostRestyleEvent(aAnchor, hint, nsChangeHint(0));
};
for (nsINode* node = aNode; node; node = node->GetParentNode()) {
if (!node->GetProperty(nsGkAtoms::hasSelectorDependency)) {
auto* dependency = static_cast<Dependency*>(
node->GetProperty(nsGkAtoms::hasSelectorDependency));
if (!dependency) {
continue;
}
if (node->IsElement()) {
affectedRoot = node->AsElement();
} else if (ShadowRoot* shadow = ShadowRoot::FromNode(node)) {
affectedRoot = shadow->GetHost();
if (node->IsElement() && dependency->MightDependOnChange(
node->AsElement(), aNode, aStateMask, aAttribute, aNewClasses,
aCompareClasses, false)) {
restyleAnchor(node->AsElement(), dependency);
}
if (!dependency->MightAffectSiblingAnchor(
node, aNode, aStateMask, aAttribute, aNewClasses, aCompareClasses)) {
continue;
}
// The parent is an index of sibling anchors, not itself an anchor. Keep
// unrelated subtrees out of the restyle, including mutations deep inside
// a sibling whose :has() argument only inspects the sibling element.
bool nodeIsFollowingSibling = true;
for (nsIContent* child = node->GetFirstChild(); child;
child = child->GetNextSibling()) {
if (child == aNode) {
nodeIsFollowingSibling = false;
}
if (!child->IsElement()) {
continue;
}
auto* siblingDependency = static_cast<Dependency*>(
child->GetProperty(nsGkAtoms::hasSelectorDependency));
if (siblingDependency && siblingDependency->MightDependOnChange(
child->AsElement(), aNode, aStateMask, aAttribute, aNewClasses,
aCompareClasses, true, nodeIsFollowingSibling)) {
restyleAnchor(child->AsElement(), siblingDependency);
}
}
}
if (!affectedRoot) {
return false;
}
PostRestyleEvent(affectedRoot, eRestyle_Subtree, nsChangeHint(0));
return true;
}
/* static */ uint64_t
@@ -425,9 +469,7 @@ RestyleManager::RestyleForAppend(nsIContent* aContainer,
nsIContent* aFirstNewContent)
{
// The container cannot be a document, but might be a ShadowRoot.
if (RestyleForHasPseudoClassChange(aContainer)) {
return;
}
RestyleForHasPseudoClassChange(aContainer);
if (!aContainer->IsElement()) {
return;
@@ -518,9 +560,7 @@ RestyleManager::RestyleForInsertOrChange(nsINode* aContainer,
nsIContent* aChild)
{
// The container might be a document or a ShadowRoot.
if (RestyleForHasPseudoClassChange(aContainer)) {
return;
}
RestyleForHasPseudoClassChange(aContainer);
if (!aContainer->IsElement()) {
return;
@@ -612,9 +652,7 @@ RestyleManager::ContentRemoved(nsINode* aContainer,
nsIContent* aFollowingSibling)
{
// The container might be a document or a ShadowRoot.
if (RestyleForHasPseudoClassChange(aContainer)) {
return;
}
RestyleForHasPseudoClassChange(aContainer);
if (!aContainer->IsElement()) {
return;
+8 -3
View File
@@ -314,9 +314,14 @@ public:
// the container is null, no work is needed.
void RestyleForAppend(nsIContent* aContainer, nsIContent* aFirstNewContent);
// Restyle a subtree containing any :has() anchor affected by a change at
// or below aNode. Returns true when such a restyle was posted.
bool RestyleForHasPseudoClassChange(nsINode* aNode);
// Restyle affected :has() anchors, retaining normal mutation invalidation.
// With no state/attribute, aNode is the container of a content mutation.
// Class changes are compared before mutation, while both values are known.
void RestyleForHasPseudoClassChange(nsINode* aNode,
EventStates aStateMask = EventStates(),
nsIAtom* aAttribute = nullptr,
const nsAttrValue* aNewClasses = nullptr,
bool aCompareClasses = false);
// Process any pending restyles. This should be called after
// CreateNeededFrames.
+9 -4
View File
@@ -185,15 +185,18 @@ struct InlineBackgroundData
mPIStartBorderData.SetCoord(joinedBorderArea.x);
}
} else if (mPIStartBorderData.mFrame) {
// Copy data to a temporary object so that computing the
// continous rect here doesn't clobber our normal state.
InlineBackgroundData temp = *this;
if (mVertical) {
mPIStartBorderData.SetCoord(GetContinuousRect(mPIStartBorderData.mFrame).y);
mPIStartBorderData.SetCoord(temp.GetContinuousRect(mPIStartBorderData.mFrame).y);
} else {
mPIStartBorderData.SetCoord(GetContinuousRect(mPIStartBorderData.mFrame).x);
mPIStartBorderData.SetCoord(temp.GetContinuousRect(mPIStartBorderData.mFrame).x);
}
}
} else {
// ... and restore it when possible.
mPIStartBorderData.mCoord = saved.mCoord;
mPIStartBorderData.SetCoord(saved.mCoord);
}
if (mVertical) {
if (joinedBorderArea.y > mPIStartBorderData.mCoord) {
@@ -342,6 +345,7 @@ protected:
// Start with the previous flow frame as our continuation point
// is the total of the widths of the previous frames.
nsIFrame* inlineFrame = GetPrevContinuation(aFrame);
bool changedLines = false;
while (inlineFrame) {
if (!mPIStartBorderData.mFrame &&
!(mVertical ? inlineFrame->GetSkipSides().Top()
@@ -350,8 +354,9 @@ protected:
}
nsRect rect = inlineFrame->GetRect();
mContinuationPoint += mVertical ? rect.height : rect.width;
if (mBidiEnabled && !AreOnSameLine(aFrame, inlineFrame)) {
if (mBidiEnabled && (changedLines || !AreOnSameLine(aFrame, inlineFrame))) {
mLineContinuationPoint += mVertical ? rect.height : rect.width;
changedLines = true;
}
mUnbrokenMeasure += mVertical ? rect.height : rect.width;
mBoundingBox.UnionRect(mBoundingBox, rect);
+2 -2
View File
@@ -164,9 +164,9 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
// We should be able to interact with the element by doing drag and drop.
mContent->AddSystemEventListener(NS_LITERAL_STRING("drop"),
mMouseListener, false);
mMouseListener, false, false);
mContent->AddSystemEventListener(NS_LITERAL_STRING("dragover"),
mMouseListener, false);
mMouseListener, false, false);
SyncDisabledState();
+7 -8
View File
@@ -235,18 +235,17 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
WritingMode wm = GetWritingMode();
LogicalSize availSize = aButtonReflowInput.ComputedSize(wm);
// The anonymous button-content frame cannot have a continuation. Give it
// unconstrained available block-size so flex/grid layout does not treat a
// definite button block-size as a fragmentainer constraint. Its computed
// block-size is overridden separately below when it needs to be definite.
availSize.BSize(wm) = NS_INTRINSICSIZE;
// Identify if the inner anonymous block is actually functioning as a flex or grid container.
nsIAtom* kidType = aFirstKid->GetType();
bool isFlexOrGrid = (kidType == nsGkAtoms::flexContainerFrame ||
kidType == nsGkAtoms::gridContainerFrame);
// Preserve the button's definite BSize ONLY for flex/grid children so they
// see a definite containing block main size. For standard buttons, clobber
// to intrinsic so standard vertical centering (extraSpace) calculations work.
if (!isFlexOrGrid || aButtonReflowInput.ComputedBSize() == NS_INTRINSICSIZE) {
availSize.BSize(wm) = NS_INTRINSICSIZE;
}
// shorthand for a value we need to use in a bunch of places
const LogicalMargin& clbp = aButtonReflowInput.ComputedLogicalBorderPadding();
@@ -260,7 +259,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
availSize);
// Apply the definite BSize directly on the inner reflow input ONLY if it's
// a flex or grid container, allowing it to be used as-is.
// a flex or grid container, without constraining its available BSize.
if (isFlexOrGrid && aButtonReflowInput.ComputedBSize() != NS_INTRINSICSIZE) {
contentsReflowInput.SetComputedBSize(aButtonReflowInput.ComputedBSize());
}
+40 -11
View File
@@ -2166,20 +2166,20 @@ nsFrameSelection::CommonPageMove(bool aForward,
//get the frame from the scrollable view
nsIFrame* scrolledFrame = aScrollableFrame->GetScrolledFrame();
if (!scrolledFrame) [[unlikely]] {
if MOZ_UNLIKELY(!scrolledFrame) {
return;
}
// find out where the caret is.
// we should know mDesiredPos value of nsFrameSelection, but I havent seen that behavior in other windows applications yet.
nsISelection* domSel = GetSelection(SelectionType::eNormal);
if (!domSel) [[unlikely]] {
if MOZ_UNLIKELY(!domSel) {
return;
}
nsRect caretPos;
nsIFrame* caretFrame = nsCaret::GetGeometry(domSel, &caretPos);
if (!caretFrame) [[unlikely]] {
if MOZ_UNLIKELY(!caretFrame) {
return;
}
@@ -2200,7 +2200,7 @@ nsFrameSelection::CommonPageMove(bool aForward,
desiredPoint.y = caretPos.y + caretPos.height/2;
nsIFrame::ContentOffsets offsets = scrolledFrame->GetContentOffsetsFromPoint(desiredPoint);
if (!offsets.content) [[unlikely]] {
if MOZ_UNLIKELY(!offsets.content) {
return;
}
@@ -2846,7 +2846,12 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
if (!mDomSelections[index])
return NS_ERROR_NULL_POINTER;
nsTableWrapperFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
// This is needed as an nsTableWrapperFrame as we use this to know we can
// static cast tableFrame to nsTableWrapperFrame.
nsTableWrapperFrame* tableWrapperFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
// Declared as weak frame, as the frame may be freed during a call to a listener.
nsWeakFrame tableFrame(tableWrapperFrame);
if (!tableFrame)
return NS_ERROR_FAILURE;
@@ -2878,6 +2883,9 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
curColIndex < minColIndex || curColIndex > maxColIndex) {
mDomSelections[index]->RemoveRange(range);
if (!tableFrame.IsAlive()) {
return NS_OK;
}
// Since we've removed the range, decrement pointer to next range
mSelectedCellIndex--;
}
@@ -2885,21 +2893,30 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
} else {
// Remove cell from selection if it belongs to the given cells range or
// it is spanned onto the cells range.
MOZ_ASSERT(tableFrame.IsAlive());
// In general, static casting to another table type is not a good idea,
// but it is valid here due to the earlier do_QueryFrame() that
// established that tableFrame is an nsTableWrapperFrame*.
auto tempTableFrame = static_cast<nsTableWrapperFrame*>(tableFrame.GetFrame());
nsTableCellFrame* cellFrame =
tableFrame->GetCellFrameAt(curRowIndex, curColIndex);
tempTableFrame->GetCellFrameAt(curRowIndex, curColIndex);
uint32_t origRowIndex = cellFrame->RowIndex();
uint32_t origColIndex = cellFrame->ColIndex();
uint32_t actualRowSpan =
tableFrame->GetEffectiveRowSpanAt(origRowIndex, origColIndex);
tempTableFrame->GetEffectiveRowSpanAt(origRowIndex, origColIndex);
uint32_t actualColSpan =
tableFrame->GetEffectiveColSpanAt(curRowIndex, curColIndex);
tempTableFrame->GetEffectiveColSpanAt(curRowIndex, curColIndex);
if (origRowIndex <= static_cast<uint32_t>(maxRowIndex) && maxRowIndex >= 0 &&
origRowIndex + actualRowSpan - 1 >= static_cast<uint32_t>(minRowIndex) &&
origColIndex <= static_cast<uint32_t>(maxColIndex) && maxColIndex >= 0 &&
origColIndex + actualColSpan - 1 >= static_cast<uint32_t>(minColIndex)) {
mDomSelections[index]->RemoveRange(range);
if (!tableFrame.IsAlive()) {
return NS_OK;
}
// Since we've removed the range, decrement pointer to next range
mSelectedCellIndex--;
}
@@ -2925,7 +2942,12 @@ nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
if (!mDomSelections[index])
return NS_ERROR_NULL_POINTER;
nsTableWrapperFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
// This is needed as an nsTableWrapperFrame as we use this to know we can
// static cast tableFrame to nsTableWrapperFrame.
nsTableWrapperFrame* tableWrapperFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
// Declared as weak frame, as the frame may be freed during a call to a listener.
nsWeakFrame tableFrame(tableWrapperFrame);
if (!tableFrame) // Check that |table| is a table.
return NS_ERROR_FAILURE;
@@ -2936,7 +2958,12 @@ nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
uint32_t col = aStartColumnIndex;
while(true)
{
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(row, col);
MOZ_ASSERT(tableFrame.IsAlive());
// In general, static casting to another table type is not a good idea,
// but it is valid here due to the earlier do_QueryFrame() that
// established that tableFrame is an nsTableWrapperFrame*.
nsTableCellFrame* cellFrame =
static_cast<nsTableWrapperFrame*>(tableFrame.GetFrame())->GetCellFrameAt(row, col);
// Skip cells that are spanned from previous locations or are already selected
if (cellFrame) {
@@ -2944,7 +2971,9 @@ nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
uint32_t origCol = cellFrame->ColIndex();
if (origRow == row && origCol == col && !cellFrame->IsSelected()) {
result = SelectCellElement(cellFrame->GetContent());
if (NS_FAILED(result)) return result;
if (NS_FAILED(result) || !tableFrame.IsAlive()) {
return result;
}
}
}
// Done when we reach end column
+3 -1
View File
@@ -1871,7 +1871,9 @@ CSSStyleSheet::InsertRuleInternal(const nsAString& aRule,
RefPtr<css::Rule> rule;
aRv = css.ParseRule(aRule, mInner->mSheetURI, mInner->mBaseURI,
mInner->mPrincipal, getter_AddRefs(rule));
if (NS_WARN_IF(aRv.Failed())) {
// A syntax error from web content is an expected insertRule() outcome. The
// binding reports it to script; do not flood debug stderr as well.
if (aRv.Failed()) {
return 0;
}
+6 -2
View File
@@ -639,8 +639,12 @@ Declaration::GetPropertyValueInternal(
}
if (revertCount == totalCount) {
// Simplify serialization below by serializing revert up-front.
nsCSSValue(eCSSUnit_Revert).AppendToString(eCSSProperty_UNKNOWN, aValue,
nsCSSValue::eNormalized);
// eCSSUnit_Revert carries the cascade origin, so it cannot use the
// nsCSSValue constructor reserved for valueless units.
nsCSSValue revert;
revert.SetRevertValue(SheetType::Unknown);
revert.AppendToString(eCSSProperty_UNKNOWN, aValue,
nsCSSValue::eNormalized);
return;
}
if (revertLayerCount == totalCount) {
+3
View File
@@ -24,6 +24,7 @@
#include "nsNameSpaceManager.h"
#include "nsXMLNameSpaceMap.h"
#include "nsCSSParser.h"
#include "nsCSSRuleUtils.h"
#include "nsCSSPseudoClasses.h"
#include "nsCSSAnonBoxes.h"
#include "nsTArray.h"
@@ -1009,6 +1010,7 @@ nsCSSSelectorList::~nsCSSSelectorList()
nsCSSSelector*
nsCSSSelectorList::AddSelector(char16_t aOperator)
{
mHasSelectorData = nullptr;
nsCSSSelector* newSel = new nsCSSSelector();
if (mSelectors) {
@@ -1026,6 +1028,7 @@ nsCSSSelectorList::AddSelector(char16_t aOperator)
void
nsCSSSelectorList::RemoveRightmostSelector()
{
mHasSelectorData = nullptr;
nsCSSSelector* current = mSelectors;
mSelectors = mSelectors->mNext;
MOZ_ASSERT(mSelectors,
+4
View File
@@ -34,6 +34,7 @@
class nsIAtom;
struct nsCSSSelectorList;
struct nsCSSHasSelectorData;
namespace mozilla {
enum class CSSPseudoClassType : uint8_t;
@@ -318,6 +319,9 @@ struct nsCSSSelectorList {
// stored as their leftmost selector. This flag keeps that implementation
// detail out of serialization and is preserved by cloning.
bool mIsRelativeSelector;
// Immutable dependency metadata, collected lazily for a :has() argument.
// Nodes retain this data independently of the stylesheet's lifetime.
RefPtr<nsCSSHasSelectorData> mHasSelectorData;
protected:
friend class inDOMUtils;
nsCSSSelectorList* Clone(bool aDeep) const;
+4 -6
View File
@@ -13454,18 +13454,16 @@ bool
CSSParserImpl::ParseAspectRatioRatio(nsCSSValue& aValue)
{
nsCSSValue width;
if (!ParseSingleTokenNonNegativeVariant(width,
VARIANT_NUMBER | VARIANT_CALC,
nullptr)) {
if (ParseNonNegativeVariant(width, VARIANT_NUMBER | VARIANT_CALC,
nullptr) != CSSParseResult::Ok) {
return false;
}
nsCSSValue height;
height.SetFloatValue(1.0f, eCSSUnit_Number);
if (ExpectSymbol('/', true)) {
if (!ParseSingleTokenNonNegativeVariant(height,
VARIANT_NUMBER | VARIANT_CALC,
nullptr)) {
if (ParseNonNegativeVariant(height, VARIANT_NUMBER | VARIANT_CALC,
nullptr) != CSSParseResult::Ok) {
return false;
}
}
+2 -2
View File
@@ -77,9 +77,9 @@ CSS_PSEUDO_CLASS(is, ":is", 0, "layout.css.is-where-pseudo.enabled")
CSS_PSEUDO_CLASS(matches, ":matches", 0, "layout.css.is-where-pseudo.enabled")
CSS_PSEUDO_CLASS(any, ":any", 0, "layout.css.is-where-pseudo.enabled")
CSS_PSEUDO_CLASS(where, ":where", 0, "layout.css.is-where-pseudo.enabled")
CSS_PSEUDO_CLASS(has, ":has", 0, "")
CSS_PSEUDO_CLASS(has, ":has", 0, "layout.css.has-pseudo.enabled")
CSS_PSEUDO_CLASS(mozHasRelativeAnchor, ":-moz-has-relative-anchor",
CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "")
CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "layout.css.has-pseudo.enabled")
CSS_PSEUDO_CLASS(firstChild, ":first-child", 0, "")
CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", 0, "")
+331 -10
View File
@@ -642,6 +642,10 @@ nsCSSRuleUtils::SelectorMatches(Element* aElement,
{
NS_PRECONDITION(!aSelector->IsPseudoElement(),
"Pseudo-element snuck into SelectorMatches?");
AutoRestore<bool> laterSiblingsRestorer(
aTreeMatchContext.mHasSelectorLaterSiblings);
aTreeMatchContext.mHasSelectorLaterSiblings |=
aSelector->mOperator == '+' || aSelector->mOperator == '~';
MOZ_ASSERT(aTreeMatchContext.mForStyling ||
!aNodeMatchContext.mIsRelevantLink,
"mIsRelevantLink should be set to false when mForStyling "
@@ -1722,6 +1726,291 @@ matchesSubtree(nsIContent* aRoot,
return false;
}
using HasSelectorDependency = nsCSSRuleUtils::HasSelectorDependency;
static void
AddHasDependencyAtom(nsTArray<nsCOMPtr<nsIAtom>>& aAtoms, nsIAtom* aAtom)
{
if (!aAtoms.Contains(aAtom)) {
aAtoms.AppendElement(aAtom);
}
}
// Collect every branch before matching, including :is() and legacy :not().
void
nsCSSHasSelectorData::Branch::AddSelector(nsCSSSelector* aSelector)
{
for (nsCSSSelector* selector = aSelector; selector; selector = selector->mNext) {
if (selector->mIDList) {
AddHasDependencyAtom(mAttributes, nsGkAtoms::id);
}
for (nsAtomList* cls = selector->mClassList; cls; cls = cls->mNext) {
AddHasDependencyAtom(mClasses, cls->mAtom);
}
for (nsAttrSelector* attr = selector->mAttrList; attr; attr = attr->mNext) {
// Include both spellings and conservatively ignore namespaces here.
AddHasDependencyAtom(mAttributes, attr->mLowercaseAttr);
AddHasDependencyAtom(mAttributes, attr->mCasedAttr);
}
for (nsPseudoClassList* pseudo = selector->mPseudoClassList;
pseudo; pseudo = pseudo->mNext) {
mStates |= nsCSSPseudoClasses::sPseudoClassStateDependences[
static_cast<CSSPseudoClassTypeBase>(pseudo->mType)];
if (nsCSSPseudoClasses::HasSelectorListArg(pseudo->mType)) {
for (nsCSSSelectorList* list = pseudo->u.mSelectorList;
list; list = list->mNext) {
AddSelector(list->mSelectors);
}
continue;
}
switch (pseudo->mType) {
case CSSPseudoClassType::mozHasRelativeAnchor:
case CSSPseudoClassType::empty:
case CSSPseudoClassType::mozOnlyWhitespace:
case CSSPseudoClassType::mozEmptyExceptChildrenWithLocalname:
case CSSPseudoClassType::root:
case CSSPseudoClassType::scope:
case CSSPseudoClassType::firstChild:
case CSSPseudoClassType::lastChild:
case CSSPseudoClassType::onlyChild:
case CSSPseudoClassType::firstNode:
case CSSPseudoClassType::lastNode:
case CSSPseudoClassType::firstOfType:
case CSSPseudoClassType::lastOfType:
case CSSPseudoClassType::onlyOfType:
case CSSPseudoClassType::nthChild:
case CSSPseudoClassType::nthLastChild:
case CSSPseudoClassType::nthOfType:
case CSSPseudoClassType::nthLastOfType:
break;
default:
// Pseudo-classes can depend on attributes implicitly (:lang(),
// :dir(), form states, etc.). Keep those cases conservative.
mAllAttributes = true;
break;
}
}
if (selector->mNegations) {
AddSelector(selector->mNegations);
}
}
}
void
nsCSSHasSelectorData::Branch::Merge(const Branch& aOther)
{
MOZ_ASSERT(mCombinator == aOther.mCombinator && mIsLocal == aOther.mIsLocal);
mStates |= aOther.mStates;
mAllAttributes |= aOther.mAllAttributes;
for (nsIAtom* attr : aOther.mAttributes) {
AddHasDependencyAtom(mAttributes, attr);
}
for (nsIAtom* cls : aOther.mClasses) {
AddHasDependencyAtom(mClasses, cls);
}
}
void
HasSelectorDependency::AddSelectorData(nsCSSHasSelectorData* aData, bool aSibling)
{
auto& lastSelector = aSibling ? mLastSiblingSelector : mLastSelector;
if (lastSelector == aData) {
return;
}
auto& branches = aSibling ? mSiblingBranches : mBranches;
for (const auto& source : aData->mBranches) {
if (aSibling && !source.IsSibling()) {
continue;
}
nsCSSHasSelectorData::Branch* destination = nullptr;
for (auto& branch : branches) {
if (branch.mCombinator == source.mCombinator &&
branch.mIsLocal == source.mIsLocal) {
destination = &branch;
break;
}
}
if (destination) {
destination->Merge(source);
} else {
branches.AppendElement(source);
}
}
lastSelector = aData;
}
// A local compound cannot observe children, ancestors, or state propagated
// from descendants. Keep structural/state/complex functional arguments on the
// conservative path; plain :is()/:not() compounds are safe to narrow.
static bool
IsLocalHasCompound(nsCSSSelector* aSelector)
{
for (nsPseudoClassList* pseudo = aSelector->mPseudoClassList;
pseudo; pseudo = pseudo->mNext) {
switch (pseudo->mType) {
case CSSPseudoClassType::is:
case CSSPseudoClassType::matches:
case CSSPseudoClassType::any:
case CSSPseudoClassType::where:
case CSSPseudoClassType::mozAny:
case CSSPseudoClassType::mozAnyPrivate:
break;
default:
return false;
}
for (nsCSSSelectorList* list = pseudo->u.mSelectorList;
list; list = list->mNext) {
if (list->mSelectors &&
(list->mSelectors->mNext || !IsLocalHasCompound(list->mSelectors))) {
return false;
}
}
}
for (nsCSSSelector* negation = aSelector->mNegations;
negation; negation = negation->mNegations) {
if (negation->mNext || !IsLocalHasCompound(negation)) {
return false;
}
}
return true;
}
nsCSSHasSelectorData::nsCSSHasSelectorData(nsCSSSelectorList* aList)
{
for (nsCSSSelectorList* list = aList; list; list = list->mNext) {
Branch* branch = mBranches.AppendElement();
branch->AddSelector(list->mSelectors);
nsCSSSelector* anchor = list->mSelectors;
while (anchor->mNext) {
anchor = anchor->mNext;
}
branch->mCombinator = anchor->mOperator;
branch->mIsLocal = list->mSelectors->mNext == anchor &&
IsLocalHasCompound(list->mSelectors);
mHasSibling |= branch->IsSibling();
}
}
bool
nsCSSHasSelectorData::Branch::MightDependOnAttribute(
Element* aElement, nsIAtom* aAttribute, const nsAttrValue* aNewClasses,
bool aCompareClasses) const
{
if (mAllAttributes || mAttributes.Contains(aAttribute)) {
return true;
}
if (aAttribute != nsGkAtoms::_class) {
return false;
}
const nsAttrValue* classes = aElement->GetClasses();
nsCaseTreatment caseTreatment =
aElement->OwnerDoc()->GetCompatibilityMode() == eCompatibility_NavQuirks
? eIgnoreCase : eCaseMatters;
for (nsIAtom* cls : mClasses) {
bool hadClass = classes && classes->Contains(cls, caseTreatment);
if (aCompareClasses) {
bool hasClass = aNewClasses && aNewClasses->Contains(cls, caseTreatment);
if (hadClass != hasClass) {
return true;
}
} else if (hadClass) {
return true;
}
}
return false;
}
bool
HasSelectorDependency::MightDependOnChange(
Element* aAnchor, nsINode* aNode, EventStates aStateMask,
nsIAtom* aAttribute, const nsAttrValue* aNewClasses,
bool aCompareClasses, bool aSibling, bool aNodeIsFollowingSibling) const
{
bool contentChange = !aAttribute && aStateMask.IsEmpty();
for (const auto& branch : mBranches) {
if (branch.IsSibling() != aSibling ||
(!aStateMask.IsEmpty() &&
!branch.mStates.HasAtLeastOneOfStates(aStateMask)) ||
(aAttribute && !branch.MightDependOnAttribute(
aNode->AsElement(), aAttribute, aNewClasses, aCompareClasses))) {
continue;
}
if (branch.mIsLocal) {
if (aSibling) {
nsINode* parent = aAnchor->GetParentNode();
if (contentChange) {
// Changing a sibling's contents cannot affect a local compound.
if (aNode != parent) {
continue;
}
} else {
if (aNode->GetParentNode() != parent) {
continue;
}
if (branch.mCombinator == '+') {
if (aAnchor->GetNextElementSibling() != aNode) {
continue;
}
} else if (!aNodeIsFollowingSibling) {
continue;
}
}
} else if (branch.mCombinator == '>') {
if (contentChange ? aNode != aAnchor
: aNode->GetParentNode() != aAnchor) {
continue;
}
}
}
return true;
}
return false;
}
bool
HasSelectorDependency::MightAffectSiblingAnchor(
nsINode* aParent, nsINode* aNode, EventStates aStateMask,
nsIAtom* aAttribute, const nsAttrValue* aNewClasses,
bool aCompareClasses) const
{
bool contentChange = !aAttribute && aStateMask.IsEmpty();
for (const auto& branch : mSiblingBranches) {
if (!branch.IsSibling() ||
(branch.mIsLocal && (contentChange ? aNode != aParent
: aNode->GetParentNode() != aParent)) ||
(!aStateMask.IsEmpty() &&
!branch.mStates.HasAtLeastOneOfStates(aStateMask)) ||
(aAttribute && !branch.MightDependOnAttribute(
aNode->AsElement(), aAttribute, aNewClasses, aCompareClasses))) {
continue;
}
return true;
}
return false;
}
static void
DeleteHasSelectorDependency(void*, nsIAtom*, void* aValue, void*)
{
delete static_cast<HasSelectorDependency*>(aValue);
}
static HasSelectorDependency*
EnsureHasSelectorDependency(nsINode* aNode)
{
auto* dependency = static_cast<HasSelectorDependency*>(
aNode->GetProperty(nsGkAtoms::hasSelectorDependency));
if (!dependency) {
dependency = new HasSelectorDependency;
if (NS_FAILED(aNode->SetProperty(nsGkAtoms::hasSelectorDependency, dependency,
DeleteHasSelectorDependency))) {
delete dependency;
return nullptr;
}
}
return dependency;
}
/* static */ bool
nsCSSRuleUtils::RelativeSelectorListMatches(
Element* aAnchor,
@@ -1731,17 +2020,23 @@ nsCSSRuleUtils::RelativeSelectorListMatches(
MOZ_ASSERT(aAnchor);
MOZ_ASSERT(aList);
// :has() reverses the usual direction of selector invalidation. The
// restyle manager uses these conservative markers to promote changes in the
// anchor's descendants, or in following sibling subtrees, back to a subtree
// that contains the anchor.
if (aTreeMatchContext.mForStyling) {
aAnchor->SetProperty(nsGkAtoms::hasSelectorDependency,
reinterpret_cast<void*>(1));
nsIContent* parent = aAnchor->GetParent();
if (parent) {
parent->SetProperty(nsGkAtoms::hasSelectorDependency,
reinterpret_cast<void*>(1));
if (!aList->mHasSelectorData) {
aList->mHasSelectorData = new nsCSSHasSelectorData(aList);
}
const auto& data = aList->mHasSelectorData;
// The document marker makes mutations in documents without styled :has()
// selectors a constant-time no-op. All markers use the same property type.
EnsureHasSelectorDependency(aAnchor->OwnerDoc());
if (auto* dependency = EnsureHasSelectorDependency(aAnchor)) {
dependency->AddSelectorData(data, false);
dependency->mRestyleLaterSiblings |=
aTreeMatchContext.mHasSelectorLaterSiblings;
}
if (data->mHasSibling && aAnchor->GetParent()) {
if (auto* dependency = EnsureHasSelectorDependency(aAnchor->GetParent())) {
dependency->AddSelectorData(data, true);
}
}
}
@@ -1764,6 +2059,26 @@ nsCSSRuleUtils::RelativeSelectorListMatches(
}
MOZ_ASSERT(leftmost->mNext);
// A single compound cannot move beyond the leading relationship.
// Avoid scanning descendants for >, and all following subtrees for +/~.
if (leftmost == relative->mSelectors) {
char combinator = leftmost->mNext->mOperator;
if (combinator == '>' || combinator == '+' || combinator == '~') {
Element* candidate = combinator == '>'
? aAnchor->GetFirstElementChild()
: aAnchor->GetNextElementSibling();
for (; candidate; candidate = candidate->GetNextElementSibling()) {
if (matchesCandidate(candidate, relative, aTreeMatchContext)) {
return true;
}
if (combinator == '+') {
break;
}
}
continue;
}
}
switch (leftmost->mNext->mOperator) {
// Even for a leading adjacent-sibling combinator, a later combinator in
// the relative selector can move the rightmost matching element into a
@@ -1778,6 +2093,12 @@ nsCSSRuleUtils::RelativeSelectorListMatches(
if (matchesSubtree(sibling, relative, aTreeMatchContext)) {
return true;
}
// Once + .a enters .a's descendants, later combinators cannot
// leave that subtree. + .a + .b still needs the broader search.
if (leftmost->mNext->mOperator == '+' &&
NS_IS_ANCESTOR_OPERATOR(leftmost->mOperator)) {
break;
}
}
break;
+60 -3
View File
@@ -9,7 +9,8 @@
#include "mozilla/Attributes.h"
#include "mozilla/EventStates.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/RefCountType.h"
#include "mozilla/RefCountType.h"
#include "mozilla/RefCounted.h"
#include "mozilla/SheetType.h"
#include "mozilla/UniquePtr.h"
#include "nsExpirationTracker.h"
@@ -20,8 +21,64 @@
#include "nsTArray.h"
#include "StyleRule.h"
struct nsCSSRuleUtils
{
// No selector or DOM pointers: nodes can safely keep this after a rule is
// removed, without keeping either the stylesheet or an anchor alive.
struct nsCSSHasSelectorData : public mozilla::RefCounted<nsCSSHasSelectorData> {
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsCSSHasSelectorData)
struct Branch {
mozilla::EventStates mStates;
nsTArray<nsCOMPtr<nsIAtom>> mAttributes;
nsTArray<nsCOMPtr<nsIAtom>> mClasses;
bool mAllAttributes = false;
bool mIsLocal = false;
char16_t mCombinator = ' ';
void AddSelector(nsCSSSelector* aSelector);
void Merge(const Branch& aOther);
bool MightDependOnAttribute(mozilla::dom::Element* aElement,
nsIAtom* aAttribute,
const nsAttrValue* aNewClasses,
bool aCompareClasses) const;
bool IsSibling() const {
return mCombinator == '+' || mCombinator == '~';
}
};
explicit nsCSSHasSelectorData(nsCSSSelectorList* aList);
nsTArray<Branch> mBranches;
bool mHasSibling = false;
};
struct nsCSSRuleUtils
{
// Stored on nodes under hasSelectorDependency. Dependencies accumulate
// across matching passes, so a failed/short-circuited branch stays watched.
struct HasSelectorDependency {
// Merge rules with the same search relationship. Retaining a reference
// to every rule ever matched would grow without bound on long-lived pages
// that replace stylesheets. Only the most recent registration is cached.
nsTArray<nsCSSHasSelectorData::Branch> mBranches;
nsTArray<nsCSSHasSelectorData::Branch> mSiblingBranches;
RefPtr<nsCSSHasSelectorData> mLastSelector;
RefPtr<nsCSSHasSelectorData> mLastSiblingSelector;
bool mRestyleLaterSiblings = false;
void AddSelectorData(nsCSSHasSelectorData* aData, bool aSibling);
bool MightDependOnChange(Element* aAnchor, nsINode* aNode,
mozilla::EventStates aStateMask,
nsIAtom* aAttribute,
const nsAttrValue* aNewClasses,
bool aCompareClasses,
bool aSibling,
bool aNodeIsFollowingSibling = false) const;
bool MightAffectSiblingAnchor(nsINode* aParent, nsINode* aNode,
mozilla::EventStates aStateMask,
nsIAtom* aAttribute,
const nsAttrValue* aNewClasses,
bool aCompareClasses) const;
};
static void Startup();
static void Shutdown();
static void FreeSystemMetrics();
+3
View File
@@ -450,6 +450,7 @@ struct MOZ_STACK_CLASS TreeMatchContext {
, mIsTopmostScope(false)
, mForAssignedSlot(false)
, mRelativeSelectorAnchor(nullptr)
, mHasSelectorLaterSiblings(false)
{
if (aMatchVisited != eNeverMatchVisited) {
nsILoadContext* loadContext = mDocument->GetLoadContext();
@@ -472,6 +473,8 @@ struct MOZ_STACK_CLASS TreeMatchContext {
// relative selector. This is deliberately separate from mScopes: an
// explicit :scope inside :has() still refers to the API/style scope.
mozilla::dom::Element* mRelativeSelectorAnchor;
// Propagate an outer sibling combinator through :is(), :not(), etc.
bool mHasSelectorLaterSiblings;
};
struct MOZ_STACK_CLASS RuleProcessorData {
+4 -6
View File
@@ -333,12 +333,10 @@ void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x, unsigned char *dst_y,
_16x16mv.as_mv.row &= x->fullpixel_mask;
_16x16mv.as_mv.col &= x->fullpixel_mask;
if (2 * _16x16mv.as_mv.col < (x->mb_to_left_edge - (19 << 3)) ||
2 * _16x16mv.as_mv.col > x->mb_to_right_edge + (18 << 3) ||
2 * _16x16mv.as_mv.row < (x->mb_to_top_edge - (19 << 3)) ||
2 * _16x16mv.as_mv.row > x->mb_to_bottom_edge + (18 << 3)) {
return;
}
/* Rounding to full-pel can move the chroma MV outside the border tap
* window even though the luma MV was already clamped, so clamp again to
* keep the reference read in bounds and ensure dst_u/dst_v are written. */
clamp_uvmv_to_umv_border(&_16x16mv.as_mv, x);
pre_stride >>= 1;
offset = (_16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3);
+6 -6
View File
@@ -379,12 +379,12 @@ template<typename T>
static MOZ_ALWAYS_INLINE bool
NumberEqualsInt32(T aValue, int32_t* aInt32)
{
/*
* XXX Casting a floating-point value that doesn't truncate to int32_t, to
* int32_t, induces undefined behavior. We should definitely fix this
* (bug 744965), but as apparently it "works" in practice, it's not a
* pressing concern now.
*/
// Check the range before casting: an out-of-range float-to-integer cast is
// undefined behavior. Use an exclusive upper bound of 2^31, since converting
// INT32_MAX to float rounds up to 2^31. This also rejects NaN and infinities.
if (!(aValue >= T(INT32_MIN) && aValue < -T(INT32_MIN))) {
return false;
}
return aValue == (*aInt32 = int32_t(aValue));
}
+5 -3
View File
@@ -111,9 +111,11 @@ nsJARProtocolHandler::GetDefaultPort(int32_t *result)
NS_IMETHODIMP
nsJARProtocolHandler::GetProtocolFlags(uint32_t *result)
{
// URI_LOADABLE_BY_ANYONE, since it's our inner URI that will matter
// anyway.
*result = URI_NORELATIVE | URI_NOAUTH | URI_LOADABLE_BY_ANYONE;
// A jar: URI is only ever as loadable as the inner URI it
// wraps, and security checks consult the innermost URI. Claim
// the restrictive flag here so that consumers which look at the
// jar: handler alone don't treat it as web-loadable.
*result = URI_NORELATIVE | URI_NOAUTH | URI_IS_LOCAL_FILE;
/* Although jar uris have their own concept of relative urls
it is very different from the standard behaviour, so we
have to say norelative here! */
+6
View File
@@ -2572,6 +2572,9 @@ pref("layout.css.legacy-negation-pseudo.enabled", false);
// Is support for the :is() and :where() selectors enabled?
pref("layout.css.is-where-pseudo.enabled", true);
// Is support for the :has() selector enabled?
pref("layout.css.has-pseudo.enabled", false);
// Is support for the ::slotted() selector enabled?
pref("layout.css.slotted-pseudo.enabled", true);
@@ -4513,6 +4516,9 @@ pref("html5.flushtimer.initialdelay", 120);
// Time in milliseconds between the time a network buffer is seen and the
// timer firing when the timer has already fired previously in this parse.
pref("html5.flushtimer.subsequentdelay", 120);
// Determine whether strict (standards-compliant) subtree node checking is
// enabled for forms. See UXP issue #3197
pref("html5.forms.standards_compliant", true);
// Push/Pop/Replace State prefs
pref("browser.history.maxStateObjectSize", 655360);
+208 -227
View File
@@ -3,11 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMIMEHeaderParamImpl.h"
#include <string.h>
#include "prmem.h"
#include "mozilla/Base64.h"
#include "mozilla/Maybe.h"
#include "mozilla/TextUtils.h"
#include "mozilla/dom/EncodingUtils.h"
#include "prprf.h"
#include "plstr.h"
#include "plbase64.h"
#include "nsCRT.h"
#include "nsMemory.h"
#include "nsTArray.h"
@@ -16,18 +22,20 @@
#include "nsIUTF8ConverterService.h"
#include "nsUConvCID.h"
#include "nsIServiceManager.h"
#include "nsMIMEHeaderParamImpl.h"
#include "nsReadableUtils.h"
#include "nsNativeCharsetUtils.h"
#include "nsError.h"
#include "nsIUnicodeDecoder.h"
#include "mozilla/dom/EncodingUtils.h"
using mozilla::dom::EncodingUtils;
using mozilla::Maybe;
using mozilla::Nothing;
using mozilla::Some;
// static functions declared below are moved from mailnews/mime/src/comi18n.cpp
static char *DecodeQ(const char *, uint32_t);
static Maybe<nsCString> DecodeQ(const char *, uint32_t);
static bool Is7bitNonAsciiString(const char *, uint32_t);
static void CopyRawHeader(const char *, uint32_t, const char *, nsACString &);
static nsresult DecodeRFC2047Str(const char *, const char *, bool, nsACString&);
@@ -48,8 +56,7 @@ nsMIMEHeaderParamImpl::GetParameter(const nsACString& aHeaderVal,
const char *aParamName,
const nsACString& aFallbackCharset,
bool aTryLocaleCharset,
char **aLang, nsAString& aResult)
{
char **aLang, nsAString& aResult) {
return DoGetParameter(aHeaderVal, aParamName, MIME_FIELD_ENCODING,
aFallbackCharset, aTryLocaleCharset, aLang, aResult);
}
@@ -59,8 +66,7 @@ nsMIMEHeaderParamImpl::GetParameterHTTP(const nsACString& aHeaderVal,
const char *aParamName,
const nsACString& aFallbackCharset,
bool aTryLocaleCharset,
char **aLang, nsAString& aResult)
{
char **aLang, nsAString& aResult) {
return DoGetParameter(aHeaderVal, aParamName, HTTP_FIELD_ENCODING,
aFallbackCharset, aTryLocaleCharset, aLang, aResult);
}
@@ -94,76 +100,75 @@ nsMIMEHeaderParamImpl::DoGetParameter(const nsACString& aHeaderVal,
ParamDecoding aDecoding,
const nsACString& aFallbackCharset,
bool aTryLocaleCharset,
char **aLang, nsAString& aResult)
{
aResult.Truncate();
nsresult rv;
char **aLang, nsAString& aResult) {
aResult.Truncate();
nsresult rv;
// get parameter (decode RFC 2231/5987 when applicable, as specified by
// aDecoding (5987 being a subset of 2231) and return charset.)
nsXPIDLCString med;
nsXPIDLCString charset;
rv = DoParameterInternal(aHeaderVal, aParamName, aDecoding,
getter_Copies(charset), aLang, getter_Copies(med));
if (NS_FAILED(rv))
return rv;
// get parameter (decode RFC 2231/5987 when applicable, as specified by
// aDecoding (5987 being a subset of 2231) and return charset.)
nsXPIDLCString med;
nsXPIDLCString charset;
rv = DoParameterInternal(aHeaderVal, aParamName, aDecoding,
getter_Copies(charset), aLang, getter_Copies(med));
if (NS_FAILED(rv)) {
return rv;
}
// convert to UTF-8 after charset conversion and RFC 2047 decoding
// if necessary.
// convert to UTF-8 after charset conversion and RFC 2047 decoding
// if necessary.
nsAutoCString str1;
rv = internalDecodeParameter(med, charset.get(), nullptr, false,
// was aDecoding == MIME_FIELD_ENCODING
// see bug 875615
true,
str1);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString str1;
rv = internalDecodeParameter(med, charset.get(), nullptr, false,
// was aDecoding == MIME_FIELD_ENCODING
// see bug 875615
true,
str1);
NS_ENSURE_SUCCESS(rv, rv);
if (!aFallbackCharset.IsEmpty())
{
nsAutoCString charset;
EncodingUtils::FindEncodingForLabel(aFallbackCharset, charset);
nsAutoCString str2;
nsCOMPtr<nsIUTF8ConverterService>
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
if (cvtUTF8 &&
NS_SUCCEEDED(cvtUTF8->ConvertStringToUTF8(str1,
PromiseFlatCString(aFallbackCharset).get(), false,
!charset.EqualsLiteral("UTF-8"),
1, str2))) {
CopyUTF8toUTF16(str2, aResult);
return NS_OK;
}
}
if (IsUTF8(str1)) {
CopyUTF8toUTF16(str1, aResult);
if (!aFallbackCharset.IsEmpty()) {
nsAutoCString charset;
EncodingUtils::FindEncodingForLabel(aFallbackCharset, charset);
nsAutoCString str2;
nsCOMPtr<nsIUTF8ConverterService> cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
if (cvtUTF8 &&
NS_SUCCEEDED(cvtUTF8->ConvertStringToUTF8(str1,
PromiseFlatCString(aFallbackCharset).get(),
false,
!charset.EqualsLiteral("UTF-8"),
1,
str2))) {
CopyUTF8toUTF16(str2, aResult);
return NS_OK;
}
}
if (aTryLocaleCharset && !NS_IsNativeUTF8())
return NS_CopyNativeToUnicode(str1, aResult);
CopyASCIItoUTF16(str1, aResult);
if (IsUTF8(str1)) {
CopyUTF8toUTF16(str1, aResult);
return NS_OK;
}
if (aTryLocaleCharset && !NS_IsNativeUTF8()) {
return NS_CopyNativeToUnicode(str1, aResult);
}
CopyASCIItoUTF16(str1, aResult);
return NS_OK;
}
// remove backslash-encoded sequences from quoted-strings
// modifies string in place, potentially shortening it
void RemoveQuotedStringEscapes(char *src)
{
char *dst = src;
// modifies aValue, potentially shortening it
void RemoveQuotedStringEscapes(nsCString& aValue) {
nsAutoCString unescaped;
unescaped.SetCapacity(aValue.Length());
for (char *c = src; *c; ++c)
{
if (c[0] == '\\' && c[1])
{
for (uint32_t i = 0; i < aValue.Length(); ++i) {
if (aValue[i] == '\\' && i + 1 < aValue.Length()) {
// skip backslash if not at end
++c;
++i;
}
*dst++ = *c;
unescaped.Append(aValue[i]);
}
*dst = 0;
aValue = std::move(unescaped);
}
// true is character is a hex digit
@@ -176,12 +181,13 @@ bool IsHexDigit(char aChar)
(c >= '0' && c <= '9');
}
// validate that a C String containing %-escapes is syntactically valid
bool IsValidPercentEscaped(const char *aValue, int32_t len)
{
for (int32_t i = 0; i < len; i++) {
// validate that a string containing %-escapes is syntactically valid
bool IsValidPercentEscaped(const nsACString& aValue) {
for (uint32_t i = 0; i < aValue.Length(); i++) {
if (aValue[i] == '%') {
if (!IsHexDigit(aValue[i + 1]) || !IsHexDigit(aValue[i + 2])) {
if (i + 2 >= aValue.Length() ||
!IsHexDigit(aValue[i + 1]) ||
!IsHexDigit(aValue[i + 2])) {
return false;
}
}
@@ -189,6 +195,21 @@ bool IsValidPercentEscaped(const char *aValue, int32_t len)
return true;
}
// A NUL anywhere in a decoded value would silently truncate it in any later
// C-string based processing. Note that this is stricter than
// ContainsTrailingCharPastNull, which tolerates a value whose tail past the
// NUL is only more NULs.
static bool ContainsNull(const nsACString& aValue) {
return aValue.Contains('\0');
}
// Percent-decode aValue in place (which happens whether or not this succeeds),
// returning false if the decoded value contains a NUL.
static bool UnescapeRejectingNull(nsCString& aValue) {
NS_UnescapeURL(aValue);
return !ContainsNull(aValue);
}
// Support for continuations (RFC 2231, Section 3)
// only a sane number supported
@@ -220,59 +241,41 @@ class Continuation {
bool wasQuotedString;
};
// combine segments into a single string, returning the allocated string
// (or nullptr) while emptying the list
char *combineContinuations(nsTArray<Continuation>& aArray)
{
// Sanity check
if (aArray.Length() == 0)
return nullptr;
// combine segments into a single string, up to the first segment that is
// missing. Returns Nothing() if that leaves nothing at all, or, with
// aContainedNull set, if percent-decoding a segment produced a NUL.
Maybe<nsCString> combineContinuations(const nsTArray<Continuation>& aArray,
bool& aContainedNull) {
nsCString result;
// Get an upper bound for the length
uint32_t length = 0;
for (uint32_t i = 0; i < aArray.Length(); i++) {
length += aArray[i].length;
}
for (const Continuation& cont : aArray) {
if (!cont.value) break;
// Allocate
char *result = (char *) moz_xmalloc(length + 1);
// Concatenate
if (result) {
*result = '\0';
for (uint32_t i = 0; i < aArray.Length(); i++) {
Continuation cont = aArray[i];
if (! cont.value) break;
char *c = result + strlen(result);
strncat(result, cont.value, cont.length);
if (cont.needsPercentDecoding) {
nsUnescape(c);
}
if (cont.wasQuotedString) {
RemoveQuotedStringEscapes(c);
nsAutoCString segment(cont.value, cont.length);
if (cont.needsPercentDecoding) {
if (!UnescapeRejectingNull(segment)) {
aContainedNull = true;
return Nothing();
}
}
// return null if empty value
if (*result == '\0') {
free(result);
result = nullptr;
if (cont.wasQuotedString) {
RemoveQuotedStringEscapes(segment);
}
} else {
// Handle OOM
NS_WARNING("Out of memory\n");
result.Append(segment);
}
return result;
// no result if empty value
if (result.IsEmpty()) {
return Nothing();
}
return Some(std::move(result));
}
// add a continuation, return false on error if segment already has been seen
bool addContinuation(nsTArray<Continuation>& aArray, uint32_t aIndex,
const char *aValue, uint32_t aLength,
bool aNeedsPercentDecoding, bool aWasQuotedString)
{
bool aNeedsPercentDecoding, bool aWasQuotedString) {
if (aIndex < aArray.Length() && aArray[aIndex].value) {
NS_WARNING("duplicate RC2231 continuation segment #\n");
return false;
@@ -299,8 +302,7 @@ bool addContinuation(nsTArray<Continuation>& aArray, uint32_t aIndex,
}
// parse a segment number; return -1 on error
int32_t parseSegmentNumber(const char *aValue, int32_t aLen)
{
int32_t parseSegmentNumber(const char *aValue, int32_t aLen) {
if (aLen < 1) {
NS_WARNING("segment number missing\n");
return -1;
@@ -332,20 +334,16 @@ int32_t parseSegmentNumber(const char *aValue, int32_t aLen)
// validate a given octet sequence for compliance with the specified
// encoding
bool IsValidOctetSequenceForCharset(nsACString& aCharset, const char *aOctets)
{
nsCOMPtr<nsIUTF8ConverterService> cvtUTF8(do_GetService
(NS_UTF8CONVERTERSERVICE_CONTRACTID));
bool IsValidOctetSequenceForCharset(nsACString& aCharset, const nsACString& aOctets) {
nsCOMPtr<nsIUTF8ConverterService> cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
if (!cvtUTF8) {
NS_WARNING("Can't get UTF8ConverterService\n");
return false;
}
nsAutoCString tmpRaw;
tmpRaw.Assign(aOctets);
nsAutoCString tmpDecoded;
nsresult rv = cvtUTF8->ConvertStringToUTF8(tmpRaw,
nsresult rv = cvtUTF8->ConvertStringToUTF8(aOctets,
PromiseFlatCString(aCharset).get(),
false, false, 1, tmpDecoded);
@@ -371,8 +369,7 @@ nsMIMEHeaderParamImpl::GetParameterInternal(const nsACString& aHeaderValue,
const char* aParamName,
char** aCharset,
char** aLang,
char** aResult)
{
char** aResult) {
return DoParameterInternal(aHeaderValue, aParamName, MIME_FIELD_ENCODING,
aCharset, aLang, aResult);
}
@@ -384,9 +381,7 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
ParamDecoding aDecoding,
char** aCharset,
char** aLang,
char** aResult)
{
char** aResult) {
if (aHeaderValue.IsEmpty() || !aResult) {
return NS_ERROR_INVALID_ARG;
}
@@ -405,8 +400,12 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
*aResult = nullptr;
if (aCharset) *aCharset = nullptr;
if (aLang) *aLang = nullptr;
if (aCharset) {
*aCharset = nullptr;
}
if (aLang) {
*aLang = nullptr;
}
nsAutoCString charset;
@@ -415,8 +414,8 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
bool acceptContinuations = true;
// skip leading white space.
for (; *str && nsCRT::IsAsciiSpace(*str); ++str)
;
for (; *str && nsCRT::IsAsciiSpace(*str); ++str) { }
const char *start = str;
// aParamName is empty. return the first (possibly) _unnamed_ 'parameter'
@@ -429,9 +428,7 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
if (str == start)
return NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY;
*aResult = (char *) nsMemory::Clone(start, (str - start) + 1);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
(*aResult)[str - start] = '\0'; // null-terminate
*aResult = ToNewCString(Substring(start, str - start));
return NS_OK;
}
@@ -465,9 +462,14 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
// collect results for the different algorithms (plain filename,
// RFC5987/2231-encoded filename, + continuations) separately and decide
// which to use at the end
char *caseAResult = nullptr;
char *caseBResult = nullptr;
char *caseCDResult = nullptr;
Maybe<nsCString> caseAResult;
Maybe<nsCString> caseBResult;
Maybe<nsCString> caseCDResult;
// set when percent-decoding produced a NUL, which makes us reject the
// parameter outright rather than fall back to a value the sender did not
// intend to be used
bool containedNull = false;
// collect continuation segments
nsTArray<Continuation> segments;
@@ -548,15 +550,14 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
// if the parameter spans across multiple lines we have to strip out the
// line continuation -- jht 4/29/98
nsAutoCString tempStr(valueStart, valueEnd - valueStart);
nsCString tempStr(valueStart, valueEnd - valueStart);
tempStr.StripChars("\r\n");
char *res = ToNewCString(tempStr);
NS_ENSURE_TRUE(res, NS_ERROR_OUT_OF_MEMORY);
if (isQuotedString)
RemoveQuotedStringEscapes(res);
if (isQuotedString) {
RemoveQuotedStringEscapes(tempStr);
}
caseAResult = res;
caseAResult.emplace(std::move(tempStr));
// keep going, we may find a RFC 2231/5987 encoded alternative
}
// case B, C, and D
@@ -645,19 +646,16 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const nsACString& aHeaderValue,
// non-empty value part
if (rawValLength > 0) {
if (!caseBResult && caseB) {
if (!IsValidPercentEscaped(rawValStart, rawValLength)) {
nsCString rawVal(rawValStart, rawValLength);
if (!IsValidPercentEscaped(rawVal)) {
goto increment_str;
}
// allocate buffer for the raw value
char *tmpResult = (char *) nsMemory::Clone(rawValStart, rawValLength + 1);
if (!tmpResult) {
goto increment_str;
if (!UnescapeRejectingNull(rawVal)) {
containedNull = true;
break;
}
*(tmpResult + rawValLength) = 0;
nsUnescape(tmpResult);
caseBResult = tmpResult;
caseBResult.emplace(std::move(rawVal));
} else {
// caseC
bool added = addContinuation(segments, 0, rawValStart,
@@ -701,44 +699,45 @@ increment_str:
while (nsCRT::IsAsciiSpace(*str)) ++str;
}
caseCDResult = combineContinuations(segments);
if (!containedNull) {
caseCDResult = combineContinuations(segments, containedNull);
}
if (containedNull) {
// Percent-decoding produced a NUL, which would truncate the value.
return NS_ERROR_INVALID_ARG;
}
if (caseBResult && !charsetB.IsEmpty()) {
// check that the 2231/5987 result decodes properly given the
// specified character set
if (!IsValidOctetSequenceForCharset(charsetB, caseBResult))
caseBResult = nullptr;
if (!IsValidOctetSequenceForCharset(charsetB, *caseBResult)) {
caseBResult.reset();
}
}
if (caseCDResult && !charsetCD.IsEmpty()) {
// check that the 2231/5987 result decodes properly given the
// specified character set
if (!IsValidOctetSequenceForCharset(charsetCD, caseCDResult))
caseCDResult = nullptr;
if (!IsValidOctetSequenceForCharset(charsetCD, *caseCDResult)) {
caseCDResult.reset();
}
}
if (caseBResult) {
// prefer simple 5987 format over 2231 with continuations
*aResult = caseBResult;
caseBResult = nullptr;
*aResult = ToNewCString(*caseBResult);
charset.Assign(charsetB);
}
else if (caseCDResult) {
// prefer 2231/5987 with or without continuations over plain format
*aResult = caseCDResult;
caseCDResult = nullptr;
*aResult = ToNewCString(*caseCDResult);
charset.Assign(charsetCD);
}
else if (caseAResult) {
*aResult = caseAResult;
caseAResult = nullptr;
*aResult = ToNewCString(*caseAResult);
}
// free unused stuff
free(caseAResult);
free(caseBResult);
free(caseCDResult);
// if we have a result
if (*aResult) {
// then return charset and lang as well
@@ -825,23 +824,6 @@ bool IsRFC5987AttrChar(char aChar)
c == '_' || c == '`' || c == '|' || c == '~');
}
// percent-decode a value
// returns false on failure
bool PercentDecode(nsACString& aValue)
{
char *c = (char *) moz_xmalloc(aValue.Length() + 1);
if (!c) {
return false;
}
strcpy(c, PromiseFlatCString(aValue).get());
nsUnescape(c);
aValue.Assign(c);
free(c);
return true;
}
// Decode a parameter value using the encoding defined in RFC 5987
//
// charset "'" [ language ] "'" value-chars
@@ -909,8 +891,8 @@ nsMIMEHeaderParamImpl::DecodeRFC5987Param(const nsACString& aParamVal,
}
// percent-decode
if (!PercentDecode(value)) {
return NS_ERROR_OUT_OF_MEMORY;
if (!UnescapeRejectingNull(value)) {
return NS_ERROR_INVALID_ARG;
}
// return the encoding
@@ -999,52 +981,44 @@ nsMIMEHeaderParamImpl::DecodeParameter(const nsACString& aParamValue,
(0x41 <= uint8_t(c) && uint8_t(c) <= 0x46) || \
(0x61 <= uint8_t(c) && uint8_t(c) <= 0x66))
// Decode Q encoding (RFC 2047).
// Decode Q encoding (RFC 2047). Returns Nothing() on bad syntax.
// static
char *DecodeQ(const char *in, uint32_t length)
{
char *out, *dest = 0;
Maybe<nsCString> DecodeQ(const char* in, uint32_t length) {
nsCString dest;
dest.SetCapacity(length);
out = dest = (char *)PR_Calloc(length + 1, sizeof(char));
if (dest == nullptr)
return nullptr;
while (length > 0) {
unsigned c = 0;
switch (*in) {
case '=':
// check if |in| in the form of '=hh' where h is [0-9a-fA-F].
if (length < 3 || !ISHEXCHAR(in[1]) || !ISHEXCHAR(in[2]))
goto badsyntax;
PR_sscanf(in + 1, "%2X", &c);
*out++ = (char) c;
in += 3;
length -= 3;
break;
case '=':
// check if |in| in the form of '=hh' where h is [0-9a-fA-F].
if (length < 3 || !ISHEXCHAR(in[1]) || !ISHEXCHAR(in[2])) {
return Nothing();
}
PR_sscanf(in + 1, "%2X", &c);
dest.Append((char)c);
in += 3;
length -= 3;
break;
case '_':
*out++ = ' ';
in++;
length--;
break;
case '_':
dest.Append(' ');
in++;
length--;
break;
default:
if (*in & 0x80) goto badsyntax;
*out++ = *in++;
length--;
default:
if (*in & 0x80) {
return Nothing();
}
dest.Append(*in++);
length--;
}
}
*out++ = '\0';
for (out = dest; *out ; ++out) {
if (*out == '\t')
*out = ' ';
}
dest.ReplaceChar('\t', ' ');
return dest;
badsyntax:
PR_Free(dest);
return nullptr;
return Some(std::move(dest));
}
// check if input is HZ (a 7bit encoding for simplified Chinese : RFC 1842))
@@ -1154,17 +1128,25 @@ void CopyRawHeader(const char *aInput, uint32_t aLen,
nsresult DecodeQOrBase64Str(const char *aEncoded, size_t aLen, char aQOrBase64,
const char *aCharset, nsACString &aResult)
{
char *decodedText;
nsCString decodedText;
NS_ASSERTION(aQOrBase64 == 'Q' || aQOrBase64 == 'B', "Should be 'Q' or 'B'");
if(aQOrBase64 == 'Q')
decodedText = DecodeQ(aEncoded, aLen);
else if (aQOrBase64 == 'B') {
decodedText = PL_Base64Decode(aEncoded, aLen, nullptr);
if(aQOrBase64 == 'Q') {
Maybe<nsCString> decoded = DecodeQ(aEncoded, aLen);
if (!decoded) {
return NS_ERROR_INVALID_ARG;
}
decodedText = std::move(*decoded);
} else if (aQOrBase64 == 'B') {
if (NS_FAILED(
mozilla::Base64Decode(Substring(aEncoded, aLen), decodedText))) {
return NS_ERROR_INVALID_ARG;
}
} else {
return NS_ERROR_INVALID_ARG;
}
if (!decodedText) {
if (ContainsNull(decodedText)) {
// a NUL would truncate the decoded value
return NS_ERROR_INVALID_ARG;
}
@@ -1174,12 +1156,11 @@ nsresult DecodeQOrBase64Str(const char *aEncoded, size_t aLen, char aQOrBase64,
nsAutoCString utf8Text;
if (NS_SUCCEEDED(rv)) {
// skip ASCIIness/UTF8ness test if aCharset is 7bit non-ascii charset.
rv = cvtUTF8->ConvertStringToUTF8(nsDependentCString(decodedText),
rv = cvtUTF8->ConvertStringToUTF8(decodedText,
aCharset,
IS_7BIT_NON_ASCII_CHARSET(aCharset),
true, 1, utf8Text);
}
PR_Free(decodedText);
if (NS_FAILED(rv)) {
return rv;
}
@@ -825,6 +825,13 @@ nsHttpChannelAuthProvider::GetCredentialsForChallenge(const char *challenge,
// as restartable.
mAuthChannel->ConnectionRestartable(mConnectionBased && !authAtProgress);
if (identFromURI &&
(authFlags & nsIHttpAuthenticator::IDENTITY_INCLUDES_DOMAIN)) {
LOG((" ignoring URL identity for a domain-identity scheme\n"));
ident->Clear();
identFromURI = false;
}
if (identityInvalid) {
if (entry) {
if (ident->Equals(entry->Identity())) {
+11 -7
View File
@@ -110,22 +110,27 @@ nsHttpChunkedDecoder::ParseChunkRemaining(char *buf,
count = mLineBuf.Length();
}
// NUL is illegal in a chunk-size or trailer field line (RFC 9110 section
// 5.5).
if (memchr(buf, '\0', count)) {
LOG(("chunked line contains embedded NUL; rejecting\n"));
return NS_ERROR_UNEXPECTED;
}
if (mWaitEOF) {
if (*buf) {
if (count) {
LOG(("got trailer: %s\n", buf));
// allocate a header array for the trailers on demand
if (!mTrailers) {
mTrailers = new nsHttpHeaderArray();
}
mTrailers->ParseHeaderLine(nsDependentCSubstring(buf, count));
}
else {
} else {
mWaitEOF = false;
mReachedEOF = true;
LOG(("reached end of chunked-body\n"));
}
}
else if (*buf) {
} else if (count) {
char *endptr;
unsigned long parsedval; // could be 64 bit, could be 32
@@ -151,8 +156,7 @@ nsHttpChunkedDecoder::ParseChunkRemaining(char *buf,
// ensure that the line buffer is clear
mLineBuf.Truncate();
}
else {
} else {
// save the partial line; wait for more data
*bytesConsumed = count;
// ignore a trailing CR
+9 -1
View File
@@ -279,6 +279,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel *channel,
if (PL_strcasecmp(challenge, "NTLM") == 0) {
nsCOMPtr<nsISupports> module;
mAllowDefaultCredentials = CanUseDefaultCredentials(channel, isProxyAuth);
// Check to see if we should default to our generic NTLM auth module
// through UseGenericNTLM. (We use native auth by default if the
// system provides it.) If *sessionState is non-null, we failed to
@@ -288,7 +289,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel *channel,
// Check for approved default credentials hosts and proxies. If
// *continuationState is non-null, the last authentication attempt
// failed so skip default credential use.
if (!*continuationState && CanUseDefaultCredentials(channel, isProxyAuth)) {
if (!*continuationState && mAllowDefaultCredentials) {
// Try logging in with the user's default credentials. If
// successful, |identityInvalid| is false, which will trigger
// a default credentials attempt once we return.
@@ -399,6 +400,13 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel,
// initial challenge
if (PL_strcasecmp(challenge, "NTLM") == 0) {
// An empty user or password makes nsAuthSSPI::Init authenticate as the
// logged-in user, which only CanUseDefaultCredentials() hosts may do.
if (mUseNative && !mAllowDefaultCredentials &&
(!*user || !*pass)) {
LOG(("Not using default credentials for an untrusted host\n"));
return NS_ERROR_ABORT;
}
// NTLM service name format is 'HTTP@host' for both http and https
nsCOMPtr<nsIURI> uri;
rv = authChannel->GetURI(getter_AddRefs(uri));
+5 -1
View File
@@ -22,7 +22,11 @@ private:
// This flag indicates whether we are using the native NTLM implementation
// or the internal one.
bool mUseNative;
bool mUseNative;
// Whether the prefs let this host use the logged-in user's identity. Set by
// ChallengeReceived, read by GenerateCredentials.
bool mAllowDefaultCredentials = false;
};
} // namespace net
+24
View File
@@ -0,0 +1,24 @@
diff --git a/lib/xmltok.c b/lib/xmltok.c
--- a/lib/xmltok.c
+++ b/lib/xmltok.c
@@ -700,17 +700,19 @@ unicode_byte_type(char hi, char lo) {
static enum XML_Convert_Result PTRCALL E##toUtf16( \
const ENCODING *enc, const char **fromP, const char *fromLim, \
unsigned short **toP, const unsigned short *toLim) { \
enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \
UNUSED_P(enc); \
fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \
/* Avoid copying first half only of surrogate */ \
if (fromLim - *fromP > ((toLim - *toP) << 1) \
- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \
+/* BEGIN MCP CHANGE (Only high surrogate mask) */ \
+ && (GET_HI(fromLim - 2) & 0xFC) == 0xD8) { \
+/* END MCP CHANGE */ \
fromLim -= 2; \
res = XML_CONVERT_INPUT_INCOMPLETE; \
} \
for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \
*(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
if ((*toP == toLim) && (*fromP < fromLim)) \
return XML_CONVERT_OUTPUT_EXHAUSTED; \
else \
+3 -1
View File
@@ -705,7 +705,9 @@ unicode_byte_type(char hi, char lo) {
fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \
/* Avoid copying first half only of surrogate */ \
if (fromLim - *fromP > ((toLim - *toP) << 1) \
&& (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \
/* BEGIN MCP CHANGE (Only high surrogate mask) */ \
&& (GET_HI(fromLim - 2) & 0xFC) == 0xD8) { \
/* END MCP CHANGE */ \
fromLim -= 2; \
res = XML_CONVERT_INPUT_INCOMPLETE; \
} \
+4 -1
View File
@@ -41,6 +41,7 @@
#include "nsIHTMLDocument.h"
#include "mozilla/Likely.h"
#include "nsTextNode.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@@ -690,7 +691,9 @@ nsHtml5TreeOperation::CreateMathMLElement(nsIAtom* aName,
void
nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
{
if (aNode->SubtreeRoot() != aParent->SubtreeRoot()) {
// sFormSubtreeStrict is a pref to temporarily disable this check. See UXP #3197
bool sFormSubtreeStrict = mozilla::Preferences::GetBool("html5.forms.standards_compliant", true);
if (sFormSubtreeStrict && aNode->SubtreeRoot() != aParent->SubtreeRoot()) {
return;
}
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff. Show more