Title: [164884] trunk/Source
Revision
164884
Author
[email protected]
Date
2014-02-28 14:51:45 -0800 (Fri, 28 Feb 2014)

Log Message

Properly handle when Test.html is not present in Production builds.

https://bugs.webkit.org/show_bug.cgi?id=129506

Reviewed by Joseph Pecoraro.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.mm:
(-[WebInspectorWindowController inspectorTestPagePath]):
(-[WebInspectorWindowController webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):

Source/WebKit2:

* UIProcess/WebInspectorProxy.cpp:
(WebKit::isMainOrTestInspectorPage):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::inspectorTestPageURL):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (164883 => 164884)


--- trunk/Source/WebKit/mac/ChangeLog	2014-02-28 22:10:56 UTC (rev 164883)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-02-28 22:51:45 UTC (rev 164884)
@@ -1,3 +1,15 @@
+2014-02-28  Timothy Hatcher  <[email protected]>
+
+        Properly handle when Test.html is not present in Production builds.
+
+        https://bugs.webkit.org/show_bug.cgi?id=129506
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (-[WebInspectorWindowController inspectorTestPagePath]):
+        (-[WebInspectorWindowController webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
+
 2014-02-27  Brian Burg  <[email protected]>
 
         Web Inspector: model tests should use a special Test.html inspector page

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm (164883 => 164884)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm	2014-02-28 22:10:56 UTC (rev 164883)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm	2014-02-28 22:51:45 UTC (rev 164884)
@@ -464,7 +464,11 @@
     WebInspectorUILibrary();
 
     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
-    ASSERT([path length]);
+
+    // We might not have a Test.html in Production builds.
+    if (!path)
+        return nil;
+
     return path;
 }
 
@@ -763,7 +767,8 @@
     }
 
     // Allow loading of the test inspector file.
-    if ([[request URL] isFileURL] && [[[request URL] path] isEqualToString:[self inspectorTestPagePath]]) {
+    NSString *testPagePath = [self inspectorTestPagePath];
+    if (testPagePath && [[request URL] isFileURL] && [[[request URL] path] isEqualToString:testPagePath]) {
         [listener use];
         return;
     }

Modified: trunk/Source/WebKit2/ChangeLog (164883 => 164884)


--- trunk/Source/WebKit2/ChangeLog	2014-02-28 22:10:56 UTC (rev 164883)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-28 22:51:45 UTC (rev 164884)
@@ -1,3 +1,16 @@
+2014-02-28  Timothy Hatcher  <[email protected]>
+
+        Properly handle when Test.html is not present in Production builds.
+
+        https://bugs.webkit.org/show_bug.cgi?id=129506
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::isMainOrTestInspectorPage):
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::inspectorTestPageURL):
+
 2014-02-28  Pratik Solanki  <[email protected]>
 
         [iOS][WebKit2] Don't grab mach exception port on iOS

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (164883 => 164884)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2014-02-28 22:10:56 UTC (rev 164883)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2014-02-28 22:51:45 UTC (rev 164884)
@@ -364,17 +364,24 @@
 
 static bool isMainOrTestInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef)
 {
+    URL requestURL(URL(), toImpl(requestRef)->resourceRequest().url());
+    if (!WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()))
+        return false;
+
     // Use URL so we can compare just the paths.
     URL mainPageURL(URL(), webInspectorProxy->inspectorPageURL());
+    ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(mainPageURL.protocol()));
+    if (decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(mainPageURL.path()))
+        return true;
+
+    // We might not have a Test URL in Production builds.
+    String testPageURLString = webInspectorProxy->inspectorTestPageURL();
+    if (testPageURLString.isNull())
+        return false;
+
     URL testPageURL(URL(), webInspectorProxy->inspectorTestPageURL());
-    URL requestURL(URL(), toImpl(requestRef)->resourceRequest().url());
-
-    ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(mainPageURL.protocol()));
     ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(testPageURL.protocol()));
-
-    bool isMainPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(mainPageURL.path());
-    bool isTestPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(testPageURL.path());
-    return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && (isMainPageURL || isTestPageURL);
+    return decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(testPageURL.path());
 }
 
 static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef requestRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (164883 => 164884)


--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2014-02-28 22:10:56 UTC (rev 164883)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2014-02-28 22:51:45 UTC (rev 164884)
@@ -763,8 +763,11 @@
     WebInspectorUILibrary();
 
     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
-    ASSERT([path length]);
 
+    // We might not have a Test.html in Production builds.
+    if (!path)
+        return String();
+
     return [[NSURL fileURLWithPath:path] absoluteString];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to