Bug 151643 - Web Inspector: show something useful when the inspector frontend fails to load
Summary: Web Inspector: show something useful when the inspector frontend fails to load
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Blaze Burg
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-11-28 18:40 PST by Blaze Burg
Modified: 2015-12-01 10:45 PST (History)
8 users (show)

See Also:


Attachments
[Screenshot] Undocked Inspector (423.32 KB, image/png)
2015-11-28 18:41 PST, Blaze Burg
no flags Details
[Screenshot] Docked inspector (1.19 MB, image/png)
2015-11-28 18:41 PST, Blaze Burg
no flags Details
Proposed Fix (9.96 KB, patch)
2015-11-28 22:41 PST, Blaze Burg
no flags Details | Formatted Diff | Diff
Proposed Fix (10.50 KB, patch)
2015-11-28 23:36 PST, Blaze Burg
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blaze Burg 2015-11-28 18:40:55 PST
This is a huge mystery even if you know something went wrong.
We can easily provide:

 - An oops message
 - The actual errors
 - link to a prefilled bugzilla bug
 - A link that reloads the frontend
Comment 1 Radar WebKit Bug Importer 2015-11-28 18:41:15 PST
<rdar://problem/23681343>
Comment 2 Blaze Burg 2015-11-28 18:41:33 PST
Created attachment 266217 [details]
[Screenshot] Undocked Inspector
Comment 3 Blaze Burg 2015-11-28 18:41:58 PST
Created attachment 266218 [details]
[Screenshot] Docked inspector
Comment 4 Blaze Burg 2015-11-28 22:41:39 PST
Created attachment 266220 [details]
Proposed Fix
Comment 5 WebKit Commit Bot 2015-11-28 22:44:11 PST
Attachment 266220 [details] did not pass style-queue:


ERROR: Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:63:  Line contains single-quote character.  [js/syntax] [5]
ERROR: Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:64:  Line contains single-quote character.  [js/syntax] [5]
Total errors found: 2 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Blaze Burg 2015-11-28 23:36:18 PST
Created attachment 266221 [details]
Proposed Fix

New patch fixes some issues that come up if a ReferenceError happens after some of the inspector has been loaded, such as in WebInspector.contentLoaded. Unconditionally disarm all event handlers to prevent other weirdness.
Comment 7 WebKit Commit Bot 2015-11-28 23:37:24 PST
Attachment 266221 [details] did not pass style-queue:


ERROR: Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:75:  Line contains single-quote character.  [js/syntax] [5]
ERROR: Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:76:  Line contains single-quote character.  [js/syntax] [5]
Total errors found: 2 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Nikita Vasilyev 2015-11-29 19:21:08 PST
Comment on attachment 266221 [details]
Proposed Fix

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

Nice!

Text could be a tad smaller, especially in the docked state. I'd change margins and padding too. I think it would be easier if I send a follow-up patch.

> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.css:61
> +}

Nit: no empty CSS rules in the patch ready for landing.

> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:32
> +            document.write("<body></body></html>");

Do we have to use document.write?
Can we do:

    if (!document.body)
        document.body = document.createElement("body");

?

> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:44
> +            document.addEventListener(name, stopEventPropagation, true);

When would we need to do this?

> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:69
> +    Web Inspector encountered an error while loading.

No need for dot at the end of title.

I'm not a reviewer, so I'll keep it r?.
Comment 9 Blaze Burg 2015-11-30 09:29:25 PST
Comment on attachment 266221 [details]
Proposed Fix

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

>> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:32
>> +            document.write("<body></body></html>");
> 
> Do we have to use document.write?
> Can we do:
> 
>     if (!document.body)
>         document.body = document.createElement("body");
> 
> ?

I see no difference.

>> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:44
>> +            document.addEventListener(name, stopEventPropagation, true);
> 
> When would we need to do this?

See the comment that was posted with the second patch. I added a shorter comment above.

>> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:69
>> +    Web Inspector encountered an error while loading.
> 
> No need for dot at the end of title.
> 
> I'm not a reviewer, so I'll keep it r?.

Everything else on the page is a full sentence.
Comment 10 Blaze Burg 2015-11-30 09:34:04 PST
(In reply to comment #8)
> Comment on attachment 266221 [details]
> Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=266221&action=review
> 
> Nice!
> 
> Text could be a tad smaller, especially in the docked state. I'd change
> margins and padding too. I think it would be easier if I send a follow-up
> patch.

I prefer bigger text, since the error page doesn't zoom. That said, it's a step bigger than what Reader uses by default. To match what Reader uses, I can reduce the font size a bit (but keep the Sans Serif).
Comment 11 Timothy Hatcher 2015-11-30 10:25:58 PST
Comment on attachment 266221 [details]
Proposed Fix

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

>>> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:32
>>> +            document.write("<body></body></html>");
>> 
>> Do we have to use document.write?
>> Can we do:
>> 
>>     if (!document.body)
>>         document.body = document.createElement("body");
>> 
>> ?
> 
> I see no difference.

We try not to use things like innerHTML, document.write unless it is needed.
Comment 12 Blaze Burg 2015-11-30 15:27:35 PST
Committed r192837: <http://trac.webkit.org/changeset/192837>
Comment 13 Joseph Pecoraro 2015-12-01 10:41:59 PST
I think this caused a broken inspector on minified builds. The Debug/Foo.js being early on may be causing the minified/combined Main.html to output Main.js before its dependencies:

    <script src="Main.js"></script>
    <script src="CodeMirror.js"></script>
    <script src="Esprima.js"></script>
    <script src="ESLint.js"></script>
Comment 14 Joseph Pecoraro 2015-12-01 10:45:28 PST
Comment on attachment 266221 [details]
Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Debug/CatchEarlyErrors.js:68
> +    <img src="Images/Errors.svg" />

No need for "/>" on the known self-closing tags like <img>.