diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 93f659b6395..32ed9f970db 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "9919e96678a4fc08ffe6ca9068bfc245394fa5e3", + "revision": "2cc6e0988688b33fa46e3a05a726fb7919d7420e", "repo_path": "/integration/gaia-central" } diff --git a/browser/base/content/browser-customization.js b/browser/base/content/browser-customization.js index 369f6cbd22c..4d15dea8c8d 100644 --- a/browser/base/content/browser-customization.js +++ b/browser/base/content/browser-customization.js @@ -40,6 +40,7 @@ let CustomizationHandler = { } CombinedStopReload.uninit(); + CombinedBackForward.uninit(); PlacesToolbarHelper.customizeStart(); BookmarkingUI.customizeStart(); DownloadsButton.customizeStart(); @@ -76,6 +77,7 @@ let CustomizationHandler = { // The url bar splitter state is dependent on whether stop/reload // and the location bar are combined, so we need this ordering CombinedStopReload.init(); + CombinedBackForward.init(); UpdateUrlbarSearchSplitterState(); // Update the urlbar diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index a4e70625e72..5beac53e6d5 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -251,7 +251,15 @@ function UpdateBackForwardCommands(aWebNavigation) { backBroadcaster.setAttribute("disabled", true); } - if (forwardDisabled == aWebNavigation.canGoForward) { + let canGoForward = aWebNavigation.canGoForward; + if (forwardDisabled) { + // Force the button to either be hidden (if we are already disabled, + // and should be), or to show if we're about to un-disable it: + // otherwise no transition will occur and it'll never show: + CombinedBackForward.setForwardButtonOcclusion(!canGoForward); + } + + if (forwardDisabled == canGoForward) { if (forwardDisabled) forwardBroadcaster.removeAttribute("disabled"); else @@ -904,6 +912,7 @@ var gBrowserInit = { // Misc. inits. CombinedStopReload.init(); + CombinedBackForward.init(); gPrivateBrowsingUI.init(); TabsInTitlebar.init(); @@ -1221,6 +1230,7 @@ var gBrowserInit = { // uninit methods don't depend on the services having been initialized). CombinedStopReload.uninit(); + CombinedBackForward.uninit(); gGestureSupport.init(false); @@ -2940,13 +2950,11 @@ const BrowserSearch = { openSearchPageIfFieldIsNotActive(searchBar); }; if (placement && placement.area == CustomizableUI.AREA_PANEL) { - PanelUI.show().then(() => { - // The panel is not constructed until the first time it is shown. - focusSearchBar(); - }); + // The panel is not constructed until the first time it is shown. + PanelUI.show().then(focusSearchBar); return; } - if (placement.area == CustomizableUI.AREA_NAVBAR && searchBar && + if (placement && placement.area == CustomizableUI.AREA_NAVBAR && searchBar && searchBar.parentNode.classList.contains("overflowedItem")) { let navBar = document.getElementById(CustomizableUI.AREA_NAVBAR); navBar.overflowable.show().then(() => { @@ -3775,6 +3783,7 @@ var XULBrowserWindow = { onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) { if (FullZoom.updateBackgroundTabs) FullZoom.onLocationChange(gBrowser.currentURI, true); + CombinedBackForward.setForwardButtonOcclusion(!gBrowser.webProgress.canGoForward); var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; var loadingDone = aStateFlags & nsIWebProgressListener.STATE_STOP; // use a pseudo-object instead of a (potentially nonexistent) channel for getting @@ -3849,6 +3858,43 @@ var LinkTargetDisplay = { } }; +let CombinedBackForward = { + init: function() { + this.forwardButton = document.getElementById("forward-button"); + // Add a transition listener to the url bar to hide the forward button + // when necessary + if (gURLBar) + gURLBar.addEventListener("transitionend", this); + // On startup, or if the user customizes, our listener isn't attached, + // and no transitions fire anyway, so we need to make sure we've hidden the + // button if necessary: + if (this.forwardButton && this.forwardButton.hasAttribute("disabled")) { + this.setForwardButtonOcclusion(true); + } + }, + uninit: function() { + if (gURLBar) + gURLBar.removeEventListener("transitionend", this); + }, + handleEvent: function(aEvent) { + if (aEvent.type == "transitionend" && + (aEvent.propertyName == "margin-left" || aEvent.propertyName == "margin-right") && + this.forwardButton.hasAttribute("disabled")) { + this.setForwardButtonOcclusion(true); + } + }, + setForwardButtonOcclusion: function(shouldBeOccluded) { + if (!this.forwardButton) + return; + + let hasAttribute = this.forwardButton.hasAttribute("occluded-by-urlbar"); + if (shouldBeOccluded && !hasAttribute) + this.forwardButton.setAttribute("occluded-by-urlbar", "true"); + else if (!shouldBeOccluded && hasAttribute) + this.forwardButton.removeAttribute("occluded-by-urlbar"); + } +} + var CombinedStopReload = { init: function () { if (this._initialized) @@ -4211,10 +4257,10 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { } - let addToPanel = popup.querySelector(".customize-context-addToPanel"); + let moveToPanel = popup.querySelector(".customize-context-moveToPanel"); let removeFromToolbar = popup.querySelector(".customize-context-removeFromToolbar"); - // View -> Toolbars menu doesn't have the addToPanel or removeFromToolbar items. - if (!addToPanel || !removeFromToolbar) { + // View -> Toolbars menu doesn't have the moveToPanel or removeFromToolbar items. + if (!moveToPanel || !removeFromToolbar) { return; } @@ -4241,10 +4287,10 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { let movable = toolbarItem && toolbarItem.parentNode && CustomizableUI.isWidgetRemovable(toolbarItem); if (movable) { - addToPanel.removeAttribute("disabled"); + moveToPanel.removeAttribute("disabled"); removeFromToolbar.removeAttribute("disabled"); } else { - addToPanel.setAttribute("disabled", true); + moveToPanel.setAttribute("disabled", true); removeFromToolbar.setAttribute("disabled", true); } } diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 4dab60e2f0b..3d8376fe13c 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -246,8 +246,8 @@ onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));"> + label="&customizeMenu.moveToPanel.label;" + class="customize-context-moveToPanel"/> + class="customize-context-moveToToolbar" + accesskey="&customizeMenu.moveToToolbar.accesskey;" + label="&customizeMenu.moveToToolbar.label;"/> { + is(aUrl, Services.search.defaultEngine.searchForm, "Search page should be requested to open."); + is(aWhichTab, "current", "Should use the current tab for the search page."); + openUILinkInCalled = true; + }; + sendWebSearchKeyCommand(); + yield waitForCondition(function() openUILinkInCalled); + ok(openUILinkInCalled, "The search page should have been opened.") + } catch (e) { + ok(false, e); + } + openUILinkIn = this.originalOpenUILinkIn; + CustomizableUI.reset(); +}); + function sendWebSearchKeyCommand() { if (Services.appinfo.OS === "Darwin") EventUtils.synthesizeKey("k", { accelKey: true }); diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index a723725f00f..2ed43a91050 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -333,6 +333,10 @@ These should match what Safari and other Apple applications use on OS X Lion. -- + + + + diff --git a/browser/metro/base/content/contenthandlers/Content.js b/browser/metro/base/content/contenthandlers/Content.js index 48709f18141..76d24700add 100644 --- a/browser/metro/base/content/contenthandlers/Content.js +++ b/browser/metro/base/content/contenthandlers/Content.js @@ -201,7 +201,6 @@ let Content = { break; case "DOMContentLoaded": - LoginManagerContent.onContentLoaded(aEvent); this._maybeNotifyErrorPage(); break; diff --git a/browser/metro/base/tests/mochitest/browser_apzc_basic.js b/browser/metro/base/tests/mochitest/browser_apzc_basic.js index 8a49f105201..5e4a426b0e7 100644 --- a/browser/metro/base/tests/mochitest/browser_apzc_basic.js +++ b/browser/metro/base/tests/mochitest/browser_apzc_basic.js @@ -69,6 +69,7 @@ gTests.push({ } }); +/* Double-tap is disabled (bug 950832). gTests.push({ desc: "double tap transforms", setUp: setUp, @@ -93,6 +94,7 @@ gTests.push({ clearNativeTouchSequence(); } }); +*/ gTests.push({ desc: "scroll transforms", diff --git a/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp b/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp index 32da7e5c463..86fb935b1ff 100644 --- a/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp +++ b/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp @@ -675,7 +675,7 @@ DelayedExecuteThread(LPVOID param) if (GetDefaultBrowserAppModelID(appModelID)) { Log(L"Activating application"); DWORD processID; - HRESULT hr = activateMgr->ActivateApplication(appModelID, L"", AO_NOSPLASHSCREEN, &processID); + HRESULT hr = activateMgr->ActivateApplication(appModelID, L"", AO_NOERRORUI, &processID); if (SUCCEEDED(hr)) { Log(L"Activate application succeeded"); } else { diff --git a/browser/modules/BrowserUITelemetry.jsm b/browser/modules/BrowserUITelemetry.jsm index a419e56b1cd..352a62a7854 100644 --- a/browser/modules/BrowserUITelemetry.jsm +++ b/browser/modules/BrowserUITelemetry.jsm @@ -23,6 +23,11 @@ const ALL_BUILTIN_ITEMS = [ "switch-to-metro-button", ]; +const OTHER_MOUSEUP_MONITORED_ITEMS = [ + "PlacesChevron", + "PlacesToolbarItems", +]; + this.BrowserUITelemetry = { init: function() { UITelemetry.addSimpleMeasureFunction("toolbars", @@ -106,6 +111,13 @@ this.BrowserUITelemetry = { (areaNode.customizationTarget || areaNode).addEventListener("mouseup", this); } } + + for (let itemID of OTHER_MOUSEUP_MONITORED_ITEMS) { + let item = document.getElementById(itemID); + if (item) { + item.addEventListener("mouseup", this); + } + } }, _unregisterWindow: function(aWindow) { @@ -118,6 +130,13 @@ this.BrowserUITelemetry = { (areaNode.customizationTarget || areaNode).removeEventListener("mouseup", this); } } + + for (let itemID of OTHER_MOUSEUP_MONITORED_ITEMS) { + let item = document.getElementById(itemID); + if (item) { + item.removeEventListener("mouseup", this); + } + } }, handleEvent: function(aEvent) { @@ -132,6 +151,38 @@ this.BrowserUITelemetry = { }, _handleMouseUp: function(aEvent) { + let targetID = aEvent.currentTarget.id; + + switch (targetID) { + case "PlacesToolbarItems": + this._PlacesToolbarItemsMouseUp(aEvent); + break; + case "PlacesChevron": + this._PlacesChevronMouseUp(aEvent); + break; + default: + this._checkForBuiltinItem(aEvent); + } + }, + + _PlacesChevronMouseUp: function(aEvent) { + let target = aEvent.originalTarget; + let result = target.id == "PlacesChevron" ? "chevron" : "overflowed-item"; + this._countMouseUpEvent("click-bookmarks-bar", result, aEvent.button); + }, + + _PlacesToolbarItemsMouseUp: function(aEvent) { + let target = aEvent.originalTarget; + // If this isn't a bookmark-item, we don't care about it. + if (!target.classList.contains("bookmark-item")) { + return; + } + + let result = target.hasAttribute("container") ? "container" : "item"; + this._countMouseUpEvent("click-bookmarks-bar", result, aEvent.button); + }, + + _checkForBuiltinItem: function(aEvent) { let item = aEvent.originalTarget; // Perhaps we're seeing one of the default toolbar items // being clicked. @@ -158,6 +209,10 @@ this.BrowserUITelemetry = { let document = win.document; let result = {}; + // Determine if the Bookmarks bar is currently visible + let bookmarksBar = document.getElementById("PersonalToolbar"); + result.bookmarksBarEnabled = bookmarksBar && !bookmarksBar.collapsed; + result.countableEvents = this._countableEvents; return result; diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index cf55ed29c07..8a17fd7825f 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -1839,7 +1839,7 @@ chatbox { %include ../shared/customizableui/customizeMode.inc.css -#main-window[customizing] #tab-view-deck { +#main-window[customize-entered] #tab-view-deck { background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"), url("chrome://browser/skin/customizableui/background-noise-toolbar.png"), linear-gradient(to bottom, #bcbcbc, #b5b5b5); diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 58db79bb397..62f16b9d67b 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -1280,6 +1280,10 @@ toolbar .toolbarbutton-1:not([type="menu-button"]), opacity: 0; } +@conditionalForwardWithUrlbar@ > #forward-button[occluded-by-urlbar] { + visibility: hidden; +} + @media (-moz-mac-lion-theme) { #forward-button:not(:-moz-lwtheme) { background-image: linear-gradient(hsla(0,0%,100%,.73), hsla(0,0%,100%,.05) 85%); @@ -1540,8 +1544,10 @@ toolbar .toolbarbutton-1:not([type="menu-button"]), transition-delay: 100s; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar, @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar { - /* when not hovered anymore, trigger a new transition to hide the forward button immediately */ + /* when switching tabs, or when not hovered anymore, trigger a new transition + * to hide the forward button immediately */ margin-left: -@conditionalForwardWithUrlbarWidth@.01px; } @@ -1594,10 +1600,12 @@ toolbar .toolbarbutton-1:not([type="menu-button"]), transition-delay: 100s; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(ltr), @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(ltr) { padding-left: 10.01px; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl), @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl) { padding-right: 10.01px; } @@ -3945,7 +3953,7 @@ window > chatbox { padding: 0 2em 2em; } -#main-window[customizing] #tab-view-deck { +#main-window[customize-entered] #tab-view-deck { background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"), url("chrome://browser/skin/customizableui/background-noise-toolbar.png"), linear-gradient(to bottom, rgb(233,233,233), rgb(178,178,178) 21px); diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index 33eb69e814e..58d57e13d61 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -633,6 +633,10 @@ menuitem.bookmark-item { opacity: 0; } +@conditionalForwardWithUrlbar@ > #forward-button[occluded-by-urlbar] { + visibility: hidden; +} + #back-button { padding-top: 3px !important; padding-bottom: 3px !important; @@ -891,8 +895,10 @@ menuitem.bookmark-item { transition-delay: 100s; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar, @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar { - /* when not hovered anymore, trigger a new transition to hide the forward button immediately */ + /* when switching tabs, or when not hovered anymore, trigger a new transition + * to hide the forward button immediately */ margin-left: -@conditionalForwardWithUrlbarWidth@.01px; } @@ -1011,11 +1017,13 @@ html|*.urlbar-input:-moz-lwtheme::-moz-placeholder, transition-delay: 100s; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(ltr), @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(ltr) { /* when not hovered anymore, trigger a new non-delayed transition to react to the forward button hiding */ padding-left: 5.01px; } +@conditionalForwardWithUrlbar@[forwarddisabled][switchingtabs] + #urlbar-container > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl), @conditionalForwardWithUrlbar@[forwarddisabled]:not(:hover) > #urlbar-wrapper > #urlbar > #notification-popup-box[hidden] + #identity-box:-moz-locale-dir(rtl) { /* when not hovered anymore, trigger a new non-delayed transition to react to the forward button hiding */ padding-right: 5.01px; @@ -2410,7 +2418,7 @@ chatbox { %include ../shared/customizableui/customizeMode.inc.css -#main-window[customizing] { +#main-window[customize-entered] { background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"); background-attachment: fixed; } diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index 4a8dc0349c7..0e743f228d8 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -258,12 +258,13 @@ static bool IsCloseToVertical(float aAngle, float aThreshold) return (fabs(aAngle - (M_PI / 2)) < aThreshold); } -static inline void LogRendertraceRect(const char* aDesc, const char* aColor, const CSSRect& aRect) +static inline void LogRendertraceRect(const ScrollableLayerGuid& aGuid, const char* aDesc, const char* aColor, const CSSRect& aRect) { #ifdef APZC_ENABLE_RENDERTRACE static const TimeStamp sRenderStart = TimeStamp::Now(); TimeDuration delta = TimeStamp::Now() - sRenderStart; - printf_stderr("%s RENDERTRACE %f rect %s %f %f %f %f\n", + printf_stderr("(%llu,%lu,%llu)%s RENDERTRACE %f rect %s %f %f %f %f\n", + aGuid.mLayersId, aGuid.mPresShellId, aGuid.mScrollId, aDesc, delta.ToMilliseconds(), aColor, aRect.x, aRect.y, aRect.width, aRect.height); #endif @@ -1264,7 +1265,7 @@ AsyncPanZoomController::ScheduleContentRepaint(FrameMetrics &aFrameMetrics) { if (controller) { APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this); - LogRendertraceRect("requested displayport", "yellow", + LogRendertraceRect(GetGuid(), "requested displayport", "yellow", aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset); mPaintThrottler.PostTask( @@ -1355,7 +1356,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa aScrollOffset = mFrameMetrics.mScrollOffset * mFrameMetrics.mZoom; *aNewTransform = GetCurrentAsyncTransform(); - LogRendertraceRect("viewport", "red", + LogRendertraceRect(GetGuid(), "viewport", "red", CSSRect(mFrameMetrics.mScrollOffset, ScreenSize(mFrameMetrics.mCompositionBounds.Size()) / mFrameMetrics.mZoom)); @@ -1424,8 +1425,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri mFrameMetrics.mMayHaveTouchListeners = aLayerMetrics.mMayHaveTouchListeners; APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d", this, aIsFirstPaint); - LogRendertraceRect("page", "brown", aLayerMetrics.mScrollableRect); - LogRendertraceRect("painted displayport", "green", + LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.mScrollableRect); + LogRendertraceRect(GetGuid(), "painted displayport", "green", aLayerMetrics.mDisplayPort + aLayerMetrics.mScrollOffset); mPaintThrottler.TaskComplete(GetFrameTime()); @@ -1693,17 +1694,19 @@ void AsyncPanZoomController::SendAsyncScrollEvent() { bool AsyncPanZoomController::Matches(const ScrollableLayerGuid& aGuid) { - return aGuid == ScrollableLayerGuid(mLayersId, mFrameMetrics); + return aGuid == GetGuid(); } void AsyncPanZoomController::GetGuid(ScrollableLayerGuid* aGuidOut) { - if (!aGuidOut) { - return; + if (aGuidOut) { + *aGuidOut = GetGuid(); } - aGuidOut->mLayersId = mLayersId; - aGuidOut->mScrollId = mFrameMetrics.mScrollId; - aGuidOut->mPresShellId = mFrameMetrics.mPresShellId; +} + +ScrollableLayerGuid AsyncPanZoomController::GetGuid() +{ + return ScrollableLayerGuid(mLayersId, mFrameMetrics); } } diff --git a/gfx/layers/ipc/AsyncPanZoomController.h b/gfx/layers/ipc/AsyncPanZoomController.h index 61164fab5f5..5c663c89a20 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.h +++ b/gfx/layers/ipc/AsyncPanZoomController.h @@ -235,10 +235,15 @@ public: nsEventStatus HandleInputEvent(const InputData& aEvent); /** - * Populates the provided object with the scrollable guid of this apzc. + * Populates the provided object (if non-null) with the scrollable guid of this apzc. */ void GetGuid(ScrollableLayerGuid* aGuidOut); + /** + * Returns the scrollable guid of this apzc. + */ + ScrollableLayerGuid GetGuid(); + /** * Returns true if this APZC instance is for the layer identified by the guid. */ diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index aaa27a068a5..04c65b93a7a 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -1607,7 +1607,7 @@ abstract public class BrowserApp extends GeckoApp } if (isAboutHome(tab)) { - showHomePager(tab.getAboutHomePage()); + showHomePager(tab.getAboutHomePageId()); if (isDynamicToolbarEnabled()) { // Show the toolbar. @@ -1632,8 +1632,8 @@ abstract public class BrowserApp extends GeckoApp } } - private void showHomePager(HomePager.Page page) { - showHomePagerWithAnimator(page, null); + private void showHomePager(String pageId) { + showHomePagerWithAnimator(pageId, null); } private void showHomePagerWithAnimator(PropertyAnimator animator) { @@ -1642,7 +1642,7 @@ abstract public class BrowserApp extends GeckoApp showHomePagerWithAnimator(null, animator); } - private void showHomePagerWithAnimator(HomePager.Page page, PropertyAnimator animator) { + private void showHomePagerWithAnimator(String pageId, PropertyAnimator animator) { if (isHomePagerVisible()) { return; } @@ -1663,7 +1663,7 @@ abstract public class BrowserApp extends GeckoApp mHomePager.show(getSupportLoaderManager(), getSupportFragmentManager(), - page, animator); + pageId, animator); // Hide the web content so it cannot be focused by screen readers. hideWebContentOnPropertyAnimationEnd(animator); diff --git a/mobile/android/base/Tab.java b/mobile/android/base/Tab.java index 0f1a02d10a7..74f71730eb4 100644 --- a/mobile/android/base/Tab.java +++ b/mobile/android/base/Tab.java @@ -8,7 +8,6 @@ package org.mozilla.gecko; import org.mozilla.gecko.SiteIdentity.SecurityMode; import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.gfx.Layer; -import org.mozilla.gecko.home.HomePager; import org.mozilla.gecko.util.ThreadUtils; import org.json.JSONException; @@ -52,7 +51,7 @@ public class Tab { private int mHistoryIndex; private int mHistorySize; private int mParentId; - private HomePager.Page mAboutHomePage; + private String mAboutHomePageId; private boolean mExternal; private boolean mBookmark; private boolean mReadingListItem; @@ -95,7 +94,7 @@ public class Tab { mUserSearch = ""; mExternal = external; mParentId = parentId; - mAboutHomePage = null; + mAboutHomePageId = null; mTitle = title == null ? "" : title; mFavicon = null; mFaviconUrl = null; @@ -147,12 +146,12 @@ public class Tab { return mParentId; } - public HomePager.Page getAboutHomePage() { - return mAboutHomePage; + public String getAboutHomePageId() { + return mAboutHomePageId; } - private void setAboutHomePage(HomePager.Page page) { - mAboutHomePage = page; + private void setAboutHomePageId(String pageId) { + mAboutHomePageId = pageId; } // may be null if user-entered query hasn't yet been resolved to a URI @@ -656,11 +655,11 @@ public class Tab { setBackgroundColor(DEFAULT_BACKGROUND_COLOR); setErrorType(ErrorType.NONE); - final String homePage = message.getString("aboutHomePage"); - if (!TextUtils.isEmpty(homePage)) { - setAboutHomePage(HomePager.Page.valueOf(homePage)); + final String homePageId = message.getString("aboutHomePage"); + if (!TextUtils.isEmpty(homePageId)) { + setAboutHomePageId(homePageId); } else { - setAboutHomePage(null); + setAboutHomePageId(null); } Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, oldUrl); diff --git a/mobile/android/base/Tabs.java b/mobile/android/base/Tabs.java index dea9208b60b..b5c5d2cf983 100644 --- a/mobile/android/base/Tabs.java +++ b/mobile/android/base/Tabs.java @@ -7,7 +7,6 @@ package org.mozilla.gecko; import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.favicons.Favicons; -import org.mozilla.gecko.home.HomePager; import org.mozilla.gecko.mozglue.JNITarget; import org.mozilla.gecko.mozglue.RobocopTarget; import org.mozilla.gecko.sync.setup.SyncAccounts; @@ -724,7 +723,8 @@ public class Tabs implements GeckoEventListener { args.put("delayLoad", delayLoad); args.put("desktopMode", desktopMode); args.put("selected", !background); - args.put("aboutHomePage", (flags & LOADURL_READING_LIST) != 0 ? HomePager.Page.READING_LIST : ""); + // XXX: Dirty hack to pass reading list page id - let's get rid of this code path in bug 949178. + args.put("aboutHomePage", (flags & LOADURL_READING_LIST) != 0 ? "reading_list-reading_list" : ""); if ((flags & LOADURL_NEW_TAB) != 0) { int tabId = getNextTabId(); diff --git a/mobile/android/base/home/HomeAdapter.java b/mobile/android/base/home/HomeAdapter.java index db92fb7de29..d3c411cbc31 100644 --- a/mobile/android/base/home/HomeAdapter.java +++ b/mobile/android/base/home/HomeAdapter.java @@ -8,7 +8,6 @@ package org.mozilla.gecko.home; import org.mozilla.gecko.home.HomeConfig.PageEntry; import org.mozilla.gecko.home.HomeConfig.PageType; import org.mozilla.gecko.home.HomePager; -import org.mozilla.gecko.home.HomePager.Page; import android.content.Context; import android.os.Bundle; @@ -84,10 +83,10 @@ class HomeAdapter extends FragmentStatePagerAdapter { mAddPageListener = listener; } - public int getItemPosition(Page page) { + public int getItemPosition(String pageId) { for (int i = 0; i < mPageInfos.size(); i++) { - final Page infoPage = mPageInfos.get(i).toPage(); - if (infoPage == page) { + final String id = mPageInfos.get(i).getId(); + if (id.equals(pageId)) { return i; } } @@ -95,15 +94,14 @@ class HomeAdapter extends FragmentStatePagerAdapter { return -1; } - public Page getPageAtPosition(int position) { + public String getPageIdAtPosition(int position) { // getPageAtPosition() might be called before HomeAdapter // has got its initial list of PageEntries. Just bail. if (mPageInfos.isEmpty()) { return null; } - PageInfo info = mPageInfos.get(position); - return info.toPage(); + return mPageInfos.get(position).getId(); } private void addPage(PageInfo info) { @@ -178,14 +176,5 @@ class HomeAdapter extends FragmentStatePagerAdapter { return args; } - - public Page toPage() { - final PageType type = mPageEntry.getType(); - if (type == PageType.LIST) { - return null; - } - - return Page.valueOf(type); - } } } diff --git a/mobile/android/base/home/HomeConfig.java b/mobile/android/base/home/HomeConfig.java index 636fd617f7d..309bdee3472 100644 --- a/mobile/android/base/home/HomeConfig.java +++ b/mobile/android/base/home/HomeConfig.java @@ -5,8 +5,6 @@ package org.mozilla.gecko.home; -import org.mozilla.gecko.home.HomePager.Page; - import android.content.Context; import android.os.Parcel; import android.os.Parcelable; @@ -31,25 +29,6 @@ final class HomeConfig { mPageClass = pageClass; } - public static PageType valueOf(Page page) { - switch(page) { - case TOP_SITES: - return PageType.TOP_SITES; - - case BOOKMARKS: - return PageType.BOOKMARKS; - - case HISTORY: - return PageType.HISTORY; - - case READING_LIST: - return PageType.READING_LIST; - - default: - throw new IllegalArgumentException("Could not convert unrecognized Page"); - } - } - public static PageType fromId(String id) { if (id == null) { throw new IllegalArgumentException("Could not convert null String to PageType"); diff --git a/mobile/android/base/home/HomePager.java b/mobile/android/base/home/HomePager.java index 3e85eb2df75..f4ffe5be054 100644 --- a/mobile/android/base/home/HomePager.java +++ b/mobile/android/base/home/HomePager.java @@ -11,7 +11,6 @@ import org.mozilla.gecko.animation.ViewHelper; import org.mozilla.gecko.home.HomeAdapter.OnAddPageListener; import org.mozilla.gecko.home.HomeConfig.PageEntry; import org.mozilla.gecko.home.HomeConfig.PageType; -import org.mozilla.gecko.mozglue.RobocopTarget; import org.mozilla.gecko.util.HardwareUtils; import android.content.Context; @@ -46,35 +45,7 @@ public class HomePager extends ViewPager { private final HomeConfig mConfig; private ConfigLoaderCallbacks mConfigLoaderCallbacks; - private Page mInitialPage; - - // List of pages in order. - @RobocopTarget - public enum Page { - HISTORY, - TOP_SITES, - BOOKMARKS, - READING_LIST; - - static Page valueOf(PageType page) { - switch(page) { - case TOP_SITES: - return Page.TOP_SITES; - - case BOOKMARKS: - return Page.BOOKMARKS; - - case HISTORY: - return Page.HISTORY; - - case READING_LIST: - return Page.READING_LIST; - - default: - throw new IllegalArgumentException("Could not convert unrecognized PageType"); - } - } - } + private String mInitialPageId; // This is mostly used by UI tests to easily fetch // specific list views at runtime. @@ -186,17 +157,17 @@ public class HomePager extends ViewPager { public void redisplay(LoaderManager lm, FragmentManager fm) { final HomeAdapter adapter = (HomeAdapter) getAdapter(); - // If mInitialPage is non-null, this means the HomePager hasn't + // If mInitialPageId is non-null, this means the HomePager hasn't // finished loading its config yet. Simply re-show() with the // current target page. - final Page currentPage; - if (mInitialPage != null) { - currentPage = mInitialPage; + final String currentPageId; + if (mInitialPageId != null) { + currentPageId = mInitialPageId; } else { - currentPage = adapter.getPageAtPosition(getCurrentItem()); + currentPageId = adapter.getPageIdAtPosition(getCurrentItem()); } - show(lm, fm, currentPage, null); + show(lm, fm, currentPageId, null); } /** @@ -204,9 +175,9 @@ public class HomePager extends ViewPager { * * @param fm FragmentManager for the adapter */ - public void show(LoaderManager lm, FragmentManager fm, Page page, PropertyAnimator animator) { + public void show(LoaderManager lm, FragmentManager fm, String pageId, PropertyAnimator animator) { mLoaded = true; - mInitialPage = page; + mInitialPageId = pageId; // Only animate on post-HC devices, when a non-null animator is given final boolean shouldAnimate = (animator != null && Build.VERSION.SDK_INT >= 11); @@ -314,9 +285,9 @@ public class HomePager extends ViewPager { // Use the default page as defined in the HomePager's configuration // if the initial page wasn't explicitly set by the show() caller. - if (mInitialPage != null) { - setCurrentItem(adapter.getItemPosition(mInitialPage), false); - mInitialPage = null; + if (mInitialPageId != null) { + setCurrentItem(adapter.getItemPosition(mInitialPageId), false); + mInitialPageId = null; } else { for (int i = 0; i < count; i++) { final PageEntry pageEntry = pageEntries.get(i); diff --git a/mobile/android/base/tests/components/AboutHomeComponent.java b/mobile/android/base/tests/components/AboutHomeComponent.java index 59a6be43e79..2ac70d24945 100644 --- a/mobile/android/base/tests/components/AboutHomeComponent.java +++ b/mobile/android/base/tests/components/AboutHomeComponent.java @@ -7,7 +7,6 @@ package org.mozilla.gecko.tests.components; import static org.mozilla.gecko.tests.helpers.AssertionHelper.*; import org.mozilla.gecko.Actions; -import org.mozilla.gecko.home.HomePager.Page; import org.mozilla.gecko.R; import org.mozilla.gecko.tests.helpers.*; import org.mozilla.gecko.tests.UITestContext; @@ -23,6 +22,14 @@ import android.view.View; * A class representing any interactions that take place on the Awesomescreen. */ public class AboutHomeComponent extends BaseComponent { + // The different types of pages that can be present on about:home + public enum PageType { + HISTORY, + TOP_SITES, + BOOKMARKS, + READING_LIST + } + // TODO: Having a specific ordering of pages is prone to fail and thus temporary. // Hopefully the work in bug 940565 will alleviate the need for these enums. // Explicit ordering of HomePager pages on a phone. @@ -53,7 +60,7 @@ public class AboutHomeComponent extends BaseComponent { return (ViewPager) mSolo.getView(R.id.home_pager); } - public AboutHomeComponent assertCurrentPage(final Page expectedPage) { + public AboutHomeComponent assertCurrentPage(final PageType expectedPage) { assertVisible(); final int expectedPageIndex = getPageIndexForDevice(expectedPage.ordinal()); @@ -123,10 +130,10 @@ public class AboutHomeComponent extends BaseComponent { /** * Gets the page index in the device specific Page enum for the given index in the - * HomePager.Page enum. + * PageType enum. */ private int getPageIndexForDevice(final int pageIndex) { - final String pageName = Page.values()[pageIndex].name(); + final String pageName = PageType.values()[pageIndex].name(); final Class devicePageEnum = DeviceHelper.isTablet() ? TabletPage.class : PhonePage.class; return Enum.valueOf(devicePageEnum, pageName).ordinal(); diff --git a/mobile/android/base/tests/testAboutHomePageNavigation.java b/mobile/android/base/tests/testAboutHomePageNavigation.java index e42f4f4fa0d..d9cf7b11e6f 100644 --- a/mobile/android/base/tests/testAboutHomePageNavigation.java +++ b/mobile/android/base/tests/testAboutHomePageNavigation.java @@ -2,7 +2,7 @@ package org.mozilla.gecko.tests; import static org.mozilla.gecko.tests.helpers.AssertionHelper.*; -import org.mozilla.gecko.home.HomePager.Page; +import org.mozilla.gecko.tests.components.AboutHomeComponent.PageType; import org.mozilla.gecko.tests.helpers.*; /** @@ -16,13 +16,13 @@ public class testAboutHomePageNavigation extends UITest { GeckoHelper.blockForReady(); mAboutHome.assertVisible() - .assertCurrentPage(Page.TOP_SITES); + .assertCurrentPage(PageType.TOP_SITES); mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.BOOKMARKS); + mAboutHome.assertCurrentPage(PageType.BOOKMARKS); mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.READING_LIST); + mAboutHome.assertCurrentPage(PageType.READING_LIST); // Ideally these helpers would just be their own tests. However, by keeping this within // one method, we're saving test setUp and tearDown resources. @@ -35,46 +35,46 @@ public class testAboutHomePageNavigation extends UITest { private void helperTestTablet() { mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.HISTORY); + mAboutHome.assertCurrentPage(PageType.HISTORY); // Edge case. mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.HISTORY); + mAboutHome.assertCurrentPage(PageType.HISTORY); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.READING_LIST); + mAboutHome.assertCurrentPage(PageType.READING_LIST); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.BOOKMARKS); + mAboutHome.assertCurrentPage(PageType.BOOKMARKS); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.TOP_SITES); + mAboutHome.assertCurrentPage(PageType.TOP_SITES); // Edge case. mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.TOP_SITES); + mAboutHome.assertCurrentPage(PageType.TOP_SITES); } private void helperTestPhone() { // Edge case. mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.READING_LIST); + mAboutHome.assertCurrentPage(PageType.READING_LIST); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.BOOKMARKS); + mAboutHome.assertCurrentPage(PageType.BOOKMARKS); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.TOP_SITES); + mAboutHome.assertCurrentPage(PageType.TOP_SITES); mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.HISTORY); + mAboutHome.assertCurrentPage(PageType.HISTORY); // Edge case. mAboutHome.swipeToPageOnLeft(); - mAboutHome.assertCurrentPage(Page.HISTORY); + mAboutHome.assertCurrentPage(PageType.HISTORY); mAboutHome.swipeToPageOnRight(); - mAboutHome.assertCurrentPage(Page.TOP_SITES); + mAboutHome.assertCurrentPage(PageType.TOP_SITES); } // TODO: bug 943706 - reimplement this old test code. diff --git a/mobile/android/base/tests/testAboutHomeVisibility.java b/mobile/android/base/tests/testAboutHomeVisibility.java index 8c8c4620343..44291f231e5 100644 --- a/mobile/android/base/tests/testAboutHomeVisibility.java +++ b/mobile/android/base/tests/testAboutHomeVisibility.java @@ -2,7 +2,7 @@ package org.mozilla.gecko.tests; import static org.mozilla.gecko.tests.helpers.AssertionHelper.*; -import org.mozilla.gecko.home.HomePager.Page; +import org.mozilla.gecko.tests.components.AboutHomeComponent.PageType; import org.mozilla.gecko.tests.helpers.*; /** @@ -15,7 +15,7 @@ public class testAboutHomeVisibility extends UITest { // Check initial state on about:home. mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE); mAboutHome.assertVisible() - .assertCurrentPage(Page.TOP_SITES); + .assertCurrentPage(PageType.TOP_SITES); // Go to blank 01. NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL); @@ -30,7 +30,7 @@ public class testAboutHomeVisibility extends UITest { // Enter editing mode, where the about:home UI should be visible. mToolbar.enterEditingMode(); mAboutHome.assertVisible() - .assertCurrentPage(Page.TOP_SITES); + .assertCurrentPage(PageType.TOP_SITES); // Dismiss editing mode, where the about:home UI should be gone. mToolbar.dismissEditingMode(); @@ -40,7 +40,7 @@ public class testAboutHomeVisibility extends UITest { NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL); mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE); mAboutHome.assertVisible() - .assertCurrentPage(Page.TOP_SITES); + .assertCurrentPage(PageType.TOP_SITES); // TODO: Type in a url and assert the go button is visible. } diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index a12975b033e..a38e1bdbc0f 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -3368,8 +3368,6 @@ Tab.prototype = { case "DOMContentLoaded": { let target = aEvent.originalTarget; - LoginManagerContent.onContentLoaded(aEvent); - // ignore on frames and other documents if (target != this.browser.contentDocument) return; diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index bc7e5511bef..56336376fbf 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -3897,7 +3897,6 @@ pref("signon.rememberSignons", true); pref("signon.autofillForms", true); pref("signon.autologin.proxy", false); pref("signon.debug", false); -pref("signon.useDOMFormHasPassword", true); // Satchel (Form Manager) prefs pref("browser.formfill.debug", false); diff --git a/toolkit/components/passwordmgr/LoginManagerContent.jsm b/toolkit/components/passwordmgr/LoginManagerContent.jsm index f22bacf9bee..50ac2b42ca0 100644 --- a/toolkit/components/passwordmgr/LoginManagerContent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm @@ -14,7 +14,6 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); var gEnabled = false, gDebug = false, gAutofillForms = true; // these mirror signon.* prefs -var gUseDOMFormHasPassword = false; // use DOMFormHasPassword event for autofill function log(...pieces) { function generateLogMessage(args) { @@ -72,7 +71,6 @@ var observer = { gDebug = Services.prefs.getBoolPref("signon.debug"); gEnabled = Services.prefs.getBoolPref("signon.rememberSignons"); gAutofillForms = Services.prefs.getBoolPref("signon.autofillForms"); - gUseDOMFormHasPassword = Services.prefs.getBoolPref("signon.useDOMFormHasPassword"); }, }; @@ -94,32 +92,8 @@ var LoginManagerContent = { return this.__formFillService; }, - onContentLoaded : function (event) { - // If we're using the new DOMFormHasPassword event, don't fill at pageload. - if (gUseDOMFormHasPassword) - return; - - if (!event.isTrusted) - return; - - if (!gEnabled) - return; - - let domDoc = event.target; - - // Only process things which might have HTML forms. - if (!(domDoc instanceof Ci.nsIDOMHTMLDocument)) - return; - - this._fillDocument(domDoc); - }, - onFormPassword: function (event) { - // If we're not using the new DOMFormHasPassword event, only fill at pageload. - if (!gUseDOMFormHasPassword) - return; - if (!event.isTrusted) return; @@ -552,91 +526,6 @@ var LoginManagerContent = { }, - /* - * _fillDocument - * - * Called when a page has loaded. For each form in the document, - * we check to see if it can be filled with a stored login. - */ - _fillDocument : function (doc) { - var forms = doc.forms; - if (!forms || forms.length == 0) - return; - - var formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI); - - // If there are no logins for this site, bail out now. - if (!Services.logins.countLogins(formOrigin, "", null)) - return; - - // If we're currently displaying a master password prompt, defer - // processing this document until the user handles the prompt. - if (Services.logins.uiBusy) { - log("deferring fillDoc for", doc.documentURI); - let self = this; - let observer = { - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]), - - observe: function (subject, topic, data) { - log("Got deferred fillDoc notification:", topic); - // Only run observer once. - Services.obs.removeObserver(this, "passwordmgr-crypto-login"); - Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled"); - if (topic == "passwordmgr-crypto-loginCanceled") - return; - self._fillDocument(doc); - }, - handleEvent : function (event) { - // Not expected to be called - } - }; - // Trickyness follows: We want an observer, but don't want it to - // cause leaks. So add the observer with a weak reference, and use - // a dummy event listener (a strong reference) to keep it alive - // until the document is destroyed. - Services.obs.addObserver(observer, "passwordmgr-crypto-login", true); - Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", true); - doc.addEventListener("mozCleverClosureHack", observer); - return; - } - - log("fillDocument processing", forms.length, "forms on", doc.documentURI); - - var autofillForm = gAutofillForms && !PrivateBrowsingUtils.isWindowPrivate(doc.defaultView); - var previousActionOrigin = null; - var foundLogins = null; - - // Limit the number of forms we try to fill. If there are too many - // forms, just fill some at the beginning and end of the page. - const MAX_FORMS = 40; // assumed to be an even number - var skip_from = -1, skip_to = -1; - if (forms.length > MAX_FORMS) { - log("fillDocument limiting number of forms filled to", MAX_FORMS); - let chunk_size = MAX_FORMS / 2; - skip_from = chunk_size; - skip_to = forms.length - chunk_size; - } - - for (var i = 0; i < forms.length; i++) { - // Skip some in the middle of the document if there were too many. - if (i == skip_from) - i = skip_to; - - var form = forms[i]; - - // Only the actionOrigin might be changing, so if it's the same - // as the last form on the page we can reuse the same logins. - var actionOrigin = LoginUtils._getActionOrigin(form); - if (actionOrigin != previousActionOrigin) { - foundLogins = null; - previousActionOrigin = actionOrigin; - } - log("_fillDocument processing form[", i, "]"); - foundLogins = this._fillForm(form, autofillForm, false, false, foundLogins)[1]; - } // foreach form - }, - - /* * _fillform * diff --git a/toolkit/components/passwordmgr/test/mochitest.ini b/toolkit/components/passwordmgr/test/mochitest.ini index 1fdcba64748..72c8d078cad 100644 --- a/toolkit/components/passwordmgr/test/mochitest.ini +++ b/toolkit/components/passwordmgr/test/mochitest.ini @@ -54,9 +54,6 @@ support-files = # Bug 917797 - too many intermittent failures skip-if = true [test_master_password_cleanup.html] -[test_maxforms_1.html] -[test_maxforms_2.html] -[test_maxforms_3.html] [test_notifications.html] [test_notifications_popup.html] skip-if = os == "linux" # bug 934057 diff --git a/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html b/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html index 611945cb978..e0b51f2e53c 100644 --- a/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html +++ b/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html @@ -34,19 +34,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=355063 SimpleTest.finish(); } - if (SpecialPowers.getBoolPref("signon.useDOMFormHasPassword")) { - commonInit(); + commonInit(); - // Password Manager's own listener should always have been added first, so - // the test's listener should be called after the pwmgr's listener fills in - // a login. - // - SpecialPowers.addChromeEventListener("DOMFormHasPassword", checkForm); - window.addEventListener("load", startTest); - SimpleTest.waitForExplicitFinish(); - } else { - ok(true, "Skipping test when useDOMFormHasPassword is disabled"); - } + // Password Manager's own listener should always have been added first, so + // the test's listener should be called after the pwmgr's listener fills in + // a login. + // + SpecialPowers.addChromeEventListener("DOMFormHasPassword", checkForm); + window.addEventListener("load", startTest); + SimpleTest.waitForExplicitFinish(); diff --git a/toolkit/components/passwordmgr/test/test_maxforms_1.html b/toolkit/components/passwordmgr/test/test_maxforms_1.html deleted file mode 100644 index bcc2e29660c..00000000000 --- a/toolkit/components/passwordmgr/test/test_maxforms_1.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - Test for Login Manager - - - - - -Test limiting number of forms filled. - -

- - - - - -
-
-
- - diff --git a/toolkit/components/passwordmgr/test/test_maxforms_2.html b/toolkit/components/passwordmgr/test/test_maxforms_2.html deleted file mode 100644 index da315c42029..00000000000 --- a/toolkit/components/passwordmgr/test/test_maxforms_2.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - Test for Login Manager - - - - - -Test limiting number of forms filled. - -

- - - - - -
-
-
- - diff --git a/toolkit/components/passwordmgr/test/test_maxforms_3.html b/toolkit/components/passwordmgr/test/test_maxforms_3.html deleted file mode 100644 index 63d2bfedd49..00000000000 --- a/toolkit/components/passwordmgr/test/test_maxforms_3.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - Test for Login Manager - - - - - -Test limiting number of forms filled. - -

- - - - - -
-
-
- - diff --git a/widget/windows/winrt/APZController.cpp b/widget/windows/winrt/APZController.cpp index bda3d791cbc..4d8518bfa87 100644 --- a/widget/windows/winrt/APZController.cpp +++ b/widget/windows/winrt/APZController.cpp @@ -235,19 +235,11 @@ APZController::RequestContentRepaint(const FrameMetrics& aFrameMetrics) void APZController::HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers) { - NS_ConvertASCIItoUTF16 data( - nsPrintfCString("{ \"x\": %d, \"y\": %d, \"modifiers\": %d }", - (int32_t)aPoint.x, (int32_t)aPoint.y, aModifiers)); - MetroUtils::FireObserver("Gesture:DoubleTap", data.get()); } void APZController::HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers) { - NS_ConvertASCIItoUTF16 data( - nsPrintfCString("{ \"x\": %d, \"y\": %d, \"modifiers\": %d }", - (int32_t)aPoint.x, (int32_t)aPoint.y, aModifiers)); - MetroUtils::FireObserver("Gesture:SingleTap", data.get()); } void diff --git a/widget/windows/winrt/MetroAppShell.cpp b/widget/windows/winrt/MetroAppShell.cpp index 61af8d14561..9a0e53acd6a 100644 --- a/widget/windows/winrt/MetroAppShell.cpp +++ b/widget/windows/winrt/MetroAppShell.cpp @@ -27,6 +27,10 @@ using namespace ABI::Windows::Foundation; // ProcessNextNativeEvent message wait timeout, see bug 907410. #define MSG_WAIT_TIMEOUT 250 +// MetroInput will occasionally ask us to flush all input so that the dom is +// up to date. This is the maximum amount of time we'll agree to spend in +// NS_ProcessPendingEvents. +#define PURGE_MAX_TIMEOUT 50 namespace mozilla { namespace widget { @@ -43,7 +47,8 @@ extern UINT sAppShellGeckoMsgId; static ComPtr sCoreStatic; static bool sIsDispatching = false; -static bool sWillEmptyThreadQueue = false; +static bool sShouldPurgeThreadQueue = false; +static bool sBlockNativeEvents = false; MetroAppShell::~MetroAppShell() { @@ -245,7 +250,7 @@ MetroAppShell::Run(void) void // static MetroAppShell::MarkEventQueueForPurge() { - sWillEmptyThreadQueue = true; + sShouldPurgeThreadQueue = true; // If we're dispatching native events, wait until the dispatcher is // off the stack. @@ -257,19 +262,32 @@ MetroAppShell::MarkEventQueueForPurge() DispatchAllGeckoEvents(); } +// Notification from MetroInput that all events it wanted delivered +// have been dispatched. It is safe to start processing windowing +// events. +void // static +MetroAppShell::InputEventsDispatched() +{ + sBlockNativeEvents = false; +} + // static void MetroAppShell::DispatchAllGeckoEvents() { - if (!sWillEmptyThreadQueue) { + // Only do this if requested + if (!sShouldPurgeThreadQueue) { return; } NS_ASSERTION(NS_IsMainThread(), "DispatchAllGeckoEvents should be called on the main thread"); - sWillEmptyThreadQueue = false; + sShouldPurgeThreadQueue = false; + + sBlockNativeEvents = true; nsIThread *thread = NS_GetCurrentThread(); - NS_ProcessPendingEvents(thread, 0); + NS_ProcessPendingEvents(thread, PURGE_MAX_TIMEOUT); + sBlockNativeEvents = false; } static void @@ -317,6 +335,15 @@ MetroAppShell::ProcessOneNativeEventIfPresent() bool MetroAppShell::ProcessNextNativeEvent(bool mayWait) { + // NS_ProcessPendingEvents will process thread events *and* call + // nsBaseAppShell::OnProcessNextEvent to process native events. However + // we do not want native events getting dispatched while we are trying + // to dispatch pending input in DispatchAllGeckoEvents since a native + // event may be a UIA Automation call coming in to check focus. + if (sBlockNativeEvents) { + return false; + } + if (ProcessOneNativeEventIfPresent()) { return true; } diff --git a/widget/windows/winrt/MetroAppShell.h b/widget/windows/winrt/MetroAppShell.h index 1bb521ee303..b1bd7f55db1 100644 --- a/widget/windows/winrt/MetroAppShell.h +++ b/widget/windows/winrt/MetroAppShell.h @@ -28,6 +28,7 @@ public: static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM); static bool ProcessOneNativeEventIfPresent(); static void MarkEventQueueForPurge(); + static void InputEventsDispatched(); protected: NS_IMETHOD Run(); diff --git a/widget/windows/winrt/MetroInput.cpp b/widget/windows/winrt/MetroInput.cpp index d8e02ecabf1..fb6fb27a27c 100644 --- a/widget/windows/winrt/MetroInput.cpp +++ b/widget/windows/winrt/MetroInput.cpp @@ -653,11 +653,6 @@ MetroInput::OnPointerReleased(UI::Core::ICoreWindow* aSender, mGestureRecognizer->ProcessUpEvent(currentPoint.Get()); } - // Make sure all gecko events are dispatched and the dom is up to date - // so that when ui automation comes in looking for focus info it gets - // the right information. - MetroAppShell::MarkEventQueueForPurge(); - return S_OK; } @@ -962,11 +957,7 @@ MetroInput::HandleTap(const Foundation::Point& aPoint, unsigned int aTapCount) #endif LayoutDeviceIntPoint refPoint; - bool hitTestChrome = TransformRefPoint(aPoint, refPoint); - if (!hitTestChrome) { - // Let APZC handle tap/doubletap detection for content. - return; - } + TransformRefPoint(aPoint, refPoint); WidgetMouseEvent* mouseEvent = new WidgetMouseEvent(true, NS_MOUSE_MOVE, mWidget.Get(), @@ -993,6 +984,11 @@ MetroInput::HandleTap(const Foundation::Point& aPoint, unsigned int aTapCount) mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH; mouseEvent->button = WidgetMouseEvent::buttonType::eLeftButton; DispatchAsyncEventIgnoreStatus(mouseEvent); + + // Make sure all gecko events are dispatched and the dom is up to date + // so that when ui automation comes in looking for focus info it gets + // the right information. + MetroAppShell::MarkEventQueueForPurge(); } void @@ -1037,6 +1033,12 @@ MetroInput::DeliverNextQueuedEventIgnoreStatus() MOZ_ASSERT(event.get()); DispatchEventIgnoreStatus(event.get()); + // Let app shell know we've delivered that last input we wanted purged + // via a call to MarkEventQueueForPurge(). + if (event->message == NS_MOUSE_BUTTON_UP) { + MetroAppShell::InputEventsDispatched(); + } + // Clear :hover/:active states for mouse events generated by HandleTap WidgetMouseEvent* mouseEvent = event.get()->AsMouseEvent(); if (!mouseEvent) {