Title: [103640] trunk/Tools
Revision
103640
Author
[email protected]
Date
2011-12-23 15:47:00 -0800 (Fri, 23 Dec 2011)

Log Message

Provide option to disable Mac OS 10.7 application resume when using
{debug, run}-{safari, minibrowser, test-runner, test-webkit-api}, and run-webkit-app
https://bugs.webkit.org/show_bug.cgi?id=66902

Reviewed by David Kilzer.

Add an optional command line argument --no-saved-state to disable
application resume (state restoration) for the session on Mac OS 10.7.

For instance, when debugging an issue in Safari it is useful to be able
to temporarily disable application resume. Currently you can disable
application resume when launching Safari from within Xcode. We should
expose a similar option in our command line tools.

* Scripts/debug-minibrowser: Call printHelpAndExitForRunAndDebugWebKitAppIfNeeded()
to print a help message and exit() if the command line argument --help was given.
* Scripts/debug-safari: Ditto.
* Scripts/debug-test-runner: Ditto.
* Scripts/run-minibrowser: Ditto.
* Scripts/run-safari: Ditto.
* Scripts/run-test-runner: Ditto.
* Scripts/run-test-webkit-api: Ditto.
* Scripts/run-webkit-app: Ditto.
* Scripts/webkitdirs.pm:
(printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Added.
(argumentsForRunAndDebugMacWebKitApp): Added.
(runMacWebKitApp): If the --no-saved-state command line argument was given then
disable application resume for the session.
(execMacWebKitAppForDebugging): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (103639 => 103640)


--- trunk/Tools/ChangeLog	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/ChangeLog	2011-12-23 23:47:00 UTC (rev 103640)
@@ -1,3 +1,35 @@
+2011-12-23  Daniel Bates  <[email protected]>
+
+        Provide option to disable Mac OS 10.7 application resume when using
+        {debug, run}-{safari, minibrowser, test-runner, test-webkit-api}, and run-webkit-app
+        https://bugs.webkit.org/show_bug.cgi?id=66902
+
+        Reviewed by David Kilzer.
+
+        Add an optional command line argument --no-saved-state to disable
+        application resume (state restoration) for the session on Mac OS 10.7.
+
+        For instance, when debugging an issue in Safari it is useful to be able
+        to temporarily disable application resume. Currently you can disable
+        application resume when launching Safari from within Xcode. We should
+        expose a similar option in our command line tools.
+
+        * Scripts/debug-minibrowser: Call printHelpAndExitForRunAndDebugWebKitAppIfNeeded()
+        to print a help message and exit() if the command line argument --help was given.
+        * Scripts/debug-safari: Ditto.
+        * Scripts/debug-test-runner: Ditto.
+        * Scripts/run-minibrowser: Ditto.
+        * Scripts/run-safari: Ditto.
+        * Scripts/run-test-runner: Ditto.
+        * Scripts/run-test-webkit-api: Ditto.
+        * Scripts/run-webkit-app: Ditto.
+        * Scripts/webkitdirs.pm:
+        (printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Added.
+        (argumentsForRunAndDebugMacWebKitApp): Added.
+        (runMacWebKitApp): If the --no-saved-state command line argument was given then
+        disable application resume for the session.
+        (execMacWebKitAppForDebugging): Ditto.
+
 2011-12-23  Dmitry Lomov  <[email protected]>
 
         [WebWorkers][Chromium] Remove remains of cross-process dedicated worker implementation.

Modified: trunk/Tools/Scripts/debug-minibrowser (103639 => 103640)


--- trunk/Tools/Scripts/debug-minibrowser	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/debug-minibrowser	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(debugMiniBrowser());

Modified: trunk/Tools/Scripts/debug-safari (103639 => 103640)


--- trunk/Tools/Scripts/debug-safari	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/debug-safari	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(debugSafari());

Modified: trunk/Tools/Scripts/debug-test-runner (103639 => 103640)


--- trunk/Tools/Scripts/debug-test-runner	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/debug-test-runner	2011-12-23 23:47:00 UTC (rev 103640)
@@ -30,6 +30,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(debugWebKitTestRunner());

Modified: trunk/Tools/Scripts/run-minibrowser (103639 => 103640)


--- trunk/Tools/Scripts/run-minibrowser	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/run-minibrowser	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(runMiniBrowser());

Modified: trunk/Tools/Scripts/run-safari (103639 => 103640)


--- trunk/Tools/Scripts/run-safari	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/run-safari	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 # Check to see that all the frameworks are built.

Modified: trunk/Tools/Scripts/run-test-runner (103639 => 103640)


--- trunk/Tools/Scripts/run-test-runner	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/run-test-runner	2011-12-23 23:47:00 UTC (rev 103640)
@@ -30,6 +30,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(runWebKitTestRunner());

Modified: trunk/Tools/Scripts/run-test-webkit-api (103639 => 103640)


--- trunk/Tools/Scripts/run-test-webkit-api	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/run-test-webkit-api	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 exit exitStatus(runTestWebKitAPI());

Modified: trunk/Tools/Scripts/run-webkit-app (103639 => 103640)


--- trunk/Tools/Scripts/run-webkit-app	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/run-webkit-app	2011-12-23 23:47:00 UTC (rev 103640)
@@ -33,6 +33,8 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+
 setConfiguration();
 
 die "Did not specify an application to open (e.g. run-webkit-app AppName).\n" unless length($ARGV[0]) > 0;

Modified: trunk/Tools/Scripts/webkitdirs.pm (103639 => 103640)


--- trunk/Tools/Scripts/webkitdirs.pm	2011-12-23 22:33:58 UTC (rev 103639)
+++ trunk/Tools/Scripts/webkitdirs.pm	2011-12-23 23:47:00 UTC (rev 103640)
@@ -57,6 +57,7 @@
        &currentSVNRevision
        &debugSafari
        &passedConfiguration
+       &printHelpAndExitForRunAndDebugWebKitAppIfNeeded
        &productDir
        &runMacWebKitApp
        &safariPath
@@ -2251,6 +2252,24 @@
     }
 }
 
+sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded()
+{
+    return unless checkForArgumentAndRemoveFromARGV("--help");
+    print STDERR <<EOF;
+Usage: @{[basename($0)]} [options] [args ...]
+  --help                Show this help message
+  --no-saved-state      Disable application resume for the session on Mac OS 10.7
+EOF
+    exit(1);
+}
+
+sub argumentsForRunAndDebugMacWebKitApp()
+{
+    my @args = @ARGV;
+    push @args, ("-ApplePersistenceIgnoreState", "YES") if isLion() && checkForArgumentAndRemoveFromArrayRef("--no-saved-state", \@args);
+    return @args;
+}
+
 sub runMacWebKitApp($;$)
 {
     my ($appPath, $useOpenCommand) = @_;
@@ -2259,12 +2278,12 @@
     $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
     $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
     if (defined($useOpenCommand) && $useOpenCommand == USE_OPEN_COMMAND) {
-        return system("open", "-W", "-a", $appPath, "--args", @ARGV);
+        return system("open", "-W", "-a", $appPath, "--args", argumentsForRunAndDebugMacWebKitApp());
     }
     if (architecture()) {
-        return system "arch", "-" . architecture(), $appPath, @ARGV;
+        return system "arch", "-" . architecture(), $appPath, argumentsForRunAndDebugMacWebKitApp();
     }
-    return system { $appPath } $appPath, @ARGV;
+    return system { $appPath } $appPath, argumentsForRunAndDebugMacWebKitApp();
 }
 
 sub execMacWebKitAppForDebugging($)
@@ -2279,7 +2298,7 @@
     $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
     $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
     my @architectureFlags = ("-arch", architecture());
-    exec { $gdbPath } $gdbPath, @architectureFlags, $appPath, @ARGV or die;
+    exec { $gdbPath } $gdbPath, @architectureFlags, $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
 }
 
 sub debugSafari
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to