On 1/25/16 1:55 PM, Gary Guo wrote:
I believe a lot of additional work needs to be done for this proposal to
make it works across realm.

Consider the invocation chain:
alpha, alpha0 (in realm A)
beta, beta0 (in realm B)
alpha -> alpha0 -> beta -> beta0 -> alpha ->alpha0 -> beta -> beta0 ->
throws

Here comes the question. What should be included in the stack and what
shouldn't?

What browsers will do is basically include everything, with some caveats.

The main caveat I'm aware of is that when the stack crosses between realms which have different effective script origins Gecko will sanitize the script view of the stack to only include the bits that the script asking for the stack is allowed to know about. We do record the entire stack, and can show the entire thing in devtools if we want to.

In practice, such stacks are quite hard to produce on the web; they require changing document.domain partway through the script execution.

Same thing applies when calling native function.

Yeah, this needs some thought. Browsers aren't even terribly consistent with each other or with themselves here. A imple example:

  <script>
  var div = document.createElement("div");
  div.onclick = function f() {
   console.log(new Error().stack);
  }
  div.dispatchEvent(new Event("click"));
  </script>
  <script>
  function g() {
    console.log(new Error().stack);
  }
  [0].map(g);
  </script>

this shows the following in Firefox:

  f@filename:4:13
  @filename:6:1

and

  g@filename:10:17
  @filename:12:3

Whereas in Chrome it shows:

 at HTMLDivElement.f (filename1:4)
 at filename1:6

and

 at g (filename2:10:17)
 at Array.map (native)
 at filename2:12:7

where filenam1 and filename2 are actually different: the latter is an absolute URI but the former is just the filename part of the URI...

Safari does:

  f@filename:4:22
  dispatchEvent@[native code]
  global code@filename:6:18

and

  g@filename:10:26
  map@[native code]
  global code@filename:12:10

which is what I was sort of hoping to see, possibly with better names for the built-ins (e.g. "Array.prototype.map" and "Node.prototype.dispatchEvent" or something).

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to