Compare commits

...
Author SHA1 Message Date
Moonchild 810c2bf808 Merge branch 'redwood' into release 2020-12-16 07:42:37 +00:00
Moonchild 203be74ffe Revert "Issue #1695 - Add clamping to websocket polling timeouts."
As of [da0c073a7] we no longer need this workaround because the issue is avoided
with proper sleep/wake logic restored.

This reverts commit 2fa993b563.
2020-12-16 07:42:02 +00:00
Moonchild 0ea6dd009f Issue #1695 - Restore Sleep/Wake timer that was erroneously removed.
This was fallout from PR #929 for Issue #21
2020-12-16 07:41:43 +00:00
Moonchild dabdec3b3a Merge branch 'redwood' into release 2020-12-15 15:09:30 +00:00
Moonchild cd17592001 [toolkit] Handle corner case confusion of downloaded files without extension.
See code comment for details.
2020-12-15 13:39:34 +00:00
Moonchild 62d550e22d Issue #1696 - Propagate flex sizes to the table wrapper
This avoids overlapping of table styled elements inside flexboxes as used on
some websites.

Resolves #1696
2020-12-15 13:39:19 +00:00
Moonchild 2f60cae35e [network] Update port blacklist.
See BZ bugs 1674735, 1677047, 1677940 and 1676868 for details.
2020-12-15 13:39:01 +00:00
Moonchild 65bbd1acb6 Issue #1695 - Add clamping to websocket polling timeouts. 2020-12-13 18:14:40 +00:00
Moonchild 3edea8e9e0 Revert "Issue #1391 - Disable DOM Filesystem/dirpicker APIs by default."
This reverts commit 45a976a5f1.
2020-12-13 18:14:22 +00:00
Moonchild fc539ba189 Issue #1695 - Fix socket timeout logic. 2020-12-13 18:14:12 +00:00
Moonchild 68299c8613 Issue #1694 - Part 2: Use scriptabledateformat for Update History display. 2020-12-13 18:14:00 +00:00
Moonchild d0b7069d1c Issue #1694 - Part 1: Use scriptabledateformat for the Cookie Accept dialog. 2020-12-13 18:13:49 +00:00
Moonchild 55dbbe4d16 Issue #1624 - flip the inlining pref.
The default is now set to the more stable but slower global setting.
2020-12-13 18:13:39 +00:00
Moonchild a52529970f Nuke erroneously added vim line. 2020-12-13 18:13:28 +00:00
Moonchild bcb46bf65e Issue #1624 - Make ion inlining optimizations a pref.
This also adds it to JS_SetGlobalJitCompilerOption()
2020-12-13 18:13:03 +00:00
Moonchild 176f4fe206 Issue #1624 - Globally disable inlining optimizations in the JS JIT compiler. 2020-12-02 07:21:27 +00:00
Brian Smith aed41dc542 Issue #1690 - Part 2: Update MacOS Blocklist support from 10.13 to 11.0.
Changes based on Mozilla bug 1678061.
2020-12-02 07:21:03 +00:00
Brian Smith a7a521e378 Issue #1690 - Part 1: Fix MacOS version detection above 10.15.
Changes based on Mozilla bug 1616404 but supporting back to 10.7.
2020-12-02 07:20:45 +00:00
Moonchild e9b56e301c Clobber for NSS update. 2020-12-02 07:20:26 +00:00
Moonchild 57debb342a [NSS] Version and build bump 2020-12-02 07:20:16 +00:00
Moonchild 78219cdbf1 [NSS] Update root certificates. 2020-12-02 07:20:04 +00:00
Moonchild c68e97f01c Issue #1684 - Move global user-agent override to networking component.
Since this is a http protocol networking feature, it belongs in the networking
branch of our preferences.
2020-12-02 07:19:17 +00:00
Moonchild 5165ed0228 Merge branch 'redwood' into release 2020-11-20 09:47:03 +00:00
Moonchild ca9abcdf17 [webrtc] Only init WebRtcAec callbacks once 2020-11-19 22:47:40 +00:00
Werner Lemberg 459c36b9df [sfnt] Fix heap buffer overflow.
This is CVE-2020-15999.

* src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier.
2020-11-19 22:47:19 +00:00
Henri Sivonen c9508464d5 [dom] Remove attributes from descendants when setting sanitized style.
This avoids a number of problems with incomplete sanitation.
2020-11-19 22:47:05 +00:00
Moonchild 2219a336dd [http] Use a copy of nsHttpConnectionInfo.
The root cause in this bug is that the connection info used by
'SpdyConnectTransaction' is the same instance as the connection info in
'nsHttpTransaction', so we should clone it and let 'SpdyConnectTransaction' use
the cloned one.
2020-11-19 22:46:51 +00:00
Moonchild a6763e7451 [xpcom] Don't use realloc for shrinking nsTArrays when allowRealloc is false.
The original patch handled the grow case but not the shrink case. When the
current and new allocation sizes are in different size classes, jemalloc's
realloc will move the allocation when shrinking, not just truncate the existing
one.

Based on work by Jon Coppeard.
2020-11-19 22:46:22 +00:00
Henri Sivonen 727f4372a9 [parser] Make the refcount of nsHtml5OwningUTF16Buffer atomic. 2020-11-19 22:46:06 +00:00
David Major 556a15567d [xpcom] Fix GetWindowsFolder storage 2020-11-19 22:45:53 +00:00
Moonchild 95d93b55c9 [gfx][Skia] Hold mutex while accessing shared SkImage data. 2020-11-19 22:45:34 +00:00
Alessio Vanni 693dc6a5fc Issue #1686 - Align a keybinding definition with the others 2020-11-19 22:45:00 +00:00
Brian Smith 08cc9cd558 Issue #1667 - Part 3: Fix OpenGL load and runtime issues on Big Sur
This fix is included in NSPR 4.27 and Mozilla bug 1652330.
Also put a main thread check in the cocoa draw callback.
2020-11-19 22:44:41 +00:00
Brian Smith 4f0f4aa879 Issue #1667 - Part 2: Add MacOS 11.0 Big Sur widget compatibility
This involves refactoring the vibrancy and OpenGL/Pixel rendering changes contained
in the following Mozilla meta bugs: 1496823 and 1491445
Also add Big Sur to the features tests and update popup menu look and feel based
on Mozilla bug 1656301.
2020-11-19 22:44:22 +00:00
Brian Smith 53ca366d2b Issue #1667 - Part 1: Define _pthread_self if it is not already defined in jemalloc 2020-11-19 22:44:09 +00:00
Moonchild 14f7bec523 [UA] Change default compatibility mode version to 68.0
Since several entities have started to ban .9 versions, even if they are valid
ESR versions.
2020-11-18 10:59:33 +00:00
Matt A. Tobin 976ccaa922 Issue #251 - Move chrome packaging options to ac configure
Also adds options for new functionality in #1683
2020-11-18 10:59:16 +00:00
Moonchild 8b3375e2c2 [packager] Optimize archive accesses. 2020-11-18 10:58:48 +00:00
Moonchild 8fefeee3c3 Issue #1683 - Update libjar module. 2020-11-18 10:58:35 +00:00
Moonchild b645d59b1e Issue #1683 - Update Brotli lib to 1.0.9 2020-11-18 10:58:22 +00:00
Moonchild 71e0814af2 [libjar] Fix inflation logic.
This has been broken for 11 years. About time it's fixed.
Tag #1683
2020-11-18 10:58:08 +00:00
Moonchild 5744d59188 Issue #1682 - Remove vibrator DOM interface and support code. 2020-11-18 10:57:53 +00:00
Moonchild 45a976a5f1 Issue #1391 - Disable DOM Filesystem/dirpicker APIs by default.
There don't seem to be any drawbacks to this; tested for the past month disabled
and there have been no issues with any sites visited. Adoption seems very low.
2020-11-18 10:55:12 +00:00
adesh 06f9b815ce Issue #1280 - Follow-up: Get rid of HPKP pinning mode.
This was a leftover from HPKP removal.

Also remove a couple of unused variables from security/manager/ssl/nsSiteSecurityService.cpp.
2020-11-18 10:54:47 +00:00
Matt A. Tobin 0032e8313d Bug 1466909 - Use AddLvalueReference for UniquePtr's operator*().
This is required for UniquePtr to accept <void>,
which is required for PseudoHandle = mozilla::UniquePtr<T, JS::FreePolicy>;
in turn for mozilla::SegmentedVector<PseudoHandle<void>> uniquePtrArena_;

Tag #1679
2020-11-18 10:54:19 +00:00
Matt A. Tobin d7df9b336a Bug 1328948 - Add is(), as() to Cell.
Tag #1679
2020-11-18 10:54:04 +00:00
athenian200 6c1b1bd18f Issue #1673 - Part 5: Fix brace style and missed -moz-tab-size reference. 2020-11-18 10:51:58 +00:00
athenian200 770cb9a4b9 Issue #1673 - Part 4: Unprefix -moz-tab-size.
While we do fail a couple of tests, the other mainstream browsers also fail them and I think our implementation of tab-size is good enough to be unprefixed at this point. Having this patch also makes testing easier.
2020-11-18 10:51:45 +00:00
athenian200 90309c01a8 Issue #1673 - Part 3: Bring minimum tab advance up to spec.
This provides a clearer rule for the minimum tab advance that brings us to alignment with the spec and both major browsers.
2020-11-18 10:51:34 +00:00
athenian200 4de0e9c68d Issue #1673 - Part 2: Make tab-size animatable and fix typos.
There were a few typos in the previous patch and this patch also makes tab-size animatable which didn't really require much of a change at all.
2020-11-18 10:51:22 +00:00
athenian200 4dae04e594 Issue #1673 - Part 1: Allow tab-size to accept <length>.
Currently -moz-tab-size only accepts <number> values, and both Chrome and Firefox currently support <length> values and have for some time now. So with this you would be able to support sizes in px or em, for instance. This was implemented in Firefox 53 and was trivial to backport.
2020-11-18 10:51:09 +00:00
Moonchild b9c41e2624 [devtools] More gracefully (than a crash) handle stack capture failures. 2020-10-31 17:33:08 +01:00
Moonchild e1db27e199 Merge branch 'redwood' into release 2020-10-24 10:42:23 +00:00
Moonchild a5203631d8 Update docs for change of repository host.
Rename MCP back to MoonchildProductions.
2020-10-24 10:40:09 +00:00
Moonchild e2fe23c90b Update docs for change of repository host. 2020-10-24 10:39:57 +00:00
Moonchild fcc0241430 [layout] Re-order rowgroups if reflowing.
This logic was missing for tfoot. See existing code in second hunk.
2020-10-24 10:39:36 +00:00
Moonchild 24657db629 [layout] Avoid negative availSize.BSizes in paginated table reflow. 2020-10-24 10:39:16 +00:00
Moonchild 4939447eb7 Bump platform version for added features. 2020-10-24 10:39:03 +00:00
Moonchild f07d60c09f [netwerk] Make nsIncrementalStreamLoader's GetNumBytesRead threadsafe.
This prevents a potential race and simplifies the code a bit by keeping the
bytes read separate instead of using mData, which is modified from another
thread from OnDataAvailable.
Relaxed atomics are fine for these, since they don't guard any memory.
2020-10-24 10:38:50 +00:00
Moonchild d7a05ea9e5 [DOM] When failing to create a channel and an image request, make sure to set
the image blocking status appropriately.

This is the same status as we do for known no-data protocols and ensures we
treat these two cases the same.
2020-10-24 10:38:35 +00:00
Moonchild 10bf4a6d5b [DOM Fetch] Detect broken pipes and propagate that write error to the caller. 2020-10-24 10:38:21 +00:00
Moonchild c3778db14d [DOM Fetch] Improve stability of Fetch API. 2020-10-24 10:38:07 +00:00
Moonchild abcee4f85c Issue #1671 - Unprefix ::-moz-selection
This actually keeps both pseudo-elements for now, since the prefixed version is
still used internally, but we need the unprefixed version for web compat.
Note: while unprefixing a non-spec-compliant pseudo here, it's exactly in line
with what other browsers do. Nobody is following the spec here and at least
we'll be doing what everyone else is with our unprefixed version.
2020-10-24 10:37:53 +00:00
athenian200 67a7e4eabd Issue #1668 - Part 2: Visited color and auto support for caret-color property.
Mozilla's original implementation of this failed a couple of tests, but this seems to solve all the problems. Basically, the caret-color wasn't able to be set differently based on whether a link was visited, and the auto value implementation was incomplete. The only test we fail now is the one where you have grey text on a grey background and the caret is supposed to be visible, but I think that may have been removed from the spec. Even if it wasn't, no other browser supports it anyway.
2020-10-24 10:37:01 +00:00
athenian200 c1ef954679 Issue #1668 - Part 1: Implement support for caret-color property.
This CSS property allows input carets (that blinking input cursor you see in text fields), to be given a custom color. This was implemented in Firefox 53, and it was such a minor feature that no one ever missed it, but I don't see any harm in implementing this.

https://bugzilla.mozilla.org/show_bug.cgi?id=1063162
2020-10-24 10:36:47 +00:00
Moonchild eac19e3356 Issue #1643 - Follow-up: Ensure we properly clear our pointers when the
Presentation of a document is destroyed.
2020-10-24 10:36:20 +00:00
Moonchild a98d06380f Merge branch 'redwood' into release 2020-10-06 09:32:46 +00:00
Moonchild 1e8d07cac2 Issue #1606 - Add support for multi-monitor DPI awareness v2 (W10 1706+) 2020-10-06 09:32:13 +00:00
Moonchild e7a0013f81 [devtools] Teach devtools about overflow-wrap: anywhere
Tag #1666
2020-10-06 09:32:03 +00:00
Moonchild 17b4d049f4 Issue #1666 - Implement overflow-wrap: anywhere
This aligns with the current spec regarding overflow-wrap: break-word and
overflow-wrap: anywhere in if it affects intrinsic sized due to considering
soft-wrap opportunities or not.
See CSS Text Module Level 3, Editor’s Draft, 1 October 2020, Section 5.5
2020-10-06 09:31:51 +00:00
Moonchild abf1d5a099 Issue #1665 - Take overflow-wrap into account when calculating min-content intrinsic size. 2020-10-06 09:31:40 +00:00
New Tobin Paradigm b7dac18c0e Update CONTRIBUTING.md
Revise Commit message style and add Follow-up form
2020-10-06 09:31:28 +00:00
Moonchild 63a0006985 Merge branch 'redwood' into release 2020-10-01 11:37:38 +00:00
athenian200 e50094ab02 Issue #1647 - Followup: Remove excessive VARIANT_OPACITY statements.
I got very anxious about making sure I included VARIANT_OPACITY in all the places VARIANT_NUMBER was included to make sure it couldn't possibly break unexpectedly, and that led to me accidentally breaking a mechanism that prevented percentages from serializing as numbers in other parts of the code. It was a total accident, and these additions were unnecessary. Basically, the situation is that there was one part of the code where it determines what's allowed for the flex statement (and possibly other statements) by checking whether it got stored as a "number", and basically only disallows percentages if it attempted to store/serialize them as percentages.

However, it only got to that part of the code because I accidentally allowed VARIANT_OPACITY as a valid way for certain tokens to parse where it wasn't necessary. If it tries to parse it that way under very specific circumstances... percentages will be marked valid and fed through the system as numbers rather than being rejected and not serialized at all, because the check to disallow percentages there relied on them being stored as percentages.

It's a really weird thing to have a problem with in a lot of ways, because if percentages aren't allowed in a field, you would think people wouldn't try to use them there, much less depend on the broken behavior that results from them not parsing as a related value.
2020-10-01 09:55:37 +00:00
Moonchild d11196927a Issue #1643 - Follow-up: Make sure things aren't changed while iterating.
This fixes some crashing scenarios.
2020-09-30 16:03:36 +00:00
Moonchild af6a8637f5 Merge branch 'redwood' into release 2020-09-29 21:08:33 +00:00
Matt A. Tobin 5a9f8ae723 Issue #1643 - Follow up: Add a null check for mOwner in ResizeObserverNotificationHelper::Unregister
A race condition seemed to exist between tab destruction and un-registering a ResizeObserver resulting in a null deref crash.
The original reporter in Forum Topic 25311 experienced this on msn.com so that was the functional test reference.
2020-09-29 21:07:49 +00:00
Moonchild 9f5c27ba47 Merge branch 'redwood' into release 2020-09-23 23:45:46 +00:00
Moonchild f624bd1375 Output webidl filenames as they are processed, for real this time. 2020-09-23 08:29:31 +00:00
Moonchild 312f0b3a76 Issue #1655: Update MediaQueryList to the current draft spec.
This make MediaQueryList inherit from EventTarget and adds MediaQueryListEvent
as an interface as well as the onchange() method.
This should not affect compatibility with other code; the event object is a
MediaQueryListEvent instance, which is recognized as a MediaListQuery instance.
2020-09-23 08:29:21 +00:00
Moonchild 04479387a2 [webaudio] Keep track of whether the HRTF database has already been loaded.
This DiD measure ensures that our async HRTF database loading is completed
before we actually try to use it. If not done, database() simply returns null.
2020-09-23 08:29:06 +00:00
Moonchild b0c271c7f9 [dom/media] Use an atomic for mInputDeviceID to avoid potential race 2020-09-23 08:28:56 +00:00
Moonchild 37efb98518 [SVG] Only fire the SVG onload when scripting is enabled and allowed 2020-09-23 08:28:46 +00:00
Moonchild 3272147d97 Issue #1224 - Remove constant expressions from /dom
This excludes DOMProxy handlers in dom bindings because that's intertwined with
codegen and js that needs to be handled together.
2020-09-21 11:10:23 +00:00
athenian200 f2866a5420 Issue #1647 - Part 2: Implement VARIANT_OPACITY to correctly serialize.
Even though percentages are already treated as floats internally by the style system for computation purposes, you have to go out of your way to stop them from being read back out as percentages. What I do here amounts to storing the percentage token in the "wrong" container, the one normally used for floats. This allows a value that was read in as a percentage to be read back out as something else, which is normally prevented by the design of the style system.
2020-09-21 11:05:30 +00:00
athenian200 b862145e9c Issue #1647 - Part 1: Implement percentage for CSS opacity keywords
This preliminary step allows percentages to be computed and display correctly,
but unfortunately it fails a test after changing VARIANT_HN to VARIANT_HPN because that allows values to be serialized as percentages. However, not doing this means percentages are rejected as valid values for the user to input. The way the style system is setup makes it hard to change this for opacity without changing it for everything else, especially since some code-saving speed hacks in Bug 636029 and Bug 441367 that make a lot of assumptions about this stuff very rigid.
2020-09-21 11:05:19 +00:00
Moonchild e2e483ac47 Issue #1653 - Part 2: Stop indirectly loading DWM functions through WinUtils. 2020-09-21 11:05:03 +00:00
Moonchild 892a2d9655 Issue #1653 - Part 1: Remove WinUtils::SHGetKnownFolderPath
Instead of doing the whole dll-load, replace function dance, we can just use the
shlobj.h version of Windows.
2020-09-21 11:04:52 +00:00
Moonchild 075fa01286 Issue #1643 - Part 4: Hook up all the plumbing. 2020-09-21 11:04:31 +00:00
Moonchild 32e0d2ca23 Issue #1643 - Part 3: Implement ResizeObserverController 2020-09-21 11:04:19 +00:00
Moonchild 791d5f8a43 Issue #1643 - Part 2: Implement ResizeObserver API
Implements ResizeObserver, ResizeObserverEntry and ResizeObservation
2020-09-21 11:04:05 +00:00
Moonchild ed1f54ab73 Issue #1643 - Part 1: Add GetNodeDepth() to nsContentUtils. 2020-09-21 11:03:48 +00:00
Moonchild eb1315e093 [widget] Clean up Windows widget code some. 2020-09-21 11:00:01 +00:00
Gaming4JC fa9730a46c Issue #618 - Clear the module map - Debug Followup
An assertion was added to dom/script/ScriptLoader.cpp but fails to compile on debug builds due it not being included in the namespace.

