Merge m-c to inbound.

--HG--
extra : rebase_source : cb2904476d146bce98091f77d1246350d673afca
This commit is contained in:
Ryan VanderMeulen 2012-06-23 22:22:42 -04:00
commit 0ecbfb128d
9 changed files with 654 additions and 4 deletions

View File

@ -7145,6 +7145,9 @@ let gPrivateBrowsingUI = {
* and the setter should only be used in tests.
*/
get privateWindow() {
if (!gBrowser)
return false;
return gBrowser.docShell.QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing;
}

View File

@ -152,6 +152,7 @@ _BROWSER_FILES = \
browser_bug735471.js \
browser_bug743421.js \
browser_bug749738.js \
browser_bug763468.js \
browser_canonizeURL.js \
browser_customize.js \
browser_findbarClose.js \

View File

@ -0,0 +1,76 @@
/* 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/. */
// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
// initialization
const pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
const PREF = "browser.newtab.url";
function test() {
let newTabUrl = Services.prefs.getCharPref(PREF) || "about:blank";
waitForExplicitFinish();
// check whether the mode that we start off with is normal or not
ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
// Open a new tab page in normal mode
openNewTab(function () {
// Check the new tab opened while in normal mode
is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl,
"URL of NewTab should be browser.newtab.url in Normal mode");
// enter private browsing mode
togglePrivateBrowsing(function () {
ok(pb.privateBrowsingEnabled, "private browsing is enabled");
// Open a new tab page in private browsing mode
openNewTab(function () {
// Check the new tab opened while in private browsing mode
is(gBrowser.selectedBrowser.currentURI.spec, "about:privatebrowsing",
"URL of NewTab should be about:privatebrowsing in PB mode");
// exit private browsing mode
togglePrivateBrowsing(function () {
ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
// Open a new tab page in normal mode to check if
// returning from pb mode restores everything as it should
openNewTab(function () {
// Check the new tab opened while in normal mode
is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl,
"URL of NewTab should be browser.newtab.url in Normal mode");
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.removeTab(gBrowser.selectedTab);
finish();
});
});
});
});
});
}
function togglePrivateBrowsing(aCallback) {
let topic = "private-browsing-transition-complete";
Services.obs.addObserver(function observe() {
Services.obs.removeObserver(observe, topic);
executeSoon(aCallback);
}, topic, false);
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
}
function openNewTab(aCallback) {
// Open a new tab
BrowserOpenTab();
let browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
executeSoon(aCallback);
}, true);
}

View File

@ -247,7 +247,7 @@ function ensure_opentabs_match_db(aCallback) {
for (let i = 0; i < browserWin.gBrowser.tabContainer.childElementCount; i++) {
let browser = browserWin.gBrowser.getBrowserAtIndex(i);
let url = browser.currentURI.spec;
if (url == "about:blank")
if (browserWin.isBlankPageURL(url))
continue;
if (!(url in tabs))
tabs[url] = 1;

View File

@ -9,9 +9,13 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
const PREF = "browser.newtab.url";
const TOPIC = "private-browsing-transition-complete";
function getNewTabPageURL() {
return Services.prefs.getCharPref(PREF) || "about:blank";
if (("gPrivateBrowsingUI" in window) && gPrivateBrowsingUI.privateWindow)
return "about:privatebrowsing";
else
return Services.prefs.getCharPref(PREF) || "about:blank";
}
function update() {
@ -19,9 +23,12 @@ XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
}
Services.prefs.addObserver(PREF, update, false);
Services.obs.addObserver(update, TOPIC, false);
addEventListener("unload", function onUnload() {
removeEventListener("unload", onUnload);
Services.prefs.removeObserver(PREF, update);
Services.obs.removeObserver(update, TOPIC);
});
return getNewTabPageURL();

View File

@ -3872,8 +3872,14 @@ public:
~MouseEnterLeaveDispatcher()
{
for (PRInt32 i = 0; i < mTargets.Count(); ++i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
if (mType == NS_MOUSEENTER) {
for (PRInt32 i = mTargets.Count() - 1; i >= 0; --i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
}
} else {
for (PRInt32 i = 0; i < mTargets.Count(); ++i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
}
}
}

View File

@ -41,6 +41,9 @@ function sendMouseEvent(t, elem) {
synthesizeMouse(elem, r.width / 2, r.height / 2, {type: t});
}
var expectedMouseEnterTargets = [];
var expectedMouseLeaveTargets = [];
function runTests() {
outer = document.getElementById("outertest");
middle = document.getElementById("middletest");
@ -60,6 +63,7 @@ function runTests() {
checkRelatedTarget = true;
expectedRelatedEnter = outside;
expectedRelatedLeave = inner;
expectedMouseEnterTargets = ["outertest", "middletest", "innertest"];
sendMouseEvent("mousemove", inner);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
@ -67,6 +71,7 @@ function runTests() {
is(mouseleavecount, 0, "Unexpected mouseleave event count!");
expectedRelatedEnter = inner;
expectedRelatedLeave = outside;
expectedMouseLeaveTargets = ["innertest", "middletest", "outertest"];
sendMouseEvent("mousemove", outside);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
@ -132,6 +137,10 @@ function runTests() {
function menter(evt) {
++mouseentercount;
evt.stopPropagation();
if (expectedMouseEnterTargets.length) {
var t = expectedMouseEnterTargets.shift();
is(evt.target.id, t, "Wrong event target!");
}
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");
@ -145,6 +154,10 @@ function menter(evt) {
function mleave(evt) {
++mouseleavecount;
evt.stopPropagation();
if (expectedMouseLeaveTargets.length) {
var t = expectedMouseLeaveTargets.shift();
is(evt.target.id, t, "Wrong event target!");
}
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");

View File

@ -46,6 +46,7 @@ _TEST_FILES = \
file_clonewrapper.html \
file_moving_nodeList.html \
test_performance_now.html \
test_interfaces.html \
$(NULL)
_CHROME_FILES = \

View File

@ -0,0 +1,543 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=766694
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 766694</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766694">Mozilla Bug 766694</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 766694 **/
var interfaceNamesInGlobalScope =
[
"MozApplicationEvent",
"HTMLByteRanges",
"URL",
"MozBatteryManager",
"HTMLStyleElement",
"PropertyNodeList",
"SVGPatternElement",
"LinkStyle",
"IDBTransaction",
"CSSMediaRule",
"SVGFEMergeNodeElement",
"HTMLUnknownElement",
"SVGStylable",
"MozContactChangeEvent",
"ToString",
"MozBrowserFrame",
"UserDataHandler",
"HTMLDirectoryElement",
"SVGNumberList",
"SVGMaskElement",
"DeviceMotionEvent",
"GetSVGDocument",
"SVGAnimatedPreserveAspectRatio",
"MozSmsRequest",
"SVGViewElement",
"HTMLTableSectionElement",
"HTMLCollection",
"HTMLProgressElement",
"CRMFObject",
"CSSStyleSheet",
"UIEvent",
"IDBOpenDBRequest",
"XMLHttpRequest",
"SVGTextPathElement",
"StorageItem",
"SVGPolygonElement",
"MutationRecord",
"TimeEvent",
"HTMLElement",
"HTMLOptionElement",
"Pkcs11",
"NotifyAudioAvailableEvent",
"Array",
"SVGZoomAndPan",
"XULPopupElement",
"MediaError",
"DeviceStorageCursor",
"PageTransitionEvent",
"DataContainerEvent",
"MozCSSKeyframesRule",
"SVGAnimatedInteger",
"TouchEvent",
"OpenWindowEventDetail",
"IDBIndex",
"EventListener",
"TransitionEvent",
"XULContainerItemElement",
"HTMLTableCaptionElement",
"SVGRect",
"IDBCursor",
"History",
"HTMLTableRowElement",
"NodeFilter",
"ClientRectList",
"WebGLExtensionLoseContext",
"CanvasRenderingContext2D",
"SVGPathSegLinetoVerticalRel",
"MozPowerManager",
"SVGElement",
"GeoPositionError",
"XPathEvaluator",
"NodeIterator",
"MozNavigatorNetwork",
"CryptoDialogs",
"SVGLocatable",
"XULElement",
"CSSRuleList",
"SVGMarkerElement",
"Rect",
"SVGPathElement",
"WebGLUniformLocation",
"SVGUseElement",
"SVGAnimatedPoints",
"DeviceAcceleration",
"DOMError",
"SVGAnimateMotionElement",
"HTMLMeterElement",
"SmartCardEvent",
"CSSValueList",
"ValidityState",
"HTMLAppletElement",
"Touch",
"Controllers",
"AnimationEvent",
"NavigatorDesktopNotification",
"LoadStatus",
"WebGLBuffer",
"MediaQueryList",
"Contact",
"MediaQueryListListener",
"DesktopNotificationCenter",
"PluginArray",
"XULSelectControlElement",
"TimeRanges",
"ImageData",
"SVGPathSegArcAbs",
"MimeTypeArray",
"DocumentFragment",
"ParserJS",
"CanvasPattern",
"GeoPosition",
"XPathExpression",
"BarProp",
"NSEditableElement",
"SVGRectElement",
"DOMRequest",
"WindowPerformance",
"DOMSettableTokenList",
"SVGTransformList",
"SVGTransformable",
"XULControlElement",
"MozMobileConnection",
"HTMLFrameSetElement",
"CSSCharsetRule",
"TouchList",
"DOMStringList",
"HTMLCommandElement",
"FileList",
"XULRelatedElement",
"Blob",
"Node",
"HTMLEmbedElement",
"ProgressEvent",
"SVGAnimateElement",
"MutationEvent",
"TreeSelection",
"DeviceLightEvent",
"SVGCircleElement",
"SVGFEComponentTransferElement",
"SVGPathSeg",
"SVGSVGElement",
"GlobalPropertyInitializer",
"HTMLMenuItemElement",
"HTMLDataListElement",
"XPathResult",
"XMLDocument",
"DocumentType",
"NamedNodeMap",
"DeviceProximityEvent",
"XULLabeledControlElement",
"MozWakeLock",
"WebGLFramebuffer",
"MozConnection",
"WebGLRenderingContext",
"JSON",
"ClientRect",
"GetUserMediaSuccessCallback",
"CommandEvent",
"HTMLDocument",
"DeviceOrientationEvent",
"HTMLPreElement",
"StorageEvent",
"CSS2Properties",
"StorageIndexedDB",
"XULDocument",
"XULMultiSelectControlElement",
"SVGTitleElement",
"ContactProperties",
"PerformanceTiming",
"LSProgressEvent",
"NSEvent",
"HTMLBRElement",
"MouseScrollEvent",
"HashChangeEvent",
"TreeWalker",
"HTMLTitleElement",
"LockedFile",
"GetUserMediaErrorCallback",
"SVGFEMorphologyElement",
"SVGFETurbulenceElement",
"XULTextBoxElement",
"SVGDocument",
"CSSStyleDeclaration",
"SVGAltGlyphElement",
"Screen",
"FileReader",
"SVGSwitchElement",
"SVGPolylineElement",
"SVGPathSegLinetoAbs",
"NavigatorDeviceStorage",
"HTMLOptionsCollection",
"IDBKeyRange",
"Parser",
"HTMLDivElement",
"HTMLLinkElement",
"ClientInformation",
"SVGMpathElement",
"HTMLTextAreaElement",
"SVGAnimatedEnumeration",
"Attr",
"StyleSheet",
"HTMLBodyElement",
"SVGPathSegCurvetoQuadraticSmoothRel",
"HTMLHeadingElement",
"Document",
"FileHandle",
"HTMLAnchorElement",
"SVGZoomEvent",
"UserProximityEvent",
"SVGAnimateTransformElement",
"CSSMozDocumentRule",
"HTMLQuoteElement",
"PopStateEvent",
"IDBVersionChangeEvent",
"HTMLCanvasElement",
"MouseEvent",
"OfflineResourceList",
"ContactAddress",
"Range",
"MozCSSKeyframeRule",
"SettingsLock",
"Screen",
"ImageDocument",
"TextMetrics",
"SVGScriptElement",
"CDATASection",
"CanvasGradient",
"SVGViewSpec",
"DOMException",
"MozSmsMessage",
"SVGFESpecularLightingElement",
"StorageObsolete",
"ContactManager",
"NSXPathExpression",
"SVGLineElement",
"SVGPathSegArcRel",
"WebGLExtension",
"XSLTProcessor",
"SVGPathSegLinetoVerticalAbs",
"SVGPathSegLinetoRel",
"HTMLImageElement",
"MozSmsEvent",
"CustomEvent",
"XMLHttpRequestUpload",
"SVGFEFuncBElement",
"Text",
"SVGPathSegCurvetoCubicRel",
"DataTransfer",
"SVGTSpanElement",
"SVGRadialGradientElement",
"SVGFEDisplacementMapElement",
"SVGPathSegCurvetoCubicSmoothAbs",
"CSSValue",
"DesktopNotification",
"KeyEvent",
"HTMLAreaElement",
"XULLabelElement",
"FormData",
"IDBDatabase",
"CSSPrimitiveValue",
"SVGStopElement",
"WebGLExtensionCompressedTextureS3TC",
"XULCommandEvent",
"HTMLMediaElement",
"SVGPathSegLinetoHorizontalAbs",
"SVGAnimatedRect",
"SVGTextContentElement",
"SyncMessageSender",
"WebGLRenderbuffer",
"TreeColumn",
"WebGLExtensionStandardDerivatives",
"WebGLShaderPrecisionFormat",
"XPathNamespace",
"FontFace",
"SVGPathSegCurvetoCubicSmoothRel",
"HTMLMapElement",
"SVGImageElement",
"HTMLMetaElement",
"NotifyPaintEvent",
"XULTreeElement",
"DragEvent",
"IDBObjectStore",
"NodeSelector",
"NavigatorUserMedia",
"TreeContentView",
"MimeType",
"SVGForeignObjectElement",
"MozMobileNetworkInfo",
"SVGAnimatedString",
"HTMLPropertiesCollection",
"WindowInternal",
"Serializer",
"SVGFEFuncGElement",
"XULCheckboxElement",
"SVGFEPointLightElement",
"ModalContentWindow",
"Crypto",
"StorageManager",
"SVGAngle",
"Navigator",
"SVGPathSegCurvetoQuadraticSmoothAbs",
"HTMLButtonElement",
"MozNavigatorBattery",
"WebGLProgram",
"SVGPointList",
"SVGFEColorMatrixElement",
"USSDReceivedEvent",
"SettingsManager",
"DeviceRotationRate",
"HTMLAudioElement",
"WebGLTexture",
"SVGFEDistantLightElement",
"HTMLOListElement",
"ProcessingInstruction",
"CSSUnknownRule",
"SVGComponentTransferFunctionElement",
"SVGEvent",
"SVGPathSegLinetoHorizontalRel",
"SVGAnimatedNumber",
"HTMLHtmlElement",
"MozSmsManager",
"MozSmsFilter",
"SVGFETileElement",
"MozMobileConnectionInfo",
"CSSRule",
"HTMLSelectElement",
"MessageEvent",
"SVGFEImageElement",
"MozURLProperty",
"DeviceStorage",
"SVGFEOffsetElement",
"DOMImplementation",
"SVGFECompositeElement",
"MediaList",
"HTMLFrameElement",
"NodeList",
"SVGPathSegCurvetoQuadraticRel",
"IDBFactory",
"SVGFilterPrimitiveStandardAttributes",
"CSSImportRule",
"SVGPathSegClosePath",
"HTMLTableCellElement",
"WindowUtils",
"SVGAnimatedNumberList",
"WindowCollection",
"WebGLExtensionTextureFilterAnisotropic",
"SVGPathSegMovetoRel",
"ChromeWindow",
"Comment",
"HTMLSourceElement",
"SVGStringList",
"Storage",
"HTMLModElement",
"PaintRequest",
"XPathNSResolver",
"XULDescriptionElement",
"SVGLinearGradientElement",
"JSWindow",
"SVGGElement",
"BoxObject",
"SVGFEBlendElement",
"Event",
"File",
"HTMLOptGroupElement",
"SVGAnimatedLengthList",
"SVGAnimatedTransformList",
"MozTouchEvent",
"MozWakeLockListener",
"Selection",
"XULTreeBuilder",
"ScrollAreaEvent",
"SVGStyleElement",
"XULContainerElement",
"DOMTokenList",
"FrameMessageManager",
"HTMLHRElement",
"HTMLFontElement",
"SVGFEFloodElement",
"HTMLDListElement",
"SVGSymbolElement",
"SVGLengthList",
"TreeColumns",
"PaintRequestList",
"SVGTextElement",
"SimpleGestureEvent",
"SVGMatrix",
"HTMLUListElement",
"SVGFEConvolveMatrixElement",
"SVGAnimationElement",
"SVGMetadataElement",
"EventListenerInfo",
"CSSStyleRule",
"IDBRequest",
"Performance",
"XULMenuListElement",
"SVGTransform",
"SVGTextPositioningElement",
"ContactFindOptions",
"SVGFEMergeElement",
"FileRequest",
"SVGDefsElement",
"Element",
"HTMLBaseElement",
"WebGLShader",
"GeoPositionErrorCallback",
"HTMLVideoElement",
"MozSettingsEvent",
"SVGAnimatedPathData",
"SVGUnitTypes",
"SVGTests",
"RGBColor",
"HTMLLabelElement",
"MozSmsCursor",
"EventSource",
"MozNavigatorSms",
"SVGSetElement",
"GlobalObjectConstructor",
"SVGAnimatedBoolean",
"HTMLTableElement",
"Window",
"SVGNumber",
"XULImageElement",
"Plugin",
"SVGAnimatedLength",
"FontFaceList",
"EventTarget",
"SVGFEFuncRElement",
"SVGPathSegMovetoAbs",
"SVGPoint",
"GeoPositionCoords",
"HTMLIFrameElement",
"PerformanceNavigation",
"MediaStream",
"DOMStringMap",
"HTMLFieldSetElement",
"SVGFEDiffuseLightingElement",
"StyleSheetList",
"ElementCSSInlineStyle",
"HTMLInputElement",
"CharacterData",
"HTMLObjectElement",
"SVGURIReference",
"GeoGeolocation",
"HTMLParamElement",
"HTMLTableColElement",
"MozBlobBuilder",
"SVGFESpotLightElement",
"PopupBlockedEvent",
"XULButtonElement",
"CSSPageRule",
"Location",
"DocumentXBL",
"HTMLHeadElement",
"XULTemplateBuilder",
"GeoPositionCallback",
"XULCommandDispatcher",
"DocumentTouch",
"XULSelectControlItemElement",
"SVGPathSegCurvetoQuadraticAbs",
"MutationObserver",
"RequestService",
"Counter",
"ContentFrameMessageManager",
"SVGAnimatedAngle",
"SVGPathSegList",
"SVGFEFuncAElement",
"WebSocket",
"ElementTimeControl",
"HTMLLegendElement",
"SVGFEGaussianBlurElement",
"SVGEllipseElement",
"SVGDescElement",
"BeforeUnloadEvent",
"NSRGBAColor",
"MozBrowserFrame",
"SVGPreserveAspectRatio",
"HTMLMenuElement",
"CloseEvent",
"IDBCursorWithValue",
"CSSFontFaceRule",
"XMLHttpRequestEventTarget",
"CompositionEvent",
"HTMLOutputElement",
"HTMLFormElement",
"SVGLength",
"SVGFilterElement",
"HTMLScriptElement",
"SVGPathSegCurvetoCubicAbs",
"HTMLLIElement",
"SVGClipPathElement",
"NavigatorGeolocation",
"HTMLParagraphElement",
"EventTarget",
"File",
"WebGLActiveInfo",
"SVGGradientElement",
"ContactTelephone",
"SVGFitToViewBox",
"SVGAElement"
]
for (var i in Components.interfaces) {
var s = i.toString();
var name = null;
if (s.indexOf("nsIDOM") == 0) {
name = s.substring("nsIDOM".length);
} else if (s.indexOf("nsI") == 0) {
name = s.substring("nsI".length);
}
if (name && (name in window)) {
ok(interfaceNamesInGlobalScope.indexOf(name) >= 0,
"Unexpected interface name in global scope: " + name);
}
}
</script>
</pre>
</body>
</html>