Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
this fixes browser history quirk on Chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed May 12, 2015
1 parent 535a46d commit 73ed896
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/js/contentscript-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ var collapser = (function() {
var collapse = response.collapse;
var placeholders = response.placeholders;
var i = requests.length;
var request, entry, target, tagName;
var request, entry, target, tagName, docurl;
while ( i-- ) {
request = requests[i];
if ( pendingRequests.hasOwnProperty(request.id) === false ) {
Expand All @@ -211,12 +211,14 @@ var collapser = (function() {

// Special case: iframe
if ( tagName === 'iframe' ) {
target.setAttribute(
'src',
'data:text/html,' + encodeURIComponent(
placeholders.iframe.replace(reURLplaceholder, request.url)
)
);
docurl = 'data:text/html,' + encodeURIComponent(placeholders.iframe.replace(reURLplaceholder, request.url));
// Using contentWindow.location prevent tainting browser
// history -- i.e. breaking back button (seen on Chromium).
if ( target.contentWindow ) {
target.contentWindow.location.replace(docurl);
} else {
target.setAttribute('src', docurl);
}
continue;
}

Expand Down

0 comments on commit 73ed896

Please sign in to comment.