Closed Bug 982153 Opened 8 years ago Closed 8 years ago
Wrong stack frame lines for scripts dynamically injected using <script> element
Stack frame lines are wrong (should be +1) for script that are dynamically created using <script> element and textContent as follows: var scriptTag = document.createElement("script"); scriptTag.textContent = "console.log('hello world');"; document.body.appendChild(scriptTag); Note that line numbers are correct when <script> tag with valid src attribute is appended to the document as follows: var scriptTag = document.createElement("script"); scriptTag.src = my-file-url.js"; document.body.appendChild(scriptTag); --- It might be caused by the fact that script.startLine is set to 0 Note that script.startLine is set to 1 for other dynamically created scripts: - new Function - eval - Appending <script> element to the document (with valid src attribute) - event handlers Honza
Or should I rather use DOM: Core & HTML component? Honza
A try run suggests no further changes necessary: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=ad8321fcb698 (Being completely new to this I'm not sure if there are any other tests relevant to run.) FWIW Chrome also has 1-indexed line numbers, so I don't expect this to break anything external.
Attachment #8509853 - Flags: review?(bzbarsky)
Comment on attachment 8509853 [details] [diff] [review] Give dynamically created script elements 1-indexed line numbers. v1 Please move this bug to the appropriate Core component. There used to be a time when "0" meant "we have no idea, please don't show line numbers here at all because they'll just be lies", but apparently someone broke that at some point and started showing the bogus numbers. :( r=me given that.
Attachment #8509853 - Flags: review?(bzbarsky) → review+
Component: Developer Tools: Debugger → DOM: Core & HTML
Product: Firefox → Core
Assignee: nobody → simon.lindholm10
Backed out for Windows-only mochitest-1 crashes (I know, right?). https://hg.mozilla.org/integration/mozilla-inbound/rev/ed7562a016fa https://treeherder.mozilla.org/ui/logviewer.html#?job_id=3251743&repo=mozilla-inbound
... oh. So this is due to me being a complete beginner at this: the "run-if = os == 'linux'" line affects the test before it, not after. New try-run: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=7d8fd041d79a
Yes, that syntax is crazy. You're not the first one to make the mistake.
Passes m-1 on Linux and Windows.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.