<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24110</bug_id>
          
          <creation_ts>2013-12-16 11:51:28 +0000</creation_ts>
          <short_desc>Navigate algorithm doesn&apos;t specify explicit action when aborting due to sandboxing in Step 2.</short_desc>
          <delta_ts>2014-01-03 21:33:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bob Owen">bobowencode</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bobbyholley</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97652</commentid>
    <comment_count>0</comment_count>
    <who name="Bob Owen">bobowencode</who>
    <bug_when>2013-12-16 11:51:28 +0000</bug_when>
    <thetext>Currently the navigate algorithm step 2:
http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate
says that if the source browsing context is not allowed to navigate the browsing context then abort these steps.
However it does not says explicitly what should be done if it aborts, nor do any of the callers of the algorithm as far as I can see.

Gecko currently throws in some circumstances and does nothing in others.
We have a bug to address this and make it throw where possible, as we believe it is better to propagate the error than to fail silently.

It would be good if this could be reflected in the spec, or at least a comment to say that the user agent may throw an InvalidAccessError at this point.

Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97693</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-16 21:58:45 +0000</bug_when>
    <thetext>I&apos;m confused. Why would it throw? Do you have a test case demonstrating what you mean? &quot;Abort&quot; here just means that on and no more: &quot;stop doing these steps&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97695</commentid>
    <comment_count>2</comment_count>
    <who name="Bobby Holley (:bholley)">bobbyholley</who>
    <bug_when>2013-12-16 22:03:35 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #1)
&gt; I&apos;m confused. Why would it throw?

Because it&apos;s generally more helpful to throw an exception than to fail silently? There may be reasons against this that I don&apos;t understand, but naively it seems like a reasonable thing to do.

&gt; Do you have a test case demonstrating what
&gt; you mean? &quot;Abort&quot; here just means that on and no more: &quot;stop doing these
&gt; steps&quot;.

Right. And Bob is proposing that things like .replace() should throw if they were prevented by sandboxing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97721</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-16 23:46:12 +0000</bug_when>
    <thetext>Oh I see, you mean when this is called synchronously from a method. I suppose we can throw if it&apos;s not Web-incompatible. What do you want to throw for? Anything that aborts before the algorithm goes async? Anything that aborts before the &quot;gone async&quot; flag starts being checked? Only the first thing that can abort, relating to the sandboxing flags? What if the user later indicates a desire to navigate anyway? What should the exception be, a regular secrutity exception? InvalidState?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97754</commentid>
    <comment_count>4</comment_count>
    <who name="Bob Owen">bobowencode</who>
    <bug_when>2013-12-17 18:55:29 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #3)
&gt; Oh I see, you mean when this is called synchronously from a method. I
&gt; suppose we can throw if it&apos;s not Web-incompatible. What do you want to throw
&gt; for?

I was thinking just for Step 2, which relates to the sandboxing flags and I was thinking an InvalidAccessError seems appropriate or perhaps an AbortError.

Nearly all the other cases before it goes async, seem to either be because some other algorithm takes over or because some other action is already happening.
In both these cases, it probably makes sense not to throw to makes sure the other actions are not affected.

As for web-compatibility, I&apos;m not sure, but window.open and location.replace can both throw exceptions for other reasons.
Also, Gecko already throws for window.open, and some others, when blocked because of sandboxing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97814</commentid>
    <comment_count>5</comment_count>
    <who name="Bobby Holley (:bholley)">bobbyholley</who>
    <bug_when>2013-12-19 18:23:09 +0000</bug_when>
    <thetext>Naively, the easiest thing for implementors is just to throw for anything that&apos;s sync. This allows the sandboxing code to just throw, and let the error propagate up to the caller if it happens to be synchronous script.

Whether it works out conveniently like that in practice I&apos;m not sure, since it depends on the details of the spec algorithms and Gecko&apos;s implementation of them, neither of which I have in my head right now. I&apos;ll defer to Ian and Bob on that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97978</commentid>
    <comment_count>6</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-03 21:33:51 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8370.
Check-in comment: Make the case of an API call trying to navigate a browsing context that it can&apos;t navigate due to sandboxing throw a security exception rather than silently fail.
http://html5.org/tools/web-apps-tracker?from=8369&amp;to=8370</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>