Closed Bug 1200426 Opened 6 years ago Closed 6 years ago

Convert PROCESS_OBJECT event to native call

Categories

(Core :: Widget: Android, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(2 files)

PROCESS_OBJECT event in GeckoEvent is used to set the GeckoLayerClient object in Gecko. We can convert it to a native call in GeckoView.
When we queue native calls in GeckoThread, we try to deduce the
types of the arguments through Object.getClass(). However, there are
cases where this could fail. For example, the argument could be null,
or could be a String instance but the parameter type is really
CharSequence.

This patch introduces a way to optionally include parameter types for
the queued call. When a passed-in argument is a Class instance, it is
treated as the type for the next queued parameter, and the next argument
is treated as the value for the queued parameter. For example,

> // Queue a call with CharSequence parameter, using a String argument.
> GeckoThread.queueNativeCall(..., CharSequence.class, "123");

> // Queue a call with String parameter, using a null argument.
> GeckoThread.queueNativeCall(..., String.class, null);

Deduction is still performed when the type is missing:

> // Queue a call with int, String, and boolean parameter.
> GeckoThread.queueNativeCall(..., 42, "123", true);

> // Queue the same call but with a null argument.
> GeckoThread.queueNativeCall(..., 42, String.class, null, true);
Attachment #8666779 - Flags: review?(snorp)
The PROCESS_OBJECT GeckoEvent is used to set the layer client object in
Gecko once Gecko is done loading. This patch converts it to a native
call in GeckoView.Window.

Because the native method has an Object parameter, we need the first patch
in order to queue a call to it using GeckoThread.
Attachment #8666781 - Flags: review?(snorp)
Attachment #8666779 - Flags: review?(snorp) → review+
Attachment #8666781 - Flags: review?(snorp) → review+
sorry had to back this out since this or the other checkin caused https://treeherder.mozilla.org/logviewer.html#?job_id=15360927&repo=mozilla-inbound
https://hg.mozilla.org/mozilla-central/rev/8ca3465da606
https://hg.mozilla.org/mozilla-central/rev/dee668cc4bb8
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Flags: needinfo?(nchen)
You need to log in before you can comment on or make changes to this bug.