{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/push-api/issues/198","repository_url":"https://api.github.com/repos/w3c/push-api","labels_url":"https://api.github.com/repos/w3c/push-api/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/w3c/push-api/issues/198/comments","events_url":"https://api.github.com/repos/w3c/push-api/issues/198/events","html_url":"https://github.com/w3c/push-api/issues/198","id":163911154,"number":198,"title":"PushSubscriptionOptions ArrayBuffer lifetime issues","user":{"login":"johnmellor","id":563043,"avatar_url":"https://avatars.githubusercontent.com/u/563043?v=3","gravatar_id":"","url":"https://api.github.com/users/johnmellor","html_url":"https://github.com/johnmellor","followers_url":"https://api.github.com/users/johnmellor/followers","following_url":"https://api.github.com/users/johnmellor/following{/other_user}","gists_url":"https://api.github.com/users/johnmellor/gists{/gist_id}","starred_url":"https://api.github.com/users/johnmellor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnmellor/subscriptions","organizations_url":"https://api.github.com/users/johnmellor/orgs","repos_url":"https://api.github.com/users/johnmellor/repos","events_url":"https://api.github.com/users/johnmellor/events{/privacy}","received_events_url":"https://api.github.com/users/johnmellor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-05T18:06:51Z","updated_at":"2016-07-06T14:19:19Z","closed_at":null,"body":"PushSubscriptionOptions is spec'd as:\r\n\r\n```\r\ninterface PushSubscriptionOptions {\r\n    readonly        attribute boolean      userVisibleOnly;\r\n    [Throws]\r\n    readonly        attribute ArrayBuffer? applicationServerKey;\r\n};\r\n```\r\n\r\n1. What does `[Throws]` do? I couldn't find it in [WebIDL](https://heycam.github.io/webidl/) - is it Mozilla-specific IDL syntax?\r\n\r\n2. Should the ArrayBuffer be marked [SameObject] since it never changes to allow `==` comparison?\r\n\r\n3. What happens if the developer [detaches the ArrayBuffer](https://heycam.github.io/webidl/#dfn-detach) by passing it in the `transfer` argument to [postMessage](https://html.spec.whatwg.org/multipage/comms.html#dom-window-postmessage) (or using [`ArrayBuffer.transfer()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transfer))? Do we need to freeze it or something like that? Would freezing even have any effect, since the data being detached is stored in an internal slot? See also [w3c issue 23369](https://www.w3.org/Bugs/Public/show_bug.cgi?id=23369). For example I noticed that @annevk used [`[NewObject]`](https://heycam.github.io/webidl/#NewObject) for https://encoding.spec.whatwg.org/#textencoder, but we probably can't use that here since `[NewObject]` is only for methods, not for attributes.\r\n\r\n@martinthomson @beverloo "},"comment":{"url":"https://api.github.com/repos/w3c/push-api/issues/comments/230785938","html_url":"https://github.com/w3c/push-api/issues/198#issuecomment-230785938","issue_url":"https://api.github.com/repos/w3c/push-api/issues/198","id":230785938,"user":{"login":"kitcambridge","id":243830,"avatar_url":"https://avatars.githubusercontent.com/u/243830?v=3","gravatar_id":"","url":"https://api.github.com/users/kitcambridge","html_url":"https://github.com/kitcambridge","followers_url":"https://api.github.com/users/kitcambridge/followers","following_url":"https://api.github.com/users/kitcambridge/following{/other_user}","gists_url":"https://api.github.com/users/kitcambridge/gists{/gist_id}","starred_url":"https://api.github.com/users/kitcambridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitcambridge/subscriptions","organizations_url":"https://api.github.com/users/kitcambridge/orgs","repos_url":"https://api.github.com/users/kitcambridge/repos","events_url":"https://api.github.com/users/kitcambridge/events{/privacy}","received_events_url":"https://api.github.com/users/kitcambridge/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T14:19:19Z","updated_at":"2016-07-06T14:19:19Z","body":"I was wondering if `[SameObject]` means scripts could mutate the `ArrayBuffer`, and how it behaves with two `PushSubscription` objects for the same scope. For example:\r\n\r\n```js\r\nserviceWorkerRegistration.pushManager.getSubscription().then(subscription => {\r\n  let applicationServerKey = subscription.options.applicationServerKey;\r\n\r\n  let keyArray = new Uint8Array(applicationServerKey);\r\n  keyArray[0] = 123;\r\n\r\n  let maybeModifiedKey = subscription.options.applicationServerKey;\r\n\r\n  // If `applicationServerKey` is `[SameObject]`, does that mean scripts could\r\n  // change the contents of the key?\r\n  assert(applicationServerKey == modifiedKey);\r\n  assert(new Uint8Array(maybeModifiedKey)[0] == 123);\r\n\r\n  return serviceWorkerRegistration.pushManager.getSubscription().then(newSubscription => {\r\n    // `getSubscription` resolves to a new `PushSubscription` instance, so I assume\r\n    // these are all true. Is that right?\r\n    assert(newSubscription != subscription);\r\n    assert(newSubscription.applicationServerKey != applicationServerKey);\r\n    assert(new Uint8Array(newSubscription.applicationServerKey)[0] != 123);\r\n  });\r\n});\r\n```\r\n\r\n(\"Don't do that\" is an acceptable answer for the first, but I'm curious how specs handle this kind of thing)."}}
{"actor":{"display_login":"kitcambridge"}}