Commit Graph

196 Commits

Author SHA1 Message Date
Jim Chen
62e0b641a7 Bug 1333590 - 7. Add more callback tests to testEventDispatcher; r=snorp
Add more callback tests to testEventDispatcher,

1) Test for checking that the callback for a Gecko thread event,
dispatched from Gecko, is synchronous. We depend on this behavior in
several places where we require a "function call" style event.

2) Test for checking that callbacks accept a variety of data types as
the response object, including the standard types supported by
GeckoBundle, as well as primitive types that are convertible to standard
types.
2017-02-01 17:35:45 -05:00
Jim Chen
c9a4e01072 Bug 1333590 - 6. Remove GeckoEventListener and NativeEventListener; r=snorp r=sebastian
Remove GeckoEventListener and NativeEventListener now that we uniformly
use BundleEventListener. Also remove related classes NativeJSContainer,
NativeJSObject, and GeckoRequest, as well as related tests and C++
code.

The "Messaging" object in Messaging.jsm is replaced with a dummy object
that redirect calls to the global and/or window event dispatcher.
2017-02-01 17:35:45 -05:00
Jim Chen
735fe99d21 Bug 1333590 - 5. Support other primitive types in event callback; r=snorp
Add support for byte, short, float, long, and char types as the response
object for event callbacks.
2017-02-01 17:35:45 -05:00
jwu
5b02eb2870 Bug 1237956 - Use temporary folder instead of modifying the filename while uploading, r=sebastian
MozReview-Commit-ID: 3MQWkPOIRGB

--HG--
extra : rebase_source : 3f7994ee1124e98139c8d4079129b2262c0524b3
2017-01-25 15:56:23 +08:00
Eugen Sawin
714ebcecb4 Bug 1323429 - [2.1] Remove the context reference from Clipboard. r=jchen 2017-01-26 15:52:21 +01:00
Eugen Sawin
e03bb44096 Bug 1333241 - [1.0] Initialize screen orientation on instantiation. r=jchen 2017-01-24 21:47:08 +01:00
Jim Chen
8b160783a8 Bug 1319660 - Fix possible crash when editing contentEditable; r=esawin r=masayuki r=smaug
Bug 1319660 - 1. Don't take shortcut if old replacement ranges don't match; r=esawin

The block at [1] is a shortcut we take when we reconcile Java text
changes with Gecko text changes. However, we only checked that the new
ranges are the same, i.e. that the new Gecko text is the same as the new
Java text. We should also be checking that the old ranges are the same,
i.e. that the replaced Gecko text is the same as the replaced Java text.

[1] https://dxr.mozilla.org/mozilla-central/rev/bbbd2f7539f224a482cc6d2dd10e6a5f31c8baf3/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java#1233

Bug 1319660 - 2. Use previous node instead of sibling when adjusting last node; r=masayuki r=smaug

nsContentIterator in pre mode adjusts its last node if the node is a
childless node like <br>. However, right now it's using GetPrevSibling,
which can lead to error in some edge cases such as:

<p></p><div><br></div>

In this case, if the last node is <br> with offset 0, GetPrevSibling
will return <p> because <p> is <br>'s parent's previous sibling, and the
last node will be set to <p>. However, the correct last node in this
case is <div>, because <br> with offset 0 refers to the position to the
left of <br>, which is <div> with offset 0. In this case, PrevNode
returns the correct <div> value, so we should set the last node to the
result of PrevNode.

For the first node, for a childless node in pre mode, GetNextSibling and
NextNode are the same, so there is no bug in this case. Nevertheless,
this patch changes the call to NextNode to be consistent with calling
PrevNode for the last node.

Bug 1319660 - 3. Add test for correctly adjusting last node in content iterator; r=masayuki

Add a test for the previous patch that makes sure querying selected text
in an edge case works correctly.

Bug 1319660 - 4. Add test for start node regression; r=me

Add a new test case for the NextNode() regression. r=me for trivial
test-only patch.

Bug 1319660 - 5. Restore GetNextSibling call for first node of pre-content-iterator; r=smaug

The last patch changed the `GetNextSibling()` call to `NextNode()`
because I assumed they're equivalent in this case. That turned out to
not be the case because we can reach this line even if the node has
children -- the index just has to be after the last child. So this patch
restores the `GetNextSibling` call to restore the correct behavior.

I also added some comment to clarify that we can reach this line due to
one of two conditions: 1) the node has no children; 2) the node has
children but the index is after the last child.

