summaryrefslogtreecommitdiffstats
path: root/services/sync/modules/engines/history.js
diff options
context:
space:
mode:
Diffstat (limited to 'services/sync/modules/engines/history.js')
-rw-r--r--services/sync/modules/engines/history.js57
1 files changed, 16 insertions, 41 deletions
diff --git a/services/sync/modules/engines/history.js b/services/sync/modules/engines/history.js
index 307d484c1..e7f53766f 100644
--- a/services/sync/modules/engines/history.js
+++ b/services/sync/modules/engines/history.js
@@ -44,25 +44,6 @@ HistoryEngine.prototype = {
applyIncomingBatchSize: HISTORY_STORE_BATCH_SIZE,
syncPriority: 7,
-
- _processIncoming: function (newitems) {
- // We want to notify history observers that a batch operation is underway
- // so they don't do lots of work for each incoming record.
- let observers = PlacesUtils.history.getObservers();
- function notifyHistoryObservers(notification) {
- for (let observer of observers) {
- try {
- observer[notification]();
- } catch (ex) { }
- }
- }
- notifyHistoryObservers("onBeginUpdateBatch");
- try {
- return SyncEngine.prototype._processIncoming.call(this, newitems);
- } finally {
- notifyHistoryObservers("onEndUpdateBatch");
- }
- },
};
function HistoryStore(name, engine) {
@@ -105,7 +86,7 @@ HistoryStore.prototype = {
return this._getStmt(
"UPDATE moz_places " +
"SET guid = :guid " +
- "WHERE url_hash = hash(:page_url) AND url = :page_url");
+ "WHERE url = :page_url");
},
// Some helper functions to handle GUIDs
@@ -127,7 +108,7 @@ HistoryStore.prototype = {
return this._getStmt(
"SELECT guid " +
"FROM moz_places " +
- "WHERE url_hash = hash(:page_url) AND url = :page_url");
+ "WHERE url = :page_url");
},
_guidCols: ["guid"],
@@ -146,12 +127,12 @@ HistoryStore.prototype = {
},
get _visitStm() {
- return this._getStmt(`/* do not warn (bug 599936) */
- SELECT visit_type type, visit_date date
- FROM moz_historyvisits
- JOIN moz_places h ON h.id = place_id
- WHERE url_hash = hash(:url) AND url = :url
- ORDER BY date DESC LIMIT 20`);
+ return this._getStmt(
+ "/* do not warn (bug 599936) */ " +
+ "SELECT visit_type type, visit_date date " +
+ "FROM moz_historyvisits " +
+ "WHERE place_id = (SELECT id FROM moz_places WHERE url = :url) " +
+ "ORDER BY date DESC LIMIT 10");
},
_visitCols: ["date", "type"],
@@ -223,10 +204,7 @@ HistoryStore.prototype = {
} else {
shouldApply = this._recordToPlaceInfo(record);
}
- } catch (ex) {
- if (Async.isShutdownException(ex)) {
- throw ex;
- }
+ } catch(ex) {
failed.push(record.id);
shouldApply = false;
}
@@ -299,14 +277,14 @@ HistoryStore.prototype = {
if (!visit.date || typeof visit.date != "number") {
this._log.warn("Encountered record with invalid visit date: "
+ visit.date);
- continue;
+ throw "Visit has no date!";
}
- if (!visit.type ||
- !Object.values(PlacesUtils.history.TRANSITIONS).includes(visit.type)) {
- this._log.warn("Encountered record with invalid visit type: " +
- visit.type + "; ignoring.");
- continue;
+ if (!visit.type || !(visit.type >= PlacesUtils.history.TRANSITION_LINK &&
+ visit.type <= PlacesUtils.history.TRANSITION_RELOAD)) {
+ this._log.warn("Encountered record with invalid visit type: "
+ + visit.type);
+ throw "Invalid visit type!";
}
// Dates need to be integers.
@@ -317,7 +295,6 @@ HistoryStore.prototype = {
// overwritten.
continue;
}
-
visit.visitDate = visit.date;
visit.transitionType = visit.type;
k += 1;
@@ -369,9 +346,7 @@ HistoryStore.prototype = {
},
wipe: function HistStore_wipe() {
- let cb = Async.makeSyncCallback();
- PlacesUtils.history.clear().then(result => {cb(null, result)}, err => {cb(err)});
- return Async.waitForSyncCallback(cb);
+ PlacesUtils.history.removeAllPages();
}
};