Merge latest green b2g-inbound changeset and mozilla-central

This commit is contained in:
Ed Morley 2013-09-12 12:05:20 +01:00
commit ca0c65b1d0
244 changed files with 3458 additions and 2825 deletions

View File

@ -27,6 +27,7 @@
#include "mozilla/Util.h"
#include "nsXPCOMStrings.h"
#include "nsComponentManagerUtils.h"
#include "nsIPersistentProperties2.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -10,6 +10,7 @@
#include "ImageAccessible.h"
#include "mozilla/Likely.h"
#include "nsMai.h"
#include "nsIAccessibleTypes.h"
#include "nsIURI.h"
using namespace mozilla;

View File

@ -10,6 +10,7 @@
#include "HyperTextAccessible.h"
#include "nsMai.h"
#include "nsIAccessibleTypes.h"
#include "nsIPersistentProperties2.h"
#include "mozilla/Likely.h"

View File

@ -7,7 +7,6 @@
#include "ARIAMap.h"
#include "Accessible.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "Role.h"

View File

@ -6,19 +6,12 @@
#include "AccEvent.h"
#include "ApplicationAccessibleWrap.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "DocAccessible.h"
#include "nsIAccessibleText.h"
#include "xpcAccEvents.h"
#include "States.h"
#include "nsEventStateManager.h"
#include "nsIServiceManager.h"
#ifdef MOZ_XUL
#include "nsIDOMXULMultSelectCntrlEl.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AccGroupInfo.h"
#include "nsAccUtils.h"
#include "Role.h"
#include "States.h"

View File

@ -6,7 +6,6 @@
#define AccGroupInfo_h_
#include "Accessible-inl.h"
#include "nsAccUtils.h"
namespace mozilla {
namespace a11y {

View File

@ -4,15 +4,12 @@
#include "AccIterator.h"
#include "nsAccessibilityService.h"
#include "AccGroupInfo.h"
#include "Accessible-inl.h"
#ifdef MOZ_XUL
#include "XULTreeAccessible.h"
#endif
#include "mozilla/dom/Element.h"
#include "nsBindingManager.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -9,7 +9,8 @@
#include "DocAccessible.h"
#include "Filters.h"
#include "nsAccessibilityService.h"
class nsITreeView;
namespace mozilla {
namespace a11y {

View File

@ -29,7 +29,6 @@ enum AccType {
eHTMLGroupboxType,
eHTMLHRType,
eHTMLImageMapType,
eHTMLLabelType,
eHTMLLiType,
eHTMLSelectListType,
eHTMLMediaType,

View File

@ -5,14 +5,11 @@
#include "DocManager.h"
#include "Accessible-inl.h"
#include "ApplicationAccessible.h"
#include "ARIAMap.h"
#include "DocAccessible-inl.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "RootAccessibleWrap.h"
#include "States.h"
#ifdef A11Y_LOG
#include "Logging.h"
@ -22,13 +19,14 @@
#include "nsDocShellLoadTypes.h"
#include "nsDOMEvent.h"
#include "nsIChannel.h"
#include "nsIContentViewer.h"
#include "nsIDOMDocument.h"
#include "nsEventListenerManager.h"
#include "nsIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebNavigation.h"
#include "nsServiceManagerUtils.h"
#include "nsIWebProgress.h"
#include "nsCoreUtils.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -8,7 +8,6 @@
#include "nsIDocument.h"
#include "nsIDOMEventListener.h"
#include "nsRefPtrHashtable.h"
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"
#include "nsIPresShell.h"

View File

@ -6,8 +6,12 @@
#include "EventQueue.h"
#include "Accessible-inl.h"
#include "DocAccessible-inl.h"
#include "nsEventShell.h"
#include "DocAccessible.h"
#include "nsAccessibilityService.h"
#ifdef A11Y_LOG
#include "Logging.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -8,8 +8,6 @@
#include "AccEvent.h"
class nsIContent;
namespace mozilla {
namespace a11y {

View File

@ -10,10 +10,10 @@
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "Role.h"
#include "RootAccessible.h"
#include "nsEventStateManager.h"
#include "nsFocusManager.h"
#include "mozilla/dom/Element.h"
namespace dom = mozilla::dom;
using namespace mozilla::a11y;

View File

@ -6,7 +6,10 @@
#define mozilla_a11y_FocusManager_h_
#include "nsAutoPtr.h"
#include "mozilla/dom/Element.h"
class nsINode;
class nsIDocument;
class nsISupports;
namespace mozilla {
namespace a11y {

View File

@ -22,6 +22,7 @@
#include "prenv.h"
#include "nsIDocShellTreeItem.h"
#include "nsIURI.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -8,12 +8,13 @@
#define mozilla_a11y_logs_h__
#include "nscore.h"
#include "nsAString.h"
#include "nsStringFwd.h"
class nsIDocument;
class nsINode;
class nsIRequest;
class nsISelection;
class nsISupports;
class nsIWebProgress;
namespace mozilla {

View File

@ -5,7 +5,6 @@
#include "NotificationController.h"
#include "Accessible-inl.h"
#include "DocAccessible-inl.h"
#include "TextLeafAccessible.h"
#include "TextUpdater.h"

View File

@ -15,12 +15,9 @@
#include "Logging.h"
#endif
class nsIContent;
namespace mozilla {
namespace a11y {
class Accessible;
class DocAccessible;
/**

View File

@ -7,8 +7,6 @@
#include "nsIAccessibleRole.h"
#include "Role.h"
#include "mozilla/Assertions.h"
using namespace mozilla::a11y;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \

View File

@ -10,17 +10,15 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleEvent.h"
#include "RootAccessible.h"
#include "nsCaret.h"
#include "nsIAccessibleTypes.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsISelectionPrivate.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -6,15 +6,14 @@
#include "TextAttrs.h"
#include "Accessible-inl.h"
#include "HyperTextAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "StyleInfo.h"
#include "gfxFont.h"
#include "gfxUserFontSet.h"
#include "nsFontMetrics.h"
#include "nsLayoutUtils.h"
#include "HyperTextAccessible.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -6,7 +6,7 @@
#ifndef mozilla_a11y_TreeWalker_h_
#define mozilla_a11y_TreeWalker_h_
#include "nsAutoPtr.h"
#include <stdint.h>
class nsIContent;

View File

@ -15,13 +15,10 @@
#include "Role.h"
#include "States.h"
#include "TextLeafAccessible.h"
#include "nsIMutableArray.h"
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsWhitespaceTokenizer.h"
#include "nsComponentManagerUtils.h"
#include "nsIPersistentProperties2.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -7,23 +7,21 @@
#define nsAccUtils_h_
#include "mozilla/a11y/Accessible.h"
#include "nsIAccessibleText.h"
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
#include "mozilla/dom/Element.h"
#include "nsIDocShell.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsPoint.h"
struct nsRoleMapEntry;
namespace mozilla {
namespace dom {
class Element;
}
namespace a11y {
class Accessible;
class HyperTextAccessible;
class DocAccessible;

View File

@ -5,20 +5,11 @@
#include "nsAccessNode.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "RootAccessible.h"
#include "nsIDocShell.h"
#include "nsIDOMWindow.h"
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsFocusManager.h"
#include "nsPresContext.h"
#include "mozilla/Services.h"
using namespace mozilla::a11y;

View File

@ -10,14 +10,10 @@
#ifndef _nsAccessNode_H_
#define _nsAccessNode_H_
#include "nsIAccessibleTypes.h"
#include "nsINode.h"
class nsIContent;
class nsIDocShellTreeItem;
class nsIFrame;
class nsIPresShell;
class nsPresContext;
namespace mozilla {
namespace a11y {

View File

@ -6,7 +6,6 @@
#include "nsAccessibilityService.h"
// NOTE: alphabetically ordered
#include "Accessible-inl.h"
#include "ApplicationAccessibleWrap.h"
#include "ARIAGridAccessibleWrap.h"
#include "ARIAMap.h"
@ -20,13 +19,18 @@
#include "HTMLSelectAccessible.h"
#include "HTMLTableAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "RootAccessible.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
#include "nsAttrName.h"
#include "nsEventShell.h"
#include "nsIURI.h"
#include "OuterDocAccessible.h"
#include "Platform.h"
#include "Role.h"
#ifdef MOZ_ACCESSIBILITY_ATK
#include "RootAccessibleWrap.h"
#endif
#include "States.h"
#include "Statistics.h"
#include "TextLeafAccessibleWrap.h"
@ -38,6 +42,7 @@
#ifdef XP_WIN
#include "mozilla/a11y/Compatibility.h"
#include "HTMLWin32ObjectAccessible.h"
#include "mozilla/StaticPtr.h"
#endif
#ifdef A11Y_LOG
@ -48,25 +53,18 @@
#include "nsExceptionHandler.h"
#endif
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMXULElement.h"
#include "nsImageFrame.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
#include "nsNPAPIPluginInstance.h"
#include "nsObjectFrame.h"
#include "nsSVGPathGeometryFrame.h"
#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"
#include "mozilla/StaticPtr.h"
#include "mozilla/Util.h"
#include "nsDeckFrame.h"
@ -83,6 +81,10 @@
#include "XULTreeGridAccessibleWrap.h"
#endif
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
#include "nsNPAPIPluginInstance.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;
@ -1433,6 +1435,12 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
return accessible.forget();
}
if (tag == nsGkAtoms::label) {
nsRefPtr<Accessible> accessible =
new HTMLLabelAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::output) {
nsRefPtr<Accessible> accessible =
new HTMLOutputAccessible(aContent, document);
@ -1492,9 +1500,6 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
case eHTMLImageMapType:
newAcc = new HTMLImageMapAccessible(aContent, document);
break;
case eHTMLLabelType:
newAcc = new HTMLLabelAccessible(aContent, document);
break;
case eHTMLLiType:
if (aContext->IsList() &&
aContext->GetContent() == aContent->GetParent()) {

View File

@ -6,15 +6,10 @@
#include "nsAccessiblePivot.h"
#include "DocAccessible.h"
#include "HyperTextAccessible.h"
#include "nsAccUtils.h"
#include "States.h"
#include "nsArrayUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsISupportsPrimitives.h"
using namespace mozilla::a11y;

View File

@ -15,7 +15,6 @@
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
class nsIAccessibleTraversalRule;
class RuleCache;
/**

View File

@ -7,8 +7,6 @@
#include "nsIAccessibleTypes.h"
#include "nsAccessNode.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
@ -16,10 +14,9 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsRange.h"
#include "nsIDOMWindow.h"
#include "nsIBoxObject.h"
#include "nsIDOMXULElement.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsEventListenerManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
@ -27,16 +24,12 @@
#include "nsEventStateManager.h"
#include "nsISelectionPrivate.h"
#include "nsISelectionController.h"
#include "nsPIDOMWindow.h"
#include "nsGUIEvent.h"
#include "nsView.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "nsDOMTouchEvent.h"
#include "nsComponentManagerUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/dom/Element.h"
#include "nsITreeBoxObject.h"
#include "nsITreeColumns.h"

View File

@ -7,7 +7,6 @@
#define nsCoreUtils_h_
#include "nsIContent.h"
#include "nsIBoxObject.h"
#include "nsIPresShell.h"
#include "nsIDOMDOMStringList.h"
@ -15,6 +14,7 @@
#include "nsTArray.h"
class nsRange;
class nsIBoxObject;
class nsIFrame;
class nsIDocShell;
class nsITreeColumn;

View File

@ -9,14 +9,9 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsStyleStructInlines.h"
#include "nsCoreUtils.h"
#include "nsIDOMXULLabeledControlEl.h"
#include "nsArrayUtils.h"
using namespace mozilla::a11y;
/**

View File

@ -9,7 +9,6 @@
#define _nsTextEquivUtils_H_
#include "Accessible.h"
#include "nsIStringBundle.h"
#include "Role.h"
class nsIContent;

View File

@ -12,6 +12,7 @@
#include "States.h"
#include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h"
#include "nsComponentManagerUtils.h"
using namespace mozilla;

View File

@ -11,6 +11,7 @@
#include "nsAccessibilityService.h"
#include "NotificationController.h"
#include "States.h"
#include "nsIScrollableFrame.h"
#ifdef A11Y_LOG
#include "Logging.h"

View File

@ -32,6 +32,7 @@
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsINameSpaceManager.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsViewManager.h"

View File

@ -25,6 +25,7 @@
#include "nsFrameSelection.h"
#include "nsILineIterator.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPersistentProperties2.h"
#include "nsIPlaintextEditor.h"
#include "nsIScrollableFrame.h"
#include "nsIServiceManager.h"

View File

@ -18,6 +18,7 @@
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIPersistentProperties2.h"
#include "nsPIDOMWindow.h"
#include "nsIURI.h"

View File

@ -8,6 +8,7 @@
#include "DocAccessible.h"
#include "nsAccUtils.h"
#include "nsIAccessibleRelation.h"
#include "nsIPersistentProperties2.h"
#include "nsTextEquivUtils.h"
#include "Relation.h"
#include "Role.h"

View File

@ -23,6 +23,7 @@
#include "nsIEditor.h"
#include "nsIFormControl.h"
#include "nsINameSpaceManager.h"
#include "nsIPersistentProperties2.h"
#include "nsISelectionController.h"
#include "jsapi.h"
#include "nsIServiceManager.h"

View File

@ -28,6 +28,7 @@
#include "nsIDOMHTMLCollection.h"
#include "nsIDocument.h"
#include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsITableCellLayout.h"
#include "nsFrameSelection.h"

View File

@ -13,6 +13,7 @@
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleEditableText.h"
#include "nsIPersistentProperties2.h"
#include "Relation.h"
#include "Role.h"
#include "RootAccessible.h"

View File

@ -6,6 +6,7 @@
#include "Accessible-inl.h"
#include "AccessibleWrap.h"
#include "TextLeafAccessible.h"
#include "nsIAccessibleTypes.h"
#include "nsCocoaUtils.h"
#include "nsObjCExceptions.h"

View File

@ -13,6 +13,7 @@
#include "HyperTextAccessibleWrap.h"
#include "nsIPersistentProperties2.h"
#include "nsIAccessibleTypes.h"
using namespace mozilla::a11y;

View File

@ -42,6 +42,8 @@
#include "AccessibleRole.h"
#include "AccessibleStates.h"
#include "oleacc.h"
#include "nsIAccessibleTypes.h"
#include "nsIPersistentProperties2.h"
using namespace mozilla;
using namespace mozilla::a11y;

View File

@ -11,6 +11,7 @@
#include "nsAttrName.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleTypes.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsServiceManagerUtils.h"

View File

@ -16,6 +16,7 @@
#include "nsPresContext.h"
#include "nsLayoutUtils.h"
#include "gfxFont.h"
#include "nsIAccessibleTypes.h"
using namespace mozilla::a11y;

View File

@ -28,6 +28,7 @@
#include "nsINameSpaceManager.h"
#include "nsITextControlFrame.h"
#include "nsMenuPopupFrame.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;

View File

@ -21,6 +21,7 @@
#include "nsIDOMXULPopupElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h"
using namespace mozilla::a11y;

View File

@ -10,6 +10,7 @@
#include "States.h"
#include "nsIFrame.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;

View File

@ -21,6 +21,7 @@
#include "nsIAccessibleRelation.h"
#include "nsIAutoCompleteInput.h"
#include "nsIAutoCompletePopup.h"
#include "nsIBoxObject.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"

View File

@ -14,7 +14,9 @@
#include "Role.h"
#include "States.h"
#include "nsIBoxObject.h"
#include "nsIMutableArray.h"
#include "nsIPersistentProperties2.h"
#include "nsITreeSelection.h"
#include "nsComponentManagerUtils.h"

View File

@ -73,7 +73,7 @@ pref("mozilla.widget.force-24bpp", true);
pref("mozilla.widget.use-buffer-pixmap", true);
pref("mozilla.widget.disable-native-theme", true);
pref("layout.reflow.synthMouseMove", false);
pref("layers.force-tiles", false);
pref("layers.force-tiles", true);
/* download manager (don't show the window or alert) */
pref("browser.download.useDownloadDir", true);

View File

@ -38,8 +38,7 @@ const EXPECTED_REFLOWS = [
"TabItem__reconnect@chrome://browser/content/tabview.js|" +
"TabItem@chrome://browser/content/tabview.js|" +
"TabItems_link@chrome://browser/content/tabview.js|" +
"@chrome://browser/content/tabview.js|" +
"addTab@chrome://browser/content/tabbrowser.xml|",
"@chrome://browser/content/tabview.js|",
// SessionStore.getWindowDimensions()
"ssi_getWindowDimension@resource:///modules/sessionstore/SessionStore.jsm|" +
@ -88,6 +87,7 @@ let observer = {
let path = (new Error().stack).split("\n").slice(1).map(line => {
return line.replace(/:\d+$/, "");
}).join("|");
let pathWithLineNumbers = (new Error().stack).split("\n").slice(1).join("|");
// Stack trace is empty. Reflow was triggered by native code.
if (path === "") {
@ -102,7 +102,7 @@ let observer = {
}
}
ok(false, "unexpected uninterruptible reflow '" + path + "'");
ok(false, "unexpected uninterruptible reflow '" + pathWithLineNumbers + "'");
},
reflowInterruptible: function (start, end) {

View File

@ -369,6 +369,13 @@ WebContentConverterRegistrar.prototype = {
function WCCR_registerProtocolHandler(aProtocol, aURIString, aTitle, aContentWindow) {
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
var uri = this._checkAndGetURI(aURIString, aContentWindow);
// If the protocol handler is already registered, just return early.
if (this._protocolHandlerRegistered(aProtocol, uri.spec)) {
return;
}
var browserWindow = this._getBrowserWindowForContentWindow(aContentWindow);
if (PrivateBrowsingUtils.isWindowPrivate(browserWindow)) {
// Inside the private browsing mode, we don't want to alert the user to save
@ -406,25 +413,18 @@ WebContentConverterRegistrar.prototype = {
throw("Not allowed to register a protocol handler for " + aProtocol);
}
var uri = this._checkAndGetURI(aURIString, aContentWindow);
// Now Ask the user and provide the proper callback
var message = this._getFormattedString("addProtocolHandler",
[aTitle, uri.host, aProtocol]);
var buttons, message;
if (this._protocolHandlerRegistered(aProtocol, uri.spec))
message = this._getFormattedString("protocolHandlerRegistered",
[aTitle, aProtocol]);
else {
// Now Ask the user and provide the proper callback
message = this._getFormattedString("addProtocolHandler",
[aTitle, uri.host, aProtocol]);
var notificationIcon = uri.prePath + "/favicon.ico";
var notificationValue = "Protocol Registration: " + aProtocol;
var addButton = {
label: this._getString("addProtocolHandlerAddButton"),
accessKey: this._getString("addHandlerAddButtonAccesskey"),
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
var notificationIcon = uri.prePath + "/favicon.ico";
var notificationValue = "Protocol Registration: " + aProtocol;
var addButton = {
label: this._getString("addProtocolHandlerAddButton"),
accessKey: this._getString("addHandlerAddButtonAccesskey"),
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
callback:
callback:
function WCCR_addProtocolHandlerButtonCallback(aNotification, aButtonInfo) {
var protocol = aButtonInfo.protocolInfo.protocol;
var uri = aButtonInfo.protocolInfo.uri;
@ -450,11 +450,8 @@ WebContentConverterRegistrar.prototype = {
getService(Ci.nsIHandlerService);
hs.store(handlerInfo);
}
};
buttons = [addButton];
}
};
var buttons;
var browserElement = this._getBrowserForContentWindow(browserWindow, aContentWindow);
var notificationBox = browserWindow.getBrowser().getNotificationBox(browserElement);
notificationBox.appendNotification(message,

View File

@ -28,6 +28,9 @@ function test() {
is(newBrowser.contentWindow.scrollY, 1200, "still scrolled vertically");
gBrowser.removeTab(newTab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
finish();
}, true);

View File

@ -24,17 +24,24 @@ function test() {
tabState.entries[0].referrer = REFERRER2;
ss.setTabState(tab, JSON.stringify(tabState));
tab.addEventListener("SSTabRestored", function() {
tab.addEventListener("SSTabRestored", function(e) {
tab.removeEventListener("SSTabRestored", arguments.callee, true);
is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState.");
gBrowser.removeTab(tab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
let newTab = ss.undoCloseTab(window, 0);
newTab.addEventListener("SSTabRestored", function() {
newTab.addEventListener("SSTabRestored", function(e) {
newTab.removeEventListener("SSTabRestored", arguments.callee, true);
is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab.");
gBrowser.removeTab(newTab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
finish();
}, true);

View File

@ -98,6 +98,9 @@ function testTabRestoreData(aFormData, aExpectedValues, aCallback) {
// clean up
gBrowser.removeTab(tab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
aEvent.stopPropagation();
aCallback();
});

View File

@ -49,5 +49,3 @@ feedSubscriptionVideoPodcast2=You can subscribe to this video podcast to receive
# "Add %appName (%appDomain) as an application for %protocolType links?"
addProtocolHandler=Add %S (%S) as an application for %S links?
addProtocolHandlerAddButton=Add Application
# "%appName has already been added as an application for %protocolType links."
protocolHandlerRegistered=%S has already been added as an application for %S links.

View File

@ -372,6 +372,9 @@ def parsefile(pathname):
pathname = os.path.realpath(pathname)
return _parsecache.get(pathname)
# colon followed by anything except a slash (Windows path detection)
_depfilesplitter = re.compile(r':(?![\\/])')
def parsedepfile(pathname):
"""
Parse a filename listing only depencencies into a parserdata.StatementList.
@ -394,7 +397,7 @@ def parsedepfile(pathname):
pathname = os.path.realpath(pathname)
stmts = parserdata.StatementList()
for line in continuation_iter(open(pathname).readlines()):
target, deps = line.split(":", 1)
target, deps = _depfilesplitter.split(line, 1)
stmts.append(parserdata.Rule(data.StringExpansion(target, None),
data.StringExpansion(deps, None), False))
return stmts

View File

@ -54,11 +54,11 @@ ifndef EXTERNALLY_MANAGED_MAKE_FILE
# scenarios.
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $($(var)),\
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
))
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $($(var)),\
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
))

View File

@ -46,6 +46,7 @@ class nsIURI;
class nsNodeSupportsWeakRefTearoff;
class nsNodeWeakReference;
class nsXPCClassInfo;
class nsDOMMutationObserver;
namespace mozilla {
namespace dom {
@ -1474,6 +1475,8 @@ public:
// aObject alive anymore.
void UnbindObject(nsISupports* aObject);
void GetBoundMutationObservers(nsTArray<nsRefPtr<nsDOMMutationObserver> >& aResult);
/**
* Returns the length of this node, as specified at
* <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-length>

View File

@ -66,7 +66,6 @@ NS_IMPL_RELEASE(nsMutationReceiver)
NS_INTERFACE_MAP_BEGIN(nsMutationReceiver)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY(nsMutationReceiver)
NS_INTERFACE_MAP_END
nsMutationReceiver::nsMutationReceiver(nsINode* aTarget,
@ -321,6 +320,7 @@ void nsMutationReceiver::NodeWillBeDestroyed(const nsINode *aNode)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMMutationObserver)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsDOMMutationObserver)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMMutationObserver)
@ -525,6 +525,32 @@ nsDOMMutationObserver::TakeRecords(
mPendingMutations.SwapElements(aRetVal);
}
void
nsDOMMutationObserver::GetObservingInfo(nsTArray<Nullable<MutationObservingInfoInitializer> >& aResult)
{
aResult.SetCapacity(mReceivers.Count());
for (int32_t i = 0; i < mReceivers.Count(); ++i) {
MutationObservingInfoInitializer& info = aResult.AppendElement()->SetValue();
nsMutationReceiver* mr = mReceivers[i];
info.mChildList = mr->ChildList();
info.mAttributes = mr->Attributes();
info.mCharacterData = mr->CharacterData();
info.mSubtree = mr->Subtree();
info.mAttributeOldValue = mr->AttributeOldValue();
info.mCharacterDataOldValue = mr->CharacterDataOldValue();
nsCOMArray<nsIAtom>& filters = mr->AttributeFilter();
if (filters.Count()) {
info.mAttributeFilter.Construct();
mozilla::dom::Sequence<nsString>& filtersAsStrings =
info.mAttributeFilter.Value();
for (int32_t j = 0; j < filters.Count(); ++j) {
filtersAsStrings.AppendElement(nsDependentAtomString(filters[j]));
}
}
info.mObservedNode = mr->Target();
}
}
// static
already_AddRefed<nsDOMMutationObserver>
nsDOMMutationObserver::Constructor(const mozilla::dom::GlobalObject& aGlobal,

View File

@ -25,6 +25,7 @@
#include "mozilla/dom/MutationObserverBinding.h"
class nsDOMMutationObserver;
using mozilla::dom::MutationObservingInfoInitializer;
class nsDOMMutationRecord : public nsISupports,
public nsWrapperCache
@ -267,10 +268,6 @@ private:
};
#define NS_MUTATION_OBSERVER_IID \
{ 0xe628f313, 0x8129, 0x4f90, \
{ 0x8e, 0xc3, 0x85, 0xe8, 0x28, 0x22, 0xe7, 0xab } }
class nsMutationReceiver : public nsMutationReceiverBase
{
public:
@ -315,7 +312,6 @@ public:
void Disconnect(bool aRemoveFromObserver);
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMUTATION_OBSERVER_IID)
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_ISUPPORTS
@ -337,7 +333,9 @@ public:
}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsMutationReceiver, NS_MUTATION_OBSERVER_IID)
#define NS_DOM_MUTATION_OBSERVER_IID \
{ 0x0c3b91f8, 0xcc3b, 0x4b08, \
{ 0x9e, 0xab, 0x07, 0x47, 0xa9, 0xe4, 0x65, 0xb4 } }
class nsDOMMutationObserver : public nsISupports,
public nsWrapperCache
@ -352,6 +350,7 @@ public:
virtual ~nsDOMMutationObserver();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMMutationObserver)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_MUTATION_OBSERVER_IID)
static already_AddRefed<nsDOMMutationObserver>
Constructor(const mozilla::dom::GlobalObject& aGlobal,
@ -379,6 +378,10 @@ public:
void HandleMutation();
void GetObservingInfo(nsTArray<Nullable<MutationObservingInfoInitializer> >& aResult);
mozilla::dom::MutationCallback* MutationCallback() { return mCallback; }
// static methods
static void HandleMutations()
{
@ -445,6 +448,8 @@ protected:
sCurrentlyHandlingObservers;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMMutationObserver, NS_DOM_MUTATION_OBSERVER_IID)
class nsAutoMutationBatch
{
public:

View File

@ -103,6 +103,7 @@
#include <algorithm>
#include "nsDOMEvent.h"
#include "nsGlobalWindow.h"
#include "nsDOMMutationObserver.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2144,6 +2145,22 @@ nsINode::UnbindObject(nsISupports* aObject)
}
}
void
nsINode::GetBoundMutationObservers(nsTArray<nsRefPtr<nsDOMMutationObserver> >& aResult)
{
nsCOMArray<nsISupports>* objects =
static_cast<nsCOMArray<nsISupports>*>(GetProperty(nsGkAtoms::keepobjectsalive));
if (objects) {
for (int32_t i = 0; i < objects->Count(); ++i) {
nsCOMPtr<nsDOMMutationObserver> mo = do_QueryInterface(objects->ObjectAt(i));
if (mo) {
MOZ_ASSERT(!aResult.Contains(mo));
aResult.AppendElement(mo.forget());
}
}
}
}
size_t
nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{

View File

@ -17,6 +17,7 @@
#include "mozilla/dom/Element.h"
#include "nsGkAtoms.h"
#include "nsNetUtil.h"
#include "nsIJSRuntimeService.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
@ -98,6 +99,7 @@ public:
uint32_t mJSVersion;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIPrincipal> mOriginPrincipal;
nsAutoCString mURL; // Keep the URI's filename alive during off thread parsing.
int32_t mLineNo;
const CORSMode mCORSMode;
};
@ -691,12 +693,122 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
return ProcessRequest(request) == NS_ERROR_HTMLPARSER_BLOCK;
}
namespace {
class NotifyOffThreadScriptLoadCompletedRunnable : public nsRunnable
{
nsRefPtr<nsScriptLoader> mLoader;
void *mToken;
public:
NotifyOffThreadScriptLoadCompletedRunnable(already_AddRefed<nsScriptLoader> aLoader,
void *aToken)
: mLoader(aLoader), mToken(aToken)
{}
NS_DECL_NSIRUNNABLE
};
} /* anonymous namespace */
nsresult
nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
nsScriptLoader::ProcessOffThreadRequest(void **aOffThreadToken)
{
nsCOMPtr<nsScriptLoadRequest> request = mOffThreadScriptRequest;
mOffThreadScriptRequest = nullptr;
mDocument->UnblockOnload(false);
return ProcessRequest(request, aOffThreadToken);
}
NS_IMETHODIMP
NotifyOffThreadScriptLoadCompletedRunnable::Run()
{
MOZ_ASSERT(NS_IsMainThread());
nsresult rv = mLoader->ProcessOffThreadRequest(&mToken);
if (mToken) {
// The result of the off thread parse was not actually needed to process
// the request (disappearing window, some other error, ...). Finish the
// request to avoid leaks in the JS engine.
nsCOMPtr<nsIJSRuntimeService> svc = do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
NS_ENSURE_TRUE(svc, NS_ERROR_FAILURE);
JSRuntime *rt;
svc->GetRuntime(&rt);
NS_ENSURE_TRUE(rt, NS_ERROR_FAILURE);
JS::FinishOffThreadScript(nullptr, rt, mToken);
}
return rv;
}
static void
OffThreadScriptLoaderCallback(void *aToken, void *aCallbackData)
{
// Be careful not to adjust the refcount on the loader, as this callback
// may be invoked off the main thread.
nsScriptLoader* aLoader = static_cast<nsScriptLoader*>(aCallbackData);
nsRefPtr<NotifyOffThreadScriptLoadCompletedRunnable> notify =
new NotifyOffThreadScriptLoadCompletedRunnable(
already_AddRefed<nsScriptLoader>(aLoader), aToken);
NS_DispatchToMainThread(notify);
}
nsresult
nsScriptLoader::AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest)
{
if (!aRequest->mElement->GetScriptAsync() || aRequest->mIsInline) {
return NS_ERROR_FAILURE;
}
if (mOffThreadScriptRequest) {
return NS_ERROR_FAILURE;
}
JSObject *unrootedGlobal;
nsCOMPtr<nsIScriptContext> context = GetScriptContext(&unrootedGlobal);
if (!context) {
return NS_ERROR_FAILURE;
}
AutoPushJSContext cx(context->GetNativeContext());
JS::Rooted<JSObject*> global(cx, unrootedGlobal);
JS::CompileOptions options(cx);
FillCompileOptionsForRequest(aRequest, &options);
if (!JS::CanCompileOffThread(cx, options)) {
return NS_ERROR_FAILURE;
}
mOffThreadScriptRequest = aRequest;
if (!JS::CompileOffThread(cx, global, options,
aRequest->mScriptText.get(), aRequest->mScriptText.Length(),
OffThreadScriptLoaderCallback,
static_cast<void*>(this))) {
return NS_ERROR_OUT_OF_MEMORY;
}
// This reference will be consumed by the NotifyOffThreadScriptLoadCompletedRunnable.
NS_ADDREF(this);
mDocument->BlockOnload();
return NS_OK;
}
nsresult
nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest, void **aOffThreadToken)
{
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
"Processing requests when running scripts is unsafe.");
if (!aOffThreadToken) {
nsresult rv = AttemptAsyncScriptParse(aRequest);
if (rv != NS_ERROR_FAILURE)
return rv;
}
NS_ENSURE_ARG(aRequest);
nsAFlatString* script;
nsAutoString textData;
@ -751,7 +863,7 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
doc->BeginEvaluatingExternalScript();
}
aRequest->mElement->BeginEvaluating();
rv = EvaluateScript(aRequest, *script);
rv = EvaluateScript(aRequest, *script, aOffThreadToken);
aRequest->mElement->EndEvaluating();
if (doc) {
doc->EndEvaluatingExternalScript();
@ -799,9 +911,44 @@ nsScriptLoader::FireScriptEvaluated(nsresult aResult,
aRequest->FireScriptEvaluated(aResult);
}
nsIScriptContext *
nsScriptLoader::GetScriptContext(JSObject **aGlobal)
{
nsPIDOMWindow *pwin = mDocument->GetInnerWindow();
NS_ASSERTION(pwin, "shouldn't be called with a null inner window");
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(pwin);
NS_ASSERTION(globalObject, "windows must be global objects");
// and make sure we are setup for this type of script.
nsresult rv = globalObject->EnsureScriptEnvironment();
if (NS_FAILED(rv)) {
return nullptr;
}
*aGlobal = globalObject->GetGlobalJSObject();
return globalObject->GetScriptContext();
}
void
nsScriptLoader::FillCompileOptionsForRequest(nsScriptLoadRequest *aRequest,
JS::CompileOptions *aOptions)
{
// It's very important to use aRequest->mURI, not the final URI of the channel
// aRequest ended up getting script data from, as the script filename.
nsContentUtils::GetWrapperSafeScriptFilename(mDocument, aRequest->mURI, aRequest->mURL);
aOptions->setFileAndLine(aRequest->mURL.get(), aRequest->mLineNo);
aOptions->setVersion(JSVersion(aRequest->mJSVersion));
if (aRequest->mOriginPrincipal) {
aOptions->setOriginPrincipals(nsJSPrincipals::get(aRequest->mOriginPrincipal));
}
}
nsresult
nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
const nsAFlatString& aScript)
const nsAFlatString& aScript,
void** aOffThreadToken)
{
nsresult rv = NS_OK;
@ -817,28 +964,19 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
return NS_ERROR_FAILURE;
}
nsPIDOMWindow *pwin = mDocument->GetInnerWindow();
NS_ASSERTION(pwin, "shouldn't be called with a null inner window");
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(pwin);
NS_ASSERTION(globalObject, "windows must be global objects");
// Get the script-type to be used by this element.
NS_ASSERTION(scriptContent, "no content - what is default script-type?");
// and make sure we are setup for this type of script.
rv = globalObject->EnsureScriptEnvironment();
if (NS_FAILED(rv))
return rv;
// Make sure context is a strong reference since we access it after
// we've executed a script, which may cause all other references to
// the context to go away.
nsCOMPtr<nsIScriptContext> context = globalObject->GetScriptContext();
JSObject *unrootedGlobal;
nsCOMPtr<nsIScriptContext> context = GetScriptContext(&unrootedGlobal);
if (!context) {
return NS_ERROR_FAILURE;
}
AutoPushJSContext cx(context->GetNativeContext());
JS::Rooted<JSObject*> global(cx, unrootedGlobal);
bool oldProcessingScriptTag = context->GetProcessingScriptTag();
context->SetProcessingScriptTag(true);
@ -847,22 +985,13 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
nsCOMPtr<nsIScriptElement> oldCurrent = mCurrentScript;
mCurrentScript = aRequest->mElement;
// It's very important to use aRequest->mURI, not the final URI of the channel
// aRequest ended up getting script data from, as the script filename.
nsAutoCString url;
nsContentUtils::GetWrapperSafeScriptFilename(mDocument, aRequest->mURI, url);
JSVersion version = JSVersion(aRequest->mJSVersion);
if (version != JSVERSION_UNKNOWN) {
JS::CompileOptions options(cx);
options.setFileAndLine(url.get(), aRequest->mLineNo)
.setVersion(JSVersion(aRequest->mJSVersion));
if (aRequest->mOriginPrincipal) {
options.setOriginPrincipals(nsJSPrincipals::get(aRequest->mOriginPrincipal));
}
JS::Rooted<JSObject*> global(cx, globalObject->GetGlobalJSObject());
FillCompileOptionsForRequest(aRequest, &options);
rv = context->EvaluateString(aScript, global,
options, /* aCoerceToString = */ false, nullptr);
options, /* aCoerceToString = */ false, nullptr,
aOffThreadToken);
}
// Put the old script back in case it wants to do anything else.

View File

@ -207,6 +207,12 @@ public:
const nsAString &aCrossOrigin,
bool aScriptFromHead);
/**
* Process a request that was deferred so that the script could be compiled
* off thread.
*/
nsresult ProcessOffThreadRequest(void **aOffThreadToken);
private:
/**
* Unblocks the creator parser of the parser-blocking scripts.
@ -261,14 +267,21 @@ private:
bool AddPendingChildLoader(nsScriptLoader* aChild) {
return mPendingChildLoaders.AppendElement(aChild) != nullptr;
}
nsresult ProcessRequest(nsScriptLoadRequest* aRequest);
nsresult AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest);
nsresult ProcessRequest(nsScriptLoadRequest* aRequest,
void **aOffThreadToken = nullptr);
void FireScriptAvailable(nsresult aResult,
nsScriptLoadRequest* aRequest);
void FireScriptEvaluated(nsresult aResult,
nsScriptLoadRequest* aRequest);
nsresult EvaluateScript(nsScriptLoadRequest* aRequest,
const nsAFlatString& aScript);
const nsAFlatString& aScript,
void **aOffThreadToken);
nsIScriptContext *GetScriptContext(JSObject **aGlobal);
void FillCompileOptionsForRequest(nsScriptLoadRequest *aRequest,
JS::CompileOptions *aOptions);
nsresult PrepareLoadedRequest(nsScriptLoadRequest* aRequest,
nsIStreamLoader* aLoader,
@ -302,6 +315,7 @@ private:
};
nsTArray<PreloadInfo> mPreloads;
nsCOMPtr<nsScriptLoadRequest> mOffThreadScriptRequest;
nsCOMPtr<nsIScriptElement> mCurrentScript;
nsCOMPtr<nsIScriptElement> mCurrentParserInsertedScript;
// XXXbz do we want to cycle-collect these or something? Not sure.

View File

@ -153,7 +153,10 @@ function runTest() {
then(testThisBind);
m = null;
});
m.observe(div, { attributes: true});
m.observe(div, { attributes: true, attributeFilter: ["foo"] });
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true);
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter.length, 1)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter[0], "foo")
div.setAttribute("foo", "bar");
}
@ -182,6 +185,9 @@ function testThisBind() {
m = null;
}).bind(window));
m.observe(div, { attributes: true, attributeOldValue: true, subtree: true });
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeOldValue, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true)
div.setAttribute("foo", "bar2");
div.removeAttribute("foo");
div.removeChild(child);
@ -225,6 +231,11 @@ function testCharacterData() {
m3.observe(div, { characterData: true, subtree: true });
m3.observe(div, { characterData: true, subtree: false });
m4.observe(div.firstChild, { characterData: true, subtree: false });
is(SpecialPowers.wrap(div).getBoundMutationObservers().length, 3)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].characterData, true)
is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].subtree, false)
div.firstChild.data = "bar";
}
@ -278,7 +289,7 @@ function testChildList4() {
var s1 = div.appendChild(document.createElement("span"));
s1.textContent = "foo";
var s2 = div.appendChild(document.createElement("span"));
m = new M(function(records, observer) {
function callback(records, observer) {
is(records.length, 3, "Should have got one record for removing nodes from document fragment and one record for adding them to div");
is(records[0].removedNodes.length, 2, "Should have got removedNodes");
is(records[0].removedNodes[0], t1, "Should be the 1st textnode");
@ -294,9 +305,16 @@ function testChildList4() {
observer.disconnect();
then(testChildList5);
m = null;
});
};
m = new M(callback);
m.observe(df, { childList: true, characterData: true, characterDataOldValue: true, subtree: true });
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].childList, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterData, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterDataOldValue, true)
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true)
ok(SpecialPowers.compare(SpecialPowers.wrap(df).getBoundMutationObservers()[0].mutationCallback, callback))
m.observe(div, { childList: true });
is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo().length, 2)
// Make sure transient observers aren't leaked.
var leakTest = new M(function(){});
@ -554,6 +572,8 @@ function testTakeRecords() {
m = null;
});
m.observe(div, { attributes: true, attributeOldValue: true });
// Note, [0] points to a mutation observer which is there for a leak test!
ok(SpecialPowers.compare(SpecialPowers.wrap(div).getBoundMutationObservers()[1], m));
var mutationEventCount = 0;
div.addEventListener("DOMAttrModified", mutationListener);
div.setAttribute("foo", "bar");

View File

@ -31,7 +31,9 @@ class LayerManager;
namespace dom {
class FileCallback;
class HTMLCanvasPrintState;
class PrintCallback;
class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
public nsICanvasElementExternal,
@ -92,16 +94,10 @@ public:
aRv = ToDataURL(aType, params, aCx, aDataURL);
}
void ToBlob(JSContext* aCx,
nsIFileCallback* aCallback,
FileCallback& aCallback,
const nsAString& aType,
const Optional<JS::Handle<JS::Value> >& aParams,
ErrorResult& aRv)
{
JS::Value params = aParams.WasPassed()
? aParams.Value()
: JS::UndefinedValue();
aRv = ToBlob(aCallback, aType, params, aCx);
}
ErrorResult& aRv);
bool MozOpaque() const
{
@ -126,8 +122,8 @@ public:
{
aRv = MozFetchAsStream(aCallback, aType);
}
nsIPrintCallback* GetMozPrintCallback() const;
// Using XPCOM SetMozPrintCallback.
PrintCallback* GetMozPrintCallback() const;
void SetMozPrintCallback(PrintCallback* aCallback);
/**
* Get the size in pixels of this canvas element
@ -244,9 +240,9 @@ protected:
nsString mCurrentContextId;
nsRefPtr<HTMLCanvasElement> mOriginalCanvas;
nsCOMPtr<nsIPrintCallback> mPrintCallback;
nsRefPtr<PrintCallback> mPrintCallback;
nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;
nsCOMPtr<HTMLCanvasPrintState> mPrintState;
nsRefPtr<HTMLCanvasPrintState> mPrintState;
public:
// Record whether this canvas should be write-only or not.
@ -266,6 +262,41 @@ public:
HTMLCanvasElement* GetOriginalCanvas();
};
class HTMLCanvasPrintState MOZ_FINAL : public nsWrapperCache
{
public:
HTMLCanvasPrintState(HTMLCanvasElement* aCanvas,
nsICanvasRenderingContextInternal* aContext,
nsITimerCallback* aCallback);
nsISupports* Context() const;
void Done();
void NotifyDone();
bool mIsDone;
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(HTMLCanvasPrintState)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(HTMLCanvasPrintState)
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
HTMLCanvasElement* GetParentObject()
{
return mCanvas;
}
private:
~HTMLCanvasPrintState();
bool mPendingNotify;
protected:
nsRefPtr<HTMLCanvasElement> mCanvas;
nsCOMPtr<nsICanvasRenderingContextInternal> mContext;
nsCOMPtr<nsITimerCallback> mCallback;
};
} // namespace dom
} // namespace mozilla

View File

@ -48,9 +48,9 @@ HTMLImageOrCanvasOrVideoElement;
class ToBlobRunnable : public nsRunnable
{
public:
ToBlobRunnable(nsIFileCallback* aCallback,
ToBlobRunnable(mozilla::dom::FileCallback& aCallback,
nsIDOMBlob* aBlob)
: mCallback(aCallback),
: mCallback(&aCallback),
mBlob(aBlob)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -59,11 +59,12 @@ public:
NS_IMETHOD Run()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mCallback->Receive(mBlob);
return NS_OK;
mozilla::ErrorResult rv;
mCallback->Call(mBlob, rv);
return rv.ErrorCode();
}
private:
nsCOMPtr<nsIFileCallback> mCallback;
nsRefPtr<mozilla::dom::FileCallback> mCallback;
nsCOMPtr<nsIDOMBlob> mBlob;
};
@ -72,76 +73,63 @@ private:
namespace mozilla {
namespace dom {
class HTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_3(HTMLCanvasPrintState, mCanvas,
mContext, mCallback)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(HTMLCanvasPrintState, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(HTMLCanvasPrintState, Release)
HTMLCanvasPrintState::HTMLCanvasPrintState(HTMLCanvasElement* aCanvas,
nsICanvasRenderingContextInternal* aContext,
nsITimerCallback* aCallback)
: mIsDone(false), mPendingNotify(false), mCanvas(aCanvas),
mContext(aContext), mCallback(aCallback)
{
public:
HTMLCanvasPrintState(HTMLCanvasElement* aCanvas,
nsICanvasRenderingContextInternal* aContext,
nsITimerCallback* aCallback)
: mIsDone(false), mPendingNotify(false), mCanvas(aCanvas),
mContext(aContext), mCallback(aCallback)
{
}
SetIsDOMBinding();
}
NS_IMETHOD GetContext(nsISupports** aContext)
{
NS_ADDREF(*aContext = mContext);
return NS_OK;
}
HTMLCanvasPrintState::~HTMLCanvasPrintState()
{
}
NS_IMETHOD Done()
{
if (!mPendingNotify && !mIsDone) {
// The canvas needs to be invalidated for printing reftests on linux to
// work.
if (mCanvas) {
mCanvas->InvalidateCanvas();
}
nsRefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NS_NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
mPendingNotify = true;
}
/* virtual */ JSObject*
HTMLCanvasPrintState::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return MozCanvasPrintStateBinding::Wrap(aCx, aScope, this);
}
nsISupports*
HTMLCanvasPrintState::Context() const
{
return mContext;
}
void
HTMLCanvasPrintState::Done()
{
if (!mPendingNotify && !mIsDone) {
// The canvas needs to be invalidated for printing reftests on linux to
// work.
if (mCanvas) {
mCanvas->InvalidateCanvas();
}
return NS_OK;
}
void NotifyDone()
{
mIsDone = true;
mPendingNotify = false;
if (mCallback) {
mCallback->Notify(nullptr);
nsRefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NS_NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
mPendingNotify = true;
}
}
}
bool mIsDone;
// CC
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(HTMLCanvasPrintState)
private:
virtual ~HTMLCanvasPrintState()
{
void
HTMLCanvasPrintState::NotifyDone()
{
mIsDone = true;
mPendingNotify = false;
if (mCallback) {
mCallback->Notify(nullptr);
}
bool mPendingNotify;
protected:
nsRefPtr<HTMLCanvasElement> mCanvas;
nsCOMPtr<nsICanvasRenderingContextInternal> mContext;
nsCOMPtr<nsITimerCallback> mCallback;
};
NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLCanvasPrintState)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLCanvasPrintState)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozCanvasPrintState)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozCanvasPrintState)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_3(HTMLCanvasPrintState, mCanvas, mContext, mCallback)
}
// ---------------------------------------------------------------------------
@ -226,11 +214,9 @@ HTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
// print preview mode, 2) the canvas has a print callback and 3) the callback
// hasn't already been called. For real printing the callback is handled in
// nsSimplePageSequenceFrame::PrePrintNextPage.
nsCOMPtr<nsIPrintCallback> printCallback;
if ((aType == nsPresContext::eContext_PageLayout ||
aType == nsPresContext::eContext_PrintPreview) &&
!mPrintState &&
NS_SUCCEEDED(GetMozPrintCallback(getter_AddRefs(printCallback))) && printCallback) {
!mPrintState && GetMozPrintCallback()) {
DispatchPrintCallback(nullptr);
}
}
@ -256,9 +242,8 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
void
HTMLCanvasElement::CallPrintCallback()
{
nsCOMPtr<nsIPrintCallback> printCallback;
GetMozPrintCallback(getter_AddRefs(printCallback));
printCallback->Render(mPrintState);
ErrorResult rv;
GetMozPrintCallback()->Call(*mPrintState, rv);
}
void
@ -386,14 +371,13 @@ HTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
return asyncCallback->OnInputStreamReady(asyncData);
}
NS_IMETHODIMP
HTMLCanvasElement::SetMozPrintCallback(nsIPrintCallback *aCallback)
void
HTMLCanvasElement::SetMozPrintCallback(PrintCallback* aCallback)
{
mPrintCallback = aCallback;
return NS_OK;
}
nsIPrintCallback*
PrintCallback*
HTMLCanvasElement::GetMozPrintCallback() const
{
if (mOriginalCanvas) {
@ -402,13 +386,6 @@ HTMLCanvasElement::GetMozPrintCallback() const
return mPrintCallback;
}
NS_IMETHODIMP
HTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
{
NS_IF_ADDREF(*aCallback = GetMozPrintCallback());
return NS_OK;
}
nsresult
HTMLCanvasElement::ExtractData(const nsAString& aType,
const nsAString& aOptions,
@ -571,59 +548,70 @@ HTMLCanvasElement::ToDataURLImpl(JSContext* aCx,
}
// XXXkhuey the encoding should be off the main thread, but we're lazy.
NS_IMETHODIMP
HTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
void
HTMLCanvasElement::ToBlob(JSContext* aCx,
FileCallback& aCallback,
const nsAString& aType,
const JS::Value& aEncoderOptions,
JSContext* aCx)
const Optional<JS::Handle<JS::Value> >& aParams,
ErrorResult& aRv)
{
// do a trust check if this is a write-only canvas
if (mWriteOnly && !nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
if (!aCallback) {
return NS_ERROR_UNEXPECTED;
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
}
nsAutoString type;
nsresult rv = nsContentUtils::ASCIIToLower(aType, type);
if (NS_FAILED(rv)) {
return rv;
aRv = nsContentUtils::ASCIIToLower(aType, type);
if (aRv.Failed()) {
return;
}
JS::Value encoderOptions = aParams.WasPassed()
? aParams.Value()
: JS::UndefinedValue();
nsAutoString params;
bool usingCustomParseOptions;
rv = ParseParams(aCx, type, aEncoderOptions, params, &usingCustomParseOptions);
if (NS_FAILED(rv)) {
return rv;
aRv = ParseParams(aCx, type, encoderOptions, params, &usingCustomParseOptions);
if (aRv.Failed()) {
return;
}
bool fallbackToPNG = false;
nsCOMPtr<nsIInputStream> stream;
rv = ExtractData(type, params, getter_AddRefs(stream), fallbackToPNG);
aRv = ExtractData(type, params, getter_AddRefs(stream), fallbackToPNG);
// If there are unrecognized custom parse options, we should fall back to
// the default values for the encoder without any options at all.
if (rv == NS_ERROR_INVALID_ARG && usingCustomParseOptions) {
if (aRv.ErrorCode() == NS_ERROR_INVALID_ARG && usingCustomParseOptions) {
fallbackToPNG = false;
rv = ExtractData(type, EmptyString(), getter_AddRefs(stream), fallbackToPNG);
aRv = ExtractData(type, EmptyString(), getter_AddRefs(stream), fallbackToPNG);
}
NS_ENSURE_SUCCESS(rv, rv);
if (aRv.Failed()) {
return;
}
if (fallbackToPNG) {
type.AssignLiteral("image/png");
}
uint64_t imgSize;
rv = stream->Available(&imgSize);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
aRv = stream->Available(&imgSize);
if (aRv.Failed()) {
return;
}
if (imgSize > UINT32_MAX) {
aRv.Throw(NS_ERROR_FILE_TOO_BIG);
return;
}
void* imgData = nullptr;
rv = NS_ReadInputStreamToBuffer(stream, &imgData, imgSize);
NS_ENSURE_SUCCESS(rv, rv);
aRv = NS_ReadInputStreamToBuffer(stream, &imgData, imgSize);
if (aRv.Failed()) {
return;
}
// The DOMFile takes ownership of the buffer
nsRefPtr<nsDOMMemoryFile> blob =
@ -635,7 +623,7 @@ HTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
}
nsRefPtr<ToBlobRunnable> runnable = new ToBlobRunnable(aCallback, blob);
return NS_DispatchToCurrentThread(runnable);
aRv = NS_DispatchToCurrentThread(runnable);
}
already_AddRefed<nsIDOMFile>
@ -1052,5 +1040,3 @@ HTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::Grap
} // namespace dom
} // namespace mozilla
DOMCI_DATA(MozCanvasPrintState, mozilla::dom::HTMLCanvasPrintState)

View File

@ -2352,9 +2352,12 @@ void
MediaStreamGraph::DestroyNonRealtimeInstance(MediaStreamGraph* aGraph)
{
NS_ASSERTION(NS_IsMainThread(), "Main thread only");
MOZ_ASSERT(aGraph != gGraph, "Should not destroy the global graph here");
MOZ_ASSERT(aGraph->IsNonRealtime(), "Should not destroy the global graph here");
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(aGraph);
if (graph->mForceShutDown)
return; // already done
if (!graph->mNonRealtimeProcessing) {
// Start the graph, but don't produce anything
graph->StartNonRealtimeProcessing(0);
@ -2421,6 +2424,12 @@ MediaStreamGraph::CreateAudioNodeStream(AudioNodeEngine* aEngine,
return stream;
}
bool
MediaStreamGraph::IsNonRealtime() const
{
return this != gGraph;
}
void
MediaStreamGraph::StartNonRealtimeProcessing(uint32_t aTicksToProcess)
{

View File

@ -975,6 +975,7 @@ public:
// Main thread only
static MediaStreamGraph* GetInstance();
static MediaStreamGraph* CreateNonRealtimeInstance();
// Idempotent
static void DestroyNonRealtimeInstance(MediaStreamGraph* aGraph);
// Control API.
@ -1022,6 +1023,8 @@ public:
* in main-thread stream state.
*/
int64_t GetCurrentGraphUpdateIndex() { return mGraphUpdatesSent; }
bool IsNonRealtime() const;
/**
* Start processing non-realtime for a specific number of ticks.
*/

View File

@ -89,7 +89,6 @@ MOCHITEST_FILES = \
test_paused_after_ended.html \
test_play_events.html \
test_play_events_2.html \
$(filter disabled-temporarily--bug-751539, test_played.html) \
test_playback_errors.html \
test_seekable1.html \
test_preload_actions.html \
@ -165,7 +164,7 @@ endif
# Disabled since we don't play Wave files standalone, for now
# test_audioDocumentTitle.html
# The below tests are disabled due to frequent timeouts.
# The below tests are disabled on Windows due to frequent timeouts.
# Bug 832768 and Bug 864682:
# test_buffered.html
# test_bug465498.html
@ -175,6 +174,18 @@ endif
# test_seek.html
# Bug 832768, bug 814533, bug 840742
# test_playback_rate.html
# Bug 751539
# test_played.html
ifneq ($(OS_ARCH), WINNT)
MOCHITEST_FILES += \
test_buffered.html \
test_bug465498.html \
test_bug493187.html \
test_seek.html \
test_playback_rate.html \
test_played.html \
$(NULL)
endif
# sample files
MOCHITEST_FILES += \

View File

@ -10,6 +10,8 @@
<pre id="test">
<script class="testbody" type='application/javascript;version=1.8'>
SimpleTest.expectAssertions(0, 2);
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
} else if (navigator.platform.startsWith("Mac")) {

View File

@ -13,6 +13,8 @@
let manager = new MediaTestManager;
SimpleTest.expectAssertions(0, 2);
function finish_test(element) {
if (element.parentNode)
element.parentNode.removeChild(element);

View File

@ -413,7 +413,7 @@ public:
// We've finished if we've gone past mStop, or if we're past mDuration when
// looping is disabled.
if (currentPosition >= mStop ||
(!mLoop && currentPosition - mStart + mOffset > mDuration)) {
(!mLoop && currentPosition - mStart + mOffset >= mDuration)) {
*aFinished = true;
}
}

View File

@ -63,11 +63,16 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
// Actually play audio
mDestination->Stream()->AddAudioOutput(&gWebAudioOutputKey);
nsDOMEventTargetHelper::BindToOwner(aWindow);
aWindow->AddAudioContext(this);
SetIsDOMBinding();
}
AudioContext::~AudioContext()
{
nsPIDOMWindow* window = GetOwner();
if (window) {
window->RemoveAudioContext(this);
}
}
JSObject*
@ -91,7 +96,6 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
}
nsRefPtr<AudioContext> object = new AudioContext(window, false);
window->AddAudioContext(object);
return object.forget();
}
@ -123,7 +127,6 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
aNumberOfChannels,
aLength,
aSampleRate);
window->AddAudioContext(object);
return object.forget();
}
@ -517,26 +520,11 @@ GetHashtableElements(nsTHashtable<nsPtrHashKey<T> >& aHashtable, nsTArray<T*>& a
aHashtable.EnumerateEntries(&GetHashtableEntry<T>, &aArray);
}
void
AudioContext::ShutdownDecoder()
{
mDecoder.Shutdown();
}
void
AudioContext::Shutdown()
{
Suspend();
// We need to hold the AudioContext object alive here to make sure that
// it doesn't get destroyed before our decoder shutdown runnable has had
// a chance to run.
nsCOMPtr<nsIRunnable> threadShutdownEvent =
NS_NewRunnableMethod(this, &AudioContext::ShutdownDecoder);
if (threadShutdownEvent) {
NS_DispatchToCurrentThread(threadShutdownEvent);
}
// Stop all audio buffer source nodes, to make sure that they release
// their self-references.
// We first gather an array of the nodes and then call Stop on each one,
@ -567,7 +555,7 @@ AudioContext::Shutdown()
// For offline contexts, we can destroy the MediaStreamGraph at this point.
if (mIsOffline) {
mDestination->DestroyGraph();
mDestination->OfflineShutdown();
}
}

View File

@ -79,7 +79,7 @@ public:
return GetOwner();
}
void Shutdown();
void Shutdown(); // idempotent
void Suspend();
void Resume();

View File

@ -125,11 +125,13 @@ public:
AudioNode* node = mStream->Engine()->Node();
if (node) {
context = node->Context();
MOZ_ASSERT(context, "node hasn't kept context alive");
}
}
if (!context) {
return NS_OK;
}
context->Shutdown(); // drops self reference
AutoPushJSContext cx(context->GetJSContext());
if (cx) {
@ -235,6 +237,19 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
mStream = graph->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
}
void
AudioDestinationNode::DestroyMediaStream()
{
if (!mStream)
return;
MediaStreamGraph* graph = mStream->Graph();
if (graph->IsNonRealtime()) {
MediaStreamGraph::DestroyNonRealtimeInstance(graph);
}
AudioNode::DestroyMediaStream();
}
uint32_t
AudioDestinationNode::MaxChannelCount() const
{
@ -267,11 +282,13 @@ AudioDestinationNode::Unmute()
}
void
AudioDestinationNode::DestroyGraph()
AudioDestinationNode::OfflineShutdown()
{
MOZ_ASSERT(Context() && Context()->IsOffline(),
"Should only be called on a valid OfflineAudioContext");
MediaStreamGraph::DestroyNonRealtimeInstance(mStream->Graph());
mOfflineRenderingRef.Drop(this);
}
JSObject*
@ -283,6 +300,7 @@ AudioDestinationNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
void
AudioDestinationNode::StartRendering()
{
mOfflineRenderingRef.Take(this);
mStream->Graph()->StartNonRealtimeProcessing(mFramesToProduce);
}

View File

@ -25,6 +25,8 @@ public:
uint32_t aLength = 0,
float aSampleRate = 0.0f);
virtual void DestroyMediaStream() MOZ_OVERRIDE;
NS_DECL_ISUPPORTS_INHERITED
virtual JSObject* WrapObject(JSContext* aCx,
@ -44,9 +46,10 @@ public:
void StartRendering();
void DestroyGraph();
void OfflineShutdown();
private:
SelfReference<AudioDestinationNode> mOfflineRenderingRef;
uint32_t mFramesToProduce;
};

View File

@ -102,11 +102,9 @@ private:
* real-time processing and output of this AudioNode.
*
* We track the incoming and outgoing connections to other AudioNodes.
* All connections are strong and thus rely on cycle collection to break them.
* However, we also track whether an AudioNode is capable of producing output
* in the future. If it isn't, then we break its connections to its inputs
* and outputs, allowing nodes to be immediately disconnected. This
* disconnection is done internally, invisible to DOM users.
* Outgoing connections have strong ownership. Also, AudioNodes add self
* references if they produce sound on their output even when they have silent
* or no input.
*/
class AudioNode : public nsDOMEventTargetHelper,
public EnableWebAudioCheck

View File

@ -572,15 +572,6 @@ MediaBufferDecoder::EnsureThreadPoolInitialized()
return true;
}
void
MediaBufferDecoder::Shutdown() {
if (mThreadPool) {
mThreadPool->Shutdown();
mThreadPool = nullptr;
}
MOZ_ASSERT(!mThreadPool);
}
WebAudioDecodeJob::WebAudioDecodeJob(const nsACString& aContentType,
AudioContext* aContext,
const ArrayBuffer& aBuffer,

View File

@ -80,8 +80,6 @@ public:
bool SyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
uint32_t aLength, WebAudioDecodeJob& aDecodeJob);
void Shutdown();
private:
bool EnsureThreadPoolInitialized();

View File

@ -49,10 +49,12 @@ MOCHITEST_FILES := \
test_channelSplitterNode.html \
test_channelSplitterNodeWithVolume.html \
test_convolverNode.html \
test_convolverNodeChannelCount.html \
test_convolverNodeWithGain.html \
test_convolverNode_mono_mono.html \
test_currentTime.html \
test_delayNode.html \
test_delayNodeAtMax.html \
test_delayNodeSmallMaxDelay.html \
test_delayNodeWithGain.html \
test_dynamicsCompressorNode.html \
@ -105,13 +107,6 @@ MOCHITEST_FILES := \
audio-quad.wav \
$(NULL)
ifneq ($(MOZ_DEBUG)+$(MOZ_WIDGET_TOOLKIT),+gtk2) # bug 911777
MOCHITEST_FILES += \
test_convolverNodeChannelCount.html \
test_delayNodeAtMax.html \
$(NULL)
endif # bug 911777
ifneq ($(OS_TARGET),Android) # bug 912474
MOCHITEST_FILES += \
test_pannerNodeChannelCount.html \

View File

@ -10,6 +10,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">
// Work around bug 911777
SpecialPowers.forceGC();
SpecialPowers.forceCC();
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var ac = new AudioContext();

View File

@ -49,8 +49,7 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
// aboutMemory.xhtml implements about:compartments
{ "compartments", "chrome://global/content/aboutMemory.xhtml",
{ "compartments", "chrome://global/content/aboutCompartments.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
{ "memory", "chrome://global/content/aboutMemory.xhtml",
nsIAboutModule::ALLOW_SCRIPT },

View File

@ -25,7 +25,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "BatteryManager.h"
#include "PowerManager.h"
#include "mozilla/dom/PowerManager.h"
#include "nsIDOMWakeLock.h"
#include "nsIPowerManagerService.h"
#include "mozilla/dom/MobileMessageManager.h"
@ -76,8 +76,6 @@
#include "mozilla/dom/NavigatorBinding.h"
using namespace mozilla::dom::power;
// This should not be in the namespace.
DOMCI_DATA(Navigator, mozilla::dom::Navigator)
@ -1100,7 +1098,7 @@ Navigator::GetBattery(ErrorResult& aRv)
return mBatteryManager;
}
power::PowerManager*
PowerManager*
Navigator::GetMozPower(ErrorResult& aRv)
{
if (!mPowerManager) {

View File

@ -92,9 +92,7 @@ class Telephony;
class Voicemail;
#endif
namespace power {
class PowerManager;
} // namespace power
namespace time {
class TimeManager;
@ -194,7 +192,7 @@ public:
{
aRv = GetBuildID(aBuildID);
}
power::PowerManager* GetMozPower(ErrorResult& aRv);
PowerManager* GetMozPower(ErrorResult& aRv);
bool JavaEnabled(ErrorResult& aRv);
bool TaintEnabled()
{
@ -322,7 +320,7 @@ private:
#ifdef MOZ_B2G_FM
nsRefPtr<FMRadio> mFMRadio;
#endif
nsRefPtr<power::PowerManager> mPowerManager;
nsRefPtr<PowerManager> mPowerManager;
nsRefPtr<MobileMessageManager> mMobileMessageManager;
#ifdef MOZ_B2G_RIL
nsRefPtr<Telephony> mTelephony;

View File

@ -38,7 +38,6 @@
#include "xptcall.h"
#include "nsTArray.h"
#include "nsDOMEventTargetHelper.h"
#include "nsIDOMHTMLCanvasElement.h"
#include "nsContentList.h"
#include "nsHTMLDocument.h"
#include "nsDOMBlobBuilder.h"
@ -423,9 +422,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(SVGNumber, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozCanvasPrintState, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WindowUtils, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -1233,10 +1229,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGNumber)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozCanvasPrintState, nsIDOMMozCanvasPrintState)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCanvasPrintState)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(XSLTProcessor, nsIXSLTProcessor)
DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessor)
DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessorPrivate)

View File

@ -65,9 +65,6 @@ DOMCI_CLASS(CSSSupportsRule)
DOMCI_CLASS(SVGLength)
DOMCI_CLASS(SVGNumber)
// Canvas
DOMCI_CLASS(MozCanvasPrintState)
// WindowUtils
DOMCI_CLASS(WindowUtils)

View File

@ -1387,6 +1387,11 @@ nsGlobalWindow::CleanUp()
CleanupCachedXBLHandlers(this);
for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
mAudioContexts[i]->Shutdown();
}
mAudioContexts.Clear();
if (mIdleTimer) {
mIdleTimer->Cancel();
mIdleTimer = nullptr;
@ -1651,7 +1656,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFocusedNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioContexts)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMenubar)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mToolbar)
@ -1706,7 +1710,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFocusedNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioContexts)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMenubar)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mToolbar)
@ -3258,6 +3261,12 @@ nsPIDOMWindow::AddAudioContext(AudioContext* aAudioContext)
}
}
void
nsPIDOMWindow::RemoveAudioContext(AudioContext* aAudioContext)
{
mAudioContexts.RemoveElement(aAudioContext);
}
void
nsPIDOMWindow::MuteAudioContexts()
{

View File

@ -58,12 +58,15 @@ public:
* @param aRetValue the result of executing the script. Pass null if you
* don't care about the result. Note that asking for a
* result will deoptimize your script somewhat in many cases.
* @param aOffThreadToken if specified, the result of compiling the script
* on another thread.
*/
virtual nsresult EvaluateString(const nsAString& aScript,
JS::Handle<JSObject*> aScopeObject,
JS::CompileOptions& aOptions,
bool aCoerceToString,
JS::Value* aRetValue) = 0;
JS::Value* aRetValue,
void **aOffThreadToken = nullptr) = 0;
/**
* Bind an already-compiled event handler function to the given

View File

@ -980,7 +980,8 @@ nsJSContext::EvaluateString(const nsAString& aScript,
JS::Handle<JSObject*> aScopeObject,
JS::CompileOptions& aCompileOptions,
bool aCoerceToString,
JS::Value* aRetValue)
JS::Value* aRetValue,
void **aOffThreadToken)
{
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
if (!mScriptsEnabled) {
@ -991,7 +992,8 @@ nsJSContext::EvaluateString(const nsAString& aScript,
nsJSUtils::EvaluateOptions evalOptions;
evalOptions.setCoerceToString(aCoerceToString);
return nsJSUtils::EvaluateString(mContext, aScript, aScopeObject,
aCompileOptions, evalOptions, aRetValue);
aCompileOptions, evalOptions, aRetValue,
aOffThreadToken);
}
#ifdef DEBUG

View File

@ -44,7 +44,8 @@ public:
JS::Handle<JSObject*> aScopeObject,
JS::CompileOptions &aOptions,
bool aCoerceToString,
JS::Value* aRetValue) MOZ_OVERRIDE;
JS::Value* aRetValue,
void **aOffThreadToken = nullptr) MOZ_OVERRIDE;
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
JS::Handle<JSObject*> aScope,

View File

@ -223,7 +223,8 @@ nsJSUtils::EvaluateString(JSContext* aCx,
JS::Handle<JSObject*> aScopeObject,
JS::CompileOptions& aCompileOptions,
EvaluateOptions& aEvaluateOptions,
JS::Value* aRetValue)
JS::Value* aRetValue,
void **aOffThreadToken)
{
PROFILER_LABEL("JS", "EvaluateString");
MOZ_ASSERT_IF(aCompileOptions.versionSet,
@ -265,9 +266,20 @@ nsJSUtils::EvaluateString(JSContext* aCx,
JSAutoCompartment ac(aCx, aScopeObject);
JS::RootedObject rootedScope(aCx, aScopeObject);
ok = JS::Evaluate(aCx, rootedScope, aCompileOptions,
PromiseFlatString(aScript).get(),
aScript.Length(), aRetValue);
if (aOffThreadToken) {
JSScript *script = JS::FinishOffThreadScript(aCx, JS_GetRuntime(aCx), *aOffThreadToken);
*aOffThreadToken = nullptr; // Mark the token as having been finished.
if (script) {
ok = JS_ExecuteScript(aCx, rootedScope, script, aRetValue);
} else {
ok = false;
}
} else {
ok = JS::Evaluate(aCx, rootedScope, aCompileOptions,
PromiseFlatString(aScript).get(),
aScript.Length(), aRetValue);
}
if (ok && aEvaluateOptions.coerceToString && !aRetValue->isUndefined()) {
JSString* str = JS_ValueToString(aCx, *aRetValue);
ok = !!str;

View File

@ -85,7 +85,8 @@ public:
JS::Handle<JSObject*> aScopeObject,
JS::CompileOptions &aCompileOptions,
EvaluateOptions& aEvaluateOptions,
JS::Value* aRetValue);
JS::Value* aRetValue,
void **aOffThreadToken = nullptr);
};

View File

@ -612,6 +612,7 @@ public:
const nsAString& aOptions, nsIDOMWindow **_retval) = 0;
void AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
void MuteAudioContexts();
void UnmuteAudioContexts();
@ -708,7 +709,7 @@ protected:
nsCOMPtr<nsIContent> mFocusedNode;
// The AudioContexts created for the current document, if any.
nsTArray<nsRefPtr<mozilla::dom::AudioContext> > mAudioContexts;
nsTArray<mozilla::dom::AudioContext*> mAudioContexts; // Weak
// A unique (as long as our 64-bit counter doesn't roll over) id for
// this window.

View File

@ -716,7 +716,7 @@ ReportGhostWindowsEnumerator(nsUint64HashKey* aIDHashKey, void* aClosure)
nsIMemoryReporter::KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
/* amount = */ 1,
/* desc = */ EmptyCString(),
/* description = */ NS_LITERAL_CSTRING("A ghost window."),
data->closure);
if (NS_FAILED(rv) && NS_SUCCEEDED(data->rv)) {

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