mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge fx-team to m-c. a=merge
This commit is contained in:
commit
49132d28a2
@ -118,5 +118,6 @@ skip-if = os == "linux"
|
||||
[browser_1007336_lwthemes_in_customize_mode.js]
|
||||
[browser_1008559_anchor_undo_restore.js]
|
||||
[browser_1042100_default_placements_update.js]
|
||||
[browser_1058573_showToolbarsDropdown.js]
|
||||
[browser_bootstrapped_custom_toolbar.js]
|
||||
[browser_panel_toggle.js]
|
||||
|
@ -0,0 +1,25 @@
|
||||
/* 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";
|
||||
|
||||
add_task(function() {
|
||||
info("Check that toggleable toolbars dropdown in always shown");
|
||||
|
||||
info("Remove all possible custom toolbars");
|
||||
yield removeCustomToolbars();
|
||||
|
||||
info("Enter customization mode");
|
||||
yield startCustomizing();
|
||||
|
||||
let toolbarsToggle = document.getElementById("customization-toolbar-visibility-button");
|
||||
ok(toolbarsToggle, "The toolbars toggle dropdown exists");
|
||||
ok(!toolbarsToggle.hasAttribute("hidden"),
|
||||
"The toolbars toggle dropdown is displayed");
|
||||
});
|
||||
|
||||
add_task(function asyncCleanup() {
|
||||
info("Exit customization mode");
|
||||
yield endCustomizing();
|
||||
});
|
@ -120,17 +120,26 @@ let EventsHandler = {
|
||||
/**
|
||||
* Called for each location change in the debugged tab.
|
||||
*/
|
||||
_onTabNavigated: function(event) {
|
||||
_onTabNavigated: function(event, {isFrameSwitching}) {
|
||||
switch (event) {
|
||||
case "will-navigate": {
|
||||
Task.spawn(function() {
|
||||
// Make sure the backend is prepared to handle WebGL contexts.
|
||||
gFront.setup({ reload: false });
|
||||
if (!isFrameSwitching) {
|
||||
gFront.setup({ reload: false });
|
||||
}
|
||||
|
||||
// Reset UI.
|
||||
ShadersListView.empty();
|
||||
$("#reload-notice").hidden = true;
|
||||
$("#waiting-notice").hidden = false;
|
||||
// When switching to an iframe, ensure displaying the reload button.
|
||||
// As the document has already been loaded without being hooked.
|
||||
if (isFrameSwitching) {
|
||||
$("#reload-notice").hidden = false;
|
||||
$("#waiting-notice").hidden = true;
|
||||
} else {
|
||||
$("#reload-notice").hidden = true;
|
||||
$("#waiting-notice").hidden = false;
|
||||
}
|
||||
yield ShadersEditorsView.setText({ vs: "", fs: "" });
|
||||
$("#content").hidden = true;
|
||||
}).then(() => window.emit(EVENTS.UI_RESET));
|
||||
|
@ -10,6 +10,7 @@ support-files =
|
||||
doc_connect-toggle.html
|
||||
doc_connect-param.html
|
||||
doc_connect-multi-param.html
|
||||
doc_iframe-context.html
|
||||
440hz_sine.ogg
|
||||
head.js
|
||||
|
||||
@ -29,6 +30,7 @@ support-files =
|
||||
[browser_wa_reset-01.js]
|
||||
[browser_wa_reset-02.js]
|
||||
[browser_wa_reset-03.js]
|
||||
[browser_wa_reset-04.js]
|
||||
|
||||
[browser_wa_graph-click.js]
|
||||
[browser_wa_graph-markers.js]
|
||||
|
56
browser/devtools/webaudioeditor/test/browser_wa_reset-04.js
Normal file
56
browser/devtools/webaudioeditor/test/browser_wa_reset-04.js
Normal file
@ -0,0 +1,56 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that switching to an iframe works fine.
|
||||
*/
|
||||
|
||||
function spawnTest() {
|
||||
Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
|
||||
|
||||
let [target, debuggee, panel, toolbox] = yield initWebAudioEditor(IFRAME_CONTEXT_URL);
|
||||
let { gFront, $ } = panel.panelWin;
|
||||
|
||||
is($("#reload-notice").hidden, false,
|
||||
"The 'reload this page' notice should initially be visible.");
|
||||
is($("#waiting-notice").hidden, true,
|
||||
"The 'waiting for an audio context' notice should initially be hidden.");
|
||||
is($("#content").hidden, true,
|
||||
"The tool's content should initially be hidden.");
|
||||
|
||||
let btn = toolbox.doc.getElementById("command-button-frames");
|
||||
ok(!btn.firstChild.getAttribute("hidden"), "The frame list button is visible");
|
||||
let frameBtns = btn.firstChild.querySelectorAll("[data-window-id]");
|
||||
is(frameBtns.length, 2, "We have both frames in the list");
|
||||
|
||||
// Select the iframe
|
||||
frameBtns[1].click();
|
||||
|
||||
let navigating = once(target, "will-navigate");
|
||||
|
||||
yield navigating;
|
||||
|
||||
is($("#reload-notice").hidden, false,
|
||||
"The 'reload this page' notice should still be visible when switching to a frame.");
|
||||
is($("#waiting-notice").hidden, true,
|
||||
"The 'waiting for an audio context' notice should be kept hidden when switching to a frame.");
|
||||
is($("#content").hidden, true,
|
||||
"The tool's content should still be hidden.");
|
||||
|
||||
let navigating = once(target, "will-navigate");
|
||||
let started = once(gFront, "start-context");
|
||||
|
||||
reload(target);
|
||||
|
||||
yield Promise.all([navigating, started]);
|
||||
|
||||
is($("#reload-notice").hidden, true,
|
||||
"The 'reload this page' notice should be hidden after reloading the frame.");
|
||||
is($("#waiting-notice").hidden, true,
|
||||
"The 'waiting for an audio context' notice should be hidden after reloading the frame.");
|
||||
is($("#content").hidden, false,
|
||||
"The tool's content should appear after reload.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
14
browser/devtools/webaudioeditor/test/doc_iframe-context.html
Normal file
14
browser/devtools/webaudioeditor/test/doc_iframe-context.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Web Audio Editor test page with an iframe</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe id="frame" src="doc_simple-context.html" />
|
||||
</body>
|
||||
</html>
|
@ -30,6 +30,7 @@ const DESTROY_NODES_URL = EXAMPLE_URL + "doc_destroy-nodes.html";
|
||||
const CONNECT_TOGGLE_URL = EXAMPLE_URL + "doc_connect-toggle.html";
|
||||
const CONNECT_PARAM_URL = EXAMPLE_URL + "doc_connect-param.html";
|
||||
const CONNECT_MULTI_PARAM_URL = EXAMPLE_URL + "doc_connect-multi-param.html";
|
||||
const IFRAME_CONTEXT_URL = EXAMPLE_URL + "doc_iframe-context.html";
|
||||
|
||||
// All tests are asynchronous.
|
||||
waitForExplicitFinish();
|
||||
@ -150,7 +151,7 @@ function initWebAudioEditor(aUrl) {
|
||||
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true);
|
||||
let toolbox = yield gDevTools.showToolbox(target, "webaudioeditor");
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
return [target, debuggee, panel];
|
||||
return [target, debuggee, panel, toolbox];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -223,8 +223,6 @@ let WebAudioEditorController = {
|
||||
* for an audio context notice.
|
||||
*/
|
||||
reset: function () {
|
||||
$("#reload-notice").hidden = true;
|
||||
$("#waiting-notice").hidden = false;
|
||||
$("#content").hidden = true;
|
||||
WebAudioGraphView.resetUI();
|
||||
WebAudioInspectorView.resetUI();
|
||||
@ -250,16 +248,30 @@ let WebAudioEditorController = {
|
||||
/**
|
||||
* Called for each location change in the debugged tab.
|
||||
*/
|
||||
_onTabNavigated: Task.async(function* (event) {
|
||||
_onTabNavigated: Task.async(function* (event, {isFrameSwitching}) {
|
||||
switch (event) {
|
||||
case "will-navigate": {
|
||||
// Make sure the backend is prepared to handle audio contexts.
|
||||
yield gFront.setup({ reload: false });
|
||||
if (!isFrameSwitching) {
|
||||
yield gFront.setup({ reload: false });
|
||||
}
|
||||
|
||||
// Reset UI to show "Waiting for Audio Context..." and clear out
|
||||
// current UI.
|
||||
// Clear out current UI.
|
||||
this.reset();
|
||||
|
||||
// When switching to an iframe, ensure displaying the reload button.
|
||||
// As the document has already been loaded without being hooked.
|
||||
if (isFrameSwitching) {
|
||||
$("#reload-notice").hidden = false;
|
||||
$("#waiting-notice").hidden = true;
|
||||
} else {
|
||||
// Otherwise, we are loading a new top level document,
|
||||
// so we don't need to reload anymore and should receive
|
||||
// new node events.
|
||||
$("#reload-notice").hidden = true;
|
||||
$("#waiting-notice").hidden = false;
|
||||
}
|
||||
|
||||
// Clear out stored audio nodes
|
||||
AudioNodes.length = 0;
|
||||
AudioNodeConnections.clear();
|
||||
|
@ -31,6 +31,7 @@ pt-BR
|
||||
pt-PT
|
||||
ru
|
||||
sk
|
||||
sl
|
||||
sv-SE
|
||||
th
|
||||
tr
|
||||
|
@ -537,6 +537,7 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
|
||||
}
|
||||
|
||||
/* Primary toolbar buttons */
|
||||
.findbar-button,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 {
|
||||
-moz-appearance: none;
|
||||
@ -547,6 +548,7 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.findbar-button > .toolbarbutton-text,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-badge-container > .toolbarbutton-icon,
|
||||
@ -585,6 +587,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
||||
.findbar-button:not(:-moz-any([checked="true"],[disabled="true"])):hover > .toolbarbutton-text,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1[open]:not([disabled=true]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1:not([disabled=true]):not([open]):hover > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1:not([disabled=true]):not([open]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
@ -604,6 +607,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.findbar-button:not([disabled=true]):-moz-any([checked="true"],:hover:active) > .toolbarbutton-text,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):-moz-any(:hover:active, [open="true"]) > .toolbarbutton-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1[open="true"] > .toolbarbutton-menubutton-dropmarker:not([disabled=true]) > .dropmarker-icon,
|
||||
:-moz-any(#TabsToolbar, #nav-bar) .toolbarbutton-1:not([disabled=true]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-badge-container > .toolbarbutton-icon,
|
||||
|
@ -509,6 +509,7 @@ toolbarpaletteitem[place="palette"] > #personal-bookmarks > #bookmarks-toolbar-p
|
||||
|
||||
/* ----- PRIMARY TOOLBAR BUTTONS ----- */
|
||||
|
||||
.findbar-button,
|
||||
toolbar .toolbarbutton-1:not([type="menu-button"]),
|
||||
.toolbarbutton-1 > .toolbarbutton-menubutton-button,
|
||||
.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
@ -518,6 +519,7 @@ toolbar .toolbarbutton-1:not([type="menu-button"]),
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.findbar-button,
|
||||
toolbar .toolbarbutton-1:not(:-moz-any([type="menu-button"],#back-button,#forward-button)),
|
||||
toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button,
|
||||
toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
@ -531,6 +533,7 @@ toolbar .toolbarbutton-1:not(:-moz-any([type="menu-button"],#back-button,#forwar
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.findbar-button:not(:-moz-any([checked="true"],[disabled="true"])):hover,
|
||||
toolbar .toolbarbutton-1:not(:-moz-any([type="menu-button"],[disabled],[open],#back-button,#forward-button)):hover,
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not([disabled]) > .toolbarbutton-menubutton-button[open] + .toolbarbutton-menubutton-dropmarker,
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button,
|
||||
@ -541,12 +544,14 @@ toolbar .toolbaritem-combined-buttons:hover > .toolbarbutton-combined {
|
||||
0 1px 0 hsla(0,0%,100%,.5) inset;
|
||||
}
|
||||
|
||||
.findbar-button:not(:-moz-any([checked="true"],[disabled="true"])):hover,
|
||||
toolbar .toolbarbutton-1:not(:-moz-any([type="menu-button"],[disabled],[open],#back-button,#forward-button)):hover,
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not(:-moz-any([disabled],[open]))[buttonover] > .toolbarbutton-menubutton-button,
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not(:-moz-any([disabled],[open],[buttonover])):hover > .toolbarbutton-menubutton-dropmarker {
|
||||
background: hsla(0,0%,100%,.1) linear-gradient(hsla(0,0%,100%,.3), hsla(0,0%,100%,.1)) padding-box;
|
||||
}
|
||||
|
||||
.findbar-button:not([disabled=true]):-moz-any([checked="true"],:hover:active),
|
||||
toolbar .toolbarbutton-1:not(:-moz-any([type="menu-button"],[disabled],#back-button,#forward-button)):-moz-any(:hover:active,[open],[checked]),
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not([disabled]) > .toolbarbutton-menubutton-button[open],
|
||||
toolbar .toolbarbutton-1[type="menu-button"]:not(:-moz-any([disabled],[open]))[buttonover]:active > .toolbarbutton-menubutton-button,
|
||||
@ -560,6 +565,7 @@ toolbar .toolbarbutton-1[type="menu-button"][open]:not([disabled]) > .toolbarbut
|
||||
transition-duration: 10ms;
|
||||
}
|
||||
|
||||
.findbar-button[checked="true"]:not(:active):hover,
|
||||
toolbar .toolbarbutton-1[checked]:not(:active):hover {
|
||||
background-color: hsla(0,0%,0%,.09);
|
||||
transition: background-color 250ms;
|
||||
|
@ -603,6 +603,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
-moz-margin-end: 0;
|
||||
}
|
||||
|
||||
.findbar-button,
|
||||
#nav-bar .toolbarbutton-1,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
-moz-appearance: none;
|
||||
@ -645,6 +646,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.findbar-button > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-badge-container,
|
||||
@ -663,6 +665,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
|
||||
(-moz-os-version: windows-win7) {
|
||||
%endif
|
||||
/* < Win8 */
|
||||
.findbar-button > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-badge-container,
|
||||
@ -743,6 +746,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
border-color: hsla(210,4%,10%,.1);
|
||||
}
|
||||
|
||||
.findbar-button:not(:-moz-any([checked="true"],[disabled="true"])):hover > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1:not([disabled=true]) > .toolbarbutton-menubutton-button[open] + .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled=true]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled=true]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
@ -787,6 +791,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.findbar-button:not(:-moz-any([checked="true"],[disabled="true"])):hover > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1:not([disabled=true]) > .toolbarbutton-menubutton-button[open] + .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
|
||||
@ -814,6 +819,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
}
|
||||
%endif
|
||||
|
||||
.findbar-button:not([disabled=true]):-moz-any([checked="true"],:hover:active) > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):-moz-any(:hover:active, [open]) > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled=true]) > .dropmarker-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled=true]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon,
|
||||
@ -830,6 +836,7 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
|
||||
(-moz-os-version: windows-win7) {
|
||||
%endif
|
||||
/* < Win8 */
|
||||
.findbar-button:not([disabled=true]):-moz-any([checked="true"],:hover:active) > .toolbarbutton-text,
|
||||
#nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled=true]):-moz-any(:hover:active, [open]) > .toolbarbutton-icon,
|
||||
#nav-bar .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
|
||||
#nav-bar .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon,
|
||||
|
@ -11,6 +11,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -23,10 +24,10 @@ import org.mozilla.gecko.R;
|
||||
public class FadedTextView extends TextView {
|
||||
|
||||
// Width of the fade effect from end of the view.
|
||||
private int mFadeWidth;
|
||||
private final int mFadeWidth;
|
||||
|
||||
// Padding for compound drawables.
|
||||
private int mCompoundPadding;
|
||||
// Shader for the fading edge.
|
||||
private FadedTextGradient mTextGradient;
|
||||
|
||||
public FadedTextView(Context context) {
|
||||
this(context, null);
|
||||
@ -39,42 +40,70 @@ public class FadedTextView extends TextView {
|
||||
public FadedTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
setSingleLine(true);
|
||||
setEllipsize(null);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FadedTextView);
|
||||
mFadeWidth = a.getDimensionPixelSize(R.styleable.FadedTextView_fadeWidth, 0);
|
||||
a.recycle();
|
||||
|
||||
mCompoundPadding = getCompoundDrawablePadding();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
int width = getMeasuredWidth();
|
||||
private int getAvailableWidth() {
|
||||
return getWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
|
||||
}
|
||||
|
||||
// Layout doesn't return a proper width for getWidth().
|
||||
// Instead check the width of the first line, as we've restricted to just one line.
|
||||
if (getLayout().getLineWidth(0) > width) {
|
||||
final Drawable leftDrawable = getCompoundDrawables()[0];
|
||||
int drawableWidth = 0;
|
||||
if (leftDrawable != null) {
|
||||
drawableWidth = leftDrawable.getIntrinsicWidth() + mCompoundPadding;
|
||||
width -= drawableWidth;
|
||||
}
|
||||
|
||||
int color = getCurrentTextColor();
|
||||
float stop = ((float) (width - mFadeWidth) / (float) width);
|
||||
LinearGradient gradient = new LinearGradient(0, 0, width, 0,
|
||||
new int[] { color, color, 0x0 },
|
||||
new float[] { 0, stop, 1.0f - (drawableWidth / width) },
|
||||
Shader.TileMode.CLAMP);
|
||||
getPaint().setShader(gradient);
|
||||
} else {
|
||||
getPaint().setShader(null);
|
||||
private boolean needsEllipsis() {
|
||||
final int width = getAvailableWidth();
|
||||
if (width <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do a default draw.
|
||||
final Layout layout = getLayout();
|
||||
return (layout != null && layout.getLineWidth(0) > width);
|
||||
}
|
||||
|
||||
private void updateGradientShader() {
|
||||
final int color = getCurrentTextColor();
|
||||
final int width = getAvailableWidth();
|
||||
|
||||
final boolean needsNewGradient = (mTextGradient == null ||
|
||||
mTextGradient.getColor() != color ||
|
||||
mTextGradient.getWidth() != width);
|
||||
|
||||
final boolean needsEllipsis = needsEllipsis();
|
||||
if (needsEllipsis && needsNewGradient) {
|
||||
mTextGradient = new FadedTextGradient(width, mFadeWidth, color);
|
||||
}
|
||||
|
||||
getPaint().setShader(needsEllipsis ? mTextGradient : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
updateGradientShader();
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
private static class FadedTextGradient extends LinearGradient {
|
||||
private final int mWidth;
|
||||
private final int mColor;
|
||||
|
||||
public FadedTextGradient(int width, int fadeWidth, int color) {
|
||||
super(0, 0, width, 0,
|
||||
new int[] { color, color, 0x0 },
|
||||
new float[] { 0, ((float) (width - fadeWidth) / (float) width), 1.0f },
|
||||
Shader.TileMode.CLAMP);
|
||||
|
||||
mWidth = width;
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -786,7 +786,9 @@ public class GeckoMenu extends ListView
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int position) {
|
||||
return getItem(position).isEnabled();
|
||||
// Setting this to true is a workaround to fix disappearing
|
||||
// dividers in the menu in L (bug 1050780).
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addMenuItem(GeckoMenuItem menuItem) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 523 B |
Binary file not shown.
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 376 B |
Binary file not shown.
Before Width: | Height: | Size: 1017 B After Width: | Height: | Size: 737 B |
@ -5,7 +5,8 @@
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<item android:state_pressed="true"
|
||||
android:state_enabled="true">
|
||||
<shape>
|
||||
<solid android:color="@color/highlight" />
|
||||
</shape>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#D1D5DA"/>
|
||||
<solid android:color="@color/divider_light"/>
|
||||
<size android:height="1dp" />
|
||||
|
||||
</shape>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#D1D5DA"/>
|
||||
<solid android:color="@color/divider_light"/>
|
||||
<size android:width="1dp" />
|
||||
|
||||
</shape>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<shape android:shape="rectangle" >
|
||||
<stroke android:width="1px"
|
||||
android:color="@color/doorhanger_divider_light" />
|
||||
android:color="@color/divider_light" />
|
||||
|
||||
<solid android:color="#00000000" />
|
||||
</shape>
|
||||
|
@ -12,4 +12,4 @@
|
||||
android:layout_width="@dimen/menu_item_row_width"
|
||||
android:layout_height="@dimen/browser_toolbar_height"
|
||||
android:orientation="horizontal"
|
||||
android:background="#FFD6DEE4"/>
|
||||
android:background="#FFE1E1E6"/>
|
||||
|
@ -11,6 +11,8 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.BookmarkFolderView" parent="Widget.TwoLinePageRow.Title">
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">none</item>
|
||||
<item name="android:paddingLeft">60dip</item>
|
||||
<item name="android:drawablePadding">10dip</item>
|
||||
<item name="android:drawableLeft">@drawable/bookmark_folder</item>
|
||||
|
@ -59,7 +59,7 @@
|
||||
<!-- DropDown List View -->
|
||||
<style name="DropDownListView" parent="@android:style/Widget.Holo.ListView.DropDown">
|
||||
<item name="android:listSelector">@drawable/action_bar_button</item>
|
||||
<item name="android:divider">#FFD1D5DA</item>
|
||||
<item name="android:divider">@color/divider_light</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
</style>
|
||||
|
||||
|
@ -69,6 +69,10 @@
|
||||
<!-- Link colors -->
|
||||
<color name="text_color_link">#22629E</color>
|
||||
|
||||
<!-- Divider colors -->
|
||||
<color name="divider_light">#FFD7D9DB</color>
|
||||
<color name="divider_dark">#FFB3C2CE</color>
|
||||
|
||||
<color name="splash_background">#000000</color>
|
||||
<color name="splash_msgfont">#ffffff</color>
|
||||
<color name="splash_urlfont">#000000</color>
|
||||
@ -76,8 +80,6 @@
|
||||
|
||||
<color name="doorhanger_text">#FF222222</color>
|
||||
<color name="doorhanger_link">#FF2AA1FE</color>
|
||||
<color name="doorhanger_divider_light">#FFD1D5DA</color>
|
||||
<color name="doorhanger_divider_dark">#FFB3C2CE</color>
|
||||
<color name="doorhanger_background_dark">#FFDDE4EA</color>
|
||||
|
||||
<color name="validation_message_text">#ffffff</color>
|
||||
@ -120,6 +122,5 @@
|
||||
<color name="toast_background">#DD363B40</color>
|
||||
<color name="toast_button_background">#00000000</color>
|
||||
<color name="toast_button_pressed">#DD2C3136</color>
|
||||
<color name="toast_button_divider">#FFD1D5DA</color>
|
||||
<color name="toast_button_text">#FFFFFFFF</color>
|
||||
</resources>
|
||||
|
@ -45,7 +45,7 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.ListView" parent="Widget.BaseListView">
|
||||
<item name="android:divider">#D1D5DA</item>
|
||||
<item name="android:divider">@color/divider_light</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
<item name="android:cacheColorHint">@android:color/transparent</item>
|
||||
<item name="android:listSelector">@drawable/action_bar_button</item>
|
||||
@ -114,8 +114,6 @@
|
||||
|
||||
<style name="Widget.TwoLinePageRow.Title">
|
||||
<item name="android:textAppearance">@style/TextAppearance.Widget.Home.ItemTitle</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">none</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TwoLinePageRow.Url">
|
||||
@ -126,6 +124,8 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.BookmarkFolderView" parent="Widget.TwoLinePageRow.Title">
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">none</item>
|
||||
<item name="android:paddingLeft">10dip</item>
|
||||
<item name="android:drawablePadding">10dip</item>
|
||||
<item name="android:drawableLeft">@drawable/bookmark_folder</item>
|
||||
@ -189,8 +189,6 @@
|
||||
<style name="Widget.TopSitesGridItemTitle">
|
||||
<item name="android:textColor">@color/top_sites_grid_item_title</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">none</item>
|
||||
<item name="android:paddingTop">5dip</item>
|
||||
<item name="android:gravity">left</item>
|
||||
</style>
|
||||
@ -688,7 +686,7 @@
|
||||
</style>
|
||||
|
||||
<style name="ToastDividerBase">
|
||||
<item name="android:background">@color/toast_button_divider</item>
|
||||
<item name="android:background">@color/divider_light</item>
|
||||
<item name="android:layout_width">1dp</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
</style>
|
||||
|
@ -121,10 +121,10 @@ public class DoorHanger extends LinearLayout {
|
||||
if (theme == Theme.LIGHT) {
|
||||
// The default styles declared in doorhanger.xml are light-themed, so we just
|
||||
// need to set the divider color that we'll use in addButton.
|
||||
mDividerColor = mResources.getColor(R.color.doorhanger_divider_light);
|
||||
mDividerColor = mResources.getColor(R.color.divider_light);
|
||||
|
||||
} else if (theme == Theme.DARK) {
|
||||
mDividerColor = mResources.getColor(R.color.doorhanger_divider_dark);
|
||||
mDividerColor = mResources.getColor(R.color.divider_dark);
|
||||
|
||||
// Set a dark background, and use a smaller text size for dark-themed DoorHangers.
|
||||
setBackgroundColor(mResources.getColor(R.color.doorhanger_background_dark));
|
||||
|
@ -2746,9 +2746,9 @@ var LightWeightThemeWebInstaller = {
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
BrowserApp.deck.addEventListener("InstallBrowserTheme", this, false, true);
|
||||
BrowserApp.deck.addEventListener("PreviewBrowserTheme", this, false, true);
|
||||
BrowserApp.deck.addEventListener("ResetBrowserThemePreview", this, false, true);
|
||||
BrowserApp.deck.removeEventListener("InstallBrowserTheme", this, false, true);
|
||||
BrowserApp.deck.removeEventListener("PreviewBrowserTheme", this, false, true);
|
||||
BrowserApp.deck.removeEventListener("ResetBrowserThemePreview", this, false, true);
|
||||
},
|
||||
|
||||
handleEvent: function (event) {
|
||||
|
@ -201,8 +201,14 @@ XULStore.prototype = {
|
||||
}
|
||||
|
||||
// bug 319846 -- don't save really long attributes or values.
|
||||
if (id.length > 1024 || attr.length > 1024 || value.length > 1024)
|
||||
throw Components.Exception("id, attribute, or value too long", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
if (id.length > 512 || attr.length > 512) {
|
||||
throw Components.Exception("id or attribute name too long", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
if (value.length > 4096) {
|
||||
Services.console.logStringMessage("XULStore: Warning, truncating long attribute value")
|
||||
value = value.substr(0, 4096);
|
||||
}
|
||||
|
||||
let obj = this._data;
|
||||
if (!(docURI in obj)) {
|
||||
|
@ -97,6 +97,21 @@ add_task(function* testImport(){
|
||||
checkOldStore();
|
||||
});
|
||||
|
||||
add_task(function* testTruncation() {
|
||||
let dos = Array(8192).join("~");
|
||||
// Long id names should trigger an exception
|
||||
Assert.throws(() => XULStore.setValue(browserURI, dos, "foo", "foo"), /NS_ERROR_ILLEGAL_VALUE/);
|
||||
|
||||
// Long attr names should trigger an exception
|
||||
Assert.throws(() => XULStore.setValue(browserURI, "foo", dos, "foo"), /NS_ERROR_ILLEGAL_VALUE/);
|
||||
|
||||
// Long values should be truncated
|
||||
XULStore.setValue(browserURI, "dos", "dos", dos);
|
||||
dos =XULStore.getValue(browserURI, "dos", "dos");
|
||||
do_check_true(dos.length == 4096)
|
||||
XULStore.removeValue(browserURI, "dos", "dos")
|
||||
});
|
||||
|
||||
add_task(function* testGetValue() {
|
||||
// Get non-existing property
|
||||
checkValue(browserURI, "side-window", "height", "");
|
||||
|
@ -175,7 +175,7 @@
|
||||
xbl:inherits="accesskey=findnextaccesskey"/>
|
||||
</xul:hbox>
|
||||
<xul:toolbarbutton anonid="highlight"
|
||||
class="findbar-highlight tabbable"
|
||||
class="findbar-highlight findbar-button tabbable"
|
||||
label="&highlightAll.label;"
|
||||
accesskey="&highlightAll.accesskey;"
|
||||
tooltiptext="&highlightAll.tooltiptext;"
|
||||
@ -183,7 +183,7 @@
|
||||
type="checkbox"
|
||||
xbl:inherits="accesskey=highlightaccesskey"/>
|
||||
<xul:toolbarbutton anonid="find-case-sensitive"
|
||||
class="findbar-case-sensitive tabbable"
|
||||
class="findbar-case-sensitive findbar-button tabbable"
|
||||
label="&caseSensitive.label;"
|
||||
accesskey="&caseSensitive.accesskey;"
|
||||
tooltiptext="&caseSensitive.tooltiptext;"
|
||||
|
@ -290,10 +290,9 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
|
||||
this._tracedFunctions = tracedFunctions || [];
|
||||
this._holdWeak = !!holdWeak;
|
||||
this._storeCalls = !!storeCalls;
|
||||
this._contentObserver = new ContentObserver(this.tabActor);
|
||||
|
||||
on(this._contentObserver, "global-created", this._onGlobalCreated);
|
||||
on(this._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
on(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
on(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
|
||||
if (startRecording) {
|
||||
this.resumeRecording();
|
||||
@ -325,13 +324,11 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
|
||||
this._initialized = false;
|
||||
this._finalized = true;
|
||||
|
||||
this._contentObserver.stopListening();
|
||||
off(this._contentObserver, "global-created", this._onGlobalCreated);
|
||||
off(this._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
off(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
off(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
|
||||
this._tracedGlobals = null;
|
||||
this._tracedFunctions = null;
|
||||
this._contentObserver = null;
|
||||
}, {
|
||||
oneway: true
|
||||
}),
|
||||
@ -380,10 +377,15 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
|
||||
/**
|
||||
* Invoked whenever the current tab actor's document global is created.
|
||||
*/
|
||||
_onGlobalCreated: function(window) {
|
||||
_onGlobalCreated: function({window, id, isTopLevel}) {
|
||||
let self = this;
|
||||
|
||||
this._tracedWindowId = ContentObserver.GetInnerWindowID(window);
|
||||
// TODO: bug 981748, support more than just the top-level documents.
|
||||
if (!isTopLevel) {
|
||||
return;
|
||||
}
|
||||
this._tracedWindowId = id;
|
||||
|
||||
let unwrappedWindow = XPCNativeWrapper.unwrap(window);
|
||||
let callback = this._onContentFunctionCall;
|
||||
|
||||
@ -529,7 +531,7 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
|
||||
/**
|
||||
* Invoked whenever the current tab actor's inner window is destroyed.
|
||||
*/
|
||||
_onGlobalDestroyed: function(id) {
|
||||
_onGlobalDestroyed: function({window, id, isTopLevel}) {
|
||||
if (this._tracedWindowId == id) {
|
||||
this.pauseRecording();
|
||||
this.eraseRecording();
|
||||
|
@ -332,11 +332,9 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
||||
holdWeak: true,
|
||||
storeCalls: false
|
||||
});
|
||||
// Bind to the `global-destroyed` event on the content observer so we can
|
||||
// unbind events between the global destruction and the `finalize` cleanup
|
||||
// method on the actor.
|
||||
// TODO expose these events on CallWatcherActor itself, bug 1021321
|
||||
on(this._callWatcher._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
// Bind to the `window-destroyed` event so we can unbind events between
|
||||
// the global destruction and the `finalize` cleanup method on the actor.
|
||||
on(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
}, {
|
||||
request: { reload: Option(0, "boolean") },
|
||||
oneway: true
|
||||
@ -406,7 +404,7 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
||||
}
|
||||
this.tabActor = null;
|
||||
this._initialized = false;
|
||||
off(this._callWatcher._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
off(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
this._nativeToActorID = null;
|
||||
this._callWatcher.eraseRecording();
|
||||
this._callWatcher.finalize();
|
||||
@ -586,7 +584,7 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
|
||||
* so we can cleanup some things between the global being destroyed and
|
||||
* when the actor's `finalize` method gets called.
|
||||
*/
|
||||
_onGlobalDestroyed: function (id) {
|
||||
_onGlobalDestroyed: function ({id}) {
|
||||
if (this._callWatcher._tracedWindowId !== id) {
|
||||
return;
|
||||
}
|
||||
|
@ -1230,7 +1230,7 @@ TabActor.prototype = {
|
||||
// to let a chance to unregister it
|
||||
this._willNavigate(this.window, window.location.href, null, true);
|
||||
|
||||
this._windowDestroyed(this.window);
|
||||
this._windowDestroyed(this.window, null, true);
|
||||
|
||||
DevToolsUtils.executeSoon(() => {
|
||||
this._setWindow(window);
|
||||
@ -1311,11 +1311,12 @@ TabActor.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_windowDestroyed: function (window, id = null) {
|
||||
_windowDestroyed: function (window, id = null, isFrozen = false) {
|
||||
events.emit(this, "window-destroyed", {
|
||||
window: window,
|
||||
isTopLevel: window == this.window,
|
||||
id: id || getWindowID(window)
|
||||
id: id || getWindowID(window),
|
||||
isFrozen: isFrozen
|
||||
});
|
||||
},
|
||||
|
||||
@ -1969,7 +1970,7 @@ DebuggerProgressListener.prototype = {
|
||||
}
|
||||
|
||||
let window = evt.target.defaultView;
|
||||
this._tabActor._windowDestroyed(window);
|
||||
this._tabActor._windowDestroyed(window, null, true);
|
||||
}, "DebuggerProgressListener.prototype.onWindowHidden"),
|
||||
|
||||
observe: DevToolsUtils.makeInfallible(function(subject, topic) {
|
||||
|
@ -252,11 +252,10 @@ let WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
||||
this._initialized = true;
|
||||
|
||||
this._programActorsCache = [];
|
||||
this._contentObserver = new ContentObserver(this.tabActor);
|
||||
this._webglObserver = new WebGLObserver();
|
||||
|
||||
on(this._contentObserver, "global-created", this._onGlobalCreated);
|
||||
on(this._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
on(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
on(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
on(this._webglObserver, "program-linked", this._onProgramLinked);
|
||||
|
||||
if (reload) {
|
||||
@ -278,9 +277,8 @@ let WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
||||
}
|
||||
this._initialized = false;
|
||||
|
||||
this._contentObserver.stopListening();
|
||||
off(this._contentObserver, "global-created", this._onGlobalCreated);
|
||||
off(this._contentObserver, "global-destroyed", this._onGlobalDestroyed);
|
||||
off(this.tabActor, "window-ready", this._onGlobalCreated);
|
||||
off(this.tabActor, "window-destroyed", this._onGlobalDestroyed);
|
||||
off(this._webglObserver, "program-linked", this._onProgramLinked);
|
||||
|
||||
this._programActorsCache = null;
|
||||
@ -379,19 +377,22 @@ let WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
||||
/**
|
||||
* Invoked whenever the current tab actor's document global is created.
|
||||
*/
|
||||
_onGlobalCreated: function(window) {
|
||||
let id = ContentObserver.GetInnerWindowID(window);
|
||||
WebGLInstrumenter.handle(window, this._webglObserver);
|
||||
events.emit(this, "global-created", id);
|
||||
_onGlobalCreated: function({id, window, isTopLevel}) {
|
||||
if (isTopLevel) {
|
||||
WebGLInstrumenter.handle(window, this._webglObserver);
|
||||
events.emit(this, "global-created", id);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Invoked whenever the current tab actor's inner window is destroyed.
|
||||
*/
|
||||
_onGlobalDestroyed: function(id) {
|
||||
removeFromArray(this._programActorsCache, e => e.ownerWindow == id);
|
||||
this._webglObserver.unregisterContextsForWindow(id);
|
||||
events.emit(this, "global-destroyed", id);
|
||||
_onGlobalDestroyed: function({id, isTopLevel, isFrozen}) {
|
||||
if (isTopLevel && !isFrozen) {
|
||||
removeFromArray(this._programActorsCache, e => e.ownerWindow == id);
|
||||
this._webglObserver.unregisterContextsForWindow(id);
|
||||
events.emit(this, "global-destroyed", id);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
54
toolkit/devtools/server/tests/unit/test_memory_footprint.js
Normal file
54
toolkit/devtools/server/tests/unit/test_memory_footprint.js
Normal file
@ -0,0 +1,54 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var gClient;
|
||||
var gMgr;
|
||||
var gRefMemory;
|
||||
|
||||
function run_test() {
|
||||
gMgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(Ci.nsIMemoryReporterManager);
|
||||
Cu.forceGC();
|
||||
gRefMemory = gMgr.residentUnique;
|
||||
|
||||
add_test(init_server);
|
||||
add_test(add_browser_actors);
|
||||
add_test(connect_client);
|
||||
add_test(list_tabs);
|
||||
add_test(close_client);
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function check_footprint(step, max) {
|
||||
var footprint = (gMgr.residentUnique - gRefMemory) / 1024;
|
||||
|
||||
ok(footprint < max, "Footprint after " + step + " is " + footprint + " kB (should be less than " + max + " kB).");
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function init_server() {
|
||||
DebuggerServer.init(function () { return true; });
|
||||
check_footprint("DebuggerServer.init()", 500);
|
||||
}
|
||||
|
||||
function add_browser_actors() {
|
||||
DebuggerServer.addBrowserActors();
|
||||
check_footprint("DebuggerServer.addBrowserActors()", 10500);
|
||||
}
|
||||
|
||||
function connect_client() {
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.connect(function onConnect() {
|
||||
check_footprint("DebuggerClient.connect()", 11000);
|
||||
});
|
||||
}
|
||||
|
||||
function list_tabs() {
|
||||
gClient.listTabs(function onListTabs(aResponse) {
|
||||
check_footprint("DebuggerClient.listTabs()", 11500);
|
||||
});
|
||||
}
|
||||
|
||||
function close_client() {
|
||||
gClient.close(run_next_test);
|
||||
}
|
@ -209,3 +209,7 @@ reason = bug 937197
|
||||
[test_monitor_actor.js]
|
||||
[test_symbols-01.js]
|
||||
[test_symbols-02.js]
|
||||
[test_memory_footprint.js]
|
||||
run-sequentially = measure memory, has to be run solo
|
||||
skip-if = os != 'linux' || debug || asan
|
||||
reason = bug 1014071
|
||||
|
@ -613,19 +613,18 @@ Finder.prototype = {
|
||||
},
|
||||
|
||||
/*
|
||||
* For a given node, walk up it's parent chain, to try and find an
|
||||
* editable node.
|
||||
* For a given node returns its editable parent or null if there is none.
|
||||
* It's enough to check if aNode is a text node and its parent's parent is
|
||||
* instance of nsIDOMNSEditableElement.
|
||||
*
|
||||
* @param aNode the node we want to check
|
||||
* @returns the first node in the parent chain that is editable,
|
||||
* null if there is no such node
|
||||
*/
|
||||
_getEditableNode: function (aNode) {
|
||||
while (aNode) {
|
||||
if (aNode instanceof Ci.nsIDOMNSEditableElement)
|
||||
return aNode.editor ? aNode : null;
|
||||
|
||||
aNode = aNode.parentNode;
|
||||
if (aNode.nodeType === aNode.TEXT_NODE && aNode.parentNode && aNode.parentNode.parentNode &&
|
||||
aNode.parentNode.parentNode instanceof Ci.nsIDOMNSEditableElement) {
|
||||
return aNode.parentNode.parentNode;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user