Title: [129566] trunk
Revision
129566
Author
simon.fra...@apple.com
Date
2012-09-25 15:54:30 -0700 (Tue, 25 Sep 2012)

Log Message

<rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed

Reviewed by Mark Rowe.

Use a new WebKitSytemInterface function to add data to crash logs about which
test was running when the crash happened.

Source/WebCore:

* WebCore.exp.in: Export wkSetCrashReportApplicationSpecificInformation
* platform/mac/WebCoreSystemInterface.h: Add wkSetCrashReportApplicationSpecificInformation.
* platform/mac/WebCoreSystemInterface.mm: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation.

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):  Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation.

Tools:

* DumpRenderTree/mac/Configurations/DebugRelease.xcconfig: Make sure WEBKIT_SYSTEM_INTERFACE_LIBRARY is defined.
* DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig: link with the WebKitSystemInterface library.
* DumpRenderTree/mac/FrameLoadDelegate.mm:
(testPathFromURL): Given a (probably) file URL, return the part after "/LayoutTests/"
(-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): Tell Crash Reporter which test was running,
if we're the main frame and the test is active.
* WebKitTestRunner/Configurations/DebugRelease.xcconfig: Make sure WEBKIT_SYSTEM_INTERFACE_LIBRARY is defined.
* WebKitTestRunner/Configurations/InjectedBundle.xcconfig: link the injected bundle with the WebKitSystemInterface library.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): Call platformDidStartProvisionalLoadForFrame().
(WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Stub for non-Mac platforms.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
Add a platformDidStartProvisionalLoadForFrame() for platform-specific work.
* WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm: Added.
(WTR::testPathFromURL): Given a (probably) file URL, return the part after "/LayoutTests/"
(WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Tell Crash Reporter which test was running,
if we're the main frame.
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Add InjectedBundlePageMac.mm.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129565 => 129566)


--- trunk/Source/WebCore/ChangeLog	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebCore/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
@@ -1,3 +1,16 @@
+2012-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed
+
+        Reviewed by Mark Rowe.
+
+        Use a new WebKitSytemInterface function to add data to crash logs about which 
+        test was running when the crash happened.
+
+        * WebCore.exp.in: Export wkSetCrashReportApplicationSpecificInformation
+        * platform/mac/WebCoreSystemInterface.h: Add wkSetCrashReportApplicationSpecificInformation.
+        * platform/mac/WebCoreSystemInterface.mm: Ditto.
+
 2012-09-25  Adam Klein  <ad...@chromium.org>
 
         Remove unused DOMAttrModified from EventsNames and Document::ListenerType

Modified: trunk/Source/WebCore/WebCore.exp.in (129565 => 129566)


--- trunk/Source/WebCore/WebCore.exp.in	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-09-25 22:54:30 UTC (rev 129566)
@@ -2036,6 +2036,7 @@
 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
 _wkAVAssetResolvedURL
 _wkCopyDefaultSearchProviderDisplayName
+_wkSetCrashReportApplicationSpecificInformation
 _wkCreateVMPressureDispatchOnMainQueue
 _wkCursor
 _wkExecutableWasLinkedOnOrBeforeSnowLeopard

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (129565 => 129566)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2012-09-25 22:54:30 UTC (rev 129566)
@@ -246,6 +246,7 @@
 extern bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
 
 extern CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
+extern void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
 
 extern NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
 

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (129565 => 129566)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2012-09-25 22:54:30 UTC (rev 129566)
@@ -144,6 +144,7 @@
 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
 
 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
+void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef);
 
 NSURL *(*wkAVAssetResolvedURL)(AVAsset*);
 

Modified: trunk/Source/WebKit/mac/ChangeLog (129565 => 129566)


