Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: tools/testing/dart/browser_controller.dart

Issue 15782006: Allow safari to do pop ups on startup (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_controller.dart
===================================================================
--- tools/testing/dart/browser_controller.dart (revision 23276)
+++ tools/testing/dart/browser_controller.dart (working copy)
@@ -198,6 +198,22 @@
*/
const String versionFile = "/Applications/Safari.app/Contents/version.plist";
+
+ Future<bool> allowPopUps() {
+ var command = "defaults";
+ var args = ["write", "com.apple.safari",
+ "com.apple.Safari.ContentPageGroupIdentifier." // No ,
kustermann 2013/05/28 15:07:52 What is this "// no," ?
+ "WebKit2JavaScriptCanOpenWindowsAutomatically",
+ "1"];
+ return Process.run(command, args).then((result) {
+ if (result.exitCode != 0) {
+ _logEvent("Could not disable pop-up blocking for safari");
+ return false;
+ }
+ return true;
+ });
+ }
+
Future<String> getVersion() {
/**
* Example of the file:
@@ -242,18 +258,23 @@
Future<bool> start(String url) {
_logEvent("Starting Safari browser on: $url");
// Get the version and log that.
- return getVersion().then((version) {
- _logEvent("Got version: $version");
- var args = ["'$url'"];
- return new Directory('').createTemp().then((userDir) {
- _cleanup = () { userDir.delete(recursive: true); };
- _createLaunchHTML(userDir.path, url);
- var args = ["${userDir.path}/launch.html"];
- return startBrowser(binary, args);
+ return allowPopUps().then((success) {
+ if (!success) {
+ return new Future.immediate(false);
+ }
+ return .getVersion().then((version) {
+ _logEvent("Got version: $version");
+ var args = ["'$url'"];
+ return new Directory('').createTemp().then((userDir) {
+ _cleanup = () { userDir.delete(recursive: true); };
+ _createLaunchHTML(userDir.path, url);
+ var args = ["${userDir.path}/launch.html"];
+ return startBrowser(binary, args);
+ });
+ }).catchError((e) {
+ _logEvent("Running $binary --version failed with $e");
+ return false;
});
- }).catchError((e) {
- _logEvent("Running $binary --version failed with $e");
- return false;
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698