Changeset 243631 in webkit


Ignore:
Timestamp:
Mar 28, 2019 4:47:00 PM (5 years ago)
Author:
jiewen_tan@apple.com
Message:

API::Data::createWithoutCopying should do a null check before calling CFRelease
https://bugs.webkit.org/show_bug.cgi?id=196276
<rdar://problem/48059859>

Reviewed by Alex Christensen.

Source/WebKit:

  • Shared/Cocoa/APIDataCocoa.mm:

(API::Data::createWithoutCopying):

Tools:

Add an API test that will pass a nil to API::Data::createWithoutCopying via NavigationState::NavigationClient::webCryptoMasterKey.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
  • TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm: Added.

(-[WebCryptoMasterKeyNavigationDelegate _webCryptoMasterKeyForWebView:]):
(-[WebCryptoMasterKeyNavigationDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TestWebKitAPI::TEST):

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243630 r243631  
     12019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        API::Data::createWithoutCopying should do a null check before calling CFRelease
     4        https://bugs.webkit.org/show_bug.cgi?id=196276
     5        <rdar://problem/48059859>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * Shared/Cocoa/APIDataCocoa.mm:
     10        (API::Data::createWithoutCopying):
     11
    1122019-03-28  Per Arne Vollan  <pvollan@apple.com>
    213
  • trunk/Source/WebKit/Shared/Cocoa/APIDataCocoa.mm

    r183411 r243631  
    3535
    3636    return createWithoutCopying(bytes, size, [](unsigned char*, const void* data) {
     37        if (!data)
     38            return;
    3739        CFRelease(data);
    3840    }, static_cast<void*>(data.leakRef()));
  • trunk/Tools/ChangeLog

    r243608 r243631  
     12019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        API::Data::createWithoutCopying should do a null check before calling CFRelease
     4        https://bugs.webkit.org/show_bug.cgi?id=196276
     5        <rdar://problem/48059859>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add an API test that will pass a nil to API::Data::createWithoutCopying via NavigationState::NavigationClient::webCryptoMasterKey.
     10
     11        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     12        * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
     13        * TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm: Added.
     14        (-[WebCryptoMasterKeyNavigationDelegate _webCryptoMasterKeyForWebView:]):
     15        (-[WebCryptoMasterKeyNavigationDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
     16        (TestWebKitAPI::TEST):
     17
    1182019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
    219
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r243487 r243631  
    301301                5797FE311EB15A6800B2F4A0 /* NavigationClientDefaultCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5797FE2F1EB15A5F00B2F4A0 /* NavigationClientDefaultCrypto.cpp */; };
    302302                5797FE331EB15AB100B2F4A0 /* navigation-client-default-crypto.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5797FE321EB15A8900B2F4A0 /* navigation-client-default-crypto.html */; };
     303                57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */; };
    303304                57C3FA661F7C248F009D4B80 /* WeakPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */; };
    304305                57F4AAA0208FAEF000A68E9E /* SSLKeyGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57F4AA9F208FA83D00A68E9E /* SSLKeyGenerator.mm */; };
     
    17141715                5797FE321EB15A8900B2F4A0 /* navigation-client-default-crypto.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "navigation-client-default-crypto.html"; sourceTree = "<group>"; };
    17151716                5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; };
     1717                57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCryptoMasterKey.mm; sourceTree = "<group>"; };
    17161718                57D1D75E21DCB7A80093E86A /* U2fCommandConstructorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = U2fCommandConstructorTest.cpp; sourceTree = "<group>"; };
    17171719                57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; };
     
    26762678                                83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */,
    26772679                                830F2E0B209A6A7400D36FF1 /* WebContentProcessDidTerminate.mm */,
     2680                                57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */,
    26782681                                5C973F5B1F58EF0A00359C27 /* WebGLPolicy.mm */,
    26792682                                51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
     
    43894392                                7C83E04C1D0A641800FEBCF3 /* WebCoreNSURLSession.mm in Sources */,
    43904393                                7CCE7F1A1A411AE600447C4C /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */,
     4394                                57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */,
    43914395                                5C973F5C1F58EF8B00359C27 /* WebGLPolicy.mm in Sources */,
    43924396                                7CCE7EAB1A411A2400447C4C /* WebKitAgnosticTest.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html

    r216157 r243631  
    5555    function storeKey() {
    5656        var objectStore = db.transaction("rsa-indexeddb", "readwrite").objectStore("rsa-indexeddb");
    57         var req = objectStore.put(key, "mykey");
    58         req.onerror = function(event) {
    59             alert('failed to store key');
    60         }
    61         req.onsuccess = function(event) {
    62             alert('successfully stored key');
    63             readKey();
     57        try {
     58            var req = objectStore.put(key, "mykey");
     59            req.onerror = function(event) {
     60                alert('failed to store key');
     61            }
     62            req.onsuccess = function(event) {
     63                alert('successfully stored key');
     64                readKey();
     65            }
     66        } catch (e) {
     67            alert(e.name);
    6468        }
    6569    }
Note: See TracChangeset for help on using the changeset viewer.