Bug 1332213 - Store the update stream duplicately in v2 protocol parser. r=francois.

MozReview-Commit-ID: dPbvro5xIa

--HG--
extra : rebase_source : 911291a89531bbe55490f38b094015fcd6664562
This commit is contained in:
Henry 2017-01-19 17:16:13 +08:00
Родитель 97091ff0e1
Коммит 4f731551c1
3 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -142,6 +142,9 @@ ProtocolParserV2::AppendStream(const nsACString& aData)
nsresult rv;
mPending.Append(aData);
#ifdef MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES
mRawUpdate.Append(aData);
#endif
bool done = false;
while (!done) {

Просмотреть файл

@ -31,7 +31,7 @@ public:
nsresult Init(nsICryptoHash* aHasher);
#ifdef MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES
nsCString GetRawTableUpdates() const { return mPending; }
virtual nsCString GetRawTableUpdates() const { return mPending; }
#endif
virtual void SetCurrentTable(const nsACString& aTable) = 0;
@ -101,6 +101,12 @@ public:
virtual const nsTArray<ForwardedUpdate> &Forwards() const override { return mForwards; }
virtual bool ResetRequested() override { return mResetRequested; }
#ifdef MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES
// Unfortunately we have to override to return mRawUpdate which
// will not be modified during the parsing, unlike mPending.
virtual nsCString GetRawTableUpdates() const override { return mRawUpdate; }
#endif
private:
virtual TableUpdate* CreateTableUpdate(const nsACString& aTableName) const override;
@ -158,6 +164,10 @@ private:
// Updates to apply to the current table being parsed.
TableUpdateV2 *mTableUpdate;
#ifdef MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES
nsCString mRawUpdate; // Keep a copy of mPending before it's processed.
#endif
};
// Helpers to parse the "proto" list format.

Просмотреть файл

@ -25,4 +25,9 @@ UNIFIED_SOURCES += [
'TestVariableLengthPrefixSet.cpp',
]
# Required to have the same MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES
# as non-testing code.
if CONFIG['NIGHTLY_BUILD'] or CONFIG['MOZ_DEBUG']:
DEFINES['MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES'] = True
FINAL_LIBRARY = 'xul-gtest'