Merge m-c to elm

This commit is contained in:
Nick Alexander 2013-09-03 10:45:50 -07:00
commit 8ab8f9b7e4
1823 changed files with 45076 additions and 34211 deletions

View File

@ -19,7 +19,6 @@ XPIDL_SOURCES += [
'nsIAccessibleHyperText.idl',
'nsIAccessibleImage.idl',
'nsIAccessiblePivot.idl',
'nsIAccessibleProvider.idl',
'nsIAccessibleRelation.idl',
'nsIAccessibleRetrieval.idl',
'nsIAccessibleRole.idl',

View File

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 "nsISupports.idl"
/**
* nsIAccessibleProvider interface is used to link element and accessible
object. For that XBL binding of element should implement the interface.
*/
[scriptable, uuid(f7e531b6-bc29-4d3d-8c91-60fc2b71eb40)]
interface nsIAccessibleProvider : nsISupports
{
/**
* Constants set of common use.
*/
/** Do not create an accessible for this object
* This is useful if an ancestor binding already implements nsIAccessibleProvider,
* but no accessible is desired for the inheriting binding
*/
const long NoAccessible = 0;
/** For elements that spawn a new document. For example now it is used by
<xul:iframe>, <xul:browser> and <xul:editor>. */
const long OuterDoc = 0x00000001;
/**
* Constants set is used by XUL controls.
*/
const long XULAlert = 0x00001001;
const long XULButton = 0x00001002;
const long XULCheckbox = 0x00001003;
const long XULColorPicker = 0x00001004;
const long XULColorPickerTile = 0x00001005;
const long XULCombobox = 0x00001006;
const long XULDropmarker = 0x00001007;
const long XULGroupbox = 0x00001008;
const long XULImage = 0x00001009;
const long XULLink = 0x0000100A;
const long XULListbox = 0x0000100B;
const long XULListCell = 0x00001026;
const long XULListHead = 0x00001024;
const long XULListHeader = 0x00001025;
const long XULListitem = 0x0000100C;
const long XULMenubar = 0x0000100D;
const long XULMenuitem = 0x0000100E;
const long XULMenupopup = 0x0000100F;
const long XULMenuSeparator = 0x00001010;
const long XULPane = 0x00001011;
const long XULProgressMeter = 0x00001012;
const long XULScale = 0x00001013;
const long XULStatusBar = 0x00001014;
const long XULRadioButton = 0x00001015;
const long XULRadioGroup = 0x00001016;
/** Used for XUL tab element */
const long XULTab = 0x00001017;
/** Used for XUL tabs element, a container for tab elements */
const long XULTabs = 0x00001018;
/** Used for XUL tabpanels element */
const long XULTabpanels = 0x00001019;
const long XULText = 0x0000101A;
const long XULTextBox = 0x0000101B;
const long XULThumb = 0x0000101C;
const long XULTree = 0x0000101D;
const long XULTreeColumns = 0x0000101E;
const long XULTreeColumnItem = 0x0000101F;
const long XULToolbar = 0x00001020;
const long XULToolbarSeparator = 0x00001021;
const long XULTooltip = 0x00001022;
const long XULToolbarButton = 0x00001023;
/**
* Return one of constants declared above.
*/
readonly attribute long accessibleType;
};

View File

@ -17,6 +17,7 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../html \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../xul \
-I$(srcdir)/../../../content/xbl/src \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/style \
-I$(srcdir)/../../../layout/svg \

View File

@ -23,7 +23,6 @@
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "nsIAccessibleProvider.h"
#include "OuterDocAccessible.h"
#include "Platform.h"
#include "Role.h"
@ -61,6 +60,9 @@
#include "nsTreeBodyFrame.h"
#include "nsTreeColumns.h"
#include "nsTreeUtils.h"
#include "nsBindingManager.h"
#include "nsXBLPrototypeBinding.h"
#include "nsXBLBinding.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
@ -1137,204 +1139,187 @@ already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
DocAccessible* aDoc)
{
nsCOMPtr<nsIAccessibleProvider> accessibleProvider(do_QueryInterface(aContent));
if (!accessibleProvider)
nsAutoString role;
for (const nsXBLBinding* binding = aContent->GetXBLBinding(); binding; binding = binding->GetBaseBinding()) {
nsIContent* bindingElm = binding->PrototypeBinding()->GetBindingElement();
bindingElm->GetAttr(kNameSpaceID_None, nsGkAtoms::role, role);
if (!role.IsEmpty())
break;
}
if (role.IsEmpty() || role.EqualsLiteral("none"))
return nullptr;
int32_t type;
nsresult rv = accessibleProvider->GetAccessibleType(&type);
if (NS_FAILED(rv))
return nullptr;
if (type == nsIAccessibleProvider::OuterDoc) {
if (role.EqualsLiteral("outerdoc")) {
nsRefPtr<Accessible> accessible = new OuterDocAccessible(aContent, aDoc);
return accessible.forget();
}
nsRefPtr<Accessible> accessible;
switch (type)
{
#ifdef MOZ_XUL
case nsIAccessibleProvider::NoAccessible:
return nullptr;
// XUL controls
if (role.EqualsLiteral("xul:alert")) {
accessible = new XULAlertAccessible(aContent, aDoc);
// XUL controls
case nsIAccessibleProvider::XULAlert:
accessible = new XULAlertAccessible(aContent, aDoc);
break;
} else if (role.EqualsLiteral("xul:button")) {
accessible = new XULButtonAccessible(aContent, aDoc);
case nsIAccessibleProvider::XULButton:
accessible = new XULButtonAccessible(aContent, aDoc);
break;
} else if (role.EqualsLiteral("xul:checkbox")) {
accessible = new XULCheckboxAccessible(aContent, aDoc);
case nsIAccessibleProvider::XULCheckbox:
accessible = new XULCheckboxAccessible(aContent, aDoc);
break;
} else if (role.EqualsLiteral("xul:colorpicker")) {
accessible = new XULColorPickerAccessible(aContent, aDoc);
case nsIAccessibleProvider::XULColorPicker:
accessible = new XULColorPickerAccessible(aContent, aDoc);
break;
} else if (role.EqualsLiteral("xul:colorpickertile")) {
accessible = new XULColorPickerTileAccessible(aContent, aDoc);
case nsIAccessibleProvider::XULColorPickerTile:
accessible = new XULColorPickerTileAccessible(aContent, aDoc);
break;
} else if (role.EqualsLiteral("xul:combobox")) {
accessible = new XULComboboxAccessible(aContent, aDoc);
case nsIAccessibleProvider::XULCombobox:
accessible = new XULComboboxAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTabpanels:
} else if (role.EqualsLiteral("xul:tabpanels")) {
accessible = new XULTabpanelsAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULDropmarker:
} else if (role.EqualsLiteral("xul:dropmarker")) {
accessible = new XULDropmarkerAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULGroupbox:
} else if (role.EqualsLiteral("xul:groupbox")) {
accessible = new XULGroupboxAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULImage:
{
} else if (role.EqualsLiteral("xul:image")) {
if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
} else {
// Don't include nameless images in accessible tree.
if (!aContent->HasAttr(kNameSpaceID_None,
nsGkAtoms::tooltiptext))
return nullptr;
accessible = new ImageAccessibleWrap(aContent, aDoc);
break;
}
case nsIAccessibleProvider::XULLink:
accessible = new XULLinkAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListbox:
} else if (role.EqualsLiteral("xul:link")) {
accessible = new XULLinkAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listbox")) {
accessible = new XULListboxAccessibleWrap(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListCell:
accessible = new XULListCellAccessibleWrap(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListHead:
accessible = new XULColumAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListHeader:
accessible = new XULColumnItemAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULListitem:
accessible = new XULListitemAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULMenubar:
accessible = new XULMenubarAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULMenuitem:
accessible = new XULMenuitemAccessibleWrap(aContent, aDoc);
break;
case nsIAccessibleProvider::XULMenupopup:
{
#ifdef MOZ_ACCESSIBILITY_ATK
// ATK considers this node to be redundant when within menubars, and it makes menu
// navigation with assistive technologies more difficult
// XXX In the future we will should this for consistency across the nsIAccessible
// implementations on each platform for a consistent scripting environment, but
// then strip out redundant accessibles in the AccessibleWrap class for each platform.
nsIContent *parent = aContent->GetParent();
if (parent && parent->NodeInfo()->Equals(nsGkAtoms::menu,
kNameSpaceID_XUL))
return nullptr;
#endif
accessible = new XULMenupopupAccessible(aContent, aDoc);
break;
}
case nsIAccessibleProvider::XULMenuSeparator:
accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULPane:
accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE);
break;
case nsIAccessibleProvider::XULProgressMeter:
accessible = new XULProgressMeterAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULStatusBar:
accessible = new XULStatusBarAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULScale:
accessible = new XULSliderAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULRadioButton:
accessible = new XULRadioButtonAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULRadioGroup:
accessible = new XULRadioGroupAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTab:
accessible = new XULTabAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTabs:
accessible = new XULTabsAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULText:
accessible = new XULLabelAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTextBox:
accessible = new XULTextFieldAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULThumb:
accessible = new XULThumbAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTree:
return CreateAccessibleForXULTree(aContent, aDoc);
case nsIAccessibleProvider::XULTreeColumns:
accessible = new XULTreeColumAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTreeColumnItem:
accessible = new XULColumnItemAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULToolbar:
accessible = new XULToolbarAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULToolbarSeparator:
accessible = new XULToolbarSeparatorAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULTooltip:
accessible = new XULTooltipAccessible(aContent, aDoc);
break;
case nsIAccessibleProvider::XULToolbarButton:
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
break;
#endif // MOZ_XUL
default:
} else if (role.EqualsLiteral("xul:listcell")) {
// Only create cells if there's more than one per row.
nsIContent* listItem = aContent->GetParent();
if (!listItem)
return nullptr;
for (nsIContent* child = listItem->GetFirstChild(); child;
child = child->GetNextSibling()) {
if (child->IsXUL(nsGkAtoms::listcell) && child != aContent) {
accessible = new XULListCellAccessibleWrap(aContent, aDoc);
break;
}
}
} else if (role.EqualsLiteral("xul:listhead")) {
accessible = new XULColumAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listheader")) {
accessible = new XULColumnItemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listitem")) {
accessible = new XULListitemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menubar")) {
accessible = new XULMenubarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menulist")) {
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::droppable,
nsGkAtoms::_false, eCaseMatters))
accessible = new XULTextFieldAccessible(aContent, aDoc);
else
accessible = new XULComboboxAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menuitem")) {
accessible = new XULMenuitemAccessibleWrap(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menupopup")) {
#ifdef MOZ_ACCESSIBILITY_ATK
// ATK considers this node to be redundant when within menubars, and it makes menu
// navigation with assistive technologies more difficult
// XXX In the future we will should this for consistency across the nsIAccessible
// implementations on each platform for a consistent scripting environment, but
// then strip out redundant accessibles in the AccessibleWrap class for each platform.
nsIContent *parent = aContent->GetParent();
if (parent && parent->IsXUL() && parent->Tag() == nsGkAtoms::menu)
return nullptr;
#endif
accessible = new XULMenupopupAccessible(aContent, aDoc);
} else if(role.EqualsLiteral("xul:menuseparator")) {
accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
} else if(role.EqualsLiteral("xul:pane")) {
accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE);
} else if (role.EqualsLiteral("xul:panel")) {
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
nsGkAtoms::_true, eCaseMatters))
accessible = new XULAlertAccessible(aContent, aDoc);
else
accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE);
} else if (role.EqualsLiteral("xul:progressmeter")) {
accessible = new XULProgressMeterAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xulstatusbar")) {
accessible = new XULStatusBarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:scale")) {
accessible = new XULSliderAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:radiobutton")) {
accessible = new XULRadioButtonAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:radiogroup")) {
accessible = new XULRadioGroupAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tab")) {
accessible = new XULTabAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tabs")) {
accessible = new XULTabsAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:text")) {
accessible = new XULLabelAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:textbox")) {
accessible = new XULTextFieldAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:thumb")) {
accessible = new XULThumbAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tree")) {
accessible = CreateAccessibleForXULTree(aContent, aDoc);
} else if (role.EqualsLiteral("xul:treecolumns")) {
accessible = new XULTreeColumAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:treecolumnitem")) {
accessible = new XULColumnItemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbar")) {
accessible = new XULToolbarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbarseparator")) {
accessible = new XULToolbarSeparatorAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tooltip")) {
accessible = new XULTooltipAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbarbutton")) {
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
}
#endif // MOZ_XUL
return accessible.forget();
}

View File

@ -22,7 +22,6 @@
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIEditor.h"
#include "nsIFormControl.h"
#include "nsIFrame.h"
#include "nsINameSpaceManager.h"
#include "nsISelectionController.h"
#include "jsapi.h"

View File

@ -6,17 +6,10 @@
module.metadata = {
'stability': 'experimental',
'engines': {
'Firefox': '> 24'
'Firefox': '*'
}
};
try {
require('chrome').Cu.import('resource:///modules/CustomizableUI.jsm', {});
}
catch (e) {
throw Error('Unsupported Application: The module ' + module.id + ' does not support this application.');
}
const { Class } = require('../core/heritage');
const { merge } = require('../util/object');
const { Disposable } = require('../core/disposable');
@ -32,11 +25,9 @@ const { remove: removeFromArray } = require('../util/array');
const { show, hide, toggle } = require('./sidebar/actions');
const { Worker: WorkerTrait } = require('../content/worker');
const { contract: sidebarContract } = require('./sidebar/contract');
const { Button } = require('./button');
const { setStateFor, getStateFor } = require('./state');
const { create, dispose, updateTitle, updateURL, isSidebarShowing, showSidebar, hideSidebar } = require('./sidebar/view');
const { defer } = require('../core/promise');
const { models, buttons, views, viewsFor, modelFor } = require('./sidebar/namespace');
const { models, views, viewsFor, modelFor } = require('./sidebar/namespace');
const { isLocalURL } = require('../url');
const { ensure } = require('../system/unload');
@ -61,19 +52,6 @@ const Sidebar = Class({
validateTitleAndURLCombo({}, this.title, this.url);
// NOTE: delegating icon validation to the Button.
// IMPORTANT: Make the button first since it has it's own
// validation which we make use of.. (even if the sidebar
// id is not a duplicate the button id could be..)
let button = Button({
id: model.id,
icon: model.icon,
label: model.title,
type: 'checkbox',
onChange: update.bind(null, 'button')
});
buttons.set(this, button);
const self = this;
const internals = sidebarNS(self);
const windowNS = internals.windowNS = ns();
@ -83,28 +61,6 @@ const Sidebar = Class({
setListeners(this, options);
function update(source, state) {
let wins = windows('navigator:browser', { includePrivate: true });
for (let window of wins) {
let isShowing = isSidebarShowing(window, self);
let isChecked = (source == 'button') ? getStateFor(button, window).checked : isShowing;
// update sidebar?
if (isShowing != isChecked) {
if (isChecked) {
showSidebar(window, self);
}
else {
hideSidebar(window, self);
}
}
// update the button
setStateFor(button, window, { checked: isChecked });
}
}
let bars = [];
internals.tracker = WindowTracker({
onTrack: function(window) {
@ -160,7 +116,6 @@ const Sidebar = Class({
// uncheck the associated menuitem
bar.setAttribute('checked', 'false');
setStateFor(button, window, { checked: false });
emit(self, 'hide', {});
emit(self, 'detach', worker);
@ -175,8 +130,6 @@ const Sidebar = Class({
panelBrowser.contentWindow.removeEventListener('load', onWebPanelSidebarLoad, true);
windowNS(window).onWebPanelSidebarLoad = null;
update();
// TODO: decide if returning worker is acceptable..
//emit(self, 'show', { worker: worker });
emit(self, 'show', {});
@ -263,13 +216,6 @@ const Sidebar = Class({
updateURL(this, v);
modelFor(this).url = v;
},
get icon() (buttons.get(this) || {}).icon,
set icon(v) {
let button = buttons.get(this);
if (!button)
return;
button.icon = v;
},
show: function() {
return showSidebar(null, this);
},
@ -291,11 +237,6 @@ const Sidebar = Class({
views.delete(this);
models.delete(this);
// kill the button
let button = buttons.get(this);
if (button)
button.destroy();
}
});
exports.Sidebar = Sidebar;

View File

@ -7,11 +7,6 @@ const { contract } = require('../../util/contract');
const { isValidURI, URL, isLocalURL } = require('../../url');
const { isNil, isObject, isString } = require('../../lang/type');
function isIconSet(icons) {
return Object.keys(icons).
every(size => String(size >>> 0) === size && isLocalURL(icons[size]))
}
exports.contract = contract({
id: {
is: [ 'string' ],
@ -23,12 +18,6 @@ exports.contract = contract({
is: [ 'string' ],
ok: v => v.length
},
icon: {
is: ['string', 'object'],
ok: v => (isString(v) && isLocalURL(v)) || (isObject(v) && isIconSet(v)),
msg: 'The option "icon" must be a local URL or an object with ' +
'numeric keys / local URL values pair.'
},
url: {
is: [ 'string' ],
ok: v => isLocalURL(v),

View File

@ -6,7 +6,7 @@
module.metadata = {
'stability': 'unstable',
'engines': {
'Firefox': '> 24'
'Firefox': '*'
}
};
@ -20,10 +20,14 @@ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const WEB_PANEL_BROWSER_ID = 'web-panels-browser';
function create(window, details) {
let id = makeID(details.id);
let { document } = window;
if (document.getElementById(id))
throw new Error('The ID "' + details.id + '" seems already used.');
let menuitem = document.createElementNS(XUL_NS, 'menuitem');
menuitem.setAttribute('id', makeID(details.id));
menuitem.setAttribute('id', id);
menuitem.setAttribute('label', details.title);
menuitem.setAttribute('sidebarurl', details.sidebarurl);
menuitem.setAttribute('checked', 'false');

View File

@ -7,8 +7,6 @@ const { Cu } = require('chrome');
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
const { fromIterator } = require('sdk/util/array');
const BLANK_IMG = exports.BLANK_IMG = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
const BUILTIN_SIDEBAR_MENUITEMS = exports.BUILTIN_SIDEBAR_MENUITEMS = [
'menu_socialSidebar',
'menu_historySidebar',
@ -61,23 +59,6 @@ function simulateClick(ele) {
}
exports.simulateClick = simulateClick;
function getWidget(buttonId, window = getMostRecentBrowserWindow()) {
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
const { AREA_NAVBAR } = CustomizableUI;
let widgets = CustomizableUI.getWidgetsInArea(AREA_NAVBAR).
filter(({id}) => id.startsWith('button--') && id.endsWith(buttonId));
if (widgets.length === 0)
throw new Error('Widget with id `' + buttonId +'` not found.');
if (widgets.length > 1)
throw new Error('Unexpected number of widgets: ' + widgets.length)
return widgets[0].forWindow(window);
};
exports.getWidget = getWidget;
// OSX and Windows exhibit different behaviors when 'checked' is false,
// so compare against the consistent 'true'. See bug 894809.
function isChecked(node) {

View File

@ -13,9 +13,9 @@ const { isPrivate } = require('sdk/private-browsing');
const { data } = require('sdk/self');
const { URL } = require('sdk/url');
const { BLANK_IMG, BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
const { BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
getSidebarMenuitems, getExtraSidebarMenuitems, makeID, simulateCommand,
simulateClick, getWidget, isChecked } = require('./sidebar/utils');
simulateClick, isChecked } = require('./sidebar/utils');
exports.testSideBarIsInNewPrivateWindows = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
@ -23,7 +23,6 @@ exports.testSideBarIsInNewPrivateWindows = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -44,6 +43,8 @@ exports.testSideBarIsInNewPrivateWindows = function(assert, done) {
})
}
// Disabled in order to land other fixes, see bug 910647 for further details.
/*
exports.testSidebarIsOpenInNewPrivateWindow = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testSidebarIsOpenInNewPrivateWindow';
@ -52,7 +53,6 @@ exports.testSidebarIsOpenInNewPrivateWindow = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -87,7 +87,7 @@ exports.testSidebarIsOpenInNewPrivateWindow = function(assert, done) {
sidebar.show();
}
*/
// TEST: edge case where web panel is destroyed while loading
exports.testDestroyEdgeCaseBugWithPrivateWindow = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
@ -96,7 +96,6 @@ exports.testDestroyEdgeCaseBugWithPrivateWindow = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -125,14 +124,13 @@ exports.testDestroyEdgeCaseBugWithPrivateWindow = function(assert, done) {
let sidebar = loader.require('sdk/ui/sidebar').Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName,
onShow: function() {
assert.pass('onShow works for Sidebar');
loader.unload();
let sidebarMI = getSidebarMenuitems();
for each (let mi in sidebarMI) {
for (let mi of sidebarMI) {
assert.ok(BUILTIN_SIDEBAR_MENUITEMS.indexOf(mi.getAttribute('id')) >= 0, 'the menuitem is for a built-in sidebar')
assert.ok(!isChecked(mi), 'no sidebar menuitem is checked');
}
@ -159,7 +157,6 @@ exports.testShowInPrivateWindow = function(assert, done) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
let menuitemID = makeID(sidebar1.id);

View File

@ -5,7 +5,7 @@
module.metadata = {
'engines': {
'Firefox': '> 24'
'Firefox': '*'
}
};
@ -13,8 +13,6 @@ const { Cu } = require('chrome');
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
const { fromIterator } = require('sdk/util/array');
const BLANK_IMG = exports.BLANK_IMG = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
const BUILTIN_SIDEBAR_MENUITEMS = exports.BUILTIN_SIDEBAR_MENUITEMS = [
'menu_socialSidebar',
'menu_historySidebar',
@ -67,23 +65,6 @@ function simulateClick(ele) {
}
exports.simulateClick = simulateClick;
function getWidget(buttonId, window = getMostRecentBrowserWindow()) {
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
const { AREA_NAVBAR } = CustomizableUI;
let widgets = CustomizableUI.getWidgetsInArea(AREA_NAVBAR).
filter(({id}) => id.startsWith('button--') && id.endsWith(buttonId));
if (widgets.length === 0)
throw new Error('Widget with id `' + buttonId +'` not found.');
if (widgets.length > 1)
throw new Error('Unexpected number of widgets: ' + widgets.length)
return widgets[0].forWindow(window);
};
exports.getWidget = getWidget;
// OSX and Windows exhibit different behaviors when 'checked' is false,
// so compare against the consistent 'true'. See bug 894809.
function isChecked(node) {

View File

@ -5,7 +5,7 @@
module.metadata = {
'engines': {
'Firefox': '> 24'
'Firefox': '*'
}
};
@ -19,9 +19,9 @@ const { isPrivate } = require('sdk/private-browsing');
const { data } = require('sdk/self');
const { URL } = require('sdk/url');
const { BLANK_IMG, BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
const { BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
getSidebarMenuitems, getExtraSidebarMenuitems, makeID, simulateCommand,
simulateClick, getWidget, isChecked } = require('./sidebar/utils');
simulateClick, isChecked } = require('./sidebar/utils');
exports.testSideBarIsNotInNewPrivateWindows = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
@ -29,7 +29,6 @@ exports.testSideBarIsNotInNewPrivateWindows = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -58,7 +57,6 @@ exports.testSidebarIsNotOpenInNewPrivateWindow = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -94,7 +92,6 @@ exports.testDestroyEdgeCaseBugWithPrivateWindow = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -123,14 +120,13 @@ exports.testDestroyEdgeCaseBugWithPrivateWindow = function(assert, done) {
let sidebar = loader.require('sdk/ui/sidebar').Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName,
onShow: function() {
assert.pass('onShow works for Sidebar');
loader.unload();
let sidebarMI = getSidebarMenuitems();
for each (let mi in sidebarMI) {
for (let mi of sidebarMI) {
assert.ok(BUILTIN_SIDEBAR_MENUITEMS.indexOf(mi.getAttribute('id')) >= 0, 'the menuitem is for a built-in sidebar')
assert.ok(!isChecked(mi), 'no sidebar menuitem is checked');
}
@ -158,7 +154,6 @@ exports.testShowInPrivateWindow = function(assert, done) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});

View File

@ -5,7 +5,7 @@
module.metadata = {
'engines': {
'Firefox': '> 24'
'Firefox': '*'
}
};
@ -22,9 +22,9 @@ const { URL } = require('sdk/url');
const { once, off, emit } = require('sdk/event/core');
const { defer, all } = require('sdk/core/promise');
const { BLANK_IMG, BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
const { BUILTIN_SIDEBAR_MENUITEMS, isSidebarShowing,
getSidebarMenuitems, getExtraSidebarMenuitems, makeID, simulateCommand,
simulateClick, getWidget, isChecked } = require('./sidebar/utils');
simulateClick, isChecked } = require('./sidebar/utils');
exports.testSidebarBasicLifeCycle = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
@ -39,15 +39,12 @@ exports.testSidebarBasicLifeCycle = function(assert, done) {
let sidebarDetails = {
id: testName,
title: 'test',
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
};
let sidebar = Sidebar(sidebarDetails);
// test the sidebar attributes
for each(let key in Object.keys(sidebarDetails)) {
if (key == 'icon')
continue;
for (let key of Object.keys(sidebarDetails)) {
assert.equal(sidebarDetails[key], sidebar[key], 'the attributes match the input');
}
@ -81,7 +78,7 @@ exports.testSidebarBasicLifeCycle = function(assert, done) {
sidebar.destroy();
let sidebarMI = getSidebarMenuitems();
for each (let mi in sidebarMI) {
for (let mi of sidebarMI) {
assert.ok(BUILTIN_SIDEBAR_MENUITEMS.indexOf(mi.getAttribute('id')) >= 0, 'the menuitem is for a built-in sidebar')
assert.ok(!isChecked(mi), 'no sidebar menuitem is checked');
}
@ -107,7 +104,6 @@ exports.testSideBarIsInNewWindows = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -136,7 +132,6 @@ exports.testSideBarIsShowingInNewWindows = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: URL('data:text/html;charset=utf-8,'+testName)
});
@ -206,7 +201,6 @@ exports.testAddonGlobalSimple = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: data.url('test-sidebar-addon-global.html')
});
@ -233,7 +227,6 @@ exports.testAddonGlobalComplex = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: data.url('test-sidebar-addon-global.html')
});
@ -265,13 +258,11 @@ exports.testShowingOneSidebarAfterAnother = function(assert, done) {
let sidebar1 = Sidebar({
id: testName + '1',
title: testName + '1',
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName + 1
});
let sidebar2 = Sidebar({
id: testName + '2',
title: testName + '2',
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName + 2
});
@ -290,7 +281,7 @@ exports.testShowingOneSidebarAfterAnother = function(assert, done) {
sidebar1.once('show', function() {
testShowing(true, false, true);
for each (let mi in getExtraSidebarMenuitems(window)) {
for (let mi of getExtraSidebarMenuitems(window)) {
let menuitemID = mi.getAttribute('id').replace(/^jetpack-sidebar-/, '');
assert.ok(IDs.indexOf(menuitemID) >= 0, 'the extra menuitem is for one of our test sidebars');
assert.equal(isChecked(mi), menuitemID == sidebar1.id, 'the test sidebar menuitem has the correct checked value');
@ -298,7 +289,7 @@ exports.testShowingOneSidebarAfterAnother = function(assert, done) {
sidebar2.once('show', function() {
testShowing(false, true, true);
for each (let mi in getExtraSidebarMenuitems(window)) {
for (let mi of getExtraSidebarMenuitems(window)) {
let menuitemID = mi.getAttribute('id').replace(/^jetpack-sidebar-/, '');
assert.ok(IDs.indexOf(menuitemID) >= 0, 'the extra menuitem is for one of our test sidebars');
assert.equal(isChecked(mi), menuitemID == sidebar2.id, 'the test sidebar menuitem has the correct checked value');
@ -328,18 +319,16 @@ exports.testSidebarUnload = function(assert, done) {
assert.equal(isPrivate(window), false, 'the current window is not private');
// EXPLICIT: testing require('sdk/ui')
let sidebar = loader.require('sdk/ui').Sidebar({
let sidebar = loader.require('sdk/ui/sidebar').Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName,
onShow: function() {
assert.pass('onShow works for Sidebar');
loader.unload();
let sidebarMI = getSidebarMenuitems();
for each (let mi in sidebarMI) {
for (let mi of sidebarMI) {
assert.ok(BUILTIN_SIDEBAR_MENUITEMS.indexOf(mi.getAttribute('id')) >= 0, 'the menuitem is for a built-in sidebar')
assert.ok(!isChecked(mi), 'no sidebar menuitem is checked');
}
@ -361,7 +350,6 @@ exports.testRemoteContent = function(assert) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'http://dne.xyz.mozilla.org'
});
assert.fail('a bad sidebar was created..');
@ -379,7 +367,6 @@ exports.testInvalidURL = function(assert) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'http:mozilla.org'
});
assert.fail('a bad sidebar was created..');
@ -396,8 +383,7 @@ exports.testInvalidURLType = function(assert) {
try {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG
title: testName
});
assert.fail('a bad sidebar was created..');
sidebar.destroy();
@ -414,7 +400,6 @@ exports.testInvalidTitle = function(assert) {
let sidebar = Sidebar({
id: testName,
title: '',
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
@ -425,23 +410,6 @@ exports.testInvalidTitle = function(assert) {
}
}
exports.testInvalidIcon = function(assert) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testInvalidIcon';
try {
let sidebar = Sidebar({
id: testName,
title: testName,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
sidebar.destroy();
}
catch(e) {
assert.ok(/The option "icon" must be a local URL or an object with/.test(e), 'invalid icons are not acceptable');
}
}
exports.testInvalidID = function(assert) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testInvalidID';
@ -449,7 +417,6 @@ exports.testInvalidID = function(assert) {
let sidebar = Sidebar({
id: '!',
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
@ -467,7 +434,6 @@ exports.testInvalidBlankID = function(assert) {
let sidebar = Sidebar({
id: '',
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
@ -485,7 +451,6 @@ exports.testInvalidNullID = function(assert) {
let sidebar = Sidebar({
id: null,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
@ -502,7 +467,6 @@ exports.testInvalidUndefinedID = function(assert) {
try {
let sidebar = Sidebar({
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
assert.fail('a bad sidebar was created..');
@ -521,7 +485,6 @@ exports.testDestroyEdgeCaseBug = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -550,14 +513,13 @@ exports.testDestroyEdgeCaseBug = function(assert, done) {
let sidebar = loader.require('sdk/ui/sidebar').Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+ testName,
onShow: function() {
assert.pass('onShow works for Sidebar');
loader.unload();
let sidebarMI = getSidebarMenuitems();
for each (let mi in sidebarMI) {
for (let mi of sidebarMI) {
assert.ok(BUILTIN_SIDEBAR_MENUITEMS.indexOf(mi.getAttribute('id')) >= 0, 'the menuitem is for a built-in sidebar')
assert.ok(!isChecked(mi), 'no sidebar menuitem is checked');
}
@ -582,7 +544,6 @@ exports.testClickingACheckedMenuitem = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName,
});
@ -600,61 +561,6 @@ exports.testClickingACheckedMenuitem = function(assert, done) {
});
};
exports.testClickingACheckedButton = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testClickingACheckedButton';
let window = getMostRecentBrowserWindow();
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName,
onShow: function onShow() {
sidebar.off('show', onShow);
assert.pass('the sidebar was shown');
//assert.equal(button.checked, true, 'the button is now checked');
sidebar.once('hide', function() {
assert.pass('clicking the button after the sidebar has shown hides it.');
sidebar.once('show', function() {
assert.pass('clicking the button again shows it.');
sidebar.hide().then(function() {
assert.pass('hide callback works');
assert.equal(isShowing(sidebar), false, 'the sidebar is not showing, final.');
assert.pass('the sidebar was destroying');
sidebar.destroy();
assert.pass('the sidebar was destroyed');
assert.equal(button.parentNode, null, 'the button\'s parents were shot')
done();
}, assert.fail);
});
assert.equal(isShowing(sidebar), false, 'the sidebar is not showing');
// TODO: figure out why this is necessary..
setTimeout(function() simulateCommand(button));
});
assert.equal(isShowing(sidebar), true, 'the sidebar is showing');
simulateCommand(button);
}
});
let { node: button } = getWidget(sidebar.id, window);
//assert.equal(button.checked, false, 'the button exists and is not checked');
assert.equal(isShowing(sidebar), false, 'the sidebar is not showing');
simulateCommand(button);
}
exports.testTitleSetter = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testTitleSetter';
@ -663,16 +569,12 @@ exports.testTitleSetter = function(assert, done) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName,
});
assert.equal(sidebar1.title, testName, 'title getter works');
sidebar1.show().then(function() {
let button = document.querySelector('toolbarbutton[label=' + testName + ']');
assert.ok(button, 'button was found');
assert.equal(document.getElementById(makeID(sidebar1.id)).getAttribute('label'),
testName,
'the menuitem label is correct');
@ -689,8 +591,6 @@ exports.testTitleSetter = function(assert, done) {
assert.equal(document.getElementById('sidebar-title').value, 'foo', 'the sidebar title was updated');
assert.equal(button.getAttribute('label'), 'foo', 'the button label was updated');
sidebar1.destroy();
done();
}, assert.fail);
@ -706,7 +606,6 @@ exports.testURLSetter = function(assert, done) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -759,7 +658,6 @@ exports.testDuplicateID = function(assert) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -767,7 +665,6 @@ exports.testDuplicateID = function(assert) {
Sidebar({
id: testName,
title: testName + 1,
icon: BLANK_IMG,
url: url + 2
}).destroy();
}, /The ID .+ seems already used\./i, 'duplicate IDs will throw errors');
@ -785,7 +682,6 @@ exports.testURLSetterToSameValueReloadsSidebar = function(assert, done) {
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -828,16 +724,15 @@ exports.testURLSetterToSameValueReloadsSidebar = function(assert, done) {
}, assert.fail);
}
exports.testButtonShowingInOneWindowDoesNotAffectOtherWindows = function(assert, done) {
exports.testShowingInOneWindowDoesNotAffectOtherWindows = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testButtonShowingInOneWindowDoesNotAffectOtherWindows';
let testName = 'testShowingInOneWindowDoesNotAffectOtherWindows';
let window1 = getMostRecentBrowserWindow();
let url = 'data:text/html;charset=utf-8,'+testName;
let sidebar1 = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -860,7 +755,7 @@ exports.testButtonShowingInOneWindowDoesNotAffectOtherWindows = function(assert,
let { document } = window;
assert.pass('new window was opened!');
// waiting for show using button
// waiting for show
sidebar1.once('show', function() {
// check state of the new window
assert.equal(isShowing(sidebar1), true, 'the sidebar is showing');
@ -899,11 +794,7 @@ exports.testButtonShowingInOneWindowDoesNotAffectOtherWindows = function(assert,
assert.pass('set sidebar1.url');
});
// clicking the sidebar button on the second window
let { node: button } = getWidget(sidebar1.id, window);
assert.ok(!!button, 'the button was found!');
simulateCommand(button);
sidebar1.show();
}, assert.fail);
}
@ -914,7 +805,6 @@ exports.testHidingAHiddenSidebarRejects = function(assert) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -938,7 +828,6 @@ exports.testGCdSidebarsOnUnload = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -947,17 +836,14 @@ exports.testGCdSidebarsOnUnload = function(assert, done) {
assert.equal(isSidebarShowing(window), true, 'the sidebar is showing');
let buttonID = getWidget(testName, window).node.getAttribute('id');
let menuitemID = makeID(testName);
assert.ok(!!window.document.getElementById(buttonID), 'the button was found');
assert.ok(!!window.document.getElementById(menuitemID), 'the menuitem was found');
Cu.schedulePreciseGC(function() {
loader.unload();
assert.equal(isSidebarShowing(window), false, 'the sidebar is not showing after unload');
assert.ok(!window.document.getElementById(buttonID), 'the button was removed');
assert.ok(!window.document.getElementById(menuitemID), 'the menuitem was removed');
done();
@ -978,7 +864,6 @@ exports.testGCdShowingSidebarsOnUnload = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -987,21 +872,17 @@ exports.testGCdShowingSidebarsOnUnload = function(assert, done) {
assert.equal(isSidebarShowing(window), true, 'the sidebar is showing');
let buttonID = getWidget(testName, window).node.getAttribute('id');
let menuitemID = makeID(testName);
assert.ok(!!window.document.getElementById(buttonID), 'the button was found');
assert.ok(!!window.document.getElementById(menuitemID), 'the menuitem was found');
Cu.schedulePreciseGC(function() {
assert.equal(isSidebarShowing(window), true, 'the sidebar is still showing after gc');
assert.ok(!!window.document.getElementById(buttonID), 'the button was found after gc');
assert.ok(!!window.document.getElementById(menuitemID), 'the menuitem was found after gc');
loader.unload();
assert.equal(isSidebarShowing(window), false, 'the sidebar is not showing after unload');
assert.ok(!window.document.getElementById(buttonID), 'the button was removed');
assert.ok(!window.document.getElementById(menuitemID), 'the menuitem was removed');
done();
@ -1025,23 +906,18 @@ exports.testGCdHiddenSidebarsOnUnload = function(assert, done) {
Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
let buttonID = getWidget(testName, window).node.getAttribute('id');
let menuitemID = makeID(testName);
assert.ok(!!window.document.getElementById(buttonID), 'the button was found');
assert.ok(!!window.document.getElementById(menuitemID), 'the menuitem was found');
Cu.schedulePreciseGC(function() {
assert.ok(!!window.document.getElementById(buttonID), 'the button was found after gc');
assert.ok(!!window.document.getElementById(menuitemID), 'the menuitem was found after gc');
loader.unload();
assert.ok(!window.document.getElementById(buttonID), 'the button was removed');
assert.ok(!window.document.getElementById(menuitemID), 'the menuitem was removed');
done();
@ -1056,7 +932,6 @@ exports.testSidebarGettersAndSettersAfterDestroy = function(assert) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -1079,61 +954,6 @@ exports.testSidebarGettersAndSettersAfterDestroy = function(assert) {
assert.equal(sidebar.url, undefined, 'sidebar after destroy has no url');
}
exports.testButtonIconSet = function(assert) {
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
let loader = Loader(module);
let { Sidebar } = loader.require('sdk/ui');
let testName = 'testButtonIconSet';
let url = 'data:text/html;charset=utf-8,'+testName;
// Test remote icon set
assert.throws(
() => Sidebar({
id: 'my-button-10',
title: 'my button',
url: url,
icon: {
'16': 'http://www.mozilla.org/favicon.ico'
}
}),
/^The option "icon"/,
'throws on no valid icon given');
let sidebar = Sidebar({
id: 'my-button-11',
title: 'my button',
url: url,
icon: {
'16': './icon16.png',
'32': './icon32.png',
'64': './icon64.png'
}
});
let { node, id: widgetId } = getWidget(sidebar.id);
let { devicePixelRatio } = node.ownerDocument.defaultView;
let size = 16 * devicePixelRatio;
assert.equal(node.getAttribute('image'), data.url(sidebar.icon[size].substr(2)),
'the icon is set properly in navbar');
let size = 32 * devicePixelRatio;
CustomizableUI.addWidgetToArea(widgetId, CustomizableUI.AREA_PANEL);
assert.equal(node.getAttribute('image'), data.url(sidebar.icon[size].substr(2)),
'the icon is set properly in panel');
// Using `loader.unload` without move back the button to the original area
// raises an error in the CustomizableUI. This is doesn't happen if the
// button is moved manually from navbar to panel. I believe it has to do
// with `addWidgetToArea` method, because even with a `timeout` the issue
// persist.
CustomizableUI.addWidgetToArea(widgetId, CustomizableUI.AREA_NAVBAR);
loader.unload();
}
exports.testSidebarLeakCheckDestroyAfterAttach = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
@ -1142,7 +962,6 @@ exports.testSidebarLeakCheckDestroyAfterAttach = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -1184,7 +1003,6 @@ exports.testSidebarLeakCheckUnloadAfterAttach = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,'+testName
});
@ -1228,7 +1046,6 @@ exports.testTwoSidebarsWithSameTitleAndURL = function(assert) {
let sidebar1 = Sidebar({
id: testName + 1,
title: title,
icon: BLANK_IMG,
url: url
});
@ -1236,7 +1053,6 @@ exports.testTwoSidebarsWithSameTitleAndURL = function(assert) {
Sidebar({
id: testName + 2,
title: title,
icon: BLANK_IMG,
url: url
}).destroy();
}, /title.+url.+invalid/i, 'Creating two sidebars with the same title + url is not allowed');
@ -1244,7 +1060,6 @@ exports.testTwoSidebarsWithSameTitleAndURL = function(assert) {
let sidebar2 = Sidebar({
id: testName + 2,
title: title,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,X'
});
@ -1263,9 +1078,9 @@ exports.testTwoSidebarsWithSameTitleAndURL = function(assert) {
sidebar2.destroy();
}
exports.testButtonToOpenXToClose = function(assert, done) {
exports.testShowToOpenXToClose = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testButtonToOpenXToClose';
let testName = 'testShowToOpenXToClose';
let title = testName;
let url = 'data:text/html;charset=utf-8,' + testName;
@ -1274,17 +1089,14 @@ exports.testButtonToOpenXToClose = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url,
onShow: function() {
assert.ok(isChecked(button), 'button is checked');
assert.ok(isChecked(menuitem), 'menuitem is checked');
let closeButton = window.document.querySelector('#sidebar-header > toolbarbutton.tabs-closebutton');
simulateCommand(closeButton);
},
onHide: function() {
assert.ok(!isChecked(button), 'button is not checked');
assert.ok(!isChecked(menuitem), 'menuitem is not checked');
sidebar.destroy();
@ -1292,18 +1104,16 @@ exports.testButtonToOpenXToClose = function(assert, done) {
}
});
let { node: button } = getWidget(sidebar.id, window);
let menuitem = window.document.getElementById(makeID(sidebar.id));
assert.ok(!isChecked(button), 'button is not checked');
assert.ok(!isChecked(menuitem), 'menuitem is not checked');
simulateCommand(button);
sidebar.show();
}
exports.testButtonToOpenMenuitemToClose = function(assert, done) {
exports.testShowToOpenMenuitemToClose = function(assert, done) {
const { Sidebar } = require('sdk/ui/sidebar');
let testName = 'testButtonToOpenMenuitemToClose';
let testName = 'testShowToOpenMenuitemToClose';
let title = testName;
let url = 'data:text/html;charset=utf-8,' + testName;
@ -1312,16 +1122,13 @@ exports.testButtonToOpenMenuitemToClose = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url,
onShow: function() {
assert.ok(isChecked(button), 'button is checked');
assert.ok(isChecked(menuitem), 'menuitem is checked');
simulateCommand(menuitem);
},
onHide: function() {
assert.ok(!isChecked(button), 'button is not checked');
assert.ok(!isChecked(menuitem), 'menuitem is not checked');
sidebar.destroy();
@ -1329,13 +1136,11 @@ exports.testButtonToOpenMenuitemToClose = function(assert, done) {
}
});
let { node: button } = getWidget(sidebar.id, window);
let menuitem = window.document.getElementById(makeID(sidebar.id));
assert.ok(!isChecked(button), 'button is not checked');
assert.ok(!isChecked(menuitem), 'menuitem is not checked');
simulateCommand(button);
sidebar.show();
}
exports.testDestroyWhileNonBrowserWindowIsOpen = function(assert, done) {
@ -1346,7 +1151,6 @@ exports.testDestroyWhileNonBrowserWindowIsOpen = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: url
});
@ -1393,7 +1197,6 @@ exports.testEventListeners = function(assert, done) {
let sidebar = Sidebar({
id: testName,
title: testName,
icon: BLANK_IMG,
url: 'data:text/html;charset=utf-8,' + testName,
onShow: function() {
assert.equal(this, sidebar, '`this` is correct in onShow');

View File

@ -197,6 +197,8 @@ let FormAssistant = {
addMessageListener("Forms:GetText", this);
addMessageListener("Forms:Input:SendKey", this);
addMessageListener("Forms:GetContext", this);
addMessageListener("Forms:SetComposition", this);
addMessageListener("Forms:EndComposition", this);
},
ignoredInputTypes: new Set([
@ -239,6 +241,7 @@ let FormAssistant = {
if (this.focusedElement) {
this.focusedElement.removeEventListener('mousedown', this);
this.focusedElement.removeEventListener('mouseup', this);
this.focusedElement.removeEventListener('compositionend', this);
if (this._observer) {
this._observer.disconnect();
this._observer = null;
@ -263,6 +266,7 @@ let FormAssistant = {
if (element) {
element.addEventListener('mousedown', this);
element.addEventListener('mouseup', this);
element.addEventListener('compositionend', this);
if (isContentEditable(element)) {
this._documentEncoder = getDocumentEncoder(element);
}
@ -327,12 +331,18 @@ let FormAssistant = {
}
// Focusing on Window, Document or iFrame should focus body
if (target instanceof HTMLHtmlElement)
if (target instanceof HTMLHtmlElement) {
target = target.document.body;
else if (target instanceof HTMLDocument)
} else if (target instanceof HTMLDocument) {
target = target.body;
else if (target instanceof HTMLIFrameElement)
target = target.contentDocument.body;
} else if (target instanceof HTMLIFrameElement) {
target = target.contentDocument ? target.contentDocument.body
: null;
}
if (!target) {
break;
}
if (isContentEditable(target)) {
this.showKeyboard(this.getTopLevelEditable(target));
@ -423,6 +433,8 @@ let FormAssistant = {
break;
}
CompositionManager.endComposition('');
// Don't monitor the text change resulting from key event.
this._ignoreEditActionOnce = true;
@ -438,8 +450,18 @@ let FormAssistant = {
break;
}
CompositionManager.endComposition('');
this._ignoreEditActionOnce = false;
break;
case "compositionend":
if (!this.focusedElement) {
break;
}
CompositionManager.onCompositionEnd();
break;
}
},
@ -475,6 +497,8 @@ let FormAssistant = {
this._editing = true;
switch (msg.name) {
case "Forms:Input:Value": {
CompositionManager.endComposition('');
target.value = json.value;
let event = target.ownerDocument.createEvent('HTMLEvents');
@ -484,6 +508,8 @@ let FormAssistant = {
}
case "Forms:Input:SendKey":
CompositionManager.endComposition('');
["keydown", "keypress", "keyup"].forEach(function(type) {
domWindowUtils.sendKeyEvent(type, json.keyCode, json.charCode,
json.modifiers);
@ -528,6 +554,8 @@ let FormAssistant = {
}
case "Forms:SetSelectionRange": {
CompositionManager.endComposition('');
let start = json.selectionStart;
let end = json.selectionEnd;
setSelectionRange(target, start, end);
@ -543,6 +571,8 @@ let FormAssistant = {
}
case "Forms:ReplaceSurroundingText": {
CompositionManager.endComposition('');
let text = json.text;
let beforeLength = json.beforeLength;
let afterLength = json.afterLength;
@ -583,6 +613,23 @@ let FormAssistant = {
sendAsyncMessage("Forms:GetContext:Result:OK", obj);
break;
}
case "Forms:SetComposition": {
CompositionManager.setComposition(target, json.text, json.cursor,
json.clauses);
sendAsyncMessage("Forms:SetComposition:Result:OK", {
requestId: json.requestId,
});
break;
}
case "Forms:EndComposition": {
CompositionManager.endComposition(json.text);
sendAsyncMessage("Forms:EndComposition:Result:OK", {
requestId: json.requestId,
});
break;
}
}
this._editing = false;
@ -1015,3 +1062,97 @@ function replaceSurroundingText(element, text, selectionStart, beforeLength,
editor.insertText(text);
}
}
let CompositionManager = {
_isStarted: false,
_text: '',
_clauseAttrMap: {
'raw-input': domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
'selected-raw-text': domWindowUtils.COMPOSITION_ATTR_SELECTEDRAWTEXT,
'converted-text': domWindowUtils.COMPOSITION_ATTR_CONVERTEDTEXT,
'selected-converted-text': domWindowUtils.COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT
},
setComposition: function cm_setComposition(element, text, cursor, clauses) {
// Check parameters.
if (!element) {
return;
}
let len = text.length;
if (cursor < 0) {
cursor = 0;
} else if (cursor > len) {
cursor = len;
}
let clauseLens = [len, 0, 0];
let clauseAttrs = [domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
domWindowUtils.COMPOSITION_ATTR_RAWINPUT];
if (clauses) {
let remainingLength = len;
// Currently we don't support 4 or more clauses composition string.
let clauseNum = Math.min(3, clauses.length);
for (let i = 0; i < clauseNum; i++) {
if (clauses[i]) {
let clauseLength = clauses[i].length || 0;
// Make sure the total clauses length is not bigger than that of the
// composition string.
if (clauseLength > remainingLength) {
clauseLength = remainingLength;
}
remainingLength -= clauseLength;
clauseLens[i] = clauseLength;
clauseAttrs[i] = this._clauseAttrMap[clauses[i].selectionType] ||
domWindowUtils.COMPOSITION_ATTR_RAWINPUT;
}
}
// If the total clauses length is less than that of the composition
// string, extend the last clause to the end of the composition string.
if (remainingLength > 0) {
clauseLens[2] += remainingLength;
}
}
// Start composition if need to.
if (!this._isStarted) {
this._isStarted = true;
domWindowUtils.sendCompositionEvent('compositionstart', '', '');
this._text = '';
}
// Update the composing text.
if (this._text !== text) {
this._text = text;
domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
}
domWindowUtils.sendTextEvent(text,
clauseLens[0], clauseAttrs[0],
clauseLens[1], clauseAttrs[1],
clauseLens[2], clauseAttrs[2],
cursor, 0);
},
endComposition: function cm_endComposition(text) {
if (!this._isStarted) {
return;
}
// Update the composing text.
if (this._text !== text) {
domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
}
domWindowUtils.sendTextEvent(text, 0, 0, 0, 0, 0, 0, 0, 0);
domWindowUtils.sendCompositionEvent('compositionend', text, '');
this._text = '';
this._isStarted = false;
},
// Composition ends due to external actions.
onCompositionEnd: function cm_onCompositionEnd() {
if (!this._isStarted) {
return;
}
this._text = '';
this._isStarted = false;
}
};

View File

@ -415,6 +415,10 @@ SettingsListener.observe('privacy.donottrackheader.enabled', false, function(val
Services.prefs.setBoolPref('privacy.donottrackheader.enabled', value);
});
SettingsListener.observe('privacy.donottrackheader.value', 1, function(value) {
Services.prefs.setIntPref('privacy.donottrackheader.value', value);
});
// =================== Crash Reporting ====================
SettingsListener.observe('app.reportCrashes', 'ask', function(value) {
if (value == 'always') {

View File

@ -23,7 +23,8 @@ let Keyboard = {
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions',
'SetSelectionRange', 'ReplaceSurroundingText', 'ShowInputMethodPicker',
'SwitchToNextInputMethod', 'HideInputMethod',
'GetText', 'SendKey', 'GetContext'
'GetText', 'SendKey', 'GetContext',
'SetComposition', 'EndComposition'
],
get messageManager() {
@ -66,6 +67,8 @@ let Keyboard = {
mm.addMessageListener('Forms:SendKey:Result:OK', this);
mm.addMessageListener('Forms:SequenceError', this);
mm.addMessageListener('Forms:GetContext:Result:OK', this);
mm.addMessageListener('Forms:SetComposition:Result:OK', this);
mm.addMessageListener('Forms:EndComposition:Result:OK', this);
// When not running apps OOP, we need to load forms.js here since this
// won't happen from dom/ipc/preload.js
@ -116,6 +119,8 @@ let Keyboard = {
case 'Forms:SendKey:Result:OK':
case 'Forms:SequenceError':
case 'Forms:GetContext:Result:OK':
case 'Forms:SetComposition:Result:OK':
case 'Forms:EndComposition:Result:OK':
let name = msg.name.replace(/^Forms/, 'Keyboard');
this.forwardEvent(name, msg);
break;
@ -153,6 +158,12 @@ let Keyboard = {
case 'Keyboard:GetContext':
this.getContext(msg);
break;
case 'Keyboard:SetComposition':
this.setComposition(msg);
break;
case 'Keyboard:EndComposition':
this.endComposition(msg);
break;
}
},
@ -223,6 +234,14 @@ let Keyboard = {
getContext: function keyboardGetContext(msg) {
this.messageManager.sendAsyncMessage('Forms:GetContext', msg.data);
},
setComposition: function keyboardSetComposition(msg) {
this.messageManager.sendAsyncMessage('Forms:SetComposition', msg.data);
},
endComposition: function keyboardEndComposition(msg) {
this.messageManager.sendAsyncMessage('Forms:EndComposition', msg.data);
}
};

View File

@ -415,6 +415,8 @@ MozInputContext.prototype = {
"Keyboard:SetSelectionRange:Result:OK",
"Keyboard:ReplaceSurroundingText:Result:OK",
"Keyboard:SendKey:Result:OK",
"Keyboard:SetComposition:Result:OK",
"Keyboard:EndComposition:Result:OK",
"Keyboard:SequenceError"]);
},
@ -472,6 +474,10 @@ MozInputContext.prototype = {
// not invalidated yet...
resolver.reject("InputContext has expired");
break;
case "Keyboard:SetComposition:Result:OK": // Fall through.
case "Keyboard:EndComposition:Result:OK":
resolver.resolve();
break;
default:
dump("Could not find a handler for " + msg.name);
resolver.reject();
@ -627,12 +633,30 @@ MozInputContext.prototype = {
});
},
setComposition: function ic_setComposition(text, cursor) {
throw new this._window.DOMError("NotSupportedError", "Not implemented");
setComposition: function ic_setComposition(text, cursor, clauses) {
let self = this;
return this.createPromise(function(resolver) {
let resolverId = self.getPromiseResolverId(resolver);
cpmm.sendAsyncMessage('Keyboard:SetComposition', {
contextId: self._contextId,
requestId: resolverId,
text: text,
cursor: cursor || text.length,
clauses: clauses || null
});
});
},
endComposition: function ic_endComposition(text) {
throw new this._window.DOMError("NotSupportedError", "Not implemented");
let self = this;
return this.createPromise(function(resolver) {
let resolverId = self.getPromiseResolverId(resolver);
cpmm.sendAsyncMessage('Keyboard:EndComposition', {
contextId: self._contextId,
requestId: resolverId,
text: text || ''
});
});
}
};

View File

@ -1,4 +1,4 @@
{
"revision": "9adc8de2a121d92d43a4669c4326695fe703eb71",
"revision": "d9f759cc10938a3caa252e96420531bbb6d6cab3",
"repo_path": "/integration/gaia-central"
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1376427851000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1377553788000">
<emItems>
<emItem blockID="i350" id="sqlmoz@facebook.com">
<versionRange minVersion="0" maxVersion="*" severity="3">
@ -480,6 +480,10 @@
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
</versionRange>
</emItem>
<emItem blockID="i444" id="fplayer@adobe.flash">
<versionRange minVersion="0" maxVersion="*" severity="3">
</versionRange>
</emItem>
<emItem blockID="i334" id="{0F827075-B026-42F3-885D-98981EE7B1AE}">
<versionRange minVersion="0" maxVersion="*" severity="3">
</versionRange>

View File

@ -1082,6 +1082,7 @@ pref("devtools.layoutview.open", false);
// Enable the Responsive UI tool
pref("devtools.responsiveUI.enabled", true);
pref("devtools.responsiveUI.no-reload-notification", false);
// Enable the Debugger
pref("devtools.debugger.enabled", true);

View File

@ -153,7 +153,7 @@ const SNIPPETS_OBJECTSTORE_NAME = "snippets";
let gInitialized = false;
let gObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
setupSearchEngine();
if (!gInitialized) {
ensureSnippetsMapThen(loadSnippets);
@ -295,52 +295,17 @@ function ensureSnippetsMapThen(aCallback)
function onSearchSubmit(aEvent)
{
let searchTerms = document.getElementById("searchText").value;
let searchURL = document.documentElement.getAttribute("searchEngineURL");
let engineName = document.documentElement.getAttribute("searchEngineName");
if (searchURL && searchTerms.length > 0) {
// Send an event that a search was performed. This was originally
// added so Firefox Health Report could record that a search from
// about:home had occurred.
let engineName = document.documentElement.getAttribute("searchEngineName");
let event = new CustomEvent("AboutHomeSearchEvent", {detail: engineName});
if (engineName && searchTerms.length > 0) {
// Send an event that will perform a search and Firefox Health Report will
// record that a search from about:home has occurred.
let eventData = JSON.stringify({
engineName: engineName,
searchTerms: searchTerms
});
let event = new CustomEvent("AboutHomeSearchEvent", {detail: eventData});
document.dispatchEvent(event);
const SEARCH_TOKEN = "_searchTerms_";
let searchPostData = document.documentElement.getAttribute("searchEnginePostData");
if (searchPostData) {
// Check if a post form already exists. If so, remove it.
const POST_FORM_NAME = "searchFormPost";
let form = document.forms[POST_FORM_NAME];
if (form) {
form.parentNode.removeChild(form);
}
// Create a new post form.
form = document.body.appendChild(document.createElement("form"));
form.setAttribute("name", POST_FORM_NAME);
// Set the URL to submit the form to.
form.setAttribute("action", searchURL.replace(SEARCH_TOKEN, searchTerms));
form.setAttribute("method", "post");
// Create new <input type=hidden> elements for search param.
searchPostData = searchPostData.split("&");
for (let postVar of searchPostData) {
let [name, value] = postVar.split("=");
if (value == SEARCH_TOKEN) {
value = searchTerms;
}
let input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", name);
input.setAttribute("value", value);
form.appendChild(input);
}
// Submit the form.
form.submit();
} else {
searchURL = searchURL.replace(SEARCH_TOKEN, encodeURIComponent(searchTerms));
window.location.href = searchURL;
}
}
aEvent.preventDefault();

View File

@ -111,7 +111,7 @@
<command id="Browser:ToggleAddonBar" oncommand="toggleAddonBar();"/>
<command id="Social:TogglePageMark" oncommand="SocialMark.togglePageMark();" disabled="true"/>
<command id="Social:SharePage" oncommand="SocialShare.sharePage();" disabled="true"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();" hidden="true"/>
<command id="Social:ToggleNotifications" oncommand="Social.toggleNotifications();" hidden="true"/>
<command id="Social:FocusChat" oncommand="SocialChatBar.focus();" hidden="true" disabled="true"/>
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>

View File

@ -45,9 +45,9 @@ SocialUI = {
if (!Social.initialized) {
Social.init();
} else if (Social.enabled) {
// social was previously initialized, so it's not going to notify us of
// anything, so handle that now.
} else if (Social.providers.length > 0) {
// Social was initialized during startup in a previous window. If we have
// providers enabled initialize the UI for this window.
this.observe(null, "social:providers-changed", null);
this.observe(null, "social:provider-set", Social.provider ? Social.provider.origin : null);
}
@ -322,7 +322,10 @@ SocialUI = {
let containerParent = container.parentNode;
if (containerParent.classList.contains("social-panel") &&
containerParent instanceof Ci.nsIDOMXULPopupElement) {
containerParent.hidePopup();
// allow the link traversal to finish before closing the panel
setTimeout(() => {
containerParent.hidePopup();
}, 0);
}
},
@ -693,7 +696,7 @@ SocialShare = {
onHidden: function() {
this.shareButton.removeAttribute("open");
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,")
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,");
this.currentShare = null;
},

View File

@ -16,18 +16,6 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
// Bug 671101 - directly using webNavigation in this context
// causes docshells to leak
this.__defineGetter__("webNavigation", function () {
return docShell.QueryInterface(Ci.nsIWebNavigation);
});
addMessageListener("WebNavigation:LoadURI", function (message) {
let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE;
webNavigation.loadURI(message.json.uri, flags, null, null, null);
});
addMessageListener("Browser:HideSessionRestoreButton", function (message) {
// Hide session restore button on about:home
let doc = content.document;
@ -90,19 +78,13 @@ let AboutHomeListener = {
// Inject search engine and snippets URL.
let docElt = doc.documentElement;
// set the following attributes BEFORE searchEngineURL, which triggers to
// set the following attributes BEFORE searchEngineName, which triggers to
// show the snippets when it's set.
docElt.setAttribute("snippetsURL", aData.snippetsURL);
if (aData.showKnowYourRights)
docElt.setAttribute("showKnowYourRights", "true");
docElt.setAttribute("snippetsVersion", aData.snippetsVersion);
let engine = aData.defaultSearchEngine;
docElt.setAttribute("searchEngineName", engine.name);
docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
// Again, keep the searchEngineURL as the last attribute, because the
// mutation observer in aboutHome.js is counting on that.
docElt.setAttribute("searchEngineURL", engine.searchURL);
docElt.setAttribute("searchEngineName", Services.search.defaultEngine.name);
},
onPageLoad: function() {
@ -135,7 +117,7 @@ let AboutHomeListener = {
sendAsyncMessage("AboutHome:RequestUpdate");
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
sendAsyncMessage("AboutHome:Search", { engineName: e.detail });
sendAsyncMessage("AboutHome:Search", { searchData: e.detail });
}, true, true);
},
@ -280,4 +262,4 @@ let ClickEventHandler = {
return [href ? makeURLAbsolute(baseURI, href) : null, null];
}
};
ClickEventHandler.init();
ClickEventHandler.init();

View File

@ -10,20 +10,11 @@
xmlns:xbl="http://www.mozilla.org/xbl">
<!-- based on preferences.xml paneButton -->
<binding id="viewbutton" extends="chrome://global/content/bindings/radio.xml#radio">
<binding id="viewbutton" extends="chrome://global/content/bindings/radio.xml#radio" role="xullistitem">
<content>
<xul:image class="viewButtonIcon" xbl:inherits="src"/>
<xul:label class="viewButtonLabel" xbl:inherits="value=label"/>
</content>
<implementation implements="nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
return Components.interfaces.nsIAccessibleProvider.XULListitem;
]]>
</getter>
</property>
</implementation>
</binding>
</bindings>

View File

@ -194,6 +194,7 @@ MOCHITEST_BROWSER_FILES = \
browser_bug882977.js \
browser_bug887515.js \
browser_canonizeURL.js \
browser_mixedcontent_securityflags.js \
browser_clearplugindata_noage.html \
browser_clearplugindata.html \
browser_clearplugindata.js \
@ -339,6 +340,7 @@ MOCHITEST_BROWSER_FILES = \
test_bug628179.html \
test_bug839103.html \
test_wyciwyg_copying.html \
test-mixedcontent-securityerrors.html \
title_test.svg \
video.ogg \
zoom_test.html \

View File

@ -107,7 +107,8 @@ let gTests = [
let engineName = doc.documentElement.getAttribute("searchEngineName");
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
is(e.detail, engineName, "Detail is search engine name");
let data = JSON.parse(e.detail);
is(data.engineName, engineName, "Detail is search engine name");
// We use executeSoon() to ensure that this code runs after the
// count has been updated in browser.js, since it uses the same
@ -287,7 +288,7 @@ let gTests = [
// propagated to the about:home content, we want to perform a search.
let mutationObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
searchText.value = needle;
searchText.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
@ -445,7 +446,7 @@ function promiseBrowserAttributes(aTab)
}
// Now we just have to wait for the last attribute.
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
info("Remove attributes observer");
observer.disconnect();
// Must be sure to continue after the page mutation observer.

View File

@ -0,0 +1,57 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// The test loads a web page with mixed active and display content
// on it while the "block mixed content" settings are _on_.
// It then checks that the mixed content flags have been set correctly.
// The test then overrides the MCB settings and checks that the flags
// have been set correctly again.
// Bug 838396 - Not setting hasMixedDisplayContentLoaded and
// hasMixedDisplayContentBlocked flag in nsMixedContentBlocker.cpp
const TEST_URI = "https://example.com/browser/browser/base/content/test/test-mixedcontent-securityerrors.html";
let gTestBrowser = null;
function test()
{
waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["security.mixed_content.block_active_content", true],
["security.mixed_content.block_display_content", true]]}, blockMixedContentTest);
}
function blockMixedContentTest()
{
gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
let tab = gBrowser.selectedTab;
gTestBrowser = gBrowser.getBrowserForTab(tab);
gTestBrowser.addEventListener("load", function onLoad(aEvent) {
gTestBrowser.removeEventListener(aEvent.type, onLoad, true);
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, true, "hasMixedDisplayContentBlocked flag has been set");
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, true, "hasMixedActiveContentBlocked flag has been set");
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, false, "hasMixedDisplayContentLoaded flag has been set");
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, false, "hasMixedActiveContentLoaded flag has been set");
overrideMCB();
}, true);
}
function overrideMCB()
{
gTestBrowser.addEventListener("load", mixedContentOverrideTest, true);
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
ok(notification, "Mixed Content Doorhanger didn't appear");
// Click on the doorhanger to allow mixed content.
notification.secondaryActions[0].callback(mixedContentOverrideTest);
}
function mixedContentOverrideTest()
{
gTestBrowser.removeEventListener("load", mixedContentOverrideTest, true);
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, true, "hasMixedDisplayContentLoaded flag has not been set");
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, true, "hasMixedActiveContentLoaded flag has not been set");
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, false, "second hasMixedDisplayContentBlocked flag has been set");
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, false, "second hasMixedActiveContentBlocked flag has been set");
gBrowser.removeCurrentTab();
finish();
}

View File

@ -133,12 +133,10 @@ var tests = {
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
is(panel.state, "closed", "flyout should be closed");
ok(true, "Link should open a new tab");
executeSoon(function(){
waitForCondition(function() { return panel.state == "closed" }, function() {
gBrowser.removeTab(event.target);
next();
});
}, "panel should close after tab open");
}
let panel = document.getElementById("social-flyout-panel");
@ -154,7 +152,7 @@ var tests = {
if (e.data.result == "shown") {
// click on our test link
is(panel.state, "open", "flyout should be open");
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
let iframe = panel.firstChild;
iframe.contentDocument.getElementById('traversal').click();
}

View File

@ -4,6 +4,8 @@
// Test the top-level window UI for social.
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
// This function should "reset" Social such that the next time Social.init()
// is called (eg, when a new window is opened), it re-performs all
// initialization.
@ -12,7 +14,6 @@ function resetSocial() {
Social._provider = null;
Social.providers = [];
// *sob* - listeners keep getting added...
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
SocialService._providerListeners.clear();
}
@ -52,9 +53,10 @@ function test() {
}
let tests = {
// check when social is totally disabled at startup (ie, no providers)
// check when social is totally disabled at startup (ie, no providers enabled)
testInactiveStartup: function(cbnext) {
is(Social.providers.length, 0, "needs zero providers to start this test.");
ok(!SocialService.hasEnabledProviders, "no providers are enabled");
resetSocial();
openWindowAndWaitForInit(function(w1) {
checkSocialUI(w1);
@ -67,12 +69,13 @@ let tests = {
});
},
// Check when providers exist and social is turned on at startup.
// Check when providers are enabled and social is turned on at startup.
testEnabledStartup: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
resetSocial();
openWindowAndWaitForInit(function(w1) {
ok(Social.enabled, "social is enabled");
ok(SocialService.hasEnabledProviders, "providers are enabled");
checkSocialUI(w1);
// now init is complete, open a second window
openWindowAndWaitForInit(function(w2) {
@ -91,11 +94,13 @@ let tests = {
}, cbnext);
},
// Check when providers exist but social is turned off at startup.
// Check when providers are enabled but social is turned off at startup.
testDisabledStartup: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
setManifestPref("social.manifest.test", manifest);
SocialService.addProvider(manifest, function (provider) {
Services.prefs.setBoolPref("social.enabled", false);
resetSocial();
ok(SocialService.hasEnabledProviders, "providers are enabled");
openWindowAndWaitForInit(function(w1) {
ok(!Social.enabled, "social is disabled");
checkSocialUI(w1);
@ -109,36 +114,36 @@ let tests = {
ok(Social.enabled, "social is enabled");
checkSocialUI(w2);
checkSocialUI(w1);
finishcb();
});
});
});
}, cbnext);
},
// Check when the last provider is removed.
testRemoveProvider: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
openWindowAndWaitForInit(function(w1) {
checkSocialUI(w1);
// now init is complete, open a second window
openWindowAndWaitForInit(function(w2) {
checkSocialUI(w2);
// remove the current provider.
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
SocialService.removeProvider(manifest.origin, function() {
ok(!Social.enabled, "social is disabled");
is(Social.providers.length, 0, "no providers");
checkSocialUI(w2);
checkSocialUI(w1);
// *sob* - runSocialTestWithProvider's cleanup fails when it can't
// remove the provider, so re-add it.
SocialService.addProvider(manifest, function() {
finishcb();
SocialService.removeProvider(manifest.origin, function() {
Services.prefs.clearUserPref("social.manifest.test");
cbnext();
});
});
});
});
}, cbnext);
},
// Check when the last provider is disabled.
testRemoveProvider: function(cbnext) {
setManifestPref("social.manifest.test", manifest);
SocialService.addProvider(manifest, function (provider) {
openWindowAndWaitForInit(function(w1) {
checkSocialUI(w1);
// now init is complete, open a second window
openWindowAndWaitForInit(function(w2) {
checkSocialUI(w2);
// disable the current provider.
SocialService.removeProvider(manifest.origin, function() {
ok(!Social.enabled, "social is disabled");
is(Social.providers.length, 0, "no providers");
checkSocialUI(w2);
checkSocialUI(w1);
Services.prefs.clearUserPref("social.manifest.test");
cbnext();
});
});
});
}, cbnext);
},
}

View File

@ -194,6 +194,7 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
// A fairly large hammer which checks all aspects of the SocialUI for
// internal consistency.
function checkSocialUI(win) {
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
win = win || window;
let doc = win.document;
let provider = Social.provider;
@ -201,6 +202,14 @@ function checkSocialUI(win) {
let active = Social.providers.length > 0 && !win.SocialUI._chromeless &&
!PrivateBrowsingUtils.isWindowPrivate(win);
// if we have enabled providers, we should also have instances of those
// providers
if (SocialService.hasEnabledProviders) {
ok(Social.providers.length > 0, "providers are enabled");
} else {
is(Social.providers.length, 0, "providers are not enabled");
}
// some local helpers to avoid log-spew for the many checks made here.
let numGoodTests = 0, numTests = 0;
function _ok(what, msg) {
@ -246,6 +255,7 @@ function checkSocialUI(win) {
// and for good measure, check all the social commands.
isbool(!doc.getElementById("Social:Toggle").hidden, active, "Social:Toggle visible?");
isbool(!doc.getElementById("Social:ToggleSidebar").hidden, enabled, "Social:ToggleSidebar visible?");
isbool(!doc.getElementById("Social:ToggleNotifications").hidden, enabled, "Social:ToggleNotifications visible?");
isbool(!doc.getElementById("Social:FocusChat").hidden, enabled, "Social:FocusChat visible?");
isbool(doc.getElementById("Social:FocusChat").getAttribute("disabled"), enabled ? "false" : "true", "Social:FocusChat disabled?");

View File

@ -0,0 +1,21 @@
<!--
Bug 875456 - Log mixed content messages from the Mixed Content Blocker to the
Security Pane in the Web Console
-->
<!DOCTYPE HTML>
<html dir="ltr" xml:lang="en-US" lang="en-US">
<head>
<meta charset="utf8">
<title>Mixed Content test - http on https</title>
<script src="testscript.js"></script>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
</head>
<body>
<iframe src="http://example.com"></iframe>
<img src="http://example.com/tests/image/test/mochitest/blue.png"></img>
</body>
</html>

View File

@ -11,6 +11,7 @@
.text-link {
color: #fff !important;
text-decoration: underline;
}
.text-link:-moz-focusring {

View File

@ -11,6 +11,7 @@
.text-link {
color: #fff !important;
text-decoration: underline;
}
.text-link:-moz-focusring {

View File

@ -11,6 +11,7 @@
.text-link {
color: #fff !important;
text-decoration: underline;
}
#rightBox {

View File

@ -7,10 +7,9 @@
let tmp = {};
Cu.import("resource://gre/modules/osfile.jsm", tmp);
Cu.import("resource://gre/modules/Task.jsm", tmp);
Cu.import("resource:///modules/sessionstore/_SessionFile.jsm", tmp);
const {OS, Task, _SessionFile} = tmp;
const {OS, _SessionFile} = tmp;
const PREF_SS_INTERVAL = "browser.sessionstore.interval";
// Full paths for sessionstore.js and sessionstore.bak.

View File

@ -44,6 +44,11 @@ function test() {
let tab;
Task.spawn(function() {
try {
let SESSION_STORAGE_KEY = "SESSION_STORAGE_KEY " + Math.random();
let SESSION_STORAGE_VALUE = "SESSION_STORAGE_VALUE " + Math.random();
let LOCAL_STORAGE_KEY = "LOCAL_STORAGE_KEY " + Math.random();
let LOCAL_STORAGE_VALUE = "LOCAL_STORAGE_VALUE " + Math.random();
tab = gBrowser.addTab("http://example.com");
// about:home supports sessionStorage and localStorage
@ -57,25 +62,27 @@ function test() {
ss.getBrowserState();
info("Change sessionStorage, ensure that state is saved");
win.sessionStorage["SESSION_STORAGE_KEY"] = "SESSION_STORAGE_VALUE";
let storageChanged = yield waitForStorageChange(tab);
let storageChangedPromise = waitForStorageChange(tab);
win.sessionStorage[SESSION_STORAGE_KEY] = SESSION_STORAGE_VALUE;
let storageChanged = yield storageChangedPromise;
ok(storageChanged, "Changing sessionStorage triggered the right message");
yield forceWriteState();
let state = ss.getBrowserState();
ok(state.indexOf("SESSION_STORAGE_KEY") != -1, "Key appears in state");
ok(state.indexOf("SESSION_STORAGE_VALUE") != -1, "Value appears in state");
ok(state.indexOf(SESSION_STORAGE_KEY) != -1, "Key appears in state");
ok(state.indexOf(SESSION_STORAGE_VALUE) != -1, "Value appears in state");
info("Change localStorage, ensure that state is not saved");
win.localStorage["LOCAL_STORAGE_KEY"] = "LOCAL_STORAGE_VALUE";
storageChanged = yield waitForStorageChange(tab);
storageChangedPromise = waitForStorageChange(tab);
win.localStorage[LOCAL_STORAGE_KEY] = LOCAL_STORAGE_VALUE;
storageChanged = yield storageChangedPromise;
ok(!storageChanged, "Changing localStorage did not trigger a message");
yield forceWriteState();
state = ss.getBrowserState();
ok(state.indexOf("LOCAL_STORAGE_KEY") == -1, "Key does not appear in state");
ok(state.indexOf("LOCAL_STORAGE_VALUE") == -1, "Value does not appear in state");
ok(state.indexOf(LOCAL_STORAGE_KEY) == -1, "Key does not appear in state");
ok(state.indexOf(LOCAL_STORAGE_VALUE) == -1, "Value does not appear in state");
} catch (ex) {
ok(false, ex);
info(ex.stack);

View File

@ -15,6 +15,7 @@ Cu.import("resource:///modules/devtools/shared/event-emitter.js");
var require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
let Telemetry = require("devtools/shared/telemetry");
let {TouchEventHandler} = require("devtools/shared/touch-events");
this.EXPORTED_SYMBOLS = ["ResponsiveUIManager"];
@ -24,6 +25,9 @@ const MIN_HEIGHT = 50;
const MAX_WIDTH = 10000;
const MAX_HEIGHT = 10000;
const SLOW_RATIO = 6;
const ROUND_RATIO = 10;
this.ResponsiveUIManager = {
/**
* Check if the a tab is in a responsive mode.
@ -113,6 +117,7 @@ function ResponsiveUI(aWindow, aTab)
this.stack = this.container.querySelector(".browserStack");
this._telemetry = new Telemetry();
// Try to load presets from prefs
if (Services.prefs.prefHasUserValue("devtools.responsiveUI.presets")) {
try {
@ -153,10 +158,14 @@ function ResponsiveUI(aWindow, aTab)
this.stack.setAttribute("responsivemode", "true");
// Let's bind some callbacks.
this.bound_onPageLoad = this.onPageLoad.bind(this);
this.bound_onPageUnload = this.onPageUnload.bind(this);
this.bound_presetSelected = this.presetSelected.bind(this);
this.bound_addPreset = this.addPreset.bind(this);
this.bound_removePreset = this.removePreset.bind(this);
this.bound_rotate = this.rotate.bind(this);
this.bound_screenshot = () => this.screenshot();
this.bound_touch = this.toggleTouch.bind(this);
this.bound_close = this.close.bind(this);
this.bound_startResizing = this.startResizing.bind(this);
this.bound_stopResizing = this.stopResizing.bind(this);
@ -184,6 +193,18 @@ function ResponsiveUI(aWindow, aTab)
this._telemetry.toolOpened("responsive");
// Touch events support
this.touchEnableBefore = false;
this.touchEventHandler = new TouchEventHandler(this.browser.contentWindow);
this.browser.addEventListener("load", this.bound_onPageLoad, true);
this.browser.addEventListener("unload", this.bound_onPageUnload, true);
if (this.browser.contentWindow.document &&
this.browser.contentWindow.document.readyState == "complete") {
this.onPageLoad();
}
ResponsiveUIManager.emit("on", this.tab, this);
}
@ -200,6 +221,24 @@ ResponsiveUI.prototype = {
}
},
/**
* Window onload / onunload
*/
onPageLoad: function() {
this.touchEventHandler = new TouchEventHandler(this.browser.contentWindow);
if (this.touchEnableBefore) {
this.enableTouch();
}
},
onPageUnload: function() {
if (this.closing)
return;
this.touchEnableBefore = this.touchEventHandler.enabled;
this.disableTouch();
delete this.touchEventHandler;
},
/**
* Destroy the nodes. Remove listeners. Reset the style.
*/
@ -208,6 +247,9 @@ ResponsiveUI.prototype = {
return;
this.closing = true;
this.browser.removeEventListener("load", this.bound_onPageLoad, true);
this.browser.removeEventListener("unload", this.bound_onPageUnload, true);
if (this._floatingScrollbars)
switchToNativeScrollbars(this.tab);
@ -228,6 +270,8 @@ ResponsiveUI.prototype = {
this.tab.removeEventListener("TabClose", this);
this.tabContainer.removeEventListener("TabSelect", this);
this.rotatebutton.removeEventListener("command", this.bound_rotate, true);
this.screenshotbutton.removeEventListener("command", this.bound_screenshot, true);
this.touchbutton.removeEventListener("command", this.bound_touch, true);
this.closebutton.removeEventListener("command", this.bound_close, true);
this.addbutton.removeEventListener("command", this.bound_addPreset, true);
this.removebutton.removeEventListener("command", this.bound_removePreset, true);
@ -243,6 +287,8 @@ ResponsiveUI.prototype = {
this.stack.removeAttribute("responsivemode");
delete this.tab.__responsiveUI;
if (this.touchEventHandler)
this.touchEventHandler.stop();
this._telemetry.toolClosed("responsive");
ResponsiveUIManager.emit("off", this.tab, this);
},
@ -300,8 +346,9 @@ ResponsiveUI.prototype = {
* <vbox class="browserContainer"> From tabbrowser.xml
* <toolbar class="devtools-toolbar devtools-responsiveui-toolbar">
* <menulist class="devtools-menulist"/> // presets
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton" label="rotate"/> // rotate
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton devtools-closebutton" tooltiptext="Leave Responsive Design View"/> // close
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton" tooltiptext="rotate"/> // rotate
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton" tooltiptext="screenshot"/> // screenshot
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton" tooltiptext="Leave Responsive Design View"/> // close
* </toolbar>
* <stack class="browserStack"> From tabbrowser.xml
* <browser/>
@ -341,37 +388,55 @@ ResponsiveUI.prototype = {
this.rotatebutton = this.chromeDoc.createElement("toolbarbutton");
this.rotatebutton.setAttribute("tabindex", "0");
this.rotatebutton.setAttribute("label", this.strings.GetStringFromName("responsiveUI.rotate"));
this.rotatebutton.className = "devtools-toolbarbutton";
this.rotatebutton.setAttribute("tooltiptext", this.strings.GetStringFromName("responsiveUI.rotate2"));
this.rotatebutton.className = "devtools-toolbarbutton devtools-responsiveui-rotate";
this.rotatebutton.addEventListener("command", this.bound_rotate, true);
this.screenshotbutton = this.chromeDoc.createElement("toolbarbutton");
this.screenshotbutton.setAttribute("tabindex", "0");
this.screenshotbutton.setAttribute("tooltiptext", this.strings.GetStringFromName("responsiveUI.screenshot"));
this.screenshotbutton.className = "devtools-toolbarbutton devtools-responsiveui-screenshot";
this.screenshotbutton.addEventListener("command", this.bound_screenshot, true);
this.touchbutton = this.chromeDoc.createElement("toolbarbutton");
this.touchbutton.setAttribute("tabindex", "0");
this.touchbutton.setAttribute("tooltiptext", this.strings.GetStringFromName("responsiveUI.touch"));
this.touchbutton.className = "devtools-toolbarbutton devtools-responsiveui-touch";
this.touchbutton.addEventListener("command", this.bound_touch, true);
this.closebutton = this.chromeDoc.createElement("toolbarbutton");
this.closebutton.setAttribute("tabindex", "0");
this.closebutton.className = "devtools-toolbarbutton devtools-closebutton";
this.closebutton.className = "devtools-toolbarbutton devtools-responsiveui-close";
this.closebutton.setAttribute("tooltiptext", this.strings.GetStringFromName("responsiveUI.close"));
this.closebutton.addEventListener("command", this.bound_close, true);
this.toolbar.appendChild(this.closebutton);
this.toolbar.appendChild(this.menulist);
this.toolbar.appendChild(this.rotatebutton);
this.toolbar.appendChild(this.touchbutton);
this.toolbar.appendChild(this.screenshotbutton);
// Resizers
let resizerTooltip = this.strings.GetStringFromName("responsiveUI.resizerTooltip");
this.resizer = this.chromeDoc.createElement("box");
this.resizer.className = "devtools-responsiveui-resizehandle";
this.resizer.setAttribute("right", "0");
this.resizer.setAttribute("bottom", "0");
this.resizer.setAttribute("tooltiptext", resizerTooltip);
this.resizer.onmousedown = this.bound_startResizing;
this.resizeBarV = this.chromeDoc.createElement("box");
this.resizeBarV.className = "devtools-responsiveui-resizebarV";
this.resizeBarV.setAttribute("top", "0");
this.resizeBarV.setAttribute("right", "0");
this.resizeBarV.setAttribute("tooltiptext", resizerTooltip);
this.resizeBarV.onmousedown = this.bound_startResizing;
this.resizeBarH = this.chromeDoc.createElement("box");
this.resizeBarH.className = "devtools-responsiveui-resizebarH";
this.resizeBarH.setAttribute("bottom", "0");
this.resizeBarH.setAttribute("left", "0");
this.resizeBarV.setAttribute("tooltiptext", resizerTooltip);
this.resizeBarH.onmousedown = this.bound_startResizing;
this.container.insertBefore(this.toolbar, this.stack);
@ -568,6 +633,107 @@ ResponsiveUI.prototype = {
}
},
/**
* Take a screenshot of the page.
*
* @param aFileName name of the screenshot file (used for tests).
*/
screenshot: function RUI_screenshot(aFileName) {
let window = this.browser.contentWindow;
let document = window.document;
let canvas = this.chromeDoc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
let width = window.innerWidth;
let height = window.innerHeight;
canvas.width = width;
canvas.height = height;
let ctx = canvas.getContext("2d");
ctx.drawWindow(window, window.scrollX, window.scrollY, width, height, "#fff");
let filename = aFileName;
if (!filename) {
let date = new Date();
let month = ("0" + (date.getMonth() + 1)).substr(-2, 2);
let day = ("0" + (date.getDay() + 1)).substr(-2, 2);
let dateString = [date.getFullYear(), month, day].join("-");
let timeString = date.toTimeString().replace(/:/g, ".").split(" ")[0];
filename = this.strings.formatStringFromName("responsiveUI.screenshotGeneratedFilename", [dateString, timeString], 2);
}
canvas.toBlob(blob => {
let chromeWindow = this.chromeDoc.defaultView;
let url = chromeWindow.URL.createObjectURL(blob);
chromeWindow.saveURL(url, filename + ".png", null, true, true, document.documentURIObject, document);
});
},
/**
* Enable/Disable mouse -> touch events translation.
*/
enableTouch: function RUI_enableTouch() {
if (!this.touchEventHandler.enabled) {
let isReloadNeeded = this.touchEventHandler.start();
this.touchbutton.setAttribute("checked", "true");
return isReloadNeeded;
}
return false;
},
disableTouch: function RUI_disableTouch() {
if (this.touchEventHandler.enabled) {
this.touchEventHandler.stop();
this.touchbutton.removeAttribute("checked");
}
},
hideTouchNotification: function RUI_hideTouchNotification() {
let nbox = this.mainWindow.gBrowser.getNotificationBox(this.browser);
let n = nbox.getNotificationWithValue("responsive-ui-need-reload");
if (n) {
n.close();
}
},
toggleTouch: function RUI_toggleTouch() {
this.hideTouchNotification();
if (this.touchEventHandler.enabled) {
this.disableTouch();
} else {
let isReloadNeeded = this.enableTouch();
if (isReloadNeeded) {
if (Services.prefs.getBoolPref("devtools.responsiveUI.no-reload-notification")) {
return;
}
let nbox = this.mainWindow.gBrowser.getNotificationBox(this.browser);
var buttons = [{
label: this.strings.GetStringFromName("responsiveUI.notificationReload"),
callback: () => {
this.browser.reload();
},
accessKey: this.strings.GetStringFromName("responsiveUI.notificationReload_accesskey"),
}, {
label: this.strings.GetStringFromName("responsiveUI.dontShowReloadNotification"),
callback: function() {
Services.prefs.setBoolPref("devtools.responsiveUI.no-reload-notification", true);
},
accessKey: this.strings.GetStringFromName("responsiveUI.dontShowReloadNotification_accesskey"),
}];
nbox.appendNotification(
this.strings.GetStringFromName("responsiveUI.needReload"),
"responsive-ui-need-reload",
null,
nbox.PRIORITY_INFO_LOW,
buttons);
}
}
},
/**
* Change the size of the browser.
*
@ -645,27 +811,48 @@ ResponsiveUI.prototype = {
* @param aEvent
*/
onDrag: function RUI_onDrag(aEvent) {
let deltaX = aEvent.screenX - this.lastScreenX;
let deltaY = aEvent.screenY - this.lastScreenY;
let shift = aEvent.shiftKey;
let ctrl = !aEvent.shiftKey && aEvent.ctrlKey;
let screenX = aEvent.screenX;
let screenY = aEvent.screenY;
let deltaX = screenX - this.lastScreenX;
let deltaY = screenY - this.lastScreenY;
if (this.ignoreY)
deltaY = 0;
if (this.ignoreX)
deltaX = 0;
if (ctrl) {
deltaX /= SLOW_RATIO;
deltaY /= SLOW_RATIO;
}
let width = this.customPreset.width + deltaX;
let height = this.customPreset.height + deltaY;
if (shift) {
let roundedWidth, roundedHeight;
roundedWidth = 10 * Math.floor(width / ROUND_RATIO);
roundedHeight = 10 * Math.floor(height / ROUND_RATIO);
screenX += roundedWidth - width;
screenY += roundedHeight - height;
width = roundedWidth;
height = roundedHeight;
}
if (width < MIN_WIDTH) {
width = MIN_WIDTH;
} else {
this.lastScreenX = aEvent.screenX;
this.lastScreenX = screenX;
}
if (height < MIN_HEIGHT) {
height = MIN_HEIGHT;
} else {
this.lastScreenY = aEvent.screenY;
this.lastScreenY = screenY;
}
this.setSize(width, height);

View File

@ -16,6 +16,8 @@ MOCHITEST_BROWSER_FILES := \
browser_responsiveruleview.js \
browser_responsive_cmd.js \
browser_responsivecomputedview.js \
browser_responsiveui_touch.js \
touch.html \
head.js \
$(NULL)

View File

@ -102,9 +102,53 @@ function test() {
let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
is(width, expectedWidth, "Label updated (width).");
is(height, expectedHeight, "Label updated (height).");
testCustom2();
}
function testCustom2() {
let initialWidth = content.innerWidth;
let initialHeight = content.innerHeight;
let x = 2, y = 2;
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousedown"}, window);
x += 23; y += 13;
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousemove", shiftKey: true}, window);
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mouseup"}, window);
let expectedWidth = initialWidth + 20;
let expectedHeight = initialHeight + 10;
is(content.innerWidth, expectedWidth, "with shift: Size correcty updated (width).");
is(content.innerHeight, expectedHeight, "with shift: Size correcty updated (height).");
is(instance.menulist.selectedIndex, 0, "with shift: Custom menuitem selected");
let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
is(width, expectedWidth, "Label updated (width).");
is(height, expectedHeight, "Label updated (height).");
testCustom3();
}
function testCustom3() {
let initialWidth = content.innerWidth;
let initialHeight = content.innerHeight;
let x = 2, y = 2;
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousedown"}, window);
x += 60; y += 30;
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousemove", ctrlKey: true}, window);
EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mouseup"}, window);
let expectedWidth = initialWidth + 10;
let expectedHeight = initialHeight + 5;
is(content.innerWidth, expectedWidth, "with ctrl: Size correcty updated (width).");
is(content.innerHeight, expectedHeight, "with ctrl: Size correcty updated (height).");
is(instance.menulist.selectedIndex, 0, "with ctrl: Custom menuitem selected");
let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
is(width, expectedWidth, "Label updated (width).");
is(height, expectedHeight, "Label updated (height).");
rotate();
}
function rotate() {
let initialWidth = content.innerWidth;
let initialHeight = content.innerHeight;
@ -153,10 +197,38 @@ function test() {
is(content.innerWidth, widthBeforeClose, "width restored.");
is(content.innerHeight, heightBeforeClose, "height restored.");
mgr.once("off", function() {executeSoon(finishUp)});
mgr.once("off", function() {executeSoon(testScreenshot)});
EventUtils.synthesizeKey("VK_ESCAPE", {});
}
function testScreenshot() {
let isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
if (isWinXP) {
// We have issues testing this on Windows XP.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=848760#c17
return finishUp();
}
info("screenshot");
instance.screenshot("responsiveui");
let FileUtils = (Cu.import("resource://gre/modules/FileUtils.jsm", {})).FileUtils;
// while(1) until we find the file.
// no need for a timeout, the test will get killed anyway.
info("checking if file exists in 200ms");
function checkIfFileExist() {
let file = FileUtils.getFile("DfltDwnld", [ "responsiveui.png" ]);
if (file.exists()) {
ok(true, "Screenshot file exists");
file.remove(false);
finishUp();
} else {
setTimeout(checkIfFileExist, 200);
}
}
checkIfFileExist();
}
function finishUp() {
// Menus are correctly updated?

View File

@ -0,0 +1,66 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let url = "http://mochi.test:8888/browser/browser/devtools/responsivedesign/test/touch.html";
let mgr = ResponsiveUI.ResponsiveUIManager;
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
waitForFocus(startTest, content);
}, true);
content.location = url;
function startTest() {
mgr.once("on", function() {executeSoon(testWithNoTouch)});
mgr.once("off", function() {executeSoon(finishUp)});
mgr.toggle(window, gBrowser.selectedTab);
}
function testWithNoTouch() {
let div = content.document.querySelector("div");
let x = 2, y = 2;
EventUtils.synthesizeMouse(div, x, y, {type: "mousedown"}, content);
x += 20; y += 10;
EventUtils.synthesizeMouse(div, x, y, {type: "mousemove"}, content);
is(div.style.transform, "", "touch didn't work");
EventUtils.synthesizeMouse(div, x, y, {type: "mouseup"}, content);
testWithTouch();
}
function testWithTouch() {
gBrowser.selectedTab.__responsiveUI.enableTouch();
let div = content.document.querySelector("div");
let x = 2, y = 2;
EventUtils.synthesizeMouse(div, x, y, {type: "mousedown"}, content);
x += 20; y += 10;
EventUtils.synthesizeMouse(div, x, y, {type: "mousemove"}, content);
is(div.style.transform, "translate(20px, 10px)", "touch worked");
EventUtils.synthesizeMouse(div, x, y, {type: "mouseup"}, content);
is(div.style.transform, "none", "end event worked");
mgr.toggle(window, gBrowser.selectedTab);
}
function testWithTouchAgain() {
gBrowser.selectedTab.__responsiveUI.disableTouch();
let div = content.document.querySelector("div");
let x = 2, y = 2;
EventUtils.synthesizeMouse(div, x, y, {type: "mousedown"}, content);
x += 20; y += 10;
EventUtils.synthesizeMouse(div, x, y, {type: "mousemove"}, content);
is(div.style.transform, "", "touch didn't work");
EventUtils.synthesizeMouse(div, x, y, {type: "mouseup"}, content);
finishUp();
}
function finishUp() {
gBrowser.removeCurrentTab();
finish();
}
}

View File

@ -85,7 +85,7 @@ function test() {
// We're still in the loop of initializing the responsive mode.
// Let's wait next loop to stop it.
executeSoon(function() {
EventUtils.synthesizeKey("VK_ESCAPE", {});
instance.close();
});
}
@ -135,7 +135,7 @@ function test() {
// We're still in the loop of initializing the responsive mode.
// Let's wait next loop to stop it.
executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {}));
executeSoon(() => instance.close());
}
function restartAgain() {

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset=utf-8 />
<title>test</title>
<style>
div {
border:1px solid red;
width: 100px; height: 100px;
}
</style>
<div></div>
<script>
var div = document.querySelector("div");
var initX, initY;
div.addEventListener("touchstart", function(evt) {
var touch = evt.changedTouches[0];
initX = touch.pageX;
initY = touch.pageY;
}, true);
div.addEventListener("touchmove", function(evt) {
var touch = evt.changedTouches[0];
var deltaX = touch.pageX - initX;
var deltaY = touch.pageY - initY;
div.style.transform = "translate(" + deltaX + "px, " + deltaY + "px)";
}, true);
div.addEventListener("touchend", function(evt) {
div.style.transform = "none";
}, true);
</script>

View File

@ -0,0 +1,185 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let {CC, Cc, Ci, Cu, Cr} = require('chrome');
Cu.import('resource://gre/modules/Services.jsm');
let handlerCount = 0;
let orig_w3c_touch_events = Services.prefs.getIntPref('dom.w3c_touch_events.enabled');
// =================== Touch ====================
// Simulate touch events on desktop
function TouchEventHandler (window) {
let contextMenuTimeout = 0;
// This guard is used to not re-enter the events processing loop for
// self dispatched events
let ignoreEvents = false;
let threshold = 25;
try {
threshold = Services.prefs.getIntPref('ui.dragThresholdX');
} catch(e) {}
let delay = 500;
try {
delay = Services.prefs.getIntPref('ui.click_hold_context_menus.delay');
} catch(e) {}
let TouchEventHandler = {
enabled: false,
events: ['mousedown', 'mousemove', 'mouseup', 'click'],
start: function teh_start() {
let isReloadNeeded = Services.prefs.getIntPref('dom.w3c_touch_events.enabled') != 1;
handlerCount++;
Services.prefs.setIntPref('dom.w3c_touch_events.enabled', 1);
this.enabled = true;
this.events.forEach((function(evt) {
window.addEventListener(evt, this, true);
}).bind(this));
return isReloadNeeded;
},
stop: function teh_stop() {
handlerCount--;
if (handlerCount == 0)
Services.prefs.setIntPref('dom.w3c_touch_events.enabled', orig_w3c_touch_events);
this.enabled = false;
this.events.forEach((function(evt) {
window.removeEventListener(evt, this, true);
}).bind(this));
},
handleEvent: function teh_handleEvent(evt) {
if (evt.button || ignoreEvents ||
evt.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN)
return;
// The gaia system window use an hybrid system even on the device which is
// a mix of mouse/touch events. So let's not cancel *all* mouse events
// if it is the current target.
let content = evt.target.ownerDocument.defaultView;
let isSystemWindow = content.location.toString().indexOf("system.gaiamobile.org") != -1;
let eventTarget = this.target;
let type = '';
switch (evt.type) {
case 'mousedown':
this.target = evt.target;
contextMenuTimeout =
this.sendContextMenu(evt.target, evt.pageX, evt.pageY, delay);
this.cancelClick = false;
this.startX = evt.pageX;
this.startY = evt.pageY;
// Capture events so if a different window show up the events
// won't be dispatched to something else.
evt.target.setCapture(false);
type = 'touchstart';
break;
case 'mousemove':
if (!eventTarget)
return;
if (!this.cancelClick) {
if (Math.abs(this.startX - evt.pageX) > threshold ||
Math.abs(this.startY - evt.pageY) > threshold) {
this.cancelClick = true;
content.clearTimeout(contextMenuTimeout);
}
}
type = 'touchmove';
break;
case 'mouseup':
if (!eventTarget)
return;
this.target = null;
content.clearTimeout(contextMenuTimeout);
type = 'touchend';
break;
case 'click':
// Mouse events has been cancelled so dispatch a sequence
// of events to where touchend has been fired
evt.preventDefault();
evt.stopImmediatePropagation();
if (this.cancelClick)
return;
ignoreEvents = true;
content.setTimeout(function dispatchMouseEvents(self) {
self.fireMouseEvent('mousedown', evt);
self.fireMouseEvent('mousemove', evt);
self.fireMouseEvent('mouseup', evt);
ignoreEvents = false;
}, 0, this);
return;
}
let target = eventTarget || this.target;
if (target && type) {
this.sendTouchEvent(evt, target, type);
}
if (!isSystemWindow) {
evt.preventDefault();
evt.stopImmediatePropagation();
}
},
fireMouseEvent: function teh_fireMouseEvent(type, evt) {
let content = evt.target.ownerDocument.defaultView;
var utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
utils.sendMouseEvent(type, evt.clientX, evt.clientY, 0, 1, 0, true);
},
sendContextMenu: function teh_sendContextMenu(target, x, y, delay) {
let doc = target.ownerDocument;
let evt = doc.createEvent('MouseEvent');
evt.initMouseEvent('contextmenu', true, true, doc.defaultView,
0, x, y, x, y, false, false, false, false,
0, null);
let content = target.ownerDocument.defaultView;
let timeout = content.setTimeout((function contextMenu() {
target.dispatchEvent(evt);
this.cancelClick = true;
}).bind(this), delay);
return timeout;
},
sendTouchEvent: function teh_sendTouchEvent(evt, target, name) {
let document = target.ownerDocument;
let content = document.defaultView;
let touchEvent = document.createEvent('touchevent');
let point = document.createTouch(content, target, 0,
evt.pageX, evt.pageY,
evt.screenX, evt.screenY,
evt.clientX, evt.clientY,
1, 1, 0, 0);
let touches = document.createTouchList(point);
let targetTouches = touches;
let changedTouches = touches;
touchEvent.initTouchEvent(name, true, true, content, 0,
false, false, false, false,
touches, targetTouches, changedTouches);
target.dispatchEvent(touchEvent);
return touchEvent;
}
};
return TouchEventHandler;
}
exports.TouchEventHandler = TouchEventHandler;

View File

@ -101,8 +101,6 @@ ifndef LIBXUL_SDK
INSTALL_SDK = 1
endif
GENERATE_CACHE = 1
include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk

View File

@ -12,8 +12,19 @@
# documentation on web development on the web.
# LOCALIZATION NOTE (responsiveUI.rotate): label of the rotate button.
responsiveUI.rotate=rotate
# LOCALIZATION NOTE (responsiveUI.rotate2): tooltip of the rotate button.
responsiveUI.rotate2=Rotate
# LOCALIZATION NOTE (responsiveUI.screenshot): tooltip of the screenshot button.
responsiveUI.screenshot=Screenshot
# LOCALIZATION NOTE (responsiveUI.screenshotGeneratedFilename): The auto generated filename.
# The first argument (%1$S) is the date string in yyyy-mm-dd format and the second
# argument (%2$S) is the time string in HH.MM.SS format.
responsiveUI.screenshotGeneratedFilename=Screen Shot %1$S at %2$S
# LOCALIZATION NOTE (responsiveUI.touch): tooltip of the touch button.
responsiveUI.touch=Simulate touch events (page reload might be needed)
# LOCALIZATION NOTE (responsiveUI.addPreset): label of the add preset button.
responsiveUI.addPreset=Add Preset
@ -41,3 +52,15 @@ responsiveUI.close=Leave Responsive Design View
# LOCALIZATION NOTE (responsiveUI.customNamePromptMsg): prompt message when asking
# the user to specify a name for a new custom preset.
responsiveUI.customNamePromptMsg=Give a name to the %Sx%S preset
# LOCALIZATION NOTE (responsiveUI.resizer): tooltip showed when
# overring the resizers.
responsiveUI.resizerTooltip=Use the Control key for more precision. Use Shift key for rounded sizes.
# LOCALIZATION NOTE (responsiveUI.needReload): notification that appears
# when touch events are enabled
responsiveUI.needReload=If touch event listeners have been added earlier, the page needs to be reloaded.
responsiveUI.notificationReload=Reload
responsiveUI.notificationReload_accesskey=R
responsiveUI.dontShowReloadNotification=Never show again
responsiveUI.dontShowReloadNotification_accesskey=N

View File

@ -15,7 +15,7 @@
<binding id="local-browser" extends="chrome://global/content/bindings/browser.xml#browser">
<implementation type="application/javascript"
implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIMessageListener">
implements="nsIObserver, nsIDOMEventListener, nsIMessageListener">
<constructor>
<![CDATA[
@ -782,15 +782,7 @@
</binding>
<binding id="remote-browser" extends="#local-browser">
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIMessageListener">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
throw "accessibleType: Supports Remote?";
]]>
</getter>
</property>
<implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIMessageListener">
<property name="autoscrollEnabled">
<getter>
<![CDATA[

View File

@ -0,0 +1,79 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE bindings [
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
%notificationDTD;
]>
<bindings id="notificationBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="notificationbox" extends="chrome://global/content/bindings/notification.xml#notificationbox">
<content>
<xul:stack xbl:inherits="hidden=notificationshidden"
class="notificationbox-stack">
<xul:spacer/>
<children includes="notification"/>
</xul:stack>
<html:div anonid="layer1" class="notification-layer"></html:div>
<html:div anonid="layer2" class="notification-layer"></html:div>
<children/>
</content>
<implementation>
<constructor>
<![CDATA[
this.addEventListener("AlertActive", this.handleEvent, true);
this.addEventListener("AlertClose", this.handleEvent, true);
this.setAttribute("count", 0);
]]>
</constructor>
<destructor>
<![CDATA[
this.removeEventListener("AlertActive", this.handleEvent, true);
this.removeEventListener("AlertClose", this.handleEvent, true);
]]>
</destructor>
<method name="removeNotification">
<parameter name="aItem"/>
<parameter name="aSkipAnimation"/>
<body>
<![CDATA[
if (aItem == this.currentNotification)
this.removeCurrentNotification(aSkipAnimation);
else if (aItem != this._closedNotification)
this._removeNotificationElement(aItem);
// Fire notification closed event.
let event = new Event('AlertClose');
this.dispatchEvent(event);
return aItem;
]]>
</body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body>
<![CDATA[
switch (aEvent.type) {
case "AlertActive":
case "AlertClose":
this.setAttribute("count", this.allNotifications.length);
break;
}
]]>
</body>
</method>
</implementation>
</binding>
</bindings>

View File

@ -46,6 +46,10 @@ autoscroller {
-moz-binding: url('chrome://browser/content/bindings/popup.xml#element-popup');
}
notificationbox {
-moz-binding: url('chrome://browser/content/bindings/notification.xml#notificationbox');
}
circularprogressindicator {
-moz-binding: url('chrome://browser/content/bindings/circularprogress.xml#circular-progress-indicator');
}

View File

@ -28,6 +28,7 @@ chrome.jar:
content/bindings/cssthrobber.xml (content/bindings/cssthrobber.xml)
content/bindings/popup.xml (content/bindings/popup.xml)
content/bindings/circularprogress.xml (content/bindings/circularprogress.xml)
content/bindings/notification.xml (content/bindings/notification.xml)
* content/flyoutpanels/FlyoutPanelsUI.js (content/flyoutpanels/FlyoutPanelsUI.js)
* content/flyoutpanels/AboutFlyoutPanel.js (content/flyoutpanels/AboutFlyoutPanel.js)

View File

@ -447,8 +447,27 @@ notification {
min-height: 64px;
}
notificationbox[count="0"] .notification-layer,
notificationbox[count="1"] .notification-layer,
notificationbox[count="2"] .notification-layer[anonid="layer2"] {
visibility: collapse;
}
notificationbox[count="2"] .notification-layer[anonid="layer1"],
notificationbox[count="3"] .notification-layer[anonid="layer1"],
notificationbox[count="3"] .notification-layer[anonid="layer2"] {
visibility: visible;
}
.notification-layer {
border: @metro_border_thin@ solid @field_disabled_foreground_color@;
border-bottom: none;
height:5px
}
.notification-inner {
border-style: none;
border: @metro_border_thin@ solid @field_disabled_foreground_color@;
}
.notification-button {

View File

@ -25,21 +25,6 @@ const STARTPAGE_VERSION = 4;
this.AboutHomeUtils = {
get snippetsVersion() STARTPAGE_VERSION,
/**
* Returns an object containing the name and searchURL of the original default
* search engine.
*/
get defaultSearchEngine() {
let defaultEngine = Services.search.defaultEngine;
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
return Object.freeze({
name: defaultEngine.name,
searchURL: submission.uri.spec,
postDataString: submission.postDataString
});
},
/*
* showKnowYourRights - Determines if the user should be shown the
* about:rights notification. The notification should *not* be shown if
@ -173,9 +158,19 @@ let AboutHome = {
break;
case "AboutHome:Search":
let data;
try {
data = JSON.parse(aMessage.data.searchData);
} catch(ex) {
Cu.reportError(ex);
break;
}
#ifdef MOZ_SERVICES_HEALTHREPORT
window.BrowserSearch.recordSearchInHealthReport(aMessage.data.engineName, "abouthome");
window.BrowserSearch.recordSearchInHealthReport(data.engineName, "abouthome");
#endif
// Trigger a search through nsISearchEngine.getSubmission()
let submission = Services.search.currentEngine.getSubmission(data.searchTerms);
window.loadURI(submission.uri.spec, null, submission.postData);
break;
}
},
@ -189,8 +184,7 @@ let AboutHome = {
showRestoreLastSession: ss.canRestoreLastSession,
snippetsURL: AboutHomeUtils.snippetsURL,
showKnowYourRights: AboutHomeUtils.showKnowYourRights,
snippetsVersion: AboutHomeUtils.snippetsVersion,
defaultSearchEngine: AboutHomeUtils.defaultSearchEngine
snippetsVersion: AboutHomeUtils.snippetsVersion
};
if (AboutHomeUtils.showKnowYourRights) {

View File

@ -158,8 +158,9 @@ this.Social = {
return;
}
this.initialized = true;
if (SocialService.enabled) {
// if SocialService.hasEnabledProviders, retreive the providers so the
// front-end can generate UI
if (SocialService.hasEnabledProviders) {
// Retrieve the current set of providers, and set the current provider.
SocialService.getOrderedProviderList(function (providers) {
Social._updateProviderCache(providers);

View File

@ -222,6 +222,9 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (devtools/arrow-e.png)
skin/classic/browser/devtools/responsiveui-rotate.png (../shared/devtools/responsiveui-rotate.png)
skin/classic/browser/devtools/responsiveui-touch.png (../shared/devtools/responsiveui-touch.png)
skin/classic/browser/devtools/responsiveui-screenshot.png (../shared/devtools/responsiveui-screenshot.png)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-16-throbber.png
skin/classic/browser/sync-16.png

View File

@ -312,6 +312,9 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (devtools/arrow-e.png)
skin/classic/browser/devtools/responsiveui-rotate.png (../shared/devtools/responsiveui-rotate.png)
skin/classic/browser/devtools/responsiveui-touch.png (../shared/devtools/responsiveui-touch.png)
skin/classic/browser/devtools/responsiveui-screenshot.png (../shared/devtools/responsiveui-screenshot.png)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png

View File

@ -34,6 +34,27 @@
margin-left: 0;
}
.devtools-responsiveui-close {
list-style-image: url("chrome://browser/skin/devtools/close.png");
}
.devtools-responsiveui-rotate {
list-style-image: url("chrome://browser/skin/devtools/responsiveui-rotate.png");
}
.devtools-responsiveui-touch {
list-style-image: url("chrome://browser/skin/devtools/responsiveui-touch.png");
-moz-image-region: rect(0px,16px,16px,0px);
}
.devtools-responsiveui-touch[checked] {
-moz-image-region: rect(0px,32px,16px,16px);
}
.devtools-responsiveui-screenshot {
list-style-image: url("chrome://browser/skin/devtools/responsiveui-screenshot.png");
}
.devtools-responsiveui-resizebarV {
width: 7px;
height: 24px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

View File

@ -249,6 +249,9 @@ browser.jar:
skin/classic/browser/devtools/font-inspector.css (devtools/font-inspector.css)
skin/classic/browser/devtools/computedview.css (devtools/computedview.css)
skin/classic/browser/devtools/arrow-e.png (devtools/arrow-e.png)
skin/classic/browser/devtools/responsiveui-rotate.png (../shared/devtools/responsiveui-rotate.png)
skin/classic/browser/devtools/responsiveui-touch.png (../shared/devtools/responsiveui-touch.png)
skin/classic/browser/devtools/responsiveui-screenshot.png (../shared/devtools/responsiveui-screenshot.png)
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png
@ -508,6 +511,9 @@ browser.jar:
skin/classic/aero/browser/devtools/font-inspector.css (devtools/font-inspector.css)
skin/classic/aero/browser/devtools/computedview.css (devtools/computedview.css)
skin/classic/aero/browser/devtools/arrow-e.png (devtools/arrow-e.png)
skin/classic/aero/browser/devtools/responsiveui-rotate.png (../shared/devtools/responsiveui-rotate.png)
skin/classic/aero/browser/devtools/responsiveui-touch.png (../shared/devtools/responsiveui-touch.png)
skin/classic/aero/browser/devtools/responsiveui-screenshot.png (../shared/devtools/responsiveui-screenshot.png)
#ifdef MOZ_SERVICES_SYNC
skin/classic/aero/browser/sync-throbber.png
skin/classic/aero/browser/sync-16.png

View File

@ -57,8 +57,8 @@ ifdef MOZ_APP_PROFILE
DEFINES += -DMOZ_APP_PROFILE="$(MOZ_APP_PROFILE)"
endif
ifdef MOZILLA_OFFICIAL
DEFINES += -DMOZILLA_OFFICIAL
ifdef MOZ_CRASHREPORTER
DEFINES += -DMOZ_CRASHREPORTER
endif
ifdef MOZ_PROFILE_MIGRATOR

View File

@ -27,6 +27,16 @@ def main(file):
appdata = dict(("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s))
appdata['flags'] = ' | '.join(flags) if flags else '0'
appdata['App:profile'] = '"%s"' % appdata['App:profile'] if 'App:profile' in appdata else 'NULL'
expected = ('App:vendor', 'App:name', 'App:version', 'App:buildid',
'App:id', 'Gecko:minversion', 'Gecko:maxversion')
missing = [var for var in expected if var not in appdata]
if missing:
print >>sys.stderr, \
"Missing values in %s: %s" % (file, ', '.join(missing))
sys.exit(1)
if not 'Crash Reporter:serverurl' in appdata:
appdata['Crash Reporter:serverurl'] = ''
print '''#include "nsXREAppData.h"
static const nsXREAppData sAppData = {

View File

@ -37,8 +37,8 @@ EnableProfileMigrator=1
EnableExtensionManager=1
#endif
#if MOZ_CRASHREPORTER
[Crash Reporter]
#if MOZILLA_OFFICIAL
Enabled=1
#endif
ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@APP_BUILDID@
#endif

View File

@ -37,16 +37,6 @@ if test -z "$MOZ_ARCH"; then
MOZ_ARCH=toolchain-default
MOZ_THUMB=yes
;;
arm-*)
if test -n "$MOZ_PLATFORM_MAEMO"; then
MOZ_THUMB=no
MOZ_ARCH=armv7-a
MOZ_FLOAT_ABI=softfp
fi
if test "$MOZ_PLATFORM_MAEMO" = 6; then
MOZ_THUMB=yes
fi
;;
esac
fi

View File

@ -78,6 +78,85 @@ if test -z "$_MOZ_USE_RTTI"; then
fi
])
dnl ========================================================
dnl =
dnl = Debugging Options
dnl =
dnl ========================================================
AC_DEFUN([MOZ_DEBUGGING_OPTS],
[
dnl Debug info is ON by default.
if test -z "$MOZ_DEBUG_FLAGS"; then
MOZ_DEBUG_FLAGS="-g"
fi
MOZ_ARG_ENABLE_STRING(debug,
[ --enable-debug[=DBG] Enable building with developer debug info
(using compiler flags DBG)],
[ if test "$enableval" != "no"; then
MOZ_DEBUG=1
if test -n "$enableval" -a "$enableval" != "yes"; then
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
_MOZ_DEBUG_FLAGS_SET=1
fi
else
MOZ_DEBUG=
fi ],
MOZ_DEBUG=)
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
MOZ_ARG_WITH_STRING(debug-label,
[ --with-debug-label=LABELS
Define DEBUG_<value> for each comma-separated
value given.],
[ for option in `echo $withval | sed 's/,/ /g'`; do
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
done])
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
if test -n "$MOZ_DEBUG"; then
AC_MSG_CHECKING([for valid debug flags])
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
AC_TRY_COMPILE([#include <stdio.h>],
[printf("Hello World\n");],
_results=yes,
_results=no)
AC_MSG_RESULT([$_results])
if test "$_results" = "no"; then
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
fi
dnl ========================================================
dnl = Enable generation of debug symbols
dnl ========================================================
MOZ_ARG_ENABLE_STRING(debug-symbols,
[ --enable-debug-symbols[=DBG]
Enable debugging symbols (using compiler flags DBG)],
[ if test "$enableval" != "no"; then
MOZ_DEBUG_SYMBOLS=1
if test -n "$enableval" -a "$enableval" != "yes"; then
if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
else
AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
fi
fi
else
MOZ_DEBUG_SYMBOLS=
fi ],
MOZ_DEBUG_SYMBOLS=1)
if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
AC_DEFINE(MOZ_DEBUG_SYMBOLS)
export MOZ_DEBUG_SYMBOLS
fi
])
dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
@ -144,7 +223,8 @@ if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
fi
CXXFLAGS="$CXXFLAGS -fno-exceptions"
CFLAGS="$CFLAGS -fno-math-errno"
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno"
fi
dnl ========================================================

View File

@ -537,6 +537,12 @@ class Automation(object):
return env
def killPid(self, pid):
try:
os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
except WindowsError:
self.log.info("Failed to kill process %d." % pid)
if IS_WIN32:
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
GetLastError = ctypes.windll.kernel32.GetLastError
@ -587,14 +593,6 @@ class Automation(object):
ctypes.windll.kernel32.CloseHandle(pHandle)
return pExitCode.value == STILL_ACTIVE
def killPid(self, pid):
PROCESS_TERMINATE = 0x0001
pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
if not pHandle:
return
ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
ctypes.windll.kernel32.CloseHandle(pHandle)
else:
def readWithTimeout(self, f, timeout):
@ -624,9 +622,6 @@ class Automation(object):
return False
raise
def killPid(self, pid):
os.kill(pid, signal.SIGKILL)
def dumpScreen(self, utilityPath):
if self.haveDumpedScreen:
self.log.info("Not taking screenshot here: see the one that was previously logged")

View File

@ -8,7 +8,6 @@
#include "nsISerializable.idl"
%{C++
struct JSContext;
struct JSPrincipals;
#include "nsCOMPtr.h"
#include "nsTArray.h"

View File

@ -18,13 +18,10 @@
#include "pldhash.h"
#include "plstr.h"
#include "nsIScriptExternalNameSet.h"
#include "js/TypeDecls.h"
#include <stdint.h>
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
}
class nsIDocShell;
class nsString;
class nsIClassInfo;

View File

@ -8,6 +8,7 @@
#include "nsChromeRegistry.h"
#include "nsVoidArray.h"
#include "mozilla/Move.h"
namespace mozilla {
namespace dom {
@ -126,8 +127,8 @@ class nsChromeRegistryChrome : public nsChromeRegistry
typedef nsURIHashKey::KeyTypePointer KeyTypePointer;
OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { }
OverlayListEntry(OverlayListEntry& toCopy) : nsURIHashKey(toCopy),
mArray(toCopy.mArray) { }
OverlayListEntry(OverlayListEntry&& toMove) : nsURIHashKey(mozilla::Move(toMove)),
mArray(mozilla::Move(toMove.mArray)) { }
~OverlayListEntry() { }
void AddURI(nsIURI* aURI);

View File

@ -104,18 +104,9 @@ endif
# Load mozconfig Options
# See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
define CR
endef
# As $(shell) doesn't preserve newlines, use sed to replace them with an
# unlikely sequence (||), which is then replaced back to newlines by make
# before evaluation.
$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/')))
# mozconfig.mk needs to be loaded multiple times by configure, so we don't check
# for INCLUDED_MOZCONFIG_MK
include $(TOPSRCDIR)/config/makefiles/mozconfig.mk
ifdef AUTOCLOBBER
export AUTOCLOBBER=1

View File

@ -494,8 +494,8 @@ OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
endif
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)

View File

@ -3,5 +3,5 @@
# 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/.
add_tier_dir('js', 'js/src', static=True)
add_tier_dir('js', 'js/src', external=True)

View File

@ -0,0 +1,33 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# 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/.
#
INCLUDED_MOZCONFIG_MK = 1
# We are pulling in the mozconfig exports, so we only need to run once for the
# whole make process tree (not for each sub-make). Export this so the sub-makes
# don't read mozconfig multiple times.
export INCLUDED_MOZCONFIG_MK
MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
define CR
endef
# topsrcdir is used by rules.mk (set from the generated Makefile), while
# TOPSRCDIR is used by client.mk
ifneq (,$(topsrcdir))
top := $(topsrcdir)
else
top := $(TOPSRCDIR)
endif
# As $(shell) doesn't preserve newlines, use sed to replace them with an
# unlikely sequence (||), which is then replaced back to newlines by make
# before evaluation.
$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(top)/$(MOZCONFIG_LOADER) $(top) 2> $(top)/.mozconfig.out | sed 's/$$/||/')))

View File

@ -10,6 +10,10 @@ ifndef topsrcdir
$(error topsrcdir was not set))
endif
ifndef INCLUDED_MOZCONFIG_MK
include $(topsrcdir)/config/makefiles/mozconfig.mk
endif
# Integrate with mozbuild-generated make files. We first verify that no
# variables provided by the automatically generated .mk files are
# present. If they are, this is a violation of the separation of
@ -683,9 +687,6 @@ SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
ifndef SUPPRESS_DEFAULT_RULES
ifndef TIERS
default all::
ifneq (,$(strip $(STATIC_DIRS)))
$(foreach dir,$(STATIC_DIRS),$(call SUBMAKE,,$(dir),1))
endif
$(MAKE) export
$(MAKE) libs
$(MAKE) tools
@ -830,10 +831,21 @@ checkout:
clean clobber realclean clobber_all:: $(SUBMAKEFILES)
-$(RM) $(ALL_TRASH)
-$(RM) -r $(ALL_TRASH_DIRS)
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
ifdef TIERS
clean clobber realclean clobber_all distclean::
$(foreach dir, \
$(foreach tier, $(TIERS), $(tier_$(tier)_staticdirs) $(tier_$(tier)_dirs)), \
-$(call SUBMAKE,$@,$(dir)))
else
clean clobber realclean clobber_all distclean::
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
distclean:: $(SUBMAKEFILES)
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
endif
distclean::
-$(RM) -r $(ALL_TRASH_DIRS)
-$(RM) $(ALL_TRASH) \
Makefile .HSancillary \

View File

@ -1059,21 +1059,9 @@ hunspell.hxx
#if MOZ_NATIVE_BZ2==1
bzlib.h
#endif
#if MOZ_PLATFORM_MAEMO==5
hildon-uri.h
hildon-mime.h
hildon-file-chooser-dialog.h
libosso.h
osso-mem.h
#endif
#ifdef MOZ_ENABLE_GIO
gio/gio.h
#endif
#ifdef MOZ_ENABLE_LIBCONIC
conic/conicconnection.h
conic/conicconnectionevent.h
conic/conicstatisticsevent.h
#endif
#if MOZ_NATIVE_LIBEVENT==1
event.h
#else
@ -1082,9 +1070,6 @@ sys/event.h
#ifdef MOZ_ENABLE_LIBPROXY
proxy.h
#endif
#if MOZ_PLATFORM_MAEMO==6
contentaction/contentaction.h
#endif
#ifdef MOZ_ENABLE_CONTENTMANAGER
SelectSingleContentItemPage.h
SelectMultipleContentItemsPage.h

View File

@ -2464,88 +2464,6 @@ if test -z "$COMPILE_ENVIRONMENT"; then
SKIP_LIBRARY_CHECKS=1
fi
dnl ========================================================
dnl =
dnl = Debugging Options
dnl =
dnl = These must come before MOZ_COMPILER_OPTS so that MOZ_COMPILER_OPTS
dnl = sees any debug flags set by the user.
dnl =
dnl ========================================================
MOZ_ARG_HEADER(Debugging)
dnl ========================================================
dnl = Debug info is ON by default.
dnl ========================================================
if test -z "$MOZ_DEBUG_FLAGS"; then
MOZ_DEBUG_FLAGS="-g"
fi
MOZ_ARG_ENABLE_STRING(debug,
[ --enable-debug[=DBG] Enable building with developer debug info
(using compiler flags DBG)],
[ if test "$enableval" != "no"; then
MOZ_DEBUG=1
if test -n "$enableval" -a "$enableval" != "yes"; then
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
_MOZ_DEBUG_FLAGS_SET=1
fi
else
MOZ_DEBUG=
fi ],
MOZ_DEBUG=)
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
MOZ_ARG_WITH_STRING(debug-label,
[ --with-debug-label=LABELS
Define DEBUG_<value> for each comma-separated
value given.],
[ for option in `echo $withval | sed 's/,/ /g'`; do
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
done])
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
if test -n "$MOZ_DEBUG"; then
AC_MSG_CHECKING([for valid debug flags])
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
AC_TRY_COMPILE([#include <stdio.h>],
[printf("Hello World\n");],
_results=yes,
_results=no)
AC_MSG_RESULT([$_results])
if test "$_results" = "no"; then
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
fi
dnl ========================================================
dnl = Enable generation of debug symbols
dnl ========================================================
MOZ_ARG_ENABLE_STRING(debug-symbols,
[ --enable-debug-symbols[=DBG]
Enable debugging symbols (using compiler flags DBG)],
[ if test "$enableval" != "no"; then
MOZ_DEBUG_SYMBOLS=1
if test -n "$enableval" -a "$enableval" != "yes"; then
if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
else
AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
fi
fi
else
MOZ_DEBUG_SYMBOLS=
fi ],
MOZ_DEBUG_SYMBOLS=1)
if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
AC_DEFINE(MOZ_DEBUG_SYMBOLS)
export MOZ_DEBUG_SYMBOLS
fi
MOZ_COMPILER_OPTS
if test -z "$SKIP_COMPILER_CHECKS"; then
dnl Checks for typedefs, structures, and compiler characteristics.
@ -4818,6 +4736,8 @@ incorrect])
MOZ_ENABLE_QTMOBILITY=1
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
AC_SUBST(MOZ_ENABLE_QTMOBILITY)
else
AC_CHECK_LIB(QtSensors, main, [
MOZ_ENABLE_QTMOBILITY=1
@ -4828,8 +4748,20 @@ incorrect])
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
])
fi
if test "$MOZ_ENABLE_QTMOBILITY"; then
AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
if test "$MOZ_ENABLE_CONTENTACTION"; then
MOZ_ENABLE_CONTENTACTION=1
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
fi
MOZ_ENABLE_CONTENTACTION=
PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
if test "$MOZ_ENABLE_CONTENTACTION"; then
MOZ_ENABLE_CONTENTACTION=1
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
fi
fi
@ -6765,185 +6697,6 @@ MOZ_ARG_DISABLE_BOOL(zipwriter,
MOZ_ZIPWRITER=1 )
AC_SUBST(MOZ_ZIPWRITER)
dnl ========================================================
dnl = libconic
dnl ========================================================
dnl superseded by QtNetwork starting from 4.7
MOZ_ENABLE_LIBCONIC=1
if test -n "$MOZ_ENABLE_QT"; then
if test "$MOZ_ENABLE_QTNETWORK"; then
MOZ_ENABLE_LIBCONIC=
fi
fi
MOZ_ARG_DISABLE_BOOL(libconic,
[ --disable-libconic Disable libconic],
MOZ_ENABLE_LIBCONIC=,
MOZ_ENABLE_LIBCONIC=1 )
if test -n "$MOZ_ENABLE_LIBCONIC"; then
PKG_CHECK_MODULES(LIBCONIC, conic,
MOZ_ENABLE_LIBCONIC=1,
MOZ_ENABLE_LIBCONIC=)
fi
if test "$MOZ_ENABLE_LIBCONIC"; then
AC_DEFINE(MOZ_ENABLE_LIBCONIC)
fi
AC_SUBST(MOZ_ENABLE_LIBCONIC)
AC_SUBST(LIBCONIC_CFLAGS)
AC_SUBST(LIBCONIC_LIBS)
dnl ========================================================
dnl = Maemo checks
dnl ========================================================
MAEMO_SDK_TARGET_VER=-1
MOZ_ARG_WITH_STRING(maemo-version,
[ --with-maemo-version=MAEMO_SDK_TARGET_VER
Maemo SDK Version],
MAEMO_SDK_TARGET_VER=$withval)
case "$MAEMO_SDK_TARGET_VER" in
5)
MOZ_PLATFORM_MAEMO=5
;;
6)
MOZ_PLATFORM_MAEMO=6
;;
-1)
dnl We aren't compiling for Maemo, move on.
;;
*)
AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
;;
esac
if test $MOZ_PLATFORM_MAEMO; then
AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
if test -z "$MOZ_ENABLE_DBUS"; then
AC_MSG_ERROR([DBus is required when building for Maemo])
fi
MOZ_GFX_OPTIMIZE_MOBILE=1
MOZ_GL_DEFAULT_PROVIDER=EGL
MOZ_MAEMO_LIBLOCATION=
if test $MOZ_PLATFORM_MAEMO = 5; then
dnl if we have Xcomposite we should also have Xdamage and Xfixes
MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
[AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
[MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
AC_SUBST(XCOMPOSITE_LIBS)
PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
if test -z "$_LIB_FOUND"; then
AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
fi
PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
if test -z "$_LIB_FOUND"; then
AC_MSG_ERROR([LibOSSO is required when building for Maemo])
fi
PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
if test -z "$_LIB_FOUND"; then
AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
fi
fi
if test $MOZ_PLATFORM_MAEMO = 6; then
PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
_LIB_FOUND=1,
_LIB_FOUND=)
if test "$_LIB_FOUND"; then
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
MOZ_ENABLE_CONTENTMANAGER=1
AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
else
AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
fi
AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
dnl ========================================================
dnl = Enable meego libcontentaction
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(meegocontentaction,
[ --enable-meegocontentaction Enable meegocontentaction support],
MOZ_MEEGOCONTENTACTION=1,
MOZ_MEEGOCONTENTACTION=)
if test -n "$MOZ_MEEGOCONTENTACTION"; then
PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
if test "$_LIB_FOUND"; then
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
MOZ_ENABLE_CONTENTACTION=1
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
fi
fi
MOZ_ARG_ENABLE_BOOL(meegotouch,
[ --enable-meegotouch Enable meegotouch support],
MOZ_MEEGOTOUCHENABLED=1,
MOZ_MEEGOTOUCHENABLED=)
if test -n "$MOZ_MEEGOTOUCHENABLED"; then
PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
if test "$_LIB_FOUND"; then
MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
else
AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
fi
fi
fi
PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
if test "$_LIB_FOUND"; then
MOZ_MAEMO_LIBLOCATION=1
AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
else
AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
fi
AC_SUBST(MOZ_MAEMO_LIBLOCATION)
PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
if test "$_LIB_FOUND"; then
MOZ_ENABLE_MEEGOTOUCHSHARE=1
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
else
AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
fi
AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
fi
dnl ========================================================
dnl GL provider
dnl ========================================================
@ -8614,7 +8367,6 @@ AC_SUBST(FILTER)
AC_SUBST(BIN_FLAGS)
AC_SUBST(MOZ_WIDGET_TOOLKIT)
AC_SUBST(MOZ_UPDATE_XTERM)
AC_SUBST(MOZ_PLATFORM_MAEMO)
AC_SUBST(MOZ_AUTH_EXTENSION)
AC_SUBST(MOZ_PERMISSIONS)
AC_SUBST(MOZ_PREF_EXTENSIONS)
@ -9475,19 +9227,32 @@ fi
dist=$MOZ_BUILD_ROOT/dist
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
ac_configure_args="$ac_configure_args --enable-threadsafe"
MOZ_ARG_WITH_STRING(intl-api,
[ --with-intl-api, --with-intl-api=build, --without-intl-api
Determine the status of the ECMAScript Internationalization API. The first
(or lack of any of these) builds and exposes the API. The second builds it
but doesn't use ICU or expose the API to script. The third doesn't build
ICU at all.],
WITH_INTL="--with-intl-api=$withval"
])
if test -z "$WITH_INTL"; then
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser"; then
# In desktop nightlies the Internationalization API is disabled, but all
# code for it is still built. Bug 853301 will remove this so that it's
# built and the API is enabled.
ac_configure_args="$ac_configure_args --with-intl-api=build"
WITH_INTL="--with-intl-api=build"
else
# Internationalization isn't built or exposed by default in non-desktop and
# non-nightly builds. Bugs to enable:
#
# Android: bug 864843
# B2G: bug 866301
ac_configure_args="$ac_configure_args --without-intl-api"
WITH_INTL="--without-intl-api"
fi
fi
ac_configure_args="$ac_configure_args $WITH_INTL"
if test "$BUILD_CTYPES"; then
# Build js-ctypes on the platforms we can.
ac_configure_args="$ac_configure_args --enable-ctypes"

View File

@ -18,6 +18,7 @@
#include <ieeefp.h>
#endif
#include "js/TypeDecls.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/GuardObjects.h"
@ -92,7 +93,6 @@ class nsTextFragment;
class nsViewportInfo;
class nsWrapperCache;
struct JSContext;
struct JSPropertyDescriptor;
struct JSRuntime;
struct nsIntMargin;
@ -103,10 +103,6 @@ template<class K, class V> class nsDataHashtable;
template<class K, class V> class nsRefPtrHashtable;
template<class T> class nsReadingIterator;
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
class ErrorResult;
class Selection;
@ -189,6 +185,7 @@ public:
static JSContext* GetContextFromDocument(nsIDocument *aDocument);
static bool IsCallerChrome();
static bool ThreadsafeIsCallerChrome();
static bool IsCallerXBL();
static bool IsImageSrcSetDisabled();
@ -1538,12 +1535,12 @@ public:
// Call EnterMicroTask when you're entering JS execution.
// Usually the best way to do this is to use nsAutoMicroTask.
static void EnterMicroTask() { ++sMicroTaskLevel; }
static void EnterMicroTask();
static void LeaveMicroTask();
static bool IsInMicroTask() { return sMicroTaskLevel != 0; }
static uint32_t MicroTaskLevel() { return sMicroTaskLevel; }
static void SetMicroTaskLevel(uint32_t aLevel) { sMicroTaskLevel = aLevel; }
static bool IsInMicroTask();
static uint32_t MicroTaskLevel();
static void SetMicroTaskLevel(uint32_t aLevel);
/* Process viewport META data. This gives us information for the scale
* and zoom of a page on mobile devices. We stick the information in

View File

@ -149,6 +149,7 @@ protected:
nsString mContentType;
nsString mName;
nsString mPath; // The path relative to a directory chosen by the user
uint64_t mStart;
uint64_t mLength;
@ -300,6 +301,8 @@ public:
NS_IMETHOD GetMozFullPathInternal(nsAString& aFullPath) MOZ_OVERRIDE;
NS_IMETHOD GetInternalStream(nsIInputStream**) MOZ_OVERRIDE;
void SetPath(const nsAString& aFullPath);
protected:
// Create slice
nsDOMFileFile(const nsDOMFileFile* aOther, uint64_t aStart, uint64_t aLength,

View File

@ -296,6 +296,11 @@ public:
return IsInNamespace(kNameSpaceID_XUL);
}
inline bool IsXUL(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_XUL);
}
inline bool IsMathML() const
{
return IsInNamespace(kNameSpaceID_MathML);

View File

@ -59,11 +59,13 @@ interface nsIDOMBlob : nsISupports
[notxpcom] FileInfo getFileInfo(in FileManager aFileManager);
};
[scriptable, builtinclass, uuid(6928584d-7d87-4d56-9ce1-1c89c24f2c6a)]
[scriptable, builtinclass, uuid(0acb4135-9f79-4516-ba92-b5fba5203620)]
interface nsIDOMFile : nsIDOMBlob
{
readonly attribute DOMString name;
readonly attribute DOMString path;
[implicit_jscontext]
readonly attribute jsval lastModifiedDate;

View File

@ -16,8 +16,10 @@
#include "nsPropertyTable.h" // for typedefs
#include "nsTObserverArray.h" // for member
#include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS
#include "mozilla/ErrorResult.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventTarget.h" // for base class
#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext
// Including 'windows.h' will #define GetClassInfo to something else.
#ifdef XP_WIN
@ -66,11 +68,6 @@ template<typename T> class Optional;
} // namespace dom
} // namespace mozilla
namespace JS {
class Value;
template<typename T> class Handle;
}
#define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_)))
enum {

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMParser.h"
#include "mozilla/dom/DOMParser.h"
#include "nsIDOMDocument.h"
#include "nsNetUtil.h"
@ -20,28 +20,28 @@
using namespace mozilla;
using namespace mozilla::dom;
nsDOMParser::nsDOMParser()
DOMParser::DOMParser()
: mAttemptedInit(false)
{
SetIsDOMBinding();
}
nsDOMParser::~nsDOMParser()
DOMParser::~DOMParser()
{
}
// QueryInterface implementation for nsDOMParser
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMParser)
// QueryInterface implementation for DOMParser
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMParser)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMParser)
NS_INTERFACE_MAP_ENTRY(nsIDOMParser)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMParser, mOwner)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(DOMParser, mOwner)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMParser)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMParser)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMParser)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMParser)
static const char*
StringFromSupportedType(SupportedType aType)
@ -50,8 +50,8 @@ StringFromSupportedType(SupportedType aType)
}
already_AddRefed<nsIDocument>
nsDOMParser::ParseFromString(const nsAString& aStr, SupportedType aType,
ErrorResult& rv)
DOMParser::ParseFromString(const nsAString& aStr, SupportedType aType,
ErrorResult& rv)
{
nsCOMPtr<nsIDOMDocument> domDocument;
rv = ParseFromString(aStr,
@ -62,9 +62,9 @@ nsDOMParser::ParseFromString(const nsAString& aStr, SupportedType aType,
}
NS_IMETHODIMP
nsDOMParser::ParseFromString(const PRUnichar *str,
const char *contentType,
nsIDOMDocument **aResult)
DOMParser::ParseFromString(const PRUnichar *str,
const char *contentType,
nsIDOMDocument **aResult)
{
NS_ENSURE_ARG(str);
// Converting a string to an enum value manually is a bit of a pain,
@ -73,9 +73,9 @@ nsDOMParser::ParseFromString(const PRUnichar *str,
}
nsresult
nsDOMParser::ParseFromString(const nsAString& str,
const char *contentType,
nsIDOMDocument **aResult)
DOMParser::ParseFromString(const nsAString& str,
const char *contentType,
nsIDOMDocument **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
@ -120,31 +120,31 @@ nsDOMParser::ParseFromString(const nsAString& str,
}
already_AddRefed<nsIDocument>
nsDOMParser::ParseFromBuffer(const Sequence<uint8_t>& aBuf, uint32_t aBufLen,
SupportedType aType, ErrorResult& rv)
DOMParser::ParseFromBuffer(const Sequence<uint8_t>& aBuf, uint32_t aBufLen,
SupportedType aType, ErrorResult& rv)
{
if (aBufLen > aBuf.Length()) {
rv.Throw(NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY);
return nullptr;
}
nsCOMPtr<nsIDOMDocument> domDocument;
rv = nsDOMParser::ParseFromBuffer(aBuf.Elements(), aBufLen,
StringFromSupportedType(aType),
getter_AddRefs(domDocument));
rv = DOMParser::ParseFromBuffer(aBuf.Elements(), aBufLen,
StringFromSupportedType(aType),
getter_AddRefs(domDocument));
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
return document.forget();
}
already_AddRefed<nsIDocument>
nsDOMParser::ParseFromBuffer(const Uint8Array& aBuf, uint32_t aBufLen,
SupportedType aType, ErrorResult& rv)
DOMParser::ParseFromBuffer(const Uint8Array& aBuf, uint32_t aBufLen,
SupportedType aType, ErrorResult& rv)
{
if (aBufLen > aBuf.Length()) {
rv.Throw(NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY);
return nullptr;
}
nsCOMPtr<nsIDOMDocument> domDocument;
rv = nsDOMParser::ParseFromBuffer(aBuf.Data(), aBufLen,
rv = DOMParser::ParseFromBuffer(aBuf.Data(), aBufLen,
StringFromSupportedType(aType),
getter_AddRefs(domDocument));
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
@ -152,10 +152,10 @@ nsDOMParser::ParseFromBuffer(const Uint8Array& aBuf, uint32_t aBufLen,
}
NS_IMETHODIMP
nsDOMParser::ParseFromBuffer(const uint8_t *buf,
uint32_t bufLen,
const char *contentType,
nsIDOMDocument **aResult)
DOMParser::ParseFromBuffer(const uint8_t *buf,
uint32_t bufLen,
const char *contentType,
nsIDOMDocument **aResult)
{
NS_ENSURE_ARG_POINTER(buf);
NS_ENSURE_ARG_POINTER(aResult);
@ -173,28 +173,28 @@ nsDOMParser::ParseFromBuffer(const uint8_t *buf,
already_AddRefed<nsIDocument>
nsDOMParser::ParseFromStream(nsIInputStream* aStream,
const nsAString& aCharset,
int32_t aContentLength,
SupportedType aType,
ErrorResult& rv)
DOMParser::ParseFromStream(nsIInputStream* aStream,
const nsAString& aCharset,
int32_t aContentLength,
SupportedType aType,
ErrorResult& rv)
{
nsCOMPtr<nsIDOMDocument> domDocument;
rv = nsDOMParser::ParseFromStream(aStream,
NS_ConvertUTF16toUTF8(aCharset).get(),
aContentLength,
StringFromSupportedType(aType),
getter_AddRefs(domDocument));
rv = DOMParser::ParseFromStream(aStream,
NS_ConvertUTF16toUTF8(aCharset).get(),
aContentLength,
StringFromSupportedType(aType),
getter_AddRefs(domDocument));
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
return document.forget();
}
NS_IMETHODIMP
nsDOMParser::ParseFromStream(nsIInputStream *stream,
const char *charset,
int32_t contentLength,
const char *contentType,
nsIDOMDocument **aResult)
DOMParser::ParseFromStream(nsIInputStream *stream,
const char *charset,
int32_t contentLength,
const char *contentType,
nsIDOMDocument **aResult)
{
NS_ENSURE_ARG(stream);
NS_ENSURE_ARG(contentType);
@ -304,8 +304,8 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
}
NS_IMETHODIMP
nsDOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
nsIURI* baseURI, nsIScriptGlobalObject* aScriptObject)
DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
nsIURI* baseURI, nsIScriptGlobalObject* aScriptObject)
{
NS_ENSURE_STATE(!mAttemptedInit);
mAttemptedInit = true;
@ -360,16 +360,16 @@ nsDOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
return NS_OK;
}
/*static */already_AddRefed<nsDOMParser>
nsDOMParser::Constructor(const GlobalObject& aOwner,
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
nsIURI* aBaseURI, ErrorResult& rv)
/*static */already_AddRefed<DOMParser>
DOMParser::Constructor(const GlobalObject& aOwner,
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
nsIURI* aBaseURI, ErrorResult& rv)
{
if (!nsContentUtils::IsCallerChrome()) {
rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
nsRefPtr<nsDOMParser> domParser = new nsDOMParser(aOwner.GetAsSupports());
nsRefPtr<DOMParser> domParser = new DOMParser(aOwner.GetAsSupports());
rv = domParser->InitInternal(aOwner.GetAsSupports(), aPrincipal, aDocumentURI,
aBaseURI);
if (rv.Failed()) {
@ -378,9 +378,9 @@ nsDOMParser::Constructor(const GlobalObject& aOwner,
return domParser.forget();
}
/*static */already_AddRefed<nsDOMParser>
nsDOMParser::Constructor(const GlobalObject& aOwner,
ErrorResult& rv)
/*static */already_AddRefed<DOMParser>
DOMParser::Constructor(const GlobalObject& aOwner,
ErrorResult& rv)
{
nsCOMPtr<nsIPrincipal> prin;
nsCOMPtr<nsIURI> documentURI;
@ -403,7 +403,7 @@ nsDOMParser::Constructor(const GlobalObject& aOwner,
return nullptr;
}
nsRefPtr<nsDOMParser> domParser = new nsDOMParser(aOwner.GetAsSupports());
nsRefPtr<DOMParser> domParser = new DOMParser(aOwner.GetAsSupports());
rv = domParser->InitInternal(aOwner.GetAsSupports(), prin, documentURI, baseURI);
if (rv.Failed()) {
return nullptr;
@ -412,8 +412,8 @@ nsDOMParser::Constructor(const GlobalObject& aOwner,
}
nsresult
nsDOMParser::InitInternal(nsISupports* aOwner, nsIPrincipal* prin,
nsIURI* documentURI, nsIURI* baseURI)
DOMParser::InitInternal(nsISupports* aOwner, nsIPrincipal* prin,
nsIURI* documentURI, nsIURI* baseURI)
{
AttemptedInitMarker marker(&mAttemptedInit);
if (!documentURI) {
@ -446,8 +446,8 @@ nsDOMParser::InitInternal(nsISupports* aOwner, nsIPrincipal* prin,
}
void
nsDOMParser::Init(nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
nsIURI* aBaseURI, mozilla::ErrorResult& rv)
DOMParser::Init(nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
nsIURI* aBaseURI, mozilla::ErrorResult& rv)
{
AttemptedInitMarker marker(&mAttemptedInit);
@ -485,7 +485,7 @@ nsDOMParser::Init(nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
}
nsresult
nsDOMParser::SetUpDocument(DocumentFlavor aFlavor, nsIDOMDocument** aResult)
DOMParser::SetUpDocument(DocumentFlavor aFlavor, nsIDOMDocument** aResult)
{
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
do_QueryReferent(mScriptHandlingObject);

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMParser_h_
#define nsDOMParser_h_
#ifndef mozilla_dom_DOMParser_h_
#define mozilla_dom_DOMParser_h_
#include "nsCOMPtr.h"
#include "nsIDocument.h"
@ -17,28 +17,31 @@
class nsIDocument;
class nsDOMParser MOZ_FINAL : public nsIDOMParser,
public nsSupportsWeakReference,
public nsWrapperCache
namespace mozilla {
namespace dom {
class DOMParser MOZ_FINAL : public nsIDOMParser,
public nsSupportsWeakReference,
public nsWrapperCache
{
typedef mozilla::dom::GlobalObject GlobalObject;
public:
nsDOMParser();
virtual ~nsDOMParser();
DOMParser();
virtual ~DOMParser();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMParser,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(DOMParser,
nsIDOMParser)
// nsIDOMParser
NS_DECL_NSIDOMPARSER
// WebIDL API
static already_AddRefed<nsDOMParser>
static already_AddRefed<DOMParser>
Constructor(const GlobalObject& aOwner,
mozilla::ErrorResult& rv);
static already_AddRefed<nsDOMParser>
static already_AddRefed<DOMParser>
Constructor(const GlobalObject& aOwner,
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI, nsIURI* aBaseURI,
mozilla::ErrorResult& rv);
@ -77,7 +80,7 @@ public:
}
private:
nsDOMParser(nsISupports* aOwner) : mOwner(aOwner), mAttemptedInit(false)
DOMParser(nsISupports* aOwner) : mOwner(aOwner), mAttemptedInit(false)
{
MOZ_ASSERT(aOwner);
SetIsDOMBinding();
@ -116,4 +119,7 @@ private:
bool mAttemptedInit;
};
} // namespace dom
} // namespace mozilla
#endif

View File

@ -485,29 +485,26 @@ WebSocket::WrapObject(JSContext* cx, JS::Handle<JSObject*> scope)
// Constructor:
already_AddRefed<WebSocket>
WebSocket::Constructor(const GlobalObject& aGlobal,
JSContext* aCx,
const nsAString& aUrl,
ErrorResult& aRv)
{
Sequence<nsString> protocols;
return WebSocket::Constructor(aGlobal, aCx, aUrl, protocols, aRv);
return WebSocket::Constructor(aGlobal, aUrl, protocols, aRv);
}
already_AddRefed<WebSocket>
WebSocket::Constructor(const GlobalObject& aGlobal,
JSContext* aCx,
const nsAString& aUrl,
const nsAString& aProtocol,
ErrorResult& aRv)
{
Sequence<nsString> protocols;
protocols.AppendElement(aProtocol);
return WebSocket::Constructor(aGlobal, aCx, aUrl, protocols, aRv);
return WebSocket::Constructor(aGlobal, aUrl, protocols, aRv);
}
already_AddRefed<WebSocket>
WebSocket::Constructor(const GlobalObject& aGlobal,
JSContext* aCx,
const nsAString& aUrl,
const Sequence<nsString>& aProtocols,
ErrorResult& aRv)
@ -565,7 +562,8 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
}
nsRefPtr<WebSocket> webSocket = new WebSocket();
nsresult rv = webSocket->Init(aCx, principal, ownerWindow, aUrl, protocolArray);
nsresult rv = webSocket->Init(aGlobal.GetContext(), principal, ownerWindow,
aUrl, protocolArray);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;

View File

@ -92,18 +92,15 @@ public: // WebIDL interface:
// Constructor:
static already_AddRefed<WebSocket> Constructor(const GlobalObject& aGlobal,
JSContext *aCx,
const nsAString& aUrl,
ErrorResult& rv);
static already_AddRefed<WebSocket> Constructor(const GlobalObject& aGlobal,
JSContext *aCx,
const nsAString& aUrl,
const nsAString& aProtocol,
ErrorResult& rv);
static already_AddRefed<WebSocket> Constructor(const GlobalObject& aGlobal,
JSContext *aCx,
const nsAString& aUrl,
const Sequence<nsString>& aProtocols,
ErrorResult& rv);

View File

@ -54,6 +54,7 @@ EXPORTS.mozilla.dom += [
'Attr.h',
'Comment.h',
'DOMImplementation.h',
'DOMParser.h',
'DocumentFragment.h',
'DocumentType.h',
'EventSource.h',
@ -70,6 +71,7 @@ CPP_SOURCES += [
'DirectionalityUtils.cpp',
'DocumentFragment.cpp',
'DocumentType.cpp',
'DOMParser.cpp',
'Element.cpp',
'EventSource.cpp',
'FileIOObject.cpp',
@ -103,7 +105,6 @@ CPP_SOURCES += [
'nsDOMFileReader.cpp',
'nsDOMLists.cpp',
'nsDOMMutationObserver.cpp',
'nsDOMParser.cpp',
'nsDOMSerializer.cpp',
'nsDOMSettableTokenList.cpp',
'nsDOMTokenList.cpp',

View File

@ -263,9 +263,8 @@ MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS, bool aPrepareForCC)
int32_t i, historyCount;
history->GetCount(&historyCount);
for (i = 0; i < historyCount; ++i) {
nsCOMPtr<nsIHistoryEntry> historyEntry;
history->GetEntryAtIndex(i, false, getter_AddRefs(historyEntry));
nsCOMPtr<nsISHEntry> shEntry = do_QueryInterface(historyEntry);
nsCOMPtr<nsISHEntry> shEntry;
history->GetEntryAtIndex(i, false, getter_AddRefs(shEntry));
MarkSHEntry(shEntry, aCleanupJS, aPrepareForCC);
}

View File

@ -299,6 +299,16 @@ public:
mMatchNameSpaceId == aKey.mMatchNameSpaceId;
}
/**
* Sets the state to LIST_DIRTY and clears mElements array.
* @note This is the only acceptable way to set state to LIST_DIRTY.
*/
void SetDirty()
{
mState = LIST_DIRTY;
Reset();
}
protected:
/**
* Returns whether the element matches our criterion
@ -350,16 +360,6 @@ protected:
*/
inline void BringSelfUpToDate(bool aDoFlush);
/**
* Sets the state to LIST_DIRTY and clears mElements array.
* @note This is the only acceptable way to set state to LIST_DIRTY.
*/
void SetDirty()
{
mState = LIST_DIRTY;
Reset();
}
/**
* To be called from non-destructor locations that want to remove from caches.
* Needed because if subclasses want to have cache behavior they can't just

View File

@ -1746,6 +1746,7 @@ nsContentUtils::GetDocumentFromContext()
bool
nsContentUtils::IsCallerChrome()
{
MOZ_ASSERT(NS_IsMainThread());
bool is_caller_chrome = false;
nsresult rv = sSecurityManager->SubjectPrincipalIsSystem(&is_caller_chrome);
if (NS_FAILED(rv)) {
@ -1759,6 +1760,22 @@ nsContentUtils::IsCallerChrome()
return xpc::IsUniversalXPConnectEnabled(GetCurrentJSContext());
}
namespace mozilla {
namespace dom {
namespace workers {
extern bool IsCurrentThreadRunningChromeWorker();
}
}
}
bool
nsContentUtils::ThreadsafeIsCallerChrome()
{
return NS_IsMainThread() ?
IsCallerChrome() :
mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
}
bool
nsContentUtils::IsCallerXBL()
{
@ -4790,14 +4807,43 @@ nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable)
return true;
}
void
nsContentUtils::EnterMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
++sMicroTaskLevel;
}
void
nsContentUtils::LeaveMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
if (--sMicroTaskLevel == 0) {
nsDOMMutationObserver::HandleMutations();
}
}
bool
nsContentUtils::IsInMicroTask()
{
MOZ_ASSERT(NS_IsMainThread());
return sMicroTaskLevel != 0;
}
uint32_t
nsContentUtils::MicroTaskLevel()
{
MOZ_ASSERT(NS_IsMainThread());
return sMicroTaskLevel;
}
void
nsContentUtils::SetMicroTaskLevel(uint32_t aLevel)
{
MOZ_ASSERT(NS_IsMainThread());
sMicroTaskLevel = aLevel;
}
/*
* Helper function for nsContentUtils::ProcessViewportInfo.
*

View File

@ -22,7 +22,6 @@
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "prtime.h"
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "nsStreamUtils.h"
@ -45,7 +44,7 @@ public:
struct TokenTime
{
nsCString token;
PRTime expirationTime;
TimeStamp expirationTime;
};
struct CacheEntry : public LinkedListElement<CacheEntry>
@ -61,7 +60,7 @@ public:
MOZ_COUNT_DTOR(nsPreflightCache::CacheEntry);
}
void PurgeExpired(PRTime now);
void PurgeExpired(TimeStamp now);
bool CheckRequest(const nsCString& aMethod,
const nsTArray<nsCString>& aCustomHeaders);
@ -124,7 +123,7 @@ static bool EnsurePreflightCache()
}
void
nsPreflightCache::CacheEntry::PurgeExpired(PRTime now)
nsPreflightCache::CacheEntry::PurgeExpired(TimeStamp now)
{
uint32_t i;
for (i = 0; i < mMethods.Length(); ++i) {
@ -143,7 +142,7 @@ bool
nsPreflightCache::CacheEntry::CheckRequest(const nsCString& aMethod,
const nsTArray<nsCString>& aHeaders)
{
PurgeExpired(PR_Now());
PurgeExpired(TimeStamp::NowLoRes());
if (!aMethod.EqualsLiteral("GET") && !aMethod.EqualsLiteral("POST")) {
uint32_t i;
@ -214,7 +213,7 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
// Now enforce the max count.
if (mTable.Count() == PREFLIGHT_CACHE_SIZE) {
// Try to kick out all the expired entries.
PRTime now = PR_Now();
TimeStamp now = TimeStamp::NowLoRes();
mTable.Enumerate(RemoveExpiredEntries, &now);
// If that didn't remove anything then kick out the least recently used
@ -267,7 +266,7 @@ nsPreflightCache::RemoveExpiredEntries(const nsACString& aKey,
nsAutoPtr<CacheEntry>& aValue,
void* aUserData)
{
PRTime* now = static_cast<PRTime*>(aUserData);
TimeStamp* now = static_cast<TimeStamp*>(aUserData);
aValue->PurgeExpired(*now);
@ -899,8 +898,7 @@ nsCORSPreflightListener::AddResultToCache(nsIRequest *aRequest)
nsCOMPtr<nsIURI> uri;
NS_GetFinalChannelURI(http, getter_AddRefs(uri));
// PR_Now gives microseconds
PRTime expirationTime = PR_Now() + (uint64_t)age * PR_USEC_PER_SEC;
TimeStamp expirationTime = TimeStamp::NowLoRes() + TimeDuration::FromSeconds(age);
nsPreflightCache::CacheEntry* entry =
sPreflightCache->GetEntry(uri, mReferrerPrincipal, mWithCredentials,

View File

@ -126,6 +126,14 @@ nsDOMFileBase::GetName(nsAString &aFileName)
return NS_OK;
}
NS_IMETHODIMP
nsDOMFileBase::GetPath(nsAString &aPath)
{
NS_ASSERTION(mIsFile, "Should only be called on files");
aPath = mPath;
return NS_OK;
}
NS_IMETHODIMP
nsDOMFileBase::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
{
@ -591,6 +599,12 @@ nsDOMFileFile::GetInternalStream(nsIInputStream **aStream)
-1, -1, sFileStreamFlags);
}
void
nsDOMFileFile::SetPath(const nsAString& aPath)
{
mPath = aPath;
}
////////////////////////////////////////////////////////////////////////////
// nsDOMMemoryFile implementation

View File

@ -108,8 +108,6 @@ StructuredCloneData UnpackClonedMessageDataForChild(const ClonedMessageData& aDa
} // namespace mozilla
class nsAXPCNativeCallContext;
struct JSContext;
class JSObject;
struct nsMessageListenerInfo
{

View File

@ -2012,7 +2012,6 @@ GK_ATOM(mac_lion_theme, "mac-lion-theme")
GK_ATOM(windows_compositor, "windows-compositor")
GK_ATOM(windows_glass, "windows-glass")
GK_ATOM(touch_enabled, "touch-enabled")
GK_ATOM(maemo_classic, "maemo-classic")
GK_ATOM(menubar_drag, "menubar-drag")
GK_ATOM(swipe_animation_enabled, "swipe-animation-enabled")
GK_ATOM(physical_home_button, "physical-home-button")
@ -2053,7 +2052,6 @@ GK_ATOM(_moz_windows_glass, "-moz-windows-glass")
GK_ATOM(_moz_windows_theme, "-moz-windows-theme")
GK_ATOM(_moz_os_version, "-moz-os-version")
GK_ATOM(_moz_touch_enabled, "-moz-touch-enabled")
GK_ATOM(_moz_maemo_classic, "-moz-maemo-classic")
GK_ATOM(_moz_menubar_drag, "-moz-menubar-drag")
GK_ATOM(_moz_device_pixel_ratio, "-moz-device-pixel-ratio")
GK_ATOM(_moz_device_orientation, "-moz-device-orientation")

View File

@ -61,7 +61,6 @@
#include "nsIDOMUserDataHandler.h"
#include "nsIEditor.h"
#include "nsIEditorIMESupport.h"
#include "nsIFrame.h"
#include "nsILinkHandler.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"

View File

@ -482,12 +482,14 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
*aDecision = nsIContentPolicy::ACCEPT;
rootDoc->SetHasMixedActiveContentLoaded(true);
if (!rootDoc->GetHasMixedDisplayContentLoaded() && NS_SUCCEEDED(stateRV)) {
rootDoc->SetHasMixedDisplayContentLoaded(true);
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
}
} else {
*aDecision = nsIContentPolicy::REJECT_REQUEST;
LogMixedContentMessage(classification, aContentLocation, rootDoc, eBlocked);
if (!rootDoc->GetHasMixedDisplayContentBlocked() && NS_SUCCEEDED(stateRV)) {
rootDoc->SetHasMixedDisplayContentBlocked(true);
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT));
}
}

View File

@ -8,10 +8,9 @@
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
#include "js/TypeDecls.h"
struct CharacterDataChangeInfo;
struct JSContext;
class JSObject;
class nsIVariant;
class nsIDOMNode;
class nsIDOMUserDataHandler;

View File

@ -2676,12 +2676,6 @@ DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner,
nsObjectLoadingContent* aContent,
bool aDelayedStop)
{
#if (MOZ_PLATFORM_MAEMO==5)
// Don't delay stop on Maemo/Hildon (bug 530739).
if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash"))
return false;
#endif
// Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
// XStandard (bug 430219), CMISS Zinc (bug 429604).
if (aDelayedStop

View File

@ -289,7 +289,7 @@ nsXMLHttpRequest::nsXMLHttpRequest()
mProgressSinceLastProgressEvent(false),
mRequestSentTime(0), mTimeoutMilliseconds(0),
mErrorLoad(false), mWaitingForOnStopRequest(false),
mProgressTimerIsActive(false), mProgressEventWasDelayed(false),
mProgressTimerIsActive(false),
mIsHtml(false),
mWarnAboutSyncHtml(false),
mLoadLengthComputable(false), mLoadTotal(0),
@ -3752,7 +3752,6 @@ nsXMLHttpRequest::StartProgressEventTimer()
mProgressNotifier = do_CreateInstance(NS_TIMER_CONTRACTID);
}
if (mProgressNotifier) {
mProgressEventWasDelayed = false;
mProgressTimerIsActive = true;
mProgressNotifier->Cancel();
mProgressNotifier->InitWithCallback(this, NS_PROGRESS_EVENT_INTERVAL,

View File

@ -673,7 +673,6 @@ protected:
bool mErrorLoad;
bool mWaitingForOnStopRequest;
bool mProgressTimerIsActive;
bool mProgressEventWasDelayed;
bool mIsHtml;
bool mWarnAboutMultipartHtml;
bool mWarnAboutSyncHtml;

View File

@ -552,6 +552,9 @@ MOCHITEST_FILES_C= \
test_bug708620.html \
file_bug708620.html \
file_bug708620-2.html \
test_XHR_timeout.html \
test_XHR_timeout.js \
file_XHR_timeout.sjs \
test_bug717511.html \
file_bug717511.html \
file_bug717511.html^headers^ \
@ -701,11 +704,6 @@ MOCHITEST_FILES_PARTS = $(foreach s,A B C,MOCHITEST_FILES_$(s))
# test_bug503473.html \
# file_bug503473-frame.sjs \
# Disabled for frequent failures (bug 841505, bug 842344, etc)
# test_XHR_timeout.html \
# test_XHR_timeout.js \
# file_XHR_timeout.sjs \
MOCHITEST_BROWSER_FILES = \
browser_bug593387.js \
browser_bug902350.js \

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