Closed
Bug 896523
Opened 12 years ago
Closed 11 years ago
In Firefox, Console.log does not work from apps launched within the system app
Categories
(Firefox OS Graveyard :: Gaia, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.3 C3/1.4 S3(31jan)
People
(Reporter: kgrandon, Assigned: paul)
References
Details
Attachments
(2 files, 3 obsolete files)
7.39 KB,
patch
|
Details | Diff | Splinter Review | |
4.97 KB,
patch
|
msucan
:
review+
|
Details | Diff | Splinter Review |
Perhaps this is due to being in a mozbrowser, but I feel like this used to work before. Ideally console.log statements should work when apps are launched in their own tabs or inside of the system app.
Reporter | ||
Updated•12 years ago
|
Blocks: gaia-devtools
Assignee | ||
Comment 2•11 years ago
|
||
How do you start the console? Do use the special profile for Firefox Desktop (DEBUG=1 DESKTOP=1)?
Assignee | ||
Comment 3•11 years ago
|
||
Mihai, at the console level, do we, at some point, cross frame boundaries (as in, do we use `window.parent`)?
Flags: needinfo?(mihai.sucan)
Comment 4•11 years ago
|
||
(In reply to Paul Rouget [:paul] from comment #3)
> Mihai, at the console level, do we, at some point, cross frame boundaries
> (as in, do we use `window.parent`)?
Once we receive a console API message:
1. we get the window object that it belongs to, based on the window ID. (is this working? is the console actor in the same process?)
2. once we have the window object, we get window.top. (is this allowed?)
3. we compare messageWindow.top to consoleActor.window check if they are the same.
If yes, then the message is sent from the server to the client to be displayed.
See CAL_observe() in toolkit/devtools/webconsole/utils.js.
Flags: needinfo?(mihai.sucan)
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Mihai Sucan [:msucan] from comment #4)
> 2. once we have the window object, we get window.top. (is this allowed?)
Not in mozbrowser. You have to use the docshell API instead:
http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsIDocShellTreeItem.idl#64
Maybe I can look at this. Where do we do that?
Comment 6•11 years ago
|
||
(In reply to Paul Rouget [:paul] from comment #5)
> (In reply to Mihai Sucan [:msucan] from comment #4)
> > 2. once we have the window object, we get window.top. (is this allowed?)
>
> Not in mozbrowser. You have to use the docshell API instead:
> http://mxr.mozilla.org/mozilla-central/source/docshell/base/
> nsIDocShellTreeItem.idl#64
>
> Maybe I can look at this. Where do we do that?
In the aforementioned utils.js. See comment #4.
Assignee | ||
Comment 7•11 years ago
|
||
Mihai, what do you think of that?
Not asking for a review yet, I need to figure out how to test that.
Assignee | ||
Comment 8•11 years ago
|
||
To test that, you need to enable mozbrowser. What I do is to run the gaia with:
> DEBUG=1 DESKTOP=1 make profile-debug && ~/mozilla/apps/firefox/firefox -profile /home/paul/github/gaia/profile-debug -no-remote
Also, see https://developer.mozilla.org/en-US/docs/WebAPI/Browser
The preferences are:
> user_pref("dom.mozBrowserFramesEnabled", true);
> user_pref("dom.mozApps.used", true);
Comment 9•11 years ago
|
||
Comment on attachment 805876 [details] [diff] [review]
Patch v1
Review of attachment 805876 [details] [diff] [review]:
-----------------------------------------------------------------
I am getting the following error when I try to open the browser console:
Timestamp: 17/09/2013 23:01:17
Error: error occurred while processing 'startListeners: TypeError: aTopLevelWindow is null
Stack: LayoutHelpers@resource://gre/modules/devtools/LayoutHelpers.jsm:19
ConsoleServiceListener@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:933
WCA_onStartListeners@resource://gre/modules/devtools/dbg-server.jsm -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/server/actors/webconsole.js:361
DSC_onPacket@resource://gre/modules/devtools/dbg-server.jsm -> resource://gre/modules/devtools/server/main.js:1018
LDT_send/<@resource://gre/modules/devtools/dbg-server.jsm -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/server/transport.js:255
makeInfallible/<@resource://gre/modules/devtools/dbg-server.jsm -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/DevToolsUtils.js:72
Source File: resource://gre/modules/devtools/dbg-server.jsm -> resource://gre/modules/devtools/server/main.js
Line: 923
The reason is that the browser console does not use per-window object message filtering. The ConsoleAPIListener and the ConsoleServiceListener constructors have the window argument, but that's optional.
The web console seems to be working well. The patch looks fine. f+ with the above bug fixed.
Attachment #805876 -
Flags: feedback?(mihai.sucan) → feedback+
Assignee | ||
Comment 10•11 years ago
|
||
Fixed the exception.
Attachment #805876 -
Attachment is obsolete: true
Assignee | ||
Comment 11•11 years ago
|
||
I'm struggling with the tests. Apparently, I can only set the browser permission from a mochitest-plain (not mochistest-chrome). `SpecialPowers.addPermission("browser", true, document)` raises an exception. From a mochitest-plain, I'm struggling to start the debugger and get the webconsole actor.
Alex, if I'm not mistaken, you've been working on something similar for the webapp actors. Can you help?
Flags: needinfo?(poirot.alex)
Comment 12•11 years ago
|
||
Yes, I'm using mochitest-plain, as mochitest-chrome aren't run on b2g.
In order to do that, I introduced a way to easily have chrome script helpers in mochitest-plain (bug 914633). It only allows you to have a decent piece of chrome code, but it doesn't allow you to test the chrome code, yet.
So if your main goal is to test the actor, that's not perfect, but if most assertions live in content, that's a good way to go.
The first test using this is the app actor mochitest:
http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/apps/tests/test_webapps_actor.html?force=1#83
This mochitest-plain interact with the following chrome script:
http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/apps/tests/debugger-protocol-helper.js
Do you have a test draft?
Flags: needinfo?(poirot.alex)
Reporter | ||
Comment 13•11 years ago
|
||
Hi Paul - is the only thing that's blocking this tests?
Flags: needinfo?(paul)
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #13)
> Hi Paul - is the only thing that's blocking this tests?
yes.
Flags: needinfo?(paul)
Assignee | ||
Comment 15•11 years ago
|
||
Attachment #807804 -
Attachment is obsolete: true
Assignee | ||
Comment 16•11 years ago
|
||
Assignee | ||
Comment 17•11 years ago
|
||
(In reply to Alexandre Poirot (:ochameau) from comment #12)
> Do you have a test draft?
See attachment 832882 [details] [diff] [review].
Flags: needinfo?(poirot.alex)
Reporter | ||
Comment 18•11 years ago
|
||
Paul - any chance we can land this and file a bug to follow-up with a test? This is pretty painful, and getting more complaints on IRC. Thanks.
Flags: needinfo?(paul)
Updated•11 years ago
|
Blocks: firefox-mulet
Assignee | ||
Comment 19•11 years ago
|
||
Kevin, can you still reproduce? Do you use B2G Desktop or on the device?
Flags: needinfo?(paul)
Reporter | ||
Comment 20•11 years ago
|
||
Yes, this is still an issue. This is broken in Firefox Nightly, and every few weeks we have more contributors complaining about it. If we can fix it, that would be great.
Assignee | ||
Comment 21•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=6aa00cc0fc35
Let's work on test later. This is blocking people.
Attachment #832881 -
Attachment is obsolete: true
Attachment #8364472 -
Flags: review?(mihai.sucan)
Flags: needinfo?(poirot.alex)
Comment 22•11 years ago
|
||
Comment on attachment 8364472 [details] [diff] [review]
patch v2
Review of attachment 8364472 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, assuming the LayoutHelpers work as advertised.
Attachment #8364472 -
Flags: review?(mihai.sucan) → review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 23•11 years ago
|
||
Should we have a follow-up bug to add a test?
Assignee | ||
Comment 24•11 years ago
|
||
(In reply to Mihai Sucan [:msucan] from comment #23)
> Should we have a follow-up bug to add a test?
bug 963530
Comment 25•11 years ago
|
||
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Comment 26•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → 1.3 C3/1.4 S3(31jan)
Comment 27•11 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #26)
> https://hg.mozilla.org/mozilla-central/rev/4852d88cc2ae
Then how we can debug system apps. I am not able to debug system apps.
Please give some information regarding the prints logs.
(In reply to sb00349044 from comment #27)
> (In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #26)
> > https://hg.mozilla.org/mozilla-central/rev/4852d88cc2ae
> Then how we can debug system apps. I am not able to debug system apps.
> Please give some information regarding the prints logs.
To discuss the specific issue you're seeing it would be best to do one of the following:
* Email the dev-b2g or dev-developer-tools mailing list
* Discuss in the #devtools IRC room
* File a new bug about your issue
You need to log in
before you can comment on or make changes to this bug.
Description
•