Fixed: crash when opening a platformWindow with a popup blocker

Previously, when opening a CPPlatformWindow a crash happened when this new window was blocked by the browser (addblock, or browser feature).
Now when opening an external window, we check if the DOMWindow has been created.

This PR has modified the method isVisible of CPPlatformWindow. We now check if the _DOMWindow is not NULL and undefined.
This commit is contained in:
Alexandre Wilhelm
2015-10-02 16:00:57 -07:00
parent ea37bf8b45
commit 40a9f19352
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ var PrimaryPlatformWindow = NULL;
- (BOOL)isVisible
{
#if PLATFORM(DOM)
return _DOMWindow !== NULL;
return _DOMWindow !== NULL && _DOMWindow !== undefined;
#else
return NO;
#endif
@@ -568,6 +568,9 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
_DOMWindow = window.open("about:blank", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + CGRectGetMinX(_contentRect) + ",top=" + CGRectGetMinY(_contentRect) + ",width=" + CGRectGetWidth(_contentRect) + ",height=" + CGRectGetHeight(_contentRect));
if (!_DOMWindow)
return;
[PlatformWindows addObject:self];
// FIXME: cpSetFrame?
@@ -1414,6 +1417,9 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
- (void)order:(CPWindowOrderingMode)orderingMode window:(CPWindow)aWindow relativeTo:(CPWindow)otherWindow
{
if (!_DOMWindow)
return;
[CPPlatform initializeScreenIfNecessary];
// Grab the appropriate level for the layer, and create it if