--- trunk/Source/WebKit/mac/ChangeLog	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
@@ -1,3 +1,15 @@
+2012-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed
+
+        Reviewed by Mark Rowe.
+
+        Use a new WebKitSytemInterface function to add data to crash logs about which 
+        test was running when the crash happened.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation.
+
 2012-09-25  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=95397

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (129565 => 129566)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2012-09-25 22:54:30 UTC (rev 129566)
@@ -132,6 +132,7 @@
     INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
     INIT(RecommendedScrollerStyle);
     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
+    INIT(SetCrashReportApplicationSpecificInformation);
     INIT(CopyDefaultSearchProviderDisplayName);
     INIT(AVAssetResolvedURL);
     INIT(Cursor);

Modified: trunk/Source/WebKit2/ChangeLog (129565 => 129566)


--- trunk/Source/WebKit2/ChangeLog	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
@@ -1,3 +1,15 @@
+2012-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed
+
+        Reviewed by Mark Rowe.
+
+        Use a new WebKitSytemInterface function to add data to crash logs about which 
+        test was running when the crash happened.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):  Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation.
+
 2012-09-25  Beth Dakin  <bda...@apple.com>
 
         Build fix. I removed this function as a part of 

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (129565 => 129566)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2012-09-25 22:54:30 UTC (rev 129566)
@@ -124,6 +124,7 @@
         INIT(RecommendedScrollerStyle);
         INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
         INIT(CopyDefaultSearchProviderDisplayName);
+        INIT(SetCrashReportApplicationSpecificInformation);
         INIT(AVAssetResolvedURL);
         INIT(Cursor);
 #else

Modified: trunk/Tools/ChangeLog (129565 => 129566)


--- trunk/Tools/ChangeLog	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/ChangeLog	2012-09-25 22:54:30 UTC (rev 129566)
@@ -1,3 +1,31 @@
+2012-09-24  Simon Fraser  <simon.fra...@apple.com>
+
+        <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed
+
+        Reviewed by Mark Rowe.
+
+        Use a new WebKitSytemInterface function to add data to crash logs about which 
+        test was running when the crash happened.
+
+        * DumpRenderTree/mac/Configurations/DebugRelease.xcconfig: Make sure WEBKIT_SYSTEM_INTERFACE_LIBRARY is defined.
+        * DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig: link with the WebKitSystemInterface library.
+        * DumpRenderTree/mac/FrameLoadDelegate.mm:
+        (testPathFromURL): Given a (probably) file URL, return the part after "/LayoutTests/"
+        (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]): Tell Crash Reporter which test was running,
+        if we're the main frame and the test is active.
+        * WebKitTestRunner/Configurations/DebugRelease.xcconfig: Make sure WEBKIT_SYSTEM_INTERFACE_LIBRARY is defined.
+        * WebKitTestRunner/Configurations/InjectedBundle.xcconfig: link the injected bundle with the WebKitSystemInterface library.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame): Call platformDidStartProvisionalLoadForFrame().
+        (WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Stub for non-Mac platforms.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+        Add a platformDidStartProvisionalLoadForFrame() for platform-specific work.
+        * WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm: Added.
+        (WTR::testPathFromURL): Given a (probably) file URL, return the part after "/LayoutTests/"
+        (WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Tell Crash Reporter which test was running,
+        if we're the main frame.
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Add InjectedBundlePageMac.mm.
+
 2012-09-25  Julie Parent  <jpar...@chromium.org>
 
         Make test_shell_tests show up in flakiness dashboard.

Modified: trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig (129565 => 129566)


--- trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig	2012-09-25 22:54:30 UTC (rev 129566)
@@ -38,3 +38,13 @@
 MACOSX_DEPLOYMENT_TARGET_1070 = 10.7;
 MACOSX_DEPLOYMENT_TARGET_1080 = 10.8;
 MACOSX_DEPLOYMENT_TARGET_1090 = 10.9;
+
+WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(REAL_PLATFORM_NAME));
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos = WebKitSystemInterface;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphonesimulator = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos);
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion;

Modified: trunk/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig (129565 => 129566)


--- trunk/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/DumpRenderTree/mac/Configurations/DumpRenderTree.xcconfig	2012-09-25 22:54:30 UTC (rev 129566)
@@ -21,7 +21,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
-OTHER_LDFLAGS = -sectcreate __DATA Ahem qt/fonts/AHEM____.TTF -sectcreate __DATA WeightWatcher100 fonts/WebKitWeightWatcher100.ttf -sectcreate __DATA WeightWatcher200 fonts/WebKitWeightWatcher200.ttf -sectcreate __DATA WeightWatcher300 fonts/WebKitWeightWatcher300.ttf -sectcreate __DATA WeightWatcher400 fonts/WebKitWeightWatcher400.ttf -sectcreate __DATA WeightWatcher500 fonts/WebKitWeightWatcher500.ttf -sectcreate __DATA WeightWatcher600 fonts/WebKitWeightWatcher600.ttf -sectcreate __DATA WeightWatcher700 fonts/WebKitWeightWatcher700.ttf -sectcreate __DATA WeightWatcher800 fonts/WebKitWeightWatcher800.ttf -sectcreate __DATA WeightWatcher900 fonts/WebKitWeightWatcher900.ttf -sectcreate __DATA HiraMaruMono-W4 fonts/SampleFont.sfont
+OTHER_LDFLAGS = -sectcreate __DATA Ahem qt/fonts/AHEM____.TTF -sectcreate __DATA WeightWatcher100 fonts/WebKitWeightWatcher100.ttf -sectcreate __DATA WeightWatcher200 fonts/WebKitWeightWatcher200.ttf -sectcreate __DATA WeightWatcher300 fonts/WebKitWeightWatcher300.ttf -sectcreate __DATA WeightWatcher400 fonts/WebKitWeightWatcher400.ttf -sectcreate __DATA WeightWatcher500 fonts/WebKitWeightWatcher500.ttf -sectcreate __DATA WeightWatcher600 fonts/WebKitWeightWatcher600.ttf -sectcreate __DATA WeightWatcher700 fonts/WebKitWeightWatcher700.ttf -sectcreate __DATA WeightWatcher800 fonts/WebKitWeightWatcher800.ttf -sectcreate __DATA WeightWatcher900 fonts/WebKitWeightWatcher900.ttf -sectcreate __DATA HiraMaruMono-W4 fonts/SampleFont.sfont -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)
 LD_RUNPATH_SEARCH_PATHS = "@loader_path/.";
 PRODUCT_NAME = DumpRenderTree
 GCC_ENABLE_OBJC_EXCEPTIONS = YES

Modified: trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm (129565 => 129566)


--- trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm	2012-09-25 22:54:30 UTC (rev 129566)
@@ -45,6 +45,7 @@
 #import "WorkQueue.h"
 #import "WorkQueueItem.h"
 #import <_javascript_Core/_javascript_Core.h>
+#import <WebKitSystemInterface.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebHTMLViewPrivate.h>
 #import <WebKit/WebKit.h>
@@ -154,8 +155,39 @@
     }
 }
 
+static NSString *testPathFromURL(NSURL* url)
+{
+    if ([url isFileURL]) {
+        NSString *filePath = [url path];
+        NSRange layoutTestsRange = [filePath rangeOfString:@"/LayoutTests/"];
+        if (layoutTestsRange.location == NSNotFound)
+            return nil;
+            
+        return [filePath substringFromIndex:NSMaxRange(layoutTestsRange)];
+    }
+    
+    // HTTP test URLs look like: http://127.0.0.1:8000/inspector/resource-tree/resource-request-content-after-loading-and-clearing-cache.html
+    if (![[url scheme] isEqualToString:@"http"] && ![[url scheme] isEqualToString:@"https"])
+        return nil;
+
+    if ([[url host] isEqualToString:@"127.0.0.1"] && ([[url port] intValue] == 8000 || [[url port] intValue] == 8443))
+        return [url path];
+
+    return nil;
+}
+
 - (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
 {
+    ASSERT([frame provisionalDataSource]);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+    if (!done && [[sender mainFrame] isEqual:frame]) {
+        NSURL *provisionalLoadURL = [[[frame provisionalDataSource] initialRequest] URL];
+        if (NSString *testPath = testPathFromURL(provisionalLoadURL))
+            WKSetCrashReportApplicationSpecificInformation((CFStringRef)[@"CRASHING TEST: " stringByAppendingString:testPath]);
+    }
+#endif
+
     if (!done && gTestRunner->dumpFrameLoadCallbacks()) {
         NSString *string = [NSString stringWithFormat:@"%@ - didStartProvisionalLoadForFrame", [frame _drt_descriptionSuitableForTestResult]];
         printf ("%s\n", [string UTF8String]);
@@ -166,7 +198,6 @@
         printf ("%s\n", [string UTF8String]);
     }
 
-    ASSERT([frame provisionalDataSource]);
     // Make sure we only set this once per test.  If it gets cleared, and then set again, we might
     // end up doing two dumps for one test.
     if (!topLoadingFrame && !done)

Modified: trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig (129565 => 129566)


--- trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig	2012-09-25 22:54:30 UTC (rev 129566)
@@ -40,3 +40,13 @@
 MACOSX_DEPLOYMENT_TARGET_1090 = 10.9;
 
 WEBKIT_UMBRELLA_FRAMEWORKS_DIR = $(BUILT_PRODUCTS_DIR);
+
+WEBKIT_SYSTEM_INTERFACE_LIBRARY = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_$(REAL_PLATFORM_NAME));
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos = WebKitSystemInterface;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphonesimulator = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_iphoneos);
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion;
+WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion;

Modified: trunk/Tools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig (129565 => 129566)


--- trunk/Tools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/WebKitTestRunner/Configurations/InjectedBundle.xcconfig	2012-09-25 22:54:30 UTC (rev 129566)
@@ -26,3 +26,4 @@
 
 INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Resources;
 SKIP_INSTALL = NO;
+OTHER_LDFLAGS = -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (129565 => 129566)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-25 22:54:30 UTC (rev 129566)
@@ -743,6 +743,8 @@
     if (!InjectedBundle::shared().isTestRunning())
         return;
 
+    platformDidStartProvisionalLoadForFrame(frame);
+
     if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) {
         dumpFrameDescriptionSuitableForTestResult(frame);
         InjectedBundle::shared().stringBuilder()->appendLiteral(" - didStartProvisionalLoadForFrame\n");
@@ -1870,4 +1872,10 @@
     InjectedBundle::shared().stringBuilder()->appendLiteral("===============================================\n");
 }
 
+#if !PLATFORM(MAC)
+void InjectedBundlePage::platformDidStartProvisionalLoadForFrame(WKBundleFrameRef)
+{
+}
+#endif
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (129565 => 129566)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-25 22:54:30 UTC (rev 129566)
@@ -172,6 +172,8 @@
     void dumpAllFramesText();
     void dumpAllFrameScrollPositions();
 
+    void platformDidStartProvisionalLoadForFrame(WKBundleFrameRef);
+
     WKBundlePageRef m_page;
     WKRetainPtr<WKBundleScriptWorldRef> m_world;
     WKRetainPtr<WKBundleBackForwardListItemRef> m_previousTestBackForwardListItem;

Added: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm (0 => 129566)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm	2012-09-25 22:54:30 UTC (rev 129566)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "InjectedBundlePage.h"
+
+#import "StringFunctions.h"
+#import <WebKit2/WKBundleFrame.h>
+#import <WebKit2/WKURLCF.h>
+#import <WebKitSystemInterface.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/text/StringBuilder.h>
+#import <wtf/text/WTFString.h>
+
+namespace WTR {
+
+using namespace WTF;
+
+static String testPathFromURL(WKURLRef url)
+{
+    RetainPtr<CFURLRef> cfURL(AdoptCF, WKURLCopyCFURL(kCFAllocatorDefault, url));
+    
+    RetainPtr<CFStringRef> schemeCFString(AdoptCF, CFURLCopyScheme(cfURL.get()));
+    RetainPtr<CFStringRef> pathCFString(AdoptCF, CFURLCopyPath(cfURL.get()));
+
+    String schemeString(schemeCFString.get());
+    String pathString(pathCFString.get());
+    
+    if (equalIgnoringCase(schemeString, "file")) {
+        String layoutTests("/LayoutTests/");
+        size_t layoutTestsOffset = pathString.find(layoutTests);
+        if (layoutTestsOffset == notFound)
+            return String();
+
+        return pathString.substring(layoutTestsOffset + layoutTests.length());
+    }
+
+    if (!equalIgnoringCase(schemeString, "http") && !equalIgnoringCase(schemeString, "https"))
+        return String();
+
+    RetainPtr<CFStringRef> hostCFString(AdoptCF, CFURLCopyHostName(cfURL.get()));
+    String hostString(hostCFString.get());
+    if (hostString == "127.0.0.1"  && (CFURLGetPortNumber(cfURL.get()) == 8000 || CFURLGetPortNumber(cfURL.get()) == 8443))
+        return pathString;
+
+    return String();
+}
+
+void InjectedBundlePage::platformDidStartProvisionalLoadForFrame(WKBundleFrameRef frame)
+{
+    if (!WKBundleFrameIsMainFrame(frame))
+        return;
+
+    WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyProvisionalURL(frame));
+    
+    String testPath = testPathFromURL(mainFrameURL.get());
+    if (!testPath.isNull()) {
+        StringBuilder builder;
+        builder.appendLiteral("CRASHING TEST: ");
+        builder.append(testPath);
+        RetainPtr<CFStringRef> cfString(AdoptCF, builder.toString().createCFString());
+        WKSetCrashReportApplicationSpecificInformation(cfString.get());
+    }
+}
+
+} // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (129565 => 129566)


--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2012-09-25 22:54:19 UTC (rev 129565)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2012-09-25 22:54:30 UTC (rev 129566)
@@ -23,6 +23,7 @@
 /* Begin PBXBuildFile section */
 		0F5169CB1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
 		0F5169CC1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
+		0FAF67EF160D6C100077CB2B /* InjectedBundlePageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FAF67EE160D6C100077CB2B /* InjectedBundlePageMac.mm */; };
 		26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */; };
 		29210EAE144CACB700835BB5 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */; };
 		29210EB0144CACBD00835BB5 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */; };
@@ -102,6 +103,7 @@
 
 /* Begin PBXFileReference section */
 		0F5169CA1445222D00E0A9D7 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		0FAF67EE160D6C100077CB2B /* InjectedBundlePageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundlePageMac.mm; sourceTree = "<group>"; };
 		26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationProviderMock.cpp; sourceTree = "<group>"; };
 		26D758E6160BECDD00268472 /* GeolocationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationProviderMock.h; sourceTree = "<group>"; };
 		29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
@@ -325,6 +327,7 @@
 			children = (
 				65EB859F11EC67CC0034D300 /* ActivateFonts.mm */,
 				BC8DAD771316D7B900EC96FC /* InjectedBundleMac.mm */,
+				0FAF67EE160D6C100077CB2B /* InjectedBundlePageMac.mm */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -618,6 +621,7 @@
 				29A8FCE5145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm in Sources */,
 				8097338A14874A5A008156D9 /* AccessibilityNotificationHandler.mm in Sources */,
 				8034C6621487636400AC32E9 /* AccessibilityControllerMac.mm in Sources */,
+				0FAF67EF160D6C100077CB2B /* InjectedBundlePageMac.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to