Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher 2016-07-05 17:12:45 -07:00
commit fc828c3264
22 changed files with 773 additions and 351 deletions

View File

@ -2967,7 +2967,7 @@ var BrowserOnClick = {
anchorTarget.classList.contains("newtab-link")) {
event.preventDefault();
let where = whereToOpenLink(event, false, false);
openLinkIn(anchorTarget.href, where, { charset: ownerDoc.characterSet });
openLinkIn(anchorTarget.href, where, { charset: ownerDoc.characterSet, referrerURI: ownerDoc.documentURIObject });
}
},
@ -7248,8 +7248,9 @@ var gIdentityHandler = {
label.textContent = aPermission.label;
let img = document.createElement("image");
let isBlocked = (aPermission.state == SitePermissions.BLOCK) ? " blocked" : "";
img.setAttribute("class",
"identity-popup-permission-icon " + aPermission.id + "-icon");
"identity-popup-permission-icon " + aPermission.id + "-icon" + isBlocked);
let container = document.createElement("hbox");
container.setAttribute("align", "center");

View File

@ -1764,12 +1764,10 @@
<parameter name="aParams"/>
<body>
<![CDATA[
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
// Supported parameters:
// userContextId, remote, isPreloadBrowser, uriIsAboutBlank
let remote = aParams && aParams.remote;
let uriIsAboutBlank = aParams && aParams.uriIsAboutBlank;
let isPreloadBrowser = aParams && aParams.isPreloadBrowser;
let userContextId = aParams && aParams.userContextId;
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let b = document.createElementNS(NS_XUL, "browser");
b.permanentKey = {};
@ -1779,19 +1777,21 @@
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
if (userContextId) {
b.setAttribute("usercontextid", userContextId);
if (aParams.userContextId) {
b.setAttribute("usercontextid", aParams.userContextId);
}
if (remote)
if (aParams.remote) {
b.setAttribute("remote", "true");
}
if (window.gShowPageResizers && window.windowState == window.STATE_NORMAL) {
b.setAttribute("showresizer", "true");
}
if (!isPreloadBrowser && this.hasAttribute("autocompletepopup"))
if (!aParams.isPreloadBrowser && this.hasAttribute("autocompletepopup")) {
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
}
if (this.hasAttribute("selectmenulist"))
b.setAttribute("selectmenulist", this.getAttribute("selectmenulist"));
@ -1826,7 +1826,7 @@
// Prevent the superfluous initial load of a blank document
// if we're going to load something other than about:blank.
if (!uriIsAboutBlank) {
if (!aParams.uriIsAboutBlank) {
b.setAttribute("nodefaultsrc", "true");
}
@ -1843,23 +1843,15 @@
<![CDATA[
"use strict";
let aReferrerURI = aParams.referrerURI;
let aReferrerPolicy = aParams.referrerPolicy;
let aCharset = aParams.charset;
let aPostData = aParams.postData;
let aAllowThirdPartyFixup = aParams.allowThirdPartyFixup;
let aFromExternal = aParams.fromExternal;
let aAllowMixedContent = aParams.allowMixedContent;
let aForceNotRemote = aParams.forceNotRemote;
let aNoReferrer = aParams.noReferrer;
let aUserContextId = aParams.userContextId;
// Supported parameters:
// forceNotRemote, userContextId
let uriIsAboutBlank = !aURI || aURI == "about:blank";
// The new browser should be remote if this is an e10s window and
// the uri to load can be loaded remotely.
let remote = gMultiProcessBrowser &&
!aForceNotRemote &&
!aParams.forceNotRemote &&
E10SUtils.canLoadURIInProcess(aURI, Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT);
let browser;
@ -1869,7 +1861,8 @@
// userContext, check if there is a preloaded browser ready.
// Private windows are not included because both the label and the
// icon for the tab would be set incorrectly (see bug 1195981).
if (aURI == BROWSER_NEW_TAB_URL && !aUserContextId &&
if (aURI == BROWSER_NEW_TAB_URL &&
!aParams.userContextId &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
browser = this._getPreloadedBrowser();
usingPreloadedContent = !!browser;
@ -1879,7 +1872,7 @@
// No preloaded browser found, create one.
browser = this._createBrowser({remote: remote,
uriIsAboutBlank: uriIsAboutBlank,
userContextId: aUserContextId});
userContextId: aParams.userContextId});
}
let notificationbox = this.getNotificationBox(browser);
@ -2024,19 +2017,6 @@
this.tabContainer.updateVisibility();
let options = {
referrerURI : aReferrerURI,
referrerPolicy : aReferrerPolicy,
charset : aCharset,
postData : aPostData,
allowThirdPartyFixup : aAllowThirdPartyFixup,
fromExternal : aFromExternal,
allowMixedContent : aAllowMixedContent,
forceNotRemote : aForceNotRemote,
noReferrer : aNoReferrer,
userContextId : aUserContextId
};
// Currently in this incarnation of bug 906076, we are forcing the
// browser to immediately be linked. In future incarnations of this
// bug this will be removed so we can leave the tab in its "lazy"
@ -2044,7 +2024,11 @@
// now this must occur before "TabOpen" event is fired, as that will
// trigger SessionStore.jsm to run code that expects the existence
// of tab.linkedBrowser.
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, options);
let browserParams = {
forceNotRemote: aForceNotRemote,
userContextId: aUserContextId
};
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
let b = t.linkedBrowser;
// Dispatch a new tab notification. We do this once we're

View File

@ -22,6 +22,7 @@ support-files =
[browser_newtab_bug1145428.js]
[browser_newtab_bug1178586.js]
[browser_newtab_bug1194895.js]
[browser_newtab_bug1271075.js]
[browser_newtab_disable.js]
[browser_newtab_drag_drop.js]
[browser_newtab_drag_drop_ext.js]

View File

@ -0,0 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(function* () {
is(gBrowser.tabs.length, 1, "one tab is open initially");
// Add a few tabs.
let tabs = [];
function addTab(aURL, aReferrer) {
let tab = gBrowser.addTab(aURL, {referrerURI: aReferrer});
tabs.push(tab);
return BrowserTestUtils.browserLoaded(tab.linkedBrowser);
}
yield addTab("http://mochi.test:8888/#0");
yield addTab("http://mochi.test:8888/#1");
yield addTab("http://mochi.test:8888/#2");
yield addTab("http://mochi.test:8888/#3");
// Create a new tab page with a "www.example.com" tile and move it to the 2nd tab position.
yield setLinks("-1");
yield* addNewTabPageTab();
gBrowser.moveTabTo(gBrowser.selectedTab, 1);
// Send a middle-click and confirm that the clicked site opens immediately next to the new tab page.
yield BrowserTestUtils.synthesizeMouseAtCenter(".newtab-cell",
{button: 1}, gBrowser.selectedBrowser);
yield BrowserTestUtils.browserLoaded(gBrowser.getBrowserAtIndex(2));
is(gBrowser.getBrowserAtIndex(2).currentURI.spec, "http://example.com/",
"Middle click opens site in a new tab immediately to the right.");
});

View File

@ -19,8 +19,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -4,6 +4,9 @@
# 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/.
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
FINAL_TARGET_FILES.features['e10srollout@mozilla.org'] += [
'bootstrap.js'
]

View File

@ -19,8 +19,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -4,6 +4,9 @@
# 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/.
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
FINAL_TARGET_FILES.features['flyweb@mozilla.org'] += [
'bootstrap.js'
]

View File

@ -19,8 +19,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -4,6 +4,9 @@
# 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/.
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
DIRS += ['locales']
FINAL_TARGET_FILES.features['firefox@getpocket.com'] += [

View File

@ -19,8 +19,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -4,6 +4,9 @@
# 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/.
DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
FINAL_TARGET_FILES.features['webcompat@mozilla.org'] += [
'bootstrap.js'
]

View File

@ -3,25 +3,69 @@
- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="32" height="32" viewBox="0 0 32 32">
<style>
path:not(:target) {
use:not(:target) {
display: none;
}
#strikeout {
display: none;
}
.blocked:target ~ #strikeout {
display: block;
}
.blocked {
clip-path: url(#clip);
}
</style>
<path id="camera" d="m 2,23 a 3,3 0 0 0 3,3 l 14,0 a 3,3 0 0 0 3,-3 l 0,-4 6,5.5 c 0.5,0.5 1,0.7 2,0.5 l 0,-18 c -1,-0.2 -1.5,0 -2,0.5 l -6,5.5 0,-4 a 3,3 0 0 0 -3,-3 l -14,0 a 3,3 0 0 0 -3,3 z" />
<path id="desktop-notification" d="m 2,20 a 4,4 0 0 0 4,4 l 13,0 7,7 0,-7 a 4,4 0 0 0 4,-4 l 0,-12 a 4,4 0 0 0 -4,-4 l -20,0 a 4,4 0 0 0 -4,4 z m 5,-2 a 1,1 0 1 1 0,-2 l 10,0 a 1,1 0 1 1 0,2 z m 0,-4 a 1,1 0 1 1 0,-2 l 14,0 a 1,1 0 1 1 0,2 z m 0,-4 a 1,1 0 1 1 0,-2 l 18,0 a 1,1 0 1 1 0,2 z" />
<path id="geo-linux" d="m 2,15.9 a 14,14 0 1 1 0,0.2 z m 4,2.1 a 10,10 0 0 0 8,8 l 0,-4 4,0 0,4 a 10,10 0 0 0 8,-8 l -4,0 0,-4 4,0 a 10,10 0 0 0 -8,-8 l 0,4 -4,0 0,-4 a 10,10 0 0 0 -8,8 l 4,0 0,4 z" />
<path id="geo-linux-detailed" d="m 2,15.9 a 14,14 0 1 1 0,0.2 z m 3,2.1 a 11,11 0 0 0 9,9 l 1,-5 2,0 1,5 a 11,11 0 0 0 9,-9 l -5,-1 0,-2 5,-1 a 11,11 0 0 0 -9,-9 l -1,5 -2,0 -1,-5 a 11,11 0 0 0 -9,9 l 5,1 0,2 z" />
<path id="geo-osx" d="m 0,16 16,0 0,16 12,-28 z" />
<path id="geo-windows" d="m 2,14 0,4 2,0 a 12,12 0 0 0 10,10 l 0,2 4,0 0,-2 a 12,12 0 0 0 10,-10 l 2,0 0,-4 -2,0 a 12,12 0 0 0 -10,-10 l 0,-2 -4,0 0,2 a 12,12 0 0 0 -10,10 z m 4,1.9 a 10,10 0 1 1 0,0.2 z m 4,0 a 6,6 0 1 1 0,0.2 z" />
<path id="geo-windows-detailed" d="m 2,14.5 0,3 2,0.5 a 12,12 0 0 0 10,10 l 0.5,2 3,0 0.5,-2 a 12,12 0 0 0 10,-10 l 2,-0.5 0,-3 -2,-0.5 a 12,12 0 0 0 -10,-10 l -0.5,-2 -3,0 -0.5,2 a 12,12 0 0 0 -10,10 z m 4,1.4 a 10,10 0 1 1 0,0.2 z m 3,0 a 7,7 0 1 1 0,0.2 z" />
<path id="indexedDB" d="m 2,24 a 4,4 0 0 0 4,4 l 2,0 0,-4 -2,0 0,-16 20,0 0,16 -2,0 0,4 2,0 a 4,4 0 0 0 4,-4 l 0,-16 a 4,4 0 0 0 -4,-4 l -20,0 a 4,4 0 0 0 -4,4 z m 8,-2 6,7 6,-7 -4,0 0,-8 -4,0 0,8 z" />
<path id="login" d="m 2,26 0,4 6,0 0,-2 2,0 0,-2 1,0 0,-1 2,0 0,-3 2,0 2.5,-2.5 1.5,1.5 3,-3 a 8,8 0 1 0 -8,-8 l -3,3 2,2 z m 20,-18.1 a 2,2 0 1 1 0,0.2 z" />
<path id="login-detailed" d="m 1,27 0,3.5 a 0.5,0.5 0 0 0 0.5,0.5 l 5,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1.5 1.5,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1.5 1,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1 1,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-2 2,0 2.5,-2.5 q 0.5,-0.5 1,0 l 1,1 c 0.5,0.5 1,0.5 1.5,-0.5 l 1,-2 a 9,9 0 1 0 -8,-8 l -2,1 c -1,0.5 -1,1 -0.5,1.5 l 1.5,1.5 q 0.5,0.5 0,1 z m 21,-19.1 a 2,2 0 1 1 0,0.2 z" />
<path id="microphone" d="m 8,14 0,4 a 8,8 0 0 0 6,7.7 l 0,2.3 -2,0 a 2,2 0 0 0 -2,2 l 12,0 a 2,2 0 0 0 -2,-2 l -2,0 0,-2.3 a 8,8 0 0 0 6,-7.7 l 0,-4 -2,0 0,4 a 6,6 0 0 1 -12,0 l 0,-4 z m 4,4 a 4,4 0 0 0 8,0 l 0,-12 a 4,4 0 0 0 -8,0 z" />
<path id="microphone-detailed" d="m 8,18 a 8,8 0 0 0 6,7.7 l 0,2.3 -1,0 a 3,2 0 0 0 -3,2 l 12,0 a 3,2 0 0 0 -3,-2 l -1,0 0,-2.3 a 8,8 0 0 0 6,-7.7 l 0,-4 a 1,1 0 0 0 -2,0 l 0,4 a 6,6 0 0 1 -12,0 l 0,-4 a 1,1 0 0 0 -2,0 z m 4,0 a 4,4 0 0 0 8,0 l 0,-12 a 4,4 0 0 0 -8,0 z" />
<path id="pointerLock" d="m 8,24 6,-5 5,10 4,-2 -5,-10 7,-1 -17,-14 z" />
<path id="popup" d="m 2,24 a 4,4 0 0 0 4,4 l 8,0 a 10,10 0 0 1 -2,-4 l -4,0 a 2,2 0 0 1 -2,-2 l 0,-12 18,0 0,2 a 10,10 0 0 1 4,2 l 0,-8 a 4,4 0 0 0 -4,-4 l -18,0 a 4,4 0 0 0 -4,4 z m 12,-2.1 a 8,8 0 1 1 0,0.2 m 10.7,-4.3 a 5,5 0 0 0 -6.9,6.9 z m -5.4,8.4 a 5,5 0 0 0 6.9,-6.9 z" />
<path id="screen" d="m 2,18 a 2,2 0 0 0 2,2 l 2,0 0,-6 a 4,4 0 0 1 4,-4 l 14,0 0,-6 a 2,2 0 0 0 -2,-2 l -18,0 a 2,2 0 0 0 -2,2 z m 6,10 a 2,2 0 0 0 2,2 l 18,0 a 2,2 0 0 0 2,-2 l 0,-14 a 2,2 0 0 0 -2,-2 l -18,0 a 2,2 0 0 0 -2,2 z" />
<defs>
<path id="camera-icon" d="m 2,23 a 3,3 0 0 0 3,3 l 14,0 a 3,3 0 0 0 3,-3 l 0,-4 6,5.5 c 0.5,0.5 1,0.7 2,0.5 l 0,-18 c -1,-0.2 -1.5,0 -2,0.5 l -6,5.5 0,-4 a 3,3 0 0 0 -3,-3 l -14,0 a 3,3 0 0 0 -3,3 z" />
<path id="desktop-notification-icon" d="m 2,20 a 4,4 0 0 0 4,4 l 13,0 7,7 0,-7 a 4,4 0 0 0 4,-4 l 0,-12 a 4,4 0 0 0 -4,-4 l -20,0 a 4,4 0 0 0 -4,4 z m 5,-2 a 1,1 0 1 1 0,-2 l 10,0 a 1,1 0 1 1 0,2 z m 0,-4 a 1,1 0 1 1 0,-2 l 14,0 a 1,1 0 1 1 0,2 z m 0,-4 a 1,1 0 1 1 0,-2 l 18,0 a 1,1 0 1 1 0,2 z" />
<path id="geo-linux-icon" d="m 2,15.9 a 14,14 0 1 1 0,0.2 z m 4,2.1 a 10,10 0 0 0 8,8 l 0,-4 4,0 0,4 a 10,10 0 0 0 8,-8 l -4,0 0,-4 4,0 a 10,10 0 0 0 -8,-8 l 0,4 -4,0 0,-4 a 10,10 0 0 0 -8,8 l 4,0 0,4 z" />
<path id="geo-linux-detailed-icon" d="m 2,15.9 a 14,14 0 1 1 0,0.2 z m 3,2.1 a 11,11 0 0 0 9,9 l 1,-5 2,0 1,5 a 11,11 0 0 0 9,-9 l -5,-1 0,-2 5,-1 a 11,11 0 0 0 -9,-9 l -1,5 -2,0 -1,-5 a 11,11 0 0 0 -9,9 l 5,1 0,2 z" />
<path id="geo-osx-icon" d="m 0,16 16,0 0,16 12,-28 z" />
<path id="geo-windows-icon" d="m 2,14 0,4 2,0 a 12,12 0 0 0 10,10 l 0,2 4,0 0,-2 a 12,12 0 0 0 10,-10 l 2,0 0,-4 -2,0 a 12,12 0 0 0 -10,-10 l 0,-2 -4,0 0,2 a 12,12 0 0 0 -10,10 z m 4,1.9 a 10,10 0 1 1 0,0.2 z m 4,0 a 6,6 0 1 1 0,0.2 z" />
<path id="geo-windows-detailed-icon" d="m 2,14.5 0,3 2,0.5 a 12,12 0 0 0 10,10 l 0.5,2 3,0 0.5,-2 a 12,12 0 0 0 10,-10 l 2,-0.5 0,-3 -2,-0.5 a 12,12 0 0 0 -10,-10 l -0.5,-2 -3,0 -0.5,2 a 12,12 0 0 0 -10,10 z m 4,1.4 a 10,10 0 1 1 0,0.2 z m 3,0 a 7,7 0 1 1 0,0.2 z" />
<path id="indexedDB-icon" d="m 2,24 a 4,4 0 0 0 4,4 l 2,0 0,-4 -2,0 0,-16 20,0 0,16 -2,0 0,4 2,0 a 4,4 0 0 0 4,-4 l 0,-16 a 4,4 0 0 0 -4,-4 l -20,0 a 4,4 0 0 0 -4,4 z m 8,-2 6,7 6,-7 -4,0 0,-8 -4,0 0,8 z" />
<path id="login-icon" d="m 2,26 0,4 6,0 0,-2 2,0 0,-2 1,0 0,-1 2,0 0,-3 2,0 2.5,-2.5 1.5,1.5 3,-3 a 8,8 0 1 0 -8,-8 l -3,3 2,2 z m 20,-18.1 a 2,2 0 1 1 0,0.2 z" />
<path id="login-detailed-icon" d="m 1,27 0,3.5 a 0.5,0.5 0 0 0 0.5,0.5 l 5,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1.5 1.5,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1.5 1,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-1 1,0 a 0.5,0.5 0 0 0 0.5,-0.5 l 0,-2 2,0 2.5,-2.5 q 0.5,-0.5 1,0 l 1,1 c 0.5,0.5 1,0.5 1.5,-0.5 l 1,-2 a 9,9 0 1 0 -8,-8 l -2,1 c -1,0.5 -1,1 -0.5,1.5 l 1.5,1.5 q 0.5,0.5 0,1 z m 21,-19.1 a 2,2 0 1 1 0,0.2 z" />
<path id="microphone-icon" d="m 8,14 0,4 a 8,8 0 0 0 6,7.7 l 0,2.3 -2,0 a 2,2 0 0 0 -2,2 l 12,0 a 2,2 0 0 0 -2,-2 l -2,0 0,-2.3 a 8,8 0 0 0 6,-7.7 l 0,-4 -2,0 0,4 a 6,6 0 0 1 -12,0 l 0,-4 z m 4,4 a 4,4 0 0 0 8,0 l 0,-12 a 4,4 0 0 0 -8,0 z" />
<path id="microphone-detailed-icon" d="m 8,18 a 8,8 0 0 0 6,7.7 l 0,2.3 -1,0 a 3,2 0 0 0 -3,2 l 12,0 a 3,2 0 0 0 -3,-2 l -1,0 0,-2.3 a 8,8 0 0 0 6,-7.7 l 0,-4 a 1,1 0 0 0 -2,0 l 0,4 a 6,6 0 0 1 -12,0 l 0,-4 a 1,1 0 0 0 -2,0 z m 4,0 a 4,4 0 0 0 8,0 l 0,-12 a 4,4 0 0 0 -8,0 z" />
<path id="pointerLock-icon" d="m 8,24 6,-5 5,10 4,-2 -5,-10 7,-1 -17,-14 z" />
<path id="popup-icon" d="m 2,24 a 4,4 0 0 0 4,4 l 8,0 a 10,10 0 0 1 -2,-4 l -4,0 a 2,2 0 0 1 -2,-2 l 0,-12 18,0 0,2 a 10,10 0 0 1 4,2 l 0,-8 a 4,4 0 0 0 -4,-4 l -18,0 a 4,4 0 0 0 -4,4 z m 12,-2.1 a 8,8 0 1 1 0,0.2 m 10.7,-4.3 a 5,5 0 0 0 -6.9,6.9 z m -5.4,8.4 a 5,5 0 0 0 6.9,-6.9 z" />
<path id="screen-icon" d="m 2,18 a 2,2 0 0 0 2,2 l 2,0 0,-6 a 4,4 0 0 1 4,-4 l 14,0 0,-6 a 2,2 0 0 0 -2,-2 l -18,0 a 2,2 0 0 0 -2,2 z m 6,10 a 2,2 0 0 0 2,2 l 18,0 a 2,2 0 0 0 2,-2 l 0,-14 a 2,2 0 0 0 -2,-2 l -18,0 a 2,2 0 0 0 -2,2 z" />
<clipPath id="clip">
<path d="m 0,0 0,31 31,-31 z m 6,32 26,0 0,-26 z"/>
</clipPath>
</defs>
<use id="camera" xlink:href="#camera-icon" />
<use id="camera-blocked" class="blocked" xlink:href="#camera-icon" />
<use id="desktop-notification" xlink:href="#desktop-notification-icon" />
<use id="desktop-notification-blocked" class="blocked" xlink:href="#desktop-notification-icon" />
<use id="geo-osx" xlink:href="#geo-osx-icon" />
<use id="geo-osx-blocked" class="blocked" xlink:href="#geo-osx-icon" />
<use id="geo-linux" xlink:href="#geo-linux-icon" />
<use id="geo-linux-blocked" class="blocked" xlink:href="#geo-linux-icon" />
<use id="geo-linux-detailed" xlink:href="#geo-linux-detailed-icon" />
<use id="geo-windows" xlink:href="#geo-windows-icon" />
<use id="geo-windows-blocked" class="blocked" xlink:href="#geo-windows-icon" />
<use id="geo-windows-detailed" xlink:href="#geo-windows-detailed-icon" />
<use id="indexedDB" xlink:href="#indexedDB-icon" />
<use id="indexedDB-blocked" class="blocked" xlink:href="#indexedDB-icon" />
<use id="login" xlink:href="#login-icon" />
<use id="login-detailed" xlink:href="#login-detailed-icon" />
<use id="microphone" xlink:href="#microphone-icon" />
<use id="microphone-blocked" class="blocked" xlink:href="#microphone-icon" />
<use id="microphone-detailed" xlink:href="#microphone-detailed-icon" />
<use id="pointerLock" xlink:href="#pointerLock-icon" />
<use id="pointerLock-blocked" class="blocked" xlink:href="#pointerLock-icon" />
<use id="popup" xlink:href="#popup-icon" />
<use id="screen" xlink:href="#screen-icon" />
<use id="screen-blocked" class="blocked" xlink:href="#screen-icon" />
<path id="strikeout" d="m 2,28 2,2 26,-26 -2,-2 z"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -112,6 +112,10 @@
list-style-image: url(chrome://browser/skin/glyphs.svg#desktop-notification);
}
.desktop-notification-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#desktop-notification-blocked);
}
.geo-icon {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/glyphs.svg#geo-osx);
@ -122,6 +126,16 @@
%endif
}
.geo-icon.blocked {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/glyphs.svg#geo-osx-blocked);
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
list-style-image: url(chrome://browser/skin/glyphs.svg#geo-linux-blocked);
%else
list-style-image: url(chrome://browser/skin/glyphs.svg#geo-windows-blocked);
%endif
}
.popup-notification-icon[popupid="geolocation"] {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/glyphs.svg#geo-osx);
@ -137,6 +151,10 @@
list-style-image: url(chrome://browser/skin/glyphs.svg#indexedDB);
}
.indexedDB-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#indexedDB-blocked);
}
.login-icon {
list-style-image: url(chrome://browser/skin/glyphs.svg#login);
}
@ -158,12 +176,20 @@
list-style-image: url(chrome://browser/skin/glyphs.svg#camera);
}
.camera-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#camera-blocked);
}
/* The first selector is used by socialchat.xml (bug 1275558). */
.webRTC-sharingMicrophone-notification-icon,
.microphone-icon {
list-style-image: url(chrome://browser/skin/glyphs.svg#microphone);
}
.microphone-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#microphone-blocked);
}
.popup-notification-icon[popupid="webRTC-shareMicrophone"],
.popup-notification-icon[popupid="webRTC-sharingMicrophone"] {
list-style-image: url(chrome://browser/skin/glyphs.svg#microphone-detailed);
@ -175,11 +201,20 @@
list-style-image: url(chrome://browser/skin/glyphs.svg#screen);
}
.screen-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#screen-blocked);
}
.popup-notification-icon[popupid="pointerLock"],
.pointerLock-icon {
list-style-image: url(chrome://browser/skin/glyphs.svg#pointerLock);
}
.pointerLock-icon.blocked {
list-style-image: url(chrome://browser/skin/glyphs.svg#pointerLock-blocked);
}
/* This icon has a block sign in it, so we don't need a blocked version. */
.popup-icon {
list-style-image: url("chrome://browser/skin/glyphs.svg#popup");
}

View File

@ -1540,12 +1540,13 @@ addAsyncAnimTest("tree_ordering", { observe: div, subtree: true }, function*() {
yield await_frame();
assert_records([], "records after assigning same value");
anim.currentTime = 500 * MS_PER_SEC;
anim.currentTime = anim.effect.timing.duration * 2;
anim.finish();
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after animation end");
anim.effect.timing.duration = 1000 * MS_PER_SEC;
anim.effect.timing.duration = anim.effect.timing.duration * 3;
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation restarted");

View File

@ -296,46 +296,99 @@ function find_(container, strategy, selector, searchFn, opts) {
}
/**
* Find a value by XPATH
* Find a single element by XPath expression.
*
* @param nsIDOMElement root
* Document root
* @param string value
* XPATH search string
* @param nsIDOMElement node
* start node
* @param {DOMElement} root
* Document root
* @param {DOMElement} startNode
* Where in the DOM hiearchy to begin searching.
* @param {string} expr
* XPath search expression.
*
* @return nsIDOMElement
* returns the found element
* @return {DOMElement}
* First element matching expression.
*/
function findByXPath(root, value, node) {
return root.evaluate(value, node, null,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
element.findByXPath = function(root, startNode, expr) {
let iter = root.evaluate(expr, startNode, null,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE, null)
return iter.singleNodeValue;
};
/**
* Find values by XPATH
* Find elements by XPath expression.
*
* @param nsIDOMElement root
* Document root
* @param string value
* XPATH search string
* @param nsIDOMElement node
* start node
* @param {DOMElement} root
* Document root.
* @param {DOMElement} startNode
* Where in the DOM hierarchy to begin searching.
* @param {string} expr
* XPath search expression.
*
* @return object
* returns a list of found nsIDOMElements
* @return {Array.<DOMElement>}
* Sequence of found elements matching expression.
*/
function findByXPathAll(root, value, node) {
let values = root.evaluate(value, node, null,
Ci.nsIDOMXPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
let elements = [];
let element = values.iterateNext();
while (element) {
elements.push(element);
element = values.iterateNext();
element.findByXPathAll = function(root, startNode, expr) {
let rv = [];
let iter = root.evaluate(expr, startNode, null,
Ci.nsIDOMXPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
let el = iter.iterateNext();
while (el) {
rv.push(el);
el = iter.iterateNext();
}
return elements;
return rv;
};
/**
* Find all hyperlinks dscendant of |node| which link text is |s|.
*
* @param {DOMElement} node
* Where in the DOM hierarchy to being searching.
* @param {string} s
* Link text to search for.
*
* @return {Array.<DOMAnchorElement>}
* Sequence of link elements which text is |s|.
*/
element.findByLinkText = function(node, s) {
return filterLinks(node, link => link.text === s);
};
/**
* Find all hyperlinks descendant of |node| which link text contains |s|.
*
* @param {DOMElement} node
* Where in the DOM hierachy to begin searching.
* @param {string} s
* Link text to search for.
*
* @return {Array.<DOMAnchorElement>}
* Sequence of link elements which text containins |s|.
*/
element.findByPartialLinkText = function(node, s) {
return filterLinks(node, link => link.text.indexOf(s) != -1);
};
/**
* Filters all hyperlinks that are descendant of |node| by |predicate|.
*
* @param {DOMElement} node
* Where in the DOM hierarchy to begin searching.
* @param {function(DOMAnchorElement): boolean} predicate
* Function that determines if given link should be included in
* return value or filtered away.
*
* @return {Array.<DOMAnchorElement>}
* Sequence of link elements matching |predicate|.
*/
function filterLinks(node, predicate) {
let rv = [];
for (let link of node.getElementsByTagName("a")) {
if (predicate(link)) {
rv.push(link);
}
}
return rv;
}
/**
@ -364,13 +417,13 @@ function findElement(using, value, rootNode, startNode) {
if (startNode.getElementById) {
return startNode.getElementById(value);
}
return findByXPath(rootNode, `.//*[@id="${value}"]`, startNode);
return element.findByXPath(rootNode, startNode, `.//*[@id="${value}"]`);
case element.Strategy.Name:
if (startNode.getElementsByName) {
return startNode.getElementsByName(value)[0];
}
return findByXPath(rootNode, `.//*[@name="${value}"]`, startNode);
return element.findByXPath(rootNode, startNode, `.//*[@name="${value}"]`);
case element.Strategy.ClassName:
// works for >= Firefox 3
@ -381,24 +434,23 @@ function findElement(using, value, rootNode, startNode) {
return startNode.getElementsByTagName(value)[0];
case element.Strategy.XPath:
return findByXPath(rootNode, value, startNode);
return element.findByXPath(rootNode, startNode, value);
// TODO(ato): Rewrite this, it's hairy:
case element.Strategy.LinkText:
case element.Strategy.PartialLinkText:
let el;
let allLinks = startNode.getElementsByTagName("A");
for (let i = 0; i < allLinks.length && !el; i++) {
let text = allLinks[i].text;
if (using == element.Strategy.PartialLinkText) {
if (text.indexOf(value) != -1) {
el = allLinks[i];
}
} else if (text == value) {
el = allLinks[i];
for (let link of startNode.getElementsByTagName("a")) {
if (link.text === value) {
return link;
}
}
return el;
break;
case element.Strategy.PartialLinkText:
for (let link of startNode.getElementsByTagName("a")) {
if (link.text.indexOf(value) != -1) {
return link;
}
}
break;
case element.Strategy.Selector:
try {
@ -446,13 +498,13 @@ function findElements(using, value, rootNode, startNode) {
// fall through
case element.Strategy.XPath:
return findByXPathAll(rootNode, value, startNode);
return element.findByXPathAll(rootNode, startNode, value);
case element.Strategy.Name:
if (startNode.getElementsByName) {
return startNode.getElementsByName(value);
}
return findByXPathAll(rootNode, `.//*[@name="${value}"]`, startNode);
return element.findByXPathAll(rootNode, startNode, `.//*[@name="${value}"]`);
case element.Strategy.ClassName:
return startNode.getElementsByClassName(value);
@ -461,20 +513,10 @@ function findElements(using, value, rootNode, startNode) {
return startNode.getElementsByTagName(value);
case element.Strategy.LinkText:
return element.findByLinkText(startNode, value);
case element.Strategy.PartialLinkText:
let els = [];
let allLinks = startNode.getElementsByTagName("A");
for (let i = 0; i < allLinks.length; i++) {
let text = allLinks[i].text;
if (using == element.Strategy.PartialLinkText) {
if (text.indexOf(value) != -1) {
els.push(allLinks[i]);
}
} else if (text == value) {
els.push(allLinks[i]);
}
}
return els;
return element.findByPartialLinkText(startNode, value);
case element.Strategy.Selector:
return startNode.querySelectorAll(value);

View File

@ -0,0 +1,466 @@
# 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/.
import re
import urllib
from marionette import MarionetteTestCase, skip
from marionette_driver.marionette import HTMLElement
from marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException, InvalidSelectorException
def inline(doc, doctype="html"):
if doctype == "html":
return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
elif doctype == "xhtml":
return "data:application/xhtml+xml,%s" % urllib.quote(
r"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>XHTML might be the future</title>
</head>
<body>
%s
</body>
</html>""" % doc)
id_html = inline("<p id=foo></p>", doctype="html")
id_xhtml = inline('<p id="foo"></p>', doctype="xhtml")
parent_child_html = inline("<div id=parent><p id=child></p></div>", doctype="html")
parent_child_xhtml = inline('<div id="parent"><p id="child"></p></div>', doctype="xhtml")
children_html = inline("<div><p>foo <p>bar</div>", doctype="html")
children_xhtml = inline("<div><p>foo</p> <p>bar</p></div>", doctype="xhtml")
class_html = inline("<p class='foo bar'>", doctype="html")
class_xhtml = inline('<p class="foo bar"></p>', doctype="xhtml")
name_html = inline("<p name=foo>", doctype="html")
name_xhtml = inline('<p name="foo"></p>', doctype="xhtml")
link_html = inline("<p><a href=#>foo bar</a>", doctype="html")
link_xhtml = inline('<p><a href="#">foo bar</a></p>', doctype="xhtml")
class TestFindElementHTML(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_search_timeout(0)
def test_id(self):
self.marionette.navigate(id_html)
expected = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.ID, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(expected, found)
def test_child_element(self):
self.marionette.navigate(parent_child_html)
parent = self.marionette.find_element(By.ID, "parent")
child = self.marionette.find_element(By.ID, "child")
found = parent.find_element(By.TAG_NAME, "p")
self.assertEqual(found.tag_name, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(child, found)
def test_tag_name(self):
self.marionette.navigate(children_html)
el = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.TAG_NAME, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_class_name(self):
self.marionette.navigate(class_html)
el = self.marionette.execute_script("return document.querySelector('.foo')")
found = self.marionette.find_element(By.CLASS_NAME, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_by_name(self):
self.marionette.navigate(name_html)
el = self.marionette.execute_script("return document.querySelector('[name=foo]')")
found = self.marionette.find_element(By.NAME, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_css_selector(self):
self.marionette.navigate(children_html)
el = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.CSS_SELECTOR, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_invalid_css_selector_should_throw(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element(By.CSS_SELECTOR, "#")
def test_link_text(self):
self.marionette.navigate(link_html)
el = self.marionette.execute_script("return document.querySelector('a')")
found = self.marionette.find_element(By.LINK_TEXT, "foo bar")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_partial_link_text(self):
self.marionette.navigate(link_html)
el = self.marionette.execute_script("return document.querySelector('a')")
found = self.marionette.find_element(By.PARTIAL_LINK_TEXT, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_xpath(self):
self.marionette.navigate(id_html)
el = self.marionette.execute_script("return document.querySelector('#foo')")
found = self.marionette.find_element(By.XPATH, "id('foo')")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_not_found(self):
self.marionette.set_search_timeout(0)
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.XPATH, "cheese")
def test_not_found_implicit_wait(self):
self.marionette.set_search_timeout(50)
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.XPATH, "cheese")
def test_not_found(self):
self.marionette.set_search_timeout(0)
self.marionette.navigate(id_html)
el = self.marionette.find_element(By.ID, "foo")
self.assertRaises(NoSuchElementException, el.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.XPATH, "cheese")
def test_not_found_implicit_wait(self):
self.marionette.set_search_timeout(50)
self.marionette.navigate(id_html)
el = self.marionette.find_element(By.ID, "foo")
self.assertRaises(NoSuchElementException, el.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, el.find_element, By.XPATH, "cheese")
def test_css_selector_scope_doesnt_start_at_rootnode(self):
self.marionette.navigate(parent_child_html)
el = self.marionette.find_element(By.ID, "child")
parent = self.marionette.find_element(By.ID, "parent")
found = parent.find_element(By.CSS_SELECTOR, "p")
self.assertEqual(el, found)
def test_unknown_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_elements("foo", "bar")
def test_element_id_is_valid_uuid(self):
self.marionette.navigate(id_html)
el = self.marionette.find_element(By.TAG_NAME, "p")
uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
self.assertIsNotNone(re.search(uuid_regex, el.id),
'UUID for the WebElement is not valid. ID is {}'\
.format(el.id))
def test_invalid_xpath_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element(By.XPATH, "count(//input)")
with self.assertRaises(InvalidSelectorException):
parent = self.marionette.execute_script("return document.documentElement")
parent.find_element(By.XPATH, "count(//input)")
def test_invalid_css_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element(By.CSS_SELECTOR, "")
with self.assertRaises(InvalidSelectorException):
parent = self.marionette.execute_script("return document.documentElement")
parent.find_element(By.CSS_SELECTOR, "")
def test_finding_active_element_returns_element(self):
self.marionette.navigate(id_html)
active = self.marionette.execute_script("return document.activeElement")
self.assertEqual(active, self.marionette.get_active_element())
class TestFindElementXHTML(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_search_timeout(0)
def test_id(self):
self.marionette.navigate(id_xhtml)
expected = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.ID, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(expected, found)
def test_child_element(self):
self.marionette.navigate(parent_child_xhtml)
parent = self.marionette.find_element(By.ID, "parent")
child = self.marionette.find_element(By.ID, "child")
found = parent.find_element(By.TAG_NAME, "p")
self.assertEqual(found.tag_name, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(child, found)
def test_tag_name(self):
self.marionette.navigate(children_xhtml)
el = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.TAG_NAME, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_class_name(self):
self.marionette.navigate(class_xhtml)
el = self.marionette.execute_script("return document.querySelector('.foo')")
found = self.marionette.find_element(By.CLASS_NAME, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_by_name(self):
self.marionette.navigate(name_xhtml)
el = self.marionette.execute_script("return document.querySelector('[name=foo]')")
found = self.marionette.find_element(By.NAME, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_css_selector(self):
self.marionette.navigate(children_xhtml)
el = self.marionette.execute_script("return document.querySelector('p')")
found = self.marionette.find_element(By.CSS_SELECTOR, "p")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_link_text(self):
self.marionette.navigate(link_xhtml)
el = self.marionette.execute_script("return document.querySelector('a')")
found = self.marionette.find_element(By.LINK_TEXT, "foo bar")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_partial_link_text(self):
self.marionette.navigate(link_xhtml)
el = self.marionette.execute_script("return document.querySelector('a')")
found = self.marionette.find_element(By.PARTIAL_LINK_TEXT, "foo")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_xpath(self):
self.marionette.navigate(id_xhtml)
el = self.marionette.execute_script("return document.querySelector('#foo')")
found = self.marionette.find_element(By.XPATH, "id('foo')")
self.assertIsInstance(found, HTMLElement)
self.assertEqual(el, found)
def test_css_selector_scope_does_not_start_at_rootnode(self):
self.marionette.navigate(parent_child_xhtml)
el = self.marionette.find_element(By.ID, "child")
parent = self.marionette.find_element(By.ID, "parent")
found = parent.find_element(By.CSS_SELECTOR, "p")
self.assertEqual(el, found)
def test_active_element(self):
self.marionette.navigate(id_xhtml)
active = self.marionette.execute_script("return document.activeElement")
self.assertEqual(active, self.marionette.get_active_element())
class TestFindElementsHTML(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_search_timeout(0)
def assertItemsIsInstance(self, items, typ):
for item in items:
self.assertIsInstance(item, typ)
def test_child_elements(self):
self.marionette.navigate(children_html)
parent = self.marionette.find_element(By.TAG_NAME, "div")
children = self.marionette.find_elements(By.TAG_NAME, "p")
found = parent.find_elements(By.TAG_NAME, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(found, children)
def test_tag_name(self):
self.marionette.navigate(children_html)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.TAG_NAME, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_class_name(self):
self.marionette.navigate(class_html)
els = self.marionette.execute_script("return document.querySelectorAll('.foo')")
found = self.marionette.find_elements(By.CLASS_NAME, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_by_name(self):
self.marionette.navigate(name_html)
els = self.marionette.execute_script("return document.querySelectorAll('[name=foo]')")
found = self.marionette.find_elements(By.NAME, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_css_selector(self):
self.marionette.navigate(children_html)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.CSS_SELECTOR, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_invalid_css_selector_should_throw(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_elements(By.CSS_SELECTOR, "#")
def test_link_text(self):
self.marionette.navigate(link_html)
els = self.marionette.execute_script("return document.querySelectorAll('a')")
found = self.marionette.find_elements(By.LINK_TEXT, "foo bar")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_partial_link_text(self):
self.marionette.navigate(link_html)
els = self.marionette.execute_script("return document.querySelectorAll('a')")
found = self.marionette.find_elements(By.PARTIAL_LINK_TEXT, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_xpath(self):
self.marionette.navigate(children_html)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.XPATH, ".//p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_css_selector_scope_doesnt_start_at_rootnode(self):
self.marionette.navigate(parent_child_html)
els = self.marionette.find_elements(By.ID, "child")
parent = self.marionette.find_element(By.ID, "parent")
found = parent.find_elements(By.CSS_SELECTOR, "p")
self.assertSequenceEqual(els, found)
def test_unknown_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element("foo", "bar")
def test_element_id_is_valid_uuid(self):
self.marionette.navigate(id_html)
els = self.marionette.find_elements(By.TAG_NAME, "p")
uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
self.assertIsNotNone(re.search(uuid_regex, els[0].id),
'UUID for the WebElement is not valid. ID is {}'\
.format(els[0].id))
def test_invalid_xpath_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_elements(By.XPATH, "count(//input)")
with self.assertRaises(InvalidSelectorException):
parent = self.marionette.execute_script("return document.documentElement")
parent.find_elements(By.XPATH, "count(//input)")
def test_invalid_css_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_elements(By.CSS_SELECTOR, "")
with self.assertRaises(InvalidSelectorException):
parent = self.marionette.execute_script("return document.documentElement")
parent.find_elements(By.CSS_SELECTOR, "")
class TestFindElementsXHTML(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_search_timeout(0)
def assertItemsIsInstance(self, items, typ):
for item in items:
self.assertIsInstance(item, typ)
def test_child_elements(self):
self.marionette.navigate(children_xhtml)
parent = self.marionette.find_element(By.TAG_NAME, "div")
children = self.marionette.find_elements(By.TAG_NAME, "p")
found = parent.find_elements(By.TAG_NAME, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(found, children)
def test_tag_name(self):
self.marionette.navigate(children_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.TAG_NAME, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_class_name(self):
self.marionette.navigate(class_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('.foo')")
found = self.marionette.find_elements(By.CLASS_NAME, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_by_name(self):
self.marionette.navigate(name_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('[name=foo]')")
found = self.marionette.find_elements(By.NAME, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_css_selector(self):
self.marionette.navigate(children_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.CSS_SELECTOR, "p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_link_text(self):
self.marionette.navigate(link_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('a')")
found = self.marionette.find_elements(By.LINK_TEXT, "foo bar")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_partial_link_text(self):
self.marionette.navigate(link_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('a')")
found = self.marionette.find_elements(By.PARTIAL_LINK_TEXT, "foo")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
@skip("XHTML namespace not yet supported")
def test_xpath(self):
self.marionette.navigate(children_xhtml)
els = self.marionette.execute_script("return document.querySelectorAll('p')")
found = self.marionette.find_elements(By.XPATH, "//xhtml:p")
self.assertItemsIsInstance(found, HTMLElement)
self.assertSequenceEqual(els, found)
def test_css_selector_scope_doesnt_start_at_rootnode(self):
self.marionette.navigate(parent_child_xhtml)
els = self.marionette.find_elements(By.ID, "child")
parent = self.marionette.find_element(By.ID, "parent")
found = parent.find_elements(By.CSS_SELECTOR, "p")
self.assertSequenceEqual(els, found)

View File

@ -1,209 +0,0 @@
# 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/.
import re
from marionette import MarionetteTestCase
from marionette_driver.marionette import HTMLElement
from marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException, InvalidSelectorException
class TestElements(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_search_timeout(0)
url = self.marionette.absolute_url("test.html")
self.marionette.navigate(url)
def test_id(self):
el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
found_el = self.marionette.find_element(By.ID, "mozLink")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_child_element(self):
el = self.marionette.find_element(By.ID, "divLink")
div = self.marionette.find_element(By.ID, "testDiv")
found_el = div.find_element(By.TAG_NAME, "a")
self.assertEqual("a", found_el.tag_name)
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_child_elements(self):
el = self.marionette.find_element(By.ID, "divLink2")
div = self.marionette.find_element(By.ID, "testDiv")
found_els = div.find_elements(By.TAG_NAME, "a")
self.assertTrue(el.id in [found_el.id for found_el in found_els])
def test_tag_name(self):
el = self.marionette.execute_script("return window.document.getElementsByTagName('body')[0];")
found_el = self.marionette.find_element(By.TAG_NAME, "body")
self.assertEqual('body', found_el.tag_name)
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.TAG_NAME, "body")[0]
self.assertEqual('body', found_el.tag_name)
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_class_name(self):
el = self.marionette.execute_script("return window.document.getElementsByClassName('linkClass')[0];")
found_el = self.marionette.find_element(By.CLASS_NAME, "linkClass")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.CLASS_NAME, "linkClass")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_by_name(self):
el = self.marionette.execute_script("return window.document.getElementsByName('myInput')[0];")
found_el = self.marionette.find_element(By.NAME, "myInput")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.NAME, "myInput")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_css_selector(self):
el = self.marionette.execute_script("return window.document.getElementById('testh1');")
found_el = self.marionette.find_element(By.CSS_SELECTOR, "h1")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.CSS_SELECTOR, "h1")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_invalid_css_selector_should_throw(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element(By.CSS_SELECTOR, "#")
def test_link_text(self):
el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
found_el = self.marionette.find_element(By.LINK_TEXT, "Click me!")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.LINK_TEXT, "Click me!")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_partial_link_text(self):
el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
found_el = self.marionette.find_element(By.PARTIAL_LINK_TEXT, "Click m")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.PARTIAL_LINK_TEXT, "Click m")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_xpath(self):
el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
found_el = self.marionette.find_element(By.XPATH, "id('mozLink')")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
found_el = self.marionette.find_elements(By.XPATH, "id('mozLink')")[0]
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_not_found(self):
self.marionette.set_search_timeout(0)
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.XPATH, "cheese")
def test_not_found_implicit_wait(self):
self.marionette.set_search_timeout(50)
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CLASS_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.CSS_SELECTOR, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.PARTIAL_LINK_TEXT, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.TAG_NAME, "cheese")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.XPATH, "cheese")
def test_timeout_element(self):
button = self.marionette.find_element(By.ID, "createDivButton")
button.click()
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "newDiv")
self.assertTrue(True, self.marionette.set_search_timeout(8000))
self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "newDiv")))
def test_timeout_elements(self):
button = self.marionette.find_element(By.ID, "createDivButton")
button.click()
self.assertEqual(len(self.marionette.find_elements(By.ID, "newDiv")), 0)
self.assertTrue(True, self.marionette.set_search_timeout(8000))
self.assertEqual(len(self.marionette.find_elements(By.ID, "newDiv")), 1)
def test_css_selector_scope_doesnt_start_at_rootnode(self):
el = self.marionette.find_element(By.ID, "mozLink")
nav_el = self.marionette.find_element(By.ID, "testDiv")
found_els = nav_el.find_elements(By.CSS_SELECTOR, "a")
self.assertFalse(el.id in [found_el.id for found_el in found_els])
def test_finding_active_element_returns_element(self):
body = self.marionette.find_element(By.TAG_NAME, "body")
self.assertEqual(body, self.marionette.get_active_element())
def test_unknown_selector(self):
with self.assertRaises(InvalidSelectorException):
self.marionette.find_element("foo", "bar")
def test_element_id_is_valid_uuid(self):
el = self.marionette.find_element(By.TAG_NAME, "body")
uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
self.assertIsNotNone(re.search(uuid_regex, el.id),
'UUID for the WebElement is not valid. ID is {}'\
.format(el.id))
def test_should_find_elements_by_link_text(self):
url = self.marionette.absolute_url("nestedElements.html")
self.marionette.navigate(url)
element = self.marionette.find_element(By.NAME, "div1")
children = element.find_elements(By.LINK_TEXT, "hello world")
self.assertEqual(len(children), 2)
self.assertEqual("link1", children[0].get_attribute("name"))
self.assertEqual("link2", children[1].get_attribute("name"))
def test_should_throw_invalidselectorexception_when_invalid_xPath_in_driver_find_element(self):
url = self.marionette.absolute_url("formPage.html")
self.marionette.navigate(url)
self.assertRaises(InvalidSelectorException, self.marionette.find_element, By.XPATH, "count(//input)")
def test_should_throw_invalidselectorexception_when_invalid_xpath_in_driver_find_elements(self):
url = self.marionette.absolute_url("formPage.html")
self.marionette.navigate(url)
self.assertRaises(InvalidSelectorException, self.marionette.find_elements, By.XPATH, "count(//input)")
def test_should_throw_invalidselectorexception_when_invalid_xpath_in_element_find_element(self):
url = self.marionette.absolute_url("formPage.html")
self.marionette.navigate(url)
body = self.marionette.find_element(By.TAG_NAME, "body")
self.assertRaises(InvalidSelectorException, body.find_element, By.XPATH, "count(//input)")
def test_should_throw_invalidselectorexception_when_invalid_xpath_in_element_find_elements(self):
url = self.marionette.absolute_url("formPage.html")
self.marionette.navigate(url)
body = self.marionette.find_element(By.TAG_NAME, "body")
self.assertRaises(InvalidSelectorException, body.find_elements, By.XPATH, "count(//input)")
def test_should_throw_invalidselectorexception_when_css_is_empty_in_driver_find_element(self):
self.assertRaises(InvalidSelectorException, self.marionette.find_element, By.CSS_SELECTOR, "")
def test_should_throw_invalidselectorexception_when_css_is_empty_in_driver_find_elements(self):
self.assertRaises(InvalidSelectorException, self.marionette.find_elements, By.CSS_SELECTOR, "")
def test_should_throw_invalidselectorexception_when_css_is_empty_in_element_find_element(self):
body = self.marionette.find_element(By.TAG_NAME, "body")
self.assertRaises(InvalidSelectorException, body.find_element, By.CSS_SELECTOR, "")
def test_should_throw_invalidselectorexception_when_css_is_empty_in_element_find_elements(self):
body = self.marionette.find_element(By.TAG_NAME, "body")
self.assertRaises(InvalidSelectorException, body.find_elements, By.CSS_SELECTOR, "")

View File

@ -39,7 +39,7 @@ skip-if = buildapp == 'b2g'
[test_execute_async_script.py]
[test_execute_script.py]
[test_simpletest_fail.js]
[test_findelement.py]
[test_element_retrieval.py]
[test_findelement_chrome.py]
skip-if = buildapp == 'b2g'

View File

@ -1258,7 +1258,6 @@ var Impl = {
simpleMeasurements: simpleMeasurements,
histograms: protect(() => this.getHistograms(isSubsession, clearSubsession)),
keyedHistograms: protect(() => this.getKeyedHistograms(isSubsession, clearSubsession)),
scalars: protect(() => this.getScalars(isSubsession, clearSubsession)),
};
// Add extended set measurements common to chrome & content processes
@ -1273,6 +1272,13 @@ var Impl = {
return payloadObj;
}
// Set the scalars for the parent process.
payloadObj.processes = {
parent: {
scalars: protect(() => this.getScalars(isSubsession, clearSubsession)),
}
};
// Additional payload for chrome process.
payloadObj.info = info;

View File

@ -242,13 +242,14 @@ function checkPayloadInfo(data) {
Assert.ok(data.timezoneOffset <= 12*60, "The timezone must be in a valid range.");
}
function checkScalars(payload) {
function checkScalars(processes) {
// Check that the scalars section is available in the ping payload.
Assert.ok("scalars" in payload, "The scalars section must be available in the payload.");
Assert.equal(typeof payload.scalars, "object", "The scalars entry must be an object.");
const parentProcess = processes.parent;
Assert.ok("scalars" in parentProcess, "The scalars section must be available in the parent process.");
Assert.equal(typeof parentProcess.scalars, "object", "The scalars entry must be an object.");
// Check that we have valid scalar entries.
const scalars = payload.scalars;
const scalars = parentProcess.scalars;
for (let name in scalars) {
Assert.equal(typeof name, "string", "Scalar names must be strings.");
// Check if the value is of a supported type.
@ -403,7 +404,9 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
};
Assert.deepEqual(expected_keyed_count, keyedHistograms[TELEMETRY_TEST_KEYED_COUNT]);
checkScalars(payload);
Assert.ok("processes" in payload, "The payload must have a processes section.");
Assert.ok("parent" in payload.processes, "There must be at least a parent process.");
checkScalars(payload.processes);
}
function writeStringToFile(file, contents) {
@ -608,25 +611,25 @@ add_task(function* test_checkSubsessionScalars() {
const TEST_SCALARS = [ UINT_SCALAR, STRING_SCALAR ];
for (let name of TEST_SCALARS) {
// Scalar must be reported in subsession pings (e.g. main).
Assert.ok(name in subsession.scalars,
Assert.ok(name in subsession.processes.parent.scalars,
name + " must be reported in a subsession ping.");
}
// No scalar must be reported in classic pings (e.g. saved-session).
Assert.ok(Object.keys(classic.scalars).length == 0,
Assert.ok(Object.keys(classic.processes.parent.scalars).length == 0,
"Scalars must not be reported in a classic ping.");
// And make sure that we're getting the right values in the
// subsession ping.
Assert.equal(subsession.scalars[UINT_SCALAR], expectedUint,
Assert.equal(subsession.processes.parent.scalars[UINT_SCALAR], expectedUint,
UINT_SCALAR + " must contain the expected value.");
Assert.equal(subsession.scalars[STRING_SCALAR], expectedString,
Assert.equal(subsession.processes.parent.scalars[STRING_SCALAR], expectedString,
STRING_SCALAR + " must contain the expected value.");
// Since we cleared the subsession in the last getPayload(), check that
// breaking subsessions clears the scalars.
subsession = TelemetrySession.getPayload("environment-change");
for (let name of TEST_SCALARS) {
Assert.ok(!(name in subsession.scalars),
Assert.ok(!(name in subsession.processes.parent.scalars),
name + " must be cleared with the new subsession.");
}
@ -636,9 +639,9 @@ add_task(function* test_checkSubsessionScalars() {
Telemetry.scalarSet(UINT_SCALAR, expectedUint);
Telemetry.scalarSet(STRING_SCALAR, expectedString);
subsession = TelemetrySession.getPayload("environment-change");
Assert.equal(subsession.scalars[UINT_SCALAR], expectedUint,
Assert.equal(subsession.processes.parent.scalars[UINT_SCALAR], expectedUint,
UINT_SCALAR + " must contain the expected value.");
Assert.equal(subsession.scalars[STRING_SCALAR], expectedString,
Assert.equal(subsession.processes.parent.scalars[STRING_SCALAR], expectedString,
STRING_SCALAR + " must contain the expected value.");
});

View File

@ -1559,7 +1559,11 @@ var Scalars = {
let scalarsSection = document.getElementById("scalars");
removeAllChildNodes(scalarsSection);
let scalars = aPayload.scalars;
if (!aPayload.processes || !aPayload.processes.parent) {
return;
}
let scalars = aPayload.processes.parent.scalars;
const hasData = scalars && Object.keys(scalars).length > 0;
setHasData("scalars-section", hasData);
if (!hasData) {