Compare commits

..
Author SHA1 Message Date
Moonchild c5fa5bd4c1 Merge branch 'master' into release
Effectively reverse the cubeb lib update.
2021-08-22 17:42:44 +00:00
Moonchild 8226d379d2 Issue #1797 - Implement WindowOrWorkerGlobalScope.origin
Resolves #1797
2021-08-15 14:31:05 +00:00
Moonchild 02882c3680 Merge branch 'master' into release 2021-08-13 09:48:56 +00:00
Moonchild feafc2f129 Merge branch 'master' into release 2021-07-15 23:13:31 +00:00
Moonchild 8482546804 [js] Fix porting typo
Follow-up for 9acd98298c
2021-06-04 06:30:44 +00:00
Jan de Mooij f06526314d [js] Fix invalid early return in BaselineFrame::trace.
We were not tracing debugger environments for Baseline frames without any
local/expression slots.
2021-06-04 06:30:29 +00:00
Moonchild a1775784c8 [toolkit] Exclude printer spew from troubleshooting information.
In almost all cases this is pointless to include, a ton of useless entries,
and there's no reason to have people post a full enumeration of installed
printers on their system when asked for TS information.
If there's a printer specific issue, people can always be asked to post relevant
info manually.
2021-06-04 06:30:13 +00:00
Matt A. Tobin a9d7e74025 Issue #1774 - Add metrics to the editable menulist-button for GTK3 2021-06-04 06:29:58 +00:00
Moonchild 9c3e2ad6f3 Revert "Issue #21 - Remove TelemertyVFS"
This:
- reverts commit 83ecae9ff7
- adds a failure check to Connection::GetQuotaObjects

This resolves #1768.
2021-06-04 06:29:26 +00:00
Moonchild 343053e977 Issue #1767 - Prevent incorrect calling of network change detection function.
This rewrites the websocket channel network change detection function to not
skip part of its logic in a situation that has already been checked, preventing
a thread race. See analysis of the problem in the issue.
2021-06-04 06:29:06 +00:00
FranklinDM df74700e2c Issue #1770 - Fix incorrect reference to event parameter 2021-06-04 06:28:25 +00:00
Moonchild b83c7c7865 Merge branch 'master' into release 2021-04-21 03:57:43 +00:00
Moonchild f753d342aa [WebRTC] Apply port restrictions to peerconnections. 2021-03-25 21:34:32 +00:00
Moonchild e2484022ae [WebGL] Only allow texture uploads from pixelbuffer if bound.
Throw an error if it mismatches.
2021-03-25 21:34:18 +00:00
Moonchild 31a94d3003 [docshell] Stop loading of the document if network load is stopped.
After all, stop means stop.
2021-03-25 21:34:07 +00:00
Moonchild 7962989e81 Issue #1749 - Remove restriction of SVG width/height element attributes.
According to the original SVG spec, the SVG element in documents had to follow
special rules as to what was allowed for width/height attributes. This is no
longer the case, so we can decouple it from whatever internal units SVG/XML
language uses and allow all units like every other element.
2021-03-20 08:57:01 +00:00
Moonchild 1fdf9caeb7 [CSS] Enable scrollbar-width keyword by default.
I totally forgot this <.<
2021-03-20 08:56:53 +00:00
Matt A. Tobin 94b353bc9b [NSS hotpatch] Hard disable AVX2 in NSS Build System 2021-03-20 08:56:02 +00:00
Moonchild de4a2cc0f9 Force clobber 2021-03-20 08:55:52 +00:00
Moonchild 0c847a4637 Issue #1693 - Update NSS to 3.52.2-UXP
Update root certificates and port NSS sec patches from previous work.
2021-03-20 08:55:04 +00:00
Moonchild 0f1072adf2 [NSS] Update root certificates. 2021-03-20 08:54:43 +00:00
J.C. Jones ac5b704ce9 [NSS] Prevent slotLock race in NSC_GetTokenInfo
Basically, NSC_GetTokenInfo doesn't lock slot->slotLock before accessing slot
after obtaining it, even though slotLock is defined as its lock.
2021-03-20 08:54:35 +00:00
Sohaib ul Hassan 84c05b5af4 [NSS] Implement constant-time GCD and modular inversion
The implementation is based on the work by Bernstein and Yang
(https://eprint.iacr.org/2019/266)
"Fast constant-time gcd computation and modular inversion".

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

Co-authored by : Billy Bob Brumley
2021-03-20 08:54:24 +00:00
Moonchild 979c996104 Issue #1743 - Update CK_GCM_PARAMS use for PKCS11 v3.0 in WebCryptoTask
Re-apply now we have PKCS11 v3.0 again
2021-03-20 08:54:14 +00:00
Moonchild 5a74837b53 Issue #1693 - Update NSPR to 4.25-RTM 2021-03-20 08:54:04 +00:00
Moonchild 852c6cd024 Issue #1693 - Update NSS to 3.52.1-RTM 2021-03-20 08:53:53 +00:00
Moonchild bb989cf7a0 Revert "Issue #1743 - Update CK_GCM_PARAMS use for PKCS11 v3.0 in WebCryptoTask"
This reverts commit 2b6effbf29.
2021-03-20 08:53:42 +00:00
Moonchild 219c21b8d5 Issue #1746 - Revert "Update NSPR to 4.29"
This reverts commit 149d2ffa77.
2021-03-20 08:53:32 +00:00
Moonchild e47391b526 Issue #1746 - Revert "Update to NSS 3.59.1.1" 2021-03-20 08:53:19 +00:00
Moonchild 0822c5b946 Issue #1746 - Revert "Additional configuration for NSS lib update."
This reverts commit ae775e493b.
2021-03-20 08:53:09 +00:00
Moonchild e79563a0b4 Issue #1746 - Update pkix code with later NSS code. 2021-03-20 08:53:00 +00:00
Moonchild bb138fdc51 Merge branch 'master' into release 2021-02-26 17:42:34 +00:00
Moonchild ceadffab6b Merge branch 'master' into release 2021-02-25 01:03:57 +00:00
Moonchild 14fb2f966e Issue #1737 - Disable AV1 by default.
Our current implementation has consistent playback issues; this needs to be
addressed before the codec can be enabled by default.
2021-02-07 20:22:04 +00:00
Moonchild 08903c0c9c [angle] Cherry-pick compressed tex depth stride fix. 2021-02-05 18:43:01 +00:00
Moonchild cca738e986 Issue #1515 - Add null check to nsCSSFrameConstructor::IsValidSibling
With the changes to layout for WebComponents, it is now apparently possible to
pass in null for frame tree items to this function, which would cause a null
deref crash if not checked.
2021-02-05 18:42:30 +00:00
trav90 304496d4ab Issue #1723 - Fix Linux build bustage in HTMLMenuItemElement.cpp 2021-01-30 01:07:11 +00:00
Moonchild 745254183c Merge branch 'master' into release 2021-01-29 14:55:20 +00:00
Moonchild c76214f0b5 Master merge
This merges master into release to replace Redwood.

# Conflicts:
#	CLOBBER
#	build/moz.configure/old.configure
#	config/milestone.txt
#	config/moz.build
#	config/system-headers
#	dom/abort/AbortController.cpp
#	dom/abort/AbortController.h
#	dom/abort/AbortSignal.cpp
#	dom/abort/AbortSignal.h
#	dom/abort/moz.build
#	dom/abort/tests/moz.build
#	dom/animation/KeyframeEffect.cpp
#	dom/base/CustomElementRegistry.cpp
#	dom/base/DocGroup.cpp
#	dom/base/ResizeObserverController.cpp
#	dom/base/ResizeObserverController.h
#	dom/base/nsContentUtils.cpp
#	dom/base/nsContentUtils.h
#	dom/base/nsDocument.cpp
#	dom/base/nsIDocument.h
#	dom/fetch/FetchObserver.cpp
#	dom/fetch/FetchObserver.h
#	dom/heapsnapshot/AutoMemMap.cpp
#	dom/heapsnapshot/AutoMemMap.h
#	dom/heapsnapshot/CoreDump.proto
#	dom/heapsnapshot/HeapSnapshot.cpp
#	dom/heapsnapshot/HeapSnapshotTempFileHelperChild.h
#	dom/heapsnapshot/HeapSnapshotTempFileHelperParent.cpp
#	dom/heapsnapshot/HeapSnapshotTempFileHelperParent.h
#	dom/heapsnapshot/PHeapSnapshotTempFileHelper.ipdl
#	dom/heapsnapshot/moz.build
#	dom/heapsnapshot/tests/gtest/moz.build
#	dom/html/nsGenericHTMLElement.h
#	dom/media/platforms/PlatformDecoderModule.h
#	dom/media/platforms/moz.build
#	dom/script/ModuleLoadRequest.cpp
#	dom/script/ModuleLoadRequest.h
#	dom/script/ModuleScript.cpp
#	dom/script/ModuleScript.h
#	dom/script/ScriptElement.cpp
#	dom/script/ScriptElement.h
#	dom/script/ScriptLoadHandler.cpp
#	dom/script/ScriptLoadHandler.h
#	dom/script/ScriptLoader.cpp
#	dom/script/ScriptLoader.h
#	dom/script/ScriptSettings.cpp
#	dom/script/ScriptSettings.h
#	dom/script/nsIScriptElement.h
#	dom/script/nsIScriptLoaderObserver.idl
#	dom/webidl/HTMLLinkElement.webidl
#	gfx/gl/moz.build
#	gfx/graphite2/src/moz.build
#	gfx/layers/moz.build
#	js/ductwork/inspector/moz.build
#	js/ductwork/moz.build
#	js/src/gc/Heap.h
#	js/src/moz.build
#	js/src/vm/UnboxedObject-inl.h
#	js/src/vm/UnboxedObject.cpp
#	js/src/vm/UnboxedObject.h
#	layout/base/crashtests/crashtests.list
#	layout/build/moz.build
#	layout/generic/AspectRatio.h
#	layout/generic/crashtests/crashtests.list
#	layout/reftests/bidi/reftest-stylo.list
#	layout/reftests/reftest-stylo.list
#	layout/reftests/table-bordercollapse/reftest.list
#	layout/reftests/writing-mode/reftest-stylo.list
#	layout/style/StyleSheet.cpp
#	layout/style/nsRuleNode.cpp
#	layout/style/nsStyleStruct.cpp
#	layout/style/nsStyleStruct.h
#	modules/libpref/init/all.js
#	nsprpub/pr/src/linking/prlink.c
#	parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java
#	parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java
#	parser/html/nsHtml5AtomList.h
#	parser/html/nsHtml5AttributeName.cpp
#	parser/html/nsHtml5AttributeName.h
#	parser/html/nsHtml5ElementName.cpp
#	parser/html/nsHtml5ElementName.h
#	parser/html/nsHtml5TreeBuilderCppSupplement.h
#	parser/htmlparser/nsElementTable.cpp
#	parser/htmlparser/nsHTMLTagList.h
#	security/nss/lib/nss/nss.h
#	security/nss/lib/softoken/pkcs11.c
#	security/nss/lib/softoken/softkver.h
#	security/nss/lib/util/nssutil.h
#	testing/web-platform/tests/tools/html5lib/html5lib/html5parser.py
#	testing/web-platform/tests/tools/html5lib/html5lib/treebuilders/_base.py
#	toolkit/modules/AppConstants.jsm
2021-01-19 08:08:18 +00:00
Moonchild 810c2bf808 Merge branch 'redwood' into release 2020-12-16 07:42:37 +00:00
Moonchild 203be74ffe Revert "Issue #1695 - Add clamping to websocket polling timeouts."
As of [da0c073a7] we no longer need this workaround because the issue is avoided
with proper sleep/wake logic restored.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tested that synthesis still works as-intended.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

See also: https://gcc.gnu.org/gcc-10/porting_to.html
2020-05-06 19:13:31 +02:00
adeshkp e175224b88 Issue #80 - Include nsIContentInlines.h in layout/base/PositionedEventTargeting.cpp 2020-05-06 19:13:11 +02:00
Moonchild 0afb9e2d75 Issue #80 - Resolve issues with compiling on insane gcc configurations with no optimizations in layout/
(and fix a typo for cs fs)
2020-05-06 19:12:59 +02:00
Moonchild e733c3681b Issue #80 - De-unify layout/xul and tree, grid 2020-05-06 19:12:48 +02:00
Moonchild 157cd64a8e Issue #80 - De-unify layout/tables 2020-05-06 19:12:37 +02:00
Moonchild 5c3c92da90 Issue #80 - De-unify layout/svg 2020-05-06 19:12:26 +02:00
Moonchild aa21f96cf5 Issue #80 - De-unify layout/style (redwood) 2020-05-06 19:12:11 +02:00
Moonchild 537c63d600 Issue #80 - De-unify layout/printing 2020-05-06 19:06:17 +02:00
Moonchild 975db4c7f0 Issue #80 - De-unify layout/PITA... I mean layout/generic 2020-05-06 19:06:06 +02:00
Moonchild 528abd534e Issue #80 - De-unify layout/base 2020-05-06 19:05:49 +02:00
Moonchild 320682148b [XPFE] Properly anchor XUL windows when tearing down 2020-05-06 19:03:37 +02:00
Moonchild 1ed84ac1f8 [WebRTC] Port some upstream sctp fixes
- add SCTP auth token boundary check.
- turn off SCTP auth and address reconfiguration.
2020-05-06 19:03:23 +02:00
Moonchild 9c9d04e3e0 [dom] Reorder some calls to improve memory safety 2020-05-06 19:03:08 +02:00
Moonchild 19504d5263 [devtools] Port various upstream fixes 2020-05-06 19:02:56 +02:00
Moonchild 533b346f4e [js] Record load in MCreateThis alias set. 2020-05-06 19:02:42 +02:00
Bas Schouten 6afd96c460 Prevent the existance of dangling pointers upon failure of FindDataStart. 2020-05-06 19:02:28 +02:00
Matt A. Tobin 9858dc03cb Hyperbola IceDove should use the toolkit SearchService 2020-05-06 19:00:16 +02:00
wolfbeast d21b46fc9c Revert "Issue #1445 - Clarify the status of extensions in the Add-On manager"
This reverts commit f107de8a90.
2020-04-27 11:58:42 +02:00
wolfbeast 55fa46d059 Revert "Issue #1446 - Only allow extension add-on types for Firefox compat mode."
This reverts commit e8417acbff.
2020-04-27 11:57:28 +02:00
wolfbeast b089b365d6 Revert "Issue #1446 - Only match extension add-on types for target applications."
This reverts commit 4889e6dbbd.
2020-04-27 11:57:14 +02:00
wolfbeast 0c150945dc Revert "Issue #1445 - Use the detailed string also in the list entries."
This reverts commit ac68f8cf6c.
2020-04-27 11:57:01 +02:00
wolfbeast 0fb23389f5 Revert "Issue #1445 - remove redundant nativeIndicator"
This reverts commit 2073a7f1c9.
2020-04-27 11:56:47 +02:00
wolfbeast 7ba07f4a17 Revert "Issue #1445 - Add a link to details on using Firefox extensions in Pale Moon"
This reverts commit c220c30bbb.
2020-04-27 11:56:33 +02:00
wolfbeast 554183b5dd Revert "Issue #1445 - strings cleanup"
This reverts commit 461a9e86b2.
2020-04-27 11:56:19 +02:00
wolfbeast 98fe8b0ccb Merge branch 'redwood' into 28.9-platform 2020-04-26 12:56:46 +02:00
Matt A. Tobin 519030e688 Issue #80 - Resolve issues with compiling on insane gcc configurations with no optimizations in dom/ 2020-04-26 10:27:18 +02:00
adeshkp b9531d8e11 Issue #80 - Add Unused.h to dom/gamepad for Mac build 2020-04-26 10:26:57 +02:00
adeshkp 7605f4b0f8 Issue #80 - Fix include in PlatformDecoderModule.h 2020-04-26 10:26:07 +02:00
wolfbeast ab0e18135f Issue #80 - Fix include in dom/quota
Reported by Luke.
2020-04-26 10:23:13 +02:00
wolfbeast e883ac54e9 Issue #80 - Fix include in dom/media for Pale Moon builds. 2020-04-26 10:22:59 +02:00
New Tobin Paradigm 9cb65e8a77 Add Unused.h to dom/media/webrtc/MediaTrackConstraints.cpp 2020-04-26 10:22:46 +02:00
adeshkp 3a3152d54b Issue #80 - Include D3DMessageUtils.h in dom/plugins/ipc for Mac build
This should ideally not be needed on Mac but compilation fails due to
sizeof `DxgiAdapterDesc` not known.

Didn't face this issue on Linux though, probably due to a different include
chain which already has this file included somewhere along the way.
2020-04-26 10:22:32 +02:00
adeshkp f174801b64 Issue #80 - Fix includes in dom/media/platforms for Mac build 2020-04-26 10:22:20 +02:00
New Tobin Paradigm 3caceeb539 Issue #80 - Include nsIContentInlines.h in dom/svg/SVGTests.cpp to fix linux bustage 2020-04-26 10:21:59 +02:00
Moonchild 216189e6f7 Issue #80 - De-unify dom/xul 2020-04-26 10:21:48 +02:00
Moonchild bbae11cdd9 Issue #80 - De-unify dom/xslt 2020-04-26 10:21:37 +02:00
Moonchild 917447df6e Issue #80 - De-unify dom/xml 2020-04-26 10:21:27 +02:00
Moonchild 244c8ef1f7 Issue #80 - De-unify dom/xhr 2020-04-26 10:21:10 +02:00
Moonchild e1b6493747 Issue #80 - De-unify dom/xbl 2020-04-26 10:20:59 +02:00
Moonchild 4e225fc7d1 Issue #80 - De-unify dom/workers 2020-04-26 10:20:48 +02:00
Moonchild 683b1bedea Issue #80 - De-unify dom/system 2020-04-26 10:20:38 +02:00
Moonchild 11519ee6d2 Issue #80 - De-unify dom/svg 2020-04-26 10:20:27 +02:00
Moonchild 8a343284d9 Issue #80 - De-unify dom/smil 2020-04-26 10:20:16 +02:00
Moonchild 5a34fb5e1d Issue #80 - De-unify dom/security
Exception: CSPUtils relies on something in CSPContext, but on
Windows it throws in an MSVC include which provides no hints.
2020-04-26 10:20:05 +02:00
Moonchild 16c8dff724 Issue #80 - De-unify dom/quota 2020-04-26 10:19:55 +02:00
Moonchild 3595b9eecf Issue #80 - De-unify dom/push 2020-04-26 10:19:44 +02:00
Moonchild 594cbca6d1 Issue #80 - De-unify dom/plugins/ipc 2020-04-26 10:19:33 +02:00
Moonchild a4ba260904 Issue #80 - De-unify dom/plugins/base 2020-04-26 10:19:22 +02:00
Moonchild 4a8c186eea Issue #80 - De-unify dom/performance 2020-04-26 10:19:11 +02:00
Moonchild 8ff6e8c8a2 Issue #80 - De-unify dom/media part 3
Excluding /dom/media/webrtc for bad template use:
MediaTrackConstraints.cpp/h
MediaEngineCameraVideoSource.cpp and
MediaEngineRemoteVideoSource.cpp
2020-04-26 10:18:59 +02:00
Moonchild 3652cd0f99 Issue #80 - De-unify dom/media part 2 2020-04-26 10:18:45 +02:00
Moonchild b738ccc61b Issue #80 - De-unify dom/media part 1 (updated reland)
This de-unifies up to and including dom/media/platforms with the exception of
dom/media/platforms/wmf, because that one throws weird errors in the Win
SDK which don't have a clear cause (yet)
2020-04-26 10:18:28 +02:00
Moonchild 1c3a9a40e5 Issue #80 - De-unify dom/ipc 2020-04-24 10:37:30 +02:00
Moonchild 0a33733505 Issue #80 - De-unify dom/indexedDB 2020-04-24 10:37:19 +02:00
wolfbeast 691878e20f Issue #80 - De-unify dom/html 2020-04-24 10:37:08 +02:00
wolfbeast bf1fa93b91 [AM] Clean up addon-signing build leftovers. 2020-04-24 10:36:55 +02:00
wolfbeast 0ac7481d2e Issue #80 - De-unify dom/network 2020-04-24 10:36:44 +02:00
wolfbeast 168bb31e4f Issue #80 - De-unify dom/grid 2020-04-24 10:36:33 +02:00
wolfbeast ca04b37910 Issue #80 - De-unify dom/geolocation 2020-04-24 10:36:23 +02:00
wolfbeast f3b26f64fc Issue #80 - De-unify dom/gamepad 2020-04-24 10:36:11 +02:00
wolfbeast 99d23484bb Issue #80 - De-unify dom/filesystem 2020-04-24 10:36:01 +02:00
wolfbeast 376bc050a6 Issue #80 - De-unify dom/filehandle 2020-04-24 10:35:49 +02:00
Matt A. Tobin 9258382b0d Issue #576 - Remove IdentityService and ContextualIdentityService 2020-04-24 10:35:38 +02:00
Matt A. Tobin b6a703907e Issue #65 - Remove AppConstants from toolkit/prompts/content/tabprompts.xml
This file not only somehow escaped my pass through here but was also mocking me by using AppConstants in a preprocessed file BUT ALSO right AFTER a preprocessor directive.
2020-04-24 10:35:09 +02:00
Matt A. Tobin da42871b0e Put Request.cpp and Response.cpp back into UNIFIED in dom/fetch due to linux linker errors
Reference:

15:03.06 ../../build/unix/gold/ld: error: /home/mattatobin/development/.obj/trunk-master/navigator-x64-gtk3/toolkit/library/../../dom/fetch/Request.o: requires dynamic R_X86_64_PC32 reloc against '_ZN7mozilla3dom9FetchBodyINS0_7RequestEED2Ev' which may overflow at runtime; recompile with -fPIC
15:03.06 ../../build/unix/gold/ld: error: /home/mattatobin/development/.obj/trunk-master/navigator-x64-gtk3/toolkit/library/../../dom/fetch/Response.o: requires dynamic R_X86_64_PC32 reloc against '_ZN7mozilla3dom9FetchBodyINS0_8ResponseEED2Ev' which may overflow at runtime; recompile with -fPIC
15:03.06 ../../build/unix/gold/ld: error: read-only segment has dynamic relocations
15:03.07 /home/mattatobin/development/.obj/trunk-master/navigator-x64-gtk3/toolkit/library/../../dom/fetch/Request.o:Request.cpp:function mozilla::dom::Request::~Request(): error: undefined reference to 'mozilla::dom::FetchBody<mozilla::dom::Request>::~FetchBody()'
15:03.07 /home/mattatobin/development/.obj/trunk-master/navigator-x64-gtk3/toolkit/library/../../dom/fetch/Response.o:Response.cpp:function mozilla::dom::Response::~Response(): error: undefined reference to 'mozilla::dom::FetchBody<mozilla::dom::Response>::~FetchBody()'
2020-04-24 10:34:46 +02:00
wolfbeast c55433ee03 Issue #80 - De-unify dom/fetch
Running into the same problem as with dom/canvas: derived template
classes not being happy about being non-unified. Kept unified for now
to prevent linking errors.
2020-04-24 10:34:33 +02:00
wolfbeast d0a2389b43 Issue #80 - De-unify dom/events 2020-04-24 10:34:20 +02:00
wolfbeast 796a14e116 Issue #80 - De-unify dom/crypto 2020-04-24 10:34:08 +02:00
Matt A. Tobin ba6e4753b7 Fix typo in dom/animation/CSSPseudoElement.cpp
Linux filesystems tend to be case sensitive
2020-04-24 10:33:56 +02:00
wolfbeast 6d3d69f644 Issue #80 - De-unify dom/canvas 2020-04-24 10:33:20 +02:00
Matt A. Tobin fce3132fe8 Make application moz.configure file optional and set application/xulrunner as the default platform build_app 2020-04-24 10:33:08 +02:00
Matt A. Tobin a7da3cf52b Issue #80 - De-unify layout/mathml 2020-04-24 10:32:48 +02:00
Matt A. Tobin f5316668a3 Issue #80 - De-unify layout/forms 2020-04-24 10:32:36 +02:00
wolfbeast dc687dbc0b Issue #80 - De-unify dom/cache 2020-04-24 10:32:24 +02:00
wolfbeast 216aa2cada Issue #80 - De-unify dom/archivereader 2020-04-24 10:32:14 +02:00
wolfbeast 9d96ad90dd Issue #80 - De-unify dom/animation
KeyFrameEffect and KeyFrameEffectReadOnly are still built unified as
buddies because they have some complex interdependency that couldn't
easily be resolved without linking failures.
2020-04-24 10:32:03 +02:00
Matt A. Tobin b064c95231 Issue #80 - De-unify dom/messagechannel 2020-04-24 10:31:52 +02:00
Matt A. Tobin 11eb1f57f4 Issue #80 - De-unify dom/audiochannel 2020-04-24 10:31:42 +02:00
Matt A. Tobin 052cb18fff Issue #80 - De-unify dom/notification 2020-04-24 10:31:31 +02:00
Matt A. Tobin d306fe61c5 Issue #80 - De-unify dom/url 2020-04-24 10:31:19 +02:00
Matt A. Tobin 7859a0d693 Issue #80 - De-unify dom/encoding 2020-04-24 10:31:08 +02:00
Matt A. Tobin c5d9e1f973 Issue #80 - De-unify dom/json 2020-04-24 10:30:52 +02:00
Matt A. Tobin 2e12bda342 Issue #80 - De-unify dom/u2f 2020-04-24 10:30:40 +02:00
Matt A. Tobin 9755cd617d Issue #80 - De-unify dom/power 2020-04-24 10:30:29 +02:00
Matt A. Tobin abaf4d9fb4 Issue #80 - De-unify dom/mathml 2020-04-24 10:30:18 +02:00
Matt A. Tobin ae6f407177 Issue #80 - De-unify dom/jsurl 2020-04-24 10:30:08 +02:00
Matt A. Tobin 2a44476795 Issue #80 - De-unify dom/worklet 2020-04-24 10:29:56 +02:00
Matt A. Tobin 755cf4c7d0 Issue #80 - De-unify dom/console 2020-04-24 10:29:45 +02:00
Matt A. Tobin 47f26a67f4 Issue #80 - De-unify dom/media/webm 2020-04-24 10:29:34 +02:00
Matt A. Tobin e8aa76713a Issue #80 - De-unify dom/media/flac 2020-04-24 10:29:23 +02:00
Matt A. Tobin e6ffc4bdb7 Issue #80 - De-unify dom/media/mp3 2020-04-24 10:29:13 +02:00
Matt A. Tobin 90bbe7536d Issue #80 - De-unify dom/media/ogg 2020-04-24 10:29:01 +02:00
Matt A. Tobin 140750e4e8 Issue #80 - De-unify dom/media/encoder 2020-04-24 10:28:50 +02:00
Matt A. Tobin f2e089d51b Issue #80 - De-unify dom/media/mediasink 2020-04-24 10:28:38 +02:00
Matt A. Tobin e1d0ac30ac Issue #80 - De-unify dom/media/wave 2020-04-24 10:28:28 +02:00
Matt A. Tobin 9e8adc25a4 Issue #80 - De-unify dom/storage 2020-04-24 10:28:16 +02:00
Matt A. Tobin 7f66e8946a Issue #80 - De-unify dom/time 2020-04-24 10:28:05 +02:00
Matt A. Tobin c75b8ec714 Issue #80 - De-unify dom/permission 2020-04-24 10:27:54 +02:00
Matt A. Tobin 4250d93166 Issue #80 - De-unify dom/broadcastchannel 2020-04-24 10:27:42 +02:00
Matt A. Tobin 37250226d5 Issue #80 - De-unify dom/offline 2020-04-24 10:27:30 +02:00
Matt A. Tobin 802a4cfefe Issue #80 - De-unify /layout/inspector 2020-04-24 10:27:18 +02:00
Matt A. Tobin 5641a6d574 Issue #80 - De-unify /layout/tools/layout-debug/src 2020-04-24 10:27:06 +02:00
Matt A. Tobin 88d2480356 Issue #80 - De-unify /layout/ipc 2020-04-24 10:26:52 +02:00
Matt A. Tobin fcb4b997d0 Issue #80 - De-unify /layout/build 2020-04-24 10:26:40 +02:00
wolfbeast 79964767f5 [docs] Update coding style cf. discussion with Tobin. 2020-04-24 10:26:16 +02:00
wolfbeast a4a8d082a3 Issue #251 - Move MOZ_AV1 back to ac configure for everyone to use. 2020-04-24 10:25:57 +02:00
Matt A. Tobin adce88de95 Issue #1516 - Part 1: Add a global build define to determine if the client can draw in the titlebar and update consumers of the local define 2020-04-24 10:24:52 +02:00
wolfbeast 974d6ca889 Issue #1517 - Enable high-resolution DOM timestamps on trunk
At the very least we should enable these short term, with the potential
removal of it pending.
2020-04-16 13:58:36 +02:00
wolfbeast e08a4ad1c8 Issue #1517 - Enable high-resolution DOM timestamps on release 2020-04-16 04:20:42 +02:00
wolfbeast 39dac57259 Merge branch 'redwood' into 28.9-platform 2020-04-14 21:49:04 +02:00
wolfbeast c2d9ab62f3 Fix additional deprot in dom/base 2020-04-14 21:37:53 +02:00
wolfbeast b9e692af05 Revert 1320408 part 15: Make addDataProperty static 2020-04-14 21:10:50 +02:00
wolfbeast 871e57fdd6 Issue #80 - De-unify dom/base and fix deprot. 2020-04-14 14:19:58 +02:00
wolfbeast 03530de64f Fix deprot in /layout 2020-04-14 14:02:50 +02:00
Moonchild 4730da5b27 Create SECURITY.md
Provide basic instructions how to report security vulnerabilities.
2020-04-14 13:28:43 +02:00
wolfbeast 3cb245b749 Issue #1514 - Perform validity check before trying to use the content.
Resolves #1514
2020-04-14 13:28:28 +02:00
wolfbeast 9f5529d1e7 Issue #1513 - Bail on orphan node
This was refactored by Mozilla into doing effectively the same thing so
it aligns with them re: behavior.
Resolves #1513
2020-04-14 13:28:10 +02:00
wolfbeast 26c888208a Issue #1512 - Improve handling of multiple selections.
IsSelectionEditable should check whether the focus node and anchor node
aren't null before trying to use them.
This also changes the initialization of selections' aOutIndex to the
last range in the selection as a fallback in case we don't add a range
later (in AddItem) which could also end up with a null selection
otherwise if the additional selection nodes are removed.
2020-04-14 13:27:57 +02:00
wolfbeast 9a52b3b852 [layout] Always move descendants of layout frames if moved.
If we move the frame then we always need to move any descendant views,
not just in case the frame itself has a view.
2020-04-14 13:27:34 +02:00
wolfbeast 96afb5250d Issue #1511 - Bail on orphan situation.
This resolves #1511
2020-04-14 13:27:12 +02:00
Jan de Mooij b93afb1ba7 [js] Handle functions with rest parameters in isObservableArgumentSlot. 2020-04-14 13:26:57 +02:00
Matt A. Tobin 277f2116b6 Move aom source to a sub-directory under media/libaom
There is no damned reason to treat this differently than any other media lib given its license and there never was.
2020-04-14 13:26:42 +02:00
Matt A. Tobin d270404436 Silence removing dist/bin 2020-04-14 13:26:26 +02:00
Matt A. Tobin 3bec218684 Take files out of preprocessing that no longer require it 2020-04-14 13:26:13 +02:00
Matt A. Tobin 6daff43b61 Follow up to d0eee8f01 - Run precomplete cmd during package staging 2020-04-14 13:25:58 +02:00
Matt A. Tobin eedf9f5ebf Align mar generation on Windows with other platforms
This makes mar generation dependent on packaging not installer
2020-04-14 13:25:44 +02:00
Matt A. Tobin 049dae86d2 Alter config.guess to properly detect host and target bitness on SunOS 2020-04-14 13:25:29 +02:00
wolfbeast 65ba3cac58 [Docshell] Ensure nsDocShell::mContentViewer is released properly. 2020-04-14 13:25:13 +02:00
wolfbeast 1b8788aecb Issue #1505 - Part 3: Make native mode actually native again. 2020-04-14 13:24:59 +02:00
wolfbeast 747632bd64 Issue #1505 - Part 2: Store application build ID in nsHttpHandler
Since we're needing to reuse this several times, it makes it simpler to
just get it once in init and storing it.
2020-04-14 13:24:46 +02:00
wolfbeast 02327fa745 Issue #1505 - Rebuild application version string
To respond dynamically to the pref change, the mAppVersion string needs
to be rebuilt.
Includes some minor improvements for corner cases and removes leftover
b2g junk.
2020-04-14 13:24:32 +02:00
New Tobin Paradigm b470422d5a Issue #1497 - Re-implement an un-preprocessed file check 2020-04-14 13:24:17 +02:00
wolfbeast 449d530a30 Issue #1508 - Redirect moz://a to http://thereisonlyxul.org/ 2020-04-14 13:24:03 +02:00
wolfbeast 8bd941d4e3 Issue #1507 - Remove nsRefreshDriver's use of high res system timers.
Since we are using vsync for timing anyway in the layout refresh driver,
there is no need to bump the system timer resolution down to 1 ms.

This resolves #1507.
2020-04-14 13:23:48 +02:00
JustOff 7172fc72a3 Issue #65 - Fix unprocessed directives in WebRequest.jsm 2020-04-14 13:23:21 +02:00
Matt A. Tobin b977981df6 Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp
.. correctly
2020-04-14 13:23:06 +02:00
Matt A. Tobin 9dc65422ba Revert "Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp"
This reverts commit d4afddfada.
2020-04-14 13:22:51 +02:00
Matt A. Tobin 45e8e98031 Make the reference to Handle unambiguous in ipc/testshell/XPCShellEnvironment.cpp 2020-04-14 13:22:34 +02:00
Matt A. Tobin 965232ab2f Output webidl filenames as they are processed 2020-04-14 13:22:13 +02:00
athenian200 980ca14602 Issue #1501 - Un-bust building of NSS after update to 3.48 on Solaris. 2020-04-14 13:21:54 +02:00
Matt A. Tobin 02519e8575 Explicitly remove dist/bin before mozbuild's install_manifests get a hold of it 2020-04-14 13:21:33 +02:00
Matt A. Tobin e003547dc5 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-04-14 13:21:07 +02:00
Matt A. Tobin 56f8375338 Revert "Only state the stop notification for JSDownloads in nsWebBrowserPersist::EndDownload"
This reverts commit aa28523a55.
2020-04-14 13:20:54 +02:00
wolfbeast 2407845ec1 Issue #1280 - Un-bust certerror pages and ForgetAboutSite 2020-04-14 13:20:35 +02:00
wolfbeast 3f09b298b0 Issue #1280 - Stop requesting HPKP state from within devtools. 2020-04-14 13:20:22 +02:00
wolfbeast c27830f35c Issue #1280 - Part 2: Remove HPKP tests. 2020-04-14 13:19:54 +02:00
wolfbeast 99bad1726e 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-04-14 13:19:41 +02:00
JustOff d86349716a Issue #1473 - Fix building %OS_SLICE% on non-Windows platforms 2020-04-14 13:19:20 +02:00
JMadgwick 64a7c9e2d2 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-04-14 13:18:48 +02:00
New Tobin Paradigm 514ff21cba Update README.md 2020-04-14 13:18:16 +02:00
wolfbeast edb5796d58 Issue #1497 Revert "Check if there are any unpreprocessed files"
This reverts PR #429
2020-04-14 13:18:02 +02:00
wolfbeast c23e3b25f8 Issue #1497 Revert "MoonchildProductions#1251 - Part 19"
"Make the unpreprocessed file script work on Solaris."

This reverts commit e51afbcc2f.
2020-04-14 13:17:47 +02:00
Matt A. Tobin e360caa1a2 Teach config.guess to know if we want to build 32 or 64 bit builds on Windows 2020-04-14 13:17:20 +02:00
Matt A. Tobin 9eeaeff77b Issue #1499 - Re-import ExtensionStorage.jsm 2020-04-14 13:16:54 +02:00
wolfbeast a435374873 Issue #1498 - Part 6: Remove STS preloadlist pref. 2020-04-14 13:16:38 +02:00
wolfbeast 04cfc091da Issue #1498 - Part 5: Update SSService CID and correct mismatch. 2020-04-14 13:16:24 +02:00
wolfbeast b23e7b61c6 Issue #1498 - Part 4: Remove clearPreloads.
Also tag #1280
2020-04-14 13:16:11 +02:00
wolfbeast 69b4e77751 Issue #1498 - Part 3: Remove support for storing "knockout" values. 2020-04-14 13:15:58 +02:00
wolfbeast 5657b5c53b Issue #1498 - Part 2: 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-04-14 13:14:43 +02:00
wolfbeast 1037746d00 Issue #1498 - Part 1: Stop using HSTS preload lists. 2020-04-14 13:14:03 +02:00
Matt A. Tobin a060401264 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-04-14 13:13:44 +02:00
wolfbeast 4e26fc1844 Issue #447 - Update HSTS preload list 2020-04-14 13:13:06 +02:00
Brian Smith 2645f9b944 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-04-14 13:12:48 +02:00
Brian Smith 88ce149033 Issue #1491 - Part 1: Update nsCocoaFeatures for newer versions of MacOS X. 2020-04-14 13:12:25 +02:00
wolfbeast 09655ad6d8 Issue #1467 - Part 4: Rename NSS_SQLSTORE to MOZ_SECURITY_SQLSTORE.
Rename the build config option accordingly.
2020-04-14 13:12:08 +02:00
wolfbeast 4fd0b98c2c Issue #1467 - Part 3: Use UTF-8 file paths for NSS-SQL database. 2020-04-14 13:11:51 +02:00
wolfbeast 894b33e53a Issue #1467 - Part 2: Make the PBKDF rounds adaptive to choice of NSS db 2020-04-14 13:11:37 +02:00
wolfbeast 236d425993 Issue #1467 - Part 1b: Fix type and make moz.configure happy. 2020-04-14 13:11:22 +02:00
wolfbeast 899e14e945 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-04-14 13:11:05 +02:00
wolfbeast 03fda9f0f3 [devtools] Properly escape method arguments for curl. 2020-04-14 13:10:45 +02:00
wolfbeast 3aae828871 [DOM] Make sure to exit fullscreen mode if popups are opened or focused. 2020-04-14 13:10:23 +02:00
wolfbeast e7514afc7c [js] Remove pointless MakeMRegExpHoistable optimization.
It's a lot of code with no measurable effect.
2020-04-14 13:10:09 +02:00
wolfbeast 4adf0d09f7 [network] Cherry-pick various sctp lib upstream fixes. 2020-04-14 13:09:51 +02:00
wolfbeast 22d0b88e37 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-04-14 13:06:54 +02:00
JustOff f7388678bd Issue #1482 - Give dynamic SSUAO rules priority over static ones 2020-04-14 13:06:30 +02:00
wolfbeast b45f5c435e 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-04-14 13:06:11 +02:00
Matt A. Tobin 3c73c0805c 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-04-14 13:05:58 +02:00
wolfbeast db93b005f5 Issue #1480 - Skip abspos, fixed, float and placeholders for outline. 2020-04-14 13:05:43 +02:00
JustOff d2aaa74f31 Issue #1053 - Remove no longer used function and modules from UserAgentUpdates.jsm 2020-04-14 13:05:25 +02:00
JustOff 702cf42544 Issue #1473 - Add %OS_SLICE% macro to SSUAO to refine OS info 2020-04-14 13:05:07 +02:00
wolfbeast 79a9dc2479 Minor update to UXP coding style guideline. 2020-04-14 13:04:46 +02:00
New Tobin Paradigm ddcc3deddd Update README.md 2020-04-14 13:04:19 +02:00
wolfbeast f3b148844a 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-04-14 13:04:05 +02:00
wolfbeast 51d5d162b7 Update UXP coding style guide JS guide. 2020-04-14 13:03:47 +02:00
wolfbeast 94494805da Update UXP coding style guide JS guide. 2020-04-14 13:03:34 +02:00
Matt A. Tobin 5c7109182c Issue #1470 - Part 3: Remove now unused update.locale
This requires changes to package-manifest in all applications
2020-04-14 13:03:21 +02:00
Matt A. Tobin 68e873ada7 Issue #1470 - Part 2: Change calls from UpdateUtils.getUpdateChannel() to UpdateUtils.UpdateChannel in telemetry modules 2020-04-14 13:03:07 +02:00
Matt A. Tobin a5b05528fe Issue #1470 - Part 1: Refactor UpdateUtils.jsm 2020-04-14 13:02:53 +02:00
wolfbeast ce88d82f4a Update UXP coding style guide with JS guide. 2020-04-14 13:02:39 +02:00
New Tobin Paradigm 61d3aa9be2 Remove exposed bug from UpdateUtils.jsm 2020-04-14 13:02:22 +02:00
Matt A. Tobin a078d9f976 Issue #1053 - Remove android-only skia-npapi 2020-04-14 13:01:51 +02:00
Matt A. Tobin 3ed2b7a7cc Issue #1053 - Remove android support from nsNSSComponent.cpp 2020-04-14 13:01:34 +02:00
Matt A. Tobin 9816a810e6 Issue #251 - Move --disable-dbm to ac configure
Also Tag #1467
2020-04-14 13:01:21 +02:00
Matt A. Tobin 9a8068ea3f Remove unused mailnews.mozbuild 2020-04-14 13:01:07 +02:00
Matt A. Tobin dcd9bbb717 Mork is not dependent on dbm and never was. 2020-04-14 13:00:55 +02:00
Matt A. Tobin ecc0a40688 Correct typo in mailnews/base/src/moz.build 2020-04-14 13:00:41 +02:00
Matt A. Tobin 8f40737fc7 Issue #1319 - Remove EARLY_BETA_OR_EARLIER condition 2020-04-14 13:00:26 +02:00
wolfbeast e7841ab5d7 Issue #1465 - Implement optional catch binding. 2020-04-14 13:00:11 +02:00
wolfbeast dba09fa5c4 Revert "Issue #1355 - Better way to create display items for column backgrounds"
This reverts commit 44c47c5038.
2020-04-14 12:59:57 +02:00
wolfbeast afe2b7fa5a Revert "Layout\reftests\table-background\reftest.list should have only additions to the end of it."
This reverts commit efdc2af8ab.
2020-04-14 12:59:43 +02:00
wolfbeast acaec3f389 [DOM] Add a null check 2020-04-14 12:59:26 +02:00
Matt A. Tobin d2083edba2 No Issue - Always build marionette until it can be tracked down and killed 2020-04-14 12:58:54 +02:00
win7-7 1ebcc1d7e5 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-04-14 12:58:33 +02:00
win7-7 cbb61ab832 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-04-14 12:58:11 +02:00
Matt A. Tobin cf288a1847 Issue #1053 - Remove android preprocessor directive from toolkit/locales/jar.mn 2020-04-14 12:57:54 +02:00
wolfbeast 0d1eea2ebf 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-04-14 12:57:32 +02:00
wolfbeast af69cb07db Revert #1137 - Remove unboxed arrays
- accounting for removal of watch()/unwatch()
- updated for intermediate code changes.
2020-04-14 12:57:13 +02:00
wolfbeast dc4695406f Revert "Issue #1382 - Remove invalid assertion."
This reverts commit 9c6a8450b3.
2020-04-14 12:56:56 +02:00
wolfbeast c22a493144 Revert #1142 - Remove unboxed objects
- accounting for removal of watch()/unwatch()
2020-04-14 12:56:40 +02:00
Matt A. Tobin d20ca24a07 Issue #1053 - Remove android support from toolkit
Note: Does not remove support completely from toolkit/mozapps/installer or from telemetry or AppConstants.jsm
2020-04-14 12:56:02 +02:00
Matt A. Tobin b2ca17a298 Bug 1339444 - Remove unused resource://gre/modules/sqlite/sqlite_internal.js 2020-04-14 12:55:48 +02:00
Matt A. Tobin eb70e6e3d0 Issue #439 - Remove tests from toolkit/ 2020-04-14 12:55:19 +02:00
Matt A. Tobin 32ead79529 Issue #1053 - Remove android support from db 2020-04-14 12:55:00 +02:00
Matt A. Tobin 3e59235162 Issue #1053 - Remove android support from docshell 2020-04-14 12:54:47 +02:00
Matt A. Tobin 7494866cb5 Issue #1053 - Remove android support from hal 2020-04-14 12:54:30 +02:00
Matt A. Tobin 19bf63b0ee Issue #1053 - Remove android support from image 2020-04-14 12:54:15 +02:00
Matt A. Tobin 8b539ec9e7 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-04-14 12:54:01 +02:00
Matt A. Tobin ba0011606d Follow-up to 4e2e9be6a - Move HeapSnapshot DevTools-only Modules back to DevTools
I am so done with this.

Resolves #316
2020-04-14 12:53:46 +02:00
Matt A. Tobin ec2daa8dc9 Issue #1053 - Remove android support from memory 2020-04-14 12:53:27 +02:00
Matt A. Tobin 44c169c9be Issue #1053 - Remove android support from mfbt 2020-04-14 12:53:13 +02:00
Matt A. Tobin 57383be95d 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-04-14 12:52:59 +02:00
Matt A. Tobin 6ef03f136b Issue #1053 - Remove android support from mozglue
Yes, I checked for unsaved files this time...
2020-04-14 12:52:45 +02:00
Matt A. Tobin d6bcaa6491 Issue #1053 - Remove android support from netwerk/protocol/http/nsHttpHandler.cpp 2020-04-14 12:52:32 +02:00
Matt A. Tobin 92edec6f58 Issue #1053 - Remove android support from netwerk 2020-04-14 12:52:18 +02:00
Matt A. Tobin 2dea4edfd7 Issue #1053 - Remove android support from storage/mozStorageConnection.cpp 2020-04-14 12:52:05 +02:00
Matt A. Tobin 54cb1b965e Issue #1053 - Remove android support from uriloader 2020-04-14 12:51:52 +02:00
Matt A. Tobin a6d1dd183d Issue #1053 - Remove android support from xpcom/threads/nsThread.cpp
Forgot to save..
2020-04-14 12:51:38 +02:00
Matt A. Tobin da15aa0fdf Issue #1053 - Remove android support from XPCOM 2020-04-14 12:51:25 +02:00
Matt A. Tobin 867737dd4b Remove redundant moz.build from db/ 2020-04-14 12:51:11 +02:00
Matt A. Tobin 36fc5f674e Reclassify heapsnapshot and nsJSInspector as not part of devtools
This resolves Issue #316
2020-04-14 12:50:57 +02:00
wolfbeast 7b30664f59 Set module default identification properly. 2020-04-14 12:50:42 +02:00
wolfbeast ef71f96a8d Remove gtest reference to non-existing path of removed component 2020-04-14 12:50:25 +02:00
wolfbeast 2b99226680 [gfx] Put Skia-specific CTOR init behind Skia-conditional. 2020-04-14 12:50:12 +02:00
wolfbeast 2794f0c48c Issue #316 - Make sure MOZ_DEVTOOLS_SERVER is passed down to js. 2020-04-14 12:49:36 +02:00
Matt A. Tobin 2f23073a3a Issue #1053 - Remove android support from NPAPI 2020-04-14 12:49:22 +02:00
Matt A. Tobin 496fbaf738 Issue #1053 - Remove conditional android code from widget/ 2020-04-14 12:49:08 +02:00
Matt A. Tobin 85621ee9b3 Issue #1053 - Remove Android Widget Toolkit specific files 2020-04-14 12:48:53 +02:00
Matt A. Tobin ee6595e6de Issue #439 - Remove tests from widget/ 2020-04-14 12:48:40 +02:00
wolfbeast 201be4d8fc Issue #316 - Be more gentle with the CC and nursery. 2020-04-14 12:48:23 +02:00
wolfbeast 9e586a1d0e Issue #316 - Pre-process Performance.webidl 2020-04-14 12:48:09 +02:00
wolfbeast 009c9dd2f8 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-04-14 12:47:56 +02:00
Matt A. Tobin 6407f1abd4 Issue #1457 - Unfold sqlite3 from nss 2020-04-14 12:47:38 +02:00
wolfbeast 28f0155307 Issue #1383 - Remove "Copy raw data to clipboard" button
This resolves #1383
2020-04-14 12:47:23 +02:00
JustOff 11ede87242 Issue #1445 - Add a link to details on using Firefox extensions in Pale Moon 2020-04-14 12:47:05 +02:00
Matt A. Tobin 3630fec559 Issue #1454 - Add MOZ_PKG_SPECIAL to UpdateUtils 2020-04-14 12:46:46 +02:00
JustOff d062e7311c Issue #1445 - strings cleanup 2020-04-14 12:46:29 +02:00
wolfbeast 0313ac74fd Issue #1445 - remove redundant nativeIndicator
This resolves #1445
2020-04-14 12:46:14 +02:00
Matt A. Tobin 9612c64265 Issue #1320 - Stop appending cpu arch to the end of %BUILD_TARGET% on Windows in UpdateUtils.jsm 2020-04-14 12:45:59 +02:00
wolfbeast c5d570792d Issue #1445 - Use the detailed string also in the list entries. 2020-04-14 12:45:44 +02:00
wolfbeast 10c4e73e56 Issue #1446 - Only match extension add-on types for target applications.
This resolves #1446
2020-04-14 12:45:31 +02:00
win7-7 c9fd86cb78 Issue #1355 - Make nsTableCellFrame::GetColIndex/GetRowIndex faster
We can devirtualize it, remove some branches.
2020-04-14 12:45:15 +02:00
wolfbeast 550d634ff5 Issue #1446 - Only allow extension add-on types for Firefox compat mode. 2020-04-14 12:44:56 +02:00
wolfbeast bbee80fa1c Issue #1445 - Clarify the status of extensions in the Add-On manager
This resolves #1445.
2020-04-14 12:44:41 +02:00
wolfbeast 8ffe533b3d [CSS] Only emit non-GC chrome wrapped XUL box warnings in debug builds. 2020-04-14 12:44:16 +02:00
wolfbeast 9670bdb685 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-04-14 12:44:02 +02:00
wolfbeast 8fa80e2c8d Revert "Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var."
This reverts commit 2bdbca39b2.
2020-04-14 12:43:49 +02:00
Simon Giesecke a377d1ecd4 [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-04-14 12:43:34 +02:00
Henri Sivonen 1ebbb0af03 [Parser] Move setting context to null to the correct location. 2020-04-14 12:43:22 +02:00
wolfbeast 29b13d3523 Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var. 2020-04-14 12:43:06 +02:00
sotaro 76476ed75b [Layers] Clear WrappingTextureSourceYCbCrBasic::mTexture correctly 2020-04-14 12:42:53 +02:00
wolfbeast 84fc500ff2 [Network] Bump http channel default Firefox CompatMode init value. 2020-04-14 12:42:38 +02:00
wolfbeast 2560dd2514 Fix a whitespace issue in nsComputedDOMStyle.cpp 2020-04-14 12:42:23 +02:00
wolfbeast 0e2b0db4d7 [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-04-14 12:42:10 +02:00
wolfbeast c4f65de9b2 [CSP] Allow not having a Port for RessourceURI if the Scheme has no
Default Port
2020-04-14 12:41:57 +02:00
Matt A. Tobin e3148b0a25 Issue #65 - Correct nsHelperAppDlg.js for bad preprocessing conversion 2020-04-14 12:41:44 +02:00
Matt A. Tobin fe6730c219 Issue #80 - Stop building non-generated dom/binding files as UNIFIED_SOURCES
Also fix deprot
2020-04-14 12:41:31 +02:00
Matt A. Tobin 2e44ddb15e 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-04-14 12:41:12 +02:00
win7-7 da74d1f3f3 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-04-14 12:40:47 +02:00
Matt A. Tobin 91be118376 Issue #65 - Don't split in the middle of assignment statements in createProfileWizard.js 2020-04-14 12:40:06 +02:00
Matt A. Tobin 2258e09d59 Issue #65 - Correct fallthough case in profileSelection.js 2020-04-14 12:39:51 +02:00
Matt A. Tobin 30ec922d7e Issue #65 - Remove AppConstants from toolkit/components/passwordmgr 2020-04-14 12:39:35 +02:00
Matt A. Tobin 1000488a5b Issue #65 - Remove AppConstants from toolkit/components/alerts 2020-04-14 12:39:21 +02:00
Matt A. Tobin ffe75592e3 Issue #65 - Remove AppConstants from toolkit/components/places 2020-04-14 12:39:08 +02:00
Matt A. Tobin 0084e71953 Issue #65 - Remove AppConstants from toolkit/components/apppicker 2020-04-14 12:38:54 +02:00
Matt A. Tobin dbeceecde2 Issue #65 - Remove AppConstants from toolkit/components/thumbnails 2020-04-14 12:38:41 +02:00
Matt A. Tobin 9fc28c55c3 Issue #65 - Remove AppConstants from toolkit/components/printing 2020-04-14 12:38:27 +02:00
Matt A. Tobin 113a825c1f Issue #65 - Remove AppConstants from toolkit/components/satchel 2020-04-14 12:38:14 +02:00
Matt A. Tobin 419abfb09f Issue #65 - Remove AppConstants from toolkit/components/jsdownloads 2020-04-14 12:37:58 +02:00
Matt A. Tobin 4e58dab0a1 Issue #65 - Remove AppConstants from toolkit/mozapps/downloads 2020-04-14 12:37:44 +02:00
Matt A. Tobin 9e42d9ea2f Issue #65 - Remove AppConstants from toolkit/mozapps/extensions 2020-04-14 12:37:29 +02:00
Matt A. Tobin 377f54f3fe Issue #65 - Remove AppConstants from toolkit/mozapps/update 2020-04-14 12:37:16 +02:00
Matt A. Tobin 62f39d829d Issue #65 - Remove AppConstants from toolkit/profile 2020-04-14 12:37:02 +02:00
win7-7 28971524e4 fix whitespace
fix whitespace.
2020-04-14 12:36:29 +02:00
win7-7 be37269123 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-04-14 12:36:12 +02:00
Matt A. Tobin 8acff5cdbe Issue #1395 - Part 2: Remove the rest of FlyWeb 2020-04-14 12:35:06 +02:00
Matt A. Tobin 11a4ab0982 Issue #1395 - Remove FlyWeb Service 2020-04-14 12:31:31 +02:00
Matt A. Tobin 8c41fcd240 Issue #1390 - Get rid of the Presentation API 2020-04-14 12:31:16 +02:00
Matt A. Tobin 27f4e60be8 Issue #1390 - Remove secondscreen modules from toolkit 2020-04-14 12:31:03 +02:00
wolfbeast aae1baabe9 [AM] Remove shared theme leftovers for webextensions 2020-04-14 12:30:49 +02:00
Matt A. Tobin f620afc446 Issue #1392 - Change --enable-eme to MOZ_ARG_ENABLE_BOOL and remove MOZ_EME_MODULES 2020-04-14 12:30:34 +02:00
Moonchild 456f4a5891 Update UXP Coding Style.md
Be more explicit about paranthesis spacing
2020-04-14 12:30:16 +02:00
Moonchild 84d99e2996 Update UXP Coding Style.md
Minor typo
2020-04-14 12:30:03 +02:00
wolfbeast e29301f5d0 Issue #26 - Part 2c: Remove dependence on gmp/widevine-adapter/* 2020-04-14 12:29:44 +02:00
wolfbeast 369ad75fc8 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-04-14 12:29:29 +02:00
wolfbeast 37e3135bc5 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-04-14 12:29:16 +02:00
wolfbeast 259bd2e977 [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-04-14 12:28:34 +02:00
win7-7 0ebdc99757 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-04-14 12:28:14 +02:00
wolfbeast 68d3bc54fb 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-04-14 12:28:00 +02:00
win7-7 2109f36dd4 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-04-14 12:27:45 +02:00
wolfbeast 58f10adc97 Revert "Issue #1355 - Hit testing in large tables has become extremely slow"
This reverts commit f7b2f0a665.
2020-04-14 12:27:31 +02:00
win7-7 05c68a17a0 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-04-14 12:27:14 +02:00
New Tobin Paradigm f78958a020 Fix preprocessor directive in UserAgentUpdates.jsm 2020-04-14 12:26:58 +02:00
wolfbeast bcd6c96aec Issue #1378 - Follow-up: make sure background items remain table-aligned. 2020-04-14 12:26:44 +02:00
Matt A. Tobin 73289f5389 Issue #65 - Remove AppConstants from toolkit/modules
Except for secondscreen
2020-04-14 12:26:25 +02:00
Matt A. Tobin 4acc0d58cb Issue #65 - Remove AppConstants from toolkit/content 2020-04-14 12:26:11 +02:00
Matt A. Tobin a1c9dd468d Issue #65 - Remove AppConstants from netwerk/ 2020-04-14 12:25:58 +02:00
Matt A. Tobin 0a5acb852a Issue #65 - Remove AppConstants from mailnews/ 2020-04-14 12:25:45 +02:00
Matt A. Tobin c8bbebe59d Issue #65 - Remove AppConstants from dom/ 2020-04-14 12:25:32 +02:00
wolfbeast fddc35e438 Issue #1378 - Align the drawing of table cell backgrounds with the spec. 2020-04-14 12:22:44 +02:00
Matt A. Tobin 7e4efa4e1f 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-04-14 12:21:51 +02:00
wolfbeast 84b5515a8d 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-04-14 12:21:27 +02:00
wolfbeast 6b7fa183dd Issue #1342 - Remove support for system libvpx 2020-04-14 12:21:10 +02:00
wolfbeast a43d59bcbf Issue #1342 - Remove support for system sqlite 2020-04-14 12:20:23 +02:00
wolfbeast ac6896b599 Issue #1342 - Update old.configure for removed build options 2020-04-14 12:20:08 +02:00
wolfbeast 171053d0b2 Issue #1342 - Remove support for system linbpng 2020-04-14 12:19:55 +02:00
win7-7 efd88ee999 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-04-14 12:19:39 +02:00
wolfbeast 9a74d53315 Issue #1342 - Remove support for system NSPR/NSS 2020-04-14 12:18:35 +02:00
wolfbeast e2a478072a Issue #1342 - Remove support for system ICU 2020-04-14 12:18:21 +02:00
wolfbeast cb06cac81d [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-04-14 12:17:58 +02:00
athenian200 c3d92cd338 Issue #1356 - Add tests.
Forgot to include these before.
2020-04-14 12:17:34 +02:00
athenian200 8ae2267eac 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-04-14 12:16:48 +02:00
athenian200 563dc95cdb Issue #1356 - Remove -moz-user-input disabled to improve event handling. 2020-04-14 12:16:31 +02:00
wolfbeast 7e59ac9036 Issue #1360 - Enable acceleration by default on all known-good platforms. 2020-04-14 12:15:53 +02:00
wolfbeast f1e40aaa5b Issue #1360 - Part 2: Update tests for changed preferences. 2020-04-14 12:14:27 +02:00
wolfbeast 068372c618 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-04-14 12:14:11 +02:00
3012 changed files with 232414 additions and 128935 deletions

No files matched your search

+5
View File
@@ -36,6 +36,11 @@ def FlagsForFile(filename):
flag_list = shlex.split(out.getvalue())
# This flag is added by Fennec for android build and causes ycmd to fail to parse the file.
# Removing this flag is a workaround until ycmd starts to handle this flag properly.
# https://github.com/Valloric/YouCompleteMe/issues/1490
final_flags = [x for x in flag_list if not x.startswith('-march=armv')]
return {
'flags': final_flags,
'do_cache': True
+1 -1
View File
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Clobber for NSS update
Clobber for NSS update
+3 -1
View File
@@ -9,6 +9,8 @@ selective cherry-picking of directly-applicable patches, this repository has its
own development and holds the base for a maintained platform to be used by XUL
applications.
For a list of active projects making use of the Unified XUL Platform, checkout http://thereisonlyxul.org/.
## Additional documentation
Additional documentation relevant to this source code can be found in the `/docs`
@@ -21,7 +23,7 @@ You are also always welcome to get in touch with our community on the [Pale Moon
### A note about trademarks and branding
Although this repository is primarily licensed under Mozilla Public License v2.0, the
Although this repository is licensed under Mozilla Public License v2.0, the
trademarks and brands contained herein remain the property of their respective
owners. For more details, please see the notifications in the respective directories.
+3 -2
View File
@@ -15,14 +15,14 @@ What should be considered vulnerabilities or security hazards by default:
Generally not security vulnerabilities:
- Null dereferencing crashes;
- Malware extensions (but please do report those on the forum in the add-ons board!);
- Malware extensions (but please do report those on the forum in the extensions board!);
- Denial-of-service (AKA "evil trap sites")
- Browser hangs
- Issues with non-standard manual configuration (either at build time or by manipulating about:config directly)
## Reporting a Vulnerability
If you find an issue in UXP, or the applications building on it, that could impact the security or safety of users please **do not**
If you find an issue in UXP or the applications it builds on that could impact the security or safety of users please **do not**
make an issue on Gitea about it. Gitea does not support restricted viewability for security sensitive bugs.
If you want to report a security-sensitive issue then please go to the [forum](https://forum.palemoon.org) and report the issue
@@ -33,3 +33,4 @@ except the recipient (not even moderators!).
You will be informed via private message if the vulnerability report is accepted or declined, with reasoning.
Security updates occur regularly and are given priority over most other development tasks. In general, they can be solved
relatively quickly and will be included in the next point release (third digit if not rolled into a more major one).
+2
View File
@@ -5,7 +5,9 @@
#include "AccIterator.h"
#include "AccGroupInfo.h"
#ifdef MOZ_XUL
#include "XULTreeAccessible.h"
#endif
#include "mozilla/dom/HTMLLabelElement.h"
+2
View File
@@ -341,6 +341,8 @@ LogRequest(nsIRequest* aRequest)
printf("targeted; ");
if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS)
printf("call content sniffers; ");
if (loadFlags & nsIChannel::LOAD_CLASSIFY_URI)
printf("classify uri; ");
} else {
printf(" no request");
}
@@ -13,6 +13,7 @@
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
using namespace mozilla::a11y;
+2 -2
View File
@@ -35,10 +35,10 @@ EPlatformDisabledState PlatformDisabledState();
void PreInit();
#endif
#if defined(MOZ_ACCESSIBILITY_ATK) || defined(XP_MACOSX)
#if defined(MOZ_ACCESSIBILITY_ATK)
/**
* Is platform accessibility enabled.
* Only used on linux with atk and MacOS for now.
* Only used on linux with atk.
*/
bool ShouldA11yBeEnabled();
#endif
-4
View File
@@ -96,10 +96,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
@@ -68,6 +68,7 @@
#include "mozilla/Services.h"
#include "nsDeckFrame.h"
#ifdef MOZ_XUL
#include "XULAlertAccessible.h"
#include "XULColorPickerAccessible.h"
#include "XULComboboxAccessible.h"
@@ -78,6 +79,7 @@
#include "XULSliderAccessible.h"
#include "XULTabAccessible.h"
#include "XULTreeGridAccessibleWrap.h"
#endif
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
#include "nsNPAPIPluginInstance.h"
@@ -1354,6 +1356,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
}
RefPtr<Accessible> accessible;
#ifdef MOZ_XUL
// XUL controls
if (role.EqualsLiteral("xul:alert")) {
accessible = new XULAlertAccessible(aContent, aDoc);
@@ -1512,6 +1515,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
}
#endif // MOZ_XUL
return accessible.forget();
}
@@ -1735,6 +1739,7 @@ nsAccessibilityService::HasAccessible(nsIDOMNode* aDOMNode)
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService private (DON'T put methods here)
#ifdef MOZ_XUL
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
DocAccessible* aDoc)
@@ -1764,6 +1769,7 @@ nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
new XULTreeGridAccessibleWrap(aContent, aDoc, treeFrame);
return accessible.forget();
}
#endif
nsAccessibilityService*
GetOrCreateAccService(uint32_t aNewConsumer)
+2
View File
@@ -274,11 +274,13 @@ private:
CreateAccessibleByFrameType(nsIFrame* aFrame, nsIContent* aContent,
Accessible* aContext);
#ifdef MOZ_XUL
/**
* Create accessible for XUL tree element.
*/
already_AddRefed<Accessible>
CreateAccessibleForXULTree(nsIContent* aContent, DocAccessible* aDoc);
#endif
/**
* Reference for accessibility service instance.
+6
View File
@@ -48,7 +48,9 @@
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#ifdef MOZ_XUL
#include "nsIXULDocument.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;
@@ -208,9 +210,11 @@ DocAccessible::NativeRole()
return roles::CHROME_WINDOW;
if (itemType == nsIDocShellTreeItem::typeContent) {
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocumentNode));
if (xulDoc)
return roles::APPLICATION;
#endif
return roles::DOCUMENT;
}
}
@@ -383,11 +387,13 @@ DocAccessible::URL(nsAString& aURL) const
void
DocAccessible::DocType(nsAString& aType) const
{
#ifdef MOZ_XUL
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocumentNode));
if (xulDoc) {
aType.AssignLiteral("window"); // doctype not implemented for XUL at time of writing - causes assertion
return;
}
#endif
dom::DocumentType* docType = mDocumentNode->GetDoctype();
if (docType)
docType->GetPublicId(aType);
+31 -8
View File
@@ -19,7 +19,9 @@
#include "Relation.h"
#include "Role.h"
#include "States.h"
#ifdef MOZ_XUL
#include "XULTreeAccessible.h"
#endif
#include "mozilla/dom/Element.h"
@@ -41,8 +43,10 @@
#include "nsFocusManager.h"
#include "nsGlobalWindow.h"
#ifdef MOZ_XUL
#include "nsIXULDocument.h"
#include "nsIXULWindow.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;
@@ -98,6 +102,7 @@ RootAccessible::NativeRole()
}
// RootAccessible protected member
#ifdef MOZ_XUL
uint32_t
RootAccessible::GetChromeFlags()
{
@@ -117,6 +122,7 @@ RootAccessible::GetChromeFlags()
xulWin->GetChromeFlags(&chromeFlags);
return chromeFlags;
}
#endif
uint64_t
RootAccessible::NativeState()
@@ -125,6 +131,7 @@ RootAccessible::NativeState()
if (state & states::DEFUNCT)
return state;
#ifdef MOZ_XUL
uint32_t chromeFlags = GetChromeFlags();
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
state |= states::SIZEABLE;
@@ -135,6 +142,7 @@ RootAccessible::NativeState()
state |= states::MOVEABLE;
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
state |= states::MODAL;
#endif
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && fm->GetActiveWindow() == mDocumentNode->GetWindow())
@@ -284,6 +292,7 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
if (!accessible)
return;
#ifdef MOZ_XUL
XULTreeAccessible* treeAcc = accessible->AsXULTree();
if (treeAcc) {
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
@@ -296,6 +305,7 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
return;
}
}
#endif
if (eventType.EqualsLiteral("RadioStateChange")) {
uint64_t state = accessible->State();
@@ -331,6 +341,7 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
}
Accessible* treeItemAcc = nullptr;
#ifdef MOZ_XUL
// If it's a tree element, need the currently selected item.
if (treeAcc) {
treeItemAcc = accessible->CurrentItem();
@@ -374,22 +385,29 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
nsEventShell::FireEvent(selChangeEvent);
return;
}
} else if (eventType.EqualsLiteral("AlertActive")) {
}
else
#endif
if (eventType.EqualsLiteral("AlertActive")) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
} else if (eventType.EqualsLiteral("popupshown")) {
}
else if (eventType.EqualsLiteral("popupshown")) {
HandlePopupShownEvent(accessible);
} else if (eventType.EqualsLiteral("DOMMenuInactive")) {
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (accessible->Role() == roles::MENUPOPUP) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
} else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
}
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
FocusMgr()->ActiveItemChanged(accessible);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuItemActive", accessible);
#endif
} else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
}
else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
// Process DOMMenuItemInactive event for autocomplete only because this is
// unique widget that may acquire focus from autocomplete popup while popup
// stays open and has no active item. In case of XUL tree autocomplete
@@ -403,7 +421,8 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
logging::ActiveItemChangeCausedBy("DOMMenuItemInactive", accessible);
#endif
}
} else if (eventType.EqualsLiteral("DOMMenuBarActive")) { // Always from user input
}
else if (eventType.EqualsLiteral("DOMMenuBarActive")) { // Always from user input
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
accessible, eFromUserInput);
@@ -421,7 +440,8 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
logging::ActiveItemChangeCausedBy("DOMMenuBarActive", accessible);
#endif
}
} else if (eventType.EqualsLiteral("DOMMenuBarInactive")) { // Always from user input
}
else if (eventType.EqualsLiteral("DOMMenuBarInactive")) { // Always from user input
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
accessible, eFromUserInput);
@@ -430,7 +450,8 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuBarInactive", accessible);
#endif
} else if (accessible->NeedsDOMUIEvent() &&
}
else if (accessible->NeedsDOMUIEvent() &&
eventType.EqualsLiteral("ValueChange")) {
uint32_t event = accessible->HasNumericValue()
? nsIAccessibleEvent::EVENT_VALUE_CHANGE
@@ -629,6 +650,7 @@ RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
}
}
#ifdef MOZ_XUL
void
RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
XULTreeAccessible* aAccessible)
@@ -692,6 +714,7 @@ RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
aAccessible->TreeViewInvalidated(startRow, endRow, startCol, endCol);
}
#endif
ProxyAccessible*
RootAccessible::GetPrimaryRemoteTopLevelContentDoc() const
+7 -5
View File
@@ -70,12 +70,14 @@ protected:
*/
void HandlePopupHidingEvent(nsINode* aNode);
void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
XULTreeAccessible* aAccessible);
void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
XULTreeAccessible* aAccessible);
#ifdef MOZ_XUL
void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
XULTreeAccessible* aAccessible);
void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
XULTreeAccessible* aAccessible);
uint32_t GetChromeFlags();
uint32_t GetChromeFlags();
#endif
};
inline RootAccessible*
-4
View File
@@ -52,10 +52,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
-4
View File
@@ -32,10 +32,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
-4
View File
@@ -19,10 +19,6 @@ else:
LOCAL_INCLUDES += [
'/accessible/atk',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
-4
View File
@@ -28,10 +28,6 @@ if CONFIG['ACCESSIBILITY']:
LOCAL_INCLUDES += [
'/accessible/atk',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
+1 -1
View File
@@ -786,7 +786,7 @@ this.UtteranceGenerator = { // jshint ignore:line
// This is because we expose the checked information on the node itself.
// XXX: this means the checked state is always appended to the end,
// regardless of the utterance ordering preference.
if (Utils.MozBuildApp === 'browser' &&
if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === 'browser') &&
aState.contains(States.CHECKABLE)) {
let checked = aState.contains(States.CHECKED);
let statetr;
+12
View File
@@ -39,6 +39,13 @@ var PointerRelay = { // jshint ignore:line
delete this._eventsOfInterest;
switch (Utils.widgetToolkit) {
case 'android':
this._eventsOfInterest = {
'touchstart' : true,
'touchmove' : true,
'touchend' : true };
break;
default:
// Desktop.
this._eventsOfInterest = {
@@ -103,6 +110,11 @@ var PointerRelay = { // jshint ignore:line
target: aEvent.target
}];
if (Utils.widgetToolkit === 'android' &&
changedTouches.length === 1 && changedTouches[0].identifier === 1) {
return;
}
if (changedTouches.length === 1 &&
changedTouches[0].identifier === SYNTH_ID) {
return;
+29 -17
View File
@@ -257,8 +257,11 @@ AndroidPresenter.prototype.pivotChanged =
let androidEvents = [];
let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT);
let focusEventType = this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED;
let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT &&
Utils.AndroidSdkVersion >= 14);
let focusEventType = (Utils.AndroidSdkVersion >= 16) ?
this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED :
this.ANDROID_VIEW_FOCUSED;
if (isExploreByTouch) {
// This isn't really used by TalkBack so this is a half-hearted attempt
@@ -267,21 +270,25 @@ AndroidPresenter.prototype.pivotChanged =
}
let brailleOutput = {};
if (!this._braillePresenter) {
this._braillePresenter = new BraillePresenter();
if (Utils.AndroidSdkVersion >= 16) {
if (!this._braillePresenter) {
this._braillePresenter = new BraillePresenter();
}
brailleOutput = this._braillePresenter.pivotChanged(aContext, aReason).
details;
}
brailleOutput = this._braillePresenter.pivotChanged(aContext, aReason).
details;
if (aReason === Ci.nsIAccessiblePivot.REASON_TEXT) {
let adjustedText = aContext.textAndAdjustedOffsets;
if (Utils.AndroidSdkVersion >= 16) {
let adjustedText = aContext.textAndAdjustedOffsets;
androidEvents.push({
eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
text: [adjustedText.text],
fromIndex: adjustedText.startOffset,
toIndex: adjustedText.endOffset
});
androidEvents.push({
eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
text: [adjustedText.text],
fromIndex: adjustedText.startOffset,
toIndex: adjustedText.endOffset
});
}
} else {
let state = Utils.getState(aContext.accessible);
androidEvents.push({eventType: (isExploreByTouch) ?
@@ -364,7 +371,7 @@ AndroidPresenter.prototype.textSelectionChanged =
aOldEnd, aIsFromUserInput) {
let androidEvents = [];
if (!aIsFromUserInput) {
if (Utils.AndroidSdkVersion >= 14 && !aIsFromUserInput) {
if (!this._braillePresenter) {
this._braillePresenter = new BraillePresenter();
}
@@ -381,7 +388,7 @@ AndroidPresenter.prototype.textSelectionChanged =
});
}
if (aIsFromUserInput) {
if (Utils.AndroidSdkVersion >= 16 && aIsFromUserInput) {
let [from, to] = aOldStart < aStart ?
[aOldStart, aStart] : [aStart, aOldStart];
androidEvents.push({
@@ -400,6 +407,10 @@ AndroidPresenter.prototype.textSelectionChanged =
AndroidPresenter.prototype.viewportChanged =
function AndroidPresenter_viewportChanged(aWindow, aCurrentContext) {
if (Utils.AndroidSdkVersion < 14) {
return null;
}
let events = [{
eventType: this.ANDROID_VIEW_SCROLLED,
text: [],
@@ -409,7 +420,7 @@ AndroidPresenter.prototype.viewportChanged =
maxScrollY: aWindow.scrollMaxY
}];
if (aCurrentContext) {
if (Utils.AndroidSdkVersion >= 16 && aCurrentContext) {
let currentAcc = aCurrentContext.accessibleForBounds;
if (Utils.isAliveAndVisible(currentAcc)) {
events.push({
@@ -436,7 +447,8 @@ AndroidPresenter.prototype.announce =
return {
type: this.type,
details: [{
eventType: this.ANDROID_ANNOUNCEMENT,
eventType: (Utils.AndroidSdkVersion >= 16) ?
this.ANDROID_ANNOUNCEMENT : this.ANDROID_VIEW_TEXT_CHANGED,
text: [localizedAnnouncement],
addedCount: localizedAnnouncement.length,
removedCount: 0,
+25
View File
@@ -109,13 +109,35 @@ this.Utils = { // jshint ignore:line
return this._ScriptName;
},
get AndroidSdkVersion() {
if (!this._AndroidSdkVersion) {
if (Services.appinfo.OS == 'Android') {
this._AndroidSdkVersion = Services.sysinfo.getPropertyAsInt32(
'version');
} else {
// Most useful in desktop debugging.
this._AndroidSdkVersion = 16;
}
}
return this._AndroidSdkVersion;
},
set AndroidSdkVersion(value) {
// When we want to mimic another version.
this._AndroidSdkVersion = value;
},
get BrowserApp() {
if (!this.win) {
return null;
}
switch (this.MozBuildApp) {
case 'mobile/android':
return this.win.BrowserApp;
case 'browser':
return this.win.gBrowser;
case 'b2g':
return this.win.shell;
default:
return null;
}
@@ -125,6 +147,9 @@ this.Utils = { // jshint ignore:line
if (!this.BrowserApp) {
return null;
}
if (this.MozBuildApp == 'b2g') {
return this.BrowserApp.contentBrowser;
}
return this.BrowserApp.selectedBrowser;
},
-22
View File
@@ -1,22 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
#include "ARIAGridAccessible.h"
namespace mozilla {
namespace a11y {
typedef class ARIAGridAccessible ARIAGridAccessibleWrap;
typedef class ARIAGridCellAccessible ARIAGridCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-103
View File
@@ -1,103 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
#ifndef _AccessibleWrap_H_
#define _AccessibleWrap_H_
#include <objc/objc.h>
#include "Accessible.h"
#include "States.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
#if defined(__OBJC__)
@class mozAccessible;
#endif
namespace mozilla {
namespace a11y {
class AccessibleWrap : public Accessible
{
public: // construction, destruction
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
virtual ~AccessibleWrap();
/**
* Get the native Obj-C object (mozAccessible).
*/
virtual void GetNativeInterface(void** aOutAccessible) override;
/**
* The objective-c |Class| type that this accessible's native object
* should be instantied with. used on runtime to determine the
* right type for this accessible's associated native object.
*/
virtual Class GetNativeType ();
virtual void Shutdown () override;
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override;
virtual bool RemoveChild(Accessible* aAccessible) override;
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
protected:
/**
* Return true if the parent doesn't have children to expose to AT.
*/
bool AncestorIsFlat();
/**
* Get the native object. Create it if needed.
*/
#if defined(__OBJC__)
mozAccessible* GetNativeObject();
#else
id GetNativeObject();
#endif
private:
/**
* Our native object. Private because its creation is done lazily.
* Don't access it directly. Ever. Unless you are GetNativeObject() or
* Shutdown()
*/
#if defined(__OBJC__)
// if we are in Objective-C, we use the actual Obj-C class.
mozAccessible* mNativeObject;
#else
id mNativeObject;
#endif
/**
* We have created our native. This does not mean there is one.
* This can never go back to false.
* We need it because checking whether we need a native object cost time.
*/
bool mNativeInited;
};
#if defined(__OBJC__)
void FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType);
#else
void FireNativeEvent(id aNativeAcc, uint32_t aEventType);
#endif
Class GetTypeFromRole(roles::Role aRole);
} // namespace a11y
} // namespace mozilla
#endif
-256
View File
@@ -1,256 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DocAccessible.h"
#include "nsObjCExceptions.h"
#include "Accessible-inl.h"
#include "nsAccUtils.h"
#include "Role.h"
#import "mozAccessible.h"
#import "mozActionElements.h"
#import "mozHTMLAccessible.h"
#import "mozTableAccessible.h"
#import "mozTextAccessible.h"
using namespace mozilla;
using namespace mozilla::a11y;
AccessibleWrap::
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
Accessible(aContent, aDoc), mNativeObject(nil),
mNativeInited(false)
{
}
AccessibleWrap::~AccessibleWrap()
{
}
mozAccessible*
AccessibleWrap::GetNativeObject()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat()) {
uintptr_t accWrap = reinterpret_cast<uintptr_t>(this);
mNativeObject = [[GetNativeType() alloc] initWithAccessible:accWrap];
}
mNativeInited = true;
return mNativeObject;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
void
AccessibleWrap::GetNativeInterface(void** aOutInterface)
{
*aOutInterface = static_cast<void*>(GetNativeObject());
}
// overridden in subclasses to create the right kind of object. by default we create a generic
// 'mozAccessible' node.
Class
AccessibleWrap::GetNativeType ()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (IsXULTabpanels())
return [mozPaneAccessible class];
if (IsTable())
return [mozTableAccessible class];
if (IsTableRow())
return [mozTableRowAccessible class];
if (IsTableCell())
return [mozTableCellAccessible class];
return GetTypeFromRole(Role());
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
// this method is very important. it is fired when an accessible object "dies". after this point
// the object might still be around (because some 3rd party still has a ref to it), but it is
// in fact 'dead'.
void
AccessibleWrap::Shutdown ()
{
// this ensure we will not try to re-create the native object.
mNativeInited = true;
// we really intend to access the member directly.
if (mNativeObject) {
[mNativeObject expire];
[mNativeObject release];
mNativeObject = nil;
}
Accessible::Shutdown();
}
nsresult
AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
nsresult rv = Accessible::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv);
if (IPCAccessibilityActive()) {
return NS_OK;
}
uint32_t eventType = aEvent->GetEventType();
// ignore everything but focus-changed, value-changed, caret, selection
// and document load complete events for now.
if (eventType != nsIAccessibleEvent::EVENT_FOCUS &&
eventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
eventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
eventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
eventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED &&
eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE)
return NS_OK;
Accessible* accessible = aEvent->GetAccessible();
NS_ENSURE_STATE(accessible);
mozAccessible *nativeAcc = nil;
accessible->GetNativeInterface((void**)&nativeAcc);
if (!nativeAcc)
return NS_ERROR_FAILURE;
FireNativeEvent(nativeAcc, eventType);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
bool
AccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aAccessible)
{
bool inserted = Accessible::InsertChildAt(aIdx, aAccessible);
if (inserted && mNativeObject)
[mNativeObject appendChild:aAccessible];
return inserted;
}
bool
AccessibleWrap::RemoveChild(Accessible* aAccessible)
{
bool removed = Accessible::RemoveChild(aAccessible);
if (removed && mNativeObject)
[mNativeObject invalidateChildren];
return removed;
}
////////////////////////////////////////////////////////////////////////////////
// AccessibleWrap protected
bool
AccessibleWrap::AncestorIsFlat()
{
// We don't create a native object if we're child of a "flat" accessible;
// for example, on OS X buttons shouldn't have any children, because that
// makes the OS confused.
//
// To maintain a scripting environment where the XPCOM accessible hierarchy
// look the same on all platforms, we still let the C++ objects be created
// though.
Accessible* parent = Parent();
while (parent) {
if (nsAccUtils::MustPrune(parent))
return true;
parent = parent->Parent();
}
// no parent was flat
return false;
}
void
a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
switch (aEventType) {
case nsIAccessibleEvent::EVENT_FOCUS:
[aNativeAcc didReceiveFocus];
break;
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
case nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE:
[aNativeAcc valueDidChange];
break;
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
[aNativeAcc selectedTextDidChange];
break;
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
[aNativeAcc documentLoadComplete];
break;
}
NS_OBJC_END_TRY_ABORT_BLOCK;
}
Class
a11y::GetTypeFromRole(roles::Role aRole)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
switch (aRole) {
case roles::COMBOBOX:
case roles::PUSHBUTTON:
case roles::SPLITBUTTON:
case roles::TOGGLE_BUTTON:
{
return [mozButtonAccessible class];
}
case roles::PAGETAB:
return [mozButtonAccessible class];
case roles::CHECKBUTTON:
return [mozCheckboxAccessible class];
case roles::HEADING:
return [mozHeadingAccessible class];
case roles::PAGETABLIST:
return [mozTabsAccessible class];
case roles::ENTRY:
case roles::STATICTEXT:
case roles::CAPTION:
case roles::ACCEL_LABEL:
case roles::PASSWORD_TEXT:
// normal textfield (static or editable)
return [mozTextAccessible class];
case roles::TEXT_LEAF:
return [mozTextLeafAccessible class];
case roles::LINK:
return [mozLinkAccessible class];
default:
return [mozAccessible class];
}
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
@@ -1,22 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__
#define mozilla_a11y_ApplicationAccessibleWrap_h__
#include "ApplicationAccessible.h"
namespace mozilla {
namespace a11y {
typedef ApplicationAccessible ApplicationAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-25
View File
@@ -1,25 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_DocAccessibleWrap_h__
#define mozilla_a11y_DocAccessibleWrap_h__
#include "DocAccessible.h"
namespace mozilla {
namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
};
} // namespace a11y
} // namespace mozilla
#endif
-21
View File
@@ -1,21 +0,0 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DocAccessibleWrap.h"
#import "mozAccessible.h"
using namespace mozilla::a11y;
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell)
{
}
DocAccessibleWrap::~DocAccessibleWrap()
{
}
-24
View File
@@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__
#define mozilla_a11y_HTMLTableAccessibleWrap_h__
#include "HTMLTableAccessible.h"
namespace mozilla {
namespace a11y {
typedef class HTMLTableAccessible HTMLTableAccessibleWrap;
typedef class HTMLTableCellAccessible HTMLTableCellAccessibleWrap;
typedef class HTMLTableHeaderCellAccessible HTMLTableHeaderCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-20
View File
@@ -1,20 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
#define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "HyperTextAccessible.h"
namespace mozilla {
namespace a11y {
typedef class HyperTextAccessible HyperTextAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-22
View File
@@ -1,22 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_ImageAccessibleWrap_h__
#define mozilla_a11y_ImageAccessibleWrap_h__
#include "ImageAccessible.h"
namespace mozilla {
namespace a11y {
typedef class ImageAccessible ImageAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-26
View File
@@ -1,26 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _MacUtils_H_
#define _MacUtils_H_
@class NSString;
class nsString;
namespace mozilla {
namespace a11y {
namespace utils {
/**
* Get a localized string from the string bundle.
* Return nil if not found.
*/
NSString* LocalizedString(const nsString& aString);
}
}
}
#endif
-32
View File
@@ -1,32 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "MacUtils.h"
#include "Accessible.h"
#include "nsCocoaUtils.h"
namespace mozilla {
namespace a11y {
namespace utils {
/**
* Get a localized string from the a11y string bundle.
* Return nil if not found.
*/
NSString*
LocalizedString(const nsString& aString)
{
nsString text;
Accessible::TranslateString(aString, text);
return text.IsEmpty() ? nil : nsCocoaUtils::ToNSString(text);
}
}
}
}
-174
View File
@@ -1,174 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import <Cocoa/Cocoa.h>
#include "Platform.h"
#include "ProxyAccessible.h"
#include "DocAccessibleParent.h"
#include "mozTableAccessible.h"
#include "nsAppShell.h"
namespace mozilla {
namespace a11y {
// Mac a11y whitelisting
static bool sA11yShouldBeEnabled = false;
bool
ShouldA11yBeEnabled()
{
EPlatformDisabledState disabledState = PlatformDisabledState();
return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
}
void
PlatformInit()
{
}
void
PlatformShutdown()
{
}
void
ProxyCreated(ProxyAccessible* aProxy, uint32_t)
{
// Pass in dummy state for now as retrieving proxy state requires IPC.
// Note that we can use ProxyAccessible::IsTable* functions here because they
// do not use IPC calls but that might change after bug 1210477.
Class type;
if (aProxy->IsTable())
type = [mozTableAccessible class];
else if (aProxy->IsTableRow())
type = [mozTableRowAccessible class];
else if (aProxy->IsTableCell())
type = [mozTableCellAccessible class];
else
type = GetTypeFromRole(aProxy->Role());
uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap];
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper));
mozAccessible* nativeParent = nullptr;
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
// If proxy is top level, the parent we need to invalidate the children of
// will be a non-remote accessible.
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
nativeParent = GetNativeFromGeckoAccessible(outerDoc);
}
} else {
// Non-top level proxies need proxy parents' children invalidated.
ProxyAccessible* parent = aProxy->Parent();
nativeParent = GetNativeFromProxy(parent);
NS_ASSERTION(parent, "a non-top-level proxy is missing a parent?");
}
if (nativeParent) {
[nativeParent invalidateChildren];
}
}
void
ProxyDestroyed(ProxyAccessible* aProxy)
{
mozAccessible* nativeParent = nil;
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
// Invalidate native parent in parent process's children on proxy destruction
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
nativeParent = GetNativeFromGeckoAccessible(outerDoc);
}
} else {
if (!aProxy->Document()->IsShutdown()) {
// Only do if the document has not been shut down, else parent will return
// garbage since we don't shut down children from top down.
ProxyAccessible* parent = aProxy->Parent();
// Invalidate proxy parent's children.
if (parent) {
nativeParent = GetNativeFromProxy(parent);
}
}
}
mozAccessible* wrapper = GetNativeFromProxy(aProxy);
[wrapper expire];
[wrapper release];
aProxy->SetWrapper(0);
if (nativeParent) {
[nativeParent invalidateChildren];
}
}
void
ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType)
{
// ignore everything but focus-changed, value-changed, caret and selection
// events for now.
if (aEventType != nsIAccessibleEvent::EVENT_FOCUS &&
aEventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
aEventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED)
return;
mozAccessible* wrapper = GetNativeFromProxy(aProxy);
if (wrapper)
FireNativeEvent(wrapper, aEventType);
}
void
ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool)
{
// mac doesn't care about state change events
}
void
ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
{
mozAccessible* wrapper = GetNativeFromProxy(aTarget);
if (wrapper)
[wrapper selectedTextDidChange];
}
void
ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
bool, bool)
{
}
void
ProxyShowHideEvent(ProxyAccessible*, ProxyAccessible*, bool, bool)
{
}
void
ProxySelectionEvent(ProxyAccessible*, ProxyAccessible*, uint32_t)
{
}
} // namespace a11y
} // namespace mozilla
@interface GeckoNSApplication(a11y)
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
@end
@implementation GeckoNSApplication(a11y)
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
{
if ([attribute isEqualToString:@"AXEnhancedUserInterface"])
mozilla::a11y::sA11yShouldBeEnabled = ([value intValue] == 1);
return [super accessibilitySetValue:value forAttribute:attribute];
}
@end
-34
View File
@@ -1,34 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
#ifndef mozilla_a11y_RootAccessibleWrap_h__
#define mozilla_a11y_RootAccessibleWrap_h__
#include "RootAccessible.h"
namespace mozilla {
namespace a11y {
class RootAccessibleWrap : public RootAccessible
{
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
Class GetNativeType ();
// let's our native accessible get in touch with the
// native cocoa view that is our accessible parent.
void GetNativeWidget (void **aOutView);
};
} // namespace a11y
} // namespace mozilla
#endif
-53
View File
@@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RootAccessibleWrap.h"
#include "mozDocAccessible.h"
#include "nsCOMPtr.h"
#include "nsObjCExceptions.h"
#include "nsIFrame.h"
#include "nsView.h"
#include "nsIWidget.h"
using namespace mozilla::a11y;
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}
RootAccessibleWrap::~RootAccessibleWrap()
{
}
Class
RootAccessibleWrap::GetNativeType()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
return [mozRootAccessible class];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
void
RootAccessibleWrap::GetNativeWidget(void** aOutView)
{
nsIFrame *frame = GetFrame();
if (frame) {
nsView *view = frame->GetView();
if (view) {
nsIWidget *widget = view->GetWidget();
if (widget) {
*aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET);
NS_ASSERTION (*aOutView,
"Couldn't get the native NSView parent we need to connect the accessibility hierarchy!");
}
}
}
}
-19
View File
@@ -1,19 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__
#define mozilla_a11y_TextLeafAccessibleWrap_h__
#include "TextLeafAccessible.h"
namespace mozilla {
namespace a11y {
typedef class TextLeafAccessible TextLeafAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-20
View File
@@ -1,20 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__
#define mozilla_a11y_XULListboxAccessibleWrap_h__
#include "XULListboxAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULListboxAccessible XULListboxAccessibleWrap;
typedef class XULListCellAccessible XULListCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-19
View File
@@ -1,19 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__
#define mozilla_a11y_XULMenuAccessibleWrap_h__
#include "XULMenuAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
@@ -1,20 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__
#define mozilla_a11y_XULTreeGridAccessibleWrap_h__
#include "XULTreeGridAccessible.h"
namespace mozilla {
namespace a11y {
typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap;
typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif
-44
View File
@@ -1,44 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
EXPORTS += [
'mozAccessibleProtocol.h',
]
EXPORTS.mozilla.a11y += [
'AccessibleWrap.h',
'HyperTextAccessibleWrap.h',
]
SOURCES += [
'AccessibleWrap.mm',
'DocAccessibleWrap.mm',
'MacUtils.mm',
'mozAccessible.mm',
'mozActionElements.mm',
'mozDocAccessible.mm',
'mozHTMLAccessible.mm',
'mozTableAccessible.mm',
'mozTextAccessible.mm',
'Platform.mm',
'RootAccessibleWrap.mm',
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/html',
'/accessible/ipc',
'/accessible/ipc/other',
'/accessible/xul',
'/layout/generic',
'/layout/xul',
'/widget',
'/widget/cocoa',
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')
-181
View File
@@ -1,181 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AccessibleWrap.h"
#include "ProxyAccessible.h"
#import <Cocoa/Cocoa.h>
#import "mozAccessibleProtocol.h"
@class mozRootAccessible;
/**
* All mozAccessibles are either abstract objects (that correspond to XUL
* widgets, HTML frames, etc) or are attached to a certain view; for example
* a document view. When we hand an object off to an AT, we always want
* to give it the represented view, in the latter case.
*/
namespace mozilla {
namespace a11y {
inline id <mozAccessible>
GetObjectOrRepresentedView(id <mozAccessible> aObject)
{
return [aObject hasRepresentedView] ? [aObject representedView] : aObject;
}
inline mozAccessible*
GetNativeFromGeckoAccessible(Accessible* aAccessible)
{
mozAccessible* native = nil;
aAccessible->GetNativeInterface((void**)&native);
return native;
}
inline mozAccessible*
GetNativeFromProxy(const ProxyAccessible* aProxy)
{
return reinterpret_cast<mozAccessible*>(aProxy->GetWrapper());
}
} // a11y
} // mozilla
// This is OR'd with the Accessible owner to indicate the wrap-ee is a proxy.
static const uintptr_t IS_PROXY = 1;
@interface mozAccessible : NSObject <mozAccessible>
{
/**
* Weak reference; it owns us.
*/
uintptr_t mGeckoAccessible;
/**
* Strong ref to array of children
*/
NSMutableArray* mChildren;
/**
* Weak reference to the parent
*/
mozAccessible* mParent;
/**
* The role of our gecko accessible.
*/
mozilla::a11y::role mRole;
}
// return the Accessible for this mozAccessible if it exists.
- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible;
// return the ProxyAccessible for this mozAccessible if it exists.
- (mozilla::a11y::ProxyAccessible*)getProxyAccessible;
// inits with the gecko owner.
- (id)initWithAccessible:(uintptr_t)aGeckoObj;
// our accessible parent (AXParent)
- (id <mozAccessible>)parent;
// a lazy cache of our accessible children (AXChildren). updated
- (NSArray*)children;
// returns the size of this accessible.
- (NSValue*)size;
// returns the position, in cocoa coordinates.
- (NSValue*)position;
// can be overridden to report another role name.
- (NSString*)role;
// a subrole is a more specialized variant of the role. for example,
// the role might be "textfield", while the subrole is "password textfield".
- (NSString*)subrole;
// Return the role description, as there are a few exceptions.
- (NSString*)roleDescription;
// returns the native window we're inside.
- (NSWindow*)window;
// the value of this element.
- (id)value;
// name that is associated with this accessible (for buttons, etc)
- (NSString*)title;
// the accessible description (help text) of this particular instance.
- (NSString*)help;
- (BOOL)isEnabled;
// information about focus.
- (BOOL)isFocused;
- (BOOL)canBeFocused;
// returns NO if for some reason we were unable to focus the element.
- (BOOL)focus;
// notifications sent out to listening accessible providers.
- (void)didReceiveFocus;
- (void)valueDidChange;
- (void)selectedTextDidChange;
- (void)documentLoadComplete;
// internal method to retrieve a child at a given index.
- (id)childAt:(uint32_t)i;
#pragma mark -
// invalidates and removes all our children from our cached array.
- (void)invalidateChildren;
/**
* Append a child if they are already cached.
*/
- (void)appendChild:(mozilla::a11y::Accessible*)aAccessible;
// makes ourselves "expired". after this point, we might be around if someone
// has retained us (e.g., a third-party), but we really contain no information.
- (void)expire;
- (BOOL)isExpired;
#ifdef DEBUG
- (void)printHierarchy;
- (void)printHierarchyWithLevel:(unsigned)numSpaces;
- (void)sanityCheckChildren;
- (void)sanityCheckChildren:(NSArray*)theChildren;
#endif
// ---- NSAccessibility methods ---- //
// whether to skip this element when traversing the accessibility
// hierarchy.
- (BOOL)accessibilityIsIgnored;
// called by third-parties to determine the deepest child element under the mouse
- (id)accessibilityHitTest:(NSPoint)point;
// returns the deepest unignored focused accessible element
- (id)accessibilityFocusedUIElement;
// a mozAccessible needs to at least provide links to its parent and
// children.
- (NSArray*)accessibilityAttributeNames;
// value for the specified attribute
- (id)accessibilityAttributeValue:(NSString*)attribute;
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;
- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
@end
File diff suppressed because it is too large. Load diff
-69
View File
@@ -1,69 +0,0 @@
/* -*- Mode: Objective-C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import <Cocoa/Cocoa.h>
#import "mozView.h"
/* This protocol's primary use is so widget/cocoa can talk back to us
properly.
ChildView owns the topmost mozRootAccessible, and needs to take care of setting up
that parent/child relationship.
This protocol is thus used to make sure it knows it's talking to us, and not
just some random |id|.
*/
@protocol mozAccessible
// returns whether this accessible is the root accessible. there is one
// root accessible per window.
- (BOOL)isRoot;
// some mozAccessibles implement accessibility support in place of another object. for example,
// ChildView gets its support from us.
//
// instead of returning a mozAccessible to the OS when it wants an object, we need to pass the view we represent, so the
// OS doesn't get confused and think we return some random object.
- (BOOL)hasRepresentedView;
- (id)representedView;
#ifdef DEBUG
// debug utility that will print the native accessibility tree, starting
// at this node.
- (void)printHierarchy;
#endif
/*** general ***/
// returns the accessible at the specified point.
- (id)accessibilityHitTest:(NSPoint)point;
// whether this element is flagged as ignored.
- (BOOL)accessibilityIsIgnored;
// currently focused UI element (possibly a child accessible)
- (id)accessibilityFocusedUIElement;
/*** attributes ***/
// all supported attributes
- (NSArray*)accessibilityAttributeNames;
// value for given attribute.
- (id)accessibilityAttributeValue:(NSString*)attribute;
// whether a particular attribute can be modified
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;
/*** actions ***/
- (NSArray*)accessibilityActionNames;
- (NSString*)accessibilityActionDescription:(NSString*)action;
- (void)accessibilityPerformAction:(NSString*)action;
@end
-37
View File
@@ -1,37 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import <Cocoa/Cocoa.h>
#import "mozAccessible.h"
/* Simple subclasses for things like checkboxes, buttons, etc. */
@interface mozButtonAccessible : mozAccessible
{
}
- (BOOL)hasPopup;
- (void)click;
- (BOOL)isTab;
@end
@interface mozCheckboxAccessible : mozButtonAccessible
// returns one of the constants defined in CheckboxValue
- (int)isChecked;
@end
/* Class for tabs - not individual tabs */
@interface mozTabsAccessible : mozAccessible
{
NSMutableArray* mTabs;
}
-(id)tabs;
@end
/**
* Accessible for a PANE
*/
@interface mozPaneAccessible : mozAccessible
@end
-340
View File
@@ -1,340 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "mozActionElements.h"
#import "MacUtils.h"
#include "Accessible-inl.h"
#include "DocAccessible.h"
#include "XULTabAccessible.h"
#include "nsDeckFrame.h"
#include "nsObjCExceptions.h"
using namespace mozilla::a11y;
enum CheckboxValue {
// these constants correspond to the values in the OS
kUnchecked = 0,
kChecked = 1,
kMixed = 2
};
@implementation mozButtonAccessible
- (NSArray*)accessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
static NSArray *attributes = nil;
if (!attributes) {
attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required
NSAccessibilityRoleAttribute, // required
NSAccessibilityRoleDescriptionAttribute,
NSAccessibilityPositionAttribute, // required
NSAccessibilitySizeAttribute, // required
NSAccessibilityWindowAttribute, // required
NSAccessibilityPositionAttribute, // required
NSAccessibilityTopLevelUIElementAttribute, // required
NSAccessibilityHelpAttribute,
NSAccessibilityEnabledAttribute, // required
NSAccessibilityFocusedAttribute, // required
NSAccessibilityTitleAttribute, // required
NSAccessibilityChildrenAttribute,
NSAccessibilityDescriptionAttribute,
#if DEBUG
@"AXMozDescription",
#endif
nil];
}
return attributes;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString *)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
if ([self hasPopup])
return [self children];
return nil;
}
if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
if ([self isTab])
return utils::LocalizedString(NS_LITERAL_STRING("tab"));
return NSAccessibilityRoleDescription([self role], nil);
}
return [super accessibilityAttributeValue:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (BOOL)accessibilityIsIgnored
{
return ![self getGeckoAccessible] && ![self getProxyAccessible];
}
- (NSArray*)accessibilityActionNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([self isEnabled]) {
if ([self hasPopup])
return [NSArray arrayWithObjects:NSAccessibilityPressAction,
NSAccessibilityShowMenuAction,
nil];
return [NSArray arrayWithObject:NSAccessibilityPressAction];
}
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (NSString*)accessibilityActionDescription:(NSString*)action
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([action isEqualToString:NSAccessibilityPressAction]) {
if ([self isTab])
return utils::LocalizedString(NS_LITERAL_STRING("switch"));
return @"press button"; // XXX: localize this later?
}
if ([self hasPopup]) {
if ([action isEqualToString:NSAccessibilityShowMenuAction])
return @"show menu";
}
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (void)accessibilityPerformAction:(NSString*)action
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if ([self isEnabled] && [action isEqualToString:NSAccessibilityPressAction]) {
// TODO: this should bring up the menu, but currently doesn't.
// once msaa and atk have merged better, they will implement
// the action needed to show the menu.
[self click];
}
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (void)click
{
// both buttons and checkboxes have only one action. we should really stop using arbitrary
// arrays with actions, and define constants for these actions.
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
accWrap->DoAction(0);
else if (ProxyAccessible* proxy = [self getProxyAccessible])
proxy->DoAction(0);
}
- (BOOL)isTab
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
return accWrap->Role() == roles::PAGETAB;
if (ProxyAccessible* proxy = [self getProxyAccessible])
return proxy->Role() == roles::PAGETAB;
return false;
}
- (BOOL)hasPopup
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
return accWrap->NativeState() & states::HASPOPUP;
if (ProxyAccessible* proxy = [self getProxyAccessible])
return proxy->NativeState() & states::HASPOPUP;
return false;
}
@end
@implementation mozCheckboxAccessible
- (NSString*)accessibilityActionDescription:(NSString*)action
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([action isEqualToString:NSAccessibilityPressAction]) {
if ([self isChecked] != kUnchecked)
return @"uncheck checkbox"; // XXX: localize this later?
return @"check checkbox"; // XXX: localize this later?
}
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (int)isChecked
{
uint64_t state = 0;
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
state = accWrap->NativeState();
else if (ProxyAccessible* proxy = [self getProxyAccessible])
state = proxy->NativeState();
// check if we're checked or in a mixed state
if (state & states::CHECKED) {
return (state & states::MIXED) ? kMixed : kChecked;
}
return kUnchecked;
}
- (id)value
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
return [NSNumber numberWithInt:[self isChecked]];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
@end
@implementation mozTabsAccessible
- (void)dealloc
{
[mTabs release];
[super dealloc];
}
- (NSArray*)accessibilityAttributeNames
{
// standard attributes that are shared and supported by root accessible (AXMain) elements.
static NSMutableArray* attributes = nil;
if (!attributes) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
[attributes addObject:NSAccessibilityContentsAttribute];
[attributes addObject:NSAccessibilityTabsAttribute];
}
return attributes;
}
- (id)accessibilityAttributeValue:(NSString *)attribute
{
if ([attribute isEqualToString:NSAccessibilityContentsAttribute])
return [super children];
if ([attribute isEqualToString:NSAccessibilityTabsAttribute])
return [self tabs];
return [super accessibilityAttributeValue:attribute];
}
/**
* Returns the selected tab (the mozAccessible)
*/
- (id)value
{
mozAccessible* nativeAcc = nil;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
if (Accessible* accTab = accWrap->GetSelectedItem(0)) {
accTab->GetNativeInterface((void**)&nativeAcc);
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
if (ProxyAccessible* proxyTab = proxy->GetSelectedItem(0)) {
nativeAcc = GetNativeFromProxy(proxyTab);
}
}
return nativeAcc;
}
/**
* Return the mozAccessibles that are the tabs.
*/
- (id)tabs
{
if (mTabs)
return mTabs;
NSArray* children = [self children];
NSEnumerator* enumerator = [children objectEnumerator];
mTabs = [[NSMutableArray alloc] init];
id obj;
while ((obj = [enumerator nextObject]))
if ([obj isTab])
[mTabs addObject:obj];
return mTabs;
}
- (void)invalidateChildren
{
[super invalidateChildren];
[mTabs release];
mTabs = nil;
}
@end
@implementation mozPaneAccessible
- (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
if (!accWrap && !proxy)
return 0;
// By default this calls -[[mozAccessible children] count].
// Since we don't cache mChildren. This is faster.
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
if (accWrap)
return accWrap->ChildCount() ? 1 : 0;
return proxy->ChildrenCount() ? 1 : 0;
}
return [super accessibilityArrayAttributeCount:attribute];
}
- (NSArray*)children
{
if (![self getGeckoAccessible])
return nil;
nsDeckFrame* deckFrame = do_QueryFrame([self getGeckoAccessible]->GetFrame());
nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr;
Accessible* selectedAcc = nullptr;
if (selectedFrame) {
nsINode* node = selectedFrame->GetContent();
selectedAcc = [self getGeckoAccessible]->Document()->GetAccessible(node);
}
if (selectedAcc) {
mozAccessible *curNative = GetNativeFromGeckoAccessible(selectedAcc);
if (curNative)
return [NSArray arrayWithObjects:GetObjectOrRepresentedView(curNative), nil];
}
return nil;
}
@end
-31
View File
@@ -1,31 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import <Cocoa/Cocoa.h>
#import "mozAccessible.h"
// our protocol that we implement (so cocoa widgets can talk to us)
#import "mozAccessibleProtocol.h"
/*
The root accessible. There is one per window.
Created by the RootAccessibleWrap.
*/
@interface mozRootAccessible : mozAccessible
{
// the mozView that we're representing.
// all outside communication goes through the mozView.
// in reality, it's just piping all calls to us, and we're
// doing its dirty work!
//
// whenever someone asks who we are (e.g., a child asking
// for its parent, or our parent asking for its child), we'll
// respond the mozView. it is absolutely necessary for third-
// party tools that we do this!
//
// /hwaara
id <mozView, mozAccessible> mParallelView; // weak ref
}
@end
-111
View File
@@ -1,111 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RootAccessibleWrap.h"
#import "mozDocAccessible.h"
#import "mozView.h"
// This must be included last:
#include "nsObjCExceptions.h"
using namespace mozilla::a11y;
static id <mozAccessible, mozView>
getNativeViewFromRootAccessible(Accessible* aAccessible)
{
RootAccessibleWrap* root =
static_cast<RootAccessibleWrap*>(aAccessible->AsRoot());
id <mozAccessible, mozView> nativeView = nil;
root->GetNativeWidget ((void**)&nativeView);
return nativeView;
}
#pragma mark -
@implementation mozRootAccessible
- (NSArray*)accessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
// if we're expired, we don't support any attributes.
if (![self getGeckoAccessible])
return [NSArray array];
// standard attributes that are shared and supported by root accessible (AXMain) elements.
static NSMutableArray* attributes = nil;
if (!attributes) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
[attributes addObject:NSAccessibilityMainAttribute];
[attributes addObject:NSAccessibilityMinimizedAttribute];
}
return attributes;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString *)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([attribute isEqualToString:NSAccessibilityMainAttribute])
return [NSNumber numberWithBool:[[self window] isMainWindow]];
if ([attribute isEqualToString:NSAccessibilityMinimizedAttribute])
return [NSNumber numberWithBool:[[self window] isMiniaturized]];
return [super accessibilityAttributeValue:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
// return the AXParent that our parallell NSView tells us about.
- (id)parent
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (!mParallelView)
mParallelView = (id<mozView, mozAccessible>)[self representedView];
if (mParallelView)
return [mParallelView accessibilityAttributeValue:NSAccessibilityParentAttribute];
NSAssert(mParallelView, @"we're a root accessible w/o native view?");
return [super parent];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (BOOL)hasRepresentedView
{
return YES;
}
// this will return our parallell NSView. see mozDocAccessible.h
- (id)representedView
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (mParallelView)
return (id)mParallelView;
mParallelView = getNativeViewFromRootAccessible ([self getGeckoAccessible]);
NSAssert(mParallelView, @"can't return root accessible's native parallel view.");
return mParallelView;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (BOOL)isRoot
{
return YES;
}
@end
-16
View File
@@ -1,16 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "mozAccessible.h"
@interface mozHeadingAccessible : mozAccessible
@end
@interface mozLinkAccessible : mozAccessible
@end
-141
View File
@@ -1,141 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "mozHTMLAccessible.h"
#import "Accessible-inl.h"
#import "HyperTextAccessible.h"
#import "nsCocoaUtils.h"
using namespace mozilla::a11y;
@implementation mozHeadingAccessible
- (NSString*)title
{
nsAutoString title;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
mozilla::ErrorResult rv;
// XXX use the flattening API when there are available
// see bug 768298
accWrap->GetContent()->GetTextContent(title, rv);
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
proxy->Title(title);
}
return nsCocoaUtils::ToNSString(title);
}
- (id)value
{
uint32_t level = 0;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
level = accWrap->GetLevelInternal();
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
level = proxy->GetLevelInternal();
}
return [NSNumber numberWithInt:level];
}
@end
@interface mozLinkAccessible ()
-(NSURL*)url;
@end
@implementation mozLinkAccessible
- (NSArray*)accessibilityAttributeNames
{
// if we're expired, we don't support any attributes.
if (![self getGeckoAccessible] && ![self getProxyAccessible])
return [NSArray array];
static NSMutableArray* attributes = nil;
if (!attributes) {
attributes = [[super accessibilityAttributeNames] mutableCopy];
[attributes addObject:NSAccessibilityURLAttribute];
}
return attributes;
}
- (id)accessibilityAttributeValue:(NSString *)attribute
{
if ([attribute isEqualToString:NSAccessibilityURLAttribute])
return [self url];
return [super accessibilityAttributeValue:attribute];
}
- (NSArray*)accessibilityActionNames
{
// if we're expired, we don't support any attributes.
if (![self getGeckoAccessible] && ![self getProxyAccessible])
return [NSArray array];
static NSArray* actionNames = nil;
if (!actionNames) {
actionNames = [[NSArray alloc] initWithObjects:NSAccessibilityPressAction,
nil];
}
return actionNames;
}
- (void)accessibilityPerformAction:(NSString*)action
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
if (!accWrap && !proxy) {
return;
}
if ([action isEqualToString:NSAccessibilityPressAction]) {
if (accWrap) {
accWrap->DoAction(0);
} else if (proxy) {
proxy->DoAction(0);
}
return;
}
[super accessibilityPerformAction:action];
}
- (NSString*)customDescription
{
return @"";
}
- (NSString*)value
{
return @"";
}
- (NSURL*)url
{
nsAutoString value;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
accWrap->Value(value);
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
proxy->Value(value);
}
NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value);
if (!urlString)
return nil;
return [NSURL URLWithString:urlString];
}
@end
-28
View File
@@ -1,28 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "mozAccessible.h"
@interface mozTablePartAccessible : mozAccessible
- (BOOL)isLayoutTablePart;
- (NSString*)role;
@end
@interface mozTableAccessible : mozTablePartAccessible
- (NSArray*)additionalAccessibilityAttributeNames;
- (id)accessibilityAttributeValue:(NSString*)attribute;
@end
@interface mozTableRowAccessible : mozTablePartAccessible
- (NSArray*)additionalAccessibilityAttributeNames;
- (id)accessibilityAttributeValue:(NSString*)attribute;
@end
@interface mozTableCellAccessible : mozTablePartAccessible
- (NSArray*)additionalAccessibilityAttributeNames;
- (id)accessibilityAttributeValue:(NSString*)attribute;
@end
-281
View File
@@ -1,281 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#import "Accessible-inl.h"
#import "mozTableAccessible.h"
#import "TableAccessible.h"
#import "TableCellAccessible.h"
#import "nsCocoaUtils.h"
using namespace mozilla::a11y;
// convert an array of Gecko accessibles to an NSArray of native accessibles
static inline NSMutableArray*
ConvertToNSArray(nsTArray<Accessible*>& aArray)
{
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
// iterate through the list, and get each native accessible.
size_t totalCount = aArray.Length();
for (size_t i = 0; i < totalCount; i++) {
Accessible* curAccessible = aArray.ElementAt(i);
mozAccessible* curNative = GetNativeFromGeckoAccessible(curAccessible);
if (curNative)
[nativeArray addObject:GetObjectOrRepresentedView(curNative)];
}
return nativeArray;
}
// convert an array of Gecko proxy accessibles to an NSArray of native accessibles
static inline NSMutableArray*
ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
{
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
// iterate through the list, and get each native accessible.
size_t totalCount = aArray.Length();
for (size_t i = 0; i < totalCount; i++) {
ProxyAccessible* curAccessible = aArray.ElementAt(i);
mozAccessible* curNative = GetNativeFromProxy(curAccessible);
if (curNative)
[nativeArray addObject:GetObjectOrRepresentedView(curNative)];
}
return nativeArray;
}
@implementation mozTablePartAccessible
- (BOOL)isLayoutTablePart;
{
if (Accessible* accWrap = [self getGeckoAccessible]) {
while (accWrap) {
if (accWrap->IsTable()) {
return accWrap->AsTable()->IsProbablyLayoutTable();
}
accWrap = accWrap->Parent();
}
return false;
}
if (ProxyAccessible* proxy = [self getProxyAccessible]) {
while (proxy) {
if (proxy->IsTable()) {
return proxy->TableIsProbablyForLayout();
}
proxy = proxy->Parent();
}
}
return false;
}
- (NSString*)role
{
return [self isLayoutTablePart] ? NSAccessibilityGroupRole : [super role];
}
@end
@implementation mozTableAccessible
- (NSArray*)additionalAccessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
if ([self isLayoutTablePart]) {
return additionalAttributes;
}
static NSArray* tableAttrs = nil;
if (!tableAttrs) {
NSMutableArray* tempArray = [NSMutableArray new];
[tempArray addObject:NSAccessibilityRowCountAttribute];
[tempArray addObject:NSAccessibilityColumnCountAttribute];
[tempArray addObject:NSAccessibilityRowsAttribute];
tableAttrs = [[NSArray alloc] initWithArray:tempArray];
[tempArray release];
}
return [additionalAttributes arrayByAddingObjectsFromArray:tableAttrs];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
TableAccessible* table = accWrap->AsTable();
if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
return @(table->RowCount());
if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
return @(table->ColCount());
if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
// Create a new array with the list of table rows.
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
uint32_t totalCount = accWrap->ChildCount();
for (uint32_t i = 0; i < totalCount; i++) {
if (accWrap->GetChildAt(i)->IsTableRow()) {
mozAccessible* curNative =
GetNativeFromGeckoAccessible(accWrap->GetChildAt(i));
if (curNative)
[nativeArray addObject:GetObjectOrRepresentedView(curNative)];
}
}
return nativeArray;
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
return @(proxy->TableRowCount());
if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
return @(proxy->TableColumnCount());
if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
// Create a new array with the list of table rows.
NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
uint32_t totalCount = proxy->ChildrenCount();
for (uint32_t i = 0; i < totalCount; i++) {
if (proxy->ChildAt(i)->IsTableRow()) {
mozAccessible* curNative =
GetNativeFromProxy(proxy->ChildAt(i));
if (curNative)
[nativeArray addObject:GetObjectOrRepresentedView(curNative)];
}
}
return nativeArray;
}
}
return [super accessibilityAttributeValue:attribute];
}
@end
@implementation mozTableRowAccessible
- (NSArray*)additionalAccessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
if ([self isLayoutTablePart]) {
return additionalAttributes;
}
static NSArray* tableRowAttrs = nil;
if (!tableRowAttrs) {
NSMutableArray* tempArray = [NSMutableArray new];
[tempArray addObject:NSAccessibilityIndexAttribute];
tableRowAttrs = [[NSArray alloc] initWithArray:tempArray];
[tempArray release];
}
return [additionalAttributes arrayByAddingObjectsFromArray:tableRowAttrs];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) {
// Count the number of rows before that one to obtain the row index.
uint32_t index = 0;
Accessible* parent = accWrap->Parent();
if (parent) {
for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) {
if (parent->GetChildAt(i)->IsTableRow()) {
index++;
}
}
}
return [NSNumber numberWithUnsignedInteger:index];
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) {
// Count the number of rows before that one to obtain the row index.
uint32_t index = 0;
ProxyAccessible* parent = proxy->Parent();
if (parent) {
for (int32_t i = proxy->IndexInParent() - 1; i >= 0; i--) {
if (parent->ChildAt(i)->IsTableRow()) {
index++;
}
}
}
return [NSNumber numberWithUnsignedInteger:index];
}
}
return [super accessibilityAttributeValue:attribute];
}
@end
@implementation mozTableCellAccessible
- (NSArray*)additionalAccessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
if ([self isLayoutTablePart]) {
return additionalAttributes;
}
static NSArray* tableCellAttrs = nil;
if (!tableCellAttrs) {
NSMutableArray* tempArray = [NSMutableArray new];
[tempArray addObject:NSAccessibilityRowIndexRangeAttribute];
[tempArray addObject:NSAccessibilityColumnIndexRangeAttribute];
[tempArray addObject:NSAccessibilityRowHeaderUIElementsAttribute];
[tempArray addObject:NSAccessibilityColumnHeaderUIElementsAttribute];
tableCellAttrs = [[NSArray alloc] initWithArray:tempArray];
[tempArray release];
}
return [additionalAttributes arrayByAddingObjectsFromArray:tableCellAttrs];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
TableCellAccessible* cell = accWrap->AsTableCell();
if ([attribute isEqualToString:NSAccessibilityRowIndexRangeAttribute])
return [NSValue valueWithRange:NSMakeRange(cell->RowIdx(),
cell->RowExtent())];
if ([attribute isEqualToString:NSAccessibilityColumnIndexRangeAttribute])
return [NSValue valueWithRange:NSMakeRange(cell->ColIdx(),
cell->ColExtent())];
if ([attribute isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) {
AutoTArray<Accessible*, 10> headerCells;
cell->RowHeaderCells(&headerCells);
return ConvertToNSArray(headerCells);
}
if ([attribute isEqualToString:NSAccessibilityColumnHeaderUIElementsAttribute]) {
AutoTArray<Accessible*, 10> headerCells;
cell->ColHeaderCells(&headerCells);
return ConvertToNSArray(headerCells);
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
if ([attribute isEqualToString:NSAccessibilityRowIndexRangeAttribute])
return [NSValue valueWithRange:NSMakeRange(proxy->RowIdx(),
proxy->RowExtent())];
if ([attribute isEqualToString:NSAccessibilityColumnIndexRangeAttribute])
return [NSValue valueWithRange:NSMakeRange(proxy->ColIdx(),
proxy->ColExtent())];
if ([attribute isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) {
nsTArray<ProxyAccessible*> headerCells;
proxy->RowHeaderCells(&headerCells);
return ConvertToNSArray(headerCells);
}
if ([attribute isEqualToString:NSAccessibilityColumnHeaderUIElementsAttribute]) {
nsTArray<ProxyAccessible*> headerCells;
proxy->ColHeaderCells(&headerCells);
return ConvertToNSArray(headerCells);
}
}
return [super accessibilityAttributeValue:attribute];
}
@end
-627
View File
@@ -1,627 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Accessible-inl.h"
#include "HyperTextAccessible-inl.h"
#include "TextLeafAccessible.h"
#include "nsCocoaUtils.h"
#include "nsObjCExceptions.h"
#import "mozTextAccessible.h"
using namespace mozilla;
using namespace mozilla::a11y;
inline bool
ToNSRange(id aValue, NSRange* aRange)
{
NS_PRECONDITION(aRange, "aRange is nil");
if ([aValue isKindOfClass:[NSValue class]] &&
strcmp([(NSValue*)aValue objCType], @encode(NSRange)) == 0) {
*aRange = [aValue rangeValue];
return true;
}
return false;
}
inline NSString*
ToNSString(id aValue)
{
if ([aValue isKindOfClass:[NSString class]]) {
return aValue;
}
return nil;
}
@interface mozTextAccessible ()
- (NSString*)subrole;
- (NSString*)selectedText;
- (NSValue*)selectedTextRange;
- (NSValue*)visibleCharacterRange;
- (long)textLength;
- (BOOL)isReadOnly;
- (NSNumber*)caretLineNumber;
- (void)setText:(NSString*)newText;
- (NSString*)text;
- (NSString*)stringFromRange:(NSRange*)range;
@end
@implementation mozTextAccessible
- (BOOL)accessibilityIsIgnored
{
return ![self getGeckoAccessible] && ![self getProxyAccessible];
}
- (NSArray*)accessibilityAttributeNames
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
static NSMutableArray* supportedAttributes = nil;
if (!supportedAttributes) {
// text-specific attributes to supplement the standard one
supportedAttributes = [[NSMutableArray alloc] initWithObjects:
NSAccessibilitySelectedTextAttribute, // required
NSAccessibilitySelectedTextRangeAttribute, // required
NSAccessibilityNumberOfCharactersAttribute, // required
NSAccessibilityVisibleCharacterRangeAttribute, // required
NSAccessibilityInsertionPointLineNumberAttribute,
@"AXRequired",
@"AXInvalid",
nil
];
[supportedAttributes addObjectsFromArray:[super accessibilityAttributeNames]];
}
return supportedAttributes;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if ([attribute isEqualToString:NSAccessibilityNumberOfCharactersAttribute])
return [NSNumber numberWithInt:[self textLength]];
if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute])
return [self caretLineNumber];
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute])
return [self selectedTextRange];
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute])
return [self selectedText];
if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
return @"";
if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
// Apple's SpeechSynthesisServer expects AXValue to return an AXStaticText
// object's AXSelectedText attribute. See bug 674612 for details.
// Also if there is no selected text, we return the full text.
// See bug 369710 for details.
if ([[self role] isEqualToString:NSAccessibilityStaticTextRole]) {
NSString* selectedText = [self selectedText];
return (selectedText && [selectedText length]) ? selectedText : [self text];
}
return [self text];
}
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
if ([attribute isEqualToString:@"AXRequired"]) {
return [NSNumber numberWithBool:!!(accWrap->State() & states::REQUIRED)];
}
if ([attribute isEqualToString:@"AXInvalid"]) {
return [NSNumber numberWithBool:!!(accWrap->State() & states::INVALID)];
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
if ([attribute isEqualToString:@"AXRequired"]) {
return [NSNumber numberWithBool:!!(proxy->State() & states::REQUIRED)];
}
if ([attribute isEqualToString:@"AXInvalid"]) {
return [NSNumber numberWithBool:!!(proxy->State() & states::INVALID)];
}
}
if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute])
return [self visibleCharacterRange];
// let mozAccessible handle all other attributes
return [super accessibilityAttributeValue:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (NSArray*)accessibilityParameterizedAttributeNames
{
static NSArray* supportedParametrizedAttributes = nil;
// text specific parametrized attributes
if (!supportedParametrizedAttributes) {
supportedParametrizedAttributes = [[NSArray alloc] initWithObjects:
NSAccessibilityStringForRangeParameterizedAttribute,
NSAccessibilityLineForIndexParameterizedAttribute,
NSAccessibilityRangeForLineParameterizedAttribute,
NSAccessibilityAttributedStringForRangeParameterizedAttribute,
NSAccessibilityBoundsForRangeParameterizedAttribute,
#if DEBUG
NSAccessibilityRangeForPositionParameterizedAttribute,
NSAccessibilityRangeForIndexParameterizedAttribute,
NSAccessibilityRTFForRangeParameterizedAttribute,
NSAccessibilityStyleRangeForIndexParameterizedAttribute,
#endif
nil
];
}
return supportedParametrizedAttributes;
}
- (id)accessibilityAttributeValue:(NSString*)attribute forParameter:(id)parameter
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return nil;
if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) {
NSRange range;
if (!ToNSRange(parameter, &range)) {
#if DEBUG
NSLog(@"%@: range not set", attribute);
#endif
return @"";
}
return [self stringFromRange:&range];
}
if ([attribute isEqualToString:NSAccessibilityRangeForLineParameterizedAttribute]) {
// XXX: actually get the integer value for the line #
return [NSValue valueWithRange:NSMakeRange(0, [self textLength])];
}
if ([attribute isEqualToString:NSAccessibilityAttributedStringForRangeParameterizedAttribute]) {
NSRange range;
if (!ToNSRange(parameter, &range)) {
#if DEBUG
NSLog(@"%@: range not set", attribute);
#endif
return @"";
}
return [[[NSAttributedString alloc] initWithString:[self stringFromRange:&range]] autorelease];
}
if ([attribute isEqualToString:NSAccessibilityLineForIndexParameterizedAttribute]) {
// XXX: actually return the line #
return [NSNumber numberWithInt:0];
}
if ([attribute isEqualToString:NSAccessibilityBoundsForRangeParameterizedAttribute]) {
NSRange range;
if (!ToNSRange(parameter, &range)) {
#if DEBUG
NSLog(@"%@:no range", attribute);
#endif
return nil;
}
int32_t start = range.location;
int32_t end = start + range.length;
DesktopIntRect bounds;
if (textAcc) {
bounds =
DesktopIntRect::FromUnknownRect(textAcc->TextBounds(start, end));
} else if (proxy) {
bounds =
DesktopIntRect::FromUnknownRect(proxy->TextBounds(start, end));
}
return [NSValue valueWithRect:nsCocoaUtils::GeckoRectToCocoaRect(bounds)];
}
#if DEBUG
NSLog(@"unhandled attribute:%@ forParameter:%@", attribute, parameter);
#endif
return nil;
}
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
return ![self isReadOnly];
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] ||
[attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] ||
[attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute])
return YES;
return [super accessibilityIsAttributeSettable:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
}
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return;
if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
[self setText:ToNSString(value)];
return;
}
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]) {
NSString* stringValue = ToNSString(value);
if (!stringValue)
return;
int32_t start = 0, end = 0;
nsString text;
if (textAcc) {
textAcc->SelectionBoundsAt(0, &start, &end);
textAcc->DeleteText(start, end - start);
nsCocoaUtils::GetStringForNSString(stringValue, text);
textAcc->InsertText(text, start);
} else if (proxy) {
nsString data;
proxy->SelectionBoundsAt(0, data, &start, &end);
proxy->DeleteText(start, end - start);
nsCocoaUtils::GetStringForNSString(stringValue, text);
proxy->InsertText(text, start);
}
}
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
NSRange range;
if (!ToNSRange(value, &range))
return;
if (textAcc) {
textAcc->SetSelectionBoundsAt(0, range.location,
range.location + range.length);
} else if (proxy) {
proxy->SetSelectionBoundsAt(0, range.location,
range.location + range.length);
}
return;
}
if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) {
NSRange range;
if (!ToNSRange(value, &range))
return;
if (textAcc) {
textAcc->ScrollSubstringTo(range.location, range.location + range.length,
nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE);
} else if (proxy) {
proxy->ScrollSubstringTo(range.location, range.location + range.length,
nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE);
}
return;
}
[super accessibilitySetValue:value forAttribute:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (NSString*)subrole
{
if(mRole == roles::PASSWORD_TEXT)
return NSAccessibilitySecureTextFieldSubrole;
return nil;
}
#pragma mark -
- (BOOL)isReadOnly
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
if ([[self role] isEqualToString:NSAccessibilityStaticTextRole])
return YES;
AccessibleWrap* accWrap = [self getGeckoAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (textAcc)
return (accWrap->State() & states::READONLY) == 0;
if (ProxyAccessible* proxy = [self getProxyAccessible])
return (proxy->State() & states::READONLY) == 0;
return NO;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
}
- (NSNumber*)caretLineNumber
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
int32_t lineNumber = -1;
if (textAcc) {
lineNumber = textAcc->CaretLineNumber() - 1;
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
lineNumber = proxy->CaretLineNumber() - 1;
}
return (lineNumber >= 0) ? [NSNumber numberWithInt:lineNumber] : nil;
}
- (void)setText:(NSString*)aNewString
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
AccessibleWrap* accWrap = [self getGeckoAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
nsString text;
nsCocoaUtils::GetStringForNSString(aNewString, text);
if (textAcc) {
textAcc->ReplaceText(text);
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
proxy->ReplaceText(text);
}
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (NSString*)text
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return nil;
// A password text field returns an empty value
if (mRole == roles::PASSWORD_TEXT)
return @"";
nsAutoString text;
if (textAcc) {
textAcc->TextSubstring(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
} else if (proxy) {
proxy->TextSubstring(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
}
return nsCocoaUtils::ToNSString(text);
}
- (long)textLength
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return 0;
return textAcc ? textAcc->CharacterCount() : proxy->CharacterCount();
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
}
- (long)selectedTextLength
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return 0;
int32_t start = 0, end = 0;
if (textAcc) {
textAcc->SelectionBoundsAt(0, &start, &end);
} else if (proxy) {
nsString data;
proxy->SelectionBoundsAt(0, data, &start, &end);
}
return (end - start);
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
}
- (NSString*)selectedText
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return nil;
int32_t start = 0, end = 0;
nsAutoString selText;
if (textAcc) {
textAcc->SelectionBoundsAt(0, &start, &end);
if (start != end) {
textAcc->TextSubstring(start, end, selText);
}
} else if (proxy) {
proxy->SelectionBoundsAt(0, selText, &start, &end);
}
return nsCocoaUtils::ToNSString(selText);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (NSValue*)selectedTextRange
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
int32_t start = 0;
int32_t end = 0;
int32_t count = 0;
if (textAcc) {
count = textAcc->SelectionCount();
if (count) {
textAcc->SelectionBoundsAt(0, &start, &end);
return [NSValue valueWithRange:NSMakeRange(start, end - start)];
}
start = textAcc->CaretOffset();
return [NSValue valueWithRange:NSMakeRange(start != -1 ? start : 0, 0)];
}
if (proxy) {
count = proxy->SelectionCount();
if (count) {
nsString data;
proxy->SelectionBoundsAt(0, data, &start, &end);
return [NSValue valueWithRange:NSMakeRange(start, end - start)];
}
start = proxy->CaretOffset();
return [NSValue valueWithRange:NSMakeRange(start != -1 ? start : 0, 0)];
}
return [NSValue valueWithRange:NSMakeRange(0, 0)];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
}
- (NSValue*)visibleCharacterRange
{
// XXX this won't work with Textarea and such as we actually don't give
// the visible character range.
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return 0;
return [NSValue valueWithRange:
NSMakeRange(0, textAcc ?
textAcc->CharacterCount() : proxy->CharacterCount())];
}
- (void)valueDidChange
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
NSAccessibilityValueChangedNotification);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (void)selectedTextDidChange
{
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
NSAccessibilitySelectedTextChangedNotification);
}
- (NSString*)stringFromRange:(NSRange*)range
{
NS_PRECONDITION(range, "no range");
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
if (!textAcc && !proxy)
return nil;
nsAutoString text;
if (textAcc) {
textAcc->TextSubstring(range->location,
range->location + range->length, text);
} else if (proxy) {
proxy->TextSubstring(range->location,
range->location + range->length, text);
}
return nsCocoaUtils::ToNSString(text);
}
@end
@implementation mozTextLeafAccessible
- (NSArray*)accessibilityAttributeNames
{
static NSMutableArray* supportedAttributes = nil;
if (!supportedAttributes) {
supportedAttributes = [[super accessibilityAttributeNames] mutableCopy];
[supportedAttributes removeObject:NSAccessibilityChildrenAttribute];
}
return supportedAttributes;
}
- (id)accessibilityAttributeValue:(NSString*)attribute
{
if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
return @"";
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
return [self text];
return [super accessibilityAttributeValue:attribute];
}
- (NSString*)text
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
return nsCocoaUtils::ToNSString(accWrap->AsTextLeaf()->Text());
}
if (ProxyAccessible* proxy = [self getProxyAccessible]) {
nsString text;
proxy->Text(&text);
return nsCocoaUtils::ToNSString(text);
}
return nil;
}
- (long)textLength
{
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
return accWrap->AsTextLeaf()->Text().Length();
}
if (ProxyAccessible* proxy = [self getProxyAccessible]) {
nsString text;
proxy->Text(&text);
return text.Length();
}
return 0;
}
@end
+4 -4
View File
@@ -9,8 +9,6 @@ if 'gtk' in toolkit:
DIRS += ['atk']
elif toolkit == 'windows':
DIRS += ['windows']
elif toolkit == 'cocoa':
DIRS += ['mac']
else:
DIRS += ['other']
@@ -21,10 +19,12 @@ DIRS += [ 'aom',
'interfaces',
'ipc',
'jsat',
'xpcom',
'xul'
'xpcom'
]
if CONFIG['MOZ_XUL']:
DIRS += ['xul']
TEST_DIRS += ['tests/mochitest']
BROWSER_CHROME_MANIFESTS += [
+13
View File
@@ -35,6 +35,19 @@ a11y::PlatformInit()
nsWinUtils::MaybeStartWindowEmulation();
ia2AccessibleText::InitTextChangeData();
if (BrowserTabsRemoteAutostart()) {
mscom::InterceptorLog::Init();
UniquePtr<RegisteredProxy> regProxy(
mscom::RegisterProxy(L"ia2marshal.dll"));
gRegProxy = regProxy.release();
UniquePtr<RegisteredProxy> regAccTlb(
mscom::RegisterTypelib(L"oleacc.dll",
RegistrationFlags::eUseSystemDirectory));
gRegAccTlb = regAccTlb.release();
UniquePtr<RegisteredProxy> regMiscTlb(
mscom::RegisterTypelib(L"Accessible.tlb"));
gRegMiscTlb = regMiscTlb.release();
}
}
void
+7 -3
View File
@@ -33,11 +33,15 @@ SOURCES += [
'RootAccessibleWrap.cpp',
'ServiceProvider.cpp',
'TextLeafAccessibleWrap.cpp',
'XULListboxAccessibleWrap.cpp',
'XULMenuAccessibleWrap.cpp',
'XULTreeGridAccessibleWrap.cpp',
]
if CONFIG['MOZ_XUL']:
SOURCES += [
'XULListboxAccessibleWrap.cpp',
'XULMenuAccessibleWrap.cpp',
'XULTreeGridAccessibleWrap.cpp',
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
-4
View File
@@ -42,10 +42,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
-4
View File
@@ -37,10 +37,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
@@ -0,0 +1,54 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors;
/**
* Object holding annotation data. Used by GeneratableElementIterator.
*/
public class AnnotationInfo {
public enum ExceptionMode {
ABORT,
NSRESULT,
IGNORE;
String nativeValue() {
return "mozilla::jni::ExceptionMode::" + name();
}
}
public enum CallingThread {
GECKO,
UI,
ANY;
String nativeValue() {
return "mozilla::jni::CallingThread::" + name();
}
}
public enum DispatchTarget {
GECKO,
PROXY,
CURRENT;
String nativeValue() {
return "mozilla::jni::DispatchTarget::" + name();
}
}
public final String wrapperName;
public final ExceptionMode exceptionMode;
public final CallingThread callingThread;
public final DispatchTarget dispatchTarget;
public AnnotationInfo(String wrapperName, ExceptionMode exceptionMode,
CallingThread callingThread, DispatchTarget dispatchTarget) {
this.wrapperName = wrapperName;
this.exceptionMode = exceptionMode;
this.callingThread = callingThread;
this.dispatchTarget = dispatchTarget;
}
}
@@ -0,0 +1,175 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors;
import org.mozilla.gecko.annotationProcessors.classloader.AnnotatableEntity;
import org.mozilla.gecko.annotationProcessors.classloader.ClassWithOptions;
import org.mozilla.gecko.annotationProcessors.classloader.IterableJarLoadingURLClassLoader;
import org.mozilla.gecko.annotationProcessors.utils.GeneratableElementIterator;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
public class AnnotationProcessor {
public static final String GENERATED_COMMENT =
"// GENERATED CODE\n" +
"// Generated by the Java program at /build/annotationProcessors at compile time\n" +
"// from annotations on Java methods. To update, change the annotations on the\n" +
"// corresponding Java methods and rerun the build. Manually updating this file\n" +
"// will cause your build to fail.\n" +
"\n";
private static final StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
private static final StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
private static final StringBuilder nativesFile = new StringBuilder(GENERATED_COMMENT);
public static void main(String[] args) {
// We expect a list of jars on the commandline. If missing, whinge about it.
if (args.length <= 2) {
System.err.println("Usage: java AnnotationProcessor outprefix jarfiles ...");
System.exit(1);
}
final String OUTPUT_PREFIX = args[0];
final String SOURCE_FILE = OUTPUT_PREFIX + "JNIWrappers.cpp";
final String HEADER_FILE = OUTPUT_PREFIX + "JNIWrappers.h";
final String NATIVES_FILE = OUTPUT_PREFIX + "JNINatives.h";
System.out.println("Processing annotations...");
// We want to produce the same output as last time as often as possible. Ordering of
// generated statements, therefore, needs to be consistent.
final String[] jars = Arrays.copyOfRange(args, 1, args.length);
Arrays.sort(jars);
// Start the clock!
long s = System.currentTimeMillis();
// Get an iterator over the classes in the jar files given...
Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(jars);
headerFile.append(
"#ifndef " + getHeaderGuardName(HEADER_FILE) + "\n" +
"#define " + getHeaderGuardName(HEADER_FILE) + "\n" +
"\n" +
"#include \"mozilla/jni/Refs.h\"\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
implementationFile.append(
"#include \"" + HEADER_FILE + "\"\n" +
"#include \"mozilla/jni/Accessors.h\"\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
nativesFile.append(
"#ifndef " + getHeaderGuardName(NATIVES_FILE) + "\n" +
"#define " + getHeaderGuardName(NATIVES_FILE) + "\n" +
"\n" +
"#include \"" + HEADER_FILE + "\"\n" +
"#include \"mozilla/jni/Natives.h\"\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"\n");
while (jarClassIterator.hasNext()) {
generateClass(jarClassIterator.next());
}
implementationFile.append(
"} /* java */\n" +
"} /* mozilla */\n");
headerFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(HEADER_FILE) + "\n");
nativesFile.append(
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif // " + getHeaderGuardName(NATIVES_FILE) + "\n");
writeOutputFile(SOURCE_FILE, implementationFile);
writeOutputFile(HEADER_FILE, headerFile);
writeOutputFile(NATIVES_FILE, nativesFile);
long e = System.currentTimeMillis();
System.out.println("Annotation processing complete in " + (e - s) + "ms");
}
private static void generateClass(final ClassWithOptions annotatedClass) {
// Get an iterator over the appropriately generated methods of this class
final GeneratableElementIterator methodIterator
= new GeneratableElementIterator(annotatedClass);
final ClassWithOptions[] innerClasses = methodIterator.getInnerClasses();
if (!methodIterator.hasNext() && innerClasses.length == 0) {
return;
}
final CodeGenerator generatorInstance = new CodeGenerator(annotatedClass);
generatorInstance.generateClasses(innerClasses);
// Iterate all annotated members in this class..
while (methodIterator.hasNext()) {
AnnotatableEntity aElementTuple = methodIterator.next();
switch (aElementTuple.mEntityType) {
case METHOD:
generatorInstance.generateMethod(aElementTuple);
break;
case NATIVE:
generatorInstance.generateNative(aElementTuple);
break;
case FIELD:
generatorInstance.generateField(aElementTuple);
break;
case CONSTRUCTOR:
generatorInstance.generateConstructor(aElementTuple);
break;
}
}
headerFile.append(generatorInstance.getHeaderFileContents());
implementationFile.append(generatorInstance.getWrapperFileContents());
nativesFile.append(generatorInstance.getNativesFileContents());
for (ClassWithOptions innerClass : innerClasses) {
generateClass(innerClass);
}
}
private static String getHeaderGuardName(final String name) {
return name.replaceAll("\\W", "_");
}
private static void writeOutputFile(final String name,
final StringBuilder content) {
FileOutputStream outStream = null;
try {
outStream = new FileOutputStream(name);
outStream.write(content.toString().getBytes());
} catch (IOException e) {
System.err.println("Unable to write " + name + ". Perhaps a permissions issue?");
e.printStackTrace(System.err);
} finally {
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
System.err.println("Unable to close outStream due to "+e);
e.printStackTrace(System.err);
}
}
}
}
}
@@ -0,0 +1,627 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors;
import org.mozilla.gecko.annotationProcessors.classloader.AnnotatableEntity;
import org.mozilla.gecko.annotationProcessors.classloader.ClassWithOptions;
import org.mozilla.gecko.annotationProcessors.utils.Utils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashSet;
public class CodeGenerator {
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
// Buffers holding the strings to ultimately be written to the output files.
private final StringBuilder cpp = new StringBuilder();
private final StringBuilder header = new StringBuilder();
private final StringBuilder natives = new StringBuilder();
private final StringBuilder nativesInits = new StringBuilder();
private final Class<?> cls;
private final String clsName;
private AnnotationInfo.CallingThread callingThread = null;
private int numNativesInits;
private final HashSet<String> takenMethodNames = new HashSet<String>();
public CodeGenerator(ClassWithOptions annotatedClass) {
this.cls = annotatedClass.wrappedClass;
this.clsName = annotatedClass.generatedName;
final String unqualifiedName = Utils.getUnqualifiedName(clsName);
header.append(
"class " + clsName + " : public mozilla::jni::ObjectBase<" +
unqualifiedName + ">\n" +
"{\n" +
"public:\n" +
" static const char name[];\n" +
"\n" +
" explicit " + unqualifiedName + "(const Context& ctx) : ObjectBase<" +
unqualifiedName + ">(ctx) {}\n" +
"\n");
cpp.append(
"const char " + clsName + "::name[] =\n" +
" \"" + cls.getName().replace('.', '/') + "\";\n" +
"\n");
natives.append(
"template<class Impl>\n" +
"class " + clsName + "::Natives : " +
"public mozilla::jni::NativeImpl<" + unqualifiedName + ", Impl>\n" +
"{\n" +
"public:\n");
}
private String getTraitsName(String uniqueName, boolean includeScope) {
return (includeScope ? clsName + "::" : "") + uniqueName + "_t";
}
/**
* Return the C++ type name for this class or any class within the chain
* of declaring classes, if the target class matches the given type.
*
* Return null if the given type does not match any class searched.
*/
private String getMatchingClassType(final Class<?> type) {
Class<?> cls = this.cls;
String clsName = this.clsName;
while (cls != null) {
if (type.equals(cls)) {
return clsName;
}
cls = cls.getDeclaringClass();
clsName = clsName.substring(0, Math.max(0, clsName.lastIndexOf("::")));
}
return null;
}
private String getNativeParameterType(Class<?> type, AnnotationInfo info) {
final String clsName = getMatchingClassType(type);
if (clsName != null) {
return Utils.getUnqualifiedName(clsName) + "::Param";
}
return Utils.getNativeParameterType(type, info);
}
private String getNativeReturnType(Class<?> type, AnnotationInfo info) {
final String clsName = getMatchingClassType(type);
if (clsName != null) {
return Utils.getUnqualifiedName(clsName) + "::LocalRef";
}
return Utils.getNativeReturnType(type, info);
}
private void generateMember(AnnotationInfo info, Member member,
String uniqueName, Class<?> type, Class<?>[] argTypes) {
final StringBuilder args = new StringBuilder();
for (Class<?> argType : argTypes) {
args.append("\n " + getNativeParameterType(argType, info) + ",");
}
if (args.length() > 0) {
args.setLength(args.length() - 1);
}
header.append(
" struct " + getTraitsName(uniqueName, /* includeScope */ false) + " {\n" +
" typedef " + Utils.getUnqualifiedName(clsName) + " Owner;\n" +
" typedef " + getNativeReturnType(type, info) + " ReturnType;\n" +
" typedef " + getNativeParameterType(type, info) + " SetterType;\n" +
" typedef mozilla::jni::Args<" + args + "> Args;\n" +
" static constexpr char name[] = \"" +
Utils.getMemberName(member) + "\";\n" +
" static constexpr char signature[] =\n" +
" \"" + Utils.getSignature(member) + "\";\n" +
" static const bool isStatic = " + Utils.isStatic(member) + ";\n" +
" static const mozilla::jni::ExceptionMode exceptionMode =\n" +
" " + info.exceptionMode.nativeValue() + ";\n" +
" static const mozilla::jni::CallingThread callingThread =\n" +
" " + info.callingThread.nativeValue() + ";\n" +
" static const mozilla::jni::DispatchTarget dispatchTarget =\n" +
" " + info.dispatchTarget.nativeValue() + ";\n" +
" };\n" +
"\n");
cpp.append(
"constexpr char " + getTraitsName(uniqueName, /* includeScope */ true) +
"::name[];\n" +
"constexpr char " + getTraitsName(uniqueName, /* includeScope */ true) +
"::signature[];\n" +
"\n");
if (this.callingThread == null) {
this.callingThread = info.callingThread;
} else if (this.callingThread != info.callingThread) {
// We have a mix of calling threads, so specify "any" for the whole class.
this.callingThread = AnnotationInfo.CallingThread.ANY;
}
}
private String getUniqueMethodName(String basename) {
String newName = basename;
int index = 1;
while (takenMethodNames.contains(newName)) {
newName = basename + (++index);
}
takenMethodNames.add(newName);
return newName;
}
/**
* Generate a method prototype that includes return and argument types,
* without specifiers (static, const, etc.).
*/
private String generatePrototype(String name, Class<?>[] argTypes,
Class<?> returnType, AnnotationInfo info,
boolean includeScope, boolean includeArgName,
boolean isConst) {
final StringBuilder proto = new StringBuilder();
int argIndex = 0;
proto.append("auto ");
if (includeScope) {
proto.append(clsName).append("::");
}
proto.append(name).append('(');
for (Class<?> argType : argTypes) {
proto.append(getNativeParameterType(argType, info));
if (includeArgName) {
proto.append(" a").append(argIndex++);
}
proto.append(", ");
}
if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT &&
!returnType.equals(void.class)) {
proto.append(getNativeReturnType(returnType, info)).append('*');
if (includeArgName) {
proto.append(" a").append(argIndex++);
}
proto.append(", ");
}
if (proto.substring(proto.length() - 2).equals(", ")) {
proto.setLength(proto.length() - 2);
}
proto.append(')');
if (isConst) {
proto.append(" const");
}
if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT) {
proto.append(" -> nsresult");
} else {
proto.append(" -> ").append(getNativeReturnType(returnType, info));
}
return proto.toString();
}
/**
* Generate a method declaration that includes the prototype with specifiers,
* but without the method body.
*/
private String generateDeclaration(String name, Class<?>[] argTypes,
Class<?> returnType, AnnotationInfo info,
boolean isStatic) {
return (isStatic ? "static " : "") +
generatePrototype(name, argTypes, returnType, info,
/* includeScope */ false, /* includeArgName */ false,
/* isConst */ !isStatic) + ';';
}
/**
* Generate a method definition that includes the prototype with specifiers,
* and with the method body.
*/
private String generateDefinition(String accessorName, String name, Class<?>[] argTypes,
Class<?> returnType, AnnotationInfo info, boolean isStatic) {
final StringBuilder def = new StringBuilder(
generatePrototype(name, argTypes, returnType, info,
/* includeScope */ true, /* includeArgName */ true,
/* isConst */ !isStatic));
def.append("\n{\n");
// Generate code to handle the return value, if needed.
// We initialize rv to NS_OK instead of NS_ERROR_* because loading NS_OK (0) uses
// fewer instructions. We are guaranteed to set rv to the correct value later.
if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT &&
returnType.equals(void.class)) {
def.append(
" nsresult rv = NS_OK;\n" +
" ");
} else if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT) {
// Non-void return type
final String resultArg = "a" + argTypes.length;
def.append(
" MOZ_ASSERT(" + resultArg + ");\n" +
" nsresult rv = NS_OK;\n" +
" *" + resultArg + " = ");
} else {
def.append(
" return ");
}
// Generate a call, e.g., Method<Traits>::Call(a0, a1, a2);
def.append(accessorName).append("(")
.append(Utils.getUnqualifiedName(clsName) +
(isStatic ? "::Context()" : "::mCtx"));
if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT) {
def.append(", &rv");
} else {
def.append(", nullptr");
}
// Generate the call argument list.
for (int argIndex = 0; argIndex < argTypes.length; argIndex++) {
def.append(", a").append(argIndex);
}
def.append(");\n");
if (info.exceptionMode == AnnotationInfo.ExceptionMode.NSRESULT) {
def.append(" return rv;\n");
}
return def.append("}").toString();
}
/**
* Append the appropriate generated code to the buffers for the method provided.
*
* @param annotatedMethod The Java method, plus annotation data.
*/
public void generateMethod(AnnotatableEntity annotatedMethod) {
// Unpack the tuple and extract some useful fields from the Method..
final Method method = annotatedMethod.getMethod();
final AnnotationInfo info = annotatedMethod.mAnnotationInfo;
final String uniqueName = getUniqueMethodName(info.wrapperName);
final Class<?>[] argTypes = method.getParameterTypes();
final Class<?> returnType = method.getReturnType();
if (method.isSynthetic()) {
return;
}
// Sanity check
if (info.dispatchTarget != AnnotationInfo.DispatchTarget.CURRENT) {
throw new IllegalStateException("Invalid dispatch target \"" +
info.dispatchTarget.name().toLowerCase() +
"\" for non-native method " + clsName + "::" + uniqueName);
}
generateMember(info, method, uniqueName, returnType, argTypes);
final boolean isStatic = Utils.isStatic(method);
header.append(
" " + generateDeclaration(info.wrapperName, argTypes,
returnType, info, isStatic) + "\n" +
"\n");
cpp.append(
generateDefinition(
"mozilla::jni::Method<" +
getTraitsName(uniqueName, /* includeScope */ false) + ">::Call",
info.wrapperName, argTypes, returnType, info, isStatic) + "\n" +
"\n");
}
/**
* Append the appropriate generated code to the buffers for the native method provided.
*
* @param annotatedMethod The Java native method, plus annotation data.
*/
public void generateNative(AnnotatableEntity annotatedMethod) {
// Unpack the tuple and extract some useful fields from the Method..
final Method method = annotatedMethod.getMethod();
final AnnotationInfo info = annotatedMethod.mAnnotationInfo;
final String uniqueName = getUniqueMethodName(info.wrapperName);
final Class<?>[] argTypes = method.getParameterTypes();
final Class<?> returnType = method.getReturnType();
// Sanity check
if (info.exceptionMode != AnnotationInfo.ExceptionMode.ABORT &&
info.exceptionMode != AnnotationInfo.ExceptionMode.IGNORE) {
throw new IllegalStateException("Invalid exception mode \"" +
info.exceptionMode.name().toLowerCase() +
"\" for native method " + clsName + "::" + uniqueName);
}
if (info.dispatchTarget != AnnotationInfo.DispatchTarget.CURRENT &&
returnType != void.class) {
throw new IllegalStateException(
"Must return void when not dispatching to current thread for native method " +
clsName + "::" + uniqueName);
}
generateMember(info, method, uniqueName, returnType, argTypes);
final String traits = getTraitsName(uniqueName, /* includeScope */ true);
if (nativesInits.length() > 0) {
nativesInits.append(',');
}
nativesInits.append(
"\n" +
"\n" +
" mozilla::jni::MakeNativeMethod<" + traits + ">(\n" +
" mozilla::jni::NativeStub<" + traits + ", Impl>\n" +
" ::template Wrap<&Impl::" + info.wrapperName + ">)");
numNativesInits++;
}
private String getLiteral(Object val, AnnotationInfo info) {
final Class<?> type = val.getClass();
if (type.equals(char.class) || type.equals(Character.class)) {
final char c = (char) val;
if (c >= 0x20 && c < 0x7F) {
return "'" + c + '\'';
}
return "u'\\u" + Integer.toHexString(0x10000 | (int) c).substring(1) + '\'';
} else if (type.equals(CharSequence.class) || type.equals(String.class)) {
final CharSequence str = (CharSequence) val;
final StringBuilder out = new StringBuilder("u\"");
for (int i = 0; i < str.length(); i++) {
final char c = str.charAt(i);
if (c >= 0x20 && c < 0x7F) {
out.append(c);
} else {
out.append("\\u").append(Integer.toHexString(0x10000 | (int) c).substring(1));
}
}
return out.append('"').toString();
}
return String.valueOf(val);
}
public void generateField(AnnotatableEntity annotatedField) {
final Field field = annotatedField.getField();
final AnnotationInfo info = annotatedField.mAnnotationInfo;
final String uniqueName = info.wrapperName;
final Class<?> type = field.getType();
// Handles a peculiar case when dealing with enum types. We don't care about this field.
// It just gets in the way and stops our code from compiling.
if (field.isSynthetic() || field.getName().equals("$VALUES")) {
return;
}
// Sanity check
if (info.dispatchTarget != AnnotationInfo.DispatchTarget.CURRENT) {
throw new IllegalStateException("Invalid dispatch target \"" +
info.dispatchTarget.name().toLowerCase() +
"\" for field " + clsName + "::" + uniqueName);
}
final boolean isStatic = Utils.isStatic(field);
final boolean isFinal = Utils.isFinal(field);
if (isStatic && isFinal && (type.isPrimitive() || type.equals(String.class))) {
Object val = null;
try {
field.setAccessible(true);
val = field.get(null);
} catch (final IllegalAccessException e) {
}
if (val != null && type.isPrimitive()) {
// For static final primitive fields, we can use a "static const" declaration.
header.append(
" static const " + Utils.getNativeReturnType(type, info) +
' ' + info.wrapperName + " = " + getLiteral(val, info) + ";\n" +
"\n");
return;
} else if (val != null && type.equals(String.class)) {
final String nativeType = "char16_t";
header.append(
" static const " + nativeType + ' ' + info.wrapperName + "[];\n" +
"\n");
cpp.append(
"const " + nativeType + ' ' + clsName + "::" + info.wrapperName +
"[] = " + getLiteral(val, info) + ";\n" +
"\n");
return;
}
// Fall back to using accessors if we encounter an exception.
}
generateMember(info, field, uniqueName, type, EMPTY_CLASS_ARRAY);
final Class<?>[] getterArgs = EMPTY_CLASS_ARRAY;
header.append(
" " + generateDeclaration(info.wrapperName, getterArgs,
type, info, isStatic) + "\n" +
"\n");
cpp.append(
generateDefinition(
"mozilla::jni::Field<" +
getTraitsName(uniqueName, /* includeScope */ false) + ">::Get",
info.wrapperName, getterArgs, type, info, isStatic) + "\n" +
"\n");
if (isFinal) {
return;
}
final Class<?>[] setterArgs = new Class<?>[] { type };
header.append(
" " + generateDeclaration(info.wrapperName, setterArgs,
void.class, info, isStatic) + "\n" +
"\n");
cpp.append(
generateDefinition(
"mozilla::jni::Field<" +
getTraitsName(uniqueName, /* includeScope */ false) + ">::Set",
info.wrapperName, setterArgs, void.class, info, isStatic) + "\n" +
"\n");
}
public void generateConstructor(AnnotatableEntity annotatedConstructor) {
// Unpack the tuple and extract some useful fields from the Method..
final Constructor<?> method = annotatedConstructor.getConstructor();
final AnnotationInfo info = annotatedConstructor.mAnnotationInfo;
final String wrapperName = "New";
final String uniqueName = getUniqueMethodName(wrapperName);
final Class<?>[] argTypes = method.getParameterTypes();
final Class<?> returnType = cls;
if (method.isSynthetic()) {
return;
}
// Sanity check
if (info.dispatchTarget != AnnotationInfo.DispatchTarget.CURRENT) {
throw new IllegalStateException("Invalid dispatch target \"" +
info.dispatchTarget.name().toLowerCase() +
"\" for constructor " + clsName + "::" + uniqueName);
}
generateMember(info, method, uniqueName, returnType, argTypes);
header.append(
" " + generateDeclaration(wrapperName, argTypes,
returnType, info, /* isStatic */ true) + "\n" +
"\n");
cpp.append(
generateDefinition(
"mozilla::jni::Constructor<" +
getTraitsName(uniqueName, /* includeScope */ false) + ">::Call",
wrapperName, argTypes, returnType, info, /* isStatic */ true) + "\n" +
"\n");
}
public void generateMembers(Member[] members) {
for (Member m : members) {
if (!Modifier.isPublic(m.getModifiers())) {
continue;
}
String name = Utils.getMemberName(m);
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// Default for SDK bindings.
final AnnotationInfo info = new AnnotationInfo(name,
AnnotationInfo.ExceptionMode.NSRESULT,
AnnotationInfo.CallingThread.ANY,
AnnotationInfo.DispatchTarget.CURRENT);
final AnnotatableEntity entity = new AnnotatableEntity(m, info);
if (m instanceof Constructor) {
generateConstructor(entity);
} else if (m instanceof Method) {
generateMethod(entity);
} else if (m instanceof Field) {
generateField(entity);
} else {
throw new IllegalArgumentException(
"expected member to be Constructor, Method, or Field");
}
}
}
public void generateClasses(final ClassWithOptions[] classes) {
if (classes.length == 0) {
return;
}
for (final ClassWithOptions cls : classes) {
// Extract "Inner" from "Outer::Inner".
header.append(
" class " + Utils.getUnqualifiedName(cls.generatedName) + ";\n");
}
header.append('\n');
}
/**
* Get the finalised bytes to go into the generated wrappers file.
*
* @return The bytes to be written to the wrappers file.
*/
public String getWrapperFileContents() {
return cpp.toString();
}
/**
* Get the finalised bytes to go into the generated header file.
*
* @return The bytes to be written to the header file.
*/
public String getHeaderFileContents() {
if (this.callingThread == null) {
this.callingThread = AnnotationInfo.CallingThread.ANY;
}
header.append(
" static const mozilla::jni::CallingThread callingThread =\n" +
" " + this.callingThread.nativeValue() + ";\n" +
"\n");
if (nativesInits.length() > 0) {
header.append(
" template<class Impl> class Natives;\n");
}
header.append(
"};\n" +
"\n");
return header.toString();
}
/**
* Get the finalised bytes to go into the generated natives header file.
*
* @return The bytes to be written to the header file.
*/
public String getNativesFileContents() {
if (nativesInits.length() == 0) {
return "";
}
natives.append(
" static const JNINativeMethod methods[" + numNativesInits + "];\n" +
"};\n" +
"\n" +
"template<class Impl>\n" +
"const JNINativeMethod " + clsName + "::Natives<Impl>::methods[] = {" + nativesInits + '\n' +
"};\n" +
"\n");
return natives.toString();
}
}
@@ -1,13 +1,10 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
TEST_DIRS += ['tests/gtest']
include $(topsrcdir)/config/rules.mk
SOURCES += [
'nsOSXSystemProxySettings.mm',
'ProxyUtils.mm',
]
# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk
FINAL_LIBRARY = 'xul'
export:: annotationProcessors.jar
@@ -0,0 +1,258 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors;
import com.android.tools.lint.checks.ApiLookup;
import com.android.tools.lint.LintCliClient;
import org.mozilla.gecko.annotationProcessors.classloader.AnnotatableEntity;
import org.mozilla.gecko.annotationProcessors.classloader.ClassWithOptions;
import org.mozilla.gecko.annotationProcessors.classloader.IterableJarLoadingURLClassLoader;
import org.mozilla.gecko.annotationProcessors.utils.GeneratableElementIterator;
import org.mozilla.gecko.annotationProcessors.utils.Utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Properties;
import java.util.Scanner;
import java.util.Vector;
import java.net.URL;
import java.net.URLClassLoader;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
public class SDKProcessor {
public static final String GENERATED_COMMENT =
"// GENERATED CODE\n" +
"// Generated by the Java program at /build/annotationProcessors at compile time\n" +
"// from annotations on Java methods. To update, change the annotations on the\n" +
"// corresponding Javamethods and rerun the build. Manually updating this file\n" +
"// will cause your build to fail.\n" +
"\n";
private static ApiLookup sApiLookup;
private static int sMaxSdkVersion;
public static void main(String[] args) throws Exception {
// We expect a list of jars on the commandline. If missing, whinge about it.
if (args.length < 5) {
System.err.println("Usage: java SDKProcessor sdkjar classlistfile outdir fileprefix max-sdk-version");
System.exit(1);
}
System.out.println("Processing platform bindings...");
String sdkJar = args[0];
Vector classes = getClassList(args[1]);
String outdir = args[2];
String generatedFilePrefix = args[3];
sMaxSdkVersion = Integer.parseInt(args[4]);
LintCliClient lintClient = new LintCliClient();
sApiLookup = ApiLookup.get(lintClient);
// Start the clock!
long s = System.currentTimeMillis();
// Get an iterator over the classes in the jar files given...
// Iterator<ClassWithOptions> jarClassIterator = IterableJarLoadingURLClassLoader.getIteratorOverJars(args);
StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
headerFile.append(
"#ifndef " + generatedFilePrefix + "_h__\n" +
"#define " + generatedFilePrefix + "_h__\n" +
"\n" +
"#include \"mozilla/jni/Refs.h\"\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"namespace sdk {\n" +
"\n");
StringBuilder implementationFile = new StringBuilder(GENERATED_COMMENT);
implementationFile.append(
"#include \"" + generatedFilePrefix + ".h\"\n" +
"#include \"mozilla/jni/Accessors.h\"\n" +
"\n" +
"namespace mozilla {\n" +
"namespace java {\n" +
"namespace sdk {\n" +
"\n");
// Used to track the calls to the various class-specific initialisation functions.
ClassLoader loader = null;
try {
loader = URLClassLoader.newInstance(new URL[] { new URL("file://" + sdkJar) },
SDKProcessor.class.getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e.toString());
}
for (Iterator<String> i = classes.iterator(); i.hasNext(); ) {
String className = i.next();
System.out.println("Looking up: " + className);
generateClass(Class.forName(className, true, loader),
implementationFile,
headerFile);
}
implementationFile.append(
"} /* sdk */\n" +
"} /* java */\n" +
"} /* mozilla */\n");
headerFile.append(
"} /* sdk */\n" +
"} /* java */\n" +
"} /* mozilla */\n" +
"#endif\n");
writeOutputFiles(outdir, generatedFilePrefix, headerFile, implementationFile);
long e = System.currentTimeMillis();
System.out.println("SDK processing complete in " + (e - s) + "ms");
}
private static int getAPIVersion(Class<?> cls, Member m) {
if (m instanceof Method || m instanceof Constructor) {
return sApiLookup.getCallVersion(
cls.getName().replace('.', '/'),
Utils.getMemberName(m),
Utils.getSignature(m));
} else if (m instanceof Field) {
return sApiLookup.getFieldVersion(
Utils.getClassDescriptor(m.getDeclaringClass()), m.getName());
} else {
throw new IllegalArgumentException("expected member to be Method, Constructor, or Field");
}
}
private static Member[] sortAndFilterMembers(Class<?> cls, Member[] members) {
Arrays.sort(members, new Comparator<Member>() {
@Override
public int compare(Member a, Member b) {
return a.getName().compareTo(b.getName());
}
});
ArrayList<Member> list = new ArrayList<>();
for (Member m : members) {
// Sometimes (e.g. Bundle) has methods that moved to/from a superclass in a later SDK
// version, so we check for both classes and see if we can find a minimum SDK version.
int version = getAPIVersion(cls, m);
final int version2 = getAPIVersion(m.getDeclaringClass(), m);
if (version2 > 0 && version2 < version) {
version = version2;
}
if (version > sMaxSdkVersion) {
System.out.println("Skipping " + m.getDeclaringClass().getName() + "." + m.getName() +
", version " + version + " > " + sMaxSdkVersion);
continue;
}
// Sometimes (e.g. KeyEvent) a field can appear in both a class and a superclass. In
// that case we want to filter out the version that appears in the superclass, or
// we'll have bindings with duplicate names.
try {
if (m instanceof Field && !m.equals(cls.getField(m.getName()))) {
// m is a field in a superclass that has been hidden by
// a field with the same name in a subclass.
System.out.println("Skipping " + m.getName() +
" from " + m.getDeclaringClass());
continue;
}
} catch (final NoSuchFieldException e) {
}
list.add(m);
}
return list.toArray(new Member[list.size()]);
}
private static void generateClass(Class<?> clazz,
StringBuilder implementationFile,
StringBuilder headerFile) {
String generatedName = clazz.getSimpleName();
CodeGenerator generator = new CodeGenerator(new ClassWithOptions(clazz, generatedName));
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getConstructors()));
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getMethods()));
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getFields()));
headerFile.append(generator.getHeaderFileContents());
implementationFile.append(generator.getWrapperFileContents());
}
private static Vector<String> getClassList(String path) {
Scanner scanner = null;
try {
scanner = new Scanner(new FileInputStream(path));
Vector lines = new Vector();
while (scanner.hasNextLine()) {
lines.add(scanner.nextLine());
}
return lines;
} catch (Exception e) {
System.out.println(e.toString());
return null;
} finally {
if (scanner != null) {
scanner.close();
}
}
}
private static void writeOutputFiles(String aOutputDir, String aPrefix, StringBuilder aHeaderFile,
StringBuilder aImplementationFile) {
FileOutputStream implStream = null;
try {
implStream = new FileOutputStream(new File(aOutputDir, aPrefix + ".cpp"));
implStream.write(aImplementationFile.toString().getBytes());
} catch (IOException e) {
System.err.println("Unable to write " + aOutputDir + ". Perhaps a permissions issue?");
e.printStackTrace(System.err);
} finally {
if (implStream != null) {
try {
implStream.close();
} catch (IOException e) {
System.err.println("Unable to close implStream due to "+e);
e.printStackTrace(System.err);
}
}
}
FileOutputStream headerStream = null;
try {
headerStream = new FileOutputStream(new File(aOutputDir, aPrefix + ".h"));
headerStream.write(aHeaderFile.toString().getBytes());
} catch (IOException e) {
System.err.println("Unable to write " + aOutputDir + ". Perhaps a permissions issue?");
e.printStackTrace(System.err);
} finally {
if (headerStream != null) {
try {
headerStream.close();
} catch (IOException e) {
System.err.println("Unable to close headerStream due to "+e);
e.printStackTrace(System.err);
}
}
}
}
}
@@ -0,0 +1,62 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.classloader;
import org.mozilla.gecko.annotationProcessors.AnnotationInfo;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/**
* Union type to hold either a method, field, or ctor. Allows us to iterate "The generatable stuff", despite
* the fact that such things can be of either flavour.
*/
public class AnnotatableEntity {
public enum ENTITY_TYPE {METHOD, NATIVE, FIELD, CONSTRUCTOR}
private final Member mMember;
public final ENTITY_TYPE mEntityType;
public final AnnotationInfo mAnnotationInfo;
public AnnotatableEntity(Member aObject, AnnotationInfo aAnnotationInfo) {
mMember = aObject;
mAnnotationInfo = aAnnotationInfo;
if (aObject instanceof Method) {
if (Modifier.isNative(aObject.getModifiers())) {
mEntityType = ENTITY_TYPE.NATIVE;
} else {
mEntityType = ENTITY_TYPE.METHOD;
}
} else if (aObject instanceof Field) {
mEntityType = ENTITY_TYPE.FIELD;
} else {
mEntityType = ENTITY_TYPE.CONSTRUCTOR;
}
}
public Method getMethod() {
if (mEntityType != ENTITY_TYPE.METHOD && mEntityType != ENTITY_TYPE.NATIVE) {
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
}
return (Method) mMember;
}
public Field getField() {
if (mEntityType != ENTITY_TYPE.FIELD) {
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
}
return (Field) mMember;
}
public Constructor<?> getConstructor() {
if (mEntityType != ENTITY_TYPE.CONSTRUCTOR) {
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
}
return (Constructor<?>) mMember;
}
}
@@ -0,0 +1,15 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.classloader;
public class ClassWithOptions {
public final Class<?> wrappedClass;
public final String generatedName;
public ClassWithOptions(Class<?> someClass, String name) {
wrappedClass = someClass;
generatedName = name;
}
}
@@ -0,0 +1,75 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.classloader;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
* A classloader which can be initialised with a list of jar files and which can provide an iterator
* over the top level classes in the jar files it was initialised with.
* classNames is kept sorted to ensure iteration order is consistent across program invocations.
* Otherwise, we'd forever be reporting the outdatedness of the generated code as we permute its
* contents.
*/
public class IterableJarLoadingURLClassLoader extends URLClassLoader {
LinkedList<String> classNames = new LinkedList<String>();
/**
* Create an instance and return its iterator. Provides an iterator over the classes in the jar
* files provided as arguments.
* Inner classes are not supported.
*
* @param args A list of jar file names an iterator over the classes of which is desired.
* @return An iterator over the top level classes in the jar files provided, in arbitrary order.
*/
public static Iterator<ClassWithOptions> getIteratorOverJars(String[] args) {
URL[] urlArray = new URL[args.length];
LinkedList<String> aClassNames = new LinkedList<String>();
for (int i = 0; i < args.length; i++) {
try {
urlArray[i] = (new File(args[i])).toURI().toURL();
Enumeration<JarEntry> entries = new JarFile(args[i]).entries();
while (entries.hasMoreElements()) {
JarEntry e = entries.nextElement();
String fName = e.getName();
if (!fName.endsWith(".class")) {
continue;
}
final String className = fName.substring(0, fName.length() - 6).replace('/', '.');
aClassNames.add(className);
}
} catch (IOException e) {
System.err.println("Error loading jar file \"" + args[i] + '"');
e.printStackTrace(System.err);
}
}
Collections.sort(aClassNames);
return new JarClassIterator(new IterableJarLoadingURLClassLoader(urlArray, aClassNames));
}
/**
* Constructs a classloader capable of loading all classes given as URLs in urls. Used by static
* method above.
*
* @param urls URLs for all classes the new instance shall be capable of loading.
* @param aClassNames A list of names of the classes this instance shall be capable of loading.
*/
protected IterableJarLoadingURLClassLoader(URL[] urls, LinkedList<String> aClassNames) {// Array to populate with URLs for each class in the given jars.
super(urls);
classNames = aClassNames;
}
}
@@ -0,0 +1,84 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.classloader;
import java.util.Iterator;
/**
* Class for iterating over an IterableJarLoadingURLClassLoader's classes.
*
* This class is not thread safe: use it only from a single thread.
*/
public class JarClassIterator implements Iterator<ClassWithOptions> {
private IterableJarLoadingURLClassLoader mTarget;
private Iterator<String> mTargetClassListIterator;
private ClassWithOptions lookAhead;
public JarClassIterator(IterableJarLoadingURLClassLoader aTarget) {
mTarget = aTarget;
mTargetClassListIterator = aTarget.classNames.iterator();
}
@Override
public boolean hasNext() {
return fillLookAheadIfPossible();
}
@Override
public ClassWithOptions next() {
if (!fillLookAheadIfPossible()) {
throw new IllegalStateException("Failed to look ahead in next()!");
}
ClassWithOptions next = lookAhead;
lookAhead = null;
return next;
}
private boolean fillLookAheadIfPossible() {
if (lookAhead != null) {
return true;
}
if (!mTargetClassListIterator.hasNext()) {
return false;
}
String className = mTargetClassListIterator.next();
try {
Class<?> ret = mTarget.loadClass(className);
// Incremental builds can leave stale classfiles in the jar. Such classfiles will cause
// an exception at this point. We can safely ignore these classes - they cannot possibly
// ever be loaded as they conflict with their parent class and will be killed by
// Proguard later on anyway.
final Class<?> enclosingClass;
try {
enclosingClass = ret.getEnclosingClass();
} catch (IncompatibleClassChangeError e) {
return fillLookAheadIfPossible();
}
if (enclosingClass != null) {
// Anonymous inner class - unsupported.
// Or named inner class, which will be processed when we process the outer class.
return fillLookAheadIfPossible();
}
lookAhead = new ClassWithOptions(ret, ret.getSimpleName());
return true;
} catch (ClassNotFoundException e) {
System.err.println("Unable to enumerate class: " + className + ". Corrupted jar file?");
e.printStackTrace();
System.exit(2);
}
return false;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Removal of classes from iterator not supported.");
}
}
+23
View File
@@ -0,0 +1,23 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
jar = add_java_jar('annotationProcessors')
jar.sources += [
'AnnotationInfo.java',
'AnnotationProcessor.java',
'classloader/AnnotatableEntity.java',
'classloader/ClassWithOptions.java',
'classloader/IterableJarLoadingURLClassLoader.java',
'classloader/JarClassIterator.java',
'CodeGenerator.java',
'SDKProcessor.java',
'utils/AlphabeticAnnotatableEntityComparator.java',
'utils/GeneratableElementIterator.java',
'utils/Utils.java',
]
jar.extra_jars += [
CONFIG['ANDROID_TOOLS'] + '/lib/lint.jar',
CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks.jar',
]
@@ -0,0 +1,81 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.utils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.Comparator;
public class AlphabeticAnnotatableEntityComparator<T extends Member> implements Comparator<T> {
@Override
public int compare(T aLhs, T aRhs) {
// Constructors, Methods, Fields.
boolean lIsConstructor = aLhs instanceof Constructor;
boolean rIsConstructor = aRhs instanceof Constructor;
boolean lIsMethod = aLhs instanceof Method;
boolean rIsField = aRhs instanceof Field;
if (lIsConstructor) {
if (!rIsConstructor) {
return -1;
}
} else if (lIsMethod) {
if (rIsConstructor) {
return 1;
} else if (rIsField) {
return -1;
}
} else {
if (!rIsField) {
return 1;
}
}
// Verify these objects are the same type and cast them.
if (aLhs instanceof Method) {
return compare((Method) aLhs, (Method) aRhs);
} else if (aLhs instanceof Field) {
return compare((Field) aLhs, (Field) aRhs);
} else {
return compare((Constructor) aLhs, (Constructor) aRhs);
}
}
// Alas, the type system fails us.
private static int compare(Method aLhs, Method aRhs) {
// Initially, attempt to differentiate the methods be name alone..
String lName = aLhs.getName();
String rName = aRhs.getName();
int ret = lName.compareTo(rName);
if (ret != 0) {
return ret;
}
// The names were the same, so we need to compare signatures to find their uniqueness..
lName = Utils.getSignature(aLhs);
rName = Utils.getSignature(aRhs);
return lName.compareTo(rName);
}
private static int compare(Constructor<?> aLhs, Constructor<?> aRhs) {
// The names will be the same, so we need to compare signatures to find their uniqueness..
String lName = Utils.getSignature(aLhs);
String rName = Utils.getSignature(aRhs);
return lName.compareTo(rName);
}
private static int compare(Field aLhs, Field aRhs) {
// Compare field names..
String lName = aLhs.getName();
String rName = aRhs.getName();
return lName.compareTo(rName);
}
}
@@ -0,0 +1,267 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.utils;
import org.mozilla.gecko.annotationProcessors.AnnotationInfo;
import org.mozilla.gecko.annotationProcessors.classloader.AnnotatableEntity;
import org.mozilla.gecko.annotationProcessors.classloader.ClassWithOptions;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
/**
* Iterator over the methods in a given method list which have the WrappedJNIMethod
* annotation. Returns an object containing both the annotation (Which may contain interesting
* parameters) and the argument.
*/
public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
private final ClassWithOptions mClass;
private final Member[] mObjects;
private AnnotatableEntity mNextReturnValue;
private int mElementIndex;
private AnnotationInfo mClassInfo;
private boolean mIterateEveryEntry;
private boolean mSkipCurrentEntry;
public GeneratableElementIterator(ClassWithOptions annotatedClass) {
mClass = annotatedClass;
final Class<?> aClass = annotatedClass.wrappedClass;
// Get all the elements of this class as AccessibleObjects.
Member[] aMethods = aClass.getDeclaredMethods();
Member[] aFields = aClass.getDeclaredFields();
Member[] aCtors = aClass.getDeclaredConstructors();
// Shove them all into one buffer.
Member[] objs = new Member[aMethods.length + aFields.length + aCtors.length];
int offset = 0;
System.arraycopy(aMethods, 0, objs, 0, aMethods.length);
offset += aMethods.length;
System.arraycopy(aFields, 0, objs, offset, aFields.length);
offset += aFields.length;
System.arraycopy(aCtors, 0, objs, offset, aCtors.length);
// Sort the elements to ensure determinism.
Arrays.sort(objs, new AlphabeticAnnotatableEntityComparator<Member>());
mObjects = objs;
// Check for "Wrap ALL the things" flag.
for (Annotation annotation : aClass.getDeclaredAnnotations()) {
mClassInfo = buildAnnotationInfo(aClass, annotation);
if (mClassInfo != null) {
mIterateEveryEntry = true;
break;
}
}
if (mSkipCurrentEntry) {
throw new IllegalArgumentException("Cannot skip entire class");
}
findNextValue();
}
private Class<?>[] getFilteredInnerClasses() {
// Go through all inner classes and see which ones we want to generate.
final Class<?>[] candidates = mClass.wrappedClass.getDeclaredClasses();
int count = 0;
for (int i = 0; i < candidates.length; ++i) {
final GeneratableElementIterator testIterator
= new GeneratableElementIterator(new ClassWithOptions(candidates[i], null));
if (testIterator.hasNext()
|| testIterator.getFilteredInnerClasses() != null) {
count++;
continue;
}
// Clear out ones that don't match.
candidates[i] = null;
}
return count > 0 ? candidates : null;
}
public ClassWithOptions[] getInnerClasses() {
final Class<?>[] candidates = getFilteredInnerClasses();
if (candidates == null) {
return new ClassWithOptions[0];
}
int count = 0;
for (Class<?> candidate : candidates) {
if (candidate != null) {
count++;
}
}
final ClassWithOptions[] ret = new ClassWithOptions[count];
count = 0;
for (Class<?> candidate : candidates) {
if (candidate != null) {
ret[count++] = new ClassWithOptions(
candidate, mClass.generatedName + "::" + candidate.getSimpleName());
}
}
assert ret.length == count;
Arrays.sort(ret, new Comparator<ClassWithOptions>() {
@Override public int compare(ClassWithOptions lhs, ClassWithOptions rhs) {
return lhs.generatedName.compareTo(rhs.generatedName);
}
});
return ret;
}
private static <T extends Enum<T>> T getEnumValue(Class<T> type, String name)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
try {
return Enum.valueOf(type, name.toUpperCase());
} catch (IllegalArgumentException e) {
Object[] values = (Object[]) type.getDeclaredMethod("values").invoke(null);
StringBuilder names = new StringBuilder();
for (int i = 0; i < values.length; i++) {
if (i != 0) {
names.append(", ");
}
names.append(values[i].toString().toLowerCase());
}
System.err.println("***");
System.err.println("*** Invalid value \"" + name + "\" for " + type.getSimpleName());
System.err.println("*** Specify one of " + names.toString());
System.err.println("***");
e.printStackTrace(System.err);
System.exit(6);
return null;
}
}
private AnnotationInfo buildAnnotationInfo(AnnotatedElement element, Annotation annotation) {
Class<? extends Annotation> annotationType = annotation.annotationType();
final String annotationTypeName = annotationType.getName();
if (!annotationTypeName.equals("org.mozilla.gecko.annotation.WrapForJNI")) {
return null;
}
String stubName = null;
AnnotationInfo.ExceptionMode exceptionMode = null;
AnnotationInfo.CallingThread callingThread = null;
AnnotationInfo.DispatchTarget dispatchTarget = null;
try {
final Method skipMethod = annotationType.getDeclaredMethod("skip");
skipMethod.setAccessible(true);
if ((Boolean) skipMethod.invoke(annotation)) {
mSkipCurrentEntry = true;
return null;
}
// Determine the explicitly-given name of the stub to generate, if any.
final Method stubNameMethod = annotationType.getDeclaredMethod("stubName");
stubNameMethod.setAccessible(true);
stubName = (String) stubNameMethod.invoke(annotation);
final Method exceptionModeMethod = annotationType.getDeclaredMethod("exceptionMode");
exceptionModeMethod.setAccessible(true);
exceptionMode = getEnumValue(
AnnotationInfo.ExceptionMode.class,
(String) exceptionModeMethod.invoke(annotation));
final Method calledFromMethod = annotationType.getDeclaredMethod("calledFrom");
calledFromMethod.setAccessible(true);
callingThread = getEnumValue(
AnnotationInfo.CallingThread.class,
(String) calledFromMethod.invoke(annotation));
final Method dispatchToMethod = annotationType.getDeclaredMethod("dispatchTo");
dispatchToMethod.setAccessible(true);
dispatchTarget = getEnumValue(
AnnotationInfo.DispatchTarget.class,
(String) dispatchToMethod.invoke(annotation));
} catch (NoSuchMethodException e) {
System.err.println("Unable to find expected field on WrapForJNI annotation. Did the signature change?");
e.printStackTrace(System.err);
System.exit(3);
} catch (IllegalAccessException e) {
System.err.println("IllegalAccessException reading fields on WrapForJNI annotation. Seems the semantics of Reflection have changed...");
e.printStackTrace(System.err);
System.exit(4);
} catch (InvocationTargetException e) {
System.err.println("InvocationTargetException reading fields on WrapForJNI annotation. This really shouldn't happen.");
e.printStackTrace(System.err);
System.exit(5);
}
// If the method name was not explicitly given in the annotation generate one...
if (stubName.isEmpty()) {
stubName = Utils.getNativeName(element);
}
return new AnnotationInfo(stubName, exceptionMode, callingThread, dispatchTarget);
}
/**
* Find and cache the next appropriately annotated method, plus the annotation parameter, if
* one exists. Otherwise cache null, so hasNext returns false.
*/
private void findNextValue() {
while (mElementIndex < mObjects.length) {
Member candidateElement = mObjects[mElementIndex];
mElementIndex++;
for (Annotation annotation : ((AnnotatedElement) candidateElement).getDeclaredAnnotations()) {
AnnotationInfo info = buildAnnotationInfo((AnnotatedElement)candidateElement, annotation);
if (info != null) {
mNextReturnValue = new AnnotatableEntity(candidateElement, info);
return;
}
}
if (mSkipCurrentEntry) {
mSkipCurrentEntry = false;
continue;
}
// If no annotation found, we might be expected to generate anyway
// using default arguments, thanks to the "Generate everything" annotation.
if (mIterateEveryEntry) {
AnnotationInfo annotationInfo = new AnnotationInfo(
Utils.getNativeName(candidateElement),
mClassInfo.exceptionMode,
mClassInfo.callingThread,
mClassInfo.dispatchTarget);
mNextReturnValue = new AnnotatableEntity(candidateElement, annotationInfo);
return;
}
}
mNextReturnValue = null;
}
@Override
public boolean hasNext() {
return mNextReturnValue != null;
}
@Override
public AnnotatableEntity next() {
AnnotatableEntity ret = mNextReturnValue;
findNextValue();
return ret;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Removal of methods from GeneratableElementIterator not supported.");
}
}
+288
View File
@@ -0,0 +1,288 @@
/* 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/. */
package org.mozilla.gecko.annotationProcessors.utils;
import org.mozilla.gecko.annotationProcessors.AnnotationInfo;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.util.HashMap;
/**
* A collection of utility methods used by CodeGenerator. Largely used for translating types.
*/
public class Utils {
// A collection of lookup tables to simplify the functions to follow...
private static final HashMap<String, String> NATIVE_TYPES = new HashMap<String, String>();
static {
NATIVE_TYPES.put("void", "void");
NATIVE_TYPES.put("boolean", "bool");
NATIVE_TYPES.put("byte", "int8_t");
NATIVE_TYPES.put("char", "char16_t");
NATIVE_TYPES.put("short", "int16_t");
NATIVE_TYPES.put("int", "int32_t");
NATIVE_TYPES.put("long", "int64_t");
NATIVE_TYPES.put("float", "float");
NATIVE_TYPES.put("double", "double");
}
private static final HashMap<String, String> NATIVE_ARRAY_TYPES = new HashMap<String, String>();
static {
NATIVE_ARRAY_TYPES.put("boolean", "mozilla::jni::BooleanArray");
NATIVE_ARRAY_TYPES.put("byte", "mozilla::jni::ByteArray");
NATIVE_ARRAY_TYPES.put("char", "mozilla::jni::CharArray");
NATIVE_ARRAY_TYPES.put("short", "mozilla::jni::ShortArray");
NATIVE_ARRAY_TYPES.put("int", "mozilla::jni::IntArray");
NATIVE_ARRAY_TYPES.put("long", "mozilla::jni::LongArray");
NATIVE_ARRAY_TYPES.put("float", "mozilla::jni::FloatArray");
NATIVE_ARRAY_TYPES.put("double", "mozilla::jni::DoubleArray");
}
private static final HashMap<String, String> CLASS_DESCRIPTORS = new HashMap<String, String>();
static {
CLASS_DESCRIPTORS.put("void", "V");
CLASS_DESCRIPTORS.put("boolean", "Z");
CLASS_DESCRIPTORS.put("byte", "B");
CLASS_DESCRIPTORS.put("char", "C");
CLASS_DESCRIPTORS.put("short", "S");
CLASS_DESCRIPTORS.put("int", "I");
CLASS_DESCRIPTORS.put("long", "J");
CLASS_DESCRIPTORS.put("float", "F");
CLASS_DESCRIPTORS.put("double", "D");
}
/**
* Get the C++ type corresponding to the provided type parameter.
*
* @param type Class to determine the corresponding JNI type for.
* @return C++ type as a String
*/
public static String getNativeParameterType(Class<?> type, AnnotationInfo info) {
final String name = type.getName().replace('.', '/');
if (NATIVE_TYPES.containsKey(name)) {
return NATIVE_TYPES.get(name);
}
if (type.isArray()) {
final String compName = type.getComponentType().getName();
if (NATIVE_ARRAY_TYPES.containsKey(compName)) {
return NATIVE_ARRAY_TYPES.get(compName) + "::Param";
}
return "mozilla::jni::ObjectArray::Param";
}
if (type.equals(String.class) || type.equals(CharSequence.class)) {
return "mozilla::jni::String::Param";
}
if (type.equals(Class.class)) {
// You're doing reflection on Java objects from inside C, returning Class objects
// to C, generating the corresponding code using this Java program. Really?!
return "mozilla::jni::Class::Param";
}
if (type.equals(Throwable.class)) {
return "mozilla::jni::Throwable::Param";
}
if (type.equals(ByteBuffer.class)) {
return "mozilla::jni::ByteBuffer::Param";
}
return "mozilla::jni::Object::Param";
}
public static String getNativeReturnType(Class<?> type, AnnotationInfo info) {
final String name = type.getName().replace('.', '/');
if (NATIVE_TYPES.containsKey(name)) {
return NATIVE_TYPES.get(name);
}
if (type.isArray()) {
final String compName = type.getComponentType().getName();
if (NATIVE_ARRAY_TYPES.containsKey(compName)) {
return NATIVE_ARRAY_TYPES.get(compName) + "::LocalRef";
}
return "mozilla::jni::ObjectArray::LocalRef";
}
if (type.equals(String.class)) {
return "mozilla::jni::String::LocalRef";
}
if (type.equals(Class.class)) {
// You're doing reflection on Java objects from inside C, returning Class objects
// to C, generating the corresponding code using this Java program. Really?!
return "mozilla::jni::Class::LocalRef";
}
if (type.equals(Throwable.class)) {
return "mozilla::jni::Throwable::LocalRef";
}
if (type.equals(ByteBuffer.class)) {
return "mozilla::jni::ByteBuffer::LocalRef";
}
return "mozilla::jni::Object::LocalRef";
}
/**
* Get the JNI class descriptor corresponding to the provided type parameter.
*
* @param type Class to determine the corresponding JNI descriptor for.
* @return Class descripor as a String
*/
public static String getClassDescriptor(Class<?> type) {
final String name = type.getName().replace('.', '/');
if (CLASS_DESCRIPTORS.containsKey(name)) {
return CLASS_DESCRIPTORS.get(name);
}
if (type.isArray()) {
// Array names are already in class descriptor form.
return name;
}
return "L" + name + ';';
}
/**
* Get the JNI signaure for a member.
*
* @param member Member to get the signature for.
* @return JNI signature as a string
*/
public static String getSignature(Member member) {
return member instanceof Field ? getSignature((Field) member) :
member instanceof Method ? getSignature((Method) member) :
getSignature((Constructor<?>) member);
}
/**
* Get the JNI signaure for a field.
*
* @param member Field to get the signature for.
* @return JNI signature as a string
*/
public static String getSignature(Field member) {
return getClassDescriptor(member.getType());
}
private static String getSignature(Class<?>[] args, Class<?> ret) {
final StringBuilder sig = new StringBuilder("(");
for (int i = 0; i < args.length; i++) {
sig.append(getClassDescriptor(args[i]));
}
return sig.append(')').append(getClassDescriptor(ret)).toString();
}
/**
* Get the JNI signaure for a method.
*
* @param member Method to get the signature for.
* @return JNI signature as a string
*/
public static String getSignature(Method member) {
return getSignature(member.getParameterTypes(), member.getReturnType());
}
/**
* Get the JNI signaure for a constructor.
*
* @param member Constructor to get the signature for.
* @return JNI signature as a string
*/
public static String getSignature(Constructor<?> member) {
return getSignature(member.getParameterTypes(), void.class);
}
/**
* Get the C++ name for a member.
*
* @param member Member to get the name for.
* @return JNI name as a string
*/
public static String getNativeName(Member member) {
final String name = getMemberName(member);
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
/**
* Get the C++ name for a member.
*
* @param member Member to get the name for.
* @return JNI name as a string
*/
public static String getNativeName(Class<?> clz) {
final String name = clz.getName();
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
/**
* Get the C++ name for a member.
*
* @param member Member to get the name for.
* @return JNI name as a string
*/
public static String getNativeName(AnnotatedElement element) {
if (element instanceof Class<?>) {
return getNativeName((Class<?>)element);
} else if (element instanceof Member) {
return getNativeName((Member)element);
} else {
return null;
}
}
/**
* Get the JNI name for a member.
*
* @param member Member to get the name for.
* @return JNI name as a string
*/
public static String getMemberName(Member member) {
if (member instanceof Constructor) {
return "<init>";
}
return member.getName();
}
public static String getUnqualifiedName(String name) {
return name.substring(name.lastIndexOf(':') + 1);
}
/**
* Determine if a member is declared static.
*
* @param member The Member to check.
* @return true if the member is declared static, false otherwise.
*/
public static boolean isStatic(final Member member) {
return Modifier.isStatic(member.getModifiers());
}
/**
* Determine if a member is declared final.
*
* @param member The Member to check.
* @return true if the member is declared final, false otherwise.
*/
public static boolean isFinal(final Member member) {
return Modifier.isFinal(member.getModifiers());
}
}
+12
View File
@@ -28,12 +28,24 @@ MOZ_ARG_WITH_STRING(arch,
if test -z "$MOZ_ARCH"; then
dnl Defaults
case "${CPU_ARCH}-${OS_TARGET}" in
arm-Android)
MOZ_THUMB=yes
MOZ_ARCH=armv7-a
MOZ_FPU=vfp
MOZ_FLOAT_ABI=softfp
MOZ_ALIGN=no
;;
arm-Darwin)
MOZ_ARCH=toolchain-default
;;
esac
fi
if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
MOZ_FPU=vfp
MOZ_FLOAT_ABI=softfp
fi
MOZ_ARG_WITH_STRING(thumb,
[ --with-thumb[[=yes|no|toolchain-default]]]
[ Use Thumb instruction set (-mthumb)],
+16 -8
View File
@@ -16,7 +16,7 @@ dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-s
DEVELOPER_OPTIONS=,
DEVELOPER_OPTIONS=1)
dnl Default to MSVC for win32
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
@@ -176,8 +176,8 @@ if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
fi
CFLAGS="$CFLAGS -fno-math-errno -pipe"
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno -pipe"
CFLAGS="$CFLAGS -fno-math-errno"
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno"
if test "$CPU_ARCH" = "x86" -o "$CPU_ARCH" = "x86_64"; then
CFLAGS="$CFLAGS -msse2 -mfpmath=sse"
@@ -186,8 +186,7 @@ if test "$GNU_CC"; then
if test -z "$CLANG_CC"; then
case "$CC_VERSION" in
4.* | 5.* | 6.*)
AC_MSG_ERROR([Unsupported GCC version.])
4.* | 5.*)
;;
*)
# Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko.
@@ -271,9 +270,18 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then
fi
fi
# On some Unix systems, some file managers (e.g. Nautilus) can't start PIE programs
# so don't enable it by default.
MOZ_PIE=
# bionic in Android < 4.1 doesn't support PIE
# On OSX, the linker defaults to building PIE programs when targetting OSX 10.7+,
# but not when targetting OSX < 10.7. OSX < 10.7 doesn't support running PIE
# programs, so as long as support for OSX 10.6 is kept, we can't build PIE.
# Even after dropping 10.6 support, MOZ_PIE would not be useful since it's the
# default (and clang says the -pie option is not used).
# On other Unix systems, some file managers (Nautilus) can't start PIE programs
if test -n "$gonkdir" && test "$ANDROID_VERSION" -ge 16; then
MOZ_PIE=1
else
MOZ_PIE=
fi
MOZ_ARG_ENABLE_BOOL(pie,
[ --enable-pie Enable Position Independent Executables],
+6 -2
View File
@@ -114,7 +114,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | \
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \
@@ -122,6 +122,10 @@ case $maybe_os in
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -1385,7 +1389,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+5
View File
@@ -7,6 +7,11 @@ dnl disabling frame pointers in this architecture based on the configure
dnl options
AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
case "$target" in
*android*)
unwind_tables="-funwind-tables"
;;
esac
if test "$GNU_CC"; then
MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer $unwind_tables"
MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer"
-2
View File
@@ -138,8 +138,6 @@ if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
,
AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
CFLAGS=$_SAVE_CFLAGS
NSPR_INCLUDE_DIR=`echo ${NSPR_CFLAGS} | sed -e 's/.*-I\([^ ]*\).*/\1/'`
NSPR_LIB_DIR=`echo ${NSPR_LIBS} | sed -e 's/.*-L\([^ ]*\).*/\1/'`
elif test -z "$JS_POSIX_NSPR"; then
NSPR_INCLUDE_DIR="${DIST}/include/nspr"
NSPR_CFLAGS="-I${NSPR_INCLUDE_DIR}"
+90
View File
@@ -0,0 +1,90 @@
.. _build_androideclipse:
========================
Android Eclipse Projects
========================
The build system contains alpha support for generating Android Eclipse
project files to aid with development.
To generate Android Eclipse project files, you'll need to have a fully
built and packaged tree::
mach build && mach package
(This is because Eclipse itself packages an APK containing
``omni.ja``, and ``omni.ja`` is only assembled during packaging.)
Then, simply generate the Android Eclipse build backend::
mach build-backend -b AndroidEclipse
If all goes well, the path to the generated projects should be
printed (currently, ``$OBJDIR/android_eclipse``).
To use the generated Android Eclipse project files, you'll need to
have a recent version of Eclipse (see `Tested Versions`_) with the
`Eclipse ADT plugin
<http://developer.android.com/tools/sdk/eclipse-adt.html>`_
installed. You can then import all the projects into Eclipse using
*File > Import ... > General > Existing Projects into Workspace*.
Updating Project Files
======================
As you pull and update the source tree, your Android Eclipse files may
fall out of sync with the build configuration. The tree should still
build fine from within Eclipse, but source files may be missing and in
rare circumstances Eclipse's index may not have the proper build
configuration.
To account for this, you'll want to periodically regenerate the
Android Eclipse project files. You can do this by running ``mach build
&& mach package && mach build-backend -b AndroidEclipse`` from the
command line. It's a good idea to refresh and clean build all projects
in Eclipse after doing this.
In future, we'd like to include an Android Eclipse run configuration
or build target that integrates updating the project files.
Currently, regeneration rewrites the original project files. **If
you've made any customizations to the projects, they will likely get
overwritten.** We would like to improve this user experience in the
future.
Troubleshooting
===============
If Eclipse's builder gets confused, you should always refresh and
clean build all projects. If Eclipse's builder is continually
confused, you can see a log of what is happening at
``$OBJDIR/android_eclipse/build.log``.
If you run into memory problems executing ``dex``, you should
`Increase Eclipse's memory limits <http://stackoverflow.com/a/11093228>`_.
The produced Android Eclipse project files are unfortunately not
portable. Please don't move them around.
Structure of Android Eclipse projects
=====================================
The Android Eclipse backend generates several projects spanning Fennec
itself and its tests. You'll mostly interact with the *Fennec* project
itself.
In future, we'd like to expand this documentation to include some of
the technical details of how the Eclipse integration works, and how to
add additional Android Eclipse projects using the ``moz.build``
system.
Tested Versions
===============
=============== ==================================== =================
OS Version Working as of
=============== ==================================== =================
Mac OS X Luna (Build id: 20130919-0819) February 2014
Mac OS X Kepler (Build id: 20131219-0014) February 2014
Mac OS X 10.8.5 Kepler (Build id: 20130919-0819) February 2014
=============== ==================================== =================
+4 -4
View File
@@ -18,14 +18,14 @@ built tree::
mach build
Then, simply generate the Eclipse build backend::
Then, simply generate the Android Eclipse build backend::
mach build-backend -b CppEclipse
If all goes well, the path to the generated workspace should be
printed.
printed (currently, ``$OBJDIR/android_eclipse``).
To use the generated Eclipse project files, you'll need to
To use the generated Android Eclipse project files, you'll need to
have a Eclipse CDT 8.3 (We plan to follow the latest Eclipse release)
`Eclipse CDT plugin
<https://www.eclipse.org/cdt/>`_
@@ -43,7 +43,7 @@ rare circumstances Eclipse's index may not have the proper build
configuration.
To account for this, you'll want to periodically regenerate the
Eclipse project files. You can do this by running ``mach build
Android Eclipse project files. You can do this by running ``mach build
&& mach build-backend -b CppEclipse`` from the
command line.
+1
View File
@@ -33,6 +33,7 @@ integrated development environment (IDE)
.. toctree::
:maxdepth: 1
androideclipse
cppeclipse
visualstudio
+79
View File
@@ -17,5 +17,84 @@ like a re-packaging post-processing step.
There are scripts in-tree in mozharness to orchestrate these re-packaging
steps for `Desktop
<https://dxr.mozilla.org/mozilla-central/source/testing/mozharness/scripts/desktop_l10n.py>`_
and `Android
<https://dxr.mozilla.org/mozilla-central/source/testing/mozharness/scripts/mobile_l10n.py>`_
but they rely heavily on buildbot information so they are almost impossible to
run locally.
The following instructions are extracted from the `Android script with hg hash
494289c7
<https://dxr.mozilla.org/mozilla-central/rev/494289c72ba3997183e7b5beaca3e0447ecaf96d/testing/mozharness/scripts/mobile_l10n.py>`_,
and may need to be updated and slightly modified for Desktop.
Step by step instructions for Android
-------------------------------------
This assumes that ``$AB_CD`` is the locale you want to repack with; I tested
with "ar" and "en-GB".
.. warning:: l10n repacks do not work with artifact builds. Repackaging
compiles no code so supporting ``--disable-compile-environment`` would not
save much, if any, time.
#. You must have a built and packaged object directory, or a pre-built
``en-US`` package.
.. code-block:: shell
./mach build
./mach package
#. Clone ``l10n-central/$AB_CD`` so that it is a sibling to your
``mozilla-central`` directory.
.. code-block:: shell
$ ls -al
mozilla-central
...
$ mkdir -p l10n-central
$ hg clone https://hg.mozilla.org/l10n-central/$AB_CD l10n-central/$AB_CD
$ ls -al
mozilla-central
l10n-central/$AB_CD
...
#. Copy your ``mozconfig`` to ``mozconfig.l10n`` and add the following.
::
ac_add_options --with-l10n-base=../../l10n-central
ac_add_options --disable-tests
mk_add_options MOZ_OBJDIR=./objdir-l10n
#. Configure and prepare the l10n object directory.
.. code-block:: shell
MOZCONFIG=mozconfig.l10n ./mach configure
MOZCONFIG=mozconfig.l10n ./mach build -C config export
MOZCONFIG=mozconfig.l10n ./mach build buildid.h
#. Copy your built package and unpack it into the l10n object directory.
.. code-block:: shell
cp $OBJDIR/dist/fennec-*en-US*.apk ./objdir-l10n/dist
MOZCONFIG=mozconfig.l10n ./mach build -C mobile/android/locales unpack
#. Run the ``compare-locales`` script to write locale-specific changes into
``objdir-l10n/merged``.
.. code-block:: shell
MOZCONFIG=mozconfig.l10n ./mach compare-locales --merge-dir objdir-l10n/merged $AB_CD
#. Finally, repackage using the locale-specific changes.
.. code-block:: shell
MOZCONFIG=mozconfig.l10n LOCALE_MERGEDIR=`realpath objdir-l10n/merged` ./mach build -C mobile/android/locales installers-$AB_CD
(Note the absolute path for ``LOCALE_MERGEDIR``.) You should find a
re-packaged build at ``objdir-l10n/dist/fennec-*$AB_CD*.apk``.
+19 -4
View File
@@ -62,7 +62,8 @@ bits
buildapp
The path to the XUL application being built.
For desktop Firefox, this is ``browser``.
For desktop Firefox, this is ``browser``. For Fennec, it's
``mobile/android``. For B2G, it's ``b2g``.
crashreporter
Whether the crash reporter is enabled for this build.
@@ -71,6 +72,13 @@ crashreporter
Always defined.
datareporting
Whether data reporting (MOZ_DATA_REPORTING) is enabled for this build.
Values are ``true`` and ``false``.
Always defined.
debug
Whether this is a debug build.
@@ -78,6 +86,13 @@ debug
Always defined.
healthreport
Whether the Health Report feature is enabled.
Values are ``true`` and ``false``.
Always defined.
mozconfig
The path of the :ref:`mozconfig file <mozconfig>` used to produce this build.
@@ -92,9 +107,9 @@ nightly_build
os
The operating system the build is produced for. Values for tier-1
supported platforms are ``linux`` and ``win``. For other platforms,
the value is the lowercase version of the ``OS_TARGET`` variable
from ``config.status``.
supported platforms are ``linux``, ``win``, ``mac``, ``b2g``, and
``android``. For other platforms, the value is the lowercase version
of the ``OS_TARGET`` variable from ``config.status``.
Always defined.
+55
View File
@@ -54,3 +54,58 @@ archive::
$ ./mach python build/windows_toolchain.py create-zip vs2015u3
The produced archive will be the argument to ``create-zip`` + ``.zip``.
Firefox for Android with Gradle
===============================
To build Firefox for Android with Gradle in automation, archives
containing both the Gradle executable and a Maven repository
comprising the exact build dependencies are produced and uploaded to
an internal Mozilla server. The build automation will download,
verify, and extract these archive before building. These archives
provide a self-contained Gradle and Maven repository so that machines
don't need to fetch additional Maven dependencies at build time.
(Gradle and the downloaded Maven dependencies can be both
redistributed publicly.)
Archiving the Gradle executable is straight-forward, but archiving a
local Maven repository is not. Therefore a special Task Cluster
Docker image and job exist for producing the required archives. The
Docker image definition is rooted in
``taskcluster/docker/android-gradle-build``. The Task Cluster job
definition is in
``testing/taskcluster/tasks/builds/android_api_15_gradle_dependencies.yml``.
The job runs in a container based on the custom Docker image and
spawns a Sonatype Nexus proxying Maven repository process in the
background. The job builds Firefox for Android using Gradle and the
in-tree Gradle configuration rooted at ``build.gradle``. The spawned
proxying Maven repository downloads external dependencies and collects
them. After the Gradle build completes, the job archives the Gradle
version used to build, and the downloaded Maven repository, and
exposes them as Task Cluster artifacts.
Here is `an example try job fetching these dependencies
<https://treeherder.mozilla.org/#/jobs?repo=try&revision=75bc98935147&selectedJob=17793653>`_.
The resulting task produced a `Gradle archive
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fgradle.tar.xz>`_
and a `Maven repository archive
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fjcentral.tar.xz>`_.
These archives were then uploaded (manually) to Mozilla automation
using tooltool for consumption in Gradle builds.
To update the version of Gradle in the archive produced, update
``gradle/wrapper/gradle-wrapper.properties``. Be sure to also update
the SHA256 checksum to prevent poisoning the build machines!
To update the versions of Gradle dependencies used, update
``dependencies`` sections in the in-tree Gradle configuration rooted
at ``build.gradle``. Once you are confident your changes build
locally, push a fresh try build with an invocation like::
$ hg push-to-try -m "try: -b o -p android-api-15-gradle-dependencies"
Then `upload your archives to tooltool
<https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool>`_,
update the in-tree manifests in
``mobile/android/config/tooltool-manifests``, and push a fresh try
build.
+39 -4
View File
@@ -3,9 +3,7 @@
# 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('gyp_base.mozbuild')
gyp_vars.update({
gyp_vars = {
'lsan': 0,
'asan': 0,
'build_with_mozilla': 1,
@@ -20,6 +18,8 @@ gyp_vars.update({
'clang_use_chrome_plugins': 0,
'enable_protobuf': 0,
'include_tests': 0,
'enable_android_opensl': 1,
'enable_android_opensl_output': 0,
# use_system_lib* still seems to be in use in trunk/build
'use_system_libjpeg': 0,
'use_system_libvpx': 0,
@@ -67,7 +67,42 @@ gyp_vars.update({
# linker to throw away uneeded bits.
'include_isac': 1,
'include_pcm16b': 1,
})
}
os = CONFIG['OS_TARGET']
if os == 'WINNT':
gyp_vars.update(
MSVS_VERSION=CONFIG['_MSVS_VERSION'],
MSVS_OS_BITS=64 if CONFIG['HAVE_64BIT_BUILD'] else 32,
)
elif os == 'Android':
gyp_vars.update(
gtest_target_type='executable',
moz_webrtc_mediacodec=1,
android_toolchain=CONFIG.get('ANDROID_TOOLCHAIN', ''),
)
flavors = {
'WINNT': 'win',
'Android': 'android',
'Linux': 'linux',
'SunOS': 'solaris',
'GNU/kFreeBSD': 'freebsd',
'DragonFly': 'dragonfly',
'FreeBSD': 'freebsd',
'NetBSD': 'netbsd',
'OpenBSD': 'openbsd',
}
gyp_vars['OS'] = flavors.get(os)
arches = {
'x86_64': 'x64',
'x86': 'ia32',
'aarch64': 'arm64',
}
gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH'])
if CONFIG['ARM_ARCH']:
if int(CONFIG['ARM_ARCH']) < 7:
-36
View File
@@ -1,36 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
gyp_vars = {}
os = CONFIG['OS_TARGET']
if os == 'WINNT':
gyp_vars.update(
MSVS_VERSION=CONFIG['_MSVS_VERSION'],
MSVS_OS_BITS=64 if CONFIG['HAVE_64BIT_BUILD'] else 32,
)
flavors = {
'WINNT': 'win',
'Linux': 'linux',
'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios',
'SunOS': 'solaris',
'GNU/kFreeBSD': 'freebsd',
'DragonFly': 'dragonfly',
'FreeBSD': 'freebsd',
'NetBSD': 'netbsd',
'OpenBSD': 'openbsd',
}
gyp_vars['OS'] = flavors.get(os)
arches = {
'x86_64': 'x64',
'x86': 'ia32',
'aarch64': 'arm64',
}
gyp_vars['host_arch'] = arches.get(CONFIG['HOST_CPU_ARCH'], CONFIG['HOST_CPU_ARCH'])
gyp_vars['target_arch'] = arches.get(CONFIG['CPU_ARCH'], CONFIG['CPU_ARCH'])
+10 -14
View File
@@ -35,6 +35,7 @@ Press ENTER/RETURN to continue or CTRL+c to abort.
# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
SEARCH_PATHS = [
'python/mach',
'python/mozboot',
'python/mozbuild',
'python/mozlint',
'python/mozversioncontrol',
@@ -64,6 +65,11 @@ SEARCH_PATHS = [
'other-licenses/ply',
'taskcluster',
'testing',
'testing/firefox-ui/harness',
'testing/marionette/client',
'testing/marionette/harness',
'testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py',
'testing/marionette/puppeteer/firefox',
'testing/mozbase/mozcrash',
'testing/mozbase/mozdebug',
'testing/mozbase/mozdevice',
@@ -99,13 +105,16 @@ MACH_MODULES = [
'python/mach/mach/commands/commandinfo.py',
'python/mach/mach/commands/settings.py',
'python/compare-locales/mach_commands.py',
'python/mozboot/mozboot/mach_commands.py',
'python/mozbuild/mozbuild/mach_commands.py',
'python/mozbuild/mozbuild/backend/mach_commands.py',
'python/mozbuild/mozbuild/compilation/codecomplete.py',
'python/mozbuild/mozbuild/frontend/mach_commands.py',
'services/common/tests/mach_commands.py',
'taskcluster/mach_commands.py',
'testing/firefox-ui/mach_commands.py',
'testing/mach_commands.py',
'testing/marionette/mach_commands.py',
'testing/mochitest/mach_commands.py',
'testing/mozharness/mach_commands.py',
'testing/talos/mach_commands.py',
@@ -189,20 +198,7 @@ def bootstrap(topsrcdir, mozilla_dir=None):
# like surprises.
sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
import mach.main
def get_state_dir():
"""Obtain path to a directory to hold state.
Returns a tuple of the path and a bool indicating whether the
value came from an environment variable.
"""
state_user_dir = os.path.expanduser('~/.mozbuild')
state_env_dir = os.environ.get('MOZBUILD_STATE_PATH')
if state_env_dir:
return state_env_dir, True
else:
return state_user_dir, False
from mozboot.util import get_state_dir
def telemetry_handler(context, data):
# We have not opted-in to telemetry
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
set -e
if ! git remote -v | grep origin | grep -q cctools-port; then
echo "must be in a cctools-port checkout"
exit 1
fi
mkdir build-cctools
cd build-cctools
CFLAGS='-mcpu=generic -mtune=generic' MACOSX_DEPLOYMENT_TARGET=10.7 ../cctools/configure --target=x86_64-apple-darwin11
env MACOSX_DEPLOYMENT_TARGET=10.7 make -s -j4
if test ! -e ld64/src/ld/ld; then
echo "ld did not get built"
exit 1
fi
gtar jcf cctools.tar.bz2 ld64/src/ld/ld --transform 's#ld64/src/ld#cctools/bin#'
cd ../
echo "build from $(git show --pretty=format:%H -s HEAD) complete!"
echo "upload the build-cctools/cctools.tar.bz2 file to tooltool"
-47
View File
@@ -1,47 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOZ_AUTOMATION_L10N_CHECK=0
if [ "x$IS_NIGHTLY" = "xyes" ]; then
# Some nightlies (eg: Mulet) don't want these set.
MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
fi
. "$topsrcdir/build/mozconfig.common"
# ld needs libLTO.so from llvm
mk_add_options "export LD_LIBRARY_PATH=$topsrcdir/clang/lib"
CROSS_CCTOOLS_PATH=$topsrcdir/cctools
CROSS_SYSROOT=$topsrcdir/MacOSX10.7.sdk
CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
FLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT"
export CC="$topsrcdir/clang/bin/clang $FLAGS"
export CXX="$topsrcdir/clang/bin/clang++ $FLAGS"
export CPP="$topsrcdir/clang/bin/clang $FLAGS -E"
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-dead_strip"
export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin10-
export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
export GENISOIMAGE=$topsrcdir/genisoimage/genisoimage
export DMG_TOOL=$topsrcdir/dmg/dmg
export HOST_CC="$topsrcdir/clang/bin/clang"
export HOST_CXX="$topsrcdir/clang/bin/clang++"
export HOST_CPP="$topsrcdir/clang/bin/clang -E"
export HOST_CFLAGS="-g"
export HOST_CXXFLAGS="-g"
export HOST_LDFLAGS="-g"
ac_add_options --target=x86_64-apple-darwin
ac_add_options --with-macos-private-frameworks=$CROSS_PRIVATE_FRAMEWORKS
# Enable static analysis checks by default on OSX cross builds.
ac_add_options --enable-clang-plugin
. "$topsrcdir/build/mozconfig.cache"
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
-46
View File
@@ -1,46 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if [ "x$IS_NIGHTLY" = "xyes" ]; then
# Some nightlies (eg: Mulet) don't want these set.
MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-1}
MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-1}
MOZ_AUTOMATION_SDK=${MOZ_AUTOMATION_SDK-1}
fi
. "$topsrcdir/build/mozconfig.common"
if [ -d "$topsrcdir/clang" ]; then
# mozilla-central based build
export CC=$topsrcdir/clang/bin/clang
export CXX=$topsrcdir/clang/bin/clang++
export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config
export DSYMUTIL=$topsrcdir/clang/bin/llvm-dsymutil
# Use an updated linker.
ldflags="-B$topsrcdir/cctools/bin"
elif [ -d "$topsrcdir/../clang" ]; then
# comm-central based build
export CC=$topsrcdir/../clang/bin/clang
export CXX=$topsrcdir/../clang/bin/clang++
export LLVMCONFIG=$topsrcdir/../clang/bin/llvm-config
export DSYMUTIL=$topsrcdir/../clang/bin/llvm-dsymutil
# Use an updated linker.
ldflags="-B$topsrcdir/../cctools/bin"
fi
# Ensure the updated linker doesn't generate things our older build tools
# don't understand.
ldflags="$ldflags -Wl,-no_data_in_code_info"
export LDFLAGS="$ldflags"
# If not set use the system default clang
if [ -z "$CC" ]; then
export CC=clang
fi
# If not set use the system default clang++
if [ -z "$CXX" ]; then
export CXX=clang++
fi
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
-5
View File
@@ -1,5 +0,0 @@
if test `uname -s` = Linux; then
. $topsrcdir/build/macosx/cross-mozconfig.common
else
. $topsrcdir/build/macosx/local-mozconfig.common
fi
-20
View File
@@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc != 2)
return 1;
uid_t realuser = getuid();
char uidstring[20];
snprintf(uidstring, 19, "%i", realuser);
uidstring[19] = '\0';
return execl("/usr/sbin/chown",
"/usr/sbin/chown", "-R", "-h", uidstring, argv[1], (char*) 0);
}
-14
View File
@@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <unistd.h>
int main(int argc, char **argv)
{
if (argc != 2)
return 1;
return execl("/usr/sbin/chown",
"/usr/sbin/chown", "-R", "-h", "root:admin", argv[1], (char*) 0);
}
-11
View File
@@ -1,11 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# i386/x86-64 Universal Build mozconfig
# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments
# to gcc's -arch parameter.
mk_add_options MOZ_BUILD_PROJECTS="x86_64 i386"
. $topsrcdir/build/macosx/universal/mozconfig.common
-55
View File
@@ -1,55 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
mk_add_options MOZ_UNIFY_BDATE=1
DARWIN_VERSION=10
ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION
ac_add_app_options x86_64 --target=x86_64-apple-darwin$DARWIN_VERSION
ac_add_app_options i386 --with-unify-dist=../x86_64/dist
ac_add_app_options x86_64 --with-unify-dist=../i386/dist
if ! test `uname -s` = Linux; then
# Cross-universal builds already do the equivalent of this by setting -isysroot directly
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk
fi
. $topsrcdir/build/macosx/mozconfig.common
# $MOZ_BUILD_APP is only defined when sourced by configure. That's not a
# problem, because the variables it affects only need to be set for
# configure.
if test -n "$MOZ_BUILD_APP" ; then
if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "x86_64"; then
TARGET_CPU=$MOZ_BUILD_APP
# $HOST_CXX is presently unused. $HOST_CC will only be used during a cross
# compile.
HOST_CC=$CC
HOST_CXX=$CXX
NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
# It's not strictly necessary to specify -arch during native builds, but it
# makes the merged about:buildconfig easier to follow, and it reduces
# conditionalized differences between builds.
CC="$CC -arch $TARGET_CPU"
CXX="$CXX -arch $TARGET_CPU"
# These must be set for cross builds, and don't hurt straight builds.
RANLIB="${TOOLCHAIN_PREFIX}ranlib"
AR="${TOOLCHAIN_PREFIX}ar"
AS=$CC
LD=ld
STRIP="${TOOLCHAIN_PREFIX}strip"
OTOOL="${TOOLCHAIN_PREFIX}otool"
# Each per-CPU build should be entirely oblivious to the fact that a
# universal binary will be produced. The exception is packager.mk, which
# needs to know to look for universal bits when building the .dmg.
UNIVERSAL_BINARY=1
export CC CXX HOST_CC HOST_CXX RANLIB AR AS LD STRIP OTOOL
fi
fi
File diff suppressed because it is too large. Load diff
+451
View File
@@ -0,0 +1,451 @@
# 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/.
import datetime
import mozcrash
import threading
import os
import posixpath
import Queue
import re
import shutil
import signal
import tempfile
import time
import traceback
import zipfile
from automation import Automation
from mozlog import get_default_logger
from mozprocess import ProcessHandlerMixin
class StdOutProc(ProcessHandlerMixin):
"""Process handler for b2g which puts all output in a Queue.
"""
def __init__(self, cmd, queue, **kwargs):
self.queue = queue
kwargs.setdefault('processOutputLine', []).append(self.handle_output)
ProcessHandlerMixin.__init__(self, cmd, **kwargs)
def handle_output(self, line):
self.queue.put_nowait(line)
class B2GRemoteAutomation(Automation):
_devicemanager = None
def __init__(self, deviceManager, appName='', remoteLog=None,
marionette=None):
self._devicemanager = deviceManager
self._appName = appName
self._remoteProfile = None
self._remoteLog = remoteLog
self.marionette = marionette
self._is_emulator = False
self.test_script = None
self.test_script_args = None
# Default our product to b2g
self._product = "b2g"
self.lastTestSeen = "b2gautomation.py"
# Default log finish to mochitest standard
self.logFinish = 'INFO SimpleTest FINISHED'
Automation.__init__(self)
def setEmulator(self, is_emulator):
self._is_emulator = is_emulator
def setDeviceManager(self, deviceManager):
self._devicemanager = deviceManager
def setAppName(self, appName):
self._appName = appName
def setRemoteProfile(self, remoteProfile):
self._remoteProfile = remoteProfile
def setProduct(self, product):
self._product = product
def setRemoteLog(self, logfile):
self._remoteLog = logfile
def getExtensionIDFromRDF(self, rdfSource):
"""
Retrieves the extension id from an install.rdf file (or string).
"""
from xml.dom.minidom import parse, parseString, Node
if isinstance(rdfSource, file):
document = parse(rdfSource)
else:
document = parseString(rdfSource)
# Find the <em:id> element. There can be multiple <em:id> tags
# within <em:targetApplication> tags, so we have to check this way.
for rdfChild in document.documentElement.childNodes:
if rdfChild.nodeType == Node.ELEMENT_NODE and rdfChild.tagName == "Description":
for descChild in rdfChild.childNodes:
if descChild.nodeType == Node.ELEMENT_NODE and descChild.tagName == "em:id":
return descChild.childNodes[0].data
return None
def installExtension(self, extensionSource, profileDir, extensionID=None):
# Bug 827504 - installing special-powers extension separately causes problems in B2G
if extensionID != "special-powers@mozilla.org":
if not os.path.isdir(profileDir):
self.log.info("INFO | automation.py | Cannot install extension, invalid profileDir at: %s", profileDir)
return
installRDFFilename = "install.rdf"
extensionsRootDir = os.path.join(profileDir, "extensions", "staged")
if not os.path.isdir(extensionsRootDir):
os.makedirs(extensionsRootDir)
if os.path.isfile(extensionSource):
reader = zipfile.ZipFile(extensionSource, "r")
for filename in reader.namelist():
# Sanity check the zip file.
if os.path.isabs(filename):
self.log.info("INFO | automation.py | Cannot install extension, bad files in xpi")
return
# We may need to dig the extensionID out of the zip file...
if extensionID is None and filename == installRDFFilename:
extensionID = self.getExtensionIDFromRDF(reader.read(filename))
# We must know the extensionID now.
if extensionID is None:
self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
return
# Make the extension directory.
extensionDir = os.path.join(extensionsRootDir, extensionID)
os.mkdir(extensionDir)
# Extract all files.
reader.extractall(extensionDir)
elif os.path.isdir(extensionSource):
if extensionID is None:
filename = os.path.join(extensionSource, installRDFFilename)
if os.path.isfile(filename):
with open(filename, "r") as installRDF:
extensionID = self.getExtensionIDFromRDF(installRDF)
if extensionID is None:
self.log.info("INFO | automation.py | Cannot install extension, missing extensionID")
return
# Copy extension tree into its own directory.
# "destination directory must not already exist".
shutil.copytree(extensionSource, os.path.join(extensionsRootDir, extensionID))
else:
self.log.info("INFO | automation.py | Cannot install extension, invalid extensionSource at: %s", extensionSource)
# Set up what we need for the remote environment
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
env = {}
# We always hide the results table in B2G; it's much slower if we don't.
env['MOZ_HIDE_RESULTS_TABLE'] = '1'
return env
def waitForNet(self):
active = False
time_out = 0
while not active and time_out < 40:
data = self._devicemanager._runCmd(['shell', '/system/bin/netcfg']).stdout.readlines()
data.pop(0)
for line in data:
if (re.search(r'UP\s+(?:[0-9]{1,3}\.){3}[0-9]{1,3}', line)):
active = True
break
time_out += 1
time.sleep(1)
return active
def checkForCrashes(self, directory, symbolsPath):
crashed = False
remote_dump_dir = self._remoteProfile + '/minidumps'
print "checking for crashes in '%s'" % remote_dump_dir
if self._devicemanager.dirExists(remote_dump_dir):
local_dump_dir = tempfile.mkdtemp()
self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
try:
logger = get_default_logger()
if logger is not None:
crashed = mozcrash.log_crashes(logger, local_dump_dir, symbolsPath, test=self.lastTestSeen)
else:
crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
except:
traceback.print_exc()
finally:
shutil.rmtree(local_dump_dir)
self._devicemanager.removeDir(remote_dump_dir)
return crashed
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# if remote profile is specified, use that instead
if (self._remoteProfile):
profileDir = self._remoteProfile
cmd, args = Automation.buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs)
return app, args
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime,
debuggerInfo, symbolsPath, outputHandler=None):
""" Wait for tests to finish (as evidenced by a signature string
in logcat), or for a given amount of time to elapse with no
output.
"""
timeout = timeout or 120
while True:
lines = proc.getStdoutLines(timeout)
if lines:
currentlog = '\n'.join(lines)
if outputHandler:
for line in lines:
outputHandler(line)
else:
print(currentlog)
# Match the test filepath from the last TEST-START line found in the new
# log content. These lines are in the form:
# ... INFO TEST-START | /filepath/we/wish/to/capture.html\n
testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", currentlog)
if testStartFilenames:
self.lastTestSeen = testStartFilenames[-1]
if (outputHandler and outputHandler.suite_finished) or (
hasattr(self, 'logFinish') and self.logFinish in currentlog):
return 0
else:
self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed "
"out after %d seconds with no output",
self.lastTestSeen, int(timeout))
self._devicemanager.killProcess('/system/b2g/b2g', sig=signal.SIGABRT)
timeout = 10 # seconds
starttime = datetime.datetime.utcnow()
while datetime.datetime.utcnow() - starttime < datetime.timedelta(seconds=timeout):
if not self._devicemanager.processExist('/system/b2g/b2g'):
break
time.sleep(1)
else:
print "timed out after %d seconds waiting for b2g process to exit" % timeout
return 1
self.checkForCrashes(None, symbolsPath)
return 1
def getDeviceStatus(self, serial=None):
# Get the current status of the device. If we know the device
# serial number, we look for that, otherwise we use the (presumably
# only) device shown in 'adb devices'.
serial = serial or self._devicemanager._deviceSerial
status = 'unknown'
for line in self._devicemanager._runCmd(['devices']).stdout.readlines():
result = re.match('(.*?)\t(.*)', line)
if result:
thisSerial = result.group(1)
if not serial or thisSerial == serial:
serial = thisSerial
status = result.group(2)
return (serial, status)
def restartB2G(self):
# TODO hangs in subprocess.Popen without this delay
time.sleep(5)
self._devicemanager._checkCmd(['shell', 'stop', 'b2g'])
# Wait for a bit to make sure B2G has completely shut down.
time.sleep(10)
self._devicemanager._checkCmd(['shell', 'start', 'b2g'])
if self._is_emulator:
self.marionette.emulator.wait_for_port(self.marionette.port)
def rebootDevice(self):
# find device's current status and serial number
serial, status = self.getDeviceStatus()
# reboot!
self._devicemanager._runCmd(['shell', '/system/bin/reboot'])
# The above command can return while adb still thinks the device is
# connected, so wait a little bit for it to disconnect from adb.
time.sleep(10)
# wait for device to come back to previous status
print 'waiting for device to come back online after reboot'
start = time.time()
rserial, rstatus = self.getDeviceStatus(serial)
while rstatus != 'device':
if time.time() - start > 120:
# device hasn't come back online in 2 minutes, something's wrong
raise Exception("Device %s (status: %s) not back online after reboot" % (serial, rstatus))
time.sleep(5)
rserial, rstatus = self.getDeviceStatus(serial)
print 'device:', serial, 'status:', rstatus
def Process(self, cmd, stdout=None, stderr=None, env=None, cwd=None):
# On a desktop or fennec run, the Process method invokes a gecko
# process in which to the tests. For B2G, we simply
# reboot the device (which was configured with a test profile
# already), wait for B2G to start up, and then navigate to the
# test url using Marionette. There doesn't seem to be any way
# to pass env variables into the B2G process, but this doesn't
# seem to matter.
# reboot device so it starts up with the mochitest profile
# XXX: We could potentially use 'stop b2g' + 'start b2g' to achieve
# a similar effect; will see which is more stable while attempting
# to bring up the continuous integration.
if not self._is_emulator:
self.rebootDevice()
time.sleep(5)
#wait for wlan to come up
if not self.waitForNet():
raise Exception("network did not come up, please configure the network" +
" prior to running before running the automation framework")
# stop b2g
self._devicemanager._runCmd(['shell', 'stop', 'b2g'])
time.sleep(5)
# For some reason user.js in the profile doesn't get picked up.
# Manually copy it over to prefs.js. See bug 1009730 for more details.
self._devicemanager.moveTree(posixpath.join(self._remoteProfile, 'user.js'),
posixpath.join(self._remoteProfile, 'prefs.js'))
# relaunch b2g inside b2g instance
instance = self.B2GInstance(self._devicemanager, env=env)
time.sleep(5)
# Set up port forwarding again for Marionette, since any that
# existed previously got wiped out by the reboot.
if not self._is_emulator:
self._devicemanager._checkCmd(['forward',
'tcp:%s' % self.marionette.port,
'tcp:%s' % self.marionette.port])
if self._is_emulator:
self.marionette.emulator.wait_for_port(self.marionette.port)
else:
time.sleep(5)
# start a marionette session
session = self.marionette.start_session()
if 'b2g' not in session:
raise Exception("bad session value %s returned by start_session" % session)
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
self.marionette.execute_script("""
let SECURITY_PREF = "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer";
Components.utils.import("resource://gre/modules/Services.jsm");
Services.prefs.setBoolPref(SECURITY_PREF, true);
if (!testUtils.hasOwnProperty("specialPowersObserver")) {
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.jsm",
testUtils);
testUtils.specialPowersObserver = new testUtils.SpecialPowersObserver();
testUtils.specialPowersObserver.init();
}
""")
# run the script that starts the tests
if self.test_script:
if os.path.isfile(self.test_script):
script = open(self.test_script, 'r')
self.marionette.execute_script(script.read(), script_args=self.test_script_args)
script.close()
elif isinstance(self.test_script, basestring):
self.marionette.execute_script(self.test_script, script_args=self.test_script_args)
else:
# assumes the tests are started on startup automatically
pass
return instance
# be careful here as this inner class doesn't have access to outer class members
class B2GInstance(object):
"""Represents a B2G instance running on a device, and exposes
some process-like methods/properties that are expected by the
automation.
"""
def __init__(self, dm, env=None):
self.dm = dm
self.env = env or {}
self.stdout_proc = None
self.queue = Queue.Queue()
# Launch b2g in a separate thread, and dump all output lines
# into a queue. The lines in this queue are
# retrieved and returned by accessing the stdout property of
# this class.
cmd = [self.dm._adbPath]
if self.dm._deviceSerial:
cmd.extend(['-s', self.dm._deviceSerial])
cmd.append('shell')
for k, v in self.env.iteritems():
cmd.append("%s=%s" % (k, v))
cmd.append('/system/bin/b2g.sh')
proc = threading.Thread(target=self._save_stdout_proc, args=(cmd, self.queue))
proc.daemon = True
proc.start()
def _save_stdout_proc(self, cmd, queue):
self.stdout_proc = StdOutProc(cmd, queue)
self.stdout_proc.run()
if hasattr(self.stdout_proc, 'processOutput'):
self.stdout_proc.processOutput()
self.stdout_proc.wait()
self.stdout_proc = None
@property
def pid(self):
# a dummy value to make the automation happy
return 0
def getStdoutLines(self, timeout):
# Return any lines in the queue used by the
# b2g process handler.
lines = []
# get all of the lines that are currently available
while True:
try:
lines.append(self.queue.get_nowait())
except Queue.Empty:
break
# wait 'timeout' for any additional lines
if not lines:
try:
lines.append(self.queue.get(True, timeout))
except Queue.Empty:
pass
return lines
def wait(self, timeout=None):
# this should never happen
raise Exception("'wait' called on B2GInstance")
def kill(self):
# this should never happen
raise Exception("'kill' called on B2GInstance")
+401
View File
@@ -0,0 +1,401 @@
# 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/.
import datetime
import glob
import time
import re
import os
import posixpath
import tempfile
import shutil
import subprocess
import sys
from automation import Automation
from mozdevice import DMError, DeviceManager
from mozlog import get_default_logger
import mozcrash
# signatures for logcat messages that we don't care about much
fennecLogcatFilters = [ "The character encoding of the HTML document was not declared",
"Use of Mutation Events is deprecated. Use MutationObserver instead.",
"Unexpected value from nativeGetEnabledTags: 0" ]
class RemoteAutomation(Automation):
_devicemanager = None
# Part of a hack for Robocop: "am COMMAND" is handled specially if COMMAND
# is in this set. See usages below.
_specialAmCommands = ('instrument', 'start')
def __init__(self, deviceManager, appName = '', remoteLog = None,
processArgs=None):
self._devicemanager = deviceManager
self._appName = appName
self._remoteProfile = None
self._remoteLog = remoteLog
self._processArgs = processArgs or {};
# Default our product to fennec
self._product = "fennec"
self.lastTestSeen = "remoteautomation.py"
Automation.__init__(self)
def setDeviceManager(self, deviceManager):
self._devicemanager = deviceManager
def setAppName(self, appName):
self._appName = appName
def setRemoteProfile(self, remoteProfile):
self._remoteProfile = remoteProfile
def setProduct(self, product):
self._product = product
def setRemoteLog(self, logfile):
self._remoteLog = logfile
# Set up what we need for the remote environment
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
env = {}
if dmdPath:
env['MOZ_REPLACE_MALLOC_LIB'] = os.path.join(dmdPath, 'libdmd.so')
# Except for the mochitest results table hiding option, which isn't
# passed to runtestsremote.py as an actual option, but through the
# MOZ_HIDE_RESULTS_TABLE environment variable.
if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
env['MOZ_CRASHREPORTER_DISABLE'] = '1'
# Crash on non-local network connections by default.
# MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
# enable non-local connections for the purposes of local testing.
# Don't override the user's choice here. See bug 1049688.
env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1')
# Send an env var noting that we are in automation. Passing any
# value except the empty string will declare the value to exist.
#
# This may be used to disabled network connections during testing, e.g.
# Switchboard & telemetry uploads.
env.setdefault('MOZ_IN_AUTOMATION', '1')
# Set WebRTC logging in case it is not set yet.
# On Android, environment variables cannot contain ',' so the
# standard WebRTC setting for NSPR_LOG_MODULES is not available.
# env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5')
env.setdefault('R_LOG_LEVEL', '6')
env.setdefault('R_LOG_DESTINATION', 'stderr')
env.setdefault('R_LOG_VERBOSE', '1')
return env
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath, outputHandler=None):
""" Wait for tests to finish.
If maxTime seconds elapse or no output is detected for timeout
seconds, kill the process and fail the test.
"""
# maxTime is used to override the default timeout, we should honor that
status = proc.wait(timeout = maxTime, noOutputTimeout = timeout)
self.lastTestSeen = proc.getLastTestSeen
topActivity = self._devicemanager.getTopActivity()
if topActivity == proc.procName:
proc.kill(True)
if status == 1:
if maxTime:
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
"allowed maximum time of %s seconds" % (self.lastTestSeen, maxTime)
else:
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
"allowed maximum time" % (self.lastTestSeen)
if status == 2:
print "TEST-UNEXPECTED-FAIL | %s | application timed out after %d seconds with no output" \
% (self.lastTestSeen, int(timeout))
return status
def deleteANRs(self):
# empty ANR traces.txt file; usually need root permissions
# we make it empty and writable so we can test the ANR reporter later
traces = "/data/anr/traces.txt"
try:
self._devicemanager.shellCheckOutput(['echo', '', '>', traces], root=True,
timeout=DeviceManager.short_timeout)
self._devicemanager.shellCheckOutput(['chmod', '666', traces], root=True,
timeout=DeviceManager.short_timeout)
except DMError:
print "Error deleting %s" % traces
pass
def checkForANRs(self):
traces = "/data/anr/traces.txt"
if self._devicemanager.fileExists(traces):
try:
t = self._devicemanager.pullFile(traces)
if t:
stripped = t.strip()
if len(stripped) > 0:
print "Contents of %s:" % traces
print t
# Once reported, delete traces
self.deleteANRs()
except DMError:
print "Error pulling %s" % traces
except IOError:
print "Error pulling %s" % traces
else:
print "%s not found" % traces
def deleteTombstones(self):
# delete any existing tombstone files from device
remoteDir = "/data/tombstones"
try:
self._devicemanager.shellCheckOutput(['rm', '-r', remoteDir], root=True,
timeout=DeviceManager.short_timeout)
except DMError:
# This may just indicate that the tombstone directory is missing
pass
def checkForTombstones(self):
# pull any tombstones from device and move to MOZ_UPLOAD_DIR
remoteDir = "/data/tombstones"
blobberUploadDir = os.environ.get('MOZ_UPLOAD_DIR', None)
if blobberUploadDir:
if not os.path.exists(blobberUploadDir):
os.mkdir(blobberUploadDir)
if self._devicemanager.dirExists(remoteDir):
# copy tombstone files from device to local blobber upload directory
try:
self._devicemanager.shellCheckOutput(['chmod', '777', remoteDir], root=True,
timeout=DeviceManager.short_timeout)
self._devicemanager.shellCheckOutput(['chmod', '666', os.path.join(remoteDir, '*')], root=True,
timeout=DeviceManager.short_timeout)
self._devicemanager.getDirectory(remoteDir, blobberUploadDir, False)
except DMError:
# This may just indicate that no tombstone files are present
pass
self.deleteTombstones()
# add a .txt file extension to each tombstone file name, so
# that blobber will upload it
for f in glob.glob(os.path.join(blobberUploadDir, "tombstone_??")):
# add a unique integer to the file name, in case there are
# multiple tombstones generated with the same name, for
# instance, after multiple robocop tests
for i in xrange(1, sys.maxint):
newname = "%s.%d.txt" % (f, i)
if not os.path.exists(newname):
os.rename(f, newname)
break
else:
print "%s does not exist; tombstone check skipped" % remoteDir
else:
print "MOZ_UPLOAD_DIR not defined; tombstone check skipped"
def checkForCrashes(self, directory, symbolsPath):
self.checkForANRs()
self.checkForTombstones()
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
javaException = mozcrash.check_for_java_exception(logcat, test_name=self.lastTestSeen)
if javaException:
return True
# No crash reporting means we can't say anything.
return False
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# If remote profile is specified, use that instead
if (self._remoteProfile):
profileDir = self._remoteProfile
# Hack for robocop, if app & testURL == None and extraArgs contains the rest of the stuff, lets
# assume extraArgs is all we need
if app == "am" and extraArgs[0] in RemoteAutomation._specialAmCommands:
return app, extraArgs
cmd, args = Automation.buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs)
# Remove -foreground if it exists, if it doesn't this just returns
try:
args.remove('-foreground')
except:
pass
#TODO: figure out which platform require NO_EM_RESTART
# return app, ['--environ:NO_EM_RESTART=1'] + args
return app, args
def Process(self, cmd, stdout = None, stderr = None, env = None, cwd = None):
if stdout == None or stdout == -1 or stdout == subprocess.PIPE:
stdout = self._remoteLog
return self.RProcess(self._devicemanager, cmd, stdout, stderr, env, cwd, self._appName,
**self._processArgs)
# be careful here as this inner class doesn't have access to outer class members
class RProcess(object):
# device manager process
dm = None
def __init__(self, dm, cmd, stdout=None, stderr=None, env=None, cwd=None, app=None,
messageLogger=None):
self.dm = dm
self.stdoutlen = 0
self.lastTestSeen = "remoteautomation.py"
self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
self.messageLogger = messageLogger
if (self.proc is None):
if cmd[0] == 'am':
self.proc = stdout
else:
raise Exception("unable to launch process")
self.procName = cmd[0].split('/')[-1]
if cmd[0] == 'am' and cmd[1] in RemoteAutomation._specialAmCommands:
self.procName = app
# Setting timeout at 1 hour since on a remote device this takes much longer.
# Temporarily increased to 90 minutes because no more chunks can be created.
self.timeout = 5400
# The benefit of the following sleep is unclear; it was formerly 15 seconds
time.sleep(1)
# Used to buffer log messages until we meet a line break
self.logBuffer = ""
@property
def pid(self):
pid = self.dm.processExist(self.procName)
# HACK: we should probably be more sophisticated about monitoring
# running processes for the remote case, but for now we'll assume
# that this method can be called when nothing exists and it is not
# an error
if pid is None:
return 0
return pid
def read_stdout(self):
"""
Fetch the full remote log file using devicemanager, process them and
return whether there were any new log entries since the last call.
"""
if not self.dm.fileExists(self.proc):
return False
try:
newLogContent = self.dm.pullFile(self.proc, self.stdoutlen)
except DMError:
# we currently don't retry properly in the pullFile
# function in dmSUT, so an error here is not necessarily
# the end of the world
return False
if not newLogContent:
return False
self.stdoutlen += len(newLogContent)
if self.messageLogger is None:
testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", newLogContent)
if testStartFilenames:
self.lastTestSeen = testStartFilenames[-1]
print newLogContent
return True
self.logBuffer += newLogContent
lines = self.logBuffer.split('\n')
lines = [l for l in lines if l]
if lines:
if self.logBuffer.endswith('\n'):
# all lines are complete; no need to buffer
self.logBuffer = ""
else:
# keep the last (unfinished) line in the buffer
self.logBuffer = lines[-1]
del lines[-1]
if not lines:
return False
for line in lines:
# This passes the line to the logger (to be logged or buffered)
parsed_messages = self.messageLogger.write(line)
for message in parsed_messages:
if isinstance(message, dict) and message.get('action') == 'test_start':
self.lastTestSeen = message['test']
return True
@property
def getLastTestSeen(self):
return self.lastTestSeen
# Wait for the remote process to end (or for its activity to go to background).
# While waiting, periodically retrieve the process output and print it.
# If the process is still running after *timeout* seconds, return 1;
# If the process is still running but no output is received in *noOutputTimeout*
# seconds, return 2;
# Else, once the process exits/goes to background, return 0.
def wait(self, timeout = None, noOutputTimeout = None):
timer = 0
noOutputTimer = 0
interval = 10
if timeout == None:
timeout = self.timeout
status = 0
top = self.procName
slowLog = False
while (top == self.procName):
# Get log updates on each interval, but if it is taking
# too long, only do it every 60 seconds
if (not slowLog) or (timer % 60 == 0):
startRead = datetime.datetime.utcnow()
hasOutput = self.read_stdout()
if (datetime.datetime.utcnow() - startRead) > datetime.timedelta(seconds=5):
slowLog = True
if hasOutput:
noOutputTimer = 0
time.sleep(interval)
timer += interval
noOutputTimer += interval
if (timer > timeout):
status = 1
break
if (noOutputTimeout and noOutputTimer > noOutputTimeout):
status = 2
break
top = self.dm.getTopActivity()
# Flush anything added to stdout during the sleep
self.read_stdout()
return status
def kill(self, stagedShutdown = False):
if stagedShutdown:
# Trigger an ANR report with "kill -3" (SIGQUIT)
self.dm.killProcess(self.procName, 3)
time.sleep(3)
# Trigger a breakpad dump with "kill -6" (SIGABRT)
self.dm.killProcess(self.procName, 6)
# Wait for process to end
retries = 0
while retries < 3:
pid = self.dm.processExist(self.procName)
if pid and pid > 0:
print "%s still alive after SIGABRT: waiting..." % self.procName
time.sleep(5)
else:
return
retries += 1
self.dm.killProcess(self.procName, 9)
pid = self.dm.processExist(self.procName)
if pid and pid > 0:
self.dm.killProcess(self.procName)
else:
self.dm.killProcess(self.procName)
+1 -1
View File
@@ -15,7 +15,7 @@ ifndef JS_STANDALONE
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
include $(topsrcdir)/toolkit/mozapps/installer/upload-files.mk
# Clear out DIST_FILES if it was set
# Clear out DIST_FILES if it was set by upload-files.mk (for Android builds)
DIST_FILES =
endif
+7 -1
View File
@@ -3,6 +3,9 @@
# 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 = ('Core', 'Build Config')
# This cannot be named "build" because of bug 922191.
SPHINX_TREES['buildsystem'] = 'docs'
@@ -11,6 +14,9 @@ if CONFIG['OS_ARCH'] == 'WINNT':
else:
DIRS += ['unix']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['annotationProcessors']
for var in ('GRE_MILESTONE',
'MOZ_APP_VERSION',
'MOZ_APP_BASENAME',
@@ -64,7 +70,7 @@ if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']:
if CONFIG['MOZ_APP_BASENAME']:
FINAL_TARGET_PP_FILES += ['application.ini']
if CONFIG['MOZ_UPDATER']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
FINAL_TARGET_PP_FILES += ['update-settings.ini']
if CONFIG['MOZ_APP_STATIC_INI']:
+149
View File
@@ -0,0 +1,149 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
js_option('--with-android-ndk', nargs=1,
help='location where the Android NDK can be found')
js_option('--with-android-toolchain', nargs=1,
help='location of the Android toolchain')
js_option('--with-android-gnu-compiler-version', nargs=1,
help='GNU compiler version to use')
min_android_version = dependable(lambda: '9')
js_option('--with-android-version',
nargs=1,
help='android platform version',
default=min_android_version)
@depends('--with-android-version', min_android_version)
@imports(_from='__builtin__', _import='ValueError')
def android_version(value, min_version):
if not value:
# Someone has passed --without-android-version.
die('--with-android-version cannot be disabled.')
try:
version = int(value[0])
except ValueError:
die('--with-android-version expects an integer value')
if version < int(min_version):
die('--with-android-version must be at least %s (got %s)',
min_version, value[0])
return version
add_old_configure_assignment('android_version', android_version)
@depends('--with-android-ndk', build_project)
def ndk(value, build_project):
if build_project == 'mobile/android' and not value:
die('You must specify --with-android-ndk=/path/to/ndk when '
'building mobile/android')
if value:
return value[0]
set_config('ANDROID_NDK', ndk)
add_old_configure_assignment('android_ndk', ndk)
@depends(target, android_version, ndk)
@checking('for android platform directory')
@imports(_from='os.path', _import='isdir')
def android_platform(target, android_version, ndk):
if target.os != 'Android':
return
if 'mips' in target.cpu:
target_dir_name = 'mips'
elif 'aarch64' == target.cpu:
target_dir_name = 'arm64'
else:
target_dir_name = target.cpu
# Not all Android releases have their own platform release. We use
# the next lower platform version in these cases.
if android_version in (11, 10):
platform_version = 9
elif android_version in (20, 22):
platform_version = android_version - 1
else:
platform_version = android_version
platform_dir = os.path.join(ndk,
'platforms',
'android-%s' % platform_version,
'arch-%s' % target_dir_name)
if not isdir(platform_dir):
die("Android platform directory not found. With the current "
"configuration, it should be in %s" % platform_dir)
return platform_dir
add_old_configure_assignment('android_platform', android_platform)
@depends(android_platform)
def extra_toolchain_flags(platform_dir):
if not platform_dir:
return []
return ['-idirafter',
os.path.join(platform_dir, 'usr', 'include')]
@depends(target, host, ndk, '--with-android-toolchain',
'--with-android-gnu-compiler-version')
@checking('for the Android toolchain directory', lambda x: x or 'not found')
@imports(_from='os.path', _import='isdir')
@imports(_from='mozbuild.shellutil', _import='quote')
def android_toolchain(target, host, ndk, toolchain, gnu_compiler_version):
if not ndk:
return
if toolchain:
return toolchain[0]
else:
if target.cpu == 'arm' and target.endianness == 'little':
target_base = 'arm-linux-androideabi'
elif target.cpu == 'x86':
target_base = 'x86'
elif target.cpu == 'mips32' and target.endianness == 'little':
target_base = 'mipsel-linux-android'
elif target.cpu == 'aarch64' and target.endianness == 'little':
target_base = 'aarch64-linux-android'
else:
die('Target cpu is not supported.')
toolchain_format = '%s/toolchains/%s-%s/prebuilt/%s-%s'
for version in gnu_compiler_version or ['4.9', '4.8', '4.7']:
toolchain = toolchain_format % (ndk, target_base, version,
host.kernel.lower(), host.cpu)
log.debug('Trying %s' % quote(toolchain))
if not isdir(toolchain) and host.cpu == 'x86_64':
toolchain = toolchain_format % (ndk, target_base, version,
host.kernel.lower(), 'x86')
log.debug('Trying %s' % quote(toolchain))
if isdir(toolchain):
return toolchain
else:
if gnu_compiler_version:
die('Your --with-android-gnu-compiler-version may be wrong')
die('You have to specify --with-android-toolchain='
'/path/to/ndk/toolchain.')
set_config('ANDROID_TOOLCHAIN', android_toolchain)
@depends(target, android_toolchain)
def android_toolchain_prefix(target, toolchain):
if toolchain:
if target.cpu == 'x86':
# Ideally, the --target should just have the right x86 variant
# in the first place.
return '%s/bin/i686-linux-android-' % toolchain
return '%s/bin/%s-' % (toolchain, target.toolchain)
imply_option('--with-toolchain-prefix', android_toolchain_prefix,
reason='--with-android-ndk')
+3 -2
View File
@@ -42,10 +42,11 @@ def compiler_class(compiler):
def checking_fn(fn):
return fn
@depends_when(self, dependable(flags), when=when)
@depends_when(self, dependable(flags), extra_toolchain_flags, when=when)
@checking_fn
def func(compiler, flags):
def func(compiler, flags, extra_flags):
flags = flags or []
flags += extra_flags or []
flags.append('-c')
if try_invoke_compiler(
Loaded 100 of 3012 files, more files were not shown because too many files have changed in this diff. Show more