⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176574 in webkit


Ignore:
Timestamp:
Nov 29, 2014, 1:12:55 PM (12 years ago)
Author:
andersca@apple.com
Message:

Crash when calling WKPageClose on the originated page from within createNewPage callback
https://bugs.webkit.org/show_bug.cgi?id=139099
<rdar://problem/19052564>

Reviewed by Sam Weinig.

Source/WebKit2:

Null check the namespace ID.

  • UIProcess/Storage/StorageManager.cpp:

(WebKit::StorageManager::cloneSessionStorageNamespaceInternal):

Tools:

Add a test.

  • TestWebKitAPI/PlatformWebView.h:
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp: Added.

(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::createNewPage):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKit2/close-from-within-create-page.html: Added.
  • TestWebKitAPI/mac/PlatformWebViewMac.mm:

(TestWebKitAPI::PlatformWebView::PlatformWebView):

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r176570 r176574  
     12014-11-29  Anders Carlsson  <andersca@apple.com>
     2
     3        Crash when calling WKPageClose on the originated page from within createNewPage callback
     4        https://bugs.webkit.org/show_bug.cgi?id=139099
     5        <rdar://problem/19052564>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Null check the namespace ID.
     10
     11        * UIProcess/Storage/StorageManager.cpp:
     12        (WebKit::StorageManager::cloneSessionStorageNamespaceInternal):
     13
    1142014-11-28  Tim Horton  <timothy_horton@apple.com>
    215
  • trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp

    r170774 r176574  
    582582{
    583583    SessionStorageNamespace* sessionStorageNamespace = m_sessionStorageNamespaces.get(storageNamespaceID);
    584     ASSERT(sessionStorageNamespace);
     584    if (!sessionStorageNamespace) {
     585        // FIXME: We can get into this situation if someone closes the originating page from within a
     586        // createNewPage callback. We bail for now, but we should really find a way to keep the session storage alive
     587        // so we we'll clone the session storage correctly.
     588        return;
     589    }
    585590
    586591    SessionStorageNamespace* newSessionStorageNamespace = m_sessionStorageNamespaces.get(newStorageNamespaceID);
  • trunk/Tools/ChangeLog

    r176567 r176574  
     12014-11-29  Anders Carlsson  <andersca@apple.com>
     2
     3        Crash when calling WKPageClose on the originated page from within createNewPage callback
     4        https://bugs.webkit.org/show_bug.cgi?id=139099
     5        <rdar://problem/19052564>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Add a test.
     10
     11        * TestWebKitAPI/PlatformWebView.h:
     12        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     13        * TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp: Added.
     14        (TestWebKitAPI::runJavaScriptAlert):
     15        (TestWebKitAPI::createNewPage):
     16        (TestWebKitAPI::TEST):
     17        * TestWebKitAPI/Tests/WebKit2/close-from-within-create-page.html: Added.
     18        * TestWebKitAPI/mac/PlatformWebViewMac.mm:
     19        (TestWebKitAPI::PlatformWebView::PlatformWebView):
     20
    1212014-11-28  Commit Queue  <commit-queue@webkit.org>
    222
  • trunk/Tools/TestWebKitAPI/PlatformWebView.h

    r173126 r176574  
    5353class PlatformWebView {
    5454public:
    55     PlatformWebView(WKContextRef, WKPageGroupRef = 0);
     55    explicit PlatformWebView(WKContextRef, WKPageGroupRef = 0);
     56    explicit PlatformWebView(WKPageRef relatedPage);
    5657    ~PlatformWebView();
    5758
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r176011 r176574  
    1919                1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; };
    2020                1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
     21                1A50AA1E1A2A4E7000F4C345 /* CloseFromWithinCreatePage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A50AA1C1A2A4E7000F4C345 /* CloseFromWithinCreatePage.cpp */; };
     22                1A50AA201A2A51FC00F4C345 /* close-from-within-create-page.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A50AA1F1A2A4EA500F4C345 /* close-from-within-create-page.html */; };
    2123                1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */; };
    2224                1A63479F183D72A4005B1707 /* all-content-in-one-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */; };
     
    148150                93ABA80916DDAB91002DB2FA /* StringHasher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABA80816DDAB91002DB2FA /* StringHasher.cpp */; };
    149151                93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; };
    150                 93AF4ED01506F123007FD57E /* lots-of-images.html in Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
    151152                93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
    152                 93D3D19C17B1A7B000C7C415 /* all-content-in-one-iframe.html in Resources */ = {isa = PBXBuildFile; fileRef = 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */; };
    153153                93D3D19E17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */; };
    154154                93F1DB3114DA20760024C362 /* NewFirstVisuallyNonEmptyLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB3014DA20760024C362 /* NewFirstVisuallyNonEmptyLayout.cpp */; };
     
    307307                                51E5C7031919C3B200D8B3E1 /* simple3.html in Copy Resources */,
    308308                                290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */,
     309                                1A50AA201A2A51FC00F4C345 /* close-from-within-create-page.html in Copy Resources */,
    309310                                290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */,
    310311                                C2CF975B16CEC71B0054E99D /* JSContextBackForwardCache1.html in Copy Resources */,
     
    377378                1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
    378379                1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
     380                1A50AA1C1A2A4E7000F4C345 /* CloseFromWithinCreatePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CloseFromWithinCreatePage.cpp; sourceTree = "<group>"; };
     381                1A50AA1F1A2A4EA500F4C345 /* close-from-within-create-page.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "close-from-within-create-page.html"; sourceTree = "<group>"; };
    379382                1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvaluateJavaScript.cpp; sourceTree = "<group>"; };
    380383                1A7BFC0A171A0BDB00BC5F64 /* WillSendSubmitEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillSendSubmitEvent.mm; sourceTree = "<group>"; };
     
    842845                        isa = PBXGroup;
    843846                        children = (
    844                                 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */,
    845847                                C0C5D3BB14598B6F00A802A6 /* mac */,
    846848                                BC90977B125571AE00083756 /* Resources */,
    847849                                BC246D8C132F115A00B56D7C /* AboutBlankLoad.cpp */,
    848850                                7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */,
     851                                1A50AA1C1A2A4E7000F4C345 /* CloseFromWithinCreatePage.cpp */,
    849852                                BC246D98132F1FE100B56D7C /* CanHandleRequest.cpp */,
    850853                                BC246D97132F1FE100B56D7C /* CanHandleRequest_Bundle.cpp */,
     
    916919                                C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
    917920                                1AE72F47173EB214006362F0 /* TerminateTwice.cpp */,
     921                                4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */,
    918922                                BC22D31314DC689800FFB1DD /* UserMessage.cpp */,
    919923                                BC22D31714DC68B800FFB1DD /* UserMessage_Bundle.cpp */,
     
    981985                                F6B7BE9617469B7E008A3445 /* associate-form-controls.html */,
    982986                                76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
     987                                1A50AA1F1A2A4EA500F4C345 /* close-from-within-create-page.html */,
    983988                                290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
    984989                                C5E1AFFD16B22179006CC1F2 /* execCopy.html */,
     
    12491254                        buildActionMask = 2147483647;
    12501255                        files = (
    1251                                 93D3D19C17B1A7B000C7C415 /* all-content-in-one-iframe.html in Resources */,
    1252                                 93AF4ED01506F123007FD57E /* lots-of-images.html in Resources */,
    12531256                        );
    12541257                        runOnlyForDeploymentPostprocessing = 0;
     
    14131416                                290F4278172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm in Sources */,
    14141417                                C08587BF13FE956C001EF4E5 /* WebKitAgnosticTest.mm in Sources */,
     1418                                1A50AA1E1A2A4E7000F4C345 /* CloseFromWithinCreatePage.cpp in Sources */,
    14151419                                51FBBB4D1513D4E900822738 /* WebViewCanPasteURL.mm in Sources */,
    14161420                                37E38C34169B7D010084C28C /* WebViewDidRemoveFrameFromHierarchy.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm

    r171199 r176574  
    5050    NSRect rect = NSMakeRect(0, 0, 800, 600);
    5151    m_view = [[WKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef];
     52    [m_view setWindowOcclusionDetectionEnabled:NO];
     53
     54    NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
     55    m_window = [[ActiveOffscreenWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
     56    [m_window setColorSpace:[[NSScreen mainScreen] colorSpace]];
     57    [[m_window contentView] addSubview:m_view];
     58    [m_window orderBack:nil];
     59    [m_window setAutodisplay:NO];
     60    [m_window setReleasedWhenClosed:NO];
     61}
     62
     63PlatformWebView::PlatformWebView(WKPageRef relatedPage)
     64{
     65    NSRect rect = NSMakeRect(0, 0, 800, 600);
     66    m_view = [[WKView alloc] initWithFrame:rect contextRef:WKPageGetContext(relatedPage) pageGroupRef:WKPageGetPageGroup(relatedPage) relatedToPage:relatedPage];
    5267    [m_view setWindowOcclusionDetectionEnabled:NO];
    5368
Note: See TracChangeset for help on using the changeset viewer.