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

Changeset 246376 in webkit


Ignore:
Timestamp:
Jun 12, 2019, 3:20:43 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r243631. rdar://problem/51656612

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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243631 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-607-branch
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebKit/ChangeLog

    r245935 r246376  
     12019-06-12  Null  <null@apple.com>
     2
     3        Cherry-pick r243631. rdar://problem/51656612
     4
     5    API::Data::createWithoutCopying should do a null check before calling CFRelease
     6    https://bugs.webkit.org/show_bug.cgi?id=196276
     7    <rdar://problem/48059859>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebKit:
     12   
     13    * Shared/Cocoa/APIDataCocoa.mm:
     14    (API::Data::createWithoutCopying):
     15   
     16    Tools:
     17   
     18    Add an API test that will pass a nil to API::Data::createWithoutCopying via NavigationState::NavigationClient::webCryptoMasterKey.
     19   
     20    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     21    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
     22    * TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm: Added.
     23    (-[WebCryptoMasterKeyNavigationDelegate _webCryptoMasterKeyForWebView:]):
     24    (-[WebCryptoMasterKeyNavigationDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
     25    (TestWebKitAPI::TEST):
     26   
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
     31
     32            API::Data::createWithoutCopying should do a null check before calling CFRelease
     33            https://bugs.webkit.org/show_bug.cgi?id=196276
     34            <rdar://problem/48059859>
     35
     36            Reviewed by Alex Christensen.
     37
     38            * Shared/Cocoa/APIDataCocoa.mm:
     39            (API::Data::createWithoutCopying):
     40
    1412019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    242
  • branches/safari-607-branch/Source/WebKit/Shared/Cocoa/APIDataCocoa.mm

    r183411 r246376  
    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()));
  • branches/safari-607-branch/Tools/ChangeLog

    r245986 r246376  
     12019-06-12  Null  <null@apple.com>
     2
     3        Cherry-pick r243631. rdar://problem/51656612
     4
     5    API::Data::createWithoutCopying should do a null check before calling CFRelease
     6    https://bugs.webkit.org/show_bug.cgi?id=196276
     7    <rdar://problem/48059859>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebKit:
     12   
     13    * Shared/Cocoa/APIDataCocoa.mm:
     14    (API::Data::createWithoutCopying):
     15   
     16    Tools:
     17   
     18    Add an API test that will pass a nil to API::Data::createWithoutCopying via NavigationState::NavigationClient::webCryptoMasterKey.
     19   
     20    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     21    * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
     22    * TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm: Added.
     23    (-[WebCryptoMasterKeyNavigationDelegate _webCryptoMasterKeyForWebView:]):
     24    (-[WebCryptoMasterKeyNavigationDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
     25    (TestWebKitAPI::TEST):
     26   
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
     31
     32            API::Data::createWithoutCopying should do a null check before calling CFRelease
     33            https://bugs.webkit.org/show_bug.cgi?id=196276
     34            <rdar://problem/48059859>
     35
     36            Reviewed by Alex Christensen.
     37
     38            Add an API test that will pass a nil to API::Data::createWithoutCopying via NavigationState::NavigationClient::webCryptoMasterKey.
     39
     40            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     41            * TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html:
     42            * TestWebKitAPI/Tests/WebKitCocoa/WebCryptoMasterKey.mm: Added.
     43            (-[WebCryptoMasterKeyNavigationDelegate _webCryptoMasterKeyForWebView:]):
     44            (-[WebCryptoMasterKeyNavigationDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
     45            (TestWebKitAPI::TEST):
     46
    1472019-05-31  Alex Christensen  <achristensen@webkit.org>
    248
  • branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r244303 r246376  
    291291                5797FE311EB15A6800B2F4A0 /* NavigationClientDefaultCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5797FE2F1EB15A5F00B2F4A0 /* NavigationClientDefaultCrypto.cpp */; };
    292292                5797FE331EB15AB100B2F4A0 /* navigation-client-default-crypto.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5797FE321EB15A8900B2F4A0 /* navigation-client-default-crypto.html */; };
     293                57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */; };
    293294                57C3FA661F7C248F009D4B80 /* WeakPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */; };
    294295                57F4AAA0208FAEF000A68E9E /* SSLKeyGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57F4AA9F208FA83D00A68E9E /* SSLKeyGenerator.mm */; };
     
    16751676                5797FE321EB15A8900B2F4A0 /* navigation-client-default-crypto.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "navigation-client-default-crypto.html"; sourceTree = "<group>"; };
    16761677                5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; };
     1678                57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCryptoMasterKey.mm; sourceTree = "<group>"; };
    16771679                57D1D75E21DCB7A80093E86A /* U2fCommandConstructorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = U2fCommandConstructorTest.cpp; sourceTree = "<group>"; };
    16781680                57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; };
     
    26062608                                83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */,
    26072609                                830F2E0B209A6A7400D36FF1 /* WebContentProcessDidTerminate.mm */,
     2610                                57A79856224AB34E00A7F6F1 /* WebCryptoMasterKey.mm */,
    26082611                                5C973F5B1F58EF0A00359C27 /* WebGLPolicy.mm */,
    26092612                                51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
     
    42914294                                7C83E04C1D0A641800FEBCF3 /* WebCoreNSURLSession.mm in Sources */,
    42924295                                7CCE7F1A1A411AE600447C4C /* WebCoreStatisticsWithNoWebProcess.cpp in Sources */,
     4296                                57A79857224AB34E00A7F6F1 /* WebCryptoMasterKey.mm in Sources */,
    42934297                                5C973F5C1F58EF8B00359C27 /* WebGLPolicy.mm in Sources */,
    42944298                                7CCE7EAB1A411A2400447C4C /* WebKitAgnosticTest.mm in Sources */,
  • branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/navigation-client-default-crypto.html

    r216157 r246376  
    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.