This patch also replaces the `HasChildren()` check when setting
`cChild`.  If the index is after the last child (i.e. index ==
childCount), `GetChildAt()` fails and we erroneously log an assertion
warning, even though the input was valid. The new check handles all
cases whether start node has children or not.
2017-01-23 14:35:04 -05:00
Ryan VanderMeulen
9e4ddf00bd Backed out 3 changesets (bug 1319660) for causing bug 1329446.
Backed out changeset d506d3c193c9 (bug 1319660)
Backed out changeset 93353b53a706 (bug 1319660)
Backed out changeset 9a7c2edd54b8 (bug 1319660)

--HG--
extra : rebase_source : 43ad1287462697f2312aa18925a462eb85c52495
2017-01-18 10:55:53 -05:00
Randall Barker
440ada1d59 Bug 1331116 - part 2, Remove unused SnapMetrics class r=jchen 2017-01-17 18:47:20 -08:00
Randall Barker
937209439a Bug 1331116 - part 1, Remove unused ProgressiveUpdateData.java r=jchen 2017-01-17 18:47:20 -08:00
maliu
e830e5cda0 Bug 1320072 - Support direct search from intent, r=sebastian
MozReview-Commit-ID: GAoC4jKVyl7

--HG--
extra : rebase_source : 1df217a86397aac7958885bd9ee7853d47c33e5a
2016-11-30 20:25:32 +08:00
Jim Chen
f48add8fb6 Bug 1330515 - Try to recover from IME errors; r=esawin
Instead of throwing IME exceptions, try to recover from IME errors by
flushing the entire text unless we already tried that before. This
prevents annoying crashes, and deals with known IME bugs that are too
risky to uplift to older releases.
2017-01-13 14:39:27 -05:00
Jim Chen
3b07a04a6b Bug 1330458 - Queue undipatched events before Gecko is ready; r=snorp
To deal with the Java side trying to send events to Gecko before Gecko
is ready, make a special exception to queue any undispatched events when
Gecko is not ready, so that the events can be redispatched to Gecko
later.
2017-01-13 14:39:27 -05:00
Tom Ritter
c123b23b46 Bug 1314784 - Add an 'Is Orbot Installed' telemetry probe. r=bsmedberg,sebastian
MozReview-Commit-ID: IlTLcVtycj8

--HG--
extra : rebase_source : 4ca3b38b231896073fcba32d31ae35ce849aa54e
2017-01-10 14:13:15 -06:00
Jim Chen
34b69f4bac Bug 1325156 - 1. Add complete Bundle/JSONObject conversion methods to GeckoBundle; r=sebastian
In addition to the existing fromJSONObject method, add fromBundle,
toBundle, and toJSONObject methods to GeckoBundle, so a GeckoBundle can
be easily converted to/from Bundle and JSONObject.
2017-01-10 23:00:57 -05:00
Jim Chen
aa76b81db3 Bug 1328115 - 1. Test vsync support in native code; r=snorp
Don't go through the VsyncSource Java class to test support for vsync.
Because VsyncSource references symbols from API 16+, Dalvik fails to
load it for API 15 and below. Also make several other changes in
VsyncSource, including removing the unnecessary JNIObject superclass,
and refactoring the instance initialization code, which fixes a possible
race when initializing.
2017-01-09 14:10:23 -05:00
Phil Ringnalda
c83d1d7ce9 Merge m-i to m-c, a=merge
MozReview-Commit-ID: 51FMtH1yTe6
2017-01-04 18:33:32 -08:00
Jim Chen
cdb5767ec4 Bug 1319660 - 1. Don't take shortcut if old replacement ranges don't match; r=esawin
The block at [1] is a shortcut we take when we reconcile Java text
changes with Gecko text changes. However, we only checked that the new
ranges are the same, i.e. that the new Gecko text is the same as the new
Java text. We should also be checking that the old ranges are the same,
i.e. that the replaced Gecko text is the same as the replaced Java text.

[1] https://dxr.mozilla.org/mozilla-central/rev/bbbd2f7539f224a482cc6d2dd10e6a5f31c8baf3/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java#1233
2017-01-04 14:46:10 -05:00
Jim Chen
34ae4d687c Bug 1325155 - 1. Add Object overrides for GeckoBundle; r=sebastian
Add overrides for Object methods in GeckoBundle, and redirected them to
the corresponding methods in SimpleArrayMap. For equals, a custom
implementation is used because the equals implementation in
SimpleArrayMap had bugs across different support library versions.
2016-12-28 17:49:28 -05:00
Adrian Zatreanu
c57580a398 Bug 1316008: Use explicit charset encoding r=nechen,sebastian
MozReview-Commit-ID: 3y2CKQZrLtl

