mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-10 20:57:11 +00:00
Merge remote-tracking branch 'slevenbits/slevenbits-settimeout-fix' into slevenbits
This commit is contained in:
+15
-5
@@ -250,8 +250,13 @@ CPRunContinuesResponse = -1002;
|
||||
_documentController = [CPDocumentController sharedDocumentController];
|
||||
|
||||
var needsUntitled = !!_documentController,
|
||||
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings(),
|
||||
index = 0,
|
||||
URLStrings = nil;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings();
|
||||
#endif
|
||||
|
||||
var index = 0,
|
||||
count = [URLStrings count];
|
||||
|
||||
for (; index < count; ++index)
|
||||
@@ -1009,7 +1014,8 @@ CPRunContinuesResponse = -1002;
|
||||
*/
|
||||
- (CPArray)arguments
|
||||
{
|
||||
if (_fullArgsString !== window.location.hash)
|
||||
// FIXME This should probably not access the window object #if !PLATFORM(DOM), but the unit tests rely on it.
|
||||
if (window && window.location && _fullArgsString !== window.location.hash)
|
||||
[self _reloadArguments];
|
||||
|
||||
return _args;
|
||||
@@ -1036,8 +1042,9 @@ CPRunContinuesResponse = -1002;
|
||||
if (!args || args.length == 0)
|
||||
{
|
||||
_args = [];
|
||||
#if PLATFORM(DOM)
|
||||
window.location.hash = @"#";
|
||||
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1052,12 +1059,15 @@ CPRunContinuesResponse = -1002;
|
||||
|
||||
var hash = [toEncode componentsJoinedByString:@"/"];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
window.location.hash = @"#" + hash;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)_reloadArguments
|
||||
{
|
||||
_fullArgsString = window.location.hash;
|
||||
// FIXME This should probably not access the window object #if !PLATFORM(DOM), but the unit tests rely on it.
|
||||
_fullArgsString = (window && window.location) ? window.location.hash : "";
|
||||
|
||||
if (_fullArgsString.length)
|
||||
{
|
||||
|
||||
@@ -99,6 +99,9 @@ var CPSharedFontManager = nil,
|
||||
{
|
||||
if (!_availableFonts)
|
||||
{
|
||||
_availableFonts = [];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_CPFontDetectSpan = document.createElement("span");
|
||||
_CPFontDetectSpan.fontSize = "24px";
|
||||
_CPFontDetectSpan.appendChild(document.createTextNode("mmmmmmmmmml"));
|
||||
@@ -110,13 +113,16 @@ var CPSharedFontManager = nil,
|
||||
|
||||
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
|
||||
|
||||
_availableFonts = [];
|
||||
for (var i = 0; i < _CPFontDetectAllFonts.length; i++)
|
||||
{
|
||||
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
|
||||
if (available)
|
||||
_availableFonts.push(_CPFontDetectAllFonts[i]);
|
||||
}
|
||||
#else
|
||||
// If there's no font detection, just assume all fonts are available.
|
||||
_availableFonts = _CPFontDetectAllFonts;
|
||||
#endif
|
||||
}
|
||||
return _availableFonts;
|
||||
}
|
||||
|
||||
@@ -1858,7 +1858,7 @@ CPTexturedBackgroundWindowMask
|
||||
{
|
||||
// In Cocoa only resizable or titled windows return YES here by default. But the main browser window in Cappuccino
|
||||
// doesn't have these masks even that it's both titled and resizable, so we return YES when isFullPlatformWindow too.
|
||||
return (_styleMask & CPResizableWindowMask) || (_styleMask & CPResizableWindowMask) || [self isFullPlatformWindow];
|
||||
return (_styleMask & CPTitledWindowMask) || (_styleMask & CPResizableWindowMask) || [self isFullPlatformWindow];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -254,6 +254,9 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio
|
||||
theFunction = function() { codeOrFunction.apply(window, functionArgs); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
|
||||
}
|
||||
|
||||
// A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we.
|
||||
aDelay = aDelay | 0.0;
|
||||
|
||||
CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat];
|
||||
|
||||
return timeoutID;
|
||||
|
||||
@@ -195,7 +195,7 @@ globalResults = [];
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(receiveNotification:)
|
||||
name:CPApplicationWillTerminateNotification
|
||||
object:nil];
|
||||
object:nil];
|
||||
|
||||
[app replyToApplicationShouldTerminate:CPTerminateNow];
|
||||
[self assert:CPApplicationWillTerminateNotification equals:[globalResults[0] name]];
|
||||
@@ -223,8 +223,8 @@ globalResults = [];
|
||||
|
||||
- (void)testTargetForAction
|
||||
{
|
||||
var mainWin = [[TestMainWindow alloc] init];
|
||||
var keyWin = [[TestKeyWindow alloc] init];
|
||||
var mainWin = [[TestMainWindow alloc] init],
|
||||
keyWin = [[TestKeyWindow alloc] init];
|
||||
mainWin._isVisible = YES;
|
||||
keyWin._isVisible = YES;
|
||||
[mainWin makeMainWindow];
|
||||
@@ -252,6 +252,6 @@ globalResults = [];
|
||||
|
||||
// when no target is given, targetForAction is called
|
||||
[self assert:app equals:[app targetForAction:@selector(someTestMethod:) to:nil from:nil]];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user