Compare commits

..
432 Commits
Author SHA1 Message Date
wolfbeast 8efaf64266 Issue #1462 - Part 7: Add OID changes anyway. 2020-04-03 14:50:26 +02:00
wolfbeast f23b96fa7d Issue #1462 - Part 3b: Actually commit -all- the code, and fix space 2020-04-02 16:38:13 +02:00
wolfbeast d3594baa4b Issue #1462 - Part 6: Don't mess with OIDs, that's a different spec. 2020-04-02 16:36:34 +02:00
wolfbeast 3388887038 Issue #1462 - Part 5: Security manager changes for Camellia-GCM suites. 2020-04-02 12:53:15 +02:00
wolfbeast a0aae25860 Issue #1462 - Part 4: Add Camellia-GCM suites to NSS
This excludes non-ephemeral suites and DSS suites listed in the RFC
because they would not see use, and is primarily based on what GnuTLS
and mbedTLS support in practice, reducing the 20 listed suites to 8.
2020-04-02 12:51:58 +02:00
wolfbeast 51e6c2cf48 Issue #1462 - Part 3: Add Camellia-GCM capabilities to NSS 2020-04-02 12:47:17 +02:00
wolfbeast 83d4264496 Merge branch 'master' into RFC6367 2020-04-02 10:19:53 +02:00
Moonchild 90a9bc2216 Merge pull request #1504 from JustOff/PR_fix_WebRequest_jsm
Issue #65 - Fix unprocessed directives in WebRequest.jsm
2020-04-02 07:32:33 +02:00
JustOff 065ec07d6b Issue #65 - Fix unprocessed directives in WebRequest.jsm 2020-04-01 21:38:20 +03:00
Matt A. Tobin 66741ca7f5 Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp
.. correctly
2020-03-31 17:37:02 -04:00
Matt A. Tobin 48a2e680c5 Revert "Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp"
This reverts commit d4afddfada.
2020-03-31 17:31:31 -04:00
Matt A. Tobin d4afddfada Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp 2020-03-31 17:28:12 -04:00
Matt A. Tobin c6eccd0e61 Output webidl filenames as they are processed 2020-03-31 12:01:49 -04:00
Matt A. Tobin f35d93396d Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-03-31 09:44:24 -04:00
Matt A. Tobin 85ab34e500 Explicitly remove dist/bin before mozbuild's install_manifests get a hold of it 2020-03-31 09:44:18 -04:00
Moonchild d42beba473 Merge pull request #1502 from athenian200/nss348_solaris
Un-bust building of NSS after update to 3.48 on Solaris.
2020-03-31 11:40:05 +02:00
wolfbeast a205ee7040 Issue #1280 - Un-bust certerror pages and ForgetAboutSite 2020-03-31 09:44:30 +02:00
athenian200 389f436c15 Issue #1501 - Un-bust building of NSS after update to 3.48 on Solaris. 2020-03-30 22:54:29 -05:00
wolfbeast 3bc5d67c98 Issue #1280 - Stop requesting HPKP state from within devtools. 2020-03-30 08:18:09 +02:00
Matt A. Tobin 61d3be4745 Properly fix crash in nsDownloadManager when repeatedly pausing and resuming a download
This applies only to applications that do not use JSDownloads and is based on Bug 1224326
2020-03-29 05:07:36 -04:00
Matt A. Tobin 0750e2d3c9 Revert "Only state the stop notification for JSDownloads in nsWebBrowserPersist::EndDownload"
This reverts commit aa28523a55.
2020-03-29 05:07:26 -04:00
Moonchild f2b6fd2481 Merge pull request #1500 from MoonchildProductions/1280
Remove HPKP
2020-03-29 10:26:15 +02:00
Moonchild 568ea8deaa Merge pull request #1494 from JustOff/PR_osslice_non_windows
Fix building `%OS_SLICE%` on non-Windows platforms
2020-03-28 16:54:43 +01:00
Moonchild 1039487b75 Merge pull request #1472 from JMadgwick/master
Fix building on sparc64 Linux
2020-03-28 16:50:07 +01:00
Matt A. Tobin 6676a7d6f1 Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-03-28 10:48:10 -04:00
Matt A. Tobin 9a31bea935 Teach config.guess to know if we want to build 32 or 64 bit builds on Windows 2020-03-28 10:48:04 -04:00
wolfbeast 070eca4c23 Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-03-28 14:45:11 +01:00
wolfbeast e51d9fbc10 Issue #1497 Revert "Check if there are any unpreprocessed files"
This reverts PR #429
2020-03-28 14:44:34 +01:00
wolfbeast 2dfd75f7f8 Issue #1497 Revert "MoonchildProductions#1251 - Part 19"
"Make the unpreprocessed file script work on Solaris."

This reverts commit e51afbcc2f.
2020-03-28 14:40:49 +01:00
New Tobin Paradigm d19bcaf4b5 Update README.md 2020-03-28 06:57:45 -04:00
wolfbeast 0afd46b48d Issue #1280 - Part 2: Remove HPKP tests. 2020-03-28 11:02:10 +01:00
wolfbeast 55aa6ce7b3 Issue #1280 - Part 1: Remove HPKP components.
This also removes leftover plumbing for storing preload information
in SiteSecurityService since no service still uses it.
2020-03-28 01:06:56 +01:00
wolfbeast e9723a6fdb Issue #1498 - Part 6: Remove STS preloadlist pref. 2020-03-27 23:27:07 +01:00
wolfbeast 50ebd35073 Issue #1498 - Part 5: Update SSService CID and correct mismatch. 2020-03-27 16:16:43 +01:00
wolfbeast 8ea2c0d5ed Issue #1498 - Part 4: Remove clearPreloads.
Also tag #1280
2020-03-27 15:13:00 +01:00
wolfbeast 9c4aef8675 Issue #1498 - Part 3: Remove support for storing "knockout" values. 2020-03-27 15:07:34 +01:00
wolfbeast e54e59827f Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-03-27 14:06:05 +01:00
wolfbeast 09a229c702 Issue #1498 - Part 1: Stop persisting preload states.
Since we don't use preloading anymore for either HPKP or HSTS, we no
longer need persistent storage in the profile for preload states.
Tag #1280 also
2020-03-27 14:02:23 +01:00
wolfbeast 595c8d53df Issue #1498 - Part 1: Stop using HSTS preload lists. 2020-03-27 12:49:01 +01:00
Matt A. Tobin 5e03c9ad4c Issue #1499 - Re-import ExtensionStorage.jsm 2020-03-26 15:38:21 -04:00
Matt A. Tobin bc127ada3b Take nsSiteSecurityService out of UNIFIED_SOURCES
It exceeded the obj file sections limit because of the HSTS preload list so it cannot be built in UNIFIED mode.
2020-03-25 01:02:52 -04:00
JustOff e74509ec54 Issue #1473 - Fix building %OS_SLICE% on non-Windows platforms 2020-03-24 22:56:31 +02:00
wolfbeast cc9b40cc21 Issue #447 - Update HSTS preload list 2020-03-24 20:35:47 +00:00
New Tobin Paradigm 9308c03f5e Merge pull request #1492 from dbsoft/PopupWindowFixes
Disable workaround for popup windows on newer versions of Mac OS
2020-03-21 22:05:10 -04:00
Brian Smith 10a45dfda6 Issue #1491 - Part 2: Disable a workaround on macOS 10.14+ for an Apple bug described in Mozilla bug 378645 involving popup windows that was fixed by Apple. 2020-03-21 17:39:53 -05:00
Brian Smith c1633db6d2 Issue #1491 - Part 1: Update nsCocoaFeatures for newer versions of MacOS X. 2020-03-21 17:37:05 -05:00
Moonchild 0212d61811 Merge pull request #1487 from MoonchildProductions/1467
Make UXP applications capable of using SQLite for NSS instead of DBM
2020-03-20 09:43:07 +01:00
wolfbeast 6f1d8fcce1 Issue #1467 - Part 4: Rename NSS_SQLSTORE to MOZ_SECURITY_SQLSTORE.
Rename the build config option accordingly.
2020-03-19 23:01:29 +01:00
wolfbeast 90a4813d17 [devtools] Properly escape method arguments for curl. 2020-03-19 07:33:05 +01:00
wolfbeast 9550c68d7a [DOM] Make sure to exit fullscreen mode if popups are opened or focused. 2020-03-18 21:15:10 +01:00
wolfbeast 54f44bb628 [js] Remove pointless MakeMRegExpHoistable optimization.
It's a lot of code with no measurable effect.
2020-03-18 13:31:19 +01:00
wolfbeast 22fc220354 [network] Cherry-pick various sctp lib upstream fixes. 2020-03-18 11:11:13 +01:00
wolfbeast 6cbe27d149 Issue #1467 - Part 3: Use UTF-8 file paths for NSS-SQL database. 2020-03-17 20:14:22 +01:00
wolfbeast 09abc10635 Issue #1467 - Part 2: Make the PBKDF rounds adaptive to choice of NSS db 2020-03-17 13:33:03 +01:00
wolfbeast 6b3fbe9ef0 Issue #1467 - Part 1b: Fix type and make moz.configure happy. 2020-03-17 12:40:10 +01:00
wolfbeast 2a4827ea40 Issue #1467 - Part 1: Set up conditional NSS-SQL builds.
- Adds buildconfig option --enable-nss-sqlstore
- Prefixes NSS dbinit with either sql: or dbm: depending on config
- Pre-initializes mozStorage when NSS-SQL storage is used to prevent
  an sqlite3_config race in NSS Init
2020-03-16 13:38:19 +01:00
wolfbeast 6d504711a0 Issue #1355 - Make addition of cell border display items depend on
whether they should be drawn.

This reduces the size of display lists for tables by only adding display
list items that are actually going to be visibly drawn, which will help
overall performance of table drawing.
2020-03-16 09:30:31 +01:00
Moonchild 60ea1e85f5 Merge pull request #1484 from JustOff/PR_ssuao_priority
Give dynamic SSUAO rules priority over static ones
2020-03-15 17:34:46 +01:00
JustOff a20f208834 Issue #1482 - Give dynamic SSUAO rules priority over static ones 2020-03-15 13:41:46 +02:00
Moonchild a1f53ada59 Merge pull request #1486 from MoonchildProductions/1485
Fix incorrect grid cell sizing to min/max space.
2020-03-15 00:10:54 +01:00
Matt A. Tobin 157a4abbcc Issue #1477 - Fix finding config.guess on builds not using MOZ_OBJDIR
* So far this seems to only affect Macintosh builds but other unix builds may be affected. Windows doesn't seem to be.
* This maintains consistency with other one-off file invocations and backwards compatibility with older comm setups
2020-03-13 13:00:12 -04:00
wolfbeast b3a4b8361e Issue #1485 - Fix incorrect grid cell sizing to min/max space.
There were actually two separate logical errors in this method:

The first part is that "origSizes.isSome()" is simply a bogus
requirement for applying min/max-sizes here. I'm still keeping
the optimization of not needlessly copying the mSizes array
(as originally intended) since it's a quite common case.

The second bug is that min/max-sizes were only applied under
the "if (fr != 0.0f)" block. This is bogus since the calculated
'fr' value depends on 'aAvailableSize' which might change by
applying min/max-sizes and thus 'fr' could become non-zero in
the second round.
To fix, this patch just moves "applyMinMax" block out one level.
2020-03-13 11:28:54 +01:00
Moonchild 41e5925b42 Merge pull request #1481 from MoonchildProductions/1480
Skip abspos, fixed, float and placeholders for outline.
2020-03-11 23:24:42 +01:00
wolfbeast 8dc520647d Issue #1480 - Skip abspos, fixed, float and placeholders for outline. 2020-03-11 13:01:48 +01:00
Moonchild e8275b9a1e Merge pull request #1479 from JustOff/PR_uau_cleanup
Remove no longer used function and modules from UserAgentUpdates.jsm
2020-03-11 11:49:30 +01:00
JustOff ad7526fe70 Issue #1053 - Remove no longer used function and modules from UserAgentUpdates.jsm 2020-03-11 01:07:33 +02:00
New Tobin Paradigm ccee9ea5b7 Merge pull request #1476 from JustOff/PR_ssuao_os_slice
Add `%OS_SLICE%` macro to SSUAO to refine OS info
2020-03-10 16:58:06 -04:00
wolfbeast fda8403f56 Minor update to UXP coding style guideline. 2020-03-10 12:47:03 +01:00
JustOff 3c8bc3da7c Issue #1473 - Add %OS_SLICE% macro to SSUAO to refine OS info 2020-03-10 13:10:26 +02:00
New Tobin Paradigm be415c44c7 Update README.md 2020-03-09 17:38:25 -04:00
JMadgwick f7c9359b2a Issue #1471 - Fix building on sparc64 Linux
Correct various pre-processor defines for sparc64 and in mozjemalloc use the JS arm64 allocator on Linux/sparc64.
This corrects build problems opn Linux sparc64 and is in line with bugzilla bug #1275204.
2020-03-09 20:55:13 +00:00
wolfbeast a1e6132772 Issue #1474 - Prevent the cp detection from starting if preffed off.
When setting up connectivity, e.g. with new network detection, the pref
wouldn't be checked (or honored), resulting in spurious startup calls
despite being preffed off. This fixes that.

Resolves #1474
2020-03-07 21:58:27 +01:00
wolfbeast 9815e4bdf0 Update UXP coding style guide JS guide. 2020-03-07 12:30:31 +01:00
wolfbeast d0b2595322 Update UXP coding style guide JS guide. 2020-03-06 23:23:57 +01:00
Matt A. Tobin b14d245a8a Merge branch 'updateutils-work' 2020-03-06 15:05:51 -05:00
wolfbeast 66ab2fa3da Update UXP coding style guide with JS guide. 2020-03-06 11:47:52 +01:00
Matt A. Tobin 4d80ed3d51 Issue #1470 - Part 3: Remove now unused update.locale
This requires changes to package-manifest in all applications
2020-03-05 19:30:38 -05:00
Matt A. Tobin 8baaecd89c Issue #1470 - Part 2: Change calls from UpdateUtils.getUpdateChannel() to UpdateUtils.UpdateChannel in telemetry modules 2020-03-05 19:24:11 -05:00
Matt A. Tobin aaedcc45fb Issue #1470 - Part 1: Refactor UpdateUtils.jsm 2020-03-05 19:22:49 -05:00
New Tobin Paradigm 88da01c294 Remove exposed bug from UpdateUtils.jsm 2020-03-04 13:03:27 -05:00
Matt A. Tobin 65b37410ca Revert "Issue #190 - Part 1: Remove XP_IOS conditional code"
This reverts commit 6a3d5769d0.
2020-02-28 18:00:45 -05:00
Matt A. Tobin 6a3d5769d0 Issue #190 - Part 1: Remove XP_IOS conditional code 2020-02-28 17:58:46 -05:00
Matt A. Tobin 1d86d37828 Issue #1053 - Remove android-only skia-npapi 2020-02-28 17:19:05 -05:00
Matt A. Tobin 9b86872d37 Issue #1053 - Remove android support from nsNSSComponent.cpp 2020-02-28 16:51:00 -05:00
Matt A. Tobin f0abf6273c Issue #251 - Move --disable-dbm to ac configure
Also Tag #1467
2020-02-28 16:21:05 -05:00
Matt A. Tobin 76bacde2ae Remove unused mailnews.mozbuild 2020-02-28 15:11:25 -05:00
Matt A. Tobin 9fceb389c1 Mork is not dependent on dbm and never was. 2020-02-28 15:01:37 -05:00
Matt A. Tobin c30898ce33 Correct typo in mailnews/base/src/moz.build 2020-02-28 15:01:13 -05:00
Matt A. Tobin b118bab81f Issue #1319 - Remove EARLY_BETA_OR_EARLIER condition 2020-02-28 12:05:19 -05:00
wolfbeast ae8eb4d4c4 Issue #1465 - Implement optional catch binding. 2020-02-27 20:09:26 +01:00
wolfbeast 793da7dd62 Revert "Issue #1355 - Better way to create display items for column backgrounds"
This reverts commit 44c47c5038.
2020-02-26 20:51:22 +01:00
wolfbeast 16abf27e65 Revert "Layout\reftests\table-background\reftest.list should have only additions to the end of it."
This reverts commit efdc2af8ab.
2020-02-26 20:51:05 +01:00
wolfbeast cdc2a22c79 [DOM] Add a null check 2020-02-26 16:22:10 +01:00
Matt A. Tobin de35c43f12 Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-02-26 09:25:07 -05:00
Matt A. Tobin 11d14ae59f No Issue - Always build marionette until it can be tracked down and killed 2020-02-26 09:24:49 -05:00
Moonchild d585e25e27 Merge pull request #1463 from win7-7/column-backgrounds-pr
Better way to create display items for column backgrounds
2020-02-26 13:53:30 +01:00
Matt A. Tobin 4ff7606b6a Issue #1053 - Remove android preprocessor directive from toolkit/locales/jar.mn 2020-02-25 22:22:41 -05:00
Moonchild cce2bc9677 Merge pull request #1461 from MoonchildProductions/ubbo
Back out unboxed array/object removals
2020-02-26 02:38:18 +01:00
Matt A. Tobin 35c26c6c19 Issue #1053 - Remove android support from toolkit
Note: Does not remove support completely from toolkit/mozapps/installer or from telemetry or AppConstants.jsm
2020-02-25 19:45:39 -05:00
Matt A. Tobin 8f35c37a9e Bug 1339444 - Remove unused resource://gre/modules/sqlite/sqlite_internal.js 2020-02-25 18:24:40 -05:00
win7-7 efdc2af8ab Layout\reftests\table-background\reftest.list should have only additions to the end of it.
Layout\reftests\table-background\reftest.list should have only additions to the end of it. Revert incorrect additions.
2020-02-26 00:36:09 +02:00
Matt A. Tobin 0ddd00f195 Issue #439 - Remove tests from toolkit/ 2020-02-25 15:07:00 -05:00
Matt A. Tobin 20f0905b33 Issue #1053 - Remove android support from db 2020-02-25 12:28:41 -05:00
Matt A. Tobin 8e09aff187 Issue #1053 - Remove android support from docshell 2020-02-25 12:26:18 -05:00
win7-7 44c47c5038 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-02-25 00:17:54 +02:00
wolfbeast 813dd63694 Issue #1462 Part 2: Implement security manager changes for RFC 6367 §2.1
This prefs and enables ECDHA-ECDSA and ECDHA-RSA variants of Camellia
CBC suites (128/256-bit)
2020-02-24 22:23:04 +01:00
wolfbeast 099a1ea88c Issue #1462 - Part 1: Implement HMAC-based Camellia suites in NSS.
This implements the ephemeral suites from RFC 6367 section 2.1 in NSS,
providing the back-end support for these suites.
2020-02-24 22:20:40 +01:00
wolfbeast ecdeefc4dd Revert #1091 Remove unboxed object code phase 1 + extras.
This should be the last code backout for this. merging this branch
should get us back to the way we were (+ additional code changes for
later changes) as fasr as the unused unboxed code is concerned.
2020-02-23 19:43:47 +01:00
Matt A. Tobin 81089ff094 Issue #1053 - Remove android support from hal 2020-02-23 11:29:12 -05:00
Matt A. Tobin 30e4959bd3 Issue #1053 - Remove android support from image 2020-02-23 11:28:41 -05:00
Matt A. Tobin 33ec695ac0 Issue #1053 - Remove android support from intl/locale/nsLocaleService.cpp
This is the only non-icu file with android code in it. Not going to remove android in icu its self because it remains a 3rd party lib.
2020-02-23 11:18:42 -05:00
Matt A. Tobin e9ee12c988 Follow-up to 4e2e9be6a - Move HeapSnapshot DevTools-only Modules back to DevTools
I am so done with this.

Resolves #316
2020-02-23 10:38:36 -05:00
wolfbeast dd57b9273c Revert #1137 - Remove unboxed arrays
- accounting for removal of watch()/unwatch()
- updated for intermediate code changes.
2020-02-23 14:41:40 +01:00
wolfbeast be16123ddc Revert "Issue #1382 - Remove invalid assertion."
This reverts commit 9c6a8450b3.
2020-02-23 11:33:50 +01:00
Matt A. Tobin e9360fae13 Issue #1053 - Remove android support from memory 2020-02-23 00:26:22 -05:00
Matt A. Tobin 2896724eaf Issue #1053 - Remove android support from mfbt 2020-02-22 23:30:31 -05:00
Matt A. Tobin dada39db23 Issue #1053 - Remove android support from ipc except for ipc/chromium
This does not include android in the imported chromium code as specific research needs done on defines and logic.
2020-02-22 22:44:01 -05:00
Matt A. Tobin 5496e4f391 Issue #1053 - Remove android support from mozglue
Yes, I checked for unsaved files this time...
2020-02-22 21:16:37 -05:00
Matt A. Tobin 13a8e78881 Issue #1053 - Remove android support from netwerk/protocol/http/nsHttpHandler.cpp 2020-02-22 20:48:32 -05:00
Matt A. Tobin bdad2357a1 Issue #1053 - Remove android support from netwerk 2020-02-22 20:10:23 -05:00
Matt A. Tobin 881c1e5f18 Issue #1053 - Remove android support from storage/mozStorageConnection.cpp 2020-02-22 19:31:52 -05:00
Matt A. Tobin ce21c398d7 Issue #1053 - Remove android support from uriloader 2020-02-22 19:22:01 -05:00
Matt A. Tobin c895d35a7a Issue #1053 - Remove android support from xpcom/threads/nsThread.cpp
Forgot to save..
2020-02-22 19:04:51 -05:00
Matt A. Tobin 69ed4e4b4e Issue #1053 - Remove android support from XPCOM 2020-02-22 19:03:00 -05:00
Matt A. Tobin 7c8262e8c3 Remove redundant moz.build from db/ 2020-02-22 17:47:21 -05:00
Matt A. Tobin 4e2e9be6ab Reclassify heapsnapshot and nsJSInspector as not part of devtools
This resolves Issue #316
2020-02-22 17:32:39 -05:00
wolfbeast 5ee844f710 Revert #1142 - Remove unboxed objects
- accounting for removal of watch()/unwatch()
2020-02-22 21:09:32 +01:00
wolfbeast b1cd96989b Revert 1320408 part 15: Make addDataProperty static 2020-02-22 21:07:48 +01:00
wolfbeast a7888b8cf2 Set module default identification properly. 2020-02-21 18:50:28 +01:00
wolfbeast 944cf0dda9 Remove gtest reference to non-existing path of removed component 2020-02-21 12:21:10 +00:00
wolfbeast 623c44226a [gfx] Put Skia-specific CTOR init behind Skia-conditional. 2020-02-21 12:12:47 +00:00
wolfbeast 1e88448ddf Merge branch '316' 2020-02-21 01:20:27 +01:00
wolfbeast 5e21bf1d54 Issue #316 - Make sure MOZ_DEVTOOLS_SERVER is passed down to js. 2020-02-21 01:19:16 +01:00
Matt A. Tobin 04fb9eaa6a Issue #1053 - Remove android support from NPAPI 2020-02-20 12:44:29 -05:00
Matt A. Tobin b36e606158 Issue #1053 - Remove conditional android code from widget/ 2020-02-20 12:12:30 -05:00
Matt A. Tobin 18e74277b3 Issue #1053 - Remove Android Widget Toolkit specific files 2020-02-20 11:22:40 -05:00
Matt A. Tobin 178382e4ce Issue #439 - Remove tests from widget/ 2020-02-20 11:08:15 -05:00
Moonchild 7832dded37 Merge pull request #1458 from MoonchildProductions/316
Fix buildability of builds without devtools-server
2020-02-20 16:50:49 +01:00
wolfbeast d53b11c9dc Issue #316 - Be more gentle with the CC and nursery. 2020-02-20 16:47:04 +01:00
Matt A. Tobin 0e9957c412 Issue #1457 - Unfold sqlite3 from nss 2020-02-20 10:02:49 -05:00
wolfbeast 28f67bddcf Issue #316 - Pre-process Performance.webidl 2020-02-20 13:29:03 +01:00
wolfbeast 59f7a2cdb4 Issue #316 - Make the memory GC performance object conditional (WIP)
This was only added for GCubench and likely interfering with building
without devtools-server.
2020-02-20 12:00:26 +01:00
wolfbeast e3d81b698e Issue #1383 - Remove "Copy raw data to clipboard" button
This resolves #1383
2020-02-20 11:01:30 +01:00
Moonchild 0a8530b916 Merge pull request #1455 from JustOff/issue1445_details_url
Add a link to details on using Firefox extensions in Pale Moon
2020-02-19 21:23:24 +01:00
Matt A. Tobin e6b48cb648 Issue #1454 - Add MOZ_PKG_SPECIAL to UpdateUtils 2020-02-19 15:05:50 -05:00
JustOff c220c30bbb Issue #1445 - Add a link to details on using Firefox extensions in Pale Moon 2020-02-19 19:30:21 +02:00
Moonchild 8dc04fc24b Merge pull request #1452 from JustOff/Issue1445_cleanup
Issue #1445 - strings cleanup
2020-02-19 14:34:44 +01:00
JustOff 461a9e86b2 Issue #1445 - strings cleanup 2020-02-19 14:37:14 +02:00
wolfbeast 2073a7f1c9 Issue #1445 - remove redundant nativeIndicator
This resolves #1445
2020-02-19 11:56:34 +01:00
Matt A. Tobin 66b9ddfd32 Issue #1320 - Stop appending cpu arch to the end of %BUILD_TARGET% on Windows in UpdateUtils.jsm 2020-02-17 12:19:22 -05:00
wolfbeast ac68f8cf6c Issue #1445 - Use the detailed string also in the list entries. 2020-02-17 16:19:57 +01:00
wolfbeast 4889e6dbbd Issue #1446 - Only match extension add-on types for target applications.
This resolves #1446
2020-02-17 16:19:05 +01:00
Moonchild a4ab3fc59d Merge pull request #1447 from win7-7/optimization-4-pr
Speed up nsTableColFrame::GetColIndex
2020-02-17 12:40:36 +01:00
wolfbeast e8417acbff Issue #1446 - Only allow extension add-on types for Firefox compat mode. 2020-02-17 12:33:34 +01:00
win7-7 d4098037a4 Issue #1355 - Make nsTableCellFrame::GetColIndex/GetRowIndex faster
We can devirtualize it, remove some branches.
2020-02-16 16:06:53 +02:00
wolfbeast f107de8a90 Issue #1445 - Clarify the status of extensions in the Add-On manager
This resolves #1445.
2020-02-16 13:10:55 +01:00
wolfbeast d3067ffdda [CSS] Only emit non-GC chrome wrapped XUL box warnings in debug builds. 2020-02-14 19:09:13 +01:00
wolfbeast 4ce361d9ba Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var.
This adds an addition to the environment set up for child processes
(plugin container) so that it may still be able to pass the omni
parameters there as-needed.
2020-02-14 17:06:30 +01:00
wolfbeast 786417cf0f Revert "Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var."
This reverts commit 2bdbca39b2.
2020-02-14 16:31:54 +01:00
Simon Giesecke 16fce4341d [IndexedDB] Ensure that strong references to newly created cursors are
kept until the DOM Binding is created.

This fixes random crashes on websites that use IndexedDB cursors.
See also BZ bug 1599420
2020-02-14 14:39:40 +01:00
Henri Sivonen 3bf1b83591 [Parser] Move setting context to null to the correct location. 2020-02-14 13:24:59 +01:00
wolfbeast 2bdbca39b2 Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var. 2020-02-14 12:35:58 +01:00
sotaro 8ec7618633 [Layers] Clear WrappingTextureSourceYCbCrBasic::mTexture correctly 2020-02-14 10:46:53 +01:00
wolfbeast 0a5784d3ce [Network] Bump http channel default Firefox CompatMode init value. 2020-02-14 10:32:41 +01:00
wolfbeast 7dc9aa0585 Fix a whitespace issue in nsComputedDOMStyle.cpp 2020-02-12 00:01:55 +01:00
wolfbeast a399acd57c [CSS] Add stub for font-variation-settings
This stub is added because websites insist on considering this
very hardware-dependent and O.S.-variable low-level font-control
as a "critical feature" which it isn't as there is 0 guarantee
that font variation settings are supported or honored by any
operating system used by the client.

On top this is a WD status feature that sites shouldn't be using, and
the feature itself is strongly discouraged for use in favor of standard
CSS font manipulation keywords like `font-weight`.
2020-02-11 23:59:53 +01:00
wolfbeast 6184ed7555 [CSP] Allow not having a Port for RessourceURI if the Scheme has no
Default Port
2020-02-11 12:30:45 +01:00
Matt A. Tobin 31d8779a22 Issue #65 - Correct nsHelperAppDlg.js for bad preprocessing conversion 2020-02-09 19:54:01 -05:00
Matt A. Tobin 5007e7c498 Issue #80 - Stop building non-generated dom/binding files as UNIFIED_SOURCES
Also fix deprot
2020-02-08 23:23:20 -05:00
Matt A. Tobin 07fe89e26f Directly assign PrimitiveConversions.h to the generated binding of KeyframeAnimationOptions.
This is a hack to deal UnifiedBindings trying to deal with an incomplete codegen implementation so it was worked around with a hack back in Firefox 30-something. If we have anymore of this non-sense crop up as stuff is added or removed from DOM then extend this conditional.

Least until something better comes along.
2020-02-08 20:33:04 -05:00
Moonchild 4234b3a36b Merge pull request #1393 from win7-7/optimization-3-pr
Do less work for columns not in the desired set in PaintRowGroupBackgroundByColIdx
2020-02-08 15:17:21 +01:00
Moonchild 6c82d043a1 Merge pull request #1394 from MoonchildProductions/appconst-work
The rest of removing AppConstants for Platform
2020-02-07 10:57:04 +01:00
Matt A. Tobin fa52fa60b7 Issue #65 - Don't split in the middle of assignment statements in createProfileWizard.js 2020-02-07 04:55:10 -05:00
Matt A. Tobin b4ac6a7dcb Issue #65 - Correct fallthough case in profileSelection.js 2020-02-07 04:51:00 -05:00
Moonchild a6ef90b183 Merge pull request #1388 from win7-7/devirtualize-pr
Merging this in even without a test performed since the code change looks sane. real-world testing will have to be performed.
2020-02-07 09:52:57 +01:00
Matt A. Tobin 99aa809cb8 Issue #1395 - Part 2: Remove the /rest/ of FlyWeb 2020-02-06 19:49:46 -05:00
Matt A. Tobin 6da9e3c6b9 Issue #1395 - Remove FlyWeb Service 2020-02-06 19:47:29 -05:00
Matt A. Tobin 5483f807c2 Issue #1390 - Get rid of the Presentation API 2020-02-06 16:03:39 -05:00
Matt A. Tobin e80e4595b9 Issue #1390 - Remove secondscreen modules from toolkit 2020-02-06 14:49:41 -05:00
wolfbeast 551c418932 [AM] Remove shared theme leftovers for webextensions 2020-02-06 19:24:50 +01:00
Matt A. Tobin 832d84d2c0 Issue #1392 - Change --enable-eme to MOZ_ARG_ENABLE_BOOL and remove MOZ_EME_MODULES 2020-02-06 13:06:35 -05:00
Matt A. Tobin cf4ad4e969 Issue #65 - Remove AppConstants from toolkit/components/passwordmgr 2020-02-06 10:39:22 -05:00
win7-7 6376eceaeb Merge branch 'master' into optimization-3-pr 2020-02-06 17:17:28 +02:00
win7-7 074f23467b Issue #1355 - Do less work for columns not in the desired set in PaintRowGroupBackgroundByColIdx
Do less work in PaintRowGroupBackgroundByColIdx for cells that are not in our desired set of columns.

crash fix:

Guard against empty column groups when building a display list for a table.
2020-02-06 17:13:55 +02:00
Matt A. Tobin 741abd440e Issue #65 - Remove AppConstants from toolkit/components/alerts 2020-02-06 09:47:45 -05:00
Matt A. Tobin 0749a35be9 Issue #65 - Remove AppConstants from toolkit/components/places 2020-02-06 09:43:27 -05:00
Matt A. Tobin cd87677798 Issue #65 - Remove AppConstants from toolkit/components/apppicker 2020-02-06 09:38:29 -05:00
Matt A. Tobin 0ab5c6474c Issue #65 - Remove AppConstants from toolkit/components/thumbnails 2020-02-06 09:34:25 -05:00
Matt A. Tobin 7a0b23aab8 Issue #65 - Remove AppConstants from toolkit/components/printing 2020-02-06 09:31:03 -05:00
Matt A. Tobin c09eca89e4 Issue #65 - Remove AppConstants from toolkit/components/satchel 2020-02-06 09:11:39 -05:00
Moonchild 04c770c8c8 Update UXP Coding Style.md
Be more explicit about paranthesis spacing
2020-02-06 14:50:58 +01:00
Moonchild bf914e9975 Update UXP Coding Style.md
Minor typo
2020-02-06 14:47:30 +01:00
Matt A. Tobin 180543f6c3 Issue #65 - Remove AppConstants from toolkit/components/jsdownloads 2020-02-06 08:31:14 -05:00
Matt A. Tobin 2e6782afb5 Issue #65 - Remove AppConstants from toolkit/mozapps/downloads 2020-02-06 06:32:11 -05:00
Matt A. Tobin 758618b605 Issue #65 - Remove AppConstants from toolkit/mozapps/extensions 2020-02-06 06:07:37 -05:00
Moonchild 58cfb9acc2 Merge pull request #1389 from MoonchildProductions/EME_conditional
Make building of EME conditional
2020-02-06 11:53:51 +01:00
wolfbeast 4c9689f680 Issue #26 - Part 2c: Remove dependence on gmp/widevine-adapter/* 2020-02-05 22:32:52 +01:00
Matt A. Tobin 43f91872bd Issue #65 - Remove AppConstants from toolkit/mozapps/update 2020-02-05 14:31:58 -05:00
Matt A. Tobin 840ecb5262 Issue #65 - Remove AppConstants from toolkit/profile 2020-02-05 13:52:28 -05:00
win7-7 3a7d5d01cc fix whitespace
fix whitespace.
2020-02-05 16:57:42 +02:00
wolfbeast d44c61bf60 Issue #26 - Part 2b: Stub out GMPDecryptorProxy functions.
If EME isn't built, these functions would have no use and the callback
structures are unavailable. Stubbing these out will still allow the
callers to work unchanged, but in effect simply always return without
dispatching a promised task.
This fixes the dependency issue from part 2a.
2020-02-04 11:48:13 +01:00
wolfbeast 99118e38e1 Issue #26 Part 2a: make more EME code conditional.
- Exclude missed MediaKey functions and CDMProxy code.
- Exclude EME APIs frm being built (webidl change)
- Fix tests in --disable-eme state
2020-02-03 23:42:52 +01:00
wolfbeast a595451104 [Installer] Updated the 7-zip stub binary to make sure it doesn't hang
on older versions of Windows but instead provides a usable error message
2020-02-03 23:23:41 +01:00
win7-7 597a6996f1 Issue #1386 - Devirtualize GetRowSpan/GetColSpan
It's at ~1.5% on the perf log for the Netflix use case, which seems a bit too much.
2020-02-03 20:47:41 +02:00
Moonchild c4e1022f57 Merge pull request #1385 from win7-7/standard-pr
Match standard for colSpan/rowSpan
2020-02-03 18:18:40 +01:00
win7-7 52940bc44c Issue #1384 - Match standard for colSpan/rowSpan
HTML standardizes proper behavior of colSpan and rowSpan:

The main thing is that getting the .rowSpan and .colSpan IDL properties will now return the actual clamped value that we use.
2020-02-03 16:59:23 +02:00
wolfbeast 9c6a8450b3 Issue #1382 - Remove invalid assertion.
There is flexibility in exactly the value the initialized length must
hold, i.e. if an array is completely empty, it is valid for the
initialized length to be any value between zero and the length of the
array, as long as the in-memory values below the initialized length have
been initialized with a hole value.
In the case of 0, the array is packed and the move operation would be a
nop, so simply convert the assert to a condition to save some cycles.
2020-02-03 04:52:44 +01:00
Moonchild bbbfd00f95 Merge pull request #1381 from win7-7/optimization2-pr
Add dirty rect intersection checks so that we don't build unnecessary table part display items
2020-02-02 19:17:12 +01:00
win7-7 e6c346c36f Issue #1355 - Hit testing in large tables has become extremely slow
Add dirty rect intersection checks so that we don't build unnecessary table part display items.
2020-02-02 15:02:47 +02:00
wolfbeast d216db11e7 Revert "Issue #1355 - Hit testing in large tables has become extremely slow"
This reverts commit f7b2f0a665.
2020-02-02 13:37:13 +01:00
Moonchild 0db3f512ea Merge pull request #1380 from win7-7/optimization-2-pr
Add dirty rect intersection checks so that we don't build unnecessary table part display items
2020-02-02 13:21:22 +01:00
New Tobin Paradigm 54e3d74002 Fix preprocessor directive in UserAgentUpdates.jsm 2020-02-02 06:52:04 -05:00
win7-7 f7b2f0a665 Issue #1355 - Hit testing in large tables has become extremely slow
Add dirty rect intersection checks so that we don't build unnecessary table part display items.
2020-02-02 13:50:51 +02:00
wolfbeast dd68cb9b3d Issue #1378 - Follow-up: make sure background items remain table-aligned. 2020-02-02 11:31:07 +01:00
Matt A. Tobin 6a3907dae4 Issue #65 - Remove AppConstants from toolkit/modules
Except for secondscreen
2020-02-02 04:25:47 -05:00
Matt A. Tobin 7d21d02d53 Issue #65 - Remove AppConstants from toolkit/content 2020-02-01 23:45:36 -05:00
Matt A. Tobin a18c27ddde Issue #65 - Remove AppConstants from netwerk/ 2020-02-01 21:59:08 -05:00
Matt A. Tobin f9ddbe3640 Issue #65 - Remove AppConstants from mailnews/ 2020-02-01 21:54:04 -05:00
Matt A. Tobin 406fc463e0 Issue #65 - Remove AppConstants from dom/ 2020-02-01 21:45:08 -05:00
wolfbeast 28208f1d3e Issue #1378 - Align the drawing of table cell backgrounds with the spec. 2020-02-02 02:16:41 +01:00
Matt A. Tobin 6bb671bcdd Issue #1377 - Fix porting typo in mailnews/base/search/content/searchWidgets.xml
MailNews Core being historically comm tended to avoid defining shorthand for Components.interfaces
2020-02-01 20:06:57 -05:00
wolfbeast 33ad27614a Issue #447 - Update HSTS preload list & reduce debug spew
Commented out spewing dump() statements in loops. With the ever growing
HSTS list it takes too much time and is pointless to display.
2020-02-01 01:37:52 +00:00
wolfbeast 229f841295 Issue #1342 - Remove support for system libvpx 2020-01-31 16:54:07 +01:00
wolfbeast d41ba28f52 Issue #1342 - Remove support for system sqlite 2020-01-31 15:40:09 +01:00
wolfbeast 8f89965f50 Issue #1342 - Update old.configure for removed build options 2020-01-31 15:12:09 +01:00
wolfbeast e0103f3d5b Issue #1342 - Remove support for system linbpng 2020-01-31 15:10:26 +01:00
Moonchild 64c8c65cf4 Merge pull request #1376 from win7-7/optimization-1-pr
Speed up the traversal of a table row frame's child cells
2020-01-30 17:54:48 +00:00
wolfbeast 499b287394 Issue #1342 - Remove support for system NSPR/NSS 2020-01-30 18:15:38 +01:00
wolfbeast 00a5321c95 Issue #1342 - Remove support for system ICU 2020-01-29 15:13:55 +01:00
win7-7 fd26b84536 Issue #1355 - Speed up the traversal of a table row frame's child cells
Speed up getting the first cellframe in a row and the next cellframe after the given one
2020-01-29 11:14:34 +02:00
wolfbeast e57998f68b [WebRequest] Remove AddonManagerPermissions leftovers
This was added as part of the WebExtension sec issue CVE-2017-5389.
Since we no longer have this interface, it needed to be removed to
prevent errors in the WebRequest channel callback.
2020-01-29 09:08:00 +01:00
Moonchild ed88b99849 Merge pull request #1357 from athenian200/form-disabled-issue
Forms: Click() isn't executing properly when elements are defined disabled
2020-01-28 23:03:48 +00:00
athenian200 7a697172f3 Issue #1356 - Add tests.
Forgot to include these before.
2020-01-28 00:03:00 -06:00
athenian200 3c4f414db7 Merge branch 'master' of https://github.com/MoonchildProductions/UXP into form-disabled-issue 2020-01-27 22:59:08 -06:00
wolfbeast c4b0715baa Issue #1360 - Enable acceleration by default on all known-good platforms. 2020-01-27 22:06:03 +01:00
wolfbeast 54fbb5c75c Update platform version.
Intended to be bumped to 4.6.x once CE/sDOM is landed completely.
2020-01-27 11:54:06 +01:00
wolfbeast 71416f9b79 Merge branch '1360' 2020-01-27 11:49:31 +01:00
Matt A. Tobin d56573bb9c Force CLOBBER 2020-01-26 18:30:55 -05:00
New Tobin Paradigm 22ed46f7cc Merge pull request #1374 from g4jc/custom_elementsv1
Custom Elements v1
2020-01-26 17:13:16 -05:00
Gaming4JC 3c70b297c7 Bug 1430951 - Avoid element name atomizing to improve performance of LookupCustomElementDefinition
Since we are dealing with the element (nodeInfo->LocalName() and NameAtom() are the same value), we could use nodeInfo->NameAtom() instead.

Tag UXP Issue #1344
2020-01-26 15:50:52 -05:00
Gaming4JC 0cea94242a Bug 1430034 - Fix attributeChangedCallback isn't fired with correct newValue when the attribute value is an empty string;
Tag UXP Issue #1344
2020-01-26 15:50:52 -05:00
Gaming4JC d84323905b Bug 1421544 - Lazy push/pop CustomElementReactionsStack entry;
Tag UXP Issue #1344
2020-01-26 15:50:51 -05:00
Gaming4JC e8f95f974f Bug 1413815 - Convert 'observedAttributes' to a sequence<DOMString>
Tag UXP Issue #1344
2020-01-26 15:50:51 -05:00
Gaming4JC 53319e5df6 Bug 1407669 - Fix custom element creation hides uncatchable exceptions from the constructor.
Tag UXP Issue #1344
2020-01-26 15:50:51 -05:00
Gaming4JC a8bf089e8a Bug 1419305 - Part 2: Keep processing remaining elements in ElementQueue even if some of elements are already unlinked
Tag UXP Issue #1344
2020-01-26 15:50:50 -05:00
Gaming4JC 0405d843be Bug 1419305 - Part 1: Use MicroTask on CustomElements correctly
Tag UXP Issue #1344
2020-01-26 15:50:50 -05:00
Gaming4JC 2077cdb41e Bug 1406922 - Make CycleCollectedJSContext to handle microtasks and make MutationObserver to use them
Tag UXP Issue #1344
2020-01-26 15:50:50 -05:00
Gaming4JC 43a8113072 Bug 1405821 - Move microtask handling to CycleCollectedJSContext
Tag UXP Issue #1344
2020-01-26 15:50:49 -05:00
Gaming4JC 14d115cfe3 Bug 1419643 - Don't need to lookup custom element definition for a non-custom element
Tag UXP Issue #1344
2020-01-26 15:50:49 -05:00
Gaming4JC 8db81508a1 Bug 1415761 - Catch the exception and rethrow it after invoking custom elements reactions;
The spec was unclear on how CEReactions interact with thrown exceptions; see https://github.com/whatwg/html/issues/3217. The spec is now being clarified in https://github.com/whatwg/html/pull/3235.

Tag UXP Issue #1344
2020-01-26 15:50:48 -05:00
Gaming4JC 4083a9abf7 Bug 1396620 - Part 2: Fix compartment mismatch crash when doing old prototype swizzling for custom element
Tag UXP Issue #1344
2020-01-26 15:50:48 -05:00
Gaming4JC f576d8f0fe Bug 1396620 - Part 1: Remove created callback for custom elements
Tag UXP Issue #1344
2020-01-26 15:50:48 -05:00
Gaming4JC 37d09da24e Bug 1400762 - Make dom.webcomponents.enabled pref doesn't control CustomElements feature
Tag UXP Issue #1344
2020-01-26 15:50:47 -05:00
Gaming4JC 7e9efb0f27 Bug 1405335 - Remove custom element attached and detached callbacks validation checks
Tag UXP Issue #1344
2020-01-26 15:50:47 -05:00
Gaming4JC 93313b0ce3 Bug 1406325 - Part 5: Implement try to upgrade.
Tag UXP Issue #1344
2020-01-26 15:50:46 -05:00
Gaming4JC fb657f7a1e Bug 1406325 - Part 4: Use mType for LookupCustomElementDefinition and also removing parts of v0.
Tag UXP Issue #1344
2020-01-26 15:50:46 -05:00
Gaming4JC 72d4c0b8df Bug 1406325 - Part 3: Refactor custom elements clone a node.
Tag UXP Issue #1344
2020-01-26 15:50:46 -05:00
Gaming4JC c199dd22e6 Bug 1406325 - Part 2: Set CustomElementData when cloning a node.
Tag UXP Issue #1344
2020-01-26 15:50:45 -05:00
Gaming4JC e62385604d Bug 1406325 - Part 1: Make sure custom element state is custom before sending callback.
Tag UXP Issue #1344
2020-01-26 15:50:45 -05:00
Gaming4JC a0014ac6e9 Bug 1378079 - Part 3: Complete the steps related to custom elements in "create an element for a token".
With fixup for missing header due to unified builds.

Tag UXP Issue #1344
2020-01-26 15:50:44 -05:00
Gaming4JC dd6749f7dd Regenerate Parser for 483155
Tag UXP Issue #1344
2020-01-26 15:50:44 -05:00
Gaming4JC e2fc7a9d49 Fix Build: We don't have SVG or MathML prefs yet
See Bug 1173199 / 1216893

Tag UXP Issue #1344
2020-01-26 15:50:44 -05:00
Gaming4JC 950275abe6 Fix aAttributes
Fallout from 483155

Tag UXP Issue #1344
2020-01-26 15:50:43 -05:00
Gaming4JC ea35625369 Fix ISINDEX
Since we want to keep this element, it has to be adapted to the parser changes in 483155

Tag UXP Issue #1344
2020-01-26 15:50:43 -05:00
Gaming4JC 0f9746b6e5 Add missing space to ElementName.java self-regeneration code.
Tag UXP Issue #1344
2020-01-26 15:50:43 -05:00
Gaming4JC 97ed13a9f9 Add missing elements from Bug 483155
Tag UXP Issue #1344
2020-01-26 15:50:42 -05:00
Gaming4JC d163c367d9 Bug 483155 - Put content creator function pointers onto nsHtml5ElementName.
This is all the manual work for Bug 483155, minus the added functionality to disable SVG and MathML which can be done at any time and are out of scope.

Tag UXP Issue #1344
2020-01-26 15:50:42 -05:00
Gaming4JC 9bf83c6a78 Bug 483155 - Put Gecko content creator function pointers on ElementName.
Tag UXP Issue #1344
2020-01-26 15:50:41 -05:00
Gaming4JC bec4d0ecdc Bug 1355779 - Skip interned ElementName lookup for Custom Elements (ones with hyphen).
Regen.

Tag UXP Issue #1344
2020-01-26 15:50:41 -05:00
Gaming4JC 1ef7d17528 Bug 1355779 - Skip interned nsHtml5ElementName lookup for Custom Elements (ones with hyphen).
Tag UXP Issue #1344
2020-01-26 15:50:41 -05:00
Gaming4JC 0b6548613a Bug 1378079 - Part 2: Introduce throw-on-dynamic-markup-insertion counter.
Per spec, document objects have a throw-on-dynamic-markup-insertion counter, which is used in conjunction with the create an element for the token algorithm to prevent custom element constructors from being able to use document.open(), document.close(), and document.write() when they are invoked by the parser.

Tag UXP Issue #1344
2020-01-26 15:50:40 -05:00
Gaming4JC 004b231d03 Bug 1378079 - Part 1: Gecko changes for adding attribute 'is' to parser.
Tag UXP Issue #1344
2020-01-26 15:50:40 -05:00
Gaming4JC 4c193edcaf Bug 1378079 - Add attribute 'is' to HTML parser.
Tag UXP Issue #1344
2020-01-26 15:50:39 -05:00
Gaming4JC b7f890e02e Bug 1410790 - Add more assertion in CustomElementData::SetCustomElementDefinition and GetCustomElementDefinition;
This is a follow-up patch for bug 1392970. Since we only set CustomElementDefinition on a custom element which is custom, we could add more assertion to ensure that.

Tag UXP Issue #1344
2020-01-26 15:50:39 -05:00
Gaming4JC fce396323d Bug 1366241 - Change memory layout of element name and attribute name hashes in HTML parser from sorted to level order BST in order to take advantage of cache during lookup.
HTML Regen.

Tag UXP Issue #1344
2020-01-26 15:50:38 -05:00
Gaming4JC a8511d983c Bug 1366241 - Change memory layout of element name and attribute name hashes from sorted to level order BST in order to take advantage of cache during lookup.
Java Regen.

Tag UXP Issue #1344
2020-01-26 15:50:38 -05:00
Gaming4JC e17a17766e Bug 1366241 - Change memory layout of element name and attribute name hashes from sorted to level order BST in order to take advantage of cache during lookup.
Tag UXP Issue #1344
2020-01-26 15:50:38 -05:00
Gaming4JC 76a4af3406 Bug 1358037 - Inline the methods of nsHtml5ElementName and nsHtml5AttributeName.
HTML Regen.

Tag UXP Issue #1344
2020-01-26 15:50:37 -05:00
Gaming4JC 5d4200f56d Bug 1358037 - Inline the methods of nsHtml5ElementName and nsHtml5AttributeName.
Manual changes

Tag UXP Issue #1344
2020-01-26 15:50:37 -05:00
Gaming4JC 41e477e2ce Bug 1358037 - Inline the methods of nsHtml5ElementName and nsHtml5AttributeName.
Tag UXP Issue #1344
2020-01-26 15:50:36 -05:00
Gaming4JC e5557d43d6 Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.
HTML Regen.

Tag UXP Issue #1344
2020-01-26 15:50:36 -05:00
Gaming4JC 650f6b5eb3 Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.
- Removes nsHtml5ReleasableAttributeName
- Adds nsHtml5AttributeEntry.h
- Makes nsHtml5HtmlAttributes no longer gentered.

Tag UXP Issue #1344
2020-01-26 15:50:36 -05:00
Gaming4JC 90d19b0a31 Bug 1355479 - Remove isindex on the Java side and allow the C++ side to reduce malloc in attribute handling.
Tag UXP Issue #1344
2020-01-26 15:50:35 -05:00
Gaming4JC f7bb7e81e3 Bug 1355769 - Avoid malloc for nsHtml5ElementName when processing a non-interned element name.
Fix build - Remove no longer used ReleaseableElement

Tag UXP Issue #1344
2020-01-26 15:50:35 -05:00
Gaming4JC 016a21c414 Bug 1355769 - Avoid malloc for nsHtml5ElementName when processing a non-interned element name.
HTML Regen.

Tag UXP Issue #1344
2020-01-26 15:50:34 -05:00
Gaming4JC e387308d9b Bug 1355769 - Avoid malloc for nsHtml5ElementName when processing a non-interned element name.
Tag UXP Issue #1344
2020-01-26 15:50:34 -05:00
Gaming4JC 738190dfde Bug 1355493 - Tweak bufToHash() and reduce the number of pre-interned elements.
HTML Regen.

Tag UXP Issue #1344
2020-01-26 15:50:34 -05:00
Gaming4JC 4503b51a4a Bug 1355493 - Tweak bufToHash() and reduce the number of pre-interned elements.
Java Regen.

Tag UXP Issue #1344
2020-01-26 15:50:33 -05:00
Gaming4JC 56925e1f4a Bug 1355493 - Tweak bufToHash() and reduce the number of pre-interned elements.
Tag UXP Issue #1344
2020-01-26 15:50:33 -05:00
Gaming4JC 72a6fd4d2a Bug 1352082 - Avoid shifting a signed integer left in C++.
Tag UXP Issue #1344
2020-01-26 15:50:32 -05:00
Gaming4JC 5b862aa38c Bug 1352082 - Avoid shifting a signed integer left in C++.
Tag UXP Issue #1344
2020-01-26 15:50:32 -05:00
Gaming4JC 1aa6cdcc1d Bug 1352290 - Add assertion to CustomElementReactionsStack::Enqueue to ensure upgrade reactions aren't scheduled to BackupQueue;
Tag UXP Issue #1344
2020-01-26 15:50:32 -05:00
Gaming4JC 2cbd6d3699 Bug 1407937 - Move mDefinition from CustomElementReacion to CustomElementUpgradeReaction;
Tag UXP Issue #1344
2020-01-26 15:50:31 -05:00
Gaming4JC 4dda3f6039 Bug 1406297 - Fix Document.createElement must report an exception.
Tag UXP Issue #1344
2020-01-26 15:50:31 -05:00
Gaming4JC 6ec385fbdb Bug 1319342 - Clone a node should enqueue an upgrade reaction.
Tag UXP Issue #1344
2020-01-26 15:50:30 -05:00
Gaming4JC 8e6ce5fae7 Bug 1121994 - Implement adopted callback for custom elements.
Tag UXP Issue #1344
2020-01-26 15:50:30 -05:00
Gaming4JC 6bbb9f062b Bug 1334044: Replace detached callback (v0) with disconnected callback (v1).
Tag UXP Issue #1344
2020-01-26 15:50:29 -05:00
Gaming4JC 01dfbc928f Bug 1334043 - Part 3: Update tests for connected callback.
Tag UXP Issue #1344
2020-01-26 15:50:29 -05:00
Gaming4JC 3d4c410091 Bug 1334043 - Part 2: Make nsContentUtils::EnqueueLifecycleCallback static.
We make nsContentUtils::EnqueueLifecycleCallback static so that it can be called without a window object. To achive this, we also make CustomElementReaction not taking a CustomElementRegistry in the constructor, as it can call Upgrade statically.

Tag UXP Issue #1344
2020-01-26 15:50:29 -05:00
Gaming4JC 186782301c Bug 1334043 - Part 1: Replace attached callback (v0) with connected callback (v1).
Tag UXP Issue #1344
2020-01-26 15:50:28 -05:00
Gaming4JC 42331663e6 Bug 1392970 - Part 2: Get CustomElementDefinition from CustomElementData when possible.
Tag UXP Issue #1344
2020-01-26 15:50:28 -05:00
Gaming4JC 8573c572fb Bug 1392970 - Part 1: Make CustomElementDefinition ref-counted and put it in CustomElementData.
Tag UXP Issue #1344
2020-01-26 15:50:27 -05:00
Gaming4JC f50503df9c Bug 1301024 - Part 2: Implement create an element steps.
Tag UXP Issue #1344
2020-01-26 15:50:27 -05:00
Gaming4JC 5840b63cca Bug 1301024 - Part 1: Set CreateElement/CreateElementNS is attribute.
Tag UXP Issue #1344
2020-01-26 15:50:27 -05:00
Gaming4JC 45a4aaf7e0 Bug 1398401 - Add preference check for custom element setup.
Tag UXP Issue #1344
2020-01-26 15:50:26 -05:00
Gaming4JC 49f597e7fb Bug 1332233 - prevent resource leak in CustomElementRegistry::Define.
Tag UXP Issue #1344
2020-01-26 15:50:26 -05:00
Gaming4JC bf004bb63b Bug 1334051 - Part 2: Invoke attributeChangedCallback only if attribute name is in the observed attribute list.
We call attributeChangedCallback in two cases:

1. When any of the attributes in the observed attribute list has changed, appended, removed, or replaced.

2. When upgrading an element, for each attribute in element's attribute list that is in the observed attribute list.

Note: w/ Fixup for not implementing an API Enhancement Bug 1363481.

Tag UXP Issue #1344
2020-01-26 15:50:25 -05:00
Gaming4JC 08fc057471 Bug 1334051 - Part 1: Include namespace in attributeChangedCallback.
Per spec [1], we should include namesapce in attributeChangedCallback argurment list.
[1] https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element, step 3

Tag UXP Issue #1344
2020-01-26 15:50:25 -05:00
Gaming4JC 704318ea0a Bug 1299363 - Part 5-2: Implement new upgrade steps.
Tag UXP Issue #1344
2020-01-26 15:50:25 -05:00
Gaming4JC bbb717ec12 Bug 1299363 - Part 5-1: Make the constructor created by document.registerElement() also works with construction stack.
So that the old upgrade can also work with new upgrade steps which will be implemented in part 5-2.

Tag UXP Issue #1344
2020-01-26 15:50:24 -05:00
Gaming4JC 515c46e695 Bug 1353647 - Fix the custom elements v0 upgrade inconsistency;
There are two places doing prototype setup in old upgrade,
- If definition comes after JS reflector creation, CustomElementRegistry::Upgrade will do prototype swizzling.
- If definition comes before JS reflector creation, Element::WrapObject will set up the prototype.

The later one does SubsumesConsideringDomain, but the former doesn't not.

This patch is to fix the inconsistency, i.e. the former case should also do SubsumesConsideringDomain.

Tag UXP Issue #1344
2020-01-26 15:50:24 -05:00
Gaming4JC d7e5ad445c Bug 1299363 - Part 4: Hold a pointer of ElementQueue in ReactionsStack instead.
1. It is possible that invoking a reaction triggers pushing a new ElementQueue into ReactionStack (e.g., calling define() in constructor which probably enqueue another upgrade reaction), and the reference of ElementQueue passed to InvokeReactions becomes invalid due to the memmove in nsTArray implementation.

2. And we get another benefit from this is memmove becomes faster.

Tag UXP Issue #1344
2020-01-26 15:50:23 -05:00
Gaming4JC ca596f2823 Bug 1299363 - Part 3: Remove unused argument in UpgradeCandidates.
Tag UXP Issue #1344
2020-01-26 15:50:23 -05:00
Gaming4JC 3d44a0b7f0 Bug 1299363 - Part 2: Allow prototype swizzling in html constructor.
Tag UXP Issue #1344
2020-01-26 15:50:23 -05:00
Gaming4JC 32f1ff0f8d Bug 1299363 - Part 1: Implement construction stack.
Tag UXP Issue #1344
2020-01-26 15:50:22 -05:00
Gaming4JC 53c9b77ed4 Bug 1315885 - Part 4: Implement callback reaction for custom element reactions.
Note: Skipped SyncInvokeReactions since it is removed in CE v1, waste of time.

Tag UXP Issue #1344
2020-01-26 15:50:22 -05:00
Gaming4JC e6733c9278 Bug 1315885 - Part 3: Transfer the ownership of ReactionQueue's entry due to re-enter CustomElementReactionsStack::InvokeReactions.
Tag UXP Issue #1344
2020-01-26 15:50:21 -05:00
Gaming4JC 6ff1c0c52f Bug 1315885 - Part 2: Avoid rethrowing exception in CustomElementCallback::Call.
Tag UXP Issue #1344
2020-01-26 15:50:21 -05:00
Gaming4JC 19f08038f0 Bug 1315885 - Part 1: Add ShadowRoot CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:20 -05:00
Gaming4JC 4c9eab4d26 Bug 1340027 - Part 5: Add XSLTProcessor CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:20 -05:00
Gaming4JC 7a1cb50405 Bug 1340027 - Part 4: Add DOM parsing CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:20 -05:00
Gaming4JC db86d423e5 Bug 1340027 - Part 3: Add CSSStyleDeclaration CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:19 -05:00
Gaming4JC 3fd2f61949 Bug 1340027 - Part 2: Add HTML CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:19 -05:00
Gaming4JC 1674f8f750 Bug 1340027 - Part 1: Add DOM CEReactions annotation.
Tag UXP Issue #1344
2020-01-26 15:50:18 -05:00
Gaming4JC cc533eaee5 Bug 1377993 - Make node slots less memory hungry in common cases.
Tag UXP Issue #1344
2020-01-26 15:50:18 -05:00
Gaming4JC 59c26110c1 Bug 1347634 - GetCustomElementData and SetCustomElementData don't need to be virtual;
Tag UXP Issue #1344
2020-01-26 15:50:17 -05:00
Gaming4JC a2c7b5f1d9 Bug 1325279 - Put the reaction queue in CustomElementData structure instead of using a map;
Bug 1347446 makes accessing ElementReactionQueue becomes a bit non-trival (have to get it via DocGroup). Since bug 1359346 already refactors the creation time of CustomElementData, ReactionQueue can also be put into CustomElementData, then we can just get ReactionQueue from Element.

Tag UXP Issue #1344
2020-01-26 15:50:17 -05:00
Gaming4JC 9d51b9d06a Creating customized built-in elements without relevant definitions registered first shouldn't throw NotFoundError;
per spec change: https://github.com/w3c/webcomponents/issues/608

Tag UXP Issue #1344
2020-01-26 15:50:17 -05:00
Gaming4JC e86aac28b8 Bug 1359346 - Implement custom element state;
https://dom.spec.whatwg.org/#concept-element-custom-element-state

Tag UXP Issue #1344
2020-01-26 15:50:16 -05:00
Gaming4JC 88925e150b Bug 1357002 - Part 2: Don't call SetupCustomElement() if the custom element feature is pref-ed off;
Tag UXP Issue #1344
2020-01-26 15:50:16 -05:00
Gaming4JC 9abc9b2b78 Bug 1357002 - Part 1: Cache dom.webcomponents.customelements.enabled preference;
Tag UXP Issue #1344
2020-01-26 15:50:15 -05:00
Gaming4JC 859fbc139a Bug 1341898 - Make nsDocument::IsWebComponentsEnabled use a cached bool pref;
Note: Minus IPC bit.

Tag UXP Issue #1344
2020-01-26 15:50:15 -05:00
Gaming4JC d8109fa9a0 Bug 1309147 - Part 5: Eliminate performance cliff when accessing CEReactions code.
Tag UXP Issue #1344
2020-01-26 15:50:15 -05:00
Gaming4JC e055747038 Bug 1309147 - Part 4: Add CEReactions for CustomElementRegistry.
Tag UXP Issue #1344
2020-01-26 15:50:14 -05:00
Gaming4JC df23f78ad1 Bug 1309147 - Part 3: Implement the support for CEReactions in Codegen.
Tag UXP Issue #1344
2020-01-26 15:50:14 -05:00
Gaming4JC 20799ce18c Bug 1309147 - Part 2: Add the name of 'this' value's JSObject* for codegen to generate CEReaction code.
Tag UXP Issue #1344
2020-01-26 15:50:13 -05:00
Gaming4JC 08d22f03ea Bug 1309147 - Part 1: Implement the support for CEReactions in WebIDL parser.
Tag UXP Issue #1344
2020-01-26 15:50:13 -05:00
Gaming4JC ba8fb9dc58 Bug 1350960 - Release CustomElementReactionsStack in TabGroup thread when DocGroup is going away.
Note: In UXP we use non-Quantum thread checking implementation here.

Tag UXP Issue #1344
2020-01-26 15:50:12 -05:00
Gaming4JC 16cd53bd8d Bug 1351979 - Change CustomElementRegistry::Define code to properly propagate out JS exceptions;
Tag UXP Issue #1344
2020-01-26 15:50:12 -05:00
Gaming4JC 25a33c7123 Bug 1347446 - Move custom element reactions stack to DocGroup.
Tag UXP Issue #1344
2020-01-26 15:50:12 -05:00
Gaming4JC 5cf46e2f87 Bug 1341693 - Don't need to check GetDocShell() when creating CustomElementRegistry;
Tag UXP Issue #1344
2020-01-26 15:50:11 -05:00
Gaming4JC 3a97503b36 Bug 1309184 - Implement upgrade reaction for custom element reactions.
Tag UXP Issue #1344
2020-01-26 15:50:11 -05:00
Gaming4JC bac01e30fd Bug 1274159 - Part 4: Add test cases for HTMLConstructor;
Tag UXP Issue #1344
2020-01-26 15:50:10 -05:00
Gaming4JC 5b814fffd6 Bug 1274159 - Part 3-2: Update web-platform-test expected result;
Tag UXP Issue #1344
2020-01-26 15:50:10 -05:00
Gaming4JC 6ea0acf750 Bug 1274159 - Part 3-1: Add HTMLConstructor to HTMLElement and its subclass;
Tag UXP Issue #1344
2020-01-26 15:50:10 -05:00
Gaming4JC 5222f6e9da Bug 1274159 - Part 2-2: Support HTMLConstructor WebIDL extended attribute for custom elements;
Tag UXP Issue #1344
2020-01-26 15:50:09 -05:00
Gaming4JC 244277a3fa Bug 1274159 - Part 2-1: Include the name of relevant interface in nsHTMLTagList.h;
Tag UXP Issue #1344
2020-01-26 15:50:09 -05:00
Gaming4JC 2d31ebf6b6 Bug 1274159 - Part 1: Support looking up definitions by using constructor as a key;
Tag UXP Issue #1344
2020-01-26 15:50:08 -05:00
Gaming4JC bc8543bf79 Bug 1271549 - Remove details and summary preference.
Tag UXP Issue #1344
2020-01-26 15:50:08 -05:00
Gaming4JC ce285b6f2d Bug 1276438 part 3. Align the .body setter with the spec a bit better.
There are two changes here:

1) We allow setting .body even if the root element is not an <html:html>. This is what the spec says to do, and what we used to do before the changes in bug
366200. No tests for this yet, pending https://github.com/whatwg/html/issues/3403 getting resolved.

2) We use GetBody(), not GetBodyElement(), to look for an existing thing to replace. This matters if there are <frameset>s involved.

Tag UXP Issue #1344
Tag UXP Issue #252
2020-01-26 15:50:07 -05:00
Gaming4JC 32f3f8826f Bug 1276438 part 2. Move the implementation of the .body setter from nsHTMLDocument to nsIDocument.
Tag UXP Issue #1344
Tag UXP Issue #252
2020-01-26 15:50:07 -05:00
Gaming4JC a2b56b295b Bug 1276438 part 1. Move the implementation of the .body getter from nsHTMLDocument to nsIDocument.
Tag UXP Issue #1344
Tag UXP Issue #252
2020-01-26 15:49:16 -05:00
wolfbeast 90773547e7 Issue #1360 - Part 2: Update tests for changed preferences. 2020-01-26 10:28:17 +01:00
wolfbeast 282b791acb Issue #1360 - Part 1: Simplify layers acceleration prefs.
This gets rid of platform-dependent hard-coded defaults, but keeps
build-time blocking if there is no GL provider (in which case layers
acceleration almost certainly won't work because it needs a GL
compositor and would likely crash without)

New prefs are
- layers.acceleration.enabled to enable HWA
- layers.acceleration.force to force it enabled (requires .enabled to be
  set as well)

This is the platform part of this issue. The rest will be front-end work
(Preference UI integration and pref migration)
2020-01-26 09:48:52 +01:00
Moonchild a1cce3b2b0 Merge pull request #1371 from athenian200/ftp-list
Potential hang on bad FTP sequence
2020-01-26 08:26:23 +00:00
athenian200 7d53919c26 Fix whitespace. 2020-01-26 01:51:37 -06:00
athenian200 8bb5db350d Issue #1349 - Stop 2xx FTP responses from causing browser to hang.
LIST and RETR still appear to work as intended on ftp:// URLs after my changes. I wasn't able to test STOR because the browser doesn't appear to support FTP uploads at this time (although our FTP implementation appears perfectly capable of doing an FTP upload.)

If I understood the issue correctly, though, what we're doing is ensuring that we receive a preliminary 100 response from the FTP server for a given action before jumping to the 200 code describing what we do if the action was completed. Even though it makes no logical sense for a server to say an action was completed before it was initiated, someone could write a really annoying FTP server that takes advantage of this fact to crash the browser if they wanted.
2020-01-26 01:40:55 -06:00
wolfbeast a64ac6d702 No issue - Always use jemalloc allocator for storage memory when
MOZ_MEMORY is defined (which is defined by enabling jemalloc in config)
2020-01-23 15:17:51 +01:00
Kai Engert 6d761aa68f Issue #1338 - Follow-up: Also cache the most recent PBKDF1 hash
This rewrites the caching mechanism to apply to both PBKDF1 and PBKDF2
2020-01-23 13:11:09 +01:00
wolfbeast 90c5288fef Issue #1342 - Remove support for system libevent 2020-01-23 13:08:02 +01:00
wolfbeast 3624078103 Issue #1366 - Fix build bustage from erroneously removing 2 function implementations. 2020-01-22 21:42:10 +01:00
wolfbeast 5a6059feef Issue #1354 - Fix another potential crashing scenario in WebGL.
(merge of gl-work branch)
2020-01-22 11:51:19 +01:00
Moonchild 8e33fa9c4b Merge pull request #1367 from g4jc/showmodaldialog
Completely remove showModalDialog
2020-01-22 10:35:12 +00:00
Gaming4JC a9290ef91e Issue #1366 - Completely remove showModalDialog 2020-01-21 21:36:54 -05:00
wolfbeast fabe21d593 Issue #1354 - Fix typo 2020-01-21 21:23:46 +01:00
wolfbeast c6dbf55449 Issue #1354 - Clear the current context when MakeCurrent() fails. 2020-01-20 22:42:14 +01:00
wolfbeast 722161775b Issue #1338 - Bump NSS version
Our NSS version is closer to the currently-released .1, so bump version
to that.
Note: we still have some additional patches to the in-tree version in
place so this isn't a 100% match to the RTM one.
2020-01-20 11:59:36 +01:00
wolfbeast 71d8ada4a9 Merge branch 'master' of https://github.com/MoonchildProductions/UXP 2020-01-19 14:40:01 +01:00
wolfbeast e0baeba546 Issue #1362 - Revert "Implement regular expression lookbehind"
This reverts commit fa473930f4.
2020-01-19 14:39:14 +01:00
wolfbeast b1abb9aebe Issue #1362 - Revert "Update js/src/builtin/TestingFunctions.cpp for
regex lookbehind changes"

This reverts commit e79607a7a6.
2020-01-19 14:36:29 +01:00
Matt A. Tobin 22198ec194 Issue #1358 - Default to SSL/TLS when using the Account Wizard 2020-01-18 14:09:43 -05:00
Matt A. Tobin c137a4045c Issue #1359 - Pointlessly rename greprefs.. again. 2020-01-18 13:17:41 -05:00
wolfbeast 63219a15b1 Minor update to the html5 parser component doc 2020-01-18 13:25:35 +01:00
wolfbeast b87a4551b5 No issue - Fix unsafe http methods on HTTP/2 with TLSv1.3 0RTT. 2020-01-18 13:17:09 +01:00
wolfbeast 82dffb32bd Add component documentation for the HTML5 parser. 2020-01-18 13:01:53 +01:00
wolfbeast a2073c54b4 Revert "No issue - Fix unsafe http methods on HTTP/2 with TLSv1.3 0RTT."
This reverts commit 67d336a6f2.
2020-01-18 02:08:53 +01:00
wolfbeast 67d336a6f2 No issue - Fix unsafe http methods on HTTP/2 with TLSv1.3 0RTT. 2020-01-17 17:11:06 +01:00
athenian200 1f8d508258 Issue #1356 - Restore older syntax.
Some newer Firefox syntax snuck into my last bug. Just to be on the safe side I'm restoring the older syntax here.
2020-01-16 14:15:23 -06:00
athenian200 42e4816771 Issue #1356 - Remove -moz-user-input disabled to improve event handling. 2020-01-16 14:07:04 -06:00
Matt A. Tobin e4c4c20e7e Update readme instructions for how to use the java html5 parser codegen makefile 2020-01-16 07:43:21 -05:00
Matt A. Tobin ed60101550 Merge branch 'html5-parser-work' 2020-01-16 07:32:48 -05:00
Matt A. Tobin 927c386dd8 Regenerate nsHtml5*.cpp files from java htmlparser sources 2020-01-16 07:28:40 -05:00
Matt A. Tobin 635baac21a Update the html5 parser java codegen makefile to clean up snapshot javasrc 2020-01-16 07:22:22 -05:00
Matt A. Tobin c050c611df Update gitignore to no longer track snapshot javasrc for the html5 parser 2020-01-16 07:19:29 -05:00
Matt A. Tobin 9dbbc6c08f Remove obsolete javasrc snapshot 2020-01-16 07:17:55 -05:00
Matt A. Tobin 72779c9dde Update java htmlparser copyright on code to be translated to cpp 2020-01-16 07:16:39 -05:00
Matt A. Tobin e93b373374 Fix an issue with the html5 tokenizer and tree builder (java htmlparser) 2020-01-15 22:07:59 -05:00
wolfbeast fa816e1ec6 No issue - Fix some line endings in WebGLShaderValidator.cpp 2020-01-16 01:41:21 +01:00
wolfbeast 7007ec9e42 Issue #1354 - Don't allow glsl[130,400] unless we have gpu_shader5
- Teach GLContext about gpu_shader5
- Downgrade shader language version if gpu_shader5 support isn't found.
2020-01-16 01:40:30 +01:00
wolfbeast 058105eec0 Issue #1354 - Cherry-pick ANGLE update for broken drivers that support
required indexing but not the extensions.
2020-01-16 01:31:47 +01:00
Matt A. Tobin 3da18fda02 Bug 1562033
Adjust tokenization of U+0000 (java htmlparser)
2020-01-15 18:10:14 -05:00
Matt A. Tobin ee1d953749 Bug 1347737 - Introduce a new non-heap-allocated type for holding nsStringBuffer* in the HTML parser. (java htmlparser) 2020-01-15 16:55:12 -05:00
Matt A. Tobin 984790c6fb Bug 1555523 (java htmlparser version) 2020-01-15 16:18:08 -05:00
Matt A. Tobin 6f27b4eb34 Bug 1322938 - Make the tree builder aware of <dialog>.
Tag #1343 | https://hg.mozilla.org/projects/htmlparser/rev/d9bdf700af247563fec9b07b52ede6bf61edd513
2020-01-15 15:30:54 -05:00
Matt A. Tobin 2ac58ecef8 Update the java codegen makefile for having the two libs in-tree and change a few target names so they aren't obnoxious 2020-01-15 14:59:35 -05:00
Matt A. Tobin 03fb2e2294 Add the java javaparser
https://github.com/javaparser/javaparser/
Invisible tag: javaparser-1.0.6
2020-01-15 14:58:11 -05:00
Matt A. Tobin 6168dbe21f Add java htmlparser sources that match the original 52-level state
https://hg.mozilla.org/projects/htmlparser/
Commit: abe62ab2a9b69ccb3b5d8a231ec1ae11154c571d
2020-01-15 14:56:04 -05:00
Matt A. Tobin 09314667a6 Update gitignore for import of java html5 codegen and parser sources 2020-01-15 14:45:20 -05:00
wolfbeast 82804d2002 Issue #1332 - Enable seeking to next frame by default.
The indicated BZ bug was resolved in Gecko 50, and could have already
been enabled before (since it returns a promise as-required).
With the rest of promise-based media implemented it makes no sense to
keep this disabled on production.
2020-01-14 15:51:26 +01:00
wolfbeast 8d65feff0a No issue - Remove some unused webextension sync preferences. 2020-01-14 15:48:23 +01:00
wolfbeast da7423057d Issue #1319 - Set some obvious prefs for production builds.
This sets some defaults for production builds that should be
self-explanatory.
2020-01-14 15:47:27 +01:00
wolfbeast cbbae72431 Issue #1353 - Disable remote jar: URIs by default.
Considering the one exception this was still enabled for on all versions
of Firefox since 45 until our fork point is no longer applicable.
This resolves #1353
2020-01-14 15:29:08 +01:00
wolfbeast 1392abe1de No issue - Remove unused network.http.bypass-cachelock-threshold pref. 2020-01-14 15:07:15 +01:00
wolfbeast abf6fd8f2a No issue - Don't define gamepad prefs when gamepad support isn't built.
This also sets sane defaults when present. See also #1319.
2020-01-14 14:45:33 +01:00
wolfbeast 0257b657d2 Issue #1319 - Enable promise debugging only in DEBUG builds. 2020-01-14 14:44:13 +01:00
wolfbeast 4a038e2b4b Issue #1319 - Disable MOZ_LOGGING in production builds.
This makes it only enabled in debug builds, instead, where logging
would be most useful.
2020-01-14 13:35:03 +01:00
wolfbeast 6d342dbab9 Issue #1319 - Remove stderr_to_file.
This local-debug function is only useful for Android to work around
issues with logspewing and should never be in production builds anyway.
2020-01-14 13:23:39 +01:00
wolfbeast 217dca872b Fix comments for NSS PBKDF setup (no code change) 2020-01-14 13:14:57 +01:00
Kai Engert 3733205f09 Issue #1338: Follow-up: Cache the most recent PBKDF2 password hash,
to speed up repeated SDR operations.

Landed on NSS-3.48 for Bug 1606992
2020-01-14 13:08:48 +01:00
wolfbeast aa2ac8dded Reinstate the java->c++ source, generator code + documentation.
We've kept the java source up-to-date until its removal, so there should
be very little additional java mangling needed to have it back up to
speed and usable again.

This reverts commit c6446f1126.
2020-01-13 09:32:00 +01:00
wolfbeast 60dc9eaa95 Simplify some alias sets in IonMonkey. 2020-01-11 13:09:17 +01:00
wolfbeast 06dbb7b7dd Prefer file extension as-provided over default extension for mimetype to
look up default applications on Windows
2020-01-11 12:53:56 +01:00
Daiki Ueno f64e760ab0 Issue #1338 - Followup: certdb: propagate trust information if trust
module is loaded afterwards,

Summary: When the builtin trust module is loaded after some temp certs
being created, these temp certs are usually not accompanied by trust
information. This causes a problem in UXP as it loads the module from a
separate thread while accessing the network cache which populates temp
certs.

This change makes it properly roll up the trust information, if a temp
cert doesn't have trust information.
2020-01-10 20:34:53 +01:00
wolfbeast 095a02f259 Update GTK clipboard handling
- Store the clipboard even if it was set in a GTK dialog.
- Fix a GtkTargetList leak.
- Notify GTK that the data is no longer available for
clipboard_get_cb(), so that GTK will no longer advertise nor attempt to
store the data.
2020-01-10 19:40:14 +01:00
wolfbeast 9365776219 Issue #1338 - Un-bust building of NSS after update to 3.48 on Linux. 2020-01-10 18:17:14 +01:00
wolfbeast 0186023f4a Handle missing base64 challenge in NegotiateAuth and NTLMAuth. 2020-01-09 22:35:03 +01:00
Yaron Tausky 51b1cd97aa Make copy of list before iterating over it. 2020-01-09 22:23:13 +01:00
wolfbeast 8198126c39 Be more consistent about decoding IP addresses in PSM. 2020-01-09 21:39:28 +01:00
wolfbeast d429ac8a60 Simplify value setting.
This gets rid of unused boolean return values on setters and a level of
indirection for calls to set values.
2020-01-09 18:26:06 +01:00
Moonchild 29bf28ca34 Merge pull request #1347 from g4jc/html5_dialog
Implement HMTL5 <dialog>
2020-01-09 13:07:56 +00:00
wolfbeast d79cc5fb49 Issue #1348 - Part 3: Set IS_PRIVATE input scope in private browsing.
Microsoft IME on Windows 10 20H1 (build 19025+) supports IME private
mode by input scope. Although previous Windows versions use an
undocumented API for Edge and IE only, the next Windows 10 release will
use a public API for it.
We pre-empt this potential privacy concern by setting the IS_PRIVATE
flag when in PB mode.
2020-01-09 13:22:29 +01:00
wolfbeast 8ae047bbbf Issue #1348 - Part 2: Teach IMEState about Private Browsing mode. 2020-01-09 13:19:56 +01:00
Makoto Kato 1672355a77 Issue #1348 - Part 1: Clean up input scope support for IMM32.
Use AutoTArray to set input scope.
2020-01-09 09:53:16 +01:00
Gaming4JC 52bda2a828 Bug 1379728 part 1. Remove the double-definition of the 'close' event from EventNameList.h.
Tag #1343
2020-01-07 18:33:24 -05:00
Gaming4JC 25e85f99ce Bug 1322938 - Make the HTML tree builder aware of <dialog>.
Original patch by :hsivonen
Tag #1343
2020-01-07 18:33:24 -05:00
Gaming4JC b91b0c37eb Bug 1322938 - Put <dialog> element behind preference.
Tag #1343
2020-01-07 18:33:23 -05:00
Gaming4JC a4011e7246 Bug 1322938 - Update <dialog> element Web Platform Tests expected results.
Tag #1343
2020-01-07 18:33:23 -05:00
Gaming4JC ef2cd8749f Bug 1322938 - Emit close event when HTMLDialogElement.prototype.close() is called.
Tag #1343
2020-01-07 18:33:23 -05:00
Gaming4JC 2e3b937f4e Bug 1322938 - Basic implementation of HTMLDialogElement.
Tag #1343
2020-01-07 18:33:22 -05:00
wolfbeast c032651778 Reject sample rates that are out-of-range for libsoundtouch.
We never reach this with our normal use of this lib but adding the
sanity check just in case. (ported from upstream)
2020-01-07 21:24:58 +01:00
Moonchild c66b70c4da Merge pull request #1346 from JustOff/PR_CSSStyleSheet_legacy
Issue #1345 - Implement non-standard legacy CSSStyleSheet rules
2020-01-07 12:30:21 +00:00
JustOff b4d686d62d Issue #1345 - Implement non-standard legacy CSSStyleSheet rules 2020-01-07 13:05:05 +02:00
4264 changed files with 119194 additions and 458384 deletions

No files matched your search

