From 848c893b9e9e0a5b2d8d38c8db4492cd26f3a71f Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sat, 15 Dec 2012 11:50:47 +0000 Subject: [PATCH] Fixed: CPApplicationTest setArguments. Without this change, CPApplicationTest's manipulation of window.location.hash was ignored by CPApplication in recent versions, since CPApp in a unit test normally does not have access to the window object. This change makes it so that CPApp does try to access the window object, even in a unit test scenario (non PLATFORM(DOM)). --- AppKit/CPApplication.j | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index e0fd5261f..8743ecee4 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -1047,9 +1047,9 @@ CPRunContinuesResponse = -1002; if (!args || args.length == 0) { _args = []; -#if PLATFORM(DOM) - window.location.hash = @"#"; -#endif + // Don't use if PLATFORM(DOM) here - the unit test fakes window.location so we should play along. + if (window && window.location) + window.location.hash = @"#"; return; } @@ -1064,9 +1064,9 @@ CPRunContinuesResponse = -1002; var hash = [toEncode componentsJoinedByString:@"/"]; -#if PLATFORM(DOM) - window.location.hash = @"#" + hash; -#endif + // Don't use if PLATFORM(DOM) here - the unit test fakes window.location so we should play along. + if (window && window.location) + window.location.hash = @"#" + hash; } - (void)_reloadArguments