Open Bug 1307732 Opened 8 years ago Updated 2 years ago

Isolate devtools from general.useragent.override changes

Categories

(DevTools :: Framework, enhancement, P3)

enhancement

Tracking

(firefox52 affected)

Tracking Status
firefox52 --- affected

People

(Reporter: jdescottes, Unassigned)

References

Details

Follow up to Bug 1306143:

(In reply to Julian Descottes [:jdescottes] from Bug 1306143 comment #6)
> Let's block this specific bug on Bug 1292592, it should fix the issue here.
> I was about to propose something specific to the html-editor anyway.
> 
> A more general solution would be to find a way to avoid applying the
> customUserAgent on devtools.
> 
> In https://bugzilla.mozilla.org/show_bug.cgi?id=1254025#c24, Brian proposed
> to change the way we load the Code Mirror iframe to avoid the issue (chrome
> resource vs data uri) but actually all the window elements of the browser
> are using the custom useragent. We would need a way to prevent this custom
> userAgent to be applied on the root devtools iframe.
> 
> That would be nice to have for devtools-html if we move towards using more
> 3rd party libraries (quickly checked React for instance, and it does check
> the userAgent in a few minor spots).

We have had several issues (with CodeMirror for now) related to 3rd party libraries relying on user agent spoofing that break devtools if the user starts using a custom user agent (either using an addon, or setting general.useragent.override in about:config).

We should investigate a way to shield the devtools iframe from a custom useragent.
Whiteboard: [devtools-html] [triage]
Whiteboard: [devtools-html] [triage]
This isn't quite the same as isolating DevTools, but we are starting to expose more features in RDM, etc. to set a UA that only affects the content of a single tab.  If such features are a good fit for whatever purpose led someone to use general.useragent.override, then they can use a modified UA for just that tab, rather than all of Firefox, and DevTools would be unaffected.
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1)
> This isn't quite the same as isolating DevTools, but we are starting to
> expose more features in RDM, etc. to set a UA that only affects the content
> of a single tab.  If such features are a good fit for whatever purpose led
> someone to use general.useragent.override, then they can use a modified UA
> for just that tab, rather than all of Firefox, and DevTools would be
> unaffected.

Good point, RDM does a really good job here and we definitely should redirect users impacted by such bugs to use RDM.

We should take into account that a reason why general.useragent.override is modified by users is https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/ . This addon has a userbase of over 300k users, one of the most used addons out there.

So this makes me think about another option here: the toolbox could detect that the useragent has been customized, and if so display a warning (popup? message in the console?) encouraging the user to try out RDM. What do you think?
Flags: needinfo?(jryans)
(In reply to Julian Descottes [:jdescottes] from comment #2)
> (In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1)
> > This isn't quite the same as isolating DevTools, but we are starting to
> > expose more features in RDM, etc. to set a UA that only affects the content
> > of a single tab.  If such features are a good fit for whatever purpose led
> > someone to use general.useragent.override, then they can use a modified UA
> > for just that tab, rather than all of Firefox, and DevTools would be
> > unaffected.
> 
> Good point, RDM does a really good job here and we definitely should
> redirect users impacted by such bugs to use RDM.
> 
> We should take into account that a reason why general.useragent.override is
> modified by users is
> https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/ . This
> addon has a userbase of over 300k users, one of the most used addons out
> there.
> 
> So this makes me think about another option here: the toolbox could detect
> that the useragent has been customized, and if so display a warning (popup?
> message in the console?) encouraging the user to try out RDM. What do you
> think?

One thing to note is that (at the moment) new RDM only lets you select from a predefined device to set a UA, so you can't easily set any arbitrary UA.  We'd need something like bug 1173142 first to able user-defined devices (one setting of which is the UA).

So, it might be too early to add a warning _right now_, but I think it's an approach we could try in the future once we have better UA support in RDM.  If you want something short term, maybe an isolation approach is better (not quite sure what that looks like myself).
Depends on: 1173142
Flags: needinfo?(jryans)
Severity: normal → enhancement
Priority: -- → P3
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.