Title: [152694] branches/safari-537-branch/Tools

Diff

Modified: branches/safari-537-branch/Tools/ChangeLog (152693 => 152694)


--- branches/safari-537-branch/Tools/ChangeLog	2013-07-16 01:44:18 UTC (rev 152693)
+++ branches/safari-537-branch/Tools/ChangeLog	2013-07-16 02:00:44 UTC (rev 152694)
@@ -1,5 +1,39 @@
 2013-07-15  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r152498
+
+    2013-07-09  Anders Carlsson  <ander...@apple.com>
+
+            DumpRenderTree should stop sending unsupported URLs to NSWorkspace
+            https://bugs.webkit.org/show_bug.cgi?id=118514
+            <rdar://problem/13686836>
+
+            Reviewed by Sam Weinig.
+
+            Add a new default policy delegate and override decidePolicyForNavigationAction: to not pass unhandled URLs to NSWorkspace.
+
+            * DumpRenderTree/DefaultPolicyDelegate.h: Added.
+            * DumpRenderTree/DefaultPolicyDelegate.m: Added.
+            (-[DefaultPolicyDelegate webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
+            * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+            Add DefaultPolicyDelegate.h and DefaultPolicyDelegate.m.
+
+            * DumpRenderTree/mac/DumpRenderTree.mm:
+            (allocateGlobalControllers):
+            Allocate a DefaultPolicyDelegate object.
+
+            (resetWebViewToConsistentStateBeforeTesting):
+            Set the policy delegate to the default policy delegate.
+
+            * DumpRenderTree/mac/DumpRenderTreeMac.h:
+            Declare the defaultPolicyDelegate object.
+
+            * DumpRenderTree/mac/TestRunnerMac.mm:
+            (TestRunner::setCustomPolicyDelegate):
+            Set the policy delegate to the default delegate if setDelegate is false.
+
+2013-07-15  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r152366
 
     2013-07-03  Jer Noble  <jer.no...@apple.com>

Copied: branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.h (from rev 152498, trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.h) (0 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.h	                        (rev 0)
+++ branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.h	2013-07-16 02:00:44 UTC (rev 152694)
@@ -0,0 +1,13 @@
+//
+//  DefaultPolicyDelegate.h
+//  DumpRenderTree
+//
+//  Created by Anders Carlsson on 7/9/13.
+//
+//
+
+#import <WebKit/WebDefaultPolicyDelegate.h>
+
+@interface DefaultPolicyDelegate : WebDefaultPolicyDelegate
+
+@end

Copied: branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.m (from rev 152498, trunk/Tools/DumpRenderTree/DefaultPolicyDelegate.m) (0 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.m	                        (rev 0)
+++ branches/safari-537-branch/Tools/DumpRenderTree/DefaultPolicyDelegate.m	2013-07-16 02:00:44 UTC (rev 152694)
@@ -0,0 +1,34 @@
+//
+//  DefaultPolicyDelegate.m
+//  DumpRenderTree
+//
+//  Created by Anders Carlsson on 7/9/13.
+//
+//
+
+#import "DefaultPolicyDelegate.h"
+
+#import <WebKit/WebPolicyDelegatePrivate.h>
+#import <WebKit/WebViewPrivate.h>
+
+@implementation DefaultPolicyDelegate
+
+- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener
+{
+    if ([WebView _canHandleRequest:request]) {
+        [listener use];
+        return;
+    }
+
+    WebNavigationType navType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
+    if (navType == WebNavigationTypePlugInRequest) {
+        [listener use];
+        return;
+    }
+
+    // The default WebKit policy delegate passes the URL along to -[NSWorkspace openURL:] here,
+    // but we don't want to do that so we just ignore the navigation completely.
+    [listener ignore];
+}
+
+@end

Modified: branches/safari-537-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (152693 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj	2013-07-16 01:44:18 UTC (rev 152693)
+++ branches/safari-537-branch/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj	2013-07-16 02:00:44 UTC (rev 152694)
@@ -39,6 +39,8 @@
 		1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; };
 		1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; };
 		1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; };
+		1A2FB84E178C80930059FD96 /* DefaultPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */; };
+		1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */; };
 		1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A31EB3713466AC100017372 /* ConvertPoint.cpp */; };
 		1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */; };
 		1A4CCD4F171375A300981040 /* ToStringAndValueOfObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */; };
@@ -254,6 +256,8 @@
 		1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; };
 		1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; };
 		1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; };
