Closed Bug 1012722 Opened 10 years ago Closed 10 years ago

Switch GeckoApp/BrowserApp listeners to using NativeJSObject

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 32

People

(Reporter: jchen, Assigned: jchen)

Details

Attachments

(2 files)

      No description provided.
This patch switches most of the event listeners in GeckoApp to using NativeJSObject. A few events are not switched over because switching is more complicated. For example, events used by Robocop (Gecko:Ready, etc) are not switched because Robocop doesn't support NativeJSObject yet. I want to work on these events in follow-up bugs.
Attachment #8425616 - Flags: review?(mark.finkle)
Same for BrowserApp
Attachment #8425619 - Flags: review?(mark.finkle)
Comment on attachment 8425616 [details] [diff] [review]
Switch most GeckoApp event listeners to native (v1)

>     /**
>      * @param aPermissions
>      *        Array of JSON objects to represent site permissions.
>      *        Example: { type: "offline-app", setting: "Store Offline Data", value: "Allow" }
>      */
>-    private void showSiteSettingsDialog(String aHost, JSONArray aPermissions) {
>+    private void showSiteSettingsDialog(final String aHost, final NativeJSObject[] aPermissions) {

Since you are making changes here, could you remove the "a" prefixes? Looks like this function is an odd-ball in the file.

>-            "NativeApp:IsDebuggable",
>-            "SystemUI:Visibility");
>+        EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener)this,
>+                "Gecko:Ready",
>+                "Gecko:DelayedStartup",

Did you mean to indent two "blocks" ? One 4-space indent seems typical.

>+        EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener)this,
>+                "Accessibility:Ready",
>+                "Bookmark:Insert",

Same

>-            "NativeApp:IsDebuggable",
>-            "SystemUI:Visibility");
>+        EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
>+                "Gecko:Ready",
>+                "Gecko:DelayedStartup",
>+                "Accessibility:Event",
>+                "NativeApp:IsDebuggable");
>+
>+        EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener)this,
>+                "Accessibility:Ready",
>+                "Bookmark:Insert",

Same
Attachment #8425616 - Flags: review?(mark.finkle) → review+
Comment on attachment 8425619 [details] [diff] [review]
Switch most BrowserApp event listeners to native (v1)

>diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java

>         EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener)this,
>-            "CharEncoding:Data",
>-            "CharEncoding:State",
>+                "Menu:Update",
>+                "Reader:Added",

Indents again

>+        EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener)this,
>+                "Accounts:Create",
>+                "CharEncoding:Data",

Same


>         EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
>-            "CharEncoding:Data",
>-            "CharEncoding:State",
>-            "Feedback:LastUrl",
>+                "Menu:Update",
>+                "Reader:Added",

Same

>+        EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener)this,
>+                "Accounts:Create",
>+                "CharEncoding:Data",
>+                "CharEncoding:State",

Same
Attachment #8425619 - Flags: review?(mark.finkle) → review+
(In reply to Mark Finkle (:mfinkle) from comment #3)
> Comment on attachment 8425616 [details] [diff] [review]
> Switch most GeckoApp event listeners to native (v1)
> 
> >-            "NativeApp:IsDebuggable",
> >-            "SystemUI:Visibility");
> >+        EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener)this,
> >+                "Gecko:Ready",
> >+                "Gecko:DelayedStartup",
> 
> Did you mean to indent two "blocks" ? One 4-space indent seems typical.

I remember someone talking about the style being 2 indents for overhanging lines, but I agree I usually see 1 indent being used.


https://hg.mozilla.org/integration/fx-team/rev/bfcd487240a0
https://hg.mozilla.org/integration/fx-team/rev/d151cf4059fa
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/bfcd487240a0
https://hg.mozilla.org/mozilla-central/rev/d151cf4059fa
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 32
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: