WebKit Bugzilla
Attachment 362392 Details for
Bug 194819
: Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194819-20190219192826.patch (text/plain), 5.88 KB, created by
Loïc Yhuel
on 2019-02-19 10:28:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Loïc Yhuel
Created:
2019-02-19 10:28:27 PST
Size:
5.88 KB
patch
obsolete
>Subversion Revision: 241757 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5bdc6d3fa0a049d3046409362ea006d8fefb7ab0..47f1e5da18f1e70baad976cd100f2e0cf5310872 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-02-19 Loïc Yhuel <loic.yhuel@softathome.com> >+ >+ Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions >+ https://bugs.webkit.org/show_bug.cgi?id=194819 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html >+ >+ * Modules/websockets/WebSocketChannel.h: >+ (WebCore::WebSocketChannel::hasCreatedHandshake): >+ * inspector/agents/page/PageNetworkAgent.cpp: >+ Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable. >+ > 2019-02-16 Darin Adler <darin@apple.com> > > Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc. >diff --git a/Source/WebCore/Modules/websockets/WebSocketChannel.h b/Source/WebCore/Modules/websockets/WebSocketChannel.h >index 68ce533463790b05696e7d660a6ccfefcba94dd1..aae66b492305b936772f7e27a90431a8c7a4ddcd 100644 >--- a/Source/WebCore/Modules/websockets/WebSocketChannel.h >+++ b/Source/WebCore/Modules/websockets/WebSocketChannel.h >@@ -116,6 +116,7 @@ public: > void didFail(int errorCode) override; > > unsigned identifier() const { return m_identifier; } >+ bool hasCreatedHandshake() { return !!m_handshake; } > ResourceRequest clientHandshakeRequest(); > const ResourceResponse& serverHandshakeResponse() const; > WebSocketHandshake::Mode handshakeMode() const; >diff --git a/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp b/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp >index 92980dc264e15a57365ebf11517cf32db9da0d19..c5d926a0b155f06d976f8c2c06eac04a593d20e4 100644 >--- a/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp >+++ b/Source/WebCore/inspector/agents/page/PageNetworkAgent.cpp >@@ -69,6 +69,9 @@ Vector<WebSocket*> PageNetworkAgent::activeWebSockets(const LockHolder& lock) > if (!channel) > continue; > >+ if (!channel->hasCreatedHandshake()) >+ continue; >+ > if (!is<Document>(webSocket->scriptExecutionContext())) > continue; > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 74027c8ab7d996c9894917ba87381adf6937a060..0c32a9dc6aed322f71910c6cdde1bbd64f78b713 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-19 Loïc Yhuel <loic.yhuel@softathome.com> >+ >+ Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions >+ https://bugs.webkit.org/show_bug.cgi?id=194819 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/inspector/network/contentextensions/blocked-websocket-crash-expected.txt: Added. >+ * http/tests/inspector/network/contentextensions/blocked-websocket-crash.html: Added. >+ * http/tests/inspector/network/contentextensions/blocked-websocket-crash.html.json: Added. >+ > 2019-02-18 Alex Christensen <achristensen@webkit.org> > > Adjust test expectations after r241754 >diff --git a/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash-expected.txt b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..36b25f98a22756a928fbb5ad8184e0d8534d57ad >--- /dev/null >+++ b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash-expected.txt >@@ -0,0 +1,7 @@ >+CONSOLE MESSAGE: line 9: Content blocker prevented frame displaying http://127.0.0.1:8000/inspector/network/contentextensions/blocked-websocket-crash.html from loading a resource from ws://127.0.0.1/ >+Test opening inspector after a blocked WebSocket connection. >+ >+ >+== Running test suite: Network.BlockedRequests >+-- Running test case: Network.BlockedRequests.WebSocket >+ >diff --git a/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a0bb0c7e4dc0dce969d695dfda936c4ee148fe4f >--- /dev/null >+++ b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html >@@ -0,0 +1,30 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<script src="../../resources/inspector-test.js"></script> >+<script> >+// Create a WebSocket before opening the inspector >+// url doesn't matter : it will be blocked by the content extension >+let ws = new WebSocket("ws://127.0.0.1"); >+ >+function test() { >+ let suite = InspectorTest.createAsyncSuite("Network.BlockedRequests"); >+ suite.addTestCase({ >+ name: "Network.BlockedRequests.WebSocket", >+ description: "Blocked WebSocket connection", >+ test(resolve, reject) { >+ // The inspector won't receive anything, so there is nothing to expect. >+ // The test just makes sure the inspector initialization is done >+ resolve(); >+ } >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p>Test opening inspector after a blocked WebSocket connection.</p> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html.json b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html.json >new file mode 100644 >index 0000000000000000000000000000000000000000..902a369104354411b9d21586045fee4d377551d8 >--- /dev/null >+++ b/LayoutTests/http/tests/inspector/network/contentextensions/blocked-websocket-crash.html.json >@@ -0,0 +1,10 @@ >+[ >+ { >+ "trigger": { >+ "url-filter": "^ws://" >+ }, >+ "action": { >+ "type": "block" >+ } >+ } >+]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194819
:
362392
|
362403
|
362411
|
362415
|
362421
|
362496