diff --git a/accessible/src/atk/AccessibleWrap.cpp b/accessible/src/atk/AccessibleWrap.cpp index 6bb19fac6950..57801ff3cf1a 100644 --- a/accessible/src/atk/AccessibleWrap.cpp +++ b/accessible/src/atk/AccessibleWrap.cpp @@ -23,6 +23,7 @@ #include "Relation.h" #include "RootAccessible.h" #include "States.h" +#include "nsISimpleEnumerator.h" #include "mozilla/Util.h" #include "nsXPCOMStrings.h" diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index bca73afdbeb1..5741ab427759 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -18,7 +18,7 @@ #include "nsIAccessibleStates.h" #include "nsIContent.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsRefPtrHashtable.h" diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 6a74da88bb68..c0ab8034fde3 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -74,10 +74,11 @@ DocAccessible:: DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent, nsIPresShell* aPresShell) : HyperTextAccessibleWrap(aRootContent, this), - mDocumentNode(aDocument), mScrollPositionChangedTicks(0), // XXX aaronl should we use an algorithm for the initial cache size? mAccessibleCache(kDefaultCacheSize), mNodeToAccessibleMap(kDefaultCacheSize), + mDocumentNode(aDocument), + mScrollPositionChangedTicks(0), mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0), mVirtualCursor(nullptr), mPresShell(aPresShell) diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index 001a7882eb01..c07f4597d673 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -498,90 +498,30 @@ var Output = { speechHelper: { EARCONS: ['chrome://global/content/accessibility/tick.wav'], - delayedActions: [], - - earconsToLoad: -1, // -1: not inited, 1 or more: initing, 0: inited - earconBuffers: {}, - webaudioEnabled: false, + inited: false, webspeechEnabled: false, - doDelayedActionsIfLoaded: function doDelayedActionsIfLoaded(aToLoadCount) { - if (aToLoadCount === 0) { - this.outputActions(this.delayedActions); - this.delayedActions = []; - return true; - } - - return false; - }, - init: function init() { - if (this.earconsToLoad === 0) { - // Already inited. - return; - } - let window = Utils.win; - this.webaudioEnabled = !!window.AudioContext; this.webspeechEnabled = !!window.speechSynthesis; - this.earconsToLoad = this.webaudioEnabled ? this.EARCONS.length : 0; - - if (this.doDelayedActionsIfLoaded(this.earconsToLoad)) { - // Nothing to load - return; - } - - this.audioContext = new window.AudioContext(); - for (let earcon of this.EARCONS) { - let xhr = new window.XMLHttpRequest(); - xhr.open('GET', earcon); - xhr.responseType = 'arraybuffer'; - xhr.onerror = () => { - Logger.error('Error getting earcon:', xhr.statusText); - this.doDelayedActionsIfLoaded(--this.earconsToLoad); - }; - xhr.onload = () => { - this.audioContext.decodeAudioData( - xhr.response, - (audioBuffer) => { - try { - let earconName = /.*\/(.*)\..*$/.exec(earcon)[1]; - this.earconBuffers[earconName] = new WeakMap(); - this.earconBuffers[earconName].set(window, audioBuffer); - this.doDelayedActionsIfLoaded(--this.earconsToLoad); - } catch (x) { - Logger.logException(x); - } - }, - () => { - this.doDelayedActionsIfLoaded(--this.earconsToLoad); - Logger.error('Error decoding earcon'); - }); - }; - xhr.send(); + let earconName = /.*\/(.*)\..*$/.exec(earcon)[1]; + this.earconBuffers[earconName] = new WeakMap(); + this.earconBuffers[earconName].set(window, new window.Audio(earcon)); } + + this.inited = true; }, output: function output(aActions) { - if (this.earconsToLoad !== 0) { - // We did not load the earcons yet. - this.delayedActions.push.apply(this.delayedActions, aActions); - if (this.earconsToLoad < 0) { - // Loading did not start yet, start it. - this.init(); - } - return; + if (!this.inited) { + this.init(); } - this.outputActions(aActions); - }, - - outputActions: function outputActions(aActions) { for (let action of aActions) { let window = Utils.win; Logger.info('tts.' + action.method, @@ -595,13 +535,10 @@ var Output = { if (action.method === 'speak' && this.webspeechEnabled) { window.speechSynthesis.speak( new window.SpeechSynthesisUtterance(action.data)); - } else if (action.method === 'playEarcon' && this.webaudioEnabled) { + } else if (action.method === 'playEarcon') { let audioBufferWeakMap = this.earconBuffers[action.data]; if (audioBufferWeakMap) { - let node = this.audioContext.createBufferSource(); - node.connect(this.audioContext.destination); - node.buffer = audioBufferWeakMap.get(window); - node.start(0); + audioBufferWeakMap.get(window).cloneNode(false).play(); } } } @@ -798,6 +735,9 @@ var Input = { case 'swipeleft1': this.moveCursor('movePrevious', 'Simple', 'gesture'); break; + case 'exploreend1': + this.activateCurrent(null, true); + break; case 'swiperight2': this.sendScrollMessage(-1, true); break; @@ -938,12 +878,13 @@ var Input = { mm.sendAsyncMessage(type, aDetails); }, - activateCurrent: function activateCurrent(aData) { + activateCurrent: function activateCurrent(aData, aActivateIfKey = false) { let mm = Utils.getMessageManager(Utils.CurrentBrowser); let offset = aData && typeof aData.keyIndex === 'number' ? aData.keyIndex - Output.brailleState.startOffset : -1; - mm.sendAsyncMessage('AccessFu:Activate', {offset: offset}); + mm.sendAsyncMessage('AccessFu:Activate', + {offset: offset, activateIfKey: aActivateIfKey}); }, sendContextMenuMessage: function sendContextMenuMessage() { diff --git a/accessible/src/jsat/TouchAdapter.jsm b/accessible/src/jsat/TouchAdapter.jsm index f4deacd8f6e7..fa65e2aee383 100644 --- a/accessible/src/jsat/TouchAdapter.jsm +++ b/accessible/src/jsat/TouchAdapter.jsm @@ -428,10 +428,10 @@ TouchPoint.prototype = { } // To be considered an explore... - if (!this.done && - duration > TouchAdapter.SWIPE_MAX_DURATION && + if (duration > TouchAdapter.SWIPE_MAX_DURATION && (this.distanceTraveled / this.dpi) > TouchAdapter.TAP_MAX_RADIUS) { - return {type: 'explore', x: this.x, y: this.y}; + return {type: this.done ? 'exploreend' : 'explore', + x: this.x, y: this.y}; } return null; diff --git a/accessible/src/jsat/TraversalRules.jsm b/accessible/src/jsat/TraversalRules.jsm index 00bab91f75c4..a266a088a4c6 100644 --- a/accessible/src/jsat/TraversalRules.jsm +++ b/accessible/src/jsat/TraversalRules.jsm @@ -31,6 +31,7 @@ const ROLE_CHECK_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM; const ROLE_PASSWORD_TEXT = Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT; const ROLE_RADIO_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM; const ROLE_TOGGLE_BUTTON = Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON; +const ROLE_KEY = Ci.nsIAccessibleRole.ROLE_KEY; const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY; const ROLE_LIST = Ci.nsIAccessibleRole.ROLE_LIST; const ROLE_DEFINITION_LIST = Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST; @@ -104,6 +105,7 @@ var gSimpleTraversalRoles = ROLE_RADIO_MENU_ITEM, ROLE_TOGGLE_BUTTON, ROLE_ENTRY, + ROLE_KEY, ROLE_HEADER, ROLE_HEADING, // Used for traversing in to child OOP frames. diff --git a/accessible/src/jsat/content-script.js b/accessible/src/jsat/content-script.js index 13d4c2649f8c..6f583a26330c 100644 --- a/accessible/src/jsat/content-script.js +++ b/accessible/src/jsat/content-script.js @@ -164,6 +164,12 @@ function forwardToChild(aMessage, aListener, aVCPosition) { function activateCurrent(aMessage) { Logger.debug('activateCurrent'); function activateAccessible(aAccessible) { + if (aMessage.json.activateIfKey && + aAccessible.role != Ci.nsIAccessibleRole.ROLE_KEY) { + // Only activate keys, don't do anything on other objects. + return; + } + if (aAccessible.actionCount > 0) { aAccessible.doAction(0); } else { diff --git a/accessible/src/windows/msaa/AccessibleWrap.cpp b/accessible/src/windows/msaa/AccessibleWrap.cpp index 737f37c09ff6..fe0e772c9bd1 100644 --- a/accessible/src/windows/msaa/AccessibleWrap.cpp +++ b/accessible/src/windows/msaa/AccessibleWrap.cpp @@ -44,6 +44,7 @@ #include "oleacc.h" #include "nsIAccessibleTypes.h" #include "nsIPersistentProperties2.h" +#include "nsISimpleEnumerator.h" using namespace mozilla; using namespace mozilla::a11y; diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index 39fab8b73be2..0e7a2cbe8216 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -378,6 +378,8 @@ @BINPATH@/components/PeerConnection.js @BINPATH@/components/PeerConnection.manifest #endif +@BINPATH@/components/HttpDataUsage.manifest +@BINPATH@/components/HttpDataUsage.js @BINPATH@/components/SiteSpecificUserAgent.js @BINPATH@/components/SiteSpecificUserAgent.manifest @BINPATH@/components/storage-Legacy.js diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 684351a11118..3a5ed1014eea 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -544,6 +544,9 @@ @BINPATH@/components/PeerConnection.manifest #endif +@BINPATH@/components/HttpDataUsage.manifest +@BINPATH@/components/HttpDataUsage.js + @BINPATH@/chrome/marionette@JAREXT@ @BINPATH@/chrome/marionette.manifest @BINPATH@/components/MarionetteComponents.manifest diff --git a/chrome/src/RegistryMessageUtils.h b/chrome/src/RegistryMessageUtils.h index fa2902758fc1..3a4a4672ec4d 100644 --- a/chrome/src/RegistryMessageUtils.h +++ b/chrome/src/RegistryMessageUtils.h @@ -7,7 +7,7 @@ #define mozilla_RegistryMessageUtils_h #include "ipc/IPCMessageUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" struct SerializedURI { diff --git a/chrome/src/nsChromeProtocolHandler.cpp b/chrome/src/nsChromeProtocolHandler.cpp index 16183e15f3e6..5f074bc99c78 100644 --- a/chrome/src/nsChromeProtocolHandler.cpp +++ b/chrome/src/nsChromeProtocolHandler.cpp @@ -10,32 +10,20 @@ */ -#include "nsAutoPtr.h" #include "nsChromeProtocolHandler.h" #include "nsChromeRegistry.h" #include "nsCOMPtr.h" -#include "nsContentCID.h" -#include "nsCRT.h" #include "nsThreadUtils.h" #include "nsIChannel.h" #include "nsIChromeRegistry.h" -#include "nsIComponentManager.h" #include "nsIFile.h" -#include "nsIFileURL.h" #include "nsIFileChannel.h" #include "nsIIOService.h" -#include "nsIJARChannel.h" -#include "nsIJARURI.h" #include "nsILoadGroup.h" -#include "nsIObjectOutputStream.h" #include "nsIScriptSecurityManager.h" -#include "nsIServiceManager.h" #include "nsIStandardURL.h" -#include "nsIStreamListener.h" #include "nsNetUtil.h" -#include "nsXPIDLString.h" #include "nsString.h" -#include "prlog.h" //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp index 08a72f73589d..d7dabde70631 100644 --- a/chrome/src/nsChromeRegistry.cpp +++ b/chrome/src/nsChromeRegistry.cpp @@ -8,33 +8,23 @@ #include "nsChromeRegistryChrome.h" #include "nsChromeRegistryContent.h" -#include - -#include "prio.h" #include "prprf.h" #include "nsCOMPtr.h" #include "nsError.h" #include "nsEscape.h" -#include "nsLayoutCID.h" #include "nsNetUtil.h" #include "nsString.h" -#include "nsUnicharUtils.h" #include "nsCSSStyleSheet.h" #include "nsIConsoleService.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" -#include "nsIDocShell.h" -#include "nsIDOMElement.h" #include "nsIDOMLocation.h" #include "nsIDOMWindowCollection.h" #include "nsIDOMWindow.h" -#include "nsIIOService.h" -#include "nsIJARProtocolHandler.h" #include "nsIObserverService.h" #include "nsIPresShell.h" -#include "nsIProtocolHandler.h" #include "nsIScriptError.h" #include "nsIWindowMediator.h" diff --git a/chrome/src/nsChromeRegistry.h b/chrome/src/nsChromeRegistry.h index 6d0351cab252..9282c20a1377 100644 --- a/chrome/src/nsChromeRegistry.h +++ b/chrome/src/nsChromeRegistry.h @@ -6,31 +6,24 @@ #ifndef nsChromeRegistry_h #define nsChromeRegistry_h -#include "nsIChromeRegistry.h" #include "nsIToolkitChromeRegistry.h" #include "nsIObserver.h" #include "nsWeakReference.h" -#include "nsIPrefBranch.h" #ifdef MOZ_XUL #include "nsIXULOverlayProvider.h" #endif -#include "pldhash.h" - -#include "nsCOMArray.h" #include "nsString.h" -#include "nsTHashtable.h" #include "nsURIHashKey.h" #include "nsInterfaceHashtable.h" #include "nsXULAppAPI.h" -#include "nsIResProtocolHandler.h" #include "nsIXPConnect.h" -#include "mozilla/Omnijar.h" #include "mozilla/FileLocation.h" class nsIDOMWindow; +class nsIPrefBranch; class nsIURL; // The chrome registry is actually split between nsChromeRegistryChrome and diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index ec2031cf6caf..8a646b2f8b06 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -13,35 +13,27 @@ #include #elif defined(XP_MACOSX) #include -#elif defined(MOZ_WIDGET_GTK) -#include #endif #include "nsArrayEnumerator.h" -#include "nsAppDirectoryServiceDefs.h" #include "nsComponentManager.h" #include "nsEnumeratorUtils.h" #include "nsNetUtil.h" #include "nsStringEnumerator.h" #include "nsTextFormatter.h" -#include "nsUnicharUtils.h" #include "nsXPCOMCIDInternal.h" -#include "nsZipArchive.h" #include "mozilla/LookAndFeel.h" #include "nsICommandLine.h" #include "nsILocaleService.h" -#include "nsIFile.h" #include "nsIObserverService.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "mozilla/Preferences.h" #include "nsIResProtocolHandler.h" #include "nsIScriptError.h" -#include "nsIVersionComparator.h" #include "nsIXPConnect.h" -#include "nsIXULAppInfo.h" #include "nsIXULRuntime.h" #define UILOCALE_CMD_LINE_ARG "UILocale" diff --git a/chrome/src/nsChromeRegistryChrome.h b/chrome/src/nsChromeRegistryChrome.h index 906218297387..5692be66e9fc 100644 --- a/chrome/src/nsChromeRegistryChrome.h +++ b/chrome/src/nsChromeRegistryChrome.h @@ -6,6 +6,7 @@ #ifndef nsChromeRegistryChrome_h #define nsChromeRegistryChrome_h +#include "nsCOMArray.h" #include "nsChromeRegistry.h" #include "nsVoidArray.h" #include "mozilla/Move.h" diff --git a/chrome/src/nsChromeRegistryContent.cpp b/chrome/src/nsChromeRegistryContent.cpp index fb75606d5164..969098788547 100644 --- a/chrome/src/nsChromeRegistryContent.cpp +++ b/chrome/src/nsChromeRegistryContent.cpp @@ -4,11 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "RegistryMessageUtils.h" -#include "nsChromeRegistry.h" #include "nsChromeRegistryContent.h" #include "nsString.h" #include "nsNetUtil.h" -#include "nsResProtocolHandler.h" +#include "nsIResProtocolHandler.h" nsChromeRegistryContent::nsChromeRegistryContent() { diff --git a/chrome/src/nsChromeRegistryContent.h b/chrome/src/nsChromeRegistryContent.h index a31d949cd334..e4c55d3fdfb9 100644 --- a/chrome/src/nsChromeRegistryContent.h +++ b/chrome/src/nsChromeRegistryContent.h @@ -7,10 +7,8 @@ #define nsChromeRegistryContent_h #include "nsChromeRegistry.h" -#include "nsTArray.h" #include "nsClassHashtable.h" -class nsCString; struct ChromePackage; struct ResourceMapping; struct OverrideMapping; diff --git a/content/base/src/DOMImplementation.h b/content/base/src/DOMImplementation.h index 37cae4806a80..8906ab844271 100644 --- a/content/base/src/DOMImplementation.h +++ b/content/base/src/DOMImplementation.h @@ -16,7 +16,7 @@ #include "nsIScriptGlobalObject.h" #include "nsIURI.h" #include "nsIWeakReferenceUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" class nsIDOMDocument; diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index 47813972ae3b..a752cd247eb7 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -12,7 +12,7 @@ #define nsAttrValue_h___ #include "nscore.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsStringBuffer.h" #include "nsColor.h" #include "nsCaseTreatment.h" diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h index e8c72ad2a7cd..ba1f56412edd 100644 --- a/content/base/src/nsContentList.h +++ b/content/base/src/nsContentList.h @@ -16,7 +16,7 @@ #include "nsContentListDeclarations.h" #include "nsISupports.h" #include "nsTArray.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsIHTMLCollection.h" #include "nsIDOMNodeList.h" #include "nsINodeList.h" diff --git a/content/base/src/nsCopySupport.cpp b/content/base/src/nsCopySupport.cpp index 3deac74541f4..f6f31c52f7bc 100644 --- a/content/base/src/nsCopySupport.cpp +++ b/content/base/src/nsCopySupport.cpp @@ -39,6 +39,7 @@ #include "nsGUIEvent.h" #include "nsIFrame.h" #include "nsIURI.h" +#include "nsISimpleEnumerator.h" // image copy stuff #include "nsIImageLoadingContent.h" diff --git a/content/base/src/nsDOMAttributeMap.h b/content/base/src/nsDOMAttributeMap.h index 14a480ac09a1..20c7191fcd72 100644 --- a/content/base/src/nsDOMAttributeMap.h +++ b/content/base/src/nsDOMAttributeMap.h @@ -16,7 +16,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsIDOMMozNamedAttrMap.h" #include "nsRefPtrHashtable.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsWrapperCache.h" class nsIAtom; diff --git a/content/base/src/nsInProcessTabChildGlobal.cpp b/content/base/src/nsInProcessTabChildGlobal.cpp index e0a4ec9e8c1b..7995491694cb 100644 --- a/content/base/src/nsInProcessTabChildGlobal.cpp +++ b/content/base/src/nsInProcessTabChildGlobal.cpp @@ -20,6 +20,7 @@ #include "nsIMozBrowserFrame.h" #include "nsDOMClassInfoID.h" #include "mozilla/dom/StructuredCloneUtils.h" +#include "js/StructuredClone.h" using mozilla::dom::StructuredCloneData; using mozilla::dom::StructuredCloneClosure; diff --git a/content/media/webspeech/synth/pico/nsPicoService.cpp b/content/media/webspeech/synth/pico/nsPicoService.cpp index 71d036d883c8..f6817c597ae1 100644 --- a/content/media/webspeech/synth/pico/nsPicoService.cpp +++ b/content/media/webspeech/synth/pico/nsPicoService.cpp @@ -9,6 +9,7 @@ #include "nsPrintfCString.h" #include "nsIWeakReferenceUtils.h" #include "SharedBuffer.h" +#include "nsISimpleEnumerator.h" #include "mozilla/dom/nsSynthVoiceRegistry.h" #include "mozilla/dom/nsSpeechTask.h" diff --git a/content/svg/content/src/SVGAttrValueWrapper.h b/content/svg/content/src/SVGAttrValueWrapper.h index 8c02b73a5bb0..9a890a5bf9d9 100644 --- a/content/svg/content/src/SVGAttrValueWrapper.h +++ b/content/svg/content/src/SVGAttrValueWrapper.h @@ -12,7 +12,7 @@ * types don't need to be exported outside the SVG module. */ -#include "nsStringGlue.h" +#include "nsString.h" class nsSVGAngle; class nsSVGIntegerPair; diff --git a/content/svg/content/src/nsSVGDataParser.h b/content/svg/content/src/nsSVGDataParser.h index cd75427ef7c7..497d35b52c15 100644 --- a/content/svg/content/src/nsSVGDataParser.h +++ b/content/svg/content/src/nsSVGDataParser.h @@ -7,7 +7,7 @@ #define __NS_SVGDATAPARSER_H__ #include "nsError.h" -#include "nsStringGlue.h" +#include "nsString.h" //---------------------------------------------------------------------- // helper macros diff --git a/content/xbl/src/nsXBLPrototypeBinding.cpp b/content/xbl/src/nsXBLPrototypeBinding.cpp index 2c299052987b..7ebfa6e0acf0 100644 --- a/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -34,7 +34,7 @@ #include "nsContentUtils.h" #include "nsTextFragment.h" #include "nsTextNode.h" - +#include "nsIInterfaceInfo.h" #include "nsIScriptError.h" #include "nsIStyleRuleProcessor.h" diff --git a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp index e036dd1a7060..a649832ec22c 100644 --- a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp +++ b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp @@ -18,6 +18,7 @@ #include "txXPathObjectAdaptor.h" #include "mozilla/Attributes.h" #include "nsIClassInfo.h" +#include "nsIInterfaceInfo.h" NS_IMPL_ISUPPORTS1(txXPathObjectAdaptor, txIXPathObject) diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index 32ab1755dee7..78ba2b79288c 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -22,6 +22,7 @@ #include "mozilla/ipc/InputStreamUtils.h" #include "mozilla/ipc/URIUtils.h" #include "nsIObserverService.h" +#include "nsXULAppAPI.h" using namespace mozilla; diff --git a/dom/base/Crypto.cpp b/dom/base/Crypto.cpp index aebd798d0fc1..f5eaf8784de6 100644 --- a/dom/base/Crypto.cpp +++ b/dom/base/Crypto.cpp @@ -6,6 +6,8 @@ #include "nsCOMPtr.h" #include "nsIRandomGenerator.h" #include "nsPIDOMWindow.h" +#include "MainThreadUtils.h" +#include "nsXULAppAPI.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/CryptoBinding.h" diff --git a/dom/base/DOMException.cpp b/dom/base/DOMException.cpp index aa22ac0b2789..d5245d820e14 100644 --- a/dom/base/DOMException.cpp +++ b/dom/base/DOMException.cpp @@ -17,6 +17,7 @@ #include "nsIDocument.h" #include "nsIDOMDOMException.h" #include "nsIException.h" +#include "nsIProgrammingLanguage.h" #include "nsMemory.h" #include "prprf.h" #include "xpcprivate.h" diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index ace94abc1257..e6979e5c0708 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -41,6 +41,7 @@ #include "mozilla/dom/Element.h" #include "mozilla/LookAndFeel.h" #include "mozilla/Preferences.h" +#include "mozilla/Services.h" #include #ifdef MOZ_XUL diff --git a/dom/base/nsIDOMScriptObjectFactory.h b/dom/base/nsIDOMScriptObjectFactory.h index 4dcd3d210dbe..03f20f3c39da 100644 --- a/dom/base/nsIDOMScriptObjectFactory.h +++ b/dom/base/nsIDOMScriptObjectFactory.h @@ -8,7 +8,7 @@ #include "nsISupports.h" #include "nsIDOMClassInfo.h" -#include "nsStringGlue.h" +#include "nsString.h" #define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \ { 0x2a50e17c, 0x46ff, 0x4150, \ diff --git a/dom/base/nsIScriptContext.h b/dom/base/nsIScriptContext.h index 7f95e785aef0..c4b4d69b5e48 100644 --- a/dom/base/nsIScriptContext.h +++ b/dom/base/nsIScriptContext.h @@ -7,7 +7,7 @@ #define nsIScriptContext_h__ #include "nscore.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsISupports.h" #include "nsCOMPtr.h" #include "nsIProgrammingLanguage.h" diff --git a/dom/base/nsScriptNameSpaceManager.cpp b/dom/base/nsScriptNameSpaceManager.cpp index 32d48d6258bb..3cdca72faa33 100644 --- a/dom/base/nsScriptNameSpaceManager.cpp +++ b/dom/base/nsScriptNameSpaceManager.cpp @@ -26,6 +26,7 @@ #include "nsDOMClassInfo.h" #include "nsCRT.h" #include "nsIObserverService.h" +#include "nsISimpleEnumerator.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index d28567d0b243..7cb2cc69f261 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -11,7 +11,7 @@ #include "jsapi.h" #include "jsproxy.h" -#include "nsStringGlue.h" +#include "nsString.h" #define DOM_PROXY_OBJECT_SLOT js::PROXY_PRIVATE_SLOT diff --git a/dom/bluetooth/BluetoothA2dpManager.cpp b/dom/bluetooth/BluetoothA2dpManager.cpp index fa53ae24fd88..fb4b8a57fc4b 100644 --- a/dom/bluetooth/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/BluetoothA2dpManager.cpp @@ -19,6 +19,7 @@ #include "mozilla/StaticPtr.h" #include "nsIAudioManager.h" #include "nsIObserverService.h" +#include "MainThreadUtils.h" using namespace mozilla; diff --git a/dom/bluetooth/BluetoothCommon.h b/dom/bluetooth/BluetoothCommon.h index e2787d89550b..b78db30956ec 100644 --- a/dom/bluetooth/BluetoothCommon.h +++ b/dom/bluetooth/BluetoothCommon.h @@ -9,7 +9,7 @@ #include "mozilla/Observer.h" #include "nsPrintfCString.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" extern bool gBluetoothDebugFlag; diff --git a/dom/bluetooth/BluetoothHidManager.cpp b/dom/bluetooth/BluetoothHidManager.cpp index 35243a87c2a5..b294814da14f 100644 --- a/dom/bluetooth/BluetoothHidManager.cpp +++ b/dom/bluetooth/BluetoothHidManager.cpp @@ -17,6 +17,7 @@ #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsIObserverService.h" +#include "MainThreadUtils.h" using namespace mozilla; USING_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp index 7778fe58e8b2..e472bd0ed39e 100644 --- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp +++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp @@ -12,6 +12,7 @@ #include "mozilla/dom/ContentChild.h" #include "BluetoothChild.h" +#include "MainThreadUtils.h" USING_BLUETOOTH_NAMESPACE diff --git a/dom/devicestorage/DeviceStorageRequestParent.cpp b/dom/devicestorage/DeviceStorageRequestParent.cpp index 9f2ee590dea9..ca9607dc8d30 100644 --- a/dom/devicestorage/DeviceStorageRequestParent.cpp +++ b/dom/devicestorage/DeviceStorageRequestParent.cpp @@ -13,6 +13,7 @@ #include "nsProxyRelease.h" #include "AppProcessChecker.h" #include "mozilla/Preferences.h" +#include "nsNetCID.h" namespace mozilla { namespace dom { diff --git a/dom/file/FileCommon.h b/dom/file/FileCommon.h index 5da6f8e467f7..736842660df1 100644 --- a/dom/file/FileCommon.h +++ b/dom/file/FileCommon.h @@ -12,7 +12,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsDOMEventTargetHelper.h" #include "nsDebug.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #define BEGIN_FILE_NAMESPACE \ diff --git a/dom/indexedDB/Client.cpp b/dom/indexedDB/Client.cpp index 5800dcce74ef..163948e7a9f5 100644 --- a/dom/indexedDB/Client.cpp +++ b/dom/indexedDB/Client.cpp @@ -13,6 +13,7 @@ #include "IDBDatabase.h" #include "IndexedDatabaseManager.h" #include "TransactionThreadPool.h" +#include "nsISimpleEnumerator.h" USING_INDEXEDDB_NAMESPACE using mozilla::dom::quota::AssertIsOnIOThread; diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 4303c9a2a682..d1d3d2a6d297 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -44,6 +44,7 @@ #include "IndexedDatabaseManager.h" #include "Key.h" #include "ProfilerHelpers.h" +#include "nsNetUtil.h" #include "ipc/IndexedDBChild.h" diff --git a/dom/indexedDB/IDBRequest.cpp b/dom/indexedDB/IDBRequest.cpp index 0ed9940d84c0..d849046e2e9c 100644 --- a/dom/indexedDB/IDBRequest.cpp +++ b/dom/indexedDB/IDBRequest.cpp @@ -18,7 +18,7 @@ #include "nsEventDispatcher.h" #include "nsJSUtils.h" #include "nsPIDOMWindow.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsThreadUtils.h" #include "nsWrapperCacheInlines.h" diff --git a/dom/indexedDB/IndexedDatabase.h b/dom/indexedDB/IndexedDatabase.h index 530b2cbc653e..2dac9862e364 100644 --- a/dom/indexedDB/IndexedDatabase.h +++ b/dom/indexedDB/IndexedDatabase.h @@ -15,7 +15,7 @@ #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsError.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsIInputStream.h" diff --git a/dom/ipc/AppProcessChecker.cpp b/dom/ipc/AppProcessChecker.cpp index a85b313a7444..0789ab60d233 100644 --- a/dom/ipc/AppProcessChecker.cpp +++ b/dom/ipc/AppProcessChecker.cpp @@ -6,6 +6,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "AppProcessChecker.h" +#ifdef MOZ_CHILD_PERMISSIONS #include "ContentParent.h" #include "mozIApplication.h" #include "mozilla/hal_sandbox/PHalParent.h" @@ -15,6 +16,7 @@ using namespace mozilla::dom; using namespace mozilla::hal_sandbox; using namespace mozilla::services; +#endif namespace mozilla { diff --git a/dom/ipc/Blob.cpp b/dom/ipc/Blob.cpp index e9505554e575..80f36d13a6b0 100644 --- a/dom/ipc/Blob.cpp +++ b/dom/ipc/Blob.cpp @@ -28,6 +28,7 @@ #include "ContentChild.h" #include "ContentParent.h" +#include "nsNetCID.h" #define PRIVATE_REMOTE_INPUT_STREAM_IID \ {0x30c7699f, 0x51d2, 0x48c8, {0xad, 0x56, 0xc0, 0x16, 0xd7, 0x6f, 0x71, 0x27}} diff --git a/dom/ipc/Blob.h b/dom/ipc/Blob.h index 78fa76c86cce..f824b2c8fed2 100644 --- a/dom/ipc/Blob.h +++ b/dom/ipc/Blob.h @@ -12,16 +12,13 @@ #include "mozilla/dom/PBlobParent.h" #include "mozilla/dom/PBlobStreamChild.h" #include "mozilla/dom/PBlobStreamParent.h" -#include "mozilla/dom/PContent.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsTArray.h" -#include "nsThreadUtils.h" class nsIDOMBlob; -class nsIIPCSerializableInputStream; -class nsIInputStream; +template class nsRevocableEventPtr; namespace mozilla { namespace dom { diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 5483d05697ac..7216f949eb14 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -20,11 +20,9 @@ #include "mozilla/dom/ExternalHelperAppChild.h" #include "mozilla/dom/PCrashReporterChild.h" #include "mozilla/dom/DOMStorageIPC.h" -#include "mozilla/Hal.h" #include "mozilla/hal_sandbox/PHalChild.h" #include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/ipc/TestShellChild.h" -#include "mozilla/ipc/XPCShellEnvironment.h" #include "mozilla/layers/CompositorChild.h" #include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/PCompositorChild.h" @@ -35,17 +33,17 @@ #endif #include "mozilla/unused.h" +#include "nsIConsoleListener.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIMemoryReporter.h" #include "nsIMemoryInfoDumper.h" #include "nsIMutable.h" #include "nsIObserverService.h" -#include "nsTObserverArray.h" #include "nsIObserver.h" #include "nsIScriptSecurityManager.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" #include "nsXULAppAPI.h" -#include "nsWeakReference.h" #include "nsIScriptError.h" #include "nsIConsoleService.h" #include "nsJSEnvironment.h" @@ -56,7 +54,6 @@ #include "nsIJSRuntimeService.h" #include "IHistory.h" -#include "nsDocShellCID.h" #include "nsNetUtil.h" #include "base/message_loop.h" @@ -64,14 +61,13 @@ #include "base/task.h" #include "nsChromeRegistryContent.h" -#include "mozilla/chrome/RegistryMessageUtils.h" #include "nsFrameMessageManager.h" #include "nsIGeolocationProvider.h" -#include "JavaScriptParent.h" #include "mozilla/dom/PMemoryReportRequestChild.h" #ifdef MOZ_PERMISSIONS +#include "nsIScriptSecurityManager.h" #include "nsPermission.h" #include "nsPermissionManager.h" #endif @@ -96,7 +92,6 @@ #include "mozilla/dom/indexedDB/PIndexedDBChild.h" #include "mozilla/dom/mobilemessage/SmsChild.h" -#include "mozilla/dom/telephony/TelephonyChild.h" #include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h" #include "mozilla/dom/bluetooth/PBluetoothChild.h" #include "mozilla/dom/PFMRadioChild.h" @@ -111,13 +106,12 @@ #include "ProcessUtils.h" #include "StructuredCloneUtils.h" #include "URIUtils.h" -#include "nsIScriptSecurityManager.h" #include "nsContentUtils.h" #include "nsIPrincipal.h" #include "nsDeviceStorage.h" #include "AudioChannelService.h" #include "JavaScriptChild.h" -#include "ProcessPriorityManager.h" +#include "mozilla/dom/telephony/PTelephonyChild.h" using namespace base; using namespace mozilla; @@ -509,14 +503,14 @@ ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier, return true; } -PCompositorChild* +bool ContentChild::AllocPCompositorChild(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { return CompositorChild::Create(aTransport, aOtherProcess); } -PImageBridgeChild* +bool ContentChild::AllocPImageBridgeChild(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index f22db3990748..27a6cbb947ea 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -9,11 +9,8 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/PContentChild.h" -#include "mozilla/dom/TabContext.h" #include "mozilla/dom/ipc/Blob.h" - -#include "nsTArray.h" -#include "nsIConsoleListener.h" +#include "nsWeakPtr.h" struct ChromePackage; class nsIDOMBlob; @@ -80,10 +77,10 @@ public: void SetProcessName(const nsAString& aName); const void GetProcessName(nsAString& aName); - PCompositorChild* + bool AllocPCompositorChild(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) MOZ_OVERRIDE; - PImageBridgeChild* + bool AllocPImageBridgeChild(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) MOZ_OVERRIDE; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 52e13b9d67fc..f4cce346f363 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -37,7 +37,6 @@ #include "mozilla/dom/GeolocationBinding.h" #include "mozilla/dom/telephony/TelephonyParent.h" #include "SmsParent.h" -#include "mozilla/Hal.h" #include "mozilla/hal_sandbox/PHalParent.h" #include "mozilla/ipc/TestShellParent.h" #include "mozilla/ipc/InputStreamUtils.h" @@ -48,8 +47,6 @@ #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "mozilla/unused.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" #include "nsAppRunner.h" #include "nsAutoPtr.h" #include "nsCDefaultURIFixup.h" @@ -59,9 +56,7 @@ #include "nsConsoleMessage.h" #include "nsConsoleService.h" #include "nsDebugImpl.h" -#include "nsDirectoryServiceDefs.h" #include "nsDOMFile.h" -#include "nsExternalHelperAppService.h" #include "nsFrameMessageManager.h" #include "nsHashPropertyBag.h" #include "nsIAlertsService.h" @@ -71,6 +66,7 @@ #include "nsIDOMGeoGeolocation.h" #include "nsIDOMWakeLock.h" #include "nsIDOMWindow.h" +#include "nsIExternalProtocolService.h" #include "nsIFilePicker.h" #include "nsIMemoryReporter.h" #include "nsIMozBrowserFrame.h" @@ -79,14 +75,12 @@ #include "nsIPresShell.h" #include "nsIRemoteBlob.h" #include "nsIScriptError.h" -#include "nsIScriptSecurityManager.h" #include "nsIStyleSheet.h" #include "nsISupportsPrimitives.h" #include "nsIURIFixup.h" #include "nsIWindowWatcher.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" -#include "nsSystemInfo.h" #include "nsThreadUtils.h" #include "nsToolkitCompsCID.h" #include "nsWidgetsCID.h" @@ -99,13 +93,12 @@ #include "nsIWebBrowserChrome.h" #include "nsIDocShell.h" -#ifdef ANDROID -# include "gfxAndroidPlatform.h" +#if defined(ANDROID) || defined(LINUX) +#include "nsSystemInfo.h" #endif -#ifdef MOZ_CRASHREPORTER -# include "nsExceptionHandler.h" -# include "nsICrashReporter.h" +#ifdef ANDROID +# include "gfxAndroidPlatform.h" #endif #ifdef MOZ_PERMISSIONS @@ -1782,14 +1775,14 @@ ContentParent::Observe(nsISupports* aSubject, return NS_OK; } -PCompositorParent* +bool ContentParent::AllocPCompositorParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { return CompositorParent::Create(aTransport, aOtherProcess); } -PImageBridgeParent* +bool ContentParent::AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 6fb06d3ba381..ef6f2df98b96 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -7,11 +7,7 @@ #ifndef mozilla_dom_ContentParent_h #define mozilla_dom_ContentParent_h -#include "base/waitable_event_watcher.h" - #include "mozilla/dom/PContentParent.h" -#include "mozilla/dom/PMemoryReportRequestParent.h" -#include "mozilla/dom/TabContext.h" #include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/dom/ipc/Blob.h" #include "mozilla/Attributes.h" @@ -22,12 +18,7 @@ #include "nsFrameMessageManager.h" #include "nsIObserver.h" #include "nsIThreadInternal.h" -#include "nsNetUtil.h" -#include "nsIPermissionManager.h" #include "nsIDOMGeoPositionCallback.h" -#include "nsCOMArray.h" -#include "nsDataHashtable.h" -#include "nsHashKeys.h" #include "PermissionMessageUtils.h" #define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown") @@ -36,6 +27,7 @@ class mozIApplication; class nsConsoleService; class nsIDOMBlob; class nsIMemoryReporter; +template class nsDataHashtable; namespace mozilla { @@ -59,6 +51,8 @@ class Element; class TabParent; class PStorageParent; class ClonedMessageData; +class MemoryReport; +class TabContext; class ContentParent : public PContentParent , public nsIObserver @@ -256,10 +250,10 @@ private: */ void ShutDownProcess(bool aCloseWithError); - PCompositorParent* + bool AllocPCompositorParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) MOZ_OVERRIDE; - PImageBridgeParent* + bool AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) MOZ_OVERRIDE; diff --git a/dom/ipc/CrashReporterChild.h b/dom/ipc/CrashReporterChild.h index c99adb334275..9eb719e50865 100644 --- a/dom/ipc/CrashReporterChild.h +++ b/dom/ipc/CrashReporterChild.h @@ -8,10 +8,6 @@ #define mozilla_dom_CrashReporterChild_h #include "mozilla/dom/PCrashReporterChild.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsXULAppAPI.h" -#endif namespace mozilla { namespace dom { diff --git a/dom/ipc/CrashReporterParent.cpp b/dom/ipc/CrashReporterParent.cpp index a825b6c428d8..356c2d1c25cb 100644 --- a/dom/ipc/CrashReporterParent.cpp +++ b/dom/ipc/CrashReporterParent.cpp @@ -4,8 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "CrashReporterParent.h" - -#include "base/process_util.h" +#include "nsXULAppAPI.h" #include diff --git a/dom/ipc/CrashReporterParent.h b/dom/ipc/CrashReporterParent.h index 5f78567ba10c..1af79583a686 100644 --- a/dom/ipc/CrashReporterParent.h +++ b/dom/ipc/CrashReporterParent.h @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/PCrashReporterParent.h" #include "mozilla/dom/TabMessageUtils.h" -#include "nsXULAppAPI.h" #include "nsIFile.h" #ifdef MOZ_CRASHREPORTER #include "nsExceptionHandler.h" diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 64eca90a6673..3ce40be08574 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -8,6 +8,7 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/Preferences.h" #include "mozilla/dom/ContentParent.h" +#include "nsIPropertyBag2.h" using namespace mozilla; using namespace mozilla::hal; diff --git a/dom/ipc/PreallocatedProcessManager.h b/dom/ipc/PreallocatedProcessManager.h index 19c2b419738e..025e494fc87a 100644 --- a/dom/ipc/PreallocatedProcessManager.h +++ b/dom/ipc/PreallocatedProcessManager.h @@ -8,10 +8,8 @@ #define mozilla_PreallocatedProcessManager_h #include "base/basictypes.h" -#include "mozilla/StaticPtr.h" #include "nsCOMPtr.h" #include "nsIObserver.h" -#include "nsAutoPtr.h" namespace mozilla { namespace dom { diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index bd7a2bce73da..081e45d669b8 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -16,25 +16,14 @@ #include "AudioChannelService.h" #include "prlog.h" #include "nsPrintfCString.h" -#include "nsWeakPtr.h" #include "nsXULAppAPI.h" #include "nsIFrameLoader.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsITimer.h" -#include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsIDocument.h" -#include "nsIDOMEventListener.h" -#include "nsIDOMWindow.h" -#include "nsIDOMEvent.h" -#include "nsIDOMDocument.h" -#include "nsPIDOMWindow.h" #include "StaticPtr.h" #include "nsIMozBrowserFrame.h" #include "nsIObserver.h" #include "nsITimer.h" -#include "nsPrintfCString.h" -#include "prlog.h" +#include "nsIPropertyBag2.h" #ifdef XP_WIN #include diff --git a/dom/ipc/ProcessPriorityManager.h b/dom/ipc/ProcessPriorityManager.h index 34806d33efd0..9a42f38d169b 100644 --- a/dom/ipc/ProcessPriorityManager.h +++ b/dom/ipc/ProcessPriorityManager.h @@ -8,9 +8,6 @@ #define mozilla_ProcessPriorityManager_h_ #include "mozilla/HalTypes.h" -#include "mozilla/StaticPtr.h" -#include "nsIObserver.h" -#include "nsDataHashtable.h" namespace mozilla { namespace dom { diff --git a/dom/ipc/StructuredCloneUtils.cpp b/dom/ipc/StructuredCloneUtils.cpp index 00f64235d936..60a7808b47b6 100644 --- a/dom/ipc/StructuredCloneUtils.cpp +++ b/dom/ipc/StructuredCloneUtils.cpp @@ -13,7 +13,7 @@ #include "nsContentUtils.h" #include "nsJSEnvironment.h" -#include "nsThreadUtils.h" +#include "MainThreadUtils.h" #include "StructuredCloneTags.h" #include "jsapi.h" diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 7be72d21e2dc..23275f2ac86a 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -9,28 +9,23 @@ #include "TabChild.h" #include "Layers.h" -#include "Blob.h" #include "ContentChild.h" #include "IndexedDBChild.h" #include "mozilla/Preferences.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/IntentionalCrash.h" #include "mozilla/docshell/OfflineCacheUpdateChild.h" -#include "mozilla/dom/PContentChild.h" #include "mozilla/dom/PContentDialogChild.h" #include "mozilla/ipc/DocumentRendererChild.h" #include "mozilla/ipc/FileDescriptorUtils.h" #include "mozilla/layers/AsyncPanZoomController.h" #include "mozilla/layers/CompositorChild.h" #include "mozilla/layers/ImageBridgeChild.h" -#include "mozilla/layers/PLayerTransactionChild.h" #include "mozilla/layers/ShadowLayers.h" #include "mozilla/layout/RenderFrameChild.h" #include "mozilla/StaticPtr.h" #include "mozilla/unused.h" #include "mozIApplication.h" -#include "nsComponentManagerUtils.h" -#include "nsComponentManagerUtils.h" #include "nsContentUtils.h" #include "nsCxPusher.h" #include "nsEmbedCID.h" @@ -40,51 +35,32 @@ #include "nsExceptionHandler.h" #endif #include "mozilla/dom/Element.h" -#include "nsIAppsService.h" #include "nsIBaseWindow.h" #include "nsICachedFileDescriptorListener.h" -#include "nsIComponentManager.h" +#include "nsIDialogParamBlock.h" #include "nsIDocumentInlines.h" -#include "nsIDOMClassInfo.h" -#include "nsIDOMElement.h" +#include "nsIDocShellTreeOwner.h" #include "nsIDOMEvent.h" #include "nsIDOMWindow.h" #include "nsIDOMWindowUtils.h" #include "nsIDocShell.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsIJSRuntimeService.h" -#include "nsISSLStatusProvider.h" -#include "nsIScriptContext.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptSecurityManager.h" -#include "nsISecureBrowserUI.h" -#include "nsIServiceManager.h" -#include "nsISupportsImpl.h" #include "nsIURI.h" #include "nsIURIFixup.h" #include "nsCDefaultURIFixup.h" -#include "nsView.h" #include "nsIWebBrowser.h" #include "nsIWebBrowserFocus.h" #include "nsIWebBrowserSetup.h" #include "nsIWebProgress.h" -#include "nsIXPCSecurityManager.h" #include "nsInterfaceHashtable.h" #include "nsPIDOMWindow.h" #include "nsPIWindowRoot.h" -#include "nsGlobalWindow.h" #include "nsLayoutUtils.h" -#include "nsPresContext.h" #include "nsPrintfCString.h" -#include "nsScriptLoader.h" -#include "nsSerializationHelper.h" #include "nsThreadUtils.h" #include "nsWeakReference.h" #include "PCOMContentPermissionRequestChild.h" #include "PuppetWidget.h" #include "StructuredCloneUtils.h" -#include "xpcpublic.h" #include "nsViewportInfo.h" #include "JavaScriptChild.h" #include "APZCCallbackHelper.h" diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 0848deee45fd..d6b9097dae30 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -18,31 +18,23 @@ #include "nsIWebBrowserChrome2.h" #include "nsIEmbeddingSiteWindow.h" #include "nsIWebBrowserChromeFocus.h" -#include "nsIWidget.h" #include "nsIDOMEventListener.h" #include "nsIInterfaceRequestor.h" #include "nsIWindowProvider.h" #include "nsIDOMWindow.h" #include "nsIDocShell.h" -#include "nsIDocShellTreeItem.h" -#include "nsIDocShellTreeOwner.h" #include "nsIDocument.h" -#include "nsNetUtil.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsFrameMessageManager.h" #include "nsIWebProgressListener.h" #include "nsDOMEventTargetHelper.h" #include "nsIDialogCreator.h" -#include "nsIDialogParamBlock.h" #include "nsIPresShell.h" -#include "nsIPrincipal.h" #include "nsIScriptObjectPrincipal.h" #include "nsWeakReference.h" #include "nsITabChild.h" #include "mozilla/Attributes.h" -#include "FrameMetrics.h" -#include "ProcessUtils.h" #include "mozilla/dom/TabContext.h" -#include "mozilla/dom/ContentChild.h" struct gfxMatrix; class nsICachedFileDescriptorListener; diff --git a/dom/ipc/TabContext.cpp b/dom/ipc/TabContext.cpp index eaea0b33e46c..a774ee097386 100644 --- a/dom/ipc/TabContext.cpp +++ b/dom/ipc/TabContext.cpp @@ -5,9 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/TabContext.h" +#include "mozilla/dom/PTabContext.h" #include "mozilla/dom/TabParent.h" #include "mozilla/dom/TabChild.h" #include "nsIAppsService.h" +#include "nsIScriptSecurityManager.h" #define NO_APP_ID (nsIScriptSecurityManager::NO_APP_ID) diff --git a/dom/ipc/TabContext.h b/dom/ipc/TabContext.h index 4214dd2033b9..fc6fbfec1e2a 100644 --- a/dom/ipc/TabContext.h +++ b/dom/ipc/TabContext.h @@ -7,16 +7,15 @@ #ifndef mozilla_dom_TabContext_h #define mozilla_dom_TabContext_h -#include "mozilla/Assertions.h" -#include "mozilla/dom/PContent.h" -#include "mozilla/dom/PBrowser.h" #include "mozilla/layout/RenderFrameUtils.h" -#include "nsIScriptSecurityManager.h" #include "mozIApplication.h" +#include "nsCOMPtr.h" namespace mozilla { namespace dom { +struct IPCTabContext; + /** * TabContext encapsulates information about an iframe that may be a mozbrowser * or mozapp. You can ask whether a TabContext corresponds to a mozbrowser or diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index a26fd31754c9..f18159d966a1 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -8,7 +8,6 @@ #include "TabParent.h" -#include "Blob.h" #include "IDBFactory.h" #include "IndexedDBParent.h" #include "mozIApplication.h" @@ -25,38 +24,34 @@ #include "nsContentPermissionHelper.h" #include "nsContentUtils.h" #include "nsDebug.h" -#include "nsEventDispatcher.h" #include "nsEventStateManager.h" #include "nsFocusManager.h" #include "nsFrameLoader.h" #include "nsIContent.h" #include "nsIDocShell.h" -#include "nsIDOMApplicationRegistry.h" +#include "nsIDocShellTreeOwner.h" #include "nsIDOMElement.h" #include "nsIDOMEvent.h" -#include "nsIDOMHTMLFrameElement.h" #include "nsIDOMWindow.h" #include "nsIDialogCreator.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIPromptFactory.h" #include "nsIURI.h" -#include "nsIMozBrowserFrame.h" -#include "nsIScriptSecurityManager.h" #include "nsIWebBrowserChrome.h" #include "nsIXULBrowserWindow.h" #include "nsIXULWindow.h" #include "nsViewManager.h" #include "nsIWidget.h" #include "nsIWindowWatcher.h" -#include "nsNetUtil.h" #include "nsPIDOMWindow.h" #include "nsPrintfCString.h" -#include "nsSerializationHelper.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "private/pprio.h" #include "StructuredCloneUtils.h" #include "JavaScriptParent.h" #include "TabChild.h" +#include "nsNetCID.h" #include using namespace mozilla::dom; diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index bc8f8cd11d11..4e323649f446 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -7,25 +7,19 @@ #ifndef mozilla_tabs_TabParent_h #define mozilla_tabs_TabParent_h -#include "base/basictypes.h" - -#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/PBrowserParent.h" #include "mozilla/dom/PContentDialogParent.h" #include "mozilla/dom/TabContext.h" -#include "mozilla/ipc/GeckoChildProcessHost.h" #include "nsCOMPtr.h" #include "nsIAuthPromptProvider.h" #include "nsIBrowserDOMWindow.h" #include "nsIDialogParamBlock.h" #include "nsISecureBrowserUI.h" #include "nsITabParent.h" -#include "nsWeakReference.h" #include "Units.h" #include "js/TypeDecls.h" struct gfxMatrix; -class mozIApplication; class nsFrameLoader; class nsIURI; class CpowHolder; @@ -44,6 +38,7 @@ class RenderFrameParent; namespace dom { class ClonedMessageData; +class ContentParent; class Element; struct StructuredCloneData; diff --git a/dom/media/MediaPermissionGonk.cpp b/dom/media/MediaPermissionGonk.cpp index 8ce436ba3be5..fe1862ee3914 100644 --- a/dom/media/MediaPermissionGonk.cpp +++ b/dom/media/MediaPermissionGonk.cpp @@ -18,6 +18,7 @@ #include "mozilla/dom/PBrowserChild.h" #include "mozilla/dom/TabChild.h" #include "mozilla/dom/MediaStreamTrackBinding.h" +#include "nsISupportsPrimitives.h" #define AUDIO_PERMISSION_NAME "audio-capture" diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 21b1bf26445f..e7a236f6a78b 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -113,18 +113,32 @@ function getUserMedia(constraints, onSuccess, onError) { * Test method to execute after initialization */ function runTest(aCallback) { - SimpleTest.waitForExplicitFinish(); - SpecialPowers.pushPrefEnv({'set': [ - ['media.peerconnection.enabled', true], - ['media.navigator.permission.disabled', true]] - }, function () { - try { - aCallback(); - } - catch (err) { - unexpectedCallbackAndFinish()(err); - } - }); + if (window.SimpleTest) { + // Running as a Mochitest. + SimpleTest.waitForExplicitFinish(); + SpecialPowers.pushPrefEnv({'set': [ + ['media.peerconnection.enabled', true], + ['media.navigator.permission.disabled', true]] + }, function () { + try { + aCallback(); + } + catch (err) { + unexpectedCallbackAndFinish()(err); + } + }); + } else { + // Steeplechase, let it call the callback. + window.run_test = function(is_initiator) { + var options = {is_local: is_initiator, + is_remote: !is_initiator}; + aCallback(options); + }; + // Also load the steeplechase test code. + var s = document.createElement("script"); + s.src = "/test.js"; + document.head.appendChild(s); + } } /** diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 67a963566288..9068c71f7d17 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -224,6 +224,20 @@ CommandChain.prototype = { this.insertBefore(id, commands); return oldCommands; + }, + + /** + * Remove all commands whose identifiers match the specified regex. + * + * @param {regex} id_match + * Regular expression to match command identifiers. + */ + filterOut : function (id_match) { + for (var i = this._commands.length - 1; i >= 0; i--) { + if (id_match.test(this._commands[i][0])) { + this._commands.splice(i, 1); + } + } } }; @@ -318,6 +332,10 @@ MediaElementChecker.prototype = { * Optional options for the peer connection test * @param {object} [options.commands=commandsPeerConnection] * Commands to run for the test + * @param {bool} [options.is_local=true] + * true if this test should run the tests for the "local" side. + * @param {bool} [options.is_remote=true] + * true if this test should run the tests for the "remote" side. * @param {object} [options.config_pc1=undefined] * Configuration for the local peer connection instance * @param {object} [options.config_pc2=undefined] @@ -328,19 +346,34 @@ function PeerConnectionTest(options) { // If no options are specified make it an empty object options = options || { }; options.commands = options.commands || commandsPeerConnection; + options.is_local = "is_local" in options ? options.is_local : true; + options.is_remote = "is_remote" in options ? options.is_remote : true; - this.pcLocal = new PeerConnectionWrapper('pcLocal', options.config_pc1); - this.pcRemote = new PeerConnectionWrapper('pcRemote', options.config_pc2 || options.config_pc1); + if (options.is_local) + this.pcLocal = new PeerConnectionWrapper('pcLocal', options.config_pc1); + else + this.pcLocal = null; + + if (options.is_remote) + this.pcRemote = new PeerConnectionWrapper('pcRemote', options.config_pc2 || options.config_pc1); + else + this.pcRemote = null; this.connected = false; // Create command chain instance and assign default commands this.chain = new CommandChain(this, options.commands); + if (!options.is_local) { + this.chain.filterOut(/^PC_LOCAL/); + } + if (!options.is_remote) { + this.chain.filterOut(/^PC_REMOTE/); + } var self = this; this.chain.onFinished = function () { self.teardown(); - } + }; } /** @@ -354,8 +387,10 @@ PeerConnectionTest.prototype.close = function PCT_close(onSuccess) { // There is no onclose event for the remote peer existent yet. So close it // side-by-side with the local peer. - this.pcLocal.close(); - this.pcRemote.close(); + if (this.pcLocal) + this.pcLocal.close(); + if (this.pcRemote) + this.pcRemote.close(); this.connected = false; onSuccess(); @@ -444,8 +479,10 @@ function PCT_setLocalDescription(peer, desc, onSuccess) { */ PeerConnectionTest.prototype.setMediaConstraints = function PCT_setMediaConstraints(constraintsLocal, constraintsRemote) { - this.pcLocal.constraints = constraintsLocal; - this.pcRemote.constraints = constraintsRemote; + if (this.pcLocal) + this.pcLocal.constraints = constraintsLocal; + if (this.pcRemote) + this.pcRemote.constraints = constraintsRemote; }; /** @@ -455,7 +492,8 @@ function PCT_setMediaConstraints(constraintsLocal, constraintsRemote) { */ PeerConnectionTest.prototype.setOfferConstraints = function PCT_setOfferConstraints(constraints) { - this.pcLocal.offerConstraints = constraints; + if (this.pcLocal) + this.pcLocal.offerConstraints = constraints; }; /** @@ -506,7 +544,10 @@ PeerConnectionTest.prototype.run = function PCT_run() { PeerConnectionTest.prototype.teardown = function PCT_teardown() { this.close(function () { info("Test finished"); - SimpleTest.finish(); + if (window.SimpleTest) + SimpleTest.finish(); + else + finish(); }); }; diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js index f8a6fa33d14f..ccd9927c76ea 100644 --- a/dom/media/tests/mochitest/templates.js +++ b/dom/media/tests/mochitest/templates.js @@ -19,10 +19,16 @@ var commandsPeerConnection = [ } ], [ - 'PC_CHECK_INITIAL_SIGNALINGSTATE', + 'PC_LOCAL_CHECK_INITIAL_SIGNALINGSTATE', function (test) { is(test.pcLocal.signalingState, "stable", "Initial local signalingState is 'stable'"); + test.next(); + } + ], + [ + 'PC_REMOTE_CHECK_INITIAL_SIGNALINGSTATE', + function (test) { is(test.pcRemote.signalingState, "stable", "Initial remote signalingState is 'stable'"); test.next(); @@ -34,6 +40,10 @@ var commandsPeerConnection = [ test.createOffer(test.pcLocal, function () { is(test.pcLocal.signalingState, "stable", "Local create offer does not change signaling state"); + if (!test.pcRemote) { + send_message({"offer": test.pcLocal._last_offer, + "media_constraints": test.pcLocal.constraints}); + } test.next(); }); } @@ -48,10 +58,27 @@ var commandsPeerConnection = [ }); } ], + [ + 'PC_REMOTE_GET_OFFER', + function (test) { + if (test.pcLocal) { + test._local_offer = test.pcLocal._last_offer; + test._local_constraints = test.pcLocal.constraints; + test.next(); + } else { + wait_for_message().then(function(message) { + ok("offer" in message, "Got an offer message"); + test._local_offer = new mozRTCSessionDescription(message.offer); + test._local_constraints = message.media_constraints; + test.next(); + }); + } + } + ], [ 'PC_REMOTE_SET_REMOTE_DESCRIPTION', function (test) { - test.setRemoteDescription(test.pcRemote, test.pcLocal._last_offer, function () { + test.setRemoteDescription(test.pcRemote, test._local_offer, function () { is(test.pcRemote.signalingState, "have-remote-offer", "signalingState after remote setRemoteDescription is 'have-remote-offer'"); test.next(); @@ -64,14 +91,35 @@ var commandsPeerConnection = [ test.createAnswer(test.pcRemote, function () { is(test.pcRemote.signalingState, "have-remote-offer", "Remote createAnswer does not change signaling state"); + if (!test.pcLocal) { + send_message({"answer": test.pcRemote._last_answer, + "media_constraints": test.pcRemote.constraints}); + } test.next(); }); } ], + [ + 'PC_LOCAL_GET_ANSWER', + function (test) { + if (test.pcRemote) { + test._remote_answer = test.pcRemote._last_answer; + test._remote_constraints = test.pcRemote.constraints; + test.next(); + } else { + wait_for_message().then(function(message) { + ok("answer" in message, "Got an answer message"); + test._remote_answer = new mozRTCSessionDescription(message.answer); + test._remote_constraints = message.media_constraints; + test.next(); + }); + } + } + ], [ 'PC_LOCAL_SET_REMOTE_DESCRIPTION', function (test) { - test.setRemoteDescription(test.pcLocal, test.pcRemote._last_answer, function () { + test.setRemoteDescription(test.pcLocal, test._remote_answer, function () { is(test.pcLocal.signalingState, "stable", "signalingState after local setRemoteDescription is 'stable'"); test.next(); @@ -91,14 +139,14 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_CHECK_MEDIA_STREAMS', function (test) { - test.pcLocal.checkMediaStreams(test.pcRemote.constraints); + test.pcLocal.checkMediaStreams(test._remote_constraints); test.next(); } ], [ 'PC_REMOTE_CHECK_MEDIA_STREAMS', function (test) { - test.pcRemote.checkMediaStreams(test.pcLocal.constraints); + test.pcRemote.checkMediaStreams(test._local_constraints); test.next(); } ], diff --git a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html b/dom/media/tests/mochitest/test_peerConnection_basicAudio.html index 51d1a9072709..bfec6e32de9f 100644 --- a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio.html @@ -17,8 +17,8 @@ }); var test; - runTest(function () { - test = new PeerConnectionTest(); + runTest(function (options) { + test = new PeerConnectionTest(options); test.setMediaConstraints([{audio: true}], [{audio: true}]); test.run(); }); diff --git a/dom/mobilemessage/src/ipc/SmsChild.cpp b/dom/mobilemessage/src/ipc/SmsChild.cpp index ead1843576d9..11fa7e440fb1 100644 --- a/dom/mobilemessage/src/ipc/SmsChild.cpp +++ b/dom/mobilemessage/src/ipc/SmsChild.cpp @@ -11,6 +11,7 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType #include "MobileMessageThread.h" +#include "MainThreadUtils.h" using namespace mozilla; using namespace mozilla::dom; diff --git a/dom/network/src/TCPSocketParent.cpp b/dom/network/src/TCPSocketParent.cpp index 31732ce76ef0..a911d753f767 100644 --- a/dom/network/src/TCPSocketParent.cpp +++ b/dom/network/src/TCPSocketParent.cpp @@ -14,6 +14,7 @@ #include "mozilla/net/PNeckoParent.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/TabParent.h" +#include "nsIScriptSecurityManager.h" namespace IPC { diff --git a/dom/plugins/base/nsPluginTags.h b/dom/plugins/base/nsPluginTags.h index c166ac3b9c0b..c4a5a8938abc 100644 --- a/dom/plugins/base/nsPluginTags.h +++ b/dom/plugins/base/nsPluginTags.h @@ -13,7 +13,7 @@ #include "nsCOMArray.h" #include "nsIPluginTag.h" #include "nsITimer.h" -#include "nsStringGlue.h" +#include "nsString.h" class nsPluginHost; struct PRLibrary; diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index 3724366f515e..42601da9b094 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -11,6 +11,7 @@ #include "prmem.h" #include "prenv.h" #include "prerror.h" +#include "prio.h" #include #include "nsString.h" #include "nsIFile.h" diff --git a/dom/plugins/ipc/PluginIdentifierChild.h b/dom/plugins/ipc/PluginIdentifierChild.h index fcc7e6d9e7e2..4b8d188e30fb 100644 --- a/dom/plugins/ipc/PluginIdentifierChild.h +++ b/dom/plugins/ipc/PluginIdentifierChild.h @@ -11,7 +11,7 @@ #include "npapi.h" #include "npruntime.h" -#include "nsStringGlue.h" +#include "nsString.h" namespace mozilla { namespace plugins { diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index c2ae48cf61a5..9260f225e068 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -18,7 +18,7 @@ #include "npruntime.h" #include "npfunctions.h" #include "nsAutoPtr.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "prlog.h" #include "nsHashKeys.h" diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 1705e75ad310..09279f381e42 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -493,19 +493,10 @@ PluginModuleParent::TerminateChildProcess(MessageLoop* aMsgLoop) // this must run before the error notification from the channel, // or not at all bool isFromHangUI = aMsgLoop != MessageLoop::current(); - if (isFromHangUI) { - // If we're posting from a different thread we can't create - // the task via mTaskFactory - aMsgLoop->PostTask(FROM_HERE, - NewRunnableMethod(this, - &PluginModuleParent::CleanupFromTimeout, - isFromHangUI)); - } else { - aMsgLoop->PostTask( - FROM_HERE, - mTaskFactory.NewRunnableMethod( - &PluginModuleParent::CleanupFromTimeout, isFromHangUI)); - } + aMsgLoop->PostTask( + FROM_HERE, + mTaskFactory.NewRunnableMethod( + &PluginModuleParent::CleanupFromTimeout, isFromHangUI)); if (!KillProcess(OtherProcess(), 1, false)) NS_WARNING("failed to kill subprocess!"); diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 27907ef12f3f..a8226312228a 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -10,6 +10,7 @@ #include "base/process.h" #include "mozilla/FileUtils.h" #include "mozilla/PluginLibrary.h" +#include "mozilla/plugins/ScopedMethodFactory.h" #include "mozilla/plugins/PluginProcessParent.h" #include "mozilla/plugins/PPluginModuleParent.h" #include "npapi.h" @@ -302,7 +303,7 @@ private: const NPNetscapeFuncs* mNPNIface; nsDataHashtable, PluginIdentifierParent*> mIdentifiers; nsNPAPIPlugin* mPlugin; - ScopedRunnableMethodFactory mTaskFactory; + ScopedMethodFactory mTaskFactory; nsString mPluginDumpID; nsString mBrowserDumpID; nsString mHangID; diff --git a/dom/plugins/ipc/ScopedMethodFactory.h b/dom/plugins/ipc/ScopedMethodFactory.h new file mode 100644 index 000000000000..f48063e93a44 --- /dev/null +++ b/dom/plugins/ipc/ScopedMethodFactory.h @@ -0,0 +1,87 @@ +/* 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/. */ + +#ifndef mozilla_plugins_ScopedMethodFactory_h +#define mozilla_plugins_ScopedMethodFactory_h + +#include + +/* + * This is based on the ScopedRunnableMethodFactory from ipc/chromium/src/base/task.h + * Chromiums factories assert if tasks are created and run on different threads, + * which is something we need to do in PluginModuleParent (hang UI vs. main thread). + * ScopedMethodFactory just provides cancellable tasks that don't assert this. + */ + +namespace mozilla { +namespace plugins { + +template +class ScopedMethodFactory : public RevocableStore +{ +private: + template + class TaskWrapper : public TaskType + { + public: + explicit TaskWrapper(RevocableStore* store) : revocable_(store) { } + + virtual void Run() { + if (!revocable_.revoked()) + TaskType::Run(); + } + + private: + Revocable revocable_; + }; + +public: + explicit ScopedMethodFactory(T* object) : object_(object) { } + + template + inline Task* NewRunnableMethod(Method method) { + typedef TaskWrapper > TaskWrapper; + + TaskWrapper* task = new TaskWrapper(this); + task->Init(object_, method, MakeTuple()); + return task; + } + + template + inline Task* NewRunnableMethod(Method method, const A& a) { + typedef TaskWrapper > > TaskWrapper; + + TaskWrapper* task = new TaskWrapper(this); + task->Init(object_, method, MakeTuple(a)); + return task; + } + +protected: + template + class RunnableMethod : public Task { + public: + RunnableMethod() { } + + void Init(T* obj, Method meth, const Params& params) { + obj_ = obj; + meth_ = meth; + params_ = params; + } + + virtual void Run() { DispatchToMethod(obj_, meth_, params_); } + + private: + T* obj_; + Method meth_; + Params params_; + }; + +private: + T* object_; +}; + +} // namespace plugins +} // namespace mozilla + +#endif // mozilla_plugins_ScopedMethodFactory_h diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build index 753a36d3955e..8741dfa7c625 100644 --- a/dom/plugins/ipc/moz.build +++ b/dom/plugins/ipc/moz.build @@ -39,6 +39,7 @@ EXPORTS.mozilla.plugins += [ 'PluginStreamChild.h', 'PluginStreamParent.h', 'PluginUtilsOSX.h', + 'ScopedMethodFactory.h', 'StreamNotifyChild.h', 'StreamNotifyParent.h', ] diff --git a/dom/power/WakeLock.cpp b/dom/power/WakeLock.cpp index 93a8249655af..e7787ea0a1b7 100644 --- a/dom/power/WakeLock.cpp +++ b/dom/power/WakeLock.cpp @@ -14,6 +14,7 @@ #include "nsIDOMWindow.h" #include "nsIDOMEvent.h" #include "nsPIDOMWindow.h" +#include "nsIPropertyBag2.h" DOMCI_DATA(MozWakeLock, mozilla::dom::power::WakeLock) diff --git a/dom/quota/FileStreams.cpp b/dom/quota/FileStreams.cpp index be43fa990f75..82ad5c437947 100644 --- a/dom/quota/FileStreams.cpp +++ b/dom/quota/FileStreams.cpp @@ -7,6 +7,7 @@ #include "FileStreams.h" #include "QuotaManager.h" +#include "prio.h" USING_QUOTA_NAMESPACE diff --git a/dom/quota/QuotaCommon.h b/dom/quota/QuotaCommon.h index 97a8f5f8ba2e..d32316664919 100644 --- a/dom/quota/QuotaCommon.h +++ b/dom/quota/QuotaCommon.h @@ -10,7 +10,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsDebug.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #define BEGIN_QUOTA_NAMESPACE \ diff --git a/dom/src/notification/DesktopNotification.cpp b/dom/src/notification/DesktopNotification.cpp index 291f6a3c5e90..675771bd3499 100644 --- a/dom/src/notification/DesktopNotification.cpp +++ b/dom/src/notification/DesktopNotification.cpp @@ -12,6 +12,7 @@ #include "nsGlobalWindow.h" #include "nsIAppsService.h" #include "PCOMContentPermissionRequestChild.h" +#include "nsIScriptSecurityManager.h" namespace mozilla { namespace dom { diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 8488ab456da2..dc91865f68b1 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -17,6 +17,7 @@ #include "nsToolkitCompsCID.h" #include "nsGlobalWindow.h" #include "nsDOMJSUtils.h" +#include "nsIScriptSecurityManager.h" #ifdef MOZ_B2G #include "nsIDOMDesktopNotification.h" #include "nsIAppsService.h" diff --git a/dom/src/storage/DOMStorageIPC.cpp b/dom/src/storage/DOMStorageIPC.cpp index 776cd8364916..3826e85b5811 100644 --- a/dom/src/storage/DOMStorageIPC.cpp +++ b/dom/src/storage/DOMStorageIPC.cpp @@ -10,6 +10,7 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/unused.h" #include "nsIDiskSpaceWatcher.h" +#include "nsThreadUtils.h" namespace mozilla { namespace dom { diff --git a/dom/system/gonk/SystemWorkerManager.h b/dom/system/gonk/SystemWorkerManager.h index 703960d506b9..c007a6ce0833 100644 --- a/dom/system/gonk/SystemWorkerManager.h +++ b/dom/system/gonk/SystemWorkerManager.h @@ -25,7 +25,7 @@ #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsDOMEventTargetHelper.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" class nsIWorkerHolder; diff --git a/dom/system/gonk/nsVolumeMountLock.cpp b/dom/system/gonk/nsVolumeMountLock.cpp index 6684d1829ce9..09699e8ed793 100644 --- a/dom/system/gonk/nsVolumeMountLock.cpp +++ b/dom/system/gonk/nsVolumeMountLock.cpp @@ -12,6 +12,7 @@ #include "nsIVolume.h" #include "nsIVolumeService.h" #include "nsString.h" +#include "nsXULAppAPI.h" #define VOLUME_MANAGER_LOG_TAG "nsVolumeMountLock" #include "VolumeManagerLog.h" diff --git a/dom/telephony/TelephonyCommon.h b/dom/telephony/TelephonyCommon.h index 1da21e126a81..f2bc34311d41 100644 --- a/dom/telephony/TelephonyCommon.h +++ b/dom/telephony/TelephonyCommon.h @@ -14,7 +14,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsDebug.h" #include "nsDOMEventTargetHelper.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #define BEGIN_TELEPHONY_NAMESPACE \ diff --git a/dom/workers/ChromeWorkerScope.cpp b/dom/workers/ChromeWorkerScope.cpp index 432d0ce0882b..d7bd53527cf2 100644 --- a/dom/workers/ChromeWorkerScope.cpp +++ b/dom/workers/ChromeWorkerScope.cpp @@ -9,7 +9,7 @@ #include "nsXPCOM.h" #include "nsNativeCharsetUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "WorkerPrivate.h" diff --git a/dom/workers/File.cpp b/dom/workers/File.cpp index 701f1dc851c0..6e296495329b 100644 --- a/dom/workers/File.cpp +++ b/dom/workers/File.cpp @@ -14,7 +14,7 @@ #include "jsfriendapi.h" #include "nsCOMPtr.h" #include "nsJSUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "mozilla/dom/Exceptions.h" #include "WorkerInlines.h" diff --git a/dom/workers/FileReaderSync.h b/dom/workers/FileReaderSync.h index e676a04495ee..5e131144e988 100644 --- a/dom/workers/FileReaderSync.h +++ b/dom/workers/FileReaderSync.h @@ -11,7 +11,7 @@ #include "mozilla/dom/workers/bindings/DOMBindingBase.h" #include "nsICharsetDetectionObserver.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "mozilla/Attributes.h" class nsIInputStream; diff --git a/dom/workers/Navigator.h b/dom/workers/Navigator.h index e58f4285cd19..df8cce54788a 100644 --- a/dom/workers/Navigator.h +++ b/dom/workers/Navigator.h @@ -8,7 +8,7 @@ #include "Workers.h" #include "mozilla/dom/workers/bindings/DOMBindingBase.h" -#include "nsStringGlue.h" +#include "nsString.h" BEGIN_WORKERS_NAMESPACE diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index 878b74fc2f5b..5f2f1dd33a94 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -18,7 +18,7 @@ #include "nsClassHashtable.h" #include "nsCOMPtr.h" #include "nsHashKeys.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" class nsIThread; diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 3f25fa62de15..811f9f5296f9 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -25,7 +25,7 @@ #include "nsISupportsPrimitives.h" #include "nsNetUtil.h" #include "nsScriptLoader.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsThreadUtils.h" #include "nsXPCOM.h" diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 607b673515a6..c3f9294837fc 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -22,7 +22,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsEventQueue.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsTPriorityQueue.h" #include "StructuredCloneTags.h" diff --git a/dom/workers/Workers.h b/dom/workers/Workers.h index 601ceb7426a7..b64e4cef1700 100644 --- a/dom/workers/Workers.h +++ b/dom/workers/Workers.h @@ -13,7 +13,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsDebug.h" -#include "nsStringGlue.h" +#include "nsString.h" #define BEGIN_WORKERS_NAMESPACE \ namespace mozilla { namespace dom { namespace workers { diff --git a/embedding/browser/webBrowser/nsEmbedStream.cpp b/embedding/browser/webBrowser/nsEmbedStream.cpp index 4f311e67966d..df44a0d4b6b0 100644 --- a/embedding/browser/webBrowser/nsEmbedStream.cpp +++ b/embedding/browser/webBrowser/nsEmbedStream.cpp @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIAsyncInputStream.h" +#include "nsIAsyncOutputStream.h" #include "nsIDocShell.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIPipe.h" diff --git a/embedding/components/appstartup/src/nsAppStartupNotifier.cpp b/embedding/components/appstartup/src/nsAppStartupNotifier.cpp index 72a40ad2f30e..1e63557e8f35 100644 --- a/embedding/components/appstartup/src/nsAppStartupNotifier.cpp +++ b/embedding/components/appstartup/src/nsAppStartupNotifier.cpp @@ -11,7 +11,7 @@ #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsAppStartupNotifier.h" - +#include "nsISimpleEnumerator.h" NS_IMPL_ISUPPORTS1(nsAppStartupNotifier, nsIObserver) diff --git a/extensions/spellcheck/src/mozSpellChecker.cpp b/extensions/spellcheck/src/mozSpellChecker.cpp index 35c3aedb96d3..dee3a0f1e90e 100644 --- a/extensions/spellcheck/src/mozSpellChecker.cpp +++ b/extensions/spellcheck/src/mozSpellChecker.cpp @@ -9,6 +9,7 @@ #include "nsIStringEnumerator.h" #include "nsICategoryManager.h" #include "nsISupportsPrimitives.h" +#include "nsISimpleEnumerator.h" #define DEFAULT_SPELL_CHECKER "@mozilla.org/spellchecker/engine;1" diff --git a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp index 2cb7768b3c45..301f5d284bf0 100644 --- a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp +++ b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp @@ -12,6 +12,7 @@ #include "nsTextServicesCID.h" #include "mozPersonalDictionary.h" #include "mozSpellI18NManager.h" +#include "nsIFile.h" #define NS_SPELLCHECKER_CID \ { /* 8227f019-afc7-461e-b030-9f185d7a0e29 */ \ diff --git a/extensions/widgetutils/src/nsWidgetUtils.cpp b/extensions/widgetutils/src/nsWidgetUtils.cpp index 738fab2599c3..ba02c1b8262b 100644 --- a/extensions/widgetutils/src/nsWidgetUtils.cpp +++ b/extensions/widgetutils/src/nsWidgetUtils.cpp @@ -23,7 +23,7 @@ #include "nsIWindowWatcher.h" #include "nsNetUtil.h" #include "nsRect.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsWeakReference.h" #include "nsIWebBrowser.h" #include "nsIObserverService.h" diff --git a/gfx/layers/ipc/CompositorChild.cpp b/gfx/layers/ipc/CompositorChild.cpp index 2936020e575d..8e8eecd53d8e 100644 --- a/gfx/layers/ipc/CompositorChild.cpp +++ b/gfx/layers/ipc/CompositorChild.cpp @@ -51,7 +51,7 @@ CompositorChild::Destroy() SendStop(); } -/*static*/ PCompositorChild* +/*static*/ bool CompositorChild::Create(Transport* aTransport, ProcessId aOtherProcess) { // There's only one compositor per child process. @@ -62,15 +62,16 @@ CompositorChild::Create(Transport* aTransport, ProcessId aOtherProcess) if (!base::OpenProcessHandle(aOtherProcess, &handle)) { // We can't go on without a compositor. NS_RUNTIMEABORT("Couldn't OpenProcessHandle() to parent process."); - return nullptr; + return false; } if (!child->Open(aTransport, handle, XRE_GetIOMessageLoop(), AsyncChannel::Child)) { NS_RUNTIMEABORT("Couldn't Open() Compositor channel."); - return nullptr; + return false; } // We release this ref in ActorDestroy(). - return sCompositor = child.forget().get(); + sCompositor = child.forget().get(); + return true; } /*static*/ PCompositorChild* diff --git a/gfx/layers/ipc/CompositorChild.h b/gfx/layers/ipc/CompositorChild.h index 1eca1b4cb016..238f42ce6939 100644 --- a/gfx/layers/ipc/CompositorChild.h +++ b/gfx/layers/ipc/CompositorChild.h @@ -38,7 +38,7 @@ public: * or Bridge() request from our parent process. The Transport is to * the compositor's context. */ - static PCompositorChild* + static bool Create(Transport* aTransport, ProcessId aOtherProcess); static PCompositorChild* Get(); diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index ce42e07215a2..fb0d4414d322 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -905,7 +905,7 @@ OpenCompositor(CrossProcessCompositorParent* aCompositor, MOZ_ASSERT(ok); } -/*static*/ PCompositorParent* +/*static*/ bool CompositorParent::Create(Transport* aTransport, ProcessId aOtherProcess) { nsRefPtr cpcp = @@ -913,16 +913,14 @@ CompositorParent::Create(Transport* aTransport, ProcessId aOtherProcess) ProcessHandle handle; if (!base::OpenProcessHandle(aOtherProcess, &handle)) { // XXX need to kill |aOtherProcess|, it's boned - return nullptr; + return false; } cpcp->mSelfRef = cpcp; CompositorLoop()->PostTask( FROM_HERE, NewRunnableFunction(OpenCompositor, cpcp.get(), aTransport, handle, XRE_GetIOMessageLoop())); - // The return value is just compared to null for success checking, - // we're not sharing a ref. - return cpcp.get(); + return true; } static void diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 53b7ae3e2c97..928252f6cc2c 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -172,7 +172,7 @@ public: * A new child process has been configured to push transactions * directly to us. Transport is to its thread context. */ - static PCompositorParent* + static bool Create(Transport* aTransport, ProcessId aOtherProcess); /** diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index fbb4c37109c0..53a0e8628a09 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -521,7 +521,7 @@ ImageBridgeChild::EndTransaction() } -PImageBridgeChild* +bool ImageBridgeChild::StartUpInChildProcess(Transport* aTransport, ProcessId aOtherProcess) { @@ -529,12 +529,12 @@ ImageBridgeChild::StartUpInChildProcess(Transport* aTransport, ProcessHandle processHandle; if (!base::OpenProcessHandle(aOtherProcess, &processHandle)) { - return nullptr; + return false; } sImageBridgeChildThread = new Thread("ImageBridgeChild"); if (!sImageBridgeChildThread->Start()) { - return nullptr; + return false; } sImageBridgeChildSingleton = new ImageBridgeChild(); @@ -543,7 +543,7 @@ ImageBridgeChild::StartUpInChildProcess(Transport* aTransport, NewRunnableFunction(ConnectImageBridgeInChildProcess, aTransport, processHandle)); - return sImageBridgeChildSingleton; + return true; } void ImageBridgeChild::ShutDown() diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index b040fd7950ec..1e76f0d8c372 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -114,7 +114,7 @@ public: */ static void StartUp(); - static PImageBridgeChild* + static bool StartUpInChildProcess(Transport* aTransport, ProcessId aOtherProcess); /** diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index c92b55119b35..8d8c12fbb9de 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -103,12 +103,12 @@ ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge, XRE_GetIOMessageLoop(), AsyncChannel::Parent); } -/*static*/ PImageBridgeParent* +/*static*/ bool ImageBridgeParent::Create(Transport* aTransport, ProcessId aOtherProcess) { ProcessHandle processHandle; if (!base::OpenProcessHandle(aOtherProcess, &processHandle)) { - return nullptr; + return false; } MessageLoop* loop = CompositorParent::CompositorLoop(); @@ -117,7 +117,7 @@ ImageBridgeParent::Create(Transport* aTransport, ProcessId aOtherProcess) loop->PostTask(FROM_HERE, NewRunnableFunction(ConnectImageBridgeInParentProcess, bridge.get(), aTransport, processHandle)); - return bridge.get(); + return true; } bool ImageBridgeParent::RecvStop() diff --git a/gfx/layers/ipc/ImageBridgeParent.h b/gfx/layers/ipc/ImageBridgeParent.h index 1e2bcd2e9803..5f2b14d80213 100644 --- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -44,7 +44,7 @@ public: virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; - static PImageBridgeParent* + static bool Create(Transport* aTransport, ProcessId aOtherProcess); virtual PGrallocBufferParent* diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index d5658c062c17..b2dc20cba1e7 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -25,7 +25,7 @@ #include "nsIObserverService.h" // for nsIObserverService #include "nsIRunnable.h" // for nsIRunnable #include "nsISupports.h" -#include "nsStringGlue.h" // for nsAutoCString, nsCString, etc +#include "nsString.h" // for nsAutoCString, nsCString, etc #include "nsTArray.h" // for nsTArray #include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc #include "nscore.h" // for NS_IMETHOD, NS_IMETHODIMP, etc diff --git a/gfx/src/nsColor.cpp b/gfx/src/nsColor.cpp index 4f0b009655be..d610fbd80bed 100644 --- a/gfx/src/nsColor.cpp +++ b/gfx/src/nsColor.cpp @@ -12,7 +12,7 @@ #include "nsColorNames.h" // for nsColorNames #include "nsDebug.h" // for NS_ASSERTION, etc #include "nsStaticNameTable.h" -#include "nsStringGlue.h" // for nsAutoCString, nsString, etc +#include "nsString.h" // for nsAutoCString, nsString, etc #include "nscore.h" // for nsAString, etc using namespace mozilla; diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 542f71abf8b4..c3c632271f10 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -30,7 +30,7 @@ #include "nsRect.h" // for nsRect #include "nsRenderingContext.h" // for nsRenderingContext #include "nsServiceManagerUtils.h" // for do_GetService -#include "nsStringGlue.h" // for nsDependentString +#include "nsString.h" // for nsDependentString #include "nsTArray.h" // for nsTArray, nsTArray_Impl #include "nsThreadUtils.h" // for NS_IsMainThread #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h index 9459dcc64983..f579ae5c6293 100644 --- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -13,7 +13,7 @@ #include "nsAutoPtr.h" // for nsRefPtr #include "nsCoord.h" // for nscoord #include "nsStringFwd.h" // for nsSubstring -#include "nsStringGlue.h" // for nsString +#include "nsString.h" // for nsString #include "nsTArray.h" // for nsTArray struct gfxFontStyle; diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index 479e7849e477..3d30483af745 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -16,7 +16,7 @@ #include "nsIAtom.h" // for nsIAtom #include "nsMathUtils.h" // for NS_round #include "nsRenderingContext.h" // for nsRenderingContext -#include "nsStringGlue.h" // for nsString +#include "nsString.h" // for nsString #include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE class gfxUserFontSet; diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 10f82f5902ae..84abd72d8f38 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -6,7 +6,7 @@ #include "nsRect.h" #include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc #include "nsDeviceContext.h" // for nsDeviceContext -#include "nsStringGlue.h" // for nsAutoString, etc +#include "nsString.h" // for nsAutoString, etc #include "prtypes.h" // for PR_STATIC_ASSERT #include "nsMargin.h" // for nsMargin diff --git a/gfx/src/nsRegion.h b/gfx/src/nsRegion.h index a6b9354e76af..b6a554456d7b 100644 --- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -14,7 +14,7 @@ #include "nsError.h" // for nsresult #include "nsPoint.h" // for nsIntPoint, nsPoint #include "nsRect.h" // for nsIntRect, nsRect -#include "nsStringGlue.h" // for nsCString +#include "nsString.h" // for nsCString #include "xpcom-config.h" // for CPP_THROW_NEW class nsIntRegion; diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h index 0545abcd2fa2..a9f81ef978de 100644 --- a/gfx/src/nsRenderingContext.h +++ b/gfx/src/nsRenderingContext.h @@ -18,7 +18,7 @@ #include "nsDeviceContext.h" // for nsDeviceContext #include "nsFontMetrics.h" // for nsFontMetrics #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc -#include "nsStringGlue.h" // for nsString +#include "nsString.h" // for nsString #include "nscore.h" // for PRUnichar class gfxASurface; diff --git a/gfx/src/nsThebesFontEnumerator.cpp b/gfx/src/nsThebesFontEnumerator.cpp index eff36fc61975..ada46411a6bf 100644 --- a/gfx/src/nsThebesFontEnumerator.cpp +++ b/gfx/src/nsThebesFontEnumerator.cpp @@ -13,7 +13,7 @@ #include "nsIAtom.h" // for nsIAtom, do_GetAtom #include "nsID.h" #include "nsMemory.h" // for nsMemory -#include "nsStringGlue.h" // for nsAutoCString, nsAutoString, etc +#include "nsString.h" // for nsAutoCString, nsAutoString, etc #include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc #include "nscore.h" // for PRUnichar, NS_IMETHODIMP diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index 27aafff304f1..5a76c2c45089 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -49,7 +49,7 @@ #include "nsCOMPtr.h" #include "nsIConsoleService.h" #include "nsServiceManagerUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsIClipboardHelper.h" using namespace mozilla; diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index fd9dda05ec3f..70f03b0c2875 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -8,7 +8,7 @@ #include "prlog.h" #include "nsTArray.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsIObserver.h" #include "gfxTypes.h" diff --git a/image/decoders/icon/nsIconURI.h b/image/decoders/icon/nsIconURI.h index b72469b7db48..b5753ae296e7 100644 --- a/image/decoders/icon/nsIconURI.h +++ b/image/decoders/icon/nsIconURI.h @@ -9,7 +9,7 @@ #include "nsIIconURI.h" #include "nsCOMPtr.h" -#include "nsStringGlue.h" +#include "nsString.h" #define NS_MOZICONURI_CID \ { \ diff --git a/image/src/imgRequest.h b/image/src/imgRequest.h index ce5845169e91..0316b925956b 100644 --- a/image/src/imgRequest.h +++ b/image/src/imgRequest.h @@ -14,7 +14,7 @@ #include "nsAutoPtr.h" #include "nsCOMPtr.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsError.h" #include "nsIAsyncVerifyRedirectCallback.h" diff --git a/intl/locale/public/nsCharsetAlias.h b/intl/locale/public/nsCharsetAlias.h index 17419043b69f..c792d8de11fa 100644 --- a/intl/locale/public/nsCharsetAlias.h +++ b/intl/locale/public/nsCharsetAlias.h @@ -7,7 +7,7 @@ #define nsCharsetAlias_h___ #include "nscore.h" -#include "nsStringGlue.h" +#include "nsString.h" class nsCharsetConverterManager; class nsScriptableUnicodeConverter; diff --git a/intl/locale/public/nsIDateTimeFormat.h b/intl/locale/public/nsIDateTimeFormat.h index 4abf40339769..318d2ef60c64 100644 --- a/intl/locale/public/nsIDateTimeFormat.h +++ b/intl/locale/public/nsIDateTimeFormat.h @@ -10,7 +10,7 @@ #include "nsISupports.h" #include "nscore.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsILocale.h" #include "nsIScriptableDateFormat.h" #include "prtime.h" diff --git a/intl/locale/public/nsIPlatformCharset.h b/intl/locale/public/nsIPlatformCharset.h index 24a37bcfe0a3..aadd9b07044a 100644 --- a/intl/locale/public/nsIPlatformCharset.h +++ b/intl/locale/public/nsIPlatformCharset.h @@ -6,7 +6,7 @@ #ifndef nsIPlatformCharset_h__ #define nsIPlatformCharset_h__ -#include "nsStringGlue.h" +#include "nsString.h" #include "nsISupports.h" // Interface ID for our nsIPlatformCharset interface diff --git a/intl/uconv/idl/nsICharsetConverterManager.idl b/intl/uconv/idl/nsICharsetConverterManager.idl index 3b0b0ab04b92..d464e459ca5a 100644 --- a/intl/uconv/idl/nsICharsetConverterManager.idl +++ b/intl/uconv/idl/nsICharsetConverterManager.idl @@ -9,7 +9,7 @@ %{ C++ #include "nsIUnicodeDecoder.h" #include "nsIUnicodeEncoder.h" -#include "nsStringGlue.h" +#include "nsString.h" // XXX change to NS_CHARSETCONVERTERMANAGER_CID diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index eb6d1642476b..1c518eeaaaa7 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -20,7 +20,7 @@ #include "nsID.h" #include "nsMemory.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "js/StructuredClone.h" #include "nsCSSProperty.h" diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index 3aecb768d87b..6b4af0c36799 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -6,7 +6,7 @@ #include "nsComponentManagerUtils.h" #include "nsServiceManagerUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" #include "prthread.h" diff --git a/ipc/glue/ScopedXREEmbed.cpp b/ipc/glue/ScopedXREEmbed.cpp index e3b8d377c606..544de73150f3 100644 --- a/ipc/glue/ScopedXREEmbed.cpp +++ b/ipc/glue/ScopedXREEmbed.cpp @@ -11,7 +11,7 @@ #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsXULAppAPI.h" using mozilla::ipc::ScopedXREEmbed; diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index 84a1174901fd..e9a02e8a2498 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -12,7 +12,7 @@ #include "nsAutoPtr.h" #include "nsServiceManagerUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsIXULAppInfo.h" #include "mozilla/PaintTracker.h" diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 2106f2b583a7..88a5c53a2fa9 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -2718,7 +2718,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): _allocMethod(actor.ptype, actor.side).name, params=[ Decl(Type('Transport', ptr=1), 'transport'), Decl(Type('ProcessId'), 'otherProcess') ], - ret=actortype, + ret=Type.BOOL, virtual=1, pure=1))) # optional ActorDestroy() method; default is no-op diff --git a/ipc/ipdl/test/cxx/TestBridgeMain.cpp b/ipc/ipdl/test/cxx/TestBridgeMain.cpp index 4e3e0d39a60b..a1679a079dd7 100644 --- a/ipc/ipdl/test/cxx/TestBridgeMain.cpp +++ b/ipc/ipdl/test/cxx/TestBridgeMain.cpp @@ -25,7 +25,7 @@ TestBridgeMainParent::Main() fail("sending Start"); } -PTestBridgeMainSubParent* +bool TestBridgeMainParent::AllocPTestBridgeMainSubParent(Transport* transport, ProcessId otherProcess) { @@ -38,7 +38,8 @@ TestBridgeMainParent::AllocPTestBridgeMainSubParent(Transport* transport, if (!a->Open(transport, h, XRE_GetIOMessageLoop(), AsyncChannel::Parent)) { return nullptr; } - return a.forget(); + a.forget(); + return true; } void @@ -176,24 +177,25 @@ TestBridgeSubChild::RecvPing() return true; } -PTestBridgeMainSubChild* +bool TestBridgeSubChild::AllocPTestBridgeMainSubChild(Transport* transport, ProcessId otherProcess) { ProcessHandle h; if (!base::OpenProcessHandle(otherProcess, &h)) { - return nullptr; + return false; } nsAutoPtr a(new TestBridgeMainSubChild(transport)); if (!a->Open(transport, h, XRE_GetIOMessageLoop(), AsyncChannel::Child)) { - return nullptr; + return false; } if (!a->SendHello()) fail("sending Hello"); - return a.forget(); + a.forget(); + return true; } void diff --git a/ipc/ipdl/test/cxx/TestBridgeMain.h b/ipc/ipdl/test/cxx/TestBridgeMain.h index 170f2127359f..16fc0d710ebb 100644 --- a/ipc/ipdl/test/cxx/TestBridgeMain.h +++ b/ipc/ipdl/test/cxx/TestBridgeMain.h @@ -31,7 +31,7 @@ public: void Main(); protected: - virtual PTestBridgeMainSubParent* + virtual bool AllocPTestBridgeMainSubParent(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE; @@ -105,7 +105,7 @@ public: protected: virtual bool RecvPing() MOZ_OVERRIDE; - virtual PTestBridgeMainSubChild* + virtual bool AllocPTestBridgeMainSubChild(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE; diff --git a/ipc/ipdl/test/cxx/TestOpens.cpp b/ipc/ipdl/test/cxx/TestOpens.cpp index 14b6b4bca685..461856c2842c 100644 --- a/ipc/ipdl/test/cxx/TestOpens.cpp +++ b/ipc/ipdl/test/cxx/TestOpens.cpp @@ -64,7 +64,7 @@ OpenParent(TestOpensOpenedParent* aParent, fail("opening Parent"); } -PTestOpensOpenedParent* +bool TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport, ProcessId otherProcess) { @@ -72,7 +72,7 @@ TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport, ProcessHandle h; if (!base::OpenProcessHandle(otherProcess, &h)) { - return nullptr; + return false; } gParentThread = new Thread("ParentThread"); @@ -84,7 +84,7 @@ TestOpensParent::AllocPTestOpensOpenedParent(Transport* transport, FROM_HERE, NewRunnableFunction(OpenParent, a, transport, h)); - return a; + return true; } void @@ -177,7 +177,7 @@ OpenChild(TestOpensOpenedChild* aChild, fail("sending Hello"); } -PTestOpensOpenedChild* +bool TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport, ProcessId otherProcess) { @@ -185,7 +185,7 @@ TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport, ProcessHandle h; if (!base::OpenProcessHandle(otherProcess, &h)) { - return nullptr; + return false; } gChildThread = new Thread("ChildThread"); @@ -197,7 +197,7 @@ TestOpensChild::AllocPTestOpensOpenedChild(Transport* transport, FROM_HERE, NewRunnableFunction(OpenChild, a, transport, h)); - return a; + return true; } void diff --git a/ipc/ipdl/test/cxx/TestOpens.h b/ipc/ipdl/test/cxx/TestOpens.h index f3a1f7d4ba89..3f92d5f2d6bb 100644 --- a/ipc/ipdl/test/cxx/TestOpens.h +++ b/ipc/ipdl/test/cxx/TestOpens.h @@ -27,7 +27,7 @@ public: void Main(); protected: - virtual PTestOpensOpenedParent* + virtual bool AllocPTestOpensOpenedParent(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE; virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; @@ -70,7 +70,7 @@ public: protected: virtual bool RecvStart() MOZ_OVERRIDE; - virtual PTestOpensOpenedChild* + virtual bool AllocPTestOpensOpenedChild(Transport* transport, ProcessId otherProcess) MOZ_OVERRIDE; virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; diff --git a/ipc/testshell/TestShellParent.h b/ipc/testshell/TestShellParent.h index 2fad6f731b32..2ee3ee1c2f30 100644 --- a/ipc/testshell/TestShellParent.h +++ b/ipc/testshell/TestShellParent.h @@ -13,7 +13,7 @@ #include "js/TypeDecls.h" #include "nsAutoJSValHolder.h" -#include "nsStringGlue.h" +#include "nsString.h" namespace mozilla { diff --git a/ipc/testshell/XPCShellEnvironment.h b/ipc/testshell/XPCShellEnvironment.h index 3abe42d72a8e..d120a23e43ce 100644 --- a/ipc/testshell/XPCShellEnvironment.h +++ b/ipc/testshell/XPCShellEnvironment.h @@ -13,7 +13,7 @@ #include "nsAutoJSValHolder.h" #include "nsCOMPtr.h" #include "nsDebug.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsJSPrincipals.h" #include "nsContentUtils.h" #include "js/TypeDecls.h" diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 77d3a58493c5..6e02daecbb2a 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -715,12 +715,15 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(js::PerThreadDataFriendFields::getMainThread(rt)); } - ~Rooted() { + // Note that we need to let the compiler generate the default destructor in + // non-exact-rooting builds because of a bug in the instrumented PGO builds + // using MSVC, see bug 915735 for more details. #ifdef JSGC_TRACK_EXACT_ROOTS + ~Rooted() { JS_ASSERT(*stack == reinterpret_cast*>(this)); *stack = prev; -#endif } +#endif #ifdef JSGC_TRACK_EXACT_ROOTS Rooted *previous() { return prev; } diff --git a/js/src/assembler/assembler/X86Assembler.h b/js/src/assembler/assembler/X86Assembler.h index 751b013008e0..7f9a8d0fb30f 100644 --- a/js/src/assembler/assembler/X86Assembler.h +++ b/js/src/assembler/assembler/X86Assembler.h @@ -1312,6 +1312,13 @@ public: m_formatter.oneByteOp(OP_CMP_EvGv, reg, addr); } + void cmpl_rm_force32(RegisterID reg, const void* addr) + { + spew("cmpl %s, %p", + nameIReg(4, reg), addr); + m_formatter.oneByteOp_disp32(OP_CMP_EvGv, reg, addr); + } + void cmpl_im(int imm, const void* addr) { spew("cmpl $0x%x, %p", imm, addr); @@ -3359,6 +3366,13 @@ private: m_buffer.putByteUnchecked(opcode); memoryModRM(reg, address); } + + void oneByteOp_disp32(OneByteOpcodeID opcode, int reg, const void* address) + { + m_buffer.ensureSpace(maxInstructionSize); + m_buffer.putByteUnchecked(opcode); + memoryModRM_disp32(reg, address); + } #if WTF_CPU_X86_64 void oneByteRipOp(OneByteOpcodeID opcode, int reg, int ripOffset) { @@ -3887,7 +3901,7 @@ private: m_buffer.putIntUnchecked(offset); } - void memoryModRM(int reg, const void* address) + void memoryModRM_disp32(int reg, const void* address) { int32_t disp = addressImmediate(address); @@ -3901,6 +3915,11 @@ private: m_buffer.putIntUnchecked(disp); } + void memoryModRM(int reg, const void* address) + { + memoryModRM_disp32(reg, address); + } + AssemblerBuffer m_buffer; } m_formatter; }; diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 6699eecaa35e..8c67bbfeefe6 100644 --- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -12,7 +12,6 @@ # include "vtune/VTuneWrapper.h" #endif -#include "jsmath.h" #include "jsprf.h" #include "jsworkers.h" #include "prmjtime.h" @@ -1772,6 +1771,16 @@ class MOZ_STACK_CLASS ModuleCompiler } #endif + // Absolute links + for (size_t i = 0; i < masm_.numAsmJSAbsoluteLinks(); i++) { + AsmJSAbsoluteLink src = masm_.asmJSAbsoluteLink(i); + AsmJSStaticLinkData::AbsoluteLink link; + link.patchAt = masm_.actualOffset(src.patchAt.offset()); + link.target = src.target; + if (!linkData->absoluteLinks.append(link)) + return false; + } + *module = module_.forget(); return true; } @@ -2285,7 +2294,7 @@ class FunctionCompiler return callPrivate(MAsmJSCall::Callee(ptrFun), call, returnType, def); } - bool builtinCall(void *builtin, const Call &call, MIRType returnType, MDefinition **def) + bool builtinCall(AsmJSImmKind builtin, const Call &call, MIRType returnType, MDefinition **def) { return callPrivate(MAsmJSCall::Callee(builtin), call, returnType, def); } @@ -3768,18 +3777,6 @@ CheckFFICall(FunctionCompiler &f, ParseNode *callNode, unsigned ffiIndex, RetTyp return true; } -static inline void * -UnaryMathFunCast(double (*pf)(double)) -{ - return JS_FUNC_TO_DATA_PTR(void*, pf); -} - -static inline void * -BinaryMathFunCast(double (*pf)(double, double)) -{ - return JS_FUNC_TO_DATA_PTR(void*, pf); -} - static bool CheckIsDoublish(FunctionCompiler &f, ParseNode *argNode, Type type) { @@ -3793,23 +3790,23 @@ CheckMathBuiltinCall(FunctionCompiler &f, ParseNode *callNode, AsmJSMathBuiltin RetType retType, MDefinition **def, Type *type) { unsigned arity = 0; - void *callee = NULL; + AsmJSImmKind callee; switch (mathBuiltin) { case AsmJSMathBuiltin_imul: return CheckMathIMul(f, callNode, retType, def, type); case AsmJSMathBuiltin_abs: return CheckMathAbs(f, callNode, retType, def, type); - case AsmJSMathBuiltin_sin: arity = 1; callee = UnaryMathFunCast(sin); break; - case AsmJSMathBuiltin_cos: arity = 1; callee = UnaryMathFunCast(cos); break; - case AsmJSMathBuiltin_tan: arity = 1; callee = UnaryMathFunCast(tan); break; - case AsmJSMathBuiltin_asin: arity = 1; callee = UnaryMathFunCast(asin); break; - case AsmJSMathBuiltin_acos: arity = 1; callee = UnaryMathFunCast(acos); break; - case AsmJSMathBuiltin_atan: arity = 1; callee = UnaryMathFunCast(atan); break; - case AsmJSMathBuiltin_ceil: arity = 1; callee = UnaryMathFunCast(ceil); break; - case AsmJSMathBuiltin_floor: arity = 1; callee = UnaryMathFunCast(floor); break; - case AsmJSMathBuiltin_exp: arity = 1; callee = UnaryMathFunCast(exp); break; - case AsmJSMathBuiltin_log: arity = 1; callee = UnaryMathFunCast(log); break; case AsmJSMathBuiltin_sqrt: return CheckMathSqrt(f, callNode, retType, def, type); - case AsmJSMathBuiltin_pow: arity = 2; callee = BinaryMathFunCast(ecmaPow); break; - case AsmJSMathBuiltin_atan2: arity = 2; callee = BinaryMathFunCast(ecmaAtan2); break; + case AsmJSMathBuiltin_sin: arity = 1; callee = AsmJSImm_SinD; break; + case AsmJSMathBuiltin_cos: arity = 1; callee = AsmJSImm_CosD; break; + case AsmJSMathBuiltin_tan: arity = 1; callee = AsmJSImm_TanD; break; + case AsmJSMathBuiltin_asin: arity = 1; callee = AsmJSImm_ASinD; break; + case AsmJSMathBuiltin_acos: arity = 1; callee = AsmJSImm_ACosD; break; + case AsmJSMathBuiltin_atan: arity = 1; callee = AsmJSImm_ATanD; break; + case AsmJSMathBuiltin_ceil: arity = 1; callee = AsmJSImm_CeilD; break; + case AsmJSMathBuiltin_floor: arity = 1; callee = AsmJSImm_FloorD; break; + case AsmJSMathBuiltin_exp: arity = 1; callee = AsmJSImm_ExpD; break; + case AsmJSMathBuiltin_log: arity = 1; callee = AsmJSImm_LogD; break; + case AsmJSMathBuiltin_pow: arity = 2; callee = AsmJSImm_PowD; break; + case AsmJSMathBuiltin_atan2: arity = 2; callee = AsmJSImm_ATan2D; break; } FunctionCompiler::Call call(f, retType); @@ -5444,7 +5441,10 @@ static const RegisterSet NonVolatileRegs = static void LoadAsmJSActivationIntoRegister(MacroAssembler &masm, Register reg) { - masm.loadPtr(AbsoluteAddress(GetIonContext()->runtime->mainThread.addressOfAsmJSActivationStackReadOnly()), reg); + masm.movePtr(AsmJSImm_Runtime, reg); + size_t offset = offsetof(JSRuntime, mainThread) + + PerThreadData::offsetOfAsmJSActivationStackReadOnly(); + masm.loadPtr(Address(reg, offset), reg); } static void @@ -5645,7 +5645,9 @@ TryEnablingIon(JSContext *cx, AsmJSModule &module, HandleFunction fun, uint32_t return true; } -static int32_t +namespace js { + +int32_t InvokeFromAsmJS_Ignore(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv) { AsmJSModule &module = cx->mainThread().asmJSActivationStackFromOwnerThread()->module(); @@ -5662,7 +5664,7 @@ InvokeFromAsmJS_Ignore(JSContext *cx, int32_t exitIndex, int32_t argc, Value *ar return true; } -static int32_t +int32_t InvokeFromAsmJS_ToInt32(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv) { AsmJSModule &module = cx->mainThread().asmJSActivationStackFromOwnerThread()->module(); @@ -5684,7 +5686,7 @@ InvokeFromAsmJS_ToInt32(JSContext *cx, int32_t exitIndex, int32_t argc, Value *a return true; } -static int32_t +int32_t InvokeFromAsmJS_ToNumber(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv) { AsmJSModule &module = cx->mainThread().asmJSActivationStackFromOwnerThread()->module(); @@ -5706,6 +5708,8 @@ InvokeFromAsmJS_ToNumber(JSContext *cx, int32_t exitIndex, int32_t argc, Value * return true; } +} // namespace js + static void FillArgumentArray(ModuleCompiler &m, const VarTypeVector &argTypes, unsigned offsetToArgs, unsigned offsetToCallerStackArgs, @@ -5823,16 +5827,16 @@ GenerateFFIInterpreterExit(ModuleCompiler &m, const ModuleCompiler::ExitDescript AssertStackAlignment(masm); switch (exit.sig().retType().which()) { case RetType::Void: - masm.call(ImmPtr(InvokeFromAsmJS_Ignore)); + masm.call(AsmJSImm_InvokeFromAsmJS_Ignore); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); break; case RetType::Signed: - masm.call(ImmPtr(InvokeFromAsmJS_ToInt32)); + masm.call(AsmJSImm_InvokeFromAsmJS_ToInt32); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); masm.unboxInt32(argv, ReturnReg); break; case RetType::Double: - masm.call(ImmPtr(InvokeFromAsmJS_ToNumber)); + masm.call(AsmJSImm_InvokeFromAsmJS_ToNumber); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); masm.loadDouble(argv, ReturnFloatReg); break; @@ -5874,16 +5878,16 @@ GenerateFFIInterpreterExit(ModuleCompiler &m, const ModuleCompiler::ExitDescript AssertStackAlignment(masm); switch (exit.sig().retType().which()) { case RetType::Void: - masm.call(ImmPtr(InvokeFromAsmJS_Ignore)); + masm.call(AsmJSImm_InvokeFromAsmJS_Ignore); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); break; case RetType::Signed: - masm.call(ImmPtr(InvokeFromAsmJS_ToInt32)); + masm.call(AsmJSImm_InvokeFromAsmJS_ToInt32); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); masm.unboxInt32(argv, ReturnReg); break; case RetType::Double: - masm.call(ImmPtr(InvokeFromAsmJS_ToNumber)); + masm.call(AsmJSImm_InvokeFromAsmJS_ToNumber); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); #if defined(JS_CPU_ARM) && !defined(JS_CPU_ARM_HARDFP) masm.loadValue(argv, softfpReturnOperand); @@ -5898,28 +5902,6 @@ GenerateFFIInterpreterExit(ModuleCompiler &m, const ModuleCompiler::ExitDescript #endif } -static int32_t -ValueToInt32(JSContext *cx, MutableHandleValue val) -{ - int32_t i32; - if (!ToInt32(cx, val, &i32)) - return false; - val.set(Int32Value(i32)); - - return true; -} - -static int32_t -ValueToNumber(JSContext *cx, MutableHandleValue val) -{ - double dbl; - if (!ToNumber(cx, val, &dbl)) - return false; - val.set(DoubleValue(dbl)); - - return true; -} - static void GenerateOOLConvert(ModuleCompiler &m, RetType retType, Label *throwLabel) { @@ -5970,12 +5952,12 @@ GenerateOOLConvert(ModuleCompiler &m, RetType retType, Label *throwLabel) // Call switch (retType.which()) { case RetType::Signed: - masm.call(ImmPtr(ValueToInt32)); + masm.call(AsmJSImm_CoerceInPlace_ToInt32); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); masm.unboxInt32(Address(StackPointer, offsetToArgv), ReturnReg); break; case RetType::Double: - masm.call(ImmPtr(ValueToNumber)); + masm.call(AsmJSImm_CoerceInPlace_ToNumber); masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, throwLabel); #if defined(JS_CPU_ARM) && !defined(JS_CPU_ARM_HARDFP) masm.loadValue(Address(StackPointer, offsetToArgv), softfpReturnOperand); @@ -5990,24 +5972,6 @@ GenerateOOLConvert(ModuleCompiler &m, RetType retType, Label *throwLabel) masm.freeStack(stackDec); } -static void -EnableActivation(AsmJSActivation *activation) -{ - JSContext *cx = activation->cx(); - Activation *act = cx->mainThread().activation(); - JS_ASSERT(act->isJit()); - act->asJit()->setActive(cx); -} - -static void -DisableActivation(AsmJSActivation *activation) -{ - JSContext *cx = activation->cx(); - Activation *act = cx->mainThread().activation(); - JS_ASSERT(act->isJit()); - act->asJit()->setActive(cx, false); -} - static void GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit, unsigned exitIndex, Label *throwLabel) @@ -6097,7 +6061,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit masm.push(scratch); masm.setupUnalignedABICall(1, scratch); masm.passABIArg(callee); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, EnableActivation)); + masm.callWithABI(AsmJSImm_EnableActivationFromAsmJS); masm.pop(scratch); // 2. Call @@ -6117,7 +6081,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit LoadAsmJSActivationIntoRegister(masm, callee); masm.setupUnalignedABICall(1, scratch); masm.passABIArg(callee); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, DisableActivation)); + masm.callWithABI(AsmJSImm_DisableActivationFromAsmJS); masm.pop(JSReturnReg_Data); masm.pop(JSReturnReg_Type); @@ -6203,8 +6167,7 @@ GenerateStackOverflowExit(ModuleCompiler &m, Label *throwLabel) LoadAsmJSActivationIntoRegister(masm, IntArgReg0); LoadJSContextFromActivation(masm, IntArgReg0, IntArgReg0); #endif - void (*reportOverRecursed)(JSContext*) = js_ReportOverRecursed; - masm.call(ImmPtr(reportOverRecursed)); + masm.call(AsmJSImm_ReportOverRecursed); masm.jump(throwLabel); return !masm.oom(); @@ -6261,7 +6224,7 @@ GenerateOperationCallbackExit(ModuleCompiler &m, Label *throwLabel) LoadJSContextFromActivation(masm, activation, IntArgReg0); #endif - masm.call(ImmPtr(js_HandleExecutionInterrupt)); + masm.call(AsmJSImm_HandleExecutionInterrupt); masm.branchIfFalseBool(ReturnReg, throwLabel); // Restore the StackPointer to it's position before the call. @@ -6292,7 +6255,7 @@ GenerateOperationCallbackExit(ModuleCompiler &m, Label *throwLabel) masm.loadPtr(Address(IntArgReg0, AsmJSActivation::offsetOfContext()), IntArgReg0); masm.PushRegsInMask(RegisterSet(GeneralRegisterSet(0), FloatRegisterSet(FloatRegisters::AllMask))); // save all FP registers - masm.call(ImmPtr(js_HandleExecutionInterrupt)); + masm.call(AsmJSImm_HandleExecutionInterrupt); masm.branchIfFalseBool(ReturnReg, throwLabel); // Restore the machine state to before the interrupt. this will set the pc! @@ -6455,7 +6418,7 @@ CheckModule(ExclusiveContext *cx, AsmJSParser &parser, ParseNode *stmtList, if (!FinishModule(m, module, &linkData)) return false; - (*module)->staticallyLink(linkData); + (*module)->staticallyLink(linkData, cx); m.buildCompilationTimeReport(compilationTimeReport); return true; @@ -6489,12 +6452,12 @@ EstablishPreconditions(ExclusiveContext *cx, AsmJSParser &parser) if (cx->compartment()->debugMode()) return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by debugger"); -# ifdef JS_WORKER_THREADS +#ifdef JS_WORKER_THREADS if (ParallelCompilationEnabled(cx)) { if (!EnsureWorkerThreadsInitialized(cx)) return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Failed compilation thread initialization"); } -# endif +#endif return true; } diff --git a/js/src/jit/AsmJSModule.cpp b/js/src/jit/AsmJSModule.cpp index e66fcde17438..38b9bb044b56 100644 --- a/js/src/jit/AsmJSModule.cpp +++ b/js/src/jit/AsmJSModule.cpp @@ -11,6 +11,8 @@ # include #endif +#include "jslibmath.h" +#include "jsmath.h" #ifdef XP_WIN # include "jswin.h" #endif @@ -40,6 +42,7 @@ AsmJSModule::initHeap(Handle heap, JSContext *cx) JSC::X86Assembler::setPointer(access.patchLengthAt(code_), heapLength); void *addr = access.patchOffsetAt(code_); uint32_t disp = reinterpret_cast(JSC::X86Assembler::getPointer(addr)); + JS_ASSERT(disp <= INT32_MAX); JSC::X86Assembler::setPointer(addr, (void *)(heapOffset + disp)); } #elif defined(JS_CPU_ARM) @@ -109,8 +112,148 @@ AsmJSModule::allocateAndCopyCode(ExclusiveContext *cx, MacroAssembler &masm) return true; } +static int32_t +CoerceInPlace_ToInt32(JSContext *cx, MutableHandleValue val) +{ + int32_t i32; + if (!ToInt32(cx, val, &i32)) + return false; + val.set(Int32Value(i32)); + + return true; +} + +static int32_t +CoerceInPlace_ToNumber(JSContext *cx, MutableHandleValue val) +{ + double dbl; + if (!ToNumber(cx, val, &dbl)) + return false; + val.set(DoubleValue(dbl)); + + return true; +} + +static void +EnableActivationFromAsmJS(AsmJSActivation *activation) +{ + JSContext *cx = activation->cx(); + Activation *act = cx->mainThread().activation(); + JS_ASSERT(act->isJit()); + act->asJit()->setActive(cx); +} + +static void +DisableActivationFromAsmJS(AsmJSActivation *activation) +{ + JSContext *cx = activation->cx(); + Activation *act = cx->mainThread().activation(); + JS_ASSERT(act->isJit()); + act->asJit()->setActive(cx, false); +} + +namespace js { + +// Defined in AsmJS.cpp: + +int32_t +InvokeFromAsmJS_Ignore(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv); + +int32_t +InvokeFromAsmJS_ToInt32(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv); + +int32_t +InvokeFromAsmJS_ToNumber(JSContext *cx, int32_t exitIndex, int32_t argc, Value *argv); + +} + +#if defined(JS_CPU_ARM) +extern "C" { + +extern int +__aeabi_idivmod(int, int); + +extern int +__aeabi_uidivmod(int, int); + +} +#endif + +template +static inline void * +FuncCast(F *pf) +{ + return JS_FUNC_TO_DATA_PTR(void *, pf); +} + +static void * +AddressOf(AsmJSImmKind kind, ExclusiveContext *cx) +{ + switch (kind) { + case AsmJSImm_Runtime: + return cx->runtimeAddressForJit(); + case AsmJSImm_StackLimit: + return cx->stackLimitAddress(StackForUntrustedScript); + case AsmJSImm_ReportOverRecursed: + return FuncCast(js_ReportOverRecursed); + case AsmJSImm_HandleExecutionInterrupt: + return FuncCast(js_HandleExecutionInterrupt); + case AsmJSImm_InvokeFromAsmJS_Ignore: + return FuncCast(InvokeFromAsmJS_Ignore); + case AsmJSImm_InvokeFromAsmJS_ToInt32: + return FuncCast(InvokeFromAsmJS_ToInt32); + case AsmJSImm_InvokeFromAsmJS_ToNumber: + return FuncCast(InvokeFromAsmJS_ToNumber); + case AsmJSImm_CoerceInPlace_ToInt32: + return FuncCast(CoerceInPlace_ToInt32); + case AsmJSImm_CoerceInPlace_ToNumber: + return FuncCast(CoerceInPlace_ToNumber); + case AsmJSImm_ToInt32: + return FuncCast(js::ToInt32); + case AsmJSImm_EnableActivationFromAsmJS: + return FuncCast(EnableActivationFromAsmJS); + case AsmJSImm_DisableActivationFromAsmJS: + return FuncCast(DisableActivationFromAsmJS); +#if defined(JS_CPU_ARM) + case AsmJSImm_aeabi_idivmod: + return FuncCast(__aeabi_idivmod); + case AsmJSImm_aeabi_uidivmod: + return FuncCast(__aeabi_uidivmod); +#endif + case AsmJSImm_ModD: + return FuncCast(NumberMod); + case AsmJSImm_SinD: + return FuncCast(sin); + case AsmJSImm_CosD: + return FuncCast(cos); + case AsmJSImm_TanD: + return FuncCast(tan); + case AsmJSImm_ASinD: + return FuncCast(asin); + case AsmJSImm_ACosD: + return FuncCast(acos); + case AsmJSImm_ATanD: + return FuncCast(atan); + case AsmJSImm_CeilD: + return FuncCast(ceil); + case AsmJSImm_FloorD: + return FuncCast(floor); + case AsmJSImm_ExpD: + return FuncCast(exp); + case AsmJSImm_LogD: + return FuncCast(log); + case AsmJSImm_PowD: + return FuncCast(ecmaPow); + case AsmJSImm_ATan2D: + return FuncCast(ecmaAtan2); + } + + MOZ_ASSUME_UNREACHABLE("Bad AsmJSImmKind"); + return NULL; +} + void -AsmJSModule::staticallyLink(const AsmJSStaticLinkData &linkData) +AsmJSModule::staticallyLink(const AsmJSStaticLinkData &linkData, ExclusiveContext *cx) { // Process AsmJSStaticLinkData: @@ -121,6 +264,13 @@ AsmJSModule::staticallyLink(const AsmJSStaticLinkData &linkData) *(void **)(code_ + link.patchAtOffset) = code_ + link.targetOffset; } + for (size_t i = 0; i < linkData.absoluteLinks.length(); i++) { + AsmJSStaticLinkData::AbsoluteLink link = linkData.absoluteLinks[i]; + Assembler::patchDataWithValueCheck(code_ + link.patchAt.offset(), + PatchedImmPtr(AddressOf(link.target, cx)), + PatchedImmPtr((void*)-1)); + } + // Initialize global data segment for (size_t i = 0; i < exits_.length(); i++) { diff --git a/js/src/jit/AsmJSModule.h b/js/src/jit/AsmJSModule.h index 35ed09693156..e2697efe2ba9 100644 --- a/js/src/jit/AsmJSModule.h +++ b/js/src/jit/AsmJSModule.h @@ -54,11 +54,20 @@ struct AsmJSStaticLinkData typedef Vector RelativeLinkVector; + struct AbsoluteLink + { + jit::CodeOffsetLabel patchAt; + jit::AsmJSImmKind target; + }; + + typedef Vector AbsoluteLinkVector; + size_t operationCallbackExitOffset; RelativeLinkVector relativeLinks; + AbsoluteLinkVector absoluteLinks; AsmJSStaticLinkData(ExclusiveContext *cx) - : relativeLinks(cx) + : relativeLinks(cx), absoluteLinks(cx) {} }; @@ -673,7 +682,7 @@ class AsmJSModule } bool allocateAndCopyCode(ExclusiveContext *cx, jit::MacroAssembler &masm); - void staticallyLink(const AsmJSStaticLinkData &linkData); + void staticallyLink(const AsmJSStaticLinkData &linkData, ExclusiveContext *cx); uint8_t *codeBase() const { JS_ASSERT(code_); diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 2dfd2acec092..d1a44d0e0c25 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -146,6 +146,7 @@ CodeGenerator::CodeGenerator(MIRGenerator *gen, LIRGraph *graph, MacroAssembler CodeGenerator::~CodeGenerator() { + JS_ASSERT_IF(!gen->compilingAsmJS(), masm.numAsmJSAbsoluteLinks() == 0); js_delete(unassociatedScriptCounts_); } @@ -3832,7 +3833,10 @@ CodeGenerator::visitModD(LModD *ins) masm.passABIArg(lhs); masm.passABIArg(rhs); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, NumberMod), MacroAssembler::DOUBLE); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_ModD, MacroAssembler::DOUBLE); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, NumberMod), MacroAssembler::DOUBLE); return true; } @@ -7393,7 +7397,7 @@ CodeGenerator::visitAsmJSCall(LAsmJSCall *ins) masm.call(ToRegister(ins->getOperand(mir->dynamicCalleeOperandIndex()))); break; case MAsmJSCall::Callee::Builtin: - masm.call(ImmPtr(callee.builtin())); + masm.call(callee.builtin()); break; } @@ -7445,9 +7449,8 @@ CodeGenerator::visitAsmJSVoidReturn(LAsmJSVoidReturn *lir) bool CodeGenerator::visitAsmJSCheckOverRecursed(LAsmJSCheckOverRecursed *lir) { - uintptr_t *limitAddr = &GetIonContext()->runtime->mainThread.nativeStackLimit[StackForUntrustedScript]; masm.branchPtr(Assembler::AboveOrEqual, - AbsoluteAddress(limitAddr), + AsmJSAbsoluteAddress(AsmJSImm_StackLimit), StackPointer, lir->mir()->onError()); return true; diff --git a/js/src/jit/IonLinker.h b/js/src/jit/IonLinker.h index e9d8f4b70758..60c3da831333 100644 --- a/js/src/jit/IonLinker.h +++ b/js/src/jit/IonLinker.h @@ -32,6 +32,8 @@ class Linker JS_ASSERT(kind == JSC::ION_CODE || kind == JSC::BASELINE_CODE || kind == JSC::OTHER_CODE); + JS_ASSERT(masm.numAsmJSAbsoluteLinks() == 0); + gc::AutoSuppressGC suppressGC(cx); if (masm.oom()) return fail(cx); diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 1b0ce4535960..ea6a0f5d16b3 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -8789,17 +8789,17 @@ class MAsmJSCall MOZ_FINAL : public MInstruction union { Label *internal_; MDefinition *dynamic_; - const void *builtin_; + AsmJSImmKind builtin_; } u; public: Callee() {} Callee(Label *callee) : which_(Internal) { u.internal_ = callee; } Callee(MDefinition *callee) : which_(Dynamic) { u.dynamic_ = callee; } - Callee(const void *callee) : which_(Builtin) { u.builtin_ = callee; } + Callee(AsmJSImmKind callee) : which_(Builtin) { u.builtin_ = callee; } Which which() const { return which_; } Label *internal() const { JS_ASSERT(which_ == Internal); return u.internal_; } MDefinition *dynamic() const { JS_ASSERT(which_ == Dynamic); return u.dynamic_; } - const void *builtin() const { JS_ASSERT(which_ == Builtin); return u.builtin_; } + AsmJSImmKind builtin() const { JS_ASSERT(which_ == Builtin); return u.builtin_; } }; private: diff --git a/js/src/jit/RegisterSets.h b/js/src/jit/RegisterSets.h index ffe03c5f6e7f..509e4c3d1965 100644 --- a/js/src/jit/RegisterSets.h +++ b/js/src/jit/RegisterSets.h @@ -785,6 +785,11 @@ class ABIArg AnyRegister reg() const { return kind_ == GPR ? AnyRegister(gpr()) : AnyRegister(fpu()); } }; +// Summarizes a heap access made by asm.js code that needs to be patched later +// and/or looked up by the asm.js signal handlers. Different architectures need +// to know different things (x64: offset and length, ARM: where to patch in +// heap length, x86: where to patch in heap length and base) hence the massive +// #ifdefery. class AsmJSHeapAccess { uint32_t offset_; @@ -794,10 +799,10 @@ class AsmJSHeapAccess #if defined(JS_CPU_X86) || defined(JS_CPU_X64) uint8_t opLength_; // the length of the load/store instruction uint8_t isFloat32Load_; - jit::AnyRegister::Code loadedReg_ : 8; + AnyRegister::Code loadedReg_ : 8; #endif - JS_STATIC_ASSERT(jit::AnyRegister::Total < UINT8_MAX); + JS_STATIC_ASSERT(AnyRegister::Total < UINT8_MAX); public: #if defined(JS_CPU_X86) || defined(JS_CPU_X64) @@ -839,7 +844,7 @@ class AsmJSHeapAccess unsigned opLength() const { return opLength_; } bool isLoad() const { return loadedReg_ != UINT8_MAX; } bool isFloat32Load() const { return isFloat32Load_; } - jit::AnyRegister loadedReg() const { return jit::AnyRegister::FromCode(loadedReg_); } + AnyRegister loadedReg() const { return AnyRegister::FromCode(loadedReg_); } #endif }; diff --git a/js/src/jit/arm/Assembler-arm.cpp b/js/src/jit/arm/Assembler-arm.cpp index 91993da9ea29..bf587bb541fd 100644 --- a/js/src/jit/arm/Assembler-arm.cpp +++ b/js/src/jit/arm/Assembler-arm.cpp @@ -2562,7 +2562,8 @@ Assembler::patchWrite_NearCall(CodeLocationLabel start, CodeLocationLabel toCall } void -Assembler::patchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue, ImmPtr expectedValue) +Assembler::patchDataWithValueCheck(CodeLocationLabel label, PatchedImmPtr newValue, + PatchedImmPtr expectedValue) { Instruction *ptr = (Instruction *) label.raw(); InstructionIterator iter(ptr); @@ -2579,6 +2580,12 @@ Assembler::patchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue, Imm } } +void +Assembler::patchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue, ImmPtr expectedValue) +{ + patchDataWithValueCheck(label, PatchedImmPtr(newValue.value), PatchedImmPtr(expectedValue.value)); +} + // This just stomps over memory with 32 bits of raw data. Its purpose is to // overwrite the call of JITed code with 32 bits worth of an offset. This will // is only meant to function on code that has been invalidated, so it should diff --git a/js/src/jit/arm/Assembler-arm.h b/js/src/jit/arm/Assembler-arm.h index eabe4aaebd2e..d5adacea7bdd 100644 --- a/js/src/jit/arm/Assembler-arm.h +++ b/js/src/jit/arm/Assembler-arm.h @@ -1261,6 +1261,7 @@ class Assembler js::Vector tmpJumpRelocations_; js::Vector tmpDataRelocations_; js::Vector tmpPreBarriers_; + AsmJSAbsoluteLinkVector asmJSAbsoluteLinks_; CompactBufferWriter jumpRelocations_; CompactBufferWriter dataRelocations_; @@ -1382,6 +1383,13 @@ class Assembler return codeLabels_[i]; } + size_t numAsmJSAbsoluteLinks() const { + return asmJSAbsoluteLinks_.length(); + } + AsmJSAbsoluteLink asmJSAbsoluteLink(size_t i) const { + return asmJSAbsoluteLinks_[i]; + } + // Size of the instruction stream, in bytes. size_t size() const; // Size of the jump relocation table, in bytes. @@ -1795,6 +1803,8 @@ class Assembler static uint32_t patchWrite_NearCallSize(); static uint32_t nopSize() { return 4; } static void patchWrite_NearCall(CodeLocationLabel start, CodeLocationLabel toCall); + static void patchDataWithValueCheck(CodeLocationLabel label, PatchedImmPtr newValue, + PatchedImmPtr expectedValue); static void patchDataWithValueCheck(CodeLocationLabel label, ImmPtr newValue, ImmPtr expectedValue); static void patchWrite_Imm32(CodeLocationLabel label, Imm32 imm); diff --git a/js/src/jit/arm/CodeGenerator-arm.cpp b/js/src/jit/arm/CodeGenerator-arm.cpp index a3ed71434860..ad1f0d44d1dd 100644 --- a/js/src/jit/arm/CodeGenerator-arm.cpp +++ b/js/src/jit/arm/CodeGenerator-arm.cpp @@ -609,7 +609,10 @@ CodeGeneratorARM::visitSoftDivI(LSoftDivI *ins) masm.setupAlignedABICall(2); masm.passABIArg(lhs); masm.passABIArg(rhs); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_idivmod)); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_aeabi_idivmod); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_idivmod)); // idivmod returns the quotient in r0, and the remainder in r1. if (!mir->isTruncated()) { JS_ASSERT(mir->fallible()); @@ -767,7 +770,10 @@ CodeGeneratorARM::visitSoftModI(LSoftModI *ins) masm.setupAlignedABICall(2); masm.passABIArg(lhs); masm.passABIArg(rhs); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_idivmod)); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_aeabi_idivmod); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_idivmod)); // If X%Y == 0 and X < 0, then we *actually* wanted to return -0.0 if (mir->isTruncated()) { @@ -2037,7 +2043,10 @@ CodeGeneratorARM::visitSoftUDivOrMod(LSoftUDivOrMod *ins) masm.setupAlignedABICall(2); masm.passABIArg(lhs); masm.passABIArg(rhs); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_uidivmod)); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_aeabi_uidivmod); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_uidivmod)); masm.bind(&afterDiv); return true; diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index 5b2efefde842..1a71faccfd85 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -376,8 +376,8 @@ NextInst(Instruction *i) } void -MacroAssemblerARM::ma_movPatchable(Imm32 imm_, Register dest, - Assembler::Condition c, RelocStyle rs, Instruction *i) +MacroAssemblerARM::ma_movPatchable(Imm32 imm_, Register dest, Assembler::Condition c, + RelocStyle rs, Instruction *i) { int32_t imm = imm_.value; if (i) { @@ -1895,6 +1895,19 @@ MacroAssemblerARMCompat::movePtr(const ImmPtr &imm, const Register &dest) movePtr(ImmWord(uintptr_t(imm.value)), dest); } void +MacroAssemblerARMCompat::movePtr(const AsmJSImmPtr &imm, const Register &dest) +{ + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + AsmJSAbsoluteLink link(nextOffset().getOffset(), imm.kind()); + enoughMemory_ &= asmJSAbsoluteLinks_.append(link); + ma_movPatchable(Imm32(-1), dest, Always, rs); +} +void MacroAssemblerARMCompat::load8ZeroExtend(const Address &address, const Register &dest) { ma_dataTransferN(IsLoad, 8, false, address.base, Imm32(address.offset), dest); @@ -2038,6 +2051,12 @@ MacroAssemblerARMCompat::loadPtr(const AbsoluteAddress &address, const Register movePtr(ImmWord(uintptr_t(address.addr)), ScratchRegister); loadPtr(Address(ScratchRegister, 0x0), dest); } +void +MacroAssemblerARMCompat::loadPtr(const AsmJSAbsoluteAddress &address, const Register &dest) +{ + movePtr(AsmJSImmPtr(address.kind()), ScratchRegister); + loadPtr(Address(ScratchRegister, 0x0), dest); +} Operand payloadOf(const Address &address) { return Operand(address.base, address.offset); @@ -3292,7 +3311,7 @@ MacroAssemblerARM::ma_callIonHalfPush(const Register r) } void -MacroAssemblerARM::ma_call(void *dest) +MacroAssemblerARM::ma_call(ImmPtr dest) { RelocStyle rs; if (hasMOVWT()) @@ -3300,7 +3319,7 @@ MacroAssemblerARM::ma_call(void *dest) else rs = L_LDR; - ma_movPatchable(Imm32((uint32_t) dest), CallReg, Always, rs); + ma_movPatchable(dest, CallReg, Always, rs); as_blx(CallReg); } @@ -3561,7 +3580,16 @@ MacroAssemblerARMCompat::callWithABI(void *fun, Result result) { uint32_t stackAdjust; callWithABIPre(&stackAdjust); - ma_call(fun); + ma_call(ImmPtr(fun)); + callWithABIPost(stackAdjust, result); +} + +void +MacroAssemblerARMCompat::callWithABI(AsmJSImmPtr imm, Result result) +{ + uint32_t stackAdjust; + callWithABIPre(&stackAdjust); + call(imm); callWithABIPost(stackAdjust, result); } diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index f008266fc1f8..2484a3a609da 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -374,7 +374,7 @@ class MacroAssemblerARM : public Assembler // calls an ion function, assuming that the stack is currently not 8 byte aligned void ma_callIonHalfPush(const Register reg); - void ma_call(void *dest); + void ma_call(ImmPtr dest); // Float registers can only be loaded/stored in continuous runs // when using vstm/vldm. @@ -542,7 +542,11 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void call(ImmPtr imm) { BufferOffset bo = m_buffer.nextOffset(); addPendingJump(bo, imm, Relocation::HARDCODED); - ma_call(imm.value); + ma_call(imm); + } + void call(AsmJSImmPtr imm) { + movePtr(imm, CallReg); + call(CallReg); } void call(IonCode *c) { BufferOffset bo = m_buffer.nextOffset(); @@ -553,7 +557,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM else rs = L_LDR; - ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs); + ma_movPatchable(ImmPtr(c->raw()), ScratchRegister, Always, rs); ma_callIonHalfPush(ScratchRegister); } void branch(IonCode *c) { @@ -565,7 +569,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM else rs = L_LDR; - ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs); + ma_movPatchable(ImmPtr(c->raw()), ScratchRegister, Always, rs); ma_bx(ScratchRegister); } void branch(const Register reg) { @@ -935,6 +939,10 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void branchPtr(Condition cond, Register lhs, ImmPtr imm, Label *label) { branchPtr(cond, lhs, ImmWord(uintptr_t(imm.value)), label); } + void branchPtr(Condition cond, Register lhs, AsmJSImmPtr imm, Label *label) { + movePtr(imm, ScratchRegister); + branchPtr(cond, lhs, ScratchRegister, label); + } void decBranchPtr(Condition cond, const Register &lhs, Imm32 imm, Label *label) { subPtr(imm, lhs); branch32(cond, lhs, Imm32(0), label); @@ -967,8 +975,13 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM branchPtr(cond, addr, ImmWord(uintptr_t(ptr.value)), label); } void branchPtr(Condition cond, const AbsoluteAddress &addr, const Register &ptr, Label *label) { - loadPtr(addr, secondScratchReg_); // ma_cmp will use the scratch register. - ma_cmp(secondScratchReg_, ptr); + loadPtr(addr, ScratchRegister); + ma_cmp(ScratchRegister, ptr); + ma_b(label, cond); + } + void branchPtr(Condition cond, const AsmJSAbsoluteAddress &addr, const Register &ptr, Label *label) { + loadPtr(addr, ScratchRegister); + ma_cmp(ScratchRegister, ptr); ma_b(label, cond); } void branch32(Condition cond, const AbsoluteAddress &lhs, Imm32 rhs, Label *label) { @@ -1208,6 +1221,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void movePtr(const Register &src, const Register &dest); void movePtr(const ImmWord &imm, const Register &dest); void movePtr(const ImmPtr &imm, const Register &dest); + void movePtr(const AsmJSImmPtr &imm, const Register &dest); void movePtr(const ImmGCPtr &imm, const Register &dest); void load8SignExtend(const Address &address, const Register &dest); @@ -1229,6 +1243,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void loadPtr(const Address &address, const Register &dest); void loadPtr(const BaseIndex &src, const Register &dest); void loadPtr(const AbsoluteAddress &address, const Register &dest); + void loadPtr(const AsmJSAbsoluteAddress &address, const Register &dest); void loadPrivate(const Address &address, const Register &dest); @@ -1383,6 +1398,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM public: // Emits a call to a C/C++ function, resolving all argument moves. void callWithABI(void *fun, Result result = GENERAL); + void callWithABI(AsmJSImmPtr imm, Result result = GENERAL); void callWithABI(const Address &fun, Result result = GENERAL); CodeOffsetLabel labelForPatch() { diff --git a/js/src/jit/shared/Assembler-shared.h b/js/src/jit/shared/Assembler-shared.h index 7b072ab0932e..f31695b810dd 100644 --- a/js/src/jit/shared/Assembler-shared.h +++ b/js/src/jit/shared/Assembler-shared.h @@ -104,41 +104,79 @@ struct ImmWord { } }; +#ifdef DEBUG +static inline bool +IsCompilingAsmJS() +{ + // asm.js compilation pushes an IonContext with a null JSCompartment. + IonContext *ictx = MaybeGetIonContext(); + return ictx && ictx->compartment == NULL; +} +#endif + // Pointer to be embedded as an immediate in an instruction. struct ImmPtr { void *value; explicit ImmPtr(const void *value) : value(const_cast(value)) - { } + { + // To make code serialization-safe, asm.js compilation should only + // compile pointer immediates using AsmJSImmPtr. + JS_ASSERT(!IsCompilingAsmJS()); + } template explicit ImmPtr(R (*pf)()) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) - { } + { + JS_ASSERT(!IsCompilingAsmJS()); + } template explicit ImmPtr(R (*pf)(A1)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) - { } + { + JS_ASSERT(!IsCompilingAsmJS()); + } template explicit ImmPtr(R (*pf)(A1, A2)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) - { } + { + JS_ASSERT(!IsCompilingAsmJS()); + } template explicit ImmPtr(R (*pf)(A1, A2, A3)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) - { } + { + JS_ASSERT(!IsCompilingAsmJS()); + } template explicit ImmPtr(R (*pf)(A1, A2, A3, A4)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) - { } + { + JS_ASSERT(!IsCompilingAsmJS()); + } }; +// The same as ImmPtr except that the intention is to patch this +// instruction. The initial value of the immediate is 'addr' and this value is +// either clobbered or used in the patching process. +struct PatchedImmPtr { + void *value; + + explicit PatchedImmPtr() + : value(NULL) + { } + explicit PatchedImmPtr(const void *value) + : value(const_cast(value)) + { } +}; + // Used for immediates which require relocation. struct ImmGCPtr { @@ -148,6 +186,9 @@ struct ImmGCPtr { JS_ASSERT(!IsPoisonedPtr(ptr)); JS_ASSERT_IF(ptr, ptr->isTenured()); + + // asm.js shouldn't be creating GC things + JS_ASSERT(!IsCompilingAsmJS()); } protected: @@ -161,6 +202,9 @@ struct ImmMaybeNurseryPtr : public ImmGCPtr { this->value = reinterpret_cast(ptr); JS_ASSERT(!IsPoisonedPtr(ptr)); + + // asm.js shouldn't be creating GC things + JS_ASSERT(!IsCompilingAsmJS()); } }; @@ -171,7 +215,10 @@ struct AbsoluteAddress { explicit AbsoluteAddress(const void *addr) : addr(const_cast(addr)) - { } + { + // asm.js shouldn't be creating GC things + JS_ASSERT(!IsCompilingAsmJS()); + } AbsoluteAddress offset(ptrdiff_t delta) { return AbsoluteAddress(((uint8_t *) addr) + delta); @@ -625,6 +672,75 @@ struct AsmJSGlobalAccess typedef Vector AsmJSGlobalAccessVector; +// Describes the intended pointee of an immediate to be embedded in asm.js +// code. By representing the pointee as a symbolic enum, the pointee can be +// patched after deserialization when the address of global things has changed. +enum AsmJSImmKind +{ + AsmJSImm_Runtime, + AsmJSImm_StackLimit, + AsmJSImm_ReportOverRecursed, + AsmJSImm_HandleExecutionInterrupt, + AsmJSImm_InvokeFromAsmJS_Ignore, + AsmJSImm_InvokeFromAsmJS_ToInt32, + AsmJSImm_InvokeFromAsmJS_ToNumber, + AsmJSImm_CoerceInPlace_ToInt32, + AsmJSImm_CoerceInPlace_ToNumber, + AsmJSImm_ToInt32, + AsmJSImm_EnableActivationFromAsmJS, + AsmJSImm_DisableActivationFromAsmJS, +#if defined(JS_CPU_ARM) + AsmJSImm_aeabi_idivmod, + AsmJSImm_aeabi_uidivmod, +#endif + AsmJSImm_ModD, + AsmJSImm_SinD, + AsmJSImm_CosD, + AsmJSImm_TanD, + AsmJSImm_ASinD, + AsmJSImm_ACosD, + AsmJSImm_ATanD, + AsmJSImm_CeilD, + AsmJSImm_FloorD, + AsmJSImm_ExpD, + AsmJSImm_LogD, + AsmJSImm_PowD, + AsmJSImm_ATan2D +}; + +// Pointer to be embedded as an immediate in asm.js code. +class AsmJSImmPtr +{ + AsmJSImmKind kind_; + public: + AsmJSImmKind kind() const { return kind_; } + AsmJSImmPtr(AsmJSImmKind kind) : kind_(kind) { JS_ASSERT(IsCompilingAsmJS()); } + AsmJSImmPtr() {} +}; + +// Pointer to be embedded as an immediate that is loaded/stored from by an +// instruction in asm.js code. +class AsmJSAbsoluteAddress +{ + AsmJSImmKind kind_; + public: + AsmJSImmKind kind() const { return kind_; } + AsmJSAbsoluteAddress(AsmJSImmKind kind) : kind_(kind) { JS_ASSERT(IsCompilingAsmJS()); } + AsmJSAbsoluteAddress() {} +}; + +// Represents an instruction to be patched and the intended pointee. These +// links are accumulated in the MacroAssembler, but patching is done outside +// the MacroAssembler (in AsmJSModule::staticallyLink). +struct AsmJSAbsoluteLink +{ + AsmJSAbsoluteLink(CodeOffsetLabel patchAt, AsmJSImmKind target) + : patchAt(patchAt), target(target) {} + CodeOffsetLabel patchAt; + AsmJSImmKind target; +}; + +typedef Vector AsmJSAbsoluteLinkVector; } // namespace jit } // namespace js diff --git a/js/src/jit/shared/Assembler-x86-shared.h b/js/src/jit/shared/Assembler-x86-shared.h index 4fe503484709..dd8b766af667 100644 --- a/js/src/jit/shared/Assembler-x86-shared.h +++ b/js/src/jit/shared/Assembler-x86-shared.h @@ -131,6 +131,7 @@ class AssemblerX86Shared Vector codeLabels_; Vector jumps_; + AsmJSAbsoluteLinkVector asmJSAbsoluteLinks_; CompactBufferWriter jumpRelocations_; CompactBufferWriter dataRelocations_; CompactBufferWriter preBarriers_; @@ -292,6 +293,13 @@ class AssemblerX86Shared return codeLabels_[i]; } + size_t numAsmJSAbsoluteLinks() const { + return asmJSAbsoluteLinks_.length(); + } + const AsmJSAbsoluteLink &asmJSAbsoluteLink(size_t i) const { + return asmJSAbsoluteLinks_[i]; + } + // Size of the instruction stream, in bytes. size_t size() const { return masm.size(); @@ -1582,13 +1590,16 @@ class AssemblerX86Shared *((int32_t *) dataLabel.raw() - 1) = toWrite.value; } - static void patchDataWithValueCheck(CodeLocationLabel data, ImmPtr newData, - ImmPtr expectedData) { + static void patchDataWithValueCheck(CodeLocationLabel data, PatchedImmPtr newData, + PatchedImmPtr expectedData) { // The pointer given is a pointer to *after* the data. uintptr_t *ptr = ((uintptr_t *) data.raw()) - 1; JS_ASSERT(*ptr == (uintptr_t)expectedData.value); *ptr = (uintptr_t)newData.value; } + static void patchDataWithValueCheck(CodeLocationLabel data, ImmPtr newData, ImmPtr expectedData) { + patchDataWithValueCheck(data, PatchedImmPtr(newData.value), PatchedImmPtr(expectedData.value)); + } static uint32_t nopSize() { return 1; } diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index b7a3aa7ee731..7ec05ba498aa 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -706,7 +706,10 @@ CodeGeneratorShared::visitOutOfLineTruncateSlow(OutOfLineTruncateSlow *ool) masm.setupUnalignedABICall(1, dest); masm.passABIArg(src); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js::ToInt32)); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_ToInt32); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js::ToInt32)); masm.storeCallResult(dest); restoreVolatile(dest); diff --git a/js/src/jit/x64/Assembler-x64.h b/js/src/jit/x64/Assembler-x64.h index 302049266699..c90dabcc6fd8 100644 --- a/js/src/jit/x64/Assembler-x64.h +++ b/js/src/jit/x64/Assembler-x64.h @@ -485,6 +485,11 @@ class Assembler : public AssemblerX86Shared void mov(ImmPtr imm, const Register &dest) { movq(imm, dest); } + void mov(AsmJSImmPtr imm, const Register &dest) { + masm.movq_i64r(-1, dest.code()); + AsmJSAbsoluteLink link(masm.currentOffset(), imm.kind()); + enoughMemory_ &= asmJSAbsoluteLinks_.append(link); + } void mov(const Imm32 &imm32, const Register &dest) { movl(imm32, dest); } diff --git a/js/src/jit/x64/MacroAssembler-x64.cpp b/js/src/jit/x64/MacroAssembler-x64.cpp index 5eecd7b4edee..8ae84c0e016b 100644 --- a/js/src/jit/x64/MacroAssembler-x64.cpp +++ b/js/src/jit/x64/MacroAssembler-x64.cpp @@ -237,6 +237,15 @@ MacroAssemblerX64::callWithABI(void *fun, Result result) callWithABIPost(stackAdjust, result); } +void +MacroAssemblerX64::callWithABI(AsmJSImmPtr imm, Result result) +{ + uint32_t stackAdjust; + callWithABIPre(&stackAdjust); + call(imm); + callWithABIPost(stackAdjust, result); +} + static bool IsIntArgReg(Register reg) { diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index f21bbf15f6b9..346209acca4a 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -111,6 +111,10 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void call(ImmPtr target) { call(ImmWord(uintptr_t(target.value))); } + void call(AsmJSImmPtr target) { + mov(target, rax); + call(rax); + } // Refers to the upper 32 bits of a 64-bit Value operand. // On x86_64, the upper 32 bits do not necessarily only contain the type. @@ -545,6 +549,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared branchPtr(cond, Operand(ScratchReg, 0x0), ptr, label); } } + void branchPtr(Condition cond, const AsmJSAbsoluteAddress &addr, const Register &ptr, Label *label) { + JS_ASSERT(ptr != ScratchReg); + mov(AsmJSImmPtr(addr.kind()), ScratchReg); + branchPtr(cond, Operand(ScratchReg, 0x0), ptr, label); + } void branchPrivatePtr(Condition cond, Address lhs, ImmPtr ptr, Label *label) { branchPtr(cond, lhs, ImmWord(uintptr_t(ptr.value) >> 1), label); @@ -611,6 +620,9 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void movePtr(ImmPtr imm, Register dest) { mov(imm, dest); } + void movePtr(AsmJSImmPtr imm, const Register &dest) { + mov(imm, dest); + } void movePtr(ImmGCPtr imm, Register dest) { movq(imm, dest); } @@ -1137,6 +1149,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared public: // Emits a call to a C/C++ function, resolving all argument moves. void callWithABI(void *fun, Result result = GENERAL); + void callWithABI(AsmJSImmPtr imm, Result result = GENERAL); void callWithABI(Address fun, Result result = GENERAL); void handleFailureWithHandler(void *handler); diff --git a/js/src/jit/x86/Assembler-x86.h b/js/src/jit/x86/Assembler-x86.h index cbd7f7166f84..4b2efd52bc57 100644 --- a/js/src/jit/x86/Assembler-x86.h +++ b/js/src/jit/x86/Assembler-x86.h @@ -231,6 +231,11 @@ class Assembler : public AssemblerX86Shared void mov(ImmPtr imm, Register dest) { movl(imm, dest); } + void mov(AsmJSImmPtr imm, Register dest) { + masm.movl_i32r(-1, dest.code()); + AsmJSAbsoluteLink link(masm.currentOffset(), imm.kind()); + enoughMemory_ &= asmJSAbsoluteLinks_.append(link); + } void mov(Imm32 imm, Register dest) { movl(imm, dest); } @@ -291,6 +296,11 @@ class Assembler : public AssemblerX86Shared MOZ_ASSUME_UNREACHABLE("unexpected operand kind"); } } + void cmpl(const AsmJSAbsoluteAddress &lhs, const Register &rhs) { + masm.cmpl_rm_force32(rhs.code(), (void*)-1); + AsmJSAbsoluteLink link(masm.currentOffset(), lhs.kind()); + enoughMemory_ &= asmJSAbsoluteLinks_.append(link); + } CodeOffsetLabel cmplWithPatch(const Register &lhs, Imm32 rhs) { masm.cmpl_ir_force32(rhs.value, lhs.code()); return masm.currentOffset(); @@ -323,6 +333,13 @@ class Assembler : public AssemblerX86Shared JmpSrc src = masm.call(); addPendingJump(src, target, Relocation::HARDCODED); } + void call(AsmJSImmPtr target) { + // Moving to a register is suboptimal. To fix (use a single + // call-immediate instruction) we'll need to distinguish a new type of + // relative patch to an absolute address in AsmJSAbsoluteLink. + mov(target, eax); + call(eax); + } // Emit a CALL or CMP (nop) instruction. ToggleCall can be used to patch // this instruction. diff --git a/js/src/jit/x86/CodeGenerator-x86.cpp b/js/src/jit/x86/CodeGenerator-x86.cpp index 968b158fcc50..4beb71628879 100644 --- a/js/src/jit/x86/CodeGenerator-x86.cpp +++ b/js/src/jit/x86/CodeGenerator-x86.cpp @@ -859,7 +859,10 @@ CodeGeneratorX86::visitOutOfLineTruncate(OutOfLineTruncate *ool) masm.setupUnalignedABICall(1, output); masm.passABIArg(input); - masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js::ToInt32)); + if (gen->compilingAsmJS()) + masm.callWithABI(AsmJSImm_ToInt32); + else + masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js::ToInt32)); masm.storeCallResult(output); restoreVolatile(output); diff --git a/js/src/jit/x86/MacroAssembler-x86.cpp b/js/src/jit/x86/MacroAssembler-x86.cpp index b17e8857b439..3c06d88e44d9 100644 --- a/js/src/jit/x86/MacroAssembler-x86.cpp +++ b/js/src/jit/x86/MacroAssembler-x86.cpp @@ -255,6 +255,15 @@ MacroAssemblerX86::callWithABI(void *fun, Result result) callWithABIPost(stackAdjust, result); } +void +MacroAssemblerX86::callWithABI(AsmJSImmPtr fun, Result result) +{ + uint32_t stackAdjust; + callWithABIPre(&stackAdjust); + call(fun); + callWithABIPost(stackAdjust, result); +} + void MacroAssemblerX86::callWithABI(const Address &fun, Result result) { diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 1c85f9bb776f..cf5134307558 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -558,6 +558,12 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared j(cond, label); } + // Specialization for AsmJSAbsoluteAddress. + void branchPtr(Condition cond, AsmJSAbsoluteAddress lhs, Register ptr, Label *label) { + cmpl(lhs, ptr); + j(cond, label); + } + template void branchPtr(Condition cond, T lhs, S ptr, Label *label) { cmpl(Operand(lhs), ptr); @@ -624,6 +630,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared void movePtr(ImmPtr imm, Register dest) { movl(imm, dest); } + void movePtr(AsmJSImmPtr imm, Register dest) { + mov(imm, dest); + } void movePtr(ImmGCPtr imm, Register dest) { movl(imm, dest); } @@ -1028,6 +1037,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared public: // Emits a call to a C/C++ function, resolving all argument moves. void callWithABI(void *fun, Result result = GENERAL); + void callWithABI(AsmJSImmPtr fun, Result result = GENERAL); void callWithABI(const Address &fun, Result result = GENERAL); // Used from within an Exit frame to handle a pending exception. diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 9d5cbc21bc8c..829a46bdc8b7 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -268,6 +268,8 @@ struct ThreadSafeContext : ContextFriendFields, FreeOp *defaultFreeOp() { return runtime_->defaultFreeOp(); } bool useHelperThreads() { return runtime_->useHelperThreads(); } size_t helperThreadCount() { return runtime_->helperThreadCount(); } + void *runtimeAddressForJit() { return runtime_; } + void *stackLimitAddress(StackKind kind) { return &runtime_->mainThread.nativeStackLimit[kind]; } // GCs cannot happen while non-main threads are running. uint64_t gcNumber() { return runtime_->gcNumber; } diff --git a/js/src/shell/js-gdb.gdb b/js/src/shell/js-gdb.gdb index ae5400e381be..c87a3b21570d 100644 --- a/js/src/shell/js-gdb.gdb +++ b/js/src/shell/js-gdb.gdb @@ -1,4 +1,4 @@ -afe9b1f9b180define hookpost-run +define hookpost-run if ($sigaction) call free($sigaction) set $sigaction = 0 @@ -10,7 +10,7 @@ commands if !$sigaction set $sigaction = malloc(sizeof(sigaction)) end - set $ignored = __GI___sigaction(11, 0, $sigaction) + set $ignored = __sigaction(11, 0, $sigaction) set $handler = ((struct sigaction *)$sigaction)->__sigaction_handler.sa_handler if $handler == AsmJSFaultHandler continue diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index d9721fd259ed..9acc8074e492 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -537,8 +537,8 @@ class PerThreadData : public PerThreadDataFriendFields, js::Activation *const *addressOfActivation() const { return &activation_; } - js::AsmJSActivation *const *addressOfAsmJSActivationStackReadOnly() const { - return &asmJSActivationStack_; + static unsigned offsetOfAsmJSActivationStackReadOnly() { + return offsetof(PerThreadData, asmJSActivationStack_); } js::AsmJSActivation *asmJSActivationStackFromAnyThread() const { diff --git a/js/xpconnect/src/XPCString.cpp b/js/xpconnect/src/XPCString.cpp index c380bc27bf26..6779f091909d 100644 --- a/js/xpconnect/src/XPCString.cpp +++ b/js/xpconnect/src/XPCString.cpp @@ -19,7 +19,7 @@ */ #include "nscore.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsStringBuffer.h" #include "jsapi.h" #include "xpcpublic.h" diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index b0c6844bbedc..d49e7bb74414 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -160,6 +160,7 @@ nsXPCWrappedJS::AddRef(void) NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this)); if (2 == cnt && IsValid()) { + GetJSObject(); // Unmark gray JSObject. XPCJSRuntime* rt = mClass->GetRuntime(); rt->AddWrappedJSRoot(this); } @@ -246,7 +247,9 @@ nsXPCWrappedJS::GetWeakReference(nsIWeakReference** aInstancePtr) JSObject* nsXPCWrappedJS::GetJSObject() { - JS::ExposeObjectToActiveJS(mJSObj); + if (mJSObj) { + JS::ExposeObjectToActiveJS(mJSObj); + } return mJSObj; } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index bfb7bbc71e98..a4d6762360b2 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -156,6 +156,10 @@ #include "nsIDOMHTMLElement.h" #include "nsIDragSession.h" +#ifdef ANDROID +#include "nsIDocShellTreeOwner.h" +#endif + #define ANCHOR_SCROLL_FLAGS \ (nsIPresShell::SCROLL_OVERFLOW_HIDDEN | nsIPresShell::SCROLL_NO_PARENT_FRAMES) diff --git a/layout/ipc/RenderFrameUtils.h b/layout/ipc/RenderFrameUtils.h index 59182a403560..568287fbf211 100644 --- a/layout/ipc/RenderFrameUtils.h +++ b/layout/ipc/RenderFrameUtils.h @@ -8,6 +8,8 @@ #ifndef mozilla_layer_RenderFrameUtils_h #define mozilla_layer_RenderFrameUtils_h +#include "ipc/IPCMessageUtils.h" + namespace mozilla { namespace layout { diff --git a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c index 8ec13be9d598..8eeab7c5de2c 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c +++ b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c @@ -234,7 +234,7 @@ int nr_stun_server_process_request(nr_stun_server_ctx *ctx, nr_socket *sock, cha nr_stun_server_client *clnt = 0; nr_stun_server_request info; int error; - int dont_free; + int dont_free = 0; r_log(NR_LOG_STUN,LOG_DEBUG,"STUN-SERVER(%s): Received(my_addr=%s,peer_addr=%s)",ctx->label,ctx->my_addr.as_string,peer_addr->as_string); diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 558a24dfa8f5..cafba2972ac6 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -406,6 +406,9 @@ @BINPATH@/components/PeerConnection.manifest #endif +@BINPATH@/components/HttpDataUsage.manifest +@BINPATH@/components/HttpDataUsage.js + #ifdef MOZ_SERVICES_HEALTHREPORT @BINPATH@/components/HealthReportComponents.manifest @BINPATH@/components/HealthReportService.js diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 2ade9ec0e143..b68d240f350e 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -45,6 +45,7 @@ #include "nsTArray.h" #include "nsRefPtrHashtable.h" #include "nsIMemoryReporter.h" +#include "nsThreadUtils.h" class PrefCallback; diff --git a/netwerk/base/src/BackgroundFileSaver.cpp b/netwerk/base/src/BackgroundFileSaver.cpp index 16f5dbffd10e..27419bdc6b6a 100644 --- a/netwerk/base/src/BackgroundFileSaver.cpp +++ b/netwerk/base/src/BackgroundFileSaver.cpp @@ -15,6 +15,7 @@ #include "BackgroundFileSaver.h" #include "mozilla/Telemetry.h" +#include "nsIAsyncInputStream.h" namespace mozilla { namespace net { diff --git a/netwerk/base/src/nsDirectoryIndexStream.cpp b/netwerk/base/src/nsDirectoryIndexStream.cpp index e5a93c83cacf..f5c174f403ef 100644 --- a/netwerk/base/src/nsDirectoryIndexStream.cpp +++ b/netwerk/base/src/nsDirectoryIndexStream.cpp @@ -17,6 +17,7 @@ #include "nsEscape.h" #include "nsDirectoryIndexStream.h" #include "prlog.h" +#include "prtime.h" #ifdef PR_LOGGING static PRLogModuleInfo* gLog; #endif diff --git a/netwerk/cache/nsDeleteDir.cpp b/netwerk/cache/nsDeleteDir.cpp index fd66c0c0f23b..686d0cbd0be1 100644 --- a/netwerk/cache/nsDeleteDir.cpp +++ b/netwerk/cache/nsDeleteDir.cpp @@ -14,6 +14,7 @@ #include "nsThreadUtils.h" #include "nsISupportsPriority.h" #include "nsCacheUtils.h" +#include "prtime.h" #include using namespace mozilla; diff --git a/netwerk/protocol/about/nsAboutCacheEntry.cpp b/netwerk/protocol/about/nsAboutCacheEntry.cpp index 79b11243158d..01ac7117e1e2 100644 --- a/netwerk/protocol/about/nsAboutCacheEntry.cpp +++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp @@ -9,6 +9,8 @@ #include "nsNetUtil.h" #include "prprf.h" #include "nsEscape.h" +#include "nsIAsyncInputStream.h" +#include "nsIAsyncOutputStream.h" #include #define HEXDUMP_MAX_ROWS 16 diff --git a/netwerk/protocol/http/HttpDataUsage.js b/netwerk/protocol/http/HttpDataUsage.js new file mode 100644 index 000000000000..6237e3ae34f0 --- /dev/null +++ b/netwerk/protocol/http/HttpDataUsage.js @@ -0,0 +1,222 @@ +/* -*- indent-tabs-mode: nil -*- */ +/* 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/. */ + +/* HTTPDATA_* telemetry producer + every 3 minutes of idle time we update a data file and report it + once a day. this avoids adding io to the shutdown path +*/ + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cr = Components.results; +const Cu = Components.utils; +const CC = Components.Constructor; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/NetUtil.jsm"); + +XPCOMUtils.defineLazyServiceGetter(this, "idleService", + "@mozilla.org/widget/idleservice;1", + "nsIIdleService"); +XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", + "resource://gre/modules/FileUtils.jsm"); + +const MB = 1000000; + +var gDataUsage; +function HttpDataUsage() {} +HttpDataUsage.prototype = { + classID: Components.ID("{6d72bfca-2747-4859-887f-6f06d4ce6787}"), + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), + contractID: "@mozilla.org/network/HttpDataUsage;1", + + _isIdleObserver: false, + _locked : false, + _do_telemetry : false, + _idle_timeout : 60 * 3, + _quanta : 86400000, // per day + + _logtime : new Date(), + _ethernetRead : 0, + _ethernetWritten : 0, + _cellRead : 0, + _cellWritten : 0, + + _dataFile : FileUtils.getFile("ProfD", ["httpDataUsage.dat"], true), + _dataUsage : Cc["@mozilla.org/network/protocol;1?name=http"] + .getService(Ci.nsIHttpProtocolHandler) + .QueryInterface(Ci.nsIHttpDataUsage), + _pipe : CC("@mozilla.org/pipe;1", "nsIPipe", "init"), + _outputStream : CC("@mozilla.org/network/file-output-stream;1", + "nsIFileOutputStream", "init"), + + setup: function setup() { + gDataUsage = this; + + var enabled = false; + try { + if (Services.prefs.getBoolPref("toolkit.telemetry.enabled")) + enabled = true; + } catch (e) { } + try { + if (Services.prefs.getBoolPref("toolkit.telemetry.enabledPreRelease")) + enabled = true; + } catch (e) { } + + // this isn't important enough to worry about getting a + // runtime telemetry config change for + if (!enabled) + return; + + if (this._dataUsage == null) + return; + + idleService.addIdleObserver(this, this._idle_timeout); + this._isIdleObserver = true; + }, + + shutdown: function shutdown() { + if (this._isIdleObserver) + idleService.removeIdleObserver(this, this._idle_timeout); + this._isIdleObserver = false; + }, + + sUpdateStats2: function sUpdateStats2(stream, result) { + gDataUsage.updateStats2(stream, result); + }, + + sGatherTelemetry2: function sGatherTelemetry2(stream, result) { + gDataUsage.gatherTelemetry2(stream, result); + }, + + readCounters: function readCounters(stream, result) { + if (Components.isSuccessCode(result)) { + let count = stream.available(); + let data = NetUtil.readInputStreamToString(stream, count); + var list = data.split(","); + if (list.length == 5) { + this._logtime = new Date(Number(list[0])); + this._ethernetRead = Number(list[1]); + this._ethernetWritten = Number(list[2]); + this._cellRead = Number(list[3]); + this._cellWritten = Number(list[4]); + } + } + + this._ethernetRead += this._dataUsage.ethernetBytesRead; + this._ethernetWritten += this._dataUsage.ethernetBytesWritten; + this._cellRead += this._dataUsage.cellBytesRead; + this._cellWritten += this._dataUsage.cellBytesWritten; + this._dataUsage.resetHttpDataUsage(); + }, + + // writeCounters also releases the lock + writeCounters: function writeCounters() { + var dataout = this._logtime.getTime().toString() + "," + + this._ethernetRead.toString() + "," + + this._ethernetWritten.toString() + "," + + this._cellRead.toString() + "," + + this._cellWritten.toString() + "\n"; + + var buffer = new this._pipe(true, false, 4096, 1, null); + buffer.outputStream.write(dataout, dataout.length); + buffer.outputStream.close(); + var fileOut = new this._outputStream(this._dataFile, -1, -1, 0); + + NetUtil.asyncCopy(buffer.inputStream, fileOut, + function (result) { gDataUsage.finishedWriting(); }); + }, + + updateStats2: function updateStats2(stream, result) { + this.readCounters(stream, result); + this.writeCounters(); + }, + + gatherTelemetry2: function gatherTelemetry2(stream, result) { + this.readCounters(stream, result); + + var now = new Date(); + var elapsed = now.getTime() - this._logtime.getTime(); + // make sure we have at least 1 day of data + if (elapsed < this._quanta) { + this.finishedWriting(); + return; + } + + var days = elapsed / this._quanta; + var eInPerQuanta = Math.floor(this._ethernetRead / days); + var eOutPerQuanta = Math.floor(this._ethernetWritten / days); + var cInPerQuanta = Math.floor(this._cellRead / days); + var cOutPerQuanta = Math.floor(this._cellWritten / days); + + var histogram; + + while (elapsed >= this._quanta) { + histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_ETHERNET_IN"); + histogram.add(Math.round(eInPerQuanta / MB)); + histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_ETHERNET_OUT"); + histogram.add(Math.round(eOutPerQuanta / MB)); + histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_CELL_IN"); + histogram.add(Math.round(cInPerQuanta / MB)); + histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_CELL_OUT"); + histogram.add(Math.round(cOutPerQuanta / MB)); + + elapsed -= this._quanta; + this._ethernetRead -= eInPerQuanta; + this._ethernetWritten -= eOutPerQuanta; + this._cellRead -= cInPerQuanta; + this._cellWritten -= cOutPerQuanta; + } + this._logtime = new Date(now.getTime() - elapsed); + + this.writeCounters(); + }, + + finishedWriting : function finishedWriting() { + this._locked = false; + if (this._do_telemetry) { + this._do_telemetry = false; + this.gatherTelemetry(); + } + }, + + updateStats: function updateStats() { + if (this._locked) + return; + this._locked = true; + + NetUtil.asyncFetch(this._dataFile, this.sUpdateStats2); + }, + + gatherTelemetry: function gatherTelemetry() { + if (this._locked) + return; // oh well, maybe next time + this._locked = true; + + NetUtil.asyncFetch(this._dataFile, this.sGatherTelemetry2); + }, + + observe: function (aSubject, aTopic, aData) { + switch (aTopic) { + case "profile-after-change": + this.setup(); + break; + case "gather-telemetry": + this._do_telemetry = true; + this.updateStats(); + break; + case "idle": + this.updateStats(); + break; + case "profile-change-net-teardown": + this.shutdown(); + break; + } + }, + +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([HttpDataUsage]); diff --git a/netwerk/protocol/http/HttpDataUsage.manifest b/netwerk/protocol/http/HttpDataUsage.manifest new file mode 100644 index 000000000000..4888f3fcf5d4 --- /dev/null +++ b/netwerk/protocol/http/HttpDataUsage.manifest @@ -0,0 +1,3 @@ +component {6d72bfca-2747-4859-887f-6f06d4ce6787} HttpDataUsage.js +contract @mozilla.org/network/HttpDataUsage;1 {6d72bfca-2747-4859-887f-6f06d4ce6787} +category profile-after-change HttpDataUsage @mozilla.org/network/HttpDataUsage;1 diff --git a/netwerk/protocol/http/moz.build b/netwerk/protocol/http/moz.build index c8b7fa412861..d6a587a8b4d0 100644 --- a/netwerk/protocol/http/moz.build +++ b/netwerk/protocol/http/moz.build @@ -13,6 +13,7 @@ XPIDL_SOURCES += [ 'nsIHttpChannelAuthProvider.idl', 'nsIHttpChannelChild.idl', 'nsIHttpChannelInternal.idl', + 'nsIHttpDataUsage.idl', 'nsIHttpEventSink.idl', 'nsIHttpHeaderVisitor.idl', 'nsIHttpProtocolHandler.idl', @@ -81,6 +82,11 @@ EXTRA_JS_MODULES += [ 'UserAgentUpdates.jsm', ] +EXTRA_COMPONENTS += [ + 'HttpDataUsage.js', + 'HttpDataUsage.manifest', +] + FAIL_ON_WARNINGS = True LIBXUL_LIBRARY = True diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index 20226232ecec..9e6e55f06122 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -46,6 +46,8 @@ nsHttpConnection::nsHttpConnection() , mMaxBytesRead(0) , mTotalBytesRead(0) , mTotalBytesWritten(0) + , mUnreportedBytesRead(0) + , mUnreportedBytesWritten(0) , mKeepAlive(true) // assume to keep-alive by default , mKeepAliveMask(true) , mDontReuse(false) @@ -75,6 +77,7 @@ nsHttpConnection::~nsHttpConnection() { LOG(("Destroying nsHttpConnection @%x\n", this)); + ReportDataUsage(false); if (!mEverUsedSpdy) { LOG(("nsHttpConnection %p performed %d HTTP/1.x transactions\n", this, mHttp1xTransactionCount)); @@ -1182,6 +1185,8 @@ nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) mCallbacks = nullptr; } + ReportDataUsage(false); + if (NS_FAILED(reason)) Close(reason); @@ -1224,8 +1229,11 @@ nsHttpConnection::OnReadSegment(const char *buf, else { mLastWriteTime = PR_IntervalNow(); mSocketOutCondition = NS_OK; // reset condition - if (!mProxyConnectInProgress) + if (!mProxyConnectInProgress) { mTotalBytesWritten += *countRead; + mUnreportedBytesWritten += *countRead; + ReportDataUsage(true); + } } return mSocketOutCondition; @@ -1443,6 +1451,8 @@ nsHttpConnection::OnSocketReadable() else { mCurrentBytesRead += n; mTotalBytesRead += n; + mUnreportedBytesRead += n; + ReportDataUsage(true); if (NS_FAILED(mSocketInCondition)) { // continue waiting for the socket if necessary... if (mSocketInCondition == NS_BASE_STREAM_WOULD_BLOCK) @@ -1507,6 +1517,27 @@ nsHttpConnection::SetupProxyConnect() return NS_NewCStringInputStream(getter_AddRefs(mProxyConnectStream), buf); } +void +nsHttpConnection::ReportDataUsage(bool allowDefer) +{ + static const uint64_t kDeferThreshold = 128000; + + if (!mUnreportedBytesRead && !mUnreportedBytesWritten) + return; + + if (!gHttpHandler->IsTelemetryEnabled()) + return; + + if (allowDefer && + (mUnreportedBytesRead + mUnreportedBytesWritten) < kDeferThreshold) { + return; + } + + gHttpHandler->UpdateDataUsage(mCallbacks, + mUnreportedBytesRead, mUnreportedBytesWritten); + mUnreportedBytesRead = mUnreportedBytesWritten = 0; +} + //----------------------------------------------------------------------------- // nsHttpConnection::nsISupports //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h index d64a75d8cb3a..4e0f9733e3e1 100644 --- a/netwerk/protocol/http/nsHttpConnection.h +++ b/netwerk/protocol/http/nsHttpConnection.h @@ -193,6 +193,9 @@ private: // Directly Add a transaction to an active connection for SPDY nsresult AddTransaction(nsAHttpTransaction *, int32_t); + // used to inform nsIHttpDataUsage of transfer + void ReportDataUsage(bool); + private: nsCOMPtr mSocketTransport; nsCOMPtr mSocketIn; @@ -226,6 +229,10 @@ private: int64_t mTotalBytesRead; // total data read int64_t mTotalBytesWritten; // does not include CONNECT tunnel + // for nsIHttpDataUsage + uint64_t mUnreportedBytesRead; // subset of totalBytesRead + uint64_t mUnreportedBytesWritten; // subset of totalBytesWritten + nsRefPtr mInputOverflow; PRIntervalTime mRtt; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 72e97ae324a6..dc1dad8367a7 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -69,6 +69,10 @@ #include #endif +#if defined(MOZ_WIDGET_GONK) +#include "nsINetworkManager.h" +#endif + //----------------------------------------------------------------------------- using namespace mozilla; using namespace mozilla::net; @@ -198,6 +202,12 @@ nsHttpHandler::nsHttpHandler() , mRequestTokenBucketHz(100) , mRequestTokenBucketBurst(32) , mCritialRequestPrioritization(true) + , mEthernetBytesRead(0) + , mEthernetBytesWritten(0) + , mCellBytesRead(0) + , mCellBytesWritten(0) + , mNetworkTypeKnown(false) + , mNetworkTypeWasEthernet(true) { #if defined(PR_LOGGING) gHttpLog = PR_NewLogModule("nsHttp"); @@ -1505,13 +1515,14 @@ nsHttpHandler::SetAcceptEncodings(const char *aAcceptEncodings) // nsHttpHandler::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_ISUPPORTS6(nsHttpHandler, +NS_IMPL_ISUPPORTS7(nsHttpHandler, nsIHttpProtocolHandler, nsIProxiedProtocolHandler, nsIProtocolHandler, nsIObserver, nsISupportsWeakReference, - nsISpeculativeConnect) + nsISpeculativeConnect, + nsIHttpDataUsage) //----------------------------------------------------------------------------- // nsHttpHandler::nsIProtocolHandler @@ -1931,45 +1942,248 @@ nsHttpHandler::SpeculativeConnect(nsIURI *aURI, return SpeculativeConnect(ci, aCallbacks); } -void -nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb) +// nsIHttpDataUsage + +NS_IMETHODIMP +nsHttpHandler::GetEthernetBytesRead(uint64_t *aEthernetBytesRead) { - if (!cb || !mWifiTickler) + MOZ_ASSERT(NS_IsMainThread()); + *aEthernetBytesRead = mEthernetBytesRead; + return NS_OK; +} + +NS_IMETHODIMP +nsHttpHandler::GetEthernetBytesWritten(uint64_t *aEthernetBytesWritten) +{ + MOZ_ASSERT(NS_IsMainThread()); + *aEthernetBytesWritten = mEthernetBytesWritten; + return NS_OK; +} + +NS_IMETHODIMP +nsHttpHandler::GetCellBytesRead(uint64_t *aCellBytesRead) +{ + MOZ_ASSERT(NS_IsMainThread()); + *aCellBytesRead = mCellBytesRead; + return NS_OK; +} + +NS_IMETHODIMP +nsHttpHandler::GetCellBytesWritten(uint64_t *aCellBytesWritten) +{ + MOZ_ASSERT(NS_IsMainThread()); + *aCellBytesWritten = mCellBytesWritten; + return NS_OK; +} + +NS_IMETHODIMP +nsHttpHandler::ResetHttpDataUsage() +{ + MOZ_ASSERT(NS_IsMainThread()); + mEthernetBytesRead = mEthernetBytesWritten = 0; + mCellBytesRead = mCellBytesWritten = 0; + return NS_OK; +} + +class DataUsageEvent : public nsRunnable +{ +public: + explicit DataUsageEvent(nsIInterfaceRequestor *cb, + uint64_t bytesRead, + uint64_t bytesWritten) + : mCB(cb), mRead(bytesRead), mWritten(bytesWritten) { } + + NS_IMETHOD Run() MOZ_OVERRIDE + { + MOZ_ASSERT(NS_IsMainThread()); + if (gHttpHandler) + gHttpHandler->UpdateDataUsage(mCB, mRead, mWritten); + return NS_OK; + } + +private: + ~DataUsageEvent() { } + nsCOMPtr mCB; + uint64_t mRead; + uint64_t mWritten; +}; + +void +nsHttpHandler::UpdateDataUsage(nsIInterfaceRequestor *cb, + uint64_t bytesRead, uint64_t bytesWritten) +{ + if (!IsTelemetryEnabled()) return; - // If B2G requires a similar mechanism nsINetworkManager, currently only avail - // on B2G, contains the necessary information on wifi and gateway + if (!NS_IsMainThread()) { + nsRefPtr event = new DataUsageEvent(cb, bytesRead, bytesWritten); + NS_DispatchToMainThread(event); + return; + } + + bool isEthernet = true; + + if (NS_FAILED(GetNetworkEthernetInfo(cb, &isEthernet))) { + // without a window it is hard for android to determine the network type + // so on failures we will just use the last value + if (!mNetworkTypeKnown) + return; + isEthernet = mNetworkTypeWasEthernet; + } + + if (isEthernet) { + mEthernetBytesRead += bytesRead; + mEthernetBytesWritten += bytesWritten; + } else { + mCellBytesRead += bytesRead; + mCellBytesWritten += bytesWritten; + } +} + +nsresult +nsHttpHandler::GetNetworkEthernetInfo(nsIInterfaceRequestor *cb, + bool *aEthernet) +{ + NS_ENSURE_ARG_POINTER(aEthernet); + + nsresult rv = GetNetworkEthernetInfoInner(cb, aEthernet); + if (NS_SUCCEEDED(rv)) { + mNetworkTypeKnown = true; + mNetworkTypeWasEthernet = *aEthernet; + } + return rv; +} + +// aEthernet and aGateway are required out parameters +// on b2g and desktop gateway cannot be determined yet and +// this function returns ERROR_NOT_IMPLEMENTED. +nsresult +nsHttpHandler::GetNetworkInfo(nsIInterfaceRequestor *cb, + bool *aEthernet, + uint32_t *aGateway) +{ + NS_ENSURE_ARG_POINTER(aEthernet); + NS_ENSURE_ARG_POINTER(aGateway); + + nsresult rv = GetNetworkInfoInner(cb, aEthernet, aGateway); + if (NS_SUCCEEDED(rv)) { + mNetworkTypeKnown = true; + mNetworkTypeWasEthernet = *aEthernet; + } + return rv; +} + +nsresult +nsHttpHandler::GetNetworkInfoInner(nsIInterfaceRequestor *cb, + bool *aEthernet, + uint32_t *aGateway) +{ + NS_ENSURE_ARG_POINTER(aEthernet); + NS_ENSURE_ARG_POINTER(aGateway); + + *aGateway = 0; + *aEthernet = true; + +#if defined(MOZ_WIDGET_GONK) + // b2g only allows you to ask for ethernet or not right now. + return NS_ERROR_NOT_IMPLEMENTED; +#endif + +#if defined(ANDROID) + if (!cb) + return NS_ERROR_FAILURE; nsCOMPtr domWindow; cb->GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow)); if (!domWindow) - return; + return NS_ERROR_FAILURE; nsCOMPtr domNavigator; domWindow->GetNavigator(getter_AddRefs(domNavigator)); nsCOMPtr networkNavigator = do_QueryInterface(domNavigator); if (!networkNavigator) - return; + return NS_ERROR_FAILURE; nsCOMPtr mozConnection; networkNavigator->GetMozConnection(getter_AddRefs(mozConnection)); nsCOMPtr networkProperties = do_QueryInterface(mozConnection); if (!networkProperties) + return NS_ERROR_FAILURE; + + nsresult rv; + rv = networkProperties->GetDhcpGateway(aGateway); + if (NS_FAILED(rv)) + return rv; + + return networkProperties->GetIsWifi(aEthernet); +#endif + + // desktop does not currently know about the gateway + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsHttpHandler::GetNetworkEthernetInfoInner(nsIInterfaceRequestor *cb, + bool *aEthernet) +{ + *aEthernet = true; + +#if defined(MOZ_WIDGET_GONK) + int32_t networkType; + nsCOMPtr networkManager = + do_GetService("@mozilla.org/network/manager;1"); + if (!networkManager) + return NS_ERROR_FAILURE; + if (NS_FAILED(networkManager->GetPreferredNetworkType(&networkType))) + return NS_ERROR_FAILURE; + *aEthernet = networkType == nsINetworkInterface::NETWORK_TYPE_WIFI; + return NS_OK; +#endif + +#if defined(ANDROID) + if (!cb) + return NS_ERROR_FAILURE; + + nsCOMPtr domWindow; + cb->GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow)); + if (!domWindow) + return NS_ERROR_FAILURE; + + nsCOMPtr domNavigator; + domWindow->GetNavigator(getter_AddRefs(domNavigator)); + nsCOMPtr networkNavigator = + do_QueryInterface(domNavigator); + if (!networkNavigator) + return NS_ERROR_FAILURE; + + nsCOMPtr mozConnection; + networkNavigator->GetMozConnection(getter_AddRefs(mozConnection)); + nsCOMPtr networkProperties = + do_QueryInterface(mozConnection); + if (!networkProperties) + return NS_ERROR_FAILURE; + + return networkProperties->GetIsWifi(aEthernet); +#endif + + // desktop assumes never on cell data + *aEthernet = true; + return NS_OK; +} + +void +nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb) +{ + if (!cb || !mWifiTickler) return; uint32_t gwAddress; bool isWifi; - nsresult rv; - rv = networkProperties->GetDhcpGateway(&gwAddress); - if (NS_SUCCEEDED(rv)) - rv = networkProperties->GetIsWifi(&isWifi); - if (NS_FAILED(rv)) - return; - - if (!gwAddress || !isWifi) + nsresult rv = GetNetworkInfo(cb, &isWifi, &gwAddress); + if (NS_FAILED(rv) || !gwAddress || !isWifi) return; mWifiTickler->SetIPV4Address(gwAddress); diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index ddf5601ab094..1daa12844d76 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -15,6 +15,7 @@ #include "nsCOMPtr.h" #include "nsWeakReference.h" +#include "nsIHttpDataUsage.h" #include "nsIHttpProtocolHandler.h" #include "nsIObserver.h" #include "nsISpeculativeConnect.h" @@ -50,6 +51,7 @@ class nsHttpHandler : public nsIHttpProtocolHandler , public nsIObserver , public nsSupportsWeakReference , public nsISpeculativeConnect + , public nsIHttpDataUsage { public: NS_DECL_THREADSAFE_ISUPPORTS @@ -58,6 +60,7 @@ public: NS_DECL_NSIHTTPPROTOCOLHANDLER NS_DECL_NSIOBSERVER NS_DECL_NSISPECULATIVECONNECT + NS_DECL_NSIHTTPDATAUSAGE nsHttpHandler(); virtual ~nsHttpHandler(); @@ -473,8 +476,30 @@ public: } private: + // for nsIHttpDataUsage + uint64_t mEthernetBytesRead; + uint64_t mEthernetBytesWritten; + uint64_t mCellBytesRead; + uint64_t mCellBytesWritten; + bool mNetworkTypeKnown; + bool mNetworkTypeWasEthernet; + nsRefPtr mWifiTickler; + nsresult GetNetworkEthernetInfo(nsIInterfaceRequestor *cb, + bool *ethernet); + nsresult GetNetworkEthernetInfoInner(nsIInterfaceRequestor *cb, + bool *ethernet); + nsresult GetNetworkInfo(nsIInterfaceRequestor *cb, + bool *ethernet, uint32_t *gw); + nsresult GetNetworkInfoInner(nsIInterfaceRequestor *cb, + bool *ethernet, uint32_t *gw); void TickleWifi(nsIInterfaceRequestor *cb); + +public: + // this is called to update the member variables used for nsIHttpDataUsage + // it can be called from any thread + void UpdateDataUsage(nsIInterfaceRequestor *cb, + uint64_t bytesRead, uint64_t bytesWritten); }; extern nsHttpHandler *gHttpHandler; diff --git a/netwerk/protocol/http/nsIHttpDataUsage.idl b/netwerk/protocol/http/nsIHttpDataUsage.idl new file mode 100644 index 000000000000..ecbb52976c91 --- /dev/null +++ b/netwerk/protocol/http/nsIHttpDataUsage.idl @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* 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" + +/** + * nsIHttpDataUsage contains counters for the amount of HTTP data transferred + * in and out of this session since the last time it was reset with the + * resetHttpDataUsage() method. These counters are normally reset on each + * telemetry ping. + * + * Data is split into ethernet and cell. ethernet includes wifi. + * + */ + +[scriptable, uuid(79dee3eb-9323-4d5c-b0a8-1baa18934d9e)] +interface nsIHttpDataUsage : nsISupports +{ + readonly attribute unsigned long long ethernetBytesRead; + readonly attribute unsigned long long ethernetBytesWritten; + readonly attribute unsigned long long cellBytesRead; + readonly attribute unsigned long long cellBytesWritten; + + void resetHttpDataUsage(); +}; diff --git a/netwerk/streamconv/src/nsStreamConverterService.cpp b/netwerk/streamconv/src/nsStreamConverterService.cpp index b28b2e71355d..1bb4c5fa8f93 100644 --- a/netwerk/streamconv/src/nsStreamConverterService.cpp +++ b/netwerk/streamconv/src/nsStreamConverterService.cpp @@ -32,6 +32,7 @@ #include "nsTArray.h" #include "nsServiceManagerUtils.h" #include "nsHashtable.h" +#include "nsISimpleEnumerator.h" /////////////////////////////////////////////////////////////////// // Breadth-First-Search (BFS) algorithm state classes and types. diff --git a/netwerk/test/PropertiesTest.cpp b/netwerk/test/PropertiesTest.cpp index 6af8a92f2f8a..f750d99f5bbd 100644 --- a/netwerk/test/PropertiesTest.cpp +++ b/netwerk/test/PropertiesTest.cpp @@ -17,6 +17,7 @@ #include #include "nsComponentManagerUtils.h" #include "nsServiceManagerUtils.h" +#include "nsISimpleEnumerator.h" #define TEST_URL "resource:/res/test.properties" static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID); diff --git a/parser/htmlparser/public/nsHTMLTags.h b/parser/htmlparser/public/nsHTMLTags.h index 00189ab4c903..10ec895c3fb1 100644 --- a/parser/htmlparser/public/nsHTMLTags.h +++ b/parser/htmlparser/public/nsHTMLTags.h @@ -6,7 +6,7 @@ #ifndef nsHTMLTags_h___ #define nsHTMLTags_h___ -#include "nsStringGlue.h" +#include "nsString.h" #include "plhash.h" class nsIAtom; diff --git a/parser/htmlparser/public/nsIContentSink.h b/parser/htmlparser/public/nsIContentSink.h index 1c5491a19446..56c70a1b4647 100644 --- a/parser/htmlparser/public/nsIContentSink.h +++ b/parser/htmlparser/public/nsIContentSink.h @@ -17,7 +17,7 @@ * about more, which is the IHTMLContentSink interface. (See that file for details). */ #include "nsISupports.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "mozFlushType.h" #include "nsIDTD.h" diff --git a/parser/htmlparser/public/nsIDTD.h b/parser/htmlparser/public/nsIDTD.h index 19571a2c86f8..619380e71907 100644 --- a/parser/htmlparser/public/nsIDTD.h +++ b/parser/htmlparser/public/nsIDTD.h @@ -22,7 +22,7 @@ * */ #include "nsISupports.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsITokenizer.h" #define NS_IDTD_IID \ diff --git a/parser/htmlparser/public/nsIParser.h b/parser/htmlparser/public/nsIParser.h index b5bfc469365a..dbf6ba13de05 100644 --- a/parser/htmlparser/public/nsIParser.h +++ b/parser/htmlparser/public/nsIParser.h @@ -21,7 +21,7 @@ #include "nsISupports.h" #include "nsIStreamListener.h" #include "nsIDTD.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsIAtom.h" #include "nsParserBase.h" diff --git a/parser/htmlparser/public/nsIParserService.h b/parser/htmlparser/public/nsIParserService.h index a369cb852e8a..328a2455f370 100644 --- a/parser/htmlparser/public/nsIParserService.h +++ b/parser/htmlparser/public/nsIParserService.h @@ -7,7 +7,7 @@ #define nsIParserService_h__ #include "nsISupports.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsHTMLTags.h" class nsIParser; diff --git a/security/manager/boot/src/nsSiteSecurityService.cpp b/security/manager/boot/src/nsSiteSecurityService.cpp index 948a2592f004..742187550a1e 100644 --- a/security/manager/boot/src/nsSiteSecurityService.cpp +++ b/security/manager/boot/src/nsSiteSecurityService.cpp @@ -14,7 +14,7 @@ #include "nsIURI.h" #include "nsNetUtil.h" #include "nsThreadUtils.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsIScriptSecurityManager.h" #include "nsISocketProvider.h" #include "mozilla/Preferences.h" diff --git a/storage/src/VacuumManager.cpp b/storage/src/VacuumManager.cpp index 6f9567053f88..1100375cedd0 100644 --- a/storage/src/VacuumManager.cpp +++ b/storage/src/VacuumManager.cpp @@ -14,6 +14,7 @@ #include "nsIFile.h" #include "nsThreadUtils.h" #include "prlog.h" +#include "prtime.h" #include "mozStorageConnection.h" #include "mozIStorageStatement.h" diff --git a/storage/test/test_file_perms.cpp b/storage/test/test_file_perms.cpp index c89663047909..1235fe09bd34 100644 --- a/storage/test/test_file_perms.cpp +++ b/storage/test/test_file_perms.cpp @@ -6,6 +6,7 @@ #include "storage_test_harness.h" #include "nsIFile.h" +#include "prio.h" /** * This file tests that the file permissions of the sqlite files match what diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index afdbdad53f4b..9825ad71e991 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -26,6 +26,7 @@ #include "nsPrintfCString.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" +#include "prtime.h" // Time between corrupt database backups. #define RECENT_BACKUP_TIME_MICROSEC (int64_t)86400 * PR_USEC_PER_SEC // 24H diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 52e6648d8800..d8911275e3e5 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -23,7 +23,7 @@ #include "nsNativeCharsetUtils.h" #include "nsThreadUtils.h" #include "nsAutoPtr.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "mozilla/Preferences.h" #include "GeckoProfiler.h" diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 2d1c1aa1d499..ddf2a0fec4ca 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -869,6 +869,34 @@ "kind": "boolean", "description": "Whether a HTTP base page load was over SSL or not." }, + "HTTPDATA_DAILY_ETHERNET_IN": { + "kind": "exponential", + "high": "10000", + "n_buckets": 200, + "extended_statistics_ok": true, + "description": "MB of http ethernet data recvd in one day" + }, + "HTTPDATA_DAILY_ETHERNET_OUT": { + "kind": "exponential", + "high": "10000", + "n_buckets": 200, + "extended_statistics_ok": true, + "description": "MB of http ethernet data sent in one day" + }, + "HTTPDATA_DAILY_CELL_IN": { + "kind": "exponential", + "high": "10000", + "n_buckets": 200, + "extended_statistics_ok": true, + "description": "MB of http cell data recvd in one day" + }, + "HTTPDATA_DAILY_CELL_OUT": { + "kind": "exponential", + "high": "10000", + "n_buckets": 200, + "extended_statistics_ok": true, + "description": "MB of http cell data sent in one day" + }, "SSL_HANDSHAKE_VERSION": { "kind": "enumerated", "n_values": 16, diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 3aade6687c8f..6893af089dda 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -29,7 +29,7 @@ #include "jsapi.h" #include "jsfriendapi.h" #include "js/GCAPI.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsITelemetry.h" #include "nsIFile.h" #include "nsIFileStreams.h" diff --git a/toolkit/crashreporter/mac_utils.h b/toolkit/crashreporter/mac_utils.h index b4373c34c11a..839baad558b4 100644 --- a/toolkit/crashreporter/mac_utils.h +++ b/toolkit/crashreporter/mac_utils.h @@ -6,7 +6,7 @@ #ifndef toolkit_breakpad_mac_utils_h__ #define toolkit_breakpad_mac_utils_h__ -#include "nsStringGlue.h" +#include "nsString.h" // Given an Objective-C NSException object, put exception info into a string. void GetObjCExceptionInfo(void* inException, nsACString& outString); diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 38e2148df887..50b5a1ebc7f5 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -11,6 +11,7 @@ #include "mozilla/Util.h" #include "nsThreadUtils.h" +#include "nsXULAppAPI.h" #if defined(XP_WIN32) #ifdef WIN32_LEAN_AND_MEAN diff --git a/toolkit/identity/IdentityCryptoService.cpp b/toolkit/identity/IdentityCryptoService.cpp index 9d896b718104..c9dfcc0f6fed 100644 --- a/toolkit/identity/IdentityCryptoService.cpp +++ b/toolkit/identity/IdentityCryptoService.cpp @@ -12,7 +12,7 @@ #include "nsThreadUtils.h" #include "nsCOMPtr.h" #include "nsProxyRelease.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "mozilla/Base64.h" #include "mozilla/Util.h" // ArrayLength #include "ScopedNSSTypes.h" diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp index b31e607ba5e6..1311371e0adc 100644 --- a/toolkit/xre/ProfileReset.cpp +++ b/toolkit/xre/ProfileReset.cpp @@ -20,6 +20,7 @@ #include "nsXREAppData.h" #include "mozilla/Services.h" +#include "prtime.h" extern const nsXREAppData* gAppData; diff --git a/tools/profiler/JSCustomObjectBuilder.cpp b/tools/profiler/JSCustomObjectBuilder.cpp index 25cd6f0e165f..012244151bfe 100644 --- a/tools/profiler/JSCustomObjectBuilder.cpp +++ b/tools/profiler/JSCustomObjectBuilder.cpp @@ -7,7 +7,7 @@ #include "mozilla/Util.h" // for ArrayLength #include "nsDataHashtable.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsTArray.h" #include "nsUTF8Utils.h" diff --git a/tools/profiler/JSObjectBuilder.cpp b/tools/profiler/JSObjectBuilder.cpp index 71d36cdac194..8db0ec4a939e 100644 --- a/tools/profiler/JSObjectBuilder.cpp +++ b/tools/profiler/JSObjectBuilder.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsapi.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "JSObjectBuilder.h" JSObjectBuilder::JSObjectBuilder(JSContext *aCx) : mCx(aCx), mOk(true) diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index 5e5b00baf69b..493ad2866a00 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -13,6 +13,7 @@ #include "platform.h" #include "nsThreadUtils.h" #include "prenv.h" +#include "prtime.h" #include "shared-libraries.h" #include "mozilla/StackWalk.h" #include "TableTicker.h" diff --git a/uriloader/exthandler/ExternalHelperAppParent.cpp b/uriloader/exthandler/ExternalHelperAppParent.cpp index 66c70049bfd5..4fe33d140abf 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.cpp +++ b/uriloader/exthandler/ExternalHelperAppParent.cpp @@ -16,6 +16,7 @@ #include "nsIBrowserDOMWindow.h" #include "nsStringStream.h" #include "mozilla/ipc/URIUtils.h" +#include "nsNetUtil.h" #include "mozilla/unused.h" diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index d137be6830db..8bf50c01f7c9 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -51,7 +51,7 @@ using mozilla::unused; #include "imgIEncoder.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "GeckoProfiler.h" // For PROFILER_LABEL using namespace mozilla; diff --git a/widget/gtk/nsGtkIMModule.cpp b/widget/gtk/nsGtkIMModule.cpp index f67d4ca61c0c..f1654c028ece 100644 --- a/widget/gtk/nsGtkIMModule.cpp +++ b/widget/gtk/nsGtkIMModule.cpp @@ -8,6 +8,7 @@ #define FORCE_PR_LOG /* Allow logging in the release build */ #endif // MOZ_LOGGING #include "prlog.h" +#include "prtime.h" #include "nsGtkIMModule.h" #include "nsWindow.h" diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index ec8b2f3ce055..4b5b2acd755c 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -11,7 +11,7 @@ #include "nsPoint.h" #include "nsRect.h" #include "nsEvent.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsCOMPtr.h" #include "nsIAtom.h" #include "nsIDOMKeyEvent.h" diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 984bd62ec752..c93bea22ded0 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -9,7 +9,7 @@ #include "nsISupports.h" #include "nsColor.h" #include "nsRect.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsEvent.h" #include "nsCOMPtr.h" diff --git a/widget/qt/faststartupqt/mozqwidgetfast.cpp b/widget/qt/faststartupqt/mozqwidgetfast.cpp index f74bc544f585..21822a65932a 100644 --- a/widget/qt/faststartupqt/mozqwidgetfast.cpp +++ b/widget/qt/faststartupqt/mozqwidgetfast.cpp @@ -8,7 +8,7 @@ #include "mozqwidgetfast.h" #include "nsFastStartupQt.h" #include "nsIFile.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "BinaryPath.h" #define TOOLBAR_SPLASH "toolbar_splash.png" diff --git a/widget/xpwidgets/GfxInfoCollector.cpp b/widget/xpwidgets/GfxInfoCollector.cpp index 8f077443c98a..aa7c85123dda 100644 --- a/widget/xpwidgets/GfxInfoCollector.cpp +++ b/widget/xpwidgets/GfxInfoCollector.cpp @@ -7,7 +7,7 @@ #include "GfxInfoCollector.h" #include "jsapi.h" -#include "nsStringGlue.h" +#include "nsString.h" using namespace mozilla; using namespace widget; diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index d0890f4f592d..ddd640448a27 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -17,6 +17,7 @@ #include "nsConsoleService.h" #include "nsConsoleMessage.h" #include "nsIClassInfoImpl.h" +#include "nsIConsoleListener.h" #include "mozilla/Preferences.h" diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 1858bde711ba..34cfbc034f7d 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -13,7 +13,7 @@ #ifdef MOZ_CRASHREPORTER # include "nsExceptionHandler.h" #endif -#include "nsStringGlue.h" +#include "nsString.h" #include "prprf.h" #include "prlog.h" #include "nsError.h" diff --git a/xpcom/base/nsIConsoleListener.idl b/xpcom/base/nsIConsoleListener.idl index f0cb9ddeed0c..45e6fcb1fcc7 100644 --- a/xpcom/base/nsIConsoleListener.idl +++ b/xpcom/base/nsIConsoleListener.idl @@ -8,7 +8,8 @@ */ #include "nsISupports.idl" -#include "nsIConsoleMessage.idl" + +interface nsIConsoleMessage; [scriptable, function, uuid(35c400a4-5792-438c-b915-65e30d58d557)] interface nsIConsoleListener : nsISupports diff --git a/xpcom/base/nsIConsoleService.idl b/xpcom/base/nsIConsoleService.idl index 15e5a3c51051..fb9e906fb796 100644 --- a/xpcom/base/nsIConsoleService.idl +++ b/xpcom/base/nsIConsoleService.idl @@ -4,8 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsIConsoleListener.idl" -#include "nsIConsoleMessage.idl" + +interface nsIConsoleListener; +interface nsIConsoleMessage; [scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] interface nsIConsoleService : nsISupports diff --git a/xpcom/base/nsIException.idl b/xpcom/base/nsIException.idl index 7e7cac4d28fc..77b760f47131 100644 --- a/xpcom/base/nsIException.idl +++ b/xpcom/base/nsIException.idl @@ -9,7 +9,6 @@ #include "nsISupports.idl" -#include "nsIProgrammingLanguage.idl" // XXX - most "string"s in this file should probably move to Unicode // so may as well use AStrings... diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 50f85ac9a256..dcd7b8d6fae1 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -19,6 +19,7 @@ #include "nsGZFileWriter.h" #include "nsJSEnvironment.h" #include "nsPrintfCString.h" +#include "nsISimpleEnumerator.h" #include #ifdef XP_WIN diff --git a/xpcom/build/FileLocation.cpp b/xpcom/build/FileLocation.cpp index 309f3f0920f1..9a34cb0598ca 100644 --- a/xpcom/build/FileLocation.cpp +++ b/xpcom/build/FileLocation.cpp @@ -8,6 +8,24 @@ namespace mozilla { +FileLocation::FileLocation() +{ +} + +FileLocation::~FileLocation() +{ +} + +FileLocation::FileLocation(nsIFile* file) +{ + Init(file); +} + +FileLocation::FileLocation(nsIFile* file, const char *path) +{ + Init(file, path); +} + FileLocation::FileLocation(const FileLocation &file, const char *path) { if (file.IsZip()) { @@ -50,6 +68,30 @@ FileLocation::FileLocation(const FileLocation &file, const char *path) } } +void +FileLocation::Init(nsIFile* file) +{ + mBaseZip = NULL; + mBaseFile = file; + mPath.Truncate(); +} + +void +FileLocation::Init(nsIFile* file, const char* path) +{ + mBaseZip = NULL; + mBaseFile = file; + mPath = path; +} + +void +FileLocation::Init(nsZipArchive* zip, const char* path) +{ + mBaseZip = zip; + mBaseFile = NULL; + mPath = path; +} + void FileLocation::GetURIString(nsACString &result) const { diff --git a/xpcom/build/FileLocation.h b/xpcom/build/FileLocation.h index b05bd1813c69..9cc7b643371c 100644 --- a/xpcom/build/FileLocation.h +++ b/xpcom/build/FileLocation.h @@ -31,29 +31,21 @@ public: * When the archive is in an archive, an nsZipArchive is stored instead * of a file path. */ - FileLocation() { } + FileLocation(); + ~FileLocation(); /** * Constructor for plain files */ - FileLocation(nsIFile *file) - { - Init(file); - } + FileLocation(nsIFile *file); /** * Constructors for path within an archive. The archive can be given either * as nsIFile or nsZipArchive. */ - FileLocation(nsIFile *zip, const char *path) - { - Init(zip, path); - } + FileLocation(nsIFile *zip, const char *path); - FileLocation(nsZipArchive *zip, const char *path) - { - Init(zip, path); - } + FileLocation(nsZipArchive *zip, const char *path); /** * Creates a new file location relative to another one. @@ -63,26 +55,11 @@ public: /** * Initialization functions corresponding to constructors */ - void Init(nsIFile *file) - { - mBaseZip = NULL; - mBaseFile = file; - mPath.Truncate(); - } + void Init(nsIFile *file); - void Init(nsIFile *zip, const char *path) - { - mBaseZip = NULL; - mBaseFile = zip; - mPath = path; - } + void Init(nsIFile *zip, const char *path); - void Init(nsZipArchive *zip, const char *path) - { - mBaseZip = zip; - mBaseFile = NULL; - mPath = path; - } + void Init(nsZipArchive *zip, const char *path); /** * Returns an URI string corresponding to the file location diff --git a/xpcom/build/perfprobe.h b/xpcom/build/perfprobe.h index 53ea5428fa9e..ad0b55fc0750 100644 --- a/xpcom/build/perfprobe.h +++ b/xpcom/build/perfprobe.h @@ -16,7 +16,7 @@ #endif #include "nsError.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "prlog.h" #include "nsTArray.h" #include "nsAutoPtr.h" diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index e959bab23ab2..132deee2aee5 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -32,6 +32,7 @@ #include "mozilla/Services.h" #include "ManifestParser.h" +#include "nsISimpleEnumerator.h" using namespace mozilla; class nsIComponentLoaderManager; diff --git a/xpcom/components/nsICategoryManager.idl b/xpcom/components/nsICategoryManager.idl index e3e824fca24e..e33d3ed8bfda 100644 --- a/xpcom/components/nsICategoryManager.idl +++ b/xpcom/components/nsICategoryManager.idl @@ -4,7 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsISimpleEnumerator.idl" + +interface nsISimpleEnumerator; /* * nsICategoryManager diff --git a/xpcom/ds/nsAtomService.cpp b/xpcom/ds/nsAtomService.cpp index 1ecbac3e69ee..e336762e34d1 100644 --- a/xpcom/ds/nsAtomService.cpp +++ b/xpcom/ds/nsAtomService.cpp @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsAtomService.h" +#include "nsIAtom.h" NS_IMPL_ISUPPORTS1(nsAtomService, nsIAtomService) diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index e16ed88e995e..1035afbaceac 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -11,7 +11,7 @@ #include "nsAtomTable.h" #include "nsStaticAtom.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsCRT.h" #include "pldhash.h" #include "prenv.h" diff --git a/xpcom/ds/nsIAtomService.idl b/xpcom/ds/nsIAtomService.idl index 2270445c637f..37c094e3d935 100644 --- a/xpcom/ds/nsIAtomService.idl +++ b/xpcom/ds/nsIAtomService.idl @@ -3,7 +3,9 @@ * 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 "nsIAtom.idl" +#include "nsISupports.idl" + +interface nsIAtom; %{C++ #define NS_ATOMSERVICE_CID \ diff --git a/xpcom/ds/nsICollection.idl b/xpcom/ds/nsICollection.idl index 58a9a7c7a7b8..463098937b11 100644 --- a/xpcom/ds/nsICollection.idl +++ b/xpcom/ds/nsICollection.idl @@ -4,7 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISerializable.idl" -#include "nsIEnumerator.idl" + +interface nsIEnumerator; [scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)] interface nsICollection : nsISerializable diff --git a/xpcom/ds/nsIEnumerator.idl b/xpcom/ds/nsIEnumerator.idl index e874e426baf6..7569fb8a39d8 100644 --- a/xpcom/ds/nsIEnumerator.idl +++ b/xpcom/ds/nsIEnumerator.idl @@ -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 "nsISimpleEnumerator.idl" +#include "nsISupports.idl" %{C++ #define NS_ENUMERATOR_FALSE 1 diff --git a/xpcom/ds/nsIPersistentProperties2.idl b/xpcom/ds/nsIPersistentProperties2.idl index 9fbb2619c4a7..4da205977b18 100644 --- a/xpcom/ds/nsIPersistentProperties2.idl +++ b/xpcom/ds/nsIPersistentProperties2.idl @@ -3,12 +3,11 @@ * 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" #include "nsIProperties.idl" -#include "nsISimpleEnumerator.idl" interface nsIInputStream; interface nsIOutputStream; +interface nsISimpleEnumerator; [scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)] interface nsIPropertyElement : nsISupports { diff --git a/xpcom/ds/nsISupportsArray.idl b/xpcom/ds/nsISupportsArray.idl index 2cd71a28c1ab..f8b90de7a425 100644 --- a/xpcom/ds/nsISupportsArray.idl +++ b/xpcom/ds/nsISupportsArray.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsISupports.idl" #include "nsICollection.idl" /* diff --git a/xpcom/ds/nsPersistentProperties.h b/xpcom/ds/nsPersistentProperties.h index 71a621d6c999..a8d5674bb40a 100644 --- a/xpcom/ds/nsPersistentProperties.h +++ b/xpcom/ds/nsPersistentProperties.h @@ -9,7 +9,7 @@ #include "nsIPersistentProperties2.h" #include "pldhash.h" #include "plarena.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsCOMPtr.h" #include "mozilla/Attributes.h" diff --git a/xpcom/ds/nsStaticNameTable.h b/xpcom/ds/nsStaticNameTable.h index 081c55618feb..6616c770e6be 100644 --- a/xpcom/ds/nsStaticNameTable.h +++ b/xpcom/ds/nsStaticNameTable.h @@ -10,7 +10,7 @@ #define nsStaticNameTable_h___ #include "pldhash.h" -#include "nsStringGlue.h" +#include "nsString.h" /* This class supports case insensitive lookup. * diff --git a/xpcom/ds/nsSupportsPrimitives.h b/xpcom/ds/nsSupportsPrimitives.h index 72da261fee95..2e16a94ce237 100644 --- a/xpcom/ds/nsSupportsPrimitives.h +++ b/xpcom/ds/nsSupportsPrimitives.h @@ -10,7 +10,7 @@ #include "nsISupportsPrimitives.h" #include "nsCOMPtr.h" -#include "nsStringGlue.h" +#include "nsString.h" class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID { diff --git a/xpcom/ds/nsVariant.cpp b/xpcom/ds/nsVariant.cpp index 20052026b280..a913b3661123 100644 --- a/xpcom/ds/nsVariant.cpp +++ b/xpcom/ds/nsVariant.cpp @@ -14,7 +14,7 @@ #include "xpt_struct.h" #include "nsReadableUtils.h" #include "nsMemory.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "nsCRTGlue.h" /***************************************************************************/ diff --git a/xpcom/glue/nsStringGlue.h b/xpcom/glue/nsStringGlue.h index 2cd7e0a4b885..42b62241b92c 100644 --- a/xpcom/glue/nsStringGlue.h +++ b/xpcom/glue/nsStringGlue.h @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// IWYU pragma: private, include "nsString.h" /** * @file nsStringGlue.h diff --git a/xpcom/io/Base64.cpp b/xpcom/io/Base64.cpp index 5d8dfc531d50..94fec02775ae 100644 --- a/xpcom/io/Base64.cpp +++ b/xpcom/io/Base64.cpp @@ -6,7 +6,7 @@ #include "Base64.h" #include "nsIInputStream.h" -#include "nsStringGlue.h" +#include "nsString.h" #include "plbase64.h" diff --git a/xpcom/io/nsIBinaryInputStream.idl b/xpcom/io/nsIBinaryInputStream.idl index 5d228dee4dcc..ebc46e5674fa 100644 --- a/xpcom/io/nsIBinaryInputStream.idl +++ b/xpcom/io/nsIBinaryInputStream.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIInputStream.idl" -#include "nsrootidl.idl" /** * This interface allows consumption of primitive data types from a "binary diff --git a/xpcom/io/nsIBinaryOutputStream.idl b/xpcom/io/nsIBinaryOutputStream.idl index 7711aecd1c0d..68b82642de93 100644 --- a/xpcom/io/nsIBinaryOutputStream.idl +++ b/xpcom/io/nsIBinaryOutputStream.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIOutputStream.idl" -#include "nsrootidl.idl" /** * This interface allows writing of primitive data types (integers, diff --git a/xpcom/io/nsIDirectoryService.idl b/xpcom/io/nsIDirectoryService.idl index 520c9bc11124..6f58e37b9ced 100644 --- a/xpcom/io/nsIDirectoryService.idl +++ b/xpcom/io/nsIDirectoryService.idl @@ -4,7 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsIFile.idl" + +interface nsIFile; +interface nsISimpleEnumerator; /** * nsIDirectoryServiceProvider diff --git a/xpcom/io/nsIFile.idl b/xpcom/io/nsIFile.idl index effd27654f72..2392c6f41368 100644 --- a/xpcom/io/nsIFile.idl +++ b/xpcom/io/nsIFile.idl @@ -6,8 +6,8 @@ #include "nsISupports.idl" %{C++ -#include "prio.h" -#include "prlink.h" +struct PRFileDesc; +struct PRLibrary; #include %} diff --git a/xpcom/io/nsIObjectInputStream.idl b/xpcom/io/nsIObjectInputStream.idl index 70f2a55e8dda..c482d3b89f22 100644 --- a/xpcom/io/nsIObjectInputStream.idl +++ b/xpcom/io/nsIObjectInputStream.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIBinaryInputStream.idl" -#include "nsrootidl.idl" /** * @see nsIObjectOutputStream diff --git a/xpcom/io/nsIObjectOutputStream.idl b/xpcom/io/nsIObjectOutputStream.idl index 92c77b8b1510..3ef6711d492d 100644 --- a/xpcom/io/nsIObjectOutputStream.idl +++ b/xpcom/io/nsIObjectOutputStream.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIBinaryOutputStream.idl" -#include "nsrootidl.idl" /** * @See nsIObjectInputStream diff --git a/xpcom/io/nsIPipe.idl b/xpcom/io/nsIPipe.idl index 93951ffe5b6a..3ad20f236efe 100644 --- a/xpcom/io/nsIPipe.idl +++ b/xpcom/io/nsIPipe.idl @@ -3,9 +3,10 @@ * 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 "nsIAsyncInputStream.idl" -#include "nsIAsyncOutputStream.idl" +#include "nsISupports.idl" +interface nsIAsyncInputStream; +interface nsIAsyncOutputStream; interface nsIMemory; /** @@ -100,6 +101,9 @@ interface nsISearchableInputStream : nsISupports %{C++ +class nsIInputStream; +class nsIOutputStream; + /** * NS_NewPipe2 * diff --git a/xpcom/io/nsIStorageStream.idl b/xpcom/io/nsIStorageStream.idl index e49e80d00d05..0313e2b3a417 100644 --- a/xpcom/io/nsIStorageStream.idl +++ b/xpcom/io/nsIStorageStream.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsrootidl.idl" interface nsIMemory; interface nsIInputStream; diff --git a/xpcom/io/nsIStreamBufferAccess.idl b/xpcom/io/nsIStreamBufferAccess.idl index 002fb2f1e92a..c37afd8dc249 100644 --- a/xpcom/io/nsIStreamBufferAccess.idl +++ b/xpcom/io/nsIStreamBufferAccess.idl @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsrootidl.idl" /** * An interface for access to a buffering stream implementation's underlying diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index ff8e54a79b77..ffaacdd1a958 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -43,6 +43,7 @@ #include "nsIDirectoryEnumerator.h" #include "nsISimpleEnumerator.h" #include "private/pprio.h" +#include "prlink.h" #ifdef MOZ_WIDGET_GTK #include "nsIGIOService.h" diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index a94b0ecd9b38..a9d7c7eef766 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -40,6 +40,7 @@ #include "nsXPIDLString.h" #include "prproces.h" +#include "prlink.h" #include "mozilla/Mutex.h" #include "SpecialSystemDirectory.h" diff --git a/xpcom/io/nsLocalFileWin.h b/xpcom/io/nsLocalFileWin.h index 740836f26127..9a796dfd6ea7 100644 --- a/xpcom/io/nsLocalFileWin.h +++ b/xpcom/io/nsLocalFileWin.h @@ -15,6 +15,7 @@ #include "nsILocalFileWin.h" #include "nsIHashable.h" #include "nsIClassInfoImpl.h" +#include "prio.h" #include "mozilla/Attributes.h" diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index 2f4b17d1e5eb..c5d88b0a56f8 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -16,6 +16,8 @@ #include "nsIClassInfoImpl.h" #include "nsAlgorithm.h" #include "nsMemory.h" +#include "nsIAsyncInputStream.h" +#include "nsIAsyncOutputStream.h" using namespace mozilla; diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index cf2c6aaba734..a923f3a06492 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -13,6 +13,8 @@ #include "nsIRunnable.h" #include "nsISafeOutputStream.h" #include "nsString.h" +#include "nsIAsyncInputStream.h" +#include "nsIAsyncOutputStream.h" using namespace mozilla; diff --git a/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl b/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl index f0db98a2f6e1..5ce8372b0441 100644 --- a/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl +++ b/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl @@ -7,9 +7,9 @@ #include "nsISupports.idl" -#include "nsIInterfaceInfo.idl" -#include "nsIEnumerator.idl" -#include "nsISimpleEnumerator.idl" + +interface nsIInterfaceInfo; +interface nsIEnumerator; /* this is NOT intended to be scriptable */ [uuid(1d53d8d9-1d92-428f-b5cc-198b55e897d7)] diff --git a/xpcom/string/public/nsAString.h b/xpcom/string/public/nsAString.h index 506d7bb1c23c..46f008b8d5fd 100644 --- a/xpcom/string/public/nsAString.h +++ b/xpcom/string/public/nsAString.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #ifndef nsAString_h___ #define nsAString_h___ diff --git a/xpcom/string/public/nsReadableUtils.h b/xpcom/string/public/nsReadableUtils.h index a222d8cc28dc..981ba9b9e712 100644 --- a/xpcom/string/public/nsReadableUtils.h +++ b/xpcom/string/public/nsReadableUtils.h @@ -2,7 +2,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #ifndef nsReadableUtils_h___ #define nsReadableUtils_h___ diff --git a/xpcom/string/public/nsString.h b/xpcom/string/public/nsString.h index 03e41e41f811..6d2f958a3bc8 100644 --- a/xpcom/string/public/nsString.h +++ b/xpcom/string/public/nsString.h @@ -3,7 +3,6 @@ /* 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/. */ -// IWYU pragma: private, include "nsStringGlue.h" #ifndef nsString_h___ #define nsString_h___ diff --git a/xpcom/string/public/nsTDependentSubstring.h b/xpcom/string/public/nsTDependentSubstring.h index 61c84c2f2d73..679cbfd9207d 100644 --- a/xpcom/string/public/nsTDependentSubstring.h +++ b/xpcom/string/public/nsTDependentSubstring.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" /** * nsTDependentSubstring_CharT diff --git a/xpcom/string/public/nsTString.h b/xpcom/string/public/nsTString.h index ca694736f26c..e5ce802d3730 100644 --- a/xpcom/string/public/nsTString.h +++ b/xpcom/string/public/nsTString.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" /** * This is the canonical null-terminated string class. All subclasses diff --git a/xpcom/string/public/nsTSubstring.h b/xpcom/string/public/nsTSubstring.h index fa7099fd6f35..f480830d876b 100644 --- a/xpcom/string/public/nsTSubstring.h +++ b/xpcom/string/public/nsTSubstring.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #include "mozilla/MemoryReporting.h" diff --git a/xpcom/string/public/nsTSubstringTuple.h b/xpcom/string/public/nsTSubstringTuple.h index 103d292528ad..fb9bad679089 100644 --- a/xpcom/string/public/nsTSubstringTuple.h +++ b/xpcom/string/public/nsTSubstringTuple.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" /** * nsTSubstringTuple_CharT diff --git a/xpcom/string/public/string-template-def-char.h b/xpcom/string/public/string-template-def-char.h index 2ca792281856..18cbae1eca11 100644 --- a/xpcom/string/public/string-template-def-char.h +++ b/xpcom/string/public/string-template-def-char.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #define CharT char #define CharT_is_char 1 diff --git a/xpcom/string/public/string-template-def-unichar.h b/xpcom/string/public/string-template-def-unichar.h index 70a8f40e3a95..5e1583a5d88d 100644 --- a/xpcom/string/public/string-template-def-unichar.h +++ b/xpcom/string/public/string-template-def-unichar.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #define CharT PRUnichar #define CharT_is_PRUnichar 1 diff --git a/xpcom/string/public/string-template-undef.h b/xpcom/string/public/string-template-undef.h index ba558c2a6196..6690b15aca4b 100644 --- a/xpcom/string/public/string-template-undef.h +++ b/xpcom/string/public/string-template-undef.h @@ -3,7 +3,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// IWYU pragma: private, include "nsStringGlue.h" +// IWYU pragma: private, include "nsString.h" #undef CharT #undef CharT_is_PRUnichar diff --git a/xpcom/system/nsIGConfService.idl b/xpcom/system/nsIGConfService.idl index ddbee4bae9be..ccc02610f2c3 100644 --- a/xpcom/system/nsIGConfService.idl +++ b/xpcom/system/nsIGConfService.idl @@ -4,7 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsIArray.idl" + +interface nsIArray; [scriptable, uuid(5009acae-6973-48c3-b6d6-52c692cc5d9d)] interface nsIGConfService : nsISupports diff --git a/xpcom/system/nsIGSettingsService.idl b/xpcom/system/nsIGSettingsService.idl index ac9c4cbb007a..26d86a77e0d0 100644 --- a/xpcom/system/nsIGSettingsService.idl +++ b/xpcom/system/nsIGSettingsService.idl @@ -4,7 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -#include "nsIArray.idl" + +interface nsIArray; [scriptable, uuid(16d5b0ed-e756-4f1b-a8ce-9132e869acd8)] interface nsIGSettingsCollection : nsISupports diff --git a/xpcom/tests/TestPipe.cpp b/xpcom/tests/TestPipe.cpp index fc41b4e61451..b507184deaaa 100644 --- a/xpcom/tests/TestPipe.cpp +++ b/xpcom/tests/TestPipe.cpp @@ -8,6 +8,8 @@ #include "nsIPipe.h" #include "nsIMemory.h" #include "mozilla/Attributes.h" +#include "nsIAsyncInputStream.h" +#include "nsIAsyncOutputStream.h" /** NS_NewPipe2 reimplemented, because it's not exported by XPCOM */ nsresult TP_NewPipe2(nsIAsyncInputStream** input, diff --git a/xpcom/threads/nsIProcess.idl b/xpcom/threads/nsIProcess.idl index 49e57175ba3c..2c7dcd55ea89 100644 --- a/xpcom/threads/nsIProcess.idl +++ b/xpcom/threads/nsIProcess.idl @@ -2,9 +2,9 @@ * 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 "nsIFile.idl" #include "nsISupports.idl" +interface nsIFile; interface nsIObserver; [scriptable, uuid(609610de-9954-4a63-8a7c-346350a86403)]