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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>52046</bug_id>
          
          <creation_ts>2011-01-06 22:34:56 -0800</creation_ts>
          <short_desc>Navigation history inconsistent with FF/IE when using .open() on an iframe document</short_desc>
          <delta_ts>2022-08-18 13:11:48 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Frames</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Darth">priyajeet.hora</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>83.samarth</cc>
    
    <cc>achristensen</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>arpitabahuguna</cc>
    
    <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>creis</cc>
    
    <cc>fishd</cc>
    
    <cc>mihaip</cc>
    
    <cc>priyajeet.hora</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>330649</commentid>
    <comment_count>0</comment_count>
    <who name="Darth">priyajeet.hora</who>
    <bug_when>2011-01-06 22:34:56 -0800</bug_when>
    <thetext>Please use the file below.
Open it in IE/FF/Safari/Chrome, press the button a few times and observe the history entries of the browser.

FF/IE: history entry gets added per click
Webkit: no history entry added

Then comment out the 2 lines that deal with .open() and .close() and all the browsers behave similarly.

Unsure if this bug impacts much. Nothing is mentioned here
https://developer.mozilla.org/en/DOM/document.open about history
But I guess it opens with an empty origin, later src changes, hence a history entry.

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;script&gt;
		function butt() {
			var frame = document.createElement(&apos;iframe&apos;);
			frame.width = &apos;500px&apos;;
			frame.height = &apos;500px&apos;;
			document.body.appendChild(frame);
			frame.contentDocument.open();
			frame.contentDocument.close();
			frame.src = &apos;http://www.chromium.org/&apos;;
			document.getElementById(&apos;history&apos;).innerHTML = window.history.length;
		}
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;button type=&apos;button&apos; onclick=&apos;butt();&apos;&gt;Create iframe, then open() it and then close() it&lt;/button&gt;
	History Length (should increment like FF/IE every button onclick): &lt;div id=&apos;history&apos;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>330651</commentid>
    <comment_count>1</comment_count>
      <attachid>78212</attachid>
    <who name="Darth">priyajeet.hora</who>
    <bug_when>2011-01-06 22:35:51 -0800</bug_when>
    <thetext>Created attachment 78212
iframe creation history entries test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>573668</commentid>
    <comment_count>2</comment_count>
    <who name="Arpita Bahuguna">arpitabahuguna</who>
    <bug_when>2012-03-07 23:59:22 -0800</bug_when>
    <thetext>Not just for an iFrame but even otherwise back/forward navigation does not work as expected in case of document.open().

Currently Webkit does not seem to support the &quot;replace&quot; argument for the document.open() method.

As per the specification (http://dev.w3.org/html5/spec-LC/apis-in-html-documents.html#opening-the-input-stream) :
&quot;If replace is false, then add a new entry, just before the last entry, and associate with the new entry the text that was parsed by the previous parser associated with the Document object, as well as the state of the document at the start of these steps. This allows the user to step backwards in the session history to see the page before it was blown away by the document.open() call. This new entry does not have a Document object, so a new one will be created if the session history is traversed to that entry.&quot;

The &quot;entry&quot; mentioned above refers to the History entry.

However, this seems to work well on FF and IE.

Additional test scenario:
Fetch: http://lava.access.co.jp/nmcstestsuite/Scheme/
Click on: &quot;javascript_scheme&quot;
On the following page click on &quot;0&quot; link.
Now navigate back to the starting page. Note that the second page is skipped.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1872768</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-05-30 09:13:18 -0700</bug_when>
    <thetext>From spec perspective, it was aligned with Chrome (Webkit) as per below:

https://bugs.chromium.org/p/chromium/issues/detail?id=68833#c17

Further - based on JSFiddle - https://jsfiddle.net/u9tpz6ye/1/

Upon each reach Fiddle run and clicking on &quot;button&quot;, it adds increment on Safari 15.5 but the behavior is inconsistent across browsers as below:

E.g. Chrome sometime start with 4 or 3 and same is with Firefox. I tried to use &quot;Incognito / Private Mode&quot; for this.

I think it is quite inconsistent and if we have WPT test cases to cover such behavior then good. Otherwise, it could be another webcompat issue. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>78212</attachid>
            <date>2011-01-06 22:35:51 -0800</date>
            <delta_ts>2011-01-06 22:35:51 -0800</delta_ts>
            <desc>iframe creation history entries test</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>640</size>
            <attacher name="Darth">priyajeet.hora</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KCTxzY3JpcHQ+DQoJCWZ1bmN0aW9uIGJ1
dHQoKSB7DQoJCQl2YXIgZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKTsN
CgkJCWZyYW1lLndpZHRoID0gJzUwMHB4JzsNCgkJCWZyYW1lLmhlaWdodCA9ICc1MDBweCc7DQoJ
CQlkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGZyYW1lKTsNCgkJCWZyYW1lLmNvbnRlbnREb2N1
bWVudC5vcGVuKCk7DQoJCQlmcmFtZS5jb250ZW50RG9jdW1lbnQuY2xvc2UoKTsNCgkJCWZyYW1l
LnNyYyA9ICdodHRwOi8vd3d3LmNocm9taXVtLm9yZy8nOw0KCQkJZG9jdW1lbnQuZ2V0RWxlbWVu
dEJ5SWQoJ2hpc3RvcnknKS5pbm5lckhUTUwgPSB3aW5kb3cuaGlzdG9yeS5sZW5ndGg7DQoJCX0N
Cgk8L3NjcmlwdD4NCjwvaGVhZD4NCjxib2R5Pg0KCTxidXR0b24gdHlwZT0nYnV0dG9uJyBvbmNs
aWNrPSdidXR0KCk7Jz5DcmVhdGUgaWZyYW1lLCB0aGVuIG9wZW4oKSBpdCBhbmQgdGhlbiBjbG9z
ZSgpIGl0PC9idXR0b24+DQoJSGlzdG9yeSBMZW5ndGggKHNob3VsZCBpbmNyZW1lbnQgbGlrZSBG
Ri9JRSBldmVyeSBidXR0b24gb25jbGljayk6IDxkaXYgaWQ9J2hpc3RvcnknPjwvZGl2Pg0KPC9i
b2R5Pg0KPC9odG1sPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>