Bug 58886 - Web Inspector: Render non-document HTML resources as HTML
Summary: Web Inspector: Render non-document HTML resources as HTML
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 53067 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-19 06:01 PDT by Vsevolod Vlasov
Modified: 2011-06-10 02:05 PDT (History)
12 users (show)

See Also:


Attachments
Patch (7.28 KB, patch)
2011-04-19 06:29 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Fixed quotes (7.28 KB, patch)
2011-04-19 06:34 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch with fixes (7.75 KB, patch)
2011-04-19 07:42 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch with fixes (13.41 KB, patch)
2011-04-20 09:40 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (with fixes) (17.37 KB, patch)
2011-05-26 08:39 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vsevolod Vlasov 2011-04-19 06:01:31 PDT
Render non-document HTML resources as HTML
Comment 1 Vsevolod Vlasov 2011-04-19 06:29:45 PDT
Created attachment 90189 [details]
Patch
Comment 2 Vsevolod Vlasov 2011-04-19 06:34:45 PDT
Created attachment 90190 [details]
Fixed quotes
Comment 3 Alexander Pavlov (apavlov) 2011-04-19 06:42:16 PDT
Comment on attachment 90190 [details]
Fixed quotes

View in context: https://bugs.webkit.org/attachment.cgi?id=90190&action=review

> Source/WebCore/inspector/front-end/ResourceHTMLView.js:1
> +/*

Please add it into WebCore.vcproj as well (and checking if all of our JS files are there is a good idea).

> Source/WebCore/inspector/front-end/ResourceHTMLView.js:57
> +        iframe.sandbox=""; // Forbid to run JavaScript and set unique origin

Comments are full sentences in WebKit (end in a period).
Comment 4 Vsevolod Vlasov 2011-04-19 07:42:04 PDT
Created attachment 90201 [details]
Patch with fixes

Done these.
I'll add missing files in .vcproj in separate bug
Comment 5 Adam Barth 2011-04-19 10:22:04 PDT
Comment on attachment 90201 [details]
Patch with fixes

View in context: https://bugs.webkit.org/attachment.cgi?id=90201&action=review

> Source/WebCore/inspector/front-end/NetworkItemView.js:58
> +    if (resource.type !== WebInspector.Resource.Type.Document && resource.content && resource.mimeType == "text/html") {

Has mimeType already been canonicalized (e.g., converted to lower case)?  What about application/xml+html ?

> Source/WebCore/inspector/front-end/ResourceHTMLView.js:57
> +        iframe.sandbox=""; // Forbid to run JavaScript and set unique origin.

You should use setAttribute rather than the DOM reflection of the attribute.
Comment 6 Vsevolod Vlasov 2011-04-20 09:39:55 PDT
> > Source/WebCore/inspector/front-end/NetworkItemView.js:58
> > +    if (resource.type !== WebInspector.Resource.Type.Document && resource.content && resource.mimeType == "text/html") {
> 
> Has mimeType already been canonicalized (e.g., converted to lower case)?  What about application/xml+html ?
I removed this check. We decided that we should render HTML only for resources with error status code.

> > Source/WebCore/inspector/front-end/ResourceHTMLView.js:57
> > +        iframe.sandbox=""; // Forbid to run JavaScript and set unique origin.
> 
> You should use setAttribute rather than the DOM reflection of the attribute.
Done
Comment 7 Vsevolod Vlasov 2011-04-20 09:40:49 PDT
Created attachment 90351 [details]
Patch with fixes
Comment 8 Pavel Feldman 2011-04-20 10:16:06 PDT
Comment on attachment 90351 [details]
Patch with fixes

View in context: https://bugs.webkit.org/attachment.cgi?id=90351&action=review

> Source/WebCore/inspector/front-end/NetworkItemView.js:48
> +        var responseView = new WebInspector.ResourceSourceFrame(resource);

You could reuse existing SourceFrame in case previewView is instance of ResourceSourceFrame. In fact, you should adjust resourceViewForResource to cache only SourceFrame views.

> Source/WebCore/inspector/front-end/Resource.js:795
> +            if (data == null)

pending callbacks should be notified upon missing content.

> Source/WebCore/inspector/front-end/ResourceHTMLView.js:52
> +        this.element.textContent = "";

this.element.removeChildren()

> Source/WebCore/inspector/front-end/ResourceView.js:49
> +        return new WebInspector.ResourceHTMLView(resource);

Reuse SourceFrame-based views when possible as per comment above.

> Source/WebCore/inspector/front-end/ResourceView.js:80
> +        if (WebInspector.ResourceJSONView.parseJSON(resource.content))

This seems to be a bit too expensive. Testing for the prototype would be sufficient.
Comment 9 Vsevolod Vlasov 2011-05-26 08:38:04 PDT
(In reply to comment #8)
> (From update of attachment 90351 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=90351&action=review
> 
> > Source/WebCore/inspector/front-end/NetworkItemView.js:48
> > +        var responseView = new WebInspector.ResourceSourceFrame(resource);
> 
> You could reuse existing SourceFrame in case previewView is instance of ResourceSourceFrame. In fact, you should adjust resourceViewForResource to cache only SourceFrame views.
We ar enot caching SourceFrames anymore, but I reuse SourceFrame for the response and rpeview view the same resource.

> > Source/WebCore/inspector/front-end/Resource.js:795
> > +            if (data == null)
> 
> pending callbacks should be notified upon missing content.
Removed that.

> > Source/WebCore/inspector/front-end/ResourceHTMLView.js:52
> > +        this.element.textContent = "";
> 
> this.element.removeChildren()
Done.

> > Source/WebCore/inspector/front-end/ResourceView.js:49
> > +        return new WebInspector.ResourceHTMLView(resource);
> 
> Reuse SourceFrame-based views when possible as per comment above.
Reusing SourceFrame between preview and response view now.

> > Source/WebCore/inspector/front-end/ResourceView.js:80
> > +        if (WebInspector.ResourceJSONView.parseJSON(resource.content))
> 
> This seems to be a bit too expensive. Testing for the prototype would be sufficient.
This method was removed, so this is not needed anymore.
Comment 10 Vsevolod Vlasov 2011-05-26 08:39:52 PDT
Created attachment 94979 [details]
Patch (with fixes)
Comment 11 Pavel Feldman 2011-05-31 22:07:57 PDT
Comment on attachment 94979 [details]
Patch (with fixes)

View in context: https://bugs.webkit.org/attachment.cgi?id=94979&action=review

> Source/WebCore/inspector/front-end/Settings.js:71
> +    this.installApplicationSetting("resourceViewTab", "preview");

Where will user be navigated in case he has "content" in his settings?
Comment 12 Vsevolod Vlasov 2011-06-01 06:02:22 PDT
(In reply to comment #11)
> (From update of attachment 94979 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=94979&action=review
> 
> > Source/WebCore/inspector/front-end/Settings.js:71
> > +    this.installApplicationSetting("resourceViewTab", "preview");
> 
> Where will user be navigated in case he has "content" in his settings?
To headers tab that is the default one.
http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/inspector/front-end/NetworkItemView.js&q=resourceViewTab&exact_package=chromium&l=83
Comment 13 WebKit Review Bot 2011-06-08 07:58:44 PDT
Comment on attachment 94979 [details]
Patch (with fixes)

Clearing flags on attachment: 94979

Committed r88348: <http://trac.webkit.org/changeset/88348>
Comment 14 WebKit Review Bot 2011-06-08 07:58:49 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Yury Semikhatsky 2011-06-10 02:05:13 PDT
*** Bug 53067 has been marked as a duplicate of this bug. ***