--HG--
extra : rebase_source : b75b5f59c7d9e6ef95a06dde982f8a70a352649b
2016-11-29 20:42:08 +02:00
John Lin
d6335c2417 Bug 1075025 - part 1: receive vsync events through Choreographer. r=snorp
MozReview-Commit-ID: 69MefRKMWmh
2016-12-22 12:55:19 +08:00
Jim Chen
23c3c2e325 Bug 1323576 - Convert GeckoNetworkManager events to bundle events; r=sebastian
Convert "Wifi:Enable" and "Wifi:GetIPAddress" events to GeckoBundle
events. Use the UI thread because we do things like starting activities
and using system services, which are best done on the UI thread.
2016-12-18 08:10:18 -05:00
Nick Alexander
56fbd14e28 Bug 1291366 - Part 3: Generate o.m.geckoview.BuildConfig using Gradle. r=sebastian
There's still work to be done here to unify these two processes, but
that can be follow-up.  In any case, geckoview.BuildConfig should
change very infrequently, and we're hoping to transition to Gradle
eventually.

MozReview-Commit-ID: D2c6XTYqubj

--HG--
extra : rebase_source : 107febdd97899f29fa493925c70252738fb666b9
2016-11-17 14:22:28 -08:00
Nick Alexander
d97195fefa Bug 1291366 - Part 2: Add o.m.geckoview.BuildConfig. r=sebastian
This is the first, mostly mechanical, introduction of a GeckoView
specific BuildConfig.

We have a few "debug logging" like checks.  I introduced a
MOZILLA_OFFICIAL abstraction and removed some of the checks as I saw
fit.  Subsequent patches will remove more of these checks.

With this change applied, Gradle is broken, because there will be
duplicate BuildConfig files included in the build.  That will be fixed
in subsequent patches.

MozReview-Commit-ID: KHhV32o5j5A

--HG--
extra : rebase_source : 8b0991fb6ab47bc02ca2b55be8fbaf397740e453
2016-12-14 20:26:03 -08:00
Nick Alexander
174dc9b176 Bug 1291366 - Pre: Don't check against {MIN,MAX}_SDK_VERSION. r=sebastian
This had some value for Fennec when we shipped split APKs.  Since we
don't, there's little value left; and there's definitely no value for
GeckoView, which will only ever ship a single library AAR for all
consumers.  (That library AAR will have a minimum SDK, but it'll be
enforced by the Gradle build system, not by runtime checks.)

MozReview-Commit-ID: 3l0jUKdCepS

--HG--
extra : rebase_source : ca7678ac6a96d70ec2da638fe0f8b6132b3c14f1
2016-11-14 20:46:31 -08:00
Nick Alexander
6265973a09 Bug 1291366 - Pre: Inline AppConstants.Versions in GeckoView. r=sebastian
This patch inlines most uses of Versions in GeckoView.

The Android linter can check that symbols only defined in particular
versions of Android are only accessed behind safe guards.  However,
our Versions symbolic constants defeat the Android linter's simplistic
code analysis.  The value of the linter is (much!) greater than the
explanatory value of our symbolic constants, especially for GeckoView,
which will only ever ship a single library AAR suitable for all
consumers.

I manually tried to squash a few linter errors; subsequent tickets
will track enabling the linter for GeckoView specifically, and burning
down the remaining linter version errors.

MozReview-Commit-ID: cZmNehx8tR

--HG--
extra : rebase_source : a8fcf08d2edaec504c73c1eb8f399fbb581123e0
2016-12-16 15:50:07 -08:00
Nick Alexander
bb60f7a80a Bug 1321638 - Part 4: Remove last GeckoInterface.getActivity call in geckoview. r=jchen
This API is vestigial.

Sadly we can't remove GeckoInterface.getActivity entirely since there
are still some Fennec consumers that I don't care to unravel just yet.

MozReview-Commit-ID: HX038okB4sR

--HG--
extra : rebase_source : 4c82e7d186a7b4e93e826f60e7e7ea8af6e851cf
2016-12-13 21:52:26 -08:00
Nick Alexander
bac0316cde Bug 1321638 - Part 3: Add ScreenOrientationDelegate. r=jchen
This patch abstracts setting the screen orientation into an interface
(but not into the already overloaded GeckoInterface).

I feel this form obscures the (eventual) connection between the
GeckoView widget and its embedding Activity, but it removes the
explicit getActivity() and it's certainly simpler than previous
iterations.

MozReview-Commit-ID: 8a8bPTlcp3T

--HG--
extra : rebase_source : 4817140c7142abbcb589495ce2d3c169ca0bd9df
2016-12-16 15:45:27 -08:00
Nick Alexander
e8830b213b Bug 1321638 - Part 2: Remove fullscreen support for GeckoView consumers. r=jchen
As implemented right now, this doesn't make sense for general
GeckoView consumers.

I believe fullscreen will be important to GeckoView consumers -- games
in particular will want it -- but we'll need to think harder about how
to support it, how to support it with multiple GeckoViews, and how to
ensure we persist the fullscreen state across device configuration
changes, etc.

MozReview-Commit-ID: 5sjNx1hovvt

--HG--
extra : rebase_source : 33d28838ec807e7f6bf589245e755eb9c451d94e
2016-12-02 16:23:54 -08:00
Nick Alexander
4caab329ed Bug 1321638 - Part 1: Remove "app.orientation.default". r=jchen
This was added for the Android Web App Runtime in Bug 776600.  If it
was ever used, it's definitely not now.  In addition, fishing the
default orientation from Gecko prefs in a constructor that is
implicitly called from a static singleton initializer is unreliable,
so this probably was never robust.  The comments on the ticket say as
much.

MozReview-Commit-ID: E8oz7JsB6oB

--HG--
extra : rebase_source : a77158564f6de73b0673b3720be49d87f89b1377
2016-12-01 13:43:21 -08:00
Phil Ringnalda
f680e72cc6 Merge m-i to m-c, a=merge
MozReview-Commit-ID: 4iKvEwhyJQJ
2016-12-15 17:47:41 -08:00
Eugen Sawin
cbc1668ca6 Bug 1322585 - [1.0] Remove GeckoView.Browser. r=snorp 2016-12-15 20:22:11 +01:00
Eugen Sawin
6ac3765414 Bug 1322584 - [1.0] Remove GeckoView.ChromeDelegate.onScriptMessage. r=snorp 2016-12-15 20:22:10 +01:00
Eugen Sawin
fa847d4f26 Bug 1322582 - [1.0] Remove GeckoView.ChromeDelegate.onReady. r=snorp 2016-12-15 20:21:46 +01:00
Nevin Chen
91bd753d3a Bug 1278245 - If a space is found, we assume this is a search query. r=ahunt
MozReview-Commit-ID: EfenqXSlaWj

--HG--
extra : rebase_source : 3934445d279a5f438294abed4a6b315eda6a2d33
2016-11-29 11:33:27 +08:00
Jim Chen
e3b91096b5 Bug 1322710 - Don't use SpannableStringBuilder.equals; r=esawin
Don't use the system SpannableStringBuilder.equals implementation,
because of a bug in Android N+ that incorrectly compares spans.
2016-12-13 03:21:46 -05:00
Eugen Sawin
c103851dcd Bug 1322765 - [1.0] Move service declarations into application scope. r=rbarker 2016-12-09 13:51:29 -10:00
Jim Chen
e9532b9a3f Bug 1321418 - Use GekcoBundle events in GeckoApp/BrowserApp; r=snorp r=sebastian r=gbrown
Bug 1321418 - 1. Use GekcoBundle events in GeckoApp; r=snorp r=sebastian

Switch GeckoApp to using GeckoBundle events everywhere. UI or Gecko
events are used if the event requires the UI or Gecko thread,
respectively, and background events are used for all other events.

There are changes to some other Java classes, such as SnackbarBuilder
and GeckoAccessibility, due to the switch to GeckoBundle.

For "Snackbar:Show", we need the global EventDispatcher because the
event can be sent to both GeckoApp and GeckoPreferences. Howveer, we
only want one listener registered at the same time, so we register and
unregister in GeckoApp's and GeckoPreferences's onPause and onResume
methods.

Bug 1321418 - 2. Use appropriate JS EventDispatcher to send GeckoApp events; r=snorp r=sebastian

Change JS code that sends events to GeckoApp to use either the global
EventDispatcher or the per-window EventDispatcher.

"Session:StatePurged" is not used so it's removed. "Gecko:Ready" in
geckoview.js is not necessary because it's only used for GeckoApp, so
it's removed from geckoview.js.

Bug 1321418 - 3. Use GeckoBundle events in BrowserApp; r=snorp r=sebastian

Switch BrowserApp to using GeckoBundle events, in a similar vein as
GeckoApp. UI or Gecko events are used if the event handlers required UI
or Gecko thread, respectively, and background events are used for all
other events.

Some other Java classes also have to be modified as a result of
switching to GeckoBundle.

Bug 1321418 - 4. Use global EventDispatcher to send BrowserApp events; r=snorp r=sebastian

Change JS code that sends events to BrowserApp to use the global
EventDispatcher instead of "Messaging".

Bug 1321418 - 5. Update usages of events in tests; r=gbrown

Update cases where we use or wait for events in tests.
2016-12-09 12:32:45 -05:00
Dylan Roeh
9ff1fe4af5 Bug 1235431 - Implement windowClient.focus() for Fennec. r=catalinb 2016-11-14 17:22:13 -06:00
Jim Chen
8eb5680901 Bug 1321562 - Fix bugs in GeckoBundle.fromJSONObject; r=me
Fix a crash in GeckoBundle.fromJSONObject due to wrong values array
type. Also, fix a bug where the first element of a converted array is
repeated. r=me for trivial patch.
2016-12-01 12:25:22 -05:00
Jim Chen
edb09e5551 Bug 1319496 - 3. Convert prompts to BundleEventListener; r=sebastian
Convert prompts to use BundleEventListener and GeckoBundle.

DefaultDoorHanger.setOptions accepts a JSONObject argument, but if we
converted it to GeckoBundle, it would involve a lot of extra changes in
the other doorhanger code. So this patch adds GeckoBundle.fromJSONObject
and converts JSONObject to GeckoBundle within
DefaultDoorHanger.setOptions. In the future, another patch would convert
all doorhanger code to use GeckoBundle instead of JSONObject.
2016-11-29 12:25:53 -05:00
Jim Chen
cc57abd3cd Bug 1319496 - 1. Fix GeckoBundle array handling; r=snorp
Fix several bugs when handling arrays in GeckoBundle.

1. Correctly return null when getting an array that is not in the
   bundle, instead of crashing.

2. Convert object arrays to GeckoBundle arrays in EventDispatcher
   instead of leaving it as a single GeckoBundle with integer keys, due
   to lack of object array support in NativeJSObject.toBundle.

3. Return error when trying to convert a JS array of arrays to
   GeckoBundle, instead of crashing.

4. Add convenience methods for setting arrays; for example, setting
   boolean arrays from Boolean[] and Collection<Boolean>.
2016-11-29 12:25:52 -05:00
Nevin Chen
7d8bc9ace3 Bug 1240560 - After shortcut is created, show the mobile desktop. r=sebastian
MozReview-Commit-ID: 21YzmJfNC6E

--HG--
extra : rebase_source : 130a84c9c01b57b730863a99b8507fb36bc93626
2016-11-24 10:57:19 +08:00
Nevin Chen
4b0c2fb780 Bug 1240560 - Extract goToHomeScreen() method to AcitvityUtils r=sebastian
MozReview-Commit-ID: 5w4ywPhDtAy

--HG--
extra : rebase_source : 048a3b5c6c0fff93ff9e92ce25d738c3de7afbdd
2016-11-24 10:54:49 +08:00
James Cheng
3f263dd616 Bug 1317239 - Part1 - Add an API to ask if the codec support adaptive playback. r=jolin
MozReview-Commit-ID: 7Pgj9hFE6pu

--HG--
extra : rebase_source : bc2b6b0c5052655c9e2ea0f8f44dd31169a40a75
2016-11-23 14:11:22 +08:00
Randall Barker
cbb0be79dc Bug 1318245 - Prevent intermittent crash in Fennec by removing unneeded call to IBinder.unlinkToDeath during child service process shutdown r=snorp 2016-11-21 09:36:26 -08:00
Jim Chen
c2f64f66ce Bug 1317604 - 2. Rip out GeckoView event listeners; r=snorp
GeckoView's GeckoEventListener and NativeEventListener are not actually
hooked up to events right now, so it's better to just rip them out until
we figure out a better implementation in the future.
2016-11-21 10:01:30 -05:00
Randall Barker
5f5999162e Bug 1314466 - part 6, Add new files to build r=nalexander 2016-11-14 16:45:23 -08:00
Randall Barker
de17af98b5 Bug 1314466 - part 5, Add service process manager r=snorp 2016-11-14 16:45:23 -08:00
James Willcox
7a2672f6a2 Bug 1314974 - Make GeckoView on Android work again r=jchen
--HG--
rename : mobile/android/base/java/org/mozilla/gecko/ScreenManagerHelper.java => mobile/android/geckoview/src/main/java/org/mozilla/gecko/ScreenManagerHelper.java
2016-11-14 14:55:29 -06:00