diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/autocomplete/nsAutoCompleteController.cpp | 15 | ||||
-rw-r--r-- | components/autocomplete/nsIAutoCompleteInput.idl | 9 | ||||
-rw-r--r-- | components/gfx/SanityTest.js | 45 | ||||
-rw-r--r-- | components/satchel/nsFormFillController.cpp | 13 | ||||
-rw-r--r-- | components/satchel/nsFormFillController.h | 1 |
5 files changed, 50 insertions, 33 deletions
diff --git a/components/autocomplete/nsAutoCompleteController.cpp b/components/autocomplete/nsAutoCompleteController.cpp index 37b2e5dfa..971a7abaf 100644 --- a/components/autocomplete/nsAutoCompleteController.cpp +++ b/components/autocomplete/nsAutoCompleteController.cpp @@ -1160,11 +1160,16 @@ nsAutoCompleteController::BeforeSearches() mSearchStatus = nsIAutoCompleteController::STATUS_SEARCHING; mDefaultIndexCompleted = false; - // The first search result will clear mResults array, though we should pass - // the previous result to each search to allow them to reuse it. So we - // temporarily cache current results till AfterSearches(). - if (!mResultCache.AppendObjects(mResults)) { - return NS_ERROR_OUT_OF_MEMORY; + bool invalidatePreviousResult = false; + mInput->GetInvalidatePreviousResult(&invalidatePreviousResult); + + if (!invalidatePreviousResult) { + // ClearResults will clear the mResults array, but we should pass the + // previous result to each search to allow reusing it. So we temporarily + // cache the current results until AfterSearches(). + if (!mResultCache.AppendObjects(mResults)) { + return NS_ERROR_OUT_OF_MEMORY; + } } mSearchesOngoing = mSearches.Length(); diff --git a/components/autocomplete/nsIAutoCompleteInput.idl b/components/autocomplete/nsIAutoCompleteInput.idl index 26a75ea77..98f36d11b 100644 --- a/components/autocomplete/nsIAutoCompleteInput.idl +++ b/components/autocomplete/nsIAutoCompleteInput.idl @@ -7,7 +7,7 @@ interface nsIAutoCompletePopup; -[scriptable, uuid(B068E70F-F82C-4C12-AD87-82E271C5C180)] +[scriptable, uuid(224d9847-d743-47e3-8c9e-07e1bcedf569)] interface nsIAutoCompleteInput : nsISupports { /* @@ -178,4 +178,11 @@ interface nsIAutoCompleteInput : nsISupports * The userContextId of the current browser. */ readonly attribute unsigned long userContextId; + + /** + * Indicates whether the previous result should be invalidated due to dynamic + * list updates. If search content is updated, we shouldn't use the previous + * search result. + */ + readonly attribute boolean invalidatePreviousResult; }; diff --git a/components/gfx/SanityTest.js b/components/gfx/SanityTest.js index 03b9067ef..3bf7a3f1d 100644 --- a/components/gfx/SanityTest.js +++ b/components/gfx/SanityTest.js @@ -22,27 +22,6 @@ const DISABLE_VIDEO_PREF="media.hardware-video-decoding.failed"; const RUNNING_PREF="sanity-test.running"; const TIMEOUT_SEC=20; -// GRAPHICS_SANITY_TEST histogram enumeration values -const TEST_PASSED=0; -const TEST_FAILED_RENDER=1; -const TEST_FAILED_VIDEO=2; -const TEST_CRASHED=3; -const TEST_TIMEOUT=4; - -// GRAPHICS_SANITY_TEST_REASON enumeration values. -const REASON_FIRST_RUN=0; -const REASON_FIREFOX_CHANGED=1; -const REASON_DEVICE_CHANGED=2; -const REASON_DRIVER_CHANGED=3; - -// GRAPHICS_SANITY_TEST_OS_SNAPSHOT histogram enumeration values -const SNAPSHOT_VIDEO_OK=0; -const SNAPSHOT_VIDEO_FAIL=1; -const SNAPSHOT_ERROR=2; -const SNAPSHOT_TIMEOUT=3; -const SNAPSHOT_LAYERS_OK=4; -const SNAPSHOT_LAYERS_FAIL=5; - function testPixel(ctx, x, y, r, g, b, a, fuzz) { var data = ctx.getImageData(x, y, 1, 1); @@ -55,6 +34,11 @@ function testPixel(ctx, x, y, r, g, b, a, fuzz) { return false; } +function stopRunning() { + Preferences.set(RUNNING_PREF, false); + Services.prefs.savePrefFile(null); +} + function setTimeout(aMs, aCallback) { var timer = Cc['@mozilla.org/timer;1']. createInstance(Ci.nsITimer); @@ -100,15 +84,18 @@ function testCompositor(win, ctx) { var testPassed = true; if (!verifyVideoRendering(ctx)) { + stopRunning(); Preferences.set(DISABLE_VIDEO_PREF, true); testPassed = false; } if (!verifyLayersRendering(ctx)) { + stopRunning(); testPassed = false; } if (testPassed) { + stopRunning(); } return testPassed; @@ -130,8 +117,10 @@ var listener = { this.win.onload = this.onWindowLoaded.bind(this); this.utils = this.win.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); + // Stop running the test if it timed out. setTimeout(TIMEOUT_SEC * 1000, () => { if (this.win) { + stopRunning(); this.endTest(); } }); @@ -208,17 +197,19 @@ SanityTest.prototype = { Ci.nsISupportsWeakReference]), shouldRunTest: function() { - // Only test gfx features if firefox has updated, or if the user has a new - // gpu or drivers. + // Only test GFX features if the application was updated, or if the user + // has a new GPU or drivers. var buildId = Services.appinfo.platformBuildID; var gfxinfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo); + // Stop the test and disable hardware video decoding if we crashed. if (Preferences.get(RUNNING_PREF, false)) { Preferences.set(DISABLE_VIDEO_PREF, true); + stopRunning(); return false; } - function checkPref(pref, value, reason) { + function checkPref(pref, value) { var prefValue = Preferences.get(pref, undefined); if (prefValue == value) { return true; @@ -227,9 +218,9 @@ SanityTest.prototype = { } // TODO: Handle dual GPU setups - if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion, REASON_DRIVER_CHANGED) && - checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID, REASON_DEVICE_CHANGED) && - checkPref(VERSION_PREF, buildId, REASON_FIREFOX_CHANGED)) + if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion) && + checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID) && + checkPref(VERSION_PREF, buildId)) { return false; } diff --git a/components/satchel/nsFormFillController.cpp b/components/satchel/nsFormFillController.cpp index 880ca79b2..7ac7c40a4 100644 --- a/components/satchel/nsFormFillController.cpp +++ b/components/satchel/nsFormFillController.cpp @@ -670,6 +670,13 @@ nsFormFillController::GetUserContextId(uint32_t* aUserContextId) return NS_OK; } +NS_IMETHODIMP +nsFormFillController::GetInvalidatePreviousResult( + bool* aInvalidatePreviousResult) { + *aInvalidatePreviousResult = mInvalidatePreviousResult; + return NS_OK; +} + //////////////////////////////////////////////////////////////////////// //// nsIAutoCompleteSearch @@ -807,6 +814,8 @@ void nsFormFillController::RevalidateDataList() return; } + // We cannot use previous result since any items in search target are updated. + mInvalidatePreviousResult = true; controller->StartSearch(mLastSearchString); return; } @@ -817,6 +826,8 @@ void nsFormFillController::RevalidateDataList() nsCOMPtr<nsIAutoCompleteResult> result; + // We cannot use previous result since any items in search target are updated. + mInvalidatePreviousResult = true; rv = inputListAutoComplete->AutoCompleteSearch(mLastSearchString, mFocusedInput, getter_AddRefs(result)); @@ -864,6 +875,8 @@ nsFormFillController::OnSearchCompletion(nsIAutoCompleteResult *aResult) NS_IMETHODIMP nsFormFillController::HandleEvent(nsIDOMEvent* aEvent) { + mInvalidatePreviousResult = false; + nsAutoString type; aEvent->GetType(type); diff --git a/components/satchel/nsFormFillController.h b/components/satchel/nsFormFillController.h index 27fb1edbd..b11835d1d 100644 --- a/components/satchel/nsFormFillController.h +++ b/components/satchel/nsFormFillController.h @@ -120,6 +120,7 @@ protected: bool mCompleteSelectedIndex; bool mForceComplete; bool mSuppressOnInput; + bool mInvalidatePreviousResult = false; }; #endif // __nsFormFillController__ |