Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($sniffer): history problems on Boxee box #3687

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ng/sniffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function $SnifferProvider() {
this.$get = ['$window', '$document', function($window, $document) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
boxee = $window.navigator.userAgent.indexOf('Boxee') != -1,
document = $document[0] || {},
vendorPrefix,
vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
Expand Down Expand Up @@ -55,7 +56,10 @@ function $SnifferProvider() {
// so let's not use the history API at all.
// http://code.google.com/p/android/issues/detail?id=17471
// https://github.com/angular/angular.js/issues/904
history: !!($window.history && $window.history.pushState && !(android < 4)),

// older webit browser (533.9) on Boxee box has exactly the same problem as Android has
// so let's not use the history API also
history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies
(!document.documentMode || document.documentMode > 7),
Expand Down
23 changes: 23 additions & 0 deletions test/ng/snifferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,27 @@ describe('$sniffer', function() {
});

});

describe('history', function() {
it('should be true on Boxee box with an older version of Webkit', function() {
module(function($provide) {
var doc = {
body : {
style : {}
}
};
var win = {
navigator: {
userAgent: 'Boxee'
}
};
$provide.value('$document', jqLite(doc));
$provide.value('$window', win);
});
inject(function($sniffer) {
expect($sniffer.history).toBe(false);
});
});

});
});