+5 -3
View File
@@ -49,9 +49,11 @@ js/src/autom4te.cache
js/src/tests/results-*.html
js/src/tests/results-*.txt
# Java HTML5 parser classes
parser/html/java/htmlparser/
parser/html/java/javaparser/
# Java HTML5 parser codegen artifacts
parser/html/java/htmlparser/bin/
parser/html/java/javaparser/bin/
parser/html/java/*.jar
parser/html/javasrc/
# Ignore the files and directory that Eclipse IDE creates
.project
+1 -1
View File
@@ -22,5 +22,5 @@
# 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 incremental customElements v1 landing
+6
View File
@@ -47,6 +47,12 @@ ifndef MOZ_PROFILE_USE
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
# rules.mk doesn't run early enough.
$(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status $(BUILD_BACKEND_FILES)
# While our mozbuild backend has some kind of crazy install_manfests junk to
# try and make this not have to happen, we actually want dist/bin to be
# completely removed regardless.
default alldep all::
$(RM) -r $(DIST)/bin
ifndef JS_STANDALONE
ifdef COMPILE_ENVIRONMENT
$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
+3
View File
@@ -34,3 +34,6 @@ and other community members.
If you fork this repository to perform your own work on it, please consider offering
improvement patches upstream to its origin to mutually improve the platform and build
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).
+21 -27
View File
@@ -175,23 +175,17 @@ HTMLTableCellAccessible::Table() const
uint32_t
HTMLTableCellAccessible::ColIdx() const
{
nsITableCellLayout* cellLayout = GetCellLayout();
NS_ENSURE_TRUE(cellLayout, 0);
int32_t colIdx = 0;
cellLayout->GetColIndex(colIdx);
return colIdx > 0 ? static_cast<uint32_t>(colIdx) : 0;
nsTableCellFrame* cellFrame = GetCellFrame();
NS_ENSURE_TRUE(cellFrame, 0);
return cellFrame->ColIndex();
}
uint32_t
HTMLTableCellAccessible::RowIdx() const
{
nsITableCellLayout* cellLayout = GetCellLayout();
NS_ENSURE_TRUE(cellLayout, 0);
int32_t rowIdx = 0;
cellLayout->GetRowIndex(rowIdx);
return rowIdx > 0 ? static_cast<uint32_t>(rowIdx) : 0;
nsTableCellFrame* cellFrame = GetCellFrame();
NS_ENSURE_TRUE(cellFrame, 0);
return cellFrame->RowIndex();
}
uint32_t
@@ -285,6 +279,12 @@ HTMLTableCellAccessible::GetCellLayout() const
return do_QueryFrame(mContent->GetPrimaryFrame());
}
nsTableCellFrame*
HTMLTableCellAccessible::GetCellFrame() const
{
return do_QueryFrame(mContent->GetPrimaryFrame());
}
nsresult
HTMLTableCellAccessible::GetCellIndexes(int32_t& aRowIdx, int32_t& aColIdx) const
{
@@ -520,11 +520,9 @@ HTMLTableAccessible::SelectedCellCount()
if (!cellFrame || !cellFrame->IsSelected())
continue;
int32_t startRow = -1, startCol = -1;
cellFrame->GetRowIndex(startRow);
cellFrame->GetColIndex(startCol);
if (startRow >= 0 && (uint32_t)startRow == rowIdx &&
startCol >= 0 && (uint32_t)startCol == colIdx)
uint32_t startRow = cellFrame->RowIndex();
uint32_t startCol = cellFrame->ColIndex();
if (startRow == rowIdx && startCol == colIdx)
count++;
}
}
@@ -570,11 +568,9 @@ HTMLTableAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
if (!cellFrame || !cellFrame->IsSelected())
continue;
int32_t startCol = -1, startRow = -1;
cellFrame->GetRowIndex(startRow);
cellFrame->GetColIndex(startCol);
if ((startRow >= 0 && (uint32_t)startRow != rowIdx) ||
(startCol >= 0 && (uint32_t)startCol != colIdx))
uint32_t startRow = cellFrame->RowIndex();
uint32_t startCol = cellFrame->ColIndex();
if (startRow != rowIdx || startCol != colIdx)
continue;
Accessible* cell = mDoc->GetAccessible(cellFrame->GetContent());
@@ -597,11 +593,9 @@ HTMLTableAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells)
if (!cellFrame || !cellFrame->IsSelected())
continue;
int32_t startRow = -1, startCol = -1;
cellFrame->GetColIndex(startCol);
cellFrame->GetRowIndex(startRow);
if (startRow >= 0 && (uint32_t)startRow == rowIdx &&
startCol >= 0 && (uint32_t)startCol == colIdx)
uint32_t startCol = cellFrame->ColIndex();
uint32_t startRow = cellFrame->RowIndex();
if (startRow == rowIdx && startCol == colIdx)
aCells->AppendElement(CellIndexAt(rowIdx, colIdx));
}
}
+6
View File
@@ -11,6 +11,7 @@
#include "TableCellAccessible.h"
class nsITableCellLayout;
class nsTableCellFrame;
namespace mozilla {
namespace a11y {
@@ -53,6 +54,11 @@ protected:
*/
nsITableCellLayout* GetCellLayout() const;
/**
* Return the table cell frame.
*/
nsTableCellFrame* GetCellFrame() const;
/**
* Return row and column indices of the cell.
*/
@@ -421,7 +421,7 @@
//////////////////////////////////////////////////////////////////////////
// HTML:dialog
todo(isAccessible("dialog"), "dialog element is not accessible");
ok(isAccessible("dialog"), "dialog element is not accessible");
//////////////////////////////////////////////////////////////////////////
// HTML:div
+7
View File
@@ -842,6 +842,13 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW32_NT*:*)
if [ "$PLATFORM" = "X64" ]; then
echo x86_64-pc-mingw32
else
echo ${UNAME_MACHINE}-pc-mingw32
fi
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
+2 -15
View File
@@ -8,19 +8,6 @@ dnl ICU library, as well as a few other things.
AC_DEFUN([MOZ_CONFIG_ICU], [
ICU_LIB_NAMES=
MOZ_SYSTEM_ICU=
MOZ_ARG_WITH_BOOL(system-icu,
[ --with-system-icu
Use system ICU (located with pkgconfig)],
MOZ_SYSTEM_ICU=1)
if test -n "$MOZ_SYSTEM_ICU"; then
PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 58.1)
CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS"
CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS"
fi
AC_SUBST(MOZ_SYSTEM_ICU)
dnl We always use ICU.
USE_ICU=1
@@ -51,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 -z "$MOZ_SYSTEM_ICU" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
if test -z "$JS_STANDALONE" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
MOZ_ICU_DATA_ARCHIVE=1
else
MOZ_ICU_DATA_ARCHIVE=
@@ -64,7 +51,7 @@ AC_SUBST(USE_ICU)
AC_SUBST(ICU_DATA_FILE)
AC_SUBST(MOZ_ICU_DATA_ARCHIVE)
if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then
if test -n "$USE_ICU"; then
if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then
AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api])
fi
+2 -32
View File
@@ -42,15 +42,6 @@ if test "$MOZ_BUILD_APP" != js || test -n "$JS_STANDALONE"; then
_IS_OUTER_CONFIGURE=1
fi
MOZ_ARG_WITH_BOOL(system-nspr,
[ --with-system-nspr Use an NSPR that is already built and installed.
Use the 'nspr-config' script in the current path,
or look for the script in the directories given with
--with-nspr-exec-prefix or --with-nspr-prefix.
(Those flags are only checked if you specify
--with-system-nspr.)],
_USE_SYSTEM_NSPR=1 )
JS_POSIX_NSPR=unset
ifdef([CONFIGURING_JS],[
if test -n "$JS_STANDALONE"; then
@@ -71,7 +62,6 @@ ifdef([CONFIGURING_JS],[
])
dnl Pass at most one of
dnl --with-system-nspr
dnl --with-nspr-cflags/libs
dnl --enable-nspr-build
dnl --enable-posix-nspr-emulation
@@ -79,10 +69,6 @@ dnl --enable-posix-nspr-emulation
AC_MSG_CHECKING([NSPR selection])
nspr_opts=
which_nspr=default
if test -n "$_USE_SYSTEM_NSPR"; then
nspr_opts="x$nspr_opts"
which_nspr="system"
fi
if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
nspr_opts="x$nspr_opts"
which_nspr="command-line"
@@ -136,11 +122,7 @@ fi
# anything itself.
if test -n "$_IS_OUTER_CONFIGURE"; then
if test -n "$_USE_SYSTEM_NSPR"; then
AM_PATH_NSPR($NSPR_MINVER, [MOZ_SYSTEM_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])])
fi
if test -n "$MOZ_SYSTEM_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $NSPR_CFLAGS"
AC_TRY_COMPILE([#include "prtypes.h"],
@@ -178,19 +160,7 @@ AC_SUBST(NSPR_INCLUDE_DIR)
AC_SUBST(NSPR_LIB_DIR)
PKGCONF_REQUIRES_PRIVATE="Requires.private: nspr"
if test -n "$MOZ_SYSTEM_NSPR"; then
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $NSPR_CFLAGS"
AC_TRY_COMPILE([#include "prlog.h"],
[#ifndef PR_STATIC_ASSERT
#error PR_STATIC_ASSERT not defined
#endif],
,
AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
CFLAGS=$_SAVE_CFLAGS
# piggy back on $MOZ_SYSTEM_NSPR to set a variable for the nspr check for js.pc
PKGCONF_REQUIRES_PRIVATE="Requires.private: nspr >= $NSPR_MINVER"
elif test -n "$JS_POSIX_NSPR"; then
if test -n "$JS_POSIX_NSPR"; then
PKGCONF_REQUIRES_PRIVATE=
fi
AC_SUBST([PKGCONF_REQUIRES_PRIVATE])
-3
View File
@@ -1,3 +0,0 @@
# Define indicating that this build is prior to one of the early betas. To be
# unset mid-way through the beta cycle.
EARLY_BETA_OR_EARLIER=
-6
View File
@@ -33,15 +33,9 @@ if ('MOZ_OFFICIAL_BRANDING' in listConfig) or (strBrandingDirectory.endswith("br
# Applies to Pale Moon and Basilisk
if ('MC_BASILISK' in listConfig) or ('MC_PALEMOON' in listConfig):
listViolations += [
'MOZ_SYSTEM_LIBEVENT',
'MOZ_SYSTEM_NSS',
'MOZ_SYSTEM_NSPR',
'MOZ_SYSTEM_JPEG',
'MOZ_SYSTEM_ZLIB',
'MOZ_SYSTEM_BZ2',
'MOZ_SYSTEM_PNG',
'MOZ_SYSTEM_LIBVPX',
'MOZ_SYSTEM_SQLITE',
'MOZ_SYSTEM_JEMALLOC'
]
+2 -7
View File
@@ -166,6 +166,7 @@ def old_configure_options(*options):
'--enable-cookies',
'--enable-cpp-rtti',
'--enable-crashreporter',
'--enable-dbm',
'--enable-dbus',
'--enable-debug-js-modules',
'--enable-jetpack',
@@ -222,6 +223,7 @@ def old_configure_options(*options):
'--enable-release',
'--enable-safe-browsing',
'--enable-sandbox',
'--enable-security-sqlstore',
'--enable-signmar',
'--enable-simulator',
'--enable-small-chunk-size',
@@ -233,7 +235,6 @@ def old_configure_options(*options):
'--enable-system-cairo',
'--enable-system-extension-dirs',
'--enable-system-pixman',
'--enable-system-sqlite',
'--enable-tasktracer',
'--enable-tests',
'--enable-thread-sanitizer',
@@ -287,13 +288,7 @@ def old_configure_options(*options):
'--with-sixgill',
'--with-soft-float',
'--with-system-bz2',
'--with-system-icu',
'--with-system-jpeg',
'--with-system-libevent',
'--with-system-libvpx',
'--with-system-nspr',
'--with-system-nss',
'--with-system-png',
'--with-system-zlib',
'--with-thumb',
'--with-thumb-interwork',
-4
View File
@@ -44,11 +44,7 @@ export:: $(export-preqs)
-DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \
-DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \
-DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \
-DMOZ_SYSTEM_PNG=$(MOZ_SYSTEM_PNG) \
-DMOZ_SYSTEM_JPEG=$(MOZ_SYSTEM_JPEG) \
-DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \
-DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \
-DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \
$(srcdir)/system-headers $(srcdir)/stl-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
$(INSTALL) system_wrappers $(DIST)
+10 -12
View File
@@ -6,16 +6,14 @@
Library('icu')
if CONFIG['MOZ_SYSTEM_ICU']:
OS_LIBS += CONFIG['MOZ_ICU_LIBS']
DIRS += [
'common',
'data',
'i18n',
]
if CONFIG['MOZ_ICU_DATA_ARCHIVE']:
DIRS += ['stubdata']
USE_LIBS += ['icustubdata']
else:
DIRS += [
'common',
'data',
'i18n',
]
if CONFIG['MOZ_ICU_DATA_ARCHIVE']:
DIRS += ['stubdata']
USE_LIBS += ['icustubdata']
else:
USE_LIBS += ['icudata']
USE_LIBS += ['icudata']
+4 -8
View File
@@ -6,10 +6,8 @@
external_dirs = []
DIRS += [
'lgpllibs',
'sqlite',
]
DIRS += ['lgpllibs']
if not CONFIG['MOZ_SYSTEM_JPEG']:
external_dirs += ['media/libjpeg']
@@ -30,14 +28,12 @@ if CONFIG['MOZ_TREMOR']:
if CONFIG['MOZ_WEBM_ENCODER']:
external_dirs += ['media/libmkv']
if not CONFIG['MOZ_SYSTEM_LIBVPX']:
external_dirs += ['media/libvpx']
external_dirs += ['media/libvpx']
if CONFIG['MOZ_AV1']:
external_dirs += ['media/libaom']
if not CONFIG['MOZ_SYSTEM_PNG']:
external_dirs += ['media/libpng']
external_dirs += ['media/libpng']
external_dirs += ['media/libwebp']
+1 -10
View File
@@ -3,8 +3,6 @@
# 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 MOZ_SYSTEM_NSS
CC_WRAPPER =
CXX_WRAPPER =
@@ -121,15 +119,9 @@ DEFAULT_GMAKE_FLAGS += NSS_ENABLE_TLS_1_3=1
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib
endif
ifndef MOZ_SYSTEM_SQLITE
ifdef MOZ_FOLD_LIBS
DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3
else
DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3
DEFAULT_GMAKE_FLAGS += SQLITE_LIB_DIR=$(ABS_DIST)/../config/external/sqlite
endif # MOZ_FOLD_LIBS
DEFAULT_GMAKE_FLAGS += SQLITE_LIB_DIR=$(ABS_DIST)/../db/sqlite3/src
DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include
endif
ifdef NSS_DISABLE_DBM
DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1
endif
@@ -475,4 +467,3 @@ endif # MOZ_FOLD_LIBS
# security/nss/lib/ckfw/builtins. See bug #836220.
libs-nss/lib$(if $(MOZ_FOLD_LIBS),/ckfw): $(call mkdir_deps,$(DEPTH)/security/nss/lib/ckfw/builtins)
endif
+8 -11
View File
@@ -6,14 +6,11 @@
Library('crmf')
if CONFIG['MOZ_SYSTEM_NSS']:
OS_LIBS += [l for l in CONFIG['NSS_LIBS'] if l.startswith('-L')]
else:
USE_LIBS += [
# The dependency on nss is not real, but is required to force the
# parent directory being built before this one. This has no
# practical effect on linkage, since the only thing linking crmf
# will need nss anyways.
'nss',
'static:/security/nss/lib/crmf/crmf',
]
USE_LIBS += [
# The dependency on nss is not real, but is required to force the
# parent directory being built before this one. This has no
# practical effect on linkage, since the only thing linking crmf
# will need nss anyways.
'nss',
'static:/security/nss/lib/crmf/crmf',
]
+3 -5
View File
@@ -6,10 +6,7 @@
DIRS += ['crmf']
if CONFIG['MOZ_SYSTEM_NSS']:
Library('nss')
OS_LIBS += CONFIG['NSS_LIBS']
elif CONFIG['MOZ_FOLD_LIBS']:
if CONFIG['MOZ_FOLD_LIBS']:
GeckoSharedLibrary('nss', linkage=None)
# TODO: The library name can be changed when bug 845217 is fixed.
SHARED_LIBRARY_NAME = 'nss3'
@@ -32,9 +29,10 @@ else:
'/security/nss/lib/smime/smime3',
'/security/nss/lib/ssl/ssl3',
'/security/nss/lib/util/nssutil3',
'sqlite',
]
USE_LIBS += ['sqlite']
# XXX: We should fix these warnings.
ALLOW_COMPILER_WARNINGS = True
-1
View File
@@ -13,7 +13,6 @@
PR_*
PL_*
#endif
#include ../../../db/sqlite3/src/sqlite.symbols
ATOB_AsciiToData
ATOB_AsciiToData_Util
ATOB_ConvertAsciiToItem
-22
View File
@@ -1,22 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_SYSTEM_SQLITE']:
Library('sqlite')
OS_LIBS += CONFIG['SQLITE_LIBS']
else:
DIRS += ['../../../db/sqlite3/src']
if CONFIG['MOZ_FOLD_LIBS']:
Library('sqlite')
# When folding libraries, sqlite is actually in the nss library.
USE_LIBS += [
'nss',
]
else:
SharedLibrary('sqlite')
SHARED_LIBRARY_NAME = 'mozsqlite3'
SYMBOLS_FILE = '/db/sqlite3/src/sqlite.symbols'
+1 -1
View File
@@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
4.5.0
4.5.9
-3
View File
@@ -29,9 +29,6 @@ if CONFIG['HOST_OS_ARCH'] != 'WINNT':
# while the program here is in C.
HostProgram('nsinstall_real', c_only=True)
if CONFIG['MOZ_SYSTEM_ICU']:
DEFINES['MOZ_SYSTEM_ICU'] = True
PYTHON_UNIT_TESTS += [
'tests/test_mozbuild_reading.py',
'tests/unit-expandlibs.py',
+1 -1
View File
@@ -172,7 +172,7 @@ ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
mozglue/build/target memory/replace/logalloc/replay/target: memory/replace/dummy/target
endif
endif
ifeq (,$(MOZ_SYSTEM_NSPR)$(MOZ_SYSTEM_NSS)$(MOZ_FOLD_LIBS))
ifeq (,$(MOZ_FOLD_LIBS))
config/external/nss/target: config/external/nspr/pr/target config/external/nspr/ds/target config/external/nspr/libc/target
endif
# Most things are built during compile (target/host), but some things happen during export
-32
View File
@@ -1253,9 +1253,6 @@ soundtouch/SoundTouchFactory.h
#if MOZ_LIBAV_FFT==1
libavcodec/avfft.h
#endif
#if MOZ_SYSTEM_PNG==1
png.h
#endif
#if MOZ_SYSTEM_ZLIB==1
zlib.h
#endif
@@ -1276,11 +1273,7 @@ bzlib.h
#ifdef MOZ_ENABLE_GIO
gio/gio.h
#endif
#if MOZ_SYSTEM_LIBEVENT==1
event.h
#else
sys/event.h
#endif
#ifdef MOZ_ENABLE_LIBPROXY
proxy.h
#endif
@@ -1295,15 +1288,6 @@ QtSparql/qsparqlresult.h
#if MOZ_TREE_PIXMAN!=1
pixman.h
#endif
#if MOZ_SYSTEM_LIBVPX==1
vpx/svc_context.h
vpx/vpx_codec.h
vpx/vpx_decoder.h
vpx/vpx_encoder.h
vpx/vp8cx.h
vpx/vp8dx.h
vpx_mem/vpx_mem.h
#endif
gst/gst.h
gst/app/gstappsink.h
gst/app/gstappsrc.h
@@ -1316,22 +1300,6 @@ kvm.h
spawn.h
err.h
xlocale.h
#ifdef MOZ_SYSTEM_ICU
unicode/locid.h
unicode/numsys.h
unicode/timezone.h
unicode/ucal.h
unicode/uchar.h
unicode/uclean.h
unicode/ucol.h
unicode/udat.h
unicode/udatpg.h
unicode/uenum.h
unicode/unorm.h
unicode/unum.h
unicode/ustring.h
unicode/utypes.h
#endif
libutil.h
unwind.h
fenv.h
+5 -5
View File
@@ -93,7 +93,7 @@ if (!defined($official)) {$official="";}
if (!defined($milestone)) {$milestone="";}
if (!defined($module)) {$module="";}
if (!defined($binary)) {$binary="";}
if (!defined($displayname)) {$displayname="Mozilla";}
if (!defined($displayname)) {$displayname="UXP";}
if (!defined($appversion)) {$appversion=$milestone;}
if (!defined($depth)) {$depth=".";}
if (!defined($rcinclude)) {$rcinclude="";}
@@ -234,10 +234,10 @@ for ($j = 1; $j < 4; $j++)
}
my $winappversion = "$appver[0],$appver[1],$appver[2],$appver[3]";
my $copyright = "License: MPL 2";
my $company = "Mozilla Foundation";
my $trademarks = "Mozilla";
my $productname = $displayname;
my $copyright = "License: MPL 2.0";
my $company = "Moonchild Productions";
my $trademarks = "Moonchild";
my $productname = "UXP";
if (defined($override_comment)){$override_comment =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $comment=$override_comment;}
+5 -6
View File
@@ -3,9 +3,8 @@
# 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/.
if not CONFIG['NSS_DISABLE_DBM'] and CONFIG['MOZ_MORK']:
DIRS += [
'public',
'src',
'build',
]
DIRS += [
'public',
'src',
'build',
]
-11
View File
@@ -1,11 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['NSS_DISABLE_DBM'] and CONFIG['MOZ_MORK']:
DIRS += [
'mork/public',
'mork/src',
'mork/build',
]
+12 -23
View File
@@ -3,25 +3,18 @@
# 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/.
NO_VISIBILITY_FLAGS = True
EXPORTS += [
'sqlite3.h',
]
NO_VISIBILITY_FLAGS = True
# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True
if CONFIG['MOZ_FOLD_LIBS']:
# When folding libraries, sqlite is actually in the nss library.
FINAL_LIBRARY = 'nss'
else:
# The final library is in config/external/sqlite
FINAL_LIBRARY = 'sqlite'
GeckoSharedLibrary('sqlite', linkage=None, mozglue='library')
SHARED_LIBRARY_NAME = 'mozsqlite3'
SYMBOLS_FILE = 'sqlite.symbols'
SOURCES += [
'sqlite3.c',
]
EXPORTS += ['sqlite3.h']
SOURCES += ['sqlite3.c']
# -DSQLITE_SECURE_DELETE=1 will cause SQLITE to 0-fill delete data so we
# don't have to vacuum to make sure the data is not visible in the file.
@@ -34,8 +27,11 @@ SOURCES += [
# hidden preference. If that preference is missing or invalid then this value
# will be used.
# Note: Be sure to update the configure.in checks when these change!
for var in ('SQLITE_SECURE_DELETE', 'SQLITE_THREADSAFE', 'SQLITE_CORE',
'SQLITE_ENABLE_FTS3', 'SQLITE_ENABLE_UNLOCK_NOTIFY',
for var in ('SQLITE_SECURE_DELETE',
'SQLITE_THREADSAFE',
'SQLITE_CORE',
'SQLITE_ENABLE_FTS3',
'SQLITE_ENABLE_UNLOCK_NOTIFY',
'SQLITE_ENABLE_DBSTAT_VTAB'):
DEFINES[var] = 1
@@ -67,10 +63,6 @@ if CONFIG['MOZ_DEBUG']:
DEFINES['SQLITE_DEBUG'] = 1
DEFINES['SQLITE_ENABLE_API_ARMOR'] = True
if CONFIG['OS_TARGET'] == 'Android':
# default to user readable only to fit Android security model
DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600'
# Force using malloc_usable_size when building with jemalloc because _msize
# causes assertions on Win64. See bug 719579.
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
@@ -86,10 +78,7 @@ DEFINES['SQLITE_OMIT_DECLTYPE'] = True
# performance and doesn't suffer from a full separate tmp partition.
# Exclude 32bit platforms due to address space fragmentation issues.
# System Sqlite is managed through a PRAGMA instead.
if CONFIG['OS_TARGET'] == 'Android':
# On Android there's no tmp partition, so always use a MEMORY temp store.
DEFINES['SQLITE_TEMP_STORE'] = 3
elif CONFIG['HAVE_64BIT_BUILD']:
if CONFIG['HAVE_64BIT_BUILD']:
# On 64bit platforms default to a MEMORY temp store for performance.
DEFINES['SQLITE_TEMP_STORE'] = 2
+1 -1
View File
@@ -9828,7 +9828,7 @@ var Debugger =
var host = httpActivity.hostname;
info.hsts = sss.isSecureHost(sss.HEADER_HSTS, host, flags);
info.hpkp = sss.isSecureHost(sss.HEADER_HPKP, host, flags);
info.hpkp = false;
} else {
DevToolsUtils.reportException("NetworkHelper.parseSecurityInfo", "Could not get HSTS/HPKP status as hostname is not available.");
info.hsts = false;
+25 -13
View File
@@ -58,9 +58,21 @@ const Curl = {
* A cURL command.
*/
generateCommand: function (data) {
let utils = CurlUtils;
const utils = CurlUtils;
let command = ["curl"];
// Make sure to use the following helpers to sanitize arguments before execution.
const addParam = value => {
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
command.push(safe);
};
const addPostData = value => {
const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value);
postData.push(safe);
};
let ignoredHeaders = new Set();
// The cURL command is expected to run on the same platform that Firefox runs
@@ -69,7 +81,7 @@ const Curl = {
utils.escapeStringWin : utils.escapeStringPosix;
// Add URL.
command.push(escapeString(data.url));
addParam(data.url);
let postDataText = null;
let multipartRequest = utils.isMultipartRequest(data);
@@ -79,15 +91,15 @@ const Curl = {
if (utils.isUrlEncodedRequest(data) ||
["PUT", "POST", "PATCH"].includes(data.method)) {
postDataText = data.postDataText;
postData.push("--data");
postData.push(escapeString(utils.writePostDataTextParams(postDataText)));
addPostData("--data");
addPostData(utils.writePostDataTextParams(postDataText));
ignoredHeaders.add("content-length");
} else if (multipartRequest) {
postDataText = data.postDataText;
postData.push("--data-binary");
addPostData("--data-binary");
let boundary = utils.getMultipartBoundary(data);
let text = utils.removeBinaryDataFromMultipartText(postDataText, boundary);
postData.push(escapeString(text));
addPostData(text);
ignoredHeaders.add("content-length");
}
@@ -95,15 +107,15 @@ const Curl = {
// For GET and POST requests this is not necessary as GET is the
// default. If --data or --binary is added POST is the default.
if (!(data.method == "GET" || data.method == "POST")) {
command.push("-X");
command.push(data.method);
addParam("-X");
addParam(data.method);
}
// Add -I (HEAD)
// For servers that supports HEAD.
// This will fetch the header of a document only.
if (data.method == "HEAD") {
command.push("-I");
addParam("-I");
}
// Add http version.
@@ -114,7 +126,7 @@ const Curl = {
// data.httpVersion are HTTP/1.0, HTTP/1.1 and HTTP/2.0
// So in case of HTTP/2.0 (which should ideally be HTTP/2) we are using
// only major version, and full version in other cases
command.push("--http" + (version == "2.0" ? version.split(".")[0] : version));
addParam("--http" + (version == "2.0" ? version.split(".")[0] : version));
}
// Add request headers.
@@ -126,14 +138,14 @@ const Curl = {
for (let i = 0; i < headers.length; i++) {
let header = headers[i];
if (header.name.toLowerCase() === "accept-encoding") {
command.push("--compressed");
addParam("--compressed");
continue;
}
if (ignoredHeaders.has(header.name.toLowerCase())) {
continue;
}
command.push("-H");
command.push(escapeString(header.name + ": " + header.value));
addParam("-H");
addParam(header.name + ": " + header.value);
}
// Add post data.
-1
View File
@@ -14,7 +14,6 @@
a {
-moz-user-focus: normal;
-moz-user-input: enabled;
cursor: pointer;
text-decoration: underline;
}
+5 -11
View File
@@ -4,20 +4,14 @@
# 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/.
DIRS += [
'server',
'shared',
]
if CONFIG['MOZ_DEVTOOLS']:
DIRS += ['client']
if CONFIG['MOZ_DEVTOOLS_SERVER']:
DIRS += [
'server',
'shared',
]
else:
DIRS += [
'shared/heapsnapshot',
'shared/jsinspector',
]
# /browser uses DIST_SUBDIR. We opt-in to this treatment when building
# DevTools for the browser to keep the root omni.ja slim for use by external XUL
# apps. Mulet also uses this since it includes /browser.
@@ -1440,8 +1440,6 @@ exports.CSS_PROPERTIES = {
"supports": [],
"values": [
"auto",
"disabled",
"enabled",
"inherit",
"initial",
"none",
+9 -57
View File
@@ -4,60 +4,12 @@
# 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/.
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Memory')
if CONFIG['ENABLE_TESTS']:
DIRS += ['tests/gtest']
XPCSHELL_TESTS_MANIFESTS += [ 'tests/unit/xpcshell.ini' ]
MOCHITEST_MANIFESTS += [ 'tests/mochitest/mochitest.ini' ]
MOCHITEST_CHROME_MANIFESTS += [ 'tests/mochitest/chrome.ini' ]
EXPORTS.mozilla.devtools += [
'AutoMemMap.h',
'CoreDump.pb.h',
'DeserializedNode.h',
'DominatorTree.h',
'FileDescriptorOutputStream.h',
'HeapSnapshot.h',
'HeapSnapshotTempFileHelperChild.h',
'HeapSnapshotTempFileHelperParent.h',
'ZeroCopyNSIOutputStream.h',
]
IPDL_SOURCES += [
'PHeapSnapshotTempFileHelper.ipdl',
]
include('/ipc/chromium/chromium-config.mozbuild')
SOURCES += [
'AutoMemMap.cpp',
'CoreDump.pb.cc',
'DeserializedNode.cpp',
'DominatorTree.cpp',
'FileDescriptorOutputStream.cpp',
'HeapSnapshot.cpp',
'HeapSnapshotTempFileHelperParent.cpp',
'ZeroCopyNSIOutputStream.cpp',
]
# Disable RTTI in google protocol buffer
DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_DEVTOOLS_SERVER']:
DevToolsModules(
'census-tree-node.js',
'CensusUtils.js',
'DominatorTreeNode.js',
'HeapAnalysesClient.js',
'HeapAnalysesWorker.js',
'HeapSnapshotFileUtils.js',
'shortest-paths.js',
)
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']
DevToolsModules(
'census-tree-node.js',
'CensusUtils.js',
'DominatorTreeNode.js',
'HeapAnalysesClient.js',
'HeapAnalysesWorker.js',
'HeapSnapshotFileUtils.js',
'shortest-paths.js',
)
-1
View File
@@ -17,7 +17,6 @@ DIRS += [
'heapsnapshot',
'inspector',
'jsbeautify',
'jsinspector',
'layout',
'locales',
'node-properties',
+2 -1
View File
@@ -668,7 +668,8 @@ var NetworkHelper = {
let host = httpActivity.hostname;
info.hsts = sss.isSecureHost(sss.HEADER_HSTS, host, flags);
info.hpkp = sss.isSecureHost(sss.HEADER_HPKP, host, flags);
// HPKP is no longer supported.
info.hpkp = false;
} else {
DevToolsUtils.reportException("NetworkHelper.parseSecurityInfo",
"Could not get HSTS/HPKP status as hostname is not available.");
@@ -0,0 +1,63 @@
# Updating HTML5 parser code
Our html5 parser is based on the java html5 parser from [Validator.nu](http://about.validator.nu/htmlparser/) by Henri Sivonen. It has been adopted by Mozilla and further updated, and has been imported as a whole into the UXP tree to have an independent and maintainable source of it that doesn't rely on external sources.
## Stages
Updating the parser code consists of 3 stages:
- Make updates to the html parser source in java
- Let the java parser regenerate part of its own code after the change
- Translate the java source to C++
This process was best explained in the [following Bugzilla comment](https://bugzilla.mozilla.org/show_bug.cgi?id=1378079#c6), which explain how to add a new attribute name ("is") to html5, inserted in this document for convenience:
>> Is
>> there any documentation on how to add a new nsHtml5AttributeName?
>
> I don't recall. I should get around to writing it.
>
>> Looks like
>> I need to clone hg.mozilla.org/projects/htmlparser/ and generate a hash with
>> it?
>
> Yes. Here's how:
>
> `cd parser/html/java/`
> `make sync`
>
> Now you have a clone of [https://hg.mozilla.org/projects/htmlparser/](https://hg.mozilla.org/projects/htmlparser/) in > parser/html/java/htmlparser/
>
> `cd htmlparser/src/`
> `$EDITOR nu/validator/htmlparser/impl/AttributeName.java`
>
> Search for the word "uncomment" and uncomment stuff according to the two comments that talk about uncommenting
> Duplicate the declaration a normal attribute (nothings special in SVG mode, etc.). Let's use "alt", since it's the first one.
> In the duplicate, replace ALT with IS and "alt" with "is".
> Search for "ALT,", duplicate that line and change the duplicate to say "IS,"
> Save.
>
> `javac nu/validator/htmlparser/impl/AttributeName.java`
> `java nu.validator.htmlparser.impl.AttributeName`
>
> Copy and paste the output into nu/validator/htmlparser/impl/AttributeName.java replacing the text below the comment "START GENERATED CODE" and above the very last "}".
> Recomment the bits that you uncommented earlier.
> Save.
>
> `cd ../..` - Back to parser/html/java/
> `make translate`
## Organizing commits
**The html5 parser code is fragile due to its generation and translation before being used as C++ in our tree. Do not touch or commit anything without a code peer nearby with knowledge of the parser and the commit process (at this moment that means Gaming4JC (@g4jc)), and communicate the changes thoroughly.**
To organize this properly in our repo, commits should be split up when making these kinds of changes:
1. Commit your code edits to the html parser
2. Regenerate java into a translation-ready source
3. Commit
4. Translate and regenerate C++ code
5. Check a build to make sure the changes have the intended result
6. Commit
This is needed because the source edit will sometimes be in parts that are self-generated and may otherwise be lost in generation noise, and because we want to keep a strict separation between commits resulting from developer work and those resulting from running scripts/automated processes.
+253 -11
View File
@@ -1,4 +1,4 @@
# UXP Coding Style Guide
# UXP Coding Style Guide
While our source tree is currently in a number of different Coding Styles and the general rule applies to adhere to style of surrounding code when you are making changes, it is our goal to unify the style of our source tree and making it adhere to a single style.
This document describes the preferred style for new source code files and the preferred style to convert existing files to.
@@ -11,9 +11,9 @@ Our own managed and maintained code should adhere to this guide where possible o
## General formatting rules
The following formatting rules apply to all code:
- Always use spaces for indentation, never use tabs!
- Put a space between a keyword and parenthesis, e.g. `if (`.
- Put a space between a keyword and parenthesis, e.g. `if (`. Do _not_ put a space between a function/type-assignment name and its parenthesis, e.g. `function(somevar)` or `int32_t(somevar)`.
- Put a space between variables and operators, e.g. `a == b`.
- Put a space after a comma or semicolon in variable lists, e.g. `function (a, b, c)` or `for (i = 1; i < 10; i++)`.
- Put a space after a comma or semicolon in variable lists, e.g. `function(a, b, c)` or `for (i = 1; i < 10; i++)`.
- Indentation of scopes is 2 spaces.
- Indentation of long lines is variable-aligned or expression-aligned (see "long line wrapping")
- Conditional defines are always placed on column 1. This is also true for nested defines.
@@ -225,15 +225,257 @@ somelongvariable = somelongexpression ?
## JavaScript
Applies to `*.js` and `*.jsm`.
### General formatting guidelines
- Place function signatures on the same line as js object identifiers, and do not use named function syntax in that case:
```JavaScript
var myObject = {
myIdentifier: function(var1, var2) {
...
},
myIdentifier2: function() {
...
}
}
```
- Variable initializers should be placed on the variable declaration line if needed.
```JavaScript
var fwdCommand = document.getElementById("Browser:Forward");
```
```JavaScript
var myObject = {
myVariable: null,
myString: "Something"
}
```
- Avoid placing executed code on the expression line. Preferably brace executed code.
WRONG:
```JavaScript
if (a == b) do_something();
if (a == b) { do_something(); }
```
DISCOURAGED:
```JavaScript
if (a == b)
do_something();
```
CORRECT:
```JavaScript
if (a == b) {
do_something();
}
```
- Format in-lined variable functions as if you would format normal functions with the exception of closure: break with the opening brace, followed by code, and closing brace on its own line, followed immediately by any other variables passed in-line.
```JavaScript
appMenuButton.addEventListener("mousedown", function(event) {
if (event.button == 0) {
appMenuOpening = new Date();
}
}, false);
```
- Use a single space between `{` `}` braces in empty js objects.
### Flow control
Flow control expressions should follow the following guidelines:
- Scopes have their opening braces on the expression line
- Scopes have their closing braces on a separate line, indent-aligned with the flow control expression
- Any alternative flow control paths are generally started with an expression on the closing brace line. The logic behind this is that you should keep the flow control level visually the same for the executed code blocks with no breaks (a closing brace on its own line means "done").
- Case statements are indented by 2 on a new line with the case expression on its own line.
- Flow control default scopes are always placed at the bottom.
#### if..else
`if..else` statements example:
```JavaScript
if (something == somethingelse) {
true_case_code here;
} else {
false_case_code here;
}
if (case1) {
case1_code here;
} else if (case2) {
case2_code here;
} else {
other_case_code here;
}
if (case1) {
case1_code here;
} else {
if (case2) {
case2_code here;
}
case2_and_other_code here;
}
```
#### for
`for` loop example:
```JavaScript
for (let i = 1; i < max; i++) {
loop_code here;
}
for (let i = 0;; i++) {
do_something_with(i);
if (i > max) break;
...
}
```
#### while
`while` loop example:
```JavaScript
while (something == true) {
loop_code here;
}
do {
execute_me_at_least_once();
...
} while (something == true);
```
#### switch..case
`switch..case` flow control example:
```JavaScript
switch (variable) {
case value1:
// Comment describing 1
code_for_1;
code_for_1;
break;
case value2:
code_for_2;
code_for_2;
// fallthrough
case value3:
case value4:
code_for_3_and_4;
break;
default:
code_for_default;
code_for_default;
}
```
Alternatively (braced):
```JavaScript
switch (variable) {
case value1: {
// Comment describing 1
code_for_1;
code_for_1;
break;
}
case value2: {
code_for_2;
code_for_2;
// fallthrough
}
case value3:
case value4: {
code_for_3_and_4;
break;
}
default: {
code_for_default;
code_for_default;
}
}
```
#### try..catch
- When using `try..catch` blocks, the use of optional catch binding is discouraged. Please always include the error variable.
`try..catch` flow control examples:
```JavaScript
try {
do_something();
} catch(e) {
handle_error(e);
} finally {
always();
}
try {
do_something();
} catch(e) {
}
try {
do_something();
} finally {
always();
}
```
DISCOURAGED
```JavaScript
try {
do_something();
} catch {
// No error processing
do_something_else();
}
// No closing brace on its own line
try {
do_something();
} catch(ex) { }
```
### Long line wrapping
If statements on a single line become overly long, they should be split into multiple lines:
- Binary operators (including ternary) must be left on their original lines if the line break happens around the operator. The second line should start in the same column as the start of the expression in the first line.
- Lists of variables (e.g. when calling or declaring a function) should be split at the wrapping column.
- Long OOP calls should be split at the period with the period on the start of the new line, indented to the column of the first object, filling to the wrapping column where possible, including additional terms.
- When breaking assignments/operations/logic, break right after the operator (`=`, `+`, `&&`, `||`, etc.)
- **Don't break too rigorously**; short additions should be kept on the same line to keep things legible - use common sense and context for flexibility.
WRONG:
```JavaScript
somelongobjectname.somelongfunction(
var1, var2, var3, var4, var5);
if (somelongvariable == somelongothervariable
|| somelongvariable2 == somelongothervariable2) {
somelongvariable = somelongexpression ? somevalue1
: somevalue2;
var iShouldntBeUsingThisLongOfAVarName
= someValueToAdd + someValueToAdd + someValueToAdd
+ someValueToAdd;
Cu.import("resource:///modules/DownloadsCommon.jsm", {}).
DownloadsCommon.initializeAllDataLinks();
```
CORRECT:
```JavaScript
somelongobjectname.somelongfunction(var1, var2, var3,
var4, var5);
if (somelongvariable == somelongothervariable ||
somelongvariable2 == somelongothervariable2) {
somelongvariable = somelongexpression ?
somevalue1 :
somevalue2;
var iShouldntBeUsingThisLongOfAVarName =
someValueToAdd + someValueToAdd + someValueToAdd +
someValueToAdd;
Cu.import("resource:///modules/DownloadsCommon.jsm", {})
.DownloadsCommon.initializeAllDataLinks();
let sessionStartup = Cc["@mozilla.org/browser/sessionstartup;1"]
.getService(Ci.nsISessionStartup);
```
## XUL and other XML-derivatives
Applies to `*.xul`, `*.html`, `*.xhtml`.
TODO
## IDL
Applies to `*.idl`, `*.xpidl` and `*.webidl`.
<!--stackedit_data:
eyJoaXN0b3J5IjpbMjUzODYzMzMsMjg5MjUwODIsLTQzMjMzNz
ExMSw4MzQ2MjYwNDksLTE5MDMyNzE5OTYsLTEwMTIwMjc3ODMs
LTE4MzgzODM5MDIsODA5MjEzNTEyLC01Mzg0MjM4MDAsMzgyNj
I3NDYzLDIwODYwMjIwODUsLTE1MjU5MjE2MjIsLTY1OTMzMTA0
MCwtNzQwOTE5MDQ1LDE4Njc1NTQxNDJdfQ==
-->
TODO
## Python-esque
Applies to `*.py`, `mozbuild` etc.
TODO
-2
View File
@@ -119,12 +119,10 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT
},
#ifndef ANDROID
{
"profiles", "chrome://global/content/aboutProfiles.xhtml",
nsIAboutModule::ALLOW_SCRIPT
},
#endif
// about:srcdoc is unresolvable by specification. It is included here
// because the security manager would disallow srcdoc iframes otherwise.
{
+5 -29
View File
@@ -4943,13 +4943,11 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
if (errorClass == nsINSSErrorsService::ERROR_CLASS_BAD_CERT) {
error.AssignLiteral("nssBadCert");
// If this is an HTTP Strict Transport Security host or a pinned host
// and the certificate is bad, don't allow overrides (RFC 6797 section
// 12.1, HPKP draft spec section 2.6).
// If this is an HTTP Strict Transport Security host, don't allow
// overrides (RFC 6797 section 12.1).
uint32_t flags =
UsePrivateBrowsing() ? nsISocketProvider::NO_PERMANENT_STORAGE : 0;
bool isStsHost = false;
bool isPinnedHost = false;
if (XRE_IsParentProcess()) {
nsCOMPtr<nsISiteSecurityService> sss =
do_GetService(NS_SSSERVICE_CONTRACTID, &rv);
@@ -4957,9 +4955,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
rv = sss->IsSecureURI(nsISiteSecurityService::HEADER_HSTS, aURI,
flags, nullptr, &isStsHost);
NS_ENSURE_SUCCESS(rv, rv);
rv = sss->IsSecureURI(nsISiteSecurityService::HEADER_HPKP, aURI,
flags, nullptr, &isPinnedHost);
NS_ENSURE_SUCCESS(rv, rv);
} else {
mozilla::dom::ContentChild* cc =
mozilla::dom::ContentChild::GetSingleton();
@@ -4967,8 +4962,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
SerializeURI(aURI, uri);
cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HSTS, uri, flags,
&isStsHost);
cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HPKP, uri, flags,
&isPinnedHost);
}
if (Preferences::GetBool(
@@ -4976,11 +4969,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
cssClass.AssignLiteral("expertBadCert");
}
// HSTS/pinning takes precedence over the expert bad cert pref. We
// HSTS takes precedence over the expert bad cert pref. We
// never want to show the "Add Exception" button for these sites.
// In the future we should differentiate between an HSTS host and a
// pinned host and display a more informative message to the user.
if (isStsHost || isPinnedHost) {
if (isStsHost) {
cssClass.AssignLiteral("badStsCert");
}
@@ -13356,24 +13347,9 @@ nsDocShell::EnsureScriptEnvironment()
uint32_t chromeFlags;
browserChrome->GetChromeFlags(&chromeFlags);
bool isModalContentWindow =
(mItemType == typeContent) &&
(chromeFlags & nsIWebBrowserChrome::CHROME_MODAL_CONTENT_WINDOW);
// There can be various other content docshells associated with the
// top-level window, like sidebars. Make sure that we only create an
// nsGlobalModalWindow for the primary content shell.
if (isModalContentWindow) {
nsCOMPtr<nsIDocShellTreeItem> primaryItem;
nsresult rv =
mTreeOwner->GetPrimaryContentShell(getter_AddRefs(primaryItem));
NS_ENSURE_SUCCESS(rv, rv);
isModalContentWindow = (primaryItem == this);
}
// If our window is modal and we're not opened as chrome, make
// this window a modal content window.
mScriptGlobal =
NS_NewScriptGlobalObject(mItemType == typeChrome, isModalContentWindow);
mScriptGlobal = NS_NewScriptGlobalObject(mItemType == typeChrome);
MOZ_ASSERT(mScriptGlobal);
mScriptGlobal->SetDocShell(this);
-22
View File
@@ -25,10 +25,6 @@
#ifdef MOZ_ENABLE_DBUS
#include "nsDBusHandlerApp.h"
#endif
#if defined(MOZ_WIDGET_ANDROID)
#include "nsExternalSharingAppService.h"
#include "nsExternalURLHandlerService.h"
#endif
// session history
#include "nsSHEntry.h"
@@ -85,10 +81,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
#ifdef MOZ_ENABLE_DBUS
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp)
#endif
#if defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ContentHandlerService, Init)
// session history
@@ -114,10 +106,6 @@ NS_DEFINE_NAMED_CID(NS_LOCALHANDLERAPP_CID);
#ifdef MOZ_ENABLE_DBUS
NS_DEFINE_NAMED_CID(NS_DBUSHANDLERAPP_CID);
#endif
#if defined(MOZ_WIDGET_ANDROID)
NS_DEFINE_NAMED_CID(NS_EXTERNALSHARINGAPPSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_EXTERNALURLHANDLERSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_SHENTRY_CID);
NS_DEFINE_NAMED_CID(NS_SHTRANSACTION_CID);
NS_DEFINE_NAMED_CID(NS_SHISTORY_CID);
@@ -142,10 +130,6 @@ const mozilla::Module::CIDEntry kDocShellCIDs[] = {
{ &kNS_LOCALHANDLERAPP_CID, false, nullptr, PlatformLocalHandlerApp_tConstructor },
#ifdef MOZ_ENABLE_DBUS
{ &kNS_DBUSHANDLERAPP_CID, false, nullptr, nsDBusHandlerAppConstructor },
#endif
#if defined(MOZ_WIDGET_ANDROID)
{ &kNS_EXTERNALSHARINGAPPSERVICE_CID, false, nullptr, nsExternalSharingAppServiceConstructor },
{ &kNS_EXTERNALURLHANDLERSERVICE_CID, false, nullptr, nsExternalURLHandlerServiceConstructor },
#endif
{ &kNS_SHENTRY_CID, false, nullptr, nsSHEntryConstructor },
{ &kNS_SHTRANSACTION_CID, false, nullptr, nsSHTransactionConstructor },
@@ -183,9 +167,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "performance", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "serviceworkers", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifndef ANDROID
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "profiles", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "srcdoc", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "telemetry", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
@@ -205,10 +187,6 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ NS_LOCALHANDLERAPP_CONTRACTID, &kNS_LOCALHANDLERAPP_CID },
#ifdef MOZ_ENABLE_DBUS
{ NS_DBUSHANDLERAPP_CONTRACTID, &kNS_DBUSHANDLERAPP_CID },
#endif
#if defined(MOZ_WIDGET_ANDROID)
{ NS_EXTERNALSHARINGAPPSERVICE_CONTRACTID, &kNS_EXTERNALSHARINGAPPSERVICE_CID },
{ NS_EXTERNALURLHANDLERSERVICE_CONTRACTID, &kNS_EXTERNALURLHANDLERSERVICE_CID },
#endif
{ NS_SHENTRY_CONTRACTID, &kNS_SHENTRY_CID },
{ NS_SHTRANSACTION_CONTRACTID, &kNS_SHTRANSACTION_CID },
File diff suppressed because it is too large. Load diff
+364 -63
View File
@@ -7,13 +7,16 @@
#ifndef mozilla_dom_CustomElementRegistry_h
#define mozilla_dom_CustomElementRegistry_h
#include "js/GCHashTable.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsGenericHTMLElement.h"
#include "nsWrapperCache.h"
class nsDocument;
@@ -22,8 +25,8 @@ namespace dom {
struct CustomElementData;
struct ElementDefinitionOptions;
struct LifecycleCallbacks;
class CallbackFunction;
class CustomElementReaction;
class Function;
class Promise;
@@ -32,6 +35,13 @@ struct LifecycleCallbackArgs
nsString name;
nsString oldValue;
nsString newValue;
nsString namespaceURI;
};
struct LifecycleAdoptedCallbackArgs
{
nsCOMPtr<nsIDocument> mOldDocument;
nsCOMPtr<nsIDocument> mNewDocument;
};
class CustomElementCallback
@@ -39,8 +49,7 @@ class CustomElementCallback
public:
CustomElementCallback(Element* aThisObject,
nsIDocument::ElementCallbackType aCallbackType,
CallbackFunction* aCallback,
CustomElementData* aOwnerData);
CallbackFunction* aCallback);
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
void Call();
void SetArgs(LifecycleCallbackArgs& aArgs)
@@ -50,6 +59,13 @@ public:
mArgs = aArgs;
}
void SetAdoptedCallbackArgs(LifecycleAdoptedCallbackArgs& aAdoptedCallbackArgs)
{
MOZ_ASSERT(mType == nsIDocument::eAdopted,
"Arguments are only used by adopted callback.");
mAdoptedCallbackArgs = aAdoptedCallbackArgs;
}
private:
// The this value to use for invocation of the callback.
RefPtr<Element> mThisObject;
@@ -59,9 +75,19 @@ private:
// Arguments to be passed to the callback,
// used by the attribute changed callback.
LifecycleCallbackArgs mArgs;
// CustomElementData that contains this callback in the
// callback queue.
CustomElementData* mOwnerData;
LifecycleAdoptedCallbackArgs mAdoptedCallbackArgs;
};
class CustomElementConstructor final : public CallbackFunction
{
public:
explicit CustomElementConstructor(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
MOZ_ASSERT(JS::IsConstructor(mCallback));
}
already_AddRefed<Element> Construct(const char* aExecutionReason, ErrorResult& aRv);
};
// Each custom element has an associated callback queue and an element is
@@ -70,63 +96,299 @@ struct CustomElementData
{
NS_INLINE_DECL_REFCOUNTING(CustomElementData)
explicit CustomElementData(nsIAtom* aType);
// Objects in this array are transient and empty after each microtask
// checkpoint.
nsTArray<nsAutoPtr<CustomElementCallback>> mCallbackQueue;
// Custom element type, for <button is="x-button"> or <x-button>
// this would be x-button.
nsCOMPtr<nsIAtom> mType;
// The callback that is next to be processed upon calling RunCallbackQueue.
int32_t mCurrentCallback;
// Element is being created flag as described in the custom elements spec.
bool mElementIsBeingCreated;
// Flag to determine if the created callback has been invoked, thus it
// determines if other callbacks can be enqueued.
bool mCreatedCallbackInvoked;
// The microtask level associated with the callbacks in the callback queue,
// it is used to determine if a new queue needs to be pushed onto the
// processing stack.
int32_t mAssociatedMicroTask;
// https://dom.spec.whatwg.org/#concept-element-custom-element-state
// CustomElementData is only created on the element which is a custom element
// or an upgrade candidate, so the state of an element without
// CustomElementData is "uncustomized".
enum class State {
eUndefined,
eFailed,
eCustom
};
// Empties the callback queue.
void RunCallbackQueue();
explicit CustomElementData(nsIAtom* aType);
CustomElementData(nsIAtom* aType, State aState);
// Custom element state as described in the custom element spec.
State mState;
// custom element reaction queue as described in the custom element spec.
// There is 1 reaction in reaction queue, when 1) it becomes disconnected,
// 2) it’s adopted into a new document, 3) its attributes are changed,
// appended, removed, or replaced.
// There are 3 reactions in reaction queue when doing upgrade operation,
// e.g., create an element, insert a node.
AutoTArray<UniquePtr<CustomElementReaction>, 3> mReactionQueue;
void SetCustomElementDefinition(CustomElementDefinition* aDefinition);
CustomElementDefinition* GetCustomElementDefinition();
nsIAtom* GetCustomElementType();
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
void Unlink();
private:
virtual ~CustomElementData() {}
// Custom element type, for <button is="x-button"> or <x-button>
// this would be x-button.
RefPtr<nsIAtom> mType;
RefPtr<CustomElementDefinition> mCustomElementDefinition;
};
#define ALEADY_CONSTRUCTED_MARKER nullptr
// The required information for a custom element as defined in:
// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-definition
struct CustomElementDefinition
{
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CustomElementDefinition)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CustomElementDefinition)
CustomElementDefinition(nsIAtom* aType,
nsIAtom* aLocalName,
JSObject* aConstructor,
Function* aConstructor,
nsCOMArray<nsIAtom>&& aObservedAttributes,
JSObject* aPrototype,
mozilla::dom::LifecycleCallbacks* aCallbacks,
uint32_t aDocOrder);
// The type (name) for this custom element.
// The type (name) for this custom element, for <button is="x-foo"> or <x-foo>
// this would be x-foo.
nsCOMPtr<nsIAtom> mType;
// The localname to (e.g. <button is=type> -- this would be button).
nsCOMPtr<nsIAtom> mLocalName;
// The custom element constructor.
JS::Heap<JSObject *> mConstructor;
RefPtr<CustomElementConstructor> mConstructor;
// The list of attributes that this custom element observes.
nsCOMArray<nsIAtom> mObservedAttributes;
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
// The lifecycle callbacks to call for this custom element.
nsAutoPtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
UniquePtr<mozilla::dom::LifecycleCallbacks> mCallbacks;
// A construction stack.
// TODO: Bug 1287348 - Implement construction stack for upgrading an element
// A construction stack. Use nullptr to represent an "already constructed marker".
nsTArray<RefPtr<nsGenericHTMLElement>> mConstructionStack;
// The document custom element order.
uint32_t mDocOrder;
bool IsCustomBuiltIn()
{
return mType != mLocalName;
}
bool IsInObservedAttributeList(nsIAtom* aName)
{
if (mObservedAttributes.IsEmpty()) {
return false;
}
return mObservedAttributes.Contains(aName);
}
private:
~CustomElementDefinition() {}
};
class CustomElementReaction
{
public:
virtual ~CustomElementReaction() = default;
virtual void Invoke(Element* aElement, ErrorResult& aRv) = 0;
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const
{
}
#if DEBUG
bool IsUpgradeReaction()
{
return mIsUpgradeReaction;
}
protected:
bool mIsUpgradeReaction = false;
#endif
};
class CustomElementUpgradeReaction final : public CustomElementReaction
{
public:
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
: mDefinition(aDefinition)
{
#if DEBUG
mIsUpgradeReaction = true;
#endif
}
private:
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
CustomElementDefinition* mDefinition;
};
class CustomElementCallbackReaction final : public CustomElementReaction
{
public:
explicit CustomElementCallbackReaction(UniquePtr<CustomElementCallback> aCustomElementCallback)
: mCustomElementCallback(Move(aCustomElementCallback))
{
}
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const override
{
mCustomElementCallback->Traverse(aCb);
}
private:
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
UniquePtr<CustomElementCallback> mCustomElementCallback;
};
// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions-stack
class CustomElementReactionsStack
{
public:
NS_INLINE_DECL_REFCOUNTING(CustomElementReactionsStack)
CustomElementReactionsStack()
: mIsBackupQueueProcessing(false)
, mRecursionDepth(0)
, mIsElementQueuePushedForCurrentRecursionDepth(false)
{
}
// Hold a strong reference of Element so that it does not get cycle collected
// before the reactions in its reaction queue are invoked.
// The element reaction queues are stored in CustomElementData.
// We need to lookup ElementReactionQueueMap again to get relevant reaction queue.
// The choice of 1 for the auto size here is based on gut feeling.
typedef AutoTArray<RefPtr<Element>, 1> ElementQueue;
/**
* Enqueue a custom element upgrade reaction
* https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-upgrade-reaction
*/
void EnqueueUpgradeReaction(Element* aElement,
CustomElementDefinition* aDefinition);
/**
* Enqueue a custom element callback reaction
* https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction
*/
void EnqueueCallbackReaction(Element* aElement,
UniquePtr<CustomElementCallback> aCustomElementCallback);
/**
* [CEReactions] Before executing the algorithm's steps.
* Increase the current recursion depth, and the element queue is pushed
* lazily when we really enqueue reactions.
*
* @return true if the element queue is pushed for "previous" recursion depth.
*/
bool EnterCEReactions()
{
bool temp = mIsElementQueuePushedForCurrentRecursionDepth;
mRecursionDepth++;
// The is-element-queue-pushed flag is initially false when entering a new
// recursion level. The original value will be cached in AutoCEReaction
// and restored after leaving this recursion level.
mIsElementQueuePushedForCurrentRecursionDepth = false;
return temp;
}
/**
* [CEReactions] After executing the algorithm's steps.
* Pop and invoke the element queue if it is created and pushed for current
* recursion depth, then decrease the current recursion depth.
*
* @param aCx JSContext used for handling exception thrown by algorithm's
* steps, this could be a nullptr.
* aWasElementQueuePushed used for restoring status after leaving
* current recursion.
*/
void LeaveCEReactions(JSContext* aCx, bool aWasElementQueuePushed)
{
MOZ_ASSERT(mRecursionDepth);
if (mIsElementQueuePushedForCurrentRecursionDepth) {
Maybe<JS::AutoSaveExceptionState> ases;
if (aCx) {
ases.emplace(aCx);
}
PopAndInvokeElementQueue();
}
mRecursionDepth--;
// Restore the is-element-queue-pushed flag cached in AutoCEReaction when
// leaving the recursion level.
mIsElementQueuePushedForCurrentRecursionDepth = aWasElementQueuePushed;
MOZ_ASSERT_IF(!mRecursionDepth, mReactionsStack.IsEmpty());
}
private:
~CustomElementReactionsStack() {};
/**
* Push a new element queue onto the custom element reactions stack.
*/
void CreateAndPushElementQueue();
/**
* Pop the element queue from the custom element reactions stack, and invoke
* custom element reactions in that queue.
*/
void PopAndInvokeElementQueue();
// The choice of 8 for the auto size here is based on gut feeling.
AutoTArray<UniquePtr<ElementQueue>, 8> mReactionsStack;
ElementQueue mBackupQueue;
// https://html.spec.whatwg.org/#enqueue-an-element-on-the-appropriate-element-queue
bool mIsBackupQueueProcessing;
void InvokeBackupQueue();
/**
* Invoke custom element reactions
* https://html.spec.whatwg.org/multipage/scripting.html#invoke-custom-element-reactions
*/
void InvokeReactions(ElementQueue* aElementQueue, nsIGlobalObject* aGlobal);
void Enqueue(Element* aElement, CustomElementReaction* aReaction);
// Current [CEReactions] recursion depth.
uint32_t mRecursionDepth;
// True if the element queue is pushed into reaction stack for current
// recursion depth. This will be cached in AutoCEReaction when entering a new
// CEReaction recursion and restored after leaving the recursion.
bool mIsElementQueuePushedForCurrentRecursionDepth;
private:
class BackupQueueMicroTask final : public mozilla::MicroTaskRunnable {
public:
explicit BackupQueueMicroTask(CustomElementReactionsStack* aReactionStack)
: MicroTaskRunnable()
, mReactionStack(aReactionStack)
{
MOZ_ASSERT(!mReactionStack->mIsBackupQueueProcessing,
"mIsBackupQueueProcessing should be initially false");
mReactionStack->mIsBackupQueueProcessing = true;
}
virtual void Run(AutoSlowOperation& aAso) override
{
mReactionStack->InvokeBackupQueue();
mReactionStack->mIsBackupQueueProcessing = false;
}
private:
RefPtr<CustomElementReactionsStack> mReactionStack;
};
};
class CustomElementRegistry final : public nsISupports,
@@ -142,36 +404,33 @@ public:
public:
static bool IsCustomElementEnabled(JSContext* aCx = nullptr,
JSObject* aObject = nullptr);
static already_AddRefed<CustomElementRegistry> Create(nsPIDOMWindowInner* aWindow);
static void ProcessTopElementQueue();
static void XPCOMShutdown();
explicit CustomElementRegistry(nsPIDOMWindowInner* aWindow);
/**
* Looking up a custom element definition.
* https://html.spec.whatwg.org/#look-up-a-custom-element-definition
*/
CustomElementDefinition* LookupCustomElementDefinition(
const nsAString& aLocalName, const nsAString* aIs = nullptr) const;
nsIAtom* aNameAtom, nsIAtom* aTypeAtom) const;
/**
* Enqueue created callback or register upgrade candidate for
* newly created custom elements, possibly extending an existing type.
* ex. <x-button>, <button is="x-button> (type extension)
*/
void SetupCustomElement(Element* aElement, const nsAString* aTypeExtension);
CustomElementDefinition* LookupCustomElementDefinition(
JSContext* aCx, JSObject *aConstructor) const;
void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
CustomElementDefinition* aDefinition);
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition);
void GetCustomPrototype(nsIAtom* aAtom,
JS::MutableHandle<JSObject*> aPrototype);
private:
explicit CustomElementRegistry(nsPIDOMWindowInner* aWindow);
~CustomElementRegistry();
/**
* Upgrade an element.
* https://html.spec.whatwg.org/multipage/scripting.html#upgrades
*/
static void Upgrade(Element* aElement, CustomElementDefinition* aDefinition, ErrorResult& aRv);
/**
* Registers an unresolved custom element that is a candidate for
@@ -184,23 +443,48 @@ private:
void RegisterUnresolvedElement(Element* aElement,
nsIAtom* aTypeName = nullptr);
void UpgradeCandidates(JSContext* aCx,
nsIAtom* aKey,
CustomElementDefinition* aDefinition);
/**
* Unregister an unresolved custom element that is a candidate for
* upgrade when a custom element is removed from tree.
*/
void UnregisterUnresolvedElement(Element* aElement,
nsIAtom* aTypeName = nullptr);
private:
~CustomElementRegistry();
typedef nsClassHashtable<nsISupportsHashKey, CustomElementDefinition>
static UniquePtr<CustomElementCallback> CreateCustomElementCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition);
void UpgradeCandidates(nsIAtom* aKey,
CustomElementDefinition* aDefinition,
ErrorResult& aRv);
typedef nsRefPtrHashtable<nsISupportsHashKey, CustomElementDefinition>
DefinitionMap;
typedef nsClassHashtable<nsISupportsHashKey, nsTArray<nsWeakPtr>>
CandidateMap;
typedef JS::GCHashMap<JS::Heap<JSObject*>,
nsCOMPtr<nsIAtom>,
js::MovableCellHasher<JS::Heap<JSObject*>>,
js::SystemAllocPolicy> ConstructorMap;
// Hashtable for custom element definitions in web components.
// Custom prototypes are stored in the compartment where
// registerElement was called.
DefinitionMap mCustomDefinitions;
// Hashtable for looking up definitions by using constructor as key.
// Custom elements' name are stored here and we need to lookup
// mCustomDefinitions again to get definitions.
ConstructorMap mConstructors;
typedef nsRefPtrHashtable<nsISupportsHashKey, Promise>
WhenDefinedPromiseMap;
WhenDefinedPromiseMap mWhenDefinedPromiseMap;
// The "upgrade candidates map" from the web components spec. Maps from a
// namespace id and local name to a list of elements to upgrade if that
// element is registered as a custom element.
@@ -208,14 +492,6 @@ private:
nsCOMPtr<nsPIDOMWindowInner> mWindow;
// Array representing the processing stack in the custom elements
// specification. The processing stack is conceptually a stack of
// element queues. Each queue is represented by a sequence of
// CustomElementData in this array, separated by nullptr that
// represent the boundaries of the items in the stack. The first
// queue in the stack is the base element queue.
static mozilla::Maybe<nsTArray<RefPtr<CustomElementData>>> sProcessingStack;
// It is used to prevent reentrant invocations of element definition.
bool mIsCustomDefinitionRunning;
@@ -252,6 +528,31 @@ public:
already_AddRefed<Promise> WhenDefined(const nsAString& aName, ErrorResult& aRv);
};
class MOZ_RAII AutoCEReaction final {
public:
// JSContext is allowed to be a nullptr if we are guaranteeing that we're
// not doing something that might throw but not finish reporting a JS
// exception during the lifetime of the AutoCEReaction.
AutoCEReaction(CustomElementReactionsStack* aReactionsStack, JSContext* aCx)
: mReactionsStack(aReactionsStack)
, mCx(aCx)
{
mIsElementQueuePushedForPreviousRecursionDepth =
mReactionsStack->EnterCEReactions();
}
~AutoCEReaction()
{
mReactionsStack->LeaveCEReactions(
mCx, mIsElementQueuePushedForPreviousRecursionDepth);
}
private:
RefPtr<CustomElementReactionsStack> mReactionsStack;
JSContext* mCx;
bool mIsElementQueuePushedForPreviousRecursionDepth;
};
} // namespace dom
} // namespace mozilla
+3
View File
@@ -46,6 +46,9 @@ DocGroup::DocGroup(TabGroup* aTabGroup, const nsACString& aKey)
DocGroup::~DocGroup()
{
MOZ_ASSERT(mDocuments.IsEmpty());
if (!NS_IsMainThread()) {
NS_ReleaseOnMainThread(mReactionsStack.forget());
}
mTabGroup->mDocGroups.RemoveEntry(mKey);
}
+10
View File
@@ -14,6 +14,7 @@
#include "nsString.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/CustomElementRegistry.h"
namespace mozilla {
namespace dom {
@@ -52,6 +53,14 @@ public:
{
return mTabGroup;
}
mozilla::dom::CustomElementReactionsStack* CustomElementReactionsStack()
{
if (!mReactionsStack) {
mReactionsStack = new mozilla::dom::CustomElementReactionsStack();
}
return mReactionsStack;
}
void RemoveDocument(nsIDocument* aWindow);
// Iterators for iterating over every document within the DocGroup
@@ -71,6 +80,7 @@ private:
nsCString mKey;
RefPtr<TabGroup> mTabGroup;
nsTArray<nsIDocument*> mDocuments;
RefPtr<mozilla::dom::CustomElementReactionsStack> mReactionsStack;
};
} // namespace dom
+114 -44
View File
@@ -479,9 +479,13 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
if (data) {
// If this is a registered custom element then fix the prototype.
nsContentUtils::GetCustomPrototype(OwnerDoc(), NodeInfo()->NamespaceID(),
data->mType, &customProto);
data->GetCustomElementType(), &customProto);
if (customProto &&
NodePrincipal()->SubsumesConsideringDomain(nsContentUtils::ObjectPrincipal(customProto))) {
// The custom element prototype could be in different compartment.
if (!JS_WrapObject(aCx, &customProto)) {
return nullptr;
}
// Just go ahead and create with the right proto up front. Set
// customProto to null to flag that we don't need to do any post-facto
// proto fixups here.
@@ -1595,7 +1599,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
#endif
{
if (aBindingParent) {
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
}
@@ -1618,7 +1622,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
ShadowRoot* parentContainingShadow = aParent->GetContainingShadow();
if (parentContainingShadow) {
DOMSlots()->mContainingShadow = parentContainingShadow;
ExtendedDOMSlots()->mContainingShadow = parentContainingShadow;
}
}
@@ -1684,14 +1688,17 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
SetSubtreeRootPointer(aParent->SubtreeRoot());
}
nsIDocument* composedDoc = GetComposedDoc();
if (composedDoc) {
// Attached callback must be enqueued whenever custom element is inserted into a
// document and this document has a browsing context.
if (GetCustomElementData() && composedDoc->GetDocShell()) {
// Enqueue an attached callback for the custom element.
nsContentUtils::EnqueueLifecycleCallback(
composedDoc, nsIDocument::eAttached, this);
if (CustomElementRegistry::IsCustomElementEnabled() && IsInComposedDoc()) {
// Connected callback must be enqueued whenever a custom element becomes
// connected.
CustomElementData* data = GetCustomElementData();
if (data) {
if (data->mState == CustomElementData::State::eCustom) {
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this);
} else {
// Step 7.7.2.2 https://dom.spec.whatwg.org/#concept-node-insert
nsContentUtils::TryToUpgradeElement(this);
}
}
}
@@ -1986,12 +1993,21 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
document->ClearBoxObjectFor(this);
// Detached must be enqueued whenever custom element is removed from
// the document and this document has a browsing context.
if (GetCustomElementData() && document->GetDocShell()) {
// Enqueue a detached callback for the custom element.
nsContentUtils::EnqueueLifecycleCallback(
document, nsIDocument::eDetached, this);
// Disconnected must be enqueued whenever a connected custom element becomes
// disconnected.
if (CustomElementRegistry::IsCustomElementEnabled()) {
CustomElementData* data = GetCustomElementData();
if (data) {
if (data->mState == CustomElementData::State::eCustom) {
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
this);
} else {
// Remove an unresolved custom element that is a candidate for
// upgrade when a custom element is disconnected.
// We will make sure it's shadow-including tree order in bug 1326028.
nsContentUtils::UnregisterUnresolvedElement(this);
}
}
}
}
@@ -2007,7 +2023,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
}
#endif
nsDOMSlots* slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
if (clearBindingParent) {
slots->mBindingParent = nullptr;
@@ -2055,7 +2071,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
nsICSSDeclaration*
Element::GetSMILOverrideStyle()
{
Element::nsDOMSlots *slots = DOMSlots();
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
if (!slots->mSMILOverrideStyle) {
slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
@@ -2067,7 +2083,7 @@ Element::GetSMILOverrideStyle()
DeclarationBlock*
Element::GetSMILOverrideStyleDeclaration()
{
Element::nsDOMSlots *slots = GetExistingDOMSlots();
Element::nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
return slots ? slots->mSMILOverrideStyleDeclaration.get() : nullptr;
}
@@ -2075,7 +2091,7 @@ nsresult
Element::SetSMILOverrideStyleDeclaration(DeclarationBlock* aDeclaration,
bool aNotify)
{
Element::nsDOMSlots *slots = DOMSlots();
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mSMILOverrideStyleDeclaration = aDeclaration;
@@ -2586,19 +2602,32 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
UpdateState(aNotify);
nsIDocument* ownerDoc = OwnerDoc();
if (ownerDoc && GetCustomElementData()) {
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
LifecycleCallbackArgs args = {
nsDependentAtomString(aName),
aModType == nsIDOMMutationEvent::ADDITION ?
NullString() : nsDependentAtomString(oldValueAtom),
nsDependentAtomString(newValueAtom)
};
if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
data->GetCustomElementType(),
aName)) {
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
"AttributeChanged callback should fire only if "
"custom element state is custom");
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
nsContentUtils::EnqueueLifecycleCallback(
ownerDoc, nsIDocument::eAttributeChanged, this, &args);
LifecycleCallbackArgs args = {
nsDependentAtomString(aName),
aModType == nsIDOMMutationEvent::ADDITION ?
NullString() : nsDependentAtomString(oldValueAtom),
nsDependentAtomString(newValueAtom),
(ns.IsEmpty() ? NullString() : ns)
};
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
this, &args, nullptr, definition);
}
}
}
if (aCallAfterSetAttr) {
@@ -2843,17 +2872,30 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
UpdateState(aNotify);
nsIDocument* ownerDoc = OwnerDoc();
if (ownerDoc && GetCustomElementData()) {
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
LifecycleCallbackArgs args = {
nsDependentAtomString(aName),
nsDependentAtomString(oldValueAtom),
NullString()
};
if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
data->GetCustomElementType(),
aName)) {
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
"AttributeChanged callback should fire only if "
"custom element state is custom");
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
nsContentUtils::EnqueueLifecycleCallback(
ownerDoc, nsIDocument::eAttributeChanged, this, &args);
nsCOMPtr<nsIAtom> oldValueAtom = oldValue.GetAsAtom();
LifecycleCallbackArgs args = {
nsDependentAtomString(aName),
nsDependentAtomString(oldValueAtom),
NullString(),
(ns.IsEmpty() ? NullString() : ns)
};
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
this, &args, nullptr, definition);
}
}
}
if (aNotify) {
@@ -3988,7 +4030,7 @@ Element::ClearDataset()
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>*
Element::RegisteredIntersectionObservers()
{
nsDOMSlots* slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
return &slots->mRegisteredIntersectionObservers;
}
@@ -4037,3 +4079,31 @@ Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32
}
return false;
}
void
Element::SetCustomElementData(CustomElementData* aData)
{
nsExtendedDOMSlots *slots = ExtendedDOMSlots();
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
slots->mCustomElementData = aData;
}
CustomElementDefinition*
Element::GetCustomElementDefinition() const
{
CustomElementData* data = GetCustomElementData();
if (!data) {
return nullptr;
}
return data->GetCustomElementDefinition();
}
void
Element::SetCustomElementDefinition(CustomElementDefinition* aDefinition)
{
CustomElementData* data = GetCustomElementData();
MOZ_ASSERT(data);
data->SetCustomElementDefinition(aDefinition);
}
+40 -1
View File
@@ -390,6 +390,45 @@ public:
Directionality GetComputedDirectionality() const;
/**
* Gets the custom element data used by web components custom element.
* Custom element data is created at the first attempt to enqueue a callback.
*
* @return The custom element data or null if none.
*/
inline CustomElementData* GetCustomElementData() const
{
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return slots->mCustomElementData;
}
return nullptr;
}
/**
* Sets the custom element data, ownership of the
* callback data is taken by this element.
*
* @param aData The custom element data.
*/
void SetCustomElementData(CustomElementData* aData);
/**
* Gets the custom element definition used by web components custom element.
*
* @return The custom element definition or null if element is not a custom
* element or custom element is not defined yet.
*/
CustomElementDefinition* GetCustomElementDefinition() const;
/**
* Sets the custom element definition, called when custom element is created
* or upgraded.
*
* @param aDefinition The custom element definition.
*/
void SetCustomElementDefinition(CustomElementDefinition* aDefinition);
protected:
/**
* Method to get the _intrinsic_ content state of this element. This is the
@@ -814,7 +853,7 @@ public:
ShadowRoot *FastGetShadowRoot() const
{
nsDOMSlots* slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
return slots ? slots->mShadowRoot.get() : nullptr;
}
+93 -78
View File
@@ -530,8 +530,7 @@ nsNodeSupportsWeakRefTearoff::GetWeakReference(nsIWeakReference** aInstancePtr)
//----------------------------------------------------------------------
FragmentOrElement::nsDOMSlots::nsDOMSlots()
: nsINode::nsSlots(),
mDataset(nullptr),
mBindingParent(nullptr)
mDataset(nullptr)
{
}
@@ -543,84 +542,104 @@ FragmentOrElement::nsDOMSlots::~nsDOMSlots()
}
void
FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
cb.NoteXPCOMChild(mStyle.get());
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
cb.NoteXPCOMChild(mSMILOverrideStyle.get());
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
cb.NoteXPCOMChild(mAttributeMap.get());
if (aIsXUL) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mControllers");
cb.NoteXPCOMChild(mControllers);
}
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mXBLBinding");
cb.NoteNativeChild(mXBLBinding, NS_CYCLE_COLLECTION_PARTICIPANT(nsXBLBinding));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mXBLInsertionParent");
cb.NoteXPCOMChild(mXBLInsertionParent.get());
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mShadowRoot");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mShadowRoot));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mContainingShadow");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mContainingShadow));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mLabelsList");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mLabelsList));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
cb.NoteXPCOMChild(mClassList.get());
if (mCustomElementData) {
for (uint32_t i = 0; i < mCustomElementData->mCallbackQueue.Length(); i++) {
mCustomElementData->mCallbackQueue[i]->Traverse(cb);
}
if (!mExtendedSlots) {
return;
}
for (auto iter = mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mSMILOverrideStyle");
cb.NoteXPCOMChild(mExtendedSlots->mSMILOverrideStyle.get());
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mControllers");
cb.NoteXPCOMChild(mExtendedSlots->mControllers);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mLabelsList");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*,mExtendedSlots-> mLabelsList));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mShadowRoot");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mExtendedSlots->mShadowRoot));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mContainingShadow");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIContent*, mExtendedSlots->mContainingShadow));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mXBLBinding");
cb.NoteNativeChild(mExtendedSlots->mXBLBinding,
NS_CYCLE_COLLECTION_PARTICIPANT(nsXBLBinding));
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mXBLInsertionParent");
cb.NoteXPCOMChild(mExtendedSlots->mXBLInsertionParent.get());
if (mExtendedSlots->mCustomElementData) {
mExtendedSlots->mCustomElementData->Traverse(cb);
}
for (auto iter = mExtendedSlots->mRegisteredIntersectionObservers.Iter();
!iter.Done(); iter.Next()) {
DOMIntersectionObserver* observer = iter.Key();
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mRegisteredIntersectionObservers[i]");
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
"mExtendedSlots->mRegisteredIntersectionObservers[i]");
cb.NoteXPCOMChild(observer);
}
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mExtendedSlots->mFrameLoaderOrOpener");
cb.NoteXPCOMChild(mExtendedSlots->mFrameLoaderOrOpener);
}
void
FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
FragmentOrElement::nsDOMSlots::Unlink()
{
mStyle = nullptr;
mSMILOverrideStyle = nullptr;
if (mAttributeMap) {
mAttributeMap->DropReference();
mAttributeMap = nullptr;
}
if (aIsXUL)
NS_IF_RELEASE(mControllers);
MOZ_ASSERT(!mXBLBinding);
mXBLInsertionParent = nullptr;
mShadowRoot = nullptr;
mContainingShadow = nullptr;
mChildrenList = nullptr;
mLabelsList = nullptr;
mCustomElementData = nullptr;
mClassList = nullptr;
mRegisteredIntersectionObservers.Clear();
if (!mExtendedSlots) {
return;
}
mExtendedSlots->mSMILOverrideStyle = nullptr;
mExtendedSlots->mControllers = nullptr;
mExtendedSlots->mLabelsList = nullptr;
mExtendedSlots->mShadowRoot = nullptr;
mExtendedSlots->mContainingShadow = nullptr;
MOZ_ASSERT(!(mExtendedSlots->mXBLBinding));
mExtendedSlots->mXBLInsertionParent = nullptr;
if (mExtendedSlots->mCustomElementData) {
mExtendedSlots->mCustomElementData->Unlink();
mExtendedSlots->mCustomElementData = nullptr;
}
mExtendedSlots->mRegisteredIntersectionObservers.Clear();
nsCOMPtr<nsIFrameLoader> frameLoader =
do_QueryInterface(mExtendedSlots->mFrameLoaderOrOpener);
if (frameLoader) {
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
}
mExtendedSlots->mFrameLoaderOrOpener = nullptr;
}
size_t
FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
if (mExtendedSlots) {
n += aMallocSizeOf(mExtendedSlots.get());
}
if (mAttributeMap) {
n += mAttributeMap->SizeOfIncludingThis(aMallocSizeOf);
@@ -641,6 +660,19 @@ FragmentOrElement::nsDOMSlots::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) c
return n;
}
FragmentOrElement::nsExtendedDOMSlots::nsExtendedDOMSlots()
: mBindingParent(nullptr)
{
}
FragmentOrElement::nsExtendedDOMSlots::~nsExtendedDOMSlots()
{
nsCOMPtr<nsIFrameLoader> frameLoader = do_QueryInterface(mFrameLoaderOrOpener);
if (frameLoader) {
static_cast<nsFrameLoader*>(frameLoader.get())->Destroy();
}
}
FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsIContent(aNodeInfo)
{
@@ -962,7 +994,7 @@ FragmentOrElement::IsLink(nsIURI** aURI) const
nsIContent*
FragmentOrElement::GetBindingParent() const
{
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return slots->mBindingParent;
@@ -974,7 +1006,7 @@ nsXBLBinding*
FragmentOrElement::GetXBLBinding() const
{
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return slots->mXBLBinding;
}
@@ -1009,11 +1041,11 @@ FragmentOrElement::SetXBLBinding(nsXBLBinding* aBinding,
if (aBinding) {
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mXBLBinding = aBinding;
bindingManager->AddBoundContent(this);
} else {
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
slots->mXBLBinding = nullptr;
}
@@ -1028,7 +1060,7 @@ nsIContent*
FragmentOrElement::GetXBLInsertionParent() const
{
if (HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return slots->mXBLInsertionParent;
}
@@ -1040,7 +1072,7 @@ FragmentOrElement::GetXBLInsertionParent() const
ShadowRoot*
FragmentOrElement::GetContainingShadow() const
{
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return slots->mContainingShadow;
}
@@ -1050,21 +1082,21 @@ FragmentOrElement::GetContainingShadow() const
void
FragmentOrElement::SetShadowRoot(ShadowRoot* aShadowRoot)
{
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
slots->mShadowRoot = aShadowRoot;
}
nsTArray<nsIContent*>&
FragmentOrElement::DestInsertionPoints()
{
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
return slots->mDestInsertionPoints;
}
nsTArray<nsIContent*>*
FragmentOrElement::GetExistingDestInsertionPoints() const
{
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
return &slots->mDestInsertionPoints;
}
@@ -1075,35 +1107,17 @@ void
FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent)
{
if (aContent) {
nsDOMSlots *slots = DOMSlots();
nsExtendedDOMSlots* slots = ExtendedDOMSlots();
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
slots->mXBLInsertionParent = aContent;
} else {
nsDOMSlots *slots = GetExistingDOMSlots();
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots) {
slots->mXBLInsertionParent = nullptr;
}
}
}
CustomElementData*
FragmentOrElement::GetCustomElementData() const
{
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots) {
return slots->mCustomElementData;
}
return nullptr;
}
void
FragmentOrElement::SetCustomElementData(CustomElementData* aData)
{
nsDOMSlots *slots = DOMSlots();
MOZ_ASSERT(!slots->mCustomElementData, "Custom element data may not be changed once set.");
slots->mCustomElementData = aData;
}
nsresult
FragmentOrElement::InsertChildAt(nsIContent* aKid,
uint32_t aIndex,
@@ -1366,14 +1380,15 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
if (tmp->IsElement()) {
if (slots->mExtendedSlots && tmp->IsElement()) {
Element* elem = tmp->AsElement();
for (auto iter = slots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
for (auto iter = slots->mExtendedSlots->mRegisteredIntersectionObservers.Iter();
!iter.Done(); iter.Next()) {
DOMIntersectionObserver* observer = iter.Key();
observer->UnlinkTarget(*elem);
}
}
slots->Unlink(tmp->IsXULElement());
slots->Unlink();
}
}
@@ -1938,7 +1953,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
slots->Traverse(cb, tmp->IsXULElement());
slots->Traverse(cb);
}
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+82 -50
View File
@@ -15,6 +15,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/UniquePtr.h"
#include "nsAttrAndChildArray.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class
@@ -37,6 +38,7 @@ class nsIURI;
namespace mozilla {
class DeclarationBlock;
namespace dom {
struct CustomElementData;
class DOMIntersectionObserver;
class Element;
} // namespace dom
@@ -159,9 +161,6 @@ public:
virtual void SetXBLInsertionParent(nsIContent* aContent) override;
virtual bool IsLink(nsIURI** aURI) const override;
virtual CustomElementData *GetCustomElementData() const override;
virtual void SetCustomElementData(CustomElementData* aData) override;
virtual void DestroyContent() override;
virtual void SaveSubtreeState() override;
@@ -241,8 +240,6 @@ protected:
nsresult CopyInnerTo(FragmentOrElement* aDest);
public:
// Because of a bug in MS C++ compiler nsDOMSlots must be declared public,
// otherwise nsXULElement::nsXULSlots doesn't compile.
/**
* There are a set of DOM- and scripting-specific instance variables
* that may only be instantiated when a content object is accessed
@@ -251,29 +248,13 @@ public:
* in a side structure that's only allocated when the content is
* accessed through the DOM.
*/
class nsDOMSlots : public nsINode::nsSlots
class nsExtendedDOMSlots
{
public:
nsDOMSlots();
virtual ~nsDOMSlots();
nsExtendedDOMSlots();
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
void Unlink(bool aIsXUL);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
/**
* The .style attribute (an interface that forwards to the actual
* style rules)
* @see nsGenericHTMLElement::GetStyle
*/
nsCOMPtr<nsICSSDeclaration> mStyle;
/**
* The .dataset attribute.
* @see nsGenericHTMLElement::GetDataset
*/
nsDOMStringMap* mDataset; // [Weak]
~nsExtendedDOMSlots();
/**
* SMIL Overridde style rules (for SMIL animation of CSS properties)
@@ -287,35 +268,17 @@ public:
RefPtr<mozilla::DeclarationBlock> mSMILOverrideStyleDeclaration;
/**
* An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
* @see FragmentOrElement::GetAttributes
*/
RefPtr<nsDOMAttributeMap> mAttributeMap;
union {
/**
* The nearest enclosing content node with a binding that created us.
* @see FragmentOrElement::GetBindingParent
*/
nsIContent* mBindingParent; // [Weak]
/**
* The controllers of the XUL Element.
*/
nsIControllers* mControllers; // [OWNER]
};
* The nearest enclosing content node with a binding that created us.
* @see FragmentOrElement::GetBindingParent
*/
nsIContent* mBindingParent; // [Weak]
/**
* An object implementing the .children property for this element.
*/
RefPtr<nsContentList> mChildrenList;
* The controllers of the XUL Element.
*/
nsCOMPtr<nsIControllers> mControllers;
/**
* An object implementing the .classList property for this element.
*/
RefPtr<nsDOMTokenList> mClassList;
/*
* An object implementing the .labels property for this element.
*/
RefPtr<nsLabelsNodeList> mLabelsList;
@@ -356,6 +319,55 @@ public:
*/
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>
mRegisteredIntersectionObservers;
/**
* For XUL to hold either frameloader or opener.
*/
nsCOMPtr<nsISupports> mFrameLoaderOrOpener;
};
class nsDOMSlots : public nsINode::nsSlots
{
public:
nsDOMSlots();
virtual ~nsDOMSlots();
void Traverse(nsCycleCollectionTraversalCallback &cb);
void Unlink();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
/**
* The .style attribute (an interface that forwards to the actual
* style rules)
* @see nsGenericHTMLElement::GetStyle
*/
nsCOMPtr<nsICSSDeclaration> mStyle;
/**
* The .dataset attribute.
* @see nsGenericHTMLElement::GetDataset
*/
nsDOMStringMap* mDataset; // [Weak]
/**
* An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
* @see FragmentOrElement::GetAttributes
*/
RefPtr<nsDOMAttributeMap> mAttributeMap;
/**
* An object implementing the .children property for this element.
*/
RefPtr<nsContentList> mChildrenList;
/**
* An object implementing the .classList property for this element.
*/
RefPtr<nsDOMTokenList> mClassList;
mozilla::UniquePtr<nsExtendedDOMSlots> mExtendedSlots;
};
protected:
@@ -375,6 +387,26 @@ protected:
return static_cast<nsDOMSlots*>(GetExistingSlots());
}
nsExtendedDOMSlots* ExtendedDOMSlots()
{
nsDOMSlots* slots = DOMSlots();
if (!slots->mExtendedSlots) {
slots->mExtendedSlots = MakeUnique<nsExtendedDOMSlots>();
}
return slots->mExtendedSlots.get();
}
nsExtendedDOMSlots* GetExistingExtendedDOMSlots() const
{
nsDOMSlots* slots = GetExistingDOMSlots();
if (slots) {
return slots->mExtendedSlots.get();
}
return nullptr;
}
/**
* Calls SetIsElementInStyleScopeFlagOnSubtree for each shadow tree attached
* to this node, which is assumed to be an Element.
-59
View File
@@ -37,10 +37,7 @@
#include "mozilla/dom/PowerManager.h"
#include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/dom/FlyWebPublishedServer.h"
#include "mozilla/dom/FlyWebService.h"
#include "mozilla/dom/Permissions.h"
#include "mozilla/dom/Presentation.h"
#include "mozilla/dom/ServiceWorkerContainer.h"
#include "mozilla/dom/StorageManager.h"
#include "mozilla/dom/TCPSocket.h"
@@ -67,8 +64,6 @@
#include "nsIAppsService.h"
#include "mozIApplication.h"
#include "WidgetUtils.h"
#include "nsIPresentationService.h"
#include "mozilla/dom/MediaDevices.h"
#include "MediaManager.h"
@@ -218,7 +213,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
#ifdef MOZ_EME
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation)
#ifdef MOZ_GAMEPAD
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest)
#endif
@@ -284,10 +278,6 @@ Navigator::Invalidate()
mTimeManager = nullptr;
}
if (mPresentation) {
mPresentation = nullptr;
}
mServiceWorkerContainer = nullptr;
#ifdef MOZ_EME
@@ -1364,41 +1354,6 @@ Navigator::GetBattery(ErrorResult& aRv)
return mBatteryPromise;
}
already_AddRefed<Promise>
Navigator::PublishServer(const nsAString& aName,
const FlyWebPublishOptions& aOptions,
ErrorResult& aRv)
{
RefPtr<FlyWebService> service = FlyWebService::GetOrCreate();
if (!service) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<FlyWebPublishPromise> mozPromise =
service->PublishServer(aName, aOptions, mWindow);
MOZ_ASSERT(mozPromise);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
ErrorResult result;
RefPtr<Promise> domPromise = Promise::Create(global, result);
if (result.Failed()) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
mozPromise->Then(AbstractThread::MainThread(),
__func__,
[domPromise] (FlyWebPublishedServer* aServer) {
domPromise->MaybeResolve(aServer);
},
[domPromise] (nsresult aStatus) {
domPromise->MaybeReject(aStatus);
});
return domPromise.forget();
}
PowerManager*
Navigator::GetMozPower(ErrorResult& aRv)
{
@@ -1931,19 +1886,5 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
}
#endif
Presentation*
Navigator::GetPresentation(ErrorResult& aRv)
{
if (!mPresentation) {
if (!mWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
mPresentation = Presentation::Create(mWindow);
}
return mPresentation;
}
} // namespace dom
} // namespace mozilla
-9
View File
@@ -39,8 +39,6 @@ class WakeLock;
class ArrayBufferViewOrBlobOrStringOrFormData;
class ServiceWorkerContainer;
class DOMRequest;
struct FlyWebPublishOptions;
struct FlyWebFilter;
} // namespace dom
} // namespace mozilla
@@ -74,7 +72,6 @@ class Connection;
} // namespace network
class PowerManager;
class Presentation;
class LegacyMozTCPSocket;
class StorageManager;
@@ -141,9 +138,6 @@ public:
Geolocation* GetGeolocation(ErrorResult& aRv);
Promise* GetBattery(ErrorResult& aRv);
already_AddRefed<Promise> PublishServer(const nsAString& aName,
const FlyWebPublishOptions& aOptions,
ErrorResult& aRv);
static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);
static nsresult GetPlatform(nsAString& aPlatform,
@@ -210,8 +204,6 @@ public:
system::AudioChannelManager* GetMozAudioChannelManager(ErrorResult& aRv);
#endif // MOZ_AUDIO_CHANNEL_MANAGER
Presentation* GetPresentation(ErrorResult& aRv);
bool SendBeacon(const nsAString& aUrl,
const Nullable<ArrayBufferViewOrBlobOrStringOrFormData>& aData,
ErrorResult& aRv);
@@ -288,7 +280,6 @@ private:
RefPtr<time::TimeManager> mTimeManager;
RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
RefPtr<Presentation> mPresentation;
#ifdef MOZ_GAMEPAD
RefPtr<GamepadServiceTest> mGamepadServiceTest;
#endif
+2 -2
View File
@@ -75,8 +75,8 @@ ShadowRoot::ShadowRoot(nsIContent* aContent,
SetFlags(NODE_IS_IN_SHADOW_TREE);
DOMSlots()->mBindingParent = aContent;
DOMSlots()->mContainingShadow = this;
ExtendedDOMSlots()->mBindingParent = aContent;
ExtendedDOMSlots()->mContainingShadow = this;
// Add the ShadowRoot as a mutation observer on the host to watch
// for mutations because the insertion points in this ShadowRoot
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<script>
var o1 = document.documentElement;
var o2 = document.createElement("frame");
document.documentElement.appendChild(o2);
var o3 = o2.contentWindow;
o1.parentNode.removeChild(o1);
o3.customElements;
</script>
</body>
</html>
+1
View File
@@ -209,3 +209,4 @@ load 1230422.html
load 1251361.html
load 1304437.html
pref(clipboard.autocopy,true) load 1385272-1.html
pref(dom.webcomponents.customelements.enabled,true) load 1341693.html
+34
View File
@@ -1526,6 +1526,40 @@ nsAttrValue::ParseIntWithFallback(const nsAString& aString, int32_t aDefault,
SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr);
}
void
nsAttrValue::ParseClampedNonNegativeInt(const nsAString& aString,
int32_t aDefault, int32_t aMin,
int32_t aMax)
{
ResetIfSet();
nsContentUtils::ParseHTMLIntegerResultFlags result;
int32_t val = nsContentUtils::ParseHTMLInteger(aString, &result);
bool nonStrict = (result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);
if (result & nsContentUtils::eParseHTMLInteger_ErrorOverflow) {
if (result & nsContentUtils::eParseHTMLInteger_Negative) {
val = aDefault;
} else {
val = aMax;
}
nonStrict = true;
} else if ((result & nsContentUtils::eParseHTMLInteger_Error) || val < 0) {
val = aDefault;
nonStrict = true;
} else if (val < aMin) {
val = aMin;
nonStrict = true;
} else if (val > aMax) {
val = aMax;
nonStrict = true;
}
SetIntValueAndType(val, eInteger, nonStrict ? &aString : nullptr);
}
bool
nsAttrValue::ParseNonNegativeIntValue(const nsAString& aString)
{
+13
View File
@@ -362,6 +362,19 @@ public:
*/
bool ParseNonNegativeIntValue(const nsAString& aString);
/**
* Parse a string value into a clamped non-negative integer.
* This method follows the rules for parsing non-negative integer from:
* https://html.spec.whatwg.org/multipage/infrastructure.html#clamped-to-the-range
*
* @param aString the string to parse
* @param aDefault value to return for negative or invalid values
* @param aMin minimum value
* @param aMax maximum value
*/
void ParseClampedNonNegativeInt(const nsAString& aString, int32_t aDefault,
int32_t aMin, int32_t aMax);
/**
* Parse a string value into a positive integer.
* This method follows the rules for parsing non-negative integer from:
+3 -1
View File
@@ -24,6 +24,7 @@ namespace mozilla {
namespace dom {
class Element;
class NodeInfo;
struct CustomElementDefinition;
} // namespace dom
} // namespace mozilla
@@ -41,7 +42,8 @@ nsresult
NS_NewHTMLElement(mozilla::dom::Element** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser,
const nsAString* aIs = nullptr);
const nsAString* aIs = nullptr,
mozilla::dom::CustomElementDefinition* aDefinition = nullptr);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.
+100 -83
View File
@@ -227,6 +227,7 @@ extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
int ns_aware, const char** colon);
class imgLoader;
class nsIAtom;
using namespace mozilla::dom;
using namespace mozilla::ipc;
@@ -258,7 +259,6 @@ nsIWordBreaker *nsContentUtils::sWordBreaker;
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
uint32_t nsContentUtils::sScriptBlockerCount = 0;
uint32_t nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
uint32_t nsContentUtils::sMicroTaskLevel = 0;
AutoTArray<nsCOMPtr<nsIRunnable>, 8>* nsContentUtils::sBlockedScriptRunners = nullptr;
uint32_t nsContentUtils::sRunnersCountAtFirstBlocker = 0;
nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nullptr;
@@ -284,6 +284,8 @@ bool nsContentUtils::sIsResourceTimingEnabled = false;
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
bool nsContentUtils::sIsWebComponentsEnabled = false;
bool nsContentUtils::sIsCustomElementsEnabled = false;
bool nsContentUtils::sEncodeDecodeURLHash = false;
bool nsContentUtils::sGettersDecodeURLHash = false;
bool nsContentUtils::sPrivacyResistFingerprinting = false;
@@ -584,6 +586,12 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsExperimentalAutocompleteEnabled,
"dom.forms.autocomplete.experimental", false);
Preferences::AddBoolVarCache(&sIsWebComponentsEnabled,
"dom.webcomponents.enabled", false);
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
"dom.webcomponents.customelements.enabled", false);
Preferences::AddBoolVarCache(&sEncodeDecodeURLHash,
"dom.url.encode_decode_hash", false);
@@ -1080,6 +1088,7 @@ nsContentUtils::ParseHTMLInteger(const nsAString& aValue,
int sign = 1;
if (*iter == char16_t('-')) {
sign = -1;
result |= eParseHTMLInteger_Negative;
++iter;
} else if (*iter == char16_t('+')) {
result |= eParseHTMLInteger_NonStandard;
@@ -5293,51 +5302,6 @@ nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
}
void
nsContentUtils::EnterMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
++sMicroTaskLevel;
}
void
nsContentUtils::LeaveMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
if (--sMicroTaskLevel == 0) {
PerformMainThreadMicroTaskCheckpoint();
}
}
bool
nsContentUtils::IsInMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
return sMicroTaskLevel != 0;
}
uint32_t
nsContentUtils::MicroTaskLevel()
{
MOZ_ASSERT(NS_IsMainThread());
return sMicroTaskLevel;
}
void
nsContentUtils::SetMicroTaskLevel(uint32_t aLevel)
{
MOZ_ASSERT(NS_IsMainThread());
sMicroTaskLevel = aLevel;
}
void
nsContentUtils::PerformMainThreadMicroTaskCheckpoint()
{
MOZ_ASSERT(NS_IsMainThread());
nsDOMMutationObserver::HandleMutations();
}
/*
* Helper function for nsContentUtils::ProcessViewportInfo.
*
@@ -9567,11 +9531,34 @@ nsContentUtils::HttpsStateIsModern(nsIDocument* aDocument)
return false;
}
/* static */ void
nsContentUtils::TryToUpgradeElement(Element* aElement)
{
NodeInfo* nodeInfo = aElement->NodeInfo();
RefPtr<nsIAtom> typeAtom =
aElement->GetCustomElementData()->GetCustomElementType();
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
CustomElementDefinition* definition =
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
nodeInfo->NameAtom(),
nodeInfo->NamespaceID(),
typeAtom);
if (definition) {
nsContentUtils::EnqueueUpgradeReaction(aElement, definition);
} else {
// Add an unresolved custom element that is a candidate for
// upgrade when a custom element is connected to the document.
// We will make sure it's shadow-including tree order in bug 1326028.
nsContentUtils::RegisterUnresolvedElement(aElement, typeAtom);
}
}
/* static */ CustomElementDefinition*
nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc,
const nsAString& aLocalName,
nsIAtom* aNameAtom,
uint32_t aNameSpaceID,
const nsAString* aIs)
nsIAtom* aTypeAtom)
{
MOZ_ASSERT(aDoc);
@@ -9593,30 +9580,16 @@ nsContentUtils::LookupCustomElementDefinition(nsIDocument* aDoc,
return nullptr;
}
return registry->LookupCustomElementDefinition(aLocalName, aIs);
return registry->LookupCustomElementDefinition(aNameAtom, aTypeAtom);
}
/* static */ void
nsContentUtils::SetupCustomElement(Element* aElement,
const nsAString* aTypeExtension)
nsContentUtils::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
{
MOZ_ASSERT(aElement);
nsCOMPtr<nsIDocument> doc = aElement->OwnerDoc();
if (!doc) {
return;
}
// To support imported document.
doc = doc->MasterDocument();
if (aElement->GetNameSpaceID() != kNameSpaceID_XHTML ||
!doc->GetDocShell()) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window(doc->GetInnerWindow());
nsIDocument* doc = aElement->OwnerDoc();
nsPIDOMWindowInner* window(doc->GetInnerWindow());
if (!window) {
return;
}
@@ -9626,26 +9599,18 @@ nsContentUtils::SetupCustomElement(Element* aElement,
return;
}
return registry->SetupCustomElement(aElement, aTypeExtension);
registry->RegisterUnresolvedElement(aElement, aTypeName);
}
/* static */ void
nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc,
nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
CustomElementDefinition* aDefinition)
nsContentUtils::UnregisterUnresolvedElement(Element* aElement)
{
MOZ_ASSERT(aDoc);
MOZ_ASSERT(aElement);
// To support imported document.
nsCOMPtr<nsIDocument> doc = aDoc->MasterDocument();
if (!doc->GetDocShell()) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window(doc->GetInnerWindow());
RefPtr<nsIAtom> typeAtom =
aElement->GetCustomElementData()->GetCustomElementType();
nsIDocument* doc = aElement->OwnerDoc();
nsPIDOMWindowInner* window(doc->GetInnerWindow());
if (!window) {
return;
}
@@ -9655,7 +9620,59 @@ nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc,
return;
}
registry->EnqueueLifecycleCallback(aType, aCustomElement, aArgs, aDefinition);
registry->UnregisterUnresolvedElement(aElement, typeAtom);
}
/* static */ CustomElementDefinition*
nsContentUtils::GetElementDefinitionIfObservingAttr(Element* aCustomElement,
nsIAtom* aExtensionType,
nsIAtom* aAttrName)
{
CustomElementDefinition* definition =
aCustomElement->GetCustomElementDefinition();
// Custom element not defined yet or attribute is not in the observed
// attribute list.
if (!definition || !definition->IsInObservedAttributeList(aAttrName)) {
return nullptr;
}
return definition;
}
/* static */ void
nsContentUtils::EnqueueUpgradeReaction(Element* aElement,
CustomElementDefinition* aDefinition)
{
MOZ_ASSERT(aElement);
nsIDocument* doc = aElement->OwnerDoc();
// No DocGroup means no custom element reactions stack.
if (!doc->GetDocGroup()) {
return;
}
CustomElementReactionsStack* stack =
doc->GetDocGroup()->CustomElementReactionsStack();
stack->EnqueueUpgradeReaction(aElement, aDefinition);
}
/* static */ void
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs,
CustomElementDefinition* aDefinition)
{
// No DocGroup means no custom element reactions stack.
if (!aCustomElement->OwnerDoc()->GetDocGroup()) {
return;
}
CustomElementRegistry::EnqueueLifecycleCallback(aType, aCustomElement, aArgs,
aAdoptedCallbackArgs,
aDefinition);
}
/* static */ void
@@ -9834,4 +9851,4 @@ nsContentUtils::IsLocalRefURL(const nsString& aString)
}
return false;
}
}
+32 -32
View File
@@ -126,6 +126,7 @@ class EventTarget;
class IPCDataTransfer;
class IPCDataTransferItem;
struct LifecycleCallbackArgs;
struct LifecycleAdoptedCallbackArgs;
class NodeInfo;
class nsIContentChild;
class nsIContentParent;
@@ -444,7 +445,9 @@ public:
// Set if one or more error flags were set.
eParseHTMLInteger_Error = 1 << 3,
eParseHTMLInteger_ErrorNoValue = 1 << 4,
eParseHTMLInteger_ErrorOverflow = 1 << 5
eParseHTMLInteger_ErrorOverflow = 1 << 5,
// Use this flag to detect the difference between overflow and underflow
eParseHTMLInteger_Negative = 1 << 6,
};
static int32_t ParseHTMLInteger(const nsAString& aValue,
ParseHTMLIntegerResultFlags *aResult);
@@ -1739,17 +1742,6 @@ public:
*/
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
// Call EnterMicroTask when you're entering JS execution.
// Usually the best way to do this is to use nsAutoMicroTask.
static void EnterMicroTask();
static void LeaveMicroTask();
static bool IsInMicroTask();
static uint32_t MicroTaskLevel();
static void SetMicroTaskLevel(uint32_t aLevel);
static void PerformMainThreadMicroTaskCheckpoint();
/* Process viewport META data. This gives us information for the scale
* and zoom of a page on mobile devices. We stick the information in
* the document header and use it later on after rendering.
@@ -2710,23 +2702,37 @@ public:
*/
static bool HttpsStateIsModern(nsIDocument* aDocument);
/**
* Try to upgrade an element.
* https://html.spec.whatwg.org/multipage/custom-elements.html#concept-try-upgrade
*/
static void TryToUpgradeElement(Element* aElement);
/**
* Looking up a custom element definition.
* https://html.spec.whatwg.org/#look-up-a-custom-element-definition
*/
static mozilla::dom::CustomElementDefinition*
LookupCustomElementDefinition(nsIDocument* aDoc,
const nsAString& aLocalName,
nsIAtom* aNameAtom,
uint32_t aNameSpaceID,
const nsAString* aIs = nullptr);
nsIAtom* aTypeAtom);
static void SetupCustomElement(Element* aElement,
const nsAString* aTypeExtension = nullptr);
static void RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName);
static void UnregisterUnresolvedElement(Element* aElement);
static void EnqueueLifecycleCallback(nsIDocument* aDoc,
nsIDocument::ElementCallbackType aType,
static mozilla::dom::CustomElementDefinition*
GetElementDefinitionIfObservingAttr(Element* aCustomElement,
nsIAtom* aExtensionType,
nsIAtom* aAttrName);
static void EnqueueUpgradeReaction(Element* aElement,
mozilla::dom::CustomElementDefinition* aDefinition);
static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
mozilla::dom::LifecycleCallbackArgs* aArgs = nullptr,
mozilla::dom::LifecycleAdoptedCallbackArgs* aAdoptedCallbackArgs = nullptr,
mozilla::dom::CustomElementDefinition* aDefinition = nullptr);
static void GetCustomPrototype(nsIDocument* aDoc,
@@ -2743,6 +2749,12 @@ public:
static bool
IsLocalRefURL(const nsString& aString);
static bool
IsWebComponentsEnabled() { return sIsWebComponentsEnabled; }
static bool
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
private:
static bool InitializeEventTable();
@@ -2829,7 +2841,6 @@ private:
static bool sInitialized;
static uint32_t sScriptBlockerCount;
static uint32_t sDOMNodeRemovedSuppressCount;
static uint32_t sMicroTaskLevel;
// Not an nsCOMArray because removing elements from those is slower
static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners;
static uint32_t sRunnersCountAtFirstBlocker;
@@ -2850,6 +2861,8 @@ private:
static bool sIsUserTimingLoggingEnabled;
static bool sIsFrameTimingPrefEnabled;
static bool sIsExperimentalAutocompleteEnabled;
static bool sIsWebComponentsEnabled;
static bool sIsCustomElementsEnabled;
static bool sEncodeDecodeURLHash;
static bool sGettersDecodeURLHash;
static bool sPrivacyResistFingerprinting;
@@ -2905,19 +2918,6 @@ public:
}
};
class MOZ_STACK_CLASS nsAutoMicroTask
{
public:
nsAutoMicroTask()
{
nsContentUtils::EnterMicroTask();
}
~nsAutoMicroTask()
{
nsContentUtils::LeaveMicroTask();
}
};
namespace mozilla {
namespace dom {
+30 -37
View File
@@ -32,8 +32,6 @@ using mozilla::dom::Element;
AutoTArray<RefPtr<nsDOMMutationObserver>, 4>*
nsDOMMutationObserver::sScheduledMutationObservers = nullptr;
nsDOMMutationObserver* nsDOMMutationObserver::sCurrentObserver = nullptr;
uint32_t nsDOMMutationObserver::sMutationLevel = 0;
uint64_t nsDOMMutationObserver::sCount = 0;
@@ -597,10 +595,32 @@ nsDOMMutationObserver::ScheduleForRun()
RescheduleForRun();
}
class MutationObserverMicroTask final : public MicroTaskRunnable
{
public:
virtual void Run(AutoSlowOperation& aAso) override
{
nsDOMMutationObserver::HandleMutations(aAso);
}
virtual bool Suppressed() override
{
return nsDOMMutationObserver::AllScheduledMutationObserversAreSuppressed();
}
};
void
nsDOMMutationObserver::RescheduleForRun()
{
if (!sScheduledMutationObservers) {
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
if (!ccjs) {
return;
}
RefPtr<MutationObserverMicroTask> momt =
new MutationObserverMicroTask();
ccjs->DispatchMicroTaskRunnable(momt.forget());
sScheduledMutationObservers = new AutoTArray<RefPtr<nsDOMMutationObserver>, 4>;
}
@@ -862,36 +882,9 @@ nsDOMMutationObserver::HandleMutation()
mCallback->Call(this, mutations, *this);
}
class AsyncMutationHandler : public mozilla::Runnable
{
public:
NS_IMETHOD Run() override
{
nsDOMMutationObserver::HandleMutations();
return NS_OK;
}
};
void
nsDOMMutationObserver::HandleMutationsInternal()
nsDOMMutationObserver::HandleMutationsInternal(AutoSlowOperation& aAso)
{
if (!nsContentUtils::IsSafeToRunScript()) {
nsContentUtils::AddScriptRunner(new AsyncMutationHandler());
return;
}
static RefPtr<nsDOMMutationObserver> sCurrentObserver;
if (sCurrentObserver && !sCurrentObserver->Suppressed()) {
// In normal cases sScheduledMutationObservers will be handled
// after previous mutations are handled. But in case some
// callback calls a sync API, which spins the eventloop, we need to still
// process other mutations happening during that sync call.
// This does *not* catch all cases, but should work for stuff running
// in separate tabs.
return;
}
mozilla::AutoSlowOperation aso;
nsTArray<RefPtr<nsDOMMutationObserver> >* suppressedObservers = nullptr;
while (sScheduledMutationObservers) {
@@ -899,20 +892,21 @@ nsDOMMutationObserver::HandleMutationsInternal()
sScheduledMutationObservers;
sScheduledMutationObservers = nullptr;
for (uint32_t i = 0; i < observers->Length(); ++i) {
sCurrentObserver = static_cast<nsDOMMutationObserver*>((*observers)[i]);
if (!sCurrentObserver->Suppressed()) {
sCurrentObserver->HandleMutation();
RefPtr<nsDOMMutationObserver> currentObserver =
static_cast<nsDOMMutationObserver*>((*observers)[i]);
if (!currentObserver->Suppressed()) {
currentObserver->HandleMutation();
} else {
if (!suppressedObservers) {
suppressedObservers = new nsTArray<RefPtr<nsDOMMutationObserver> >;
}
if (!suppressedObservers->Contains(sCurrentObserver)) {
suppressedObservers->AppendElement(sCurrentObserver);
if (!suppressedObservers->Contains(currentObserver)) {
suppressedObservers->AppendElement(currentObserver);
}
}
}
delete observers;
aso.CheckForInterrupt();
aAso.CheckForInterrupt();
}
if (suppressedObservers) {
@@ -923,7 +917,6 @@ nsDOMMutationObserver::HandleMutationsInternal()
delete suppressedObservers;
suppressedObservers = nullptr;
}
sCurrentObserver = nullptr;
}
nsDOMMutationRecord*
+19 -4
View File
@@ -552,13 +552,29 @@ public:
}
// static methods
static void HandleMutations()
static void HandleMutations(mozilla::AutoSlowOperation& aAso)
{
if (sScheduledMutationObservers) {
HandleMutationsInternal();
HandleMutationsInternal(aAso);
}
}
static bool AllScheduledMutationObserversAreSuppressed()
{
if (sScheduledMutationObservers) {
uint32_t len = sScheduledMutationObservers->Length();
if (len > 0) {
for (uint32_t i = 0; i < len; ++i) {
if (!(*sScheduledMutationObservers)[i]->Suppressed()) {
return false;
}
}
return true;
}
}
return false;
}
static void EnterMutationHandling();
static void LeaveMutationHandling();
@@ -594,7 +610,7 @@ protected:
return false;
}
static void HandleMutationsInternal();
static void HandleMutationsInternal(mozilla::AutoSlowOperation& aAso);
static void AddCurrentlyHandlingObserver(nsDOMMutationObserver* aObserver,
uint32_t aMutationLevel);
@@ -622,7 +638,6 @@ protected:
static uint64_t sCount;
static AutoTArray<RefPtr<nsDOMMutationObserver>, 4>* sScheduledMutationObservers;
static nsDOMMutationObserver* sCurrentObserver;
static uint32_t sMutationLevel;
static AutoTArray<AutoTArray<RefPtr<nsDOMMutationObserver>, 4>, 4>*
-1
View File
@@ -34,7 +34,6 @@ DEPRECATED_OPERATION(UseOfCaptureEvents)
DEPRECATED_OPERATION(UseOfReleaseEvents)
DEPRECATED_OPERATION(UseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ChromeUseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ShowModalDialog)
DEPRECATED_OPERATION(Window_Content)
DEPRECATED_OPERATION(SyncXMLHttpRequest)
DEPRECATED_OPERATION(DataContainerEvent)
+123 -64
View File
@@ -166,7 +166,6 @@
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/MediaSource.h"
#include "mozilla/dom/FlyWebService.h"
#include "mozAutoDocUpdate.h"
#include "nsGlobalWindow.h"
@@ -1329,7 +1328,8 @@ nsIDocument::nsIDocument()
mFrameRequestCallbacksScheduled(false),
mBidiOptions(IBMBIDI_DEFAULT_BIDI_OPTIONS),
mPartID(0),
mUserHasInteracted(false)
mUserHasInteracted(false),
mThrowOnDynamicMarkupInsertionCounter(0)
{
SetIsInDocument();
@@ -5395,18 +5395,14 @@ nsDocument::CreateElement(const nsAString& aTagName,
}
const nsString* is = nullptr;
if (aOptions.IsElementCreationOptions()) {
// Throw NotFoundError if 'is' is not-null and definition is null
is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
needsLowercase ? lcTagName : aTagName, mDefaultElementType, rv);
if (rv.Failed()) {
return nullptr;
}
}
RefPtr<Element> elem = CreateElem(
needsLowercase ? lcTagName : aTagName, nullptr, mDefaultElementType, is);
if (is) {
elem->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
}
return elem.forget();
}
@@ -5443,14 +5439,6 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
}
const nsString* is = nullptr;
if (aOptions.IsElementCreationOptions()) {
// Throw NotFoundError if 'is' is not-null and definition is null
is = CheckCustomElementName(aOptions.GetAsElementCreationOptions(),
aQualifiedName, nodeInfo->NamespaceID(), rv);
if (rv.Failed()) {
return nullptr;
}
}
nsCOMPtr<Element> element;
rv = NS_NewElement(getter_AddRefs(element), nodeInfo.forget(),
@@ -5459,6 +5447,10 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
return nullptr;
}
if (is) {
element->SetAttr(kNameSpaceID_None, nsGkAtoms::is, *is, true);
}
return element.forget();
}
@@ -5681,24 +5673,70 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
}
nsCOMPtr<nsIAtom> typeAtom(NS_Atomize(elemName));
CustomElementDefinition* definition = registry->mCustomDefinitions.Get(typeAtom);
CustomElementDefinition* definition =
registry->mCustomDefinitions.GetWeak(typeAtom);
if (!definition) {
return true;
}
nsDependentAtomString localName(definition->mLocalName);
RefPtr<Element> element;
nsCOMPtr<Element> element =
document->CreateElem(localName, nullptr, kNameSpaceID_XHTML);
NS_ENSURE_TRUE(element, true);
// We integrate with construction stack and do prototype swizzling here, so
// that old upgrade behavior could also share the new upgrade steps.
// And this old upgrade will be remove at some point (when everything is
// switched to latest custom element spec).
nsTArray<RefPtr<nsGenericHTMLElement>>& constructionStack =
definition->mConstructionStack;
if (constructionStack.Length()) {
element = constructionStack.LastElement();
NS_ENSURE_TRUE(element != ALEADY_CONSTRUCTED_MARKER, false);
if (definition->mLocalName != typeAtom) {
// This element is a custom element by extension, thus we need to
// do some special setup. For non-extended custom elements, this happens
// when the element is created.
nsContentUtils::SetupCustomElement(element, &elemName);
// Do prototype swizzling if dom reflector exists.
JS::Rooted<JSObject*> reflector(aCx, element->GetWrapper());
if (reflector) {
Maybe<JSAutoCompartment> ac;
JS::Rooted<JSObject*> prototype(aCx, definition->mPrototype);
if (element->NodePrincipal()->SubsumesConsideringDomain(nsContentUtils::ObjectPrincipal(prototype))) {
ac.emplace(aCx, reflector);
if (!JS_WrapObject(aCx, &prototype) ||
!JS_SetPrototype(aCx, reflector, prototype)) {
return false;
}
} else {
// We want to set the custom prototype in the compartment where it was
// registered. We store the prototype from define() without unwrapped,
// hence the prototype's compartment is the compartment where it was
// registered.
// In the case that |reflector| and |prototype| are in different
// compartments, this will set the prototype on the |reflector|'s wrapper
// and thus only visible in the wrapper's compartment, since we know
// reflector's principal does not subsume prototype's in this case.
ac.emplace(aCx, prototype);
if (!JS_WrapObject(aCx, &reflector) ||
!JS_SetPrototype(aCx, reflector, prototype)) {
return false;
}
}
// Wrap into current context.
if (!JS_WrapObject(aCx, &reflector)) {
return false;
}
args.rval().setObject(*reflector);
return true;
}
} else {
nsDependentAtomString localName(definition->mLocalName);
element =
document->CreateElem(localName, nullptr, kNameSpaceID_XHTML,
(definition->mLocalName != typeAtom) ? &elemName
: nullptr);
NS_ENSURE_TRUE(element, false);
}
// The prototype setup happens in Element::WrapObject().
nsresult rv = nsContentUtils::WrapNative(aCx, element, element, args.rval());
NS_ENSURE_SUCCESS(rv, true);
@@ -5710,7 +5748,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
{
JS::Rooted<JSObject*> obj(aCx, aObject);
if (Preferences::GetBool("dom.webcomponents.enabled")) {
if (nsContentUtils::IsWebComponentsEnabled()) {
return true;
}
@@ -5726,7 +5764,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
bool
nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
{
if (Preferences::GetBool("dom.webcomponents.enabled")) {
if (nsContentUtils::IsWebComponentsEnabled()) {
return true;
}
@@ -5770,6 +5808,8 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
return;
}
AutoCEReaction ceReaction(this->GetDocGroup()->CustomElementReactionsStack(),
aCx);
// Unconditionally convert TYPE to lowercase.
nsAutoString lcType;
nsContentUtils::ASCIIToLower(aType, lcType);
@@ -6536,6 +6576,49 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
return nullptr;
}
nsGenericHTMLElement*
nsIDocument::GetBody()
{
Element* html = GetHtmlElement();
if (!html) {
return nullptr;
}
for (nsIContent* child = html->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->IsHTMLElement(nsGkAtoms::body) ||
child->IsHTMLElement(nsGkAtoms::frameset)) {
return static_cast<nsGenericHTMLElement*>(child);
}
}
return nullptr;
}
void
nsIDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
{
nsCOMPtr<Element> root = GetRootElement();
// The body element must be either a body tag or a frameset tag. And we must
// have a root element to be able to add kids to it.
if (!newBody ||
!newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) ||
!root) {
rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return;
}
// Use DOM methods so that we pass through the appropriate security checks.
nsCOMPtr<Element> currentBody = GetBody();
if (currentBody) {
root->ReplaceChild(*newBody, *currentBody, rv);
} else {
root->AppendChild(*newBody, rv);
}
}
Element*
nsDocument::GetTitleElement()
{
@@ -8369,13 +8452,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
return false;
}
// Don't save presentation if there are active FlyWeb connections or FlyWeb
// servers.
FlyWebService* flyWebService = FlyWebService::GetExisting();
if (flyWebService && flyWebService->HasConnectionOrServer(win->WindowID())) {
return false;
}
if (mSubDocuments) {
for (auto iter = mSubDocuments->Iter(); !iter.Done(); iter.Next()) {
auto entry = static_cast<SubDocMapEntry*>(iter.Get());
@@ -12526,8 +12602,12 @@ MarkDocumentTreeToBeInSyncOperation(nsIDocument* aDoc, void* aData)
nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
{
mMicroTaskLevel = nsContentUtils::MicroTaskLevel();
nsContentUtils::SetMicroTaskLevel(0);
mMicroTaskLevel = 0;
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
if (ccjs) {
mMicroTaskLevel = ccjs->MicroTaskLevel();
ccjs->SetMicroTaskLevel(0);
}
if (aDoc) {
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
@@ -12543,7 +12623,10 @@ nsAutoSyncOperation::~nsAutoSyncOperation()
for (int32_t i = 0; i < mDocuments.Count(); ++i) {
mDocuments[i]->SetIsInSyncOperation(false);
}
nsContentUtils::SetMicroTaskLevel(mMicroTaskLevel);
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
if (ccjs) {
ccjs->SetMicroTaskLevel(mMicroTaskLevel);
}
}
gfxUserFontSet*
@@ -12713,30 +12796,6 @@ nsIDocument::UpdateStyleBackendType()
#endif
}
const nsString*
nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
const nsAString& aLocalName,
uint32_t aNamespaceID,
ErrorResult& rv)
{
// only check aOptions if 'is' is passed and the webcomponents preference
// is enabled
if (!aOptions.mIs.WasPassed() ||
!CustomElementRegistry::IsCustomElementEnabled()) {
return nullptr;
}
const nsString* is = &aOptions.mIs.Value();
// Throw NotFoundError if 'is' is not-null and definition is null
if (!nsContentUtils::LookupCustomElementDefinition(this, aLocalName,
aNamespaceID, is)) {
rv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
}
return is;
}
Selection*
nsIDocument::GetSelection(ErrorResult& aRv)
{
-14
View File
@@ -1388,20 +1388,6 @@ protected:
private:
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
/**
* Check if the passed custom element name, aOptions.mIs, is a registered
* custom element type or not, then return the custom element name for future
* usage.
*
* If there is no existing custom element definition for this name, throw a
* NotFoundError.
*/
const nsString* CheckCustomElementName(
const mozilla::dom::ElementCreationOptions& aOptions,
const nsAString& aLocalName,
uint32_t aNamespaceID,
ErrorResult& rv);
public:
virtual already_AddRefed<mozilla::dom::CustomElementRegistry>
GetCustomElementRegistry() override;
+9
View File
@@ -1261,6 +1261,15 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags,
isElementInActiveWindow = (mActiveWindow && newRootWindow == mActiveWindow);
}
// Exit fullscreen if a website focuses another window
if (!isElementInActiveWindow && aFlags & FLAG_RAISE) {
if (nsIDocument* doc = mActiveWindow ? mActiveWindow->GetDoc() : nullptr) {
if (doc && doc->GetFullscreenElement()) {
nsIDocument::AsyncExitFullscreen(doc);
}
}
}
// Exit fullscreen if we're focusing a windowed plugin on a non-MacOSX
// system. We don't control event dispatch to windowed plugins on non-MacOSX,
// so we can't display the "Press ESC to leave fullscreen mode" warning on
-11
View File
@@ -793,17 +793,6 @@ nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent)
}
}
CustomElementData *
nsGenericDOMDataNode::GetCustomElementData() const
{
return nullptr;
}
void
nsGenericDOMDataNode::SetCustomElementData(CustomElementData* aData)
{
}
bool
nsGenericDOMDataNode::IsNodeOfType(uint32_t aFlags) const
{
-3
View File
@@ -162,9 +162,6 @@ public:
virtual bool IsNodeOfType(uint32_t aFlags) const override;
virtual bool IsLink(nsIURI** aURI) const override;
virtual mozilla::dom::CustomElementData* GetCustomElementData() const override;
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) override;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
+6 -316
View File
@@ -909,7 +909,6 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
mMayHaveMouseEnterLeaveEventListener(false),
mMayHavePointerEnterLeaveEventListener(false),
mInnerObjectsFreed(false),
mIsModalContentWindow(false),
mIsActive(false), mIsBackground(false),
mMediaSuspend(Preferences::GetBool("media.block-autoplay-until-in-foreground", true) ?
nsISuspendedTypes::SUSPENDED_BLOCK : nsISuspendedTypes::NONE_SUSPENDED),
@@ -1957,7 +1956,6 @@ nsGlobalWindow::CleanUp()
}
mArguments = nullptr;
mDialogArguments = nullptr;
CleanupCachedXBLHandlers(this);
@@ -2195,7 +2193,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArguments)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDialogArguments)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReturnValue)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator)
@@ -2274,7 +2271,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDialogArguments)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReturnValue)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
@@ -3019,8 +3015,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
} else {
if (thisChrome) {
newInnerWindow = nsGlobalChromeWindow::Create(this);
} else if (mIsModalContentWindow) {
newInnerWindow = nsGlobalModalWindow::Create(this);
} else {
newInnerWindow = nsGlobalWindow::Create(this);
}
@@ -3871,31 +3865,16 @@ nsGlobalWindow::SetArguments(nsIArray *aArguments)
MOZ_ASSERT(IsOuterWindow());
nsresult rv;
// Historically, we've used the same machinery to handle openDialog arguments
// (exposed via window.arguments) and showModalDialog arguments (exposed via
// window.dialogArguments), even though the former is XUL-only and uses an XPCOM
// array while the latter is web-exposed and uses an arbitrary JS value.
// Moreover, per-spec |dialogArguments| is a property of the browsing context
// (outer), whereas |arguments| lives on the inner.
//
// We've now mostly separated them, but the difference is still opaque to
// nsWindowWatcher (the caller of SetArguments in this little back-and-forth
// embedding waltz we do here).
//
// So we need to demultiplex the two cases here.
nsGlobalWindow *currentInner = GetCurrentInnerWindowInternal();
if (mIsModalContentWindow) {
// nsWindowWatcher blindly converts the original nsISupports into an array
// of length 1. We need to recover it, and then cast it back to the concrete
// object we know it to be.
nsCOMPtr<nsISupports> supports = do_QueryElementAt(aArguments, 0, &rv);
NS_ENSURE_SUCCESS(rv, rv);
mDialogArguments = static_cast<DialogValueHolder*>(supports.get());
} else {
mArguments = aArguments;
rv = currentInner->DefineArgumentsProperty(aArguments);
NS_ENSURE_SUCCESS(rv, rv);
}
mArguments = aArguments;
rv = currentInner->DefineArgumentsProperty(aArguments);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@@ -3904,7 +3883,6 @@ nsresult
nsGlobalWindow::DefineArgumentsProperty(nsIArray *aArguments)
{
MOZ_ASSERT(IsInnerWindow());
MOZ_ASSERT(!mIsModalContentWindow); // Handled separately.
nsIScriptContext *ctx = GetOuterWindowInternal()->mContext;
NS_ENSURE_TRUE(aArguments && ctx, NS_ERROR_NOT_INITIALIZED);
@@ -4263,8 +4241,9 @@ CustomElementRegistry*
nsGlobalWindow::CustomElements()
{
MOZ_RELEASE_ASSERT(IsInnerWindow());
if (!mCustomElements) {
mCustomElements = CustomElementRegistry::Create(AsInner());
mCustomElements = new CustomElementRegistry(AsInner());
}
return mCustomElements;
@@ -5040,21 +5019,6 @@ nsGlobalWindow::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal();
}
/* static */ bool
nsGlobalWindow::IsShowModalDialogEnabled(JSContext*, JSObject*)
{
static bool sAddedPrefCache = false;
static bool sIsDisabled;
static const char sShowModalDialogPref[] = "dom.disable_window_showModalDialog";
if (!sAddedPrefCache) {
Preferences::AddBoolVarCache(&sIsDisabled, sShowModalDialogPref, false);
sAddedPrefCache = true;
}
return !sIsDisabled && !XRE_IsContentProcess();
}
nsIDOMOfflineResourceList*
nsGlobalWindow::GetApplicationCache(ErrorResult& aError)
{
@@ -9741,126 +9705,6 @@ nsGlobalWindow::ConvertDialogOptions(const nsAString& aOptions,
}
}
already_AddRefed<nsIVariant>
nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl,
nsIVariant* aArgument,
const nsAString& aOptions,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (mDoc) {
mDoc->WarnOnceAbout(nsIDocument::eShowModalDialog);
}
if (!IsShowModalDialogEnabled()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
RefPtr<DialogValueHolder> argHolder =
new DialogValueHolder(&aSubjectPrincipal, aArgument);
// Before bringing up the window/dialog, unsuppress painting and flush
// pending reflows.
EnsureReflowFlushAndPaint();
if (!AreDialogsEnabled()) {
// We probably want to keep throwing here; silently doing nothing is a bit
// weird given the typical use cases of showModalDialog().
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
nsCOMPtr<nsPIDOMWindowOuter> dlgWin;
nsAutoString options(NS_LITERAL_STRING("-moz-internal-modal=1,status=1"));
ConvertDialogOptions(aOptions, options);
options.AppendLiteral(",scrollbars=1,centerscreen=1,resizable=0");
EnterModalState();
uint32_t oldMicroTaskLevel = nsContentUtils::MicroTaskLevel();
nsContentUtils::SetMicroTaskLevel(0);
aError = OpenInternal(aUrl, EmptyString(), options,
false, // aDialog
true, // aContentModal
true, // aCalledNoScript
true, // aDoJSFixups
true, // aNavigate
nullptr, argHolder, // args
nullptr, // aLoadInfo
false, // aForceNoOpener
getter_AddRefs(dlgWin));
nsContentUtils::SetMicroTaskLevel(oldMicroTaskLevel);
LeaveModalState();
if (aError.Failed()) {
return nullptr;
}
nsCOMPtr<nsIDOMModalContentWindow> dialog = do_QueryInterface(dlgWin);
if (!dialog) {
return nullptr;
}
nsCOMPtr<nsIVariant> retVal;
aError = dialog->GetReturnValue(getter_AddRefs(retVal));
MOZ_ASSERT(!aError.Failed());
return retVal.forget();
}
already_AddRefed<nsIVariant>
nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
const nsAString& aOptions,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(ShowModalDialogOuter,
(aUrl, aArgument, aOptions, aSubjectPrincipal,
aError), aError, nullptr);
}
void
nsGlobalWindow::ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
JS::Handle<JS::Value> aArgument,
const nsAString& aOptions,
JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
MOZ_ASSERT(IsInnerWindow());
nsCOMPtr<nsIVariant> args;
aError = nsContentUtils::XPConnect()->JSToVariant(aCx,
aArgument,
getter_AddRefs(args));
if (aError.Failed()) {
return;
}
nsCOMPtr<nsIVariant> retVal =
ShowModalDialog(aUrl, args, aOptions, aSubjectPrincipal, aError);
if (aError.Failed()) {
return;
}
JS::Rooted<JS::Value> result(aCx);
if (retVal) {
aError = nsContentUtils::XPConnect()->VariantToJS(aCx,
FastGetGlobalJSObject(),
retVal, aRetval);
} else {
aRetval.setNull();
}
}
class ChildCommandDispatcher : public Runnable
{
public:
@@ -14613,70 +14457,6 @@ nsGlobalChromeWindow::TakeOpenerForInitialContentBrowser(mozIDOMWindowProxy** aO
return NS_OK;
}
// nsGlobalModalWindow implementation
// QueryInterface implementation for nsGlobalModalWindow
NS_INTERFACE_MAP_BEGIN(nsGlobalModalWindow)
NS_INTERFACE_MAP_ENTRY(nsIDOMModalContentWindow)
NS_INTERFACE_MAP_END_INHERITING(nsGlobalWindow)
NS_IMPL_ADDREF_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
NS_IMPL_RELEASE_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
void
nsGlobalWindow::GetDialogArgumentsOuter(JSContext* aCx,
JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
MOZ_ASSERT(IsModalContentWindow(),
"This should only be called on modal windows!");
if (!mDialogArguments) {
MOZ_ASSERT(mIsClosed, "This window should be closed!");
aRetval.setUndefined();
return;
}
// This does an internal origin check, and returns undefined if the subject
// does not subsumes the origin of the arguments.
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
JSAutoCompartment ac(aCx, wrapper);
mDialogArguments->Get(aCx, wrapper, &aSubjectPrincipal, aRetval, aError);
}
void
nsGlobalWindow::GetDialogArguments(JSContext* aCx,
JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(GetDialogArgumentsOuter,
(aCx, aRetval, aSubjectPrincipal, aError),
aError, );
}
/* static */ already_AddRefed<nsGlobalModalWindow>
nsGlobalModalWindow::Create(nsGlobalWindow *aOuterWindow)
{
RefPtr<nsGlobalModalWindow> window = new nsGlobalModalWindow(aOuterWindow);
window->InitWasOffline();
return window.forget();
}
NS_IMETHODIMP
nsGlobalModalWindow::GetDialogArguments(nsIVariant **aArguments)
{
FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(GetDialogArguments, (aArguments),
NS_ERROR_NOT_INITIALIZED);
// This does an internal origin check, and returns undefined if the subject
// does not subsumes the origin of the arguments.
return mDialogArguments->Get(nsContentUtils::SubjectPrincipal(), aArguments);
}
/* static */ already_AddRefed<nsGlobalWindow>
nsGlobalWindow::Create(nsGlobalWindow *aOuterWindow)
{
@@ -14691,96 +14471,6 @@ nsGlobalWindow::InitWasOffline()
mWasOffline = NS_IsOffline();
}
void
nsGlobalWindow::GetReturnValueOuter(JSContext* aCx,
JS::MutableHandle<JS::Value> aReturnValue,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
MOZ_ASSERT(IsModalContentWindow(),
"This should only be called on modal windows!");
if (mReturnValue) {
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
JSAutoCompartment ac(aCx, wrapper);
mReturnValue->Get(aCx, wrapper, &aSubjectPrincipal, aReturnValue, aError);
} else {
aReturnValue.setUndefined();
}
}
void
nsGlobalWindow::GetReturnValue(JSContext* aCx,
JS::MutableHandle<JS::Value> aReturnValue,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(GetReturnValueOuter,
(aCx, aReturnValue, aSubjectPrincipal, aError),
aError, );
}
NS_IMETHODIMP
nsGlobalModalWindow::GetReturnValue(nsIVariant **aRetVal)
{
FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(GetReturnValue, (aRetVal), NS_OK);
if (!mReturnValue) {
nsCOMPtr<nsIVariant> variant = CreateVoidVariant();
variant.forget(aRetVal);
return NS_OK;
}
return mReturnValue->Get(nsContentUtils::SubjectPrincipal(), aRetVal);
}
void
nsGlobalWindow::SetReturnValueOuter(JSContext* aCx,
JS::Handle<JS::Value> aReturnValue,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
MOZ_ASSERT(IsModalContentWindow(),
"This should only be called on modal windows!");
nsCOMPtr<nsIVariant> returnValue;
aError =
nsContentUtils::XPConnect()->JSToVariant(aCx, aReturnValue,
getter_AddRefs(returnValue));
if (!aError.Failed()) {
mReturnValue = new DialogValueHolder(&aSubjectPrincipal, returnValue);
}
}
void
nsGlobalWindow::SetReturnValue(JSContext* aCx,
JS::Handle<JS::Value> aReturnValue,
nsIPrincipal& aSubjectPrincipal,
ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(SetReturnValueOuter,
(aCx, aReturnValue, aSubjectPrincipal, aError),
aError, );
}
NS_IMETHODIMP
nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal)
{
FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(SetReturnValue, (aRetVal), NS_OK);
mReturnValue = new DialogValueHolder(nsContentUtils::SubjectPrincipal(),
aRetVal);
return NS_OK;
}
/* static */
bool
nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal)
{
return xpc::WindowOrNull(aGlobal)->IsModalContentWindow();
}
#if defined(MOZ_WIDGET_ANDROID)
int16_t
nsGlobalWindow::Orientation(CallerType aCallerType) const
+1 -60
View File
@@ -458,9 +458,6 @@ public:
static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj);
static bool IsShowModalDialogEnabled(JSContext* /* unused */ = nullptr,
JSObject* /* unused */ = nullptr);
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
JS::Handle<jsid> aId,
JS::MutableHandle<JS::PropertyDescriptor> aDesc);
@@ -583,9 +580,6 @@ public:
return mIsChrome;
}
using nsPIDOMWindow::IsModalContentWindow;
static bool IsModalContentWindow(JSContext* aCx, JSObject* aGlobal);
// GetScrollFrame does not flush. Callers should do it themselves as needed,
// depending on which info they actually want off the scrollable frame.
nsIScrollableFrame *GetScrollFrame();
@@ -950,12 +944,6 @@ public:
mozilla::ErrorResult& aRv);
void PrintOuter(mozilla::ErrorResult& aError);
void Print(mozilla::ErrorResult& aError);
void ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
JS::Handle<JS::Value> aArgument,
const nsAString& aOptions,
JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const nsAString& aTargetOrigin,
const mozilla::dom::Optional<mozilla::dom::Sequence<JS::Value > >& aTransfer,
@@ -1227,12 +1215,6 @@ public:
mozilla::dom::Element* aPanel,
mozilla::ErrorResult& aError);
void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
@@ -1681,18 +1663,6 @@ protected:
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
already_AddRefed<nsIVariant>
ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgument,
const nsAString& aOptions,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
already_AddRefed<nsIVariant>
ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
const nsAString& aOptions,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
// Ask the user if further dialogs should be blocked, if dialogs are currently
// being abused. This is used in the cases where we have no modifiable UI to
// show, in that case we show a separate dialog to ask this question.
@@ -1832,9 +1802,6 @@ protected:
// For |window.arguments|, via |openDialog|.
nsCOMPtr<nsIArray> mArguments;
// For |window.dialogArguments|, via |showModalDialog|.
RefPtr<DialogValueHolder> mDialogArguments;
// Only used in the outer.
RefPtr<DialogValueHolder> mReturnValue;
@@ -2067,40 +2034,14 @@ public:
nsCOMPtr<mozIDOMWindowProxy> mOpenerForInitialContentBrowser;
};
/*
* nsGlobalModalWindow inherits from nsGlobalWindow. It is the global
* object created for a modal content windows only (i.e. not modal
* chrome dialogs).
*/
class nsGlobalModalWindow : public nsGlobalWindow,
public nsIDOMModalContentWindow
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMMODALCONTENTWINDOW
static already_AddRefed<nsGlobalModalWindow> Create(nsGlobalWindow *aOuterWindow);
protected:
explicit nsGlobalModalWindow(nsGlobalWindow *aOuterWindow)
: nsGlobalWindow(aOuterWindow)
{
mIsModalContentWindow = true;
}
~nsGlobalModalWindow() {}
};
/* factory function */
inline already_AddRefed<nsGlobalWindow>
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow)
NS_NewScriptGlobalObject(bool aIsChrome)
{
RefPtr<nsGlobalWindow> global;
if (aIsChrome) {
global = nsGlobalChromeWindow::Create(nullptr);
} else if (aIsModalContentWindow) {
global = nsGlobalModalWindow::Create(nullptr);
} else {
global = nsGlobalWindow::Create(nullptr);
}
-17
View File
@@ -26,7 +26,6 @@ namespace mozilla {
class EventChainPreVisitor;
namespace dom {
class ShadowRoot;
struct CustomElementData;
} // namespace dom
namespace widget {
struct IMEState;
@@ -729,22 +728,6 @@ public:
*/
nsINode *GetFlattenedTreeParentNodeInternal() const;
/**
* Gets the custom element data used by web components custom element.
* Custom element data is created at the first attempt to enqueue a callback.
*
* @return The custom element data or null if none.
*/
virtual mozilla::dom::CustomElementData *GetCustomElementData() const = 0;
/**
* Sets the custom element data, ownership of the
* callback data is taken by this content.
*
* @param aCallbackData The custom element data.
*/
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) = 0;
/**
* API to check if this is a link that's traversed in response to user input
* (e.g. a click event). Specializations for HTML/SVG/generic XML allow for
+47 -3
View File
@@ -61,6 +61,7 @@ class nsFrameLoader;
class nsHTMLCSSStyleSheet;
class nsHTMLDocument;
class nsHTMLStyleSheet;
class nsGenericHTMLElement;
class nsIAtom;
class nsIBFCacheEntry;
class nsIChannel;
@@ -1036,6 +1037,11 @@ public:
Element* GetHeadElement() {
return GetHtmlChildElement(nsGkAtoms::head);
}
// Get the "body" in the sense of document.body: The first <body> or
// <frameset> that's a child of a root <html>
nsGenericHTMLElement* GetBody();
// Set the "body" in the sense of document.body.
void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);
/**
* Accessors to the collection of stylesheets owned by this document.
@@ -2573,9 +2579,9 @@ public:
}
enum ElementCallbackType {
eCreated,
eAttached,
eDetached,
eConnected,
eDisconnected,
eAdopted,
eAttributeChanged
};
@@ -2872,6 +2878,22 @@ public:
virtual void ScheduleIntersectionObserverNotification() = 0;
virtual void NotifyIntersectionObservers() = 0;
bool ShouldThrowOnDynamicMarkupInsertion()
{
return mThrowOnDynamicMarkupInsertionCounter;
}
void IncrementThrowOnDynamicMarkupInsertionCounter()
{
++mThrowOnDynamicMarkupInsertionCounter;
}
void DecrementThrowOnDynamicMarkupInsertionCounter()
{
MOZ_ASSERT(mThrowOnDynamicMarkupInsertionCounter);
--mThrowOnDynamicMarkupInsertionCounter;
}
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{
@@ -3319,6 +3341,11 @@ protected:
uint32_t mBlockDOMContentLoaded;
// Used in conjunction with the create-an-element-for-the-token algorithm to
// prevent custom element constructors from being able to use document.open(),
// document.close(), and document.write() when they are invoked by the parser.
uint32_t mThrowOnDynamicMarkupInsertionCounter;
// Our live MediaQueryLists
PRCList mDOMMediaQueryLists;
@@ -3392,6 +3419,23 @@ private:
uint32_t mMicroTaskLevel;
};
class MOZ_RAII AutoSetThrowOnDynamicMarkupInsertionCounter final {
public:
explicit AutoSetThrowOnDynamicMarkupInsertionCounter(
nsIDocument* aDocument)
: mDocument(aDocument)
{
mDocument->IncrementThrowOnDynamicMarkupInsertionCounter();
}
~AutoSetThrowOnDynamicMarkupInsertionCounter() {
mDocument->DecrementThrowOnDynamicMarkupInsertionCounter();
}
private:
nsIDocument* mDocument;
};
// XXX These belong somewhere else
nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData = false);
+7 -4
View File
@@ -25,7 +25,7 @@
#include "xpcpublic.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Element.h"
@@ -159,7 +159,8 @@ nsJSUtils::EvaluateString(JSContext* aCx,
aEvaluationGlobal);
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
CycleCollectedJSContext::Get()->MicroTaskLevel());
// Unfortunately, the JS engine actually compiles scripts with a return value
// in a different, less efficient way. Furthermore, it can't JIT them in many
@@ -293,7 +294,8 @@ nsJSUtils::CompileModule(JSContext* aCx,
aEvaluationGlobal);
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx) == aEvaluationGlobal);
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
CycleCollectedJSContext::Get()->MicroTaskLevel());
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
@@ -330,7 +332,8 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
CycleCollectedJSContext::Get()->MicroTaskLevel());
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
+49 -15
View File
@@ -301,9 +301,12 @@ nsNodeUtils::LastRelease(nsINode* aNode)
Element* elem = aNode->AsElement();
FragmentOrElement::nsDOMSlots* domSlots =
static_cast<FragmentOrElement::nsDOMSlots*>(slots);
for (auto iter = domSlots->mRegisteredIntersectionObservers.Iter(); !iter.Done(); iter.Next()) {
DOMIntersectionObserver* observer = iter.Key();
observer->UnlinkTarget(*elem);
if (domSlots->mExtendedSlots) {
for (auto iter = domSlots->mExtendedSlots->mRegisteredIntersectionObservers.Iter();
!iter.Done(); iter.Next()) {
DOMIntersectionObserver* observer = iter.Key();
observer->UnlinkTarget(*elem);
}
}
}
@@ -476,19 +479,33 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
rv = aNode->Clone(nodeInfo, getter_AddRefs(clone));
NS_ENSURE_SUCCESS(rv, rv);
if (clone->IsElement()) {
if (CustomElementRegistry::IsCustomElementEnabled() &&
clone->IsHTMLElement()) {
// The cloned node may be a custom element that may require
// enqueing created callback and prototype swizzling.
Element* elem = clone->AsElement();
if (nsContentUtils::IsCustomElementName(nodeInfo->NameAtom())) {
nsContentUtils::SetupCustomElement(elem);
} else {
// Check if node may be custom element by type extension.
// ex. <button is="x-button">
nsAutoString extension;
if (elem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension) &&
!extension.IsEmpty()) {
nsContentUtils::SetupCustomElement(elem, &extension);
// enqueing upgrade reaction.
Element* cloneElem = clone->AsElement();
RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
CustomElementData* data = elem->GetCustomElementData();
// Check if node may be custom element by type extension.
// ex. <button is="x-button">
nsAutoString extension;
if (!data || data->GetCustomElementType() != tagAtom) {
cloneElem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension);
}
if (data || !extension.IsEmpty()) {
RefPtr<nsIAtom> typeAtom = extension.IsEmpty() ? tagAtom : NS_Atomize(extension);
cloneElem->SetCustomElementData(new CustomElementData(typeAtom));
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
CustomElementDefinition* definition =
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
nodeInfo->NameAtom(),
nodeInfo->NamespaceID(),
typeAtom);
if (definition) {
nsContentUtils::EnqueueUpgradeReaction(cloneElem, definition);
}
}
}
@@ -523,6 +540,23 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
nsIDocument* newDoc = aNode->OwnerDoc();
if (newDoc) {
if (CustomElementRegistry::IsCustomElementEnabled()) {
// Adopted callback must be enqueued whenever a node’s
// shadow-including inclusive descendants that is custom.
Element* element = aNode->IsElement() ? aNode->AsElement() : nullptr;
if (element) {
CustomElementData* data = element->GetCustomElementData();
if (data && data->mState == CustomElementData::State::eCustom) {
LifecycleAdoptedCallbackArgs args = {
oldDoc,
newDoc
};
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAdopted,
element, nullptr, &args);
}
}
}
// XXX what if oldDoc is null, we don't know if this should be
// registered or not! Can that really happen?
if (wasRegistered) {
-10
View File
@@ -303,11 +303,6 @@ public:
virtual bool CanClose() = 0;
virtual void ForceClose() = 0;
bool IsModalContentWindow() const
{
return mIsModalContentWindow;
}
/**
* Call this to indicate that some node (this window, its document,
* or content in that document) has a paint event listener.
@@ -629,11 +624,6 @@ protected:
// This member is only used by inner windows.
bool mInnerObjectsFreed;
// This variable is used on both inner and outer windows (and they
// should match).
bool mIsModalContentWindow;
// Tracks activation state that's used for :-moz-window-inactive.
// Only used on outer windows.
bool mIsActive;
+1 -2
View File
@@ -29,8 +29,7 @@ const unsigned long SANDBOXED_NAVIGATION = 0x1;
/**
* This flag prevents content from creating new auxiliary browsing contexts,
* e.g. using the target attribute, the window.open() method, or the
* showModalDialog() method.
* e.g. using the target attribute, or the window.open() method.
*/
const unsigned long SANDBOXED_AUXILIARY_NAVIGATION = 0x2;
+1 -1
View File
@@ -1144,7 +1144,7 @@ nsScriptLoader::InstantiateModuleTree(nsModuleLoadRequest* aRequest)
nsModuleScript* ms = aRequest->mModuleScript;
MOZ_ASSERT(ms);
if (!ms->ModuleRecord()) {
if (!ms || !ms->ModuleRecord()) {
return false;
}
+2 -2
View File
@@ -1,8 +1,8 @@
var proto = Object.create(HTMLElement.prototype);
proto.magicNumber = 42;
proto.createdCallback = function() {
proto.connectedCallback = function() {
finishTest(this.magicNumber === 42);
};
document.registerElement("x-foo", { prototype: proto });
document.createElement("x-foo");
document.firstChild.appendChild(document.createElement("x-foo"));
@@ -21,19 +21,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
<script type="application/javascript"><![CDATA[
/** Test for Bug 1130028 **/
SimpleTest.waitForExplicitFinish();
var connectedCallbackCount = 0;
var createdCallbackCount = 0;
// Callback should be called once by element created in chrome,
// and once by element created in content.
function createdCallbackCalled() {
createdCallbackCount++;
ok(true, "Created callback called, should be called twice in test.");
// Callback should be called only once by element created in content.
function connectedCallbackCalled() {
connectedCallbackCount++;
is(connectedCallbackCount, 1, "Connected callback called, should be called once in test.");
is(this.magicNumber, 42, "Callback should be able to see the custom prototype.");
if (createdCallbackCount == 2) {
SimpleTest.finish();
}
}
function startTests() {
@@ -45,10 +39,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
var proto = Object.create(frame.contentWindow.HTMLElement.prototype);
proto.magicNumber = 42;
proto.createdCallback = createdCallbackCalled;
frame.contentDocument.registerElement("x-bar", { prototype: proto });
proto.connectedCallback = connectedCallbackCalled;
frame.contentDocument.createElement("x-bar");
frame.contentDocument.registerElement("x-bar", { prototype: proto });
is(connectedCallbackCount, 1, "Connected callback should be called by element created in content.");
var element = frame.contentDocument.createElement("x-bar");
is(element.magicNumber, 42, "Should be able to see the custom prototype on created element.");
}
]]></script>
@@ -26,8 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1130028
SimpleTest.waitForExplicitFinish();
function finishTest(canSeePrototype) {
ok(true, "createdCallback called when reigsterElement was called with an extended principal.");
ok(canSeePrototype, "createdCallback should be able to see custom prototype.");
ok(true, "connectedCallback called when reigsterElement was called with an extended principal.");
ok(canSeePrototype, "connectedCallback should be able to see custom prototype.");
SimpleTest.finish();
}
-4
View File
@@ -196,7 +196,6 @@ support-files =
formReset.html
invalid_accesscontrol.resource
invalid_accesscontrol.resource^headers^
mutationobserver_dialog.html
orientationcommon.js
script-1_bug597345.sjs
script-2_bug597345.js
@@ -627,9 +626,6 @@ subsuite = clipboard
skip-if = toolkit == 'android' #bug 904183
[test_createHTMLDocument.html]
[test_declare_stylesheet_obsolete.html]
[test_dialogArguments.html]
tags = openwindow
skip-if = toolkit == 'android' || e10s # showmodaldialog
[test_document.all_iteration.html]
[test_document.all_unqualified.html]
[test_document_constructor.html]
@@ -1,62 +0,0 @@
<html>
<head>
<title></title>
<script>
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;
}
var didCall1 = false;
var didCall2 = false;
function testMutationObserverInDialog() {
div.innerHTML = "<span>1</span><span>2</span>";
m = new M(function(records, observer) {
opener.is(records[0].type, "childList", "Should have got childList");
opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes");
opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes");
observer.disconnect();
m = null;
didCall1 = true;
});
m.observe(div, { childList: true });
div.innerHTML = "<span><span>foo</span></span>";
}
function testMutationObserverInDialog2() {
div.innerHTML = "<span>1</span><span>2</span>";
m = new M(function(records, observer) {
opener.is(records[0].type, "childList", "Should have got childList");
opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes");
opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes");
observer.disconnect();
m = null;
didCall2 = true;
});
m.observe(div, { childList: true });
div.innerHTML = "<span><span>foo</span></span>";
}
window.addEventListener("load", testMutationObserverInDialog);
window.addEventListener("load", testMutationObserverInDialog2);
window.addEventListener("load",
function() {
opener.ok(didCall1, "Should have called 1st mutation callback");
opener.ok(didCall2, "Should have called 2nd mutation callback");
window.close();
});
</script>
<style>
</style>
</head>
<body>
<input type="button" onclick="window.close()" value="close">
</body>
</html>
-31
View File
@@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for Bug 1019761</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<script type="application/javascript">
/*
Tests whether Firefox crashes when accessing the dialogArguments property
of a modal window that has been closed.
*/
SimpleTest.waitForExplicitFinish();
function openModal() {
showModalDialog("javascript:opener.winRef = window; \
window.opener.setTimeout(\'winRef.dialogArguments;\', 0);\
window.close();");
ok(true, "dialogArguments did not cause a crash.");
SimpleTest.finish();
}
window.onload = openModal;
</script>
</body>
</html>
+32 -23
View File
@@ -362,7 +362,7 @@ function testChildList5() {
is(records[5].previousSibling, c3, "");
is(records[5].nextSibling, c5, "");
observer.disconnect();
then(testAdoptNode);
then(testNestedMutations);
m = null;
});
m.observe(div, { childList: true, subtree: true });
@@ -375,6 +375,37 @@ function testChildList5() {
div.appendChild(emptyDF); // empty document shouldn't cause mutation records
}
function testNestedMutations() {
div.textContent = null;
div.appendChild(document.createTextNode("foo"));
var m2WasCalled = false;
m = new M(function(records, observer) {
is(records[0].type, "characterData", "Should have got characterData");
observer.disconnect();
m = null;
m3 = new M(function(records, observer) {
ok(m2WasCalled, "m2 should have been called before m3!");
is(records[0].type, "characterData", "Should have got characterData");
observer.disconnect();
then(testAdoptNode);
m3 = null;
});
m3.observe(div, { characterData: true, subtree: true});
div.firstChild.data = "foo";
});
m2 = new M(function(records, observer) {
m2WasCalled = true;
is(records[0].type, "characterData", "Should have got characterData");
observer.disconnect();
m2 = null;
});
m2.observe(div, { characterData: true, subtree: true});
div.appendChild(document.createTextNode("foo"));
m.observe(div, { characterData: true, subtree: true });
div.firstChild.data = "bar";
}
function testAdoptNode() {
var d1 = document.implementation.createHTMLDocument(null);
var d2 = document.implementation.createHTMLDocument(null);
@@ -484,28 +515,6 @@ function testSyncXHR() {
function testSyncXHR2() {
ok(callbackHandled, "Should have called the mutation callback!");
then(testModalDialog);
}
function testModalDialog() {
var didHandleCallback = false;
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();
m = null;
didHandleCallback = true;
});
m.observe(div, { childList: true });
div.innerHTML = "<span><span>foo</span></span>";
try {
window.showModalDialog("mutationobserver_dialog.html");
ok(didHandleCallback, "Should have called the callback while showing modal dialog!");
} catch(e) {
todo(false, "showModalDialog not implemented on this platform");
}
then(testTakeRecords);
}
+212
View File
@@ -16,13 +16,16 @@
#include "mozilla/SizePrintfMacros.h"
#include "mozilla/Unused.h"
#include "mozilla/UseCounter.h"
#include "mozilla/dom/DocGroup.h"
#include "AccessCheck.h"
#include "jsfriendapi.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#include "nsIDocShell.h"
#include "nsIDOMGlobalPropertyInitializer.h"
#include "nsIParserService.h"
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsIXPConnect.h"
@@ -37,6 +40,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/DOMErrorBinding.h"
#include "mozilla/dom/DOMException.h"
@@ -44,6 +48,7 @@
#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/HTMLSharedObjectElement.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/HTMLEmbedElementBinding.h"
#include "mozilla/dom/HTMLAppletElementBinding.h"
#include "mozilla/dom/Promise.h"
@@ -62,6 +67,30 @@ namespace dom {
using namespace workers;
// Forward declare GetConstructorObject methods.
#define HTML_TAG(_tag, _classname, _interfacename) \
namespace HTML##_interfacename##ElementBinding { \
JSObject* GetConstructorObject(JSContext*); \
}
#define HTML_OTHER(_tag)
#include "nsHTMLTagList.h"
#undef HTML_TAG
#undef HTML_OTHER
typedef JSObject* (*constructorGetterCallback)(JSContext*);
// Mapping of html tag and GetConstructorObject methods.
#define HTML_TAG(_tag, _classname, _interfacename) HTML##_interfacename##ElementBinding::GetConstructorObject,
#define HTML_OTHER(_tag) nullptr,
// We use eHTMLTag_foo (where foo is the tag) which is defined in nsHTMLTags.h
// to index into this array.
static const constructorGetterCallback sConstructorGetterCallback[] = {
HTMLUnknownElementBinding::GetConstructorObject,
#include "nsHTMLTagList.h"
#undef HTML_TAG
#undef HTML_OTHER
};
const JSErrorFormatString ErrorFormatString[] = {
#define MSG_DEF(_name, _argc, _exn, _str) \
{ #_name, _str, _argc, _exn },
@@ -3377,6 +3406,189 @@ GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
return true;
}
CustomElementReactionsStack*
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj)
{
// This might not be the right object, if there are wrappers. Unwrap if we can.
JSObject* obj = js::CheckedUnwrap(aObj);
if (!obj) {
return nullptr;
}
nsGlobalWindow* window = xpc::WindowGlobalOrNull(obj);
if (!window) {
return nullptr;
}
DocGroup* docGroup = window->AsInner()->GetDocGroup();
if (!docGroup) {
return nullptr;
}
return docGroup->CustomElementReactionsStack();
}
// https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,
JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv)
{
// Step 1.
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
nsIDocument* doc = window->GetExtantDoc();
if (!doc) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
RefPtr<mozilla::dom::CustomElementRegistry> registry(window->CustomElements());
if (!registry) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
// Step 2 is in the code output by CGClassConstructor.
// Step 3.
JSContext* cx = aGlobal.Context();
JS::Rooted<JSObject*> newTarget(cx, &aCallArgs.newTarget().toObject());
CustomElementDefinition* definition =
registry->LookupCustomElementDefinition(cx, newTarget);
if (!definition) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
// The callee might be an Xray. Unwrap it to get actual callee.
JS::Rooted<JSObject*> callee(cx, js::CheckedUnwrap(&aCallArgs.callee()));
if (!callee) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
// And the actual callee might be in different compartment, so enter its
// compartment before getting the standard constructor object to compare to,
// so we get it from the same global as callee itself.
JSAutoCompartment ac(cx, callee);
int32_t tag = eHTMLTag_userdefined;
if (!definition->IsCustomBuiltIn()) {
// Step 4.
// If the definition is for an autonomous custom element, the active
// function should be HTMLElement.
JS::Rooted<JSObject*> constructor(cx, HTMLElementBinding::GetConstructorObject(cx));
if (!constructor) {
aRv.NoteJSContextException(cx);
return nullptr;
}
if (callee != constructor) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
} else {
// Step 5.
// If the definition is for a customized built-in element, the localName
// should be defined in the specification.
nsIParserService* parserService = nsContentUtils::GetParserService();
if (!parserService) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
tag = parserService->HTMLCaseSensitiveAtomTagToId(definition->mLocalName);
if (tag == eHTMLTag_userdefined) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
MOZ_ASSERT(tag <= NS_HTML_TAG_MAX, "tag is out of bounds");
// If the definition is for a customized built-in element, the active
// function should be the localname's element interface.
constructorGetterCallback cb = sConstructorGetterCallback[tag];
if (!cb) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
JS::Rooted<JSObject*> constructor(cx, cb(cx));
if (!constructor) {
aRv.NoteJSContextException(cx);
return nullptr;
}
if (callee != constructor) {
aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>();
return nullptr;
}
}
RefPtr<mozilla::dom::NodeInfo> nodeInfo =
doc->NodeInfoManager()->GetNodeInfo(definition->mLocalName,
nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
if (!nodeInfo) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
// Step 6 and Step 7 are in the code output by CGClassConstructor.
// Step 8.
nsTArray<RefPtr<nsGenericHTMLElement>>& constructionStack =
definition->mConstructionStack;
if (constructionStack.IsEmpty()) {
RefPtr<nsGenericHTMLElement> newElement;
if (tag == eHTMLTag_userdefined) {
// Autonomous custom element.
newElement = NS_NewHTMLElement(nodeInfo.forget());
} else {
// Customized built-in element.
newElement = CreateHTMLElement(tag, nodeInfo.forget(), NOT_FROM_PARSER);
}
newElement->SetCustomElementData(
new CustomElementData(definition->mType, CustomElementData::State::eCustom));
newElement->SetCustomElementDefinition(definition);
return newElement.forget();
}
// Step 9.
RefPtr<nsGenericHTMLElement>& element = constructionStack.LastElement();
// Step 10.
if (element == ALEADY_CONSTRUCTED_MARKER) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
// Step 11.
// Do prototype swizzling for upgrading a custom element here, for cases when
// we have a reflector already. If we don't have one yet, our caller will
// create it with the right proto (by calling DoGetOrCreateDOMReflector with
// that proto).
JS::Rooted<JSObject*> reflector(cx, element->GetWrapper());
if (reflector) {
// reflector might be in different compartment.
JSAutoCompartment ac(cx, reflector);
JS::Rooted<JSObject*> givenProto(cx, aGivenProto);
if (!JS_WrapObject(cx, &givenProto) ||
!JS_SetPrototype(cx, reflector, givenProto)) {
aRv.NoteJSContextException(cx);
return nullptr;
}
}
// Step 12 and Step 13.
return element.forget();
}
#ifdef DEBUG
namespace binding_detail {
void
+15
View File
@@ -42,6 +42,7 @@
#include "nsWrapperCacheInlines.h"
class nsGenericHTMLElement;
class nsIJSID;
namespace mozilla {
@@ -49,6 +50,7 @@ namespace mozilla {
enum UseCounter : int16_t;
namespace dom {
class CustomElementReactionsStack;
template<typename KeyType, typename ValueType> class Record;
nsresult
@@ -3420,6 +3422,19 @@ bool
GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs,
JS::MutableHandle<JSObject*> aDesiredProto);
// Get the CustomElementReactionsStack for the docgroup of the global
// of the underlying object of aObj. This can be null if aObj can't
// be CheckUnwrapped, or if the global of the result has no docgroup
// (e.g. because it's not a Window global).
CustomElementReactionsStack*
GetCustomElementReactionsStack(JS::Handle<JSObject*> aObj);
// This function is expected to be called from the constructor function for an
// HTML element interface; the global/callargs need to be whatever was passed to
// that constructor function.
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs,
JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv);
void
SetDocumentAndPageUseCounter(JSContext* aCx, JSObject* aObject,
UseCounter aUseCounter);
+9 -13
View File
@@ -53,11 +53,6 @@ DOMInterfaces = {
'concrete': False
},
'AddonManagerPermissions': {
'wrapperCache': False,
'concrete': False
},
'AnimationEffectReadOnly': {
'concrete': False
},
@@ -340,14 +335,6 @@ DOMInterfaces = {
'wrapperCache': False,
},
'FlyWebFetchEvent': {
'headerFile': 'FlyWebServerEvents.h',
},
'FlyWebWebSocketEvent': {
'headerFile': 'FlyWebServerEvents.h',
},
'FontFaceSet': {
'implicitJSContext': [ 'load' ],
},
@@ -1638,6 +1625,15 @@ DOMInterfaces = {
'register': False,
},
'TestHTMLConstructorInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False,
},
'TestCEReactionsInterface' : {
'headerFile': 'TestBindingHeader.h',
'register': False,
},
}
# These are temporary, until they've been converted to use new DOM bindings
+9 -2
View File
@@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/CallbackObject.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "jsfriendapi.h"
#include "nsIScriptGlobalObject.h"
@@ -79,7 +80,10 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
, mIsMainThread(NS_IsMainThread())
{
if (mIsMainThread) {
nsContentUtils::EnterMicroTask();
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
if (ccjs) {
ccjs->EnterMicroTask();
}
}
// Compute the caller's subject principal (if necessary) early, before we
@@ -288,7 +292,10 @@ CallbackObject::CallSetup::~CallSetup()
// It is important that this is the last thing we do, after leaving the
// compartment and undoing all our entry/incumbent script changes
if (mIsMainThread) {
nsContentUtils::LeaveMicroTask();
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
if (ccjs) {
ccjs->LeaveMicroTask();
}
}
}
+133 -25
View File
@@ -1109,6 +1109,12 @@ class CGHeaders(CGWrapper):
# Now find all the things we'll need as arguments because we
# need to wrap or unwrap them.
bindingHeaders = set()
# KeyframeAnimationOptions.webidl is doing something VERY screwy and
# Unified Building really sucks so directly include this
if prefix == "KeyframeAnimationOptionsBinding":
bindingHeaders.add("mozilla/dom/PrimitiveConversions.h")
declareIncludes = set(declareIncludes)
def addHeadersForType((t, dictionary)):
@@ -1747,6 +1753,71 @@ class CGClassConstructor(CGAbstractStaticMethod):
else:
ctorName = self.descriptor.interface.identifier.name
# [HTMLConstructor] for custom element
# This needs to live in bindings code because it directly examines
# newtarget and the callee function to do HTMLConstructor specific things.
if self._ctor.isHTMLConstructor():
htmlConstructorSanityCheck = dedent("""
// The newTarget might be a cross-compartment wrapper. Get the underlying object
// so we can do the spec's object-identity checks.
JS::Rooted<JSObject*> newTarget(cx, js::CheckedUnwrap(&args.newTarget().toObject()));
if (!newTarget) {
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
}
// Step 2 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
// Enter the compartment of our underlying newTarget object, so we end
// up comparing to the constructor object for our interface from that global.
{
JSAutoCompartment ac(cx, newTarget);
JS::Handle<JSObject*> constructor(GetConstructorObjectHandle(cx));
if (!constructor) {
return false;
}
if (newTarget == constructor) {
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
}
}
""")
# If we are unable to get desired prototype from newTarget, then we
# fall back to the interface prototype object from newTarget's realm.
htmlConstructorFallback = dedent("""
if (!desiredProto) {
// Step 7 of https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor.
// This fallback behavior is designed to match analogous behavior for the
// JavaScript built-ins. So we enter the compartment of our underlying
// newTarget object and fall back to the prototype object from that global.
// XXX The spec says to use GetFunctionRealm(), which is not actually
// the same thing as what we have here (e.g. in the case of scripted callable proxies
// whose target is not same-compartment with the proxy, or bound functions, etc).
// https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
{
JSAutoCompartment ac(cx, newTarget);
desiredProto = GetProtoObjectHandle(cx);
if (!desiredProto) {
return false;
}
}
// desiredProto is in the compartment of the underlying newTarget object.
// Wrap it into the context compartment.
if (!JS_WrapObject(cx, &desiredProto)) {
return false;
}
}
""")
else:
htmlConstructorSanityCheck = ""
htmlConstructorFallback = ""
# If we're a constructor, "obj" may not be a function, so calling
# XrayAwareCalleeGlobal() on it is not safe. Of course in the
# constructor case either "obj" is an Xray or we're already in the
# content compartment, not the Xray compartment, so just
# constructing the GlobalObject from "obj" is fine.
preamble = fill(
"""
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@@ -1757,19 +1828,41 @@ class CGClassConstructor(CGAbstractStaticMethod):
// Adding more relocations
return ThrowConstructorWithoutNew(cx, "${ctorName}");
}
GlobalObject global(cx, obj);
if (global.Failed()) {
return false;
}
$*{htmlConstructorSanityCheck}
JS::Rooted<JSObject*> desiredProto(cx);
if (!GetDesiredProto(cx, args, &desiredProto)) {
return false;
}
$*{htmlConstructorFallback}
""",
chromeOnlyCheck=chromeOnlyCheck,
ctorName=ctorName)
ctorName=ctorName,
htmlConstructorSanityCheck=htmlConstructorSanityCheck,
htmlConstructorFallback=htmlConstructorFallback)
name = self._ctor.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
callGenerator = CGMethodCall(nativeName, True, self.descriptor,
self._ctor, isConstructor=True,
constructorName=ctorName)
if self._ctor.isHTMLConstructor():
signatures = self._ctor.signatures()
assert len(signatures) == 1
# Given that HTMLConstructor takes no args, we can just codegen a
# call to CreateHTMLElement() in BindingUtils which reuses the
# factory thing in HTMLContentSink. Then we don't have to implement
# Constructor on all the HTML elements.
callGenerator = CGPerSignatureCall(signatures[0][0], signatures[0][1],
"CreateHTMLElement", True,
self.descriptor, self._ctor,
isConstructor=True)
else:
name = self._ctor.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
callGenerator = CGMethodCall(nativeName, True, self.descriptor,
self._ctor, isConstructor=True,
constructorName=ctorName)
return preamble + "\n" + callGenerator.define()
@@ -7386,7 +7479,7 @@ class CGPerSignatureCall(CGThing):
def __init__(self, returnType, arguments, nativeMethodName, static,
descriptor, idlNode, argConversionStartsAt=0, getter=False,
setter=False, isConstructor=False, useCounterName=None,
resultVar=None):
resultVar=None, objectName="obj"):
assert idlNode.isMethod() == (not getter and not setter)
assert idlNode.isAttr() == (getter or setter)
# Constructors are always static
@@ -7440,26 +7533,23 @@ class CGPerSignatureCall(CGThing):
argsPre = []
if idlNode.isStatic():
# If we're a constructor, "obj" may not be a function, so calling
# XrayAwareCalleeGlobal() on it is not safe. Of course in the
# constructor case either "obj" is an Xray or we're already in the
# content compartment, not the Xray compartment, so just
# constructing the GlobalObject from "obj" is fine.
if isConstructor:
objForGlobalObject = "obj"
else:
objForGlobalObject = "xpc::XrayAwareCalleeGlobal(obj)"
cgThings.append(CGGeneric(fill(
"""
GlobalObject global(cx, ${obj});
if (global.Failed()) {
return false;
}
# If we're a constructor, the GlobalObject struct will be created in
# CGClassConstructor.
if not isConstructor:
cgThings.append(CGGeneric(dedent(
"""
GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj));
if (global.Failed()) {
return false;
}
""")))
""",
obj=objForGlobalObject)))
argsPre.append("global")
if isConstructor and idlNode.isHTMLConstructor():
argsPre.extend(["args", "desiredProto"])
# For JS-implemented interfaces we do not want to base the
# needsCx decision on the types involved, just on our extended
# attributes. Also, JSContext is not needed for the static case
@@ -7588,6 +7678,17 @@ class CGPerSignatureCall(CGThing):
CGIfWrapper(CGList(xraySteps),
"objIsXray"))
if (idlNode.getExtendedAttribute('CEReactions') is not None and
not getter):
cgThings.append(CGGeneric(fill(
"""
CustomElementReactionsStack* reactionsStack = GetCustomElementReactionsStack(${obj});
Maybe<AutoCEReaction> ceReaction;
if (reactionsStack) {
ceReaction.emplace(reactionsStack, cx);
}
""", obj=objectName)))
# If this is a method that was generated by a maplike/setlike
# interface, use the maplike/setlike generator to fill in the body.
# Otherwise, use CGCallGenerator to call the native method.
@@ -10985,7 +11086,8 @@ class CGProxySpecialOperation(CGPerSignatureCall):
# CGPerSignatureCall won't do any argument conversion of its own.
CGPerSignatureCall.__init__(self, returnType, arguments, nativeName,
False, descriptor, operation,
len(arguments), resultVar=resultVar)
len(arguments), resultVar=resultVar,
objectName="proxy")
if operation.isSetter() or operation.isCreator():
# arguments[0] is the index or name of the item that we're setting.
@@ -13755,12 +13857,18 @@ class CGBindingRoot(CGThing):
iface = desc.interface
return any(m.getExtendedAttribute("Deprecated") for m in iface.members + [iface])
def descriptorHasCEReactions(desc):
iface = desc.interface
return any(m.getExtendedAttribute("CEReactions") for m in iface.members + [iface])
bindingHeaders["nsIDocument.h"] = any(
descriptorDeprecated(d) for d in descriptors)
bindingHeaders["mozilla/Preferences.h"] = any(
descriptorRequiresPreferences(d) for d in descriptors)
bindingHeaders["mozilla/dom/DOMJSProxyHandler.h"] = any(
d.concrete and d.proxy for d in descriptors)
bindingHeaders["mozilla/dom/CustomElementRegistry.h"] = any(
descriptorHasCEReactions(d) for d in descriptors)
def descriptorHasChromeOnly(desc):
ctor = desc.interface.ctor()
@@ -16,6 +16,7 @@ def generateLine(propName, extendedAttrs):
return " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs),
propName)
def generate(output, idlFilename, preprocessorHeader):
print(idlFilename)
cpp = list(buildconfig.substs['CPP'])
cpp += shellutil.split(buildconfig.substs['ACDEFINES'])
cpp.append(preprocessorHeader)
+4
View File
@@ -4,8 +4,12 @@
* 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 "jswrapper.h"
#include "WebIDLGlobalNameHash.h"
#include "js/GCAPI.h"
#include "XrayWrapper.h"
#include "XPCWrapper.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/Maybe.h"
#include "mozilla/dom/DOMJSProxyHandler.h"
+1
View File
@@ -8,6 +8,7 @@
#define mozilla_dom_WebIDLGlobalNameHash_h__
#include "js/RootingAPI.h"
#include "nsString.h"
#include "nsTArray.h"
namespace mozilla {
+1 -1
View File
@@ -89,7 +89,7 @@ LOCAL_INCLUDES += [
'/media/webrtc/signaling/src/peerconnection',
]
UNIFIED_SOURCES += [
SOURCES += [
'BindingUtils.cpp',
'CallbackInterface.cpp',
'CallbackObject.cpp',
@@ -269,6 +269,7 @@ class WebIDLCodegenManager(LoggingMixin):
# Generate bindings from .webidl files.
for filename in sorted(changed_inputs):
basename = mozpath.basename(filename)
print basename
result.inputs.add(filename)
written, deps = self._generate_build_files_for_webidl(filename)
result.created |= written[0]
+5
View File
@@ -14,8 +14,13 @@
#include "jsapi.h"
#include "js/RootingAPI.h"
#include "jswrapper.h"
#include "nsCOMArray.h"
#include "nsContentUtils.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIScriptError.h"
#include "nsString.h"
#include "nsStringFwd.h"
class nsScriptErrorNote final : public nsIScriptErrorNote {
public:
+2 -2
View File
@@ -22,7 +22,7 @@ using namespace mozilla::dom;
namespace {
static nsCString
FormatStackString(JSContext* cx, HandleObject aStack) {
FormatStackString(JSContext* cx, JS::HandleObject aStack) {
JS::RootedString formattedStack(cx);
if (!JS::BuildStackString(cx, aStack, &formattedStack)) {
@@ -111,7 +111,7 @@ nsScriptErrorWithStack::ToString(nsACString& /*UTF8*/ aResult)
}
JSContext* cx = jsapi.cx();
RootedObject stack(cx, mStack);
JS::RootedObject stack(cx, mStack);
nsCString stackString = FormatStackString(cx, stack);
nsCString combined = message + NS_LITERAL_CSTRING("\n") + stackString;
aResult.Assign(combined);
+42 -5
View File
@@ -1582,7 +1582,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
[self.location])
self._noInterfaceObject = True
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor":
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
if identifier == "Constructor" and not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
@@ -1595,11 +1595,20 @@ class IDLInterface(IDLInterfaceOrNamespace):
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if identifier == "HTMLConstructor":
if not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if not attr.noArguments():
raise WebIDLError(str(identifier) + " must take no arguments",
[attr.location])
args = attr.args() if attr.hasArgs() else []
retType = IDLWrapperType(self.location, self)
if identifier == "Constructor" or identifier == "ChromeConstructor":
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
name = "constructor"
allowForbidden = True
else:
@@ -1610,7 +1619,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
allowForbidden=allowForbidden)
method = IDLMethod(self.location, methodIdentifier, retType,
args, static=True)
args, static=True,
htmlConstructor=(identifier == "HTMLConstructor"))
# Constructors are always NewObject and are always
# assumed to be able to throw (since there's no way to
# indicate otherwise) and never have any other
@@ -1622,7 +1632,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("ChromeOnly",))])
if identifier == "Constructor" or identifier == "ChromeConstructor":
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor":
method.resolve(self)
else:
# We need to detect conflicts for NamedConstructors across
@@ -4073,6 +4083,11 @@ class IDLAttribute(IDLInterfaceMember):
raise WebIDLError("Attribute returns a type that is not exposed "
"everywhere where the attribute is exposed",
[self.location])
if self.getExtendedAttribute("CEReactions"):
if self.readonly:
raise WebIDLError("[CEReactions] is not allowed on "
"readonly attributes",
[self.location])
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
@@ -4243,6 +4258,10 @@ class IDLAttribute(IDLInterfaceMember):
raise WebIDLError("[Unscopable] is only allowed on non-static "
"attributes and operations",
[attr.location, self.location])
elif identifier == "CEReactions":
if not attr.noArguments():
raise WebIDLError("[CEReactions] must take no arguments",
[attr.location])
elif (identifier == "Pref" or
identifier == "Deprecated" or
identifier == "SetterThrows" or
@@ -4537,7 +4556,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
static=False, getter=False, setter=False, creator=False,
deleter=False, specialType=NamedOrIndexed.Neither,
legacycaller=False, stringifier=False, jsonifier=False,
maplikeOrSetlikeOrIterable=None):
maplikeOrSetlikeOrIterable=None, htmlConstructor=False):
# REVIEW: specialType is NamedOrIndexed -- wow, this is messed up.
IDLInterfaceMember.__init__(self, location, identifier,
IDLInterfaceMember.Tags.Method)
@@ -4567,6 +4586,10 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
self._jsonifier = jsonifier
assert maplikeOrSetlikeOrIterable is None or isinstance(maplikeOrSetlikeOrIterable, IDLMaplikeOrSetlikeOrIterableBase)
self.maplikeOrSetlikeOrIterable = maplikeOrSetlikeOrIterable
assert isinstance(htmlConstructor, bool)
# The identifier of a HTMLConstructor must be 'constructor'.
assert not htmlConstructor or identifier.name == "constructor"
self._htmlConstructor = htmlConstructor
self._specialType = specialType
self._unforgeable = False
self.dependsOn = "Everything"
@@ -4667,6 +4690,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
self.isStringifier() or
self.isJsonifier())
def isHTMLConstructor(self):
return self._htmlConstructor
def hasOverloads(self):
return self._hasOverloads
@@ -4722,6 +4748,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
assert not method.isStringifier()
assert not self.isJsonifier()
assert not method.isJsonifier()
assert not self.isHTMLConstructor()
assert not method.isHTMLConstructor()
return self
@@ -4964,6 +4992,15 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
raise WebIDLError("[Unscopable] is only allowed on non-static "
"attributes and operations",
[attr.location, self.location])
elif identifier == "CEReactions":
if not attr.noArguments():
raise WebIDLError("[CEReactions] must take no arguments",
[attr.location])
if self.isSpecial() and not self.isSetter() and not self.isDeleter():
raise WebIDLError("[CEReactions] is only allowed on operation, "
"attribute, setter, and deleter",
[attr.location, self.location])
elif (identifier == "Throws" or
identifier == "NewObject" or
identifier == "ChromeOnly" or
@@ -0,0 +1,162 @@
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions(DOMString a)] void foo(boolean arg2);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions(DOMString b)] readonly attribute boolean bar;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] attribute boolean bar;
};
""")
results = parser.finish()
except Exception, e:
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on writable attribute. %s" % e)
threw = True
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] void foo(boolean arg2);
};
""")
results = parser.finish()
except Exception, e:
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on regular operations. %s" % e)
threw = True
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] readonly attribute boolean A;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a readonly attribute")
parser = parser.reset()
threw = False
try:
parser.parse("""
[CEReactions]
interface Foo {
}
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] getter any(DOMString name);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should have thrown for [CEReactions] used on a named getter")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] creator boolean (DOMString name, boolean value);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should have thrown for [CEReactions] used on a named creator")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] legacycaller double compute(double x);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should have thrown for [CEReactions] used on a legacycaller")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] stringifier DOMString ();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should have thrown for [CEReactions] used on a stringifier")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions] jsonifier;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for [CEReactions] used on a jsonifier")
+165 -1
View File
@@ -13,7 +13,7 @@ def WebIDLTest(parser, harness):
def checkMethod(method, QName, name, signatures,
static=True, getter=False, setter=False, creator=False,
deleter=False, legacycaller=False, stringifier=False,
chromeOnly=False):
chromeOnly=False, htmlConstructor=False):
harness.ok(isinstance(method, WebIDL.IDLMethod),
"Should be an IDLMethod")
harness.ok(method.isMethod(), "Method is a method")
@@ -29,6 +29,7 @@ def WebIDLTest(parser, harness):
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
harness.check(method.getExtendedAttribute("ChromeOnly") is not None, chromeOnly, "Method has the correct value for ChromeOnly")
harness.check(method.isHTMLConstructor(), htmlConstructor, "Method has the correct htmlConstructor value")
harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
sigpairs = zip(method.signatures(), signatures)
@@ -78,6 +79,21 @@ def WebIDLTest(parser, harness):
("TestConstructorOverloads (Wrapper)",
[("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
parser = parser.reset()
parser.parse("""
[HTMLConstructor]
interface TestHTMLConstructor {
};
""")
results = parser.finish()
harness.check(len(results), 1, "Should be one production")
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestHTMLConstructor::constructor",
"constructor", [("TestHTMLConstructor (Wrapper)", [])],
htmlConstructor=True)
parser = parser.reset()
parser.parse("""
[ChromeConstructor()]
@@ -107,3 +123,151 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Can't have both a Constructor and a ChromeConstructor")
# Test HTMLConstructor with argument
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor(DOMString a)]
interface TestHTMLConstructorWithArgs {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "HTMLConstructor should take no argument")
# Test HTMLConstructor on a callback interface
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor]
callback interface TestHTMLConstructorOnCallbackInterface {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
# Test HTMLConstructor and Constructor
parser = parser.reset()
threw = False
try:
parser.parse("""
[Constructor,
HTMLConstructor]
interface TestHTMLConstructorAndConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a Constructor and a HTMLConstructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
Constructor]
interface TestHTMLConstructorAndConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
Constructor(DOMString a)]
interface TestHTMLConstructorAndConstructor {
};
""")
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[Constructor(DOMString a),
HTMLConstructor]
interface TestHTMLConstructorAndConstructor {
};
""")
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
# Test HTMLConstructor and ChromeConstructor
parser = parser.reset()
threw = False
try:
parser.parse("""
[ChromeConstructor,
HTMLConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
ChromeConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
parser = parser.reset()
threw = False
try:
parser.parse("""
[ChromeConstructor(DOMString a),
HTMLConstructor]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor,
ChromeConstructor(DOMString a)]
interface TestHTMLConstructorAndChromeConstructor {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor")
@@ -34,3 +34,36 @@ def WebIDLTest(parser, harness):
interface TestNamedConstructorNoInterfaceObject {
};
""")
# Test HTMLConstructor and NoInterfaceObject
parser = parser.reset()
threw = False
try:
parser.parse("""
[NoInterfaceObject, HTMLConstructor]
interface TestHTMLConstructorNoInterfaceObject {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor, NoInterfaceObject]
interface TestHTMLConstructorNoInterfaceObject {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown.")
Loaded 100 of 4264 files, more files were not shown because too many files have changed in this diff. Show more