New issue
Advanced search Search tips

Issue 882013 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 7
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

DevTools: FormatterWorker broken w/ debug_devtools

Project Member Reported by l...@chromium.org, Sep 7

Issue description

What steps will reproduce the problem?
(1) Build Chromium with `debug_devtools = true`
(2) Try any feature that depends on FormatterWorker, e.g.
- Pretty print
- Type `document.body` in the console

What is the expected result?
Pretty print should work.  `document.` should show `body` in autocomplete.

What happens instead?
FormatterWorker-dependent features fail due to error:

`Refused to execute script from 'chrome-devtools://devtools/bundled/Runtime.js' because its MIME type ('') is not executable.`, likely a result of recent strict MIME-type checks for `importScripts()`.


The resource_loader looks at `response.HttpContentType()`, which is empty in debug mode, but valid in release mode, since DevToolsDataSource overrides `ShouldServeMimeTypeAsContentTypeHeader()`.

 
Description: Show this description
Recently, we turned on strict MIME-checks for `importScripts` [1].
A short-term solution could involve doing `ShouldServeMimeTypeAsContentTypeHeader` [2] for the DebugDevToolsInterceptor's request.


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=794548#c6
[2] https://cs.chromium.org/chromium/src/chrome/browser/ui/webui/devtools_ui.cc?type=cs&g=0&l=232

Project Member

Comment 3 by bugdroid1@chromium.org, Sep 10

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/75f9ed0695b3c3c0eac4e014f485264c1e4d8c5e

commit 75f9ed0695b3c3c0eac4e014f485264c1e4d8c5e
Author: Erik Luo <luoe@chromium.org>
Date: Mon Sep 10 16:44:15 2018

DevTools: serve MimeType as ContentType for debug_devtools

- Adds ShouldServeMimeTypeAsContentTypeHeader() on URLRequestFileJob
- With debug_devtools, our interceptor now serves files with
  ContentType header, allowing DevTools to importScripts() on
  locally-served bundled files.
- Without this CL, strict MIME-type checks prevent importScripts()
  in FormatterWorker, required for pretty-print and autocomplete.

Bug:  882013 
Change-Id: Ib61284cfccd430dd9a4ddae769a416147c504e05
Reviewed-on: https://chromium-review.googlesource.com/1214365
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589944}
[modify] https://crrev.com/75f9ed0695b3c3c0eac4e014f485264c1e4d8c5e/chrome/browser/profiles/profile_io_data.cc
[modify] https://crrev.com/75f9ed0695b3c3c0eac4e014f485264c1e4d8c5e/net/url_request/url_request_file_job.cc
[modify] https://crrev.com/75f9ed0695b3c3c0eac4e014f485264c1e4d8c5e/net/url_request/url_request_file_job.h

Status: Fixed (was: Assigned)

Sign in to add a comment