Closed Bug 904982 Opened 11 years ago Closed 11 years ago

[System] System reboot if CustomDialog shows with improper callbacks

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gweng, Assigned: gweng)

Details

Attachments

(1 file)

STR:

1. Show the dialog with callbacks contain no 'CustomDialog.hide()', ex: `CustomDialog.show('Title', 'Message', function(){}, function(){})` .

2. The dialog pop-up, and then press the cancel or confirm button. 

Expected Results:  
Nothing happens. Because callbacks do no-op.

Actual Results:  
System reboot.

Tested on:
1. Firefox Nightly 26.0a1 + Gaia profile at Linux x86_64
2. B2G 1.1.0-prerelease, unagi/1.1.0/beta

----

I don't know the principle of handling such callbacks, but I think that if the callbacks are really improper, it at least should throw exceptions instead reboot the whole system.
(In reply to Greg Weng [:snowmantw] from comment #0)

Sorry, the callbacks in the example are wrong. It should be:
CustomDialog.show('Title', 'Message', 
{'title': 'Cancel', 'callback': function(){} }, 
{'title': 'Confirm', 'callback': function(){} })

> STR:
> 
> 1. Show the dialog with callbacks contain no 'CustomDialog.hide()', ex:
> `CustomDialog.show('Title', 'Message', function(){}, function(){})` .
> 
> 2. The dialog pop-up, and then press the cancel or confirm button. 
> 
> Expected Results:  
> Nothing happens. Because callbacks do no-op.
> 
> Actual Results:  
> System reboot.
> 
> Tested on:
> 1. Firefox Nightly 26.0a1 + Gaia profile at Linux x86_64
> 2. B2G 1.1.0-prerelease, unagi/1.1.0/beta
> 
> ----
> 
> I don't know the principle of handling such callbacks, but I think that if
> the callbacks are really improper, it at least should throw exceptions
> instead reboot the whole system.
Assignee: nobody → gweng
After tests, I've found that the "button" tag is default to submit the form, and then the page will get refreshed as the browser's default behavior. At least after I added the "type=button" attribute on the element, it never reboot again.
Attached file Patch
It's caused by the default type of a element will be 'Submit', and the Gecko will reload whole system app as browser reloading the page. Solved this after setting correct type to the buttons.
Attachment #790660 - Flags: review?(alive)
Comment on attachment 790660 [details]
Patch

r=me if you correct the comments.
BTW, if this affects v1-train as well, please set |leo?| flag.
Attachment #790660 - Flags: review?(alive) → review+
Than(In reply to Alive Kuo [:alive] from comment #4)
> Comment on attachment 790660 [details]
> Patch
> 
> r=me if you correct the comments.
> BTW, if this affects v1-train as well, please set |leo?| flag.

Thanks for reviewing, and I still have no permission to merge in GitHub, so please merge for me.
master
https://github.com/mozilla-b2g/gaia/commit/7ca2728938944150cbf30ef1c1cba6e20772a720
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: