diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 5ae2efa3e0be..13935c368afa 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -338,7 +338,7 @@ pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); // If an urlclassifier table has not been updated in this number of seconds, // a gethash request will be forced to check that the result is still in // the database. -pref("urlclassifier.confirm-age", 2700); +pref("urlclassifier.max-complete-age", 2700); // URL for checking the reason for a malware warning. pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); diff --git a/b2g/confvars.sh b/b2g/confvars.sh index a3021feb2fc6..d2f90e318bd3 100755 --- a/b2g/confvars.sh +++ b/b2g/confvars.sh @@ -43,6 +43,7 @@ MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61} MOZ_EXTENSION_MANAGER=1 MOZ_SYS_MSG=1 +MOZ_TIME_MANAGER=1 MOZ_B2G_CERTDATA=1 MOZ_PAY=1 diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml index fa1d63a724d9..65a8cd36caad 100644 --- a/browser/app/blocklist.xml +++ b/browser/app/blocklist.xml @@ -1,5 +1,5 @@ - + @@ -46,7 +46,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -555,32 +555,16 @@ - - - - - + - - - - - + - - - - - + - - - - - + @@ -606,42 +590,42 @@ - + - + - + - + - + - + @@ -666,6 +650,16 @@ + + + + + + + + + + diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index f44570d4b9f4..d6a186cd14d5 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -734,7 +734,7 @@ pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); // If an urlclassifier table has not been updated in this number of seconds, // a gethash request will be forced to check that the result is still in // the database. -pref("urlclassifier.confirm-age", 2700); +pref("urlclassifier.max-complete-age", 2700); #endif pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/firefox/geolocation/"); diff --git a/configure.in b/configure.in index d49909b7c74d..713371dedf45 100644 --- a/configure.in +++ b/configure.in @@ -4308,6 +4308,7 @@ MOZ_WEBSMS_BACKEND= MOZ_GRAPHITE=1 ACCESSIBILITY=1 MOZ_SYS_MSG= +MOZ_TIME_MANAGER= MOZ_PAY= MOZ_AUDIO_CHANNEL_MANAGER= @@ -7573,6 +7574,14 @@ if test -n "$MOZ_SYS_MSG"; then fi AC_SUBST(MOZ_SYS_MSG) +dnl ======================================================== +dnl = Enable Support for Time Manager API +dnl ======================================================== +if test -n "$MOZ_TIME_MANAGER"; then + AC_DEFINE(MOZ_TIME_MANAGER) +fi +AC_SUBST(MOZ_TIME_MANAGER) + dnl ======================================================== dnl = Enable Camera Interface for B2G (Gonk usually) dnl ======================================================== diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index 36e322683bf1..eb67f1fd6c52 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -582,7 +582,8 @@ static const TrackRate RATE_VIDEO = USECS_PER_S; void nsBuiltinDecoderStateMachine::SendStreamData() { - NS_ASSERTION(OnDecodeThread(), "Should be on decode thread."); + NS_ASSERTION(OnDecodeThread() || + OnStateMachineThread(), "Should be on decode thread or state machine thread"); mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); DecodedStreamData* stream = mDecoder->GetDecodedStream(); @@ -592,6 +593,13 @@ void nsBuiltinDecoderStateMachine::SendStreamData() if (mState == DECODER_STATE_DECODING_METADATA) return; + // If there's still an audio thread alive, then we can't send any stream + // data yet since both SendStreamData and the audio thread want to be in + // charge of popping the audio queue. We're waiting for the audio thread + // to die before sending anything to our stream. + if (mAudioThread) + return; + int64_t minLastAudioPacketTime = INT64_MAX; SourceMediaStream* mediaStream = stream->mStream; StreamTime endPosition = 0; @@ -1338,8 +1346,12 @@ void nsBuiltinDecoderStateMachine::SetAudioCaptured(bool aCaptured) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - if (!mAudioCaptured && aCaptured) { - StopAudioThread(); + if (!mAudioCaptured && aCaptured && !mStopAudioThread) { + // Make sure the state machine runs as soon as possible. That will + // stop the audio thread. + // If mStopAudioThread is true then we're already stopping the audio thread + // and since we set mAudioCaptured to true, nothing can start it again. + ScheduleStateMachine(); } mAudioCaptured = aCaptured; } @@ -1547,7 +1559,15 @@ void nsBuiltinDecoderStateMachine::StopDecodeThread() void nsBuiltinDecoderStateMachine::StopAudioThread() { + NS_ASSERTION(OnDecodeThread() || + OnStateMachineThread(), "Should be on decode thread or state machine thread"); mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); + + if (mStopAudioThread) { + // Nothing to do, since the thread is already stopping + return; + } + mStopAudioThread = true; mDecoder->GetReentrantMonitor().NotifyAll(); if (mAudioThread) { @@ -1557,6 +1577,9 @@ void nsBuiltinDecoderStateMachine::StopAudioThread() mAudioThread->Shutdown(); } mAudioThread = nullptr; + // Now that the audio thread is dead, try sending data to our MediaStream(s). + // That may have been waiting for the audio thread to stop. + SendStreamData(); } } @@ -1633,8 +1656,13 @@ nsBuiltinDecoderStateMachine::StartAudioThread() NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(), "Should be on state machine or decode thread."); mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); + if (mAudioCaptured) { + NS_ASSERTION(mStopAudioThread, "mStopAudioThread must always be true if audio is captured"); + return NS_OK; + } + mStopAudioThread = false; - if (HasAudio() && !mAudioThread && !mAudioCaptured) { + if (HasAudio() && !mAudioThread) { nsresult rv = NS_NewNamedThread("Media Audio", getter_AddRefs(mAudioThread), nullptr, @@ -2499,6 +2527,11 @@ nsresult nsBuiltinDecoderStateMachine::CallRunStateMachine() // This flag prevents us from dispatching mDispatchedRunEvent = false; + // If audio is being captured, stop the audio thread if it's running + if (mAudioCaptured) { + StopAudioThread(); + } + mTimeout = TimeStamp(); mIsRunning = true; diff --git a/content/media/nsBuiltinDecoderStateMachine.h b/content/media/nsBuiltinDecoderStateMachine.h index 96d9be9afb92..743177c6a921 100644 --- a/content/media/nsBuiltinDecoderStateMachine.h +++ b/content/media/nsBuiltinDecoderStateMachine.h @@ -610,7 +610,8 @@ protected: // been consumed by the play state machine thread. uint32_t mAmpleVideoFrames; // True if we shouldn't play our audio (but still write it to any capturing - // streams). + // streams). When this is true, mStopAudioThread is always true and + // the audio thread will never start again after it has stopped. bool mAudioCaptured; // True if the media resource can be seeked. Accessed from the state diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 70757865044f..6e209a980ee2 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -135,7 +135,9 @@ NS_INTERFACE_MAP_BEGIN(Navigator) #endif NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorCamera) NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorSystemMessages) +#ifdef MOZ_TIME_MANAGER NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorTime) +#endif #ifdef MOZ_AUDIO_CHANNEL_MANAGER NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorAudioChannelManager) #endif @@ -1378,6 +1380,7 @@ Navigator::MozSetMessageHandler(const nsAString& aType, //***************************************************************************** // Navigator::nsIDOMNavigatorTime //***************************************************************************** +#ifdef MOZ_TIME_MANAGER NS_IMETHODIMP Navigator::GetMozTime(nsIDOMMozTimeManager** aTime) { @@ -1394,6 +1397,7 @@ Navigator::GetMozTime(nsIDOMMozTimeManager** aTime) NS_ADDREF(*aTime = mTimeManager); return NS_OK; } +#endif //***************************************************************************** // nsNavigator::nsIDOMNavigatorCamera diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index e37ce6a28867..87059ff23975 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -113,7 +113,9 @@ class Navigator : public nsIDOMNavigator #endif , public nsIDOMNavigatorCamera , public nsIDOMNavigatorSystemMessages +#ifdef MOZ_TIME_MANAGER , public nsIDOMMozNavigatorTime +#endif #ifdef MOZ_AUDIO_CHANNEL_MANAGER , public nsIMozNavigatorAudioChannelManager #endif @@ -147,7 +149,9 @@ public: NS_DECL_NSIDOMNAVIGATORBLUETOOTH #endif NS_DECL_NSIDOMNAVIGATORSYSTEMMESSAGES +#ifdef MOZ_TIME_MANAGER NS_DECL_NSIDOMMOZNAVIGATORTIME +#endif #ifdef MOZ_AUDIO_CHANNEL_MANAGER NS_DECL_NSIMOZNAVIGATORAUDIOCHANNELMANAGER diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 6ddc260c7aff..af72ae7959b3 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -535,7 +535,9 @@ using mozilla::dom::indexedDB::IDBWrapperCache; #include "nsIDOMNavigatorSystemMessages.h" #include "mozilla/dom/Activity.h" +#ifdef MOZ_TIME_MANAGER #include "TimeManager.h" +#endif #include "DOMCameraManager.h" #include "DOMCameraControl.h" @@ -1726,8 +1728,10 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(MozActivity, nsEventTargetSH, EVENTTARGET_SCRIPTABLE_FLAGS) +#ifdef MOZ_TIME_MANAGER NS_DEFINE_CLASSINFO_DATA(MozTimeManager, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) +#endif #ifdef MOZ_WEBRTC NS_DEFINE_CLASSINFO_DATA(DataChannel, nsEventTargetSH, @@ -2526,7 +2530,9 @@ nsDOMClassInfo::Init() #ifdef MOZ_SYS_MSG DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorSystemMessages) #endif +#ifdef MOZ_TIME_MANAGER DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorTime) +#endif #ifdef MOZ_AUDIO_CHANNEL_MANAGER DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorAudioChannelManager) #endif @@ -4542,9 +4548,11 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END +#ifdef MOZ_TIME_MANAGER DOM_CLASSINFO_MAP_BEGIN(MozTimeManager, nsIDOMMozTimeManager) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozTimeManager) DOM_CLASSINFO_MAP_END +#endif #ifdef MOZ_WEBRTC DOM_CLASSINFO_MAP_BEGIN(DataChannel, nsIDOMDataChannel) diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index 09e6fb675a75..9dac9a9064cc 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -531,7 +531,9 @@ DOMCI_CLASS(LockedFile) DOMCI_CLASS(MozActivity) +#ifdef MOZ_TIME_MANAGER DOMCI_CLASS(MozTimeManager) +#endif #ifdef MOZ_WEBRTC DOMCI_CLASS(DataChannel) diff --git a/dom/tests/mochitest/bugs/Makefile.in b/dom/tests/mochitest/bugs/Makefile.in index 785aa20b3ca6..a8374cd0d933 100644 --- a/dom/tests/mochitest/bugs/Makefile.in +++ b/dom/tests/mochitest/bugs/Makefile.in @@ -129,6 +129,7 @@ MOCHITEST_FILES = \ test_bug750051.html \ test_bug755320.html \ test_bug777628.html \ + test_bug823173.html \ $(NULL) ifneq (Linux,$(OS_ARCH)) diff --git a/dom/tests/mochitest/bugs/test_bug823173.html b/dom/tests/mochitest/bugs/test_bug823173.html new file mode 100644 index 000000000000..15748786c668 --- /dev/null +++ b/dom/tests/mochitest/bugs/test_bug823173.html @@ -0,0 +1,30 @@ + + + + + + Test for Bug 823173 + + + + +Mozilla Bug 823173 +

+ +
+
+
+ + diff --git a/dom/time/TimeManager.cpp b/dom/time/TimeManager.cpp index fed27daf624a..59245778b6e7 100644 --- a/dom/time/TimeManager.cpp +++ b/dom/time/TimeManager.cpp @@ -7,7 +7,9 @@ #include "nsITimeService.h" #include "TimeManager.h" +#ifdef MOZ_TIME_MANAGER DOMCI_DATA(MozTimeManager, mozilla::dom::time::TimeManager) +#endif namespace mozilla { namespace dom { @@ -16,7 +18,9 @@ namespace time { NS_INTERFACE_MAP_BEGIN(TimeManager) NS_INTERFACE_MAP_ENTRY(nsIDOMMozTimeManager) NS_INTERFACE_MAP_ENTRY(nsISupports) +#ifdef MOZ_TIME_MANAGER NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozTimeManager) +#endif NS_INTERFACE_MAP_END NS_IMPL_ADDREF(TimeManager) diff --git a/ipc/chromium/src/base/debug_util_posix.cc b/ipc/chromium/src/base/debug_util_posix.cc index dadb79174def..b32c86d41642 100644 --- a/ipc/chromium/src/base/debug_util_posix.cc +++ b/ipc/chromium/src/base/debug_util_posix.cc @@ -20,6 +20,9 @@ #endif #if defined(OS_MACOSX) || defined(OS_BSD) +#if defined(OS_OPENBSD) +#include +#endif #include #endif diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 6ef866fd2baf..42f21d29ca5c 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -576,7 +576,7 @@ pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); // If an urlclassifier table has not been updated in this number of seconds, // a gethash request will be forced to check that the result is still in // the database. -pref("urlclassifier.confirm-age", 2700); +pref("urlclassifier.max-complete-age", 2700); #endif // True if this is the first time we are showing about:firstrun diff --git a/mobile/xul/app/mobile.js b/mobile/xul/app/mobile.js index ae77196e307a..732d2b9ab3ce 100644 --- a/mobile/xul/app/mobile.js +++ b/mobile/xul/app/mobile.js @@ -628,7 +628,7 @@ pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); // If an urlclassifier table has not been updated in this number of seconds, // a gethash request will be forced to check that the result is still in // the database. -pref("urlclassifier.confirm-age", 2700); +pref("urlclassifier.max-complete-age", 2700); // URL for checking the reason for a malware warning. pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index 1564dad3b845..0447f2521818 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -987,10 +987,13 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr, // pass the bytes-unit and the SP char *range = (char *) strchr(colon + 2, ' '); - if (!range) return NS_ERROR_FAILURE; + do { + range++; + } while (*range == ' '); + if (range[0] == '*'){ mByteRangeStart = mByteRangeEnd = 0; } diff --git a/netwerk/test/unit/test_multipart_byteranges.js b/netwerk/test/unit/test_multipart_byteranges.js new file mode 100644 index 000000000000..bb4172dfc97f --- /dev/null +++ b/netwerk/test/unit/test_multipart_byteranges.js @@ -0,0 +1,122 @@ +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://testing-common/httpd.js"); + +var httpserver = null; +var uri = "http://localhost:4444/multipart"; + +function make_channel(url) { + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + return ios.newChannel(url, "", null); +} + +var multipartBody = "--boundary\r\n"+ +"Content-type: text/plain\r\n"+ +"Content-range: bytes 0-2/10\r\n"+ +"\r\n"+ +"aaa\r\n"+ +"--boundary\r\n"+ +"Content-type: text/plain\r\n"+ +"Content-range: bytes 3-7/10\r\n"+ +"\r\n"+ +"bbbbb"+ +"\r\n"+ +"--boundary\r\n"+ +"Content-type: text/plain\r\n"+ +"Content-range: bytes 8-9/10\r\n"+ +"\r\n"+ +"cc"+ +"\r\n"+ +"--boundary--"; + +function make_channel(url) { + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + return ios.newChannel(url, "", null); +} + +function contentHandler(metadata, response) +{ + response.setHeader("Content-Type", 'multipart/byteranges; boundary="boundary"'); + response.bodyOutputStream.write(multipartBody, multipartBody.length); +} + +var numTests = 2; +var testNum = 0; + +var testData = + [ + { data: "aaa", type: "text/plain", isByteRangeRequest: true, startRange: 0, endRange: 2 }, + { data: "bbbbb", type: "text/plain", isByteRangeRequest: true, startRange: 3, endRange: 7 }, + { data: "cc", type: "text/plain", isByteRangeRequest: true, startRange: 8, endRange: 9 } + ]; + +function responseHandler(request, buffer) +{ + do_check_eq(buffer, testData[testNum].data); + do_check_eq(request.QueryInterface(Ci.nsIChannel).contentType, + testData[testNum].type); + do_check_eq(request.QueryInterface(Ci.nsIByteRangeRequest).isByteRangeRequest, + testData[testNum].isByteRangeRequest); + do_check_eq(request.QueryInterface(Ci.nsIByteRangeRequest).startRange, + testData[testNum].startRange); + do_check_eq(request.QueryInterface(Ci.nsIByteRangeRequest).endRange, + testData[testNum].endRange); + if (++testNum == numTests) + httpserver.stop(do_test_finished); +} + +var multipartListener = { + _buffer: "", + + QueryInterface: function(iid) { + if (iid.equals(Components.interfaces.nsIStreamListener) || + iid.equals(Components.interfaces.nsIRequestObserver) || + iid.equals(Components.interfaces.nsISupports)) + return this; + throw Components.results.NS_ERROR_NO_INTERFACE; + }, + + onStartRequest: function(request, context) { + this._buffer = ""; + }, + + onDataAvailable: function(request, context, stream, offset, count) { + try { + this._buffer = this._buffer.concat(read_stream(stream, count)); + dump("BUFFEEE: " + this._buffer + "\n\n"); + } catch (ex) { + do_throw("Error in onDataAvailable: " + ex); + } + }, + + onStopRequest: function(request, context, status) { + try { + responseHandler(request, this._buffer); + } catch (ex) { + do_throw("Error in closure function: " + ex); + } + } +}; + +function run_test() +{ + httpserver = new HttpServer(); + httpserver.registerPathHandler("/multipart", contentHandler); + httpserver.start(4444); + + var streamConv = Cc["@mozilla.org/streamConverters;1"] + .getService(Ci.nsIStreamConverterService); + var conv = streamConv.asyncConvertData("multipart/byteranges", + "*/*", + multipartListener, + null); + + var chan = make_channel(uri); + chan.asyncOpen(conv, null); + do_test_pending(); +} diff --git a/netwerk/test/unit/xpcshell.ini b/netwerk/test/unit/xpcshell.ini index 3e9e048abc16..460e3f14963a 100644 --- a/netwerk/test/unit/xpcshell.ini +++ b/netwerk/test/unit/xpcshell.ini @@ -145,6 +145,7 @@ skip-if = os == "android" [test_mismatch_last-modified.js] [test_MIME_params.js] [test_mozTXTToHTMLConv.js] +[test_multipart_byteranges.js] [test_multipart_streamconv.js] [test_multipart_streamconv_missing_lead_boundary.js] [test_nestedabout_serialize.js] diff --git a/testing/mochitest/android.json b/testing/mochitest/android.json index c96a72ccd87a..928fe31d9cd8 100644 --- a/testing/mochitest/android.json +++ b/testing/mochitest/android.json @@ -177,6 +177,7 @@ "dom/tests/mochitest/bugs/test_bug597809.html": "", "dom/tests/mochitest/bugs/test_bug61098.html": "", "dom/tests/mochitest/bugs/test_bug641552.html": "", + "dom/tests/mochitest/bugs/test_bug823173.html": "disabled on Android for Firefox 18 because their xpts are all broken. See bug 807222 part 5", "dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html": "bug 775227", "dom/tests/mochitest/bugs/test_resize_move_windows.html": "TIMED_OUT", "dom/tests/mochitest/bugs/test_window_bar.html": "", diff --git a/toolkit/components/url-classifier/LookupCache.cpp b/toolkit/components/url-classifier/LookupCache.cpp index 5302335b22a0..f9d34e1e8a41 100644 --- a/toolkit/components/url-classifier/LookupCache.cpp +++ b/toolkit/components/url-classifier/LookupCache.cpp @@ -54,7 +54,11 @@ LookupCache::LookupCache(const nsACString& aTableName, nsIFile* aStoreDir, , mPerClientRandomize(aPerClientRandomize) , mTableName(aTableName) , mStoreDirectory(aStoreDir) + , mTestTable(false) { + if (mTableName.RFind(NS_LITERAL_CSTRING("-simple")) != kNotFound) { + mTestTable = true; + } } nsresult @@ -199,14 +203,6 @@ LookupCache::Has(const Completion& aCompletion, { *aHas = *aComplete = false; - // check completion store first - if (mCompletions.BinaryIndexOf(aCompletion) != nsTArray::NoIndex) { - LOG(("Complete in %s", mTableName.get())); - *aComplete = true; - *aHas = true; - return NS_OK; - } - uint32_t prefix = aCompletion.ToUint32(); uint32_t hostkey = aHostkey.ToUint32(); uint32_t codedkey; @@ -223,8 +219,14 @@ LookupCache::Has(const Completion& aCompletion, LOG(("Probe in %s: %X, found %d", mTableName.get(), prefix, found)); - if (found) { - *aHas = true; + if (found || mTestTable) { + *aHas = found; + // check completion store + if (mCompletions.BinaryIndexOf(aCompletion) != nsTArray::NoIndex) { + LOG(("Complete in %s", mTableName.get())); + *aHas = true; + *aComplete = true; + } } return NS_OK; diff --git a/toolkit/components/url-classifier/LookupCache.h b/toolkit/components/url-classifier/LookupCache.h index ac25a54cd020..459b34b676d2 100644 --- a/toolkit/components/url-classifier/LookupCache.h +++ b/toolkit/components/url-classifier/LookupCache.h @@ -152,6 +152,9 @@ private: CompletionArray mCompletions; // Set of prefixes known to be in the database nsRefPtr mPrefixSet; + + // Fx18 temporary; true if this is a -simple test table. + bool mTestTable; }; } diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 80368e244de7..d6e9a3b6cf97 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -70,7 +70,7 @@ PRLogModuleInfo *gUrlClassifierDbServiceLog = nullptr; #define GETHASH_TABLES_PREF "urlclassifier.gethashtables" -#define CONFIRM_AGE_PREF "urlclassifier.confirm-age" +#define CONFIRM_AGE_PREF "urlclassifier.max-complete-age" #define CONFIRM_AGE_DEFAULT_SEC (45 * 60) class nsUrlClassifierDBServiceWorker; diff --git a/toolkit/components/url-classifier/tests/unit/test_partial.js b/toolkit/components/url-classifier/tests/unit/test_partial.js index 2e997bc36d78..60723b5fd5c3 100644 --- a/toolkit/components/url-classifier/tests/unit/test_partial.js +++ b/toolkit/components/url-classifier/tests/unit/test_partial.js @@ -661,7 +661,7 @@ function testStaleList() }; // Consider a match stale after one second. - prefBranch.setIntPref("urlclassifier.confirm-age", 1); + prefBranch.setIntPref("urlclassifier.max-complete-age", 1); // Apply the update. doStreamUpdate(update, function() { @@ -670,7 +670,7 @@ function testStaleList() new Timer(3000, function() { // Now the lists should be marked stale. Check assertions. checkAssertions(assertions, function() { - prefBranch.setIntPref("urlclassifier.confirm-age", 2700); + prefBranch.setIntPref("urlclassifier.max-complete-age", 2700); runNextTest(); }); }, updateError); @@ -701,7 +701,7 @@ function testStaleListEmpty() }; // Consider a match stale after one second. - prefBranch.setIntPref("urlclassifier.confirm-age", 1); + prefBranch.setIntPref("urlclassifier.max-complete-age", 1); // Apply the update. doStreamUpdate(update, function() { @@ -710,7 +710,7 @@ function testStaleListEmpty() new Timer(3000, function() { // Now the lists should be marked stale. Check assertions. checkAssertions(assertions, function() { - prefBranch.setIntPref("urlclassifier.confirm-age", 2700); + prefBranch.setIntPref("urlclassifier.max-complete-age", 2700); runNextTest(); }); }, updateError);