Merge m-c to inbound

This commit is contained in:
Wes Kocher 2013-12-17 21:23:18 -08:00
commit ffd63d7db6
42 changed files with 367 additions and 511 deletions

View File

@ -1,4 +1,4 @@
{
"revision": "9919e96678a4fc08ffe6ca9068bfc245394fa5e3",
"revision": "2cc6e0988688b33fa46e3a05a726fb7919d7420e",
"repo_path": "/integration/gaia-central"
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -246,8 +246,8 @@
onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));">
<menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
accesskey="&customizeMenu.addToPanel.accesskey;"
label="&customizeMenu.addToPanel.label;"
class="customize-context-addToPanel"/>
label="&customizeMenu.moveToPanel.label;"
class="customize-context-moveToPanel"/>
<menuitem oncommand="gCustomizeMode.removeFromArea(document.popupNode)"
accesskey="&customizeMenu.removeFromToolbar.accesskey;"
label="&customizeMenu.removeFromToolbar.label;"

View File

@ -38,9 +38,6 @@ if (Services.prefs.getBoolPref("browser.tabs.remote")) {
sendAsyncMessage("contextmenu", {}, { event: event });
}, false);
} else {
addEventListener("DOMContentLoaded", function(event) {
LoginManagerContent.onContentLoaded(event);
});
addEventListener("DOMFormHasPassword", function(event) {
InsecurePasswordUtils.checkForInsecurePasswords(event.target);
LoginManagerContent.onFormPassword(event);

View File

@ -126,9 +126,9 @@
see bug 492960 comment 20. -->
<menupopup id="customizationPanelItemContextMenu">
<menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
class="customize-context-addToToolbar"
accesskey="&customizeMenu.addToToolbar.accesskey;"
label="&customizeMenu.addToToolbar.label;"/>
class="customize-context-moveToToolbar"
accesskey="&customizeMenu.moveToToolbar.accesskey;"
label="&customizeMenu.moveToToolbar.label;"/>
<menuitem oncommand="gCustomizeMode.removeFromArea(document.popupNode)"
class="customize-context-removeFromPanel"
accesskey="&customizeMenu.removeFromMenu.accesskey;"

View File

@ -527,6 +527,11 @@ CustomizeMode.prototype = {
aNode.removeAttribute("command");
}
if (aNode.hasAttribute("observes")) {
wrapper.setAttribute("itemobserves", aNode.getAttribute("observes"));
aNode.removeAttribute("observes");
}
if (aNode.checked) {
wrapper.setAttribute("itemchecked", "true");
aNode.checked = false;
@ -602,6 +607,10 @@ CustomizeMode.prototype = {
return null;
}
if (aWrapper.hasAttribute("itemobserves")) {
toolbarItem.setAttribute("observes", aWrapper.getAttribute("itemobserves"));
}
if (aWrapper.hasAttribute("itemchecked")) {
toolbarItem.checked = true;
}

View File

@ -11,6 +11,7 @@ support-files =
[browser_878452_drag_to_panel.js]
[browser_880164_customization_context_menus.js]
[browser_880382_drag_wide_widgets_in_panel.js]
[browser_885052_customize_mode_observers_disabed.js]
[browser_885530_showInPrivateBrowsing.js]
[browser_886323_buildArea_removable_nodes.js]
[browser_887438_currentset_shim.js]

View File

@ -18,7 +18,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToPanel", true],
[".customize-context-moveToPanel", true],
[".customize-context-removeFromToolbar", true],
["---"]
];
@ -49,7 +49,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToPanel", false],
[".customize-context-moveToPanel", false],
[".customize-context-removeFromToolbar", false],
["---"]
];
@ -111,7 +111,7 @@ add_task(function() {
is(PanelUI.panel.state, "open", "The PanelUI should still be open.");
let expectedEntries = [
[".customize-context-addToToolbar", true],
[".customize-context-moveToToolbar", true],
[".customize-context-removeFromPanel", true],
["---"],
[".viewCustomizeToolbar", true]
@ -138,7 +138,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToPanel", true],
[".customize-context-moveToPanel", true],
[".customize-context-removeFromToolbar", true],
["---"]
];
@ -187,7 +187,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToToolbar", true],
[".customize-context-moveToToolbar", true],
[".customize-context-removeFromPanel", true],
["---"],
[".viewCustomizeToolbar", false]
@ -214,7 +214,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToToolbar", true],
[".customize-context-moveToToolbar", true],
[".customize-context-removeFromPanel", true],
["---"],
[".viewCustomizeToolbar", false]
@ -254,7 +254,7 @@ add_task(function() {
yield shownPromise;
let expectedEntries = [
[".customize-context-addToPanel", true],
[".customize-context-moveToPanel", true],
[".customize-context-removeFromToolbar", true],
["---"]
];

View File

@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Observers should be disabled when in customization mode.
add_task(function() {
// Open and close the panel to make sure that the
// area is generated before getting a child of the area.
let shownPanelPromise = promisePanelShown(window);
PanelUI.toggle({type: "command"});
yield shownPanelPromise;
let hiddenPanelPromise = promisePanelHidden(window);
PanelUI.toggle({type: "command"});
yield hiddenPanelPromise;
let fullscreenButton = document.getElementById("fullscreen-button");
ok(!fullscreenButton.checked, "Fullscreen button should not be checked when not in fullscreen.")
BrowserFullScreen();
yield waitForCondition(function() fullscreenButton.checked);
ok(fullscreenButton.checked, "Fullscreen button should be checked when in fullscreen.")
yield startCustomizing();
let fullscreenButtonWrapper = document.getElementById("wrapper-fullscreen-button");
ok(fullscreenButtonWrapper.hasAttribute("itemobserves"), "Observer should be moved to wrapper");
fullscreenButton = document.getElementById("fullscreen-button");
ok(!fullscreenButton.hasAttribute("observes"), "Observer should be removed from button");
ok(!fullscreenButton.checked, "Fullscreen button should no longer be checked during customization mode");
yield endCustomizing();
BrowserFullScreen();
fullscreenButton = document.getElementById("fullscreen-button");
yield waitForCondition(function() !fullscreenButton.checked);
ok(!fullscreenButton.checked, "Fullscreen button should not be checked when not in fullscreen.")
});

View File

@ -86,6 +86,30 @@ add_task(function() {
is(document.activeElement, searchbar.textbox.inputField, "The searchbar should be focused");
});
// Ctrl+K should open the search page if the search bar has been customized out.
add_task(function() {
this.originalOpenUILinkIn = openUILinkIn;
try {
CustomizableUI.removeWidgetFromArea("search-container");
let placement = CustomizableUI.getPlacementOfWidget("search-container");
is(placement, null, "Search container should be in palette");
let openUILinkInCalled = false;
openUILinkIn = (aUrl, aWhichTab) => {
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 });

View File

@ -333,6 +333,10 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY customizeMenu.addToToolbar.accesskey "A">
<!ENTITY customizeMenu.addToPanel.label "Add to Menu">
<!ENTITY customizeMenu.addToPanel.accesskey "M">
<!ENTITY customizeMenu.moveToToolbar.label "Move to Toolbar">
<!ENTITY customizeMenu.moveToToolbar.accesskey "M">
<!ENTITY customizeMenu.moveToPanel.label "Move to Menu">
<!ENTITY customizeMenu.moveToPanel.accesskey "M">
<!ENTITY customizeMenu.removeFromToolbar.label "Remove from Toolbar">
<!ENTITY customizeMenu.removeFromToolbar.accesskey "R">
<!ENTITY customizeMenu.removeFromMenu.label "Remove from Menu">

View File

@ -201,7 +201,6 @@ let Content = {
break;
case "DOMContentLoaded":
LoginManagerContent.onContentLoaded(aEvent);
this._maybeNotifyErrorPage();
break;

View File

@ -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",

View File

@ -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 {

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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.
*/

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -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");

View File

@ -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);

View File

@ -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();

View File

@ -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.

View File

@ -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.
}

View File

@ -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;

View File

@ -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);

View File

@ -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
*

View File

@ -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

View File

@ -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();
</script>
</head>
<body>

View File

@ -1,64 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Login Manager</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Test limiting number of forms filled.
<p id="display"></p>
<div id="content" style="display: none"></div>
<script>
commonInit();
SimpleTest.waitForExplicitFinish();
var FORMS_TO_CREATE = 39;
function createForm(id) {
var template1 = "<form id='form"
var template2 = "'><input name='u'><input type='password' name='p'></form>\n";
return id + template1 + id + template2;
}
var formsHtml = "";
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
formsHtml += createForm(i);
}
var theDiv = document.getElementById("content");
theDiv.innerHTML = formsHtml;
</script>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: form fill, multiple forms. **/
function startTest() {
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
if (true) {
is($_(i, "u").value, "testuser", "Checking for filled username in form " + i);
is($_(i, "p").value, "testpass", "Checking for filled password in form " + i);
} else {
is($_(i, "u").value, "", "Checking for unfilled username in form " + i);
is($_(i, "p").value, "", "Checking for unfilled password in form " + i);
}
}
SimpleTest.finish();
}
if (SpecialPowers.getBoolPref("signon.useDOMFormHasPassword")) {
info("skipping test when signon.useDOMFormHasPassword is enabled");
SimpleTest.finish();
} else {
window.onload = startTest;
}
</script>
</pre>
</body>
</html>

View File

@ -1,64 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Login Manager</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Test limiting number of forms filled.
<p id="display"></p>
<div id="content" style="display: none"></div>
<script>
commonInit();
SimpleTest.waitForExplicitFinish();
var FORMS_TO_CREATE = 40;
function createForm(id) {
var template1 = "<form id='form"
var template2 = "'><input name='u'><input type='password' name='p'></form>\n";
return id + template1 + id + template2;
}
var formsHtml = "";
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
formsHtml += createForm(i);
}
var theDiv = document.getElementById("content");
theDiv.innerHTML = formsHtml;
</script>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: form fill, multiple forms. **/
function startTest() {
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
if (true) {
is($_(i, "u").value, "testuser", "Checking for filled username in form " + i);
is($_(i, "p").value, "testpass", "Checking for filled password in form " + i);
} else {
is($_(i, "u").value, "", "Checking for unfilled username in form " + i);
is($_(i, "p").value, "", "Checking for unfilled password in form " + i);
}
}
SimpleTest.finish();
}
if (SpecialPowers.getBoolPref("signon.useDOMFormHasPassword")) {
info("skipping test when signon.useDOMFormHasPassword is enabled");
SimpleTest.finish();
} else {
window.onload = startTest;
}
</script>
</pre>
</body>
</html>

View File

@ -1,64 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Login Manager</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Test limiting number of forms filled.
<p id="display"></p>
<div id="content" style="display: none"></div>
<script>
commonInit();
SimpleTest.waitForExplicitFinish();
var FORMS_TO_CREATE = 41;
function createForm(id) {
var template1 = "<form id='form"
var template2 = "'><input name='u'><input type='password' name='p'></form>\n";
return id + template1 + id + template2;
}
var formsHtml = "";
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
formsHtml += createForm(i);
}
var theDiv = document.getElementById("content");
theDiv.innerHTML = formsHtml;
</script>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: form fill, multiple forms. **/
function startTest() {
for (var i = 1; i <= FORMS_TO_CREATE; i++) {
if (i != 21) {
is($_(i, "u").value, "testuser", "Checking for filled username in form " + i);
is($_(i, "p").value, "testpass", "Checking for filled password in form " + i);
} else {
is($_(i, "u").value, "", "Checking for unfilled username in form " + i);
is($_(i, "p").value, "", "Checking for unfilled password in form " + i);
}
}
SimpleTest.finish();
}
if (SpecialPowers.getBoolPref("signon.useDOMFormHasPassword")) {
info("skipping test when signon.useDOMFormHasPassword is enabled");
SimpleTest.finish();
} else {
window.onload = startTest;
}
</script>
</pre>
</body>
</html>

View File

@ -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

View File

@ -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<ICoreWindowStatic> 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;
}

View File

@ -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();

View File

@ -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) {