Closed Bug 1208018 Opened 9 years ago Closed 9 years ago

Improve javascript stackframe logging

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

(Keywords: pi-marionette-server)

Attachments

(1 file, 1 obsolete file)

When using execute_js_script, even when passing a filename, this filename isn't used in JS exceptions. We need to pass this `filename` information to Cu.evalInSandbox in order to have better stackframe. Also, in JavaScriptError helper function, we are trying to only display the topmost frame (the line of the script passed to execute_js_script) whereas having the full stack is really important to figure out where the exception really happenned.
Attached patch patch v1 (obsolete) (deleted) — Splinter Review
Quite simple patch, just forward filename information up to Cu.evalInSandbox, and use filename instead of "dummy file". Then, now that stack frame have meaningfull paths, we can start displaying the full stack instead of just the topmost frame. May be I can remove the existing code that displays: inline javascript, line xxx src: ... ? I tried to write a test, but it looks like tests are going through completely different codepath. I crafted this patch in order to improve error logging in luciddream. In luciddream I go through driver.js whereas tests are using listener.js. Note that we could apply to the same improvement to listener.js.
Attachment #8665383 - Flags: review?(jgriffin)
Comment on attachment 8665383 [details] [diff] [review] patch v1 Review of attachment 8665383 [details] [diff] [review]: ----------------------------------------------------------------- this looks fine; we should really do this in listener.js as well, where we call evalInSandbox (e.g., https://dxr.mozilla.org/mozilla-central/source/testing/marionette/listener.js#791) the executeScript tests mostly are run twice, once in chrome ('driver.js') mode, and once in content ('listener.js') mode. it should be pretty easy to test this.
Attachment #8665383 - Flags: review?(jgriffin) → review+
Blocks: 1199205
Attached patch patch v2 (deleted) — Splinter Review
+ set filename correctly in listener.js + added a execute_js_script test and tweaked existing execute_script test What do you think about removing the old trick[1], and instead, only display the full JS trace[2]? Here is the current stacktrace values for the two tests: inline javascript, line 2 | [1] src: " return b;" | Stack: | [2] __marionetteFunc@test_execute_script.py:2:17 | @test_execute_script.py:3:19 | inline javascript, line 2 | [1] src: " throwHere();" | [1] Stack: | [2] @file.js:2:17 |
Attachment #8665383 - Attachment is obsolete: true
Attachment #8666669 - Flags: review?(jgriffin)
Assignee: nobody → poirot.alex
I ran the tests locally against firefox and b2g desktop, but I was wondering if I can push to try to run marionette tests? If not, is there any tests/platform useful to run on try?
Attachment #8666669 - Flags: review?(jgriffin) → review+
https://hg.mozilla.org/integration/fx-team/rev/ebbf62bde078a1c781ae9f66c34e5887bf446f58 Bug 1208018 - Improve marionette stack info and dump it when executeJSScript throws. r=jgriffin
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: