this fixes browser history quirk on Chromium

pull/2/head 0.9.0.0
gorhill 10 years ago
parent 535a46db37
commit 73ed896a85

@ -184,7 +184,7 @@ var collapser = (function() {
var collapse = response.collapse; var collapse = response.collapse;
var placeholders = response.placeholders; var placeholders = response.placeholders;
var i = requests.length; var i = requests.length;
var request, entry, target, tagName; var request, entry, target, tagName, docurl;
while ( i-- ) { while ( i-- ) {
request = requests[i]; request = requests[i];
if ( pendingRequests.hasOwnProperty(request.id) === false ) { if ( pendingRequests.hasOwnProperty(request.id) === false ) {
@ -211,12 +211,14 @@ var collapser = (function() {
// Special case: iframe // Special case: iframe
if ( tagName === 'iframe' ) { if ( tagName === 'iframe' ) {
target.setAttribute( docurl = 'data:text/html,' + encodeURIComponent(placeholders.iframe.replace(reURLplaceholder, request.url));
'src', // Using contentWindow.location prevent tainting browser
'data:text/html,' + encodeURIComponent( // history -- i.e. breaking back button (seen on Chromium).
placeholders.iframe.replace(reURLplaceholder, request.url) if ( target.contentWindow ) {
) target.contentWindow.location.replace(docurl);
); } else {
target.setAttribute('src', docurl);
}
continue; continue;
} }

Loading…
Cancel
Save