Compare commits

...
381 Commits
Author SHA1 Message Date
Moonchild 610e44320c Issue #2342: Remove MOZ_MUST_USE macro 2023-11-05 12:38:11 +01:00
Moonchild 10476e27da Issue #2342: Use [[nodiscard]] in /mfbt 2023-11-05 12:37:04 +01:00
Moonchild a4777b1c21 Issue #2342: Use [[nodiscard]] in /xpcom and xpidl parser 2023-11-05 10:41:52 +01:00
Moonchild 9f6e448f78 Issue #2342: Use [[nodiscard]] in /uriloader /widget
Also a few misc low-volume places.
2023-11-05 00:59:31 +01:00
Moonchild 19a21bac1b Issue #2342: Use [[nodiscard]] in /netwerk 2023-11-04 23:42:53 +01:00
Moonchild c7867ce130 Issue #2342: Use [[nodiscard]] in /memory and remove Sun Studio hack 2023-11-04 22:57:30 +01:00
Moonchild 34c068e611 Issue #2342: Use [[nodiscard]] in /media 2023-11-04 22:28:58 +01:00
Moonchild a48e621048 Issue #2342: Use [[nodiscard]] in /js 2023-11-04 20:06:50 +01:00
Moonchild de5d3b1034 Issue #2342: Use [[nodiscard]] in IPDL generation and fix warnings
DOM plugin code had two warning in IPC caught by [[nodiscard]], these
were fixed in one go.
2023-11-04 01:24:20 +01:00
Moonchild f8737bbf4f Issue #2342: Use [[nodiscard]] in /ipc 2023-11-04 01:22:37 +01:00
Moonchild d9c70eaba2 Issue #2342: Use [[nodiscard]] in /hal /image and /intl 2023-11-04 01:21:57 +01:00
Moonchild 9308c63ce6 Issue #2281 - Remove the use of non-standard namespace std::tr1 in
Google's WebRTC gtest code
2023-11-04 00:13:32 +01:00
Moonchild 6314e01691 Issue #2342: Use [[nodiscard]] in /accessible and /caps 2023-11-03 12:17:29 +01:00
Moonchild b7b2f1de84 Issue #2342: Use [[nodiscard]] in /gfx and /layout 2023-11-03 00:34:37 +01:00
Moonchild b838d6634c Issue #2342: Use [[nodiscard]] in /dom 2023-11-03 00:17:31 +01:00
Moonchild dc4ea7f680 Merge branch 'master' into c++17-work 2023-11-02 12:20:37 +01:00
Moonchild 2132ea4a22 Merge pull request 'Improve boxshadow rendering' (#2367) from boxshadow-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2367
2023-11-02 00:27:19 +00:00
Moonchild 33bff10b1c [devtools] Make ECMA v6 the default for devtools pretty-printing. 2023-11-01 14:27:24 +01:00
Moonchild 9493e8c3de Issue #2364 - Limit the growth of scaling for animated nsDisplayTransform
in the fallback case.

This ensures we don't scale the underlying size of the layer beyond what
is close to the current display size. When box shadows get much larger
than this, they start taking so much time to render that successive
frames grow in scale too fast for any inter-frame reuse to be possible.

With this, we avoid that and no longer get crushed by re-rendering
gigantic box shadows every single frame.

See BZ 1383825
2023-11-01 10:32:04 +01:00
Moonchild 7631297112 [gfx] Add Min() and Max() convenience functions for 2d point types.
This will return (min(x1,x2), min(y1,y2)) and equivalent max from 2
passed-in (x1,y1) (x2,y2) points
2023-11-01 10:31:19 +01:00
Moonchild 5e381b021c [gfx] Fix a bug in SizeTyped templating
A second template parameter 'F' was previously added to SizeTyped, but
was not correspondingly added to the argument passed for the 'Sub'
parameter of BaseSize.
2023-11-01 10:31:18 +01:00
Moonchild 5c9a1efa7c Issue #2364 - Only use HWA AlphaBoxBlur when targets are large enough.
There's considerable cost associated with creating HWA draw targets
which would negate and regress the performance won by it if used for
too small targets (like small spans of text).
This only uses HWA if >= 8K SurfaceAllocationSize to balance HWA draw
target cost with box blur cost.
2023-11-01 10:31:18 +01:00
Moonchild 93ddeb613e Issue #2364 - Optimize the software-based box blur implementation. 2023-11-01 10:31:17 +01:00
Moonchild 2fae5d3e6b Issue #2364 - use DrawTarget::DrawSurfaceWithShadow to render box
shadows on platforms that accelerate it.
2023-11-01 10:31:16 +01:00
Moonchild 5fd365cb76 Issue #2364 - Re-factor AlphaBoxBlur
Only blur one quadrant of a box-shadow and mirror it to the other quadrants.
This applies only if the corners are symmetrical (square corners or equal
corner radii) otherwise we'll fall back to the old method.
2023-11-01 10:31:16 +01:00
Moonchild d7f8e56f04 Merge pull request 'Update ffvpx to version 6.0' (#2363) from trav90/UXP-contrib:ffvpx60-rebased into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2363
2023-11-01 09:27:31 +00:00
trav90 6ee56b0a60 Issue #2317 - Part 9 - "send" before "receive"-ing when decoding audio using FFmpeg
This is what the documentation says we should be doing. We miss decoding a packet otherwise.
2023-10-27 10:16:08 -05:00
trav90 165ef56547 Issue #2317 - Part 8 - Update compiler flags used for ffvpx 2023-10-27 10:15:42 -05:00
trav90 9d333be11b Issue #2317 - Part 7 - Don't use -ffreestanding flag when building with clang
This was added by Mozilla as a workaround for an automated build system (one that they no longer use) for building on Linux with clang (which is not our target compiler for that platform). No need for us to keep this workaround.
2023-10-27 10:15:10 -05:00
trav90 aff6fbf36c Issue #2317 - Part 6 - Remove old workaround for clang-cl
This was added back in 2016 to work around issues with clang-cl. Shouldn't be needed anymore.
2023-10-27 10:14:45 -05:00
trav90 ef8447ad4b Issue #2317 - Part 5 - Build ffvpx against the FFmpeg 6.0 headers 2023-10-27 10:14:24 -05:00
trav90 21face45d3 Issue #2317 - Part 4 - Regenerate config* files for ffvpx 2023-10-27 10:14:02 -05:00
trav90 ff4d550c80 Issue #2317 - Part 3 - Update symbols list for FFmpeg 6.0 2023-10-27 10:13:46 -05:00
trav90 45b9cfbe93 Issue #2317 - Part 2b - Clip constants used with shift instructions within inline assembly
Cherry-pick of upstream commit: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb
2023-10-27 10:13:23 -05:00
trav90 4321dbddcc Issue #2317 - Part 2a - Update changes.patch for ffvpx 2023-10-27 10:13:06 -05:00
trav90 3a67a9510b Issue #2317 - Part 2 - Import FFmpeg 6.0 source files for ffvpx 2023-10-27 10:12:44 -05:00
trav90 ea464a764f Issue #2317 - Part 1 - Update and cleanup ffvpx documentation in preparation for lib update. 2023-10-27 10:11:11 -05:00
Moonchild 72a2a5f2bd [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:18:57 +02:00
Moonchild 0b70c77657 Merge branch 'master' of https://repo.palemoon.org/MoonchildProductions/UXP 2023-10-26 22:46:45 +02:00
Moonchild ca04aefa67 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:45:36 +02:00
Moonchild 89dec27643 Merge pull request 'Restore ARM32 buildability.' (#2360) from dbsoft/UXP:arm-2354 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2360
2023-10-26 12:10:38 +00:00
Moonchild 53a8a408f2 Bump Goanna version to 6.5.0 2023-10-25 22:51:24 +02:00
Moonchild a653f74576 Merge pull request 'No Issue - Implement crypto.randomUUID' (#2359) from Basilisk-Dev/UXP-contrib:crypto-randomuuid into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2359
2023-10-25 20:48:01 +00:00
Brian Smith 5fa394b169 Issue #2354 - Restore ARM32 buildability on Linux.
Fix ION breakages due to BigInt changes.
Fix breakages from libjpeg, libyuv and libvpx upgrades.
Restore ARM(32/64) NEON FPU support in libyuv.
2023-10-25 19:01:38 +00:00
Basilisk-Dev 3d92b82125 No Issue - Implement crypto.randomUUID
We already have code in the platform to generate random UUIDs. This simply exposes that functionality via the crypto.UUID function
2023-10-25 13:39:53 -04:00
Moonchild ccb41c645c [WebRTC] Give ::Terminated() the same treatment as ::Close_g 2023-10-25 18:30:38 +02:00
Moonchild 98c3aa5743 [XPCOM] Add several app/msi file types to the executables list (Win).
This errs on the side of caution for what are installer packages, but
people getting conned into thinking this is safe is a bit too common.
They are akin in danger to .exe files in that respect as it installs
software, and should be treated similarly, so, warn about the potential
danger.
2023-10-25 18:20:53 +02:00
Moonchild 2c2ddd98d2 [DOM] Drop mWrappedRunnable early in workers.
This should prevent some intermittent crashes.
2023-10-25 18:04:26 +02:00
Moonchild b15a36452d [WebGL] Add preffed limit to WebGL vertCount
Defaults to 30M, working around driver bugs (looking at you, Mesa)
2023-10-25 07:53:57 +02:00
Moonchild a71597905c [widget] Change RegisterDragDrop to be called on idle.
This is a low-priority init function that should not be called with
immediate dispatch to the current thread, for performance reasons.
Additionally, do not call RegisterDragDrop for hidden windows.
2023-10-25 06:09:09 +02:00
Moonchild 028aa731ed [network] Block more invalid cookie name characters.
This blocks the following characters from use in the cookie name:
0x3B (semi-colon), 0x3D (equals) and 0x7F (del)
2023-10-25 04:31:47 +02:00
Moonchild 688ed9a114 [DOM] Ignore status 206 and vary header checking for opaque responses in
the Cache API.
2023-10-25 04:29:37 +02:00
Moonchild c30be25773 Merge pull request 'Implement support for WebM transparency/alpha channel.' (#2358) from athenian200/UXP:webm_alpha_work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2358
Reviewed-by: Travis W. <travawine@palemoon.org>
2023-10-25 02:19:47 +00:00
Moonchild 72f30730e7 Merge branch 'master' of https://repo.palemoon.org/MoonchildProductions/UXP 2023-10-25 03:59:44 +02:00
Moonchild 782202963e [media] Use RefPtr<TrackBuffersManager> instead of raw pointers 2023-10-25 03:59:10 +02:00
Moonchild dd2fbc763a Merge pull request 'Treat all GLSL versions >=450 as 450' (#2356) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2356
2023-10-24 13:55:41 +00:00
Jeremy Andrews f4d408dffe Issue #2357 - Add reftest for WebM alpha.
I figured I should include the reftest for the sake of completeness, though I have already verified the feature working from the site mentioned in the forum thread that prompted me to look into this in the first place.

Ref: BZ 1331528
2023-10-24 00:59:20 -05:00
Jeremy Andrews f7c0599e1e Issue #2357 - WebM w/alpha renders black if WMF decoder is enabled.
Mozilla forgot to force use of VPXDecoder on Windows in their initial implementation, this is pretty much what they did for Android as well. Straight port of the Firefox 67 fix.

Ref: BZ 1528652
2023-10-24 00:59:11 -05:00
Jeremy Andrews 855109b028 Issue #2357 - Paused WebM videos w/alpha are 100% transparent if HA is disabled.
Mozilla found a bug in their initial implementation, causing paused WebM videos with alpha to become totally transparent if hardware acceleration is disabled. Straight port of the Firefox 54 fix.

Ref: BZ 1332952
2023-10-24 00:59:00 -05:00
Jeremy Andrews c48055d6ea Issue #2357 - VPXDecoder does not decode alpha frames.
Another requirement to have transparency in videos. Straight port of Firefox 53 implementation, save for some oddities relating to needing to put uint8_t instead of uint8 in yuv_convert to get this to compile.

Ref: BZ 1321076, 1329104
2023-10-24 00:58:50 -05:00
Jeremy Andrews 8b746b6c12 Issue #2357 - WebM demuxer can't tell when a video wants to be transparent.
Required to have an alpha channel (which in the strange world of graphics seems to refer to transparency, and not experimental code) in WebM videos. Straight port of Firefox 53 implementation, adapted slightly for a couple of patches previously taken without this.

Ref: BZ 1320829
2023-10-24 00:58:15 -05:00
Basilisk-Dev 1889edcea8 Treat all GLSL versions >=450 as 450
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1446548
2023-10-23 13:52:25 -04:00
Moonchild 6df4c18747 Issue #2355 - Apply self-transforms to the frame of top level <svg>
We previously didn't do this because we relied on our anonymous wrapper
to perform transforms. However, that resulted in only the children
transforming, and the frame's cliprect wouldn't be updated,
giving the impression of the z-ordering being wrong.

Also adds reftests from the relevant BZ bug found later.

Resolves #2355
2023-10-22 09:33:22 +02:00
Moonchild d5231ca7e7 Issue #2346 - Follow-up: restore erroneously removed GMP mCrashHelper. 2023-10-21 17:06:43 +02:00
Moonchild 93823836d7 Merge pull request 'Implement some NumberFormat spec updates' (#2352) from 2350-numberformat-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2352
2023-10-20 20:57:39 +00:00
Moonchild 1e3301e987 Merge pull request 'Align the Performance Observer navigation and resource with the spec.' (#2353) from dbsoft/UXP:po-navres-2282 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2353
2023-10-20 13:01:08 +00:00
Brian Smith ccbeea30aa Issue #2282 - Part 2 - Re-add some timer clamping that got clobber erroneously. 2023-10-20 05:00:04 -05:00
Brian Smith 398486a64b Issue #2282 - Align the Performance Observer navigation and resource with the spec.
This now passes the conformance tests.
https://bugzilla.mozilla.org/show_bug.cgi?id=1425458
Resource timing entries Workers - part 2 - PerformanceTimingData.
https://bugzilla.mozilla.org/show_bug.cgi?id=1462605
PerformanceNavigationTiming.name must be the value of the address of the current document.
https://bugzilla.mozilla.org/show_bug.cgi?id=1462883
Update PerformanceTimingData::mReportCrossOriginRedirect in SetPropertiesFromHttpChannel.
https://bugzilla.mozilla.org/show_bug.cgi?id=1462879
PerformanceNavigationTiming must be notified correctly - part 1 - notify.
2023-10-20 04:21:49 -05:00
Moonchild 4554cb9929 Merge pull request 'Clean up the rest of EME' (#2348) from 2346-EME-cleanup into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2348
2023-10-19 18:41:58 +00:00
Moonchild 8f62ed27eb Merge pull request 'Issue #2332 - Hyphenate rtc stats type as per spec' (#2349) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2349
2023-10-19 15:33:23 +00:00
Moonchild 3e71cd6b93 Issue #2350 - Part 2: Allow "maximumFractionDigits" option in
Intl.NumberFormat to be less than the default minimum fraction digits.

This implements the changes from the "has consensus" PR in TC39
The second pair of `DefaultNumberOption()` calls was inlined, because
only the fallback case is relevant anyway.

Steps 12.d and 12.e from the spec PR were combined into a single
`if`-block. That way it also matches step 12.f more closely.
Also changed the single `if` steps into an `if-else if` chain, because
the steps are mutually exclusive.
2023-10-19 15:46:27 +02:00
Moonchild 6c6c16b7f0 Issue #2350 - Part 1: Apply "minimumIntegerDigits" to number-formatters
with fraction-digits.

Implements the changes to `SetNumberFormatDigitOptions` and
`FormatNumberToString`, except for the support of the new
"compact-rounding" mode.
This also includes a few minor fixes for edge cases (like -0 vs. 0)
2023-10-19 15:19:55 +02:00
Moonchild 6ad6cc9c2d Issue #2350 - Part 0: Add a helper function DefaultNumberOption
This is the abstract operation that converts an option value to a number
value, checking whether it is in the allowed range, and filling in a
fallback value if necessary.
2023-10-19 10:17:11 +02:00
Basilisk-Dev 5b5672fd56 Issue #2332 - Hyphenate rtc stats type as per spec
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1322503
2023-10-18 16:30:27 -04:00
Moonchild 0e427867e3 Issue #2281 - Force clobber
Without a clobber, mozconfigure doesn't properly pick up the /std:c++17
or -std=gnu++17 compiler switches needed to put them into C++17 mode.
2023-10-18 14:40:16 +02:00
Moonchild 8137a4e122 Issue #2281 - Add some deduction guides for class template arguments.
This is necessary if we want to start using Span() constructors
instead of the MakeSpan() kludge.
2023-10-18 14:35:59 +02:00
Moonchild f2ec6ef34d Issue #2346 - Remove IsWaitingOnCDMResource stub 2023-10-18 10:59:39 +02:00
Moonchild 42c8b9470c Issue #2346 - Remove EME PDM factory creation. 2023-10-17 16:37:46 +02:00
Moonchild d0d6e8edf5 Issue #2346 - Clean up EME code in toolkit extension manager (GMP) 2023-10-17 16:37:45 +02:00
Moonchild 30d3325148 Issue #2346 - Remove stub for setting decryptor ID 2023-10-17 16:37:45 +02:00
Moonchild 0451648c60 Issue #2346 - Remove MDSM "Wait for CDM" state
Without EME we don't need the machinery to wait for an external
CDM module to be ready in our mediadecoder.
2023-10-17 16:37:44 +02:00
Moonchild 7a10dcaadf Issue #2346 - Update tests 2023-10-17 16:37:43 +02:00
Moonchild a63cf31989 Issue #2346 - Update build configuration and remove --{en|dis}able-eme 2023-10-17 16:37:43 +02:00
Moonchild ea3785a6d7 Issue #2346 - Remove EME WebIDL interfaces 2023-10-17 16:37:42 +02:00
Moonchild d0d9e63809 Issue #2346 - Update license (remove OpenAES) 2023-10-17 16:37:42 +02:00
Moonchild e80bbcfe91 Issue #2346 - Remove unused EME components
This removes:
dom/media/eme code
GMP CDM proxies
GMP WideVine adapter code
EME media platform code
GMP clearkey module
2023-10-17 16:37:41 +02:00
Moonchild 08406731e5 Issue #2346 - Remove MOZ_EME conditional code 2023-10-17 16:37:41 +02:00
Moonchild 6076431d7c Merge pull request 'Backport of Mozilla tooltip bugs' (#2347) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2347
2023-10-17 14:30:19 +00:00
Moonchild 60b4d804bd Issue #1721 - Follow-up: Properly protect GPC header
Make it a singleton so it cannot be overwritten.
2023-10-17 16:26:18 +02:00
Basilisk-Dev 2b1281f2c9 Backport of Mozilla tooltip bugs:
Bug 148624 - only show tooltip when document has focus
Partial Bug 1857513 - Use window activeness rather than document.hasFocus() to display chrome-only tooltips
2023-10-16 10:13:10 -04:00
Moonchild 087febcc4b Merge pull request 'Stop pretending proxies have a JSNative call/construct hook.' (#2345) from dbsoft/UXP:readablestreams-crash into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2345
2023-10-16 06:51:06 +00:00
Moonchild 6430adfb2d Restore EME WebIDL for proper cleanup later. 2023-10-16 08:39:28 +02:00
Brian Smith d5020b69bd Issue #1442 Follow-up: Stop pretending proxies have a JSNative call/construct hook.
https://bugzilla.mozilla.org/show_bug.cgi?id=1471924 Part 1
Also remove an erroneous debug assert and guard against future issues.
This fixes crashes on vk.com but still does not behave correctly.
2023-10-16 01:10:26 -05:00
Moonchild 46138995f6 Issue #2281 - Default to C++17 when building.
Configure the toolchain to default to C++17 language standard with
optional gnu extensions (if on GCC)
2023-10-15 15:12:23 +02:00
Moonchild aeb9de40a5 Issue #2281 - Avoid class-static constexpr in TypedArrayObject 2023-10-15 01:54:25 +02:00
Moonchild 3d693801f9 Issue #2281 - Build LZ4 as C instead of including it as C++. 2023-10-15 00:19:13 +02:00
Moonchild 3b39358c84 Clean up dom\webidl
Fix CRLF line endings in some files, and remove EME interface leftovers.
2023-10-14 15:16:41 +02:00
Moonchild 4df8e7664a Issue #2340 - Return an array (actually frozen sequence) for {border|content}BoxSize
Resolves #2340
2023-10-14 14:16:26 +02:00
Moonchild 14fa712b8c Issue #2281 - The 'register' storage class is no longer a thing in c++17 2023-10-13 23:12:37 +02:00
Moonchild 7d93034fd0 Issue #2281 - Mark mozalloc new() as noexcept to aligh with what the VC
runtime expects.

Currently spams warnings but may actually error out if not fixed, or
result in undefined behaviour if mismatching signatures are treated as
redeclarations with different exception specifications.
2023-10-13 23:12:00 +02:00
Moonchild 1769e74839 Issue #2281 - Replace std::iterator inheritance with iterator traits
definitions (as required by C++17).
2023-10-13 23:07:22 +02:00
Moonchild cdfd243b5a Merge pull request 'Issue #2332 - WebRTC Spec Updates' (#2338) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2338
2023-10-10 11:13:22 +00:00
Moonchild b326873871 Merge pull request 'Issue #2332 - Fix CamerasChild helper to return by value instead of out-of-scope reference' (#2339) from Basilisk-Dev/UXP-contrib:bugzilla-1318132 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2339
2023-10-10 11:12:08 +00:00
Basilisk-Dev 0ea78ba5fa Issue #2332 - Fix CamerasChild helper to return by value instead of out-of-scope reference
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1318132
2023-10-09 22:13:50 -04:00
Basilisk-Dev 95a8edc5fc Issue #2332 - Update most tests to skip RTCSessionDescription construction
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 6
2023-10-09 17:09:04 -04:00
Basilisk-Dev 38dfadad45 Issue #2332 - Update most tests to skip RTCIceCandidate construction
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 5
2023-10-09 17:08:07 -04:00
Basilisk-Dev 9bee3a8b72 Issue #2332 - Have createOffer/Answer resolve with dictionaries
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 4
2023-10-09 17:07:05 -04:00
Basilisk-Dev c8218f73b7 Issue #2332 - Have set(Local|Remote)Description take dictionaries
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 3
2023-10-09 17:06:12 -04:00
Basilisk-Dev 81cf4413e2 Issue #2332 - Have addIceCandidate take a dictionary
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 2
2023-10-09 17:04:07 -04:00
Basilisk-Dev 09e6d13d6b Issue #2332 - Update RTCIceCandidate to spec
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 - part 1
2023-10-09 17:02:11 -04:00
Basilisk-Dev 69cfed48da Issue #2332 - Add deprecation warnings to writable RTCSessionDescription
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1313966
2023-10-09 17:00:40 -04:00
Moonchild 1b2c1d8eac Merge pull request 'Correct overzealous GMP checks' (#2336) from mrnhmath/UXP:2301fix into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2336
2023-10-08 09:24:21 +00:00
Moonchild e0746ccf31 Merge pull request 'Issue #2332 - Do some cleaning around direct listeners and video sinks' (#2335) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2335
2023-10-08 09:21:07 +00:00
Matheus Marinho 8f6d5c5ba0 Correct overzealous GMP checks 2023-10-06 23:04:36 -03:00
Moonchild 78120a7693 [DOM] Fix deprot in PerformanceMark.cpp 2023-10-05 23:10:36 +02:00
Basilisk-Dev ecc90c09ef Issue #2332 - Use only one listener in MediaPipelineTransmit
https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 3
2023-10-05 16:51:40 -04:00
Basilisk-Dev 8698518416 Issue #2332 - Use the same path for passing on missed data to video sink, as during normal operation
https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 2
2023-10-05 16:48:52 -04:00
Basilisk-Dev cf178171a4 Issue #2332 - Refactor code that feeds video stream sink when it gets added
https://bugzilla.mozilla.org/show_bug.cgi?id=1305949 part 1
2023-10-05 16:47:30 -04:00
Moonchild 92ad63b579 Merge pull request 'Issue #2332 - Update libvpx to 1.6.1' (#2333) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2333
2023-10-05 18:07:43 +00:00
Moonchild 8c63b950f5 Merge pull request 'Issue #2332 - Remove unimplemented and non-spec getStreamById from RTCPeerConnection' (#2334) from Basilisk-Dev/UXP-contrib:bz-1318163 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2334
2023-10-05 18:02:14 +00:00
Basilisk-Dev 9aed582fc1 Issue #2332 - Remove unimplemented and non-spec getStreamById from RTCPeerConnection
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1318163
2023-10-05 10:27:12 -04:00
Basilisk-Dev 1b5b970a53 Issue #2332 - libvpx upgrade followup part 5
Port commits 39f9ab375b and ed7b08e608 to new libvpx version
2023-10-04 22:11:29 -04:00
Basilisk-Dev bf6ed5545d Issue #2332 - libvpx upgrade followup part 4
Port commit babeb5c556 to new libvpx version
2023-10-04 22:11:29 -04:00
Basilisk-Dev 302411b4df Issue #2332 - libvpx upgrade followup part 3
Port commit d5a2c45aad to new libvpx version
2023-10-04 22:11:29 -04:00
Basilisk-Dev 2cb4813adb Issue #2332 - libvpx upgrade followup part 2
Port commit ca36e991ea to new libvpx version
2023-10-04 22:11:28 -04:00
Basilisk-Dev c5ba4dd2a4 Issue #2332 - libvpx upgrade followup part 1
Port commit a8f45aba81 to new libvpx version
2023-10-04 22:11:28 -04:00
Basilisk-Dev 322bbcad1b Issue #2332 - Update to libvpx 1.6.1
Backport of Bugzilla 1223692 and 1331498
2023-10-04 22:10:42 -04:00
Moonchild a2f69c22f8 Merge pull request 'No Issue - Remove deprecation errors for obsolete RTCOfferOptions' (#2325) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2325
2023-10-04 09:19:58 +00:00
Basilisk-Dev 9d69fa3c37 No Issue - Remove deprecation errors for obsolete RTCOfferOptions
Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1197021
2023-10-03 16:55:28 -04:00
Moonchild 5d76f35990 Merge pull request 'Initial implementation of readable streams' (#2324) from dbsoft/UXP:readablestreams into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2324
2023-10-03 17:23:19 +00:00
Brian Smith 054f135a54 Issue #1442 - Part 26 - FetchStreamReader needs to cancel its reader when it encounters write errors.
https://bugzilla.mozilla.org/show_bug.cgi?id=1416879 Part 5
Also same fix as in Part 24 for FetchStream but in FetchStreamReader.
2023-10-03 01:45:08 -05:00
Brian Smith 5c8336d123 Issue #1442 - Part 25b - Second try that hopefully doesn't break Windows. 2023-10-02 18:38:02 -04:00
Brian Smith 0f0adfa1b4 Issue #1442 - Part 25 - Fix bustage on X11 platforms. 2023-10-02 18:08:46 -04:00
Brian Smith ec38250eea Issue #1442 - Part 24 - Prevent FetchStream from incorrectly running on the main thread.
This prevents a deadlock and JSContext related crashes, however this should eventually
be replaced by an EventTargetFor() call when the Dispatcher API is implemented.
Also now that ReadableStream appears stable, toggle the preferences true by default.
2023-10-02 04:42:24 -05:00
Moonchild 682e5a4727 Merge branch '2323-timerclamp-workers'
This resolves #2323
2023-10-01 22:08:45 +02:00
Moonchild 16e405f818 Issue #2323 - Part 3: Exclude chrome workers from worker timer clamping. 2023-10-01 20:54:48 +02:00
Moonchild bfae2ed943 Issue #2323 - Part 2: Implement timer nesting and clamping for workers. 2023-10-01 19:42:45 +02:00
Botond Ballo 1337373ee1 Issue #2323 - Part 1: Add Min()/Max() methods to TimeDuration.
Just some helper functions to make time comparisons in the correct data
format easier.

See BZ 1321885
2023-10-01 19:37:49 +02:00
Moonchild efc3e99b90 Merge pull request 'Fall back to 0 if setInterval interval not supplied' (#2322) from martok/UXP-contrib:mr/2321-setInterval into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2322
2023-10-01 12:57:10 +00:00
Martok eaf9a3cc57 Issue #2321 - Fall back to 0 if setInterval interval not supplied 2023-10-01 02:21:53 +02:00
Brian Smith b7a5d73ba9 Issue #1442 - Part 23 - Align FetchStream with Firefox 68ESR.
https://bugzilla.mozilla.org/show_bug.cgi?id=1612308
https://bugzilla.mozilla.org/show_bug.cgi?id=1445587
Partial part 2 implementing synchronization changes.
2023-09-30 11:19:06 -05:00
Brian Smith aa1caf5ade Issue #1442 & #1691 Follow-up - Part 22 - Changes that came with Dynamic Module Import.
At the time we did not have ReadableStreams in our tree so these changes were left out.
https://bugzilla.mozilla.org/show_bug.cgi?id=1499140
Implement support for dynamic module import in the interpreter.
2023-09-29 15:34:10 -05:00
Brian Smith bc4d5cec6a Issue #1442 - Part 21 - Fix debug builds by removing an invalid assert. 2023-09-29 13:09:28 -05:00
Brian Smith 7d55641d43 Issue #1442 - Part 20 - FetchStream should not have an extra JS::Heap<ReadableStream>.
https://bugzilla.mozilla.org/show_bug.cgi?id=1390717
2023-09-29 09:25:52 -05:00
Brian Smith 3f799def4d Issue #1442 - Part 19 - FetchStream must support multiple read requests.
https://bugzilla.mozilla.org/show_bug.cgi?id=1395220
2023-09-29 09:12:08 -05:00
Brian Smith 796863b719 Issue #1442 - Part 18 - Cycle collect FetchStreamReader.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-28 22:17:06 -05:00
Brian Smith aced9bbc94 Issue #1442 - Part 17 - Creating FetchStream as a out param in order to avoid JS hazards
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-28 22:06:25 -05:00
Brian Smith b1d111ab6b Issue #1442 - Part 16 - Report stream errors during consumption.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-28 21:18:27 -05:00
Brian Smith 99c25d8e98 Issue #1442 - Part 15 - Setting the correct global when ReadableStream.getReader() is called.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-28 19:51:09 -05:00
Brian Smith 8a45238908 Issue #1442 - Part 14 - Starting body consuming and passing the JSContext down
from the binding entrypoints to where the ReadableStream could be read.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-28 19:35:59 -05:00
Moonchild 1b588e0d73 Merge pull request 'Issue #2058 - Upgrade usrsctp library' (#2297) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2297
2023-09-28 23:22:41 +00:00
Brian Smith c9020fed9c Issue #1442 - Part 13 - Implement FetchStreamReader.
https://bugzilla.mozilla.org/show_bug.cgi?id=1329298
2023-09-28 17:36:52 -05:00
Brian Smith 4c6e382f47 Issue #1442 - Part 12b - Allow idle worker shutdown while Cache/CacheStorage DOM objects exist, but block it during Cache operation.
https://bugzilla.mozilla.org/show_bug.cgi?id=1362444
Pre-requisite for Part 13.
2023-09-28 17:35:26 -05:00
Brian Smith 26cb9b0802 Issue #1442 - Part 12a - Allow idle worker shutdown to begin for an opt-in WorkerHolder mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1362444
Pre-requisite for Part 13.
2023-09-28 17:34:54 -05:00
Brian Smith 1fd5023fdc Issue #1442 - Part 12 - Label FetchBody.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363318
FetchSignal is not in our tree so this is a partial patch to get mOwner changes.
Pre-requisite for Part 13.
2023-09-28 16:54:19 -05:00
Brian Smith 8a0c7bde63 Issue #1442 - Part 11 - Response.body handling.
https://bugzilla.mozilla.org/show_bug.cgi?id=1329298
Use BufferSource in webIDL.
https://bugzilla.mozilla.org/show_bug.cgi?id=1337722
2023-09-28 14:05:55 -05:00
Moonchild cc43ec658c Merge pull request 'Intel Ion: Don't test for a 3-byte opcode in a 2-byte opcode predicate.' (#2319) from dbsoft/UXP:ion-fix into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2319
2023-09-28 14:25:56 +00:00
Moonchild 07df24f00f Merge pull request 'Cherry-pick upstream libvpx fix for CVE-2023-5217' (#2320) from Basilisk-Dev/UXP-contrib:libvpx-cve into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2320
2023-09-28 14:14:15 +00:00
Basilisk-Dev ed7b08e608 Cherry-pick upstream libvpx fix
Backport of https://hg.mozilla.org/releases/mozilla-esr115/rev/5241232a3292943bd59ff1704eab60fee3cbc9d1
Addresses CVE-2023-5217
2023-09-28 09:49:10 -04:00
Brian Smith 1a429629d2 Issue #1442 - Part 10c - Use application/octet-stream for arrayBuffer in sendBeacon.
https://bugzilla.mozilla.org/show_bug.cgi?id=1329298
Pre-requisite for Part 11.
2023-09-27 23:40:02 -05:00
Brian Smith 03ec9c095b Issue #1442 - Part 10b - Use nsIXHRSendable instead Blob/FormData/URLSearchParams.
https://bugzilla.mozilla.org/show_bug.cgi?id=1329298
Pre-requisite for Part 11.
2023-09-27 23:22:06 -05:00
Brian Smith 24edfc1652 Issue #1442 - Part 10a - Unify body extraction in Fetch/Beacon/XHR.
https://bugzilla.mozilla.org/show_bug.cgi?id=1329298
Pre-requisite for Part 11.
2023-09-27 22:58:24 -05:00
Brian Smith efd2b96387 Issue #1442 - Part 9: Stream shutdown handling.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-27 19:24:08 -05:00
Brian Smith 4a179ff885 Issue #1442 - Part 8: Fetch implementation of streams.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
+worker-friendly pref checking for the DOM API.
2023-09-27 19:20:08 -05:00
Brian Smith 8c5a0f0de9 Issue #1442 - Part 7: Use of ReadableStream in WebIDL files.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-27 19:08:24 -05:00
Brian Smith cc8f43bf79 Issue #1442 - Part 6: binding codegen naming alignment for Streams.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-27 19:04:02 -05:00
Brian Smith 552d964ae7 Issue #1442 - Part 5: Implement WebIDL bindings for Streams.
https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
2023-09-27 18:25:48 -05:00
Brian Smith 0099fc1627 Issue #1442 - Part 4: Add JSAPI functions for working with ReadableStream.
https://bugzilla.mozilla.org/show_bug.cgi?id=1272697
2023-09-27 17:33:34 -05:00
Brian Smith 8ce17f02ee Issue #1442 - Part 3: Implement ReadableStream and associated classes in the JS engine.
https://bugzilla.mozilla.org/show_bug.cgi?id=1272697
2023-09-27 16:00:10 -05:00
Brian Smith 269a703200 No Issue - IonMonkey: Don't test for a 3-byte opcode in a 2-byte opcode predicate.
https://bugzilla.mozilla.org/show_bug.cgi?id=1390214
Silence increasingly loud warnings from clang, also could cause errant behavior.
2023-09-27 14:29:07 -05:00
Brian Smith 582fd0dd81 Issue #1442 - Part 2: Add a run-time preference for toggling the streams API.
https://bugzilla.mozilla.org/show_bug.cgi?id=1272697
2023-09-27 10:45:00 -05:00
Moonchild 395caa8780 [network] Refactor TransactionObserver::OnDataAvailable() 2023-09-27 16:37:30 +02:00
Brian Smith f31471e689 Issue #1442 - Part 1: Change ArrayBufferCopyData self-hosting intrinsic to take a start offset for the destination.
This will be needed to manage stream chunks.
https://bugzilla.mozilla.org/show_bug.cgi?id=1272697
2023-09-27 09:36:44 -05:00
André Bargull be4b71b580 [js] Handle dead wrappers 2023-09-27 15:23:57 +02:00
Moonchild de91800956 Merge branch 'alloc-cleanup-work' 2023-09-27 00:53:54 +02:00
Moonchild 7a48dfc066 [memory] Guard OOM reporter from incorrectly reported (too small) size. 2023-09-26 21:07:29 +02:00
Moonchild 4769b2a9fa [memory] Remove likely/unlikely duplication in mozalloc.
We already have this in mozilla/Likely.h, use that instead.
2023-09-26 21:02:11 +02:00
Moonchild b12c222c61 [memory] Remove MOZALLOC_INLINE
MOZ_ALWAYS_INLINE_EVEN_DEBUG is always defined through
mozilla/Attributes.h, so the fallbacks are never used in practice.
2023-09-26 20:56:11 +02:00
Moonchild 2ac006763b Merge branch 'master' of https://repo.palemoon.org/MoonchildProductions/UXP 2023-09-26 15:23:20 +02:00
Moonchild 3edbfa6b6e Merge branch '2316-drawimage-svg-work'
Resolves #2316
2023-09-26 15:22:52 +02:00
Moonchild fcb74a0fb6 Issue #2316 - Part 3: Clarify comment 2023-09-26 15:21:34 +02:00
Moonchild bfda40bce9 Issue #2316 - Part 2: Add reftests 2023-09-26 15:15:45 +02:00
Moonchild 8b4aae99b4 Issue #2316 - Part 1: Use fallback element sizes for w/h-less SVG
Instead of completely failing the call, use the CSS specified intrinsic
default width/height of 300x150.
2023-09-26 15:15:31 +02:00
Basilisk-Dev 4e1d7760d5 Issue #2058 - add patches from dbsoft to fix Mac and FreeBSD builds 2023-09-25 18:22:49 -04:00
Moonchild 1b2961f93f Merge pull request 'Replace libav's FFT functions with the ones from FFmpeg and remove now unused libav source files.' (#2312) from trav90/UXP-contrib:media-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2312
2023-09-25 16:39:24 +00:00
Moonchild 8775eedca5 Merge pull request 'Implement WebAssembly sign extension opcodes.' (#2315) from dbsoft/UXP:wasm-sign2313 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2315
2023-09-25 08:38:17 +00:00
Basilisk-Dev 8ffb592b72 Issue #2058 - restore FBSDID 2023-09-23 13:53:52 -04:00
trav90 522d8c66a5 Issue #2311 - Part 7 - Unset CONFIG_DCT and CONFIG_FFT
These functions aren't be needed at the moment and disabling them should fix builing on Windows.
2023-09-22 15:34:15 -05:00
Basilisk-Dev 7df5060161 Issue #2058 - fix OS defines for Windows builds 2023-09-22 16:17:40 -04:00
Basilisk-Dev 73a150b1c1 Issue #2058 - fix typo 2023-09-22 14:38:38 -04:00
Basilisk-Dev 89f280a78e Issue #2058 - fix issues with sctp_bsd_addr.c memory allocation causing breakage 2023-09-22 14:36:28 -04:00
Brian Smith 6aeae2ba74 Issue #2313 - Implement WebAssembly sign extension opcodes.
https://bugzilla.mozilla.org/show_bug.cgi?id=1389461
2023-09-22 13:23:36 -05:00
Moonchild 5fd783135d Issue #2307 - Follow-up: remove some missed SIMD scalar types. 2023-09-22 12:36:34 +02:00
Moonchild 1b2be9536f Clobber and goanna version bump. 2023-09-22 10:00:52 +02:00
Moonchild 2ad1f8f08d Merge branch 'simdjs-removal' 2023-09-21 10:26:10 +02:00
trav90 85734b9adf Issue #2311 - Part 6 - Remove now unused libav source files 2023-09-20 17:17:43 -05:00
trav90 2b46202164 IIssue #2311 - Part 5 - Only load function pointer in FFTBlock once 2023-09-20 17:16:35 -05:00
trav90 18ec63e459 Issue #2311 - Part 4 - Use FFTBlock from ffvpx instead of libav 2023-09-20 17:16:01 -05:00
trav90 004a3d003b Issue #2311 - Part 3 - Add accessor for ffvpx real DFT functions 2023-09-20 17:15:46 -05:00
trav90 9c72ce666b Issue #2311 - Part 2 - Link ffmpeg real DFT functions 2023-09-20 17:15:23 -05:00
trav90 47f213c878 Issue #2311 - Part 1 - Add ffmpeg's own floating point real FFT functions to ffvpx
Instead of using Libav's.
2023-09-20 17:14:31 -05:00
Moonchild d2eb2ce9f4 Merge branch 'master' into simdjs-removal 2023-09-20 11:56:31 +02:00
Moonchild dba1e36601 Merge pull request 'Collection of BigInt related fixes from working on Proton Mail issue' (#2310) from dbsoft/UXP:bigint-incdec into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2310
2023-09-20 00:40:04 +00:00
Moonchild bb39e1e38f Issue #2307 - Part 3b: Fix build bustage. 2023-09-19 16:53:12 +02:00
Moonchild 7003ea7dc4 Issue #2307 - Part 3: Remove SIMD.js support
This gets rid of the SIMD-specific scalar types in JS.
This considerably deviates from Mozilla's work because of our divergent
path.
2023-09-18 16:57:09 +02:00
Brian Smith dca8417ba7 Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Doubles in Ion. 2023-09-18 01:10:07 -05:00
Brian Smith 99184b1764 Issue #2308 & #1240 Follow-up - Replace JSOP_POS in ++/-- with JSOP_TONUMERIC.
https://bugzilla.mozilla.org/show_bug.cgi?id=1519135
2023-09-17 12:39:03 -05:00
Brian Smith 8f26f1a873 Issue #2308 & #1240 Follow-up - Fill in missing JSOP_INC/DEC cases for Ion on Intel32/64. 2023-09-17 06:21:49 -05:00
Brian Smith 53ce814858 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-17 04:23:57 -05:00
Brian Smith 33d4be58a5 Issue #2308 & #1240 Follow-up - Introduce new increment and decrement operations.
https://bugzilla.mozilla.org/show_bug.cgi?id=1508521
2023-09-16 05:38:42 -05:00
Moonchild 8635073418 Issue #2307 - Part 2b: Remove superfluous dev comment 2023-09-13 17:09:54 +02:00
Moonchild f122b231e5 Issue #2309 - Cherry-pick upstream libwebp fix.
Backport of: https://chromium.googlesource.com/webm/libwebp.git/+/2af26267cdfcb63a88e5c74a85927a12d6ca1d76

Resolves #2309
2023-09-13 10:20:51 +02:00
Moonchild 1a7f79ef9a Issue #2307 - Part 2: Move SIMD code generation to masm methods 2023-09-12 23:28:49 +02:00
Moonchild 281497201e Issue #2307 - Part 1: Extend masm with the pmovmskb SSE2 instruction. 2023-09-12 23:26:44 +02:00
Brian Smith dce6745dec Issue #2308 - Fix JSON BigInt regressions.
https://bugzilla.mozilla.org/show_bug.cgi?id=1522433
2023-09-11 04:01:25 -05:00
Moonchild a9bb437550 Merge pull request 'Make Gecko Media Plugins optional when not building EME or WebRTC' (#2301) from mrnhmath/UXP:optgmp3 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2301
2023-09-09 19:09:32 +00:00
Brian Smith 01ee4539cb Issue #2282 - Performance observer safety checks.
Both fixes from later revisions, without the Dispatch API changes.
2023-09-07 15:31:26 -05:00
Brian Smith 47fbe9552a Issue #2026 Follow-up: Fill in missing BigInt64 cases in js::IsTypedArrayConstructor().
Hopefully fixes RSA errors on ProtonMail.
2023-09-06 11:18:05 -05:00
Moonchild ee97a5dad4 [DOM] Follow-up: fix refcounting in FilePickerParent. 2023-09-01 09:54:03 +02:00
Matheus MarinhoandMoonchild c94c303447 Make Gecko Media Plugins optional when not building EME or WebRTC
Co-authored-by: Moonchild <moonchild@palemoon.org>
2023-08-31 17:04:44 -03:00
Basilisk-Dev a15cbf9256 Issue #2058 - apply additional patches from dbsoft for OS defines 2023-08-31 08:44:34 -04:00
Moonchild 7a4b850150 [gfx] Check if we have a valid texture before trying to delete it. 2023-08-31 10:02:50 +02:00
Moonchild 7de2732e7f [DOM] Make IORunnable::mFilePickerParent into a RefPtr. 2023-08-30 19:30:17 +02:00
Moonchild f20e3f4dd1 [network] Hold a strong ref to mChannel in OpenConn 2023-08-30 18:59:32 +02:00
Moonchild ca691c8d2d [DOM] Deny web notifications if principal can't resolve. 2023-08-30 17:46:49 +02:00
Moonchild 226f97e2f4 [network] Add locking around access to WebSocketChannel::mPMCECompressor 2023-08-30 16:38:42 +02:00
Moonchild 7fdc866b5a [XPCOM] Add xll files to the executables list. 2023-08-30 12:48:43 +02:00
Moonchild e112df8849 Merge pull request 'Implement ergonomic brand check' (#2300) from martok/UXP-contrib:mr/ergo-brand-check into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2300
2023-08-30 09:36:31 +00:00
Moonchild 45ec6b3a86 Issue #2293 - Add preferences to disable CSS animation/transition props.
This resolves #2293
2023-08-30 10:52:52 +02:00
Martok 8b9d69f912 Issue #2298 - Support '#x in obj' ergonomic brand check syntax 2023-08-30 09:38:14 +02:00
Martok 92ecaaeaa9 Issue #2298 - Carry private-ness of names through ParseNodeHandler 2023-08-30 09:38:13 +02:00
Basilisk-Dev ebf4f559e0 Issue #2058 - Apply patches from dbsoft to fix Mac and FreeBSD builds 2023-08-28 12:54:45 -04:00
Basilisk-Dev d9eb5d3e2b Issue #2058 - Fix build issues in DataChannel.cpp after sctp upgrade 2023-08-26 23:09:27 -04:00
Basilisk-Dev 9e85eb2816 Issue #2058 - Cleanup obsolete code from netwerk/sctp
Port of commit 84fa3f9f72
2023-08-26 22:19:37 -04:00
Basilisk-Dev 32ef10e763 Issue #2058 - Initial update of usrsctp library 2023-08-26 21:58:02 -04:00
Moonchild ac24db13ef Merge pull request 'Bug 1274518 - Add IPDL preprocessing support' (#2296) from mrnhmath/UXP:ipdlprep into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2296
2023-08-26 07:07:10 +00:00
Matheus MarinhoandKai-Zhen Li 8ac0957072 Bug 1274518 - Add IPDL preprocessing support
Co-authored-by: Kai-Zhen Li <seinlin.maung@gmail.com>
2023-08-25 17:18:15 -03:00
Moonchild 7178ca44ef Merge pull request 'Add --enable-irc and --enable-inspector to old.configure' (#2292) from mrnhmath/UXP:extflags into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2292
2023-08-19 05:05:16 +00:00
Matheus Marinho 178a43839d Add --enable-irc and --enable-inspector to old.configure 2023-08-18 23:23:51 -03:00
Moonchild da947c5045 Merge pull request 'Hunspell must be built into libxul on SunOS.' (#2291) from athenian200/UXP:sunos_hunspell_fix into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2291
2023-08-18 21:35:17 +00:00
athenian200 6d65f1d192 Issue #2290 - Hunspell must be built into libxul on SunOS. 2023-08-18 10:29:49 -05:00
Moonchild 4ddaf0f490 Merge pull request 'Implement Address Sanitizer for MSVC, Leak, Undefined Behavior and other debug fixes.' (#2288) from dbsoft/UXP:sanitize into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2288
2023-08-16 07:08:19 +00:00
Brian Smith ff81f4969c Issue #2266 - Part 2 - Add Leak and Undefined Behavior Sanitizer support.
Also fix building on FreeBSD and Linux, from the previous commit.
2023-08-14 23:40:46 -05:00
Brian Smith 369ba2e7d6 Issue #2266 - Part 1 - Allow MSVC and potentially GCC to use Address Sanitizer on Windows.
Check for WINNT instead of CLANG-CL, except for the Blacklist that isn't supported by MSVC.
Neither CLANG-CL nor MSVC require -fsanitize=address on the link phase.
2023-08-14 19:56:06 -05:00
Brian Smith a0fb8c06de Issue #2255 - Disable untested code path in Stopwatch.(h|cpp).
https://bugzilla.mozilla.org/show_bug.cgi?id=1325299
Multiprocessor support in Windows returned bogus times causing debug asserts.
This may or may not be related to the issue but found it trying to debug it.
2023-08-14 13:08:41 -05:00
Brian Smith d16b014115 No Issue - Fix building WebRTC/Basilisk with --enable-debug
A bogus MOZ_ASSERT was added at some point, this should make it work.
2023-08-14 13:06:15 -05:00
Moonchild 3bb0c18a59 Merge branch '2284-flexpercentage-work' 2023-08-14 10:34:09 +02:00
Moonchild 53b548e31a Issue #2284 - Adjust some in-content CSS to account for flex definite-sizing change.
As of this change, flex items in a vertical flex container will sometimes
be considered to have "indefinite" sizes, i.e. percent sizes in them will
no longer resolve.
To work around this, they need to provide a definite flex-basis (e.g. as
part of the "flex" shorthand property) if we want percent sizes to
resolve (instead of being treated as "auto") inside of them.
2023-08-13 22:09:27 +02:00
Moonchild 2a6187709b Issue #2284 - Update reftest for behaviour change.
I've verified this against Edge-latest.
2023-08-13 22:06:13 +02:00
Moonchild cd98dce5fa Issue #2284 - Add exception for flex/grid items resolving percentages against parent.
This folds in BZ bugs 1578586 and 1092007 part 2.
2023-08-13 22:04:54 +02:00
Moonchild 9bfeaab2e6 Merge pull request 'Fix RegEx GC crash' (#2287) from martok/UXP-contrib:mr/2172-regex-gc into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2287
2023-08-10 06:05:46 +00:00
Martok 3b32a66cb6 Issue #2172 - add null zone sanity checks 2023-08-09 22:41:30 +02:00
Martok edfb29e1a2 Issue #2172 - ensure pointers in RegExpShared are updated after GC compacting 2023-08-08 19:36:21 +02:00
Martok 41f38134f1 Issue #2172 - add missing RegExpShared TraceKind declaration 2023-08-08 19:36:13 +02:00
Moonchild 20ac6059ce Merge pull request 'Several low risk fixes and improvements' (#2286) from dbsoft/UXP:fixes into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2286
2023-08-07 07:36:53 +00:00
Brian Smith d9aa76f5c2 No Issue - Fix building with --enable-js-lto
Needed to include jscntxt.h due to de-unified building.
2023-08-06 23:22:09 -05:00
Brian Smith 9dda91e5cb Issue #2285 - Ensure we don't try to treat non-DOM-Node event targets as such,
https://bugzilla.mozilla.org/show_bug.cgi?id=1440809
Fix crash on https://beeper.notion.site
2023-08-06 22:35:51 -05:00
Brian Smith 39d52370dc Issue #2026 - Follow-up: Support Big(U)Int64Array in crypto.getRandomValues.
https://bugzilla.mozilla.org/show_bug.cgi?id=1718932
2023-08-06 22:28:22 -05:00
Moonchild 8b1222c5f8 Merge pull request 'Properly implement Performance Timeline Level 2 w3c spec.' (#2283) from dbsoft/UXP:perf-l2-2282 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2283
2023-08-06 14:21:18 +00:00
Brian Smith e748187360 Issue #2282 - - Properly implement Performance Timeline Level 2 w3c spec.
https://bugzilla.mozilla.org/show_bug.cgi?id=1539006
Do not throw from PerformanceObserver.observe when none of the entryTypes are known.
https://bugzilla.mozilla.org/show_bug.cgi?id=1403027
Implement PerformanceObserver::takeRecords().
https://bugzilla.mozilla.org/show_bug.cgi?id=1436692
"server" is not a valid PerformanceEntry type.
https://bugzilla.mozilla.org/show_bug.cgi?id=1463065
Fix a null ptr crash in PerformanceObserver::Observe.
https://bugzilla.mozilla.org/show_bug.cgi?id=1631346
2023-08-02 02:41:40 -05:00
Moonchild 13cca807e6 Merge pull request 'Implement Big(U)Int64Array and fill in some missing BigInt pieces.' (#2280) from dbsoft/UXP:bigint64-2026 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2280
2023-07-29 08:58:35 +00:00
Brian Smith 7f8ea9ae2f Issue #1240 - Follow-up: Add missing JSVAL_TYPE_BIGINT cases in JitFrames.cpp.
As pointed out by roytam1 during testing with Discord.
2023-07-28 19:57:55 -05:00
Brian Smith 1851f19271 Issue #1240 - Follow-up: Fix incorrect values in Number() constructor.
https://bugzilla.mozilla.org/show_bug.cgi?id=1466893
Our code base was using the return value to create the Number object.
However with the BigInt changes, it is no longer stored in rval, use args[0].
2023-07-28 19:55:53 -05:00
Brian Smith 3dc659b86d Issue #2026 - Part 4 - Fill in missing dense elements case and fix a comment.
https://bugzilla.mozilla.org/show_bug.cgi?id=1456569
Skipped this during the initial implementation, not sure when or if  this code path
is used, but I figure it should be there just in case.
Also fix debug builgs by removing an no longer valid MOZ_ASSERT.
2023-07-28 19:54:06 -05:00
Brian Smith 83daf83360 Merge branch 'bigint-devtools-test' of https://repo.palemoon.org/martok/UXP-contrib into bigint64-2026 2023-07-28 19:47:20 -05:00
Martok 5a7348a8d1 Issue #2026 - Part 3c - Add BigInt Devtools support. (new frontend) 2023-07-29 01:39:08 +02:00
Martok fa32034f30 Issue #2026 - Part 3b - Add BigInt Devtools support. (legacy frontend) 2023-07-28 23:35:59 +02:00
Brian Smith 56a82b8ed4 Issue #2026 - Part 3a - Add support for BigInt in devtools. (Server side)
https://bugzilla.mozilla.org/show_bug.cgi?id=1527867
2023-07-25 02:27:03 -05:00
Brian Smith 7a5b68c98e Issue #2026 - Part 2b - Format BigInts representable as int64_t without first converting them to strings.
https://bugzilla.mozilla.org/show_bug.cgi?id=1543677
2023-07-25 01:59:56 -05:00
Brian Smith 1edc4e41d3 Issue #2026 - Part 2a - Support BigInt in NumberFormat and toLocaleString.
https://bugzilla.mozilla.org/show_bug.cgi?id=1543677
2023-07-25 01:41:42 -05:00
Brian Smith edacbbd965 Issue #2026 - Part 1 - Implement BigInt64 and BigUint64Array.
https://bugzilla.mozilla.org/show_bug.cgi?id=1456569
2023-07-24 23:30:27 -05:00
Moonchild a3096d09f9 Update UXP/Goanna version now BigInt has landed. 2023-07-25 01:02:59 +02:00
Moonchild b4ddadd8b9 Merge pull request 'Add BigInt primitive type.' (#2276) from dbsoft/UXP:bigint-merged into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2276
2023-07-23 23:38:53 +00:00
Brian Smith f359533b82 Issue #1240 - Part 11 - Fix several issue reported on review.
Skip over block delimiters when parsing BigInt literals.
Update BigInt hashing to account for the possibility of moving GC.
https://bugzilla.mozilla.org/show_bug.cgi?id=1531018
Make HashableValue comparison of BigInts infallible.
https://bugzilla.mozilla.org/show_bug.cgi?id=1530406
Fix BigInt constructor API CallArgs usage.
https://bugzilla.mozilla.org/show_bug.cgi?id=1526279
2023-07-23 15:36:19 -05:00
Brian Smith 94609cf97b Issue #1240 - Part 10 - Implement minimal Ion support for BigInt.
https://bugzilla.mozilla.org/show_bug.cgi?id=1507484
Implement IC support for BigInt.
https://bugzilla.mozilla.org/show_bug.cgi?id=1522431
2023-07-21 20:25:52 -05:00
Brian Smith 6257513c7e Issue #1240 - Part 9 - Fix incorrectly parsing decimal BigInt 0n.
The decimal parser strips leading 0s, so prevent tokenbuf being empty.
2023-07-21 14:20:11 -05:00
Brian Smith 0587c85114 Issue #1240 - Part 8 - Fix incorrect asserts with debug enabled.
Fix BigInt errors in remainder operations
https://bugzilla.mozilla.org/show_bug.cgi?id=1524136
Also fix 2 debug asserts in fallthroughs due to missing BigInt cases.
2023-07-21 04:10:47 -05:00
Brian Smith f4c134225c Issue #1240 - Part 7 - Handle BigInt values in XPCVariant code.
https://bugzilla.mozilla.org/show_bug.cgi?id=1603055
2023-07-20 17:25:46 -05:00
Brian Smith 24e4a09270 Issue #1240 - Part 5g - Implement BigInt comparison operators.
Implement BigInt support for equality operators.
https://bugzilla.mozilla.org/show_bug.cgi?id=1486173 Part 3.
Implement BigInt support for relational comparison operators.
https://bugzilla.mozilla.org/show_bug.cgi?id=1492669
2023-07-19 17:10:33 -05:00
Brian Smith f193a4a7dc Issue #1240 - Part 6c - Implement asIntN and asUintN methods for BigInt values.
https://bugzilla.mozilla.org/show_bug.cgi?id=1501104
2023-07-19 16:39:34 -05:00
Brian Smith 2b198142f0 Issue #1240 - Part 6b - Use ToIndex when constructing TypedArray with length argument.
https://bugzilla.mozilla.org/show_bug.cgi?id=1317383 Part 2.
2023-07-19 16:36:58 -05:00
Brian Smith 700bead8ba Issue #1240 - Part 6a - Implement BigInt.prototype.toLocaleString.
https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 5.
2023-07-19 16:00:07 -05:00
Brian Smith f734e4f724 Issue #1240 - Part 5f - Add DataView methods for BigInt access.
https://bugzilla.mozilla.org/show_bug.cgi?id=1528582
2023-07-19 15:27:59 -05:00
Brian Smith 32acbcb96b Issue #1240 - Part 5e - BigInt bitwise operators.
https://bugzilla.mozilla.org/show_bug.cgi?id=1490387
2023-07-19 14:32:00 -05:00
Brian Smith 0da765e156 Issue #1240 - Part 5d - Use the radix when parsing BigInts.
Fixes Hex, Octal and Binary BigInt literal parsing.
Previously it was only parsing in decimal.
2023-07-19 03:02:35 -05:00
Brian Smith a816a6b6de Issue #1240 - Part 5c -Implement ToInt32OrBigInt operation.
https://bugzilla.mozilla.org/show_bug.cgi?id=1490387
2023-07-19 03:00:43 -05:00
Brian Smith 37e02a4bd4 Issue #1240 - Part 5b - BigInt support for basic arithmetic operations.
https://bugzilla.mozilla.org/show_bug.cgi?id=1471134 Parts 3-5.
2023-07-19 02:19:32 -05:00
Brian Smith 93a10f9e2f Issue #1240 - Part 5a - BigInt to Number conversion.
https://bugzilla.mozilla.org/show_bug.cgi?id=1466893
2023-07-19 02:17:04 -05:00
Brian Smith 94240c9002 Merge branch 'master' into bigint-merged 2023-07-18 20:25:54 -05:00
Brian Smith 069fa50258 Issue #1240 - Part 4 - Implement parser support for BigInt literals.
https://bugzilla.mozilla.org/show_bug.cgi?id=1505849
Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1456568
Un-result-ified the BigInt XDR code, so we can enable it.
https://bugzilla.mozilla.org/show_bug.cgi?id=1419094
Uninitialised memory read with BigInt right-shift
https://bugzilla.mozilla.org/show_bug.cgi?id=1679003
2023-07-18 20:23:02 -05:00
Moonchild 7175868124 Merge pull request 'Fix intermittent crash on MacOS 14 Sonoma Beta 3.' (#2274) from dbsoft/UXP:sonomafix into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2274
2023-07-17 18:38:50 +00:00
Brian Smith 8c25550baf No Issue - Fix intermitted crash on MacOS 14 Sonoma Beta 3.
Not sure why this is happening but mIOSurface is nullptr.
If we just skip binding, it will be created on the next call to BeginUpdate.
2023-07-17 02:01:35 -05:00
Moonchild cd0c08484d Merge pull request 'Fix cloning of self-hosted functions' (#2273) from martok/UXP-contrib:mr/canon-names into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2273
2023-07-14 16:31:37 +00:00
Martok 3c37b8857d Issue #2271 - Use declared names of self-hosted functions for cloning
Ensure that cloning a self-hosted function always has access to the declared
name from the source and that it doesn't get lost on successive clones.
This is done by storing the declared name in an extended slot on rename, and
cloning it with the function.

Based-on: m-c 1546232
2023-07-13 13:57:43 +02:00
Martok 1eccb6f42a Issue #2271 - Separate cloning of native and interpreted functions
Separate code paths make it easier to follow and specialize than a single
one-size-fits-all function.

Based-on: m-c 1405766, 1411954
2023-07-13 13:57:42 +02:00
Brian Smith cb1aa7f456 Issue #1240 - Part 3c - Fast-forward to the V8 version of BigIntType.
Disabling some sections temporarily since the dependencies are not there yet.
Based on the following: https://bugzilla.mozilla.org/show_bug.cgi?id=1502797
https://bugzilla.mozilla.org/show_bug.cgi?id=1471134
https://bugzilla.mozilla.org/show_bug.cgi?id=1441098 Part 3 & 4
Add structured clone support for BigInt and Enable BigInt wrapping from DOM bindings.
https://bugzilla.mozilla.org/show_bug.cgi?id=1522738
2023-07-13 04:07:05 -05:00
Brian Smith 42cf583a57 Issue #1240 - Part 3b - Implement WrappingOperations.h for wraparound math operations & conversions.
https://bugzilla.mozilla.org/show_bug.cgi?id=1441657
Implement mozilla::WrappingMultiply.
Prerequisite for our V8 fast forward.
2023-07-13 03:27:12 -05:00
Brian Smith 3aeea5f9d0 Issue #1240 - Part 3a - Adjust mozilla::FloatingPoint<T>'s definition.
So only the barest details are specified for floating-point encodings,
with every other number, bit mask, &c. mathematically derived.
Also add a bunch of documentation comments.
https://bugzilla.mozilla.org/show_bug.cgi?id=1508725
Prerequisite for our V8 fast forward.
2023-07-13 03:02:29 -05:00
Brian Smith b2ae4d3885 Issue #1240 - Part 2 - Define the BigIntObject class for BigInt wrapper objects.
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 3.
In our Part 3 we will fast forward to the V8 implementation skipping GMP.
2023-07-13 02:40:25 -05:00
Brian Smith eb7a856c76 Issue #1240 - Part 1 - Define a new BigInt primitive type.
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 1.0.
However leaving out the --enable-bigint changes.
2023-07-13 01:59:24 -05:00
Moonchild 8e0e86face Merge pull request 'Further enhance Maybe<> and use it in the Performance API' (#2272) from dbsoft/UXP:maybe-2255-deux into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2272
2023-07-13 05:54:23 +00:00
Brian Smith 0980b1e936 Issue #2255 - Fix build bustage on Linux.
Need #include <utility> to ensure std::forward is available.
2023-07-12 17:52:59 -05:00
Brian Smith f0b08a209d Issue #2255 - Use Maybe<> in the Performance API. 2023-07-12 14:25:06 -05:00
Brian Smith 3284e449a7 Issue #2255 - Add support for Maybe<T&>
https://bugzilla.mozilla.org/show_bug.cgi?id=1620568
Make Maybe<T>::emplace() work when T is const
https://bugzilla.mozilla.org/show_bug.cgi?id=1335780
2023-07-12 14:24:28 -05:00
Moonchild 377625e539 Merge pull request 'Enhance Mac Packaging via mozconfig options and fix ARM Mac debug builds.' (#2269) from dbsoft/UXP:macbundle-2268 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2269
2023-07-11 15:53:23 +00:00
Brian Smith eae076209f Issue #2268 - Fix Mac packaging by making the individual parts configurable.
Add --with-macbundle-entitlement= to specify alternate entitlements or "none"
Add --with-macbundle-type=hybrid to use the old DMG format.
2023-07-07 17:46:55 -05:00
Brian Smith 7a2f114334 No Issue - Fix debug builds on ARM Mac.
mach_override used by the IO Poisoner used in debug mode is not support on ARM.
https://bugzilla.mozilla.org/show_bug.cgi?id=1658385
2023-07-07 17:38:09 -05:00
Moonchild af5dbfc120 [XPCOM] Win: Update executable extension list 2023-07-05 22:08:40 +02:00
Moonchild 3d87998c59 [DOM] Filter out symlinks for webkitdirectory.
This is effectively a back-out of the following patches from Bug 1274959
except we add comments and test coverage:

- Part 1 which made the DirectoryListingTask include symlinks in the
  results as exposed by Directory.getFilesAndDirectories.
- Part 3 which made GetFilesHelper include symlinks in the results.

Test coverage for getFilesAndDirectories is provided by
dom/filesystem/tests/test_basic.html by way of changes to its included
file dom/filesystem/tests/filesystem_commons.js and changes to the
createTreeFile helper in dom/filesystem/tests/script_fileList.js.
Test coverage for GetFilesHelper is provided by
dom/filesystem/tests/test_webkitdirectory.html and changes to the
createTestFile helper in dom/filesystem/tests/script_fileList.js.

Commenting out either of the `isLink` test in the relevant C++ code will
cause the given tests to fail on non-windows platforms.
2023-07-05 21:55:00 +02:00
Moonchild 6f46768035 [network] Prepare for requiring Authorization in CORS ACAH preflight
The Authorization header with a JSON Web Token (JWT) can be sent via
XMLHttpRequest without explicit authorization via Access-Control headers.
According to the spec, this must always explicitly be mentioned in ACAH
request headers and isn't allowed to be wildcarded. However, nobody
currently obeys this rule and many websites are misconfigured because
Chromium and Firefox always allowed it.

This patch adds the more stricter code but keeps it behind an #ifdef 0
to be released later on if and when there is enough consensus on the web
to obey this spec. This patch explicitly avoids the added complexity
Mozilla added to educate web devs since our role in that respect is not
significant. it's not preffed and it won't throw an explicit deprecation
warning.

See Mozilla bugs 1687364 and 1841019.
2023-07-05 19:27:03 +02:00
Moonchild b98ca4be18 Merge pull request 'Simplify and enhance Maybe and Some().' (#2267) from dbsoft/UXP:maybesome-update into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2267
2023-07-04 21:17:52 +00:00
Brian Smith d9c5b3bde5 Issue #2255 & #1240 - Simplify and enhance Maybe and Some().
https://bugzilla.mozilla.org/show_bug.cgi?id=1325351
This is a prerequisite for our BigInt V8 fast forward and potential #2255 fix.
2023-07-04 13:58:36 -05:00
Moonchild b3f6b7a224 [multiple] Update Intl tests. 2023-07-02 11:36:47 +02:00
Moonchild 05d58b4aa1 Issue #1656 - Follow-up: Re-nuke the vim lines introduced in #2265 2023-07-02 10:28:09 +02:00
Moonchild 90aaa1fdfb Merge pull request 'Intl API Updates' (#2265) from martok/UXP-contrib:intl-upgrades into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2265
2023-07-02 08:18:10 +00:00
Moonchild e40bea1e04 Merge pull request 'Improve incremental GC sweeping' (#2264) from gcsweep-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2264
2023-07-02 08:16:54 +00:00
Martok 569f23eb6a Issue #2046 - Implement Intl.DateTimeFormat's date-/timeStyle and hourCycle options
- remove mozExtensions flag and expose to client code

Based-on: m-c 1557718
2023-06-30 00:01:36 +02:00
Martok af47a256b5 Issue #1819 - Further align Intl.Locale to spec
- Reference updates (UTS 35)
- variant subtag and transform extension canonicalisation
2023-06-30 00:01:35 +02:00
Martok e96f965422 Issue #2259 - Performance improvements for LanguageTag parsing
- parsing: dont normalise things that don't need to be normalised anymore:
  extension, private-use, variant, language, script, and region subtags
- Add missing() and present() methods to LanguageSubtag
- Change mozilla::Range to mozilla::Span for slightly better code

Based-on: m-c 1592588
2023-06-30 00:01:35 +02:00
Martok 7c3aa6a8b6 Issue #2259 - Performance improvements in Locale
- Move BestAvailableLocale function to C++
- Move default locale computation to C++
- Add available-locales set to SharedIntlData
- Remove separate sets for DateFormat and NumberFormat available locales.

Based-on: m-c 1373089
2023-06-30 00:01:35 +02:00
Martok 1a9d6d6372 Issue #1819 - Implement Intl.Locale proposal
This is according to spec for the mozilla71 cycle, a follow-up will further adjust to spec.

- Add Intl.Locale as native C++
- Port Unicode BCP 47 locale identifier parser to C++
- Port language tag parser to C++
- adjust make_intl_data to generate the data

Based-on: m-c 1433303, 1570370
2023-06-30 00:01:35 +02:00
Martok 2f940bdc9d Issue #2259 - process Unicode langtags and locale identifiers according to BCP 47
Major spec change: text references are to BCP47 (not the implementing RFCs) and
the single source of truth is now Unicode CLDR.

- Switch from IANA to CLDR for make_unicode
- Update grandfathered tag handling directly in the parser
- Don't support extlang, irregular, privateuse or 4-letter subtags
- Adjust comments to refer to Unicode BCP 47 locale identifiers, remove RFC 5646
- Canonicalize/order langtags correctly
- Tokenize BCP47 in reusable class

Based-on: m-c 1407674(partial), 1451082, 1530320, 1522070, 1531091
2023-06-30 00:01:34 +02:00
Martok 6808e659ad Issue #2195 - Add support for hourCycle to Intl.DateTimeFormat
Based-on: m-c 1386146, 1430809
2023-06-30 00:01:34 +02:00
Martok 371ae1639a Issue #2259 - Improve ResolveLocale performance when initializing the default Intl objects
Based-on: m-c 1365650
2023-06-30 00:01:27 +02:00
Martok 33ec3d04f2 Issue #2259 - Support Unicode extensions with multiple value subtags in BCP47 language tags
Based-on: m-c 1321789
2023-06-30 00:01:18 +02:00
Martok f168e0afe9 Issue #2259 - Reimplement String.prototype.toLocale{Lower,Upper}Case per ECMAScript Intl specification
- Update make_unicode to output SpecialCasing
- Handle special casing
- Use realloc instead of malloc when resizing a newly created string buffer

Based-on: m-c 1318403, 1431957
2023-06-29 23:05:33 +02:00
Martok 9eb285a9fb Issue #2259 - Implement caseFirst option in Intl.Collator
Based-on: m-c 866473
2023-06-29 23:03:12 +02:00
Martok bbe3b8e12f Issue #2046 - Introduce mozIntl.DateTimeFormat with mozExtensions
Based-on: m-c 1329904
2023-06-29 23:02:37 +02:00
Martok 73c366766a Issue #2259 - Update Intl.* Object-ness to ECMA-402, 4th edition
- turn each Intl object into a NativeObject subclass
- create them as PlainObject
- ensure correct type is passed in self-hosted code
- implement legacy constructor semantics for DateTime&NumberFormat
- store internals on object slot instead of JS WeakMap

Based-on: m-c 1328386, 1332604
2023-06-29 23:02:11 +02:00
Martok 388733cd1d Issue #2259 - Introduce helper for self-hosted hasOwnProperty calls in intl 2023-06-29 22:27:29 +02:00
Martok 35f1a49cf2 Issue #2259 - Adjust self-hosted Array.prototype.sort to ES2018
The comparator to ArraySort must be optional also in self-hosted code, where calling the
implementation directly is generally faster than calling between JS and C++ multiple times.
2023-06-29 22:27:29 +02:00
Martok c2019fa28c Issue #2259 - Add JS::StackGCVector and JS::RootedVector
Based-on: m-c 1521732/{1,3}, 1527881
2023-06-29 22:27:29 +02:00
Martok bed754c21c Issue #2259 - Add mozilla::Result<V, E> and JS::Result<> for fallible return values
Based-on: m-c 1283562, 1277368/1, 1324828
2023-06-29 22:27:28 +02:00
Martok 85efbc0c1e Issue #2259 - Add mozilla::Vector -> mozilla::Span implicit conversion
Based-on: part of m-c 1578339
2023-06-29 22:27:18 +02:00
Martok 93bd7fc61e Issue #2259 - Add missing IsAscii* helper functions in mozilla/TextUtils.h 2023-06-29 22:18:07 +02:00
Martok 1ec5d757e6 Issue #1969 Follow-Up: Error reporting arguments in RelativeTimeFormat/DateTimeFormat 2023-06-29 22:18:07 +02:00
Moonchild 1a3f3da99d Fix debug builds 2023-06-28 19:54:07 +02:00
Moonchild b238bb079f Avoid TLS lookups when checking if zones need to be marked for GC.
This converts the fromPointer() calls to an object cast to (hopefully)
avoid the GC crashes. Logic is reversed from MustSkipMarking to
ShouldMark with appropriate renames.
2023-06-27 18:39:24 +02:00
Moonchild c3d4cec8ad Simplify incremental GC sweeping
Splitting several parts of `SweepPhase` into constituent parts to
separate out sweeping code from code that handles yielding to the
mutator and resuming.
2023-06-27 03:04:39 +02:00
Moonchild a666c05d68 Merge pull request 'Build UXP with C++14 by default' (#2263) from martok/UXP-contrib:build-cpp14 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2263
2023-06-26 09:36:27 +00:00
Martok 14836b0c17 Issue #2262 - Build with C++14 by default
Including infrastructure changes to ensure correct opts for future changes.

Based-on: m-c 1325632, 1418047, 1418573
2023-06-21 22:18:07 +02:00
Moonchild 30829b7a07 Merge pull request 'Remove support for "experiment" type extensions' (#2261) from FranklinDM/UXP-contrib:work_telemetry-remove-experiment-extensions into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2261
2023-06-20 09:31:08 +00:00
Moonchild 2fe6bb5c36 Merge pull request 'Follow-up: Print leaking class name and remove crash reporter dependency' (#2260) from FranklinDM/UXP-contrib:work_js-1691-followup-1 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2260
2023-06-20 09:30:39 +00:00
FranklinDM 773cbb1a3e Issue #21 - Follow-up: Remove experiment category images 2023-06-19 21:59:39 +08:00
FranklinDM 5f6b2407e7 Issue #21 - Part 3: Remove experiments localization
This also removes bits from about:support that weren't removed in bf6bb142fc.
2023-06-19 21:55:23 +08:00
FranklinDM adfb8133d1 Issue #21 - Part 2: Remove experiment extension assets and styling 2023-06-19 21:55:22 +08:00
FranklinDM 559d2ed26f Issue #21 - Part 1: Remove experiments base code from the Add-ons Manager
The experiments manager was already removed in bf6bb142fc and this was imported dead code from Tycho AM.
2023-06-19 21:55:21 +08:00
Moonchild 2004256c89 No issue - Update SQLite lib to 3.42.0 2023-06-19 15:34:01 +02:00
FranklinDM 32751e3d8f Issue #1691 - Follow-up: Print leaking class name and remove crash reporter dependency 2023-06-19 15:15:47 +08:00
Moonchild c11311fd5b No issue - Set the default for incremental cycle collector to be off.
Negative performance impact if enabled.
2023-06-04 17:15:36 +02:00
Moonchild 4253a2a893 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-01 18:45:35 +02:00
Moonchild 6e35a8566e Issue #2256 - Implement Object.hasOwn(object, property)
This is a convenience access function to hasOwnProperty.

Trivial, self-hosted implementation providing the interface to the
already existing hasOwnProperty cpp function with additional toObject
for spec compliance.

Resolves #2256
2023-05-29 22:47:26 +02:00
Moonchild 281a8854d0 Merge pull request 'Fix crashes and assertions involving ::slotted() and ancestor matching' (#2253) from FranklinDM/UXP-contrib:work_css-slotted-followup into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2253
2023-05-23 13:32:31 +00:00
Moonchild 370e66ecce Merge pull request 'Prevent crash when attempting to load a script with execution disallowed.' (#2254) from dbsoft/UXP:noscript2252 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2254
2023-05-23 13:28:22 +00:00
Brian Smith beabbde706 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-05-21 07:55:37 -05:00
FranklinDM ac5101015f Issue #1592 - Follow-up: Ensure topmost scope marker is cleaned up 2023-05-21 19:01:42 +08:00
FranklinDM 0627dc7639 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-05-21 19:01:42 +08:00
FranklinDM c58f825821 Issue #2250 - Part 1: Return early if the element being tested for is likely an ancestor and does not have an assigned slot 2023-05-21 19:01:41 +08:00
Moonchild e4eb31879f Merge pull request 'Ensure jit_ioncheck{1|2|3}_deunified_sources in js/src/moz.build is defined.' (#2248) from jobbautista9/UXP:2221-followup into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2248
2023-05-17 11:09:09 +00:00
Job Bautista 709d0bde73 Issue #2221 - Follow-up: Simplify jit_ioncheck{1|2|3}_deunified_sources assignment. 2023-05-17 19:02:53 +08:00
Moonchild 2a730d59f9 Merge pull request 'Implement Array find from last.' (#2247) from jobbautista9/UXP:array-findlast into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2247
2023-05-17 10:52:33 +00:00
Job Bautista 5ee57767e0 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-05-17 18:13:48 +08:00
Job Bautista 61d8ec5478 Issue #2246 - Implement Array find from last.
Based on the implementation from Mozilla bug 1704385.
2023-05-17 17:21:08 +08:00
Moonchild 3f09edfde0 Merge pull request 'Implement geometry .from* static constructors' (#2242) from jobbautista9/UXP:2241-fromrect-nodouble into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2242
2023-05-14 22:05:31 +00:00
Moonchild b116ab7a1e Merge pull request 'Implement partial support for calc-in-color' (#2244) from FranklinDM/UXP-contrib:work_css-hack-calc-in-color into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2244
2023-05-14 22:03:43 +00:00
FranklinDM ddf3f39070 Issue #1765 - Part 3: Provided token type should be used in LookForTokenType
I didn't realize this immediately after moving the code into a method. Oops.
2023-05-14 18:31:21 +08:00
FranklinDM e56b7b826d Issue #1765 - Part 2: Implement calc() parsing inside rgb/a() and the non-hue component of hsl/a()
This also adds a new helper method for checking the type of tokens that will be parsed after the current token, which is useful for determining the unit of values inside calc() functions.

Partially based on https://github.com/roytam1/UXP/commit/8a0897d23f5b51526f8a2c6ef63cb26968e6b985
2023-05-13 19:22:42 +08:00
FranklinDM 19650c6f8a Issue #1765 - Part 1: Move ReduceNumberCalcOps struct up higher, rename IsCSSTokenCalcFunction to CSSParserImpl::IsCalcFunctionToken 2023-05-13 19:22:42 +08:00
Job Bautista d2a86d81f3 Issue #2241 - Part 7.2 Follow-up: Fix build bustage due to unified building in Basilisk.
Tag #80
2023-05-12 19:04:16 +08:00
Job Bautista ccb51f2f40 Issue #2241 - Part 8: Remove non-working layout.css.DOM*.enabled prefs.
A follow-up to fdfe7a8245.
2023-05-12 16:28:57 +08:00
Job Bautista ecf05312e6 Issue #2241 - Part 7.2: Implement .fromRect and .fromQuad.
Backported from Mozilla bug 1558101.
2023-05-12 16:26:06 +08:00
Job Bautista c7ca649bd1 Issue #2241 - Part 7.1: Implement .fromFloat{32/64}Array.
Backported from Mozilla bug 1558101.
2023-05-12 16:26:06 +08:00
Job Bautista b2889d844f Issue #2241 - Part 6: Implement DOMMatrix.fromMatrix.
Also fixes .multiply() to use DOMMatrixInit.

Backported from Mozilla bug 1560462.
2023-05-12 16:26:06 +08:00
Job Bautista fdfe7a8245 Issue #2241 - Part 4&5 Follow-up: Fix WebIDL errors
Remove [Pref] attribute from Geometry interfaces as they're now exposed to web
workers too via Part 5.

Remove nonexistent toJSON objects erroneously added in Part 4.1.
2023-05-12 16:26:06 +08:00
Job Bautista 709c34a448 Issue #2241 - Part 5: Expose Geometry interfaces to web workers.
Exposes DOMMatrix, DOMPoint, DOMQuad, and DOMRect to workers.

Backported from Mozilla bug 1420580.
2023-05-12 16:26:05 +08:00
Job Bautista 0adb8cc71f Issue #2241 - Part 4.3: Move devtools over to getBounds().
This leaves getAdjustedQuads alone because it lives in its own world and its
result gets sent over IPC. That leaves things in a bit of an intermediate state,
but that should be OK for now.

Backported from Mozilla bug 1186265.
2023-05-12 16:26:05 +08:00
Job Bautista 286e18e40c Issue #2241 - Part 4.2: Resurrect DOMQuad.bounds, but deprecated.
This also forces DOMQuad.toJSON() to only return the points.

Backported from Mozilla bug 1186265.
2023-05-12 16:26:05 +08:00
Job Bautista 4c2a1920b8 Issue #2241 - Part 4.1: Get DOMPoint, DOMQuad, DOMRect, DOMMatrix a bit closer to spec.
Backported from Mozilla bug 1186265's part 1.
2023-05-12 16:26:05 +08:00
Job Bautista 29bdffbb54 Issue #2241 - Part 3: Extend DOMMatrixReadOnly to allow instantiation with a Matrix4x4.
Backported from Mozilla bug 1355675.
2023-05-12 16:26:05 +08:00
Job Bautista ef31c426b1 Issue #2241 - Part 2: Add SameValueZero implementation to mfbt/FloatingPoint.h
Backported from Mozilla bug 1560658.

This is to prevent duplication of code while implementing DOMMatrix operations.
2023-05-12 16:26:04 +08:00
Job Bautista 30b5a4d830 Issue #2241 - Part 1: Move {js::,JS_}{{Strictly,Loosely}Equal,SameValue} into their own header and implementation files
Backported from Mozilla bug 1516742.

The .from* methods are going to depend on SameValueZero, which needs to be
visible to /dom. This patch provides the foundation for that.
2023-05-12 16:26:04 +08:00
3005 changed files with 534253 additions and 347446 deletions

No files matched your search

+1 -1
View File
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Touching ICU's build system requires a CLOBBER. (Issue #2165)
Switching to C++17 requires CLOBBER to pick up compiler conf. (Issue #2281)
+1 -1
View File
@@ -176,7 +176,7 @@ private:
uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent);
MOZ_MUST_USE bool CheckDocTree() const;
[[nodiscard]] bool CheckDocTree() const;
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
nsTArray<DocAccessibleParent*> mChildDocs;
+2 -2
View File
@@ -173,7 +173,7 @@ public: // construction, destruction
/**
* Find an accessible by the given child ID in cached documents.
*/
MOZ_MUST_USE already_AddRefed<IAccessible>
[[nodiscard]] already_AddRefed<IAccessible>
GetIAccessibleFor(const VARIANT& aVarChild, bool* aIsDefunct);
virtual void GetNativeInterface(void **aOutAccessible) override;
@@ -198,7 +198,7 @@ protected:
/**
* Find a remote accessible by the given child ID.
*/
MOZ_MUST_USE already_AddRefed<IAccessible>
[[nodiscard]] already_AddRefed<IAccessible>
GetRemoteIAccessibleFor(const VARIANT& aVarChild);
/**
+37 -3
View File
@@ -13,7 +13,7 @@ MOZ_ARG_ENABLE_BOOL(address-sanitizer,
MOZ_ASAN= )
if test -n "$MOZ_ASAN"; then
MOZ_LLVM_HACKS=1
if test -n "$CLANG_CL"; then
if test "$OS_ARCH" = "WINNT"; then
# Look for the ASan runtime binary
if test "$CPU_ARCH" = "x86_64"; then
MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-x86_64.dll
@@ -27,14 +27,14 @@ if test -n "$MOZ_ASAN"; then
fi
AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
# Suppressing errors in recompiled code.
if test "$OS_ARCH" = "WINNT"; then
if test -n "$CLANG_CL"; then
CFLAGS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/asan_blacklist_win.txt $CFLAGS"
CXXFLAGS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/asan_blacklist_win.txt $CXXFLAGS"
fi
fi
CFLAGS="-fsanitize=address $CFLAGS"
CXXFLAGS="-fsanitize=address $CXXFLAGS"
if test -z "$CLANG_CL"; then
if test "$OS_ARCH" != "WINNT"; then
LDFLAGS="-fsanitize=address $LDFLAGS"
fi
AC_DEFINE(MOZ_ASAN)
@@ -80,6 +80,40 @@ if test -n "$MOZ_TSAN"; then
fi
AC_SUBST(MOZ_TSAN)
dnl ========================================================
dnl = Use Leak Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(leak-sanitizer,
[ --enable-leak-sanitizer Enable Leak Sanitizer (default=no)],
MOZ_LSAN=1,
MOZ_LSAN= )
if test -n "$MOZ_LSAN"; then
MOZ_LLVM_HACKS=1
LDFLAGS="-fsanitize=leak $LDFLAGS"
AC_DEFINE(MOZ_LSAN)
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
fi
AC_SUBST(MOZ_LSAN)
dnl ========================================================
dnl = Use Undefined Behavior Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(undefined-sanitizer,
[ --enable-undefined-sanitizer Enable Undefined Behavior Sanitizer (default=no)],
MOZ_UBSAN=1,
MOZ_UBSAN= )
if test -n "$MOZ_UBSAN"; then
MOZ_LLVM_HACKS=1
CFLAGS="-fsanitize=undefined $CFLAGS"
CXXFLAGS="-fsanitize=undefined $CXXFLAGS"
if test -z "$CLANG_CL"; then
LDFLAGS="-fsanitize=undefined $LDFLAGS"
fi
AC_DEFINE(MOZ_UBSAN)
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
fi
AC_SUBST(MOZ_UBSAN)
# The LLVM symbolizer is used by all sanitizers
AC_SUBST(LLVM_SYMBOLIZER)
+5 -3
View File
@@ -58,9 +58,11 @@ FINAL_TARGET_FILES += ['/.gdbinit']
FINAL_TARGET_PP_FILES += ['.gdbinit_python.in']
OBJDIR_FILES += ['!/dist/bin/.gdbinit_python']
# Install the clang-cl runtime library for ASAN next to the binaries we produce.
if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']:
FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
# Install the clang runtime library for ASAN next to the binaries we produce.
if CONFIG['MOZ_ASAN'] and CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']:
FINAL_TARGET_FILES += [CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
if CONFIG['LLVM_SYMBOLIZER']:
FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]
if CONFIG['MOZ_APP_BASENAME']:
FINAL_TARGET_PP_FILES += ['application.ini']
+109 -39
View File
@@ -74,6 +74,61 @@ def check_headers(*headers, **kwargs):
return checks
# Determine whether to add a given flag to the given lists of flags for C or
# C++ compilation.
# - `flag` is the flag to test
# - `cflags` is a @depends function for the list of C compiler flags to add to
# - `cxxflags` is a @depends function for the list of C++ compiler flags to
# add to
# - `test_flags` is a list of flags to pass to the compiler instead of merely
# passing `flag`. This is especially useful for checking warning flags. If
# this list is empty, `flag` will be passed on its own.
# - `compiler` (optional) is the compiler to test against (c_compiler or
# cxx_compiler, from toolchain.configure). When omitted, both compilers
# are tested; the list of flags added to is dependent on the compiler tested.
# - `when` (optional) is a @depends function or option name conditioning
# when the warning flag is wanted.
# - `check`, when not set, skips checking whether the flag is supported and
# adds it to the list of flags unconditionally.
@template
def check_and_add_flags(flag, cflags, cxxflags, test_flags,
compiler=None, when=None, check=True):
if compiler is not None:
compilers = (compiler,)
else:
compilers = (c_compiler, cxx_compiler)
if when is None:
when = always
if test_flags:
flags = test_flags
else:
flags = [flag]
for c in compilers:
assert c in (c_compiler, cxx_compiler)
lang, list_of_flags = {
c_compiler: ('C', cflags),
cxx_compiler: ('C++', cxxflags),
}[c]
@depends(c, when)
def result(c, when):
if when and c.type in ('clang', 'gcc'):
return True
if check:
result = c.try_compile(
flags=flags, when=result,
check_msg='whether the %s compiler supports %s' % (lang, flag))
@depends(result, list_of_flags)
def maybe_add_flag(result, list_of_flags):
if result:
list_of_flags.append(flag)
@depends(c_compiler)
def warnings_cflags(c_compiler):
return []
@@ -96,48 +151,21 @@ def warnings_cxxflags(cxx_compiler):
# for add_gcc_warning().
@template
def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True):
if compiler:
compilers = (compiler,)
# GCC and clang will fail if given an unknown warning option like
# -Wfoobar. But later versions won't fail if given an unknown negated
# warning option like -Wno-foobar. So when we are checking for support
# of a negated warning option, we actually test the positive form, but
# add the negated form to the flags variable.
if warning.startswith('-Wno-') and not warning.startswith('-Wno-error='):
flags = ['-Werror', '-W' + warning[5:]]
elif warning.startswith('-Werror='):
flags = [warning]
else:
compilers = (c_compiler, cxx_compiler)
flags = ['-Werror', warning]
when = when or always
check_and_add_flags(warning, warnings_cflags, warnings_cxxflags,
flags, compiler=compiler, when=when, check=check)
for c in compilers:
assert c in (c_compiler, cxx_compiler)
lang, warnings_flags = {
c_compiler: ('C', warnings_cflags),
cxx_compiler: ('C++', warnings_cxxflags),
}[c]
# GCC and clang will fail if given an unknown warning option like
# -Wfoobar. But later versions won't fail if given an unknown negated
# warning option like -Wno-foobar. So when we are checking for support
# of a negated warning option, we actually test the positive form, but
# add the negated form to the flags variable.
if (warning.startswith('-Wno-') and
not warning.startswith('-Wno-error=')):
flags = ['-Werror', '-W' + warning[5:]]
elif warning.startswith('-Werror='):
flags = [warning]
else:
flags = ['-Werror', warning]
@depends(c, when)
def result(c, when):
if when and c.type in ('clang', 'gcc'):
return True
if check:
result = c.try_compile(
flags=flags, when=result,
check_msg='whether the %s compiler supports %s' % (lang,
warning))
@depends(result, warnings_flags)
def maybe_add_flag(result, warnings_flags):
if result:
warnings_flags.append(warning)
# Add the given warning to the list of warning flags for the build.
# - `warning` is the warning flag (e.g. -Wfoo)
@@ -149,3 +177,45 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True):
@template
def add_gcc_warning(warning, compiler=None, when=None):
check_and_add_gcc_warning(warning, compiler, when, check=False)
# Like the warning checks above, but for general compilation flags.
@dependable
def compilation_cflags():
return []
@dependable
def compilation_cxxflags():
return []
# Tests whether GCC or clang support the given compilation flag; if the flag
# is supported, add it to the list of compilation flags for the build.
# - `flag` is the flag to test
# - `compiler` (optional) is the compiler to test against (c_compiler or
# cxx_compiler, from toolchain.configure). When omitted, both compilers
# are tested.
# - `when` (optional) is a @depends function or option name conditioning
# when the warning flag is wanted.
# - `check`, when not set, skips checking whether the flag is supported and
# adds it to the list of flags unconditionally. This is only meant for
# add_gcc_flag().
@template
def check_and_add_gcc_flag(flag, compiler=None, when=None, check=True):
flags = ['-Werror', flag]
check_and_add_flags(flag, compilation_cflags, compilation_cxxflags,
flags, compiler=compiler, when=when, check=check)
# Add the given flag to the list of flags for the build.
# - `flag` is the flag (e.g. -fno-sized-deallocation)
# - `compiler` (optional) is the compiler to add the flag for (c_compiler or
# cxx_compiler, from toolchain.configure). When omitted, the flag is added
# for both compilers.
# - `when` (optional) is a @depends function or option name conditioning
# when the flag is wanted.
@template
def add_gcc_flag(warning, compiler=None, when=None):
check_and_add_gcc_flag(warning, compiler, when, check=False)
+13
View File
@@ -0,0 +1,13 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
# We support C++14, but we don't want to enable the sized deallocation
# facilities in C++14 yet.
check_and_add_gcc_flag('-fno-sized-deallocation', compiler=cxx_compiler)
# Please keep these last in this file.
add_old_configure_assignment('_COMPILATION_CFLAGS', compilation_cflags)
add_old_configure_assignment('_COMPILATION_CXXFLAGS', compilation_cxxflags)
+6 -1
View File
@@ -179,7 +179,6 @@ def old_configure_options(*options):
'--enable-directshow',
'--enable-dtrace',
'--enable-dump-painting',
'--enable-eme',
'--enable-elf-hack',
'--enable-extensions',
'--enable-faststripe',
@@ -197,6 +196,7 @@ def old_configure_options(*options):
'--enable-ios-target',
'--enable-jitspew',
'--enable-js-lto',
'--enable-leak-sanitizer',
'--enable-libjpeg-turbo',
'--enable-libproxy',
'--enable-llvm-hacks',
@@ -246,6 +246,7 @@ def old_configure_options(*options):
'--enable-thread-sanitizer',
'--enable-trace-logging',
'--enable-ui-locale',
'--enable-undefined-sanitizer',
'--enable-universalchardet',
'--enable-updater',
'--enable-url-classifier',
@@ -276,7 +277,9 @@ def old_configure_options(*options):
'--with-ios-sdk',
'--with-jitreport-granularity',
'--with-macbundlename-prefix',
'--with-macbundle-entitlement',
'--with-macbundle-identity',
'--with-macbundle-type',
'--with-macos-private-frameworks',
'--with-macos-sdk',
'--with-nspr-cflags',
@@ -303,6 +306,8 @@ def old_configure_options(*options):
'--enable-ldap',
'--enable-mapi',
'--enable-calendar',
'--enable-inspector',
'--enable-irc',
'--enable-incomplete-external-linkage',
'--enable-mailnews',
'--enable-mailnews-oauth2',
+35 -19
View File
@@ -171,6 +171,9 @@ include('compilers-util.configure')
def try_preprocess(compiler, language, source):
return try_invoke_compiler(compiler, language, source, ['-E'])
def msvc_std14(): return '-std:c++14'
def msvc_std17(): return '-std:c++17'
@imports(_from='mozbuild.configure.constants', _import='CompilerType')
@imports(_from='mozbuild.configure.constants',
_import='CPU_preprocessor_checks')
@@ -279,6 +282,13 @@ def get_compiler_info(compiler, language):
'Unknown compiler or compiler not supported.')
cplusplus = int(data.get('cplusplus', '0L').rstrip('L'))
if language == 'C++' and type=='msvc' and cplusplus == 199711:
# Note: MSVC still reports 199711L for __cplusplus. Fix the report by
# assuming it does what we asked it to do.
if msvc_std14() in compiler:
cplusplus = 201402
elif msvc_std17() in compiler:
cplusplus = 201703
stdc_version = int(data.get('STDC_VERSION', '0L').rstrip('L'))
version = data.get('VERSION')
@@ -330,16 +340,16 @@ def check_compiler(compiler, language, target):
if info.type in ('clang-cl', 'clang', 'gcc'):
append_flag('-std=gnu99')
# Note: MSVC, while supporting C++11, still reports 199711L for __cplusplus.
# Note: this is a strict version check because we used to always add
# -std=gnu++11.
cxx17_version = 201703
if info.language == 'C++':
if info.type in ('clang', 'gcc') and info.language_version != 201103:
append_flag('-std=gnu++11')
# MSVC 2015 headers include C++14 features, but don't guard them
# with appropriate checks.
if info.type == 'clang-cl' and info.language_version != 201402:
append_flag('-std=c++14')
if info.language_version != cxx17_version:
# Compiler doesn't default to C++17, so add the appropriate flag.
if info.type in ('clang', 'gcc'):
# We're on Clang or GCC, enable C++17 and add GNU extensions.
append_flag('-std=gnu++17')
else:
# We're on MSVC; enable C++17 language mode.
append_flag('-std:c++17')
# We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to
# cl.exe.
@@ -644,11 +654,17 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
host_or_target)
# Check that the additional flags we got are enough to not require any
# more flags.
if info.flags:
flags += info.flags
info = check_compiler(wrapper + [compiler] + flags, language,
host_or_target)
# more flags. If we get an exception, just ignore it; it's liable to be
# invalid command-line flags, which means the compiler we're checking
# doesn't support those command-line flags and will fail one or more of
# the checks below.
try:
if info.flags:
flags += info.flags
info = check_compiler(wrapper + [compiler] + flags, language,
host_or_target)
except FatalCheckError:
pass
if not info.target_cpu or info.target_cpu != host_or_target.cpu:
raise FatalCheckError(
@@ -674,10 +690,6 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
info.target_endianness or 'unknown', host_or_target_str,
host_or_target.endianness))
if info.flags:
raise FatalCheckError(
'Unknown compiler or compiler not supported.')
# Compiler version checks
# ===================================================
# Check the compiler version here instead of in `compiler_version` so
@@ -689,7 +701,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
% info.version)
# If you want to bump the version check here search for
# __cpp_static_assert above, and see the associated comment.
# cxx_alignof above, and see the associated comment.
if info.type == 'clang' and not info.version:
raise FatalCheckError(
'Only clang/llvm 3.6 or newer is supported.')
@@ -704,6 +716,10 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
'See https://developer.mozilla.org/en/'
'Windows_Build_Prerequisites' % info.version)
if info.flags:
raise FatalCheckError(
'Unknown compiler or compiler not supported.')
return namespace(
wrapper=wrapper,
compiler=compiler,
+1 -7
View File
@@ -18,9 +18,6 @@ add_old_configure_assignment(
# lots of useful warnings
add_gcc_warning('-Wall')
# catches C++ version forward-compat issues
add_gcc_warning('-Wc++11-compat', cxx_compiler)
# catches bugs, e.g. "if (c); foo();", few false positives
add_gcc_warning('-Wempty-body')
@@ -55,10 +52,7 @@ check_and_add_gcc_warning('-Wclass-varargs')
check_and_add_gcc_warning('-Wloop-analysis')
# catches C++ version forward-compat issues
check_and_add_gcc_warning('-Wc++11-compat-pedantic', cxx_compiler)
check_and_add_gcc_warning('-Wc++14-compat', cxx_compiler)
check_and_add_gcc_warning('-Wc++14-compat-pedantic', cxx_compiler)
check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
# check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler)
# catches unintentional switch case fallthroughs
check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)
-3
View File
@@ -9,9 +9,6 @@ if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] or CONFIG['MOZ_LIBSTDCXX_HOST_VERSION'
if CONFIG['USE_ELF_HACK']:
DIRS += ['elfhack']
if CONFIG['LLVM_SYMBOLIZER']:
FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]
SDK_FILES.bin += [
'run-mozilla.sh',
]
+3 -3
View File
@@ -51,12 +51,12 @@ public:
// Don't use this method for anything else than debugging!
void CreateAnonymizedSuffix(nsACString& aStr) const;
MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
// Populates the attributes from a string like
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix);
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix);
// Helper function to match mIsPrivateBrowsing to existing private browsing
// flags. Once all other flags are removed, this can be removed too.
+1
View File
@@ -82,6 +82,7 @@ included_inclnames_to_ignore = set([
'unicode/plurrule.h', # ICU
'unicode/timezone.h', # ICU
'unicode/ucal.h', # ICU
'unicode/uchar.h', # ICU
'unicode/uclean.h', # ICU
'unicode/ucol.h', # ICU
'unicode/udat.h', # ICU
-10
View File
@@ -1,10 +0,0 @@
; This Source Code Form is subject to the terms of the Mozilla Public
; 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/.
LIBRARY lgpllibs.dll
EXPORTS
av_rdft_init
av_rdft_calc
av_rdft_end
+2 -6
View File
@@ -4,14 +4,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# The lgpllibs library stores symbols from third-party LGPL licensed libraries,
# such as libav and libsoundtouch. It fulfills the requirement of dynamically
# linking these symbols into gecko.
# such as libsoundtouch. It fulfills the requirement of dynamically linking
# these symbols into Goanna.
#
# Any library added here should also be reflected in the about:license page.
GeckoSharedLibrary('lgpllibs', linkage=None)
SHARED_LIBRARY_NAME = 'lgpllibs'
if CONFIG['MOZ_LIBAV_FFT']:
DIRS += ['/media/libav']
DEFFILE = SRCDIR + '/lgpllibs.def'
+1 -1
View File
@@ -8,4 +8,4 @@
# Referenced by milestone.py.
#--------------------------------------------------------
6.2.0
6.5.0
+24801 -12689
View File
File diff suppressed because it is too large. Load diff
+896 -181
View File
File diff suppressed because it is too large. Load diff
+64 -5
View File
@@ -2509,6 +2509,10 @@ var Debugger =
var Attribute = _require9.Attribute;
var _require23 = __webpack_require__(460);
var BigInt = _require23.BigInt;
var _require10 = __webpack_require__(47);
var DateTime = _require10.DateTime;
@@ -2565,7 +2569,7 @@ var Debugger =
// XXX there should be a way for extensions to register a new
// or modify an existing rep.
var reps = [RegExp, StyleSheet, Event, DateTime, TextNode, Attribute, Func, ArrayRep, Document, Window, ObjectWithText, ObjectWithURL, GripArray, GripMap, Grip, Undefined, Null, StringRep, Number, SymbolRep];
var reps = [RegExp, StyleSheet, Event, DateTime, TextNode, Attribute, Func, ArrayRep, Document, Window, ObjectWithText, ObjectWithURL, GripArray, GripMap, Grip, Undefined, Null, StringRep, Number, BigInt, SymbolRep];
/**
* Generic rep that is using for rendering native JS types or an object.
@@ -2605,10 +2609,12 @@ var Debugger =
var defaultRep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Obj;
var type = typeof object;
if (type == "object" && object instanceof String) {
type = "string";
} else if (type == "object" && object.type === "symbol") {
type = "symbol";
if (type == "object") {
if (object instanceof String) {
type = "string";
} else if (["symbol", "BigInt"].includes(object.type)) {
type = object.type;
}
}
if (isGrip(object)) {
@@ -58325,6 +58331,59 @@ var Debugger =
setBundle
};
/***/ },
/* 460 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
// Make this available to both AMD and CJS environments
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require, exports, module) {
// Dependencies
var React = __webpack_require__(2);
// Shortcuts
var span = React.DOM.span;
/**
* Renders a number
*/
var BigInt = React.createClass({
displayName: "BigInt",
propTypes: {
object: React.PropTypes.object.isRequired
},
render: function () {
let {object} = this.props;
let {text} = object;
return span({ className: "objectBox objectBox-number" }, `${text}n`);
}
});
function supportsObject(object, type) {
return type == "BigInt";
}
// Exports from this module
exports.BigInt = {
rep: BigInt,
supportsObject: supportsObject
};
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ }
/******/ ]);
//# sourceMappingURL=bundle.js.map
@@ -1068,7 +1068,7 @@ var Debugger =
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
ecmaVersion: 6,
// Turn on `strictSemicolons` to prevent the parser from doing
// automatic semicolon insertion.
strictSemicolons: false,
@@ -39,14 +39,14 @@ add_task(function* () {
// Calculate offsets to click in the middle of the first box quad.
let rect = prop.editor.valueSpan.getBoundingClientRect();
let firstQuad = prop.editor.valueSpan.getBoxQuads()[0];
let firstQuadBounds = prop.editor.valueSpan.getBoxQuads()[0].getBounds();
// For a multiline value, the first quad left edge is not aligned with the
// bounding rect left edge. The offsets expected by focusEditableField are
// relative to the bouding rectangle, so we need to translate the x-offset.
let x = firstQuad.bounds.left - rect.left + firstQuad.bounds.width / 2;
let x = firstQuadBounds.left - rect.left + firstQuadBounds.width / 2;
// The first quad top edge is aligned with the bounding top edge, no
// translation needed here.
let y = firstQuad.bounds.height / 2;
let y = firstQuadBounds.height / 2;
info("Focusing the css property editable value");
let editor = yield focusEditableField(view, prop.editor.valueSpan, x, y);
+1 -1
View File
@@ -283,7 +283,7 @@ AutocompletePopup.prototype = {
return;
}
let {top, height} = quads[0].bounds;
let {top, height} = quads[0].getBounds();
let containerHeight = this._tooltip.panel.getBoundingClientRect().height;
if (top < 0) {
// Element is above container.
@@ -0,0 +1,48 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
// Make this available to both AMD and CJS environments
define(function (require, exports, module) {
// Dependencies
const React = require("devtools/client/shared/vendor/react");
// Shortcuts
const { span } = React.DOM;
/**
* Renders a BigInt
*/
const BigInt = React.createClass({
displayName: "BigInt",
propTypes: {
object: React.PropTypes.object.isRequired
},
render: function () {
let {object} = this.props;
let {text} = object;
return (
span({className: "objectBox objectBox-number"},
`${text}n`
)
);
}
});
function supportsObject(object, type) {
return (type == "BigInt");
}
// Exports from this module
exports.BigInt = {
rep: BigInt,
supportsObject: supportsObject
};
});
@@ -6,6 +6,7 @@
DevToolsModules(
'array.js',
'attribute.js',
'big-int.js',
'caption.js',
'comment-node.js',
'date-time.js',
@@ -26,6 +26,7 @@ define(function (require, exports, module) {
// DOM types (grips)
const { Attribute } = require("./attribute");
const { BigInt } = require("./big-int");
const { DateTime } = require("./date-time");
const { Document } = require("./document");
const { Event } = require("./event");
@@ -70,6 +71,7 @@ define(function (require, exports, module) {
Null,
StringRep,
Number,
BigInt,
SymbolRep,
InfinityRep,
NaNRep,
@@ -111,10 +113,12 @@ define(function (require, exports, module) {
*/
function getRep(object, defaultRep = Obj) {
let type = typeof object;
if (type == "object" && object instanceof String) {
type = "string";
} else if (object && type == "object" && object.type) {
type = object.type;
if (type == "object") {
if (object instanceof String) {
type = "string";
} else if (["symbol", "BigInt"].includes(object.type)) {
type = object.type;
}
}
if (isGrip(object)) {
@@ -85,9 +85,9 @@ function* runTests(doc) {
ok(arrow, "Tooltip has an arrow");
// Get the geometry of the anchor, the tooltip panel & arrow.
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].bounds;
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].bounds;
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].bounds;
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].getBounds();
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].getBounds();
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].getBounds();
let intersects = arrowBounds.left <= anchorBounds.right &&
arrowBounds.right >= anchorBounds.left;
@@ -78,9 +78,9 @@ function* runTests(doc) {
ok(arrow, "Tooltip has an arrow");
// Get the geometry of the anchor, the tooltip panel & arrow.
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].bounds;
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].bounds;
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].bounds;
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].getBounds();
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].getBounds();
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].getBounds();
let intersects = arrowBounds.left <= anchorBounds.right &&
arrowBounds.right >= anchorBounds.left;
@@ -114,5 +114,5 @@ let runAutocompletionTest = Task.async(function* (editor) {
*/
function getPopupOffset({popup, input}) {
let popupQuads = popup._panel.getBoxQuads({relativeTo: input});
return popupQuads[0].bounds.left;
return popupQuads[0].getBounds().left;
}
@@ -3236,14 +3236,6 @@ VariablesView.prototype.isOverridden = function (aItem) {
* The variable's descriptor.
*/
VariablesView.isPrimitive = function (aDescriptor) {
// For accessor property descriptors, the getter and setter need to be
// contained in 'get' and 'set' properties.
let getter = aDescriptor.get;
let setter = aDescriptor.set;
if (getter || setter) {
return false;
}
// As described in the remote debugger protocol, the value grip
// must be contained in a 'value' property.
let grip = aDescriptor.value;
@@ -3261,7 +3253,8 @@ VariablesView.isPrimitive = function (aDescriptor) {
type == "NaN" ||
type == "-0" ||
type == "symbol" ||
type == "longString") {
type == "longString" ||
type == "BigInt") {
return true;
}
@@ -3354,6 +3347,10 @@ VariablesView.getGrip = function (aValue) {
return { type: "-0" };
}
return aValue;
case "bigint":
return { type: "BigInt",
text: aValue.toString(),
};
case "undefined":
// document.all is also "undefined"
if (aValue === undefined) {
@@ -3496,6 +3493,10 @@ VariablesView.stringifiers.byType = {
return keyString + " \u2192 " + valueString;
},
BigInt: function (aGrip, aOptions) {
return aGrip.text + "n";
},
}; // VariablesView.stringifiers.byType
VariablesView.stringifiers.byObjectClass = {
@@ -176,9 +176,9 @@ const getRelativeRect = function (node, relativeTo) {
// Width and Height can be taken from the rect.
let {width, height} = node.getBoundingClientRect();
let quads = node.getBoxQuads({relativeTo});
let top = quads[0].bounds.top;
let left = quads[0].bounds.left;
let quadBounds = node.getBoxQuads({relativeTo})[0].getBounds();
let top = quadBounds.top;
let left = quadBounds.left;
// Compute right and bottom coordinates using the rest of the data.
let right = left + width;
@@ -1293,6 +1293,7 @@ Messages.Extended.prototype = extend(Messages.Simple.prototype, {
{
let map = {
"number": "cm-number",
"bigint": "cm-number",
"longstring": "console-string",
"string": "console-string",
"regexp": "cm-string-2",
@@ -3364,6 +3365,15 @@ Widgets.ObjectRenderers.add({
render: WrappedPrimitiveRenderer,
});
/**
* The widget used for displaying BigInt previews.
*/
Widgets.ObjectRenderers.add({
byClass: "BigInt",
render: WrappedPrimitiveRenderer,
});
/**
* The widget used for displaying String previews.
*/
+4 -1
View File
@@ -3071,7 +3071,10 @@ function nodeHasSize(node) {
}
let quads = node.getBoxQuads();
return quads.length && quads.some(quad => quad.bounds.width && quad.bounds.height);
return quads.some(quad => {
let bounds = quad.getBounds();
return bounds.width && bounds.height;
});
}
/**
+6
View File
@@ -2159,6 +2159,12 @@ function createValueGrip(value, pool, makeObjectGrip) {
}
return value;
case "bigint":
return {
type: "BigInt",
text: value.toString(),
};
case "undefined":
return { type: "undefined" };
@@ -41,25 +41,15 @@ function test_object_grip()
let objClient = gThreadClient.pauseGrip(args[0]);
objClient.getPrototypeAndProperties(function (aResponse) {
do_check_eq(aResponse.ownProperties.a.configurable, true);
do_check_eq(aResponse.ownProperties.a.enumerable, true);
do_check_eq(aResponse.ownProperties.a.writable, true);
do_check_eq(aResponse.ownProperties.a.value.type, "Infinity");
const {a, b, c, d, e, f, g} = aResponse.ownProperties;
do_check_eq(aResponse.ownProperties.b.configurable, true);
do_check_eq(aResponse.ownProperties.b.enumerable, true);
do_check_eq(aResponse.ownProperties.b.writable, true);
do_check_eq(aResponse.ownProperties.b.value.type, "-Infinity");
do_check_eq(aResponse.ownProperties.c.configurable, true);
do_check_eq(aResponse.ownProperties.c.enumerable, true);
do_check_eq(aResponse.ownProperties.c.writable, true);
do_check_eq(aResponse.ownProperties.c.value.type, "NaN");
do_check_eq(aResponse.ownProperties.d.configurable, true);
do_check_eq(aResponse.ownProperties.d.enumerable, true);
do_check_eq(aResponse.ownProperties.d.writable, true);
do_check_eq(aResponse.ownProperties.d.value.type, "-0");
testPropertyType(a, "Infinity");
testPropertyType(b, "-Infinity");
testPropertyType(c, "NaN");
testPropertyType(d, "-0");
testPropertyType(e, "BigInt");
testPropertyType(f, "BigInt");
testPropertyType(g, "BigInt");
gThreadClient.resume(function () {
gClient.close().then(gCallback);
@@ -67,6 +57,20 @@ function test_object_grip()
});
});
gDebuggee.eval("stopMe({ a: Infinity, b: -Infinity, c: NaN, d: -0 })");
gDebuggee.eval(`stopMe({
a: Infinity,
b: -Infinity,
c: NaN,
d: -0,
e: 1n,
f: -2n,
g: 0n,
})`);
}
function testPropertyType(prop, expectedType) {
do_check_eq(prop.configurable, true);
do_check_eq(prop.enumerable, true);
do_check_eq(prop.writable, true);
do_check_eq(prop.value.type, expectedType);
}
+1 -1
View File
@@ -1299,7 +1299,7 @@ var defaultOptions = {
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
ecmaVersion: 6,
// Source type ("script" or "module") for different semantics
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
+14 -8
View File
@@ -175,6 +175,11 @@ exports.getFrameOffsets = getFrameOffsets;
/**
* Get box quads adjusted for iframes and zoom level.
*
* Warning: this function returns things that look like DOMQuad objects but
* aren't (they resemble an old version of the spec). Unlike the return value
* of node.getBoxQuads, they have a .bounds property and not a .getBounds()
* method.
*
* @param {DOMWindow} boundaryWindow
* The window where to stop to iterate. If `null` is given, the top
* window is used.
@@ -206,6 +211,7 @@ function getAdjustedQuads(boundaryWindow, node, region) {
let adjustedQuads = [];
for (let quad of quads) {
let bounds = quad.getBounds();
adjustedQuads.push({
p1: {
w: quad.p1.w * scale,
@@ -232,14 +238,14 @@ function getAdjustedQuads(boundaryWindow, node, region) {
z: quad.p4.z * scale
},
bounds: {
bottom: quad.bounds.bottom * scale + yOffset,
height: quad.bounds.height * scale,
left: quad.bounds.left * scale + xOffset,
right: quad.bounds.right * scale + xOffset,
top: quad.bounds.top * scale + yOffset,
width: quad.bounds.width * scale,
x: quad.bounds.x * scale + xOffset,
y: quad.bounds.y * scale + yOffset
bottom: bounds.bottom * scale + yOffset,
height: bounds.height * scale,
left: bounds.left * scale + xOffset,
right: bounds.right * scale + xOffset,
top: bounds.top * scale + yOffset,
width: bounds.width * scale,
x: bounds.x * scale + xOffset,
y: bounds.y * scale + yOffset
}
});
}
+23
View File
@@ -75,6 +75,8 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
case js::Scalar::Uint16:
case js::Scalar::Int32:
case js::Scalar::Uint32:
case js::Scalar::BigInt64:
case js::Scalar::BigUint64:
break;
default:
aRv.Throw(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
@@ -113,6 +115,27 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
aRetval.set(view);
}
void Crypto::RandomUUID(nsAString& aRetVal)
{
// NSID_LENGTH == 39 == 36 UUID chars + 2 curly braces + 1 NUL byte
static_assert(NSID_LENGTH == 39, "Crypto:RandomUUID: NSID_LENGTH must be 39");
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1");
nsID uuid;
nsresult rv = uuidgen->GenerateUUIDInPlace(&uuid);
char uuidBuffer[NSID_LENGTH];
uuid.ToProvidedString(uuidBuffer);
nsCString asciiString(uuidBuffer);
// Convert UUID chars to UTF-16 retval, omitting the curly braces and NUL
CopyASCIItoUTF16(Substring(asciiString, 1, NSID_LENGTH - 3), aRetVal);
}
SubtleCrypto*
Crypto::Subtle()
{
+3
View File
@@ -9,6 +9,7 @@
#include "mozilla/dom/SubtleCrypto.h"
#include "nsIGlobalObject.h"
#include "nsString.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/TypedArray.h"
#define NS_DOMCRYPTO_CID \
@@ -39,6 +40,8 @@ public:
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv);
void RandomUUID(nsAString& aRetVal);
SubtleCrypto*
Subtle();
+379 -29
View File
@@ -17,9 +17,15 @@
#include <math.h>
#include "js/Equality.h" // JS::SameValueZero
namespace mozilla {
namespace dom {
template <typename T>
static void
SetDataInMatrix(DOMMatrixReadOnly* aMatrix, const T* aData, int aLength, ErrorResult& aRv);
static const double radPerDegree = 2.0 * M_PI / 360.0;
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMMatrixReadOnly, mParent)
@@ -27,6 +33,210 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMMatrixReadOnly, mParent)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMMatrixReadOnly, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMMatrixReadOnly, Release)
JSObject*
DOMMatrixReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return DOMMatrixReadOnlyBinding::Wrap(aCx, this, aGivenProto);
}
// https://drafts.fxtf.org/geometry/#matrix-validate-and-fixup-2d
static bool
ValidateAndFixupMatrix2DInit(DOMMatrix2DInit& aMatrixInit, ErrorResult& aRv)
{
#define ValidateAliases(field, alias, fieldName, aliasName) \
if ((field).WasPassed() && (alias).WasPassed() && \
!JS::SameValueZero((field).Value(), (alias).Value())) { \
aRv.ThrowTypeError<MSG_MATRIX_INIT_CONFLICTING_VALUE>((fieldName), \
(aliasName)); \
return false; \
}
#define SetFromAliasOrDefault(field, alias, defaultValue) \
if (!(field).WasPassed()) { \
if ((alias).WasPassed()) { \
(field).Construct((alias).Value()); \
} else { \
(field).Construct(defaultValue); \
} \
}
#define ValidateAndSet(field, alias, fieldName, aliasName, defaultValue) \
ValidateAliases((field), (alias), NS_LITERAL_STRING(fieldName), \
NS_LITERAL_STRING(aliasName)); \
SetFromAliasOrDefault((field), (alias), (defaultValue));
ValidateAndSet(aMatrixInit.mM11, aMatrixInit.mA, "m11", "a", 1);
ValidateAndSet(aMatrixInit.mM12, aMatrixInit.mB, "m12", "b", 0);
ValidateAndSet(aMatrixInit.mM21, aMatrixInit.mC, "m21", "c", 0);
ValidateAndSet(aMatrixInit.mM22, aMatrixInit.mD, "m22", "d", 1);
ValidateAndSet(aMatrixInit.mM41, aMatrixInit.mE, "m41", "e", 0);
ValidateAndSet(aMatrixInit.mM42, aMatrixInit.mF, "m42", "f", 0);
return true;
#undef ValidateAliases
#undef SetFromAliasOrDefault
#undef ValidateAndSet
}
// https://drafts.fxtf.org/geometry/#matrix-validate-and-fixup
static bool
ValidateAndFixupMatrixInit(DOMMatrixInit& aMatrixInit, ErrorResult& aRv)
{
#define Check3DField(field, fieldName, defaultValue) \
if ((field) != (defaultValue)) { \
if (!aMatrixInit.mIs2D.WasPassed()) { \
aMatrixInit.mIs2D.Construct(false); \
return true; \
} \
if (aMatrixInit.mIs2D.Value()) { \
aRv.ThrowTypeError<MSG_MATRIX_INIT_EXCEEDS_2D>( \
NS_LITERAL_STRING(fieldName)); \
return false; \
} \
}
if (!ValidateAndFixupMatrix2DInit(aMatrixInit, aRv)) {
return false;
}
Check3DField(aMatrixInit.mM13, "m13", 0);
Check3DField(aMatrixInit.mM14, "m14", 0);
Check3DField(aMatrixInit.mM23, "m23", 0);
Check3DField(aMatrixInit.mM24, "m24", 0);
Check3DField(aMatrixInit.mM31, "m31", 0);
Check3DField(aMatrixInit.mM32, "m32", 0);
Check3DField(aMatrixInit.mM34, "m34", 0);
Check3DField(aMatrixInit.mM43, "m43", 0);
Check3DField(aMatrixInit.mM33, "m33", 1);
Check3DField(aMatrixInit.mM44, "m44", 1);
if (!aMatrixInit.mIs2D.WasPassed()) {
aMatrixInit.mIs2D.Construct(true);
}
return true;
#undef Check3DField
}
void
DOMMatrixReadOnly::SetDataFromMatrixInit(DOMMatrixInit& aMatrixInit)
{
const bool is2D = aMatrixInit.mIs2D.Value();
MOZ_ASSERT(is2D == Is2D());
if (is2D) {
mMatrix2D->_11 = aMatrixInit.mM11.Value();
mMatrix2D->_12 = aMatrixInit.mM12.Value();
mMatrix2D->_21 = aMatrixInit.mM21.Value();
mMatrix2D->_22 = aMatrixInit.mM22.Value();
mMatrix2D->_31 = aMatrixInit.mM41.Value();
mMatrix2D->_32 = aMatrixInit.mM42.Value();
} else {
mMatrix3D->_11 = aMatrixInit.mM11.Value();
mMatrix3D->_12 = aMatrixInit.mM12.Value();
mMatrix3D->_13 = aMatrixInit.mM13;
mMatrix3D->_14 = aMatrixInit.mM14;
mMatrix3D->_21 = aMatrixInit.mM21.Value();
mMatrix3D->_22 = aMatrixInit.mM22.Value();
mMatrix3D->_23 = aMatrixInit.mM23;
mMatrix3D->_24 = aMatrixInit.mM24;
mMatrix3D->_31 = aMatrixInit.mM31;
mMatrix3D->_32 = aMatrixInit.mM32;
mMatrix3D->_33 = aMatrixInit.mM33;
mMatrix3D->_34 = aMatrixInit.mM34;
mMatrix3D->_41 = aMatrixInit.mM41.Value();
mMatrix3D->_42 = aMatrixInit.mM42.Value();
mMatrix3D->_43 = aMatrixInit.mM43;
mMatrix3D->_44 = aMatrixInit.mM44;
}
}
already_AddRefed<DOMMatrixReadOnly>
DOMMatrixReadOnly::FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv)
{
DOMMatrixInit matrixInit(aMatrixInit);
if (!ValidateAndFixupMatrixInit(matrixInit, aRv)) {
return nullptr;
};
RefPtr<DOMMatrixReadOnly> rval =
new DOMMatrixReadOnly(aGlobal.GetAsSupports(), matrixInit.mIs2D.Value());
rval->SetDataFromMatrixInit(matrixInit);
return rval.forget();
}
already_AddRefed<DOMMatrixReadOnly>
DOMMatrixReadOnly::FromFloat32Array(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv)
{
aArray32.ComputeLengthAndData();
const int length = aArray32.Length();
const bool is2D = length == 6;
RefPtr<DOMMatrixReadOnly> obj =
new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
SetDataInMatrix(obj, aArray32.Data(), length, aRv);
return obj.forget();
}
already_AddRefed<DOMMatrixReadOnly>
DOMMatrixReadOnly::FromFloat64Array(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv)
{
aArray64.ComputeLengthAndData();
const int length = aArray64.Length();
const bool is2D = length == 6;
RefPtr<DOMMatrixReadOnly> obj =
new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D);
SetDataInMatrix(obj, aArray64.Data(), length, aRv);
return obj.forget();
}
already_AddRefed<DOMMatrixReadOnly>
DOMMatrixReadOnly::Constructor(
const GlobalObject& aGlobal,
const Optional<StringOrUnrestrictedDoubleSequence>& aArg,
ErrorResult& aRv)
{
RefPtr<DOMMatrixReadOnly> rval = new DOMMatrixReadOnly(aGlobal.GetAsSupports());
if (!aArg.WasPassed()) {
return rval.forget();
}
const auto& arg = aArg.Value();
if (arg.IsString()) {
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
if (!win) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
rval->SetMatrixValue(arg.GetAsString(), aRv);
} else {
const auto& sequence = arg.GetAsUnrestrictedDoubleSequence();
SetDataInMatrix(rval, sequence.Elements(), sequence.Length(), aRv);
}
return rval.forget();
}
already_AddRefed<DOMMatrixReadOnly>
DOMMatrixReadOnly::ReadStructuredClone(nsISupports* aParent, JSStructuredCloneReader* aReader)
{
uint8_t is2D;
if (!JS_ReadBytes(aReader, &is2D, 1)) {
return nullptr;
}
RefPtr<DOMMatrixReadOnly> rval = new DOMMatrixReadOnly(aParent, is2D);
if (!ReadStructuredCloneElements(aReader, rval)) {
return nullptr;
};
return rval.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrixReadOnly::Translate(double aTx,
double aTy,
@@ -127,10 +337,10 @@ DOMMatrixReadOnly::SkewY(double aSy) const
}
already_AddRefed<DOMMatrix>
DOMMatrixReadOnly::Multiply(const DOMMatrix& other) const
DOMMatrixReadOnly::Multiply(const DOMMatrixInit& other, ErrorResult& aRv) const
{
RefPtr<DOMMatrix> retval = new DOMMatrix(mParent, *this);
retval->MultiplySelf(other);
retval->MultiplySelf(other, aRv);
return retval.forget();
}
@@ -307,6 +517,117 @@ DOMMatrixReadOnly::Stringify(nsAString& aResult)
aResult = matrixStr;
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool
DOMMatrixReadOnly::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
{
#define WriteFloatPair(f1, f2) \
JS_WriteUint32Pair(aWriter, BitwiseCast<uint32_t>(f1), \
BitwiseCast<uint32_t>(f2))
const uint8_t is2D = Is2D();
if (!JS_WriteBytes(aWriter, &is2D, 1)) {
return false;
}
if (is2D == 1) {
return WriteFloatPair(mMatrix2D->_11, mMatrix2D->_12) &&
WriteFloatPair(mMatrix2D->_21, mMatrix2D->_22) &&
WriteFloatPair(mMatrix2D->_31, mMatrix2D->_32);
}
return WriteFloatPair(mMatrix3D->_11, mMatrix3D->_12) &&
WriteFloatPair(mMatrix3D->_13, mMatrix3D->_14) &&
WriteFloatPair(mMatrix3D->_21, mMatrix3D->_22) &&
WriteFloatPair(mMatrix3D->_23, mMatrix3D->_24) &&
WriteFloatPair(mMatrix3D->_31, mMatrix3D->_32) &&
WriteFloatPair(mMatrix3D->_33, mMatrix3D->_34) &&
WriteFloatPair(mMatrix3D->_41, mMatrix3D->_42) &&
WriteFloatPair(mMatrix3D->_43, mMatrix3D->_44);
#undef WriteFloatPair
}
bool
DOMMatrixReadOnly::ReadStructuredCloneElements(JSStructuredCloneReader* aReader, DOMMatrixReadOnly* matrix)
{
uint32_t high;
uint32_t low;
#define ReadFloatPair(f1, f2) \
if (!JS_ReadUint32Pair(aReader, &high, &low)) { \
return false; \
} \
(*(f1) = BitwiseCast<float>(high)); \
(*(f2) = BitwiseCast<float>(low));
if (matrix->Is2D() == 1) {
ReadFloatPair(&(matrix->mMatrix2D->_11), &(matrix->mMatrix2D->_12));
ReadFloatPair(&(matrix->mMatrix2D->_21), &(matrix->mMatrix2D->_22));
ReadFloatPair(&(matrix->mMatrix2D->_31), &(matrix->mMatrix2D->_32));
} else {
ReadFloatPair(&(matrix->mMatrix3D->_11), &(matrix->mMatrix3D->_12));
ReadFloatPair(&(matrix->mMatrix3D->_13), &(matrix->mMatrix3D->_14));
ReadFloatPair(&(matrix->mMatrix3D->_21), &(matrix->mMatrix3D->_22));
ReadFloatPair(&(matrix->mMatrix3D->_23), &(matrix->mMatrix3D->_24));
ReadFloatPair(&(matrix->mMatrix3D->_31), &(matrix->mMatrix3D->_32));
ReadFloatPair(&(matrix->mMatrix3D->_33), &(matrix->mMatrix3D->_34));
ReadFloatPair(&(matrix->mMatrix3D->_41), &(matrix->mMatrix3D->_42));
ReadFloatPair(&(matrix->mMatrix3D->_43), &(matrix->mMatrix3D->_44));
}
return true;
#undef ReadFloatPair
}
already_AddRefed<DOMMatrix>
DOMMatrix::FromMatrix(nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv)
{
DOMMatrixInit matrixInit(aMatrixInit);
if (!ValidateAndFixupMatrixInit(matrixInit, aRv)) {
return nullptr;
};
RefPtr<DOMMatrix> matrix = new DOMMatrix(aParent, matrixInit.mIs2D.Value());
matrix->SetDataFromMatrixInit(matrixInit);
return matrix.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv)
{
RefPtr<DOMMatrix> matrix =
FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
return matrix.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::FromFloat32Array(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv)
{
aArray32.ComputeLengthAndData();
const int length = aArray32.Length();
const bool is2D = length == 6;
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
SetDataInMatrix(obj, aArray32.Data(), length, aRv);
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::FromFloat64Array(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv)
{
aArray64.ComputeLengthAndData();
const int length = aArray64.Length();
const bool is2D = length == 6;
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D);
SetDataInMatrix(obj, aArray64.Data(), length, aRv);
return obj.forget();
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
@@ -317,6 +638,11 @@ DOMMatrix::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
if (!win) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
obj = obj->SetMatrixValue(aTransformList, aRv);
@@ -330,7 +656,9 @@ DOMMatrix::Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOt
return obj.forget();
}
template <typename T> void SetDataInMatrix(DOMMatrix* aMatrix, const T* aData, int aLength, ErrorResult& aRv)
template <typename T>
static void
SetDataInMatrix(DOMMatrixReadOnly* aMatrix, const T* aData, int aLength, ErrorResult& aRv)
{
if (aLength == 16) {
aMatrix->SetM11(aData[0]);
@@ -357,28 +685,22 @@ template <typename T> void SetDataInMatrix(DOMMatrix* aMatrix, const T* aData, i
aMatrix->SetE(aData[4]);
aMatrix->SetF(aData[5]);
} else {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
nsAutoString lengthStr;
lengthStr.AppendInt(aLength);
aRv.ThrowTypeError<MSG_MATRIX_INIT_LENGTH_WRONG>(lengthStr);
}
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv)
{
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
aArray32.ComputeLengthAndData();
SetDataInMatrix(obj, aArray32.Data(), aArray32.Length(), aRv);
return obj.forget();
return FromFloat32Array(aGlobal, aArray32, aRv);
}
already_AddRefed<DOMMatrix>
DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv)
{
RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports());
aArray64.ComputeLengthAndData();
SetDataInMatrix(obj, aArray64.Data(), aArray64.Length(), aRv);
return obj.forget();
return FromFloat64Array(aGlobal, aArray64, aRv);
}
already_AddRefed<DOMMatrix>
@@ -390,7 +712,26 @@ DOMMatrix::Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNum
return obj.forget();
}
void DOMMatrix::Ensure3DMatrix()
already_AddRefed<DOMMatrix>
DOMMatrix::ReadStructuredClone(nsISupports* aParent, JSStructuredCloneReader* aReader)
{
uint8_t is2D;
if (!JS_ReadBytes(aReader, &is2D, 1)) {
return nullptr;
}
RefPtr<DOMMatrix> rval = new DOMMatrix(aParent, is2D);
if (!ReadStructuredCloneElements(aReader, rval)) {
return nullptr;
};
return rval.forget();
}
void
DOMMatrixReadOnly::Ensure3DMatrix()
{
if (!mMatrix3D) {
mMatrix3D = new gfx::Matrix4x4(gfx::Matrix4x4::From2D(*mMatrix2D));
@@ -399,42 +740,44 @@ void DOMMatrix::Ensure3DMatrix()
}
DOMMatrix*
DOMMatrix::MultiplySelf(const DOMMatrix& aOther)
DOMMatrix::MultiplySelf(const DOMMatrixInit& aOtherInit, ErrorResult& aRv)
{
if (aOther.Identity()) {
RefPtr<DOMMatrix> other = FromMatrix(mParent, aOtherInit, aRv);
if (other->Identity()) {
return this;
}
if (aOther.Is2D()) {
if (other->Is2D()) {
if (mMatrix3D) {
*mMatrix3D = gfx::Matrix4x4::From2D(*aOther.mMatrix2D) * *mMatrix3D;
*mMatrix3D = gfx::Matrix4x4::From2D(*other->mMatrix2D) * *mMatrix3D;
} else {
*mMatrix2D = *aOther.mMatrix2D * *mMatrix2D;
*mMatrix2D = *other->mMatrix2D * *mMatrix2D;
}
} else {
Ensure3DMatrix();
*mMatrix3D = *aOther.mMatrix3D * *mMatrix3D;
*mMatrix3D = *other->mMatrix3D * *mMatrix3D;
}
return this;
}
DOMMatrix*
DOMMatrix::PreMultiplySelf(const DOMMatrix& aOther)
DOMMatrix::PreMultiplySelf(const DOMMatrixInit& aOtherInit, ErrorResult& aRv)
{
if (aOther.Identity()) {
RefPtr<DOMMatrix> other = FromMatrix(mParent, aOtherInit, aRv);
if (other->Identity()) {
return this;
}
if (aOther.Is2D()) {
if (other->Is2D()) {
if (mMatrix3D) {
*mMatrix3D = *mMatrix3D * gfx::Matrix4x4::From2D(*aOther.mMatrix2D);
*mMatrix3D = *mMatrix3D * gfx::Matrix4x4::From2D(*other->mMatrix2D);
} else {
*mMatrix2D = *mMatrix2D * *aOther.mMatrix2D;
*mMatrix2D = *mMatrix2D * *other->mMatrix2D;
}
} else {
Ensure3DMatrix();
*mMatrix3D = *mMatrix3D * *aOther.mMatrix3D;
*mMatrix3D = *mMatrix3D * *other->mMatrix3D;
}
return this;
@@ -617,8 +960,8 @@ DOMMatrix::InvertSelf()
return this;
}
DOMMatrix*
DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
DOMMatrixReadOnly*
DOMMatrixReadOnly::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
{
SVGTransformListParser parser(aTransformList);
if (!parser.Parse()) {
@@ -644,6 +987,13 @@ DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
return this;
}
DOMMatrix*
DOMMatrix::SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv)
{
DOMMatrixReadOnly::SetMatrixValue(aTransformList, aRv);
return this;
}
JSObject*
DOMMatrix::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
+157 -86
View File
@@ -6,6 +6,7 @@
#ifndef MOZILLA_DOM_DOMMATRIX_H_
#define MOZILLA_DOM_DOMMATRIX_H_
#include "js/StructuredClone.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
#include "nsCycleCollectionParticipant.h"
@@ -22,7 +23,9 @@ namespace dom {
class GlobalObject;
class DOMMatrix;
class DOMPoint;
class StringOrUnrestrictedDoubleSequence;
struct DOMPointInit;
struct DOMMatrixInit;
class DOMMatrixReadOnly : public nsWrapperCache
{
@@ -42,9 +45,36 @@ public:
}
}
DOMMatrixReadOnly(nsISupports* aParent, const gfx::Matrix4x4& aMatrix)
: mParent(aParent)
{
mMatrix3D = new gfx::Matrix4x4(aMatrix);
}
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMMatrixReadOnly)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMMatrixReadOnly)
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<DOMMatrixReadOnly>
FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly>
FromFloat32Array(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly>
FromFloat64Array(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly>
Constructor(const GlobalObject& aGlobal, const Optional<StringOrUnrestrictedDoubleSequence>& aArg, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly>
ReadStructuredClone(nsISupports* aParent, JSStructuredCloneReader* aReader);
static bool
ReadStructuredCloneElements(JSStructuredCloneReader* aReader, DOMMatrixReadOnly* matrix);
#define GetMatrixMember(entry2D, entry3D, default) \
{ \
if (mMatrix3D) { \
@@ -88,88 +118,7 @@ public:
#undef GetMatrixMember
#undef Get3DMatrixMember
already_AddRefed<DOMMatrix> Translate(double aTx,
double aTy,
double aTz = 0) const;
already_AddRefed<DOMMatrix> Scale(double aScale,
double aOriginX = 0,
double aOriginY = 0) const;
already_AddRefed<DOMMatrix> Scale3d(double aScale,
double aOriginX = 0,
double aOriginY = 0,
double aOriginZ = 0) const;
already_AddRefed<DOMMatrix> ScaleNonUniform(double aScaleX,
double aScaleY = 1.0,
double aScaleZ = 1.0,
double aOriginX = 0,
double aOriginY = 0,
double aOriginZ = 0) const;
already_AddRefed<DOMMatrix> Rotate(double aAngle,
double aOriginX = 0,
double aOriginY = 0) const;
already_AddRefed<DOMMatrix> RotateFromVector(double aX,
double aY) const;
already_AddRefed<DOMMatrix> RotateAxisAngle(double aX,
double aY,
double aZ,
double aAngle) const;
already_AddRefed<DOMMatrix> SkewX(double aSx) const;
already_AddRefed<DOMMatrix> SkewY(double aSy) const;
already_AddRefed<DOMMatrix> Multiply(const DOMMatrix& aOther) const;
already_AddRefed<DOMMatrix> FlipX() const;
already_AddRefed<DOMMatrix> FlipY() const;
already_AddRefed<DOMMatrix> Inverse() const;
bool Is2D() const;
bool Identity() const;
already_AddRefed<DOMPoint> TransformPoint(const DOMPointInit& aPoint) const;
void ToFloat32Array(JSContext* aCx,
JS::MutableHandle<JSObject*> aResult,
ErrorResult& aRv) const;
void ToFloat64Array(JSContext* aCx,
JS::MutableHandle<JSObject*> aResult,
ErrorResult& aRv) const;
void Stringify(nsAString& aResult);
protected:
nsCOMPtr<nsISupports> mParent;
nsAutoPtr<gfx::Matrix> mMatrix2D;
nsAutoPtr<gfx::Matrix4x4> mMatrix3D;
virtual ~DOMMatrixReadOnly() {}
private:
DOMMatrixReadOnly() = delete;
DOMMatrixReadOnly(const DOMMatrixReadOnly&) = delete;
DOMMatrixReadOnly& operator=(const DOMMatrixReadOnly&) = delete;
};
class DOMMatrix : public DOMMatrixReadOnly
{
public:
explicit DOMMatrix(nsISupports* aParent)
: DOMMatrixReadOnly(aParent)
{}
DOMMatrix(nsISupports* aParent, const DOMMatrixReadOnly& other)
: DOMMatrixReadOnly(aParent, other)
{}
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOther, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv);
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// Defined here so we can construct DOMMatrixReadOnly objects.
#define Set2DMatrixMember(entry2D, entry3D) \
{ \
if (mMatrix3D) { \
@@ -214,8 +163,128 @@ public:
#undef Set2DMatrixMember
#undef Set3DMatrixMember
DOMMatrix* MultiplySelf(const DOMMatrix& aOther);
DOMMatrix* PreMultiplySelf(const DOMMatrix& aOther);
already_AddRefed<DOMMatrix> Translate(double aTx,
double aTy,
double aTz = 0) const;
already_AddRefed<DOMMatrix> Scale(double aScale,
double aOriginX = 0,
double aOriginY = 0) const;
already_AddRefed<DOMMatrix> Scale3d(double aScale,
double aOriginX = 0,
double aOriginY = 0,
double aOriginZ = 0) const;
already_AddRefed<DOMMatrix> ScaleNonUniform(double aScaleX,
double aScaleY = 1.0,
double aScaleZ = 1.0,
double aOriginX = 0,
double aOriginY = 0,
double aOriginZ = 0) const;
already_AddRefed<DOMMatrix> Rotate(double aAngle,
double aOriginX = 0,
double aOriginY = 0) const;
already_AddRefed<DOMMatrix> RotateFromVector(double aX,
double aY) const;
already_AddRefed<DOMMatrix> RotateAxisAngle(double aX,
double aY,
double aZ,
double aAngle) const;
already_AddRefed<DOMMatrix> SkewX(double aSx) const;
already_AddRefed<DOMMatrix> SkewY(double aSy) const;
already_AddRefed<DOMMatrix> Multiply(const DOMMatrixInit& aOther,
ErrorResult& aRv) const;
already_AddRefed<DOMMatrix> FlipX() const;
already_AddRefed<DOMMatrix> FlipY() const;
already_AddRefed<DOMMatrix> Inverse() const;
bool Is2D() const;
bool Identity() const;
already_AddRefed<DOMPoint> TransformPoint(const DOMPointInit& aPoint) const;
void ToFloat32Array(JSContext* aCx,
JS::MutableHandle<JSObject*> aResult,
ErrorResult& aRv) const;
void ToFloat64Array(JSContext* aCx,
JS::MutableHandle<JSObject*> aResult,
ErrorResult& aRv) const;
void Stringify(nsAString& aResult);
bool WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
protected:
nsCOMPtr<nsISupports> mParent;
nsAutoPtr<gfx::Matrix> mMatrix2D;
nsAutoPtr<gfx::Matrix4x4> mMatrix3D;
virtual ~DOMMatrixReadOnly() {}
/**
* Sets data from a fully validated and fixed-up matrix init,
* where all of its members are properly defined.
* The init dictionary's dimension must match the matrix one.
*/
void SetDataFromMatrixInit(DOMMatrixInit& aMatrixInit);
DOMMatrixReadOnly* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
void Ensure3DMatrix();
DOMMatrixReadOnly(nsISupports* aParent, bool is2D) : mParent(aParent) {
if (is2D) {
mMatrix2D = new gfx::Matrix();
} else {
mMatrix3D = new gfx::Matrix4x4();
}
}
private:
DOMMatrixReadOnly() = delete;
DOMMatrixReadOnly(const DOMMatrixReadOnly&) = delete;
DOMMatrixReadOnly& operator=(const DOMMatrixReadOnly&) = delete;
};
class DOMMatrix : public DOMMatrixReadOnly
{
public:
explicit DOMMatrix(nsISupports* aParent)
: DOMMatrixReadOnly(aParent)
{}
DOMMatrix(nsISupports* aParent, const DOMMatrixReadOnly& other)
: DOMMatrixReadOnly(aParent, other)
{}
DOMMatrix(nsISupports* aParent, const gfx::Matrix4x4& aMatrix)
: DOMMatrixReadOnly(aParent, aMatrix)
{}
static already_AddRefed<DOMMatrix>
FromMatrix(nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
FromMatrix(const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
FromFloat32Array(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
FromFloat64Array(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const nsAString& aTransformList, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const DOMMatrixReadOnly& aOther, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
Constructor(const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv);
static already_AddRefed<DOMMatrix>
ReadStructuredClone(nsISupports* aParent, JSStructuredCloneReader* aReader);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
DOMMatrix* MultiplySelf(const DOMMatrixInit& aOther, ErrorResult& aRv);
DOMMatrix* PreMultiplySelf(const DOMMatrixInit& aOther, ErrorResult& aRv);
DOMMatrix* TranslateSelf(double aTx,
double aTy,
double aTz = 0);
@@ -245,10 +314,12 @@ public:
DOMMatrix* SkewYSelf(double aSy);
DOMMatrix* InvertSelf();
DOMMatrix* SetMatrixValue(const nsAString& aTransformList, ErrorResult& aRv);
protected:
void Ensure3DMatrix();
virtual ~DOMMatrix() {}
private:
DOMMatrix(nsISupports* aParent, bool is2D)
: DOMMatrixReadOnly(aParent, is2D) {}
};
} // namespace dom
+61 -2
View File
@@ -16,9 +16,68 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMPointReadOnly, mParent)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMPointReadOnly, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMPointReadOnly, Release)
already_AddRefed<DOMPointReadOnly>
DOMPointReadOnly::FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams)
{
RefPtr<DOMPointReadOnly> obj =
new DOMPointReadOnly(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
aParams.mZ, aParams.mW);
return obj.forget();
}
already_AddRefed<DOMPointReadOnly>
DOMPointReadOnly::Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aZ, double aW, ErrorResult& aRV)
{
RefPtr<DOMPointReadOnly> obj =
new DOMPointReadOnly(aGlobal.GetAsSupports(), aX, aY, aZ, aW);
return obj.forget();
}
JSObject*
DOMPointReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return DOMPointReadOnlyBinding::Wrap(aCx, this, aGivenProto);
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool
DOMPointReadOnly::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
{
#define WriteDouble(d) \
JS_WriteUint32Pair(aWriter, (BitwiseCast<uint64_t>(d) >> 32) & 0xffffffff, \
BitwiseCast<uint64_t>(d) & 0xffffffff)
return WriteDouble(mX) && WriteDouble(mY) && WriteDouble(mZ) &&
WriteDouble(mW);
#undef WriteDouble
}
bool
DOMPointReadOnly::ReadStructuredClone(JSStructuredCloneReader* aReader)
{
uint32_t high;
uint32_t low;
#define ReadDouble(d) \
if (!JS_ReadUint32Pair(aReader, &high, &low)) { \
return false; \
} \
(*(d) = BitwiseCast<double>(static_cast<uint64_t>(high) << 32 | low))
ReadDouble(&mX);
ReadDouble(&mY);
ReadDouble(&mZ);
ReadDouble(&mW);
return true;
#undef ReadDouble
}
already_AddRefed<DOMPoint>
DOMPoint::Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams,
ErrorResult& aRV)
DOMPoint::FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams)
{
RefPtr<DOMPoint> obj =
new DOMPoint(aGlobal.GetAsSupports(), aParams.mX, aParams.mY,
+17 -5
View File
@@ -6,6 +6,7 @@
#ifndef MOZILLA_DOMPOINT_H_
#define MOZILLA_DOMPOINT_H_
#include "js/StructuredClone.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
#include "nsCycleCollectionParticipant.h"
@@ -23,8 +24,8 @@ struct DOMPointInit;
class DOMPointReadOnly : public nsWrapperCache
{
public:
DOMPointReadOnly(nsISupports* aParent, double aX, double aY,
double aZ, double aW)
explicit DOMPointReadOnly(nsISupports* aParent, double aX = 0.0,
double aY = 0.0, double aZ = 0.0, double aW = 1.0)
: mParent(aParent)
, mX(aX)
, mY(aY)
@@ -33,6 +34,12 @@ public:
{
}
static already_AddRefed<DOMPointReadOnly>
FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
static already_AddRefed<DOMPointReadOnly>
Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aZ, double aW, ErrorResult& aRV);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMPointReadOnly)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPointReadOnly)
@@ -41,6 +48,13 @@ public:
double Z() const { return mZ; }
double W() const { return mW; }
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
bool WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
bool ReadStructuredClone(JSStructuredCloneReader* aReader);
protected:
virtual ~DOMPointReadOnly() {}
@@ -57,13 +71,11 @@ public:
{}
static already_AddRefed<DOMPoint>
Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams,
ErrorResult& aRV);
FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
static already_AddRefed<DOMPoint>
Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aZ, double aW, ErrorResult& aRV);
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void SetX(double aX) { mX = aX; }
+103 -78
View File
@@ -43,6 +43,32 @@ DOMQuad::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return DOMQuadBinding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DOMQuad>
DOMQuad::FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit)
{
nsISupports* parent = aGlobal.GetAsSupports();
RefPtr<DOMQuad> obj = new DOMQuad(parent);
obj->mPoints[0] = new DOMPoint(parent, aInit.mX, aInit.mY, 0, 1);
obj->mPoints[1] =
new DOMPoint(parent, aInit.mX + aInit.mWidth, aInit.mY, 0, 1);
obj->mPoints[2] = new DOMPoint(parent, aInit.mX + aInit.mWidth,
aInit.mY + aInit.mHeight, 0, 1);
obj->mPoints[3] =
new DOMPoint(parent, aInit.mX, aInit.mY + aInit.mHeight, 0, 1);
return obj.forget();
}
already_AddRefed<DOMQuad>
DOMQuad::FromQuad(const GlobalObject& aGlobal, const DOMQuadInit& aInit)
{
RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aInit.mP1);
obj->mPoints[1] = DOMPoint::FromPoint(aGlobal, aInit.mP2);
obj->mPoints[2] = DOMPoint::FromPoint(aGlobal, aInit.mP3);
obj->mPoints[3] = DOMPoint::FromPoint(aGlobal, aInit.mP4);
return obj.forget();
}
already_AddRefed<DOMQuad>
DOMQuad::Constructor(const GlobalObject& aGlobal,
const DOMPointInit& aP1,
@@ -52,10 +78,10 @@ DOMQuad::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRV)
{
RefPtr<DOMQuad> obj = new DOMQuad(aGlobal.GetAsSupports());
obj->mPoints[0] = DOMPoint::Constructor(aGlobal, aP1, aRV);
obj->mPoints[1] = DOMPoint::Constructor(aGlobal, aP2, aRV);
obj->mPoints[2] = DOMPoint::Constructor(aGlobal, aP3, aRV);
obj->mPoints[3] = DOMPoint::Constructor(aGlobal, aP4, aRV);
obj->mPoints[0] = DOMPoint::FromPoint(aGlobal, aP1);
obj->mPoints[1] = DOMPoint::FromPoint(aGlobal, aP2);
obj->mPoints[2] = DOMPoint::FromPoint(aGlobal, aP3);
obj->mPoints[3] = DOMPoint::FromPoint(aGlobal, aP4);
return obj.forget();
}
@@ -73,87 +99,86 @@ DOMQuad::Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
return obj.forget();
}
class DOMQuad::QuadBounds final : public DOMRectReadOnly
void
DOMQuad::GetHorizontalMinMax(double* aX1, double* aX2) const
{
public:
explicit QuadBounds(DOMQuad* aQuad)
: DOMRectReadOnly(aQuad->GetParentObject())
, mQuad(aQuad)
{}
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(QuadBounds, DOMRectReadOnly)
NS_DECL_ISUPPORTS_INHERITED
virtual double X() const override
{
double x1, x2;
GetHorizontalMinMax(&x1, &x2);
return x1;
double x1, x2;
x1 = x2 = Point(0)->X();
for (uint32_t i = 1; i < 4; ++i) {
double x = Point(i)->X();
x1 = std::min(x1, x);
x2 = std::max(x2, x);
}
virtual double Y() const override
{
double y1, y2;
GetVerticalMinMax(&y1, &y2);
return y1;
*aX1 = x1;
*aX2 = x2;
}
void
DOMQuad::GetVerticalMinMax(double* aY1, double* aY2) const
{
double y1, y2;
y1 = y2 = Point(0)->Y();
for (uint32_t i = 1; i < 4; ++i) {
double y = Point(i)->Y();
y1 = std::min(y1, y);
y2 = std::max(y2, y);
}
virtual double Width() const override
{
double x1, x2;
GetHorizontalMinMax(&x1, &x2);
return x2 - x1;
}
virtual double Height() const override
{
double y1, y2;
GetVerticalMinMax(&y1, &y2);
return y2 - y1;
}
void GetHorizontalMinMax(double* aX1, double* aX2) const
{
double x1, x2;
x1 = x2 = mQuad->Point(0)->X();
for (uint32_t i = 1; i < 4; ++i) {
double x = mQuad->Point(i)->X();
x1 = std::min(x1, x);
x2 = std::max(x2, x);
}
*aX1 = x1;
*aX2 = x2;
}
void GetVerticalMinMax(double* aY1, double* aY2) const
{
double y1, y2;
y1 = y2 = mQuad->Point(0)->Y();
for (uint32_t i = 1; i < 4; ++i) {
double y = mQuad->Point(i)->Y();
y1 = std::min(y1, y);
y2 = std::max(y2, y);
}
*aY1 = y1;
*aY2 = y2;
}
protected:
virtual ~QuadBounds() {}
RefPtr<DOMQuad> mQuad;
};
NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly, mQuad)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMQuad::QuadBounds)
NS_INTERFACE_MAP_END_INHERITING(DOMRectReadOnly)
NS_IMPL_ADDREF_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly)
NS_IMPL_RELEASE_INHERITED(DOMQuad::QuadBounds, DOMRectReadOnly)
*aY1 = y1;
*aY2 = y2;
}
DOMRectReadOnly*
DOMQuad::Bounds() const
DOMQuad::Bounds()
{
if (!mBounds) {
mBounds = new QuadBounds(const_cast<DOMQuad*>(this));
mBounds = GetBounds();
}
return mBounds;
}
already_AddRefed<DOMRectReadOnly>
DOMQuad::GetBounds() const
{
double x1, x2;
double y1, y2;
GetHorizontalMinMax(&x1, &x2);
GetVerticalMinMax(&y1, &y2);
RefPtr<DOMRectReadOnly> rval = new DOMRectReadOnly(GetParentObject(),
x1, y1, x2 - x1, y2 - y1);
return rval.forget();
}
void
DOMQuad::ToJSON(DOMQuadJSON& aInit)
{
aInit.mP1.Construct(RefPtr<DOMPoint>(P1()).forget());
aInit.mP2.Construct(RefPtr<DOMPoint>(P2()).forget());
aInit.mP3.Construct(RefPtr<DOMPoint>(P3()).forget());
aInit.mP4.Construct(RefPtr<DOMPoint>(P4()).forget());
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool
DOMQuad::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
{
for (const auto& point : mPoints) {
if (!point->WriteStructuredClone(aWriter)) {
return false;
}
}
return true;
}
bool
DOMQuad::ReadStructuredClone(JSStructuredCloneReader* aReader)
{
for (auto& point : mPoints) {
point = new DOMPoint(mParent);
if (!point->ReadStructuredClone(aReader)) {
return false;
}
}
return true;
}
+22 -4
View File
@@ -6,6 +6,7 @@
#ifndef MOZILLA_DOMQUAD_H_
#define MOZILLA_DOMQUAD_H_
#include "js/StructuredClone.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
#include "nsCycleCollectionParticipant.h"
@@ -20,7 +21,10 @@ namespace dom {
class DOMRectReadOnly;
class DOMPoint;
struct DOMQuadJSON;
struct DOMPointInit;
struct DOMQuadInit;
struct DOMRectInit;
class DOMQuad final : public nsWrapperCache
{
@@ -36,6 +40,12 @@ public:
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<DOMQuad>
FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit);
static already_AddRefed<DOMQuad>
FromQuad(const GlobalObject& aGlobal, const DOMQuadInit& aInit);
static already_AddRefed<DOMQuad>
Constructor(const GlobalObject& aGlobal,
const DOMPointInit& aP1,
@@ -47,20 +57,28 @@ public:
Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
ErrorResult& aRV);
DOMRectReadOnly* Bounds() const;
DOMRectReadOnly* Bounds();
already_AddRefed<DOMRectReadOnly> GetBounds() const;
DOMPoint* P1() const { return mPoints[0]; }
DOMPoint* P2() const { return mPoints[1]; }
DOMPoint* P3() const { return mPoints[2]; }
DOMPoint* P4() const { return mPoints[3]; }
DOMPoint* Point(uint32_t aIndex) { return mPoints[aIndex]; }
DOMPoint* Point(uint32_t aIndex) const { return mPoints[aIndex]; }
void ToJSON(DOMQuadJSON& aInit);
bool WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
bool ReadStructuredClone(JSStructuredCloneReader* aReader);
protected:
class QuadBounds;
void GetHorizontalMinMax(double* aX1, double* aX2) const;
void GetVerticalMinMax(double* aY1, double* aY2) const;
nsCOMPtr<nsISupports> mParent;
RefPtr<DOMPoint> mPoints[4];
mutable RefPtr<QuadBounds> mBounds; // allocated lazily
RefPtr<DOMRectReadOnly> mBounds;
};
} // namespace dom
+57 -4
View File
@@ -27,6 +27,59 @@ DOMRectReadOnly::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return DOMRectReadOnlyBinding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DOMRectReadOnly>
DOMRectReadOnly::FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit)
{
RefPtr<DOMRectReadOnly> obj = new DOMRectReadOnly(
aGlobal.GetAsSupports(), aInit.mX, aInit.mY, aInit.mWidth, aInit.mHeight);
return obj.forget();
}
already_AddRefed<DOMRectReadOnly>
DOMRectReadOnly::Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aWidth, double aHeight, ErrorResult& aRv)
{
RefPtr<DOMRectReadOnly> obj =
new DOMRectReadOnly(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
return obj.forget();
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool
DOMRectReadOnly::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
{
#define WriteDouble(d) \
JS_WriteUint32Pair(aWriter, (BitwiseCast<uint64_t>(d) >> 32) & 0xffffffff, \
BitwiseCast<uint64_t>(d) & 0xffffffff)
return WriteDouble(mX) && WriteDouble(mY) && WriteDouble(mWidth) &&
WriteDouble(mHeight);
#undef WriteDouble
}
bool
DOMRectReadOnly::ReadStructuredClone(JSStructuredCloneReader* aReader)
{
uint32_t high;
uint32_t low;
#define ReadDouble(d) \
if (!JS_ReadUint32Pair(aReader, &high, &low)) { \
return false; \
} \
(*(d) = BitwiseCast<double>(static_cast<uint64_t>(high) << 32 | low))
ReadDouble(&mX);
ReadDouble(&mY);
ReadDouble(&mWidth);
ReadDouble(&mHeight);
return true;
#undef ReadDouble
}
// -----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED(DOMRect, DOMRectReadOnly, nsIDOMClientRect)
@@ -54,16 +107,16 @@ DOMRect::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
}
already_AddRefed<DOMRect>
DOMRect::Constructor(const GlobalObject& aGlobal, ErrorResult& aRV)
DOMRect::FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit)
{
RefPtr<DOMRect> obj =
new DOMRect(aGlobal.GetAsSupports(), 0.0, 0.0, 0.0, 0.0);
RefPtr<DOMRect> obj = new DOMRect(aGlobal.GetAsSupports(), aInit.mX, aInit.mY,
aInit.mWidth, aInit.mHeight);
return obj.forget();
}
already_AddRefed<DOMRect>
DOMRect::Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aWidth, double aHeight, ErrorResult& aRV)
double aWidth, double aHeight, ErrorResult& aRv)
{
RefPtr<DOMRect> obj =
new DOMRect(aGlobal.GetAsSupports(), aX, aY, aWidth, aHeight);
+43 -34
View File
@@ -6,6 +6,7 @@
#ifndef MOZILLA_DOMRECT_H_
#define MOZILLA_DOMRECT_H_
#include "js/StructuredClone.h"
#include "nsIDOMClientRect.h"
#include "nsIDOMClientRectList.h"
#include "nsTArray.h"
@@ -22,6 +23,8 @@ struct nsRect;
namespace mozilla {
namespace dom {
struct DOMRectInit;
class DOMRectReadOnly : public nsISupports
, public nsWrapperCache
{
@@ -32,8 +35,13 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectReadOnly)
explicit DOMRectReadOnly(nsISupports* aParent)
explicit DOMRectReadOnly(nsISupports* aParent, double aX = 0, double aY = 0,
double aWidth = 0, double aHeight = 0)
: mParent(aParent)
, mX(aX)
, mY(aY)
, mWidth(aWidth)
, mHeight(aHeight)
{
}
@@ -44,10 +52,29 @@ public:
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
virtual double X() const = 0;
virtual double Y() const = 0;
virtual double Width() const = 0;
virtual double Height() const = 0;
static already_AddRefed<DOMRectReadOnly>
FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit);
static already_AddRefed<DOMRectReadOnly>
Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aWidth, double aHeight, ErrorResult& aRv);
double X() const
{
return mX;
}
double Y() const
{
return mY;
}
double Width() const
{
return mWidth;
}
double Height() const
{
return mHeight;
}
double Left() const
{
@@ -70,8 +97,13 @@ public:
return std::max(y, y + h);
}
bool WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
bool ReadStructuredClone(JSStructuredCloneReader* aReader);
protected:
nsCOMPtr<nsISupports> mParent;
double mX, mY, mWidth, mHeight;
};
class DOMRect final : public DOMRectReadOnly
@@ -80,22 +112,19 @@ class DOMRect final : public DOMRectReadOnly
public:
explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0,
double aWidth = 0, double aHeight = 0)
: DOMRectReadOnly(aParent)
, mX(aX)
, mY(aY)
, mWidth(aWidth)
, mHeight(aHeight)
: DOMRectReadOnly(aParent, aX, aY, aWidth, aHeight)
{
}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMCLIENTRECT
static already_AddRefed<DOMRect>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRV);
FromRect(const GlobalObject& aGlobal, const DOMRectInit& aInit);
static already_AddRefed<DOMRect>
Constructor(const GlobalObject& aGlobal, double aX, double aY,
double aWidth, double aHeight, ErrorResult& aRV);
double aWidth, double aHeight, ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@@ -104,23 +133,6 @@ public:
}
void SetLayoutRect(const nsRect& aLayoutRect);
virtual double X() const override
{
return mX;
}
virtual double Y() const override
{
return mY;
}
virtual double Width() const override
{
return mWidth;
}
virtual double Height() const override
{
return mHeight;
}
void SetX(double aX)
{
mX = aX;
@@ -138,11 +150,8 @@ public:
mHeight = aHeight;
}
protected:
double mX, mY, mWidth, mHeight;
private:
~DOMRect() {};
~DOMRect() {}
};
class DOMRectList final : public nsIDOMClientRectList,
+2 -2
View File
@@ -398,7 +398,7 @@ FormData::Constructor(const GlobalObject& aGlobal,
NS_IMETHODIMP
FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
nsACString& aContentType, nsACString& aCharset)
nsACString& aContentTypeWithCharset, nsACString& aCharset)
{
FSMultipartFormData fs(NS_LITERAL_CSTRING("UTF-8"), nullptr);
@@ -419,7 +419,7 @@ FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
}
}
fs.GetContentType(aContentType);
fs.GetContentType(aContentTypeWithCharset);
aCharset.Truncate();
*aContentLength = 0;
NS_ADDREF(*aBody = fs.GetSubmissionBody(aContentLength));
+6 -1
View File
@@ -1022,7 +1022,12 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor)
nsContentUtils::Retarget(relatedTargetAsNode, this);
nsCOMPtr<nsINode> targetInKnownToBeHandledScope =
FindChromeAccessOnlySubtreeOwner(aVisitor.mTargetInKnownToBeHandledScope);
if (nsContentUtils::ContentIsShadowIncludingDescendantOf(
// If aVisitor.mTargetInKnownToBeHandledScope wasn't nsINode,
// targetInKnownToBeHandledScope will be null. This may happen when
// dispatching event to Window object in a content page and
// propagating the event to a chrome Element.
if (targetInKnownToBeHandledScope &&
nsContentUtils::ContentIsShadowIncludingDescendantOf(
this, targetInKnownToBeHandledScope->SubtreeRoot())) {
// Part of step 11.4.
// "If target's root is a shadow-including inclusive ancestor of
+1 -2
View File
@@ -147,8 +147,7 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsIContent *GetBindingParent() const override;
virtual nsXBLBinding *GetXBLBinding() const override;
virtual void SetXBLBinding(nsXBLBinding* aBinding,
+66 -206
View File
@@ -11,7 +11,9 @@
#include "nsPluginArray.h"
#include "nsMimeTypeArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BodyExtractor.h"
#include "mozilla/dom/DesktopNotification.h"
#include "mozilla/dom/FetchBinding.h"
#include "mozilla/dom/File.h"
#include "nsGeolocation.h"
#include "nsIClassOfService.h"
@@ -38,6 +40,7 @@
#include "mozilla/dom/ServiceWorkerContainer.h"
#include "mozilla/dom/StorageManager.h"
#include "mozilla/dom/TCPSocket.h"
#include "mozilla/dom/URLSearchParams.h"
#include "mozilla/dom/workers/RuntimeService.h"
#include "mozilla/Hal.h"
#include "nsISiteSpecificUserAgent.h"
@@ -88,11 +91,6 @@
#endif
#include "mozilla/dom/ContentChild.h"
#ifdef MOZ_EME
#include "mozilla/EMEUtils.h"
#include "mozilla/DetailedPromise.h"
#endif
namespace mozilla {
namespace dom {
@@ -195,9 +193,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
#endif
#ifdef MOZ_GAMEPAD
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest)
#endif
@@ -258,13 +253,6 @@ Navigator::Invalidate()
mServiceWorkerContainer = nullptr;
#ifdef MOZ_EME
if (mMediaKeySystemAccessManager) {
mMediaKeySystemAccessManager->Shutdown();
mMediaKeySystemAccessManager = nullptr;
}
#endif
#ifdef MOZ_GAMEPAD
if (mGamepadServiceTest) {
mGamepadServiceTest->Shutdown();
@@ -845,8 +833,52 @@ BeaconStreamListener::OnDataAvailable(nsIRequest *aRequest,
bool
Navigator::SendBeacon(const nsAString& aUrl,
const Nullable<ArrayBufferViewOrBlobOrStringOrFormData>& aData,
const Nullable<fetch::BodyInit>& aData,
ErrorResult& aRv)
{
if (aData.IsNull()) {
return SendBeaconInternal(aUrl, nullptr, eBeaconTypeOther, aRv);
}
if (aData.Value().IsArrayBuffer()) {
BodyExtractor<const ArrayBuffer> body(&aData.Value().GetAsArrayBuffer());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
if (aData.Value().IsArrayBufferView()) {
BodyExtractor<const ArrayBufferView> body(&aData.Value().GetAsArrayBufferView());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
if (aData.Value().IsBlob()) {
BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsBlob());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
if (aData.Value().IsFormData()) {
BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsFormData());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
if (aData.Value().IsUSVString()) {
BodyExtractor<const nsAString> body(&aData.Value().GetAsUSVString());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
if (aData.Value().IsURLSearchParams()) {
BodyExtractor<nsIXHRSendable> body(&aData.Value().GetAsURLSearchParams());
return SendBeaconInternal(aUrl, &body, eBeaconTypeOther, aRv);
}
MOZ_CRASH("Invalid data type.");
return false;
}
bool
Navigator::SendBeaconInternal(const nsAString& aUrl,
BodyExtractorBase* aBody,
BeaconType aType,
ErrorResult& aRv)
{
if (!mWindow) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
@@ -887,9 +919,9 @@ Navigator::SendBeacon(const nsAString& aUrl,
nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
// No need to use CORS for sendBeacon unless it's a BLOB
nsSecurityFlags securityFlags = (!aData.IsNull() && aData.Value().IsBlob())
? nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS
: nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
nsSecurityFlags securityFlags = aType == eBeaconTypeBlob
? nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS
: nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
securityFlags |= nsILoadInfo::SEC_COOKIES_INCLUDE;
nsCOMPtr<nsIChannel> channel;
@@ -915,76 +947,30 @@ Navigator::SendBeacon(const nsAString& aUrl,
}
httpChannel->SetReferrer(documentURI);
nsCString mimeType;
if (!aData.IsNull()) {
nsCOMPtr<nsIInputStream> in;
nsCOMPtr<nsIInputStream> in;
nsAutoCString contentTypeWithCharset;
nsAutoCString charset;
uint64_t length = 0;
if (aData.Value().IsString()) {
nsCString stringData = NS_ConvertUTF16toUTF8(aData.Value().GetAsString());
nsCOMPtr<nsIStringInputStream> strStream = do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
rv = strStream->SetData(stringData.BeginReading(), stringData.Length());
if (NS_FAILED(rv)) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
mimeType.AssignLiteral("text/plain;charset=UTF-8");
in = strStream;
} else if (aData.Value().IsArrayBufferView()) {
nsCOMPtr<nsIStringInputStream> strStream = do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
const ArrayBufferView& view = aData.Value().GetAsArrayBufferView();
view.ComputeLengthAndData();
rv = strStream->SetData(reinterpret_cast<char*>(view.Data()),
view.Length());
if (NS_FAILED(rv)) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
mimeType.AssignLiteral("application/octet-stream");
in = strStream;
} else if (aData.Value().IsBlob()) {
Blob& blob = aData.Value().GetAsBlob();
blob.GetInternalStream(getter_AddRefs(in), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return false;
}
nsAutoString type;
blob.GetType(type);
mimeType = NS_ConvertUTF16toUTF8(type);
} else if (aData.Value().IsFormData()) {
FormData& form = aData.Value().GetAsFormData();
uint64_t len;
nsAutoCString charset;
form.GetSendInfo(getter_AddRefs(in),
&len,
mimeType,
charset);
} else {
MOZ_ASSERT(false, "switch statements not in sync");
aRv.Throw(NS_ERROR_FAILURE);
if (aBody) {
aRv = aBody->GetAsStream(getter_AddRefs(in), &length,
contentTypeWithCharset, charset);
if (NS_WARN_IF(aRv.Failed())) {
return false;
}
if (aType == eBeaconTypeArrayBuffer) {
MOZ_ASSERT(contentTypeWithCharset.IsEmpty());
MOZ_ASSERT(charset.IsEmpty());
contentTypeWithCharset.Assign("application/octet-stream");
}
nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(channel);
if (!uploadChannel) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
uploadChannel->ExplicitSetUploadStream(in, mimeType, -1,
uploadChannel->ExplicitSetUploadStream(in, contentTypeWithCharset, length,
NS_LITERAL_CSTRING("POST"),
false);
} else {
@@ -1503,131 +1489,5 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent);
}
#ifdef MOZ_EME
static nsCString
ToCString(const nsString& aString)
{
nsCString str("'");
str.Append(NS_ConvertUTF16toUTF8(aString));
str.AppendLiteral("'");
return str;
}
static nsCString
ToCString(const MediaKeysRequirement aValue)
{
nsCString str("'");
str.Append(nsDependentCString(MediaKeysRequirementValues::strings[static_cast<uint32_t>(aValue)].value));
str.AppendLiteral("'");
return str;
}
static nsCString
ToCString(const MediaKeySystemMediaCapability& aValue)
{
nsCString str;
str.AppendLiteral("{contentType=");
str.Append(ToCString(aValue.mContentType));
str.AppendLiteral(", robustness=");
str.Append(ToCString(aValue.mRobustness));
str.AppendLiteral("}");
return str;
}
template<class Type>
static nsCString
ToCString(const Sequence<Type>& aSequence)
{
nsCString str;
str.AppendLiteral("[");
for (size_t i = 0; i < aSequence.Length(); i++) {
if (i != 0) {
str.AppendLiteral(",");
}
str.Append(ToCString(aSequence[i]));
}
str.AppendLiteral("]");
return str;
}
template<class Type>
static nsCString
ToCString(const Optional<Sequence<Type>>& aOptional)
{
nsCString str;
if (aOptional.WasPassed()) {
str.Append(ToCString(aOptional.Value()));
} else {
str.AppendLiteral("[]");
}
return str;
}
static nsCString
ToCString(const MediaKeySystemConfiguration& aConfig)
{
nsCString str;
str.AppendLiteral("{label=");
str.Append(ToCString(aConfig.mLabel));
str.AppendLiteral(", initDataTypes=");
str.Append(ToCString(aConfig.mInitDataTypes));
str.AppendLiteral(", audioCapabilities=");
str.Append(ToCString(aConfig.mAudioCapabilities));
str.AppendLiteral(", videoCapabilities=");
str.Append(ToCString(aConfig.mVideoCapabilities));
str.AppendLiteral(", distinctiveIdentifier=");
str.Append(ToCString(aConfig.mDistinctiveIdentifier));
str.AppendLiteral(", persistentState=");
str.Append(ToCString(aConfig.mPersistentState));
str.AppendLiteral(", sessionTypes=");
str.Append(ToCString(aConfig.mSessionTypes));
str.AppendLiteral("}");
return str;
}
static nsCString
RequestKeySystemAccessLogString(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs)
{
nsCString str;
str.AppendPrintf("Navigator::RequestMediaKeySystemAccess(keySystem='%s' options=",
NS_ConvertUTF16toUTF8(aKeySystem).get());
str.Append(ToCString(aConfigs));
str.AppendLiteral(")");
return str;
}
already_AddRefed<Promise>
Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
ErrorResult& aRv)
{
EME_LOG("%s", RequestKeySystemAccessLogString(aKeySystem, aConfigs).get());
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
RefPtr<DetailedPromise> promise =
DetailedPromise::Create(go, aRv,
NS_LITERAL_CSTRING("navigator.requestMediaKeySystemAccess"));
if (aRv.Failed()) {
return nullptr;
}
if (!mMediaKeySystemAccessManager) {
mMediaKeySystemAccessManager = new MediaKeySystemAccessManager(mWindow);
}
mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs);
return promise.forget();
}
#endif
} // namespace dom
} // namespace mozilla
+17 -14
View File
@@ -7,6 +7,7 @@
#define mozilla_dom_Navigator_h
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/ErrorResult.h"
#include "nsIDOMNavigator.h"
@@ -17,9 +18,6 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsWeakPtr.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccessManager.h"
#endif
class nsPluginArray;
class nsMimeTypeArray;
@@ -30,12 +28,13 @@ class nsIURI;
namespace mozilla {
namespace dom {
class BodyExtractorBase;
class Geolocation;
class systemMessageCallback;
class MediaDevices;
struct MediaStreamConstraints;
class WakeLock;
class ArrayBufferViewOrBlobOrStringOrFormData;
class ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams;
class ServiceWorkerContainer;
class DOMRequest;
} // namespace dom
@@ -196,7 +195,7 @@ public:
#endif // MOZ_AUDIO_CHANNEL_MANAGER
bool SendBeacon(const nsAString& aUrl,
const Nullable<ArrayBufferViewOrBlobOrStringOrFormData>& aData,
const Nullable<fetch::BodyInit>& aData,
ErrorResult& aRv);
void MozGetUserMedia(const MediaStreamConstraints& aConstraints,
@@ -238,21 +237,25 @@ public:
// any, else null.
static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal);
#ifdef MOZ_EME
already_AddRefed<Promise>
RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfig,
ErrorResult& aRv);
private:
RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager;
#endif
private:
virtual ~Navigator();
bool CheckPermission(const char* type);
static bool CheckPermission(nsPIDOMWindowInner* aWindow, const char* aType);
// This enum helps SendBeaconInternal to apply different behaviors to body
// types.
enum BeaconType {
eBeaconTypeBlob,
eBeaconTypeArrayBuffer,
eBeaconTypeOther
};
bool SendBeaconInternal(const nsAString& aUrl,
BodyExtractorBase* aBody,
BeaconType aType,
ErrorResult& aRv);
RefPtr<nsMimeTypeArray> mMimeTypes;
RefPtr<nsPluginArray> mPlugins;
RefPtr<Permissions> mPermissions;
+24
View File
@@ -303,6 +303,30 @@ ResizeObserverEntry::Constructor(const GlobalObject& aGlobal,
return observerEntry.forget();
}
void ResizeObserverEntry::GetBorderBoxSize(
nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const {
// In the resize-observer-1 spec, there will only be a single
// ResizeObserverSize returned in the FrozenArray.
//
// Note: the usage of FrozenArray is to support elements that have multiple
// fragments, which occur in multi-column scenarios. See:
// https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface
aRetVal.Clear();
aRetVal.AppendElement(mBorderBoxSize);
}
void ResizeObserverEntry::GetContentBoxSize(
nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const {
// In the resize-observer-1 spec, there will only be a single
// ResizeObserverSize returned in the FrozenArray.
//
// Note: the usage of FrozenArray is to support elements that have multiple
// fragments, which occur in multi-column scenarios.
// https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface
aRetVal.Clear();
aRetVal.AppendElement(mContentBoxSize);
}
void
ResizeObserverEntry::SetBorderBoxSize(const nsSize& aSize) {
nsIFrame* frame = mTarget->GetPrimaryFrame();
+3 -7
View File
@@ -163,14 +163,10 @@ public:
/**
* Returns target's logical border-box size and content-box size as
* ResizeObserverSize.
* a ResizeObserverSize array.
*/
ResizeObserverSize* BorderBoxSize() const {
return mBorderBoxSize;
}
ResizeObserverSize* ContentBoxSize() const {
return mContentBoxSize;
}
void GetBorderBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
void GetContentBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
// Set borderBoxSize.
void SetBorderBoxSize(const nsSize& aSize);
+133 -1
View File
@@ -11,6 +11,14 @@
#include "mozilla/dom/CryptoKey.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DirectoryBinding.h"
#include "mozilla/dom/DOMMatrix.h"
#include "mozilla/dom/DOMMatrixBinding.h"
#include "mozilla/dom/DOMPoint.h"
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/DOMQuad.h"
#include "mozilla/dom/DOMQuadBinding.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/DOMRectBinding.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileList.h"
#include "mozilla/dom/FileListBinding.h"
@@ -355,7 +363,11 @@ StructuredCloneHolder::ReadFullySerializableObjects(JSContext* aCx,
return ReadStructuredCloneImageData(aCx, aReader);
}
if (aTag == SCTAG_DOM_WEBCRYPTO_KEY || aTag == SCTAG_DOM_URLSEARCHPARAMS) {
if (aTag == SCTAG_DOM_WEBCRYPTO_KEY || aTag == SCTAG_DOM_URLSEARCHPARAMS ||
aTag == SCTAG_DOM_DOMPOINT || aTag == SCTAG_DOM_DOMPOINT_READONLY ||
aTag == SCTAG_DOM_DOMRECT || aTag == SCTAG_DOM_DOMRECT_READONLY ||
aTag == SCTAG_DOM_DOMQUAD || aTag == SCTAG_DOM_DOMMATRIX ||
aTag == SCTAG_DOM_DOMMATRIX_READONLY) {
nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
if (!global) {
return nullptr;
@@ -378,6 +390,57 @@ StructuredCloneHolder::ReadFullySerializableObjects(JSContext* aCx,
} else {
result = usp->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMPOINT) {
RefPtr<DOMPoint> domPoint = new DOMPoint(global);
if (!domPoint->ReadStructuredClone(aReader)) {
result = nullptr;
} else {
result = domPoint->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMPOINT_READONLY) {
RefPtr<DOMPointReadOnly> domPoint = new DOMPointReadOnly(global);
if (!domPoint->ReadStructuredClone(aReader)) {
result = nullptr;
} else {
result = domPoint->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMRECT) {
RefPtr<DOMRect> domRect = new DOMRect(global);
if (!domRect->ReadStructuredClone(aReader)) {
result = nullptr;
} else {
result = domRect->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMRECT_READONLY) {
RefPtr<DOMRectReadOnly> domRect = new DOMRectReadOnly(global);
if (!domRect->ReadStructuredClone(aReader)) {
result = nullptr;
} else {
result = domRect->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMQUAD) {
RefPtr<DOMQuad> domQuad = new DOMQuad(global);
if (!domQuad->ReadStructuredClone(aReader)) {
result = nullptr;
} else {
result = domQuad->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMMATRIX) {
RefPtr<DOMMatrix> domMatrix =
DOMMatrix::ReadStructuredClone(global, aReader);
if (!domMatrix) {
result = nullptr;
} else {
result = domMatrix->WrapObject(aCx, nullptr);
}
} else if (aTag == SCTAG_DOM_DOMMATRIX_READONLY) {
RefPtr<DOMMatrixReadOnly> domMatrix =
DOMMatrixReadOnly::ReadStructuredClone(global, aReader);
if (!domMatrix) {
result = nullptr;
} else {
result = domMatrix->WrapObject(aCx, nullptr);
}
}
}
return result;
@@ -483,6 +546,75 @@ StructuredCloneHolder::WriteFullySerializableObjects(JSContext* aCx,
}
#endif
// Handle DOMPoint cloning
// Should be done before DOMPointeReadOnly check
// because every DOMPoint is also a DOMPointReadOnly
{
DOMPoint* domPoint = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMPoint, &obj, domPoint))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMPOINT, 0) &&
domPoint->WriteStructuredClone(aWriter);
}
}
// Handle DOMPointReadOnly cloning
{
DOMPointReadOnly* domPoint = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMPointReadOnly, &obj, domPoint))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMPOINT_READONLY, 0) &&
domPoint->WriteStructuredClone(aWriter);
}
}
// Handle DOMRect cloning
// Should be done before DOMRecteReadOnly check
// because every DOMRect is also a DOMRectReadOnly
{
DOMRect* domRect = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMRect, &obj, domRect))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMRECT, 0) &&
domRect->WriteStructuredClone(aWriter);
}
}
// Handle DOMRectReadOnly cloning
{
DOMRectReadOnly* domRect = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMRectReadOnly, &obj, domRect))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMRECT_READONLY, 0) &&
domRect->WriteStructuredClone(aWriter);
}
}
// Handle DOMQuad cloning
{
DOMQuad* domQuad = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMQuad, &obj, domQuad))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMQUAD, 0) &&
domQuad->WriteStructuredClone(aWriter);
}
}
// Handle DOMMatrix cloning
// Should be done before DOMMatrixeReadOnly check
// because every DOMMatrix is also a DOMMatrixReadOnly
{
DOMMatrix* domMatrix = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMMatrix, &obj, domMatrix))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMMATRIX, 0) &&
domMatrix->WriteStructuredClone(aWriter);
}
}
// Handle DOMMatrixReadOnly cloning
{
DOMMatrixReadOnly* domMatrix = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMMatrixReadOnly, &obj, domMatrix))) {
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMMATRIX_READONLY, 0) &&
domMatrix->WriteStructuredClone(aWriter);
}
}
if (NS_IsMainThread() && xpc::IsReflector(obj)) {
nsCOMPtr<nsISupports> base = xpc::UnwrapReflectorToISupports(obj);
nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(base);
+9
View File
@@ -30,6 +30,15 @@ enum StructuredCloneTags {
// New IDB tags go here!
// Tags for Geometry interfaces.
SCTAG_DOM_DOMPOINT,
SCTAG_DOM_DOMPOINT_READONLY,
SCTAG_DOM_DOMQUAD,
SCTAG_DOM_DOMRECT,
SCTAG_DOM_DOMRECT_READONLY,
SCTAG_DOM_DOMMATRIX,
SCTAG_DOM_DOMMATRIX_READONLY,
// These tags are used for both main thread and workers.
SCTAG_DOM_IMAGEDATA,
SCTAG_DOM_MAP_MESSAGEPORT,
+3 -4
View File
@@ -20,8 +20,7 @@ static const double sRadPerDegree = 2.0 * M_PI / 360.0;
bool
WebKitCSSMatrix::FeatureEnabled(JSContext* aCx, JSObject* aObj)
{
return Preferences::GetBool("layout.css.DOMMatrix.enabled", false) &&
Preferences::GetBool("layout.css.prefixes.webkit", false);
return Preferences::GetBool("layout.css.prefixes.webkit", false);
}
already_AddRefed<WebKitCSSMatrix>
@@ -115,10 +114,10 @@ WebKitCSSMatrix::SetMatrixValue(const nsAString& aTransformList,
}
already_AddRefed<WebKitCSSMatrix>
WebKitCSSMatrix::Multiply(const WebKitCSSMatrix& other) const
WebKitCSSMatrix::Multiply(const DOMMatrixInit& aOtherInit, ErrorResult& aRv) const
{
RefPtr<WebKitCSSMatrix> retval = new WebKitCSSMatrix(mParent, *this);
retval->MultiplySelf(other);
retval->MultiplySelf(aOtherInit, aRv);
return retval.forget();
}
+2 -1
View File
@@ -40,7 +40,8 @@ public:
WebKitCSSMatrix* SetMatrixValue(const nsAString& aTransformList,
ErrorResult& aRv);
already_AddRefed<WebKitCSSMatrix> Multiply(const WebKitCSSMatrix& aOther) const;
already_AddRefed<WebKitCSSMatrix> Multiply(const DOMMatrixInit& aOtherInit,
ErrorResult& aRv) const;
already_AddRefed<WebKitCSSMatrix> Inverse(ErrorResult& aRv) const;
already_AddRefed<WebKitCSSMatrix> Translate(double aTx,
double aTy,
+1 -1
View File
@@ -84,7 +84,7 @@ private:
nsIContent **outImageOrLinkNode,
bool* outDragSelectedText);
static already_AddRefed<nsIContent> FindParentLinkNode(nsIContent* inNode);
static MOZ_MUST_USE nsresult
static [[nodiscard]] nsresult
GetAnchorURL(nsIContent* inNode, nsAString& outURL);
static void GetNodeString(nsIContent* inNode, nsAString & outNodeString);
static void CreateLinkText(const nsAString& inURL, const nsAString & inText,
+90
View File
@@ -39,6 +39,8 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FileSystemSecurity.h"
@@ -8733,6 +8735,25 @@ nsContentUtils::PushEnabled(JSContext* aCx, JSObject* aObj)
return workerPrivate->PushEnabled();
}
// static
bool
nsContentUtils::StreamsEnabled(JSContext* aCx, JSObject* aObj)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.streams.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->StreamsEnabled();
}
// static
bool
nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
@@ -10060,3 +10081,72 @@ void nsContentUtils::StructuredClone(JSContext* aCx,
nsTArray<RefPtr<MessagePort>> ports = holder.TakeTransferredPorts();
Unused << ports;
}
/* static */ void
nsContentUtils::ExtractErrorValues(JSContext* aCx,
JS::Handle<JS::Value> aValue,
nsACString& aSourceSpecOut,
uint32_t* aLineOut,
uint32_t* aColumnOut,
nsString& aMessageOut)
{
MOZ_ASSERT(aLineOut);
MOZ_ASSERT(aColumnOut);
if (aValue.isObject()) {
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
RefPtr<dom::DOMException> domException;
// Try to process as an Error object. Use the file/line/column values
// from the Error as they will be more specific to the root cause of
// the problem.
JSErrorReport* err = obj ? JS_ErrorFromException(aCx, obj) : nullptr;
if (err) {
// Use xpc to extract the error message only. We don't actually send
// this report anywhere.
RefPtr<xpc::ErrorReport> report = new xpc::ErrorReport();
report->Init(err,
"<unknown>", // toString result
false, // chrome
0); // window ID
if (!report->mFileName.IsEmpty()) {
CopyUTF16toUTF8(report->mFileName, aSourceSpecOut);
*aLineOut = report->mLineNumber;
*aColumnOut = report->mColumn;
}
aMessageOut.Assign(report->mErrorMsg);
}
// Next, try to unwrap the rejection value as a DOMException.
else if(NS_SUCCEEDED(UNWRAP_OBJECT(DOMException, obj, domException))) {
nsAutoString filename;
domException->GetFilename(aCx, filename);
if (!filename.IsEmpty()) {
CopyUTF16toUTF8(filename, aSourceSpecOut);
*aLineOut = domException->LineNumber(aCx);
*aColumnOut = domException->ColumnNumber();
}
domException->GetName(aMessageOut);
aMessageOut.AppendLiteral(": ");
nsAutoString message;
domException->GetMessageMoz(message);
aMessageOut.Append(message);
}
}
// If we could not unwrap a specific error type, then perform default safe
// string conversions on primitives. Objects will result in "[Object]"
// unfortunately.
if (aMessageOut.IsEmpty()) {
nsAutoJSString jsString;
if (jsString.init(aCx, aValue)) {
aMessageOut = jsString;
} else {
JS_ClearPendingException(aCx);
}
}
}
+26 -19
View File
@@ -1010,6 +1010,10 @@ public:
static bool PrefetchEnabled(nsIDocShell* aDocShell);
static void ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue,
nsACString& aSourceSpecOut, uint32_t *aLineOut,
uint32_t *aColumnOut, nsString& aMessageOut);
static nsresult CalculateBufferSizeForImage(const uint32_t& aStride,
const mozilla::gfx::IntSize& aImageSize,
const mozilla::gfx::SurfaceFormat& aFormat,
@@ -1504,9 +1508,10 @@ public:
* @param aResult the result. Out param.
* @return false on out of memory errors, true otherwise.
*/
MOZ_MUST_USE
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult, const mozilla::fallible_t&);
[[nodiscard]] static bool GetNodeTextContent(nsINode* aNode,
bool aDeep,
nsAString& aResult,
const mozilla::fallible_t&);
static void GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult);
@@ -1865,28 +1870,29 @@ public:
*/
static bool CanAccessNativeAnon();
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
const nsIID* aIID,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, nullptr, aIID, vp, aAllowWrapping);
}
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, nullptr, nullptr, vp, aAllowWrapping);
}
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
nsWrapperCache *cache,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
nsWrapperCache* cache,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, cache, nullptr, vp, aAllowWrapping);
}
@@ -1910,9 +1916,8 @@ public:
* @param aString the string to convert the newlines inside [in/out]
*/
static void PlatformToDOMLineBreaks(nsString &aString);
MOZ_MUST_USE
static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
[[nodiscard]] static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
/**
* Populates aResultString with the contents of the string-buffer aBuf, up
@@ -2679,6 +2684,8 @@ public:
static mozilla::net::ReferrerPolicy GetReferrerPolicyFromHeader(const nsAString& aHeader);
static bool PushEnabled(JSContext* aCx, JSObject* aObj);
static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
static bool IsNonSubresourceRequest(nsIChannel* aChannel);
+1
View File
@@ -47,3 +47,4 @@ DEPRECATED_OPERATION(PrefixedFullscreenAPI)
DEPRECATED_OPERATION(LenientSetter)
DEPRECATED_OPERATION(FileLastModifiedDate)
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
DEPRECATED_OPERATION(DOMQuadBoundsAttr)
-34
View File
@@ -4206,32 +4206,6 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal)
}
}
#ifdef MOZ_EME
static void
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
{
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aSupports));
if (domMediaElem) {
nsCOMPtr<nsIContent> content(do_QueryInterface(domMediaElem));
MOZ_ASSERT(content, "aSupports is not a content");
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(content.get());
bool* contains = static_cast<bool*>(aContainsEME);
if (mediaElem->GetMediaKeys()) {
*contains = true;
}
}
}
bool
nsDocument::ContainsEMEContent()
{
bool containsEME = false;
EnumerateActivityObservers(CheckIfContainsEMEContent,
static_cast<void*>(&containsEME));
return containsEME;
}
#endif // MOZ_EME
static void
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
{
@@ -8036,14 +8010,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
}
#endif // MOZ_WEBRTC
#ifdef MOZ_EME
// Don't save presentations for documents containing EME content, so that
// CDMs reliably shutdown upon user navigation.
if (ContainsEMEContent()) {
return false;
}
#endif
// Don't save presentations for documents containing MSE content, to
// reduce memory usage.
if (ContainsMSEContent()) {
-4
View File
@@ -1104,10 +1104,6 @@ public:
js::ExpandoAndGeneration mExpandoAndGeneration;
#ifdef MOZ_EME
bool ContainsEMEContent();
#endif
bool ContainsMSEContent();
protected:
+2 -3
View File
@@ -144,9 +144,8 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override;
virtual void SaveSubtreeState() override;
#ifdef DEBUG
+13 -23
View File
@@ -4222,6 +4222,15 @@ nsGlobalWindow::GetPerformance()
return AsInner()->GetPerformance();
}
void
nsPIDOMWindowInner::QueuePerformanceNavigationTiming()
{
CreatePerformanceObjectIfNeeded();
if (mPerformance) {
mPerformance->QueueNavigationTimingEntry();
}
}
void
nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded()
{
@@ -12685,41 +12694,22 @@ nsGlobalWindow::SetTimeout(JSContext* aCx, const nsAString& aHandler,
return SetTimeoutOrInterval(aCx, aHandler, aTimeout, false, aError);
}
static bool
IsInterval(const Optional<int32_t>& aTimeout, int32_t& aResultTimeout)
{
if (aTimeout.WasPassed()) {
aResultTimeout = aTimeout.Value();
return true;
}
// If no interval was specified, treat this like a timeout, to avoid setting
// an interval of 0 milliseconds.
aResultTimeout = 0;
return false;
}
int32_t
nsGlobalWindow::SetInterval(JSContext* aCx, Function& aFunction,
const Optional<int32_t>& aTimeout,
const int32_t aTimeout,
const Sequence<JS::Value>& aArguments,
ErrorResult& aError)
{
int32_t timeout;
bool isInterval = IsInterval(aTimeout, timeout);
return SetTimeoutOrInterval(aCx, aFunction, timeout, aArguments, isInterval,
aError);
return SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments, true, aError);
}
int32_t
nsGlobalWindow::SetInterval(JSContext* aCx, const nsAString& aHandler,
const Optional<int32_t>& aTimeout,
const int32_t aTimeout,
const Sequence<JS::Value>& /* unused */,
ErrorResult& aError)
{
int32_t timeout;
bool isInterval = IsInterval(aTimeout, timeout);
return SetTimeoutOrInterval(aCx, aHandler, timeout, isInterval, aError);
return SetTimeoutOrInterval(aCx, aHandler, aTimeout, true, aError);
}
nsresult
+2 -2
View File
@@ -953,11 +953,11 @@ public:
mozilla::ErrorResult& aError);
void ClearTimeout(int32_t aHandle);
int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction,
const mozilla::dom::Optional<int32_t>& aTimeout,
const int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
const mozilla::dom::Optional<int32_t>& aTimeout,
const int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& /* unused */,
mozilla::ErrorResult& aError);
void ClearInterval(int32_t aHandle);
+9 -11
View File
@@ -37,18 +37,16 @@ class nsHTMLContentSerializer final : public nsXHTMLContentSerializer {
nsAString& aStr) override;
protected:
MOZ_MUST_USE
virtual bool SerializeHTMLAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
const nsAString& aTagNamespaceURI,
nsIAtom* aTagName,
int32_t aNamespace,
nsAString& aStr);
[[nodiscard]] virtual bool SerializeHTMLAttributes(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aTagPrefix,
const nsAString& aTagNamespaceURI,
nsIAtom* aTagName,
int32_t aNamespace,
nsAString& aStr);
MOZ_MUST_USE
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
[[nodiscard]] virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
};
+1 -2
View File
@@ -576,8 +576,7 @@ public:
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
/**
* Check if this content is focusable and in the current tab order.
+2 -2
View File
@@ -2513,8 +2513,8 @@ public:
mozilla::ErrorResult& rv);
virtual mozilla::dom::DOMImplementation*
GetImplementation(mozilla::ErrorResult& rv) = 0;
MOZ_MUST_USE nsresult GetURL(nsString& retval) const;
MOZ_MUST_USE nsresult GetDocumentURI(nsString& retval) const;
[[nodiscard]] nsresult GetURL(nsString& retval) const;
[[nodiscard]] nsresult GetDocumentURI(nsString& retval) const;
// Return the URI for the document.
// The returned value may differ if the document is loaded via XHR, and
// when accessed from chrome privileged script and
+1 -1
View File
@@ -1873,7 +1873,7 @@ public:
aNodeName.SetStringBuffer(nsStringBuffer::FromString(nodeName),
nodeName.Length());
}
MOZ_MUST_USE nsresult GetBaseURI(nsAString& aBaseURI) const;
[[nodiscard]] nsresult GetBaseURI(nsAString& aBaseURI) const;
// Return the base URI for the document.
// The returned value may differ if the document is loaded via XHR, and
// when accessed from chrome privileged script and
+4 -4
View File
@@ -143,7 +143,7 @@ public:
// After getting a notification that an off-thread compilation terminated,
// this function will take the result of the parser and move it to the main
// thread.
MOZ_MUST_USE nsresult JoinCompile(void** aOffThreadToken);
[[nodiscard]] nsresult JoinCompile(void** aOffThreadToken);
// Compile a script contained in a SourceText.
nsresult Compile(JS::CompileOptions& aCompileOptions,
@@ -167,7 +167,7 @@ public:
JSScript* GetScript();
// Execute the compiled script and ignore the return value.
MOZ_MUST_USE nsresult ExecScript();
[[nodiscard]] nsresult ExecScript();
// Execute the compiled script a get the return value.
//
@@ -180,10 +180,10 @@ public:
// compartment given as argument to the ExecutionContext constructor. If the
// caller is in a different compartment, then the out-param value should be
// wrapped by calling |JS_WrapValue|.
MOZ_MUST_USE nsresult
[[nodiscard]] nsresult
ExtractReturnValue(JS::MutableHandle<JS::Value> aRetValue);
MOZ_MUST_USE nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
[[nodiscard]] nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
};
static nsresult CompileModule(JSContext* aCx,
+1 -1
View File
@@ -382,7 +382,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void GetNestedParams(nsTArray<mozilla::dom::MozPluginParameter>& aParameters,
bool aIgnoreCodebase);
MOZ_MUST_USE nsresult BuildParametersArray();
[[nodiscard]] nsresult BuildParametersArray();
/**
* Loads fallback content with the specified FallbackType
+2
View File
@@ -727,6 +727,8 @@ public:
mozilla::dom::Performance* GetPerformance();
void QueuePerformanceNavigationTiming();
bool HasMutationListeners(uint32_t aMutationEventType) const
{
if (!mOuterWindow) {
+2 -2
View File
@@ -136,7 +136,7 @@ public:
* Append the contents of this string fragment to aString
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendTo(nsAString& aString,
const mozilla::fallible_t& aFallible) const {
if (mState.mIs2b) {
@@ -170,7 +170,7 @@ public:
* @param aLength the length of the substring
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendTo(nsAString& aString, int32_t aOffset, int32_t aLength,
const mozilla::fallible_t& aFallible) const
{
+4 -4
View File
@@ -46,7 +46,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
nsAString& aStr,
nsresult& aResult) override;
MOZ_MUST_USE
[[nodiscard]]
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) override;
@@ -70,7 +70,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
virtual void MaybeEnterInPreContent(nsIContent* aNode) override;
virtual void MaybeLeaveFromPreContent(nsIContent* aNode) override;
MOZ_MUST_USE
[[nodiscard]]
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@@ -82,13 +82,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
bool IsFirstChildOfOL(nsIContent* aElement);
MOZ_MUST_USE
[[nodiscard]]
bool SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr);
bool IsShorthandAttr(const nsIAtom* aAttrName,
const nsIAtom* aElementName);
MOZ_MUST_USE
[[nodiscard]]
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
+19 -24
View File
@@ -72,23 +72,21 @@ class nsXMLContentSerializer : public nsIContentSerializer {
/**
* Appends a char16_t character and increments the column position
*/
MOZ_MUST_USE
bool AppendToString(const char16_t aChar,
nsAString& aOutputStr);
[[nodiscard]] bool AppendToString(const char16_t aChar,
nsAString& aOutputStr);
/**
* Appends a nsAString string and increments the column position
*/
MOZ_MUST_USE
bool AppendToString(const nsAString& aStr,
nsAString& aOutputStr);
[[nodiscard]] bool AppendToString(const nsAString& aStr,
nsAString& aOutputStr);
/**
* Appends a string by replacing all line-endings
* by mLineBreak, except in the case of raw output.
* It increments the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringConvertLF(const nsAString& aStr,
nsAString& aOutputStr);
@@ -96,7 +94,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by wrapping it when necessary.
* It updates the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
@@ -104,12 +102,12 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by formating and wrapping it when necessary
* It updates the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
// used by AppendToStringWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -117,7 +115,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringFormatedWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendFormatedWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -126,7 +124,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendWrapped_NonWhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -139,7 +137,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add mLineBreak to the string
* It updates the column position and other flags.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendNewLineToString(nsAString& aOutputStr);
@@ -147,7 +145,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by translating entities
* It doesn't increment the column position
*/
MOZ_MUST_USE
[[nodiscard]]
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr);
@@ -197,7 +195,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsIContent *aOriginalElement,
const nsAString& aTagNamespaceURI);
MOZ_MUST_USE
[[nodiscard]]
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@@ -207,7 +205,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
uint32_t aSkipAttr,
bool aAddNSAttr);
MOZ_MUST_USE
[[nodiscard]]
bool SerializeAttr(const nsAString& aPrefix,
const nsAString& aName,
const nsAString& aValue,
@@ -239,7 +237,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* aElement and aOriginalElement are the same as the corresponding arguments
* to AppendElementStart.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendEndOfElementStart(mozilla::dom::Element* aEleemnt,
mozilla::dom::Element* aOriginalElement,
nsAString& aStr);
@@ -249,7 +247,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* after the serialization ot the start tag.
* (called at the end of AppendElementStart)
*/
MOZ_MUST_USE
[[nodiscard]]
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) { return true; };
@@ -299,17 +297,14 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add intendation. Call only in the case of formating and if the current
* position is at 0. It updates the column position.
*/
MOZ_MUST_USE
bool AppendIndentation(nsAString& aStr);
[[nodiscard]] bool AppendIndentation(nsAString& aStr);
MOZ_MUST_USE
bool IncrIndentation(nsIAtom* aName);
[[nodiscard]] bool IncrIndentation(nsIAtom* aName);
void DecrIndentation(nsIAtom* aName);
// Functions to check for newlines that needs to be added between nodes in
// the root of a document. See mAddNewlineForRootNode
MOZ_MUST_USE
bool MaybeAddNewlineForRootNode(nsAString& aStr);
[[nodiscard]] bool MaybeAddNewlineForRootNode(nsAString& aStr);
void MaybeFlagNewlineForRootNode(nsINode* aNode);
// Functions to check if we enter in or leave from a preformated content
+10 -4
View File
@@ -1037,11 +1037,17 @@ MaybeWrapValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
return MaybeWrapStringValue(cx, rval);
}
if (!rval.isObject()) {
return true;
if (rval.isObject()) {
return MaybeWrapObjectValue(cx, rval);
}
return MaybeWrapObjectValue(cx, rval);
// This could be optimized by checking the zone first, similar to
// the way strings are handled. At present, this is used primarily
// for structured cloning, so avoiding the overhead of JS_WrapValue
// calls is less important than for other types.
if (rval.isBigInt()) {
return JS_WrapValue(cx, rval);
}
return true;
}
namespace binding_detail {
+6 -3
View File
@@ -103,11 +103,13 @@ DOMInterfaces = {
},
'Cache': {
'implicitJSContext': [ 'add', 'addAll' ],
'implicitJSContext': [ 'add', 'addAll', 'match', 'matchAll', 'put',
'delete', 'keys' ],
'nativeType': 'mozilla::dom::cache::Cache',
},
'CacheStorage': {
'implicitJSContext': [ 'match' ],
'nativeType': 'mozilla::dom::cache::CacheStorage',
},
@@ -236,12 +238,10 @@ DOMInterfaces = {
'DOMMatrixReadOnly': {
'headerFile': 'mozilla/dom/DOMMatrix.h',
'concrete': False,
},
'DOMPointReadOnly': {
'headerFile': 'mozilla/dom/DOMPoint.h',
'concrete': False,
},
'DOMRectList': {
@@ -707,6 +707,7 @@ DOMInterfaces = {
'headers': 'headers_',
'referrerPolicy': 'referrerPolicy_'
},
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text' ],
},
'ResizeObservation': {
@@ -731,6 +732,8 @@ DOMInterfaces = {
'Response': {
'binaryNames': { 'headers': 'headers_' },
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text',
'clone', 'cloneUnfiltered' ],
},
'RGBColor': {
+90 -74
View File
@@ -1156,7 +1156,10 @@ class CGHeaders(CGWrapper):
# just include their header if we need to have functions
# taking references to them declared in that header.
headerSet = declareIncludes
headerSet.add("mozilla/dom/TypedArray.h")
if unrolled.isReadableStream():
headerSet.add("mozilla/dom/ReadableStream.h")
else:
headerSet.add("mozilla/dom/TypedArray.h")
else:
try:
typeDesc = config.getDescriptor(unrolled.inner.identifier.name)
@@ -1371,7 +1374,10 @@ def UnionTypes(unionTypes, config):
elif f.isInterface():
if f.isSpiderMonkeyInterface():
headers.add("jsfriendapi.h")
headers.add("mozilla/dom/TypedArray.h")
if f.isReadableStream():
headers.add("mozilla/dom/ReadableStream.h")
else:
headers.add("mozilla/dom/TypedArray.h")
else:
try:
typeDesc = config.getDescriptor(f.inner.identifier.name)
@@ -1457,7 +1463,10 @@ def UnionConversions(unionTypes, config):
elif f.isInterface():
if f.isSpiderMonkeyInterface():
headers.add("jsfriendapi.h")
headers.add("mozilla/dom/TypedArray.h")
if f.isReadableStream():
headers.add("mozilla/dom/ReadableStream.h")
else:
headers.add("mozilla/dom/TypedArray.h")
elif f.inner.isExternal():
try:
typeDesc = config.getDescriptor(f.inner.identifier.name)
@@ -5582,8 +5591,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if type.isSpiderMonkeyInterface():
assert not isEnforceRange and not isClamp
name = type.unroll().name # unroll() because it may be nullable
arrayType = CGGeneric(name)
declType = arrayType
interfaceType = CGGeneric(name)
declType = interfaceType
if type.nullable():
declType = CGTemplatedType("Nullable", declType)
objRef = "${declName}.SetValue()"
@@ -5607,22 +5616,23 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
# This is a bit annoying. In a union we don't want to have a
# holder, since unions don't support that. But if we're optional we
# want to have a holder, so that the callee doesn't see
# Optional<RootedTypedArray<ArrayType> >. So do a holder if we're
# optional and use a RootedTypedArray otherwise.
# Optional<RootedSpiderMonkeyInterface<InterfaceType>>. So do a
# holder if we're optional and use a RootedSpiderMonkeyInterface
# otherwise.
if isOptional:
holderType = CGTemplatedType("TypedArrayRooter", arrayType)
# If our typed array is nullable, this will set the Nullable to
# be not-null, but that's ok because we make an explicit
# SetNull() call on it as needed if our JS value is actually
# null. XXXbz Because "Maybe" takes const refs for constructor
# arguments, we can't pass a reference here; have to pass a
# pointer.
holderType = CGTemplatedType("SpiderMonkeyInterfaceRooter", interfaceType)
# If our SpiderMonkey interface is nullable, this will set the
# Nullable to be not-null, but that's ok because we make an
# explicit SetNull() call on it as needed if our JS value is
# actually null. XXXbz Because "Maybe" takes const refs for
# constructor arguments, we can't pass a reference here; have
# to pass a pointer.
holderArgs = "cx, &%s" % objRef
declArgs = None
else:
holderType = None
holderArgs = None
declType = CGTemplatedType("RootedTypedArray", declType)
declType = CGTemplatedType("RootedSpiderMonkeyInterface", declType)
declArgs = "cx"
else:
holderType = None
@@ -6371,7 +6381,7 @@ def getMaybeWrapValueFuncForType(type):
if type.nullable():
return "MaybeWrapObjectOrNullValue"
return "MaybeWrapObjectValue"
# Spidermonkey interfaces are never DOM objects. Neither are sequences or
# SpiderMonkey interfaces are never DOM objects. Neither are sequences or
# dictionaries, since those are always plain JS objects.
if type.isSpiderMonkeyInterface() or type.isDictionary() or type.isSequence():
if type.nullable():
@@ -6391,7 +6401,8 @@ recordWrapLevel = 0
def getWrapTemplateForType(type, descriptorProvider, result, successCode,
returnsNewObject, exceptionCode, typedArraysAreStructs,
returnsNewObject, exceptionCode,
spiderMonkeyInterfacesAreStructs,
isConstructorRetval=False):
"""
Reflect a C++ value stored in "result", of IDL type "type" into JS. The
@@ -6401,8 +6412,9 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
doing a 'break' if the entire conversion template is inside a block that
the 'break' will exit).
If typedArraysAreStructs is true, then if the type is a typed array,
"result" is one of the dom::TypedArray subclasses, not a JSObject*.
If spiderMonkeyInterfacesAreStructs is true, then if the type is a
SpiderMonkey interface, "result" is one of the
dom::SpiderMonkeyInterfaceObjectStorage subclasses, not a JSObject*.
The resulting string should be used with string.Template. It
needs the following keys when substituting:
@@ -6497,7 +6509,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
recTemplate, recInfall = getWrapTemplateForType(type.inner, descriptorProvider,
"%s.Value()" % result, successCode,
returnsNewObject, exceptionCode,
typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs)
code = fill(
"""
@@ -6529,7 +6541,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
'returnsNewObject': returnsNewObject,
'exceptionCode': exceptionCode,
'obj': "returnArray",
'typedArraysAreStructs': typedArraysAreStructs
'spiderMonkeyInterfacesAreStructs': spiderMonkeyInterfacesAreStructs
})
sequenceWrapLevel -= 1
code = fill(
@@ -6583,7 +6595,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
'returnsNewObject': returnsNewObject,
'exceptionCode': exceptionCode,
'obj': "returnObj",
'typedArraysAreStructs': typedArraysAreStructs
'spiderMonkeyInterfacesAreStructs': spiderMonkeyInterfacesAreStructs
})
recordWrapLevel -= 1
if type.keyType.isByteString():
@@ -6749,7 +6761,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
return (head + _setValue(result, wrapAsType=type), False)
if (type.isObject() or (type.isSpiderMonkeyInterface() and
not typedArraysAreStructs)):
not spiderMonkeyInterfacesAreStructs)):
# See comments in GetOrCreateDOMReflector explaining why we need
# to wrap here.
if type.nullable():
@@ -6768,21 +6780,21 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
if not (type.isUnion() or type.isPrimitive() or type.isDictionary() or
type.isDate() or
(type.isSpiderMonkeyInterface() and typedArraysAreStructs)):
(type.isSpiderMonkeyInterface() and spiderMonkeyInterfacesAreStructs)):
raise TypeError("Need to learn to wrap %s" % type)
if type.nullable():
recTemplate, recInfal = getWrapTemplateForType(type.inner, descriptorProvider,
"%s.Value()" % result, successCode,
returnsNewObject, exceptionCode,
typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs)
return ("if (%s.IsNull()) {\n" % result +
indent(setNull()) +
"}\n" +
recTemplate, recInfal)
if type.isSpiderMonkeyInterface():
assert typedArraysAreStructs
assert spiderMonkeyInterfacesAreStructs
# See comments in GetOrCreateDOMReflector explaining why we need
# to wrap here.
# NB: setObject(..., some-object-type) calls JS_WrapValue(), so is fallible
@@ -6864,7 +6876,7 @@ def wrapForType(type, descriptorProvider, templateValues):
templateValues.get('successCode', None),
templateValues.get('returnsNewObject', False),
templateValues.get('exceptionCode', "return false;\n"),
templateValues.get('typedArraysAreStructs', False),
templateValues.get('spiderMonkeyInterfacesAreStructs', False),
isConstructorRetval=templateValues.get('isConstructorRetval', False))[0]
defaultValues = {'obj': 'obj'}
@@ -8193,10 +8205,10 @@ class CGMethodCall(CGThing):
# "object" arg.
# First grab all the overloads that have a non-callback interface
# (which includes typed arrays and arraybuffers) at the
# distinguishing index. We can also include the ones that have an
# "object" here, since if those are present no other object-typed
# argument will be.
# (which includes SpiderMonkey interfaces) at the distinguishing
# index. We can also include the ones that have an "object" here,
# since if those are present no other object-typed argument will
# be.
objectSigs = [
s for s in possibleSignatures
if (distinguishingType(s).isObject() or
@@ -8227,16 +8239,17 @@ class CGMethodCall(CGThing):
# There might be more than one thing in objectSigs; we need to check
# which ones we unwrap to.
if len(objectSigs) > 0:
# Here it's enough to guard on our argument being an object. The
# code for unwrapping non-callback interfaces, typed arrays,
# sequences, and Dates will just bail out and move on to
# the next overload if the object fails to unwrap correctly,
# while "object" accepts any object anyway. We could even not
# do the isObject() check up front here, but in cases where we
# have multiple object overloads it makes sense to do it only
# once instead of for each overload. That will also allow the
# unwrapping test to skip having to do codegen for the
# null-or-undefined case, which we already handled above.
# Here it's enough to guard on our argument being an object.
# The code for unwrapping non-callback interfaces, spiderMonkey
# interfaces, sequences, and Dates will just bail out and move
# on to the next overload if the object fails to unwrap
# correctly, while "object" accepts any object anyway. We
# could even not do the isObject() check up front here, but in
# cases where we have multiple object overloads it makes sense
# to do it only once instead of for each overload. That will
# also allow the unwrapping test to skip having to do codegen
# for the null-or-undefined case, which we already handled
# above.
caseBody.append(CGGeneric("if (%s.isObject()) {\n" %
distinguishingArg))
for sig in objectSigs:
@@ -10239,7 +10252,7 @@ class CGUnionStruct(CGThing):
"jsvalHandle": "rval",
"obj": "scopeObj",
"result": val,
"typedArraysAreStructs": True
"spiderMonkeyInterfacesAreStructs": True
})
return CGGeneric(wrapCode)
@@ -13219,7 +13232,7 @@ class CGDictionary(CGThing):
# 'obj' can just be allowed to be the string "obj", since that
# will be our dictionary object, which is presumably itself in
# the right scope.
'typedArraysAreStructs': True
'spiderMonkeyInterfacesAreStructs': True
})
conversion = CGGeneric(innerTemplate)
conversion = CGWrapper(conversion,
@@ -13679,7 +13692,7 @@ class ForwardDeclarationBuilder:
except NoSuchDescriptorError:
pass
# Note: Spidermonkey interfaces are typedefs, so can't be
# Note: SpiderMonkey interfaces are typedefs, so can't be
# forward-declared
elif t.isPromise():
self.addInMozillaDom("Promise")
@@ -13988,7 +14001,7 @@ class CGBindingRoot(CGThing):
return {desc.getDescriptor(desc.interface.parent.identifier.name)}
for x in dependencySortObjects(jsImplemented, getParentDescriptor,
lambda d: d.interface.identifier.name):
cgthings.append(CGCallbackInterface(x, typedArraysAreStructs=True))
cgthings.append(CGCallbackInterface(x, spiderMonkeyInterfacesAreStructs=True))
cgthings.append(CGJSImplClass(x))
# And make sure we have the right number of newlines at the end
@@ -14050,14 +14063,13 @@ class CGBindingRoot(CGThing):
class CGNativeMember(ClassMethod):
def __init__(self, descriptorProvider, member, name, signature, extendedAttrs,
breakAfter=True, passJSBitsAsNeeded=True, visibility="public",
typedArraysAreStructs=True, variadicIsSequence=False,
resultNotAddRefed=False,
virtual=False,
override=False):
spiderMonkeyInterfacesAreStructs=True,
variadicIsSequence=False, resultNotAddRefed=False,
virtual=False, override=False):
"""
If typedArraysAreStructs is false, typed arrays will be passed as
JS::Handle<JSObject*>. If it's true they will be passed as one of the
dom::TypedArray subclasses.
If spiderMonkeyInterfacesAreStructs is false, SpiderMonkey interfaces
will be passed as JS::Handle<JSObject*>. If it's true they will be
passed as one of the dom::SpiderMonkeyInterfaceObjectStorage subclasses.
If passJSBitsAsNeeded is false, we don't automatically pass in a
JSContext* or a JSObject* based on the return and argument types. We
@@ -14068,7 +14080,7 @@ class CGNativeMember(ClassMethod):
self.extendedAttrs = extendedAttrs
self.resultAlreadyAddRefed = not resultNotAddRefed
self.passJSBitsAsNeeded = passJSBitsAsNeeded
self.typedArraysAreStructs = typedArraysAreStructs
self.spiderMonkeyInterfacesAreStructs = spiderMonkeyInterfacesAreStructs
self.variadicIsSequence = variadicIsSequence
breakAfterSelf = "\n" if breakAfter else ""
ClassMethod.__init__(self, name,
@@ -14375,7 +14387,7 @@ class CGNativeMember(ClassMethod):
False, False)
if type.isSpiderMonkeyInterface():
if not self.typedArraysAreStructs:
if not self.spiderMonkeyInterfacesAreStructs:
return "JS::Handle<JSObject*>", False, False
# Unroll for the name, in case we're nullable.
@@ -15547,16 +15559,16 @@ class CGFastCallback(CGClass):
class CGCallbackInterface(CGCallback):
def __init__(self, descriptor, typedArraysAreStructs=False):
def __init__(self, descriptor, spiderMonkeyInterfacesAreStructs=False):
iface = descriptor.interface
attrs = [m for m in iface.members if m.isAttr() and not m.isStatic()]
getters = [CallbackGetter(a, descriptor, typedArraysAreStructs)
getters = [CallbackGetter(a, descriptor, spiderMonkeyInterfacesAreStructs)
for a in attrs]
setters = [CallbackSetter(a, descriptor, typedArraysAreStructs)
setters = [CallbackSetter(a, descriptor, spiderMonkeyInterfacesAreStructs)
for a in attrs if not a.readonly]
methods = [m for m in iface.members
if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()]
methods = [CallbackOperation(m, sig, descriptor, typedArraysAreStructs)
methods = [CallbackOperation(m, sig, descriptor, spiderMonkeyInterfacesAreStructs)
for m in methods for sig in m.signatures()]
if iface.isJSImplemented() and iface.ctor():
sigs = descriptor.interface.ctor().signatures()
@@ -15601,7 +15613,8 @@ class CallbackMember(CGNativeMember):
# CallSetup already handled the unmark-gray bits for us. we don't have
# anything better to use for 'obj', really...
def __init__(self, sig, name, descriptorProvider, needThisHandling,
rethrowContentException=False, typedArraysAreStructs=False,
rethrowContentException=False,
spiderMonkeyInterfacesAreStructs=False,
wrapScope='CallbackKnownNotGray()'):
"""
needThisHandling is True if we need to be able to accept a specified
@@ -15636,7 +15649,7 @@ class CallbackMember(CGNativeMember):
extendedAttrs={},
passJSBitsAsNeeded=False,
visibility=visibility,
typedArraysAreStructs=typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
# We have to do all the generation of our body now, because
# the caller relies on us throwing if we can't manage it.
self.exceptionCode = ("aRv.Throw(NS_ERROR_UNEXPECTED);\n"
@@ -15753,7 +15766,7 @@ class CallbackMember(CGNativeMember):
'obj': self.wrapScope,
'returnsNewObject': False,
'exceptionCode': self.exceptionCode,
'typedArraysAreStructs': self.typedArraysAreStructs
'spiderMonkeyInterfacesAreStructs': self.spiderMonkeyInterfacesAreStructs
})
except MethodNotNewObjectError as err:
raise TypeError("%s being passed as an argument to %s but is not "
@@ -15857,10 +15870,11 @@ class CallbackMember(CGNativeMember):
class CallbackMethod(CallbackMember):
def __init__(self, sig, name, descriptorProvider, needThisHandling,
rethrowContentException=False, typedArraysAreStructs=False):
rethrowContentException=False,
spiderMonkeyInterfacesAreStructs=False):
CallbackMember.__init__(self, sig, name, descriptorProvider,
needThisHandling, rethrowContentException,
typedArraysAreStructs=typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
def getRvalDecl(self):
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
@@ -15919,12 +15933,12 @@ class CallbackOperationBase(CallbackMethod):
"""
def __init__(self, signature, jsName, nativeName, descriptor,
singleOperation, rethrowContentException=False,
typedArraysAreStructs=False):
spiderMonkeyInterfacesAreStructs=False):
self.singleOperation = singleOperation
self.methodName = descriptor.binaryNameFor(jsName)
CallbackMethod.__init__(self, signature, nativeName, descriptor,
singleOperation, rethrowContentException,
typedArraysAreStructs=typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
def getThisDecl(self):
if not self.singleOperation:
@@ -15975,7 +15989,8 @@ class CallbackOperation(CallbackOperationBase):
"""
Codegen actual WebIDL operations on callback interfaces.
"""
def __init__(self, method, signature, descriptor, typedArraysAreStructs):
def __init__(self, method, signature, descriptor,
spiderMonkeyInterfacesAreStructs):
self.ensureASCIIName(method)
self.method = method
jsName = method.identifier.name
@@ -15984,7 +15999,7 @@ class CallbackOperation(CallbackOperationBase):
MakeNativeName(descriptor.binaryNameFor(jsName)),
descriptor, descriptor.interface.isSingleOperationInterface(),
rethrowContentException=descriptor.interface.isJSImplemented(),
typedArraysAreStructs=typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
def getPrettyName(self):
return "%s.%s" % (self.descriptorProvider.interface.identifier.name,
@@ -15995,13 +16010,14 @@ class CallbackAccessor(CallbackMember):
"""
Shared superclass for CallbackGetter and CallbackSetter.
"""
def __init__(self, attr, sig, name, descriptor, typedArraysAreStructs):
def __init__(self, attr, sig, name, descriptor,
spiderMonkeyInterfacesAreStructs):
self.ensureASCIIName(attr)
self.attrName = attr.identifier.name
CallbackMember.__init__(self, sig, name, descriptor,
needThisHandling=False,
rethrowContentException=descriptor.interface.isJSImplemented(),
typedArraysAreStructs=typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs=spiderMonkeyInterfacesAreStructs)
def getPrettyName(self):
return "%s.%s" % (self.descriptorProvider.interface.identifier.name,
@@ -16009,12 +16025,12 @@ class CallbackAccessor(CallbackMember):
class CallbackGetter(CallbackAccessor):
def __init__(self, attr, descriptor, typedArraysAreStructs):
def __init__(self, attr, descriptor, spiderMonkeyInterfacesAreStructs):
CallbackAccessor.__init__(self, attr,
(attr.type, []),
callbackGetterName(attr, descriptor),
descriptor,
typedArraysAreStructs)
spiderMonkeyInterfacesAreStructs)
def getRvalDecl(self):
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
@@ -16036,12 +16052,12 @@ class CallbackGetter(CallbackAccessor):
class CallbackSetter(CallbackAccessor):
def __init__(self, attr, descriptor, typedArraysAreStructs):
def __init__(self, attr, descriptor, spiderMonkeyInterfacesAreStructs):
CallbackAccessor.__init__(self, attr,
(BuiltinTypes[IDLBuiltinType.Types.void],
[FakeArgument(attr.type, attr)]),
callbackSetterName(attr, descriptor),
descriptor, typedArraysAreStructs)
descriptor, spiderMonkeyInterfacesAreStructs)
def getRvalDecl(self):
# We don't need an rval
@@ -16076,7 +16092,7 @@ class CGJSImplInitOperation(CallbackOperationBase):
"__init", "__Init", descriptor,
singleOperation=False,
rethrowContentException=True,
typedArraysAreStructs=True)
spiderMonkeyInterfacesAreStructs=True)
def getPrettyName(self):
return "__init"
+3
View File
@@ -100,6 +100,9 @@ MSG_DEF(MSG_TIME_VALUE_OUT_OF_RANGE, 1, JSEXN_TYPEERR, "{0} is outside the suppo
MSG_DEF(MSG_ONLY_IF_CACHED_WITHOUT_SAME_ORIGIN, 1, JSEXN_TYPEERR, "Request mode '{0}' was used, but request cache mode 'only-if-cached' can only be used with request mode 'same-origin'.")
MSG_DEF(MSG_THRESHOLD_RANGE_ERROR, 0, JSEXN_RANGEERR, "Threshold values must all be in the range [0, 1].")
MSG_DEF(MSG_CACHE_OPEN_FAILED, 0, JSEXN_TYPEERR, "CacheStorage.open() failed to access the storage system.")
MSG_DEF(MSG_MATRIX_INIT_CONFLICTING_VALUE, 2, JSEXN_TYPEERR, "Matrix init unexpectedly got different values for '{0}' and '{1}'.")
MSG_DEF(MSG_MATRIX_INIT_EXCEEDS_2D, 1, JSEXN_TYPEERR, "Matrix init has an unexpected 3D element '{0}' which cannot coexist with 'is2D: true'.")
MSG_DEF(MSG_MATRIX_INIT_LENGTH_WRONG, 1, JSEXN_TYPEERR, "Matrix init sequence must have a length of 6 or 16 (actual value: {0})")
MSG_DEF(MSG_NO_NEGATIVE_ATTR, 1, JSEXN_TYPEERR, "Given attribute {0} cannot be negative.")
MSG_DEF(MSG_PMO_NO_SEPARATE_ENDMARK, 0, JSEXN_TYPEERR, "Cannot provide separate endMark argument if PerformanceMeasureOptions argument is given.")
MSG_DEF(MSG_PMO_MISSING_STARTENDMARK, 0, JSEXN_TYPEERR, "PerformanceMeasureOptions must have start and/or end member.")
+28
View File
@@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_dom_ReadableStream_h
#define mozilla_dom_ReadableStream_h
#include "mozilla/dom/SpiderMonkeyInterface.h"
namespace mozilla {
namespace dom {
struct ReadableStream : public SpiderMonkeyInterfaceObjectStorage
{
inline bool Init(JSObject* obj)
{
MOZ_ASSERT(!inited());
mImplObj = mWrappedObj = js::UnwrapReadableStream(obj);
return inited();
}
};
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_ReadableStream_h */
+144
View File
@@ -0,0 +1,144 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_dom_SpiderMonkeyInterface_h
#define mozilla_dom_SpiderMonkeyInterface_h
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/TracingAPI.h"
namespace mozilla {
namespace dom {
/*
* Class that just handles the JSObject storage and tracing for spidermonkey
* interfaces
*/
struct SpiderMonkeyInterfaceObjectStorage
{
protected:
JSObject* mImplObj;
JSObject* mWrappedObj;
SpiderMonkeyInterfaceObjectStorage()
: mImplObj(nullptr),
mWrappedObj(nullptr)
{
}
SpiderMonkeyInterfaceObjectStorage(SpiderMonkeyInterfaceObjectStorage&& aOther)
: mImplObj(aOther.mImplObj),
mWrappedObj(aOther.mWrappedObj)
{
aOther.mImplObj = nullptr;
aOther.mWrappedObj = nullptr;
}
public:
inline void TraceSelf(JSTracer* trc)
{
JS::UnsafeTraceRoot(trc, &mImplObj, "SpiderMonkeyInterfaceObjectStorage.mImplObj");
JS::UnsafeTraceRoot(trc, &mWrappedObj, "SpiderMonkeyInterfaceObjectStorage.mWrappedObj");
}
inline bool inited() const
{
return !!mImplObj;
}
inline bool WrapIntoNewCompartment(JSContext* cx)
{
return JS_WrapObject(cx,
JS::MutableHandle<JSObject*>::fromMarkedLocation(&mWrappedObj));
}
inline JSObject *Obj() const
{
MOZ_ASSERT(inited());
return mWrappedObj;
}
private:
SpiderMonkeyInterfaceObjectStorage(const SpiderMonkeyInterfaceObjectStorage&) = delete;
};
// A class for rooting an existing SpiderMonkey Interface struct
template<typename InterfaceType>
class MOZ_RAII SpiderMonkeyInterfaceRooter : private JS::CustomAutoRooter
{
public:
template <typename CX>
SpiderMonkeyInterfaceRooter(const CX& cx,
InterfaceType* aInterface MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInterface(aInterface)
{
}
virtual void trace(JSTracer* trc) override
{
mInterface->TraceSelf(trc);
}
private:
SpiderMonkeyInterfaceObjectStorage* const mInterface;
};
// And a specialization for dealing with nullable SpiderMonkey interfaces
template<typename Inner> struct Nullable;
template<typename InterfaceType>
class MOZ_RAII SpiderMonkeyInterfaceRooter<Nullable<InterfaceType>> :
private JS::CustomAutoRooter
{
public:
template <typename CX>
SpiderMonkeyInterfaceRooter(const CX& cx,
Nullable<InterfaceType>* aInterface MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInterface(aInterface)
{
}
virtual void trace(JSTracer* trc) override
{
if (!mInterface->IsNull()) {
mInterface->Value().TraceSelf(trc);
}
}
private:
Nullable<InterfaceType>* const mInterface;
};
// Class for easily setting up a rooted SpiderMonkey interface object on the
// stack
template<typename InterfaceType>
class MOZ_RAII RootedSpiderMonkeyInterface final : public InterfaceType,
private SpiderMonkeyInterfaceRooter<InterfaceType>
{
public:
template <typename CX>
explicit RootedSpiderMonkeyInterface(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: InterfaceType(),
SpiderMonkeyInterfaceRooter<InterfaceType>(cx, this
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
template <typename CX>
RootedSpiderMonkeyInterface(const CX& cx, JSObject* obj MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: InterfaceType(obj),
SpiderMonkeyInterfaceRooter<InterfaceType>(cx, this
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
};
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_SpiderMonkeyInterface_h */
+23 -23
View File
@@ -24,7 +24,7 @@ class Promise;
// JSContext.
// Accept strings.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsAString& aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -35,7 +35,7 @@ ToJSValue(JSContext* aCx,
// desirable. So make this a template that only gets used if the argument type
// is actually boolean
template<typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsSame<T, bool>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -123,7 +123,7 @@ ToJSValue(JSContext* aCx,
}
// Accept CallbackObjects
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx,
CallbackObject& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -139,7 +139,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects).
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T& aArgument,
@@ -155,7 +155,7 @@ ToJSValue(JSContext* aCx,
// Accept typed arrays built from appropriate nsTArray values
template<typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const TypedArrayCreator<T>& aArgument,
@@ -175,7 +175,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// DOM File).
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value, bool>::Type
@@ -193,7 +193,7 @@ ToJSValue(JSContext* aCx,
// Accept nsRefPtr/nsCOMPtr
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsCOMPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -202,7 +202,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const RefPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -211,7 +211,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const NonNull<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -221,7 +221,7 @@ ToJSValue(JSContext* aCx,
// Accept WebIDL dictionaries
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -231,7 +231,7 @@ ToJSValue(JSContext* aCx,
}
// Accept existing JS values (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -240,7 +240,7 @@ ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
}
// Accept existing JS values on the Heap (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -249,7 +249,7 @@ ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
}
// Accept existing rooted JS values (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -259,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
// Accept existing rooted JS objects (which may not be same-compartment with
// us).
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -269,7 +269,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
// Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -277,14 +277,14 @@ ToJSValue(JSContext* aCx,
// Accept ErrorResult, for use in rejections, and create an exception
// representing the failure. Note, the ErrorResult must indicate a failure
// with aArgument.Failure() returning true.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept owning WebIDL unions.
template <typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -296,7 +296,7 @@ ToJSValue(JSContext* aCx,
// Accept pointers to other things we accept
template <typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsPointer<T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -306,14 +306,14 @@ ToJSValue(JSContext* aCx,
}
// Accept Promise objects, which need special handling.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
Promise& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept arrays of other things we accept
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
T* aArguments,
size_t aLength,
@@ -340,7 +340,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -350,7 +350,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const FallibleTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -360,7 +360,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T, int N>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const T(&aArgument)[N],
JS::MutableHandle<JS::Value> aValue)
+7 -127
View File
@@ -6,51 +6,15 @@
#ifndef mozilla_dom_TypedArray_h
#define mozilla_dom_TypedArray_h
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/RootingAPI.h"
#include "js/TracingAPI.h"
#include "mozilla/Attributes.h"
#include "mozilla/Move.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/SpiderMonkeyInterface.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace dom {
/*
* Class that just handles the JSObject storage and tracing for typed arrays
*/
struct TypedArrayObjectStorage : AllTypedArraysBase {
protected:
JSObject* mTypedObj;
JSObject* mWrappedObj;
TypedArrayObjectStorage()
: mTypedObj(nullptr),
mWrappedObj(nullptr)
{
}
TypedArrayObjectStorage(TypedArrayObjectStorage&& aOther)
: mTypedObj(aOther.mTypedObj),
mWrappedObj(aOther.mWrappedObj)
{
aOther.mTypedObj = nullptr;
aOther.mWrappedObj = nullptr;
}
public:
inline void TraceSelf(JSTracer* trc)
{
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
JS::UnsafeTraceRoot(trc, &mWrappedObj, "TypedArray.mWrappedObj");
}
private:
TypedArrayObjectStorage(const TypedArrayObjectStorage&) = delete;
};
/*
* Various typed array classes for argument conversion. We have a base class
* that has a way of initializing a TypedArray from an existing typed array, and
@@ -60,7 +24,9 @@ private:
template<typename T,
JSObject* UnwrapArray(JSObject*),
void GetLengthAndDataAndSharedness(JSObject*, uint32_t*, bool*, T**)>
struct TypedArray_base : public TypedArrayObjectStorage {
struct TypedArray_base : public SpiderMonkeyInterfaceObjectStorage,
AllTypedArraysBase
{
typedef T element_type;
TypedArray_base()
@@ -72,7 +38,7 @@ struct TypedArray_base : public TypedArrayObjectStorage {
}
TypedArray_base(TypedArray_base&& aOther)
: TypedArrayObjectStorage(Move(aOther)),
: SpiderMonkeyInterfaceObjectStorage(Move(aOther)),
mData(aOther.mData),
mLength(aOther.mLength),
mShared(aOther.mShared),
@@ -94,14 +60,10 @@ public:
inline bool Init(JSObject* obj)
{
MOZ_ASSERT(!inited());
mTypedObj = mWrappedObj = UnwrapArray(obj);
mImplObj = mWrappedObj = UnwrapArray(obj);
return inited();
}
inline bool inited() const {
return !!mTypedObj;
}
// About shared memory:
//
// Any DOM TypedArray as well as any DOM ArrayBufferView that does
@@ -173,22 +135,11 @@ public:
return mLength;
}
inline JSObject *Obj() const {
MOZ_ASSERT(inited());
return mWrappedObj;
}
inline bool WrapIntoNewCompartment(JSContext* cx)
{
return JS_WrapObject(cx,
JS::MutableHandle<JSObject*>::fromMarkedLocation(&mWrappedObj));
}
inline void ComputeLengthAndData() const
{
MOZ_ASSERT(inited());
MOZ_ASSERT(!mComputed);
GetLengthAndDataAndSharedness(mTypedObj, &mLength, &mShared, &mData);
GetLengthAndDataAndSharedness(mImplObj, &mLength, &mShared, &mData);
mComputed = true;
}
@@ -363,77 +314,6 @@ class TypedArrayCreator
const ArrayType& mArray;
};
// A class for rooting an existing TypedArray struct
template<typename ArrayType>
class MOZ_RAII TypedArrayRooter : private JS::CustomAutoRooter
{
public:
template <typename CX>
TypedArrayRooter(const CX& cx,
ArrayType* aArray MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mArray(aArray)
{
}
virtual void trace(JSTracer* trc) override
{
mArray->TraceSelf(trc);
}
private:
TypedArrayObjectStorage* const mArray;
};
// And a specialization for dealing with nullable typed arrays
template<typename Inner> struct Nullable;
template<typename ArrayType>
class MOZ_RAII TypedArrayRooter<Nullable<ArrayType> > :
private JS::CustomAutoRooter
{
public:
template <typename CX>
TypedArrayRooter(const CX& cx,
Nullable<ArrayType>* aArray MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mArray(aArray)
{
}
virtual void trace(JSTracer* trc) override
{
if (!mArray->IsNull()) {
mArray->Value().TraceSelf(trc);
}
}
private:
Nullable<ArrayType>* const mArray;
};
// Class for easily setting up a rooted typed array object on the stack
template<typename ArrayType>
class MOZ_RAII RootedTypedArray final : public ArrayType,
private TypedArrayRooter<ArrayType>
{
public:
template <typename CX>
explicit RootedTypedArray(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
ArrayType(),
TypedArrayRooter<ArrayType>(cx, this
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
template <typename CX>
RootedTypedArray(const CX& cx, JSObject* obj MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
ArrayType(obj),
TypedArrayRooter<ArrayType>(cx, this
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
{
}
};
} // namespace dom
} // namespace mozilla
+2
View File
@@ -38,9 +38,11 @@ EXPORTS.mozilla.dom += [
'NonRefcountedDOMObject.h',
'Nullable.h',
'PrimitiveConversions.h',
'ReadableStream.h',
'Record.h',
'RootedDictionary.h',
'SimpleGlobalObject.h',
'SpiderMonkeyInterface.h',
'StructuredClone.h',
'ToJSValue.h',
'TypedArray.h',
+31 -8
View File
@@ -2054,6 +2054,9 @@ class IDLType(IDLObject):
def isRecord(self):
return False
def isReadableStream(self):
return False
def isArrayBuffer(self):
return False
@@ -2081,12 +2084,12 @@ class IDLType(IDLObject):
def isSpiderMonkeyInterface(self):
""" Returns a boolean indicating whether this type is an 'interface'
type that is implemented in Spidermonkey. At the moment, this
only returns true for the types from the TypedArray spec. """
type that is implemented in SpiderMonkey. """
return self.isInterface() and (self.isArrayBuffer() or
self.isArrayBufferView() or
self.isSharedArrayBuffer() or
self.isTypedArray())
self.isTypedArray() or
self.isReadableStream())
def isDictionary(self):
return False
@@ -2275,6 +2278,9 @@ class IDLNullableType(IDLParameterizedType):
def isRecord(self):
return self.inner.isRecord()
def isReadableStream(self):
return self.inner.isReadableStream()
def isArrayBuffer(self):
return self.inner.isArrayBuffer()
@@ -2634,6 +2640,9 @@ class IDLTypedefType(IDLType):
def isRecord(self):
return self.inner.isRecord()
def isReadableStream(self):
return self.inner.isReadableStream()
def isDictionary(self):
return self.inner.isDictionary()
@@ -2945,7 +2954,8 @@ class IDLBuiltinType(IDLType):
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
'Float64Array',
'ReadableStream',
)
TagLookup = {
@@ -2980,7 +2990,8 @@ class IDLBuiltinType(IDLType):
Types.Int32Array: IDLType.Tags.interface,
Types.Uint32Array: IDLType.Tags.interface,
Types.Float32Array: IDLType.Tags.interface,
Types.Float64Array: IDLType.Tags.interface
Types.Float64Array: IDLType.Tags.interface,
Types.ReadableStream: IDLType.Tags.interface,
}
def __init__(self, location, name, type):
@@ -3027,6 +3038,9 @@ class IDLBuiltinType(IDLType):
return (self._typeTag >= IDLBuiltinType.Types.Int8Array and
self._typeTag <= IDLBuiltinType.Types.Float64Array)
def isReadableStream(self):
return self._typeTag == IDLBuiltinType.Types.ReadableStream
def isInterface(self):
# TypedArray things are interface types per the TypedArray spec,
# but we handle them as builtins because SpiderMonkey implements
@@ -3034,7 +3048,8 @@ class IDLBuiltinType(IDLType):
return (self.isArrayBuffer() or
self.isArrayBufferView() or
self.isSharedArrayBuffer() or
self.isTypedArray())
self.isTypedArray() or
self.isReadableStream())
def isNonCallbackInterface(self):
# All the interfaces we can be are non-callback
@@ -3104,6 +3119,7 @@ class IDLBuiltinType(IDLType):
# that's not an ArrayBuffer or a callback interface
(self.isArrayBuffer() and not other.isArrayBuffer()) or
(self.isSharedArrayBuffer() and not other.isSharedArrayBuffer()) or
(self.isReadableStream() and not other.isReadableStream()) or
# ArrayBufferView is distinguishable from everything
# that's not an ArrayBufferView or typed array.
(self.isArrayBufferView() and not other.isArrayBufferView() and
@@ -3213,7 +3229,10 @@ BuiltinTypes = {
IDLBuiltinType.Types.Float32Array),
IDLBuiltinType.Types.Float64Array:
IDLBuiltinType(BuiltinLocation("<builtin type>"), "Float64Array",
IDLBuiltinType.Types.Float64Array)
IDLBuiltinType.Types.Float64Array),
IDLBuiltinType.Types.ReadableStream:
IDLBuiltinType(BuiltinLocation("<builtin type>"), "ReadableStream",
IDLBuiltinType.Types.ReadableStream),
}
@@ -5232,7 +5251,8 @@ class Tokenizer(object):
"maplike": "MAPLIKE",
"setlike": "SETLIKE",
"iterable": "ITERABLE",
"namespace": "NAMESPACE"
"namespace": "NAMESPACE",
"ReadableStream": "READABLESTREAM",
}
tokens.extend(keywords.values())
@@ -6420,6 +6440,7 @@ class Parser(Tokenizer):
NonAnyType : PrimitiveType Null
| ARRAYBUFFER Null
| SHAREDARRAYBUFFER Null
| READABLESTREAM Null
| OBJECT Null
"""
if p[1] == "object":
@@ -6428,6 +6449,8 @@ class Parser(Tokenizer):
type = BuiltinTypes[IDLBuiltinType.Types.ArrayBuffer]
elif p[1] == "SharedArrayBuffer":
type = BuiltinTypes[IDLBuiltinType.Types.SharedArrayBuffer]
elif p[1] == "ReadableStream":
type = BuiltinTypes[IDLBuiltinType.Types.ReadableStream]
else:
type = BuiltinTypes[p[1]]
+4 -4
View File
@@ -289,9 +289,9 @@ MatchInPutList(InternalRequest* aRequest,
} // namespace
void
AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
SchemeAction aSchemeAction, Response& aResponse,
ErrorResult& aRv)
AutoChildOpArgs::Add(JSContext* aCx, InternalRequest* aRequest,
BodyAction aBodyAction, SchemeAction aSchemeAction,
Response& aResponse, ErrorResult& aRv)
{
MOZ_DIAGNOSTIC_ASSERT(!mSent);
@@ -329,7 +329,7 @@ AutoChildOpArgs::Add(InternalRequest* aRequest, BodyAction aBodyAction,
mTypeUtils->ToCacheRequest(pair.request(), aRequest, aBodyAction,
aSchemeAction, mStreamCleanupList, aRv);
if (!aRv.Failed()) {
mTypeUtils->ToCacheResponse(pair.response(), aResponse,
mTypeUtils->ToCacheResponse(aCx, pair.response(), aResponse,
mStreamCleanupList, aRv);
}
+1 -1
View File
@@ -55,7 +55,7 @@ public:
void Add(InternalRequest* aRequest, BodyAction aBodyAction,
SchemeAction aSchemeAction, ErrorResult& aRv);
void Add(InternalRequest* aRequest, BodyAction aBodyAction,
void Add(JSContext* aCx, InternalRequest* aRequest, BodyAction aBodyAction,
SchemeAction aSchemeAction, Response& aResponse, ErrorResult& aRv);
const CacheOpArgs& SendAsOpArgs();
+23 -17
View File
@@ -184,7 +184,10 @@ public:
// Now store the unwrapped Response list in the Cache.
ErrorResult result;
RefPtr<Promise> put = mCache->PutAll(mRequestList, responseList, result);
// TODO: Here we use the JSContext as received by the ResolvedCallback, and
// its state could be the wrong one. The spec doesn't say anything
// about it, yet (bug 1384006)
RefPtr<Promise> put = mCache->PutAll(aCx, mRequestList, responseList, result);
if (NS_WARN_IF(result.Failed())) {
// TODO: abort the fetch requests we have running (bug 1157434)
mPromise->MaybeReject(result);
@@ -245,7 +248,7 @@ Cache::Cache(nsIGlobalObject* aGlobal, CacheChild* aActor)
}
already_AddRefed<Promise>
Cache::Match(const RequestOrUSVString& aRequest,
Cache::Match(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv)
{
if (NS_WARN_IF(!mActor)) {
@@ -255,7 +258,8 @@ Cache::Match(const RequestOrUSVString& aRequest,
CacheChild::AutoLock actorLock(mActor);
RefPtr<InternalRequest> ir = ToInternalRequest(aRequest, IgnoreBody, aRv);
RefPtr<InternalRequest> ir =
ToInternalRequest(aCx, aRequest, IgnoreBody, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@@ -274,7 +278,7 @@ Cache::Match(const RequestOrUSVString& aRequest,
}
already_AddRefed<Promise>
Cache::MatchAll(const Optional<RequestOrUSVString>& aRequest,
Cache::MatchAll(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv)
{
if (NS_WARN_IF(!mActor)) {
@@ -290,8 +294,8 @@ Cache::MatchAll(const Optional<RequestOrUSVString>& aRequest,
AutoChildOpArgs args(this, CacheMatchAllArgs(void_t(), params), 1);
if (aRequest.WasPassed()) {
RefPtr<InternalRequest> ir = ToInternalRequest(aRequest.Value(),
IgnoreBody, aRv);
RefPtr<InternalRequest> ir = ToInternalRequest(aCx, aRequest.Value(),
IgnoreBody, aRv);
if (aRv.Failed()) {
return nullptr;
}
@@ -390,8 +394,8 @@ Cache::AddAll(JSContext* aContext,
}
already_AddRefed<Promise>
Cache::Put(const RequestOrUSVString& aRequest, Response& aResponse,
ErrorResult& aRv)
Cache::Put(JSContext* aCx, const RequestOrUSVString& aRequest,
Response& aResponse, ErrorResult& aRv)
{
if (NS_WARN_IF(!mActor)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@@ -404,14 +408,14 @@ Cache::Put(const RequestOrUSVString& aRequest, Response& aResponse,
return nullptr;
}
RefPtr<InternalRequest> ir = ToInternalRequest(aRequest, ReadBody, aRv);
RefPtr<InternalRequest> ir = ToInternalRequest(aCx, aRequest, ReadBody, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
AutoChildOpArgs args(this, CachePutAllArgs(), 1);
args.Add(ir, ReadBody, TypeErrorOnInvalidScheme,
args.Add(aCx, ir, ReadBody, TypeErrorOnInvalidScheme,
aResponse, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
@@ -421,7 +425,7 @@ Cache::Put(const RequestOrUSVString& aRequest, Response& aResponse,
}
already_AddRefed<Promise>
Cache::Delete(const RequestOrUSVString& aRequest,
Cache::Delete(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv)
{
if (NS_WARN_IF(!mActor)) {
@@ -431,7 +435,8 @@ Cache::Delete(const RequestOrUSVString& aRequest,
CacheChild::AutoLock actorLock(mActor);
RefPtr<InternalRequest> ir = ToInternalRequest(aRequest, IgnoreBody, aRv);
RefPtr<InternalRequest> ir =
ToInternalRequest(aCx, aRequest, IgnoreBody, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@@ -450,7 +455,7 @@ Cache::Delete(const RequestOrUSVString& aRequest,
}
already_AddRefed<Promise>
Cache::Keys(const Optional<RequestOrUSVString>& aRequest,
Cache::Keys(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv)
{
if (NS_WARN_IF(!mActor)) {
@@ -466,8 +471,8 @@ Cache::Keys(const Optional<RequestOrUSVString>& aRequest,
AutoChildOpArgs args(this, CacheKeysArgs(void_t(), params), 1);
if (aRequest.WasPassed()) {
RefPtr<InternalRequest> ir = ToInternalRequest(aRequest.Value(),
IgnoreBody, aRv);
RefPtr<InternalRequest> ir =
ToInternalRequest(aCx, aRequest.Value(), IgnoreBody, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@@ -627,7 +632,7 @@ Cache::AddAll(const GlobalObject& aGlobal,
}
already_AddRefed<Promise>
Cache::PutAll(const nsTArray<RefPtr<Request>>& aRequestList,
Cache::PutAll(JSContext* aCx, const nsTArray<RefPtr<Request>>& aRequestList,
const nsTArray<RefPtr<Response>>& aResponseList,
ErrorResult& aRv)
{
@@ -644,7 +649,8 @@ Cache::PutAll(const nsTArray<RefPtr<Request>>& aRequestList,
for (uint32_t i = 0; i < aRequestList.Length(); ++i) {
RefPtr<InternalRequest> ir = aRequestList[i]->GetInternalRequest();
args.Add(ir, ReadBody, TypeErrorOnInvalidScheme, *aResponseList[i], aRv);
args.Add(aCx, ir, ReadBody, TypeErrorOnInvalidScheme, *aResponseList[i],
aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
+8 -8
View File
@@ -43,10 +43,10 @@ public:
// webidl interface methods
already_AddRefed<Promise>
Match(const RequestOrUSVString& aRequest, const CacheQueryOptions& aOptions,
ErrorResult& aRv);
Match(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv);
already_AddRefed<Promise>
MatchAll(const Optional<RequestOrUSVString>& aRequest,
MatchAll(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv);
already_AddRefed<Promise>
Add(JSContext* aContext, const RequestOrUSVString& aRequest,
@@ -55,13 +55,13 @@ public:
AddAll(JSContext* aContext,
const Sequence<OwningRequestOrUSVString>& aRequests, ErrorResult& aRv);
already_AddRefed<Promise>
Put(const RequestOrUSVString& aRequest, Response& aResponse,
Put(JSContext* aCx, const RequestOrUSVString& aRequest, Response& aResponse,
ErrorResult& aRv);
already_AddRefed<Promise>
Delete(const RequestOrUSVString& aRequest, const CacheQueryOptions& aOptions,
ErrorResult& aRv);
Delete(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv);
already_AddRefed<Promise>
Keys(const Optional<RequestOrUSVString>& aRequest,
Keys(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
const CacheQueryOptions& aParams, ErrorResult& aRv);
// binding methods
@@ -100,7 +100,7 @@ private:
ErrorResult& aRv);
already_AddRefed<Promise>
PutAll(const nsTArray<RefPtr<Request>>& aRequestList,
PutAll(JSContext* aCx, const nsTArray<RefPtr<Request>>& aRequestList,
const nsTArray<RefPtr<Response>>& aResponseList,
ErrorResult& aRv);
+10 -2
View File
@@ -74,7 +74,11 @@ CacheOpChild::CacheOpChild(CacheWorkerHolder* aWorkerHolder,
MOZ_DIAGNOSTIC_ASSERT(mPromise);
MOZ_ASSERT_IF(!NS_IsMainThread(), aWorkerHolder);
SetWorkerHolder(aWorkerHolder);
RefPtr<CacheWorkerHolder> workerHolder =
CacheWorkerHolder::PreferBehavior(aWorkerHolder,
CacheWorkerHolder::PreventIdleShutdownStart);
SetWorkerHolder(workerHolder);
}
CacheOpChild::~CacheOpChild()
@@ -165,7 +169,11 @@ CacheOpChild::Recv__delete__(const ErrorResult& aRv,
break;
}
actor->SetWorkerHolder(GetWorkerHolder());
RefPtr<CacheWorkerHolder> workerHolder =
CacheWorkerHolder::PreferBehavior(GetWorkerHolder(),
CacheWorkerHolder::AllowIdleShutdownStart);
actor->SetWorkerHolder(workerHolder);
RefPtr<Cache> cache = new Cache(mGlobal, actor);
mPromise->MaybeResolve(cache);
break;
+5 -4
View File
@@ -204,7 +204,8 @@ CacheStorage::CreateOnWorker(Namespace aNamespace, nsIGlobalObject* aGlobal,
}
RefPtr<CacheWorkerHolder> workerHolder =
CacheWorkerHolder::Create(aWorkerPrivate);
CacheWorkerHolder::Create(aWorkerPrivate,
CacheWorkerHolder::AllowIdleShutdownStart);
if (!workerHolder) {
NS_WARNING("Worker thread is shutting down.");
aRv.Throw(NS_ERROR_FAILURE);
@@ -315,7 +316,7 @@ CacheStorage::CacheStorage(nsresult aFailureResult)
}
already_AddRefed<Promise>
CacheStorage::Match(const RequestOrUSVString& aRequest,
CacheStorage::Match(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv)
{
NS_ASSERT_OWNINGTHREAD(CacheStorage);
@@ -325,8 +326,8 @@ CacheStorage::Match(const RequestOrUSVString& aRequest,
return nullptr;
}
RefPtr<InternalRequest> request = ToInternalRequest(aRequest, IgnoreBody,
aRv);
RefPtr<InternalRequest> request =
ToInternalRequest(aCx, aRequest, IgnoreBody, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
+3 -3
View File
@@ -59,9 +59,9 @@ public:
DefineCaches(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
// webidl interface methods
already_AddRefed<Promise> Match(const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions,
ErrorResult& aRv);
already_AddRefed<Promise>
Match(JSContext* aCx, const RequestOrUSVString& aRequest,
const CacheQueryOptions& aOptions, ErrorResult& aRv);
already_AddRefed<Promise> Has(const nsAString& aKey, ErrorResult& aRv);
already_AddRefed<Promise> Open(const nsAString& aKey, ErrorResult& aRv);
already_AddRefed<Promise> Delete(const nsAString& aKey, ErrorResult& aRv);
+27 -4
View File
@@ -18,11 +18,11 @@ using mozilla::dom::workers::WorkerPrivate;
// static
already_AddRefed<CacheWorkerHolder>
CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate)
CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate, Behavior aBehavior)
{
MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate);
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder();
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder(aBehavior);
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate, Terminating))) {
return nullptr;
}
@@ -30,6 +30,28 @@ CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate)
return workerHolder.forget();
}
// static
already_AddRefed<CacheWorkerHolder>
CacheWorkerHolder::PreferBehavior(CacheWorkerHolder* aCurrentHolder,
Behavior aBehavior)
{
if (!aCurrentHolder) {
return nullptr;
}
RefPtr<CacheWorkerHolder> orig = aCurrentHolder;
if (orig->GetBehavior() == aBehavior) {
return orig.forget();
}
RefPtr<CacheWorkerHolder> replace = Create(orig->mWorkerPrivate, aBehavior);
if (!replace) {
return orig.forget();
}
return replace.forget();
}
void
CacheWorkerHolder::AddActor(ActorChild* aActor)
{
@@ -88,8 +110,9 @@ CacheWorkerHolder::Notify(Status aStatus)
return true;
}
CacheWorkerHolder::CacheWorkerHolder()
: mNotified(false)
CacheWorkerHolder::CacheWorkerHolder(Behavior aBehavior)
: WorkerHolder(aBehavior)
, mNotified(false)
{
}
+6 -2
View File
@@ -25,7 +25,11 @@ class CacheWorkerHolder final : public workers::WorkerHolder
{
public:
static already_AddRefed<CacheWorkerHolder>
Create(workers::WorkerPrivate* aWorkerPrivate);
Create(workers::WorkerPrivate* aWorkerPrivate,
Behavior aBehavior);
static already_AddRefed<CacheWorkerHolder>
PreferBehavior(CacheWorkerHolder* aCurrentHolder, Behavior aBehavior);
void AddActor(ActorChild* aActor);
void RemoveActor(ActorChild* aActor);
@@ -36,7 +40,7 @@ public:
virtual bool Notify(workers::Status aStatus) override;
private:
CacheWorkerHolder();
explicit CacheWorkerHolder(Behavior aBehavior);
~CacheWorkerHolder();
nsTArray<ActorChild*> mActorList;
+17 -10
View File
@@ -79,7 +79,7 @@ ToHeadersEntryList(nsTArray<HeadersEntry>& aOut, InternalHeaders* aHeaders)
} // namespace
already_AddRefed<InternalRequest>
TypeUtils::ToInternalRequest(const RequestOrUSVString& aIn,
TypeUtils::ToInternalRequest(JSContext* aCx, const RequestOrUSVString& aIn,
BodyAction aBodyAction, ErrorResult& aRv)
{
if (aIn.IsRequest()) {
@@ -87,7 +87,7 @@ TypeUtils::ToInternalRequest(const RequestOrUSVString& aIn,
// Check and set bodyUsed flag immediately because its on Request
// instead of InternalRequest.
CheckAndSetBodyUsed(&request, aBodyAction, aRv);
CheckAndSetBodyUsed(aCx, &request, aBodyAction, aRv);
if (aRv.Failed()) { return nullptr; }
return request.GetInternalRequest();
@@ -97,7 +97,8 @@ TypeUtils::ToInternalRequest(const RequestOrUSVString& aIn,
}
already_AddRefed<InternalRequest>
TypeUtils::ToInternalRequest(const OwningRequestOrUSVString& aIn,
TypeUtils::ToInternalRequest(JSContext* aCx,
const OwningRequestOrUSVString& aIn,
BodyAction aBodyAction, ErrorResult& aRv)
{
@@ -106,7 +107,7 @@ TypeUtils::ToInternalRequest(const OwningRequestOrUSVString& aIn,
// Check and set bodyUsed flag immediately because its on Request
// instead of InternalRequest.
CheckAndSetBodyUsed(request, aBodyAction, aRv);
CheckAndSetBodyUsed(aCx, request, aBodyAction, aRv);
if (aRv.Failed()) { return nullptr; }
return request->GetInternalRequest();
@@ -189,7 +190,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
aOut.statusText() = aIn.GetUnfilteredStatusText();
RefPtr<InternalHeaders> headers = aIn.UnfilteredHeaders();
MOZ_DIAGNOSTIC_ASSERT(headers);
if (HasVaryStar(headers)) {
if (aIn.Type() != ResponseType::Opaque && HasVaryStar(headers)) {
aRv.ThrowTypeError<MSG_RESPONSE_HAS_VARY_STAR>();
return;
}
@@ -204,7 +205,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
}
void
TypeUtils::ToCacheResponse(CacheResponse& aOut, Response& aIn,
TypeUtils::ToCacheResponse(JSContext* aCx, CacheResponse& aOut, Response& aIn,
nsTArray<UniquePtr<AutoIPCStream>>& aStreamCleanupList,
ErrorResult& aRv)
{
@@ -222,7 +223,10 @@ TypeUtils::ToCacheResponse(CacheResponse& aOut, Response& aIn,
nsCOMPtr<nsIInputStream> stream;
ir->GetUnfilteredBody(getter_AddRefs(stream));
if (stream) {
aIn.SetBodyUsed();
aIn.SetBodyUsed(aCx, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
}
SerializeCacheStream(stream, &aOut.body(), aStreamCleanupList, aRv);
@@ -426,8 +430,8 @@ TypeUtils::ProcessURL(nsACString& aUrl, bool* aSchemeValidOut,
}
void
TypeUtils::CheckAndSetBodyUsed(Request* aRequest, BodyAction aBodyAction,
ErrorResult& aRv)
TypeUtils::CheckAndSetBodyUsed(JSContext* aCx, Request* aRequest,
BodyAction aBodyAction, ErrorResult& aRv)
{
MOZ_DIAGNOSTIC_ASSERT(aRequest);
@@ -443,7 +447,10 @@ TypeUtils::CheckAndSetBodyUsed(Request* aRequest, BodyAction aBodyAction,
nsCOMPtr<nsIInputStream> stream;
aRequest->GetBody(getter_AddRefs(stream));
if (stream) {
aRequest->SetBodyUsed();
aRequest->SetBodyUsed(aCx, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
}
}
+6 -6
View File
@@ -73,12 +73,12 @@ public:
GetIPCManager() = 0;
already_AddRefed<InternalRequest>
ToInternalRequest(const RequestOrUSVString& aIn, BodyAction aBodyAction,
ErrorResult& aRv);
ToInternalRequest(JSContext* aCx, const RequestOrUSVString& aIn,
BodyAction aBodyAction, ErrorResult& aRv);
already_AddRefed<InternalRequest>
ToInternalRequest(const OwningRequestOrUSVString& aIn, BodyAction aBodyAction,
ErrorResult& aRv);
ToInternalRequest(JSContext* aCx, const OwningRequestOrUSVString& aIn,
BodyAction aBodyAction, ErrorResult& aRv);
void
ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
@@ -91,7 +91,7 @@ public:
ErrorResult& aRv);
void
ToCacheResponse(CacheResponse& aOut, Response& aIn,
ToCacheResponse(JSContext* aCx, CacheResponse& aOut, Response& aIn,
nsTArray<UniquePtr<mozilla::ipc::AutoIPCStream>>& aStreamCleanupList,
ErrorResult& aRv);
@@ -133,7 +133,7 @@ public:
private:
void
CheckAndSetBodyUsed(Request* aRequest, BodyAction aBodyAction,
CheckAndSetBodyUsed(JSContext* aCx, Request* aRequest, BodyAction aBodyAction,
ErrorResult& aRv);
already_AddRefed<InternalRequest>
+4 -11
View File
@@ -2974,8 +2974,8 @@ ValidateRect(double& aX, double& aY, double& aWidth, double& aHeight, bool aIsZe
// The values of canvas API input are in double precision, but Moz2D APIs are
// using float precision. Bypass canvas API calls when the input is out of
// float precision to avoid precision problem
if (!std::isfinite((float)aX) | !std::isfinite((float)aY) |
!std::isfinite((float)aWidth) | !std::isfinite((float)aHeight)) {
if (!std::isfinite((float)aX) || !std::isfinite((float)aY) ||
!std::isfinite((float)aWidth) || !std::isfinite((float)aHeight)) {
return false;
}
@@ -5012,13 +5012,6 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
return;
}
#ifdef MOZ_EME
if (video->ContainsRestrictedContent()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return;
}
#endif
uint16_t readyState;
if (NS_SUCCEEDED(video->GetReadyState(&readyState)) &&
readyState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) {
@@ -5959,7 +5952,7 @@ void
CanvasRenderingContext2D::PutImageData(ImageData& aImageData, double aDx,
double aDy, ErrorResult& aError)
{
RootedTypedArray<Uint8ClampedArray> arr(RootingCx());
RootedSpiderMonkeyInterface<Uint8ClampedArray> arr(RootingCx());
DebugOnly<bool> inited = arr.Init(aImageData.GetDataObject());
MOZ_ASSERT(inited);
@@ -5975,7 +5968,7 @@ CanvasRenderingContext2D::PutImageData(ImageData& aImageData, double aDx,
double aDirtyHeight,
ErrorResult& aError)
{
RootedTypedArray<Uint8ClampedArray> arr(RootingCx());
RootedSpiderMonkeyInterface<Uint8ClampedArray> arr(RootingCx());
DebugOnly<bool> inited = arr.Init(aImageData.GetDataObject());
MOZ_ASSERT(inited);
+1 -1
View File
@@ -929,7 +929,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData,
const Maybe<IntRect>& aCropRect, ErrorResult& aRv)
{
// Copy data into SourceSurface.
RootedTypedArray<Uint8ClampedArray> array(RootingCx());
RootedSpiderMonkeyInterface<Uint8ClampedArray> array(RootingCx());
DebugOnly<bool> inited = array.Init(aImageData.GetDataObject());
MOZ_ASSERT(inited);
+2
View File
@@ -8,6 +8,7 @@
#include <stdarg.h>
#include "gfxPrefs.h"
#include "GLContextTypes.h"
#include "GLDefs.h"
#include "mozilla/Attributes.h"
@@ -1397,6 +1398,7 @@ protected:
CheckedUint32 mGeneration;
WebGLContextOptions mOptions;
const uint32_t mMaxVertIdsPerDraw = gfxPrefs::WebglMaxVertIDsPerDraw();
bool mInvalidated;
bool mCapturedFrameInvalidated;
Loaded 100 of 3005 files, more files were not shown because too many files have changed in this diff. Show more