Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Chrome Extensionを Firefoxにインストールする - WebExtensi...

pastak
May 08, 2016
3.1k

Chrome Extensionを Firefoxにインストールする - WebExtension移植物語

pastak

May 08, 2016
Tweet

More Decks by pastak

Transcript

  1. ࠷৽ͷݱঢ় • Firefox v46 (ݱࡏͷStable) Ͱalphaʹͳͬͨ • 2016-08-02ʹstableೖΓ͢Δ༧ఆͷFirefox v48Ͱstable ʹͳΔ໨ඪ

    • chrome -> browser • addon.mozilla.org ʹΞοϓϩʔυ͢Δ͜ͱͰॺ໊Մೳʹ • ΞοϓϩʔυΛ΍ͬͯ͘ΕΔίϚϯυϥΠϯπʔϧ web-ext ΋͋Δ • ະ࣮૷ͷAPI΋͔ͳΓݮ͖ͬͯͨ • https://developer.mozilla.org/en-US/Add-ons/ WebExtensions/Chrome_incompatibilities
  2. ࠷৽ͷݱঢ় • https://blog.mozilla.org/addons/2016/04/29/ webextensions-in-firefox-48/ • Optionϖʔδαϙʔτ׬ྃ • chrome.*APIΛݺ΂ͳ͍όά͕͋Δʁ • Firefox

    48 AndroidͰ΋αϙʔτ༧ఆ • ։ൃதΞυΦϯͷreload • https://github.com/mozilla/web-ext • https://github.com/mdn/webextensions- examples
  3. • ʰW3CͷBrowser Extension Community GroupͷϝʔϦϯάϦετʹ͓͍ͯɺϒϥ΢ βͷ֦ுػೳʹ͓͚ΔίΞAPI΍ϚχϑΣε τɺύοέʔδΛඪ४Խ͢Δ͜ͱΛڞಉͰఏ Ҋͨ͠ɻʱ • http://rockridge.hatenablog.com/entry/

    2016/05/05/110059 • https://dev.opera.com/blog/better- extensions-ecosystem/ • https://github.com/browserext/browserext • https://twitter.com/browserext
  4. What’s wemf • ඞؚͣ·Ε͍ͯΔ΂͖ΩʔͱରԠ͢Δ஋Λ௥Ճ • ෆ଍͍ͯ͠ΔΩʔ͕͋Δ৔߹͸ package.json ͳͲ͔Βੜ੒ͭ͠ ͭɺର࿩ΠϯλʔϑΣΠεͰੜ੒͠·͢ •

    ະରԠͷΩʔΛ࡟আ • ݱঢ়ະରԠͷΩʔ͕͋ΔͱΠϯετʔϧʹࣦഊ͢ΔͷͰɺͦͷ Α͏ͳΩʔΛ࡟আ͠·͢ɻ • ະରԠͷΩʔϫʔυͷ࢖༻Λ௨஌ • web_accessible_resourcesͰϫΠϧυΧʔυ͕࢖͑ͳ͍ͳͲ͕ ͋ΔͷͰɺͦͷΑ͏ͳΩʔϫʔυΛؚΜͰ͍Δ৔߹͸࡟আͤͣ ʹ௨஌͠·͢ɻ
  5. Ҡ২ͷ࣌ʹ֬ೝ͍ͨ͜͠ͱ • JS / CSS / HTML ͷͦΕͧΕ࣮૷ରԠঢ়گ • -webkit-*࢖ͬͯͳ͍ʁ

    • JSͷAPI΍CSSͷৼΔ෣͍͸ຊ౰ʹಉ͡ʁ • http://caniuse.com/ • chrome.*API ͷରԠঢ়گ • http://www.arewewebextensionsyet.com/ • APIͷҰཡ / ؔ࿈ bugzilla΁ͷࢀর / filterͱ͔͕͋ͬͯศར • https://developer.mozilla.org/en-US/Add-ons/ WebExtensions/Chrome_incompatibilities
  6. ಛʹؾΛ͚͍ͭͨະ࣮૷API • chrome.notifications.update • chrome.runtime.onStartup • chrome.runtime.onInstalled • chrome.storage.sync •

    chrome.tabs.sendRequest • chrome.tabs.getSelected • chrome.tabs.* ͷdeprecatedͱ͞Ε͍ͯΔAPI
  7. • src/firefox/manifest.json +78 • src/firefox/config.js +3 • src/firefox/_locales/ja/messages.json +8 •

    src/firefox/_locales/en_US/messages.json +8 • Rakefile +3 -1 • .gitignore +1 • ۭߦɾߦ຤εϖʔε੔ܗͳͲ +15 -22
  8. • src/firefox/manifest.json +78 • src/firefox/config.js +3 • src/firefox/_locales/ja/messages.json +8 •

    src/firefox/_locales/en_US/messages.json +8 • Rakefile +3 -1 • .gitignore +1 • ۭߦɾߦ຤εϖʔε੔ܗͳͲ +17 -24 ࣮࣭: +46 -17
  9. ·ͱΊ • ࠓ·ͰChrome Extension͸OperaʹՃ͑ͯɺFirefoxͷϢʔβʔʹ ΋΄΅ಉ͡ίʔυͰExtensionΛఏڙग़དྷΔΑ͏ʹͳͬͨ • MS΋ఏҊʹ৐͍ͬͯΔͷͰɺকདྷతʹ͸MS Edge΋஥ؒೖΓ͠ ͦ͏ʁ •

    Safari͸Ͳ͏ͳΔʁʁ • ֤ϕϯμʔͷಠ֦ࣗு΋ೝΊΒΕ͍ͯΔͷͰɺͲ͜·ͰฏԺͳ؀ڥ ʹͳΔ͔͸ࠓޙ࣍ୈ • ͢ͰʹOpera͸sidebarΛ࣮૷͍ͯ͠Δ • Mozilla΋Ϣʔβʔͷଟ͍ز͔ͭͷAddon͕ҠߦͰ͖ΔΑ͏ʹAPI Λ௥Ճͯ͠੔͑Δ४උΛ͍ͯ͠Δ