Bug 180787 - REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources
Summary: REGRESSION: Web Inspector: Opening inspector crashes page if there are empty ...
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: Joseph Pecoraro
URL:
Keywords: InRadar
: 181246 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-13 17:39 PST by Joseph Pecoraro
Modified: 2018-01-03 10:19 PST (History)
11 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (14.61 KB, patch)
2017-12-13 17:42 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-12-13 17:39:31 PST
Opening inspector crashes page if there are empty resources

Test Page: (where empty.css is an empty file)
<link rel="stylesheet" href="empty.css">

Steps to Reproduce:
1. Inspect page with empty resource
  => Inspected Page Crashes

> Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
> Exception Note:        EXC_CORPSE_NOTIFY
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   com.apple.JavaScriptCore      	0x00000004a8af11cb JSC::Yarr::interpret(JSC::Yarr::BytecodePattern*, WTF::String const&, unsigned int, unsigned int*) + 11 (StringImpl.h:269)
> 1   com.apple.JavaScriptCore      	0x00000004a86359b4 Inspector::ContentSearchUtilities::findStylesheetSourceMapURL(WTF::String const&) + 372 (ContentSearchUtilities.cpp:189)
> 2   com.apple.WebCore             	0x000000010e696bb2 WebCore::InspectorPageAgent::sourceMapURLForResource(WebCore::CachedResource*) + 354 (InspectorPageAgent.cpp:166)
> 3   com.apple.WebCore             	0x000000010e69d2b6 WebCore::InspectorPageAgent::buildObjectForFrameTree(WebCore::Frame*) + 934 (RefPtr.h:81)
> 4   com.apple.WebCore             	0x000000010e69d641 non-virtual thunk to WebCore::InspectorPageAgent::getResourceTree(WTF::String&, WTF::RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) + 33 (utility:889)
> ...
Comment 1 Joseph Pecoraro 2017-12-13 17:39:39 PST
<rdar://problem/35934838>
Comment 2 Joseph Pecoraro 2017-12-13 17:42:22 PST
Created attachment 329296 [details]
[PATCH] Proposed Fix
Comment 3 BJ Burg 2017-12-13 20:27:36 PST
Comment on attachment 329296 [details]
[PATCH] Proposed Fix

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

r=me

> LayoutTests/inspector/page/empty-or-missing-resources.html:22
> +        }

v. nice test :)

> Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:177
> +    if (content.isEmpty())

We really should have ASSERT_OR_RETURN(String(), content.isEmpty()) or something like that. Unfortunately, our codebase completely mixes up #ifndef NDEBUG and #if !LOG_DISABLED, so this would require some refactoring to not get compiled out.
Comment 4 WebKit Commit Bot 2017-12-13 20:47:38 PST
Comment on attachment 329296 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 329296

Committed r225892: <https://trac.webkit.org/changeset/225892>
Comment 5 WebKit Commit Bot 2017-12-13 20:47:40 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Joseph Pecoraro 2018-01-03 10:19:59 PST
*** Bug 181246 has been marked as a duplicate of this bug. ***