Don't calculate same hash multiple times

This commit is contained in:
Piro / YUKI Hiroshi 2016-08-18 22:56:51 +09:00
parent 4e4ec57324
commit fee1428f54

View File

@ -73,7 +73,9 @@
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) { onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) {
global.sendAsyncMessage(TreeStyleTabConstants.MESSAGE_TYPE, { global.sendAsyncMessage(TreeStyleTabConstants.MESSAGE_TYPE, {
command : TreeStyleTabConstants.COMMAND_REPORT_LOCATION_CHANGE, command : TreeStyleTabConstants.COMMAND_REPORT_LOCATION_CHANGE,
locations : this.collectLocations(global.content) locations : this.collectLocations(global.content).map(function(aURI) {
return this.getHashString(aURI);
}, this)
}); });
}, },
onStatusChange : function() {}, onStatusChange : function() {},
@ -88,7 +90,7 @@
collectLocations : function(aFrame, aLocations) { collectLocations : function(aFrame, aLocations) {
aLocations = aLocations || {}; aLocations = aLocations || {};
aLocations[this.getHashString(aFrame.location.href)] = true; aLocations[aFrame.location.href] = true;
Array.forEach(aFrame.frames, function(aSubFrame) { Array.forEach(aFrame.frames, function(aSubFrame) {
this.collectLocations(aSubFrame, aLocations); this.collectLocations(aSubFrame, aLocations);
}, this); }, this);