Skip to content

Commit

Permalink
Cherry-pick 0b437b3. rdar://123336734
Browse files Browse the repository at this point in the history
    "Activate Cash Back" button doesn’t work for Rakuten
    https://bugs.webkit.org/show_bug.cgi?id=269854
    rdar://123336734

    Reviewed by Brian Weinstein and Timothy Hatcher.

    Only storageArea.sync has a maximum item size limit. In the logs:
    "Exception thrown: Invalid call to storageArea.set(). ... value is invalid, because exceeded maximum size for a single item."

    * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm:
    (WebKit::WebExtensionAPIStorageArea::set):

    Canonical link: https://commits.webkit.org/275130@main

Identifier: 273664.1284@safari-7619.1.5-branch
  • Loading branch information
kiaraarose authored and MyahCobbs committed Feb 21, 2024
1 parent 630c7f8 commit 9f06d2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
return;
}

if (anyItemsExceedQuota(serializedData, webExtensionStorageAreaSyncQuotaBytesPerItem, &keyWithError)) {
*outExceptionString = toErrorString(nil, [NSString stringWithFormat:@"items[`%@`]", keyWithError], @"exceeded maximum size for a single item");
if (m_type == WebExtensionDataType::Sync && anyItemsExceedQuota(serializedData, webExtensionStorageAreaSyncQuotaBytesPerItem, &keyWithError)) {
*outExceptionString = toErrorString(nil, [NSString stringWithFormat:@"items[`%@`]", keyWithError], @"it exceeded maximum size for a single item");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
@"browser.test.assertThrows(() => browser?.storage?.local?.set(), /A required argument is missing/i)",
@"browser.test.assertThrows(() => browser?.storage?.local?.set([]), /'items' value is invalid, because an object is expected/i)",
@"browser.test.assertThrows(() => browser?.storage?.local?.set({ 'key': () => { 'function' } }), /it is not JSON-serializable/i)",
@"browser.test.assertThrows(() => browser?.storage?.local?.set({ 'key': 'a'.repeat(8193) }), /exceeded maximum size for a single item/i)",
@"browser.test.assertThrows(() => browser?.storage?.sync?.set({ 'key': 'a'.repeat(8193) }), /exceeded maximum size for a single item/i)",

@"browser.test.assertThrows(() => browser?.storage?.local?.remove(), /A required argument is missing/i)",
@"browser.test.assertThrows(() => browser?.storage?.local?.remove({}), /'keys' value is invalid, because a string or an array of strings is expected, but an object was provided/i)",
Expand Down Expand Up @@ -215,6 +215,10 @@
@"result = await browser?.storage?.local?.get('array')",
@"browser.test.assertDeepEq(updatedArray, result?.array)",

// Ensure there isn't a maximum item quota if the storageArea isn't sync.
@"await browser.storage?.local?.clear()",
@"browser.test.assertSafeResolve(() => browser.storage?.local?.set({ 'key': 'a'.repeat(8193) }))",

@"browser.test.notifyPass()",
]);

Expand Down

0 comments on commit 9f06d2e

Please sign in to comment.