Closed Bug 1748112 Opened 2 years ago Closed 1 year ago

TypeError: can't access property "setEnd", result.range is undefined

Categories

(Toolkit :: View Source, defect, P3)

Firefox 97
defect

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox110 --- fixed

People

(Reporter: kernp25, Assigned: jdescottes)

Details

Attachments

(3 files)

Attached image firefox_daI5FEFQag.png

Steps to reproduce:

  1. Open view-source:resource://gre-resources/hiddenWindow.html in a new tab

My browser version: 97.0a1 (2021-12-31) (64-Bit)

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.

Component: Untriaged → Tabbed Browser

My browser: Firefox Nightly

Component: Tabbed Browser → View Source
Product: Firefox → Toolkit

The severity field is not set for this bug.
:Honza, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(odvarko)

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?

Flags: needinfo?(odvarko) → needinfo?(kernp25)
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE

I have seen this error again!

Can you try this url: view-source:chrome://browser/content/browser.xhtml

Flags: needinfo?(kernp25) → needinfo?(odvarko)

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:

  1. Launching Firefox and opening the Browser Console
  2. Switching the Browser Console to "Multiprocess" mode
  3. Loading view-source:chrome://browser/content/browser.xhtml
  4. 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,
  });
Flags: needinfo?(odvarko) → needinfo?(jdescottes)

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.

Severity: -- → S3
Status: RESOLVED → REOPENED
Ever confirmed: true
Flags: needinfo?(jdescottes)
Priority: -- → P3
Resolution: INCOMPLETE → ---
Status: REOPENED → NEW

(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 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?

Attached video firefox_ib4Q71aUJu.mp4

You get the error in the Browser Console.

Flags: needinfo?(jdescottes)

Ok, so "steps to reproduce" were to click on a Browser Console link, which means fixing the fallback values should address the issue.

Flags: needinfo?(jdescottes)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/964de624661c
[devtools] Do not pass lineNumber = 0 to viewSource r=Honza
Status: ASSIGNED → RESOLVED
Closed: 2 years ago1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: