ButtonToast tries to modify views it can't

RESOLVED FIXED in Firefox 27

Status

()

Firefox for Android
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: errietta, Assigned: errietta)

Tracking

Trunk
Firefox 27
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36

Steps to reproduce:

Tried to add code that displays a buttontoast..
        win.NativeWindow.toast.show("text", "long", {
          button: {
            label: "....",
            icon: "drawable://alert_app",
            callback: function() {
            }
          }
        });



Actual results:

The call sometimes fails, with the following:
E/GeckoApp(14811): Exception handling message "Toast:Show":
E/GeckoApp(14811): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/GeckoApp(14811):      at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4039)
E/GeckoApp(14811):      at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:709)
E/GeckoApp(14811):      at android.view.View.requestLayout(View.java:12863)
E/GeckoApp(14811):      at android.view.View.requestLayout(View.java:12863)
E/GeckoApp(14811):      at android.view.View.requestLayout(View.java:12863)
E/GeckoApp(14811):      at android.view.View.requestLayout(View.java:12863)
E/GeckoApp(14811):      at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:273)
E/GeckoApp(14811):      at android.view.View.requestLayout(View.java:12863)
E/GeckoApp(14811):      at android.view.View.setFlags(View.java:6783)
E/GeckoApp(14811):      at android.view.View.setVisibility(View.java:4680)
E/GeckoApp(14811):      at org.mozilla.gecko.widget.ButtonToast.show(ButtonToast.java:124)
E/GeckoApp(14811):      at org.mozilla.gecko.widget.ButtonToast.show(ButtonToast.java:103)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoApp$10.onBitmapFound(GeckoApp.java:843)
E/GeckoApp(14811):      at org.mozilla.gecko.gfx.BitmapUtils.getDrawable(BitmapUtils.java:89)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoApp.showButtonToast(GeckoApp.java:841)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoApp.handleMessage(GeckoApp.java:539)
E/GeckoApp(14811):      at org.mozilla.gecko.BrowserApp.handleMessage(BrowserApp.java:1140)
E/GeckoApp(14811):      at org.mozilla.gecko.util.EventDispatcher.dispatchEvent(EventDispatcher.java:96)
E/GeckoApp(14811):      at org.mozilla.gecko.util.EventDispatcher.dispatchEvent(EventDispatcher.java:58)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoAppShell.handleGeckoMessage(GeckoAppShell.java:2281)
E/GeckoApp(14811):      at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
E/GeckoApp(14811):      at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
E/GeckoApp(14811):      at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoAppShell.runGecko(GeckoAppShell.java:339)
E/GeckoApp(14811):      at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:176)


Expected results:

The views should be touched on the right thread, and the buttontoast should display
(Assignee)

Comment 1

5 years ago
Created attachment 811575 [details] [diff] [review]
proposed fix
Attachment #811575 - Flags: review?(lucasr.at.mozilla)
Blocks: 910768
Comment on attachment 811575 [details] [diff] [review]
proposed fix

Review of attachment 811575 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for the patch Errieta. Nice catch.
Attachment #811575 - Flags: review?(lucasr.at.mozilla) → review+
(Assignee)

Updated

5 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/44f96a5d7e18

Thanks for the patch, Errietta! I went ahead and added the necessary commit information for this patch before pushing (see the link above to see what all was added). In the future, if you could please add it to your Hg configuration so that patches are generated with it all the time, it would be much appreciated!
https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
Assignee: nobody → errietta
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/44f96a5d7e18
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 27
You need to log in before you can comment on or make changes to this bug.