1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Chrome OS と Firefox OS のアプリと Manifest

Last updated at Posted at 2017-09-25

Chrome OS と Firefox OS では、セキュリティ的に問題があるかも知れない API にアクセスするためには、開発者は Manifest というファイルの permissions という項目に使う API を列挙しないといけない。permission の書式は似ているようで結構違うのでメモする。

Chrome OS

アプリには以下のような種類がある。現在 PC の Chrome でも Packaged apps の実行が可能だが、廃止になる予定。もしかして Chrome OS でもそのうち Packaged app が廃止されて特権 API が必要なアプリは Android に統一されるのでは? という気もする。

Permission の書き方

manifest.json 内に以下のように、権限リストを書く。

"permissions": [
  "serial",
  "storage",
  "videoCapture"
],

権限の書き方に以下のようなバリエーションがある。

  • "fileSystem" - 文字列をひとつだけ指定
  • { "fileSystem": ["write"] } - 追加オプションをオブジェクト値として書く

geolocation の例

  • Manifest permission:
    • この API を使いたい場合、manifest.webapp に "permission": { "geolocation" } が必要。
  • API name:

参考

Firefox OS

アプリには以下のような種類がある。

  • hosted: Web サーバに置かれるアプリ
  • packaged: ダウンロードして使うアプリ
    • web: 承認されていないアプリ
    • privileged: Firefox Marketplace が承認されたアプリ
    • certified: OEM やキャリアが承認したアプリ

Permission の書き方

manifest.webapp 内に以下のように、description や access を書く。

"permissions": {
  "contacts": {
    "description": "Required for autocompletion in the share screen",
    "access": "readcreate"
    },
  "alarms": {
    "description": "Required to schedule notifications"
  }
}

geolocation の例

  • Manifest permission:
    • geolocation
    • この API を使いたい場合、manifest.webapp に "permission": { "geolocation" : ... } が必要。
  • API name:
    • Geolocation
    • Manifest permission と API Name の名前の付け方に強制ルールは無いようだ。
  • Minimum app type required:
    • hosted
  • access property: none
    • ファイルアクセス等の API では、readonly など細かいパーミッションを選べる。
  • Default granted: Prompt
    • hosted type でも使える API はたいてい Prompt となっている。
    • Prompt の出し方は API によって異なる。
      • geolocation では getCurrentPosition() の際ブラウザが勝手に Prompt を出す。
      • Notification API では Notification.requestPermission() で明示的に Prompt を出す。
        • 多分 Notification API は使う前に承認が欲しいから?

参考

Web App Manifest

目的は似ているがフォーマットはかなり違う。例えば、icons の指定方法が全然違う。また、permission の指定は無いので、Chrome App や Firefox App の Manifest を置き換える意図は無いようだ。

何故か sevice_worker が指定出来るようになっている所が面白い。経緯については https://github.com/w3c/manifest/issues/161 に記録が残っている。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?