TypeError: can't access property "setEnd", result.range is undefined
Categories
(Toolkit :: View Source, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox110 | --- | fixed |
People
(Reporter: kernp25, Assigned: jdescottes)
Details
Attachments
(3 files)
Steps to reproduce:
- Open
view-source:resource://gre-resources/hiddenWindow.html
in a new tab
My browser version: 97.0a1 (2021-12-31) (64-Bit)
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•2 years ago
|
||
The severity field is not set for this bug.
:Honza, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 4•2 years ago
|
||
Thanks for the report!
How can I reproduce the issue on my machine?
I opened view-source:resource://gre-resources/hiddenWindow.html
in a new tab, but I don't see the error anywhere. Any specific action I should do?
Updated•2 years ago
|
I have seen this error again!
Can you try this url: view-source:chrome://browser/content/browser.xhtml
Can you try this code:
gViewSourceUtils.viewSource({
URL: "chrome://browser/content/browser.xhtml",
lineNumber: 0,
});
It only happens with lineNumber 0. It does not happen with lineNumber 1 for example.
I have the code from here.
Can you try this url: view-source:chrome://browser/content/browser.xhtml
I still don't see the error. Here is what I am doing:
- Launching Firefox and opening the Browser Console
- Switching the Browser Console to "Multiprocess" mode
- Loading view-source:chrome://browser/content/browser.xhtml
- Checking the Browser console content for
TypeError: can't access property "setEnd", result.range is undefined
Julian, can you please try it on your machine?
I can see the error If I execute the following code in the Browser Console
gViewSourceUtils.viewSource({
URL: "chrome://browser/content/browser.xhtml",
lineNumber: 0,
});
Assignee | ||
Comment 8•1 year ago
|
||
Julian, can you please try it on your machine?
I don't see the error when loading view-source:chrome://browser/content/browser.xhtml
manually, but I have it when calling gViewSourceUtils.viewSource. As mentioned in the comment above viewSource
can not work with lineNumber === 0.
So at least the devtools code at https://searchfox.org/mozilla-central/rev/7eca06dd4c5e4dfd6764a382569c841c05a0857d/devtools/client/shared/view-source.js#230-245 should be updated to fallback to -1 instead of 0. With -1 we should not attempt to highlight any line, which is probably the best if we don't have a specific location to point to.
I managed to also reproduce with DevTools STRs:
- open Browser Console
- open a Tab
- open a regular DevTools Console
- navigate to https://www.lemonde.fr/
- filter on
Ignoring the less restricted referrer policy “no-referrer-when-downgrade” for the cross-site request: https://acdn.adnxs.com/dmp/async_usersync.html
- you should have only one log entry matching this filter
- click on the
async_usersync.html
link on the right of the message
You should see the error in the Browser Console. Hopefully you can see the same. In any case the fix should be trivial.
Assignee | ||
Updated•1 year ago
|
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #7)
Can you try this url: view-source:chrome://browser/content/browser.xhtml
I still don't see the error.
You can ignore comment 5. The error will only show when using the code from comment 6.
Assignee | ||
Comment 10•1 year ago
|
||
(In reply to kernp25 from comment #9)
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #7)
Can you try this url: view-source:chrome://browser/content/browser.xhtml
I still don't see the error.
You can ignore comment 5. The error will only show when using the code from comment 6.
In this case, how did you face this error initially? We can fix the call sites in DevTools to avoid passing lineNumber 0, but I'm not sure this will fix your use case?
Reporter | ||
Comment 11•1 year ago
|
||
Reporter | ||
Comment 12•1 year ago
|
||
You get the error in the Browser Console.
Assignee | ||
Comment 13•1 year ago
|
||
Ok, so "steps to reproduce" were to click on a Browser Console link, which means fixing the fallback values should address the issue.
Assignee | ||
Comment 14•1 year ago
|
||
Updated•1 year ago
|
Comment 15•1 year ago
|
||
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/964de624661c [devtools] Do not pass lineNumber = 0 to viewSource r=Honza
Comment 16•1 year ago
|
||
bugherder |
Updated•1 year ago
|
Description
•