Bug 162387 - REGRESSION(r206165): [GTK] Web inspector broken since r206165
Summary: REGRESSION(r206165): [GTK] Web inspector broken since r206165
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2016-09-22 06:31 PDT by Carlos Garcia Campos
Modified: 2016-09-22 17:57 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2016-09-22 06:31:23 PDT
Web inspector no longer works after r206165 because it fails to load all resources with messages like:

CONSOLE ERROR Refused to load resource:///org/webkitgtk/inspector/UserInterface/External/CodeMirror/codemirror.css because it does not appear in the style-src directive of the Content Security Policy.
CONSOLE ERROR Refused to load resource:///org/webkitgtk/inspector/UserInterface/External/CodeMirror/codemirror.js because it does not appear in the script-src directive of the Content Security Policy.

Adding resource: to style-src or script-src doesn't work, resources are indeed loaded, but then it fails with:

resource:///org/webkitgtk/inspector/UserInterface/Base/Setting.js:61:44: CONSOLE ERROR SecurityError (DOM Exception 18): The operation is insecure.
resource:///org/webkitgtk/inspector/UserInterface/Main.html:1:21: CONSOLE ERROR ReferenceError: Can't find variable: InspectorFrontendAPI

Because since r206165 resource scheme is considered as unique origin. Simply including resource in the list of schemes checked in shouldTreatAsUniqueOrigin() would fix it, but I'm not sure it's really correct, because that's supposed to be the list of special schemes according to the spec (https://url.spec.whatwg.org/#origin).
Comment 1 Alex Christensen 2016-09-22 13:27:45 PDT
(In reply to comment #0)
> Simply including resource in the list of schemes checked in shouldTreatAsUniqueOrigin() would fix it, but I'm not sure it's really correct.
That would indeed not be correct.  Why are these not file urls?
Comment 2 Michael Catanzaro 2016-09-22 13:44:38 PDT
(In reply to comment #1)
> That would indeed not be correct.  Why are these not file urls?

With GResources, the files get bundled into the ELF executable by glib-compile-resources so that we can do fast sync I/O without error checking, and don't have to worry about users messing with or removing the files. It's the best practice for distributing data files on our platform. See https://blogs.gnome.org/alexl/2012/01/26/resources-in-glib/
Comment 3 Alex Christensen 2016-09-22 17:56:55 PDT
There are more problems similar to this.  I think the correct solution is using https://bugs.webkit.org/show_bug.cgi?id=162475