+		1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultPolicyDelegate.h; sourceTree = "<group>"; };
+		1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DefaultPolicyDelegate.m; sourceTree = "<group>"; };
 		1A31EB3713466AC100017372 /* ConvertPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertPoint.cpp; sourceTree = "<group>"; };
 		1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURLDestroyingPlugin.cpp; sourceTree = "<group>"; };
 		1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToStringAndValueOfObject.cpp; sourceTree = "<group>"; };
@@ -446,6 +450,8 @@
 		08FB7794FE84155DC02AAC07 /* DumpRenderTree */ = {
 			isa = PBXGroup;
 			children = (
+				1A2FB84C178C80920059FD96 /* DefaultPolicyDelegate.h */,
+				1A2FB84D178C80930059FD96 /* DefaultPolicyDelegate.m */,
 				9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */,
 				32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
 				1422A2750AF6F4BD00E1A883 /* Delegates */,
@@ -756,6 +762,7 @@
 				BCB284C70CFA83C4007E533E /* PixelDumpSupport.h in Headers */,
 				BCB284D00CFA83CC007E533E /* PixelDumpSupportCG.h in Headers */,
 				BCA18B650C9B08C200114369 /* PolicyDelegate.h in Headers */,
+				1A2FB84E178C80930059FD96 /* DefaultPolicyDelegate.h in Headers */,
 				BCA18B670C9B08C200114369 /* ResourceLoadDelegate.h in Headers */,
 				3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */,
 				BC0131DB0C9772010087317D /* TestRunner.h in Headers */,
@@ -1002,6 +1009,7 @@
 				BC0131DA0C9772010087317D /* TestRunner.cpp in Sources */,
 				BCA18B240C9B014B00114369 /* TestRunnerMac.mm in Sources */,
 				BCA18B490C9B02C400114369 /* TextInputController.m in Sources */,
+				1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */,
 				BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */,
 				4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */,
 				440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */,

Modified: branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTree.mm (152693 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2013-07-16 01:44:18 UTC (rev 152693)
+++ branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2013-07-16 02:00:44 UTC (rev 152694)
@@ -32,6 +32,7 @@
 
 #import "AccessibilityController.h"
 #import "CheckedMalloc.h"
+#import "DefaultPolicyDelegate.h"
 #import "DumpRenderTreeDraggingInfo.h"
 #import "DumpRenderTreePasteboard.h"
 #import "DumpRenderTreeWindow.h"
@@ -148,6 +149,7 @@
 static ResourceLoadDelegate *resourceLoadDelegate;
 static HistoryDelegate *historyDelegate;
 PolicyDelegate *policyDelegate;
+DefaultPolicyDelegate *defaultPolicyDelegate;
 StorageTrackerDelegate *storageDelegate;
 
 static int dumpPixelsForAllTests = NO;
@@ -784,6 +786,7 @@
     policyDelegate = [[PolicyDelegate alloc] init];
     historyDelegate = [[HistoryDelegate alloc] init];
     storageDelegate = [[StorageTrackerDelegate alloc] init];
+    defaultPolicyDelegate = [[DefaultPolicyDelegate alloc] init];
 }
 
 // ObjC++ doens't seem to let me pass NSObject*& sadly.
@@ -1284,7 +1287,7 @@
     [webView _scaleWebView:1.0 atOrigin:NSZeroPoint];
     [webView _setCustomBackingScaleFactor:0];
     [webView setTabKeyCyclesThroughElements:YES];
-    [webView setPolicyDelegate:nil];
+    [webView setPolicyDelegate:defaultPolicyDelegate];
     [policyDelegate setPermissive:NO];
     [policyDelegate setControllerToNotifyDone:0];
     [frameLoadDelegate resetToConsistentState];

Modified: branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h (152693 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h	2013-07-16 01:44:18 UTC (rev 152693)
+++ branches/safari-537-branch/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h	2013-07-16 02:00:44 UTC (rev 152694)
@@ -32,6 +32,7 @@
 #include <CoreFoundation/CoreFoundation.h>
 
 #ifdef __OBJC__
+@class DefaultPolicyDelegate;
 @class DumpRenderTreeDraggingInfo;
 @class NavigationController;
 @class PolicyDelegate;
@@ -40,6 +41,7 @@
 @class WebScriptWorld;
 @class WebView;
 #else
+class DefaultPolicyDelegate;
 class DumpRenderTreeDraggingInfo;
 class NavigationController;
 class PolicyDelegate;
@@ -57,6 +59,7 @@
 extern NavigationController* gNavigationController;
 extern PolicyDelegate* policyDelegate;
 extern StorageTrackerDelegate* storageDelegate;
+extern DefaultPolicyDelegate *defaultPolicyDelegate;
 
 void setWaitToDumpWatchdog(CFRunLoopTimerRef);
 bool shouldSetWaitToDumpWatchdog();

Modified: branches/safari-537-branch/Tools/DumpRenderTree/mac/TestRunnerMac.mm (152693 => 152694)


--- branches/safari-537-branch/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2013-07-16 01:44:18 UTC (rev 152693)
+++ branches/safari-537-branch/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2013-07-16 02:00:44 UTC (rev 152694)
@@ -30,6 +30,7 @@
 #import "DumpRenderTree.h"
 #import "TestRunner.h"
 
+#import "DefaultPolicyDelegate.h"
 #import "EditingDelegate.h"
 #import "MockGeolocationProvider.h"
 #import "MockWebNotificationProvider.h"
@@ -407,11 +408,13 @@
 
 void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive)
 {
-    if (setDelegate) {
-        [policyDelegate setPermissive:permissive];
-        [[mainFrame webView] setPolicyDelegate:policyDelegate];
-    } else
-        [[mainFrame webView] setPolicyDelegate:nil];
+    if (!setDelegate) {
+        [[mainFrame webView] setPolicyDelegate:defaultPolicyDelegate];
+        return;
+    }
+
+    [policyDelegate setPermissive:permissive];
+    [[mainFrame webView] setPolicyDelegate:policyDelegate];
 }
 
 void TestRunner::setDatabaseQuota(unsigned long long quota)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to