{"id":37345,"date":"2022-10-14T15:19:12","date_gmt":"2022-10-14T19:19:12","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=37345"},"modified":"2022-10-14T15:19:12","modified_gmt":"2022-10-14T19:19:12","slug":"safari-web-extension-storage-callbacks-in-the-wrong-order","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/10\/14\/safari-web-extension-storage-callbacks-in-the-wrong-order\/","title":{"rendered":"Safari Web Extension Storage Callbacks in the Wrong Order"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/works.html\">Jeff Johnson<\/a> (<a href=\"https:\/\/twitter.com\/lapcatsoftware\/status\/1578825786957901826\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/works.html\"><p>&ldquo;In a Safari web extension on both macOS 12 and iOS 15 (I filed this bug under Mac because there was no cross-platform category), if you call <code>storage.local.set<\/code> and then <code>storage.local.get<\/code>, the callbacks are called in the opposite order, and indeed the opposite order from Chrome and Firefox extensions. Attached is a sample Xcode project demonstrating the bug.&rdquo;<\/p><p>[&#8230;]<\/p><p>By design, Safari web extensions use the same cross-platform API as Chrome and Firefox extensions so that extension developers can share code across browsers and easily port their extensions to Safari from other browsers. Thus, a behavioral difference between Safari and the other browsers means that extension developers can&rsquo;t share code, defeating the fundamental design of Safari web extensions. For this reason alone, I would argue that the behavior of Safari extension storage callbacks is a bug and not a feature.<\/p><p>This is far from the first time I&rsquo;ve seen the &ldquo;Works as currently designed&rdquo; response for Apple. <\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/01\/15\/where-are-the-safari-web-extensions\/\">Where Are the Safari Web Extensions?<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson (tweet): &ldquo;In a Safari web extension on both macOS 12 and iOS 15 (I filed this bug under Mac because there was no cross-platform category), if you call storage.local.set and then storage.local.get, the callbacks are called in the opposite order, and indeed the opposite order from Chrome and Firefox extensions. Attached is a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2022-10-14T19:19:14Z","apple_news_api_id":"b2f2b883-66b2-42ae-8596-68f2d395d85e","apple_news_api_modified_at":"2022-10-14T19:19:14Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AsvK4g2ayQq6Flmjy05XYXg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[31,2078,30,2077,71,2109,103,2246,96],"class_list":["post-37345","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-15","tag-mac","tag-macos-12","tag-programming","tag-radar-and-feedback-assistant","tag-safari","tag-safari-extensions","tag-web"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=37345"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37345\/revisions"}],"predecessor-version":[{"id":37346,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/37345\/revisions\/37346"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=37345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=37345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=37345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}