Merge m-c to b2g-inbound

This commit is contained in:
Wes Kocher 2014-03-28 17:05:42 -07:00
commit a981d8de49
521 changed files with 6471 additions and 4413 deletions

View File

@ -11,14 +11,20 @@
using namespace mozilla::a11y;
AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
mPosInSet(0), mSetSize(0), mParent(nullptr)
mPosInSet(0), mSetSize(0), mParent(nullptr), mItem(aItem), mRole(aRole)
{
MOZ_COUNT_CTOR(AccGroupInfo);
Accessible* parent = aItem->Parent();
Update();
}
void
AccGroupInfo::Update()
{
Accessible* parent = mItem->Parent();
if (!parent)
return;
int32_t indexInParent = aItem->IndexInParent();
int32_t indexInParent = mItem->IndexInParent();
uint32_t siblingCount = parent->ChildCount();
if (indexInParent == -1 ||
indexInParent >= static_cast<int32_t>(siblingCount)) {
@ -26,7 +32,7 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
return;
}
int32_t level = nsAccUtils::GetARIAOrDefaultLevel(aItem);
int32_t level = nsAccUtils::GetARIAOrDefaultLevel(mItem);
// Compute position in set.
mPosInSet = 1;
@ -39,7 +45,7 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
break;
// If sibling is not visible and hasn't the same base role.
if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
if (BaseRole(siblingRole) != mRole || sibling->State() & states::INVISIBLE)
continue;
// Check if it's hierarchical flatten structure, i.e. if the sibling
@ -81,7 +87,7 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
break;
// If sibling is visible and has the same base role
if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
if (BaseRole(siblingRole) != mRole || sibling->State() & states::INVISIBLE)
continue;
// and check if it's hierarchical flatten structure.
@ -108,7 +114,7 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
return;
roles::Role parentRole = parent->Role();
if (ShouldReportRelations(aRole, parentRole))
if (ShouldReportRelations(mRole, parentRole))
mParent = parent;
// ARIA tree and list can be arranged by using ARIA groups to organize levels.
@ -119,9 +125,9 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
// parent. In other words the parent of the tree item will be a group and
// the previous tree item of the group is a conceptual parent of the tree
// item.
if (aRole == roles::OUTLINEITEM) {
if (mRole == roles::OUTLINEITEM) {
Accessible* parentPrevSibling = parent->PrevSibling();
if (parentPrevSibling && parentPrevSibling->Role() == aRole) {
if (parentPrevSibling && parentPrevSibling->Role() == mRole) {
mParent = parentPrevSibling;
return;
}
@ -130,9 +136,9 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
// Way #2 for ARIA list and tree: group is a child of an item. In other words
// the parent of the item will be a group and containing item of the group is
// a conceptual parent of the item.
if (aRole == roles::LISTITEM || aRole == roles::OUTLINEITEM) {
if (mRole == roles::LISTITEM || mRole == roles::OUTLINEITEM) {
Accessible* grandParent = parent->Parent();
if (grandParent && grandParent->Role() == aRole)
if (grandParent && grandParent->Role() == mRole)
mParent = grandParent;
}
}

View File

@ -34,6 +34,11 @@ public:
*/
Accessible* ConceptualParent() const { return mParent; }
/**
* Update group information.
*/
void Update();
/**
* Create group info.
*/
@ -99,6 +104,8 @@ private:
uint32_t mPosInSet;
uint32_t mSetSize;
Accessible* mParent;
Accessible* mItem;
a11y::role mRole;
};
} // namespace mozilla

View File

@ -89,8 +89,8 @@ public:
NotificationController(DocAccessible* aDocument, nsIPresShell* aPresShell);
virtual ~NotificationController();
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
NS_IMETHOD_(MozExternalRefCountType) Release(void);
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(NotificationController)

View File

@ -52,7 +52,6 @@ NS_IMPL_CYCLE_COLLECTION_3(nsAccessiblePivot, mRoot, mPosition, mObservers)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessiblePivot)
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivot)
NS_INTERFACE_MAP_ENTRY(nsAccessiblePivot)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessiblePivot)
NS_INTERFACE_MAP_END

View File

@ -2522,6 +2522,7 @@ Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
if (mParent != aParent) {
NS_ERROR("Adopting child!");
mParent->RemoveChild(this);
mParent->InvalidateChildrenGroupInfo();
} else {
NS_ERROR("Binding to the same parent!");
return;
@ -2530,12 +2531,15 @@ Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
mParent = aParent;
mIndexInParent = aIndexInParent;
mParent->InvalidateChildrenGroupInfo();
}
// Accessible protected
void
Accessible::UnbindFromParent()
{
mParent->InvalidateChildrenGroupInfo();
mParent = nullptr;
mIndexInParent = -1;
mIndexOfEmbeddedChild = -1;
@ -3127,13 +3131,29 @@ Accessible::GetActionRule()
AccGroupInfo*
Accessible::GetGroupInfo()
{
if (mGroupInfo)
if (mGroupInfo){
if (HasDirtyGroupInfo()) {
mGroupInfo->Update();
SetDirtyGroupInfo(false);
}
return mGroupInfo;
}
mGroupInfo = AccGroupInfo::CreateGroupInfo(this);
return mGroupInfo;
}
void
Accessible::InvalidateChildrenGroupInfo()
{
uint32_t length = mChildren.Length();
for (uint32_t i = 0; i < length; i++) {
Accessible* child = mChildren[i];
child->SetDirtyGroupInfo(true);
}
}
void
Accessible::GetPositionAndSizeInternal(int32_t *aPosInSet, int32_t *aSetSize)
{
@ -3215,13 +3235,13 @@ Accessible::GetLevelInternal()
void
Accessible::StaticAsserts() const
{
static_assert(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
static_assert(eLastChildrenFlag <= (1 << kChildrenFlagsBits) - 1,
"Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
static_assert(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
static_assert(eLastStateFlag <= (1 << kStateFlagsBits) - 1,
"Accessible::mStateFlags was oversized by eLastStateFlag!");
static_assert(eLastAccType <= (2 << kTypeBits) - 1,
static_assert(eLastAccType <= (1 << kTypeBits) - 1,
"Accessible::mType was oversized by eLastAccType!");
static_assert(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
static_assert(eLastAccGenericType <= (1 << kGenericTypesBits) - 1,
"Accessible::mGenericType was oversized by eLastAccGenericType!");
}

View File

@ -765,6 +765,11 @@ public:
bool IsNodeMapEntry() const
{ return HasOwnContent() && !(mStateFlags & eNotNodeMapEntry); }
/**
* Return true if the accessible's group info needs to be updated.
*/
inline bool HasDirtyGroupInfo() const { return mStateFlags & eGroupInfoDirty; }
/**
* Return true if the accessible has associated DOM content.
*/
@ -856,9 +861,10 @@ protected:
eSharedNode = 1 << 2, // accessible shares DOM node from another accessible
eNotNodeMapEntry = 1 << 3, // accessible shouldn't be in document node map
eHasNumericValue = 1 << 4, // accessible has a numeric value
eIgnoreDOMUIEvent = 1 << 5, // don't process DOM UI events for a11y events
eGroupInfoDirty = 1 << 5, // accessible needs to update group info
eIgnoreDOMUIEvent = 1 << 6, // don't process DOM UI events for a11y events
eLastStateFlag = eHasNumericValue
eLastStateFlag = eGroupInfoDirty
};
protected:
@ -938,6 +944,22 @@ protected:
*/
AccGroupInfo* GetGroupInfo();
/**
* Set dirty state of the accessible's group info.
*/
inline void SetDirtyGroupInfo(bool aIsDirty)
{
if (aIsDirty)
mStateFlags |= eGroupInfoDirty;
else
mStateFlags &= ~eGroupInfoDirty;
}
/**
* Flag all children group info as needing to be updated.
*/
void InvalidateChildrenGroupInfo();
// Data Members
nsCOMPtr<nsIContent> mContent;
DocAccessible* mDoc;
@ -947,7 +969,7 @@ protected:
int32_t mIndexInParent;
static const uint8_t kChildrenFlagsBits = 2;
static const uint8_t kStateFlagsBits = 5;
static const uint8_t kStateFlagsBits = 6;
static const uint8_t kTypeBits = 6;
static const uint8_t kGenericTypesBits = 12;

View File

@ -12,6 +12,8 @@
src="../common.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function doTest()
@ -184,6 +186,15 @@
testGroupAttrs("combo1_opt3", 3, 4);
testGroupAttrs("combo1_opt4", 4, 4);
// Test that group position information updates after deleting node.
testGroupAttrs("tree4_ti1", 1, 2, 1);
testGroupAttrs("tree4_ti2", 2, 2, 1);
var tree4element = document.getElementById("tree4_ti1");
var tree4acc = getAccessible("tree4");
tree4element.parentNode.removeChild(tree4element);
waitForEvent(EVENT_REORDER, tree4acc, function() {
testGroupAttrs("tree4_ti2", 1, 1, 1); });
SimpleTest.finish();
}
@ -198,6 +209,11 @@
title="Expose level for nested lists in HTML">
Mozilla Bug 468418
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=844023"
title="group info might not be properly updated when flat trees mutate">
Bug 844023
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=864224"
title="Support nested ARIA listitems structured by role='group'">
@ -377,6 +393,11 @@
</div>
</div>
<!-- IMPORTANT: Need to have no whitespace between elements in this tree. -->
<div role="tree" id="tree4"><div role="treeitem"
id="tree4_ti1">Item 1</div><div role="treeitem"
id="tree4_ti2">Item 2</div></div>
<table role="grid">
<tr role="row" id="grid_row1">
<td role="gridcell" id="grid_cell1">cell1</td>

View File

@ -901,6 +901,8 @@ pref("apz.y_skate_size_multiplier", "1.5");
pref("apz.x_stationary_size_multiplier", "1.5");
pref("apz.y_stationary_size_multiplier", "1.8");
pref("apz.enlarge_displayport_when_clipped", true);
// Use "sticky" axis locking
pref("apz.axis_lock_mode", 2);
// This preference allows FirefoxOS apps (and content, I think) to force
// the use of software (instead of hardware accelerated) 2D canvases by

View File

@ -1417,3 +1417,5 @@ pref("experiments.manifest.fetchIntervalSeconds", 86400);
pref("experiments.manifest.uri", "https://telemetry-experiment.cdn.mozilla.net/manifest/v1/firefox/%VERSION%/%CHANNEL%");
pref("experiments.manifest.certs.1.commonName", "*.cdn.mozilla.net");
pref("experiments.manifest.certs.1.issuerName", "CN=Cybertrust Public SureServer SV CA,O=Cybertrust Inc");
// Whether experiments are supported by the current application profile.
pref("experiments.supported", true);

View File

@ -1382,10 +1382,6 @@ let BookmarkingUI = {
dropmarkerAnimationNode.style.listStyleImage = dropmarkerStyle.listStyleImage;
}
let isInBookmarksToolbar = this.button.classList.contains("bookmark-item");
if (isInBookmarksToolbar)
this.notifier.setAttribute("in-bookmarks-toolbar", true);
let isInOverflowPanel = this.button.getAttribute("overflowedItem") == "true";
if (!isInOverflowPanel) {
this.notifier.setAttribute("notification", "finish");
@ -1394,7 +1390,6 @@ let BookmarkingUI = {
}
this._notificationTimeout = setTimeout( () => {
this.notifier.removeAttribute("in-bookmarks-toolbar");
this.notifier.removeAttribute("notification");
this.dropmarkerNotifier.removeAttribute("notification");
this.button.removeAttribute("notification");

View File

@ -31,7 +31,7 @@
label="&newtab.undo.restoreButton;"
class="newtab-undo-button" />
<xul:toolbarbutton id="newtab-undo-close-button" tabindex="-1"
class="close-icon"
class="close-icon tabbable"
tooltiptext="&newtab.undo.closeTooltip;" />
</div>
</div>

View File

@ -10,8 +10,8 @@
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Aurora"
!define CompanyName "mozilla.org"
!define URLInfoAbout "http://www.mozilla.org"
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-aurora-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=aurora&installer_lang=${AB_CD}"

View File

@ -10,8 +10,8 @@
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Nightly"
!define CompanyName "mozilla.org"
!define URLInfoAbout "http://www.mozilla.org"
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-nightly-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=nightly&installer_lang=${AB_CD}"

View File

@ -10,8 +10,9 @@
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Mozilla Firefox"
!define CompanyName "Mozilla Corporation"
!define URLInfoAbout "https://www.mozilla.org/${AB_CD}/"
!define URLUpdateInfo "https://www.mozilla.org/${AB_CD}/firefox/"
!define URLInfoAbout "https://www.mozilla.org"
!define URLUpdateInfo "https://www.mozilla.org/firefox/${AppVersion}/releasenotes"
!define HelpLink "https://support.mozilla.org"
; The OFFICIAL define is a workaround to support different urls for Release and
; Beta since they share the same branding when building with other branches that

View File

@ -10,8 +10,8 @@
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Mozilla Developer Preview"
!define CompanyName "mozilla.org"
!define URLInfoAbout "http://www.mozilla.org"
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=release&installer_lang=${AB_CD}"

View File

@ -810,6 +810,8 @@ let CustomizableUIInternal = {
aWindow.addEventListener("unload", this);
aWindow.addEventListener("command", this, true);
this.notifyListeners("onWindowOpened", aWindow);
}
},
@ -850,6 +852,8 @@ let CustomizableUIInternal = {
areaMap.delete(toDelete);
}
}
this.notifyListeners("onWindowClosed", aWindow);
},
setLocationAttributes: function(aNode, aArea) {
@ -2476,6 +2480,18 @@ this.CustomizableUI = {
*/
get PANEL_COLUMN_COUNT() 3,
/**
* An iteratable property of windows managed by CustomizableUI.
* Note that this can *only* be used as an iterator. ie:
* for (let window of CustomizableUI.windows) { ... }
*/
windows: {
"@@iterator": function*() {
for (let [window,] of gBuildWindows)
yield window;
}
},
/**
* Add a listener object that will get fired for various events regarding
* customization.
@ -2559,6 +2575,12 @@ this.CustomizableUI = {
* - onWidgetUnderflow(aNode, aContainer)
* Fired when a widget's DOM node is *not* overflowing its container, a
* toolbar, anymore.
* - onWindowOpened(aWindow)
* Fired when a window has been opened that is managed by CustomizableUI,
* once all of the prerequisite setup has been done.
* - onWindowClosed(aWindow)
* Fired when a window that has been managed by CustomizableUI has been
* closed.
*/
addListener: function(aListener) {
CustomizableUIInternal.addListener(aListener);
@ -3274,7 +3296,7 @@ this.CustomizableUI = {
}
};
Object.freeze(this.CustomizableUI);
Object.freeze(this.CustomizableUI.windows);
/**
* All external consumers of widgets are really interacting with these wrappers

View File

@ -93,6 +93,55 @@ function addShortcut(aNode, aDocument, aItem) {
aItem.setAttribute("shortcut", ShortcutUtils.prettifyShortcut(shortcut));
}
function fillSubviewFromMenuItems(aMenuItems, aSubview) {
let attrs = ["oncommand", "onclick", "label", "key", "disabled",
"command", "observes", "hidden", "class", "origin",
"image", "checked"];
let doc = aSubview.ownerDocument;
let fragment = doc.createDocumentFragment();
for (let menuChild of aMenuItems) {
if (menuChild.hidden)
continue;
let subviewItem;
if (menuChild.localName == "menuseparator") {
// Don't insert duplicate or leading separators. This can happen if there are
// menus (which we don't copy) above the separator.
if (!fragment.lastChild || fragment.lastChild.localName == "menuseparator") {
continue;
}
subviewItem = doc.createElementNS(kNSXUL, "menuseparator");
} else if (menuChild.localName == "menuitem") {
subviewItem = doc.createElementNS(kNSXUL, "toolbarbutton");
subviewItem.setAttribute("class", "subviewbutton");
addShortcut(menuChild, doc, subviewItem);
} else {
continue;
}
for (let attr of attrs) {
let attrVal = menuChild.getAttribute(attr);
if (attrVal)
subviewItem.setAttribute(attr, attrVal);
}
fragment.appendChild(subviewItem);
}
aSubview.appendChild(fragment);
}
function clearSubview(aSubview) {
let parent = aSubview.parentNode;
// We'll take the container out of the document before cleaning it out
// to avoid reflowing each time we remove something.
parent.removeChild(aSubview);
while (aSubview.firstChild) {
aSubview.firstChild.remove();
}
parent.appendChild(aSubview);
}
const CustomizableWidgets = [{
id: "history-panelmenu",
type: "view",
@ -284,59 +333,18 @@ const CustomizableWidgets = [{
let doc = aEvent.target.ownerDocument;
let win = doc.defaultView;
let items = doc.getElementById("PanelUI-developerItems");
let menu = doc.getElementById("menuWebDeveloperPopup");
let attrs = ["oncommand", "onclick", "label", "key", "disabled",
"command", "observes"];
let fragment = doc.createDocumentFragment();
let itemsToDisplay = [...menu.children];
// Hardcode the addition of the "work offline" menuitem at the bottom:
itemsToDisplay.push({localName: "menuseparator", getAttribute: () => {}});
itemsToDisplay.push(doc.getElementById("goOfflineMenuitem"));
for (let node of itemsToDisplay) {
if (node.hidden)
continue;
let item;
if (node.localName == "menuseparator") {
// Don't insert duplicate or leading separators. This can happen if there are
// menus (which we don't copy) above the separator.
if (!fragment.lastChild || fragment.lastChild.localName == "menuseparator") {
continue;
}
item = doc.createElementNS(kNSXUL, "menuseparator");
} else if (node.localName == "menuitem") {
item = doc.createElementNS(kNSXUL, "toolbarbutton");
item.setAttribute("class", "subviewbutton");
addShortcut(node, doc, item);
} else {
continue;
}
for (let attr of attrs) {
let attrVal = node.getAttribute(attr);
if (attrVal)
item.setAttribute(attr, attrVal);
}
fragment.appendChild(item);
}
items.appendChild(fragment);
fillSubviewFromMenuItems(itemsToDisplay, doc.getElementById("PanelUI-developerItems"));
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
let win = doc.defaultView;
let items = doc.getElementById("PanelUI-developerItems");
let parent = items.parentNode;
// We'll take the container out of the document before cleaning it out
// to avoid reflowing each time we remove something.
parent.removeChild(items);
while (items.firstChild) {
items.firstChild.remove();
}
parent.appendChild(items);
clearSubview(doc.getElementById("PanelUI-developerItems"));
}
}, {
id: "sidebar-button",
@ -350,8 +358,6 @@ const CustomizableWidgets = [{
// of dealing with those right now.
let doc = aEvent.target.ownerDocument;
let win = doc.defaultView;
let items = doc.getElementById("PanelUI-sidebarItems");
let menu = doc.getElementById("viewSidebarMenu");
// First clear any existing menuitems then populate. Social sidebar
@ -362,51 +368,11 @@ const CustomizableWidgets = [{
if (providerMenuSeps.length > 0)
win.SocialSidebar.populateProviderMenu(providerMenuSeps[0]);
let attrs = ["oncommand", "onclick", "label", "key", "disabled",
"command", "observes", "hidden", "class", "origin",
"image", "checked"];
let fragment = doc.createDocumentFragment();
let itemsToDisplay = [...menu.children];
for (let node of itemsToDisplay) {
if (node.hidden)
continue;
let item;
if (node.localName == "menuseparator") {
item = doc.createElementNS(kNSXUL, "menuseparator");
} else if (node.localName == "menuitem") {
item = doc.createElementNS(kNSXUL, "toolbarbutton");
} else {
continue;
}
for (let attr of attrs) {
let attrVal = node.getAttribute(attr);
if (attrVal)
item.setAttribute(attr, attrVal);
}
if (node.localName == "menuitem") {
item.classList.add("subviewbutton");
addShortcut(node, doc, item);
}
fragment.appendChild(item);
}
items.appendChild(fragment);
fillSubviewFromMenuItems([...menu.children], doc.getElementById("PanelUI-sidebarItems"));
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
let items = doc.getElementById("PanelUI-sidebarItems");
let parent = items.parentNode;
// We'll take the container out of the document before cleaning it out
// to avoid reflowing each time we remove something.
parent.removeChild(items);
while (items.firstChild) {
items.firstChild.remove();
}
parent.appendChild(items);
clearSubview(doc.getElementById("PanelUI-sidebarItems"));
}
}, {
id: "add-ons-button",

View File

@ -93,4 +93,5 @@ skip-if = os == "linux"
[browser_981305_separator_insertion.js]
[browser_987177_destroyWidget_xul.js]
[browser_987177_xul_wrapper_updating.js]
[browser_987492_window_api.js]
[browser_panel_toggle.js]

View File

@ -5,43 +5,65 @@
"use strict";
let tempElements = [];
// Shouldn't insert multiple separators into the developer tools subview
add_task(function testMultipleDevtoolsSeparators() {
let devtoolsSubMenu = document.getElementById("menuWebDeveloperPopup");
function insertTempItemsIntoMenu(parentMenu) {
// Last element is null to insert at the end:
let beforeEls = [devtoolsSubMenu.firstChild, devtoolsSubMenu.lastChild, null];
let beforeEls = [parentMenu.firstChild, parentMenu.lastChild, null];
for (let i = 0; i < beforeEls.length; i++) {
let sep = document.createElement("menuseparator");
tempElements.push(sep);
devtoolsSubMenu.insertBefore(sep, beforeEls[i]);
parentMenu.insertBefore(sep, beforeEls[i]);
let menu = document.createElement("menu");
tempElements.push(menu);
devtoolsSubMenu.insertBefore(menu, beforeEls[i]);
parentMenu.insertBefore(menu, beforeEls[i]);
// And another separator for good measure:
sep = document.createElement("menuseparator");
tempElements.push(sep);
devtoolsSubMenu.insertBefore(sep, beforeEls[i]);
parentMenu.insertBefore(sep, beforeEls[i]);
}
yield PanelUI.show();
}
let devtoolsButton = document.getElementById("developer-button");
devtoolsButton.click();
yield waitForCondition(() => !PanelUI.multiView.hasAttribute("transitioning"));
let subview = document.getElementById("PanelUI-developerItems");
ok(subview.firstChild, "Subview should have a kid");
is(subview.firstChild.localName, "toolbarbutton", "There should be no separators to start with");
function checkSeparatorInsertion(menuId, buttonId, subviewId) {
return function() {
info("Checking for duplicate separators in " + buttonId + " widget");
let menu = document.getElementById(menuId);
insertTempItemsIntoMenu(menu);
for (let kid of subview.children) {
if (kid.localName == "menuseparator") {
ok(kid.previousSibling && kid.previousSibling.localName != "menuseparator",
"Separators should never have another separator next to them, and should never be the first node.");
let placement = CustomizableUI.getPlacementOfWidget(buttonId);
let changedPlacement = false;
if (!placement || placement.area != CustomizableUI.AREA_PANEL) {
CustomizableUI.addWidgetToArea(buttonId, CustomizableUI.AREA_PANEL);
changedPlacement = true;
}
}
yield PanelUI.show();
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
});
let button = document.getElementById(buttonId);
button.click();
yield waitForCondition(() => !PanelUI.multiView.hasAttribute("transitioning"));
let subview = document.getElementById(subviewId);
ok(subview.firstChild, "Subview should have a kid");
is(subview.firstChild.localName, "toolbarbutton", "There should be no separators to start with");
for (let kid of subview.children) {
if (kid.localName == "menuseparator") {
ok(kid.previousSibling && kid.previousSibling.localName != "menuseparator",
"Separators should never have another separator next to them, and should never be the first node.");
}
}
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
if (changedPlacement) {
CustomizableUI.reset();
}
};
}
add_task(checkSeparatorInsertion("menuWebDeveloperPopup", "developer-button", "PanelUI-developerItems"));
add_task(checkSeparatorInsertion("viewSidebarMenu", "sidebar-button", "PanelUI-sidebarItems"));
registerCleanupFunction(function() {
for (let el of tempElements) {

View File

@ -0,0 +1,54 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function* testOneWindow() {
let windows = [];
for (let win of CustomizableUI.windows)
windows.push(win);
is(windows.length, 1, "Should have one customizable window");
});
add_task(function* testOpenCloseWindow() {
let newWindow = null;
let openListener = {
onWindowOpened: function(window) {
newWindow = window;
}
}
CustomizableUI.addListener(openListener);
let win = yield openAndLoadWindow(null, true);
isnot(newWindow, null, "Should have gotten onWindowOpen event");
is(newWindow, win, "onWindowOpen event should have received expected window");
CustomizableUI.removeListener(openListener);
let windows = [];
for (let win of CustomizableUI.windows)
windows.push(win);
is(windows.length, 2, "Should have two customizable windows");
isnot(windows.indexOf(window), -1, "Current window should be in window collection.");
isnot(windows.indexOf(newWindow), -1, "New window should be in window collection.");
let closedWindow = null;
let closeListener = {
onWindowClosed: function(window) {
closedWindow = window;
}
}
CustomizableUI.addListener(closeListener);
yield promiseWindowClosed(newWindow);
isnot(closedWindow, null, "Should have gotten onWindowClosed event")
is(newWindow, closedWindow, "Closed window should match previously opened window");
CustomizableUI.removeListener(closeListener);
let windows = [];
for (let win of CustomizableUI.windows)
windows.push(win);
is(windows.length, 1, "Should have one customizable window");
isnot(windows.indexOf(window), -1, "Current window should be in window collection.");
is(windows.indexOf(closedWindow), -1, "Closed window should not be in window collection.");
});

View File

@ -10,9 +10,6 @@ const DEBUG = false; /* set to false to suppress debug messages */
const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1";
const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}");
const nsISidebar = Components.interfaces.nsISidebar;
const nsISidebarExternal = Components.interfaces.nsISidebarExternal;
const nsIClassInfo = Components.interfaces.nsIClassInfo;
// File extension for Sherlock search plugin description files
const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
@ -119,13 +116,7 @@ function (aSearchURL)
return 0;
}
nsSidebar.prototype.classInfo = XPCOMUtils.generateCI({classID: SIDEBAR_CID,
contractID: SIDEBAR_CONTRACTID,
classDescription: "Sidebar",
interfaces: [nsISidebar, nsISidebarExternal],
flags: nsIClassInfo.DOM_OBJECT});
nsSidebar.prototype.QueryInterface = XPCOMUtils.generateQI([nsISidebar, nsISidebarExternal]);
nsSidebar.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsISupports]);
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]);

View File

@ -1,4 +1,2 @@
component {22117140-9c6e-11d3-aaf1-00805f8a4905} nsSidebar.js
contract @mozilla.org/sidebar;1 {22117140-9c6e-11d3-aaf1-00805f8a4905}
category JavaScript-global-property sidebar @mozilla.org/sidebar;1
category JavaScript-global-property external @mozilla.org/sidebar;1

View File

@ -12,8 +12,8 @@
"filename": "gcc.tar.xz"
},
{
"size": 150816,
"digest": "af25ecf03b65795d21f011939984b130db167a4efc4f306700f373854f9d7ae664662cb7812c3d737eace7f3735324daa6eb540b5e42f90189b0d9a8dd5f4c9f",
"size": 160232,
"digest": "8656c3fc2daa66839ec81a0edbd9759040a83c7a41c3e472d7f90508b80eefd008b87305dc8549b4ff6098dc33fe17fedc9b4eb76cf5307d5f22dae925c033db",
"algorithm": "sha512",
"filename": "sccache.tar.xz"
}

View File

@ -12,8 +12,8 @@
"filename": "gcc.tar.xz"
},
{
"size": 150816,
"digest": "af25ecf03b65795d21f011939984b130db167a4efc4f306700f373854f9d7ae664662cb7812c3d737eace7f3735324daa6eb540b5e42f90189b0d9a8dd5f4c9f",
"size": 160232,
"digest": "8656c3fc2daa66839ec81a0edbd9759040a83c7a41c3e472d7f90508b80eefd008b87305dc8549b4ff6098dc33fe17fedc9b4eb76cf5307d5f22dae925c033db",
"algorithm": "sha512",
"filename": "sccache.tar.xz"
}

View File

@ -0,0 +1,8 @@
[
{
"size": 266240,
"digest": "bb345b0e700ffab4d09436981f14b5de84da55a3f18a7f09ebc4364a4488acdeab8d46f447b12ac70f2da1444a68b8ce8b8675f0dae2ccf845e966d1df0f0869",
"algorithm": "sha512",
"filename": "mozmake.exe"
}
]

View File

@ -0,0 +1,8 @@
[
{
"size": 266240,
"digest": "bb345b0e700ffab4d09436981f14b5de84da55a3f18a7f09ebc4364a4488acdeab8d46f447b12ac70f2da1444a68b8ce8b8675f0dae2ccf845e966d1df0f0869",
"algorithm": "sha512",
"filename": "mozmake.exe"
}
]

View File

@ -66,5 +66,6 @@ MOZ_PAY=1
MOZ_ACTIVITIES=1
MOZ_JSDOWNLOADS=1
MOZ_WEBM_ENCODER=1
# Enable exact rooting on desktop.
# Enable exact rooting and generational GC on desktop.
JSGC_USE_EXACT_ROOTING=1
JSGC_GENERATIONAL=1

View File

@ -85,6 +85,7 @@ support-files =
[browser_dbg_addonactor.js]
[browser_dbg_addon-sources.js]
[browser_dbg_addon-modules.js]
[browser_dbg_addon-panels.js]
[browser_dbg_auto-pretty-print-01.js]
[browser_dbg_auto-pretty-print-02.js]
[browser_dbg_bfcache.js]

View File

@ -0,0 +1,80 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Ensure that only panels that are relevant to the addon debugger
// display in the toolbox
const ADDON3_URL = EXAMPLE_URL + "addon3.xpi";
let gAddon, gClient, gThreadClient, gDebugger, gSources;
function test() {
Task.spawn(function () {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.addBrowserActors();
}
gBrowser.selectedTab = gBrowser.addTab();
let iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe);
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
let connected = promise.defer();
gClient.connect(connected.resolve);
yield connected.promise;
yield installAddon();
let debuggerPanel = yield initAddonDebugger(gClient, ADDON3_URL, iframe);
gDebugger = debuggerPanel.panelWin;
gThreadClient = gDebugger.gThreadClient;
gSources = gDebugger.DebuggerView.Sources;
testPanels(iframe);
yield uninstallAddon();
yield closeConnection();
yield debuggerPanel._toolbox.destroy();
iframe.remove();
finish();
});
}
function installAddon () {
return addAddon(ADDON3_URL).then(aAddon => {
gAddon = aAddon;
});
}
function testPanels(frame) {
let tabs = frame.contentDocument.getElementById("toolbox-tabs").children;
let expectedTabs = ["options", "jsdebugger"];
is(tabs.length, 2, "displaying only 2 tabs in addon debugger");
Array.forEach(tabs, (tab, i) => {
let toolName = expectedTabs[i];
is(tab.getAttribute("toolid"), toolName, "displaying " + toolName);
});
}
function uninstallAddon() {
return removeAddon(gAddon);
}
function closeConnection () {
let deferred = promise.defer();
gClient.close(deferred.resolve);
return deferred.promise;
}
registerCleanupFunction(function() {
gClient = null;
gAddon = null;
gThreadClient = null;
gDebugger = null;
gSources = null;
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});

View File

@ -242,6 +242,10 @@ TabTarget.prototype = {
return !this.isLocalTab;
},
get isAddon() {
return !!(this._form && this._form.addonActor);
},
get isLocalTab() {
return !!this._tab;
},

View File

@ -88,8 +88,8 @@
label="&options.disableJavaScript.label;"
tooltiptext="&options.disableJavaScript.tooltip;"/>
<hbox class="hidden-labels-box">
<checkbox label="&options.enableChrome.label3;"
tooltiptext="&options.enableChrome.tooltip;"
<checkbox label="&options.enableChrome.label4;"
tooltiptext="&options.enableChrome.tooltip2;"
data-pref="devtools.chrome.enabled"/>
</hbox>
<hbox class="hidden-labels-box">

View File

@ -97,7 +97,7 @@ Tools.webConsole = {
},
isTargetSupported: function(target) {
return true;
return !target.isAddon;
},
build: function(iframeWindow, toolbox) {
let panel = new WebConsolePanel(iframeWindow, toolbox);
@ -124,7 +124,7 @@ Tools.inspector = {
},
isTargetSupported: function(target) {
return true;
return !target.isAddon;
},
build: function(iframeWindow, toolbox) {
@ -171,7 +171,7 @@ Tools.styleEditor = {
inMenu: true,
isTargetSupported: function(target) {
return true;
return !target.isAddon;
},
build: function(iframeWindow, toolbox) {
@ -191,7 +191,7 @@ Tools.shaderEditor = {
tooltip: l10n("ToolboxShaderEditor.tooltip", shaderEditorStrings),
isTargetSupported: function(target) {
return true;
return !target.isAddon;
},
build: function(iframeWindow, toolbox) {
@ -215,7 +215,7 @@ Tools.jsprofiler = {
inMenu: true,
isTargetSupported: function (target) {
return true;
return !target.isAddon;
},
build: function (frame, target) {
@ -240,7 +240,7 @@ Tools.netMonitor = {
isTargetSupported: function(target) {
let root = target.client.mainRoot;
return root.traits.networkMonitor || !target.isApp;
return !target.isAddon && (root.traits.networkMonitor || !target.isApp);
},
build: function(iframeWindow, toolbox) {
@ -261,7 +261,7 @@ Tools.scratchpad = {
inMenu: false,
isTargetSupported: function(target) {
return target.isRemote;
return !target.isAddon && target.isRemote;
},
build: function(iframeWindow, toolbox) {

View File

@ -46,11 +46,13 @@ function setupAutoCompletion(ctx, walker) {
if (popup && popup.isOpen) {
if (!privates.get(ed).suggestionInsertedOnce) {
privates.get(ed).insertingSuggestion = true;
let {label, preLabel} = popup.getItemAtIndex(0);
let {label, preLabel, text} = popup.getItemAtIndex(0);
let cur = ed.getCursor();
ed.replaceText(label.slice(preLabel.length), cur, cur);
ed.replaceText(text.slice(preLabel.length), cur, cur);
}
popup.hidePopup();
// This event is used in tests
ed.emit("popup-hidden");
return;
}
@ -135,17 +137,17 @@ function cycleSuggestions(ed, reverse) {
}
if (popup.itemCount == 1)
popup.hidePopup();
ed.replaceText(firstItem.label.slice(firstItem.preLabel.length), cur, cur);
ed.replaceText(firstItem.text.slice(firstItem.preLabel.length), cur, cur);
} else {
let fromCur = {
line: cur.line,
ch : cur.ch - popup.selectedItem.label.length
ch : cur.ch - popup.selectedItem.text.length
};
if (reverse)
popup.selectPreviousItem();
else
popup.selectNextItem();
ed.replaceText(popup.selectedItem.label, fromCur, cur);
ed.replaceText(popup.selectedItem.text, fromCur, cur);
}
// This event is used in tests.
ed.emit("suggestion-entered");

View File

@ -126,12 +126,14 @@ CSSCompleter.prototype = {
if ("media".startsWith(this.completing)) {
return Promise.resolve([{
label: "media",
preLabel: this.completing
preLabel: this.completing,
text: "media"
}]);
} else if ("keyframes".startsWith(this.completing)) {
return Promise.resolve([{
label: "keyrames",
preLabel: this.completing
label: "keyframes",
preLabel: this.completing,
text: "keyframes"
}]);
}
}
@ -785,6 +787,7 @@ CSSCompleter.prototype = {
completion.push({
label: value[0],
preLabel: query,
text: value[0],
score: value[1]
});
if (completion.length > this.maxEntries - 1)
@ -808,9 +811,11 @@ CSSCompleter.prototype = {
for (; i < length && count < this.maxEntries; i++) {
if (propertyNames[i].startsWith(startProp)) {
count++;
let propName = propertyNames[i];
finalList.push({
preLabel: startProp,
label: propertyNames[i]
label: propName,
text: propName + ": "
});
} else if (propertyNames[i] > startProp) {
// We have crossed all possible matches alphabetically.
@ -840,9 +845,11 @@ CSSCompleter.prototype = {
for (; i < length && count < this.maxEntries; i++) {
if (list[i].startsWith(startValue)) {
count++;
let value = list[i];
finalList.push({
preLabel: startValue,
label: list[i]
label: value,
text: value
});
} else if (list[i] > startValue) {
// We have crossed all possible matches alphabetically.

View File

@ -13,60 +13,71 @@ const {CSSProperties, CSSValues} = getCSSKeywords();
// Test cases to test that autocompletion works correctly when enabled.
// Format:
// [
// -1 for pressing Ctrl + Space or the particular key to press,
// Number of suggestions in the popup (-1 if popup is closed),
// Index of selected suggestion,
// 1 to check whether the selected suggestion is inserted into the editor or not
// key,
// {
// total: Number of suggestions in the popup (-1 if popup is closed),
// current: Index of selected suggestion,
// inserted: 1 to check whether the selected suggestion is inserted into the editor or not,
// entered: 1 if the suggestion is inserted and finalized
// }
// ]
let TEST_CASES = [
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
[-1, 1, 0],
['VK_LEFT', -1],
['VK_RIGHT', -1],
['VK_DOWN', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
[-1, getSuggestionNumberFor("font"), 0],
['VK_END', -1],
['VK_RETURN', -1],
['b', getSuggestionNumberFor("b"), 0],
['a', getSuggestionNumberFor("ba"), 0],
['VK_DOWN', getSuggestionNumberFor("ba"), 0, 1],
['VK_TAB', getSuggestionNumberFor("ba"), 1, 1],
[':', getSuggestionNumberFor("background", ""), 0],
['b', getSuggestionNumberFor("background", "b"), 0],
['l', getSuggestionNumberFor("background", "bl"), 0],
['VK_TAB', getSuggestionNumberFor("background", "bl"), 0, 1],
['VK_DOWN', getSuggestionNumberFor("background", "bl"), 1, 1],
['VK_UP', getSuggestionNumberFor("background", "bl"), 0, 1],
['VK_TAB', getSuggestionNumberFor("background", "bl"), 1, 1],
['VK_TAB', getSuggestionNumberFor("background", "bl"), 2, 1],
['VK_LEFT', -1],
['VK_RIGHT', -1],
['VK_DOWN', -1],
['VK_RETURN', -1],
['b', 2, 0],
['u', 1, 0],
['VK_RETURN', -1, 0, 1],
['{', -1],
['VK_HOME', -1],
['VK_DOWN', -1],
['VK_DOWN', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
['VK_RIGHT', -1],
[-1, 1, 0],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['Ctrl+Space', {total: 1, current: 0}],
['VK_LEFT'],
['VK_RIGHT'],
['VK_DOWN'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['Ctrl+Space', { total: getSuggestionNumberFor("font"), current: 0}],
['VK_END'],
['VK_RETURN'],
['b', {total: getSuggestionNumberFor("b"), current: 0}],
['a', {total: getSuggestionNumberFor("ba"), current: 0}],
['VK_DOWN', {total: getSuggestionNumberFor("ba"), current: 0, inserted: 1}],
['VK_TAB', {total: getSuggestionNumberFor("ba"), current: 1, inserted: 1}],
['VK_RETURN', {current: 1, inserted: 1, entered: 1}],
['b', {total: getSuggestionNumberFor("background", "b"), current: 0}],
['l', {total: getSuggestionNumberFor("background", "bl"), current: 0}],
['VK_TAB', {total: getSuggestionNumberFor("background", "bl"), current: 0, inserted: 1}],
['VK_DOWN', {total: getSuggestionNumberFor("background", "bl"), current: 1, inserted: 1}],
['VK_UP', {total: getSuggestionNumberFor("background", "bl"), current: 0, inserted: 1}],
['VK_TAB', {total: getSuggestionNumberFor("background", "bl"), current: 1, inserted: 1}],
['VK_TAB', {total: getSuggestionNumberFor("background", "bl"), current: 2, inserted: 1}],
[';'],
['VK_RETURN'],
['c', {total: getSuggestionNumberFor("c"), current: 0}],
['o', {total: getSuggestionNumberFor("co"), current: 0}],
['VK_RETURN', {current: 0, inserted: 1}],
['r', {total: getSuggestionNumberFor("color", "r"), current: 0}],
['VK_RETURN', {current: 0, inserted: 1}],
[';'],
['VK_LEFT'],
['VK_RIGHT'],
['VK_DOWN'],
['VK_RETURN'],
['b', {total: 2, current: 0}],
['u', {total: 1, current: 0}],
['VK_RETURN', {current: 0, inserted: 1}],
['{'],
['VK_HOME'],
['VK_DOWN'],
['VK_DOWN'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['VK_RIGHT'],
['Ctrl+Space', {total: 1, current: 0}],
];
let gEditor;
@ -100,60 +111,64 @@ function testState() {
return;
}
let [key] = TEST_CASES[index];
let [key, details] = TEST_CASES[index];
let entered;
if (details) {
entered = details.entered;
}
let mods = {};
if (key == -1) {
info("pressing Ctrl + Space to get result: [" + TEST_CASES[index] +
"] for index " + index);
gEditor.once("after-suggest", checkState);
info("pressing key " + key + " to get result: " +
JSON.stringify(TEST_CASES[index]) + " for index " + index);
let evt = "after-suggest";
if (key == 'Ctrl+Space') {
key = " ";
mods.accelKey = true;
}
else if (key == "VK_RETURN" && entered) {
evt = "popup-hidden";
}
else if (/(left|right|return|home|end)/ig.test(key) ||
(key == "VK_DOWN" && !gPopup.isOpen)) {
info("pressing key " + key + " to get result: [" + TEST_CASES[index] +
"] for index " + index);
gEditor.once("cursorActivity", checkState);
evt = "cursorActivity";
}
else if (key == "VK_TAB" || key == "VK_UP" || key == "VK_DOWN") {
info("pressing key " + key + " to get result: [" + TEST_CASES[index] +
"] for index " + index);
gEditor.once("suggestion-entered", checkState);
}
else {
info("pressing key " + key + " to get result: [" + TEST_CASES[index] +
"] for index " + index);
gEditor.once("after-suggest", checkState);
evt = "suggestion-entered";
}
gEditor.once(evt, checkState);
EventUtils.synthesizeKey(key, mods, gPanelWindow);
}
function checkState() {
executeSoon(() => {
info("After keypress for index " + index);
let [key, total, current, inserted] = TEST_CASES[index];
if (total != -1) {
let [key, details] = TEST_CASES[index];
details = details || {};
let {total, current, inserted} = details;
if (total != undefined) {
ok(gPopup.isOpen, "Popup is open for index " + index);
is(total, gPopup.itemCount,
"Correct total suggestions for index " + index);
is(current, gPopup.selectedIndex,
"Correct index is selected for index " + index);
if (inserted) {
let { preLabel, label } = gPopup.getItemAtIndex(current);
let { preLabel, label, text } = gPopup.getItemAtIndex(current);
let { line, ch } = gEditor.getCursor();
let lineText = gEditor.getText(line);
is(lineText.substring(ch - label.length, ch), label,
is(lineText.substring(ch - text.length, ch), text,
"Current suggestion from the popup is inserted into the editor.");
}
}
else {
ok(!gPopup.isOpen, "Popup is closed for index " + index);
if (inserted) {
let { preLabel, label } = gPopup.getItemAtIndex(current);
let { preLabel, label, text } = gPopup.getItemAtIndex(current);
let { line, ch } = gEditor.getCursor();
let lineText = gEditor.getText(line);
is(lineText.substring(ch - label.length, ch), label,
is(lineText.substring(ch - text.length, ch), text,
"Current suggestion from the popup is inserted into the editor.");
}
}

View File

@ -168,6 +168,51 @@ function telemetryEnabled() {
gPrefsTelemetry.get(PREF_TELEMETRY_PRERELEASE, false);
}
// Returns a promise that is resolved with the AddonInstall for that URL.
function addonInstallForURL(url, hash) {
let deferred = Promise.defer();
AddonManager.getInstallForURL(url, install => deferred.resolve(install),
"application/x-xpinstall", hash);
return deferred.promise;
}
// Returns a promise that is resolved with an Array<Addon> of the installed
// experiment addons.
function installedExperimentAddons() {
let deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"],
addons => deferred.resolve(addons));
return deferred.promise;
}
// Takes an Array<Addon> and returns a promise that is resolved when the
// addons are uninstalled.
function uninstallAddons(addons) {
let ids = new Set([a.id for (a of addons)]);
let deferred = Promise.defer();
let listener = {};
listener.onUninstalled = addon => {
if (!ids.has(addon.id)) {
return;
}
ids.delete(addon.id);
if (ids.size == 0) {
AddonManager.removeAddonListener(listener);
deferred.resolve();
}
};
AddonManager.addAddonListener(listener);
for (let addon of addons) {
addon.uninstall();
}
return deferred.promise;
}
/**
* The experiments module.
*/
@ -1300,67 +1345,91 @@ Experiments.ExperimentEntry.prototype = {
*/
start: function () {
gLogger.trace("ExperimentEntry::start() for " + this.id);
return Task.spawn(function* ExperimentEntry_start_task() {
let addons = yield installedExperimentAddons();
if (addons.length > 0) {
gLogger.error("ExperimentEntry::start() - there are already "
+ addons.length + " experiment addons installed");
yield uninstallAddons(addons);
}
yield this._installAddon();
}.bind(this));
},
// Async install of the addon for this experiment, part of the start task above.
_installAddon: function* () {
let deferred = Promise.defer();
let installCallback = install => {
let failureHandler = (install, handler) => {
let message = "AddonInstall " + handler + " for " + this.id + ", state=" +
(install.state || "?") + ", error=" + install.error;
gLogger.error("ExperimentEntry::start() - " + message);
this._failedStart = true;
let install = yield addonInstallForURL(this._manifestData.xpiURL,
this._manifestData.xpiHash);
let failureHandler = (install, handler) => {
let message = "AddonInstall " + handler + " for " + this.id + ", state=" +
(install.state || "?") + ", error=" + install.error;
gLogger.error("ExperimentEntry::_installAddon() - " + message);
this._failedStart = true;
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
[TELEMETRY_LOG.ACTIVATION.INSTALL_FAILURE, this.id]);
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
[TELEMETRY_LOG.ACTIVATION.INSTALL_FAILURE, this.id]);
deferred.reject(new Error(message));
};
let listener = {
onDownloadEnded: install => {
gLogger.trace("ExperimentEntry::start() - onDownloadEnded for " + this.id);
},
onInstallStarted: install => {
gLogger.trace("ExperimentEntry::start() - onInstallStarted for " + this.id);
// TODO: this check still needs changes in the addon manager
//if (install.addon.type !== "experiment") {
// gLogger.error("ExperimentEntry::start() - wrong addon type");
// failureHandler({state: -1, error: -1}, "onInstallStarted");
//}
let addon = install.addon;
this._name = addon.name;
this._addonId = addon.id;
this._description = addon.description || "";
this._homepageURL = addon.homepageURL || "";
},
onInstallEnded: install => {
gLogger.trace("ExperimentEntry::start() - install ended for " + this.id);
this._lastChangedDate = this._policy.now();
this._startDate = this._policy.now();
this._enabled = true;
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
[TELEMETRY_LOG.ACTIVATION.ACTIVATED, this.id]);
deferred.resolve();
},
};
["onDownloadCancelled", "onDownloadFailed", "onInstallCancelled", "onInstallFailed"]
.forEach(what => {
listener[what] = install => failureHandler(install, what)
});
install.addListener(listener);
install.install();
deferred.reject(new Error(message));
};
AddonManager.getInstallForURL(this._manifestData.xpiURL,
installCallback,
"application/x-xpinstall",
this._manifestData.xpiHash);
let listener = {
onDownloadEnded: install => {
gLogger.trace("ExperimentEntry::_installAddon() - onDownloadEnded for " + this.id);
if (install.existingAddon) {
gLogger.warn("ExperimentEntry::_installAddon() - onDownloadEnded, addon already installed");
}
if (install.addon.type !== "experiment") {
gLogger.error("ExperimentEntry::_installAddon() - onDownloadEnded, wrong addon type");
install.cancel();
}
},
onInstallStarted: install => {
gLogger.trace("ExperimentEntry::_installAddon() - onInstallStarted for " + this.id);
if (install.existingAddon) {
gLogger.warn("ExperimentEntry::_installAddon() - onInstallStarted, addon already installed");
}
if (install.addon.type !== "experiment") {
gLogger.error("ExperimentEntry::_installAddon() - onInstallStarted, wrong addon type");
return false;
}
},
onInstallEnded: install => {
gLogger.trace("ExperimentEntry::_installAddon() - install ended for " + this.id);
this._lastChangedDate = this._policy.now();
this._startDate = this._policy.now();
this._enabled = true;
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
[TELEMETRY_LOG.ACTIVATION.ACTIVATED, this.id]);
let addon = install.addon;
this._name = addon.name;
this._addonId = addon.id;
this._description = addon.description || "";
this._homepageURL = addon.homepageURL || "";
deferred.resolve();
},
};
["onDownloadCancelled", "onDownloadFailed", "onInstallCancelled", "onInstallFailed"]
.forEach(what => {
listener[what] = install => failureHandler(install, what)
});
install.addListener(listener);
install.install();
return deferred.promise;
},
@ -1395,25 +1464,9 @@ Experiments.ExperimentEntry.prototype = {
return;
}
let listener = {};
let handler = addon => {
if (addon.id !== this._addonId) {
return;
}
updateDates();
this._logTermination(terminationKind, terminationReason);
AddonManager.removeAddonListener(listener);
deferred.resolve();
};
listener.onUninstalled = handler;
listener.onDisabled = handler;
AddonManager.addAddonListener(listener);
addon.uninstall();
updateDates();
this._logTermination(terminationKind, terminationReason);
deferred.resolve(uninstallAddons([addon]));
});
return deferred.promise;

View File

@ -13,16 +13,16 @@ Cu.import("resource://testing-common/services/healthreport/utils.jsm", this);
Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
const EXPERIMENT1_ID = "test-experiment-1@tests.mozilla.org";
const EXPERIMENT1_XPI_SHA1 = "sha1:08c4d3ef1d0fc74faa455e85106ef0bc8cf8ca90";
const EXPERIMENT1_XPI_SHA1 = "sha1:0f15ee3677ffbf1e82367069fe4e8fe8e2ad838f";
const EXPERIMENT1_XPI_NAME = "experiment-1.xpi";
const EXPERIMENT1_NAME = "Test experiment 1";
const EXPERIMENT1A_XPI_SHA1 = "sha1:2b8d14e3e06a54d5ce628fe3598cbb364cff9e6b";
const EXPERIMENT1A_XPI_SHA1 = "sha1:b938f1b4f0bf466a67257aff26d4305ac24231eb";
const EXPERIMENT1A_XPI_NAME = "experiment-1a.xpi";
const EXPERIMENT1A_NAME = "Test experiment 1.1";
const EXPERIMENT2_ID = "test-experiment-2@tests.mozilla.org"
const EXPERIMENT2_XPI_SHA1 = "sha1:81877991ec70360fb48db84c34a9b2da7aa41d6a";
const EXPERIMENT2_XPI_SHA1 = "sha1:9d23425421941e1d1e2037232cf5aeae82dbd4e4";
const EXPERIMENT2_XPI_NAME = "experiment-2.xpi";
const EXPERIMENT3_ID = "test-experiment-3@tests.mozilla.org";
@ -160,11 +160,11 @@ function uninstallAddon(id) {
return deferred.promise;
}
function createAppInfo(options) {
function createAppInfo(optionsIn) {
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
let options = options || {};
let options = optionsIn || {};
let id = options.id || "xpcshell@tests.mozilla.org";
let name = options.name || "XPCShell";
let version = options.version || "1.0";

View File

@ -263,6 +263,79 @@ add_task(function* test_getExperiments() {
yield removeCacheFile();
});
// Test that we handle the experiments addon already being
// installed properly.
// We should just pave over them.
add_task(function* test_addonAlreadyInstalled() {
const OBSERVER_TOPIC = "experiments-changed";
let observerFireCount = 0;
let expectedObserverFireCount = 0;
let observer = () => ++observerFireCount;
Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
// Dates the following tests are based on.
let baseDate = new Date(2014, 5, 1, 12);
let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
// The manifest data we test with.
gManifestObject = {
"version": 1,
experiments: [
{
id: EXPERIMENT1_ID,
xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
xpiHash: EXPERIMENT1_XPI_SHA1,
startTime: dateToSeconds(startDate),
endTime: dateToSeconds(endDate),
maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
appName: ["XPCShell"],
channel: ["nightly"],
},
],
};
let experiments = new Experiments.Experiments(gPolicy);
// Trigger update, clock set to before any activation.
let now = baseDate;
defineNow(gPolicy, now);
yield experiments.updateManifest();
Assert.equal(observerFireCount, 0,
"Experiments observer should not have been called yet.");
let list = yield experiments.getExperiments();
Assert.equal(list.length, 0, "Experiment list should be empty.");
// Install conflicting addon.
let installed = yield installAddon(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
Assert.ok(installed, "Addon should have been installed.");
// Trigger update, clock set for the experiment to start.
now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
defineNow(gPolicy, now);
yield experiments.updateManifest();
Assert.equal(observerFireCount, ++expectedObserverFireCount,
"Experiments observer should have been called.");
list = yield experiments.getExperiments();
list = yield experiments.getExperiments();
Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
Assert.equal(list[0].active, true, "Experiment 1 should be active.");
// Cleanup.
Services.obs.removeObserver(observer, OBSERVER_TOPIC);
yield experiments.uninit();
yield removeCacheFile();
});
add_task(function* test_lastActiveToday() {
let experiments = new Experiments.Experiments(gPolicy);

View File

@ -640,10 +640,19 @@ FunctionEnd
${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0
${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0
${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0
${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0
${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0
${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0
${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0
DeleteRegValue SHCTX "$0" "URLInfoAbout"
; Don't add URLInfoAbout which is the release notes url except for the release
; and esr channels since nightly, aurora, and beta do not have release notes.
; Note: URLInfoAbout is only defined in the official branding.nsi.
!ifdef URLInfoAbout
!ifndef BETA_UPDATE_CHANNEL
${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0
!endif
!endif
${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0
${WriteRegDWORD2} $1 "$0" "NoModify" 1 0
${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0

View File

@ -30,6 +30,7 @@ RequestExecutionLevel user
Var Dialog
Var Progressbar
Var ProgressbarMarqueeIntervalMS
Var LabelDownloading
Var LabelInstalling
Var LabelFreeSpace
@ -84,14 +85,13 @@ Var StartDownloadPhaseTickCount
; seconds spent on each of these pages is reported.
Var IntroPhaseSeconds
Var OptionsPhaseSeconds
; The tick count for the last download
; The tick count for the last download.
Var StartLastDownloadTickCount
; The number of seconds from the start of the download phase until the first
; bytes are received. This is only recorded for first request so it is possible
; to determine connection issues for the first request.
Var DownloadFirstTransferSeconds
; The last four tick counts are for the end of a phase in the installation page.
; the options phase when it isn't entered.
Var EndDownloadPhaseTickCount
Var EndPreInstallPhaseTickCount
Var EndInstallPhaseTickCount
@ -177,6 +177,10 @@ Var ControlRightPX
; immediate feedback is given to the user.
!define InstallProgressFirstStep 20
; The finish step size to quickly increment the progress bar after the
; installation has finished.
!define InstallProgressFinishStep 40
; Number of steps for the install progress.
; This might not be enough when installing on a slow network drive so it will
; fallback to downloading the full installer if it reaches this number. The size
@ -192,9 +196,6 @@ Var ControlRightPX
; InstallProgressFirstStep .
!define /math InstallPaveOverTotalSteps ${InstallProgressFirstStep} + 1800
; The interval in MS used for the progress bars set as marquee.
!define ProgressbarMarqueeIntervalMS 10
; On Vista and above attempt to elevate Standard Users in addition to users that
; are a member of the Administrators group.
!define NONADMIN_ELEVATE
@ -388,6 +389,13 @@ Function .onInit
StrCpy $CanSetAsDefault "true"
${EndIf}
; The interval in MS used for the progress bars set as marquee.
${If} ${AtLeastWinVista}
StrCpy $ProgressbarMarqueeIntervalMS "10"
${Else}
StrCpy $ProgressbarMarqueeIntervalMS "50"
${EndIf}
; Initialize the majority of variables except those that need to be reset
; when a page is displayed.
StrCpy $IntroPhaseSeconds "0"
@ -448,9 +456,9 @@ FunctionEnd
Function .onUserAbort
${NSD_KillTimer} StartDownload
${NSD_KillTimer} OnDownload
${NSD_KillTimer} StartInstall
${NSD_KillTimer} CheckInstall
${NSD_KillTimer} FinishInstall
${NSD_KillTimer} FinishProgressBar
${NSD_KillTimer} DisplayDownloadError
${If} "$IsDownloadFinished" != ""
@ -1167,7 +1175,7 @@ Function createInstall
Pop $Progressbar
${NSD_AddStyle} $Progressbar ${PBS_MARQUEE}
SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \
${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N
$ProgressbarMarqueeIntervalMS ; start=1|stop=0 interval(ms)=+N
${NSD_CreateLabelCenter} 103u 180u 241u 20u "$(DOWNLOADING_LABEL)"
Pop $LabelDownloading
@ -1306,7 +1314,7 @@ Function OnDownload
StrCpy $DownloadedBytes "0"
${NSD_AddStyle} $Progressbar ${PBS_MARQUEE}
SendMessage $Progressbar ${PBM_SETMARQUEE} 1 \
${ProgressbarMarqueeIntervalMS} ; start=1|stop=0 interval(ms)=+N
$ProgressbarMarqueeIntervalMS ; start=1|stop=0 interval(ms)=+N
${EndIf}
InetBgDL::Get /RESET /END
StrCpy $DownloadSizeBytes ""
@ -1524,9 +1532,11 @@ Function OnDownload
; require an OS restart for the full installer.
Delete "$INSTDIR\${FileMainEXE}.moz-upgrade"
; Flicker happens less often if a timer is used between updates of the
; progress bar.
${NSD_CreateTimer} StartInstall ${InstallIntervalMS}
System::Call "kernel32::GetTickCount()l .s"
Pop $EndPreInstallPhaseTickCount
Exec "$\"$PLUGINSDIR\download.exe$\" /INI=$PLUGINSDIR\${CONFIG_INI}"
${NSD_CreateTimer} CheckInstall ${InstallIntervalMS}
${Else}
${If} $HalfOfDownload != "true"
${AndIf} $3 > $HalfOfDownload
@ -1566,21 +1576,6 @@ Function OnPing
${EndIf}
FunctionEnd
Function StartInstall
${NSD_KillTimer} StartInstall
System::Call "kernel32::GetTickCount()l .s"
Pop $EndPreInstallPhaseTickCount
IntOp $InstallCounterStep $InstallCounterStep + 1
LockWindow on
SendMessage $Progressbar ${PBM_STEPIT} 0 0
LockWindow off
Exec "$\"$PLUGINSDIR\download.exe$\" /INI=$PLUGINSDIR\${CONFIG_INI}"
${NSD_CreateTimer} CheckInstall ${InstallIntervalMS}
FunctionEnd
Function CheckInstall
IntOp $InstallCounterStep $InstallCounterStep + 1
${If} $InstallCounterStep >= $InstallTotalSteps
@ -1599,6 +1594,9 @@ Function CheckInstall
Delete "$INSTDIR\install.tmp"
CopyFiles /SILENT "$INSTDIR\install.log" "$INSTDIR\install.tmp"
; The unfocus and refocus that happens approximately here is caused by the
; installer calling SHChangeNotify to refresh the shortcut icons.
; When the full installer completes the installation the install.log will no
; longer be in use.
ClearErrors
@ -1612,7 +1610,7 @@ Function CheckInstall
Delete "$PLUGINSDIR\${CONFIG_INI}"
System::Call "kernel32::GetTickCount()l .s"
Pop $EndInstallPhaseTickCount
System::Int64Op $InstallStepSize * 20
System::Int64Op $InstallStepSize * ${InstallProgressFinishStep}
Pop $InstallStepSize
SendMessage $Progressbar ${PBM_SETSTEP} $InstallStepSize 0
${NSD_CreateTimer} FinishInstall ${InstallIntervalMS}
@ -1623,7 +1621,7 @@ FunctionEnd
Function FinishInstall
; The full installer has completed but the progress bar still needs to finish
; so increase the size of the step.
IntOp $InstallCounterStep $InstallCounterStep + 40
IntOp $InstallCounterStep $InstallCounterStep + ${InstallProgressFinishStep}
${If} $InstallTotalSteps < $InstallCounterStep
StrCpy $InstallCounterStep "$InstallTotalSteps"
${EndIf}
@ -1831,10 +1829,9 @@ Function CheckSpace
${GetLongPath} "$ExistingTopDir" $ExistingTopDir
; GetDiskFreeSpaceExW can require a backslash
; GetDiskFreeSpaceExW requires a backslash.
StrCpy $0 "$ExistingTopDir" "" -1 ; the last character
${If} "$0" != "\"
; A backslash is required for
StrCpy $0 "\"
${Else}
StrCpy $0 ""

View File

@ -57,11 +57,11 @@
- options panel and is used for settings that trigger page reload. -->
<!ENTITY options.context.triggersPageRefresh "* Current session only, reloads the page">
<!-- LOCALIZATION NOTE (options.enableChrome.label3): This is the label for the
<!-- LOCALIZATION NOTE (options.enableChrome.label4): This is the label for the
- checkbox that toggles chrome debugging, i.e. devtools.chrome.enabled
- boolean preference in about:config, in the options panel. -->
<!ENTITY options.enableChrome.label3 "Enable chrome debugging">
<!ENTITY options.enableChrome.tooltip "Turning this option on will allow you to use various developer tools in browser context">
<!ENTITY options.enableChrome.label4 "Enable chrome and addon debugging">
<!ENTITY options.enableChrome.tooltip2 "Turning this option on will allow you to use various developer tools in browser context and debug addons from the Add-On Manager">
<!-- LOCALIZATION NOTE (options.enableRemote.label3): This is the label for the
- checkbox that toggles remote debugging, i.e. devtools.debugger.remote-enabled

View File

@ -69,7 +69,6 @@ Sidebar.prototype = {
return true;
},
// =========================== nsISidebar ===========================
// The suggestedTitle and suggestedCategory parameters are ignored, but remain
// for backward compatibility.
addSearchEngine: function addSearchEngine(engineURL, iconURL, suggestedTitle,
@ -92,7 +91,6 @@ Sidebar.prototype = {
Services.search.addEngine(engineURL, dataType, iconURL, true);
},
// =========================== nsISidebarExternal ===========================
// This function exists to implement window.external.AddSearchProvider(),
// to match other browsers' APIs. The capitalization, although nonstandard here,
// is therefore important.
@ -122,17 +120,8 @@ Sidebar.prototype = {
return 0;
},
// =========================== nsIClassInfo ===========================
classInfo: XPCOMUtils.generateCI({classID: SIDEBAR_CID,
contractID: SIDEBAR_CONTRACTID,
interfaces: [Ci.nsISidebar,
Ci.nsISidebarExternal],
flags: Ci.nsIClassInfo.DOM_OBJECT,
classDescription: "Sidebar"}),
// =========================== nsISupports ===========================
QueryInterface: XPCOMUtils.generateQI([Ci.nsISidebar,
Ci.nsISidebarExternal]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
// XPCOMUtils stuff
classID: SIDEBAR_CID,

View File

@ -22,8 +22,6 @@ category xpcom-directory-providers browser-directory-provider @mozilla.org/brows
# Sidebar.js
component {22117140-9c6e-11d3-aaf1-00805f8a4905} Sidebar.js
contract @mozilla.org/sidebar;1 {22117140-9c6e-11d3-aaf1-00805f8a4905}
category JavaScript-global-property sidebar @mozilla.org/sidebar;1
category JavaScript-global-property external @mozilla.org/sidebar;1
category wakeup-request Sidebar @mozilla.org/sidebar;1,nsISidebarExternal,getService,Sidebar:AddSearchProvider
# SessionStore.js

View File

@ -683,20 +683,20 @@ this.UITour = {
let targetQuery = targetObject.query;
aWindow.PanelUI.ensureReady().then(() => {
let node;
if (typeof targetQuery == "function") {
deferred.resolve({
addTargetListener: targetObject.addTargetListener,
node: targetQuery(aWindow.document),
removeTargetListener: targetObject.removeTargetListener,
targetName: aTargetName,
widgetName: targetObject.widgetName,
});
return;
try {
node = targetQuery(aWindow.document);
} catch (ex) {
node = null;
}
} else {
node = aWindow.document.querySelector(targetQuery);
}
deferred.resolve({
addTargetListener: targetObject.addTargetListener,
node: aWindow.document.querySelector(targetQuery),
node: node,
removeTargetListener: targetObject.removeTargetListener,
targetName: aTargetName,
widgetName: targetObject.widgetName,

View File

@ -64,6 +64,30 @@ let tests = [
done();
});
},
function test_availableTargets_exceptionFromGetTarget(done) {
// The query function for the "search" target will throw if it's not found.
// Make sure the callback still fires with the other available targets.
CustomizableUI.removeWidgetFromArea("search-container");
gContentAPI.getConfiguration("availableTargets", (data) => {
// Default minus "search" and "searchProvider"
ok_targets(data, [
"accountStatus",
"addons",
"appMenu",
"backForward",
"bookmarks",
"customize",
"help",
"home",
"pinnedTab",
"quit",
"urlbar",
]);
CustomizableUI.reset();
done();
});
},
];
function ok_targets(actualData, expectedTargets) {

View File

@ -66,8 +66,12 @@
-moz-image-region: rect(-5px, 12px, 11px, -4px);
}
/* This only has an effect when this element is placed on the bookmarks toolbar.
* It's 30px to make sure buttons with 18px icons fit along with the default 16px
* icons, without changing the size of the toolbar.
*/
#personal-bookmarks {
min-height: 29px;
min-height: 30px;
}
#browser-bottombox {
@ -95,7 +99,7 @@ toolbarbutton.bookmark-item[open="true"] {
-moz-padding-end: 2px;
}
.bookmark-item > .toolbarbutton-icon,
.bookmark-item:not(#home-button) > .toolbarbutton-icon,
#personal-bookmarks[cui-areatype="toolbar"] > #bookmarks-toolbar-placeholder > .toolbarbutton-icon {
width: 16px;
height: 16px;
@ -134,13 +138,6 @@ toolbarpaletteitem[place="palette"] > #personal-bookmarks > #bookmarks-toolbar-p
to { transform: rotate(180deg) translateX(-16px) rotate(-180deg) scale(1); opacity: 0; }
}
@keyframes animation-bookmarkAddedToBookmarksBar {
from { transform: rotate(0deg) translateX(-10px) rotate(0deg) scale(1); opacity: 0; }
60% { transform: rotate(180deg) translateX(-10px) rotate(-180deg) scale(2.2); opacity: 1; }
80% { opacity: 1; }
to { transform: rotate(180deg) translateX(-10px) rotate(-180deg) scale(1); opacity: 0; }
}
@keyframes animation-bookmarkPulse {
from { transform: scale(1); }
50% { transform: scale(1.3); }
@ -182,10 +179,6 @@ toolbarpaletteitem[place="palette"] > #personal-bookmarks > #bookmarks-toolbar-p
animation-timing-function: ease, ease, ease;
}
#bookmarked-notification-anchor[notification="finish"][in-bookmarks-toolbar=true] > #bookmarked-notification {
animation: animation-bookmarkAddedToBookmarksBar 800ms;
}
#bookmarks-menu-button[notification="finish"] > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
list-style-image: none !important;
}
@ -839,12 +832,6 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu") !important;
}
#home-button.bookmark-item {
list-style-image: url("moz-icon://stock/gtk-home?size=menu");
}
#home-button.bookmark-item[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-home?size=menu&state=disabled");
}
/* Menu panel buttons */
@ -1632,6 +1619,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
#bookmarks-menu-button[cui-areatype="toolbar"] > .toolbarbutton-menubutton-dropmarker {
-moz-appearance: none !important;
-moz-box-align: center;
}
#bookmarks-menu-button[cui-areatype="toolbar"] > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
@ -1639,23 +1627,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
margin-bottom: 3px;
}
#bookmarks-menu-button[cui-areatype="toolbar"].bookmark-item > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
#bookmarks-menu-button.bookmark-item {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
}
#bookmarks-menu-button.bookmark-item {
-moz-image-region: rect(0px 144px 16px 128px);
}
#bookmarks-menu-button.bookmark-item[starred] {
-moz-image-region: rect(16px 144px 32px 128px);
}
#bookmarks-menu-button[cui-areatype="toolbar"].bookmark-item > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
-moz-image-region: rect(0px 160px 16px 144px);
}
#bookmarks-menu-button[disabled][cui-areatype="toolbar"] > .toolbarbutton-icon,
#bookmarks-menu-button[disabled][cui-areatype="toolbar"] > .toolbarbutton-menu-dropmarker,
#bookmarks-menu-button[disabled][cui-areatype="toolbar"] > .toolbarbutton-menubutton-dropmarker,
@ -1720,9 +1691,9 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
.panel-promo-closebutton {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
margin-top: 0;
margin-bottom: 0;
-moz-appearance: none;
height: 16px;
width: 16px;
}
.panel-promo-closebutton > .toolbarbutton-text {
@ -1817,11 +1788,27 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
margin: -4px;
}
/* Tabstrip close button */
.tabs-closebutton,
.tab-close-button {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
margin-top: 0;
margin-bottom: -1px;
-moz-margin-end: -4px;
-moz-appearance: none;
height: 16px;
width: 16px;
}
.tabs-closebutton:not([selected]):not(:hover),
.tab-close-button:not([selected]):not(:hover) {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 64, 16, 48);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-brighttext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-brighttext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-darktext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-darktext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 96, 16, 80);
}
/* Tabstrip new tab button */
@ -1832,10 +1819,15 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: auto;
}
/* Tabstrip close button */
.tabs-closebutton,
.customization-tipPanel-closeBox > .close-icon {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
-moz-appearance: none;
width: 16px;
height: 16px;
}
/* The :hover:active style from toolkit doesn't seem to work in this panel so just use :active. */
.customization-tipPanel-closeBox > .close-icon:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
.tabs-closebutton > .toolbarbutton-icon {

View File

@ -49,14 +49,11 @@
}
#newtab-undo-close-button {
-moz-appearance: none;
padding: 0;
border: none;
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
-moz-user-focus: normal;
}
#newtab-undo-close-button > .toolbarbutton-icon {
margin: -4px;
height: 16px;
width: 16px;
}
#newtab-undo-close-button > .toolbarbutton-text {

View File

@ -91,7 +91,17 @@ html[dir=rtl] .favicon {
width: 16px;
height: 16px;
opacity: 0.2;
background: url("moz-icon://stock/gtk-close?size=menu") no-repeat;
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 16, 16, 0);
background-position: center center;
background-repeat: no-repeat;
}
.close:hover {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 32, 16, 16);
}
.close:hover:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
html[dir=rtl] .close {

View File

@ -51,7 +51,6 @@
#newtab-undo-close-button {
padding: 0;
border: none;
-moz-user-focus: normal;
}
#newtab-undo-close-button > .toolbarbutton-text {

View File

@ -1,6 +1,8 @@
%filter substitution
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button, #sidebar-button
% Note that zoom-reset-button is a bit different since it doesn't use an image and thus has the image with display: none.
%define nestedButtons #zoom-out-button, #zoom-reset-button, #zoom-in-button, #cut-button, #copy-button, #paste-button
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #fullscreen-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button, #sidebar-button, @nestedButtons@
%ifdef XP_MACOSX
% Prior to 10.7 there wasn't a native fullscreen button so we use #restore-button to exit fullscreen
@ -9,4 +11,3 @@
%endif
%define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]), [overflowedItem=true])
%define nestedButtons #zoom-out-button, #zoom-in-button, #cut-button, #copy-button, #paste-button

View File

@ -1,3 +1,5 @@
/* Note that this file isn't used for HiDPI on OS X. */
:-moz-any(@primaryToolbarButtons@),
#bookmarks-menu-button > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
list-style-image: url("chrome://browser/skin/Toolbar.png");

View File

@ -198,6 +198,12 @@
ThreeDHighlight 1px, ThreeDHighlight 2px,
ActiveBorder 2px, ActiveBorder 4px, transparent 4px);
}
/* End classic titlebar gradient */
#main-window[tabsintitlebar]:not([inFullscreen]) :-moz-any(#TabsToolbar, #toolbar-menubar) toolbarbutton:not(:-moz-lwtheme) {
color: inherit;
}
}
/* Render a window top border for lwthemes on WinXP modern themes: */

View File

@ -57,7 +57,6 @@
-moz-appearance: none;
padding: 0;
border: none;
-moz-user-focus: normal;
}
#newtab-undo-close-button > .toolbarbutton-text {

View File

@ -22,4 +22,6 @@ else
mk_add_options "export SCCACHE_BUCKET=$bucket"
mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
mk_add_options MOZ_PREFLIGHT+=build/sccache.mk
mk_add_options MOZ_POSTFLIGHT+=build/sccache.mk
fi

View File

@ -12,6 +12,20 @@ import pymake.command, pymake.process
import gc
if __name__ == '__main__':
if 'TINDERBOX_OUTPUT' in os.environ:
# When building on mozilla build slaves, execute mozmake instead. Until bug
# 978211, this is the easiest, albeit hackish, way to do this.
import subprocess
mozmake = os.path.join(os.path.dirname(__file__), '..', '..',
'mozmake.exe')
if os.path.exists(mozmake):
cmd = [mozmake]
cmd.extend(sys.argv[1:])
shell = os.environ.get('SHELL')
if shell and not shell.lower().endswith('.exe'):
cmd += ['SHELL=%s.exe' % shell]
sys.exit(subprocess.call(cmd))
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)

7
build/sccache.mk Normal file
View File

@ -0,0 +1,7 @@
preflight:
# Terminate any sccache server that might still be around
-python2.7 $(TOPSRCDIR)/sccache/sccache.py > /dev/null 2>&1
postflight:
# Terminate sccache server. This prints sccache stats.
-python2.7 $(TOPSRCDIR)/sccache/sccache.py

View File

@ -28,8 +28,8 @@ protected:
virtual ~nsBasePrincipal();
public:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
NS_IMETHOD_(MozExternalRefCountType) Release(void);
NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp);
NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp);
public:

View File

@ -35,7 +35,7 @@ NS_IMPL_CI_INTERFACE_GETTER2(nsNullPrincipal,
nsIPrincipal,
nsISerializable)
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsNullPrincipal::AddRef()
{
NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt");
@ -44,7 +44,7 @@ nsNullPrincipal::AddRef()
return count;
}
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsNullPrincipal::Release()
{
NS_PRECONDITION(0 != refcount, "dup release");

View File

@ -46,7 +46,7 @@ static bool URIIsImmutable(nsIURI* aURI)
// Static member variables
const char nsBasePrincipal::sInvalid[] = "Invalid";
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsBasePrincipal::AddRef()
{
NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt");
@ -56,7 +56,7 @@ nsBasePrincipal::AddRef()
return count;
}
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsBasePrincipal::Release()
{
NS_PRECONDITION(0 != refcount, "dup release");

View File

@ -29,7 +29,7 @@ NS_IMPL_CI_INTERFACE_GETTER2(nsSystemPrincipal,
nsIPrincipal,
nsISerializable)
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsSystemPrincipal::AddRef()
{
NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt");
@ -38,7 +38,7 @@ nsSystemPrincipal::AddRef()
return count;
}
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsSystemPrincipal::Release()
{
NS_PRECONDITION(0 != refcount, "dup release");

View File

@ -22,6 +22,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
var Ci = Components.interfaces;
if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(2);
}
SimpleTest.waitForExplicitFinish();
/*

View File

@ -4012,6 +4012,7 @@ NSS_NO_LIBPKIX=
MOZ_CONTENT_SANDBOX=
MOZ_CONTENT_SANDBOX_REPORTER=1
JSGC_USE_EXACT_ROOTING=
JSGC_GENERATIONAL=
case "$target_os" in
mingw*)
@ -7210,10 +7211,10 @@ fi
dnl ========================================================
dnl = Use generational GC
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(gcgenerational,
[ --enable-gcgenerational Enable generational GC],
JSGC_GENERATIONAL=1,
JSGC_GENERATIONAL= )
MOZ_ARG_DISABLE_BOOL(gcgenerational,
[ --disable-gcgenerational Disable generational GC],
JSGC_GENERATIONAL= ,
JSGC_GENERATIONAL=1 )
if test -n "$JSGC_GENERATIONAL"; then
AC_DEFINE(JSGC_GENERATIONAL)
fi
@ -9228,6 +9229,9 @@ fi
if test -z "$JSGC_USE_EXACT_ROOTING" ; then
ac_configure_args="$ac_configure_args --disable-exact-rooting"
fi
if test -z "$JSGC_GENERATIONAL" ; then
ac_configure_args="$ac_configure_args --disable-gcgenerational"
fi
if test -z "$MOZ_NATIVE_NSPR"; then
ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"

View File

@ -1634,8 +1634,8 @@ public:
*
* @return the document associated with the script context
*/
static already_AddRefed<nsIDocument>
GetDocumentFromScriptContext(nsIScriptContext *aScriptContext);
static nsIDocument*
GetDocumentFromScriptContext(nsIScriptContext* aScriptContext);
static bool CheckMayLoad(nsIPrincipal* aPrincipal, nsIChannel* aChannel, bool aAllowIfInheritsPrincipal);

View File

@ -10,6 +10,7 @@
#include "nsCOMPtr.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/CommentBinding.h"
#include "mozilla/IntegerPrintfMacros.h"
using namespace mozilla;
using namespace dom;
@ -49,7 +50,7 @@ Comment::List(FILE* out, int32_t aIndent) const
int32_t indx;
for (indx = aIndent; --indx >= 0; ) fputs(" ", out);
fprintf(out, "Comment@%p refcount=%d<!--", (void*)this, mRefCnt.get());
fprintf(out, "Comment@%p refcount=%" PRIuPTR "<!--", (void*)this, mRefCnt.get());
nsAutoString tmp;
ToCString(tmp, 0, mText.GetLength());

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/DocumentFragmentBinding.h"
#include "nsPIDOMWindow.h"
#include "nsIDocument.h"
#include "mozilla/IntegerPrintfMacros.h"
namespace mozilla {
namespace dom {
@ -72,7 +73,7 @@ DocumentFragment::List(FILE* out, int32_t aIndent) const
fprintf(out, "DocumentFragment@%p", (void *)this);
fprintf(out, " flags=[%08x]", static_cast<unsigned int>(GetFlags()));
fprintf(out, " refcount=%d<", mRefCnt.get());
fprintf(out, " refcount=%" PRIuPTR "<", mRefCnt.get());
nsIContent* child = GetFirstChild();
if (child) {

View File

@ -128,6 +128,7 @@
#include "nsITextControlElement.h"
#include "nsISupportsImpl.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/IntegerPrintfMacros.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2199,7 +2200,7 @@ Element::List(FILE* out, int32_t aIndent,
fprintf(out, " ranges:%d", ranges ? ranges->Count() : 0);
}
fprintf(out, " primaryframe=%p", static_cast<void*>(GetPrimaryFrame()));
fprintf(out, " refcount=%d<", mRefCnt.get());
fprintf(out, " refcount=%" PRIuPTR "<", mRefCnt.get());
nsIContent* child = GetFirstChild();
if (child) {

View File

@ -520,10 +520,6 @@ FragmentOrElement::nsDOMSlots::~nsDOMSlots()
if (mAttributeMap) {
mAttributeMap->DropReference();
}
if (mClassList) {
mClassList->DropReference();
}
}
void
@ -589,10 +585,7 @@ FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
mChildrenList = nullptr;
mUndoManager = nullptr;
mCustomElementData = nullptr;
if (mClassList) {
mClassList->DropReference();
mClassList = nullptr;
}
mClassList = nullptr;
}
size_t
@ -1251,10 +1244,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
if (tmp->HasProperties()) {
if (tmp->IsHTML()) {
tmp->DeleteProperty(nsGkAtoms::microdataProperties);
tmp->DeleteProperty(nsGkAtoms::itemtype);
tmp->DeleteProperty(nsGkAtoms::itemref);
tmp->DeleteProperty(nsGkAtoms::itemprop);
nsIAtom*** props = nsGenericHTMLElement::PropertiesToTraverseAndUnlink();
for (uint32_t i = 0; props[i]; ++i) {
tmp->DeleteProperty(*props[i]);
}
}
}
@ -1798,15 +1791,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
if (tmp->HasProperties()) {
if (tmp->IsHTML()) {
nsISupports* property = static_cast<nsISupports*>
(tmp->GetProperty(nsGkAtoms::microdataProperties));
cb.NoteXPCOMChild(property);
property = static_cast<nsISupports*>(tmp->GetProperty(nsGkAtoms::itemref));
cb.NoteXPCOMChild(property);
property = static_cast<nsISupports*>(tmp->GetProperty(nsGkAtoms::itemprop));
cb.NoteXPCOMChild(property);
property = static_cast<nsISupports*>(tmp->GetProperty(nsGkAtoms::itemtype));
cb.NoteXPCOMChild(property);
nsIAtom*** props = nsGenericHTMLElement::PropertiesToTraverseAndUnlink();
for (uint32_t i = 0; props[i]; ++i) {
nsISupports* property =
static_cast<nsISupports*>(tmp->GetProperty(*props[i]));
cb.NoteXPCOMChild(property);
}
}
}

View File

@ -229,3 +229,7 @@ LOCAL_INCLUDES += [
'/layout/xul',
'/netwerk/base/src',
]
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
# Work around bug 986928
CXXFLAGS += ['-Wno-error=format']

View File

@ -5560,21 +5560,20 @@ nsContentUtils::GetUTFNonNullOrigin(nsIURI* aURI, nsString& aOrigin)
}
/* static */
already_AddRefed<nsIDocument>
nsIDocument*
nsContentUtils::GetDocumentFromScriptContext(nsIScriptContext *aScriptContext)
{
if (!aScriptContext)
if (!aScriptContext) {
return nullptr;
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(aScriptContext->GetGlobalObject());
nsCOMPtr<nsIDocument> doc;
if (window) {
nsCOMPtr<nsIDOMDocument> domdoc;
window->GetDocument(getter_AddRefs(domdoc));
doc = do_QueryInterface(domdoc);
}
return doc.forget();
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(aScriptContext->GetGlobalObject());
if (!window) {
return nullptr;
}
return window->GetDoc();
}
/* static */

View File

@ -29,7 +29,7 @@ nsDOMTokenList::nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom)
nsDOMTokenList::~nsDOMTokenList() { }
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsDOMTokenList)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMTokenList, mElement)
NS_INTERFACE_MAP_BEGIN(nsDOMTokenList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
@ -40,12 +40,6 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTokenList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTokenList)
void
nsDOMTokenList::DropReference()
{
mElement = nullptr;
}
const nsAttrValue*
nsDOMTokenList::GetParsedAttr()
{

View File

@ -37,8 +37,6 @@ public:
nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom);
void DropReference();
virtual JSObject* WrapObject(JSContext *cx,
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
@ -80,7 +78,7 @@ protected:
const nsTArray<nsString>& aTokens);
inline const nsAttrValue* GetParsedAttr();
Element* mElement;
nsCOMPtr<Element> mElement;
nsCOMPtr<nsIAtom> mAttrAtom;
};

View File

@ -1783,7 +1783,7 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocument)
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
nsDocument::Release()
{
NS_PRECONDITION(0 != mRefCnt, "dup release");

View File

@ -1040,8 +1040,6 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
const nsAFlatString& aScript,
void** aOffThreadToken)
{
nsresult rv = NS_OK;
// We need a document to evaluate scripts.
if (!mDocument) {
return NS_ERROR_FAILURE;
@ -1070,6 +1068,11 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
return NS_ERROR_FAILURE;
}
JSVersion version = JSVersion(aRequest->mJSVersion);
if (version == JSVERSION_UNKNOWN) {
return NS_OK;
}
// New script entry point required, due to the "Create a script" sub-step of
// http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-block
AutoEntryScript entryScript(globalObject, true, context->GetNativeContext());
@ -1083,14 +1086,12 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
nsCOMPtr<nsIScriptElement> oldCurrent = mCurrentScript;
mCurrentScript = aRequest->mElement;
JSVersion version = JSVersion(aRequest->mJSVersion);
if (version != JSVERSION_UNKNOWN) {
JS::CompileOptions options(entryScript.cx());
FillCompileOptionsForRequest(aRequest, global, &options);
nsJSUtils::EvaluateOptions evalOptions;
rv = nsJSUtils::EvaluateString(entryScript.cx(), aScript, global, options,
evalOptions, nullptr, aOffThreadToken);
}
JS::CompileOptions options(entryScript.cx());
FillCompileOptionsForRequest(aRequest, global, &options);
nsJSUtils::EvaluateOptions evalOptions;
nsresult rv = nsJSUtils::EvaluateString(entryScript.cx(), aScript, global,
options, evalOptions, nullptr,
aOffThreadToken);
// Put the old script back in case it wants to do anything else.
mCurrentScript = oldCurrent;

View File

@ -16,6 +16,7 @@
#include "nsIDocument.h"
#include "nsThreadUtils.h"
#include "nsStubMutationObserver.h"
#include "mozilla/IntegerPrintfMacros.h"
#ifdef DEBUG
#include "nsRange.h"
#endif
@ -169,7 +170,7 @@ nsTextNode::List(FILE* out, int32_t aIndent) const
fprintf(out, " ranges:%d", ranges ? ranges->Count() : 0);
}
fprintf(out, " primaryframe=%p", static_cast<void*>(GetPrimaryFrame()));
fprintf(out, " refcount=%d<", mRefCnt.get());
fprintf(out, " refcount=%" PRIuPTR "<", mRefCnt.get());
nsAutoString tmp;
ToCString(tmp, 0, mText.GetLength());

View File

@ -272,9 +272,10 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports
bool mCheckedSet;
};
NS_IMPL_ISUPPORTS1(HTMLInputElementState, HTMLInputElementState)
NS_DEFINE_STATIC_IID_ACCESSOR(HTMLInputElementState, NS_INPUT_ELEMENT_STATE_IID)
NS_IMPL_ISUPPORTS1(HTMLInputElementState, HTMLInputElementState)
HTMLInputElement::nsFilePickerShownCallback::nsFilePickerShownCallback(
HTMLInputElement* aInput, nsIFilePicker* aFilePicker)
: mFilePicker(aFilePicker)

View File

@ -30,9 +30,6 @@ HTMLOutputElement::HTMLOutputElement(already_AddRefed<nsINodeInfo>& aNodeInfo)
HTMLOutputElement::~HTMLOutputElement()
{
if (mTokenList) {
mTokenList->DropReference();
}
}
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLOutputElement)
@ -40,10 +37,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLOutputElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLOutputElement,
nsGenericHTMLFormElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
if (tmp->mTokenList) {
tmp->mTokenList->DropReference();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTokenList)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTokenList)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLOutputElement,
nsGenericHTMLFormElement)

View File

@ -41,7 +41,6 @@ namespace mozilla {
namespace dom {
NS_IMPL_ISUPPORTS1(SelectState, SelectState)
NS_DEFINE_STATIC_IID_ACCESSOR(SelectState, NS_SELECT_STATE_IID)
//----------------------------------------------------------------------
//

View File

@ -77,6 +77,8 @@ private:
nsCheapSet<nsUint32HashKey> mIndices;
};
NS_DEFINE_STATIC_IID_ACCESSOR(SelectState, NS_SELECT_STATE_IID)
class MOZ_STACK_CLASS SafeOptionListMutation
{
public:

View File

@ -183,6 +183,5 @@ LOCAL_INCLUDES += [
'/layout/tables',
'/layout/xul',
'/netwerk/base/src',
'/xpcom/ds',
]

View File

@ -3142,13 +3142,42 @@ nsDOMSettableTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty,
{
nsDOMSettableTokenList* list =
static_cast<nsDOMSettableTokenList*>(aPropertyValue);
list->DropReference();
NS_RELEASE(list);
}
static nsIAtom** sPropertiesToTraverseAndUnlink[] =
{
&nsGkAtoms::microdataProperties,
&nsGkAtoms::itemtype,
&nsGkAtoms::itemref,
&nsGkAtoms::itemprop,
&nsGkAtoms::sandbox,
nullptr
};
// static
nsIAtom***
nsGenericHTMLElement::PropertiesToTraverseAndUnlink()
{
return sPropertiesToTraverseAndUnlink;
}
nsDOMSettableTokenList*
nsGenericHTMLElement::GetTokenList(nsIAtom* aAtom)
{
#ifdef DEBUG
nsIAtom*** props =
nsGenericHTMLElement::PropertiesToTraverseAndUnlink();
bool found = false;
for (uint32_t i = 0; props[i]; ++i) {
if (*props[i] == aAtom) {
found = true;
break;
}
}
MOZ_ASSERT(found, "Trying to use an unknown tokenlist!");
#endif
nsDOMSettableTokenList* list = nullptr;
if (HasProperties()) {
list = static_cast<nsDOMSettableTokenList*>(GetProperty(aAtom));

View File

@ -296,6 +296,7 @@ public:
return rcFrame.height;
}
static nsIAtom*** PropertiesToTraverseAndUnlink();
protected:
// These methods are used to implement element-specific behavior of Get/SetItemValue
// when an element has @itemprop but no @itemscope.

View File

@ -39,7 +39,6 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/events',
'/layout/style',
'/xpcom/ds',
]
FINAL_LIBRARY = 'gklayout'

View File

@ -1316,6 +1316,8 @@ void MediaDecoder::DurationChanged()
// Duration has changed so we should recompute playback rate
UpdatePlaybackRate();
SetInfinite(mDuration == -1);
if (mOwner && oldDuration != mDuration && !IsInfinite()) {
DECODER_LOG(PR_LOG_DEBUG, ("%p duration changed to %lld", this, mDuration));
mOwner->DispatchEvent(NS_LITERAL_STRING("durationchange"));

View File

@ -397,6 +397,9 @@ RtspMediaResource::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
return size;
}
//----------------------------------------------------------------------------
// RtspMediaResource::Listener
//----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS2(RtspMediaResource::Listener,
nsIInterfaceRequestor, nsIStreamingProtocolListener);
@ -435,6 +438,15 @@ RtspMediaResource::Listener::GetInterface(const nsIID & aIID, void **aResult)
return QueryInterface(aIID, aResult);
}
void
RtspMediaResource::Listener::Revoke()
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
if (mResource) {
mResource = nullptr;
}
}
nsresult
RtspMediaResource::ReadFrameFromTrack(uint8_t* aBuffer, uint32_t aBufferSize,
uint32_t aTrackIdx, uint32_t& aBytes,
@ -595,25 +607,27 @@ RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, nsresult aReason)
mTrackBuffer[i]->Reset();
}
// If mDecoder is null pointer, it means this OnDisconnected event is
// triggered when media element was destroyed and mDecoder was already
// shutdown.
if (!mDecoder) {
return NS_OK;
if (mDecoder) {
if (aReason == NS_ERROR_NOT_INITIALIZED ||
aReason == NS_ERROR_CONNECTION_REFUSED ||
aReason == NS_ERROR_NOT_CONNECTED ||
aReason == NS_ERROR_NET_TIMEOUT) {
// Report error code to Decoder.
RTSPMLOG("Error in OnDisconnected 0x%x", aReason);
mDecoder->NetworkError();
} else {
// Resetting the decoder and media element when the connection
// between RTSP client and server goes down.
mDecoder->ResetConnectionState();
}
}
if (aReason == NS_ERROR_NOT_INITIALIZED ||
aReason == NS_ERROR_CONNECTION_REFUSED ||
aReason == NS_ERROR_NOT_CONNECTED ||
aReason == NS_ERROR_NET_TIMEOUT) {
RTSPMLOG("Error in OnDisconnected 0x%x", aReason);
mDecoder->NetworkError();
return NS_OK;
if (mListener) {
// Note: Listener's Revoke() kills its reference to us, which means it would
// release |this| object. So, ensure it is called in the end of this method.
mListener->Revoke();
}
// Resetting the decoder and media element when the connection
// between Rtsp client and server goes down.
mDecoder->ResetConnectionState();
return NS_OK;
}

View File

@ -197,7 +197,7 @@ public:
// mMediaStreamController's callback function.
// It holds RtspMediaResource reference to notify the connection status and
// data arrival. The Revoke function releases the reference when
// RtspMediaResource is destroyed.
// RtspMediaResource::OnDisconnected is called.
class Listener MOZ_FINAL : public nsIInterfaceRequestor,
public nsIStreamingProtocolListener
{
@ -209,7 +209,7 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSISTREAMINGPROTOCOLLISTENER
void Revoke() { mResource = nullptr; }
void Revoke();
private:
nsRefPtr<RtspMediaResource> mResource;

View File

@ -118,7 +118,7 @@ SharedThreadPool::Get(const nsCString& aName, uint32_t aThreadLimit)
return instance.forget();
}
NS_IMETHODIMP_(nsrefcnt) SharedThreadPool::AddRef(void)
NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::AddRef(void)
{
MOZ_ASSERT(sMonitor);
ReentrantMonitorAutoEnter mon(*sMonitor);
@ -128,7 +128,7 @@ NS_IMETHODIMP_(nsrefcnt) SharedThreadPool::AddRef(void)
return count;
}
NS_IMETHODIMP_(nsrefcnt) SharedThreadPool::Release(void)
NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::Release(void)
{
MOZ_ASSERT(sMonitor);
bool dispatchShutdownEvent;

View File

@ -44,8 +44,8 @@ public:
// are implemented using locking, so it's not recommended that you use them
// in a tight loop.
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
NS_IMETHOD_(MozExternalRefCountType) Release(void);
// Forward behaviour to wrapped thread pool implementation.
NS_FORWARD_SAFE_NSITHREADPOOL(mPool);

View File

@ -122,6 +122,7 @@ GST_FUNC(LIBGSTREAMER, gst_buffer_set_size)
GST_FUNC(LIBGSTREAMER, gst_buffer_unmap)
GST_FUNC(LIBGSTREAMER, gst_element_factory_get_metadata)
GST_FUNC(LIBGSTREAMER, gst_event_parse_segment)
GST_FUNC(LIBGSTREAMER, gst_event_type_get_name)
GST_FUNC(LIBGSTREAMER, gst_memory_init)
GST_FUNC(LIBGSTREAMER, gst_memory_map)
GST_FUNC(LIBGSTREAMER, gst_memory_unmap)

View File

@ -32,7 +32,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(AudioNode, nsDOMEventTargetHelper)
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
AudioNode::Release()
{
if (mRefCnt.get() == 1) {

View File

@ -29,7 +29,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AudioParam)
NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(AudioParam)
NS_IMETHODIMP_(nsrefcnt)
NS_IMETHODIMP_(MozExternalRefCountType)
AudioParam::Release()
{
if (mRefCnt.get() == 1) {

View File

@ -31,8 +31,8 @@ public:
float aDefaultValue);
virtual ~AudioParam();
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
NS_IMETHOD_(MozExternalRefCountType) Release(void);
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioParam)
AudioContext* GetParentObject() const

View File

@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsGlobalWindow.h"
#include "nsDOMWindowUtils.h"
#include "nsIDOMClientRect.h"
@ -16,26 +20,18 @@
#include "VideoUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
namespace mozilla {
using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
NS_IMPL_ISUPPORTS2(MediaEngineTabVideoSource, nsIDOMEventListener, nsITimerCallback)
MediaEngineTabVideoSource::MediaEngineTabVideoSource()
: mName(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;")),
mUuid(NS_LITERAL_STRING("uuid")),
mData(0),
mMonitor("MediaEngineTabVideoSource")
: mMonitor("MediaEngineTabVideoSource")
{
}
MediaEngineTabVideoSource::~MediaEngineTabVideoSource()
{
if (mData)
free(mData);
}
nsresult
MediaEngineTabVideoSource::StartRunnable::Run()
{
@ -111,14 +107,13 @@ MediaEngineTabVideoSource::InitRunnable::Run()
void
MediaEngineTabVideoSource::GetName(nsAString_internal& aName)
{
aName.Assign(mName);
aName.Assign(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;"));
}
void
MediaEngineTabVideoSource::GetUUID(nsAString_internal& aUuid)
{
aUuid.Assign(mUuid);
aUuid.Assign(NS_LITERAL_STRING("uuid"));
}
nsresult
@ -250,7 +245,7 @@ MediaEngineTabVideoSource::Draw() {
nsRefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
nsRefPtr<gfxASurface> surf;
surf = new gfxImageSurface(static_cast<unsigned char*>(mData),
surf = new gfxImageSurface(mData.rwget(),
ThebesIntSize(size), stride, format);
if (surf->CairoStatus() != 0) {
return;

View File

@ -17,7 +17,6 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSITIMERCALLBACK
MediaEngineTabVideoSource();
~MediaEngineTabVideoSource();
virtual void GetName(nsAString_internal&);
virtual void GetUUID(nsAString_internal&);
@ -56,11 +55,10 @@ private:
int mBufW;
int mBufH;
int mTimePerFrame;
unsigned char *mData;
ScopedFreePtr<unsigned char> mData;
nsCOMPtr<nsIDOMWindow> mWindow;
nsRefPtr<layers::CairoImage> mImage;
nsCOMPtr<nsITimer> mTimer;
nsAutoString mName, mUuid;
Monitor mMonitor;
nsCOMPtr<nsITabSource> mTabSource;
};

View File

@ -77,6 +77,8 @@ protected:
static EnumInfo sEnumInfo[1];
};
NS_DEFINE_STATIC_IID_ACCESSOR(SVGComponentTransferFunctionElement, NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
} // namespace dom
} // namespace mozilla

View File

@ -64,8 +64,6 @@ nsSVGElement::LengthInfo nsSVGFE::sLengthInfo[4] =
NS_IMPL_ADDREF_INHERITED(nsSVGFE,nsSVGFEBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFE,nsSVGFEBase)
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGFE, NS_SVG_FE_CID)
NS_INTERFACE_MAP_BEGIN(nsSVGFE)
// nsISupports is an ambiguous base of nsSVGFE so we have to work
// around that
@ -245,8 +243,6 @@ nsSVGElement::EnumInfo SVGComponentTransferFunctionElement::sEnumInfo[1] =
NS_IMPL_ADDREF_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransferFunctionElementBase)
NS_IMPL_RELEASE_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransferFunctionElementBase)
NS_DEFINE_STATIC_IID_ACCESSOR(SVGComponentTransferFunctionElement, NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
NS_INTERFACE_MAP_BEGIN(SVGComponentTransferFunctionElement)
// nsISupports is an ambiguous base of nsSVGFE so we have to work
// around that

View File

@ -147,6 +147,8 @@ protected:
static LengthInfo sLengthInfo[4];
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGFE, NS_SVG_FE_CID)
typedef nsSVGElement SVGFEUnstyledElementBase;
class SVGFEUnstyledElement : public SVGFEUnstyledElementBase

View File

@ -21,7 +21,6 @@ LOCAL_INCLUDES += [
'/content/xml/document/src',
'/dom/events',
'/layout/style',
'/xpcom/ds',
]
FINAL_LIBRARY = 'gklayout'

Some files were not shown because too many files have changed in this diff Show More