merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-07-06 11:41:53 +02:00
commit 8e2d371484
62 changed files with 432 additions and 618 deletions

View File

@ -67,7 +67,7 @@
<label id="generatePassphraseButton"
hidden="true"
value="&syncGenerateNewKey.label;"
class="text-link inline-link"
class="text-link"
onclick="event.stopPropagation();
Change.doGeneratePassphrase();"/>
</hbox>

View File

@ -183,12 +183,12 @@
onclick="document.getElementById('tos').focus();
document.getElementById('tos').click()">
&setup.tosAgree1.label;
<label class="text-link inline-link"
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openToS();">
&setup.tosLink.label;
</label>
&setup.tosAgree2.label;
<label class="text-link inline-link"
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();">
&setup.ppLink.label;
</label>

View File

@ -136,9 +136,9 @@
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<html:a
class="inline-link" id="doNotTrackSettings" href="#"
>&doNotTrack.settings.label;</html:a>&doNotTrack.post.label;</description>
<description>&doNotTrack.pre.label;<label
class="text-link" id="doNotTrackSettings"
>&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
</vbox>
</groupbox>
@ -165,11 +165,11 @@
<vbox flex="1">
<description>&rememberDescription.label;</description>
<separator class="thin"/>
<description>&rememberActions.pre.label;<html:a
class="inline-link" id="historyRememberClear" href="#"
>&rememberActions.clearHistory.label;</html:a>&rememberActions.middle.label;<html:a
class="inline-link" id="historyRememberCookies" href="#"
>&rememberActions.removeCookies.label;</html:a>&rememberActions.post.label;</description>
<description>&rememberActions.pre.label;<label
class="text-link" id="historyRememberClear"
>&rememberActions.clearHistory.label;</label>&rememberActions.middle.label;<label
class="text-link" id="historyRememberCookies"
>&rememberActions.removeCookies.label;</label>&rememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
@ -178,9 +178,9 @@
<vbox flex="1">
<description>&dontrememberDescription.label;</description>
<separator class="thin"/>
<description>&dontrememberActions.pre.label;<html:a
class="inline-link" id="historyDontRememberClear" href="#"
>&dontrememberActions.clearHistory.label;</html:a>&dontrememberActions.post.label;</description>
<description>&dontrememberActions.pre.label;<label
class="text-link" id="historyDontRememberClear"
>&dontrememberActions.clearHistory.label;</label>&dontrememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>

View File

@ -40,7 +40,7 @@ skip-if = os != "mac" # modal dialog disabling only working on OS X.
[browser_UITour_panel_close_annotation.js]
skip-if = true # Disabled due to frequent failures, bugs 1026310 and 1032137
[browser_UITour_pocket.js]
skip-if = os == "linux" || debug
skip-if = true # Disabled pending removal of pocket UI Tour
[browser_UITour_registerPageID.js]
[browser_UITour_resetProfile.js]
[browser_UITour_sync.js]

View File

@ -128,6 +128,24 @@ var pktUI = (function() {
* Show the sign-up panel
*/
function showSignUp() {
// AB test: Direct logged-out users to tab vs panel
if (pktApi.getSignupPanelTabTestVariant() == 'tab')
{
let site = Services.prefs.getCharPref("extensions.pocket.site");
openTabWithUrl('https://' + site + '/firefox_learnmore?src=ff_ext&s=ffi&t=buttonclick', true);
// force the panel closed before it opens
// wrapped in setTimeout to avoid race condition after logging out
// if this test goes to 100%, we should move this logic up before
// the panel is actually opened
setTimeout(function() {
getPanel().hidePopup();
}, 0);
return;
}
// Control: Show panel as normal
getFirefoxAccountSignedInUser(function(userdata)
{
var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0';
@ -138,7 +156,7 @@ var pktUI = (function() {
{
startheight = overflowMenuHeight;
}
else if (pktApi.getSignupAB().indexOf('storyboard') > -1)
else
{
startheight = 460;
if (fxasignedin == '1')
@ -146,13 +164,6 @@ var pktUI = (function() {
startheight = 406;
}
}
else
{
if (fxasignedin == '1')
{
startheight = 436;
}
}
var variant;
if (inOverflowMenu)
{
@ -160,16 +171,17 @@ var pktUI = (function() {
}
else
{
variant = pktApi.getSignupAB();
variant = 'storyboard_lm';
}
var panelId = showPanel("about:pocket-signup?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
onShow: function() {
},
onHide: panelDidHide,
width: inOverflowMenu ? overflowMenuWidth : 300,
height: startheight
});
});
});
}
/**

View File

@ -104,7 +104,7 @@ PKT_SIGNUP_OVERLAY.prototype = {
this.dictJSON.variant = (this.variant ? this.variant : 'undefined');
this.dictJSON.variant += this.fxasignedin ? '_fxa' : '_nonfxa';
this.dictJSON.pockethost = this.pockethost;
this.dictJSON.showlearnmore = (this.variant.indexOf('_lm') > -1 || this.variant == 'storyboard' || this.variant == 'hero') ? 1 : 0;
this.dictJSON.showlearnmore = true;
// extra modifier class for collapsed state
if (this.inoverflowmenu)
@ -119,13 +119,13 @@ PKT_SIGNUP_OVERLAY.prototype = {
}
// Create actual content
if (this.variant == 'storyboard' || this.variant == 'storyboard_lm' || this.variant == 'storyboard_nlm')
if (this.variant == 'overflow')
{
$('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
$('body').append(Handlebars.templates.signup_shell(this.dictJSON));
}
else
{
$('body').append(Handlebars.templates.signup_shell(this.dictJSON));
$('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
}

View File

@ -609,24 +609,32 @@ var pktApi = (function() {
/**
* Helper function to get current signup AB group the user is in
*/
function getSignupAB() {
var setting = getSetting('signupAB');
if (!setting || setting.includes('hero'))
{
var rand = (Math.floor(Math.random()*100+1));
if (rand > 90)
{
setting = 'storyboard_nlm';
}
else
{
setting = 'storyboard_lm';
}
setSetting('signupAB',setting);
}
return setting;
function getSignupPanelTabTestVariant() {
return getSimpleTestOption('panelTab', 0.1, 'tab');
}
function getSimpleTestOption(testName, threshold, testOptionName) {
// Get the test from preferences if we've already assigned the user to a test
var settingName = 'test.' + testName;
var assignedValue = getSetting(settingName);
// If not assigned yet, pick and store a value
if (!assignedValue)
{
if (Math.random() <= threshold) {
assignedValue = testOptionName;
}
else {
assignedValue = 'control';
}
setSetting('test.'+testName, assignedValue);
}
return assignedValue;
}
/**
* Public functions
*/
@ -641,6 +649,6 @@ var pktApi = (function() {
isPremiumUser: isPremiumUser,
getSuggestedTagsForItem: getSuggestedTagsForItem,
getSuggestedTagsForURL: getSuggestedTagsForURL,
getSignupAB: getSignupAB
getSignupPanelTabTestVariant: getSignupPanelTabTestVariant,
};
}());

View File

@ -10,7 +10,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>firefox@getpocket.com</em:id>
<em:version>1.0.3b1</em:version>
<em:version>1.0.4</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>

View File

@ -82,9 +82,6 @@ browser.jar:
skin/classic/browser/places/unsortedBookmarks.png (places/unsortedBookmarks.png)
skin/classic/browser/places/downloads.png (places/downloads.png)
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
skin/classic/browser/preferences/mail.png (preferences/mail.png)
skin/classic/browser/preferences/Options.png (preferences/Options.png)
skin/classic/browser/preferences/Options-sync.png (preferences/Options-sync.png)
skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -6,59 +6,10 @@
*/
/* Global Styles */
#BrowserPreferences radio[pane] {
list-style-image: url("chrome://browser/skin/preferences/Options.png");
}
radio[pane=paneMain] {
-moz-image-region: rect(0px, 32px, 32px, 0px)
}
radio[pane=paneTabs] {
-moz-image-region: rect(0px, 64px, 32px, 32px)
}
#BrowserPreferences radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
.checkbox-check {
-moz-appearance: checkbox;
}
radio[pane=paneContent] {
-moz-image-region: rect(0px, 96px, 32px, 64px)
}
radio[pane=paneApplications] {
-moz-image-region: rect(0px, 128px, 32px, 96px)
}
radio[pane=panePrivacy] {
-moz-image-region: rect(0px, 160px, 32px, 128px)
}
radio[pane=paneSecurity] {
-moz-image-region: rect(0px, 192px, 32px, 160px)
}
radio[pane=paneAdvanced] {
-moz-image-region: rect(0px, 224px, 32px, 192px)
}
radio[pane=paneSync] {
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png") !important;
}
/* These lines should be removed as part of fixing bug 1140495 */
label.small {
font-size: smaller;
}
#tabPrefsBox {
margin: 5px;
}
/* General Pane */
#useFirefoxSync,
#getStarted {
@ -75,27 +26,6 @@ label.small {
cursor: pointer;
}
/* Applications Pane */
#BrowserPreferences[animated="true"] #handlersView {
height: 25em;
}
#BrowserPreferences[animated="false"] #handlersView {
-moz-box-flex: 1;
}
/* Privacy Pane */
/* styles for the link elements copied from .text-link in global.css */
.inline-link {
color: -moz-nativehyperlinktext;
text-decoration: none;
}
.inline-link:hover {
text-decoration: underline;
}
/* Modeless Window Dialogs */
.windowDialog,
.windowDialog prefpane {
@ -118,20 +48,10 @@ label.small {
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#paneApplications {
margin-left: 4px;
margin-right: 4px;
padding-left: 0;
padding-right: 0;
}
#linksOpenInBox {
margin-top: 5px;
}
#paneAdvanced {
padding-bottom: 10px;
}
#advancedPrefs {
margin-left: 0;
margin-right: 0;

View File

@ -129,17 +129,11 @@ browser.jar:
skin/classic/browser/places/livemark-item.png (places/livemark-item.png)
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
skin/classic/browser/preferences/application.png (preferences/application.png)
skin/classic/browser/preferences/Options.png (preferences/Options.png)
skin/classic/browser/preferences/Options-sync.png (preferences/Options-sync.png)
skin/classic/browser/preferences/saveFile.png (preferences/saveFile.png)
* skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)
skin/classic/browser/preferences/checkbox.png (preferences/checkbox.png)
skin/classic/browser/preferences/checkbox@2x.png (preferences/checkbox@2x.png)
skin/classic/browser/yosemite/preferences/checkbox.png (preferences/checkbox-yosemite.png)
skin/classic/browser/yosemite/preferences/checkbox@2x.png (preferences/checkbox-yosemite@2x.png)
skin/classic/browser/social/services-16.png (social/services-16.png)
skin/classic/browser/social/services-16@2x.png (social/services-16@2x.png)
skin/classic/browser/social/services-64.png (social/services-64.png)
@ -255,8 +249,6 @@ browser.jar:
% override chrome://browser/skin/menuPanel-help@2x.png chrome://browser/skin/yosemite/menuPanel-help@2x.png os=Darwin osversion>=10.10
% override chrome://browser/skin/menuPanel-small.png chrome://browser/skin/yosemite/menuPanel-small.png os=Darwin osversion>=10.10
% override chrome://browser/skin/menuPanel-small@2x.png chrome://browser/skin/yosemite/menuPanel-small@2x.png os=Darwin osversion>=10.10
% override chrome://browser/skin/preferences/checkbox.png chrome://browser/skin/yosemite/preferences/checkbox.png os=Darwin osversion>=10.10
% override chrome://browser/skin/preferences/checkbox@2x.png chrome://browser/skin/yosemite/preferences/checkbox@2x.png os=Darwin osversion>=10.10
% override chrome://browser/skin/reload-stop-go.png chrome://browser/skin/yosemite/reload-stop-go.png os=Darwin osversion>=10.10
% override chrome://browser/skin/reload-stop-go@2x.png chrome://browser/skin/yosemite/reload-stop-go@2x.png os=Darwin osversion>=10.10
% override chrome://browser/skin/sync-horizontalbar.png chrome://browser/skin/yosemite/sync-horizontalbar.png os=Darwin osversion>=10.10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -15,79 +15,7 @@
font: -moz-dialog;
}
.paneSelector {
list-style-image: url("chrome://browser/skin/preferences/Options.png");
}
/* ----- GENERAL BUTTON ----- */
radio[pane=paneGeneral],
radio[pane=paneMain] {
-moz-image-region: rect(0px, 32px, 32px, 0px);
}
/* ----- TABS BUTTON ----- */
radio[pane=paneTabs] {
-moz-image-region: rect(0px, 64px, 32px, 32px);
}
/* ----- SEARCH BUTTON ----- */
radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
/* ----- CONTENT BUTTON ----- */
radio[pane=paneContent] {
-moz-image-region: rect(0px, 96px, 32px, 64px);
}
/* ----- APPLICATIONS BUTTON ----- */
radio[pane=paneApplications] {
-moz-image-region: rect(0px, 128px, 32px, 96px);
}
/* ----- PRIVACY BUTTON ----- */
radio[pane=panePrivacy] {
-moz-image-region: rect(0px, 160px, 32px, 128px);
}
/* ----- SECURITY BUTTON ----- */
radio[pane=paneSecurity] {
-moz-image-region: rect(0px, 192px, 32px, 160px);
}
/* ----- ADVANCED BUTTON ----- */
radio[pane=paneAdvanced] {
-moz-image-region: rect(0px, 224px, 32px, 192px);
}
/* ----- SYNC BUTTON ----- */
radio[pane=paneSync] {
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png");
}
/* These lines should be removed as part of fixing bug 1140495 */
label.small {
font-size: smaller;
}
/* ----- APPLICATIONS PREFPANE ----- */
#BrowserPreferences[animated="true"] #handlersView {
height: 25em;
}
#BrowserPreferences[animated="false"] #handlersView {
-moz-box-flex: 1;
}
description {
font: small-caption;
font-weight: normal;
@ -100,14 +28,6 @@ prefpane .groupbox-body {
padding: 8px 4px 4px 4px;
}
#paneTabs > groupbox {
margin: 0;
}
#tabPrefsBox {
margin: 12px 4px;
}
prefpane .groupbox-title {
background: url("chrome://global/skin/50pct_transparent_grey.png") repeat-x bottom left;
margin-bottom: 4px;
@ -123,22 +43,6 @@ caption {
padding-bottom: 2px;
}
#paneMain description,
#paneContent description,
#paneAdvanced description,
#paneSecurity description {
font: -moz-dialog;
}
#paneContent {
padding-top: 8px;
}
#paneContent row {
padding: 2px 4px;
-moz-box-align: center;
}
#popupPolicyRow {
margin-bottom: 4px !important;
padding-bottom: 4px !important;
@ -183,24 +87,6 @@ caption {
font-weight: bold;
}
/**
* Privacy Pane
*/
html|a.inline-link {
color: -moz-nativehyperlinktext;
text-decoration: none;
}
html|a.inline-link:hover {
text-decoration: underline;
}
html|a.inline-link:-moz-focusring {
outline-width: 0;
box-shadow: @focusRingShadow@;
}
/**
* Update Preferences
*/

View File

@ -86,7 +86,6 @@
skin/classic/browser/fxa/android@2x.png (../shared/fxa/android@2x.png)
skin/classic/browser/fxa/ios.png (../shared/fxa/ios.png)
skin/classic/browser/fxa/ios@2x.png (../shared/fxa/ios@2x.png)
skin/classic/browser/search-pref.png (../shared/search/search-pref.png)
skin/classic/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/browser/search-indicator@2x.png (../shared/search/search-indicator@2x.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -141,21 +141,12 @@ browser.jar:
skin/classic/browser/preferences/alwaysAsk-XP.png (preferences/alwaysAsk-XP.png)
skin/classic/browser/preferences/application.png (preferences/application.png)
skin/classic/browser/preferences/application-XP.png (preferences/application-XP.png)
skin/classic/browser/preferences/mail.png (preferences/mail.png)
skin/classic/browser/preferences/mail-XP.png (preferences/mail-XP.png)
skin/classic/browser/preferences/Options.png (preferences/Options.png)
skin/classic/browser/preferences/Options-XP.png (preferences/Options-XP.png)
skin/classic/browser/preferences/Options-sync.png (preferences/Options-sync.png)
skin/classic/browser/preferences/saveFile.png (preferences/saveFile.png)
skin/classic/browser/preferences/saveFile-XP.png (preferences/saveFile-XP.png)
skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css)
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)
skin/classic/browser/preferences/checkbox.png (preferences/checkbox.png)
skin/classic/browser/preferences/checkbox-aero.png (preferences/checkbox-aero.png)
skin/classic/browser/preferences/checkbox-classic.png (preferences/checkbox-classic.png)
skin/classic/browser/preferences/checkbox-xp.png (preferences/checkbox-xp.png)
skin/classic/browser/social/services-16.png (social/services-16.png)
skin/classic/browser/social/services-64.png (social/services-64.png)
skin/classic/browser/tabbrowser/newtab.svg (tabbrowser/newtab.svg)
@ -254,8 +245,6 @@ browser.jar:
% override chrome://browser/skin/places/unsortedBookmarks.png chrome://browser/skin/places/unsortedBookmarks-XP.png os=WINNT osversion<6
% override chrome://browser/skin/preferences/alwaysAsk.png chrome://browser/skin/preferences/alwaysAsk-XP.png os=WINNT osversion<6
% override chrome://browser/skin/preferences/application.png chrome://browser/skin/preferences/application-XP.png os=WINNT osversion<6
% override chrome://browser/skin/preferences/mail.png chrome://browser/skin/preferences/mail-XP.png os=WINNT osversion<6
% override chrome://browser/skin/preferences/Options.png chrome://browser/skin/preferences/Options-XP.png os=WINNT osversion<6
% override chrome://browser/skin/preferences/saveFile.png chrome://browser/skin/preferences/saveFile-XP.png os=WINNT osversion<6
% override chrome://browser/skin/actionicon-tab.png chrome://browser/skin/actionicon-tab-XPVista7.png os=WINNT osversion<=6.1
@ -295,9 +284,6 @@ browser.jar:
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/Toolbar-aero.png os=WINNT osversion=6.1
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/Toolbar-win8.png os=WINNT osversion=6.2
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/Toolbar-win8.png os=WINNT osversion=6.3
% override chrome://browser/skin/preferences/checkbox.png chrome://browser/skin/preferences/checkbox-aero.png os=WINNT osversion=6
% override chrome://browser/skin/preferences/checkbox.png chrome://browser/skin/preferences/checkbox-aero.png os=WINNT osversion=6.1
% override chrome://browser/skin/preferences/checkbox.png chrome://browser/skin/preferences/checkbox-xp.png os=WINNT osversion<6
% override chrome://browser/skin/tabbrowser/tab-background-start.png chrome://browser/skin/tabbrowser/tab-background-start-preWin10.png os=WINNT osversion<=6.3
% override chrome://browser/skin/tabbrowser/tab-background-start@2x.png chrome://browser/skin/tabbrowser/tab-background-start-preWin10@2x.png os=WINNT osversion<=6.3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

View File

@ -5,57 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* Global Styles */
#BrowserPreferences radio[pane] {
list-style-image: url("chrome://browser/skin/preferences/Options.png");
padding: 5px 3px 1px;
}
radio[pane=paneMain] {
-moz-image-region: rect(0, 32px, 32px, 0);
}
radio[pane=paneTabs] {
-moz-image-region: rect(0, 64px, 32px, 32px);
}
#BrowserPreferences radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
radio[pane=paneContent] {
-moz-image-region: rect(0, 96px, 32px, 64px);
}
radio[pane=paneApplications] {
-moz-image-region: rect(0, 128px, 32px, 96px);
}
radio[pane=panePrivacy] {
-moz-image-region: rect(0, 160px, 32px, 128px);
}
radio[pane=paneSecurity] {
-moz-image-region: rect(0, 192px, 32px, 160px);
}
radio[pane=paneAdvanced] {
-moz-image-region: rect(0, 224px, 32px, 192px);
}
radio[pane=paneSync] {
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png") !important;
}
/* These lines should be removed as part of fixing bug 1140495 */
label.small {
font-size: smaller;
}
#tabPrefsBox {
margin: 6px;
}
/* General Pane */
#useFirefoxSync,
@ -73,27 +22,6 @@ label.small {
cursor: pointer;
}
/* Applications Pane */
#BrowserPreferences[animated="true"] #handlersView {
height: 25em;
}
#BrowserPreferences[animated="false"] #handlersView {
-moz-box-flex: 1;
}
/* Privacy Pane */
/* styles for the link elements copied from .text-link in global.css */
.inline-link {
color: -moz-nativehyperlinktext;
text-decoration: none;
}
.inline-link:hover {
text-decoration: underline;
}
/* Modeless Window Dialogs */
.windowDialog,
.windowDialog prefpane {

View File

@ -15,10 +15,14 @@ const DEFAULT_MAX_CHILDREN = 100;
const COLLAPSE_DATA_URL_REGEX = /^data.+base64/;
const COLLAPSE_DATA_URL_LENGTH = 60;
const NEW_SELECTION_HIGHLIGHTER_TIMER = 1000;
const DRAG_DROP_AUTOSCROLL_EDGE_DISTANCE = 50;
const DRAG_DROP_MIN_AUTOSCROLL_SPEED = 5;
const DRAG_DROP_MAX_AUTOSCROLL_SPEED = 15;
const DRAG_DROP_AUTOSCROLL_EDGE_MAX_DISTANCE = 50;
const DRAG_DROP_AUTOSCROLL_EDGE_RATIO = 0.1;
const DRAG_DROP_MIN_AUTOSCROLL_SPEED = 2;
const DRAG_DROP_MAX_AUTOSCROLL_SPEED = 8;
const DRAG_DROP_MIN_INITIAL_DISTANCE = 10;
const DRAG_DROP_HEIGHT_TO_SPEED = 500;
const DRAG_DROP_HEIGHT_TO_SPEED_MIN = 0.5;
const DRAG_DROP_HEIGHT_TO_SPEED_MAX = 1;
const AUTOCOMPLETE_POPUP_PANEL_ID = "markupview_autoCompletePopup";
const ATTR_COLLAPSE_ENABLED_PREF = "devtools.markup.collapseAttributes";
const ATTR_COLLAPSE_LENGTH_PREF = "devtools.markup.collapseAttributeLength";
@ -252,39 +256,60 @@ MarkupView.prototype = {
_autoScroll: function (event) {
let docEl = this.doc.documentElement;
if (this._autoScrollInterval) {
clearInterval(this._autoScrollInterval);
if (this._autoScrollAnimationFrame) {
this.win.cancelAnimationFrame(this._autoScrollAnimationFrame);
}
// Auto-scroll when the mouse approaches top/bottom edge.
let fromBottom = docEl.clientHeight - event.pageY + this.win.scrollY;
let fromTop = event.pageY - this.win.scrollY;
let edgeDistance = Math.min(DRAG_DROP_AUTOSCROLL_EDGE_MAX_DISTANCE,
docEl.clientHeight * DRAG_DROP_AUTOSCROLL_EDGE_RATIO);
if (fromBottom <= DRAG_DROP_AUTOSCROLL_EDGE_DISTANCE) {
// Map our distance from 0-50 to 5-15 range so the speed is kept in a
// range not too fast, not too slow.
// The smaller the screen, the slower the movement.
let heightToSpeedRatio =
Math.max(DRAG_DROP_HEIGHT_TO_SPEED_MIN,
Math.min(DRAG_DROP_HEIGHT_TO_SPEED_MAX,
docEl.clientHeight / DRAG_DROP_HEIGHT_TO_SPEED));
if (fromBottom <= edgeDistance) {
// Map our distance range to a speed range so that the speed is not too
// fast or too slow.
let speed = map(
fromBottom,
0, DRAG_DROP_AUTOSCROLL_EDGE_DISTANCE,
0, edgeDistance,
DRAG_DROP_MIN_AUTOSCROLL_SPEED, DRAG_DROP_MAX_AUTOSCROLL_SPEED);
this._autoScrollInterval = setInterval(() => {
docEl.scrollTop -= speed - DRAG_DROP_MAX_AUTOSCROLL_SPEED;
}, 0);
this._runUpdateLoop(() => {
docEl.scrollTop -= heightToSpeedRatio *
(speed - DRAG_DROP_MAX_AUTOSCROLL_SPEED);
});
}
if (fromTop <= DRAG_DROP_AUTOSCROLL_EDGE_DISTANCE) {
if (fromTop <= edgeDistance) {
let speed = map(
fromTop,
0, DRAG_DROP_AUTOSCROLL_EDGE_DISTANCE,
0, edgeDistance,
DRAG_DROP_MIN_AUTOSCROLL_SPEED, DRAG_DROP_MAX_AUTOSCROLL_SPEED);
this._autoScrollInterval = setInterval(() => {
docEl.scrollTop += speed - DRAG_DROP_MAX_AUTOSCROLL_SPEED;
}, 0);
this._runUpdateLoop(() => {
docEl.scrollTop += heightToSpeedRatio *
(speed - DRAG_DROP_MAX_AUTOSCROLL_SPEED);
});
}
},
/**
* Run a loop on the requestAnimationFrame.
*/
_runUpdateLoop: function (update) {
let loop = () => {
update();
this._autoScrollAnimationFrame = this.win.requestAnimationFrame(loop);
};
loop();
},
_onMouseClick: function (event) {
// From the target passed here, let's find the parent MarkupContainer
// and ask it if the tooltip should be shown
@ -309,8 +334,8 @@ MarkupView.prototype = {
_onMouseUp: function () {
this.indicateDropTarget(null);
this.indicateDragTarget(null);
if (this._autoScrollInterval) {
clearInterval(this._autoScrollInterval);
if (this._autoScrollAnimationFrame) {
this.win.cancelAnimationFrame(this._autoScrollAnimationFrame);
}
},
@ -336,8 +361,8 @@ MarkupView.prototype = {
this.indicateDropTarget(null);
this.indicateDragTarget(null);
if (this._autoScrollInterval) {
clearInterval(this._autoScrollInterval);
if (this._autoScrollAnimationFrame) {
this.win.cancelAnimationFrame(this._autoScrollAnimationFrame);
}
},
@ -363,8 +388,8 @@ MarkupView.prototype = {
},
_onMouseLeave: function () {
if (this._autoScrollInterval) {
clearInterval(this._autoScrollInterval);
if (this._autoScrollAnimationFrame) {
this.win.cancelAnimationFrame(this._autoScrollAnimationFrame);
}
if (this.isDragging) {
return;
@ -1884,6 +1909,7 @@ MarkupContainer.prototype = {
this.undo = this.markup.undo;
this.win = this.markup._frame.contentWindow;
this.id = "treeitem-" + markupContainerID++;
this.htmlElt = this.win.document.documentElement;
// The template will fill the following properties
this.elt = null;
@ -2185,10 +2211,12 @@ MarkupContainer.prototype = {
this.tagLine.setAttribute("aria-grabbed", isDragging);
if (isDragging) {
this.htmlElt.classList.add("dragging");
this.elt.classList.add("dragging");
this.markup.doc.body.classList.add("dragging");
rootElt.setAttribute("aria-dropeffect", "move");
} else {
this.htmlElt.classList.remove("dragging");
this.elt.classList.remove("dragging");
this.markup.doc.body.classList.remove("dragging");
rootElt.setAttribute("aria-dropeffect", "none");
@ -2525,6 +2553,7 @@ MarkupContainer.prototype = {
}
this.win = null;
this.htmlElt = null;
if (this.expander) {
this.expander.removeEventListener("click", this._onToggle, false);

View File

@ -5,7 +5,8 @@ support-files =
actor_events_form.js
doc_markup_anonymous.html
doc_markup_dragdrop.html
doc_markup_dragdrop_autoscroll.html
doc_markup_dragdrop_autoscroll_01.html
doc_markup_dragdrop_autoscroll_02.html
doc_markup_edit.html
doc_markup_events1.html
doc_markup_events2.html
@ -65,7 +66,8 @@ subsuite = clipboard
[browser_markup_css_completion_style_attribute_01.js]
[browser_markup_css_completion_style_attribute_02.js]
[browser_markup_css_completion_style_attribute_03.js]
[browser_markup_dragdrop_autoscroll.js]
[browser_markup_dragdrop_autoscroll_01.js]
[browser_markup_dragdrop_autoscroll_02.js]
[browser_markup_dragdrop_distance.js]
[browser_markup_dragdrop_draggable.js]
[browser_markup_dragdrop_dragRootNode.js]

View File

@ -5,11 +5,15 @@
"use strict";
// Test that dragging a node near the top or bottom edge of the markup-view
// auto-scrolls the view.
// auto-scrolls the view on a large toolbox.
const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll.html";
const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll_01.html";
add_task(function* () {
// Set the toolbox as large as it would get. The toolbox automatically shrinks
// to not overflow to window.
yield pushPref("devtools.toolbox.footer.height", 10000);
let {inspector} = yield openInspectorForURL(TEST_URL);
let markup = inspector.markup;
let viewHeight = markup.doc.documentElement.clientHeight;
@ -18,7 +22,7 @@ add_task(function* () {
markup.isDragging = true;
info("Simulate a mousemove on the view, at the bottom, and expect scrolling");
let onScrolled = waitForScrollStop(markup);
let onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
@ -30,7 +34,7 @@ add_task(function* () {
ok(bottomScrollPos > 0, "The view was scrolled down");
info("Simulate a mousemove at the top and expect more scrolling");
onScrolled = waitForScrollStop(markup);
onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
@ -45,29 +49,3 @@ add_task(function* () {
info("Simulate a mouseup to stop dragging");
markup._onMouseUp();
});
/**
* Waits until the element has not scrolled for 30 consecutive frames.
*/
function* waitForScrollStop(markup) {
let el = markup.doc.documentElement;
let win = markup.doc.defaultView;
let lastScrollTop = el.scrollTop;
let stopFrameCount = 0;
while (stopFrameCount < 30) {
// Wait for a frame.
yield new Promise(resolve => win.requestAnimationFrame(resolve));
// Check if the element has scrolled.
if (lastScrollTop == el.scrollTop) {
// No scrolling since the last frame.
stopFrameCount++;
} else {
// The element has scrolled. Reset the frame counter.
stopFrameCount = 0;
lastScrollTop = el.scrollTop;
}
}
return lastScrollTop;
}

View File

@ -0,0 +1,50 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that dragging a node near the top or bottom edge of the markup-view
// auto-scrolls the view on a small toolbox.
const TEST_URL = URL_ROOT + "doc_markup_dragdrop_autoscroll_02.html";
add_task(function* () {
// Set the toolbox to very small in size.
yield pushPref("devtools.toolbox.footer.height", 150);
let {inspector} = yield openInspectorForURL(TEST_URL);
let markup = inspector.markup;
let viewHeight = markup.doc.documentElement.clientHeight;
info("Pretend the markup-view is dragging");
markup.isDragging = true;
info("Simulate a mousemove on the view, at the bottom, and expect scrolling");
let onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
target: markup.doc.body,
pageY: viewHeight
});
let bottomScrollPos = yield onScrolled;
ok(bottomScrollPos > 0, "The view was scrolled down");
info("Simulate a mousemove at the top and expect more scrolling");
onScrolled = waitForScrollStop(markup.doc);
markup._onMouseMove({
preventDefault: () => {},
target: markup.doc.body,
pageY: 0
});
let topScrollPos = yield onScrolled;
ok(topScrollPos < bottomScrollPos, "The view was scrolled up");
is(topScrollPos, 0, "The view was scrolled up to the top");
info("Simulate a mouseup to stop dragging");
markup._onMouseUp();
});

View File

@ -0,0 +1,87 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=858038
https://bugzilla.mozilla.org/show_bug.cgi?id=1226898
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 858038 and 1226898 - Autoscroll</title>
</head>
<body>
<div id="first"></div>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=858038">Mozilla Bug 858038</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1226898">Mozilla Bug 1226898</a>
<p id="display">Test</p>
<div id="content" style="display: none">
</div>
<!-- Make sure the markup-view has enough nodes shown by default that it has a scrollbar -->
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>
</html>

View File

@ -2,14 +2,16 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=858038
https://bugzilla.mozilla.org/show_bug.cgi?id=1226898
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 858038 - Autoscroll</title>
<title>Test for Bug 858038 and 1226898 - Autoscroll</title>
</head>
<body>
<div id="first"></div>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=858038">Mozilla Bug 858038</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1226898">Mozilla Bug 1226898</a>
<p id="display">Test</p>
<div id="content" style="display: none">
@ -47,5 +49,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=858038
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>
</html>

View File

@ -584,3 +584,29 @@ function* simulateNodeDragAndDrop(inspector, selector, xOffset, yOffset) {
yield simulateNodeDrag(inspector, selector, xOffset, yOffset);
yield simulateNodeDrop(inspector, selector);
}
/**
* Waits until the element has not scrolled for 30 consecutive frames.
*/
function* waitForScrollStop(doc) {
let el = doc.documentElement;
let win = doc.defaultView;
let lastScrollTop = el.scrollTop;
let stopFrameCount = 0;
while (stopFrameCount < 30) {
// Wait for a frame.
yield new Promise(resolve => win.requestAnimationFrame(resolve));
// Check if the element has scrolled.
if (lastScrollTop == el.scrollTop) {
// No scrolling since the last frame.
stopFrameCount++;
} else {
// The element has scrolled. Reset the frame counter.
stopFrameCount = 0;
lastScrollTop = el.scrollTop;
}
}
return lastScrollTop;
}

View File

@ -36,6 +36,10 @@ body {
background: none;
}
html.dragging {
overflow-x: hidden;
}
body.dragging .tag-line {
cursor: grabbing;
}

View File

@ -0,0 +1,30 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
// React
const {
PropTypes
} = require("devtools/client/shared/vendor/react");
const { createFactories } = require("devtools/client/shared/components/reps/rep-utils");
const { Rep } = createFactories(require("devtools/client/shared/components/reps/rep"));
const { Grip } = require("devtools/client/shared/components/reps/grip");
GripMessageBody.displayName = "GripMessageBody";
GripMessageBody.propTypes = {
grip: PropTypes.object.isRequired,
};
function GripMessageBody(props) {
return Rep({
object: props.grip,
defaultRep: Grip
});
}
module.exports.GripMessageBody = GripMessageBody;

View File

@ -12,6 +12,7 @@ const {
DOM: dom,
PropTypes
} = require("devtools/client/shared/vendor/react");
const GripMessageBody = createFactory(require("devtools/client/webconsole/new-console-output/components/grip-message-body").GripMessageBody);
const MessageRepeat = createFactory(require("devtools/client/webconsole/new-console-output/components/message-repeat").MessageRepeat);
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
@ -23,15 +24,14 @@ ConsoleApiCall.propTypes = {
function ConsoleApiCall(props) {
const { message } = props;
const messageBody =
dom.span({className: "message-body devtools-monospace"},
formatTextContent(message.data));
const counter = message.data.counter;
const messageBody = counter ?
`${counter.label}: ${counter.count}` :
message.data.arguments.map((arg) => GripMessageBody({grip: arg}));
const icon = MessageIcon({severity: message.severity});
const repeat = MessageRepeat({repeat: message.repeat});
const children = [
messageBody,
repeat
];
// @TODO Use of "is" is a temporary hack to get the category and severity
// attributes to be applied. There are targeted in webconsole's CSS rules,
@ -42,30 +42,20 @@ function ConsoleApiCall(props) {
category: message.category,
severity: message.severity
},
// @TODO add timestamp
// @TODO add indent if necessary
icon,
dom.span({className: "message-body-wrapper"},
dom.span({},
dom.span({className: "message-flex-body"},
children
dom.span({className: "message-body devtools-monospace"},
messageBody
),
repeat
)
)
)
);
}
function formatTextContent(data) {
return data.arguments.map(function (arg, i, arr) {
if (data.counter) {
let {label, count} = data.counter;
arg = `${label}: ${count}`;
}
const str = dom.span({className: "console-string"}, arg);
if (i < arr.length - 1) {
return [str, " "];
}
return str;
});
}
module.exports.ConsoleApiCall = ConsoleApiCall;

View File

@ -1,60 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
// React & Redux
const {
createFactory,
DOM: dom,
PropTypes
} = require("devtools/client/shared/vendor/react");
const VariablesViewLink = createFactory(require("devtools/client/webconsole/new-console-output/components/variables-view-link").VariablesViewLink);
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
DatePreview.displayName = "DatePreview";
DatePreview.propTypes = {
data: PropTypes.object.isRequired,
};
function DatePreview(props) {
const { data, category, severity } = props;
const { preview } = data;
const dateString = new Date(preview.timestamp).toISOString();
const textNodes = [
VariablesViewLink({
objectActor: data,
label: "Date"
}),
dom.span({ className: "cm-string-2" }, ` ${dateString}`)
];
const icon = MessageIcon({ severity });
// @TODO Use of "is" is a temporary hack to get the category and severity
// attributes to be applied. There are targeted in webconsole's CSS rules,
// so if we remove this hack, we have to modify the CSS rules accordingly.
return dom.div({
class: "message cm-s-mozilla",
is: "fdt-message",
category: category,
severity: severity
},
icon,
dom.span({
className: "message-body-wrapper message-body devtools-monospace"
}, dom.span({},
dom.span({ className: "class-Date" },
textNodes
)
)
)
);
}
module.exports.DatePreview = DatePreview;

View File

@ -9,8 +9,11 @@
// React & Redux
const {
createFactory,
DOM: dom,
PropTypes
} = require("devtools/client/shared/vendor/react");
const GripMessageBody = createFactory(require("devtools/client/webconsole/new-console-output/components/grip-message-body").GripMessageBody);
const MessageIcon = createFactory(require("devtools/client/webconsole/new-console-output/components/message-icon").MessageIcon);
EvaluationResult.displayName = "EvaluationResult";
@ -20,23 +23,27 @@ EvaluationResult.propTypes = {
function EvaluationResult(props) {
const { message } = props;
let PreviewComponent = getPreviewComponent(message.data);
const icon = MessageIcon({severity: message.severity});
return PreviewComponent({
data: message.data,
// @TODO Use of "is" is a temporary hack to get the category and severity
// attributes to be applied. There are targeted in webconsole's CSS rules,
// so if we remove this hack, we have to modify the CSS rules accordingly.
return dom.div({
class: "message cm-s-mozilla",
is: "fdt-message",
category: message.category,
severity: message.severity
});
}
function getPreviewComponent(data) {
if (typeof data.class != "undefined") {
switch (data.class) {
case "Date":
return createFactory(require("devtools/client/webconsole/new-console-output/components/message-types/date-preview").DatePreview);
}
}
return createFactory(require("devtools/client/webconsole/new-console-output/components/message-types/default-renderer").DefaultRenderer);
},
// @TODO add timestamp
// @TODO add indent if needed with console.group
icon,
dom.span(
{className: "message-body-wrapper message-body devtools-monospace"},
dom.span({},
GripMessageBody({grip: message.data})
)
)
);
}
module.exports.EvaluationResult = EvaluationResult;

View File

@ -5,7 +5,6 @@
DevToolsModules(
'console-api-call.js',
'date-preview.js',
'default-renderer.js',
'evaluation-result.js',
'page-error.js',

View File

@ -9,6 +9,7 @@ DIRS += [
DevToolsModules(
'console-output.js',
'grip-message-body.js',
'message-container.js',
'message-icon.js',
'message-repeat.js',

View File

@ -5,7 +5,6 @@ support-files =
[test_console-api-call.html]
[test_console-api-call_repeat.html]
[test_date-preview.html]
[test_evaluation-result.html]
[test_message-icon.html]
[test_message-container.html]

View File

@ -32,12 +32,14 @@ let testCommands = new Map();
testCommands.set("console.log()", {
command: "console.log('foobar', 'test')",
commandType: "consoleAPICall",
expectedText: "foobar test"
// @TODO should output: foobar test
expectedText: "\"foobar\"\"test\""
});
testCommands.set("new Date()", {
command: "new Date(448156800000)",
commandType: "evaluationResult",
expectedText: "Date 1984-03-15T00:00:00.000Z"
// @TODO should output: Date 1984-03-15T00:00:00.000Z
expectedText: "1984-03-15T00:00:00.000Z"
});
testCommands.set("pageError", {
command: null,

View File

@ -12,50 +12,47 @@
<p>Test for ConsoleApiCall component</p>
<script type="text/javascript;version=1.8">
window.onload = Task.async(function* () {
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
const { ConsoleApiCall } = require("devtools/client/webconsole/new-console-output/components/message-types/console-api-call");
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
const { ConsoleApiCall } = require("devtools/client/webconsole/new-console-output/components/message-types/console-api-call");
window.onload = Task.async(function* () {
yield testConsoleLog();
yield testConsoleCount();
SimpleTest.finish()
});
function testConsoleLog() {
const packet = yield getPacket("console.log('foobar', 'test')", "consoleAPICall");
const message = prepareMessage(packet);
const rendered = renderComponent(ConsoleApiCall, {message});
const messageBody = getMessageBody(rendered);
const consoleStringNodes = getConsoleStringNodes(messageBody);
// @TODO should output: foobar test
is(messageBody.textContent, "\"foobar\"\"test\"", "ConsoleApiCall outputs expected text");
const consoleStringNodes = messageBody.querySelectorAll(".objectBox");
is(consoleStringNodes.length, 2, "ConsoleApiCall outputs expected HTML structure");
is(messageBody.textContent, "foobar test", "ConsoleApiCall outputs expected text");
}
function testConsoleCount() {
for (let i = 0; i < 3; i++) {
const countPacket = yield getPacket("console.count('bar')", "consoleAPICall");
const countMessage = prepareMessage(countPacket);
const countRendered = renderComponent(ConsoleApiCall, {message: countMessage});
testConsoleCountRenderedElement(countRendered, `bar: ${i + 1}`);
}
const packet = yield getPacket("console.count('bar')", "consoleAPICall");
const message = prepareMessage(packet);
const rendered = renderComponent(ConsoleApiCall, {message: message});
const messageBody = getMessageBody(rendered);
SimpleTest.finish()
});
const expected = `bar: ${i + 1}`;
is(messageBody.textContent, expected,
"console.count has the expected text content: ${expected}");
}
}
function getMessageBody(renderedComponent) {
const queryPath = "div.message.cm-s-mozilla span span.message-flex-body " +
"span.message-body.devtools-monospace";
const queryPath = "div.message.cm-s-mozilla span span.message-flex-body span.message-body.devtools-monospace";
return renderedComponent.querySelector(queryPath);
}
function getConsoleStringNodes(messageBody) {
return messageBody.querySelectorAll("span.console-string");
}
function testConsoleCountRenderedElement(renderedComponent, expectedTextContent) {
info("Testing console.count rendered element");
const messageBody = getMessageBody(renderedComponent);
const consoleStringNodes = getConsoleStringNodes(messageBody);
is(consoleStringNodes.length, 1,
"console.count rendered element has the expected HTML structure");
is(messageBody.textContent, expectedTextContent,
"console.count rendered element has the expected text content");
}
</script>
</body>
</html>

View File

@ -23,7 +23,8 @@ window.onload = Task.async(function* () {
const messageBodyPath = "span > span.message-flex-body > span.message-body.devtools-monospace";
const messageBody = rendered.querySelectorAll(messageBodyPath);
is(messageBody[0].textContent, "foobar test", "ConsoleApiCall outputs expected text for repeated message");
// @TODO Expected output should be: foobar test
is(messageBody[0].textContent, "\"foobar\"\"test\"", "ConsoleApiCall outputs expected text for repeated message");
const repeatPath = "span > span.message-flex-body > span.message-body.devtools-monospace + span.message-repeats";
const repeat = rendered.querySelectorAll(repeatPath);

View File

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf8">
<title>Test for DatePreview component</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript;version=1.8" src="head.js"></script>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
</head>
<body>
<p>Test for DatePreview component</p>
<script type="text/javascript;version=1.8">
window.onload = Task.async(function* () {
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
const { DatePreview } = require("devtools/client/webconsole/new-console-output/components/message-types/date-preview");
const testCommand = testCommands.get("new Date()");
const packet = yield getPacket(testCommand.command, testCommand.commandType);
const message = prepareMessage(packet);
const props = {
data: message.data,
severity: message.severity,
category: message.category,
};
const rendered = renderComponent(DatePreview, props);
const queryPathBase = "div.message.cm-s-mozilla span.message-body-wrapper.message-body.devtools-monospace span span.class-Date";
const preview = rendered.querySelectorAll(queryPathBase);
is(preview[0].textContent, testCommand.expectedText, "DatePreview outputs expected text");
const link = rendered.querySelectorAll(`${queryPathBase} a[draggable=false][href="#"].cm-variable`);
is(link.length, 1, "DatePreview outputs the variables view link");
SimpleTest.finish()
});
</script>
</body>
</html>

View File

@ -15,53 +15,29 @@
window.onload = Task.async(function* () {
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
const {
EvaluationResult,
getPreviewComponent
EvaluationResult
} = require("devtools/client/webconsole/new-console-output/components/message-types/evaluation-result");
yield testFullRender();
yield testGetPreviewComponent();
yield testDate();
SimpleTest.finish()
/**
* Test that passing in a message correctly wires up all the children.
*
* The different combinations of children are tested in separate per-component
* tests. This test just ensures that this component pipes data to its children.
* Test that evaluation result correctly outputs date results.
*/
function testFullRender() {
const testValue = testCommands.get("new Date()");
const packet = yield getPacket(testValue.command, testValue.commandType);
function testDate() {
const testCommand = testCommands.get("new Date()");
const packet = yield getPacket(testCommand.command, testCommand.commandType);
const message = prepareMessage(packet);
const props = {
message
};
const rendered = renderComponent(EvaluationResult, props);
ok(rendered.textContent.includes(testValue.expectedText),
"EvaluationResult pipes data to its children as expected");
}
const queryPathBase = "div.message.cm-s-mozilla span.message-body-wrapper.message-body.devtools-monospace span .objectLink";
/**
* Test that getPreviewComponent() returns correct component for each object type.
*/
function testGetPreviewComponent() {
const testValues = [
{
commandObj: testCommands.get("new Date()"),
expectedComponent: require("devtools/client/webconsole/new-console-output/components/message-types/date-preview").DatePreview
}
];
for (let testValue of testValues) {
const { commandObj, expectedComponent } = testValue;
const packet = yield getPacket(commandObj.command, commandObj.commandType);
const message = prepareMessage(packet);
const rendered = shallowRenderComponent(EvaluationResult, {message});
is(rendered.type, expectedComponent,
`EvaluationResult nests ${expectedComponent} based on command: ${commandObj.command}`);
}
const preview = rendered.querySelectorAll(queryPathBase);
is(preview[0].textContent, testCommand.expectedText, "EvaluationResult outputs expected text");
}
});

View File

@ -83,7 +83,11 @@ function prepareMessage(packet) {
break;
case "evaluationResult":
default:
data = Object.assign({}, packet.result);
if (typeof packet.result === "object") {
data = Object.assign({}, packet.result);
} else {
data = packet.result;
}
allowRepeating = true;
category = CATEGORY_CLASS_FRAGMENTS[CATEGORY_OUTPUT];
messageType = "EvaluationResult";

View File

@ -220,8 +220,7 @@ WebConsoleActor.prototype =
{
if (window) {
if (this._hadChromeWindow) {
let contextChangedMsg = WebConsoleActor.l10n.getStr("evaluationContextChanged");
Services.console.logStringMessage(contextChangedMsg);
Services.console.logStringMessage('Webconsole context has changed');
}
this._lastChromeWindow = Cu.getWeakReference(window);
this._hadChromeWindow = true;

View File

@ -28,7 +28,7 @@ public class GcmInstanceIDListenerService extends InstanceIDListenerService {
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
PushService.getInstance().onRefresh();
PushService.getInstance(GcmInstanceIDListenerService.this).onRefresh();
}
});
}

View File

@ -30,7 +30,7 @@ public class GcmMessageListenerService extends GcmListenerService {
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
PushService.getInstance().onMessageReceived(
PushService.getInstance(GcmMessageListenerService.this).onMessageReceived(
GcmMessageListenerService.this, bundle);
}
});

View File

@ -66,9 +66,9 @@ public class PushService implements BundleEventListener {
"History:GetPrePathLastVisitedTimeMilliseconds",
};
public static synchronized PushService getInstance() {
public static synchronized PushService getInstance(Context context) {
if (sInstance == null) {
throw new IllegalStateException("PushService not yet created!");
onCreate(context);
}
return sInstance;
}

View File

@ -90,8 +90,7 @@ xul|*.numberbox-input-box {
border-width: 0;
}
xul|*.text-link:-moz-focusring,
xul|*.inline-link:-moz-focusring {
xul|*.text-link:-moz-focusring {
border: 1px dotted -moz-DialogText;
}

View File

@ -76,8 +76,7 @@ xul|description {
line-height: 22px;
}
xul|*.text-link:-moz-focusring,
xul|*.inline-link:-moz-focusring {
xul|*.text-link:-moz-focusring {
color: var(--in-content-link-highlight);
text-decoration: underline;
box-shadow: none;

View File

@ -451,15 +451,13 @@ xul|textbox[disabled="true"] {
/* Links */
html|a,
.text-link,
.inline-link {
.text-link {
color: var(--in-content-link-color);
text-decoration: none;
}
html|a:hover,
.text-link:hover,
.inline-link:hover {
.text-link:hover {
color: var(--in-content-link-color-hover);
text-decoration: underline;
}
@ -469,8 +467,7 @@ html|a:visited {
}
html|a:hover:active,
.text-link:hover:active,
.inline-link:hover:active {
.text-link:hover:active {
color: var(--in-content-link-color-active);
text-decoration: none;
}

View File

@ -64,7 +64,6 @@ xul|*.checkbox-label-box {
border-style: none;
}
xul|*.inline-link:-moz-focusring,
xul|button:-moz-focusring > xul|*.button-box,
xul|menulist:-moz-focusring > xul|*.menulist-label-box,
xul|radio[focused="true"] > xul|*.radio-label-box,