Ref: BZ 1529203
2020-09-21 10:59:48 +00:00
adeshkp ba0518147f Fix usage of a macro in a cocoa widget (#1649)
* Issue #457 - Fix usage of a macro in a cocoa widget
2020-09-21 10:59:35 +00:00
Moonchild 7564818c79 Issue #1650 - Add null check.
There are situations where nsCSSClipPathinstance->CreateClipPath(dt)
returns null. We need to check for this before trying to use its
functions. If there is no clip path, then always return "no hit".
2020-09-21 10:59:24 +00:00
adeshkp 10866dd35c Issue #1280 - Remove hostname parameter to trust domain.
Host name was purely being used for HPKP and since HPKP is killed,
this can also go. Currently it doesn't do anything other than
generating build warnings.
2020-09-21 10:59:09 +00:00
athenian200 f43c37cabe Issue #1629 - Part 5: Remove pointless local variables.
Since the local variable is always initialized to false, we don't actually need to declare it and can just pass "false" directly as a parameter to the PrepareSheet function's bool. I was worried about code readability at first, but some well-placed comments took care of that.
2020-09-21 10:58:32 +00:00
athenian200 157f218c8d Issue #1629 - Part 4: Ensure isExplicitlyEnabled is false upon sheet creation.
This clarifies the assumptions the code is making and the order in which the variables pass through the loading process. The new variable is set after the sheet is created and prepared, and is assumed to be false in the beginning.
2020-09-21 10:58:18 +00:00
Moonchild d49fb8a691 Issue #618 - Clear the module map when changing a Document's global and add
release build assertions for mismatching compartments.
2020-09-08 11:05:05 +00:00
Moonchild 71b988d1b4 Issue #618 - Make ES6 modules work for resource: URIs 2020-09-08 11:04:54 +00:00
Moonchild ddc43bf9d7 Issue #618 - Implement preloading of module scripts.
This hooks up module scripts to the existing preload mechanism.
2020-09-08 11:04:36 +00:00
Moonchild 5819a1a525 Issue #1644 - Remove plugin checking code leftovers 2020-09-08 11:03:21 +00:00
Moonchild 351974555b Clobber for CSS flow-root implementation 2020-09-08 11:03:11 +00:00
athenian200 abaea77ccb Issue #1641 - Implement CSS flow-root keyword
This is just a clean port of 1322191 and follow-up 1325970. It really seems to add create a new way to access existing code relating to block formatting and floating elements rather than implementing new functionality, and it is mercifully straightforwards.
2020-09-08 11:02:57 +00:00
Moonchild 4698b4b3ca Issue #1639 - Implement object.fromEntries()
Adds a self-hosted implementation of this map->object conversion.
This resolves #1639.
2020-09-06 10:01:37 +00:00
Moonchild 798f0bd3ad Fix build error. 2020-09-05 20:36:39 +00:00
Gaming4JC 427d325d0c Regenerate the HTML Parser code for nomodule changes. 2020-09-05 18:46:32 +00:00
Gaming4JC 9c515323ff Issue #618 - Don't preload nomodule scripts when modules are enabled (uplift) 2020-09-05 18:45:45 +00:00
Gaming4JC c2b91aaf8c Regenerate Parser for Marquee Removal 2020-09-05 18:44:45 +00:00
Moonchild 1da42403ec Issue #1525 - Kill marquee element (uplift) 2020-09-05 18:44:16 +00:00
Matt A. Tobin 602fbdcb44 Update old.configure for --enable-phoenix-extensions 2020-09-01 05:46:57 +00:00
Matt A. Tobin 42f895f27f Update old.configure for --enable-phoenix-extensions 2020-09-01 05:44:49 +00:00
Moonchild a6f632714f Merge branch 'redwood' into release 2020-08-31 05:54:39 +00:00
Moonchild b28effe2ea Remove unsupported CE keyword from HTMLLinkElement.webidl 2020-08-30 12:04:46 +00:00
Moonchild afd6edd667 Clobber for NSS update 2020-08-30 11:59:23 +00:00
Moonchild 582a1ce72a [NSS] Version and build bump 2020-08-30 11:59:14 +00:00
J.C. Jones 71ac56ba40 [NSS] Prevent slotLock race in NSC_GetTokenInfo
Basically, NSC_GetTokenInfo doesn't lock slot->slotLock before accessing slot
after obtaining it, even though slotLock is defined as its lock.
2020-08-30 11:59:06 +00:00
Moonchild ae184d09e6 Issue #1587 followup - Improve resilience of AbortSignals. 2020-08-30 11:58:58 +00:00
Moonchild 868f0755ae [misc/mar] Don't use a signed type for a length parameter. 2020-08-30 11:58:49 +00:00
Kris Maglione 5ca8fbd41c [DOM] Only construct JS-implemented objects if inner window is current. 2020-08-30 11:58:40 +00:00
Moonchild 549c8b9283 [media] Only include source error details in debugging scenarios.
Unless a user is debugging media errors, this detail is unnecessary to report
and could include sensitive data which could be abused by third-party
requesters. This aligns it with the standard success/error paradigms in normal
browsing situations.
2020-08-30 11:58:32 +00:00
Moonchild 77e8ba7eaf Issue #618 - Implement async attribute for inline module scripts. (uplift)
This commit does several things:
- Moves the pref check from ScriptLoader to ns[I]Document so it can be called on
the document.
- Changes the atrribute freezing function to a better name that takes the
document as a parameter.
- Sets the proper async/defer attributes on HTML script elements based on
keywords and whether they are module scripts or not.
2020-08-30 09:51:18 +00:00
Moonchild e854d58633 Issue #618 - (async) Keep track of script modes in a single mode state.
This simplifies handling of combinations of async/defer by assigning one and
only one state to scripts.
If async then always async > if defer or module then defer > otherwise blocking.
2020-08-30 09:48:07 +00:00
Moonchild d58cb8e11b Issue #618 - (async, preload) Correctly pass info about async/defer to parser.
This makes sure we don't block body-referred sub-resources by head-referenced
defer and async scripts. This is important for all script loads, not just
modules, but is added here because it was run into while implementing modules.
2020-08-30 09:47:49 +00:00
Moonchild 429a7bdb93 Issue #618 - (async) Split out function to add async request. 2020-08-30 09:40:15 +00:00
Moonchild 3f14e9ec5f Issue #618 - Rename some script load request flags to be more descriptive. 2020-08-30 09:40:03 +00:00
Moonchild aefb293793 Issue #618 - Make document.currentScript null in modules.
Because the spec says so.
2020-08-30 09:39:55 +00:00
Jon Coppeard c583315558 Issue #618 - Fix processing of non-parser-generated module scripts. 2020-08-30 09:39:45 +00:00
Jon Coppeard 834ecdc59a Issue #618 - Handle errors for inline module scripts and ensure we update the
module map after fetch errors.
2020-08-30 09:39:23 +00:00
Moonchild 798c2ed4f8 Issue #618 - Split SRI verification out from OnStreamComplete. 2020-08-30 09:39:13 +00:00
Moonchild 767b637c83 Issue #618 - Split handling of load errors out from OnStreamComplete. 2020-08-30 09:39:03 +00:00
Moonchild 702ad218b0 Issue #618 - Integrity for descendant module scripts should be the empty string
Because the spec says so.
2020-08-30 09:38:54 +00:00
Jon Coppeard b9af9c0c51 Issue #618 - Don't mute errors for module scripts because they always use CORS 2020-08-30 09:38:44 +00:00
Moonchild 9d6e28d3d0 Issue #618: Pass down referrer and referrer policy when fetching modules.
Because the spec says so.
2020-08-30 09:38:29 +00:00
Moonchild c735355ae1 Issue #618: Ignore 'event' and 'for' attributes for module scripts.
Because the spec says so.
2020-08-30 09:38:17 +00:00
Moonchild 10a10fd375 Issue #618 - Simplify module resolve hook to be a function pointer
This is an ahead-of time port to try and address #1624.
This is based on BZ 1461751 and Jon Coppeard's work in it.
2020-08-30 09:37:12 +00:00
Moonchild 1012dbe9e5 [js] Add some utility functions to get the current JS runtime. 2020-08-30 09:37:03 +00:00
Gaming4JC 9982c1f5cb Issue #618 - Keep track of which modules in a graph have been fetched using a visited set
Ref: BZ 1365187
2020-08-30 09:36:51 +00:00
Gaming4JC fe912e94e4 Issue #618 - Simplify module map interface
Ref: BZ 1365187
2020-08-30 09:36:41 +00:00
Gaming4JC 770b1c9071 Issue #618 - Align error handling for module scripts with the spec - Debug follow up
MODULE_STATUS_ERRORED is no more. Replacing with newer API.

Ref: BZ 1420420
2020-08-30 09:35:19 +00:00
Gaming4JC daf56131a7 Issue #618 - Lazily initialise module binding maps - Debug follow up
The added debug assertion does not work due to missing API.
They were added in BZ 1337491, 1395366, and others, but were primarily used for multi-threading.
This uses our existing non-multithreaded syntax instead, resolving a `no member named` build error.
2020-08-30 09:35:07 +00:00
Jon Coppeard d8686de401 Issue #618 - Record module dependency before starting fetch so that error
handling works correctly

Ref BZ 1395896
2020-08-30 09:33:58 +00:00
Moonchild c8a38346c8 Issue #618 - Lazily initialise module binding maps
Make it so they are not allocated on a background thread in a different zone to
the final module.

Ref: BZ 1372258
2020-08-30 09:33:33 +00:00
Moonchild 70bafe4df5 Issue #618 - Use a single slot for the module's environment object.
According to the spec this isn't created until the module is instantiated, but
we create it when we compile the module.
We stored this previously in InitialEnvironmentSlot and copied it to
EnvironmentSlot when it was supposed to be created, but we can just store it in
the latter slot straight away and check the module's status and return null if
it shouldn't exist yet.

This reduces the number of slots needed on a moduleObject to 17.

Re: BZ 1420412 Part 1
We can't implement the second part to further reduce our number of slots,
because it relies on SetProxyReservedSlot which in turn relies on
rearchitecturing JS proxies to make reserved slots dynamic. That's a rabbit hole
we really don't want to fall into.
So, we'll end up being a bit slower because it can't be in-line allocated with
having more than 16 slots, but so be it. I sincerely doubt it will make any
practical difference.
2020-08-30 09:33:21 +00:00
Moonchild 498b1ab0c8 Issue #618 - Align error handling for module scripts with the spec (again)
This updates module implementation to match spec regarding handling of
instantiation errors, after it was changed yet again, this time to not remember
instantiation errors, but instead immediately rethrow applicable ones.

Ref: BZ 1420420
2020-08-30 09:33:06 +00:00
Moonchild 2f145b6eda Issue #618 - Fix error events fired when loading JS module dependencies fail
When module dependencies fail, don't spam with errors for each import; only fire
the error event once.

Ref: BZ 1421259
2020-08-30 09:32:52 +00:00
Matt A. Tobin 06a092d08e Follow up to eb28b1f32 - Correct inputmethod build file by putting Keyboard.jsm back in EXTRA_JS_MODULES
JSMs are NOT Components.
2020-08-30 09:31:24 +00:00
Moonchild d107016d37 [js] Reinstate precise floating point model for all js sources. 2020-08-30 09:31:10 +00:00
Moonchild 63371593c0 Issue #457 - Silence SQLite compiler warning
Our use of SQLite explicitly avoids using MSVC's _msize which the lib would
notrmally use. This was set up this way in BZ bug 719579 for legitimate reasons
(because _msize would end up using the system symbol, which would crash trying
to get the size information from jemalloc allocations). Since we build the
SQLite lib separately there is no easy way to avoid this warning as it's not
directly linked against mozglue.dll which has the jemalloc functions it wants
for _msize when not using the system allocator. It is implicitly assuming the
function is an extern returning an int (with the call specifically  casting to
int) which is correct (well, correct _enough_, anyway) so the warning can
safely be ignored for our specific use as it all lines up at link time.
2020-08-30 09:30:50 +00:00
Moonchild ce1dc7e6c6 [db] Update SQLite lib to 3.33.0 2020-08-30 09:30:28 +00:00
Moonchild a4780ebaeb Issue #1629 - Uplift implementation of <link disabled> behavior for stylesheets. 2020-08-30 09:29:45 +00:00
Gaming4JC c384fa6e25 Issue #1620 - Intrinsic Aspect Ratio: Debug Follow up.
Newly introduced aspect-ratio property did not have CSS_PROP_LIST_EXCLUDE_INTERNAL defines, resulting in the following assertion:
\!nsCSSProps::PropHasFlags(p, (1<<28)) (properties defined outside of #ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL sections must not have the CSS_PROPERTY_INTERNAL flag), at ...layout/style/nsCSSProps.cpp:289

This patch resolves the assertion by adding #ifndef around the aspect-ratio property.
2020-08-30 09:24:25 +00:00
Moonchild 5e8e0d05a6 [CSS] Alias -webkit-appearance for compatibility reasons
Since this is supported as an alias by Firefox and Edge for the same
reasons and we have websites using this to (attempt to) override the
system-provided styling with their own, leaving out the only supported
keyword we'd otherwise have (with -moz- prefix) but still stating
-webkit-.

TODO: unprefix this completely and make the vendor prefixes aliases.
2020-08-30 09:24:02 +00:00
Andy bf95a03189 Issue #1620 - Enable Intrinsic Ratio by Default
A simpler name feels so much cleaner.
2020-08-30 09:23:46 +00:00
Andy c75e412f17 Issue #1620 - Remove Development Comments 2020-08-30 09:23:37 +00:00
Andy 0bbe6ec105 Issue #1620 - Use Intrinsic Aspect Ratio for Images (uplift) 2020-08-30 09:23:18 +00:00
Moonchild 48d31ea5eb Pref and disable getRootNode()
This is apparently used for fallback selection and if available it is "assumed"
Shadow DOM is also available, while this is a utility function.

Webcompat is a nightmare sometimes.
2020-08-07 21:30:12 +00:00
Matt A. Tobin 3cf0843679 Issue #1628 - Remove redundant PREF_EM_UPDATE_BACKGROUND_URL 2020-08-07 21:30:03 +00:00
Gaming4JC ff21776616 Issue #1621 - Part 4: Check whether node can be splited.
At first, HTMLEditor::GetActiveEditingHost might return null in this situation, we should check whether nullptr is returned. At second, SplitNodeDeep returns error since curent is design mode and selection node has no parent. So we should check error.

Ref: Bug 1350772
2020-08-07 21:29:45 +00:00
Gaming4JC 2f022ab1fa Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version.

Ref: Bug 1324996
2020-08-07 21:29:36 +00:00
Gaming4JC 14e7f881be Issue #1621 - Part 2: Implement nsIAtom version of SetAttribute/RemoveAttribute/CloneAttirubte.
Add nsIAtom version of the following.
 - CloneAttribute
 - RemoveAttribute
 - RemoveAttributeOrEquivalent
 - SetAttribute
 - SetAttributeOrEquivalent

Ref: Bug 1324996
2020-08-07 21:29:27 +00:00
Gaming4JC 4f03fb2798 Issue #1621 - Part 1: CSSEditUtils should use atom for CSS property if possible.
There is a lot of string compare when using CSS property name. We should use nsGkAtoms instead.

Ref: Bug 1323138
2020-08-07 21:29:16 +00:00
Matt A. Tobin 3dd316f739 Issue #1625 - Allow MailNews Oauth2 support to be configured in confvars.sh
Baby has his bottle, you ok now?
2020-08-07 21:28:54 +00:00
Moonchild 972ab6d437 [js] Try to catch bad pointers for GC and bail if not valid. 2020-08-07 21:28:14 +00:00
Andy 83ae5bd019 Issue #1619 - Nits Picked 2020-08-07 21:28:03 +00:00
Andy c237a54f23 Issue #1619 - Add Vertical Writing Testcase
Ensures aspect ratio numerator and denominator aren't swapped in vertical writing modes.
https://bugzilla.mozilla.org/show_bug.cgi?id=1548768
2020-08-07 21:27:54 +00:00
Andy 8f72a673ca Issue #1619 - Missing Dimension Computation
This existed in Firefox before this bug.
I don't know if it came from a previous bug or was removed post-fork.
2020-08-07 21:27:40 +00:00
Andy 3266e0976f Issue #1619 - Convert Intrinsic Ratio to Float
https://bugzilla.mozilla.org/show_bug.cgi?id=1547792

Aspect Ratio handling simplified by using floating point integers:
- Multiplication of value (or inverse value) to a known side for Scaling
- No unequal equal values such as "4/3" vs "8/6" vs "20/15"
- Truly "Empty" aspect ratios, even if one dimension is not 0
2020-08-07 21:27:29 +00:00
Matt A. Tobin 4433519ae8 Add license header to media/webrtc/trunk/build/mac/find_sdk_uxp.py 2020-08-07 21:27:17 +00:00
Matt A. Tobin d419fe2d52 Use an alt script to properly determine the OSX SDK version 2020-08-07 21:27:03 +00:00
Gaming4JC c77c6de9ce Bug 1318570 - Clean up GetTextNode into TextEditRules.
EditorBase parameter of GetTextNode is unnecessary because it uses static method only. Also, we should return nsINode to reduce QI.

Resolves #1617
2020-08-07 21:26:33 +00:00
Moonchild 2ed0607c74 Merge branch 'redwood' into release 2020-07-30 09:37:13 +00:00
athenian200 922a72766c Issue #1615 - SunOS LDAP cleanup.
I meant to do this a long time ago, but basically it accounts for the new XP_SOLARIS build flag that never made it into the MailNews code. Additionally, it enables a compatibility flag for Solaris 11.4 that allows us to use the three-argument implementation of ctime_r still used by Solaris 11.3 and illumos (which also appears equivalent to the NSLDAPI_CTIME implementation used by libldap internally). Also, the ctime_r function has been added to the time.h header library for a while now, not sure why Mozilla thought we didn't have a ctime_r implementation.
2020-07-30 09:36:55 +00:00
Moonchild 16d1313104 Merge branch 'redwood' into release 2020-07-29 19:32:26 +00:00
Matt A. Tobin 0387f52bd3 Issue #1614 - Update en-US Dictionary 2020-07-29 19:32:08 +00:00
Moonchild a1ca8ca9bd Merge branch 'redwood' into release 2020-07-29 14:30:24 +00:00
Moonchild 2ee2ca7dfb Improve dll loading on Windows. 2020-07-29 14:29:33 +00:00
Michael Tuexen 0d7b7b74c6 [WebRTC] Stop putting addresses in the cookie chunk.
When using AF_CONN addresses, don't put these in the COOKIE
chunk. For these addresses it is possible to reconstruct them
locally. Conceptually, addresses are something to be shared
with the peer, but in the case of AF_CONN this might not be
the case. Therefore, zero then out.

Thanks to Natalie Silvanovich of Google Project Zero for
finding and reporting the issue.
2020-07-29 14:29:23 +00:00
Moonchild 45db2388fe [dom] Fix a spec compliance issue with the HTML LS regarding script loading.
This fixes a spec compliance issue with section 8.1.4.2 Fetching scripts.
2020-07-29 14:29:10 +00:00
Moonchild 323288bc72 [js] Don't improve TypeSets containing the magic-args type.
JIT optimizations involving the Javascript 'arguments' object could
potentially confuse later optimizations, so we simply disable these
optimizations as a DiD measure.
2020-07-29 14:28:55 +00:00
Andrea Marchesini 3323a8eda3 [xpcom] Make Base64 compatible with ReadSegments() with small buffers. 2020-07-29 14:28:45 +00:00
Jan de Mooij 71293f0fe4 [js] Fix Sink to check for non-recoverable operands. 2020-07-29 14:28:36 +00:00
Moonchild a91722be27 [network/dom] Improve sanitization of download filenames. 2020-07-29 14:28:24 +00:00
Matt A. Tobin 1ef64f9ea3 Follow up to 39be34c06 - The check sound be if not ordered
FINE! I'll go to bed already...
2020-07-28 15:51:37 +00:00
Matt A. Tobin 4a960879c8 [MailNews] Allow setting "Local Folders" as always the first displayed account 2020-07-28 15:50:20 +00:00
Matt A. Tobin 4329ae3337 [MailNews] Allow ordering of accounts to respect mail.accountmanager.accounts 2020-07-28 15:50:09 +00:00
Moonchild ad453f0b28 Issue #1391 - Remove the DOM battery API 2020-07-28 15:46:41 +00:00
Moonchild d332d4a60d Fix line endings. 2020-07-28 10:38:28 +00:00
Moonchild ad5e9449d2 Issue #1587 Part 12 (followup 2): Allow clearing of signal by setting to null. 2020-07-28 10:38:16 +00:00
Moonchild 71848c23a4 Issue #1587 Part 11 (followup 1): Implement multithreaded signals for workers. 2020-07-28 10:38:04 +00:00
Moonchild 1d321e689e [css] Enable various arbitrarily-disabled CSS features in the platform.
These should all be spec-compliant and were (for release-trickling of features)
arbitrarily disabled by Mozilla at our fork point. There's no real reason to
keep them disabled since they are used in the wild.
2020-07-23 23:17:18 +00:00
Matt A. Tobin b9b9d5bfb9 Issue #1612 - Add-ons targeting Toolkit's ID (and not Firefox's) should be considered "native" by the Add-ons Manager when using the Dual-GUID system
A version bump triggering add-on compatibility check will re-evaluate the "native" status (among other things) so no extra or special work is required to fix erroneous warnings.

tl;dr instafix!
2020-07-23 23:17:09 +00:00
Matt A. Tobin b92abc83c2 Issue #1611 - Enable WASM by default but only enable jit when 64bit 2020-07-23 23:16:56 +00:00
Gaming4JC 4950c982e0 Issue #618 - Remove eager instantiation - Debug follow up
The added debug assertion did not take into account microtask refactoring done in BZ 1405821.
Resulting in error: no member named 'IsInMicroTask' in 'nsContentUtils'.

This resolves the error.
2020-07-12 19:40:18 +00:00
Moonchild 86b184b957 Revert "Revert "Issue #1445 - strings cleanup""
This reverts commit 554183b5dd.
2020-07-12 01:35:45 +02:00
Moonchild 33ba46c6bb Revert "Revert "Issue #1445 - Add a link to details on using Firefox extensions in Pale Moon""
This reverts commit 7ba07f4a17.
2020-07-12 01:35:30 +02:00
Moonchild 451980d51b Revert "Revert "Issue #1445 - remove redundant nativeIndicator""
This reverts commit 0fb23389f5.
2020-07-12 01:35:17 +02:00
Moonchild 4ddbe58171 Revert "Revert "Issue #1445 - Use the detailed string also in the list entries.""
This reverts commit 0c150945dc.
2020-07-12 01:35:04 +02:00
Moonchild 84caa4f3ad Revert "Revert "Issue #1446 - Only match extension add-on types for target applications.""
This reverts commit b089b365d6.
2020-07-12 01:34:51 +02:00
Moonchild 4f44e23c16 Revert "Revert "Issue #1446 - Only allow extension add-on types for Firefox compat mode.""
This reverts commit 55fa46d059.
2020-07-12 01:34:38 +02:00
Moonchild a69eda9b9c Revert "Revert "Issue #1445 - Clarify the status of extensions in the Add-On manager""
This reverts commit d21b46fc9c.
2020-07-12 01:34:17 +02:00
Moonchild f1b51be787 Merge branch 'redwood' into release 2020-07-10 18:46:10 +00:00
Moonchild 82faff19e1 [network] Use query and ref lengths if available in nsStandardURL. 2020-07-10 18:34:52 +00:00
Moonchild 1597b61148 [js] Get the class pointer from the ObjectGroup in NativeObject::slotSpan
This changes NativeObject::slotSpan() to get the class from the object group
rather than getting it from the base shape to avoid a race between
Shape::ensureOwnBaseShape and background sweeping.
2020-07-10 18:34:43 +00:00
Moonchild 694c5f889c Force clobber 2020-07-10 18:34:31 +00:00
Moonchild c1f8c0cb5d [NSS] Version and build bump 2020-07-10 18:33:22 +00:00
Sohaib ul Hassan dcab408a5f [NSS] Implement constant-time GCD and modular inversion
The implementation is based on the work by Bernstein and Yang
(https://eprint.iacr.org/2019/266)
"Fast constant-time gcd computation and modular inversion".

It fixes the old mp_gcd and s_mp_invmod_odd_m functions. The patch also fixes
mpl_significant_bits s_mp_div_2d and s_mp_mul_2d by having less control flow to
reduce side-channel leaks.

Co-authored by : Billy Bob Brumley
2020-07-10 18:33:11 +00:00
Moonchild 407c503fa4 [js] Improve readability and control flow of js date string parser. 2020-07-10 18:33:01 +00:00
Byron Campen [:bwc] 9130f12906 [WebRTC] Make candidate pair insertion code easier to read/understand.
Includes removing an error code for a function that never fails, and removing an
error return when the function successfully did what it said it would.

Ref: BZ 1644477
2020-07-10 18:32:51 +00:00
Moonchild 5e2b3d1d89 [AppCache] Add check for disallowed encoded path separators 2020-07-10 18:32:35 +00:00
Moonchild 0c5a41e894 [image] Add a sanity check to JPEG encoder buffer handling, just in case. 2020-07-10 18:32:26 +00:00
Moonchild e29a8bd113 Issue #618 - Fix typo and remove old function declarations. 2020-07-10 18:31:16 +00:00
Moonchild 83abc5af59 Issue #618 - Report source position information (line/column)
Report source position information for module export resolution failures.

Ref: BZ 1362098
2020-07-10 18:31:06 +00:00
Moonchild 47101f49c0 Issue #618 - Slightly improve module scripting tests.
Ref: BZ 1388728
2020-07-10 18:30:57 +00:00
Moonchild f6a6900a6b Issue #618 - Further align error handling for module scripts with the spec
Ref: BZ 1388728
2020-07-10 18:30:48 +00:00
Moonchild 40aad1a220 Issue #618 - Remove context and heap-idle check
For checking if a module is in an error state and what the error is, it
shouldn't matter if we are currently GC-ing or not. So we don't need to check
for it, which removes the requirement to pass in the JS context (needed for
AssertHeapIsIdle's runtime check); this unblocks progress where otherwise we'd
have to figure out what the context is at the module level just to satisfy this
check.
2020-07-10 18:30:39 +00:00
Moonchild 1e14031a59 Issue #618 - Remove eager instantiation
This backs out the stuff added in Bug 1295978.
Ref: BZ 1295978, 1388728
2020-07-10 18:30:30 +00:00
Moonchild 765c90318f Issue #618 - Fix JSAPI additions to pass the JS context. 2020-07-10 18:30:14 +00:00
Moonchild ef8d18da70 Issue #618 - Match JSAPI names with the changes in 9ca7414722
Ref: BZ 1388728
2020-07-10 18:30:03 +00:00
Moonchild 7bf3e4c464 Issue #618 - Add APIs to query module record errors
Ref: BZ 1388728
2020-07-10 18:29:52 +00:00
Moonchild 57523a0deb Issue #618 - Update code comments for ModuleInstantiate 2020-07-10 18:29:43 +00:00
Moonchild 3f25d0c8e4 Issue #618 - Align module instantiation/errors with the updated spec.
Store and re-throw module instantiation and evaluation errors.
Ref: BZ 1374239, 1394492
2020-07-10 18:29:33 +00:00
Moonchild ab05017026 Issue #618 - Add clarifying code comments. 2020-07-10 18:29:22 +00:00
Moonchild 255c7f6f3a Issue #618 - Check for failed instantiation when starting to fetch dependencies
If instantiation has failed, then also fail the load and don't fetch imports.
Ref BZ: 1358882
2020-07-10 18:29:13 +00:00
Moonchild 5ffe27bb03 Issue #1603 - Part 2: Split some classes out of ScriptLoader.cpp
This splits ScriptLoader up the same way Mozilla did with the exception of
ScriptRequest due to the fact that ScriptLoader and ScriptRequest are
interdependent and would create a circular dependency if split apart when not
using unified building.
2020-07-10 18:29:02 +00:00
Moonchild 0633844f46 Issue #1603 - Part 1: Reorganize ScriptLoader/ScriptElement
- Moves scripting parts of DOM into 'dom/script'
- Renames nsScript{Loader/Element} to Script{Loader/Element}
- Adjusts all callers
2020-07-10 18:28:50 +00:00
Gaming4JC d0126b96cd Bug 1316302 - Part 4: Refine HTMLEditRules::TryToJoinBlocks() and HTMLEditRules::MoveNodeSmart() with early return style for making scope of EditActionResult variable smaller
For now, let's make the scope of EditActionResult variable in them smaller without big change.

Tag #1563
2020-06-27 02:20:41 +02:00
Gaming4JC d4cd571021 Bug 1316302 - Part 3: Create EditActionResult class for making the methods which return nsresult, handled and canceled with out params
In a lot of places, edit action handlers and their helper methods return nsresult and aHandled and aCanceled with out params. However, the out params cause the code complicated since:

* it's not unclear if the method will overwrite aHandled and aCanceled value.
* callers need to create temporary variable event if some of them are not necessary.

This patch rewrites the helper methods of HTMLEditRules::WillDeleteSelection() with it.

Tag #1563
2020-06-27 02:20:28 +02:00
Gaming4JC 016c55f409 Bug 1316302 - Part 2: WillDeleteSelection() should retry to handle it when selection is collapsed and JoinBlocks() doesn't handle nor cancel the action
When selection is collapsed and JoinBlocks() doesn't handle nor cancel the action, WillDeleteSelection() should move selection to the start/end of leftmost/rightmost editable leaf node and retry to handle the action again.

For avoiding infinite loop, it checks if selected node is changed actually before calling itself again.

Tag #1563
2020-06-27 02:20:16 +02:00
Gaming4JC 016313d559 Bug 1316302 - Part 1: Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.

This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.

Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.

Tag #1563
2020-06-27 02:20:04 +02:00
wolfbeast 1fa428a789 Issue #1602 - Make sure we have a JSObject before trying to get global.
Dynamic script loading/unloading (thank you modules) can yank the script
out from under us before the JS API for it is initialized, leading to
null deref crashes.
This adds a simple check if the passed-in object is sane and present.
Resolves #1602
2020-06-27 02:19:50 +02:00
Lootyhoof d41fe2f55a Follow up to Issue #1578 - Remove unnecessary MOZ_ASSERT 2020-06-17 12:17:20 +00:00
Moonchild 4d9da86152 Issue #1594 - restore UAC elevation in the uninstaller.
Effectively backs out BZ 1333789 which was uplifted to
Firefox before we forked for UXP.
Resolves #1594
2020-06-17 12:13:15 +00:00
Gaming4JC aa19e3d8ba Bug 1613623 - For IMAP, no longer allow STARTTLS when server sends PREAUTH greeting.
Tag #1312
2020-06-17 12:12:36 +00:00
Moonchild f5b146a460 Issue #1587 - Part 10: Expose controlling pref and enable by default 2020-06-13 11:53:05 +02:00
Moonchild e2403eeb5a Issue #1587 - Part 9: Immediately reject an already-aborted signal 2020-06-13 11:52:53 +02:00
Moonchild 301ae8c2df Issue #1587 - Part 8: Remove controller follow/unfollow
Since it didn't end up being in the final spec after all.
2020-06-13 11:52:42 +02:00
Moonchild 21403c31e0 Issue #1587 - Part 7: Rename FetchController to AbortController
Also renames FetchSignal to AbortSignal. Includes renaming the various
controlling prefs to enable.
2020-06-13 11:52:30 +02:00
Moonchild 29bca891d5 Issue #1587 - Part 6: Move FetchController/Signal to its own dir
Since it is specced separately from fetch.
2020-06-13 11:52:17 +02:00
Moonchild bb70605829 Issue #1587 - Part 5: Hook FetchObserver up to the Fetch API 2020-06-13 11:52:04 +02:00
Moonchild 3f3d626434 Issue #1587 - Part 4: Implement FetchObserver 2020-06-13 11:51:53 +02:00
Moonchild a04d67dd12 Issue #1587 - Part 3: Hook FetchSignal up to the Fetch API 2020-06-13 11:51:41 +02:00
Moonchild 9e2da53a02 Issue #1587 - Part 2: Implement controller follow/unfollow 2020-06-13 11:51:30 +02:00
Moonchild 2b41c85019 Issue #1587 - Part 1: Implement FetchController/FetchSignal interface 2020-06-13 11:51:18 +02:00
adeshkp e9d41c9968 Issue #1542 - Fix a typo in wasm which was causing build failure on ARM 2020-06-13 11:50:21 +02:00
Moonchild 0e0feed5da Issue #1585 - Replace node.rootNode with node.getRootNode()
This removes the (default disabled) node.rootNode readonly attribute
and replaces it with a node.getRootNode() function per WhatWG
spec discussion.
Based on work by John Dai <jdai@mozilla.com>
2020-06-13 11:50:06 +02:00
Matt A. Tobin 7f238b1cf9 Follow up to Issue #1578 - Preprocess the popup binding 2020-06-13 11:49:53 +02:00
Lootyhoof 6235023c8b Issue MoonchildProductions/UXP#1578 - Add global menubar support for GTK 2020-06-13 11:49:36 +02:00
Moonchild f51beb3fda Issue #1560 - Always include speech synthesis IPDLs
This is entangled with the IPC messaging configuration so
we need these IPDLs even if sppech synthesis is otherwise
not being built.

This resolves #1560
2020-06-13 11:49:13 +02:00
Moonchild a934165b57 [NSS] Update exported symbols
Some symbols were missing from export which might lead to build bustage.
2020-06-13 11:47:25 +02:00
Gaming4JC 2516886ceb Issue #1580 - Add missing MP3Demuxer.h to MediaDecoderReader.h
Follow up for dom/media work on Issue #80. Fixes non-optimized build bustage.
2020-06-13 11:47:05 +02:00
Moonchild fbab1f4f9e [DOM] Hard-disable webcomponents and customelements prefs (redwood) 2020-06-07 18:09:13 +00:00
Moonchild 90c42b7afd Fix missing include 2020-06-03 11:45:28 +00:00
Moonchild 2deaddfca2 Fix missing include 2020-06-03 11:44:55 +00:00
Moonchild 0ccb51f2ae Merge branch 'release' of https://github.com/MoonchildProductions/UXP into release 2020-06-03 10:51:52 +00:00
Moonchild 5e5f2277f5 Merge branch 'redwood' into release 2020-06-03 10:50:44 +00:00
Moonchild 265d1b8019 [NSS] Bump NSS version 2020-06-03 10:49:54 +00:00
Moonchild 687f535b9c [NSS] Force a fixed length for DSA exponentiation 2020-06-03 10:49:43 +00:00
Moonchild 54b4fb0be6 Bug 1632717 2020-06-03 10:49:35 +00:00
adeshkp a054ece041 Issue #1566 - Lowercase link filename extension 2020-06-03 10:49:23 +00:00
Moonchild c6ca4380e9 Merge remote-tracking branch 'origin/redwood' into release 2020-06-01 21:58:35 +00:00
athenian200 744b044935 Issue #1571 - Remove JEMALLOC_USES_MAP_ALIGN and fix 48-bit addressing on SunOS AMD64.
The JEMALLOC_USES_MAP_ALIGN code has turned out to be worse than useless, and in fact it breaks 64-bit SunOS. It's very old and turned out not to be needed anymore because the way the memory allocator works has changed since it was implemented. It prevented a fix I tried for 48-bit addressing from working properly. However, without either this code or the 48-bit addressing fix, the 64-bit version won't even start, which is why I thought the code was still needed.

https://bugzilla.mozilla.org/show_bug.cgi?id=457189

https://hg.mozilla.org/mozilla-central/rev/a26c500b98ab

The 48-bit addressing fix is based on code found here:

https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/web/firefox/patches/patch-js_src_gc_Memory.cpp.patch

I already applied these changes to js/src/gc/Memory.cpp, but as I was looking through jemalloc.c I saw that there were very similar ifdefs for Linux on SPARC as the ones I'd had to enaable in Memory.cpp, but for whatever reason the patches I found didn't touch them. So I tried doing for jemalloc.c what was already done for Memory.cpp, and it worked (but only after I removed the map align code).
2020-06-01 11:48:25 +00:00
Moonchild b246f7b2f1 Update README.md
wiki -> site
2020-06-01 11:48:15 +00:00
wolfbeast 8618719921 Issue #1570 - Implement globalThis
This resolves #1570
2020-06-01 11:48:07 +00:00
Fedor b6db7da98a Issue #1558 - Prevent null deref crash in WebrtcVideoConduit DTOR 2020-06-01 11:47:44 +00:00
Ascrod 9805ddc483 Issue #361 - Remove dead Android code.
See Bug 1629030, part 3.
2020-06-01 11:47:09 +00:00
Trushita 83ac4391b6 Bug 1154295 - use normal formatting for plaintext documents in reader mode
Before this change the plain text document in reader mode was not formatted/styled properly.

Tag #361.
2020-06-01 11:47:01 +00:00
Cameron McCormack 027a4cac9c Bug 1621479 - Fix typo in reader mode CSS class preservation list.
Tag #361.
2020-06-01 11:46:53 +00:00
Ascrod 66470fa1d8 Issue #361 - Update Readability from upstream.
(git rev 52ab9b5c8916c306a47b2119270dcdabebf9d203)
2020-06-01 11:46:41 +00:00
athenian200 451509e2c0 Issue #1571 - Remove JEMALLOC_USES_MAP_ALIGN and fix 48-bit addressing on SunOS AMD64.
The JEMALLOC_USES_MAP_ALIGN code has turned out to be worse than useless, and in fact it breaks 64-bit SunOS. It's very old and turned out not to be needed anymore because the way the memory allocator works has changed since it was implemented. It prevented a fix I tried for 48-bit addressing from working properly. However, without either this code or the 48-bit addressing fix, the 64-bit version won't even start, which is why I thought the code was still needed.

https://bugzilla.mozilla.org/show_bug.cgi?id=457189

https://hg.mozilla.org/mozilla-central/rev/a26c500b98ab

The 48-bit addressing fix is based on code found here:

https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/web/firefox/patches/patch-js_src_gc_Memory.cpp.patch

I already applied these changes to js/src/gc/Memory.cpp, but as I was looking through jemalloc.c I saw that there were very similar ifdefs for Linux on SPARC as the ones I'd had to enaable in Memory.cpp, but for whatever reason the patches I found didn't touch them. So I tried doing for jemalloc.c what was already done for Memory.cpp, and it worked (but only after I removed the map align code).
2020-06-01 11:00:26 +02:00
wolfbeast 7895b8acd9 Issue #1570 - Implement globalThis
This resolves #1570
2020-06-01 10:59:51 +02:00
Fedor ccff4610c5 Issue #1558 - Prevent null deref crash in WebrtcVideoConduit DTOR 2020-06-01 10:59:15 +02:00
Moonchild 3045e1d5c9 [permissions] Fix build bustage with --disable-permissions 2020-05-23 16:13:26 +02:00
Moonchild 44de3c3023 [printing] Fix build bustage with --disable-printing 2020-05-23 16:13:14 +02:00
athenian200 a3124c55a1 Issue #1557 - Allow event dispatch on disabled form controls. (uplift) 2020-05-23 16:12:59 +02:00
athenian200 c4ed566602 Revert "Merge pull request #1357 from athenian200/form-disabled-issue"
This reverts commit ed88b99849, reversing
changes made to c4b0715baa.
2020-05-23 16:10:40 +02:00
athenian200 15a1f78f8b Issue #1557 - Allow event dispatch on disabled form controls. (uplift) 2020-05-21 13:16:17 +00:00
athenian200 8b44473fe6 Revert "Merge pull request #1357 from athenian200/form-disabled-issue"
This reverts commit ed88b99849, reversing
changes made to c4b0715baa.
2020-05-21 13:10:27 +00:00
athenian200 6e0aee959e Issue #1540 - Stop MP3 demuxer from choking on very small files. 2020-05-20 17:18:39 +02:00
Moonchild 99c2e698d2 Issue #1538 - remove speech recognition engine
This removes speech recognition, pocketsphinx, training models
and the speech automated test interface.
This also re-establishes proper use of MOZ_WEBSPEECH to work
for the speech API (synthesis part only) that was a broken mess
before, with some synth parts being always built, some parts
being built only with it enabled and recognition parts being
dependent on it. I'm pretty sure it'd be totally busted if you'd
ever have tried building without MOZ_WEBPEECH before.

Tested that synthesis still works as-intended.

This resolves #1538
2020-05-20 14:04:17 +00:00
Jiaxun Yang 15ac4021b0 Bug 1430745 - IPC: Fix unaligned accesses in DirReaderLinux
Tag: #1542
2020-05-20 14:04:01 +00:00
Jiaxun Yang 344b272991 Issue #1542 - [mtransport] Fix unaligned memory allocation in r_memory
Unaligend memory access can't work on RISC.
2020-05-20 14:03:54 +00:00
Jiaxun Yang fb8fcffe1d Bug 1426323 - Media: WebRTC: Fix build config for MIPS64
Tag: #1542
2020-05-20 14:03:46 +00:00
Jiaxun Yang b67a630966 Issue #1542 - [WebRTC] Set CPU speed to -1 on MIPS
CPU is pretty slow due to lack of SIMD optmization.
2020-05-20 14:03:38 +00:00
Jiaxun Yang a148bd40d8 Issue #1542 - [WebRTC] Don't use post proc on MIPS 2020-05-20 14:03:28 +00:00
Jiaxun Yang e59757fddf Bug 1384826 - Media: WebRTC: Fix build config for MIPS
Tag: #1542
2020-05-20 14:03:20 +00:00
Jiaxun Yang be954fca72 Bug 1412030 - [MIPS] Emit wasm memory access information
Tag: #1542
2020-05-20 14:03:12 +00:00
Jiaxun Yang f411e02716 Bug 1330942 - move MemoryAccessDesc::isUnaligned to the ARM/MIPS platform layer
Tag: #1542
2020-05-20 14:03:04 +00:00
Jiaxun Yang a34d02924c Bug 1441521 : [MIPS] Optimize comparation with small constants
Tag: #1542
2020-05-20 14:02:56 +00:00
Jiaxun Yang 084ea153c1 Bug 1430693 - IonMonkey: MIPS: Fix generic NaN for legacy mips (IEEE 754-1985)
Tag: #1542
2020-05-20 14:02:49 +00:00
Jiaxun Yang c40bda67bb Bug 1424978 - IonMonkey: MIPS64: Fix unboxNonDouble for Int32
Tag: #1542
2020-05-20 14:02:42 +00:00
Jiaxun Yang 0c2de12ffd Bug 1424978 - IonMonkey: MIPS64: Fix tagValue function
Tag: #1542
2020-05-20 14:02:35 +00:00
Jiaxun Yang e44709892b Bug 1424978 - IonMonkey: MIPS64: Fix boxValue function
Tag: #1542
2020-05-20 14:02:28 +00:00
Jiaxun Yang 237f8d7ebd Bug 1390802 - IonMonkey: MIPS64: Fix storeValue function
Tag: #1542
2020-05-20 14:02:21 +00:00
Jiaxun Yang 5001007287 Bug 1424978 - IonMonkey: MIPS: Fix ma_store_unaligned
Tag: #1542
2020-05-20 14:02:13 +00:00
Jiaxun Yang f83a88907a Bug 1424978 - IonMonkey: MIPS: Fix ma_addTestCarry
Tag: #1542
2020-05-20 14:02:06 +00:00
Jiaxun Yang ff8603d7a2 Bug 1390459 - mulby3 function implement error on mips platform
Tag: #1542
2020-05-20 14:02:00 +00:00
Jiaxun Yang 31ad2d12db Bug 1271968 - IonMonkey: MIPS: Refactor addMixedJump.
Tag: #1542
2020-05-20 14:01:52 +00:00
Jiaxun Yang 494cfe32c9 Bug 1271968 - wasm: MIPS: Port mixed jump for wasm.
Tag: #1542
2020-05-20 14:01:45 +00:00
Jiaxun Yang b4f0be5e95 Bug 1271968 - IonMonkey: MIPS: Refactor PatchWrite_NearCall.
Tag: #1542
2020-05-20 14:01:38 +00:00
Jiaxun Yang ac62e4cfdd Bug 1271968 - IonMonkey: MIPS: Handle conditional branch in out of line code of mixed jump.
Tag: #1542
2020-05-20 14:01:30 +00:00
Jiaxun Yang 0fa41e2adc Bug 1271968 - IonMonkey: MIPS: Merge MacroAssembler::branchWithCode.
Tag: #1542
2020-05-20 14:01:22 +00:00
Jiaxun Yang 61af6cc299 Bug 1271968 - IonMonkey: MIPS: Merge MacroAssembler::ma_jal.
Tag: #1542
2020-05-20 14:01:14 +00:00
Jiaxun Yang c3a21acaee Bug 1271968 - IonMonkey: MIPS: Merge Assembler::bind.
Tag: #1542
2020-05-20 14:01:06 +00:00
Jiaxun Yang 3fb8648bed Bug 1271968 - IonMonkey: MIPS: Replace long jumps by mixed jumps.
Tag: #1542
2020-05-20 14:00:59 +00:00
Jiaxun Yang f18d78dea0 Bug 1271968 - IonMonkey: MIPS: Make jit code in same 256 MB-aligned region
Tag: #1542
2020-05-20 14:00:49 +00:00
Jiaxun Yang 16ae8db806 [IonMonkey] MIPS: Import small optimizations from load & store 2020-05-20 14:00:40 +00:00
Jiaxun Yang 43f57fe642 Issue #1542 - IonMonkey: MIPS32: Fix build error on O32 platform. 2020-05-20 14:00:30 +00:00
Jiaxun Yang f50410bd79 Bug 1323646 - IonMonkey: MIPS64: Fix range checking in ma_addTestOverflow
Tag: #1542
2020-05-20 14:00:23 +00:00
Jiaxun Yang 609d904cc1 Bug 1323642 - IonMonkey: MIPS64: Fix load unsigned 48-bit immediate
Issue:
In ma_li(Register, ImmWord):
	Load unsigned 48-bit immediate: 0x0000_8000_0000_0000
	Wrong instructions stream:
		lui	reg, 0x8000
		dsll	reg, reg, 16 # reg = 0xffff_8000_0000_0000
	Fixed instructions stream:
		lui	reg, 0x8000
		dinsu	reg, zero, 32, 32
		dsll	reg, reg, 16

Tag: #1542
2020-05-20 14:00:15 +00:00
Jiaxun Yang fa1628f767 Bug 1323136 - wasm: MIPS: Do bounds check in 32-bit
Tag: #1542
2020-05-20 14:00:08 +00:00
Jiaxun Yang 0136960ec0 Bug 1344597 - Baldr: MIPS: Fix trap type of unsigned divide by zero
Tag: #1542
2020-05-20 14:00:01 +00:00
Jiaxun Yang d9e0b4be85 Bug 1394286 - mips64: fix error correction about stackpointer within function _NS_InvokeByIndex
Tag: #1542
2020-05-20 13:59:53 +00:00
Jiaxun Yang a17ab79b88 Issue #1542 - nsprpub: _PR_SI_ARCHITECTURE add missing mips64 2020-05-20 13:59:46 +00:00
Jiaxun Yang f11fff32fa Issue #1542 - IonMonkey: MIPS: Define JS_CODEGEN_MIPSXX by HAVE_64BIT_BUILD.
MIPSXX is required for 64bit build.
2020-05-20 13:59:39 +00:00
adeshkp 912e37d202 Issue #80 - Include MDNSResponderOperator.h in libmdns/nsDNSServiceDiscovery.h for Mac
This is needed for forward declaration of `BrowseOperator` and `RegisterOperator`.
2020-05-20 13:59:08 +00:00
Gaming4JC e15b6906c5 Issue #80 - Add nsSocketTransportService2.h to ThrottleQueue.cpp 2020-05-20 13:59:00 +00:00
Moonchild b048f3d473 Issue #80 - De-unify netwerk/wifi 2020-05-20 13:58:52 +00:00
Moonchild 6cdd6c6286 Issue #80 - De-unify netwerk/streamconv 2020-05-20 13:58:44 +00:00
Moonchild 25c1a5cbe3 Issue #80 - De-unify netwerk/srtp 2020-05-20 13:58:37 +00:00
Moonchild 83a71d9c9d Issue #80 - De-unify netwerk/socket 2020-05-20 13:58:30 +00:00
Moonchild d8a0849b7f Issue #80 - De-unify netwerk/protocol/http 2020-05-20 13:58:23 +00:00
Moonchild 02923a3648 Issue #80 - De-unify netwerk/protocol/res 2020-05-20 13:58:17 +00:00
Moonchild a5da610b87 Issue #80 - De-unify netwerk/protocol/ftp 2020-05-20 13:58:08 +00:00
Moonchild aedf5c0169 Issue #80 - De-unify smaller netwerk/protocol components
- data
- device
- file
- viewsource
- wyciwyg
2020-05-20 13:57:59 +00:00
Moonchild 1c16924e08 Issue #80 - De-unify netwerk/protocol/about 2020-05-20 13:57:52 +00:00
Moonchild 9c21ed1804 Issue #80 - De-unify netwerk/ipc 2020-05-20 13:57:44 +00:00
Moonchild 41b982b9bb Issue #80 - De-unify netwerk/dns 2020-05-20 13:57:37 +00:00
Moonchild 4c76b52e09 Issue #80 - De-unify netwerk/cookie 2020-05-20 13:57:30 +00:00
Moonchild e50cfc7b63 Issue #80 - De-unify netwerk/cache2 2020-05-20 13:57:24 +00:00
Moonchild 8bbc95988a Issue #80 - De-unify netwerk/cache 2020-05-20 13:57:16 +00:00
Moonchild ed9eb8f722 Issue #80 - De-unify netwerk/base 2020-05-20 13:57:09 +00:00
Moonchild 1cd91bc155 Issue #80 - De-unify editor/txmgr and editor/txtsvc 2020-05-20 13:56:50 +00:00
Moonchild 8c8e5fba69 Issue #80 - De-unify editor/libeditor 2020-05-20 13:56:43 +00:00
Moonchild ed1ea719dd Issue #80 - De-unify editor/composer 2020-05-20 13:56:35 +00:00
adeshkp d38d5414fc Issue #80 - Include gfx/Logging.h in NativeFontResourceMac.cpp 2020-05-20 13:56:20 +00:00
Gaming4JC 1182ecd0b4 Issue #80 - Include gfxEnv.h in gfx/gl/GLLibraryEGL.cpp 2020-05-20 13:56:12 +00:00
Moonchild 3220b7dc56 Issue #80 - Fix up gfx/ipc and gfx/src for Linux.
This removes an unused Telemetry enum
2020-05-20 13:56:02 +00:00
Moonchild 3e82ac05b1 Issue #80- De-unify gfx/layers
Excludes layers/ipc/CompositorBridgeParent and CrossProcessCompositorBridgeParent
because the latter purposely uses functions implemented in the former.
See also code comment in CrossProcessCompositorBridgeParent.cpp

Note: likely dead code for us anyway; likely not worth investing in to solve.
2020-05-20 13:55:50 +00:00
Moonchild 3ab7bd811f Issue #80 - De-unify gfx/ycbcr 2020-05-20 13:55:43 +00:00
Moonchild 8c4892fb45 Issue #80 - De-unify gfx/src 2020-05-20 13:55:36 +00:00
Moonchild 11749de754 Issue #80 - De-unify gfx/skia and stop using dangerous opts 2020-05-20 13:55:28 +00:00
Moonchild 5186d78330 Issue #80 - De-unify gfx/ots 2020-05-20 13:55:22 +00:00
Moonchild 0538c32e32 Issue #80 - De-unify gfx/ipc 2020-05-20 13:55:14 +00:00
Moonchild 46040d136d Issue #80 - De-unify gfx/harfbuzz 2020-05-20 13:55:08 +00:00
Moonchild 35c731cf08 Issue # 80 - Fix up gfx/2d/DataSurfaceHelpers
De-unified build requires <string.h> instead of <cstring> to
prevent stdlib confusion.
2020-05-20 13:55:01 +00:00
Moonchild b1851a4ad0 Issue #80 - de-unify and fix up gfx/graphite2
With de-unified building we have to re-apply the fix-up
for <cstdio>, and additionally the same for <cstring>
to prevent the compiler picking the wrong versions of
standard functions.
2020-05-20 13:54:54 +00:00
Moonchild 935ce8fa8e Issue #80 - Fix deps in gfxFont-Impl.h 2020-05-20 13:54:18 +00:00
Moonchild 85b89ee754 Issue #80 - Split out GetShapedWord template function 2020-05-20 13:54:11 +00:00
Moonchild 9c006089e1 Issue #80 - Fix gfx/thebes Windows conditional 2020-05-20 13:54:04 +00:00
Moonchild c3fc87a904 Issue #80 - De-unify gfx/gl 2020-05-20 13:53:57 +00:00
Moonchild 5f04717b00 Issue #80 - De-unify gfx/config 2020-05-20 13:53:49 +00:00
Moonchild e74b4ad8f8 Issue #80 - De-unify gfx/cairo 2020-05-20 13:53:41 +00:00
Moonchild fa68aa6fd5 Issue #80 - De-unify gfx/2d 2020-05-20 13:53:34 +00:00
Moonchild 9f37161ec5 Issue #80 - De-unify gfx/thebes 2020-05-20 13:53:25 +00:00
win7-7 21348b56d9 issue #1547 - Correct z-ordering for some table parts and add reftests 2020-05-20 13:52:54 +00:00
win7-7 ad69c023a9 Issue #1545 - Fix border-radius on table row groups, rows, column groups, or columns
Before issue #146, border-radius on row groups, rows, column groups, or columns don't apply to the background of each cell, yet the border-radius on the cell itself does.

After issue #146, the behaviors changed. In this patch, I tried to revert the behaviors of border-radius on table row groups, rows, column groups, or columns back to what happened before issue #146.

Also: Don't override GetBorderRadii in nsBCTableCellFrame.
2020-05-20 13:52:15 +00:00
Moonchild 206b1af429 Issue #457 - Silence some superfluous compiler warnings in cairo 2020-05-20 13:52:01 +00:00
Moonchild 2bdbc482e7 Bump platform version 2020-05-20 13:51:22 +00:00
Moonchild a444b5cc39 Issue #1543 - Follow-up: avoid displaying the Alt text if an image is loading.
This prevents the Alt text from briefly being shown before being replaced
with the image.
2020-05-20 13:50:04 +00:00
Moonchild d050188cd5 Issue #1543 - Align <img> with no src to the updated spec. 2020-05-20 13:49:55 +00:00
win7-7 3a1bebfb87 Issue #1355 - Fix the nit, remove nsPoint offset in nsFrame.cpp and change PresShellState member order 2020-05-20 13:49:35 +00:00
win7-7 d3d3aad6e5 Issue #1355 - Better way to create display items for column backgrounds
Part 1: Remove current table item, as it's never set.

Part 2: Get rid of generic table painting code, and handle each class separately.

Part 4: Hoist outline skipping into col(group) frame code.

Part 5: Skip box-shadow for table column and column groups.

Part 6: Store column and column group backgrounds separately, and then append them before the rest of the table contents.

Part 7: Pass rects in display list coordinates to AppendBackgroundItemsToTop.

Part 8: Create column and column group background display items as part of the cell's BuildDisplayList.

Part 9: Used cached values instead of calling nsDisplayListBuilder::ToReferenceFrame when possible, since it can be expensive when the requested frame isn't the builder's current frame.

Part 10: Make sure we build display items for table parts where only the normal position is visible, since we may need to create background items for ancestors at that position.

Part 11: Create an AutoBuildingDisplayList when we create background items for table columns and column groups, so that we initialize the invalidation state correctly.
2020-05-20 13:49:25 +00:00
win7-7 d8d0538162 Issue #1355 - SetNeedToCalcHasBCBorders to true when initialize nsTableFrame
In the printing preview, we create continuous table frame if table is too long to containing in a page. But the default value of NeedToCalcHasBCBorders is false which means we don't calculate HasBCBorders for continuous table frame. Thus, the border collapse is not shown when printing preview.
2020-05-20 13:49:16 +00:00
win7-7 36369e0fef Issue #1355 - Avoid unnecessary work in nsIFrame::BuildDisplayListForStackingContext() and nsIFrame::BuildDisplayListForChild() and Cleanup DescendIntoChild
Bug 1441796 - Part 1: Optimize the (pseudo)-stacking context conditions

Bug 1441796 - Part 3: Reuse the results in nsIFrame::BuildDisplayListForStackingContext() for ChildrenHavePerspective(), IsTransformed(), and Combines3DTransformWithAncestors()

Bug 1512244 - Part 1: Cleanup DescendIntoChild
2020-05-20 13:49:09 +00:00
win7-7 3c1e71f0b1 Issue #1355 - Preemptively fix build bustage for 1409114 2020-05-20 13:49:01 +00:00
win7-7 71137783ac Issue #1355 - Store the dirty rect on the display list builder rather than passing it as a parameter to BuildDisplayList
Also fix build bustage for De-unified layout/xul in nsRootBoxFrame.cpp
2020-05-20 13:48:52 +00:00
athenian200 fe0963002f Issue #1540 - Stop MP3 demuxer from choking on very small files. 2020-05-20 13:48:10 +00:00
wolfbeast aeef4240d5 Issue #1589 - Ensure computed length and data is always available 2020-05-20 13:47:45 +00:00
Gaming4JC 938e6204ef Issue #21 - Remove TelemertyVFS
This reverts m-c Bug 668378 and completely removes Telemetry SQLite IO. As a bonus this fixes a potential crash in newer SQLite versions without the need for updating this useless telemetry shim.
2020-05-20 13:47:24 +00:00
Moonchild 16aaa21930 Issue #1536 - Part 3: Parse content to decide whether it's an init segment. 2020-05-20 13:47:10 +00:00
wolfbeast 6b7997abbe Issue #1536 - Part 2: Parse content to decide whether it's a media segment. 2020-05-20 13:47:02 +00:00
wolfbeast f358c4dfa9 Issue #1536 - Part 1: Add timecode checking for the WebM parser 2020-05-20 13:46:53 +00:00
Moonchild ad5cb04d71 Issue #80 - Fix additional deprot in /layout (redwood) 2020-05-20 13:45:06 +00:00
Matt A. Tobin ba5930cc8e Issue #1449 - Implement URLSearchParams's sort() 2020-05-10 16:06:19 +02:00
wolfbeast 6376255c0c Issue #1589 - Ensure computed length and data is always available 2020-05-10 14:51:23 +02:00
Matt A. Tobin 9be6582ec3 Hyperbola IceDove should use the toolkit SearchService 2020-05-06 19:17:04 +02:00
Moonchild 883fa80f7d [XPFE] Properly anchor XUL windows when tearing down 2020-05-06 19:16:51 +02:00
Moonchild 82b6d2cf9d [WebRTC] Port some upstream sctp fixes
- add SCTP auth token boundary check.
- turn off SCTP auth and address reconfiguration.
2020-05-06 19:16:40 +02:00
Moonchild 09b4a7828e [dom] Reorder some calls to improve memory safety 2020-05-06 19:16:20 +02:00
Moonchild ed58b7905e [devtools] Port various upstream fixes 2020-05-06 19:16:06 +02:00
Moonchild 31f47a2ba4 [js] Record load in MCreateThis alias set. 2020-05-06 19:15:54 +02:00
Bas Schouten 8b3b858546 Prevent the existance of dangling pointers upon failure of FindDataStart. 2020-05-06 19:15:42 +02:00
Moonchild dd506c896f Issue #1451 - Split out ICU data file on Windows
This reduces the xul.dll size by 11 MB
2020-05-06 19:15:12 +02:00
adeshkp f8588a2e86 Issue #457 - Fix warning about inline nsINode::GetFlattenedTreeParentNodeForStyle being undefined 2020-05-06 19:14:56 +02:00
adeshkp 0aa1b02b2b Issue #1259 - Remove a leftover GMP migration function 2020-05-06 19:14:42 +02:00
Moonchild e008deb88b Issue #1450 - Remove NVidia 3D-Vision utils
Legacy, unmaintained and untested D3D9 stereo
output behind a hidden pref that nobody ever uses... :P
'nuf said. Resolves #1450
2020-05-06 19:14:17 +02:00
Moonchild 56cb90a482 Issue #1517 - Remove dom.event.highrestimestamp.enabled pref
This resolves #1517
2020-05-06 19:14:05 +02:00
Matt A. Tobin 812574875b Issue #1449 - Implement URLSearchParams's sort() 2020-05-06 19:13:52 +02:00
Matt A. Tobin cd196a77d4 Issue #1531 - Work around GCC 10 defaulting to -fno-common in media/ffvpx/libavcodec/
Build Reference:
26:39.53 ../../../build/unix/gold/ld: error: /home/mattatobin/development/.obj/trunk-f1f9fdabf/navigator-x86_64-pc-linux-gnu-gtk2/media/ffvpx/libavcodec/flac_parser.o: multiple definition of 'ff_flac_parser'
26:39.53 ../../../build/unix/gold/ld: /home/mattatobin/development/.obj/trunk-f1f9fdabf/navigator-x86_64-pc-linux-gnu-gtk2/media/ffvpx/libavcodec/dummy_funcs.o: previous definition here
26:39.53 collect2: error: ld returned 1 exit status
26:39.53 gmake[4]: *** [/home/mattatobin/development/binoc-central/platform/config/rules.mk:773: libmozavcodec.so] Error 1

See also: https://gcc.gnu.org/gcc-10/porting_to.html
2020-05-06 19:13:31 +02:00
adeshkp e175224b88 Issue #80 - Include nsIContentInlines.h in layout/base/PositionedEventTargeting.cpp 2020-05-06 19:13:11 +02:00
Moonchild 0afb9e2d75 Issue #80 - Resolve issues with compiling on insane gcc configurations with no optimizations in layout/
(and fix a typo for cs fs)
2020-05-06 19:12:59 +02:00
Moonchild e733c3681b Issue #80 - De-unify layout/xul and tree, grid 2020-05-06 19:12:48 +02:00
Moonchild 157cd64a8e Issue #80 - De-unify layout/tables 2020-05-06 19:12:37 +02:00
Moonchild 5c3c92da90 Issue #80 - De-unify layout/svg 2020-05-06 19:12:26 +02:00
Moonchild aa21f96cf5 Issue #80 - De-unify layout/style (redwood) 2020-05-06 19:12:11 +02:00
Moonchild 537c63d600 Issue #80 - De-unify layout/printing 2020-05-06 19:06:17 +02:00
Moonchild 975db4c7f0 Issue #80 - De-unify layout/PITA... I mean layout/generic 2020-05-06 19:06:06 +02:00
Moonchild 528abd534e Issue #80 - De-unify layout/base 2020-05-06 19:05:49 +02:00
1498 changed files with 49508 additions and 388808 deletions

No files matched your search

+1 -2
View File
@@ -22,5 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Clobber for NSS Update
Clobber for NSS update
+2 -2
View File
@@ -18,7 +18,7 @@ directory. This will contain relevant documentation regarding contributing,
using and distributing this code and its binaries.
If you are interested in the development and building side of things, some
information will be available on the [Pale Moon developer wiki](http://developer.palemoon.org).
information will be available on the [Pale Moon developer site](http://developer.palemoon.org).
You are also always welcome to get in touch with our community on the [Pale Moon forum](https://forum.palemoon.org/).
### A note about trademarks and branding
@@ -36,4 +36,4 @@ improvement patches upstream to its origin to mutually improve the platform and
a future for XUL.
## Looking for Pale Moon and Basilisk?
As of [`Issue #969`](https://github.com/MoonchildProductions/UXP/issues/969), release versions `28.9.0` and `2020.03.04` respectively, they have been split off into their own dedicated repositories located at [`MoonchildProductions/Pale-Moon`](https://github.com/MoonchildProductions/Pale-Moon) and [`MoonchildProductions/Basilisk`](https://github.com/MoonchildProductions/Basilisk).
As of [`Issue #969`](https://repo.palemoon.org/MoonchildProductions/UXP/issues/969), release versions `28.9.0` and `2020.03.04` respectively, they have been split off into their own dedicated repositories located at [`MoonchildProductions/Pale-Moon`](https://repo.palemoon.org/MoonchildProductions/Pale-Moon) and [`MoonchildProductions/Basilisk`](https://repo.palemoon.org/MoonchildProductions/Basilisk).
+1 -1
View File
@@ -23,7 +23,7 @@ Generally not security vulnerabilities:
## Reporting a Vulnerability
If you find an issue in UXP or the applications it builds on that could impact the security or safety of users please **do not**
make an issue on GitHub about it. GitHub does not support restricted viewability for security sensitive bugs.
make an issue on Gitea about it. Gitea does not support restricted viewability for security sensitive bugs.
If you want to report a security-sensitive issue then please go to the [forum](https://forum.palemoon.org) and report the issue
via a **private message** to **Moonchild** (the founder and prime responsible for security issues).
-10
View File
@@ -347,16 +347,6 @@ static const nsRoleMapEntry sWAIRoleMaps[] =
eLandmark,
kNoReqStates
},
{ // marquee
&nsGkAtoms::marquee,
roles::ANIMATION,
kUseMapRole,
eNoValue,
eNoAction,
eOffLiveAttr,
kGenericAccType,
kNoReqStates
},
{ // math
&nsGkAtoms::math,
roles::FLAT_EQUATION,
-3
View File
@@ -732,8 +732,6 @@ using namespace mozilla::a11y;
return @"AXDocument";
if (roleAtom == nsGkAtoms::log_)
return @"AXApplicationLog";
if (roleAtom == nsGkAtoms::marquee)
return @"AXApplicationMarquee";
if (roleAtom == nsGkAtoms::math)
return @"AXDocumentMath";
if (roleAtom == nsGkAtoms::note_)
@@ -869,7 +867,6 @@ static const RoleDescrMap sRoleDescrMap[] = {
{ @"AXApplicationAlert", NS_LITERAL_STRING("alert") },
{ @"AXApplicationAlertDialog", NS_LITERAL_STRING("alertDialog") },
{ @"AXApplicationLog", NS_LITERAL_STRING("log") },
{ @"AXApplicationMarquee", NS_LITERAL_STRING("marquee") },
{ @"AXApplicationStatus", NS_LITERAL_STRING("status") },
{ @"AXApplicationTimer", NS_LITERAL_STRING("timer") },
{ @"AXContentSeparator", NS_LITERAL_STRING("separator") },
@@ -62,7 +62,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAbsentAttrs("live3", {"live" : ""});
testAttrs("log", {"live" : "polite"}, true);
testAttrs("logAssertive", {"live" : "assertive"}, true);
testAttrs("marquee", {"live" : "off"}, true);
testAttrs("status", {"live" : "polite"}, true);
testAttrs("timer", {"live" : "off"}, true);
testAbsentAttrs("tablist", {"live" : "polite"});
@@ -72,7 +71,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("live2Child", {"container-live" : "polite"}, true);
testAttrs("logChild", {"container-live" : "polite"}, true);
testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
testAttrs("marqueeChild", {"container-live" : "off"}, true);
testAttrs("statusChild", {"container-live" : "polite"}, true);
testAttrs("timerChild", {"container-live" : "off"}, true);
testAbsentAttrs("tablistChild", {"container-live" : "polite"});
@@ -80,13 +78,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
// container-live-role object attribute
testAttrs("log", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("marquee", {"container-live-role" : "marquee"}, true);
testAttrs("status", {"container-live-role" : "status"}, true);
testAttrs("timer", {"container-live-role" : "timer"}, true);
testAttrs("logChild", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
testAttrs("statusChild", {"container-live-role" : "status"}, true);
testAttrs("timerChild", {"container-live-role" : "timer"}, true);
testAbsentAttrs("tablistChild", {"container-live-role" : "tablist"});
@@ -230,11 +226,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
<!-- back to aria -->
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
<div id="live3" role="region">excuse</div>
<div id="log" role="log">excuse <div id="logChild">me</div></div>
<div id="logAssertive" role="log" aria-live="assertive">excuse <div id="logAssertiveChild">me</div></div>
<div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div>
<div id="status" role="status">excuse <div id="statusChild">me</div></div>
<div id="tablist" role="tablist">tablist <div id="tablistChild">tab</div></div>
<div id="timer" role="timer">excuse <div id="timerChild">me</div></div>
@@ -83,7 +83,7 @@
'listitem-2-3']);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null,
['image-2', 'image-3']);
['image-1', 'image-2', 'image-3']);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null,
['link-0', 'link-1', 'link-2', 'link-3']);
@@ -117,7 +117,7 @@
'1. Scheme', '2. Racket', '3. Clojure',
'4. Standard Lisp', 'link-0', ' Lisp',
'checkbox-1-5', ' LeLisp', '• JavaScript',
'heading-5', 'image-2', 'image-3',
'heading-5', 'image-1', 'image-2', 'image-3',
'Not actually an image', 'link-1', 'anchor-1',
'link-2', 'anchor-2', 'link-3', '3', '1', '4',
'1', 'Sunday', 'M', 'Week 1', '3', '4', '7', '2',
@@ -41,7 +41,6 @@
testRole("aria_listbox", ROLE_LISTBOX);
testRole("aria_listitem", ROLE_LISTITEM);
testRole("aria_log", ROLE_TEXT); // weak role
testRole("aria_marquee", ROLE_ANIMATION);
testRole("aria_math", ROLE_FLAT_EQUATION);
testRole("aria_menu", ROLE_MENUPOPUP);
testRole("aria_menubar", ROLE_MENUBAR);
@@ -89,9 +88,6 @@
testRole("log_table", ROLE_TABLE);
testRole("timer_div", ROLE_SECTION);
// other roles that are forms of "live regions"
testRole("marquee_h1", ROLE_ANIMATION);
// strong landmark
testRole("application", ROLE_APPLICATION);
testRole("form", ROLE_FORM);
@@ -219,7 +215,6 @@
<span id="aria_listbox" role="listbox"/>
<span id="aria_listitem" role="listitem"/>
<span id="aria_log" role="log"/>
<span id="aria_marquee" role="marquee"/>
<span id="aria_math" role="math"/>
<span id="aria_menu" role="menu"/>
<span id="aria_menubar" role="menubar"/>
@@ -263,7 +258,6 @@
<table role="log" id="log_table">
<tr><td>Table based log</td></tr>
</table>
<h1 role="marquee" id="marquee_h1">marquee</h1>
<div role="timer" id="timer_div">timer</div>
<!-- landmarks -->
@@ -20,8 +20,8 @@
document.getElementsByTagName("img")[0].firstChild.data = "2";
var accTree = {
role: ROLE_TEXT,
children: [ { role: ROLE_TEXT_LEAF } ]
role: ROLE_GRAPHIC,
children: []
};
testAccessibleTree("the_img", accTree);
SimpleTest.finish();
+1 -1
View File
@@ -38,7 +38,7 @@ if test -n "$USE_ICU"; then
dnl We also don't do it on Windows because sometimes the file goes
dnl missing -- possibly due to overzealous antivirus software? --
dnl which prevents the browser from starting up :(
if test -z "$JS_STANDALONE" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
if test -z "$JS_STANDALONE"; then
MOZ_ICU_DATA_ARCHIVE=1
else
MOZ_ICU_DATA_ARCHIVE=
+4
View File
@@ -162,6 +162,8 @@ def old_configure_options(*options):
'--enable-b2g-camera',
'--enable-b2g-ril',
'--enable-bundled-fonts',
'--enable-chrome-compression',
'--enable-chrome-format',
'--enable-clang-plugin',
'--enable-content-sandbox',
'--enable-cookies',
@@ -263,6 +265,7 @@ def old_configure_options(*options):
'--with-app-name',
'--with-arch',
'--with-branding',
'--with-chrome-name',
'--with-crashreporter-enable-percent',
'--with-cross-lib',
'--with-debug-label',
@@ -310,6 +313,7 @@ def old_configure_options(*options):
'--disable-browser-statusbar',
'--disable-sync',
'--disable-personas',
'--enable-phoenix-extensions',
# Below are configure flags used by Basilisk
'--disable-webextensions',
+1 -1
View File
@@ -216,7 +216,7 @@ endif # NO_PROFILE_GUIDED_OPTIMIZE
MAKE_JARS_FLAGS = \
-t $(topsrcdir) \
-f $(MOZ_JAR_MAKER_FILE_FORMAT) \
-f $(MOZ_CHROME_FILE_FORMAT) \
$(NULL)
ifdef USE_EXTENSION_MANIFEST
-6
View File
@@ -40,12 +40,6 @@ external_dirs += ['media/libwebp']
if CONFIG['CPU_ARCH'] == 'arm':
external_dirs += ['media/openmax_dl']
if CONFIG['MOZ_WEBSPEECH_POCKETSPHINX']:
external_dirs += [
'media/sphinxbase',
'media/pocketsphinx',
]
if CONFIG['MOZ_FFVPX']:
external_dirs += ['media/ffvpx']
+3
View File
@@ -112,6 +112,7 @@ CERT_GetCertChainFromCert
CERT_GetCertEmailAddress
CERT_GetCertificateDer
CERT_GetCertificateRequestExtensions
CERT_GetCertKeyType
CERT_GetCertTimes
CERT_GetCertTrust
CERT_GetCommonName
@@ -270,6 +271,7 @@ NSS_Init
NSS_Initialize
NSS_InitWithMerge
NSS_IsInitialized
NSS_OptionGet
NSS_OptionSet
NSS_NoDB_Init
NSS_SecureMemcmp
@@ -383,6 +385,7 @@ PK11_GetNextSymKey
PK11_GetPadMechanism
PK11_GetPrivateKeyNickname
PK11_GetPrivateModulusLen
PK11_GetSlotFromPrivateKey
PK11_GetSlotID
PK11_GetSlotInfo
PK11_GetSlotName
+1 -1
View File
@@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
4.5.0
4.7.0
-1
View File
@@ -526,7 +526,6 @@ hardware/lights.h
hardware/power.h
hardware_legacy/power.h
hardware_legacy/uevent.h
hardware_legacy/vibrator.h
#endif
HIToolbox/HIToolbox.h
hlink.h
+1 -1
View File
@@ -22,7 +22,7 @@ REF_MANIFEST = $(if $(USE_EXTENSION_MANIFEST),chrome.manifest,test.manifest)
check-%::
if test -d $(FINAL_TARGET); then rm -rf $(FINAL_TARGET); fi;
$(MAKE) realchrome MOZ_JAR_MAKER_FILE_FORMAT=$*
$(MAKE) realchrome MOZ_CHROME_FILE_FORMAT=$*
@echo 'Comparing manifests...'
@if ! sort $(MY_MANIFEST) | diff --text -U 0 $(srcdir)/../$(REF_MANIFEST).$* - ; then \
echo 'TEST-UNEXPECTED-FAIL | config/tests/$(REF_MANIFEST).$* | differing content in manifest!' ; \
+4
View File
@@ -65,9 +65,13 @@ if CONFIG['MOZ_DEBUG']:
# Force using malloc_usable_size when building with jemalloc because _msize
# causes assertions on Win64. See bug 719579.
# This causes a known warning due to the way mozjemalloc is linked and the
# malloc_usable_size function not being available at compile time on MSVC
# so we suppress that particular warning (C4013)
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True
DEFINES['SQLITE_WITHOUT_MSIZE'] = True
CFLAGS += ['-wd4013']
# Omit unused functions to save some library footprint.
DEFINES['SQLITE_OMIT_DEPRECATED'] = True
+20958 -15503
View File
File diff suppressed because it is too large. Load diff
+1205 -888
View File
File diff suppressed because it is too large. Load diff
@@ -30,7 +30,7 @@ function* testTopLeft(inspector, view) {
elementRulesNb: 4,
firstLineRulesNb: 2,
firstLetterRulesNb: 1,
selectionRulesNb: 0,
selectionRulesNb: 1,
afterRulesNb: 1,
beforeRulesNb: 2
}
@@ -167,7 +167,7 @@ function* testParagraph(inspector, view) {
elementRulesNb: 3,
firstLineRulesNb: 1,
firstLetterRulesNb: 1,
selectionRulesNb: 1,
selectionRulesNb: 2,
beforeRulesNb: 0,
afterRulesNb: 0
});
@@ -217,7 +217,7 @@ function* assertPseudoElementRulesNumbers(selector, inspector, view, ruleNbs) {
firstLetterRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":first-letter"),
selectionRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":-moz-selection"),
rule.pseudoElement === ":selection"),
beforeRules: elementStyle.rules.filter(rule =>
rule.pseudoElement === ":before"),
afterRules: elementStyle.rules.filter(rule =>
+1 -1
View File
@@ -94,7 +94,7 @@ exports.menuitems = [
},
key: {
id: "browserToolbox",
modifiers: "accel,alt,shift",
modifiers: isMac ? "accel,alt" : "accel,shift",
keytext: true
}
},
+1
View File
@@ -14,6 +14,7 @@
a {
-moz-user-focus: normal;
-moz-user-input: enabled;
cursor: pointer;
text-decoration: underline;
}
+47 -2
View File
@@ -1233,7 +1233,7 @@ exports.CSS_PROPERTIES = {
"-moz-tab-size": {
"isInherited": true,
"subproperties": [
"-moz-tab-size"
"tab-size"
],
"supports": [
7
@@ -1440,6 +1440,8 @@ exports.CSS_PROPERTIES = {
"supports": [],
"values": [
"auto",
"disabled",
"enabled",
"inherit",
"initial",
"none",
@@ -2870,6 +2872,7 @@ exports.CSS_PROPERTIES = {
"box-shadow",
"box-sizing",
"caption-side",
"caret-color",
"clear",
"clip",
"clip-path",
@@ -3049,7 +3052,7 @@ exports.CSS_PROPERTIES = {
"stroke-opacity",
"stroke-width",
"-x-system-font",
"-moz-tab-size",
"tab-size",
"table-layout",
"text-align",
"text-align-last",
@@ -5275,6 +5278,28 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"caret-color": {
"isInherited": true,
"subproperties": [
"caret-color"
],
"supports": [
2
],
"values": [
"COLOR",
"auto",
"currentColor",
"hsl",
"hsla",
"inherit",
"initial",
"rgb",
"rgba",
"transparent",
"unset"
]
},
"clear": {
"isInherited": false,
"subproperties": [
@@ -7855,6 +7880,7 @@ exports.CSS_PROPERTIES = {
],
"supports": [],
"values": [
"anywhere",
"break-word",
"inherit",
"initial",
@@ -8624,6 +8650,23 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"tab-size": {
"isInherited": true,
"subproperties": [
"tab-size"
],
"supports": [
6,
7
],
"values": [
"-moz-calc",
"calc",
"inherit",
"initial",
"unset"
]
},
"table-layout": {
"isInherited": false,
"subproperties": [
@@ -9315,6 +9358,7 @@ exports.CSS_PROPERTIES = {
],
"supports": [],
"values": [
"anywhere",
"break-word",
"inherit",
"initial",
@@ -9371,6 +9415,7 @@ exports.PSEUDO_ELEMENTS = [
":backdrop",
":first-letter",
":first-line",
":selection",
":-moz-selection",
":-moz-focus-inner",
":-moz-focus-outer",
+7 -2
View File
@@ -93,15 +93,20 @@ With rare exception, it is advisable to use the following style for commit messa
This would directly apply to anyone making a pull request.
Single commits are where issues can be reasonably resolved in a single commit.
- Single Commit: `Issue #xxx - Cited issue title or appropriate direct description of changes`
- *`Issue #1083 - Deprecate FUEL extension helper javascript library`*
- Multi-Part Commits: `Issue #xxx - Part Number: Appropriate direct description of changes`
Multi-part commits would be used for complex issues. However, an exception exists for multi-part commits where the issue is anticipated or ends up being long term such as "Stop using unified compilation of sources". In these instances the multi-part form is not required.
- Multi-Part Form: `Issue #xxx - Part Number: Appropriate direct description of changes`
- *`Issue #492 - Part 1: Remove files`*
- *`Issue #492 - Part 2: Build system, Installer/Packaging`*
- *`Issue #492 - Part 3: nsUpdateService.js, updater.cpp, nsUpdateDriver.cpp`*
- *`Issue #492 - Part 4: Remove superfluous brackets in nsUpdateService.js and updater.cpp`*
An exception exists for multi-part commits where the issue is anticipated or ends up being long term such as "Stop using unified compilation of sources". In these instances the multi-part form is not required.
Occasionally a resolved (and shipped) issue requires further changes to fix bugs. However, If follow-ups are complex enough to be multi-part it should be considered a new issue.
- Follow-up Form: *`Issue #xxx - Follow-up: Appropriate direct description of changes`*
- *`Issue #1643 - Follow-up: Make sure things aren't changed while iterating.`*
### Commits with no issue
+98
View File
@@ -0,0 +1,98 @@
/* -*- 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/. */
#include "AbortController.h"
#include "AbortSignal.h"
#include "mozilla/dom/AbortControllerBinding.h"
#include "WorkerPrivate.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AbortController, mGlobal, mSignal)
NS_IMPL_CYCLE_COLLECTING_ADDREF(AbortController)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AbortController)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AbortController)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/* static */ bool
AbortController::IsEnabled(JSContext* aCx, JSObject* aGlobal)
{
if (NS_IsMainThread()) {
return Preferences::GetBool("dom.abortController.enabled", false);
}
using namespace workers;
// Otherwise, check the pref via the WorkerPrivate
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
if (!workerPrivate) {
return false;
}
return workerPrivate->AbortControllerEnabled();
}
/* static */ already_AddRefed<AbortController>
AbortController::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
if (!global) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<AbortController> abortController = new AbortController(global);
return abortController.forget();
}
AbortController::AbortController(nsIGlobalObject* aGlobal)
: mGlobal(aGlobal)
, mAborted(false)
{}
JSObject*
AbortController::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return AbortControllerBinding::Wrap(aCx, this, aGivenProto);
}
nsIGlobalObject*
AbortController::GetParentObject() const
{
return mGlobal;
}
AbortSignal*
AbortController::Signal()
{
if (!mSignal) {
mSignal = new AbortSignal(this, mAborted);
}
return mSignal;
}
void
AbortController::Abort()
{
if (mAborted) {
return;
}
mAborted = true;
if (mSignal) {
mSignal->Abort();
}
}
} // dom namespace
} // mozilla namespace
+59
View File
@@ -0,0 +1,59 @@
/* -*- 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_AbortController_h
#define mozilla_dom_AbortController_h
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/AbortSignal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
#include "nsIGlobalObject.h"
namespace mozilla {
namespace dom {
class AbortController final : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController)
static bool
IsEnabled(JSContext* aCx, JSObject* aGlobal);
static already_AddRefed<AbortController>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
explicit AbortController(nsIGlobalObject* aGlobal);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
nsIGlobalObject*
GetParentObject() const;
AbortSignal*
Signal();
void
Abort();
private:
~AbortController() = default;
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<AbortSignal> mSignal;
bool mAborted;
};
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_AbortController_h
+131
View File
@@ -0,0 +1,131 @@
/* -*- 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/. */
#include "AbortSignal.h"
#include "AbortController.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/AbortSignalBinding.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_CLASS(AbortSignal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mController)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mController)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AbortSignal)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(AbortSignal, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(AbortSignal, DOMEventTargetHelper)
AbortSignal::AbortSignal(AbortController* aController,
bool aAborted)
: DOMEventTargetHelper(aController->GetParentObject())
, mController(aController)
, mAborted(aAborted)
{}
AbortSignal::AbortSignal(bool aAborted)
: mAborted(aAborted)
{}
JSObject*
AbortSignal::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return AbortSignalBinding::Wrap(aCx, this, aGivenProto);
}
bool
AbortSignal::Aborted() const
{
return mAborted;
}
void
AbortSignal::Abort()
{
// Re-entrancy guard
if (mAborted) {
return;
}
mAborted = true;
// We might be deleted as a result of aborting a follower, so ensure we
// stay alive until all followers have been aborted.
RefPtr<AbortSignal> pinThis = this;
// Let's inform the followers.
for (uint32_t i = 0; i < mFollowers.Length(); ++i) {
mFollowers[i]->Aborted();
}
EventInit init;
init.mBubbles = false;
init.mCancelable = false;
RefPtr<Event> event =
Event::Constructor(this, NS_LITERAL_STRING("abort"), init);
event->SetTrusted(true);
bool dummy;
DispatchEvent(event, &dummy);
}
void
AbortSignal::AddFollower(AbortSignal::Follower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
if (!mFollowers.Contains(aFollower)) {
mFollowers.AppendElement(aFollower);
}
}
void
AbortSignal::RemoveFollower(AbortSignal::Follower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
mFollowers.RemoveElement(aFollower);
}
// AbortSignal::Follower
// ----------------------------------------------------------------------------
AbortSignal::Follower::~Follower()
{
Unfollow();
}
void
AbortSignal::Follower::Follow(AbortSignal* aSignal)
{
MOZ_DIAGNOSTIC_ASSERT(aSignal);
Unfollow();
mFollowingSignal = aSignal;
aSignal->AddFollower(this);
}
void
AbortSignal::Follower::Unfollow()
{
if (mFollowingSignal) {
mFollowingSignal->RemoveFollower(this);
mFollowingSignal = nullptr;
}
}
} // dom namespace
} // mozilla namespace
+76
View File
@@ -0,0 +1,76 @@
/* -*- 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_AbortSignal_h
#define mozilla_dom_AbortSignal_h
#include "mozilla/DOMEventTargetHelper.h"
namespace mozilla {
namespace dom {
class AbortController;
class AbortSignal;
class AbortSignal final : public DOMEventTargetHelper
{
public:
// This class must be implemented by objects who want to follow a AbortSignal.
class Follower
{
public:
virtual void Aborted() = 0;
protected:
virtual ~Follower();
void
Follow(AbortSignal* aSignal);
void
Unfollow();
RefPtr<AbortSignal> mFollowingSignal;
};
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AbortSignal, DOMEventTargetHelper)
AbortSignal(AbortController* aController, bool aAborted);
explicit AbortSignal(bool aAborted);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
bool
Aborted() const;
void
Abort();
IMPL_EVENT_HANDLER(abort);
void
AddFollower(Follower* aFollower);
void
RemoveFollower(Follower* aFollower);
private:
~AbortSignal() = default;
RefPtr<AbortController> mController;
// Raw pointers. Follower unregisters itself in the DTOR.
nsTArray<Follower*> mFollowers;
bool mAborted;
};
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_AbortSignal_h
+13 -8
View File
@@ -4,18 +4,23 @@
# 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/.
EXPORTS.mozilla.dom.battery += [
'Constants.h',
'Types.h',
with Files("**"):
BUG_COMPONENT = ("Core", "DOM")
TEST_DIRS += ['tests']
EXPORTS.mozilla.dom += [
'AbortController.h',
'AbortSignal.h',
]
SOURCES += [
'BatteryManager.cpp',
'AbortController.cpp',
'AbortSignal.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'../workers',
]
FINAL_LIBRARY = 'xul'
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
+113
View File
@@ -0,0 +1,113 @@
<script>
function ok(a, msg) {
parent.postMessage({ type: "check", status: !!a, message: msg }, "*");
}
function is(a, b, msg) {
ok(a === b, msg);
}
function testWebIDL() {
ok("FetchController" in self, "We have a FetchController prototype");
ok("FetchSignal" in self, "We have a FetchSignal prototype");
var fc = new FetchController();
ok(!!fc, "FetchController can be created");
ok(fc instanceof FetchController, "FetchController is a FetchController");
ok(!!fc.signal, "FetchController has a signal");
ok(fc.signal instanceof FetchSignal, "fetchSignal is a FetchSignal");
is(fc.signal.aborted, false, "By default FetchSignal.aborted is false");
next();
}
function testUpdateData() {
var fc = new FetchController();
is(fc.signal.aborted, false, "By default FetchSignal.aborted is false");
fc.abort();
is(fc.signal.aborted, true, "Signal is aborted");
next();
}
function testAbortEvent() {
var fc = new FetchController();
fc.signal.onabort = function(e) {
is(e.type, "abort", "Abort received");
next();
}
fc.abort();
}
function testAbortedFetch() {
var fc = new FetchController();
fc.abort();
fetch('slow.sjs', { signal: fc.signal }).then(() => {
ok(false, "Fetch should not return a resolved promise");
}, e => {
is(e.name, "AbortError", "We have an abort error");
}).then(next);
}
function testFetchAndAbort() {
var fc = new FetchController();
var p = fetch('slow.sjs', { signal: fc.signal });
fc.abort();
p.then(() => {
ok(false, "Fetch should not return a resolved promise");
}, e => {
is(e.name, "AbortError", "We have an abort error");
}).then(next);
}
function testWorkerAbortedFetch() {
var w = new Worker('worker_fetch_controller.js');
w.onmessage = function(e) {
ok(e.data, "Abort + Fetch works in workers");
next();
}
w.postMessage('testWorkerAbortedFetch');
}
function testWorkerFetchAndAbort() {
var w = new Worker('worker_fetch_controller.js');
w.onmessage = function(e) {
ok(e.data, "Abort + Fetch works in workers");
next();
}
w.postMessage('testWorkerFetchAndAbort');
}
var steps = [
// Simple stuff
testWebIDL,
testUpdateData,
// Event propagation
testAbortEvent,
// fetch + signaling
testAbortedFetch,
testFetchAndAbort,
testWorkerAbortedFetch,
testWorkerFetchAndAbort,
];
function next() {
if (!steps.length) {
parent.postMessage({ type: "finish" }, "*");
return;
}
var step = steps.shift();
step();
}
next();
</script>
+6
View File
@@ -0,0 +1,6 @@
[DEFAULT]
support-files =
file_abort_controller.html
worker_fetch_controller.js
[test_abort_controller.html]
@@ -4,4 +4,5 @@
# 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/.
JAR_MANIFESTS += ['jar.mn']
MOCHITEST_MANIFESTS += ['mochitest.ini']
@@ -0,0 +1,40 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Test FetchController</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
SpecialPowers.pushPrefEnv({"set": [["dom.fetchController.enabled", true ]]}, () => {
let ifr = document.createElement('iframe');
ifr.src = "file_fetch_controller.html";
document.body.appendChild(ifr);
onmessage = function(e) {
if (e.data.type == "finish") {
SimpleTest.finish();
return;
}
if (e.data.type == "check") {
ok(e.data.status, e.data.message);
return;
}
ok(false, "Something when wrong.");
}
});
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>
@@ -0,0 +1,27 @@
function testWorkerAbortedFetch() {
var fc = new AbortController();
fc.abort();
fetch('slow.sjs', { signal: fc.signal }).then(() => {
postMessage(false);
}, e => {
postMessage(e.name == "AbortError");
});
}
function testWorkerFetchAndAbort() {
var fc = new AbortController();
var p = fetch('slow.sjs', { signal: fc.signal });
fc.abort();
p.then(() => {
postMessage(false);
}, e => {
postMessage(e.name == "AbortError");
});
}
onmessage = function(e) {
self[e.data]();
}
+2 -4
View File
@@ -38,8 +38,6 @@ struct AnimationPerformanceWarning
std::initializer_list<int32_t> aParams)
: mType(aType)
{
// FIXME: Once std::initializer_list::size() become a constexpr function,
// we should use static_assert here.
MOZ_ASSERT(aParams.size() <= kMaxParamsForLocalization,
"The length of parameters should be less than "
"kMaxParamsForLocalization");
@@ -49,11 +47,11 @@ struct AnimationPerformanceWarning
// Maximum number of parameters passed to
// nsContentUtils::FormatLocalizedString to localize warning messages.
//
// NOTE: This constexpr can't be forward declared, so if you want to use
// NOTE: This can't be forward declared, so if you want to use
// this variable, please include this header file directly.
// This value is the same as the limit of nsStringBundle::FormatString.
// See the implementation of nsStringBundle::FormatString.
static constexpr uint8_t kMaxParamsForLocalization = 10;
static const uint8_t kMaxParamsForLocalization = 10;
// Indicates why this property could not be animated on the compositor.
Type mType;
@@ -75,11 +75,6 @@ const gMozillaSpecificProperties = {
from: "ignore",
to: "stretch-to-fit"
},
"-moz-tab-size": {
// https://drafts.csswg.org/css-text-3/#propdef-tab-size
from: "1",
to: "5"
},
"-moz-text-size-adjust": {
// https://drafts.csswg.org/css-size-adjust/#propdef-text-size-adjust
from: "none",
+3
View File
@@ -166,8 +166,11 @@ NS_INTERFACE_MAP_END
/* static */ bool
CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject)
{
return false;
/*
return Preferences::GetBool("dom.webcomponents.customelements.enabled") ||
Preferences::GetBool("dom.webcomponents.enabled");
*/
}
/* static */ already_AddRefed<CustomElementRegistry>
+1
View File
@@ -8,6 +8,7 @@
#define mozilla_dom_ElementInlines_h
#include "mozilla/dom/Element.h"
#include "nsIContentInlines.h"
#include "nsIDocument.h"
namespace mozilla {
+4 -4
View File
@@ -6,6 +6,7 @@
#include "ImportManager.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/EventListenerManager.h"
#include "HTMLLinkElement.h"
#include "nsContentPolicyUtils.h"
@@ -18,7 +19,6 @@
#include "nsIDOMEvent.h"
#include "nsIPrincipal.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsScriptLoader.h"
#include "nsNetUtil.h"
//-----------------------------------------------------------------------------
@@ -156,7 +156,7 @@ ImportLoader::Updater::UpdateMainReferrer(uint32_t aNewIdx)
// Our nearest predecessor has changed. So let's add the ScriptLoader to the
// new one if there is any. And remove it from the old one.
RefPtr<ImportManager> manager = mLoader->Manager();
nsScriptLoader* loader = mLoader->mDocument->ScriptLoader();
ScriptLoader* loader = mLoader->mDocument->ScriptLoader();
ImportLoader*& pred = mLoader->mBlockingPredecessor;
ImportLoader* newPred = manager->GetNearestPredecessor(newMainReferrer);
if (pred) {
@@ -339,7 +339,7 @@ ImportLoader::DispatchEventIfFinished(nsINode* aNode)
}
void
ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader)
ImportLoader::AddBlockedScriptLoader(ScriptLoader* aScriptLoader)
{
if (mBlockedScriptLoaders.Contains(aScriptLoader)) {
return;
@@ -352,7 +352,7 @@ ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader)
}
bool
ImportLoader::RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader)
ImportLoader::RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader)
{
aScriptLoader->RemoveParserBlockingScriptExecutionBlocker();
return mBlockedScriptLoaders.RemoveElement(aScriptLoader);
+4 -4
View File
@@ -45,8 +45,8 @@
#include "nsIStreamListener.h"
#include "nsIWeakReferenceUtils.h"
#include "nsRefPtrHashtable.h"
#include "nsScriptLoader.h"
#include "nsURIHashKey.h"
#include "mozilla/dom/ScriptLoader.h"
class nsIDocument;
class nsIPrincipal;
@@ -184,8 +184,8 @@ public:
// and wait for that to run its scripts. We keep track of all the
// ScriptRunners that are waiting for this import. NOTE: updating
// the main referrer might change this list.
void AddBlockedScriptLoader(nsScriptLoader* aScriptLoader);
bool RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader);
void AddBlockedScriptLoader(ScriptLoader* aScriptLoader);
bool RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader);
void SetBlockingPredecessor(ImportLoader* aLoader);
private:
@@ -230,7 +230,7 @@ private:
// List of pending ScriptLoaders that are waiting for this import
// to finish.
nsTArray<RefPtr<nsScriptLoader>> mBlockedScriptLoaders;
nsTArray<RefPtr<ScriptLoader>> mBlockedScriptLoaders;
// There is always exactly one referrer link that is flagged as
// the main referrer the primary link. This is the one that is
+1 -1
View File
@@ -32,9 +32,9 @@
#include "mozilla/Likely.h"
#include "nsCycleCollectionParticipant.h"
#include "nsNullPrincipal.h"
#include "ScriptSettings.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/LocationBinding.h"
#include "mozilla/dom/ScriptSettings.h"
namespace mozilla {
namespace dom {
+1 -235
View File
@@ -30,7 +30,6 @@
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "BatteryManager.h"
#ifdef MOZ_GAMEPAD
#include "mozilla/dom/GamepadServiceTest.h"
#endif
@@ -99,11 +98,6 @@
namespace mozilla {
namespace dom {
static bool sVibratorEnabled = false;
static uint32_t sMaxVibrateMS = 0;
static uint32_t sMaxVibrateListLen = 0;
static const char* kVibrationPermissionType = "vibration";
static void
AddPermission(nsIPrincipal* aPrincipal, const char* aType, uint32_t aPermission,
uint32_t aExpireType, int64_t aExpireTime)
@@ -154,12 +148,7 @@ GetPermission(nsIPrincipal* aPrincipal, const char* aType)
void
Navigator::Init()
{
Preferences::AddBoolVarCache(&sVibratorEnabled,
"dom.vibrator.enabled", true);
Preferences::AddUintVarCache(&sMaxVibrateMS,
"dom.vibrator.max_vibrate_ms", 10000);
Preferences::AddUintVarCache(&sMaxVibrateListLen,
"dom.vibrator.max_vibrate_list_len", 128);
// Add any Preferences::Add*VarCache(&sPref, "pref", default) here if needed.
}
Navigator::Navigator(nsPIDOMWindowInner* aWindow)
@@ -197,8 +186,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryPromise)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageManager)
@@ -249,13 +236,6 @@ Navigator::Invalidate()
mNotification = nullptr;
}
if (mBatteryManager) {
mBatteryManager->Shutdown();
mBatteryManager = nullptr;
}
mBatteryPromise = nullptr;
if (mPowerManager) {
mPowerManager->Shutdown();
mPowerManager = nullptr;
@@ -716,82 +696,6 @@ Navigator::RefreshMIMEArray()
}
}
namespace {
class VibrateWindowListener : public nsIDOMEventListener
{
public:
VibrateWindowListener(nsPIDOMWindowInner* aWindow, nsIDocument* aDocument)
{
mWindow = do_GetWeakReference(aWindow);
mDocument = do_GetWeakReference(aDocument);
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
aDocument->AddSystemEventListener(visibilitychange,
this, /* listener */
true, /* use capture */
false /* wants untrusted */);
}
void RemoveListener();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
private:
virtual ~VibrateWindowListener()
{
}
nsWeakPtr mWindow;
nsWeakPtr mDocument;
};
NS_IMPL_ISUPPORTS(VibrateWindowListener, nsIDOMEventListener)
StaticRefPtr<VibrateWindowListener> gVibrateWindowListener;
static bool
MayVibrate(nsIDocument* doc) {
// Hidden documents cannot start or stop a vibration.
return (doc && !doc->Hidden());
}
NS_IMETHODIMP
VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDocument> doc =
do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
if (!MayVibrate(doc)) {
// It's important that we call CancelVibrate(), not Vibrate() with an
// empty list, because Vibrate() will fail if we're no longer focused, but
// CancelVibrate() will succeed, so long as nobody else has started a new
// vibration pattern.
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
hal::CancelVibrate(window);
RemoveListener();
gVibrateWindowListener = nullptr;
// Careful: The line above might have deleted |this|!
}
return NS_OK;
}
void
VibrateWindowListener::RemoveListener()
{
nsCOMPtr<EventTarget> target = do_QueryReferent(mDocument);
if (!target) {
return;
}
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
target->RemoveSystemEventListener(visibilitychange, this,
true /* use capture */);
}
} // namespace
void
Navigator::AddIdleObserver(MozIdleObserver& aIdleObserver, ErrorResult& aRv)
{
@@ -820,111 +724,6 @@ Navigator::RemoveIdleObserver(MozIdleObserver& aIdleObserver, ErrorResult& aRv)
}
}
void
Navigator::SetVibrationPermission(bool aPermitted, bool aPersistent)
{
MOZ_ASSERT(NS_IsMainThread());
nsTArray<uint32_t> pattern;
pattern.SwapElements(mRequestedVibrationPattern);
if (!mWindow) {
return;
}
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
if (!MayVibrate(doc)) {
return;
}
if (aPermitted) {
// Add a listener to cancel the vibration if the document becomes hidden,
// and remove the old visibility listener, if there was one.
if (!gVibrateWindowListener) {
// If gVibrateWindowListener is null, this is the first time we've vibrated,
// and we need to register a listener to clear gVibrateWindowListener on
// shutdown.
ClearOnShutdown(&gVibrateWindowListener);
} else {
gVibrateWindowListener->RemoveListener();
}
gVibrateWindowListener = new VibrateWindowListener(mWindow, doc);
hal::Vibrate(pattern, mWindow);
}
if (aPersistent) {
AddPermission(doc->NodePrincipal(), kVibrationPermissionType,
aPermitted ? nsIPermissionManager::ALLOW_ACTION :
nsIPermissionManager::DENY_ACTION,
nsIPermissionManager::EXPIRE_SESSION, 0);
}
}
bool
Navigator::Vibrate(uint32_t aDuration)
{
AutoTArray<uint32_t, 1> pattern;
pattern.AppendElement(aDuration);
return Vibrate(pattern);
}
bool
Navigator::Vibrate(const nsTArray<uint32_t>& aPattern)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mWindow) {
return false;
}
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
if (!MayVibrate(doc)) {
return false;
}
nsTArray<uint32_t> pattern(aPattern);
if (pattern.Length() > sMaxVibrateListLen) {
pattern.SetLength(sMaxVibrateListLen);
}
for (size_t i = 0; i < pattern.Length(); ++i) {
pattern[i] = std::min(sMaxVibrateMS, pattern[i]);
}
// The spec says we check sVibratorEnabled after we've done the sanity
// checking on the pattern.
if (!sVibratorEnabled) {
return true;
}
mRequestedVibrationPattern.SwapElements(pattern);
uint32_t permission = GetPermission(mWindow, kVibrationPermissionType);
if (permission == nsIPermissionManager::ALLOW_ACTION ||
mRequestedVibrationPattern.IsEmpty() ||
(mRequestedVibrationPattern.Length() == 1 &&
mRequestedVibrationPattern[0] == 0)) {
// Always allow cancelling vibration and respect session permissions.
SetVibrationPermission(true /* permitted */, false /* persistent */);
return true;
}
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (!obs || permission == nsIPermissionManager::DENY_ACTION) {
// Abort without observer service or on denied session permission.
SetVibrationPermission(false /* permitted */, false /* persistent */);
return true;
}
// Request user permission.
obs->NotifyObservers(ToSupports(this), "Vibration:Request", nullptr);
return true;
}
//*****************************************************************************
// Pointer Events interface
//*****************************************************************************
@@ -1321,39 +1120,6 @@ Navigator::GetMozNotification(ErrorResult& aRv)
return mNotification;
}
//*****************************************************************************
// Navigator::nsINavigatorBattery
//*****************************************************************************
Promise*
Navigator::GetBattery(ErrorResult& aRv)
{
if (mBatteryPromise) {
return mBatteryPromise;
}
if (!mWindow || !mWindow->GetDocShell()) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
RefPtr<Promise> batteryPromise = Promise::Create(go, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
mBatteryPromise = batteryPromise;
if (!mBatteryManager) {
mBatteryManager = new battery::BatteryManager(mWindow);
mBatteryManager->Init();
}
mBatteryPromise->MaybeResolve(mBatteryManager);
return mBatteryPromise;
}
PowerManager*
Navigator::GetMozPower(ErrorResult& aRv)
{
-10
View File
@@ -51,10 +51,6 @@ namespace dom {
class Permissions;
namespace battery {
class BatteryManager;
} // namespace battery
class Promise;
class DesktopNotificationCenter;
@@ -136,7 +132,6 @@ public:
Permissions* GetPermissions(ErrorResult& aRv);
// The XPCOM GetDoNotTrack is ok
Geolocation* GetGeolocation(ErrorResult& aRv);
Promise* GetBattery(ErrorResult& aRv);
static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);
@@ -155,9 +150,6 @@ public:
// NavigatorBinding::ClearCachedUserAgentValue(this);
void ClearUserAgentCache();
bool Vibrate(uint32_t aDuration);
bool Vibrate(const nsTArray<uint32_t>& aDuration);
void SetVibrationPermission(bool aPermitted, bool aPersistent);
uint32_t MaxTouchPoints();
void GetAppCodeName(nsString& aAppCodeName, ErrorResult& aRv)
{
@@ -269,8 +261,6 @@ private:
RefPtr<Permissions> mPermissions;
RefPtr<Geolocation> mGeolocation;
RefPtr<DesktopNotificationCenter> mNotification;
RefPtr<battery::BatteryManager> mBatteryManager;
RefPtr<Promise> mBatteryPromise;
RefPtr<PowerManager> mPowerManager;
RefPtr<network::Connection> mConnection;
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
+304
View File
@@ -0,0 +1,304 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 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/. */
#include "mozilla/dom/ResizeObserver.h"
#include "mozilla/dom/DOMRect.h"
#include "nsContentUtils.h"
#include "nsIFrame.h"
#include "nsSVGUtils.h"
namespace mozilla {
namespace dom {
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserver)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObserver)
NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObserver)
NS_IMPL_CYCLE_COLLECTION_CLASS(ResizeObserver)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ResizeObserver)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ResizeObserver)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallback)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mObservationMap)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ResizeObserver)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallback)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObservationMap)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
already_AddRefed<ResizeObserver>
ResizeObserver::Constructor(const GlobalObject& aGlobal,
ResizeObserverCallback& aCb,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsCOMPtr<nsIDocument> document = window->GetExtantDoc();
if (!document) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<ResizeObserver> observer = new ResizeObserver(window.forget(), aCb);
document->AddResizeObserver(observer);
return observer.forget();
}
void
ResizeObserver::Observe(Element* aTarget,
ErrorResult& aRv)
{
if (!aTarget) {
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return;
}
RefPtr<ResizeObservation> observation;
if (!mObservationMap.Get(aTarget, getter_AddRefs(observation))) {
observation = new ResizeObservation(this, aTarget);
mObservationMap.Put(aTarget, observation);
mObservationList.insertBack(observation);
// Per the spec, we need to trigger notification in event loop that
// contains ResizeObserver observe call even when resize/reflow does
// not happen.
aTarget->OwnerDoc()->ScheduleResizeObserversNotification();
}
}
void
ResizeObserver::Unobserve(Element* aTarget,
ErrorResult& aRv)
{
if (!aTarget) {
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return;
}
RefPtr<ResizeObservation> observation;
if (mObservationMap.Get(aTarget, getter_AddRefs(observation))) {
mObservationMap.Remove(aTarget);
MOZ_ASSERT(!mObservationList.isEmpty(),
"If ResizeObservation found for an element, observation list "
"must be not empty.");
observation->remove();
}
}
void
ResizeObserver::Disconnect()
{
mObservationMap.Clear();
mObservationList.clear();
mActiveTargets.Clear();
}
void
ResizeObserver::GatherActiveObservations(uint32_t aDepth)
{
mActiveTargets.Clear();
mHasSkippedTargets = false;
for (auto observation : mObservationList) {
if (observation->IsActive()) {
uint32_t targetDepth =
nsContentUtils::GetNodeDepth(observation->Target());
if (targetDepth > aDepth) {
mActiveTargets.AppendElement(observation);
} else {
mHasSkippedTargets = true;
}
}
}
}
bool
ResizeObserver::HasActiveObservations() const
{
return !mActiveTargets.IsEmpty();
}
bool
ResizeObserver::HasSkippedObservations() const
{
return mHasSkippedTargets;
}
uint32_t
ResizeObserver::BroadcastActiveObservations()
{
uint32_t shallowestTargetDepth = UINT32_MAX;
if (HasActiveObservations()) {
Sequence<OwningNonNull<ResizeObserverEntry>> entries;
for (auto observation : mActiveTargets) {
RefPtr<ResizeObserverEntry> entry =
new ResizeObserverEntry(this, observation->Target());
nsRect rect = observation->GetTargetRect();
entry->SetContentRect(rect);
if (!entries.AppendElement(entry.forget(), fallible)) {
// Out of memory.
break;
}
// Sync the broadcast size of observation so the next size inspection
// will be based on the updated size from last delivered observations.
observation->UpdateBroadcastSize(rect);
uint32_t targetDepth =
nsContentUtils::GetNodeDepth(observation->Target());
if (targetDepth < shallowestTargetDepth) {
shallowestTargetDepth = targetDepth;
}
}
mCallback->Call(this, entries, *this);
mActiveTargets.Clear();
mHasSkippedTargets = false;
}
return shallowestTargetDepth;
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserverEntry)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObserverEntry)
NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObserverEntry)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ResizeObserverEntry,
mTarget, mContentRect,
mOwner)
already_AddRefed<ResizeObserverEntry>
ResizeObserverEntry::Constructor(const GlobalObject& aGlobal,
Element* aTarget,
ErrorResult& aRv)
{
RefPtr<ResizeObserverEntry> observerEntry =
new ResizeObserverEntry(aGlobal.GetAsSupports(), aTarget);
return observerEntry.forget();
}
void
ResizeObserverEntry::SetContentRect(nsRect aRect)
{
RefPtr<DOMRect> contentRect = new DOMRect(mTarget);
nsIFrame* frame = mTarget->GetPrimaryFrame();
if (frame) {
nsMargin padding = frame->GetUsedPadding();
// Per the spec, we need to include padding in contentRect of
// ResizeObserverEntry.
aRect.x = padding.left;
aRect.y = padding.top;
}
contentRect->SetLayoutRect(aRect);
mContentRect = contentRect.forget();
}
ResizeObserverEntry::~ResizeObserverEntry()
{
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObservation)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObservation)
NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObservation)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ResizeObservation,
mTarget, mOwner)
already_AddRefed<ResizeObservation>
ResizeObservation::Constructor(const GlobalObject& aGlobal,
Element* aTarget,
ErrorResult& aRv)
{
RefPtr<ResizeObservation> observation =
new ResizeObservation(aGlobal.GetAsSupports(), aTarget);
return observation.forget();
}
bool
ResizeObservation::IsActive() const
{
nsRect rect = GetTargetRect();
return (rect.width != mBroadcastWidth || rect.height != mBroadcastHeight);
}
void
ResizeObservation::UpdateBroadcastSize(nsRect aRect)
{
mBroadcastWidth = aRect.width;
mBroadcastHeight = aRect.height;
}
nsRect
ResizeObservation::GetTargetRect() const
{
nsRect rect;
nsIFrame* frame = mTarget->GetPrimaryFrame();
if (frame) {
if (mTarget->IsSVGElement()) {
gfxRect bbox = nsSVGUtils::GetBBox(frame);
rect.width = NSFloatPixelsToAppUnits(bbox.width, AppUnitsPerCSSPixel());
rect.height = NSFloatPixelsToAppUnits(bbox.height, AppUnitsPerCSSPixel());
} else {
// Per the spec, non-replaced inline Elements will always have an empty
// content rect.
if (frame->IsFrameOfType(nsIFrame::eReplaced) ||
!frame->IsFrameOfType(nsIFrame::eLineParticipant)) {
rect = frame->GetContentRectRelativeToSelf();
}
}
}
return rect;
}
ResizeObservation::~ResizeObservation()
{
}
} // namespace dom
} // namespace mozilla
+254
View File
@@ -0,0 +1,254 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 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/. */
#ifndef mozilla_dom_ResizeObserver_h
#define mozilla_dom_ResizeObserver_h
#include "mozilla/dom/ResizeObserverBinding.h"
namespace mozilla {
namespace dom {
/**
* ResizeObserver interfaces and algorithms are based on
* https://wicg.github.io/ResizeObserver/#api
*/
class ResizeObserver final
: public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserver)
ResizeObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
ResizeObserverCallback& aCb)
: mOwner(aOwner)
, mCallback(&aCb)
{
MOZ_ASSERT(mOwner, "Need a non-null owner window");
}
static already_AddRefed<ResizeObserver>
Constructor(const GlobalObject& aGlobal,
ResizeObserverCallback& aCb,
ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override
{
return ResizeObserverBinding::Wrap(aCx, this, aGivenProto);
}
nsISupports* GetParentObject() const
{
return mOwner;
}
void Observe(Element* aTarget, ErrorResult& aRv);
void Unobserve(Element* aTarget, ErrorResult& aRv);
void Disconnect();
/*
* Gather all observations which have an observed target with size changed
* since last BroadcastActiveObservations() in this ResizeObserver.
* An observation will be skipped if the depth of its observed target is less
* or equal than aDepth. All gathered observations will be added to
* mActiveTargets.
*/
void GatherActiveObservations(uint32_t aDepth);
/*
* Returns whether this ResizeObserver has any active observations
* since last GatherActiveObservations().
*/
bool HasActiveObservations() const;
/*
* Returns whether this ResizeObserver has any skipped observations
* since last GatherActiveObservations().
*/
bool HasSkippedObservations() const;
/*
* Deliver the callback function in JavaScript for all active observations
* and pass the sequence of ResizeObserverEntry so JavaScript can access them.
* The broadcast size of observations will be updated and mActiveTargets will
* be cleared. It also returns the shallowest depth of elements from active
* observations or UINT32_MAX if there is no any active observations.
*/
uint32_t BroadcastActiveObservations();
protected:
~ResizeObserver()
{
mObservationList.clear();
}
nsCOMPtr<nsPIDOMWindowInner> mOwner;
RefPtr<ResizeObserverCallback> mCallback;
nsTArray<RefPtr<ResizeObservation>> mActiveTargets;
bool mHasSkippedTargets;
// Combination of HashTable and LinkedList so we can iterate through
// the elements of HashTable in order of insertion time.
// Will be nice if we have our own data structure for this in the future.
nsRefPtrHashtable<nsPtrHashKey<Element>, ResizeObservation> mObservationMap;
LinkedList<ResizeObservation> mObservationList;
};
/**
* ResizeObserverEntry is the entry that contains the information for observed
* elements. This object is the one that visible to JavaScript in callback
* function that is fired by ResizeObserver.
*/
class ResizeObserverEntry final
: public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserverEntry)
ResizeObserverEntry(nsISupports* aOwner, Element* aTarget)
: mOwner(aOwner)
, mTarget(aTarget)
{
MOZ_ASSERT(mOwner, "Need a non-null owner");
MOZ_ASSERT(mTarget, "Need a non-null target element");
}
static already_AddRefed<ResizeObserverEntry>
Constructor(const GlobalObject& aGlobal,
Element* aTarget,
ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override
{
return ResizeObserverEntryBinding::Wrap(aCx, this,
aGivenProto);
}
nsISupports* GetParentObject() const
{
return mOwner;
}
Element* Target() const
{
return mTarget;
}
/*
* Returns the DOMRectReadOnly of target's content rect so it can be
* accessed from JavaScript in callback function of ResizeObserver.
*/
DOMRectReadOnly* GetContentRect() const
{
return mContentRect;
}
void SetContentRect(nsRect aRect);
protected:
~ResizeObserverEntry();
nsCOMPtr<nsISupports> mOwner;
nsCOMPtr<Element> mTarget;
RefPtr<DOMRectReadOnly> mContentRect;
};
/**
* We use ResizeObservation to store and sync the size information of one
* observed element so we can decide whether an observation should be fired
* or not.
*/
class ResizeObservation final
: public nsISupports
, public nsWrapperCache
, public LinkedListElement<ResizeObservation>
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObservation)
ResizeObservation(nsISupports* aOwner, Element* aTarget)
: mOwner(aOwner)
, mTarget(aTarget)
, mBroadcastWidth(0)
, mBroadcastHeight(0)
{
MOZ_ASSERT(mOwner, "Need a non-null owner");
MOZ_ASSERT(mTarget, "Need a non-null target element");
}
static already_AddRefed<ResizeObservation>
Constructor(const GlobalObject& aGlobal,
Element* aTarget,
ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override
{
return ResizeObservationBinding::Wrap(aCx, this, aGivenProto);
}
nsISupports* GetParentObject() const
{
return mOwner;
}
Element* Target() const
{
return mTarget;
}
nscoord BroadcastWidth() const
{
return mBroadcastWidth;
}
nscoord BroadcastHeight() const
{
return mBroadcastHeight;
}
/*
* Returns whether the observed target element size differs from current
* BroadcastWidth and BroadcastHeight
*/
bool IsActive() const;
/*
* Update current BroadcastWidth and BroadcastHeight with size from aRect.
*/
void UpdateBroadcastSize(nsRect aRect);
/*
* Returns the target's rect in the form of nsRect.
* If the target is SVG, width and height are determined from bounding box.
*/
nsRect GetTargetRect() const;
protected:
~ResizeObservation();
nsCOMPtr<nsISupports> mOwner;
nsCOMPtr<Element> mTarget;
// Broadcast width and broadcast height are the latest recorded size
// of observed target.
nscoord mBroadcastWidth;
nscoord mBroadcastHeight;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ResizeObserver_h
+252
View File
@@ -0,0 +1,252 @@
/* -*- 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/. */
#include "mozilla/dom/ResizeObserverController.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ErrorEvent.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
namespace mozilla {
namespace dom {
void
ResizeObserverNotificationHelper::WillRefresh(TimeStamp aTime)
{
MOZ_DIAGNOSTIC_ASSERT(mOwner, "RefreshObserver should have been de-registered on time, but isn't.");
if (mOwner) {
mOwner->Notify();
}
}
nsRefreshDriver*
ResizeObserverNotificationHelper::GetRefreshDriver() const
{
nsIPresShell* presShell = mOwner->GetShell();
if (MOZ_UNLIKELY(!presShell)) {
return nullptr;
}
nsPresContext* presContext = presShell->GetPresContext();
if (MOZ_UNLIKELY(!presContext)) {
return nullptr;
}
return presContext->RefreshDriver();
}
void
ResizeObserverNotificationHelper::Register()
{
if (mRegistered) {
return;
}
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (!refreshDriver) {
// We maybe navigating away from this page or currently in an iframe with
// display: none. Just abort the Register(), no need to do notification.
return;
}
refreshDriver->AddRefreshObserver(this, Flush_Display);
mRegistered = true;
}
void
ResizeObserverNotificationHelper::Unregister()
{
if (!mOwner) {
// We've outlived our owner, so there's nothing registered anymore.
mRegistered = false;
return;
}
if (!mRegistered) {
return;
}
nsRefreshDriver* refreshDriver = GetRefreshDriver();
MOZ_RELEASE_ASSERT(refreshDriver,
"We should not leave a dangling reference to the observer around");
refreshDriver->RemoveRefreshObserver(this, Flush_Display);
mRegistered = false;
}
void
ResizeObserverNotificationHelper::Disconnect()
{
MOZ_RELEASE_ASSERT(!mRegistered, "How can we die when registered?");
MOZ_RELEASE_ASSERT(!mOwner, "Forgot to clear weak pointer?");
}
ResizeObserverNotificationHelper::~ResizeObserverNotificationHelper()
{
Unregister();
}
void
ResizeObserverController::Traverse(nsCycleCollectionTraversalCallback& aCb)
{
ImplCycleCollectionTraverse(aCb, mResizeObservers, "mResizeObservers");
}
void
ResizeObserverController::Unlink()
{
mResizeObservers.Clear();
}
void
ResizeObserverController::AddResizeObserver(ResizeObserver* aObserver)
{
MOZ_ASSERT(aObserver, "AddResizeObserver() should never be called with "
"a null parameter");
mResizeObservers.AppendElement(aObserver);
}
void ResizeObserverController::DetachFromDocument() {
mResizeObserverNotificationHelper->Unregister();
}
void
ResizeObserverController::Notify()
{
if (mResizeObservers.IsEmpty()) {
return;
}
// Hold a strong reference to the document, because otherwise calling
// all active observers on it might yank it out from under us.
RefPtr<nsIDocument> document(mDocument);
uint32_t shallowestTargetDepth = 0;
GatherAllActiveObservations(shallowestTargetDepth);
while (HasAnyActiveObservations()) {
DebugOnly<uint32_t> oldShallowestTargetDepth = shallowestTargetDepth;
shallowestTargetDepth = BroadcastAllActiveObservations();
NS_ASSERTION(oldShallowestTargetDepth < shallowestTargetDepth,
"shallowestTargetDepth should be getting strictly deeper");
// Flush layout, so that any callback functions' style changes / resizes
// get a chance to take effect.
mDocument->FlushPendingNotifications(Flush_Layout);
// To avoid infinite resize loop, we only gather all active observations
// that have the depth of observed target element more than current
// shallowestTargetDepth.
GatherAllActiveObservations(shallowestTargetDepth);
}
mResizeObserverNotificationHelper->Unregister();
// Per spec, we deliver an error if the document has any skipped observations.
if (HasAnySkippedObservations()) {
RootedDictionary<ErrorEventInit> init(RootingCx());
init.mMessage.AssignLiteral("ResizeObserver loop completed with undelivered"
" notifications.");
init.mCancelable = true;
init.mBubbles = true;
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsPIDOMWindowInner> window =
document->GetWindow()->GetCurrentInnerWindow();
if (window) {
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
MOZ_ASSERT(sgo);
if (NS_WARN_IF(NS_FAILED(sgo->HandleScriptError(init, &status)))) {
status = nsEventStatus_eIgnore;
}
} else {
// We don't fire error events at any global for non-window JS on the main
// thread.
}
// We need to deliver pending notifications in next cycle.
ScheduleNotification();
}
}
void
ResizeObserverController::GatherAllActiveObservations(uint32_t aDepth)
{
for (auto observer : mResizeObservers) {
observer->GatherActiveObservations(aDepth);
}
}
uint32_t
ResizeObserverController::BroadcastAllActiveObservations()
{
uint32_t shallowestTargetDepth = UINT32_MAX;
// Use a copy of the observers as this invokes the callbacks of the observers
// which could register/unregister observers at will.
nsTArray<RefPtr<ResizeObserver>> tempObservers(mResizeObservers);
for (auto observer : tempObservers) {
uint32_t targetDepth = observer->BroadcastActiveObservations();
if (targetDepth < shallowestTargetDepth) {
shallowestTargetDepth = targetDepth;
}
}
return shallowestTargetDepth;
}
bool
ResizeObserverController::HasAnyActiveObservations() const
{
for (auto observer : mResizeObservers) {
if (observer->HasActiveObservations()) {
return true;
}
}
return false;
}
bool
ResizeObserverController::HasAnySkippedObservations() const
{
for (auto observer : mResizeObservers) {
if (observer->HasSkippedObservations()) {
return true;
}
}
return false;
}
void
ResizeObserverController::ScheduleNotification()
{
mResizeObserverNotificationHelper->Register();
}
nsIPresShell*
ResizeObserverController::GetShell() const
{
return mDocument->GetShell();
}
ResizeObserverController::~ResizeObserverController()
{
MOZ_RELEASE_ASSERT(
!mResizeObserverNotificationHelper->IsRegistered(),
"Nothing else should keep a reference to our notification helper when we go away");
mResizeObserverNotificationHelper->DetachFromOwner();
}
} // namespace dom
} // namespace mozilla
+134
View File
@@ -0,0 +1,134 @@
/* -*- 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_ResizeObserverController_h
#define mozilla_dom_ResizeObserverController_h
#include "mozilla/dom/ResizeObserver.h"
#include "mozilla/TimeStamp.h"
#include "nsRefreshDriver.h"
namespace mozilla {
namespace dom {
class ResizeObserverController;
/*
* ResizeObserverNotificationHelper will trigger ResizeObserver notifications
* by registering with the Refresh Driver.
*/
class ResizeObserverNotificationHelper final : public nsARefreshObserver
{
public:
NS_INLINE_DECL_REFCOUNTING(ResizeObserverNotificationHelper, override)
explicit ResizeObserverNotificationHelper(ResizeObserverController* aOwner)
: mOwner(aOwner)
, mRegistered(false)
{
MOZ_ASSERT(mOwner, "Need a non-null owner");
}
void WillRefresh(TimeStamp aTime) override;
nsRefreshDriver* GetRefreshDriver() const;
void Register();
void Unregister();
void Disconnect();
bool IsRegistered() const { return mRegistered; }
void DetachFromOwner() { mOwner = nullptr; }
protected:
virtual ~ResizeObserverNotificationHelper();
ResizeObserverController* mOwner;
bool mRegistered;
};
/*
* ResizeObserverController contains the list of ResizeObservers and controls
* the flow of notification.
*/
class ResizeObserverController final
{
public:
explicit ResizeObserverController(nsIDocument* aDocument)
: mDocument(aDocument)
, mIsNotificationActive(false)
{
MOZ_ASSERT(mDocument, "Need a non-null document");
mResizeObserverNotificationHelper =
new ResizeObserverNotificationHelper(this);
}
// Methods for supporting cycle-collection
void Traverse(nsCycleCollectionTraversalCallback& aCb);
void Unlink();
void DetachFromDocument();
void AddResizeObserver(ResizeObserver* aObserver);
/*
* Schedule the notification via ResizeObserverNotificationHelper refresh
* observer.
*/
void ScheduleNotification();
/*
* Notify all ResizeObservers by gathering and broadcasting all active
* observations.
*/
void Notify();
nsIPresShell* GetShell() const;
~ResizeObserverController();
private:
/*
* Calls GatherActiveObservations(aDepth) for all ResizeObservers in this
* controller. All observations in each ResizeObserver with element's depth
* more than aDepth will be gathered.
*/
void GatherAllActiveObservations(uint32_t aDepth);
/*
* Calls BroadcastActiveObservations() for all ResizeObservers in this
* controller. It also returns the shallowest depth of observed target
* elements from all ResizeObserver or UINT32_MAX if there is no any
* active obsevations at all.
*/
uint32_t BroadcastAllActiveObservations();
/*
* Returns whether there is any ResizeObserver that has active observations.
*/
bool HasAnyActiveObservations() const;
/*
* Returns whether there is any ResizeObserver that has skipped observations.
*/
bool HasAnySkippedObservations() const;
protected:
// Raw pointer is OK because mDocument strongly owns us & hence must outlive
// us.
nsIDocument* const mDocument;
RefPtr<ResizeObserverNotificationHelper> mResizeObserverNotificationHelper;
nsTArray<RefPtr<ResizeObserver>> mResizeObservers;
bool mIsNotificationActive;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ResizeObserverController_h
+1 -1
View File
@@ -15,7 +15,7 @@ namespace dom {
class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
{
public:
constexpr WindowNamedPropertiesHandler()
WindowNamedPropertiesHandler()
: BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
{
}
-33
View File
@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
var frameRoot;
function boom()
{
var frameWin = f.contentWindow;
frameRoot = frameWin.document.documentElement;
frameWin.location.replace("data:text/html;charset=UTF-8,<body onload='parent.g();'>2");
}
function g()
{
setTimeout(h, 0);
}
function h()
{
var newDoc = document.implementation.createDocument('', '', null);
newDoc.adoptNode(frameRoot);
}
</script>
<body onload="boom();">
<iframe id="f" src="data:text/html;charset=UTF-8,<marquee>1"></iframe>
</body>
</html>
-24
View File
@@ -1,24 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
<head>
<script>
function boom()
{
var marquee = document.getElementById("marquee");
var span = document.getElementById("span");
marquee.appendChild(span);
marquee.removeChild(span);
document.documentElement.removeAttribute("class");
}
</script>
</head>
<body onload="setTimeout(boom, 30);">
<marquee id="marquee" />
<span id="span"><div>Foo</div><textarea/></span>
</body>
</html>
-28
View File
@@ -1,28 +0,0 @@
<html class="reftest-wait">
<head>
<script type="text/javascript">
var i = 0;
function mmf()
{
if (++i == 2) {
document.body.innerHTML = "<marquee>";
document.documentElement.removeAttribute("class");
}
}
function init()
{
document.documentElement.offsetHeight;
for (var j = 0; j < 2; ++j) {
var iframe = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
iframe.addEventListener("load", mmf, false);
document.body.appendChild(iframe);
}
}
</script>
</head>
<body onload="setTimeout(init, 0);"></body>
</html>
+4 -8
View File
@@ -26,7 +26,6 @@ XPIDL_SOURCES += [
'nsIObjectLoadingContent.idl',
'nsIRemoteWindowContext.idl',
'nsIScriptChannel.idl',
'nsIScriptLoaderObserver.idl',
'nsISelection.idl',
'nsISelectionController.idl',
'nsISelectionDisplay.idl',
@@ -96,7 +95,6 @@ EXPORTS += [
'nsINode.h',
'nsINodeList.h',
'nsIScriptContext.h',
'nsIScriptElement.h',
'nsIScriptGlobalObject.h',
'nsIScriptNameSpaceManager.h',
'nsIScriptObjectPrincipal.h',
@@ -117,7 +115,6 @@ EXPORTS += [
'nsRange.h',
'nsReferencedElement.h',
'nsSandboxFlags.h',
'nsScriptLoader.h',
'nsStructuredCloneContainer.h',
'nsStubAnimationObserver.h',
'nsStubDocumentObserver.h',
@@ -205,10 +202,11 @@ EXPORTS.mozilla.dom += [
'PartialSHistory.h',
'Pose.h',
'ProcessGlobal.h',
'ResizeObserver.h',
'ResizeObserverController.h',
'ResponsiveImageSelector.h',
'SameProcessMessageQueue.h',
'ScreenOrientation.h',
'ScriptSettings.h',
'ShadowRoot.h',
'SimpleTreeIterator.h',
'StructuredCloneHolder.h',
@@ -328,8 +326,6 @@ SOURCES += [
'nsRange.cpp',
'nsReferencedElement.cpp',
'nsScreen.cpp',
'nsScriptElement.cpp',
'nsScriptLoader.cpp',
'nsScriptNameSpaceManager.cpp',
'nsStructuredCloneContainer.cpp',
'nsStubAnimationObserver.cpp',
@@ -353,10 +349,11 @@ SOURCES += [
'Pose.cpp',
'PostMessageEvent.cpp',
'ProcessGlobal.cpp',
'ResizeObserver.cpp',
'ResizeObserverController.cpp',
'ResponsiveImageSelector.cpp',
'SameProcessMessageQueue.cpp',
'ScreenOrientation.cpp',
'ScriptSettings.cpp',
'ShadowRoot.cpp',
'StructuredCloneHolder.cpp',
'StyleSheetList.cpp',
@@ -423,7 +420,6 @@ EXTRA_JS_MODULES += [
]
LOCAL_INCLUDES += [
'../battery',
'../events',
'../media',
'../network',
+2 -2
View File
@@ -268,7 +268,7 @@ public:
// EnumTable can be initialized either with an int16_t value
// or a value of an enumeration type that can fit within an int16_t.
constexpr EnumTable(const char* aTag, int16_t aValue)
EnumTable(const char* aTag, int16_t aValue)
: tag(aTag)
, value(aValue)
{
@@ -276,7 +276,7 @@ public:
template<typename T,
typename = typename std::enable_if<std::is_enum<T>::value>::type>
constexpr EnumTable(const char* aTag, T aValue)
EnumTable(const char* aTag, T aValue)
: tag(aTag)
, value(static_cast<int16_t>(aValue))
{
+1 -2
View File
@@ -29,9 +29,8 @@
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsWeakPtr.h"
#include "ScriptSettings.h"
using mozilla::Unused; // <snicker>
using mozilla::Unused;
using namespace mozilla::dom;
using namespace mozilla;
+4 -3
View File
@@ -10,7 +10,6 @@
*/
#include "nsContentSink.h"
#include "nsScriptLoader.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "mozilla/css/Loader.h"
@@ -49,6 +48,7 @@
#include "nsHTMLDNSPrefetch.h"
#include "nsIObserverService.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/ScriptLoader.h"
#include "nsParserConstants.h"
#include "nsSandboxFlags.h"
@@ -789,13 +789,14 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
// If this is a fragment parser, we don't want to observe.
// We don't support CORS for processing instructions
bool isAlternate;
bool isExplicitlyEnabled;
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, aAlternate,
CORS_NONE, mDocument->GetReferrerPolicy(),
integrity, mRunsToCompletion ? nullptr : this,
&isAlternate);
&isAlternate, &isExplicitlyEnabled);
NS_ENSURE_SUCCESS(rv, rv);
if (!isAlternate && !mRunsToCompletion) {
if ((!isAlternate || isExplicitlyEnabled) && !mRunsToCompletion) {
++mPendingSheetCount;
mScriptLoader->AddParserBlockingScriptExecutionBlocker();
}
+5 -2
View File
@@ -36,13 +36,16 @@ class nsIAtom;
class nsIChannel;
class nsIContent;
class nsNodeInfoManager;
class nsScriptLoader;
class nsIApplicationCache;
namespace mozilla {
namespace css {
class Loader;
} // namespace css
namespace dom {
class ScriptLoader;
} // namespace dom
} // namespace mozilla
#ifdef DEBUG
@@ -273,7 +276,7 @@ protected:
nsCOMPtr<nsIDocShell> mDocShell;
RefPtr<mozilla::css::Loader> mCSSLoader;
RefPtr<nsNodeInfoManager> mNodeInfoManager;
RefPtr<nsScriptLoader> mScriptLoader;
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
// back off timer notification after count
int32_t mBackoffCount;
+23 -1
View File
@@ -5105,6 +5105,14 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
fileName.SetIsVoid(true); // No actionable download attribute was found.
}
// Sanitize fileNames containing control characters by replacing them with
// underscores.
if (!fileName.IsVoid()) {
for (int i = 0; i < 32; i++) {
fileName.ReplaceChar(char16_t(i), '_');
}
}
handler->OnLinkClick(aContent, aLinkURI,
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
@@ -9835,4 +9843,18 @@ nsContentUtils::IsLocalRefURL(const nsString& aString)
}
return false;
}
}
/* static */ uint32_t
nsContentUtils::GetNodeDepth(nsINode* aNode)
{
uint32_t depth = 1;
MOZ_ASSERT(aNode, "Node shouldn't be null");
while ((aNode = aNode->GetParentNode())) {
++depth;
}
return depth;
}
+8
View File
@@ -2745,6 +2745,14 @@ public:
static bool
IsLocalRefURL(const nsString& aString);
/**
* Returns the length of the parent-traversal path (in terms of the number of
* nodes) to an unparented/root node from aNode. An unparented/root node is
* considered to have a depth of 1, its children have a depth of 2, etc.
* aNode is expected to be non-null.
*/
static uint32_t GetNodeDepth(nsINode* aNode);
private:
static bool InitializeEventTable();
+2 -1
View File
@@ -3577,7 +3577,8 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
while (node) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
WidgetEvent event(true, eVoidEvent);
if (fc && fc->IsDisabledForEvents(&event)) {
*aRetVal = true;
break;
}
+56 -10
View File
@@ -1727,6 +1727,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
cb.NoteXPCOMChild(mql);
}
}
if (tmp->mResizeObserverController) {
tmp->mResizeObserverController->Traverse(cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument)
@@ -1827,11 +1831,15 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
l != &tmp->mDOMMediaQueryLists; ) {
PRCList *next = PR_NEXT_LINK(l);
MediaQueryList *mql = static_cast<MediaQueryList*>(l);
mql->RemoveAllListeners();
mql->Disconnect();
l = next;
}
tmp->mInUnlinkOrDeletion = false;
if (tmp->mResizeObserverController) {
tmp->mResizeObserverController->Unlink();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
nsresult
@@ -1880,7 +1888,7 @@ nsDocument::Init()
mScopeObject = do_GetWeakReference(global);
MOZ_ASSERT(mScopeObject);
mScriptLoader = new nsScriptLoader(this);
mScriptLoader = new dom::ScriptLoader(this);
mozilla::HoldJSObjects(this);
@@ -3681,6 +3689,12 @@ nsDocument::DeleteShell()
// objects for @font-face rules that came from the style set.
RebuildUserFontSet();
if (mResizeObserverController) {
// If the shell is going away, we need to remove any links to this document
// from the observer.
mResizeObserverController->DetachFromDocument();
}
nsIPresShell* oldShell = mPresShell;
mPresShell = nullptr;
UpdateFrameRequestCallbackSchedulingState(oldShell);
@@ -4685,7 +4699,7 @@ nsDocument::GetWindowInternal() const
return win;
}
nsScriptLoader*
ScriptLoader*
nsDocument::ScriptLoader()
{
return mScriptLoader;
@@ -5709,9 +5723,9 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
{
JS::Rooted<JSObject*> obj(aCx, aObject);
if (Preferences::GetBool("dom.webcomponents.enabled")) {
return true;
}
//if (Preferences::GetBool("dom.webcomponents.enabled")) {
// return true;
//}
// Check for the webcomponents permission. See Bug 1181555.
JSAutoCompartment ac(aCx, obj);
@@ -5725,9 +5739,9 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
bool
nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
{
if (Preferences::GetBool("dom.webcomponents.enabled")) {
return true;
}
//if (Preferences::GetBool("dom.webcomponents.enabled")) {
// return true;
//}
nsIDocument* doc = aNodeInfo->GetDocument();
// Use GetScopeObject() here so that data documents work the same way as the
@@ -5740,6 +5754,7 @@ nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
bool
nsDocument::IsWebComponentsEnabled(nsPIDOMWindowInner* aWindow)
{
/*
if (aWindow) {
nsresult rv;
nsCOMPtr<nsIPermissionManager> permMgr =
@@ -5753,7 +5768,7 @@ nsDocument::IsWebComponentsEnabled(nsPIDOMWindowInner* aWindow)
return perm == nsIPermissionManager::ALLOW_ACTION;
}
*/
return false;
}
@@ -12104,6 +12119,24 @@ nsDocument::QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aRetur
return nsINode::QuerySelectorAll(aSelector, aReturn);
}
void
nsDocument::AddResizeObserver(ResizeObserver* aResizeObserver)
{
if (!mResizeObserverController) {
mResizeObserverController = MakeUnique<ResizeObserverController>(this);
}
mResizeObserverController->AddResizeObserver(aResizeObserver);
}
void
nsDocument::ScheduleResizeObserversNotification() const
{
if (mResizeObserverController) {
mResizeObserverController->ScheduleNotification();
}
}
already_AddRefed<nsIDocument>
nsIDocument::Constructor(const GlobalObject& aGlobal,
ErrorResult& rv)
@@ -12744,3 +12777,16 @@ nsIDocument::GetSelection(ErrorResult& aRv)
return nsGlobalWindow::Cast(window)->GetSelection(aRv);
}
bool
nsIDocument::ModuleScriptsEnabled()
{
static bool sEnabledForContent = false;
static bool sCachedPref = false;
if (!sCachedPref) {
sCachedPref = true;
Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false);
}
return nsContentUtils::IsChromeDoc(this) || sEnabledForContent;
}
+11 -3
View File
@@ -31,7 +31,6 @@
#include "nsJSThingHashtable.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h"
#include "nsScriptLoader.h"
#include "nsIRadioGroupContainer.h"
#include "nsILayoutHistoryState.h"
#include "nsIRequest.h"
@@ -60,6 +59,8 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/PendingAnimationTracker.h"
#include "mozilla/dom/DOMImplementation.h"
#include "mozilla/dom/ResizeObserverController.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/StyleSheetList.h"
#include "nsDataHashtable.h"
#include "mozilla/TimeStamp.h"
@@ -674,7 +675,7 @@ public:
/**
* Get the script loader for this document
*/
virtual nsScriptLoader* ScriptLoader() override;
virtual mozilla::dom::ScriptLoader* ScriptLoader() override;
/**
* Add/Remove an element to the document's id and name hashes
@@ -1206,6 +1207,10 @@ public:
virtual void UnblockDOMContentLoaded() override;
void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) override;
void ScheduleResizeObserversNotification() const override;
protected:
friend class nsNodeUtils;
friend class nsDocumentOnStack;
@@ -1342,6 +1347,9 @@ protected:
nsTArray<nsIObserver*> mCharSetObservers;
mozilla::UniquePtr<mozilla::dom::ResizeObserverController>
mResizeObserverController;
PLDHashTable *mSubDocuments;
// Array of owning references to all children
@@ -1417,7 +1425,7 @@ public:
RefPtr<mozilla::EventListenerManager> mListenerManager;
RefPtr<mozilla::dom::StyleSheetList> mDOMStyleSheets;
RefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
RefPtr<nsScriptLoader> mScriptLoader;
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
nsDocHeaderData* mHeaderData;
/* mIdentifierMap works as follows for IDs:
* 1) Attribute changes affect the table immediately (removing and adding
+4 -4
View File
@@ -19,7 +19,6 @@
#include "nsJSUtils.h"
#include "nsJSPrincipals.h"
#include "nsNetUtil.h"
#include "nsScriptLoader.h"
#include "nsFrameLoader.h"
#include "nsIXULRuntime.h"
#include "nsIScriptError.h"
@@ -38,6 +37,7 @@
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/SameProcessMessageQueue.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
@@ -1786,9 +1786,9 @@ nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) {
return;
}
nsScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail,
EmptyString(), nullptr,
dataStringBuf, dataStringLength);
ScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail,
EmptyString(), nullptr,
dataStringBuf, dataStringLength);
}
JS::SourceBufferHolder srcBuf(dataStringBuf, dataStringLength,
+2 -1
View File
@@ -580,7 +580,6 @@ GK_ATOM(marginTop, "margin-top")
GK_ATOM(marginheight, "marginheight")
GK_ATOM(marginwidth, "marginwidth")
GK_ATOM(mark, "mark")
GK_ATOM(marquee, "marquee")
GK_ATOM(match, "match")
GK_ATOM(max, "max")
GK_ATOM(maxheight, "maxheight")
@@ -910,7 +909,9 @@ GK_ATOM(onreadystatechange, "onreadystatechange")
GK_ATOM(onreceived, "onreceived")
GK_ATOM(onremoteheld, "onremoteheld")
GK_ATOM(onremoteresumed, "onremoteresumed")
GK_ATOM(onrequestprogress, "onrequestprogress")
GK_ATOM(onresourcetimingbufferfull, "onresourcetimingbufferfull")
GK_ATOM(onresponseprogress, "onresponseprogress")
GK_ATOM(onretrieving, "onretrieving")
GK_ATOM(onRequest, "onRequest")
GK_ATOM(onrequestmediaplaystatus, "onrequestmediaplaystatus")
+3 -3
View File
@@ -62,7 +62,7 @@
#include "nsReadableUtils.h"
#include "nsDOMClassInfo.h"
#include "nsJSEnvironment.h"
#include "ScriptSettings.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Preferences.h"
#include "mozilla/Likely.h"
#include "mozilla/Sprintf.h"
@@ -956,7 +956,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder)
class nsOuterWindowProxy : public js::Wrapper
{
public:
constexpr nsOuterWindowProxy() : js::Wrapper(0) { }
nsOuterWindowProxy() : js::Wrapper(0) { }
virtual bool finalizeInBackground(const JS::Value& priv) const override {
return false;
@@ -1407,7 +1407,7 @@ nsOuterWindowProxy::singleton;
class nsChromeOuterWindowProxy : public nsOuterWindowProxy
{
public:
constexpr nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const override;
+9 -2
View File
@@ -91,7 +91,6 @@ class nsIVariant;
class nsViewManager;
class nsPresContext;
class nsRange;
class nsScriptLoader;
class nsSMILAnimationController;
class nsTextNode;
class nsWindowSizes;
@@ -152,6 +151,8 @@ enum class OrientationType : uint32_t;
class ProcessingInstruction;
class Promise;
class Selection;
class ScriptLoader;
class ResizeObserver;
class StyleSheetList;
class SVGDocument;
class SVGSVGElement;
@@ -1290,7 +1291,7 @@ public:
/**
* Get the script loader for this document
*/
virtual nsScriptLoader* ScriptLoader() = 0;
virtual mozilla::dom::ScriptLoader* ScriptLoader() = 0;
/**
* Add/Remove an element to the document's id and name hashes
@@ -2872,6 +2873,12 @@ public:
virtual void ScheduleIntersectionObserverNotification() = 0;
virtual void NotifyIntersectionObservers() = 0;
bool ModuleScriptsEnabled();
virtual void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) = 0;
virtual void ScheduleResizeObserversNotification() const = 0;
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{
+1 -1
View File
@@ -68,7 +68,7 @@ interface nsIImageLoadingContent : imgINotificationObserver
* the image was blocked. This status always refers to the
* CURRENT_REQUEST load.
*/
readonly attribute short imageBlockingStatus;
[infallible] readonly attribute short imageBlockingStatus;
/**
* Used to register an image decoder observer. Typically, this will
+25
View File
@@ -107,6 +107,7 @@
#include "GeometryUtils.h"
#include "nsIAnimationObserver.h"
#include "nsChildContentList.h"
#include "mozilla/dom/NodeBinding.h"
#ifdef ACCESSIBILITY
#include "mozilla/dom/AccessibleNode.h"
@@ -250,6 +251,30 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
return nullptr;
}
nsINode* nsINode::GetRootNode(const GetRootNodeOptions& aOptions)
{
if (aOptions.mComposed) {
if (IsInComposedDoc() && GetComposedDoc()) {
return OwnerDoc();
}
nsINode* node = this;
ShadowRoot* shadowRootParent = nullptr;
while(node) {
node = node->SubtreeRoot();
shadowRootParent = ShadowRoot::FromNode(node);
if (!shadowRootParent) {
break;
}
node = shadowRootParent->GetHost();
}
return node;
}
return SubtreeRoot();
}
nsINode*
nsINode::SubtreeRoot() const
{
+6 -4
View File
@@ -83,6 +83,7 @@ template<typename> class Sequence;
class Text;
class TextOrElementOrDocument;
struct DOMPointInit;
struct GetRootNodeOptions;
} // namespace dom
} // namespace mozilla
@@ -942,10 +943,11 @@ public:
*/
nsINode* SubtreeRoot() const;
nsINode* RootNode() const
{
return SubtreeRoot();
}
/*
* Get context object's shadow-including root if options's composed is true,
* and context object's root otherwise.
*/
nsINode* GetRootNode(const mozilla::dom::GetRootNodeOptions& aOptions);
/**
* See nsIDOMEventTarget
+5 -1
View File
@@ -933,8 +933,12 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
// If we don't have a current URI, we might as well store this URI so people
// know what we tried (and failed) to load.
if (!mCurrentRequest)
if (!mCurrentRequest) {
mCurrentURI = aNewURI;
if (mImageBlockingStatus == nsIContentPolicy::ACCEPT) {
mImageBlockingStatus = nsIContentPolicy::REJECT_REQUEST;
}
}
FireEvent(NS_LITERAL_STRING("error"));
FireEvent(NS_LITERAL_STRING("loadend"));
+1 -1
View File
@@ -11,13 +11,13 @@
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsComponentManagerUtils.h"
#include "nsScriptLoader.h"
#include "nsFrameLoader.h"
#include "xpcpublic.h"
#include "nsIMozBrowserFrame.h"
#include "nsDOMClassInfoID.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/SameProcessMessageQueue.h"
#include "mozilla/dom/ScriptLoader.h"
using namespace mozilla;
using namespace mozilla::dom;
+2 -2
View File
@@ -37,7 +37,6 @@
#include "nsXPCOMCIDInternal.h"
#include "nsIXULRuntime.h"
#include "nsTextFormatter.h"
#include "ScriptSettings.h"
#include "xpcpublic.h"
@@ -55,6 +54,7 @@
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsAXPCNativeCallContext.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/Telemetry.h"
@@ -1161,7 +1161,7 @@ TimeUntilNow(TimeStamp start)
struct CycleCollectorStats
{
constexpr CycleCollectorStats() :
CycleCollectorStats() :
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0),
+11 -8
View File
@@ -298,25 +298,28 @@ nsJSUtils::CompileModule(JSContext* aCx,
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
if (!JS::CompileModule(aCx, aCompileOptions, aSrcBuf, aModule)) {
bool compileResult = JS::CompileModule(aCx, aCompileOptions, aSrcBuf, aModule);
if (!compileResult) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult
nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*> aModule)
nsJSUtils::ModuleInstantiate(JSContext* aCx, JS::Handle<JSObject*> aModule)
{
PROFILER_LABEL("nsJSUtils", "ModuleDeclarationInstantiation",
PROFILER_LABEL("nsJSUtils", "ModuleInstantiate",
js::ProfileEntry::Category::JS);
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
CycleCollectedJSContext::Get()->MicroTaskLevel());
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
if (!JS::ModuleDeclarationInstantiation(aCx, aModule)) {
if (!JS::ModuleInstantiate(aCx, aModule)) {
return NS_ERROR_FAILURE;
}
@@ -324,9 +327,9 @@ nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*>
}
nsresult
nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
nsJSUtils::ModuleEvaluate(JSContext* aCx, JS::Handle<JSObject*> aModule)
{
PROFILER_LABEL("nsJSUtils", "ModuleEvaluation",
PROFILER_LABEL("nsJSUtils", "ModuleEvaluate",
js::ProfileEntry::Category::JS);
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
@@ -335,7 +338,7 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
if (!JS::ModuleEvaluation(aCx, aModule)) {
if (!JS::ModuleEvaluate(aCx, aModule)) {
return NS_ERROR_FAILURE;
}
+4 -4
View File
@@ -116,11 +116,11 @@ public:
JS::CompileOptions &aCompileOptions,
JS::MutableHandle<JSObject*> aModule);
static nsresult ModuleDeclarationInstantiation(JSContext* aCx,
JS::Handle<JSObject*> aModule);
static nsresult ModuleInstantiate(JSContext* aCx,
JS::Handle<JSObject*> aModule);
static nsresult ModuleEvaluation(JSContext* aCx,
JS::Handle<JSObject*> aModule);
static nsresult ModuleEvaluate(JSContext* aCx,
JS::Handle<JSObject*> aModule);
// Returns false if an exception got thrown on aCx. Passing a null
// aElement is allowed; that wil produce an empty aScopeChain.
+1
View File
@@ -16,6 +16,7 @@
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContentSerializer.h"
#include "nsIDocumentEncoder.h"
#include "nsILineBreaker.h"
+5 -3
View File
@@ -393,8 +393,9 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
nsAutoString title, type, media;
bool isScoped;
bool isAlternate;
bool isExplicitlyEnabled;
GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate);
GetStyleSheetInfo(title, type, media, &isScoped, &isAlternate, &isExplicitlyEnabled);
if (!type.LowerCaseEqualsLiteral("text/css")) {
return NS_OK;
@@ -425,7 +426,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
// Parse the style sheet.
rv = doc->CSSLoader()->
LoadInlineStyle(thisContent, text, mLineNumber, title, media,
scopeElement, aObserver, &doneLoading, &isAlternate);
scopeElement, aObserver, &doneLoading, &isAlternate, &isExplicitlyEnabled);
}
else {
nsAutoString integrity;
@@ -452,13 +453,14 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
rv = doc->CSSLoader()->
LoadStyleLink(thisContent, clonedURI, title, media, isAlternate,
GetCORSMode(), referrerPolicy, integrity,
aObserver, &isAlternate);
aObserver, &isAlternate, &isExplicitlyEnabled);
if (NS_FAILED(rv)) {
// Don't propagate LoadStyleLink() errors further than this, since some
// consumers (e.g. nsXMLContentSink) will completely abort on innocuous
// things like a stylesheet load being blocked by the security system.
doneLoading = true;
isAlternate = false;
isExplicitlyEnabled = false;
rv = NS_OK;
}
}
+2 -1
View File
@@ -98,7 +98,8 @@ protected:
nsAString& aType,
nsAString& aMedia,
bool* aIsScoped,
bool* aIsAlternate) = 0;
bool* aIsAlternate,
bool* aIsExplicitlyEnabled) = 0;
virtual mozilla::CORSMode GetCORSMode() const
{
+13
View File
@@ -1385,6 +1385,8 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
nsAutoString styleText;
nsContentUtils::GetNodeTextContent(node, false, styleText);
RemoveAllAttributesFromDescendants(elt);
nsAutoString sanitizedStyle;
nsCOMPtr<nsIURI> baseURI = node->GetBaseURI();
if (SanitizeStyleSheet(styleText,
@@ -1480,6 +1482,17 @@ nsTreeSanitizer::RemoveAllAttributes(nsIContent* aElement)
}
}
void nsTreeSanitizer::RemoveAllAttributesFromDescendants(mozilla::dom::Element* aElement) {
nsIContent* node = aElement->GetFirstChild();
while (node) {
if (node->IsElement()) {
mozilla::dom::Element* elt = node->AsElement();
RemoveAllAttributes(elt);
}
node = node->GetNextNode(aElement);
}
}
void
nsTreeSanitizer::InitializeStatics()
{
+6
View File
@@ -183,6 +183,12 @@ class MOZ_STACK_CLASS nsTreeSanitizer {
*/
void RemoveAllAttributes(nsIContent* aElement);
/**
* Removes all attributes from the descendants of an element but not from
* the element itself.
*/
void RemoveAllAttributesFromDescendants(mozilla::dom::Element* aElement);
/**
* The whitelist of HTML elements.
*/
+11 -4
View File
@@ -4,20 +4,27 @@
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
var wasRun = false;
var hadSyntaxError = false;
var errorCount = 0;
var syntaxErrorCount = 0;
var eventCount = 0;
SimpleTest.waitForExplicitFinish();
window.onerror = handleError;
function handleError(message, url, line, column, error) {
hadSyntaxError = error instanceof SyntaxError;
errorCount++;
if (error instanceof SyntaxError) {
syntaxErrorCount++;
}
}
function testError() {
ok(!wasRun, 'Check script was not run');
ok(hadSyntaxError, 'Check that a SyntaxError was thrown');
ok(errorCount == 1, 'Check that an error was reported');
ok(syntaxErrorCount == 1, 'Check that a syntax error was reported');
ok(eventCount == 0, 'Check that no error event was fired');
SimpleTest.finish();
}
</script>
<script type="module" src="module_badSyntax.js"></script>
<script type="module" src="module_badSyntax.js" onerror="eventCount++"></script>
<body onload='testError()'></body>
@@ -4,20 +4,27 @@
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
var wasRun = false;
var hadSyntaxError = false;
var errorCount = 0;
var syntaxErrorCount = 0;
var eventCount = 0;
SimpleTest.waitForExplicitFinish();
window.onerror = handleError;
function handleError(message, url, line, column, error) {
hadSyntaxError = error instanceof SyntaxError;
errorCount++;
if (error instanceof SyntaxError) {
syntaxErrorCount++;
}
}
function testError() {
ok(!wasRun, 'Check script was not run');
ok(hadSyntaxError, 'Check that a SyntaxError was thrown');
ok(errorCount == 1, 'Check that an error was reported');
ok(syntaxErrorCount == 1, 'Check that a syntax error was reported');
ok(eventCount == 0, 'Check that no error event was fired');
SimpleTest.finish();
}
</script>
<script type="module" src="module_badSyntax.js" async></script>
<script type="module" src="module_badSyntax.js" async onerror="eventCount++"></script>
<body onload='testError()'></body>
@@ -4,22 +4,29 @@
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
var wasRun = false;
var hadSyntaxError = false;
var errorCount = 0;
var syntaxErrorCount = 0;
var eventCount = 0;
SimpleTest.waitForExplicitFinish();
window.onerror = handleError;
function handleError(message, url, line, column, error) {
hadSyntaxError = error instanceof SyntaxError;
errorCount++;
if (error instanceof SyntaxError) {
syntaxErrorCount++;
}
}
function testError() {
ok(!wasRun, 'Check script was not run');
ok(hadSyntaxError, 'Check that a SyntaxError was thrown');
ok(errorCount == 1, 'Check that an error was reported');
ok(syntaxErrorCount == 1, 'Check that a syntax error was reported');
ok(eventCount == 0, 'Check that no error event was fired');
SimpleTest.finish();
}
</script>
<script type="module">
<script type="module" onerror="eventCount++">
// Module with a syntax error.
some invalid js syntax;
wasRun = true;
@@ -4,22 +4,29 @@
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
var wasRun = false;
var hadSyntaxError = false;
var errorCount = 0;
var syntaxErrorCount = 0;
var eventCount = 0;
SimpleTest.waitForExplicitFinish();
window.onerror = handleError;
function handleError(message, url, line, column, error) {
hadSyntaxError = error instanceof SyntaxError;
errorCount++;
if (error instanceof SyntaxError) {
syntaxErrorCount++;
}
}
function testError() {
ok(!wasRun, 'Check script was not run');
ok(hadSyntaxError, 'Check that a SyntaxError was thrown');
ok(errorCount == 1, 'Check that an error was reported');
ok(syntaxErrorCount == 1, 'Check that a syntax error was reported');
ok(eventCount == 0, 'Check that no error event was fired');
SimpleTest.finish();
}
</script>
<script type="module" async>
<script type="module" async onerror="eventCount++">
// Module with a syntax error.
some invalid js syntax;
wasRun = true;
+1 -1
View File
@@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840098
<div id="content" style="display: none">
<div id="foo"></div>
</div>
<marquee id="m">Hello</marquee>
<div id="m">Hello</div>
<pre id="test">
<script type="application/javascript">
@@ -115,7 +115,7 @@
<div id="a" contenteditable><span id="test1">abc, abc, abc</span><br>
<span id="test2" style="color: blue;">abc, abc, abc</span><br>
<textarea id="test3">abc</textarea><input id="test4" value="abcdef"><br><br>
<marquee>marquee</marquee>
<div>div</div>
</div>
<input id="test5" value="The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down, so suddenly that Alice had not a moment to think about stopping herself before she found herself falling down a very deep well. Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled `ORANGE MARMALADE', but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it." type="text">
<input id="test6" type="number" style="width:150px; height:57px;" value="31415"><br>
-913
View File
@@ -1,913 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=641821
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 641821</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="runTest()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=641821">Mozilla Bug 641821</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 641821 **/
SimpleTest.requestFlakyTimeout("requestFlakyTimeout is silly. (But make sure marquee has time to initialize itself.)");
var div = document.createElement("div");
var M;
if ("MozMutationObserver" in window) {
M = window.MozMutationObserver;
} else if ("WebKitMutationObserver" in window) {
M = window.WebKitMutationObserver;
} else {
M = window.MutationObserver;
}
function log(str) {
var d = document.createElement("div");
d.textContent = str;
if (str.indexOf("PASSED") >= 0) {
d.setAttribute("style", "color: green;");
} else {
d.setAttribute("style", "color: red;");
}
document.getElementById("log").appendChild(d);
}
// Some helper functions so that this test runs also outside mochitest.
if (!("ok" in window)) {
window.ok = function(val, str) {
log(str + (val ? " PASSED\n" : " FAILED\n"));
}
}
if (!("is" in window)) {
window.is = function(val, refVal, str) {
log(str + (val == refVal? " PASSED " : " FAILED ") +
(val != refVal ? "expected " + refVal + " got " + val + "\n" : "\n"));
}
}
if (!("isnot" in window)) {
window.isnot = function(val, refVal, str) {
log(str + (val != refVal? " PASSED " : " FAILED ") +
(val == refVal ? "Didn't expect " + refVal + "\n" : "\n"));
}
}
if (!("SimpleTest" in window)) {
window.SimpleTest =
{
finish: function() {
document.getElementById("log").appendChild(document.createTextNode("DONE"));
},
waitForExplicitFinish: function() {}
}
}
function then(thenFn) {
setTimeout(function() {
if (thenFn) {
setTimeout(thenFn, 0);
} else {
SimpleTest.finish();
}
}, 0);
}
var m;
var m2;
var m3;
var m4;
// Checks basic parameter validation and normal 'this' handling.
// Tests also basic attribute handling.
function runTest() {
m = new M(function(){});
ok(m, "MutationObserver supported");
var e = null;
try {
m.observe(document, {});
} catch (ex) {
e = ex;
}
ok(e, "Should have thrown an exception");
is(e.name, "TypeError", "Should have thrown TypeError");
e = null;
try {
m.observe(document, { childList: true, attributeOldValue: true });
} catch (ex) {
e = ex;
}
ok(!e, "Shouldn't have thrown an exception");
e = null;
try {
m.observe(document, { childList: true, attributeFilter: ["foo"] });
} catch (ex) {
e = ex;
}
ok(!e, "Shouldn't have thrown an exception");
e = null;
try {
m.observe(document, { childList: true, characterDataOldValue: true });
} catch (ex) {
e = ex;
}
ok(!e, "Shouldn't have thrown an exception");
e = null;
try {
m.observe(document);
} catch (ex) {
e = ex;
}
ok(e, "Should have thrown an exception");
m = new M(function(records, observer) {
is(observer, m, "2nd parameter should be the mutation observer");
is(observer, this, "2nd parameter should be 'this'");
is(records.length, 1, "Should have one record.");
is(records[0].type, "attributes", "Should have got attributes record");
is(records[0].target, div, "Should have got div as target");
is(records[0].attributeName, "foo", "Should have got record about foo attribute");
observer.disconnect();
then(testThisBind);
m = null;
});
m.observe(div, { attributes: true, attributeFilter: ["foo"] });
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true);
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter.length, 1)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter[0], "foo")
div.setAttribute("foo", "bar");
}
// 'this' handling when fn.bind() is used.
function testThisBind() {
var child = div.appendChild(document.createElement("div"));
var gchild = child.appendChild(document.createElement("div"));
m = new M((function(records, observer) {
is(observer, m, "2nd parameter should be the mutation observer");
isnot(observer, this, "2nd parameter should be 'this'");
is(records.length, 3, "Should have one record.");
is(records[0].type, "attributes", "Should have got attributes record");
is(records[0].target, div, "Should have got div as target");
is(records[0].attributeName, "foo", "Should have got record about foo attribute");
is(records[0].oldValue, "bar", "oldValue should be bar");
is(records[1].type, "attributes", "Should have got attributes record");
is(records[1].target, div, "Should have got div as target");
is(records[1].attributeName, "foo", "Should have got record about foo attribute");
is(records[1].oldValue, "bar2", "oldValue should be bar2");
is(records[2].type, "attributes", "Should have got attributes record");
is(records[2].target, gchild, "Should have got div as target");
is(records[2].attributeName, "foo", "Should have got record about foo attribute");
is(records[2].oldValue, null, "oldValue should be bar2");
observer.disconnect();
then(testCharacterData);
m = null;
}).bind(window));
m.observe(div, { attributes: true, attributeOldValue: true, subtree: true });
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeOldValue, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true)
div.setAttribute("foo", "bar2");
div.removeAttribute("foo");
div.removeChild(child);
child.removeChild(gchild);
div.appendChild(gchild);
div.removeChild(gchild);
gchild.setAttribute("foo", "bar");
}
function testCharacterData() {
m = new M(function(records, observer) {
is(records[0].type, "characterData", "Should have got characterData");
is(records[0].oldValue, null, "Shouldn't have got oldData");
observer.disconnect();
m = null;
});
m2 = new M(function(records, observer) {
is(records[0].type, "characterData", "Should have got characterData");
is(records[0].oldValue, "foo", "Should have got oldData");
observer.disconnect();
m2 = null;
});
m3 = new M(function(records, observer) {
ok(false, "This should not be called!");
observer.disconnect();
m3 = null;
});
m4 = new M(function(records, observer) {
is(records[0].oldValue, null, "Shouldn't have got oldData");
observer.disconnect();
m3.disconnect();
m3 = null;
then(testChildList);
m4 = null;
});
div.appendChild(document.createTextNode("foo"));
m.observe(div, { characterData: true, subtree: true });
m2.observe(div, { characterData: true, characterDataOldValue: true, subtree: true});
// If observing the same node twice, only the latter option should apply.
m3.observe(div, { characterData: true, subtree: true });
m3.observe(div, { characterData: true, subtree: false });
m4.observe(div.firstChild, { characterData: true, subtree: false });
is(SpecialPowers.wrap(div).getBoundMutationObservers().length, 3)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].characterData, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].subtree, false)
div.firstChild.data = "bar";
}
function testChildList() {
var fc = div.firstChild;
m = new M(function(records, observer) {
is(records[0].type, "childList", "Should have got childList");
is(records[0].addedNodes.length, 0, "Shouldn't have got addedNodes");
is(records[0].removedNodes.length, 1, "Should have got removedNodes");
is(records[0].removedNodes[0], fc, "Should have removed a text node");
observer.disconnect();
then(testChildList2);
m = null;
});
m.observe(div, { childList: true});
div.removeChild(div.firstChild);
}
function testChildList2() {
div.innerHTML = "<span>1</span><span>2</span>";
m = new M(function(records, observer) {
is(records[0].type, "childList", "Should have got childList");
is(records[0].removedNodes.length, 2, "Should have got removedNodes");
is(records[0].addedNodes.length, 1, "Should have got addedNodes");
observer.disconnect();
then(testChildList3);
m = null;
});
m.observe(div, { childList: true });
div.innerHTML = "<span><span>foo</span></span>";
}
function testChildList3() {
m = new M(function(records, observer) {
is(records[0].type, "childList", "Should have got childList");
is(records[0].removedNodes.length, 1, "Should have got removedNodes");
is(records[0].addedNodes.length, 1, "Should have got addedNodes");
observer.disconnect();
then(testChildList4);
m = null;
});
m.observe(div, { childList: true });
div.textContent = "hello";
}
function testChildList4() {
div.textContent = null;
var df = document.createDocumentFragment();
var t1 = df.appendChild(document.createTextNode("Hello "));
var t2 = df.appendChild(document.createTextNode("world!"));
var s1 = div.appendChild(document.createElement("span"));
s1.textContent = "foo";
var s2 = div.appendChild(document.createElement("span"));
function callback(records, observer) {
is(records.length, 3, "Should have got one record for removing nodes from document fragment and one record for adding them to div");
is(records[0].removedNodes.length, 2, "Should have got removedNodes");
is(records[0].removedNodes[0], t1, "Should be the 1st textnode");
is(records[0].removedNodes[1], t2, "Should be the 2nd textnode");
is(records[1].addedNodes.length, 2, "Should have got addedNodes");
is(records[1].addedNodes[0], t1, "Should be the 1st textnode");
is(records[1].addedNodes[1], t2, "Should be the 2nd textnode");
is(records[1].previousSibling, s1, "Should have previousSibling");
is(records[1].nextSibling, s2, "Should have nextSibling");
is(records[2].type, "characterData", "3rd record should be characterData");
is(records[2].target, t1, "target should be the textnode");
is(records[2].oldValue, "Hello ", "oldValue was 'Hello '");
observer.disconnect();
then(testChildList5);
m = null;
};
m = new M(callback);
m.observe(df, { childList: true, characterData: true, characterDataOldValue: true, subtree: true });
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].childList, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterData, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterDataOldValue, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true)
ok(SpecialPowers.compare(SpecialPowers.wrap(df).getBoundMutationObservers()[0].mutationCallback, callback))
m.observe(div, { childList: true });
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo().length, 2)
// Make sure transient observers aren't leaked.
var leakTest = new M(function(){});
leakTest.observe(div, { characterData: true, subtree: true });
div.insertBefore(df, s2);
s1.firstChild.data = "bar"; // This should *not* create a record.
t1.data = "Hello the whole "; // This should create a record.
}
function testChildList5() {
div.textContent = null;
var c1 = div.appendChild(document.createElement("div"));
var c2 = document.createElement("div");
var div2 = document.createElement("div");
var c3 = div2.appendChild(document.createElement("div"));
var c4 = document.createElement("div");
var c5 = document.createElement("div");
var df = document.createDocumentFragment();
var emptyDF = document.createDocumentFragment();
var dfc1 = df.appendChild(document.createElement("div"));
var dfc2 = df.appendChild(document.createElement("div"));
var dfc3 = df.appendChild(document.createElement("div"));
m = new M(function(records, observer) {
is(records.length, 6 , "");
is(records[0].removedNodes.length, 1, "Should have got removedNodes");
is(records[0].removedNodes[0], c1, "");
is(records[0].addedNodes.length, 1, "Should have got addedNodes");
is(records[0].addedNodes[0], c2, "");
is(records[0].previousSibling, null, "");
is(records[0].nextSibling, null, "");
is(records[1].removedNodes.length, 1, "Should have got removedNodes");
is(records[1].removedNodes[0], c3, "");
is(records[1].addedNodes.length, 0, "Shouldn't have got addedNodes");
is(records[1].previousSibling, null, "");
is(records[1].nextSibling, null, "");
is(records[2].removedNodes.length, 1, "Should have got removedNodes");
is(records[2].removedNodes[0], c2, "");
is(records[2].addedNodes.length, 1, "Should have got addedNodes");
is(records[2].addedNodes[0], c3, "");
is(records[2].previousSibling, null, "");
is(records[2].nextSibling, null, "");
// Check document fragment handling
is(records[5].removedNodes.length, 1, "");
is(records[5].removedNodes[0], c4, "");
is(records[5].addedNodes.length, 3, "");
is(records[5].addedNodes[0], dfc1, "");
is(records[5].addedNodes[1], dfc2, "");
is(records[5].addedNodes[2], dfc3, "");
is(records[5].previousSibling, c3, "");
is(records[5].nextSibling, c5, "");
observer.disconnect();
then(testAdoptNode);
m = null;
});
m.observe(div, { childList: true, subtree: true });
m.observe(div2, { childList: true, subtree: true });
div.replaceChild(c2, c1);
div.replaceChild(c3, c2);
div.appendChild(c4);
div.appendChild(c5);
div.replaceChild(df, c4);
div.appendChild(emptyDF); // empty document shouldn't cause mutation records
}
function testAdoptNode() {
var d1 = document.implementation.createHTMLDocument(null);
var d2 = document.implementation.createHTMLDocument(null);
var addedNode;
m = new M(function(records, observer) {
is(records.length, 3, "Should have 2 records");
is(records[0].target.ownerDocument, d1, "ownerDocument should be the initial document")
is(records[1].target.ownerDocument, d2, "ownerDocument should be the new document");
is(records[2].type, "attributes", "Should have got attribute mutation")
is(records[2].attributeName, "foo", "Should have got foo attribute mutation")
observer.disconnect();
then(testOuterHTML);
m = null;
});
m.observe(d1, { childList: true, subtree: true, attributes: true });
d2.body.appendChild(d1.body);
addedNode = d2.body.lastChild.appendChild(d2.createElement("div"));
addedNode.setAttribute("foo", "bar");
}
function testOuterHTML() {
var doc = document.implementation.createHTMLDocument(null);
var d1 = doc.body.appendChild(document.createElement("div"));
var d2 = doc.body.appendChild(document.createElement("div"));
var d3 = doc.body.appendChild(document.createElement("div"));
var d4 = doc.body.appendChild(document.createElement("div"));
m = new M(function(records, observer) {
is(records.length, 4, "Should have 1 record");
is(records[0].removedNodes.length, 1, "Should have 1 removed nodes");
is(records[0].addedNodes.length, 2, "Should have 2 added nodes");
is(records[0].previousSibling, null, "");
is(records[0].nextSibling, d2, "");
is(records[1].removedNodes.length, 1, "Should have 1 removed nodes");
is(records[1].addedNodes.length, 2, "Should have 2 added nodes");
is(records[1].previousSibling, records[0].addedNodes[1], "");
is(records[1].nextSibling, d3, "");
is(records[2].removedNodes.length, 1, "Should have 1 removed nodes");
is(records[2].addedNodes.length, 2, "Should have 2 added nodes");
is(records[2].previousSibling, records[1].addedNodes[1], "");
is(records[2].nextSibling, d4, "");
is(records[3].removedNodes.length, 1, "Should have 1 removed nodes");
is(records[3].addedNodes.length, 0);
is(records[3].previousSibling, records[2].addedNodes[1], "");
is(records[3].nextSibling, null, "");
observer.disconnect();
then(testInsertAdjacentHTML);
m = null;
});
m.observe(doc, { childList: true, subtree: true });
d1.outerHTML = "<div>1</div><div>1</div>";
d2.outerHTML = "<div>2</div><div>2</div>";
d3.outerHTML = "<div>3</div><div>3</div>";
d4.outerHTML = "";
}
function testInsertAdjacentHTML() {
var doc = document.implementation.createHTMLDocument(null);
var d1 = doc.body.appendChild(document.createElement("div"));
var d2 = doc.body.appendChild(document.createElement("div"));
var d3 = doc.body.appendChild(document.createElement("div"));
var d4 = doc.body.appendChild(document.createElement("div"));
m = new M(function(records, observer) {
is(records.length, 4, "");
is(records[0].target, doc.body, "");
is(records[0].previousSibling, null, "");
is(records[0].nextSibling, d1, "");
is(records[1].target, d2, "");
is(records[1].previousSibling, null, "");
is(records[1].nextSibling, null, "");
is(records[2].target, d3, "");
is(records[2].previousSibling, null, "");
is(records[2].nextSibling, null, "");
is(records[3].target, doc.body, "");
is(records[3].previousSibling, d4, "");
is(records[3].nextSibling, null, "");
observer.disconnect();
then(testSyncXHR);
m = null;
});
m.observe(doc, { childList: true, subtree: true });
d1.insertAdjacentHTML("beforebegin", "<div></div><div></div>");
d2.insertAdjacentHTML("afterbegin", "<div></div><div></div>");
d3.insertAdjacentHTML("beforeend", "<div></div><div></div>");
d4.insertAdjacentHTML("afterend", "<div></div><div></div>");
}
var callbackHandled = false;
function testSyncXHR() {
div.textContent = null;
m = new M(function(records, observer) {
is(records.length, 1, "");
is(records[0].addedNodes.length, 1, "");
callbackHandled = true;
observer.disconnect();
m = null;
});
m.observe(div, { childList: true, subtree: true });
div.innerHTML = "<div>hello</div>";
var x = new XMLHttpRequest();
x.open("GET", window.location, false);
x.send();
ok(!callbackHandled, "Shouldn't have called the mutation callback!");
setTimeout(testSyncXHR2, 0);
}
function testSyncXHR2() {
ok(callbackHandled, "Should have called the mutation callback!");
then(testTakeRecords);
}
function testTakeRecords() {
var s = "<span>1</span><span>2</span>";
div.innerHTML = s;
var takenRecords;
m = new M(function(records, observer) {
is(records.length, 3, "Should have got 3 records");
is(records[0].type, "attributes", "Should have got attributes");
is(records[0].attributeName, "foo", "");
is(records[0].attributeNamespace, null, "");
is(records[0].prevValue, null, "");
is(records[1].type, "childList", "Should have got childList");
is(records[1].removedNodes.length, 2, "Should have got removedNodes");
is(records[1].addedNodes.length, 2, "Should have got addedNodes");
is(records[2].type, "attributes", "Should have got attributes");
is(records[2].attributeName, "foo", "");
is(records.length, takenRecords.length, "Should have had similar mutations");
is(records[0].type, takenRecords[0].type, "Should have had similar mutations");
is(records[1].type, takenRecords[1].type, "Should have had similar mutations");
is(records[2].type, takenRecords[2].type, "Should have had similar mutations");
is(records[1].removedNodes.length, takenRecords[1].removedNodes.length, "Should have had similar mutations");
is(records[1].addedNodes.length, takenRecords[1].addedNodes.length, "Should have had similar mutations");
is(m.takeRecords().length, 0, "Shouldn't have any records");
observer.disconnect();
then(testMutationObserverAndEvents);
m = null;
});
m.observe(div, { childList: true, attributes: true });
div.setAttribute("foo", "bar");
div.innerHTML = s;
div.removeAttribute("foo");
takenRecords = m.takeRecords();
div.setAttribute("foo", "bar");
div.innerHTML = s;
div.removeAttribute("foo");
}
function testTakeRecords() {
function mutationListener(e) {
++mutationEventCount;
is(e.attrChange, MutationEvent.ADDITION, "unexpected change");
}
m = new M(function(records, observer) {
is(records.length, 2, "Should have got 2 records");
is(records[0].type, "attributes", "Should have got attributes");
is(records[0].attributeName, "foo", "");
is(records[0].oldValue, null, "");
is(records[1].type, "attributes", "Should have got attributes");
is(records[1].attributeName, "foo", "");
is(records[1].oldValue, "bar", "");
observer.disconnect();
div.removeEventListener("DOMAttrModified", mutationListener);
then(testExpandos);
m = null;
});
m.observe(div, { attributes: true, attributeOldValue: true });
// Note, [0] points to a mutation observer which is there for a leak test!
ok(SpecialPowers.compare(SpecialPowers.wrap(div).getBoundMutationObservers()[1], m));
var mutationEventCount = 0;
div.addEventListener("DOMAttrModified", mutationListener);
div.setAttribute("foo", "bar");
div.setAttribute("foo", "bar");
is(mutationEventCount, 1, "Should have got only one mutation event!");
}
function testExpandos() {
var m2 = new M(function(records, observer) {
is(observer.expandoProperty, true);
observer.disconnect();
then(testOutsideShadowDOM);
});
m2.expandoProperty = true;
m2.observe(div, { attributes: true });
m2 = null;
if (SpecialPowers) {
// Run GC several times to see if the expando property disappears.
SpecialPowers.gc();
SpecialPowers.gc();
SpecialPowers.gc();
SpecialPowers.gc();
}
div.setAttribute("foo", "bar2");
}
function testOutsideShadowDOM() {
var m = new M(function(records, observer) {
is(records.length, 1);
is(records[0].type, "attributes", "Should have got attributes");
observer.disconnect();
then(testInsideShadowDOM);
});
m.observe(div, {
attributes: true,
childList: true,
characterData: true,
subtree: true
})
var sr = div.createShadowRoot();
sr.innerHTML = "<div" + ">text</" + "div>";
sr.firstChild.setAttribute("foo", "bar");
sr.firstChild.firstChild.data = "text2";
sr.firstChild.appendChild(document.createElement("div"));
div.setAttribute("foo", "bar");
}
function testInsideShadowDOM() {
var m = new M(function(records, observer) {
is(records.length, 4);
is(records[0].type, "childList");
is(records[1].type, "attributes");
is(records[2].type, "characterData");
is(records[3].type, "childList");
observer.disconnect();
then(testMarquee);
});
var sr = div.createShadowRoot();
m.observe(sr, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
sr.innerHTML = "<div" + ">text</" + "div>";
sr.firstChild.setAttribute("foo", "bar");
sr.firstChild.firstChild.data = "text2";
sr.firstChild.appendChild(document.createElement("div"));
div.setAttribute("foo", "bar2");
}
function testMarquee() {
var m = new M(function(records, observer) {
is(records.length, 1);
is(records[0].type, "attributes");
is(records[0].attributeName, "ok");
is(records[0].oldValue, null);
observer.disconnect();
then(testStyleCreate);
});
var marquee = document.createElement("marquee");
m.observe(marquee, {
attributes: true,
attributeOldValue: true,
childList: true,
characterData: true,
subtree: true
});
document.body.appendChild(marquee);
setTimeout(function() {marquee.setAttribute("ok", "ok")}, 500);
}
function testStyleCreate() {
m = new M(function(records, observer) {
is(records.length, 1, "number of records");
is(records[0].type, "attributes", "record.type");
is(records[0].attributeName, "style", "record.attributeName");
is(records[0].oldValue, null, "record.oldValue");
isnot(div.getAttribute("style"), null, "style attribute after creation");
observer.disconnect();
m = null;
div.removeAttribute("style");
then(testStyleModify);
});
m.observe(div, { attributes: true, attributeOldValue: true });
is(div.getAttribute("style"), null, "style attribute before creation");
div.style.color = "blue";
}
function testStyleModify() {
div.style.color = "yellow";
m = new M(function(records, observer) {
is(records.length, 1, "number of records");
is(records[0].type, "attributes", "record.type");
is(records[0].attributeName, "style", "record.attributeName");
isnot(div.getAttribute("style"), null, "style attribute after modification");
observer.disconnect();
m = null;
div.removeAttribute("style");
then(testStyleRead);
});
m.observe(div, { attributes: true });
isnot(div.getAttribute("style"), null, "style attribute before modification");
div.style.color = "blue";
}
function testStyleRead() {
m = new M(function(records, observer) {
is(records.length, 1, "number of records");
is(records[0].type, "attributes", "record.type");
is(records[0].attributeName, "data-test", "record.attributeName");
is(div.getAttribute("style"), null, "style attribute after read");
observer.disconnect();
div.removeAttribute("data-test");
m = null;
then(testStyleRemoveProperty);
});
m.observe(div, { attributes: true });
is(div.getAttribute("style"), null, "style attribute before read");
var value = div.style.color; // shouldn't generate any mutation records
div.setAttribute("data-test", "a");
}
function testStyleRemoveProperty() {
div.style.color = "blue";
m = new M(function(records, observer) {
is(records.length, 1, "number of records");
is(records[0].type, "attributes", "record.type");
is(records[0].attributeName, "style", "record.attributeName");
isnot(div.getAttribute("style"), null, "style attribute after successful removeProperty");
observer.disconnect();
m = null;
div.removeAttribute("style");
then(testStyleRemoveProperty2);
});
m.observe(div, { attributes: true });
isnot(div.getAttribute("style"), null, "style attribute before successful removeProperty");
div.style.removeProperty("color");
}
function testStyleRemoveProperty2() {
m = new M(function(records, observer) {
is(records.length, 1, "number of records");
is(records[0].type, "attributes", "record.type");
is(records[0].attributeName, "data-test", "record.attributeName");
is(div.getAttribute("style"), null, "style attribute after unsuccessful removeProperty");
observer.disconnect();
m = null;
div.removeAttribute("data-test");
then(testAttributeRecordMerging1);
});
m.observe(div, { attributes: true });
is(div.getAttribute("style"), null, "style attribute before unsuccessful removeProperty");
div.style.removeProperty("color"); // shouldn't generate any mutation records
div.setAttribute("data-test", "a");
}
function testAttributeRecordMerging1() {
ok(true, "testAttributeRecordMerging1");
var m = new M(function(records, observer) {
is(records.length, 2);
is(records[0].type, "attributes");
is(records[0].target, div);
is(records[0].attributeName, "foo");
is(records[0].attributeNamespace, null);
is(records[0].oldValue, null);
is(records[1].type, "attributes");
is(records[1].target, div.firstChild);
is(records[1].attributeName, "foo");
is(records[1].attributeNamespace, null);
is(records[1].oldValue, null);
observer.disconnect();
div.innerHTML = "";
div.removeAttribute("foo");
then(testAttributeRecordMerging2);
});
m.observe(div, {
attributes: true,
subtree: true
});
SpecialPowers.wrap(m).mergeAttributeRecords = true;
div.setAttribute("foo", "bar_1");
div.setAttribute("foo", "bar_2");
div.innerHTML = "<div></div>";
div.firstChild.setAttribute("foo", "bar_1");
div.firstChild.setAttribute("foo", "bar_2");
}
function testAttributeRecordMerging2() {
ok(true, "testAttributeRecordMerging2");
var m = new M(function(records, observer) {
is(records.length, 2);
is(records[0].type, "attributes");
is(records[0].target, div);
is(records[0].attributeName, "foo");
is(records[0].attributeNamespace, null);
is(records[0].oldValue, "initial");
is(records[1].type, "attributes");
is(records[1].target, div.firstChild);
is(records[1].attributeName, "foo");
is(records[1].attributeNamespace, null);
is(records[1].oldValue, "initial");
observer.disconnect();
div.innerHTML = "";
div.removeAttribute("foo");
then(testAttributeRecordMerging3);
});
div.setAttribute("foo", "initial");
div.innerHTML = "<div></div>";
div.firstChild.setAttribute("foo", "initial");
m.observe(div, {
attributes: true,
subtree: true,
attributeOldValue: true
});
SpecialPowers.wrap(m).mergeAttributeRecords = true;
div.setAttribute("foo", "bar_1");
div.setAttribute("foo", "bar_2");
div.firstChild.setAttribute("foo", "bar_1");
div.firstChild.setAttribute("foo", "bar_2");
}
function testAttributeRecordMerging3() {
ok(true, "testAttributeRecordMerging3");
var m = new M(function(records, observer) {
is(records.length, 4);
is(records[0].type, "attributes");
is(records[0].target, div);
is(records[0].attributeName, "foo");
is(records[0].attributeNamespace, null);
is(records[0].oldValue, "initial");
is(records[1].type, "attributes");
is(records[1].target, div.firstChild);
is(records[1].attributeName, "foo");
is(records[1].attributeNamespace, null);
is(records[1].oldValue, "initial");
is(records[2].type, "attributes");
is(records[2].target, div);
is(records[2].attributeName, "foo");
is(records[2].attributeNamespace, null);
is(records[2].oldValue, "bar_1");
is(records[3].type, "attributes");
is(records[3].target, div.firstChild);
is(records[3].attributeName, "foo");
is(records[3].attributeNamespace, null);
is(records[3].oldValue, "bar_1");
observer.disconnect();
div.innerHTML = "";
div.removeAttribute("foo");
then(testAttributeRecordMerging4);
});
div.setAttribute("foo", "initial");
div.innerHTML = "<div></div>";
div.firstChild.setAttribute("foo", "initial");
m.observe(div, {
attributes: true,
subtree: true,
attributeOldValue: true
});
SpecialPowers.wrap(m).mergeAttributeRecords = true;
// No merging should happen.
div.setAttribute("foo", "bar_1");
div.firstChild.setAttribute("foo", "bar_1");
div.setAttribute("foo", "bar_2");
div.firstChild.setAttribute("foo", "bar_2");
}
function testAttributeRecordMerging4() {
ok(true, "testAttributeRecordMerging4");
var m = new M(function(records, observer) {
});
div.setAttribute("foo", "initial");
div.innerHTML = "<div></div>";
div.firstChild.setAttribute("foo", "initial");
m.observe(div, {
attributes: true,
subtree: true,
attributeOldValue: true
});
SpecialPowers.wrap(m).mergeAttributeRecords = true;
div.setAttribute("foo", "bar_1");
div.setAttribute("foo", "bar_2");
div.firstChild.setAttribute("foo", "bar_1");
div.firstChild.setAttribute("foo", "bar_2");
var records = m.takeRecords();
is(records.length, 2);
is(records[0].type, "attributes");
is(records[0].target, div);
is(records[0].attributeName, "foo");
is(records[0].attributeNamespace, null);
is(records[0].oldValue, "initial");
is(records[1].type, "attributes");
is(records[1].target, div.firstChild);
is(records[1].attributeName, "foo");
is(records[1].attributeNamespace, null);
is(records[1].oldValue, "initial");
m.disconnect();
div.innerHTML = "";
div.removeAttribute("foo");
then(testChromeOnly);
}
function testChromeOnly() {
// Content can't access nativeAnonymousChildList
try {
var mo = new M(function(records, observer) { });
mo.observe(div, { nativeAnonymousChildList: true });
ok(false, "Should have thrown when trying to observe with chrome-only init");
} catch (e) {
ok(true, "Throws when trying to observe with chrome-only init");
}
then();
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<div id="log">
</div>
</body>
</html>
-212
View File
@@ -1,212 +0,0 @@
/* -*- 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/. */
#include <cmath>
#include <limits>
#include "BatteryManager.h"
#include "Constants.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/Hal.h"
#include "mozilla/dom/BatteryManagerBinding.h"
#include "mozilla/Preferences.h"
#include "nsContentUtils.h"
#include "nsIDOMClassInfo.h"
#include "nsIDocument.h"
/**
* We have to use macros here because our leak analysis tool things we are
* leaking strings when we have |static const nsString|. Sad :(
*/
#define LEVELCHANGE_EVENT_NAME NS_LITERAL_STRING("levelchange")
#define CHARGINGCHANGE_EVENT_NAME NS_LITERAL_STRING("chargingchange")
#define DISCHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("dischargingtimechange")
#define CHARGINGTIMECHANGE_EVENT_NAME NS_LITERAL_STRING("chargingtimechange")
namespace mozilla {
namespace dom {
namespace battery {
BatteryManager::BatteryManager(nsPIDOMWindowInner* aWindow)
: DOMEventTargetHelper(aWindow)
, mLevel(kDefaultLevel)
, mCharging(kDefaultCharging)
, mRemainingTime(kDefaultRemainingTime)
{
}
void
BatteryManager::Init()
{
hal::RegisterBatteryObserver(this);
hal::BatteryInformation batteryInfo;
hal::GetCurrentBatteryInformation(&batteryInfo);
UpdateFromBatteryInfo(batteryInfo);
}
void
BatteryManager::Shutdown()
{
hal::UnregisterBatteryObserver(this);
}
JSObject*
BatteryManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return BatteryManagerBinding::Wrap(aCx, this, aGivenProto);
}
bool
BatteryManager::Charging() const
{
MOZ_ASSERT(NS_IsMainThread());
// For testing, unable to report the battery status information
if (Preferences::GetBool("dom.battery.test.default", false)) {
return true;
}
if (Preferences::GetBool("dom.battery.test.charging", false)) {
return true;
}
if (Preferences::GetBool("dom.battery.test.discharging", false)) {
return false;
}
return mCharging;
}
double
BatteryManager::DischargingTime() const
{
MOZ_ASSERT(NS_IsMainThread());
// For testing, unable to report the battery status information
if (Preferences::GetBool("dom.battery.test.default", false)) {
return std::numeric_limits<double>::infinity();
}
if (Preferences::GetBool("dom.battery.test.discharging", false)) {
return 42.0;
}
if (Charging() || mRemainingTime == kUnknownRemainingTime) {
return std::numeric_limits<double>::infinity();
}
return mRemainingTime;
}
double
BatteryManager::ChargingTime() const
{
MOZ_ASSERT(NS_IsMainThread());
// For testing, unable to report the battery status information
if (Preferences::GetBool("dom.battery.test.default", false)) {
return 0.0;
}
if (Preferences::GetBool("dom.battery.test.charging", false)) {
return 42.0;
}
if (!Charging() || mRemainingTime == kUnknownRemainingTime) {
return std::numeric_limits<double>::infinity();
}
return mRemainingTime;
}
double
BatteryManager::Level() const
{
MOZ_ASSERT(NS_IsMainThread());
// For testing, unable to report the battery status information
if (Preferences::GetBool("dom.battery.test.default")) {
return 1.0;
}
return mLevel;
}
void
BatteryManager::UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInfo)
{
mLevel = aBatteryInfo.level();
// Round to the nearest ten percent for non-chrome and non-certified apps
nsIDocument* doc = GetOwner() ? GetOwner()->GetDoc() : nullptr;
uint16_t status = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
if (doc) {
status = doc->NodePrincipal()->GetAppStatus();
}
mCharging = aBatteryInfo.charging();
mRemainingTime = aBatteryInfo.remainingTime();
if (!nsContentUtils::IsChromeDoc(doc) &&
status != nsIPrincipal::APP_STATUS_CERTIFIED)
{
mLevel = lround(mLevel * 10.0) / 10.0;
if (mLevel == 1.0) {
mRemainingTime = mCharging ? kDefaultRemainingTime : kUnknownRemainingTime;
} else if (mRemainingTime != kUnknownRemainingTime) {
// Round the remaining time to a multiple of 15 minutes and never zero
const double MINUTES_15 = 15.0 * 60.0;
mRemainingTime = fmax(lround(mRemainingTime / MINUTES_15) * MINUTES_15,
MINUTES_15);
}
}
// Add some guards to make sure the values are coherent.
if (mLevel == 1.0 && mCharging == true &&
mRemainingTime != kDefaultRemainingTime) {
mRemainingTime = kDefaultRemainingTime;
NS_ERROR("Battery API: When charging and level at 1.0, remaining time "
"should be 0. Please fix your backend!");
}
}
void
BatteryManager::Notify(const hal::BatteryInformation& aBatteryInfo)
{
double previousLevel = mLevel;
bool previousCharging = mCharging;
double previousRemainingTime = mRemainingTime;
UpdateFromBatteryInfo(aBatteryInfo);
if (previousCharging != mCharging) {
DispatchTrustedEvent(CHARGINGCHANGE_EVENT_NAME);
}
if (previousLevel != mLevel) {
DispatchTrustedEvent(LEVELCHANGE_EVENT_NAME);
}
/*
* There are a few situations that could happen here:
* 1. Charging state changed:
* a. Previous remaining time wasn't unkwonw, we have to fire an event for
* the change.
* b. New remaining time isn't unkwonw, we have to fire an event for it.
* 2. Charging state didn't change but remainingTime did, we have to fire
* the event that correspond to the current charging state.
*/
if (mCharging != previousCharging) {
if (previousRemainingTime != kUnknownRemainingTime) {
DispatchTrustedEvent(previousCharging ? CHARGINGTIMECHANGE_EVENT_NAME
: DISCHARGINGTIMECHANGE_EVENT_NAME);
}
if (mRemainingTime != kUnknownRemainingTime) {
DispatchTrustedEvent(mCharging ? CHARGINGTIMECHANGE_EVENT_NAME
: DISCHARGINGTIMECHANGE_EVENT_NAME);
}
} else if (previousRemainingTime != mRemainingTime) {
DispatchTrustedEvent(mCharging ? CHARGINGTIMECHANGE_EVENT_NAME
: DISCHARGINGTIMECHANGE_EVENT_NAME);
}
}
} // namespace battery
} // namespace dom
} // namespace mozilla
-84
View File
@@ -1,84 +0,0 @@
/* -*- 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_battery_BatteryManager_h
#define mozilla_dom_battery_BatteryManager_h
#include "Types.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/Observer.h"
#include "nsCycleCollectionParticipant.h"
namespace mozilla {
namespace hal {
class BatteryInformation;
} // namespace hal
namespace dom {
namespace battery {
class BatteryManager : public DOMEventTargetHelper
, public BatteryObserver
{
public:
explicit BatteryManager(nsPIDOMWindowInner* aWindow);
void Init();
void Shutdown();
// For IObserver.
void Notify(const hal::BatteryInformation& aBatteryInfo) override;
/**
* WebIDL Interface
*/
nsPIDOMWindowInner* GetParentObject() const
{
return GetOwner();
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
bool Charging() const;
double ChargingTime() const;
double DischargingTime() const;
double Level() const;
IMPL_EVENT_HANDLER(chargingchange)
IMPL_EVENT_HANDLER(chargingtimechange)
IMPL_EVENT_HANDLER(dischargingtimechange)
IMPL_EVENT_HANDLER(levelchange)
private:
/**
* Update the battery information stored in the battery manager object using
* a battery information object.
*/
void UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInfo);
/**
* Represents the battery level, ranging from 0.0 (dead or removed?)
* to 1.0 (fully charged)
*/
double mLevel;
bool mCharging;
/**
* Represents the discharging time or the charging time, depending on the
* current battery status (charging or not).
*/
double mRemainingTime;
};
} // namespace battery
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_battery_BatteryManager_h
-27
View File
@@ -1,27 +0,0 @@
/* -*- 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_battery_Constants_h__
#define mozilla_dom_battery_Constants_h__
/**
* A set of constants that might need to be used by battery backends.
* It's not part of BatteryManager.h to prevent those backends to include it.
*/
namespace mozilla {
namespace dom {
namespace battery {
static const double kDefaultLevel = 1.0;
static const bool kDefaultCharging = true;
static const double kDefaultRemainingTime = 0;
static const double kUnknownRemainingTime = -1;
} // namespace battery
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_battery_Constants_h__
-23
View File
@@ -1,23 +0,0 @@
/* -*- 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_battery_Types_h
#define mozilla_dom_battery_Types_h
namespace mozilla {
namespace hal {
class BatteryInformation;
} // namespace hal
template <class T>
class Observer;
typedef Observer<hal::BatteryInformation> BatteryObserver;
} // namespace mozilla
#endif // mozilla_dom_battery_Types_h
-3
View File
@@ -1,3 +0,0 @@
[test_battery_basics.html]
[test_battery_charging.html]
[test_battery_discharging.html]
-1
View File
@@ -1 +0,0 @@
[test_battery_unprivileged.html]
-39
View File
@@ -1,39 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Battery API</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
/** Test for Battery API **/
ok("getBattery" in navigator, "navigator.getBattery should exist");
ok(!("battery" in navigator), "navigator.battery should not exist");
navigator.getBattery().then(function (battery) {
ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
SpecialPowers.pushPrefEnv({"set": [["dom.battery.test.default", true]]}, function () {
ok(battery.charging, "Battery should be charging by default");
is(battery.chargingTime, 0, "Battery chargingTime " + battery.chargingTime + " should be zero by default");
is(battery.dischargingTime, Infinity, "Battery dischargingTime should be Infinity by default");
is(battery.level, 1.0, "Battery level " + battery.level + " should be 1.0 by default");
SimpleTest.finish();
});
});
</script>
</pre>
</body>
</html>
@@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Battery API</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
/** Test for Battery API **/
navigator.getBattery().then(function (battery) {
ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
SpecialPowers.pushPrefEnv({"set": [["dom.battery.test.charging", true]]}, function () {
is(battery.charging, true, "Battery should be charging");
ok(battery.chargingTime >= 0, "Battery chargingTime " + battery.chargingTime + " should be nonnegative when charging");
is(battery.dischargingTime, Infinity, "Battery dischargingTime should be Infinity when charging");
SimpleTest.finish();
});
});
</script>
</pre>
</body>
</html>
@@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Battery API</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
/** Test for Battery API **/
navigator.getBattery().then(function (battery) {
ok(battery.level >= 0.0 && battery.level <= 1.0, "Battery level " + battery.level + " should be in the range [0.0, 1.0]");
SpecialPowers.pushPrefEnv({"set": [["dom.battery.test.discharging", true]]}, function () {
is(battery.charging, false, "Battery should be discharging");
is(battery.chargingTime, Infinity, "Battery chargingTime should be Infinity when discharging");
ok(battery.dischargingTime > 0, "Battery dischargingTime " + battery.dischargingTime + " should be positive when discharging");
SimpleTest.finish();
});
});
</script>
</pre>
</body>
</html>
@@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Battery API</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test for Battery API **/
ok(!("getBattery" in navigator), "navigator.getBattery should not exist for unprivileged web content");
ok(!("battery" in navigator), "navigator.battery should not exist");
</script>
</pre>
</body>
</html>
+6 -1
View File
@@ -2487,6 +2487,12 @@ ConstructJSImplementation(const char* aContractId,
{
AutoNoJSAPI nojsapi;
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
if (!window->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
// Get the XPCOM component containing the JS implementation.
nsresult rv;
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
@@ -2501,7 +2507,6 @@ ConstructJSImplementation(const char* aContractId,
// and our global is a window.
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
do_QueryInterface(implISupports);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
if (gpi) {
JS::Rooted<JS::Value> initReturn(RootingCx());
rv = gpi->Init(window, &initReturn);
+6 -6
View File
@@ -3071,21 +3071,21 @@ class GetCCParticipant
{
// Helper for GetCCParticipant for classes that participate in CC.
template<class U>
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
GetHelper(int, typename U::NS_CYCLE_COLLECTION_INNERCLASS* dummy=nullptr)
{
return T::NS_CYCLE_COLLECTION_INNERCLASS::GetParticipant();
}
// Helper for GetCCParticipant for classes that don't participate in CC.
template<class U>
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
GetHelper(double)
{
return nullptr;
}
public:
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
Get()
{
// Passing int() here will try to call the GetHelper that takes an int as
@@ -3100,7 +3100,7 @@ template<class T>
class GetCCParticipant<T, true>
{
public:
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
Get()
{
return nullptr;
@@ -3123,7 +3123,7 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj);
template <class T>
struct CreateGlobalOptions
{
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::NonWindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj)
{
@@ -3140,7 +3140,7 @@ struct CreateGlobalOptions
template <>
struct CreateGlobalOptions<nsGlobalWindow>
{
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::WindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj);
static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
+15
View File
@@ -717,6 +717,21 @@ DOMInterfaces = {
},
},
'ResizeObservation': {
'nativeType': 'mozilla::dom::ResizeObservation',
'headerFile': 'mozilla/dom/ResizeObserver.h',
},
'ResizeObserver': {
'nativeType': 'mozilla::dom::ResizeObserver',
'headerFile': 'mozilla/dom/ResizeObserver.h',
},
'ResizeObserverEntry': {
'nativeType': 'mozilla::dom::ResizeObserverEntry',
'headerFile': 'mozilla/dom/ResizeObserver.h',
},
'Response': {
'binaryNames': { 'headers': 'headers_' },
},
+1 -1
View File
@@ -210,7 +210,7 @@ struct NativePropertiesN {
const int32_t iteratorAliasMethodIndex;
constexpr const NativePropertiesN<7>* Upcast() const {
const NativePropertiesN<7>* Upcast() const {
return reinterpret_cast<const NativePropertiesN<7>*>(this);
}
Loaded 100 of 1498 files, more files were not shown because too many files have changed in this diff. Show more