- From: Ms2ger <notifications@github.com>
- Date: Thu, 17 Jan 2019 04:36:42 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/issues/624@github.com>
But what happens instead is different everywhere. Consider the following test, which tries to define a property with a getter on a `Storage` object:
```html
<pre id=log>
</pre>
<script>
var log = (...m) => document.getElementById("log").append(...m, "\n");
var storage = window.sessionStorage;
var key = "x";
var threw = false;
storage.clear();
log("Before property access: ", storage[key], " (expected undefined)");
log("Before getItem call: ", storage.getItem(key), " (expected null)");
try {
Object.defineProperty(storage, key, { get: function() { return "getter" } })
} catch (e) {
threw = true;
}
log("Did throw? ", threw);
log("After property access: ", storage[key], " with type ", typeof storage[key], " (expected undefined)");
log("After getItem call: ", storage.getItem(key), " with type ", typeof storage.getItem(key), " (expected null)");
</script>
```
Results:
| Test | Gecko | WebKit | Chrome |
|---|---|---|---|
| Did throw? | false | false | false |
| After property access: | undefined with type string | undefined with type undefined | getter with type string |
| After getItem call: | undefined with type string | null with type object | null with type object |
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/624
Received on Thursday, 17 January 2019 12:37:04 UTC