Closed Bug 901214 Opened 12 years ago Closed 12 years ago

new Notification API: crashes on Firefox OS

Categories

(Core :: DOM: Core & HTML, defect)

ARM
Gonk (Firefox OS)
defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME
blocking-b2g koi+

People

(Reporter: julienw, Assigned: reuben)

References

Details

(Keywords: crash, reproducible, Whiteboard: [b2g-crash][systemsfe])

Attachments

(4 files, 2 obsolete files)

STR: * go to http://everlong.org/mozilla/notifications/ with the Browser * press the second button "new Notification" Expected: * a notification is sent (the same one as the first button) Actual: * the page crashes Note that I haven't tried the same thing in a app yet. For this to happen you need to either have the patch for Bug 900960 or enable the webnotifications in Gaia's build/custom-prefs.js file.
Blocks: 892528
Note that you need to have a gecko build from before the fix to bug 866232 (that regressed the Browser app) to be able to click the buttons
Severity: normal → critical
Flags: needinfo?(felash)
Keywords: crash, stackwanted
Whiteboard: [b2g-crash]
Version: 22 Branch → Trunk
Sorry, I don't have this directory on the device, even if I activate "always send reports" in Settings. And when I try to use run-gdb I have an error like "gdbserver: not found" and I can't get the backtrace. I'll be happy to configure my device correctly if you have any information to do this.
Flags: needinfo?(felash)
I'm looking at this.
Assignee: nobody → reuben.bmo
Thomas Zimmermann could not reproduce this on your device, please tell me if you can ;) I had Thomas help me debugging this: * I pushed a eng build to my keon and could then run gdb * but I could not get any useful stack trace And I'm stuck with adding some logs in all places ;)
There is a "meaningful" logcat error when it crashes: 08-05 17:08:21.177 753 753 E GeckoConsole: [JavaScript Error: "[Exception... "'Error: no message manager set' when calling method: [nsIObserver::observe]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0" data: no]"] I'm currently instrumenting the code with logs everywhere.
so here are the logs that I added to debug so far, hope you'll find it useful.
GDB might be easier :)
I see Timestamp: 8/5/13 6:09:26 PM Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIContentPermissionRequest.element]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///Users/Gregor/code/2src/2optbuild/dist/B2G.app/Contents/MacOS/components/ContentPermissionPrompt.js :: ContentPermissionPrompt.prototype.prompt :: line 128" data: no] Source File: file:///Users/Gregor/code/2src/2optbuild/dist/B2G.app/Contents/MacOS/components/ContentPermissionPrompt.js Line: 128
(In reply to Gregor Wagner [:gwagner] from comment #8) > GDB might be easier :) We've been trying this all day, but GDB is very much unhelpful here :(
I found this in my logcat: > I/Gecko ( 108): Security problem: Content process does not have `desktop-notification'. It will be killed. > I/Gecko ( 108): IPDL protocol error: Handler for ShowAlertNotification returned error code > I/Gecko ( 108): > I/Gecko ( 108): ###!!! [Parent][AsyncChannel] Error: Processing error: message was deserialized, but the handler returned false (indicating failure) > I/Gecko ( 108):
For the desktop-notification part you may need my patch from bug 900279 after all (I had it in my gaia).
(In reply to Julien Wajsberg [:julienw] from comment #12) > For the desktop-notification part you may need my patch from bug 900279 > after all (I had it in my gaia). The messages still show up even with the patch applied.
Attached patch Fix GetElement (obsolete) — Splinter Review
Can you try with this patch?
(In reply to Gregor Wagner [:gwagner] from comment #14) > Created attachment 785821 [details] [diff] [review] > Fix GetElement > > Can you try with this patch? Didn't fix it for me.
And I also see the following messages in the logcat. Pid 494 is the Browser app. > I/Gecko ( 109): [Parent 109] WARNING: waitpid failed pid:494 errno:10: file /home/mozilla/Projects/mozilla/src/mozilla-central/ipc/chromium/src/base/process_util_posix.cc, line 260 > I/Gecko ( 109): [Parent 109] WARNING: Failed to deliver SIGKILL to 494!(3).: file /home/mozilla/Projects/mozilla/src/mozilla-central/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc, line 118
Some more fixes
Attachment #785821 - Attachment is obsolete: true
createNotification works now for me on b2g-desktop. "new Notification" doesn't handle prompting correctly. It works only after using createNotification.
Uh. aElement should never be null there. Why is it null?
May it could be helpful. I've tried to construct the Notification with "var notification=Notification.constructor(...)" and It worked for me. The Object was created, but the 'desktop-notification' message wasn't sent to system app. I think that it's is strange, because I've tested in Nightly app and the "new Notification" works. I'm testing it in the sms application.
> createNotification works now for me on b2g-desktop. The old spec always worked for me on the device :) It's the new spec which crashes for me. Gregor have you applied all the not-landed-yet patches for the new Notification API before trying ?
>createNotification works now for me on b2g-desktop. For me too. But It's the old implementation. Julien, have you already tested the "new Notification(..)" with a gaia app, like sms? I would like to know if you will get the same error than mine. "ErrorType: Notification is not a constructor"
Bug 901856 brings the notification api to the UI Tests app. The notification is correctly sent, but there are other bugs. So maybe this bug is related to the fact that Browser tabs are remote ?
(In reply to Gregor Wagner [:gwagner] from comment #17) > Created attachment 785849 [details] [diff] [review] > fix GetElement + ContentPermissionPrompt.js > > Some more fixes Still no change here.
(In reply to Boris Zbarsky (:bz) from comment #19) > Uh. aElement should never be null there. Why is it null? Hm good question. I copied this behavior from geolocation: http://mxr.mozilla.org/mozilla-central/source/dom/src/geolocation/nsGeolocation.cpp#401 There is some explanation here: http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIContentPermissionPrompt.idl#43 The current use-case is that the child sends a prompting request to the parent. We handle the case where we don't have an element but currently we return an error: http://mxr.mozilla.org/mozilla-central/source/b2g/components/ContentPermissionPrompt.js#131
(In reply to Julien Wajsberg [:julienw] from comment #21) > > createNotification works now for me on b2g-desktop. > > The old spec always worked for me on the device :) > > It's the new spec which crashes for me. > > Gregor have you applied all the not-landed-yet patches for the new > Notification API before trying ? I enabled them and applied https://bug782211.bugzilla.mozilla.org/attachment.cgi?id=783252 Anything else missing?
Julien, I've applied your patch to debug, but I think that I have no success. Where the debug messages are showed? I'm testing on emulator, because I don't have a phone. The messages aren't being sent to logcat and console.
Even on emulator you may need to enable the console in the Settings app ? Sorry I don't know the emulator...
hum...I think so. I'll test it now.
(In reply to Gregor Wagner [:gwagner] from comment #25) > I copied this behavior from geolocation: Well, that code is just as bogus. It's trying to defend-in-depth against things that are totally not allowed. > There is some explanation here: > http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/ > nsIContentPermissionPrompt.idl#43 That's talking about the return value. You're checking the pointer to the memory location where the return value should be written.
The new code doesn't support any prompting. We have to fix this. http://mxr.mozilla.org/mozilla-central/source/dom/src/notification/Notification.cpp#400
(In reply to Gregor Wagner [:gwagner] from comment #31) > The new code doesn't support any prompting. We have to fix this. > http://mxr.mozilla.org/mozilla-central/source/dom/src/notification/ > Notification.cpp#400 Prompting is done in Notification.requestPermission: https://mxr.mozilla.org/mozilla-central/source/dom/src/notification/Notification.cpp#105 The constructor should just do nothing if there's no permission.
Guys, does anybody testing it on Desktop B2G Simulator or plug-in simulator?
Attached patch WIP (obsolete) — Splinter Review
WIP, fixes the crash. I think bent and sicking have a plan to fix this differently, though.
Attached patch WIPSplinter Review
Missing qref.
Attachment #787257 - Attachment is obsolete: true
Keywords: stackwanted
Reuben, there is an error in attachment 787264 [details] [diff] [review]. On dom/src/notification/Notification.cpp:323 line, the new method "Notification::GetPrincipal(nsIPrincipal** aPrincipal)" has a parameter that wasn't declared as the method on "dom/src/notification/Notification.h:60". It is declared this way "nsIPrincipal* GetPrincipal();" It generated a compilation error. So, I've removed the "nsIPrincipal** aPrincipal" from "Notification.cpp" and It compiled well.
I thought I had removed that before attaching it. Should work fine other than that. Try run looks green: https://tbpl.mozilla.org/?tree=Try&rev=cd764bc7b55b
Sorry for this newbie ask, but what is the meaning of this link? https://tbpl.mozilla.org/?tree=Try&rev=cd764bc7b55b
Caio, see https://wiki.mozilla.org/ReleaseEngineering/TryServer#Try_Server The link is to a particular set test runs, presumbly with the patch for this bug.
Candice Serran changed story state to started in Pivotal Tracker
Comment on attachment 787264 [details] [diff] [review] WIP Review of attachment 787264 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/ipc/ContentParent.cpp @@ +2423,5 @@ > + found = true; > + break; > + } > + } > + You should use the AppsService there, and just check that getManifestURLByLocalId(principalAppId) != null to find if we have an app with this id.
Depends on: 904298
I guess I've found a kind of problem. I was trying to build my Gecko setting the GECKO_PATH to mozilla-central that I had here and the "new Notification(...)" was reporting to logcat that "Notification is not a constructor". Today, Reuben said to me to try build my b2g with "BRANCH=master ./config.sh" and the "new Notification(...)" worked well. There is an explanation for this behavior?
I use the GECKO_PATH configuration too, but in this situation you need to update the repository yourself instead of relying on "./repo sync" in B2G's directory. Maybe that was the problem ?
Keywords: reproducible
blocking-b2g: koi? → koi+
Whiteboard: [b2g-crash] → [b2g-crash][systemfe]
Whiteboard: [b2g-crash][systemfe] → [b2g-crash][systemsfe]
Is this still reproducing on anyone's device? After rebasing my patches notifications are not leaving the child at any point, completely circumventing the permissions system. I'm puzzled.
Keywords: qawanted
QA Contact: jsmith
Attached file Test Case
(In reply to Reuben Morais [:reuben] from comment #45) > Is this still reproducing on anyone's device? After rebasing my patches > notifications are not leaving the child at any point, completely > circumventing the permissions system. I'm puzzled. Nope. Works for me on a 9/12/2013 build.
Status: NEW → RESOLVED
Closed: 12 years ago
Keywords: qawanted
Resolution: --- → WORKSFORME
No longer depends on: 904298
Jason Smith changed story state to finished in Pivotal Tracker
Jason Smith changed story state to accepted in Pivotal Tracker
Jason Smith changed story state to accepted in Pivotal Tracker
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: