This commit is contained in:
Ryan VanderMeulen 2013-12-09 17:45:06 -05:00
Родитель 5ad5ffa943 52ab5ad2dc
Коммит 2ac8a0ca97
498 изменённых файлов: 3152 добавлений и 4439 удалений

Просмотреть файл

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 908695 required a clobber on Windows because bug 928195
Bug 946067 required a clobber on Windows because bug 928195

Просмотреть файл

@ -25,7 +25,7 @@
#include "States.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsXPCOMStrings.h"
#include "nsComponentManagerUtils.h"
#include "nsIPersistentProperties2.h"

Просмотреть файл

@ -63,9 +63,9 @@
#include "nsTreeUtils.h"
#include "nsXBLPrototypeBinding.h"
#include "nsXBLBinding.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Util.h"
#include "nsDeckFrame.h"
#ifdef MOZ_XUL

Просмотреть файл

@ -1451,10 +1451,22 @@ DocAccessible::CacheChildren()
if (!rootElm)
return;
// Ignore last HTML:br, copied from HyperTextAccessible.
TreeWalker walker(this, rootElm);
Accessible* lastChild = nullptr;
while (Accessible* child = walker.NextChild()) {
if (lastChild)
AppendChild(lastChild);
Accessible* child = nullptr;
while ((child = walker.NextChild()) && AppendChild(child));
lastChild = child;
}
if (lastChild) {
if (lastChild->IsHTMLBr())
Document()->UnbindFromDocument(lastChild);
else
AppendChild(lastChild);
}
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -5,7 +5,7 @@
#include "RootAccessible.h"
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#define CreateEvent CreateEventA
#include "nsIDOMDocument.h"

Просмотреть файл

@ -56,7 +56,7 @@ function editableTextTest(aID)
/**
* setTextContents test.
*/
this.setTextContents = function setTextContents(aValue, aTrailChar)
this.setTextContents = function setTextContents(aValue)
{
var testID = "setTextContents '" + aValue + "' for " + prettyName(aID);
@ -66,8 +66,7 @@ function editableTextTest(aID)
acc.setTextContents(aValue);
}
var newValue = aValue + (aTrailChar ? aTrailChar : "");
var insertTripple = newValue ? [0, newValue.length, newValue] : null;
var insertTripple = aValue ? [0, aValue.length, aValue] : null;
var oldValue = getValue(aID);
var removeTripple = oldValue ? [0, oldValue.length, oldValue] : null;

Просмотреть файл

@ -20,14 +20,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
<script type="application/javascript">
function addTestEditable(aID, aTestRun, aTrailChar)
function addTestEditable(aID, aTestRun)
{
var et = new editableTextTest(aID);
//////////////////////////////////////////////////////////////////////////
// setTextContents
et.scheduleTest(et.setTextContents, "hello");
et.scheduleTest(et.setTextContents, "olleh", aTrailChar); // due to some reason this reports '\n' in the end
et.scheduleTest(et.setTextContents, "olleh");
et.scheduleTest(et.setTextContents, "");
//////////////////////////////////////////////////////////////////////////
@ -80,9 +80,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
{
// Prepare tested elements.
// Design mode on/off trigger document accessible subtree recreation.
// Design mode on/off triggers an editable state change event on
// the document accessible.
var frame = getNode("frame");
waitForEvent(EVENT_REORDER, frame.contentDocument, runTest);
waitForEvent(EVENT_STATE_CHANGE, frame.contentDocument, runTest);
frame.contentDocument.designMode = "on";
}

Просмотреть файл

@ -5,7 +5,7 @@
MOZ_APP_BASENAME=B2G
MOZ_APP_VENDOR=Mozilla
MOZ_APP_VERSION=28.0a1
MOZ_APP_VERSION=29.0a1
MOZ_APP_UA_NAME=Firefox
MOZ_UA_OS_AGNOSTIC=1

Просмотреть файл

@ -477,7 +477,7 @@ let CustomizableUIInternal = {
this.insertWidgetBefore(node, currentNode, container, aArea);
if (gResetting) {
this.notifyListeners("onWidgetReset", id, aArea);
this.notifyListeners("onWidgetReset", node, container);
}
}
@ -527,7 +527,7 @@ let CustomizableUIInternal = {
}
if (gResetting) {
this.notifyListeners("onAreaReset", aArea);
this.notifyListeners("onAreaReset", aArea, container);
}
} finally {
this.endBatchUpdate();
@ -668,6 +668,8 @@ let CustomizableUIInternal = {
}
let area = gAreas.get(aArea);
let isToolbar = area.get("type") == CustomizableUI.TYPE_TOOLBAR;
let isOverflowable = isToolbar && area.get("overflowable");
let showInPrivateBrowsing = gPalette.has(aWidgetId)
? gPalette.get(aWidgetId).showInPrivateBrowsing
: true;
@ -679,12 +681,15 @@ let CustomizableUIInternal = {
continue;
}
let container = areaNode.customizationTarget;
let widgetNode = container.ownerDocument.getElementById(aWidgetId);
let widgetNode = window.document.getElementById(aWidgetId);
if (!widgetNode) {
ERROR("Widget not found, unable to remove");
continue;
}
let container = areaNode.customizationTarget;
if (isOverflowable) {
container = areaNode.overflowable.getContainerFor(widgetNode);
}
this.notifyListeners("onWidgetBeforeDOMChange", widgetNode, null, container, true);
@ -702,7 +707,7 @@ let CustomizableUIInternal = {
}
this.notifyListeners("onWidgetAfterDOMChange", widgetNode, null, container, true);
if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) {
if (isToolbar) {
areaNode.setAttribute("currentset", gPlacements.get(aArea).join(','));
}
@ -2094,47 +2099,330 @@ this.CustomizableUI = {
get WIDE_PANEL_CLASS() "panel-wide-item",
get PANEL_COLUMN_COUNT() 3,
/**
* Add a listener object that will get fired for various events regarding
* customization.
*
* @param aListener the listener object to add
*
* Not all event handler methods need to be defined.
* CustomizableUI will catch exceptions. Events are dispatched
* synchronously on the UI thread, so if you can delay any/some of your
* processing, that is advisable. The following event handlers are supported:
* - onWidgetAdded(aWidgetId, aArea, aPosition)
* Fired when a widget is added to an area. aWidgetId is the widget that
* was added, aArea the area it was added to, and aPosition the position
* in which it was added.
* - onWidgetMoved(aWidgetId, aArea, aOldPosition, aNewPosition)
* Fired when a widget is moved within its area. aWidgetId is the widget
* that was moved, aArea the area it was moved in, aOldPosition its old
* position, and aNewPosition its new position.
* - onWidgetRemoved(aWidgetId, aArea)
* Fired when a widget is removed from its area. aWidgetId is the widget
* that was removed, aArea the area it was removed from.
*
* - onWidgetBeforeDOMChange(aNode, aNextNode, aContainer, aIsRemoval)
* Fired *before* a widget's DOM node is acted upon by CustomizableUI
* (to add, move or remove it). aNode is the DOM node changed, aNextNode
* the DOM node (if any) before which a widget will be inserted,
* aContainer the *actual* DOM container (could be an overflow panel in
* case of an overflowable toolbar), and aWasRemoval is true iff the
* action about to happen is the removal of the DOM node.
* - onWidgetAfterDOMChange(aNode, aNextNode, aContainer, aWasRemoval)
* Like onWidgetBeforeDOMChange, but fired after the change to the DOM
* node of the widget.
*
* - onWidgetReset(aNode, aContainer)
* Fired after a reset to default placements moves a widget's node to a
* different location. aNode is the widget's node, aContainer is the
* area it was moved into (NB: it might already have been there and been
* moved to a different position!)
* - onAreaReset(aArea, aContainer)
* Fired after a reset to default placements is complete on an area's
* DOM node. Note that this is fired for each DOM node. aArea is the area
* that was reset, aContainer the DOM node that was reset.
*
* - onWidgetCreated(aWidgetId)
* Fired when a widget with id aWidgetId has been created, but before it
* is added to any placements or any DOM nodes have been constructed.
* Only fired for API-based widgets.
* - onWidgetAfterCreation(aWidgetId, aArea)
* Fired after a widget with id aWidgetId has been created, and has been
* added to either its default area or the area in which it was placed
* previously. If the widget has no default area and/or it has never
* been placed anywhere, aArea may be null. Only fired for API-based
* widgets.
* - onWidgetDestroyed(aWidgetId)
* Fired when widgets are destroyed. aWidgetId is the widget that is
* being destroyed. Only fired for API-based widgets.
* - onWidgetInstanceRemoved(aWidgetId, aDocument)
* Fired when a window is unloaded and a widget's instance is destroyed
* because of this. Only fired for API-based widgets.
*
* - onWidgetDrag(aWidgetId, aArea)
* Fired both when and after customize mode drag handling system tries
* to determine the width and height of widget aWidgetId when dragged to a
* different area. aArea will be the area the item is dragged to, or
* undefined after the measurements have been done and the node has been
* moved back to its 'regular' area.
*
* - onCustomizeStart(aWindow)
* Fired when opening customize mode in aWindow.
* - onCustomizeEnd(aWindow)
* Fired when exiting customize mode in aWindow.
*/
addListener: function(aListener) {
CustomizableUIInternal.addListener(aListener);
},
/**
* Remove a listener added with addListener
* @param aListener the listener object to remove
*/
removeListener: function(aListener) {
CustomizableUIInternal.removeListener(aListener);
},
/**
* Register a customizable area with CustomizableUI.
* @param aName the name of the area to register. Can only contain
* alphanumeric characters, dashes (-) and underscores (_).
* @param aProps the properties of the area. The following properties are
* recognized:
* - type: the type of area. Either TYPE_TOOLBAR (default) or
* TYPE_MENU_PANEL;
* - anchor: for a menu panel or overflowable toolbar, the
* anchoring node for the panel.
* - legacy: set to true if you want customizableui to
* automatically migrate the currentset attribute
* - overflowable: set to true if your toolbar is overflowable.
* This requires an anchor, and only has an
* effect for toolbars.
* - defaultPlacements: an array of widget IDs making up the
* default contents of the area
*/
registerArea: function(aName, aProperties) {
CustomizableUIInternal.registerArea(aName, aProperties);
},
/**
* Register a concrete node for a registered area. This method is automatically
* called from any toolbar in the main browser window that has its
* "customizable" attribute set to true. There should normally be no need to
* call it yourself.
*
* Note that ideally, you should register your toolbar using registerArea
* before any of the toolbars have their XBL bindings constructed (which
* will happen when they're added to the DOM and are not hidden). If you
* don't, and your toolbar has a defaultset attribute, CustomizableUI will
* register it automatically. If your toolbar does not have a defaultset
* attribute, the node will be saved for processing when you call
* registerArea. Note that CustomizableUI won't restore state in the area,
* allow the user to customize it in customize mode, or otherwise deal
* with it, until the area has been registered.
*/
registerToolbarNode: function(aToolbar, aExistingChildren) {
CustomizableUIInternal.registerToolbarNode(aToolbar, aExistingChildren);
},
/**
* Register the menu panel node. This method should not be called by anyone
* apart from the built-in PanelUI.
* @param aPanel the panel DOM node being registered.
*/
registerMenuPanel: function(aPanel) {
CustomizableUIInternal.registerMenuPanel(aPanel);
},
/**
* Unregister a customizable area. The inverse of registerArea.
*
* Unregistering an area will remove all the (removable) widgets in the
* area, which will return to the panel, and destroy all other traces
* of the area within CustomizableUI. Note that this means the *contents*
* of the area's DOM nodes will be moved to the panel or removed, but
* the area's DOM nodes *themselves* will stay.
*
* Furthermore, by default the placements of the area will be kept in the
* saved state (!) and restored if you re-register the area at a later
* point. This is useful for e.g. add-ons that get disabled and then
* re-enabled (e.g. when they update).
*
* You can override this last behaviour (and destroy the placements
* information in the saved state) by passing true for aDestroyPlacements.
*
* @param aName the name of the area to unregister
* @param aDestroyPlacements whether to destroy the placements information
* for the area, too.
*/
unregisterArea: function(aName, aDestroyPlacements) {
CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements);
},
/**
* Add a widget to an area.
* If the area to which you try to add is not known to CustomizableUI,
* this will throw.
* If the area to which you try to add has not yet been restored from its
* legacy state, this will postpone the addition.
* If the area to which you try to add is the same as the area in which
* the widget is currently placed, this will do the same as
* moveWidgetWithinArea.
* If the widget cannot be removed from its original location, this will
* no-op.
*
* This will fire an onWidgetAdded notification,
* and an onWidgetBeforeDOMChange and onWidgetAfterDOMChange notification
* for each window CustomizableUI knows about.
*
* @param aWidgetId the widget to add
* @param aArea the area to add the widget to
* @param aPosition the position at which to add the widget. If you do not
* pass a position, the widget will be added to the end
* of the area.
*/
addWidgetToArea: function(aWidgetId, aArea, aPosition) {
CustomizableUIInternal.addWidgetToArea(aWidgetId, aArea, aPosition);
},
/**
* Remove a widget from its area. If the widget cannot be removed from its
* area, or is not in any area, this will no-op. Otherwise, this will fire an
* onWidgetRemoved notification, and an onWidgetBeforeDOMChange and
* onWidgetAfterDOMChange notification for each window CustomizableUI knows
* about.
*
* @param aWidgetId the widget to remove
*/
removeWidgetFromArea: function(aWidgetId) {
CustomizableUIInternal.removeWidgetFromArea(aWidgetId);
},
/**
* Move a widget within an area.
* If the widget is not in any area, this will no-op.
* If the widget is already at the indicated position, this will no-op.
*
* Otherwise, this will move the widget and fire an onWidgetMoved notification,
* and an onWidgetBeforeDOMChange and onWidgetAfterDOMChange notification for
* each window CustomizableUI knows about.
*
* @param aWidgetid the widget to move
* @param aPosition the position to move the widget to.
* Negative values or values greater than the number of
* widgets will be interpreted to mean moving the widget to
* respectively the first or last position.
*/
moveWidgetWithinArea: function(aWidgetId, aPosition) {
CustomizableUIInternal.moveWidgetWithinArea(aWidgetId, aPosition);
},
/**
* Ensure a XUL-based widget created in a window after areas were
* initialized moves to its correct position.
* This is roughly equivalent to manually looking up the position and using
* insertItem in the old API, but a lot less work for consumers.
* Always prefer this over using toolbar.insertItem (which might no-op
* because it delegates to addWidgetToArea) or, worse, moving items in the
* DOM yourself.
*
* @param aWidgetId the widget that was just created
* @param aWindow the window in which you want to ensure it was added.
*
* NB: why is this API per-window, you wonder? Because if you need this,
* presumably you yourself need to create the widget in all the windows
* and need to loop through them anyway.
*/
ensureWidgetPlacedInWindow: function(aWidgetId, aWindow) {
return CustomizableUIInternal.ensureWidgetPlacedInWindow(aWidgetId, aWindow);
},
/**
* Start a batch update of items.
* During a batch update, the customization state is not saved to the user's
* preferences file, in order to reduce (possibly sync) IO.
* Calls to begin/endBatchUpdate may be nested.
*
* Callers should ensure that NO MATTER WHAT they call endBatchUpdate once
* for each call to endBatchUpdate, even if there are exceptions in the
* code in the batch update. Otherwise, for the duration of the
* Firefox session, customization state is never saved. Typically, you
* would do this using a try...finally block.
*/
beginBatchUpdate: function() {
CustomizableUIInternal.beginBatchUpdate();
},
/**
* End a batch update. See the documentation for beginBatchUpdate above.
*
* State is not saved if we believe it is identical to the last known
* saved state. State is only ever saved when all batch updates have
* finished (ie there has been 1 endBatchUpdate call for each
* beginBatchUpdate call). If any of the endBatchUpdate calls pass
* aForceDirty=true, we will flush to the prefs file.
*
* @param aForceDirty force CustomizableUI to flush to the prefs file when
* all batch updates have finished.
*/
endBatchUpdate: function(aForceDirty) {
CustomizableUIInternal.endBatchUpdate(aForceDirty);
},
/**
* Create a widget.
*
* To create a widget, you should pass an object with its desired
* properties. The following properties are supported:
*
* - id: the ID of the widget (required).
* - type: a string indicating the type of widget. Possible types
* are:
* 'button' - for simple button widgets (the default)
* 'view' - for buttons that open a panel or subview,
* depending on where they are placed.
* 'custom' - for fine-grained control over the creation
* of the widget.
* - viewId: Only useful for views (and required there): the id of the
* <panelview> that should be shown when clicking the widget.
* - onBuild(aDoc): Only useful for custom widgets (and required there); a
* function that will be invoked with the document in which
* to build a widget. Should return the DOM node that has
* been constructed.
* - onCreated(aNode): Attached to all widgets; a function that will be invoked
* whenever the widget has a DOM node constructed, passing the
* constructed node as an argument.
* - onCommand(aEvt): Only useful for button widgets; a function that will be
* invoked when the user activates the button.
* - onClick(aEvt): Attached to all widgets; a function that will be invoked
* when the user clicks the widget.
* - onViewShowing(aEvt): Only useful for views; a function that will be
* invoked when a user shows your view.
* - onViewHiding(aEvt): Only useful for views; a function that will be
* invoked when a user hides your view.
* - tooltiptext: string to use for the tooltip of the widget
* - label: string to use for the label of the widget
* - removable: whether the widget is removable (optional, default: false)
* - overflows: whether widget can overflow when in an overflowable
* toolbar (optional, default: true)
* - defaultArea: default area to add the widget to
* (optional, default: none)
* - shortcutId: id of an element that has a shortcut for this widget
* (optional, default: null). This is only used to display
* the shortcut as part of the tooltip for builtin widgets
* (which have strings inside
* customizableWidgets.properties). If you're in an add-on,
* you should not set this property.
* - showInPrivateBrowsing: whether to show the widget in private browsing
* mode (optional, default: true)
*
* @param aProperties the specifications for the widget.
*/
createWidget: function(aProperties) {
return CustomizableUIInternal.wrapWidget(
CustomizableUIInternal.createWidget(aProperties)
);
},
/**
* Destroy a widget
*
* If the widget is part of the default placements in an area, this will
* remove it from there. It will also remove any DOM instances. However,
* it will keep the widget in the placements for whatever area it was
* in at the time. You can remove it from there yourself by calling
* CustomizableUI.removeWidgetFromArea(aWidgetId).
*
* @param aWidgetId the widget to destroy
*/
destroyWidget: function(aWidgetId) {
CustomizableUIInternal.destroyWidget(aWidgetId);
},
@ -2765,7 +3053,14 @@ OverflowableToolbar.prototype = {
return [this._target, null];
}
return [this._list, nextNode];
}
},
getContainerFor: function(aNode) {
if (aNode.classList.contains("overflowedItem")) {
return this._list;
}
return this._target;
},
};
// When IDs contain special characters, we need to escape them for use with querySelector:

Просмотреть файл

@ -406,8 +406,8 @@ const CustomizableWidgets = [{
updateZoomResetButton();
}.bind(this),
onWidgetReset: function(aWidgetId) {
if (aWidgetId != this.id)
onWidgetReset: function(aWidgetNode) {
if (aWidgetNode != node)
return;
updateCombinedWidgetStyle(node, this.currentArea, true);
updateZoomResetButton();
@ -506,8 +506,8 @@ const CustomizableWidgets = [{
updateCombinedWidgetStyle(node);
}.bind(this),
onWidgetReset: function(aWidgetId) {
if (aWidgetId != this.id)
onWidgetReset: function(aWidgetNode) {
if (aWidgetNode != node)
return;
updateCombinedWidgetStyle(node, this.currentArea);
}.bind(this),
@ -814,4 +814,4 @@ if (isWin8OrHigher()) {
});
}
#endif
#endif
#endif

Просмотреть файл

@ -101,7 +101,7 @@ AreaPositionManager.prototype = {
let doc = aContainer.ownerDocument;
let draggedItem = doc.getElementById(aDraggedItemId);
// If dragging a wide item, always pick the first item in a row:
if (draggedItem &&
if (this._inPanel && draggedItem &&
draggedItem.classList.contains(CustomizableUI.WIDE_PANEL_CLASS)) {
return this._firstInRow(closest);
}

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsCOMPtr.h"
#include "nsGNOMEShellService.h"

Просмотреть файл

@ -1 +1 @@
28.0a1
29.0a1

Просмотреть файл

@ -149,7 +149,8 @@ ToolbarView.prototype = {
_onStepOverPressed: function() {
if (DebuggerController.activeThread.paused) {
DebuggerController.StackFrames.currentFrameDepth = -1;
DebuggerController.activeThread.stepOver();
let warn = DebuggerController._ensureResumptionOrder;
DebuggerController.activeThread.stepOver(warn);
}
},
@ -159,7 +160,8 @@ ToolbarView.prototype = {
_onStepInPressed: function() {
if (DebuggerController.activeThread.paused) {
DebuggerController.StackFrames.currentFrameDepth = -1;
DebuggerController.activeThread.stepIn();
let warn = DebuggerController._ensureResumptionOrder;
DebuggerController.activeThread.stepIn(warn);
}
},
@ -169,7 +171,8 @@ ToolbarView.prototype = {
_onStepOutPressed: function() {
if (DebuggerController.activeThread.paused) {
DebuggerController.StackFrames.currentFrameDepth = -1;
DebuggerController.activeThread.stepOut();
let warn = DebuggerController._ensureResumptionOrder;
DebuggerController.activeThread.stepOut(warn);
}
},

Просмотреть файл

@ -484,22 +484,22 @@ function testOriginalRawDataIntegrity(arr, obj) {
function testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) {
is(fooScope.header, true,
"A named scope should have a header visible.");
is(fooScope.target.hasAttribute("non-header"), false,
is(fooScope.target.hasAttribute("untitled"), false,
"The non-header attribute should not be applied to scopes with headers.");
is(anonymousScope.header, false,
"An anonymous scope should have a header visible.");
is(anonymousScope.target.hasAttribute("non-header"), true,
is(anonymousScope.target.hasAttribute("untitled"), true,
"The non-header attribute should not be applied to scopes without headers.");
is(barVar.header, true,
"A named variable should have a header visible.");
is(barVar.target.hasAttribute("non-header"), false,
is(barVar.target.hasAttribute("untitled"), false,
"The non-header attribute should not be applied to variables with headers.");
is(anonymousVar.header, false,
"An anonymous variable should have a header visible.");
is(anonymousVar.target.hasAttribute("non-header"), true,
is(anonymousVar.target.hasAttribute("untitled"), true,
"The non-header attribute should not be applied to variables without headers.");
}

Просмотреть файл

@ -72,29 +72,29 @@ function testVariablesAndPropertiesFiltering() {
is(constr2Var.expanded, true,
"The constr2Var should be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1,
"There should be 1 variable displayed in the local scope.");
is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be some variables displayed in the global scope.");
is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"__proto__", "The only inner variable displayed should be '__proto__'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"constructor", "The first inner property displayed should be 'constructor'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[1].getAttribute("value"),
"__proto__", "The second inner property displayed should be '__proto__'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[2].getAttribute("value"),
"constructor", "The third inner property displayed should be 'constructor'");
}

Просмотреть файл

@ -72,36 +72,36 @@ function testVariablesAndPropertiesFiltering() {
is(constr2Var.expanded, true,
"The constr2Var should be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1,
"There should be 1 variable displayed in the local scope.");
is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be no variables displayed in the global scope.");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 4,
"There should be 4 properties displayed in the local scope.");
is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"__proto__", "The only inner variable displayed should be '__proto__'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"constructor", "The first inner property displayed should be 'constructor'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[1].getAttribute("value"),
"__proto__", "The second inner property displayed should be '__proto__'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[2].getAttribute("value"),
"constructor", "The third inner property displayed should be 'constructor'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[3].getAttribute("value"),
"name", "The fourth inner property displayed should be 'name'");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .value")[3].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .value")[3].getAttribute("value"),
"\"Function\"", "The fourth inner property displayed should be '\"Function\"'");
}

Просмотреть файл

@ -58,20 +58,20 @@ function testVariablesAndPropertiesFiltering() {
is(globalScope.expanded, true,
"The globalScope should be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1,
"There should be 1 variable displayed in the local scope.");
is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be 0 variables displayed in the function scope.");
is(localScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the local scope.");
is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the with scope.");
is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the function scope.");
is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0,
"There should be 0 properties displayed in the global scope.");
}
@ -79,9 +79,9 @@ function testVariablesAndPropertiesFiltering() {
typeText(gSearchBox, "*one");
testFiltered("one");
isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be some variables displayed in the global scope.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"one", "The only inner variable displayed should be 'one'");
}
@ -104,9 +104,9 @@ function testVariablesAndPropertiesFiltering() {
typeText(gSearchBox, "*two");
testFiltered("two");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0,
"There should be no variables displayed in the global scope.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"two", "The only inner variable displayed should be 'two'");
}

Просмотреть файл

@ -58,7 +58,7 @@ function testVariablesAndPropertiesFiltering() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 0]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
is(functionScope.get("arguments").expanded, false,
"The arguments pseudoarray in functionScope should not be expanded.");
@ -69,12 +69,12 @@ function testVariablesAndPropertiesFiltering() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 0, 1, 1]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
is(functionScope.get("arguments").expanded, false,
"The arguments pseudoarray in functionScope should not be expanded.");
is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"EventTarget", "The EventTarget object should be visible.");
is(globalScope.get("EventTarget").expanded, false,
"The EventTarget object in globalScope should not be expanded.");
@ -85,17 +85,17 @@ function testVariablesAndPropertiesFiltering() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([0, 1, 3, 1]);
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"aNumber", "The aNumber param should be visible.");
is(functionScope.get("aNumber").expanded, false,
"The aNumber param in functionScope should not be expanded.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"),
"a", "The a variable should be visible.");
is(functionScope.get("a").expanded, false,
"The a variable in functionScope should not be expanded.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
is(functionScope.get("arguments").expanded, false,
"The arguments pseudoarray in functionScope should not be expanded.");
@ -106,37 +106,37 @@ function testVariablesAndPropertiesFiltering() {
assertScopeExpansion([true, true, true, true]);
assertVariablesCountAtLeast([4, 1, 3, 1]);
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"this", "The this reference should be visible.");
is(localScope.get("this").expanded, false,
"The this reference in localScope should not be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"),
"one", "The one variable should be visible.");
is(localScope.get("one").expanded, false,
"The one variable in localScope should not be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"),
"two", "The two variable should be visible.");
is(localScope.get("two").expanded, false,
"The two variable in localScope should not be expanded.");
is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[3].getAttribute("value"),
is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[3].getAttribute("value"),
"__proto__", "The __proto__ reference should be visible.");
is(localScope.get("__proto__").expanded, false,
"The __proto__ reference in localScope should not be expanded.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"),
"aNumber", "The aNumber param should be visible.");
is(functionScope.get("aNumber").expanded, false,
"The aNumber param in functionScope should not be expanded.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"),
"a", "The a variable should be visible.");
is(functionScope.get("a").expanded, false,
"The a variable in functionScope should not be expanded.");
is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"),
is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"),
"arguments", "The arguments pseudoarray should be visible.");
is(functionScope.get("arguments").expanded, false,
"The arguments pseudoarray in functionScope should not be expanded.");
@ -162,19 +162,19 @@ function testVariablesAndPropertiesFiltering() {
}
function assertVariablesCountAtLeast(aCounts) {
ok(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[0],
ok(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[0],
"There should be " + aCounts[0] +
" variable displayed in the local scope (" + step + ").");
ok(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[1],
ok(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[1],
"There should be " + aCounts[1] +
" variable displayed in the with scope (" + step + ").");
ok(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[2],
ok(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[2],
"There should be " + aCounts[2] +
" variable displayed in the function scope (" + step + ").");
ok(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[3],
ok(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[3],
"There should be " + aCounts[3] +
" variable displayed in the global scope (" + step + ").");

Просмотреть файл

@ -19,9 +19,9 @@ function test() {
is(tooltip.querySelectorAll(".variables-view-container").length, 1,
"There should be one variables view container added to the tooltip.");
is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
"There should be one scope with no header displayed.");
is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
"There should be one variable with no header displayed.");
is(tooltip.querySelectorAll(".variables-view-property").length, 2,

Просмотреть файл

@ -19,9 +19,9 @@ function test() {
is(tooltip.querySelectorAll(".variables-view-container").length, 1,
"There should be one variables view container added to the tooltip.");
is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
"There should be one scope with no header displayed.");
is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
"There should be one variable with no header displayed.");
is(tooltip.querySelectorAll(".variables-view-property").length, 7,

Просмотреть файл

@ -33,9 +33,9 @@ function test() {
is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 0,
"There should be no simple text node added to the tooltip.");
is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
"There should be one scope with no header displayed.");
is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1,
is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
"There should be one variable with no header displayed.");
ok(tooltip.querySelectorAll(".variables-view-property").length >= propertyCount,

Просмотреть файл

@ -1476,7 +1476,7 @@ Scope.prototype = {
if (this._isHeaderVisible || !this._nameString) {
return;
}
this._target.removeAttribute("non-header");
this._target.removeAttribute("untitled");
this._isHeaderVisible = true;
},
@ -1489,7 +1489,7 @@ Scope.prototype = {
return;
}
this.expand();
this._target.setAttribute("non-header", "");
this._target.setAttribute("untitled", "");
this._isHeaderVisible = false;
},
@ -1928,10 +1928,10 @@ Scope.prototype = {
}
if (aStatus) {
this._isMatch = true;
this.target.removeAttribute("non-match");
this.target.removeAttribute("unmatched");
} else {
this._isMatch = false;
this.target.setAttribute("non-match", "");
this.target.setAttribute("unmatched", "");
}
},

Просмотреть файл

@ -50,9 +50,9 @@
overflow: hidden;
}
.variables-view-scope[non-header] > .title,
.variable-or-property[non-header] > .title,
.variable-or-property[non-match] > .title {
.variables-view-scope[untitled] > .title,
.variable-or-property[untitled] > .title,
.variable-or-property[unmatched] > .title {
display: none;
}

Просмотреть файл

@ -112,6 +112,9 @@ endif
DEFINES += -DBINPATH=$(BINPATH)
DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION)
ifdef MOZ_NATIVE_ICU
DEFINES += -DMOZ_NATIVE_ICU
endif
ifdef MOZ_SHARED_ICU
DEFINES += -DMOZ_SHARED_ICU
endif

Просмотреть файл

@ -101,6 +101,7 @@
#endif
#endif
#endif
#ifndef MOZ_NATIVE_ICU
#ifdef MOZ_SHARED_ICU
#ifdef XP_WIN
#ifdef MOZ_DEBUG
@ -122,6 +123,7 @@
@BINPATH@/libicuuc.so.@MOZ_ICU_VERSION@
#endif
#endif
#endif
[browser]
; [Base Browser Files]

Просмотреть файл

@ -1,5 +1,6 @@
af
ak
an
ar
ast
be
@ -79,6 +80,7 @@ th
tr
uk
vi
xh
zh-CN
zh-TW
zu

Просмотреть файл

@ -308,10 +308,11 @@ var BrowserUI = {
isStartURI: function isStartURI(aURI) {
aURI = aURI || Browser.selectedBrowser.currentURI.spec;
return aURI == kStartURI;
return aURI == kStartURI || aURI == "about:home";
},
updateStartURIAttributes: function (aURI) {
let wasStart = Elements.windowState.hasAttribute("startpage");
aURI = aURI || Browser.selectedBrowser.currentURI.spec;
if (this.isStartURI(aURI)) {
ContextUI.displayNavbar();
@ -319,6 +320,13 @@ var BrowserUI = {
} else if (aURI != "about:blank") { // about:blank is loaded briefly for new tabs; ignore it
Elements.windowState.removeAttribute("startpage");
}
let isStart = Elements.windowState.hasAttribute("startpage");
if (wasStart != isStart) {
let event = document.createEvent("Events");
event.initEvent("StartUIChange", true, true);
Browser.selectedBrowser.dispatchEvent(event);
}
},
getDisplayURI: function(browser) {

Просмотреть файл

@ -1305,6 +1305,7 @@ Tab.prototype = {
}
browser.addEventListener("pageshow", onPageShowEvent, true);
browser.addEventListener("DOMWindowCreated", this, false);
browser.addEventListener("StartUIChange", this, false);
Elements.browsers.addEventListener("SizeChanged", this, false);
browser.messageManager.addMessageListener("Content:StateChange", this);
@ -1316,12 +1317,19 @@ Tab.prototype = {
updateViewport: function (aEvent) {
// <meta name=viewport> is not yet supported; just use the browser size.
this.browser.setWindowSize(this.browser.clientWidth, this.browser.clientHeight);
let browser = this.browser;
// On the start page we add padding to keep the browser above the navbar.
let paddingBottom = parseInt(getComputedStyle(browser).paddingBottom, 10);
let height = browser.clientHeight - paddingBottom;
browser.setWindowSize(browser.clientWidth, height);
},
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "DOMWindowCreated":
case "StartUIChange":
this.updateViewport();
break;
case "SizeChanged":
@ -1354,6 +1362,7 @@ Tab.prototype = {
destroy: function destroy() {
this._browser.messageManager.removeMessageListener("Content:StateChange", this);
this._browser.removeEventListener("DOMWindowCreated", this, false);
this._browser.removeEventListener("StartUIChange", this, false);
Elements.browsers.removeEventListener("SizeChanged", this, false);
clearTimeout(this._updateThumbnailTimeout);

Просмотреть файл

@ -18,8 +18,7 @@ var MetroDownloadsView = {
_inited: false,
_progressAlert: null,
_lastSec: Infinity,
_notificationBox: null,
_progressNotification: null,
_progressNotificationInfo: new Map(),
_runDownloadBooleanMap: new Map(),
@ -56,11 +55,12 @@ var MetroDownloadsView = {
Services.obs.addObserver(this, "dl-run", true);
Services.obs.addObserver(this, "dl-failed", true);
this._notificationBox = Browser.getNotificationBox();
this._progress = new DownloadProgressListener(this);
this.manager.addListener(this._progress);
Elements.tabList.addEventListener("TabClose", this, false);
this._downloadProgressIndicator = document.getElementById("download-progress");
if (this.manager.activeDownloadCount) {
@ -74,10 +74,54 @@ var MetroDownloadsView = {
Services.obs.removeObserver(this, "dl-done");
Services.obs.removeObserver(this, "dl-run");
Services.obs.removeObserver(this, "dl-failed");
if (Elements && Elements.tabList)
Elements.tabList.removeEventListener("TabClose", this);
}
},
_restartWithActiveDownloads: function() {
get _notificationBox() {
return Browser.getNotificationBox(Browser.selectedBrowser);
},
get _notificationBoxes() {
let currentBox = this._notificationBox;
let boxes = [
currentBox
];
for (let { linkedBrowser } of Elements.tabList.children) {
if (linkedBrowser !== Browser.selectedBrowser) {
let notificationBox = Browser.getNotificationBox(linkedBrowser);
if (notificationBox)
boxes.push(notificationBox);
}
}
return boxes;
},
get _progressNotification() {
let notn = this._getNotificationWithValue("download-progress");
let currentBox = this._notificationBox;
// move the progress notification if attached to a different browser
if (notn && notn.parentNode !== currentBox) {
notn.parentNode.removeNotification(notn);
currentBox.insertBefore(notn, currentBox.firstChild);
}
return notn;
},
_getNotificationWithValue: function(aValue) {
let notn;
let allNotificationBoxes = this._notificationBoxes;
for(let box of allNotificationBoxes) {
notn = box.getNotificationWithValue(aValue);
if (notn) {
break;
}
}
return notn;
},
_restartWithActiveDownloads: function() {
let activeDownloads = this.manager.activeDownloads;
while (activeDownloads.hasMoreElements()) {
@ -140,9 +184,9 @@ var MetroDownloadsView = {
this._runDownloadBooleanMap.delete(aDownload.targetFile.path);
this._downloadCount--;
this._downloadsInProgress--;
if (this._downloadsInProgress <= 0) {
this._notificationBox.removeNotification(this._progressNotification);
this._progressNotification = null;
let notn = this._progressNotification;
if (notn && this._downloadsInProgress <= 0) {
this._notificationBox.removeNotification(notn);
}
} catch (ex) {
Util.dumpLn("Failed to cancel download, with id: "+aDownload.id+", download target URI spec: " + fileURI.spec);
@ -384,32 +428,35 @@ var MetroDownloadsView = {
},
onDownloadButton: function dv_onDownloadButton() {
if (this._downloadsInProgress) {
if (!this._removeNotification("download-progress")) {
this.updateInfobar();
}
} else if (this._downloadCount) {
if (!this._removeNotification("download-complete")) {
this._showDownloadCompleteNotification();
}
let progressNotification = this._getNotificationWithValue("download-progress");
let wasProgressVisible = (progressNotification &&
progressNotification.parentNode == this._notificationBox);
let completeNotification = this._getNotificationWithValue("download-complete");
let wasCompleteVisible = (completeNotification &&
completeNotification.parentNode == this._notificationBox);
this._removeNotification("download-complete");
this._removeNotification("download-progress");
if (this._downloadsInProgress && !wasProgressVisible) {
this.updateInfobar();
} else if (this._downloadCount && !wasCompleteVisible) {
this._showDownloadCompleteNotification();
}
},
_removeNotification: function (aValue) {
let notification = this._notificationBox.getNotificationWithValue(aValue);
if (!notification) {
return false;
}
this._notificationBox.removeNotification(notification);
return true;
let notification = this._getNotificationWithValue(aValue);
return notification &&
notification.parentNode.removeNotification(notification);
},
updateInfobar: function dv_updateInfobar() {
let message = this._computeDownloadProgressString();
this._updateCircularProgressMeter();
if (this._progressNotification == null ||
!this._notificationBox.getNotificationWithValue("download-progress")) {
let notn = this._progressNotification;
if (!notn) {
let cancelButtonText =
Strings.browser.GetStringFromName("downloadCancel");
@ -425,23 +472,23 @@ var MetroDownloadsView = {
}
];
this._progressNotification =
this.showNotification("download-progress", message, buttons,
this._notificationBox.PRIORITY_WARNING_LOW);
notn = this.showNotification("download-progress", message, buttons,
this._notificationBox.PRIORITY_WARNING_LOW);
ContextUI.displayNavbar();
} else {
this._progressNotification.label = message;
notn.label = message;
}
},
updateDownload: function dv_updateDownload(aDownload) {
if (this._progressNotification != null) {
this._saveDownloadData(aDownload);
this._progressNotification.label =
this._saveDownloadData(aDownload);
let notn = this._progressNotification;
if (notn) {
notn.label =
this._computeDownloadProgressString(aDownload);
this._updateCircularProgressMeter();
}
this._updateCircularProgressMeter();
},
watchDownload: function dv_watchDownload(aDownload) {
@ -486,8 +533,9 @@ var MetroDownloadsView = {
this._showDownloadCompleteToast();
this._showDownloadCompleteNotification();
}
this._notificationBox.removeNotification(this._progressNotification);
this._progressNotification = null;
let notn = this._progressNotification;
if (notn)
this._notificationBox.removeNotification(notn);
}
break;
case "dl-failed":
@ -497,6 +545,22 @@ var MetroDownloadsView = {
}
},
handleEvent: function(aEvent) {
switch (aEvent.type) {
case 'TabClose': {
let browser = aEvent.originalTarget.linkedBrowser;
dump("DownloadNotificationsView handleEvent, got TabClose event for browser: "+browser+"\n");
let notn = this._getNotificationWithValue("download-progress");
if (notn && notn.defaultView == browser.contentWindow) {
let nextTab = Browser.getNextTab(aEvent.originalTarget);
let box = Browser.getNotificationBox(nextTab.linkedBrowser);
box.insertBefore(notn, box.firstChild);
}
break;
}
}
},
QueryInterface: function (aIID) {
if (!aIID.equals(Ci.nsIObserver) &&
!aIID.equals(Ci.nsISupportsWeakReference) &&

Просмотреть файл

@ -467,7 +467,7 @@
cursor: text;
}
.variable-or-property:not([non-header]) > .variables-view-element-details {
.variable-or-property:not([untitled]) > .variables-view-element-details {
-moz-margin-start: 10px;
}
@ -632,7 +632,7 @@
min-height: 24px;
}
.variable-or-property[non-match] {
.variable-or-property[unmatched] {
border: none;
margin: 0;
}

Просмотреть файл

@ -461,7 +461,7 @@
cursor: text;
}
.variable-or-property:not([non-header]) > .variables-view-element-details {
.variable-or-property:not([untitled]) > .variables-view-element-details {
-moz-margin-start: 10px;
}
@ -626,7 +626,7 @@
min-height: 24px;
}
.variable-or-property[non-match] {
.variable-or-property[unmatched] {
border: none;
margin: 0;
}

Просмотреть файл

@ -488,16 +488,16 @@
color: #b6babf;
margin: 0;
padding: 0;
border-left: 1px solid #42484f;
-moz-border-start: 1px solid #42484f;
-moz-box-align: center;
}
.devtools-tab:first-child {
border-left-width: 0;
-moz-border-start-width: 0;
}
.devtools-tab:last-child {
border-right: 1px solid #5a6169;
-moz-border-end: 1px solid #42484f;
}
.devtools-tab > image {
@ -522,7 +522,7 @@
}
.devtools-tab:active > image,
.devtools-tab[selected=true] > label {
.devtools-tab[selected=true] > image {
opacity: 1;
}
@ -546,12 +546,16 @@
}
.devtools-tab[selected=true]:not(:first-child) {
padding-left: 1px;
-moz-padding-start: 1px;
}
.devtools-tab[selected=true]:last-child {
-moz-padding-end: 1px;
}
.devtools-tab[selected=true] + .devtools-tab {
border-left-width: 0;
padding-left: 1px;
-moz-border-start-width: 0;
-moz-padding-start: 1px;
}
.devtools-tab:not([selected=true]).highlighted {

Просмотреть файл

@ -464,7 +464,7 @@
cursor: text;
}
.variable-or-property:not([non-header]) > .variables-view-element-details {
.variable-or-property:not([untitled]) > .variables-view-element-details {
-moz-margin-start: 10px;
}
@ -629,7 +629,7 @@
min-height: 24px;
}
.variable-or-property[non-match] {
.variable-or-property[unmatched] {
border: none;
margin: 0;
}

Просмотреть файл

@ -9,7 +9,7 @@
* same-origin with anything but themselves.
*/
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsNullPrincipal.h"
#include "nsNullPrincipalURI.h"

Просмотреть файл

@ -6,7 +6,7 @@
#include "nsScriptSecurityManager.h"
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "js/OldDebugAPI.h"
#include "xpcprivate.h"

Просмотреть файл

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
28.0a1
29.0a1

Просмотреть файл

@ -5,9 +5,9 @@
#include "mozilla/dom/EventSource.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/EventSourceBinding.h"
#include "mozilla/Util.h"
#include "js/OldDebugAPI.h"
#include "nsNetUtil.h"

Просмотреть файл

@ -10,10 +10,10 @@
* utility methods for subclasses, and so forth.
*/
#include "mozilla/ArrayUtils.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Util.h"
#include "mozilla/dom/FragmentOrElement.h"

Просмотреть файл

@ -28,6 +28,7 @@
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
#include "nsNPAPIPluginInstance.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/Base64.h"
@ -45,7 +46,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/TextEvents.h"
#include "mozilla/Util.h"
#include "nsAString.h"
#include "nsAttrName.h"
#include "nsAttrValue.h"

Просмотреть файл

@ -10,10 +10,10 @@
#include "nsDocument.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h"
#include "mozilla/Likely.h"
#include <algorithm>

Просмотреть файл

@ -9,8 +9,6 @@
* is loaded and they are destroyed when gklayout is unloaded.
*/
#include "mozilla/Util.h"
#include "nsGkAtoms.h"
#include "nsStaticAtom.h"

Просмотреть файл

@ -18,7 +18,6 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/MutationEvent.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Util.h"
#include "nsAsyncDOMEvent.h"
#include "nsAttrValueOrString.h"
#include "nsBindingManager.h"

Просмотреть файл

@ -10,7 +10,7 @@
* prefix, namespace, and localName.
*/
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Likely.h"
#include "nscore.h"

Просмотреть файл

@ -4,7 +4,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsTreeSanitizer.h"
#include "nsCSSParser.h"

Просмотреть файл

@ -6,9 +6,9 @@
#include "nsXMLHttpRequest.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Util.h"
#include "nsDOMBlobBuilder.h"
#include "nsIDOMDocument.h"
#include "nsIDOMProgressEvent.h"

Просмотреть файл

@ -18,9 +18,15 @@ DriverInfo = (function() {
// ---------------------------------------------------------------------------
// OS and driver identification
// Stolen from content/canvas/test/webgl/test_webgl_conformance_test_suite.html
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
function detectDriverInfo() {
try {
var cc = SpecialPowers.Cc;
} catch (e) {
throw 'No SpecialPowers!';
}
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var doc = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser).parseFromString("<html/>", "text/html");
var canvas = doc.createElement("canvas");
@ -46,6 +52,51 @@ DriverInfo = (function() {
return [webglVendor, webglRenderer];
}
function detectOSInfo() {
try {
var cc = SpecialPowers.Cc;
} catch (e) {
throw 'No SpecialPowers!';
}
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
// From reftest.js:
var runtime = Cc['@mozilla.org/xre/app-info;1'].getService(Ci.nsIXULRuntime);
var os = null;
var version = null;
if (navigator.platform.indexOf('Win') == 0) {
os = OS.WINDOWS;
// code borrowed from browser/modules/test/browser_taskbar_preview.js
version = SpecialPowers.Services.sysinfo.getProperty('version');
version = parseFloat(version);
// Version 6.0 is Vista, 6.1 is 7.
} else if (navigator.platform.indexOf('Mac') == 0) {
os = OS.MAC;
var versionMatch = /Mac OS X (\d+.\d+)/.exec(navigator.userAgent);
version = versionMatch ? parseFloat(versionMatch[1]) : null;
} else if (runtime.widgetToolkit == 'gonk') {
os = OS.B2G;
} else if (navigator.appVersion.indexOf('Android') != -1) {
os = OS.ANDROID;
// From layout/tools/reftest/reftest.js:
version = SpecialPowers.Services.sysinfo.getProperty('version');
} else if (navigator.platform.indexOf('Linux') == 0) {
// Must be checked after android, as android also has a 'Linux' platform string.
os = OS.LINUX;
}
return [os, version];
}
var OS = {
WINDOWS: 'windows',
MAC: 'mac',
@ -65,34 +116,10 @@ DriverInfo = (function() {
var kOSVersion = null;
var kDriver = null;
// From reftest.js:
var runtime = Cc['@mozilla.org/xre/app-info;1'].getService(Ci.nsIXULRuntime);
if (navigator.platform.indexOf('Win') == 0) {
kOS = OS.WINDOWS;
// code borrowed from browser/modules/test/browser_taskbar_preview.js
var version = SpecialPowers.Services.sysinfo.getProperty('version');
kOSVersion = parseFloat(version);
// Version 6.0 is Vista, 6.1 is 7.
} else if (navigator.platform.indexOf('Mac') == 0) {
kOS = OS.MAC;
var versionMatch = /Mac OS X (\d+.\d+)/.exec(navigator.userAgent);
kOSVersion = versionMatch ? parseFloat(versionMatch[1]) : null;
} else if (runtime.widgetToolkit == 'gonk') {
kOS = OS.B2G;
} else if (navigator.appVersion.indexOf('Android') != -1) {
kOS = OS.ANDROID;
// From layout/tools/reftest/reftest.js:
kOSVersion = SpecialPowers.Services.sysinfo.getProperty('version');
} else if (navigator.platform.indexOf('Linux') == 0) {
// Must be checked after android, as android also has a 'Linux' platform string.
kOS = OS.LINUX;
try {
[kOS, kOSVersion] = detectOSInfo();
} catch (e) {
// Generally just fails when we don't have SpecialPowers.
}
try {

Просмотреть файл

@ -0,0 +1,86 @@
import sys
import os.path
import re
assert len(sys.argv) == 2
mochiPath = sys.argv[1]
extDotPos = mochiPath.find('.html')
assert extDotPos != -1, 'mochitest target must be an html doc.'
testPath = mochiPath[:extDotPos] + '.solo.html'
def ReadLocalFile(include):
incPath = os.path.dirname(mochiPath)
filePath = os.path.join(incPath, include)
data = None
try:
f = open(filePath, 'r')
data = f.read()
except:
pass
try:
f.close()
except:
pass
return data
kSimpleTestReplacement = '''\n
<script>
// SimpleTest.js replacement
function ok(val, text) {
var elem = document.getElementById('mochi-to-testcase-output');
var status = val ? 'Test <font color=\\'green\\'>passed</font>: '
: 'Test <font color=\\'red\\' >FAILED</font>: ';
elem.innerHTML += '\\n<br/>\\n' + status + text;
}
function todo(val, text) {
ok(!val, 'Todo: ' + text);
}
</script>
<div id='mochi-to-testcase-output'></div>
\n'''
fin = open(mochiPath, 'r')
fout = open(testPath, 'w')
includePattern = re.compile('<script\\s*src=[\'"](.*)\\.js[\'"]>\\s*</script>')
cssPattern = re.compile('<link\\s*rel=[\'"]stylesheet[\'"]\\s*href=[\'"]([^=>]*)[\'"]>')
for line in fin:
skipLine = False
for css in cssPattern.findall(line):
skipLine = True
print('Ignoring stylesheet: ' + css)
for inc in includePattern.findall(line):
skipLine = True
if inc == '/MochiKit/MochiKit':
continue
if inc == '/tests/SimpleTest/SimpleTest':
print('Injecting SimpleTest replacement')
fout.write(kSimpleTestReplacement);
continue
incData = ReadLocalFile(inc + '.js')
if not incData:
print('Warning: Unknown JS file ignored: ' + inc + '.js')
continue
print('Injecting include: ' + inc + '.js')
fout.write('\n<script>\n// Imported from: ' + inc + '.js\n');
fout.write(incData);
fout.write('\n</script>\n');
continue
if skipLine:
continue
fout.write(line)
continue
fin.close()
fout.close()

Просмотреть файл

@ -86,6 +86,7 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/settings',
'/dom/src/storage',
'/js/xpconnect/wrappers',
'/layout/generic',
'/layout/xul',
'/layout/xul/tree/',

Просмотреть файл

@ -4,8 +4,8 @@
* 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/. */
#include "mozilla/ArrayUtils.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/Util.h"
#include "nsDOMDataTransfer.h"

Просмотреть файл

@ -5,6 +5,7 @@
#include "base/basictypes.h"
#include "AccessCheck.h"
#include "ipc/IPCMessageUtils.h"
#include "nsCOMPtr.h"
#include "nsError.h"
@ -33,6 +34,14 @@
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
namespace workers {
extern bool IsCurrentThreadRunningChromeWorker();
} // namespace workers
} // namespace dom
} // namespace mozilla
static char *sPopupAllowedEvents;
@ -217,6 +226,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
bool
nsDOMEvent::IsChrome(JSContext* aCx) const
{
return mIsMainThreadEvent ?
xpc::AccessCheck::isChrome(js::GetContextCompartment(aCx)) :
mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
}
// nsIDOMEventInterface
NS_METHOD nsDOMEvent::GetType(nsAString& aType)
{
@ -436,25 +453,40 @@ nsDOMEvent::GetIsTrusted(bool *aIsTrusted)
NS_IMETHODIMP
nsDOMEvent::PreventDefault()
{
if (mEvent->mFlags.mCancelable) {
mEvent->mFlags.mDefaultPrevented = true;
// This method is called only from C++ code which must handle default action
// of this event. So, pass true always.
PreventDefaultInternal(true);
return NS_OK;
}
// Need to set an extra flag for drag events.
if (mEvent->eventStructType == NS_DRAG_EVENT && IsTrusted()) {
nsCOMPtr<nsINode> node = do_QueryInterface(mEvent->currentTarget);
if (!node) {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->currentTarget);
if (win) {
node = win->GetExtantDoc();
}
}
if (node && !nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
mEvent->mFlags.mDefaultPreventedByContent = true;
}
}
void
nsDOMEvent::PreventDefault(JSContext* aCx)
{
MOZ_ASSERT(aCx, "JS context must be specified");
// Note that at handling default action, another event may be dispatched.
// Then, JS in content mey be call preventDefault()
// even in the event is in system event group. Therefore, don't refer
// mInSystemGroup here.
PreventDefaultInternal(IsChrome(aCx));
}
void
nsDOMEvent::PreventDefaultInternal(bool aCalledByDefaultHandler)
{
if (!mEvent->mFlags.mCancelable) {
return;
}
return NS_OK;
mEvent->mFlags.mDefaultPrevented = true;
// Note that even if preventDefault() has already been called by chrome,
// a call of preventDefault() by content needs to overwrite
// mDefaultPreventedByContent to true because in such case, defaultPrevented
// must be true when web apps check it after they call preventDefault().
if (!aCalledByDefaultHandler) {
mEvent->mFlags.mDefaultPreventedByContent = true;
}
}
void
@ -1143,6 +1175,24 @@ const char* nsDOMEvent::GetEventName(uint32_t aEventType)
return nullptr;
}
bool
nsDOMEvent::DefaultPrevented(JSContext* aCx) const
{
MOZ_ASSERT(aCx, "JS context must be specified");
NS_ENSURE_TRUE(mEvent, false);
// If preventDefault() has never been called, just return false.
if (!mEvent->mFlags.mDefaultPrevented) {
return false;
}
// If preventDefault() has been called by content, return true. Otherwise,
// i.e., preventDefault() has been called by chrome, return true only when
// this is called by chrome.
return mEvent->mFlags.mDefaultPreventedByContent || IsChrome(aCx);
}
bool
nsDOMEvent::GetPreventDefault() const
{
@ -1151,6 +1201,9 @@ nsDOMEvent::GetPreventDefault() const
doc->WarnOnceAbout(nsIDocument::eGetPreventDefault);
}
}
// GetPreventDefault() is legacy and Gecko specific method. Although,
// the result should be same as defaultPrevented, we don't need to break
// backward compatibility of legacy method. Let's behave traditionally.
return DefaultPrevented();
}
@ -1166,6 +1219,9 @@ NS_IMETHODIMP
nsDOMEvent::GetDefaultPrevented(bool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
// This method must be called by only event handlers implemented by C++.
// Then, the handlers must handle default action. So, this method don't need
// to check if preventDefault() has been called by content or chrome.
*aReturn = DefaultPrevented();
return NS_OK;
}

Просмотреть файл

@ -153,9 +153,20 @@ public:
// xpidl implementation
// void PreventDefault();
// You MUST NOT call PreventDefaultJ(JSContext*) from C++ code. A call of
// this method always sets Event.defaultPrevented true for web contents.
// If default action handler calls this, web applications meet wrong
// defaultPrevented value.
void PreventDefault(JSContext* aCx);
// You MUST NOT call DefaultPrevented(JSContext*) from C++ code. This may
// return false even if PreventDefault() has been called.
// See comments in its implementation for the detail.
bool DefaultPrevented(JSContext* aCx) const;
bool DefaultPrevented() const
{
return mEvent && mEvent->mFlags.mDefaultPrevented;
return mEvent->mFlags.mDefaultPrevented;
}
bool MultipleActionsPrevented() const
@ -190,6 +201,20 @@ protected:
void SetEventType(const nsAString& aEventTypeArg);
already_AddRefed<nsIContent> GetTargetFromFrame();
/**
* IsChrome() returns true if aCx is chrome context or the event is created
* in chrome's thread. Otherwise, false.
*/
bool IsChrome(JSContext* aCx) const;
/**
* @param aCalledByDefaultHandler Should be true when this is called by
* C++ or Chrome. Otherwise, e.g., called
* by a call of Event.preventDefault() in
* content script, false.
*/
void PreventDefaultInternal(bool aCalledByDefaultHandler);
mozilla::WidgetEvent* mEvent;
nsRefPtr<nsPresContext> mPresContext;
nsCOMPtr<mozilla::dom::EventTarget> mExplicitOriginalTarget;

Просмотреть файл

@ -14,7 +14,7 @@
#include "nsContentUtils.h"
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/ContentEvents.h"
#include "mozilla/TextEvents.h"

Просмотреть файл

@ -2610,10 +2610,13 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
nsWeakFrame targetFrame(aTargetFrame);
nsEventStatus statusX = *aStatus;
nsEventStatus statusY = *aStatus;
MOZ_ASSERT(*aStatus != nsEventStatus_eConsumeNoDefault &&
!aEvent->mFlags.mDefaultPrevented,
"If you make legacy events dispatched for default prevented wheel "
"event, you need to initialize stateX and stateY");
EventState stateX, stateY;
if (scrollDeltaY) {
SendLineScrollEvent(aTargetFrame, aEvent, &statusY,
SendLineScrollEvent(aTargetFrame, aEvent, stateY,
scrollDeltaY, DELTA_DIRECTION_Y);
if (!targetFrame.IsAlive()) {
*aStatus = nsEventStatus_eConsumeNoDefault;
@ -2622,7 +2625,7 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
}
if (pixelDeltaY) {
SendPixelScrollEvent(aTargetFrame, aEvent, &statusY,
SendPixelScrollEvent(aTargetFrame, aEvent, stateY,
pixelDeltaY, DELTA_DIRECTION_Y);
if (!targetFrame.IsAlive()) {
*aStatus = nsEventStatus_eConsumeNoDefault;
@ -2631,7 +2634,7 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
}
if (scrollDeltaX) {
SendLineScrollEvent(aTargetFrame, aEvent, &statusX,
SendLineScrollEvent(aTargetFrame, aEvent, stateX,
scrollDeltaX, DELTA_DIRECTION_X);
if (!targetFrame.IsAlive()) {
*aStatus = nsEventStatus_eConsumeNoDefault;
@ -2640,7 +2643,7 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
}
if (pixelDeltaX) {
SendPixelScrollEvent(aTargetFrame, aEvent, &statusX,
SendPixelScrollEvent(aTargetFrame, aEvent, stateX,
pixelDeltaX, DELTA_DIRECTION_X);
if (!targetFrame.IsAlive()) {
*aStatus = nsEventStatus_eConsumeNoDefault;
@ -2648,21 +2651,18 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
}
}
if (statusY == nsEventStatus_eConsumeNoDefault ||
statusX == nsEventStatus_eConsumeNoDefault) {
if (stateY.mDefaultPrevented || stateX.mDefaultPrevented) {
*aStatus = nsEventStatus_eConsumeNoDefault;
return;
}
if (statusY == nsEventStatus_eConsumeDoDefault ||
statusX == nsEventStatus_eConsumeDoDefault) {
*aStatus = nsEventStatus_eConsumeDoDefault;
aEvent->mFlags.mDefaultPrevented = true;
aEvent->mFlags.mDefaultPreventedByContent |=
stateY.mDefaultPreventedByContent || stateX.mDefaultPreventedByContent;
}
}
void
nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
WidgetWheelEvent* aEvent,
nsEventStatus* aStatus,
EventState& aState,
int32_t aDelta,
DeltaDirection aDeltaDirection)
{
@ -2678,9 +2678,8 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
WidgetMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_SCROLL,
aEvent->widget);
if (*aStatus == nsEventStatus_eConsumeNoDefault) {
event.mFlags.mDefaultPrevented = true;
}
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
@ -2690,14 +2689,18 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
event.delta = aDelta;
event.inputSource = aEvent->inputSource;
nsEventStatus status = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(targetContent, aTargetFrame->PresContext(),
&event, nullptr, aStatus);
&event, nullptr, &status);
aState.mDefaultPrevented =
event.mFlags.mDefaultPrevented || status == nsEventStatus_eConsumeNoDefault;
aState.mDefaultPreventedByContent = event.mFlags.mDefaultPreventedByContent;
}
void
nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
WidgetWheelEvent* aEvent,
nsEventStatus* aStatus,
EventState& aState,
int32_t aPixelDelta,
DeltaDirection aDeltaDirection)
{
@ -2714,9 +2717,8 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
WidgetMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_PIXEL_SCROLL,
aEvent->widget);
if (*aStatus == nsEventStatus_eConsumeNoDefault) {
event.mFlags.mDefaultPrevented = true;
}
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
@ -2726,8 +2728,12 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
event.delta = aPixelDelta;
event.inputSource = aEvent->inputSource;
nsEventStatus status = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(targetContent, aTargetFrame->PresContext(),
&event, nullptr, aStatus);
&event, nullptr, &status);
aState.mDefaultPrevented =
event.mFlags.mDefaultPrevented || status == nsEventStatus_eConsumeNoDefault;
aState.mDefaultPreventedByContent = event.mFlags.mDefaultPreventedByContent;
}
nsIScrollableFrame*

Просмотреть файл

@ -481,6 +481,17 @@ protected:
DELTA_DIRECTION_Y
};
struct MOZ_STACK_CLASS EventState
{
bool mDefaultPrevented;
bool mDefaultPreventedByContent;
EventState() :
mDefaultPrevented(false), mDefaultPreventedByContent(false)
{
}
};
/**
* SendLineScrollEvent() dispatches a DOMMouseScroll event for the
* WidgetWheelEvent. This method shouldn't be called for non-trusted
@ -488,14 +499,15 @@ protected:
*
* @param aTargetFrame The event target of wheel event.
* @param aEvent The original Wheel event.
* @param aStatus The event status, must not be
* nsEventStatus_eConsumeNoDefault.
* @param aState The event which should be set to the dispatching
* event. This also returns the dispatched event
* state.
* @param aDelta The delta value of the event.
* @param aDeltaDirection The X/Y direction of dispatching event.
*/
void SendLineScrollEvent(nsIFrame* aTargetFrame,
mozilla::WidgetWheelEvent* aEvent,
nsEventStatus* aStatus,
EventState& aState,
int32_t aDelta,
DeltaDirection aDeltaDirection);
@ -506,14 +518,15 @@ protected:
*
* @param aTargetFrame The event target of wheel event.
* @param aEvent The original Wheel event.
* @param aStatus The event status, must not be
* nsEventStatus_eConsumeNoDefault.
* @param aState The event which should be set to the dispatching
* event. This also returns the dispatched event
* state.
* @param aPixelDelta The delta value of the event.
* @param aDeltaDirection The X/Y direction of dispatching event.
*/
void SendPixelScrollEvent(nsIFrame* aTargetFrame,
mozilla::WidgetWheelEvent* aEvent,
nsEventStatus* aStatus,
EventState& aState,
int32_t aPixelDelta,
DeltaDirection aDeltaDirection);

Просмотреть файл

@ -15,4 +15,5 @@ support-files =
[test_bug602962.xul]
[test_bug617528.xul]
[test_bug679494.xul]
[test_bug930374-chrome.html]
[test_eventctors.xul]

Просмотреть файл

@ -83,6 +83,7 @@ skip-if = true # Disabled due to timeouts.
[test_bug847597.html]
[test_bug855741.html]
[test_bug864040.html]
[test_bug930374-content.html]
skip-if = toolkit == "gonk"
[test_clickevent_on_input.html]
[test_continuous_wheel_events.html]

Просмотреть файл

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=930374
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 930374</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=930374">Mozilla Bug 930374</a>
<div id="display">
<input id="input-text">
</div>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var gKeyPress = null;
function onKeyPress(aEvent)
{
gKeyPress = aEvent;
is(aEvent.target, document.getElementById("input-text"), "input element should have focus");
ok(!aEvent.defaultPrevented, "keypress event should be consumed before keypress event handler");
}
function runTests()
{
document.addEventListener("keypress", onKeyPress, false);
var input = document.getElementById("input-text");
input.focus();
input.addEventListener("input", function (aEvent) {
input.removeEventListener("input", arguments.callee, false);
ok(gKeyPress,
"Test1: keypress event must be fired before an input event");
ok(gKeyPress.defaultPrevented,
"Test1: keypress event's defaultPrevented should be true in chrome even if it's consumed by default action handler of editor");
setTimeout(function () {
ok(gKeyPress.defaultPrevented,
"Test2: keypress event's defaultPrevented should be true after event dispatching finished");
SimpleTest.finish();
}, 0);
}, false);
sendChar("a");
}
SimpleTest.waitForFocus(runTests);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,72 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=930374
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 930374</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=930374">Mozilla Bug 930374</a>
<div id="display">
<input id="input-text">
</div>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var gKeyPress = null;
function onKeyPress(aEvent)
{
gKeyPress = aEvent;
is(aEvent.target, document.getElementById("input-text"), "input element should have focus");
ok(!aEvent.defaultPrevented, "keypress event should be consumed before keypress event handler");
}
function runTests()
{
document.addEventListener("keypress", onKeyPress, false);
var input = document.getElementById("input-text");
input.focus();
input.addEventListener("input", function (aEvent) {
input.removeEventListener("input", arguments.callee, false);
ok(gKeyPress,
"Test1: keypress event must be fired before an input event");
ok(!gKeyPress.defaultPrevented,
"Test1: keypress event's defaultPrevented should be false even though it's consumed by the default action handler of editor");
gKeyPress.preventDefault();
ok(gKeyPress.defaultPrevented,
"Test1: keypress event's defaultPrevented should become true because of a call of preventDefault()");
}, false);
sendChar("a");
gKeyPress = null;
input.addEventListener("input", function (aEvent) {
input.removeEventListener("input", arguments.callee, false);
ok(gKeyPress,
"Test2: keypress event must be fired before an input event");
ok(!gKeyPress.defaultPrevented,
"Test2: keypress event's defaultPrevented should be false even though it's consumed by the default action handler of editor");
setTimeout(function () {
ok(!gKeyPress.defaultPrevented,
"Test2: keypress event's defaultPrevented should not become true after event dispatching finished");
SimpleTest.finish();
}, 0);
}, false);
sendChar("b");
}
SimpleTest.waitForFocus(runTests);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -5,7 +5,6 @@
#include "mozilla/dom/HTMLBRElement.h"
#include "mozilla/dom/HTMLBRElementBinding.h"
#include "mozilla/Util.h"
#include "nsAttrValueInlines.h"
#include "nsStyleConsts.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "HTMLBodyElement.h"
#include "mozilla/dom/HTMLBodyElementBinding.h"
#include "nsAttrValueInlines.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "HTMLDivElement.h"
#include "nsGenericHTMLElement.h"
#include "nsStyleConsts.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "HTMLFontElement.h"
#include "mozilla/dom/HTMLFontElementBinding.h"
#include "nsAttrValueInlines.h"

Просмотреть файл

@ -5,7 +5,6 @@
#include "mozilla/dom/HTMLFrameElement.h"
#include "mozilla/dom/HTMLFrameElementBinding.h"
#include "mozilla/Util.h"
class nsIDOMDocument;

Просмотреть файл

@ -6,7 +6,6 @@
#include "mozilla/dom/HTMLHeadingElement.h"
#include "mozilla/dom/HTMLHeadingElementBinding.h"
#include "mozilla/Util.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsMappedAttributes.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/HTMLIFrameElementBinding.h"
#include "nsMappedAttributes.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLImageElementBinding.h"
#include "nsGkAtoms.h"

Просмотреть файл

@ -5,6 +5,7 @@
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/Date.h"
#include "nsAsyncDOMEvent.h"
@ -94,7 +95,6 @@
#include "nsTextEditorState.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Util.h" // DebugOnly
#include "mozilla/Preferences.h"
#include "mozilla/MathAlgorithms.h"
@ -3835,11 +3835,10 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
// the editor's handling of up/down keypress events. For that reason we
// just ignore aVisitor.mEventStatus here and go ahead and handle the
// event to increase/decrease the value of the number control.
// XXX we still need to allow script to call preventDefault() on the
// event, but right now we can't tell the difference between the editor
// on script doing that (bug 930374).
StepNumberControlForUserEvent(keyEvent->keyCode == NS_VK_UP ? 1 : -1);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
if (!aVisitor.mEvent->mFlags.mDefaultPreventedByContent) {
StepNumberControlForUserEvent(keyEvent->keyCode == NS_VK_UP ? 1 : -1);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
} else if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
switch (aVisitor.mEvent->message) {

Просмотреть файл

@ -7,7 +7,7 @@
#define mozilla_dom_HTMLLIElement_h
#include "mozilla/Attributes.h"
#include "mozilla/Util.h"
#include "nsIDOMHTMLLIElement.h"
#include "nsGenericHTMLElement.h"

Просмотреть файл

@ -7,8 +7,8 @@
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Util.h"
#include "base/basictypes.h"
#include "nsIDOMHTMLMediaElement.h"

Просмотреть файл

@ -5,8 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsAutoPtr.h"

Просмотреть файл

@ -12,7 +12,6 @@
#include "mozilla/dom/HTMLOptionElement.h"
#include "mozilla/dom/HTMLOptionsCollectionBinding.h"
#include "mozilla/dom/HTMLSelectElement.h"
#include "mozilla/Util.h"
#include "nsContentCreatorFunctions.h"
#include "nsError.h"
#include "nsEventDispatcher.h"

Просмотреть файл

@ -7,7 +7,6 @@
#define mozilla_dom_HTMLParagraphElement_h
#include "mozilla/Attributes.h"
#include "mozilla/Util.h"
#include "nsIDOMHTMLParagraphElement.h"
#include "nsGenericHTMLElement.h"

Просмотреть файл

@ -7,7 +7,6 @@
#define mozilla_dom_HTMLPreElement_h
#include "mozilla/Attributes.h"
#include "mozilla/Util.h"
#include "nsIDOMHTMLPreElement.h"
#include "nsGenericHTMLElement.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/dom/HTMLOptGroupElement.h"
#include "mozilla/dom/HTMLOptionElement.h"
#include "mozilla/dom/HTMLSelectElementBinding.h"
#include "mozilla/Util.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentList.h"
#include "nsError.h"

Просмотреть файл

@ -5,8 +5,8 @@
#ifndef mozilla_dom_HTMLSharedListElement_h
#define mozilla_dom_HTMLSharedListElement_h
#include "mozilla/Attributes.h"
#include "mozilla/Util.h"
#include "nsIDOMHTMLOListElement.h"
#include "nsIDOMHTMLUListElement.h"

Просмотреть файл

@ -8,7 +8,6 @@
#include "mozilla/dom/HTMLEmbedElementBinding.h"
#include "mozilla/dom/HTMLAppletElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/Util.h"
#include "nsIDocument.h"
#include "nsIPluginDocument.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableCaptionElement.h"
#include "nsAttrValueInlines.h"
#include "nsMappedAttributes.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableCellElement.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "mozilla/dom/HTMLTableRowElement.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableColElement.h"
#include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "nsAttrValueInlines.h"
#include "nsRuleData.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableRowElement.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "nsMappedAttributes.h"

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/dom/HTMLTableSectionElement.h"
#include "nsMappedAttributes.h"
#include "nsAttrValueInlines.h"

Просмотреть файл

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Util.h"
#include "nsAttrValueInlines.h"
#include "nsContentCID.h"
#include "nsContentCreatorFunctions.h"

Просмотреть файл

@ -4,8 +4,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "nsIDOMHTMLVideoElement.h"
#include "nsIDOMHTMLSourceElement.h"
#include "mozilla/dom/HTMLVideoElement.h"

Просмотреть файл

@ -4,8 +4,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "nsFormSubmission.h"
#include "nsCOMPtr.h"

Просмотреть файл

@ -4,8 +4,8 @@
* 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/. */
#include "mozilla/ArrayUtils.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Util.h"
#include "mozilla/Likely.h"
#include "nscore.h"

Просмотреть файл

@ -177,6 +177,16 @@ function test() {
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
// Test preventDefault():
elem.addEventListener("keypress", function(evt) {
evt.preventDefault();
elem.removeEventListener("keypress", arguments.callee, false);
}, false);
oldVal = elem.value = 0;
expectedVal = 0;
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control where scripted preventDefault() should prevent the value changing");
}
}

Просмотреть файл

@ -10,7 +10,7 @@
* Don't bother adding new stuff in this file.
*/
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsContentSink.h"
#include "nsCOMPtr.h"

Просмотреть файл

@ -6,7 +6,7 @@
#include "nsMathMLElement.h"
#include "base/compiler_specific.h"
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsGkAtoms.h"
#include "nsCRT.h"
#include "nsRuleData.h"

Просмотреть файл

@ -161,8 +161,6 @@ AudioStream::~AudioStream()
Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE);
PrefChanged(PREF_CUBEB_LATENCY, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
InitPreferredSampleRate();
}
/*static*/ void AudioStream::ShutdownLibrary()
@ -267,16 +265,28 @@ int64_t AudioStream::GetWritten()
return 0;
}
/*static */ void AudioStream::InitPreferredSampleRate()
/*static*/ int AudioStream::PreferredSampleRate()
{
const int fallbackSampleRate = 44100;
StaticMutexAutoLock lock(sMutex);
if (sPreferredSampleRate != 0) {
return sPreferredSampleRate;
}
cubeb* cubebContext = GetCubebContextUnlocked();
if (!cubebContext) {
sPreferredSampleRate = fallbackSampleRate;
}
// Get the preferred samplerate for this platform, or fallback to something
// sensible if we fail. We cache the value, because this might be accessed
// often, and the complexity of the function call below depends on the
// backend used.
if (cubeb_get_preferred_sample_rate(GetCubebContext(),
if (cubeb_get_preferred_sample_rate(cubebContext,
&sPreferredSampleRate) != CUBEB_OK) {
sPreferredSampleRate = 44100;
sPreferredSampleRate = fallbackSampleRate;
}
return sPreferredSampleRate;
}
static void SetUint16LE(uint8_t* aDest, uint16_t aValue)

Просмотреть файл

@ -179,13 +179,9 @@ public:
// Returns the maximum number of channels supported by the audio hardware.
static int MaxNumberOfChannels();
static void InitPreferredSampleRate();
// Returns the samplerate the systems prefer, because it is the
// samplerate the hardware/mixer supports.
static int PreferredSampleRate() {
MOZ_ASSERT(sPreferredSampleRate);
return sPreferredSampleRate;
}
static int PreferredSampleRate();
AudioStream();
~AudioStream();
@ -377,14 +373,14 @@ private:
StreamState mState;
// This mutex protects the static members below.
static StaticMutex sMutex;
static cubeb* sCubebContext;
// Prefered samplerate, in Hz (characteristic of the
// hardware/mixer/platform/API used).
static uint32_t sPreferredSampleRate;
// This mutex protects the static members below
static StaticMutex sMutex;
static cubeb* sCubebContext;
static double sVolumeScale;
static uint32_t sCubebLatency;
static bool sCubebLatencyPrefSet;

Просмотреть файл

@ -13,7 +13,7 @@
#include "nsISeekableStream.h"
#include <stdint.h>
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Endian.h"
#include <algorithm>

Просмотреть файл

@ -18,7 +18,7 @@
* the listener.
*/
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
using mozilla::ArrayLength;

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsIServiceManager.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Util.h"
#include "mozilla/Services.h"
#if defined(ANDROID) || defined(LINUX) || defined(XP_MACOSX)

Просмотреть файл

@ -3,8 +3,6 @@
* 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/. */
#include "mozilla/Util.h"
#include "DOMSVGPathSeg.h"
#include "DOMSVGPathSegList.h"
#include "SVGAnimatedPathSegList.h"

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "mozilla/dom/SVGAnimatedPreserveAspectRatioBinding.h"

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGClipPathElementBinding.h"

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Util.h"
#include "mozilla/ArrayUtils.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/SVGForeignObjectElement.h"

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше