Permalink
Browse files

[giow] (0) New argument to onerror: the Error object itself.

Affected topics: HTML, Workers

git-svn-id: http://svn.whatwg.org/webapps@8086 340c8d12-0b0e-0410-8428-c7bf67bfef74
1 parent 3a7f591 commit fe7e3504a350727b71d9888aeb77c938beec6ec3 @Hixie Hixie committed Jul 24, 2013
Showing with 84 additions and 20 deletions.
  1. +27 −6 complete.html
  2. +27 −6 index
  3. +30 −8 source
View
@@ -71776,6 +71776,11 @@ <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script err
<a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
</li>
+ <li><p>Let <var title="">error object</var> be the object that represents the error: in the case
+ of an uncaught exception, that would be the object that was thrown; in the case of a JavaScript
+ error that would be an <code>Error</code> object. If there is no corresponding object, then the
+ null value must be used instead.</li>
+
<li>
<p>Let <var title="">location</var> be an <a href=#absolute-url>absolute URL</a> that corresponds to the
@@ -71803,7 +71808,7 @@ <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script err
</li>
- <li><p>If <var title="">script</var> has <a href=#muted-errors>muted errors</a>, then set <var title="">message</var> to "<code title="">Script error.</code>", set <var title="">location</var> to the empty string, and set <var title="">line</var> and <var title="">col</var> to 0.</li>
+ <li><p>If <var title="">script</var> has <a href=#muted-errors>muted errors</a>, then set <var title="">message</var> to "<code title="">Script error.</code>", set <var title="">location</var> to the empty string, set <var title="">line</var> and <var title="">col</var> to 0, and set <var title="">error object</var> to null.</li>
<li><p>Let <var title="">event</var> be a new <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#errorevent>ErrorEvent</a></code> object that does not
bubble but is cancelable, and which has the event name <code title=event-error>error</code>.</li>
@@ -71816,6 +71821,8 @@ <h5 id=runtime-script-errors><span class=secno>7.1.3.5 </span>Runtime script err
<li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code> attribute to <var title="">col</var>.</li>
+ <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-object>error</code> attribute to <var title="">error object</var>.</li>
+
<li><p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> <var title="">event</var> at <var title="">target</var>.</li>
<li><p>Let <var title="">target</var> no longer be <a href=#in-error-reporting-mode>in error reporting mode</a>.</li>
@@ -71842,13 +71849,15 @@ <h6 id=the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code><a
readonly attribute DOMString <a href=#dom-errorevent-filename title=dom-ErrorEvent-filename>filename</a>;
readonly attribute unsigned long <a href=#dom-errorevent-lineno title=dom-ErrorEvent-lineno>lineno</a>;
readonly attribute unsigned long <a href=#dom-errorevent-column title=dom-ErrorEvent-column>column</a>;
+ readonly attribute any <a href=#dom-errorevent-error title=dom-ErrorEvent-error>error</a>;
};
dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>EventInit</a> {
DOMString message;
DOMString filename;
unsigned long lineno;
unsigned long column;
+ any error;
};</pre>
<p>The <dfn id=dom-errorevent-message title=dom-ErrorEvent-message><code>message</code></dfn> attribute
@@ -71874,6 +71883,12 @@ <h6 id=the-errorevent-interface><span class=secno>7.1.3.5.2 </span>The <code><a
represents the column number where the error occurred in the
script.</p>
+ <p>The <dfn id=dom-errorevent-error title=dom-ErrorEvent-error><code>error</code></dfn>
+ attribute must return the value it was initialized to. When the
+ object is created, this attribute must be initialized to null.
+ Where appropriate, it is set to the object representing the error (e.g. the exception object in
+ the case of an uncaught DOM exception).</p>
+
<div class=impl>
@@ -72442,8 +72457,10 @@ <h5 id=event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers<
<dl class=switch><dt>If the attribute is the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> attribute of
the <code><a href=#window>Window</a></code> object</dt>
- <dd>Let the function have four arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, and <code title="">column</code>.</dd>
+ <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">column</code>,
+ and <code title="">error</code>.</dd>
<!-- /column/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 -->
+ <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
<dt>Otherwise</dt>
@@ -72592,8 +72609,9 @@ <h5 id=event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers<
<p>Invoke <var title="">callback</var> with four arguments,
the first one having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code> attribute,
the second having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute,
- the third having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute, and
+ the third having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute,
the fourth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code> attribute,
+ the fifth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute, and
with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let the return
value be <var title="">return value</var>. <a href=#refsWEBIDL>[WEBIDL]</a></p>
@@ -72677,7 +72695,7 @@ <h5 id=event-handler-attributes><span class=secno>7.1.6.1 </span>Event handlers<
arguments:</p>
<pre class=idl>[TreatNonCallableAsNull]
-callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column);
+callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef <a href=#onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
<p>Similarly, the <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
@@ -80757,8 +80775,10 @@ <h4 id=runtime-script-errors-0><span class=secno>9.2.5 </span>Runtime script err
handled</a></i> afterwards, the user
agent must <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the <code><a href=#errorevent>ErrorEvent</a></code>
interface, with the name <code title=event-error>error</code>, that doesn't bubble and is
- cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, and <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code>
- attributes initialized appropriately, at the <code><a href=#worker>Worker</a></code> object associated with the
+ cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code>,
+ attributes initialized appropriately,
+ and with the <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute initialized to null,
+ at the <code><a href=#worker>Worker</a></code> object associated with the
worker. If the event is not canceled, the user agent must act as if the uncaught runtime script
error had occurred in the global scope that the <code><a href=#worker>Worker</a></code> object is in, thus repeating
the entire runtime script error reporting process one level up.</p>
@@ -103999,6 +104019,7 @@ <h2 class=no-num id=references>References</h2><!--REFS-->
Jake Verbaten,
James Craig,
James Graham,
+ James Green,
James Justin Harrell,
James Kozianski,
James M Snell,
View
33 index
@@ -71776,6 +71776,11 @@ interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
<a href=#fingerprinting-vector class=fingerprint title="fingerprinting vector"><img src=http://images.whatwg.org/fingerprint.png width=46 alt="(This is a fingerprinting vector.)" height=64></a>
</li>
+ <li><p>Let <var title="">error object</var> be the object that represents the error: in the case
+ of an uncaught exception, that would be the object that was thrown; in the case of a JavaScript
+ error that would be an <code>Error</code> object. If there is no corresponding object, then the
+ null value must be used instead.</li>
+
<li>
<p>Let <var title="">location</var> be an <a href=#absolute-url>absolute URL</a> that corresponds to the
@@ -71803,7 +71808,7 @@ interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
</li>
- <li><p>If <var title="">script</var> has <a href=#muted-errors>muted errors</a>, then set <var title="">message</var> to "<code title="">Script error.</code>", set <var title="">location</var> to the empty string, and set <var title="">line</var> and <var title="">col</var> to 0.</li>
+ <li><p>If <var title="">script</var> has <a href=#muted-errors>muted errors</a>, then set <var title="">message</var> to "<code title="">Script error.</code>", set <var title="">location</var> to the empty string, set <var title="">line</var> and <var title="">col</var> to 0, and set <var title="">error object</var> to null.</li>
<li><p>Let <var title="">event</var> be a new <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> <code><a href=#errorevent>ErrorEvent</a></code> object that does not
bubble but is cancelable, and which has the event name <code title=event-error>error</code>.</li>
@@ -71816,6 +71821,8 @@ interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
<li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code> attribute to <var title="">col</var>.</li>
+ <li><p>Initialize <var title="">event</var>'s <code title=dom-ErrorEvent-object>error</code> attribute to <var title="">error object</var>.</li>
+
<li><p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> <var title="">event</var> at <var title="">target</var>.</li>
<li><p>Let <var title="">target</var> no longer be <a href=#in-error-reporting-mode>in error reporting mode</a>.</li>
@@ -71842,13 +71849,15 @@ interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event>Event</a> {
readonly attribute DOMString <a href=#dom-errorevent-filename title=dom-ErrorEvent-filename>filename</a>;
readonly attribute unsigned long <a href=#dom-errorevent-lineno title=dom-ErrorEvent-lineno>lineno</a>;
readonly attribute unsigned long <a href=#dom-errorevent-column title=dom-ErrorEvent-column>column</a>;
+ readonly attribute any <a href=#dom-errorevent-error title=dom-ErrorEvent-error>error</a>;
};
dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>EventInit</a> {
DOMString message;
DOMString filename;
unsigned long lineno;
unsigned long column;
+ any error;
};</pre>
<p>The <dfn id=dom-errorevent-message title=dom-ErrorEvent-message><code>message</code></dfn> attribute
@@ -71874,6 +71883,12 @@ dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit>Even
represents the column number where the error occurred in the
script.</p>
+ <p>The <dfn id=dom-errorevent-error title=dom-ErrorEvent-error><code>error</code></dfn>
+ attribute must return the value it was initialized to. When the
+ object is created, this attribute must be initialized to null.
+ Where appropriate, it is set to the object representing the error (e.g. the exception object in
+ the case of an uncaught DOM exception).</p>
+
<div class=impl>
@@ -72442,8 +72457,10 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
<dl class=switch><dt>If the attribute is the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> attribute of
the <code><a href=#window>Window</a></code> object</dt>
- <dd>Let the function have four arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, and <code title="">column</code>.</dd>
+ <dd>Let the function have five arguments, named <code title="">event</code>, <code title="">source</code>, <code title="">lineno</code>, <code title="">column</code>,
+ and <code title="">error</code>.</dd>
<!-- /column/ is new as of 2012; see https://www.w3.org/Bugs/Public/show_bug.cgi?id=13319 -->
+ <!-- /error/ is new as of 2013; see http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Jul/0313.html -->
<dt>Otherwise</dt>
@@ -72592,8 +72609,9 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
<p>Invoke <var title="">callback</var> with four arguments,
the first one having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code> attribute,
the second having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute,
- the third having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute, and
+ the third having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code> attribute,
the fourth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code> attribute,
+ the fifth having the value of <var title="">E</var>'s <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute, and
with the <i title=dfn-callback-this-value>callback this value</i> set to <var title="">E</var>'s <code title=dom-Event-currentTarget>currentTarget</code>. Let the return
value be <var title="">return value</var>. <a href=#refsWEBIDL>[WEBIDL]</a></p>
@@ -72677,7 +72695,7 @@ typedef <a href=#eventhandlernonnull>EventHandlerNonNull</a>? <dfn id=eventhandl
arguments:</p>
<pre class=idl>[TreatNonCallableAsNull]
-callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column);
+callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef <a href=#onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
<p>Similarly, the <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
@@ -80757,8 +80775,10 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})
handled</a></i> afterwards, the user
agent must <a href=#queue-a-task>queue a task</a> to <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event that uses the <code><a href=#errorevent>ErrorEvent</a></code>
interface, with the name <code title=event-error>error</code>, that doesn't bubble and is
- cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, and <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code>
- attributes initialized appropriately, at the <code><a href=#worker>Worker</a></code> object associated with the
+ cancelable, with its <code title=dom-ErrorEvent-message><a href=#dom-errorevent-message>message</a></code>, <code title=dom-ErrorEvent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code title=dom-ErrorEvent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, <code title=dom-ErrorEvent-column><a href=#dom-errorevent-column>column</a></code>,
+ attributes initialized appropriately,
+ and with the <code title=dom-ErrorEvent-error><a href=#dom-errorevent-error>error</a></code> attribute initialized to null,
+ at the <code><a href=#worker>Worker</a></code> object associated with the
worker. If the event is not canceled, the user agent must act as if the uncaught runtime script
error had occurred in the global scope that the <code><a href=#worker>Worker</a></code> object is in, thus repeating
the entire runtime script error reporting process one level up.</p>
@@ -103999,6 +104019,7 @@ if (s = prompt('What is your name?')) {
Jake Verbaten,
James Craig,
James Graham,
+ James Green,
James Justin Harrell,
James Kozianski,
James M Snell,
Oops, something went wrong.

0 comments on commit fe7e350

Please sign in to comment.