From 497b7175f9444c365e32bd2256a9fa99c98a304e Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 15 May 2013 20:51:47 -0400 Subject: [PATCH 01/73] Bug 872635 - Drop the DelayNode's self-reference right on time, to make sure that DelayNodes don't leak with OfflineAudioContexts; r=roc --- content/media/webaudio/DelayNode.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/content/media/webaudio/DelayNode.cpp b/content/media/webaudio/DelayNode.cpp index f6d0c2f4cff..ba014f18af5 100644 --- a/content/media/webaudio/DelayNode.cpp +++ b/content/media/webaudio/DelayNode.cpp @@ -144,11 +144,13 @@ public: if (!mBuffer.IsEmpty() && mLeftOverData == INT32_MIN && aStream->AllInputsFinished()) { - mLeftOverData = static_cast(mCurrentDelayTime * IdealAudioRate()); + mLeftOverData = static_cast(mCurrentDelayTime * IdealAudioRate()) - WEBAUDIO_BLOCK_SIZE; - nsRefPtr refchanged = - new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF); - NS_DispatchToMainThread(refchanged); + if (mLeftOverData > 0) { + nsRefPtr refchanged = + new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF); + NS_DispatchToMainThread(refchanged); + } } else if (mLeftOverData != INT32_MIN) { mLeftOverData -= WEBAUDIO_BLOCK_SIZE; if (mLeftOverData <= 0) { From 49cff0ab4d3c1d2277fbc0fba22165663ec5cd9c Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 16 May 2013 10:53:06 +1000 Subject: [PATCH 02/73] Bug 839745 - Test. --- gfx/tests/crashtests/839745-1.html | 20 ++++++++++++++++++++ gfx/tests/crashtests/crashtests.list | 1 + 2 files changed, 21 insertions(+) create mode 100644 gfx/tests/crashtests/839745-1.html diff --git a/gfx/tests/crashtests/839745-1.html b/gfx/tests/crashtests/839745-1.html new file mode 100644 index 00000000000..f45b2f41d13 --- /dev/null +++ b/gfx/tests/crashtests/839745-1.html @@ -0,0 +1,20 @@ +>> fill="#740000" height="64787">> +k20n01 (21.00) +> +3V97 T*2W t +fSs +_9 oCFRVeS +@ +[^2h A3Y +4 + u +vd` +8%&./h}*y|Z`6&7 2?D4PoB| +~#6b|/ak;sf?MaHHLAck Aee6fI*pU_i}5N%q? Qk7 uBJ l4;x7LlsrDu~:U=+P + *e#{z + +) n|NRXS:N + J p +ZFfSc!W %rTL)#D+6Cd}0$ +k20n03 (22.00) +>> \ No newline at end of file diff --git a/gfx/tests/crashtests/crashtests.list b/gfx/tests/crashtests/crashtests.list index a9c4efe23b7..965022740ce 100644 --- a/gfx/tests/crashtests/crashtests.list +++ b/gfx/tests/crashtests/crashtests.list @@ -96,4 +96,5 @@ load 783041-3.html load 783041-4.html asserts-if(gtk2Widget,1) load 798853.html # bug 868792 asserts-if(winWidget,0-1) skip-if(B2G) load 815489.html +load 839745-1.html load 856784-1.html From 1afa2b0fbff163ef886a249c2ad9f4485e3f5dfb Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 16 May 2013 01:53:03 +0100 Subject: [PATCH 03/73] Bug 872619 - Stop using 'load' in many SVG reftests, and use MozReftestInvalidate instead, and flag the fallback setTimeouts. r=dholbert --HG-- extra : rebase_source : c41d8fb0048e6c6eea70db12d5b6e976fc442b69 --- layout/reftests/svg/as-image/svg-image-script-2.svg | 3 +-- .../reftests/svg/as-image/svg-image-visited-1.html | 12 +++++++----- .../reftests/svg/as-image/svg-image-visited-2.html | 12 +++++++----- layout/reftests/svg/dynamic-clipPath-01.svg | 3 +-- layout/reftests/svg/dynamic-clipPath-02.svg | 3 +-- layout/reftests/svg/dynamic-filter-contents-01a.svg | 3 +-- layout/reftests/svg/dynamic-filter-contents-01b.svg | 3 +-- layout/reftests/svg/dynamic-gradient-contents-01.svg | 3 +-- layout/reftests/svg/dynamic-gradient-contents-02.svg | 3 +-- layout/reftests/svg/dynamic-inner-svg-01.svg | 3 +-- layout/reftests/svg/dynamic-marker-01.svg | 3 +-- layout/reftests/svg/dynamic-marker-02.svg | 3 +-- layout/reftests/svg/dynamic-marker-03.svg | 3 +-- layout/reftests/svg/dynamic-mask-01.svg | 3 +-- layout/reftests/svg/dynamic-mask-contents-01.svg | 3 +-- layout/reftests/svg/dynamic-pattern-01.svg | 3 +-- layout/reftests/svg/dynamic-pattern-02.svg | 9 +++------ layout/reftests/svg/dynamic-pattern-contents-01.svg | 9 +++------ layout/reftests/svg/dynamic-pattern-contents-02.svg | 9 +++------ .../svg/dynamic-small-object-scaled-up-01.svg | 4 +--- .../svg/dynamic-small-object-scaled-up-02.svg | 4 +--- layout/reftests/svg/dynamic-text-04.svg | 3 +-- layout/reftests/svg/dynamic-text-05.svg | 9 ++++----- layout/reftests/svg/dynamic-text-06.svg | 4 +++- layout/reftests/svg/dynamic-textPath-01.svg | 9 +++------ layout/reftests/svg/dynamic-textPath-02.svg | 9 +++------ layout/reftests/svg/dynamic-textPath-03.svg | 9 +++------ layout/reftests/svg/dynamic-use-03.svg | 3 +-- layout/reftests/svg/dynamic-use-04.svg | 3 +-- layout/reftests/svg/dynamic-use-05.svg | 3 +-- layout/reftests/svg/dynamic-use-06.svg | 3 +-- layout/reftests/svg/filter-invalidation-01.svg | 2 +- .../filters/dynamic-filtered-foreignObject-01.svg | 2 +- .../svg/foreignObject-ancestor-style-change-01.svg | 10 +++------- .../svg/foreignObject-change-transform-01.svg | 10 +++------- layout/reftests/svg/foreignObject-display-01.svg | 11 ++++++----- .../reftests/svg/foreignObject-move-repaint-01.svg | 10 +++------- .../reftests/svg/foreignObject-start-hidden-01.svg | 10 ++++------ .../reftests/svg/foreignObject-start-hidden-02.svg | 10 ++++------ .../reftests/svg/foreignObject-style-change-01.svg | 9 +++------ .../reftests/svg/outer-svg-border-and-padding-01.svg | 2 +- .../svg/smil/anim-filter-primitive-size-01.svg | 3 +-- layout/reftests/svg/smil/anim-filter-size-01.svg | 3 +-- layout/reftests/svg/smil/anim-view-01.svg | 3 +-- layout/reftests/svg/smil/event/event-seek-1.svg | 5 +++-- .../svg/smil/event/event-target-non-svg-1.xhtml | 6 +++++- layout/reftests/svg/smil/sort/sort-startSame-1b.svg | 5 +++-- .../svg/smil/syncbase/cross-container-3.xhtml | 6 +++++- layout/reftests/svg/smil/timed/appendChild-1a.svg | 9 ++++++--- layout/reftests/svg/smil/timed/appendChild-1b.svg | 9 ++++++--- layout/reftests/svg/smil/timed/appendChild-2a.svg | 9 ++++++--- layout/reftests/svg/smil/timed/appendChild-2b.svg | 9 ++++++--- layout/reftests/svg/smil/timed/paced-1.svg | 9 ++++++--- layout/reftests/svg/smil/timed/pause-1.svg | 9 ++++++--- layout/reftests/svg/smil/timed/removeChild-1.svg | 9 ++++++--- layout/reftests/svg/smil/timed/removeChild-2.svg | 9 ++++++--- layout/reftests/svg/suspend-02.svg | 3 +-- layout/reftests/svg/suspend-04.svg | 3 +-- 58 files changed, 158 insertions(+), 183 deletions(-) diff --git a/layout/reftests/svg/as-image/svg-image-script-2.svg b/layout/reftests/svg/as-image/svg-image-script-2.svg index 4059d133278..84aeaf1342a 100644 --- a/layout/reftests/svg/as-image/svg-image-script-2.svg +++ b/layout/reftests/svg/as-image/svg-image-script-2.svg @@ -10,8 +10,7 @@ - - - + diff --git a/layout/reftests/svg/as-image/svg-image-visited-2.html b/layout/reftests/svg/as-image/svg-image-visited-2.html index 48110a6a578..e1c66698c47 100644 --- a/layout/reftests/svg/as-image/svg-image-visited-2.html +++ b/layout/reftests/svg/as-image/svg-image-visited-2.html @@ -1,6 +1,5 @@ @@ -10,12 +9,15 @@ function snapshot() { document.documentElement.removeAttribute("class"); } + function delay_snapshot() { + setTimeout(snapshot, 100); // delay snapshot to allow time for + // :visited style inside the image to + // resolve (which it hopefully won't) + } + document.addEventListener("MozReftestInvalidate", delay_snapshot, false); - - - + diff --git a/layout/reftests/svg/dynamic-clipPath-01.svg b/layout/reftests/svg/dynamic-clipPath-01.svg index 6c31a7cda5d..1d1e86ebb86 100644 --- a/layout/reftests/svg/dynamic-clipPath-01.svg +++ b/layout/reftests/svg/dynamic-clipPath-01.svg @@ -82,8 +82,7 @@ diff --git a/layout/reftests/svg/dynamic-mask-01.svg b/layout/reftests/svg/dynamic-mask-01.svg index 59cb3f050da..7a0e428ee78 100644 --- a/layout/reftests/svg/dynamic-mask-01.svg +++ b/layout/reftests/svg/dynamic-mask-01.svg @@ -31,8 +31,7 @@ diff --git a/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg b/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg index bf23045123c..9e34ce8ab02 100644 --- a/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg +++ b/layout/reftests/svg/dynamic-small-object-scaled-up-02.svg @@ -19,9 +19,7 @@ function move_small_object() } document.addEventListener("MozReftestInvalidate", move_small_object, false); - -// fallback for browsers that don't support MozReftestInvalidate -setTimeout(move_small_object, 500); +setTimeout(move_small_objects, 4000); // fallback for running outside reftest //]]> diff --git a/layout/reftests/svg/dynamic-text-04.svg b/layout/reftests/svg/dynamic-text-04.svg index 904cc513752..b2fab69ac5c 100644 --- a/layout/reftests/svg/dynamic-text-04.svg +++ b/layout/reftests/svg/dynamic-text-04.svg @@ -8,8 +8,7 @@ diff --git a/layout/reftests/svg/dynamic-textPath-01.svg b/layout/reftests/svg/dynamic-textPath-01.svg index 377b21214bb..01df1b70c54 100644 --- a/layout/reftests/svg/dynamic-textPath-01.svg +++ b/layout/reftests/svg/dynamic-textPath-01.svg @@ -2,7 +2,7 @@ Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ --> - + Testing that dynamic changes to the element for a given ID are reflected in textPath @@ -14,11 +14,8 @@ + Play! diff --git a/layout/reftests/svg/smil/sort/sort-startSame-1b.svg b/layout/reftests/svg/smil/sort/sort-startSame-1b.svg index e49ad6a757a..7e99e508654 100644 --- a/layout/reftests/svg/smil/sort/sort-startSame-1b.svg +++ b/layout/reftests/svg/smil/sort/sort-startSame-1b.svg @@ -2,8 +2,7 @@ positions, the one that ends up later in the document should win. --> + class="reftest-wait"> diff --git a/layout/reftests/svg/smil/syncbase/cross-container-3.xhtml b/layout/reftests/svg/smil/syncbase/cross-container-3.xhtml index 9c41142d29a..d5e94ac12e3 100644 --- a/layout/reftests/svg/smil/syncbase/cross-container-3.xhtml +++ b/layout/reftests/svg/smil/syncbase/cross-container-3.xhtml @@ -42,9 +42,13 @@ function snapshotB() { svga.setCurrentTime(svga.getCurrentTime()); document.documentElement.removeAttribute("class"); } + +document.addEventListener("MozReftestInvalidate", snapshot, false); +setTimeout(snapshot, 4000); // fallback for running outside reftest + - + + class="reftest-wait"> + class="reftest-wait"> + class="reftest-wait"> + class="reftest-wait"> + class="reftest-wait"> diff --git a/layout/reftests/svg/smil/timed/pause-1.svg b/layout/reftests/svg/smil/timed/pause-1.svg index f81becae640..36101cadf04 100644 --- a/layout/reftests/svg/smil/timed/pause-1.svg +++ b/layout/reftests/svg/smil/timed/pause-1.svg @@ -3,9 +3,7 @@ a little, and make sure the animation is frozen there. --> + class="reftest-wait"> + class="reftest-wait"> + class="reftest-wait"> Date: Wed, 15 May 2013 11:43:28 -0700 Subject: [PATCH 04/73] Bug 872638 - Fix rooting hazard in js::intl_numberingSystem. r=terrence --HG-- extra : rebase_source : b918299ce07676b86309f926b1806d65d05331bb --- js/src/builtin/Intl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 069b5e8f79b..f3304e6805a 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -1276,7 +1276,7 @@ js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp) return false; } const char *name = numbers->getName(); - JSString *jsname = JS_NewStringCopyZ(cx, name); + RootedString jsname(cx, JS_NewStringCopyZ(cx, name)); delete numbers; if (!jsname) return false; From a6204c8487387d048e02a355f8dc3727e241649e Mon Sep 17 00:00:00 2001 From: Frank Yan Date: Wed, 15 May 2013 18:06:42 -0700 Subject: [PATCH 05/73] Bug 872679 - Fx Metro: Fix navigation toolbar background color in snapped view. r=silveira --- browser/metro/theme/browser.css | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/browser/metro/theme/browser.css b/browser/metro/theme/browser.css index 4aa13267040..a7206b0d206 100644 --- a/browser/metro/theme/browser.css +++ b/browser/metro/theme/browser.css @@ -394,25 +394,7 @@ documenttab[selected] .documenttab-selection { } #toolbar[mode="loading"] > #tool-reload, -#toolbar:-moz-any([mode="edit"], [mode="view"]) > #tool-stop { - visibility: collapse; -} - -/* Hide the tab toggle if we're showing classic tabs or we're snap-viewed. */ -#toolbar[viewstate="snapped"], -#tray[tabsonly] #toolbar { - background: @panel_light_color@ @panel_light_background@; - -moz-padding-end: 0; -} - -#toolbar[viewstate="snapped"] { - -moz-padding-end: 0; -} - -#toolbar[viewstate="snapped"] > #urlbar-container { - -moz-margin-end: 0; -} - +#toolbar:-moz-any([mode="edit"], [mode="view"]) > #tool-stop, #toolbar[viewstate="snapped"] > #tool-stop ~ toolbarbutton { visibility: collapse; } From ba2379aa9ba519cb992a3db523ca107b2d8f70da Mon Sep 17 00:00:00 2001 From: Frank Yan Date: Wed, 15 May 2013 18:06:42 -0700 Subject: [PATCH 06/73] Bug 860084 - Fx Metro: When creating tab, copy history from opener. r=mbrubeck --- browser/metro/base/content/browser.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/browser/metro/base/content/browser.js b/browser/metro/base/content/browser.js index 21779f6b91d..c16020eef88 100644 --- a/browser/metro/base/content/browser.js +++ b/browser/metro/base/content/browser.js @@ -435,8 +435,7 @@ var Browser = { addTab: function browser_addTab(aURI, aBringFront, aOwner, aParams) { let params = aParams || {}; - let newTab = new Tab(aURI, params); - newTab.owner = aOwner || null; + let newTab = new Tab(aURI, params, aOwner); this._tabs.push(newTab); if (aBringFront) @@ -1382,7 +1381,7 @@ function showDownloadManager(aWindowContext, aID, aReason) { // TODO: select the download with aID } -function Tab(aURI, aParams) { +function Tab(aURI, aParams, aOwner) { this._id = null; this._browser = null; this._notification = null; @@ -1391,7 +1390,7 @@ function Tab(aURI, aParams) { this._metadata = null; this._eventDeferred = null; - this.owner = null; + this.owner = aOwner || null; this.hostChanged = false; this.state = null; @@ -1402,7 +1401,7 @@ function Tab(aURI, aParams) { // aParams is an object that contains some properties for the initial tab // loading like flags, a referrerURI, a charset or even a postData. - this.create(aURI, aParams || {}); + this.create(aURI, aParams || {}, aOwner); // default tabs to inactive (i.e. no display port) this.active = false; @@ -1526,7 +1525,7 @@ Tab.prototype = { return this._loading; }, - create: function create(aURI, aParams) { + create: function create(aURI, aParams, aOwner) { this._eventDeferred = Promise.defer(); this._chromeTab = Elements.tabList.addTab(); @@ -1543,6 +1542,8 @@ Tab.prototype = { } browser.addEventListener("pageshow", onPageShowEvent, true); + if (aOwner) + this._copyHistoryFrom(aOwner); this._loadUsingParams(browser, aURI, aParams); }, @@ -1576,6 +1577,17 @@ Tab.prototype = { browser.__SS_restore = true; }, + _copyHistoryFrom: function _copyHistoryFrom(tab) { + let otherHistory = tab._browser._webNavigation.sessionHistory; + let history = this._browser._webNavigation.sessionHistory; + + // Ensure that history is initialized + history.QueryInterface(Ci.nsISHistoryInternal); + + for (let i = 0, length = otherHistory.index; i <= length; i++) + history.addEntry(otherHistory.getEntryAtIndex(i, false), true); + }, + _loadUsingParams: function _loadUsingParams(aBrowser, aURI, aParams) { let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE; let postData = ("postData" in aParams && aParams.postData) ? aParams.postData.value : null; From 1ea1aacb3c084f5c614c060e2377fa970dcd561c Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 16 May 2013 11:11:29 +1000 Subject: [PATCH 07/73] Bug 872838 - Fix some JS strict warnings on startup. r=gavin --- browser/base/content/browser-plugins.js | 4 ++-- browser/base/content/browser.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index c8771ad9c88..588c75b94bd 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -513,11 +513,11 @@ var gPluginHandler = { // only show notification for small subset of plugins let mimetype = pluginInfo.mimetype.split(";")[0]; if (!this.canInstallThisMimeType(mimetype)) - return; + return false; let pluginIdentifier = this.nameForSupportedPlugin(mimetype); if (!pluginIdentifier) - return; + return false; let displayName = this.supportedPlugins.plugins[pluginIdentifier].displayName; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 9314ffd7cfa..b5de2ba525b 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4616,6 +4616,9 @@ var TabsInTitlebar = { }, _update: function () { + function $(id) document.getElementById(id); + function rect(ele) ele.getBoundingClientRect(); + if (!this._initialized || window.fullScreen) return; @@ -4628,12 +4631,9 @@ var TabsInTitlebar = { if (allowed == this.enabled) return; - function $(id) document.getElementById(id); let titlebar = $("titlebar"); if (allowed) { - function rect(ele) ele.getBoundingClientRect(); - let tabsToolbar = $("TabsToolbar"); #ifdef MENUBAR_CAN_AUTOHIDE From 3e49bab6d7b9cb6e24ad65c6784dd538a5a1c4e7 Mon Sep 17 00:00:00 2001 From: Takeshi Kurosawa Date: Wed, 15 May 2013 21:32:28 -0400 Subject: [PATCH 08/73] Bug 599804 - Highlight all doesn't work with non HTML documents (e.g. CSS styled XML files). r=adw --- toolkit/content/widgets/findbar.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml index b4a5d2b4350..e4c540fff39 100644 --- a/toolkit/content/widgets/findbar.xml +++ b/toolkit/content/widgets/findbar.xml @@ -955,12 +955,15 @@ } var doc = win.document; - if (!doc || !(doc instanceof HTMLDocument)) - return textFound; + if (!doc || !doc.documentElement) + return textFound; + + var body = (doc instanceof HTMLDocument && doc.body) ? + doc.body : doc.documentElement; if (aHighlight) { var searchRange = doc.createRange(); - searchRange.selectNodeContents(doc.body); + searchRange.selectNodeContents(body); var startPt = searchRange.cloneRange(); startPt.collapse(true); From afacbefe14c88a32bba54a9f88693c207120ba80 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 15 May 2013 21:32:29 -0400 Subject: [PATCH 09/73] Bug 872709 - Reorder WebrtcVideoConduit init list to fix build warnings. r=gcp --- .../signaling/src/media-conduit/VideoConduit.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.h b/media/webrtc/signaling/src/media-conduit/VideoConduit.h index 244ba2e1d59..4798a7ee663 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h @@ -149,18 +149,18 @@ public: mVideoEngine(nullptr), mTransport(nullptr), mRenderer(nullptr), - mEngineTransmitting(false), - mEngineReceiving(false), - mChannel(-1), - mCapId(-1), - mCurSendCodecConfig(nullptr), mPtrViEBase(nullptr), mPtrViECapture(nullptr), mPtrViECodec(nullptr), mPtrViENetwork(nullptr), mPtrViERender(nullptr), mPtrExtCapture(nullptr), - mPtrRTP(nullptr) + mPtrRTP(nullptr), + mEngineTransmitting(false), + mEngineReceiving(false), + mChannel(-1), + mCapId(-1), + mCurSendCodecConfig(nullptr) { } From 61ac6a3ba1e56df6ea2bdbfcba708f5814f1abd0 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sat, 30 Mar 2013 18:29:47 -0400 Subject: [PATCH 10/73] bug 870594 - remove accessible/build/ r=bsmedberg f=surkov --- accessible/build/Makefile.in | 48 ------------------- accessible/build/moz.build | 8 ---- accessible/build/nsAccessibilityFactory.cpp | 53 --------------------- accessible/moz.build | 2 +- layout/build/nsLayoutModule.cpp | 17 +++++++ toolkit/library/Makefile.in | 30 ++++++++++-- toolkit/library/nsStaticXULComponents.cpp | 7 --- 7 files changed, 44 insertions(+), 121 deletions(-) delete mode 100644 accessible/build/Makefile.in delete mode 100644 accessible/build/moz.build delete mode 100644 accessible/build/nsAccessibilityFactory.cpp diff --git a/accessible/build/Makefile.in b/accessible/build/Makefile.in deleted file mode 100644 index 2031d0d0f3f..00000000000 --- a/accessible/build/Makefile.in +++ /dev/null @@ -1,48 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -LIBRARY_NAME = accessibility -EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 -MODULE_NAME = nsAccessibilityModule -LIBXUL_LIBRARY = 1 - -CPPSRCS = nsAccessibilityFactory.cpp - -LOCAL_INCLUDES = -I$(srcdir)/../src - -SHARED_LIBRARY_LIBS = \ - ../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \ - ../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \ - ../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \ - ../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \ - $(NULL) - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -SHARED_LIBRARY_LIBS += \ - ../src/windows/msaa/$(LIB_PREFIX)accessibility_toolkit_msaa_s.$(LIB_SUFFIX) \ - ../src/windows/ia2/$(LIB_PREFIX)accessibility_toolkit_ia2_s.$(LIB_SUFFIX) \ - ../src/windows/sdn/$(LIB_PREFIX)accessibility_toolkit_sdn_s.$(LIB_SUFFIX) \ - ../src/windows/uia/$(LIB_PREFIX)accessibility_toolkit_uia_s.$(LIB_SUFFIX) \ - $(NULL) -else -SHARED_LIBRARY_LIBS += \ - ../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \ - $(NULL) -endif - -ifdef MOZ_XUL -SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX) -endif - -include $(topsrcdir)/config/rules.mk - diff --git a/accessible/build/moz.build b/accessible/build/moz.build deleted file mode 100644 index c7f93f43bd4..00000000000 --- a/accessible/build/moz.build +++ /dev/null @@ -1,8 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -MODULE = 'accessibility' - diff --git a/accessible/build/nsAccessibilityFactory.cpp b/accessible/build/nsAccessibilityFactory.cpp deleted file mode 100644 index 4f618210053..00000000000 --- a/accessible/build/nsAccessibilityFactory.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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 "nsCOMPtr.h" -#include "mozilla/ModuleUtils.h" - -#include "nsIServiceManager.h" -#include "nsIComponentManager.h" -#include "nsIAccessibilityService.h" -#include "nsIAccessibleRetrieval.h" -#include "nscore.h" - -static nsresult -NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - NS_ASSERTION(aOuter == nullptr, "no aggregation"); - nsIAccessibilityService* accessibility; - rv = NS_GetAccessibilityService(&accessibility); - if (NS_FAILED(rv)) { - NS_ERROR("Unable to construct accessibility service"); - return rv; - } - rv = accessibility->QueryInterface(aIID, aResult); - NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface"); - NS_RELEASE(accessibility); - return rv; -} - -NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID); - -static const mozilla::Module::CIDEntry kA11yCIDs[] = { - { &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, NS_ConstructAccessibilityService }, - { nullptr } -}; - -static const mozilla::Module::ContractIDEntry kA11yContracts[] = { - { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID }, - { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID }, - { nullptr } -}; - -static const mozilla::Module kA11yModule = { - mozilla::Module::kVersion, - kA11yCIDs, - kA11yContracts -}; - -NSMODULE_DEFN(nsAccessibilityModule) = &kA11yModule; - - diff --git a/accessible/moz.build b/accessible/moz.build index 4fb3d970f6f..dbd2b9f8dd2 100644 --- a/accessible/moz.build +++ b/accessible/moz.build @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src', 'build'] +DIRS += ['public', 'src'] TEST_DIRS += ['tests'] MODULE = 'accessibility' diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 48d68de84da..3730639572a 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -676,6 +676,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer) NS_GENERIC_FACTORY_CONSTRUCTOR(OSFileConstantsService) NS_GENERIC_FACTORY_CONSTRUCTOR(TCPSocketChild) +#ifdef ACCESSIBILITY +#include "nsAccessibilityService.h" + + MAKE_CTOR(CreateA11yService, nsIAccessibilityService, NS_GetAccessibilityService) +#endif + static nsresult Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID, void **aResult) @@ -848,6 +854,10 @@ NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID); #endif +#ifdef ACCESSIBILITY +NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID); +#endif + static nsresult CreateWindowCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) @@ -1128,6 +1138,9 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kNS_MEDIAMANAGERSERVICE_CID, false, NULL, nsIMediaManagerServiceConstructor }, #ifdef MOZ_GAMEPAD { &kNS_GAMEPAD_TEST_CID, false, NULL, GamepadServiceTestConstructor }, +#endif +#ifdef ACCESSIBILITY + { &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, CreateA11yService }, #endif { NULL } }; @@ -1278,6 +1291,10 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { NS_GAMEPAD_TEST_CONTRACTID, &kNS_GAMEPAD_TEST_CID }, #endif { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID }, +#ifdef ACCESSIBILITY + { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID }, + { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID }, +#endif { NULL } }; diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 5c7b22a3d73..72118a4fcb4 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -42,6 +42,32 @@ SHARED_LIBRARY_LIBS += \ $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX) \ $(NULL) +ifdef ACCESSIBILITY +SHARED_LIBRARY_LIBS += \ + $(DEPTH)/accessible/src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \ + $(NULL) + +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +SHARED_LIBRARY_LIBS += \ + $(DEPTH)/accessible/src/windows/msaa/$(LIB_PREFIX)accessibility_toolkit_msaa_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/windows/ia2/$(LIB_PREFIX)accessibility_toolkit_ia2_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/windows/sdn/$(LIB_PREFIX)accessibility_toolkit_sdn_s.$(LIB_SUFFIX) \ + $(DEPTH)/accessible/src/windows/uia/$(LIB_PREFIX)accessibility_toolkit_uia_s.$(LIB_SUFFIX) \ + $(NULL) +else +SHARED_LIBRARY_LIBS += \ + $(DEPTH)/accessible/src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \ + $(NULL) +endif + +ifdef MOZ_XUL +SHARED_LIBRARY_LIBS += $(DEPTH)/accessible/src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX) +endif +endif + SHARED_LIBRARY_LIBS += \ $(foreach component,$(COMPONENT_LIBS),$(DEPTH)/staticlib/components/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \ $(foreach lib,$(STATIC_LIBS),$(DEPTH)/staticlib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX)) \ @@ -328,10 +354,6 @@ ifeq (qt,$(MOZ_WIDGET_TOOLKIT)) COMPONENT_LIBS += widget_qt endif -ifdef ACCESSIBILITY -COMPONENT_LIBS += accessibility -endif - ifdef MOZ_ENABLE_XREMOTE COMPONENT_LIBS += remoteservice endif diff --git a/toolkit/library/nsStaticXULComponents.cpp b/toolkit/library/nsStaticXULComponents.cpp index 5b60f11d35c..52806f9d03c 100644 --- a/toolkit/library/nsStaticXULComponents.cpp +++ b/toolkit/library/nsStaticXULComponents.cpp @@ -54,12 +54,6 @@ #define ICON_MODULE #endif -#ifdef ACCESSIBILITY -#define ACCESS_MODULES MODULE(nsAccessibilityModule) -#else -#define ACCESS_MODULES -#endif - #ifdef MOZ_ENABLE_XREMOTE #define XREMOTE_MODULES MODULE(RemoteServiceModule) #else @@ -208,7 +202,6 @@ MODULE(docshell_provider) \ MODULE(embedcomponents) \ MODULE(Browser_Embedding_Module) \ - ACCESS_MODULES \ MODULE(appshell) \ MODULE(nsTransactionManagerModule) \ MODULE(nsComposerModule) \ From b53dcf2bff64b45ea590fb96b769c4dfd64833b4 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 9 Apr 2013 16:00:21 -0400 Subject: [PATCH 11/73] bug 860027 - remove XPTIInterfaceInfoManager::EnumerateInterfaces() r=bholley r=bsmedberg --- js/xpconnect/src/XPCComponents.cpp | 137 +++++------------- .../public/nsIInterfaceInfoManager.idl | 4 +- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 23 ++- 3 files changed, 51 insertions(+), 113 deletions(-) diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index c11c9b52972..5f219048f0e 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -34,6 +34,7 @@ #include "nsJSEnvironment.h" #include "nsXMLHttpRequest.h" #include "mozilla/Telemetry.h" +#include "mozilla/XPTInterfaceInfoManager.h" #include "nsDOMClassInfoID.h" using namespace mozilla; @@ -120,7 +121,7 @@ public: virtual ~nsXPCComponents_Interfaces(); private: - nsCOMPtr mManager; + nsCOMArray mInterfaces; }; /* void getInterfaces (out uint32_t count, [array, size_is (count), retval] @@ -215,9 +216,9 @@ nsXPCComponents_Interfaces::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) return NS_ERROR_NOT_AVAILABLE; } -nsXPCComponents_Interfaces::nsXPCComponents_Interfaces() : - mManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)) +nsXPCComponents_Interfaces::nsXPCComponents_Interfaces() { + XPTInterfaceInfoManager::GetSingleton()->GetScriptableInterfaces(mInterfaces); } nsXPCComponents_Interfaces::~nsXPCComponents_Interfaces() @@ -254,64 +255,36 @@ nsXPCComponents_Interfaces::NewEnumerate(nsIXPConnectWrappedNative *wrapper, uint32_t enum_op, jsval * statep, jsid * idp, bool *_retval) { - nsIEnumerator* e; - switch (enum_op) { case JSENUMERATE_INIT: case JSENUMERATE_INIT_ALL: { - if (!mManager || - NS_FAILED(mManager->EnumerateInterfaces(&e)) || !e || - NS_FAILED(e->First())) - - { - *statep = JSVAL_NULL; - return NS_ERROR_UNEXPECTED; - } - - *statep = PRIVATE_TO_JSVAL(e); + *statep = JSVAL_ZERO; if (idp) - *idp = INT_TO_JSID(0); // indicate that we don't know the count + *idp = INT_TO_JSID(mInterfaces.Length()); return NS_OK; } case JSENUMERATE_NEXT: { - nsCOMPtr isup; + uint32_t idx = JSVAL_TO_INT(*statep); + nsIInterfaceInfo* interface = mInterfaces.SafeElementAt(idx); + *statep = UINT_TO_JSVAL(idx + 1); - e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep); + if (interface) { + JSString* idstr; + const char* name; - while (1) { - if (static_cast(NS_ENUMERATOR_FALSE) == e->IsDone() && - NS_SUCCEEDED(e->CurrentItem(getter_AddRefs(isup))) && isup) { - e->Next(); - nsCOMPtr iface(do_QueryInterface(isup)); - if (iface) { - JSString* idstr; - const char* name; - bool scriptable; - - if (NS_SUCCEEDED(iface->IsScriptable(&scriptable)) && - !scriptable) { - continue; - } - - if (NS_SUCCEEDED(iface->GetNameShared(&name)) && name && - nullptr != (idstr = JS_NewStringCopyZ(cx, name)) && - JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp)) { - return NS_OK; - } - } + if (NS_SUCCEEDED(interface->GetNameShared(&name)) && name && + nullptr != (idstr = JS_NewStringCopyZ(cx, name)) && + JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp)) { + return NS_OK; } - // else... - break; } - // FALL THROUGH + // fall through } case JSENUMERATE_DESTROY: default: - e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep); - NS_IF_RELEASE(e); *statep = JSVAL_NULL; return NS_OK; } @@ -327,7 +300,7 @@ nsXPCComponents_Interfaces::NewResolve(nsIXPConnectWrappedNative *wrapper, RootedObject obj(cx, objArg); RootedId id(cx, idArg); - if (!mManager || !JSID_IS_STRING(id)) + if (!JSID_IS_STRING(id)) return NS_OK; JSAutoByteString name; @@ -336,7 +309,8 @@ nsXPCComponents_Interfaces::NewResolve(nsIXPConnectWrappedNative *wrapper, // we only allow interfaces by name here if (name.encodeLatin1(cx, str) && name.ptr()[0] != '{') { nsCOMPtr info; - mManager->GetInfoForName(name.ptr(), getter_AddRefs(info)); + XPTInterfaceInfoManager::GetSingleton()-> + GetInfoForName(name.ptr(), getter_AddRefs(info)); if (!info) return NS_OK; @@ -428,7 +402,7 @@ public: virtual ~nsXPCComponents_InterfacesByID(); private: - nsCOMPtr mManager; + nsCOMArray mInterfaces; }; /***************************************************************************/ @@ -524,9 +498,9 @@ nsXPCComponents_InterfacesByID::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) return NS_ERROR_NOT_AVAILABLE; } -nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID() : - mManager(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)) +nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID() { + XPTInterfaceInfoManager::GetSingleton()->GetScriptableInterfaces(mInterfaces); } nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID() @@ -561,68 +535,38 @@ nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper, uint32_t enum_op, jsval * statep, jsid * idp, bool *_retval) { - nsIEnumerator* e; - switch (enum_op) { case JSENUMERATE_INIT: case JSENUMERATE_INIT_ALL: { - if (!mManager || - NS_FAILED(mManager->EnumerateInterfaces(&e)) || !e || - NS_FAILED(e->First())) - - { - *statep = JSVAL_NULL; - return NS_ERROR_UNEXPECTED; - } - - *statep = PRIVATE_TO_JSVAL(e); + *statep = JSVAL_ZERO; if (idp) - *idp = INT_TO_JSID(0); // indicate that we don't know the count + *idp = INT_TO_JSID(mInterfaces.Length()); return NS_OK; } case JSENUMERATE_NEXT: { - nsCOMPtr isup; + uint32_t idx = JSVAL_TO_INT(*statep); + nsIInterfaceInfo* interface = mInterfaces.SafeElementAt(idx); + *statep = UINT_TO_JSVAL(idx + 1); + if (interface) { + nsIID const *iid; + char idstr[NSID_LENGTH]; + JSString* jsstr; - e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep); - - while (1) { - if (static_cast(NS_ENUMERATOR_FALSE) == e->IsDone() && - NS_SUCCEEDED(e->CurrentItem(getter_AddRefs(isup))) && isup) { - e->Next(); - nsCOMPtr iface(do_QueryInterface(isup)); - if (iface) { - nsIID const *iid; - char idstr[NSID_LENGTH]; - JSString* jsstr; - bool scriptable; - - if (NS_SUCCEEDED(iface->IsScriptable(&scriptable)) && - !scriptable) { - continue; - } - - if (NS_SUCCEEDED(iface->GetIIDShared(&iid))) { - iid->ToProvidedString(idstr); - jsstr = JS_NewStringCopyZ(cx, idstr); - if (jsstr && - JS_ValueToId(cx, STRING_TO_JSVAL(jsstr), idp)) { - return NS_OK; - } - } + if (NS_SUCCEEDED(interface->GetIIDShared(&iid))) { + iid->ToProvidedString(idstr); + jsstr = JS_NewStringCopyZ(cx, idstr); + if (jsstr && JS_ValueToId(cx, STRING_TO_JSVAL(jsstr), idp)) { + return NS_OK; } } - // else... - break; } // FALL THROUGH } case JSENUMERATE_DESTROY: default: - e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep); - NS_IF_RELEASE(e); *statep = JSVAL_NULL; return NS_OK; } @@ -637,10 +581,6 @@ nsXPCComponents_InterfacesByID::NewResolve(nsIXPConnectWrappedNative *wrapper, { RootedObject obj(cx, objArg); RootedId id(cx, idArg); - - if (!mManager || !JSID_IS_STRING(id)) - return NS_OK; - RootedString str(cx, JSID_TO_STRING(id)); if (38 != JS_GetStringLength(str)) return NS_OK; @@ -651,7 +591,8 @@ nsXPCComponents_InterfacesByID::NewResolve(nsIXPConnectWrappedNative *wrapper, return NS_OK; nsCOMPtr info; - mManager->GetInfoForIID(&iid, getter_AddRefs(info)); + XPTInterfaceInfoManager::GetSingleton()-> + GetInfoForIID(&iid, getter_AddRefs(info)); if (!info) return NS_OK; diff --git a/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl b/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl index 72fb5f2f8a0..f0db98a2f6e 100644 --- a/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl +++ b/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl @@ -12,7 +12,7 @@ #include "nsISimpleEnumerator.idl" /* this is NOT intended to be scriptable */ -[uuid(8B161900-BE2B-11d2-9831-006008962422)] +[uuid(1d53d8d9-1d92-428f-b5cc-198b55e897d7)] interface nsIInterfaceInfoManager : nsISupports { nsIInterfaceInfo getInfoForIID(in nsIIDPtr iid); @@ -21,8 +21,6 @@ interface nsIInterfaceInfoManager : nsISupports nsIIDPtr getIIDForName(in string name); string getNameForIID(in nsIIDPtr iid); - nsIEnumerator enumerateInterfaces(); - void autoRegisterInterfaces(); nsIEnumerator enumerateInterfacesWhoseNamesStartWith(in string prefix); diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 45a33be59f8..ac622a2c227 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -268,32 +268,31 @@ XPTInterfaceInfoManager::GetNameForIID(const nsIID * iid, char **_retval) static PLDHashOperator xpti_ArrayAppender(const char* name, xptiInterfaceEntry* entry, void* arg) { - nsISupportsArray* array = (nsISupportsArray*) arg; + nsCOMArray* array = static_cast*>(arg); nsCOMPtr ii; - if (NS_SUCCEEDED(EntryToInfo(entry, getter_AddRefs(ii)))) + if (NS_SUCCEEDED(EntryToInfo(entry, getter_AddRefs(ii)))) { + bool scriptable = false; + ii->IsScriptable(&scriptable); + if (scriptable) { array->AppendElement(ii); + } + } return PL_DHASH_NEXT; } /* nsIEnumerator enumerateInterfaces (); */ -NS_IMETHODIMP -XPTInterfaceInfoManager::EnumerateInterfaces(nsIEnumerator **_retval) +void +XPTInterfaceInfoManager::GetScriptableInterfaces(nsCOMArray& aInterfaces) { // I didn't want to incur the size overhead of using nsHashtable just to // make building an enumerator easier. So, this code makes a snapshot of // the table using an nsISupportsArray and builds an enumerator for that. // We can afford this transient cost. - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) - return NS_ERROR_UNEXPECTED; - ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor); - mWorkingSet.mNameTable.EnumerateRead(xpti_ArrayAppender, array); - - return array->Enumerate(_retval); + aInterfaces.SetCapacity(mWorkingSet.mNameTable.Count()); + mWorkingSet.mNameTable.EnumerateRead(xpti_ArrayAppender, &aInterfaces); } struct ArrayAndPrefix From e6f2cf55d3002cef94c3578fa1605fb8d8524ae1 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 3 May 2013 17:22:46 -0400 Subject: [PATCH 12/73] bug 860027 - lazily get the list of interfaces r=bholley --- js/xpconnect/src/XPCComponents.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 5f219048f0e..b1367ab98ab 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -218,7 +218,6 @@ nsXPCComponents_Interfaces::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) nsXPCComponents_Interfaces::nsXPCComponents_Interfaces() { - XPTInterfaceInfoManager::GetSingleton()->GetScriptableInterfaces(mInterfaces); } nsXPCComponents_Interfaces::~nsXPCComponents_Interfaces() @@ -259,6 +258,13 @@ nsXPCComponents_Interfaces::NewEnumerate(nsIXPConnectWrappedNative *wrapper, case JSENUMERATE_INIT: case JSENUMERATE_INIT_ALL: { + // Lazily init the list of interfaces when someone tries to + // enumerate them. + if (mInterfaces.IsEmpty()) { + XPTInterfaceInfoManager::GetSingleton()-> + GetScriptableInterfaces(mInterfaces); + } + *statep = JSVAL_ZERO; if (idp) *idp = INT_TO_JSID(mInterfaces.Length()); @@ -500,7 +506,6 @@ nsXPCComponents_InterfacesByID::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID() { - XPTInterfaceInfoManager::GetSingleton()->GetScriptableInterfaces(mInterfaces); } nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID() @@ -539,6 +544,13 @@ nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper, case JSENUMERATE_INIT: case JSENUMERATE_INIT_ALL: { + // Lazily init the list of interfaces when someone tries to + // enumerate them. + if (mInterfaces.IsEmpty()) { + XPTInterfaceInfoManager::GetSingleton()-> + GetScriptableInterfaces(mInterfaces); + } + *statep = JSVAL_ZERO; if (idp) *idp = INT_TO_JSID(mInterfaces.Length()); From 43181cfc4d0e7f1ae24c5f442f65956a91fc48e0 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 3 May 2013 18:33:30 -0400 Subject: [PATCH 13/73] bug 860027 - use entry->GetScriptableFlag() directly instead of sillyness through the nsIInterfaceInfo r=bsmedberg --- .../reflect/xptinfo/src/xptiInterfaceInfoManager.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index ac622a2c227..09f410d12c7 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -270,13 +270,11 @@ xpti_ArrayAppender(const char* name, xptiInterfaceEntry* entry, void* arg) { nsCOMArray* array = static_cast*>(arg); - nsCOMPtr ii; - if (NS_SUCCEEDED(EntryToInfo(entry, getter_AddRefs(ii)))) { - bool scriptable = false; - ii->IsScriptable(&scriptable); - if (scriptable) { - array->AppendElement(ii); - } + if (entry->GetScriptableFlag()) { + nsCOMPtr ii; + if (NS_SUCCEEDED(EntryToInfo(entry, getter_AddRefs(ii)))) { + array->AppendElement(ii); + } } return PL_DHASH_NEXT; } From 6fe37fab3966ec560b8307b4370a3af09968482d Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 3 May 2013 21:54:31 -0400 Subject: [PATCH 14/73] bug 860027 - rename xptiInterfaceInfoEntry::GetInterfaceInfo() to InterfaceInfo() since it can't return null and make it return an already_AddRefed r=bsmedberg --- .../reflect/xptinfo/src/xptiInterfaceInfo.cpp | 26 +++++++------------ .../xptinfo/src/xptiInterfaceInfoManager.cpp | 17 +++--------- xpcom/reflect/xptinfo/src/xptiprivate.h | 2 +- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp index 2a29134628d..e4c4209055c 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp @@ -315,12 +315,8 @@ xptiInterfaceEntry::GetInfoForParam(uint16_t methodIndex, if(NS_FAILED(rv)) return rv; - xptiInterfaceInfo* theInfo; - rv = entry->GetInterfaceInfo(&theInfo); - if(NS_FAILED(rv)) - return rv; + *info = entry->InterfaceInfo().get(); - *info = static_cast(theInfo); return NS_OK; } @@ -537,8 +533,8 @@ xptiInterfaceEntry::HasAncestor(const nsIID * iid, bool *_retval) /***************************************************/ -nsresult -xptiInterfaceEntry::GetInterfaceInfo(xptiInterfaceInfo** info) +already_AddRefed +xptiInterfaceEntry::InterfaceInfo() { #ifdef DEBUG XPTInterfaceInfoManager::GetSingleton()->mWorkingSet.mTableReentrantMonitor. @@ -549,15 +545,10 @@ xptiInterfaceEntry::GetInterfaceInfo(xptiInterfaceInfo** info) if(!mInfo) { mInfo = new xptiInterfaceInfo(this); - if(!mInfo) - { - *info = nullptr; - return NS_ERROR_OUT_OF_MEMORY; - } } - NS_ADDREF(*info = mInfo); - return NS_OK; + nsRefPtr info = mInfo; + return info.forget(); } void @@ -580,7 +571,8 @@ xptiInterfaceInfo::BuildParent() !mParent && mEntry->Parent(), "bad BuildParent call"); - return NS_SUCCEEDED(mEntry->Parent()->GetInterfaceInfo(&mParent)); + mParent = mEntry->Parent()->InterfaceInfo().get(); + return true; } /***************************************************************************/ @@ -621,7 +613,7 @@ xptiInterfaceInfo::Release(void) mTableReentrantMonitor); LOG_INFO_MONITOR_ENTRY; - // If GetInterfaceInfo added and *released* a reference before we + // If InterfaceInfo added and *released* a reference before we // acquired the monitor then 'this' might already be dead. In that // case we would not want to try to access any instance data. We // would want to bail immediately. If 'this' is already dead then the @@ -630,7 +622,7 @@ xptiInterfaceInfo::Release(void) if(entry && !entry->InterfaceInfoEquals(this)) return 0; - // If GetInterfaceInfo added a reference before we acquired the monitor + // If InterfaceInfo added a reference before we acquired the monitor // then we want to bail out of here without destorying the object. if(mRefCnt) return 1; diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 09f410d12c7..771f034d701 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -183,20 +183,13 @@ XPTInterfaceInfoManager::VerifyAndAddEntryIfNew(XPTInterfaceDirectoryEntry* ifac static nsresult EntryToInfo(xptiInterfaceEntry* entry, nsIInterfaceInfo **_retval) { - xptiInterfaceInfo* info; - nsresult rv; - if (!entry) { *_retval = nullptr; return NS_ERROR_FAILURE; } - rv = entry->GetInterfaceInfo(&info); - if (NS_FAILED(rv)) - return rv; - - // Transfer the AddRef done by GetInterfaceInfo. - *_retval = static_cast(info); + nsRefPtr info = entry->InterfaceInfo(); + info.forget(_retval); return NS_OK; } @@ -271,10 +264,8 @@ xpti_ArrayAppender(const char* name, xptiInterfaceEntry* entry, void* arg) nsCOMArray* array = static_cast*>(arg); if (entry->GetScriptableFlag()) { - nsCOMPtr ii; - if (NS_SUCCEEDED(EntryToInfo(entry, getter_AddRefs(ii)))) { - array->AppendElement(ii); - } + nsCOMPtr ii = entry->InterfaceInfo(); + array->AppendElement(ii); } return PL_DHASH_NEXT; } diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h index 8637d70a918..dc7b16d7bae 100644 --- a/xpcom/reflect/xptinfo/src/xptiprivate.h +++ b/xpcom/reflect/xptinfo/src/xptiprivate.h @@ -199,7 +199,7 @@ public: bool EnsureResolved() {return IsFullyResolved() ? true : Resolve();} - nsresult GetInterfaceInfo(xptiInterfaceInfo** info); + already_AddRefed InterfaceInfo(); bool InterfaceInfoEquals(const xptiInterfaceInfo* info) const {return info == mInfo;} From 213a9f261b9dcc72663c7b09ab38f04dcb3310c1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 15 May 2013 21:46:44 -0400 Subject: [PATCH 15/73] Bug 872399. Don't codegen callback interfaces for worker descriptors. r=smaug --- dom/bindings/Codegen.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 1cd411429a3..f6f60c83b81 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -7929,8 +7929,10 @@ class CGBindingRoot(CGThing): # Do codegen for all the descriptors cgthings.extend([CGDescriptor(x) for x in descriptors]) - # Do codegen for all the callback interfaces - cgthings.extend([CGCallbackInterface(x) for x in callbackDescriptors]) + # Do codegen for all the callback interfaces. Again, skip + # worker callbacks. + cgthings.extend([CGCallbackInterface(x) for x in callbackDescriptors if + not x.workers]) # Do codegen for JS implemented classes def getParentDescriptor(desc): From acfc919f6062297e07e8bd66602b92d0384e722f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 15 May 2013 21:46:44 -0400 Subject: [PATCH 16/73] Bug 871177. Fix rooting hazard in IsNotDateOrRegexp. r=smaug --- dom/base/nsScreen.cpp | 54 +++++++++++++++++++------------------ dom/bindings/BindingUtils.h | 14 +++++----- dom/bindings/Codegen.py | 22 +++++++++------ 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/dom/base/nsScreen.cpp b/dom/base/nsScreen.cpp index de527b69bb4..8fa84d41c2d 100644 --- a/dom/base/nsScreen.cpp +++ b/dom/base/nsScreen.cpp @@ -248,41 +248,43 @@ NS_IMETHODIMP nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx, bool* aReturn) { - if (aOrientation.isObject() && IsArrayLike(aCx, &aOrientation.toObject())) { + if (aOrientation.isObject()) { JS::Rooted seq(aCx, &aOrientation.toObject()); - uint32_t length; - // JS_GetArrayLength actually works on all objects - if (!JS_GetArrayLength(aCx, seq, &length)) { - return NS_ERROR_FAILURE; - } - - Sequence orientations; - if (!orientations.SetCapacity(length)) { - return NS_ERROR_OUT_OF_MEMORY; - } - - for (uint32_t i = 0; i < length; ++i) { - JS::Rooted temp(aCx); - if (!JS_GetElement(aCx, seq, i, temp.address())) { + if (IsArrayLike(aCx, seq)) { + uint32_t length; + // JS_GetArrayLength actually works on all objects + if (!JS_GetArrayLength(aCx, seq, &length)) { return NS_ERROR_FAILURE; } - JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp)); - if (!jsString) { - return NS_ERROR_FAILURE; + Sequence orientations; + if (!orientations.SetCapacity(length)) { + return NS_ERROR_OUT_OF_MEMORY; } - nsDependentJSString str; - if (!str.init(aCx, jsString)) { - return NS_ERROR_FAILURE; + for (uint32_t i = 0; i < length; ++i) { + JS::Rooted temp(aCx); + if (!JS_GetElement(aCx, seq, i, temp.address())) { + return NS_ERROR_FAILURE; + } + + JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp)); + if (!jsString) { + return NS_ERROR_FAILURE; + } + + nsDependentJSString str; + if (!str.init(aCx, jsString)) { + return NS_ERROR_FAILURE; + } + + *orientations.AppendElement() = str; } - *orientations.AppendElement() = str; + ErrorResult rv; + *aReturn = MozLockOrientation(orientations, rv); + return rv.ErrorCode(); } - - ErrorResult rv; - *aReturn = MozLockOrientation(orientations, rv); - return rv.ErrorCode(); } JS::RootedString jsString(aCx, JS_ValueToString(aCx, aOrientation)); diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 869da38e728..0342c873cf4 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -186,33 +186,35 @@ UnwrapObject(JSContext* cx, JSObject* obj, U& value) } inline bool -IsNotDateOrRegExp(JSContext* cx, JSObject* obj) +IsNotDateOrRegExp(JSContext* cx, JS::Handle obj) { MOZ_ASSERT(obj); return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj); } MOZ_ALWAYS_INLINE bool -IsArrayLike(JSContext* cx, JSObject* obj) +IsArrayLike(JSContext* cx, JS::Handle obj) { return IsNotDateOrRegExp(cx, obj); } MOZ_ALWAYS_INLINE bool -IsConvertibleToDictionary(JSContext* cx, JSObject* obj) +IsObjectValueConvertibleToDictionary(JSContext* cx, + JS::Handle objVal) { + JS::Rooted obj(cx, &objVal.toObject()); return IsNotDateOrRegExp(cx, obj); } MOZ_ALWAYS_INLINE bool -IsConvertibleToDictionary(JSContext* cx, JS::Value val) +IsConvertibleToDictionary(JSContext* cx, JS::Handle val) { return val.isNullOrUndefined() || - (val.isObject() && IsConvertibleToDictionary(cx, &val.toObject())); + (val.isObject() && IsObjectValueConvertibleToDictionary(cx, val)); } MOZ_ALWAYS_INLINE bool -IsConvertibleToCallbackInterface(JSContext* cx, JSObject* obj) +IsConvertibleToCallbackInterface(JSContext* cx, JS::Handle obj) { return IsNotDateOrRegExp(cx, obj); } diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index f6f60c83b81..d896e00088c 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -2738,7 +2738,7 @@ for (uint32_t i = 0; i < length; ++i) { memberType = arrayObjectMemberTypes[0] name = memberType.name arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext;" % (unionArgumentObj, name)) - arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, &argObj)") + arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)") names.append(name) else: arrayObject = None @@ -2750,7 +2750,7 @@ for (uint32_t i = 0; i < length; ++i) { name = memberType.name dateObject = CGGeneric("%s.SetTo%s(cx, ${val}, ${valPtr});\n" "done = true;" % (unionArgumentObj, name)) - dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, &argObj)"); + dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, argObj)"); names.append(name) else: dateObject = None @@ -2774,7 +2774,7 @@ for (uint32_t i = 0; i < length; ++i) { objectMemberTypes = filter(lambda t: t.isObject(), memberTypes) if len(objectMemberTypes) > 0: - object = CGGeneric("%s.SetToObject(cx, &argObj);\n" + object = CGGeneric("%s.SetToObject(cx, argObj);\n" "done = true;" % unionArgumentObj) else: object = None @@ -2804,8 +2804,8 @@ for (uint32_t i = 0; i < length; ++i) { if any([arrayObject, dateObject, callbackObject, dictionaryObject, object]): - templateBody.prepend(CGGeneric("JSObject& argObj = ${val}.toObject();")) - templateBody = CGIfWrapper(templateBody, "${val}.isObject()") + templateBody.prepend(CGGeneric("JS::Rooted argObj(cx, &${valHandle}.toObject());")) + templateBody = CGIfWrapper(templateBody, "${valHandle}.isObject()") else: templateBody = CGGeneric() @@ -2955,12 +2955,18 @@ for (uint32_t i = 0; i < length; ++i) { templateBody = "" if descriptor.interface.isCallback(): - templateBody += str(CallbackObjectUnwrapper( + # NOTE: This is only used for EventListener at this point + callbackConversion = str(CallbackObjectUnwrapper( descriptor, - "&${val}.toObject()", + "callbackObj", "${declName}", exceptionCode, codeOnFailure=failureCode)) + templateBody += ( + "{ // Scope for callbackObj\n" + " JS::Rooted callbackObj(cx, &${valHandle}.toObject());\n" + + CGIndenter(CGGeneric(callbackConversion)).define() + + "\n}") elif not descriptor.skipGen and not descriptor.interface.isConsequential() and not descriptor.interface.isExternal(): if failureCode is not None: templateBody += str(CastableObjectUnwrapper( @@ -3307,7 +3313,7 @@ for (uint32_t i = 0; i < length; ++i) { # a dictionary, and return failureCode if not. template = CGIfWrapper( CGGeneric(failureCode), - "!IsConvertibleToDictionary(cx, &${valHandle}.toObject())").define() + "\n\n" + "!IsObjectValueConvertibleToDictionary(cx, ${valHandle})").define() + "\n\n" else: template = "" From f16fc9fb324ec7e3960ac437011b1bd5b33fee4e Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 15 May 2013 18:59:53 -0700 Subject: [PATCH 17/73] Bug 871887 - Fix marquee _setEventListener. r=bz --- js/xpconnect/tests/mochitest/Makefile.in | 1 + .../tests/mochitest/test_bug871887.html | 39 +++++++++++++++++++ layout/style/xbl-marquee/xbl-marquee.xml | 8 +++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 js/xpconnect/tests/mochitest/test_bug871887.html diff --git a/js/xpconnect/tests/mochitest/Makefile.in b/js/xpconnect/tests/mochitest/Makefile.in index 2ebc48dba20..e088887105e 100644 --- a/js/xpconnect/tests/mochitest/Makefile.in +++ b/js/xpconnect/tests/mochitest/Makefile.in @@ -94,6 +94,7 @@ MOCHITEST_FILES = chrome_wrappers_helper.html \ test_bug809674.html \ test_bug829872.html \ test_bug865260.html \ + test_bug871887.html \ file_crosscompartment_weakmap.html \ test_crosscompartment_weakmap.html \ test_asmjs.html \ diff --git a/js/xpconnect/tests/mochitest/test_bug871887.html b/js/xpconnect/tests/mochitest/test_bug871887.html new file mode 100644 index 00000000000..89599f5968f --- /dev/null +++ b/js/xpconnect/tests/mochitest/test_bug871887.html @@ -0,0 +1,39 @@ + + + + + + Test for Bug 871887 + + + + + +Mozilla Bug 871887 +

+
+Watch the Llama +
+
+
+ + diff --git a/layout/style/xbl-marquee/xbl-marquee.xml b/layout/style/xbl-marquee/xbl-marquee.xml index 33f4ab9ee3d..853e7668439 100644 --- a/layout/style/xbl-marquee/xbl-marquee.xml +++ b/layout/style/xbl-marquee/xbl-marquee.xml @@ -259,7 +259,13 @@ case "string": if (!aIgnoreNextCall) { try { - this["_on" + aName] = new XPCNativeWrapper.unwrap(window).Function("event", aValue); + // Work around bug 872772 by wrapping the cross-compartment- + // wrapped function in a function from this scope. + // + // NB: Make sure to wrap the constructor in parentheses to + // deal with the weird precedence of |new| in JS. + var contentFn = new (XPCNativeWrapper.unwrap(window).Function)("event", aValue); + this["_on" + aName] = function(e) { return contentFn(e); }; } catch(e) { return false; From 36088f3cd79eb7bed79eb97f256232be0ea54ced Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 15 May 2013 22:16:10 -0400 Subject: [PATCH 18/73] Bug 869072 - Test whether the upper 32 bits of a register are zeroed by loading an unsigned UINT32_MAX into a register and comparing with that, since x86's cmp instruction's immediate field is a 32-bit signed field. r=sstangl --- js/src/ion/x64/MacroAssembler-x64.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/ion/x64/MacroAssembler-x64.h b/js/src/ion/x64/MacroAssembler-x64.h index 114027a54db..873a351bac3 100644 --- a/js/src/ion/x64/MacroAssembler-x64.h +++ b/js/src/ion/x64/MacroAssembler-x64.h @@ -206,15 +206,16 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared JS_ASSERT(src != dest); JSValueShiftedTag tag = (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type); - mov(ImmShiftedTag(tag), dest); #ifdef DEBUG if (type == JSVAL_TYPE_INT32 || type == JSVAL_TYPE_BOOLEAN) { Label upper32BitsZeroed; - branchPtr(Assembler::BelowOrEqual, src, Imm32(UINT32_MAX), &upper32BitsZeroed); + movePtr(ImmWord(UINT32_MAX), dest); + branchPtr(Assembler::BelowOrEqual, src, dest, &upper32BitsZeroed); breakpoint(); bind(&upper32BitsZeroed); } #endif + mov(ImmShiftedTag(tag), dest); orq(src, dest); } From df32ccf30c82eb01a2c51695e301b644ed8dbbf5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 15 May 2013 22:16:58 -0400 Subject: [PATCH 19/73] Bug 871777 - Fold a load and a jump. r=jandem --- js/src/ion/shared/Assembler-x86-shared.h | 3 +++ js/src/ion/x64/BaselineHelpers-x64.h | 12 ++---------- js/src/ion/x86/BaselineHelpers-x86.h | 13 ++----------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/js/src/ion/shared/Assembler-x86-shared.h b/js/src/ion/shared/Assembler-x86-shared.h index 75793ccf971..dec3b10c8fa 100644 --- a/js/src/ion/shared/Assembler-x86-shared.h +++ b/js/src/ion/shared/Assembler-x86-shared.h @@ -562,6 +562,9 @@ class AssemblerX86Shared void jmp(const Operand &op){ switch (op.kind()) { + case Operand::REG_DISP: + masm.jmp_m(op.disp(), op.base()); + break; case Operand::SCALE: masm.jmp_m(op.disp(), op.base(), op.index(), op.scale()); break; diff --git a/js/src/ion/x64/BaselineHelpers-x64.h b/js/src/ion/x64/BaselineHelpers-x64.h index 0e5c802f13e..832bbd36a45 100644 --- a/js/src/ion/x64/BaselineHelpers-x64.h +++ b/js/src/ion/x64/BaselineHelpers-x64.h @@ -47,12 +47,8 @@ EmitEnterTypeMonitorIC(MacroAssembler &masm, // is properly initialized to point to the stub. masm.movq(Operand(BaselineStubReg, (int32_t) monitorStubOffset), BaselineStubReg); - // Load stubcode pointer from BaselineStubEntry into BaselineTailCallReg. - masm.movq(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode()), - BaselineTailCallReg); - // Jump to the stubcode. - masm.jmp(Operand(BaselineTailCallReg)); + masm.jmp(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode())); } inline void @@ -270,12 +266,8 @@ EmitStubGuardFailure(MacroAssembler &masm) // Load next stub into BaselineStubReg masm.movq(Operand(BaselineStubReg, ICStub::offsetOfNext()), BaselineStubReg); - // Load stubcode pointer from BaselineStubEntry into BaselineTailCallReg - // BaselineTailCallReg will always be unused in the contexts where IC stub guards fail - masm.movq(Operand(BaselineStubReg, ICStub::offsetOfStubCode()), BaselineTailCallReg); - // Return address is already loaded, just jump to the next stubcode. - masm.jmp(Operand(BaselineTailCallReg)); + masm.jmp(Operand(BaselineStubReg, ICStub::offsetOfStubCode())); } diff --git a/js/src/ion/x86/BaselineHelpers-x86.h b/js/src/ion/x86/BaselineHelpers-x86.h index 30f7db30986..2565d489873 100644 --- a/js/src/ion/x86/BaselineHelpers-x86.h +++ b/js/src/ion/x86/BaselineHelpers-x86.h @@ -48,12 +48,8 @@ EmitEnterTypeMonitorIC(MacroAssembler &masm, // is properly initialized to point to the stub. masm.movl(Operand(BaselineStubReg, (int32_t) monitorStubOffset), BaselineStubReg); - // Load stubcode pointer from BaselineStubReg into BaselineTailCallReg. - masm.movl(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode()), - BaselineTailCallReg); - // Jump to the stubcode. - masm.jmp(Operand(BaselineTailCallReg)); + masm.jmp(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode())); } inline void @@ -276,13 +272,8 @@ EmitStubGuardFailure(MacroAssembler &masm) // Load next stub into BaselineStubReg masm.movl(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfNext()), BaselineStubReg); - // Load stubcode pointer from BaselineStubEntry into BaselineTailCallReg - // BaselineTailCallReg will always be unused in the contexts where IC stub guards fail - masm.movl(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode()), - BaselineTailCallReg); - // Return address is already loaded, just jump to the next stubcode. - masm.jmp(Operand(BaselineTailCallReg)); + masm.jmp(Operand(BaselineStubReg, (int32_t) ICStub::offsetOfStubCode())); } From d2214881c4f812b7b8f76c28fd829e944014b954 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 15 May 2013 17:23:42 -0500 Subject: [PATCH 20/73] Bug 872785 - Move GetBytecodeInteger to jsopcode.h; use it in the expression decompiler. r=bhackett --HG-- extra : rebase_source : 4607cd7728cb3c00b601409493d6664221981ae2 --- js/src/jsanalyze.h | 16 ---------------- js/src/jsopcode.cpp | 28 ++-------------------------- js/src/jsopcode.h | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 42 deletions(-) diff --git a/js/src/jsanalyze.h b/js/src/jsanalyze.h index e37e952fea6..d04ed3ac742 100644 --- a/js/src/jsanalyze.h +++ b/js/src/jsanalyze.h @@ -322,22 +322,6 @@ BytecodeUpdatesSlot(JSOp op) return (op == JSOP_SETARG || op == JSOP_SETLOCAL); } -static inline int32_t -GetBytecodeInteger(jsbytecode *pc) -{ - switch (JSOp(*pc)) { - case JSOP_ZERO: return 0; - case JSOP_ONE: return 1; - case JSOP_UINT16: return GET_UINT16(pc); - case JSOP_UINT24: return GET_UINT24(pc); - case JSOP_INT8: return GET_INT8(pc); - case JSOP_INT32: return GET_INT32(pc); - default: - JS_NOT_REACHED("Bad op"); - return 0; - } -} - /* * Information about the lifetime of a local or argument. These form a linked * list describing successive intervals in the program where the variable's diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 3de2f7c37a2..e09b7051e2e 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -1314,32 +1314,8 @@ ExpressionDecompiler::decompilePC(jsbytecode *pc) case JSOP_INT8: case JSOP_UINT16: case JSOP_UINT24: - case JSOP_INT32: { - int32_t i; - switch (op) { - case JSOP_ZERO: - i = 0; - break; - case JSOP_ONE: - i = 1; - break; - case JSOP_INT8: - i = GET_INT8(pc); - break; - case JSOP_UINT16: - i = GET_UINT16(pc); - break; - case JSOP_UINT24: - i = GET_UINT24(pc); - break; - case JSOP_INT32: - i = GET_INT32(pc); - break; - default: - JS_NOT_REACHED("wat?"); - } - return sprinter.printf("%d", i) >= 0; - } + case JSOP_INT32: + return sprinter.printf("%d", GetBytecodeInteger(pc)) >= 0; case JSOP_STRING: return quote(loadAtom(pc), '"'); case JSOP_UNDEFINED: diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h index 66f6d4a1c7e..06f50be3026 100644 --- a/js/src/jsopcode.h +++ b/js/src/jsopcode.h @@ -477,6 +477,23 @@ IsSetterPC(jsbytecode *pc) JSOp op = JSOp(*pc); return op == JSOP_SETPROP || op == JSOP_SETNAME || op == JSOP_SETGNAME; } + +static inline int32_t +GetBytecodeInteger(jsbytecode *pc) +{ + switch (JSOp(*pc)) { + case JSOP_ZERO: return 0; + case JSOP_ONE: return 1; + case JSOP_UINT16: return GET_UINT16(pc); + case JSOP_UINT24: return GET_UINT24(pc); + case JSOP_INT8: return GET_INT8(pc); + case JSOP_INT32: return GET_INT32(pc); + default: + JS_NOT_REACHED("Bad op"); + return 0; + } +} + /* * Counts accumulated for a single opcode in a script. The counts tracked vary * between opcodes, and this structure ensures that counts are accessed in a From 6dd45bbf3dab6dbca857a5813e43f300ed531419 Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Thu, 16 May 2013 14:35:12 +1200 Subject: [PATCH 21/73] Bug 798843 - Replace instances of 'object' with 'context' to match change in CSS values r=roc --- gfx/thebes/gfxFont.cpp | 94 +++++++++++++-------------- gfx/thebes/gfxFont.h | 16 ++--- gfx/thebes/gfxSVGGlyphs.cpp | 14 ++-- gfx/thebes/gfxSVGGlyphs.h | 21 +++--- layout/generic/nsTextFrame.h | 10 +-- layout/generic/nsTextFrameThebes.cpp | 30 ++++----- layout/svg/nsSVGGlyphFrame.cpp | 90 ++++++++++++------------- layout/svg/nsSVGGlyphFrame.h | 42 ++++++------ layout/svg/nsSVGPathGeometryFrame.cpp | 14 ++-- layout/svg/nsSVGTextFrame2.cpp | 72 ++++++++++---------- layout/svg/nsSVGTextFrame2.h | 30 ++++----- layout/svg/nsSVGUtils.cpp | 76 +++++++++++----------- layout/svg/nsSVGUtils.h | 24 +++---- 13 files changed, 268 insertions(+), 265 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 3c3b4ee520d..4e0a34cd3a7 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -231,11 +231,11 @@ gfxFontEntry::GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId, bool gfxFontEntry::RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, - int aDrawMode, gfxTextObjectPaint *aObjectPaint) + int aDrawMode, gfxTextContextPaint *aContextPaint) { NS_ASSERTION(mSVGInitialized, "SVG data has not yet been loaded. TryGetSVGData() first."); return mSVGGlyphs->RenderGlyph(aContext, aGlyphId, gfxFont::DrawMode(aDrawMode), - aObjectPaint); + aContextPaint); } bool @@ -1905,7 +1905,7 @@ struct GlyphBuffer { } void Flush(cairo_t *aCR, gfxFont::DrawMode aDrawMode, bool aReverse, - gfxTextObjectPaint *aObjectPaint, + gfxTextContextPaint *aContextPaint, const gfxMatrix& aGlobalMatrix, bool aFinish = false) { // Ensure there's enough room for a glyph to be added to the buffer // and we actually have glyphs to draw @@ -1926,13 +1926,13 @@ struct GlyphBuffer { } else { if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) == (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) { - FlushStroke(aCR, aObjectPaint, aGlobalMatrix); + FlushStroke(aCR, aContextPaint, aGlobalMatrix); } if (aDrawMode & gfxFont::GLYPH_FILL) { PROFILER_LABEL("GlyphBuffer", "cairo_show_glyphs"); nsRefPtr pattern; - if (aObjectPaint && - !!(pattern = aObjectPaint->GetFillPattern(aGlobalMatrix))) { + if (aContextPaint && + !!(pattern = aContextPaint->GetFillPattern(aGlobalMatrix))) { cairo_save(aCR); cairo_set_source(aCR, pattern->CairoPattern()); } @@ -1945,7 +1945,7 @@ struct GlyphBuffer { } if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) == gfxFont::GLYPH_STROKE) { - FlushStroke(aCR, aObjectPaint, aGlobalMatrix); + FlushStroke(aCR, aContextPaint, aGlobalMatrix); } } @@ -1953,11 +1953,11 @@ struct GlyphBuffer { } private: - void FlushStroke(cairo_t *aCR, gfxTextObjectPaint *aObjectPaint, + void FlushStroke(cairo_t *aCR, gfxTextContextPaint *aContextPaint, const gfxMatrix& aGlobalMatrix) { nsRefPtr pattern; - if (aObjectPaint && - !!(pattern = aObjectPaint->GetStrokePattern(aGlobalMatrix))) { + if (aContextPaint && + !!(pattern = aContextPaint->GetStrokePattern(aGlobalMatrix))) { cairo_save(aCR); cairo_set_source(aCR, pattern->CairoPattern()); } @@ -1999,7 +1999,7 @@ struct GlyphBufferAzure { return &mGlyphBuffer[mNumGlyphs++]; } - void Flush(DrawTarget *aDT, gfxTextObjectPaint *aObjectPaint, ScaledFont *aFont, + void Flush(DrawTarget *aDT, gfxTextContextPaint *aContextPaint, ScaledFont *aFont, gfxFont::DrawMode aDrawMode, bool aReverse, const GlyphRenderingOptions *aOptions, gfxContext *aThebesContext, const Matrix *aInvFontMatrix, const DrawOptions &aDrawOptions, bool aFinish = false) @@ -2022,15 +2022,15 @@ struct GlyphBufferAzure { gfxContext::AzureState state = aThebesContext->CurrentState(); if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) == (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) { - FlushStroke(aDT, aObjectPaint, aFont, aThebesContext, buf, state); + FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state); } if (aDrawMode & gfxFont::GLYPH_FILL) { - if (state.pattern || aObjectPaint) { + if (state.pattern || aContextPaint) { Pattern *pat; nsRefPtr fillPattern; - if (!aObjectPaint || - !(fillPattern = aObjectPaint->GetFillPattern(aThebesContext->CurrentMatrix()))) { + if (!aContextPaint || + !(fillPattern = aContextPaint->GetFillPattern(aThebesContext->CurrentMatrix()))) { if (state.pattern) { pat = state.pattern->GetPattern(aDT, state.patternTransformChanged ? &state.patternTransform : nullptr); } else { @@ -2087,21 +2087,21 @@ struct GlyphBufferAzure { } if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) == gfxFont::GLYPH_STROKE) { - FlushStroke(aDT, aObjectPaint, aFont, aThebesContext, buf, state); + FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state); } mNumGlyphs = 0; } private: - void FlushStroke(DrawTarget *aDT, gfxTextObjectPaint *aObjectPaint, + void FlushStroke(DrawTarget *aDT, gfxTextContextPaint *aContextPaint, ScaledFont *aFont, gfxContext *aThebesContext, gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState) { RefPtr path = aFont->GetPathForGlyphs(aBuf, aDT); - if (aObjectPaint) { + if (aContextPaint) { nsRefPtr strokePattern = - aObjectPaint->GetStrokePattern(aThebesContext->CurrentMatrix()); + aContextPaint->GetStrokePattern(aThebesContext->CurrentMatrix()); if (strokePattern) { aDT->Stroke(path, *strokePattern->GetPattern(aDT), aState.strokeOptions); } @@ -2149,7 +2149,7 @@ ForcePaintingDrawMode(gfxFont::DrawMode aDrawMode) void gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aPt, - Spacing *aSpacing, gfxTextObjectPaint *aObjectPaint, + Spacing *aSpacing, gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks) { NS_ASSERTION(aDrawMode == gfxFont::GLYPH_PATH || !(aDrawMode & gfxFont::GLYPH_PATH), @@ -2166,14 +2166,14 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, gfxMatrix globalMatrix = aContext->CurrentMatrix(); bool haveSVGGlyphs = GetFontEntry()->TryGetSVGData(); - nsAutoPtr objectPaint; - if (haveSVGGlyphs && !aObjectPaint) { + nsAutoPtr contextPaint; + if (haveSVGGlyphs && !aContextPaint) { // If no pattern is specified for fill, use the current pattern NS_ASSERTION((aDrawMode & GLYPH_STROKE) == 0, "no pattern supplied for stroking text"); nsRefPtr fillPattern = aContext->GetPattern(); - objectPaint = new SimpleTextObjectPaint(fillPattern, nullptr, + contextPaint = new SimpleTextContextPaint(fillPattern, nullptr, aContext->CurrentMatrix()); - aObjectPaint = objectPaint; + aContextPaint = contextPaint; } // synthetic-bold strikes are each offset one device pixel in run direction @@ -2230,7 +2230,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, ToDeviceUnits(y, devUnitsPerAppUnit)); gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode); if (RenderSVGGlyph(aContext, point, mode, - glyphData->GetSimpleGlyph(), aObjectPaint, + glyphData->GetSimpleGlyph(), aContextPaint, aCallbacks, emittedGlyphs)) { continue; } @@ -2245,7 +2245,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, glyph->index = glyphData->GetSimpleGlyph(); glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit); glyph->y = ToDeviceUnits(y, devUnitsPerAppUnit); - glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix); + glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix); // synthetic bolding by multi-striking with 1-pixel offsets // at least once, more if there's room (large font sizes) @@ -2261,7 +2261,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, devUnitsPerAppUnit); doubleglyph->y = glyph->y; strikeOffset += synBoldOnePixelOffset; - glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix); + glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix); } while (--strikeCount > 0); } emittedGlyphs = true; @@ -2308,7 +2308,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode); if (RenderSVGGlyph(aContext, point, mode, details->mGlyphID, - aObjectPaint, aCallbacks, + aContextPaint, aCallbacks, emittedGlyphs)) { continue; } @@ -2318,7 +2318,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, glyph->index = details->mGlyphID; glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit); glyph->y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit); - glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix); + glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix); if (IsSyntheticBold()) { double strikeOffset = synBoldOnePixelOffset; @@ -2333,7 +2333,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, devUnitsPerAppUnit); doubleglyph->y = glyph->y; strikeOffset += synBoldOnePixelOffset; - glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix); + glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix); } while (--strikeCount > 0); } emittedGlyphs = true; @@ -2362,7 +2362,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, } // draw any remaining glyphs - glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix, true); + glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix, true); if (aCallbacks && emittedGlyphs) { aCallbacks->NotifyGlyphPathEmitted(); } @@ -2445,7 +2445,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, ToDeviceUnits(y, devUnitsPerAppUnit)); gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode); if (RenderSVGGlyph(aContext, point, mode, - glyphData->GetSimpleGlyph(), aObjectPaint, + glyphData->GetSimpleGlyph(), aContextPaint, aCallbacks, emittedGlyphs)) { continue; } @@ -2461,7 +2461,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit); glyph->mPosition.y = ToDeviceUnits(y, devUnitsPerAppUnit); glyph->mPosition = matInv * glyph->mPosition; - glyphs.Flush(dt, aObjectPaint, scaledFont, + glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL, renderingOptions, aContext, passedInvMatrix, drawOptions); @@ -2481,7 +2481,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, doubleglyph->mPosition.y = glyph->mPosition.y; doubleglyph->mPosition = matInv * doubleglyph->mPosition; strikeOffset += synBoldOnePixelOffset; - glyphs.Flush(dt, aObjectPaint, scaledFont, + glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL, renderingOptions, aContext, passedInvMatrix, drawOptions); @@ -2531,7 +2531,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode); if (RenderSVGGlyph(aContext, point, mode, details->mGlyphID, - aObjectPaint, aCallbacks, + aContextPaint, aCallbacks, emittedGlyphs)) { continue; } @@ -2542,7 +2542,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit); glyph->mPosition.y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit); glyph->mPosition = matInv * glyph->mPosition; - glyphs.Flush(dt, aObjectPaint, scaledFont, aDrawMode, + glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL, renderingOptions, aContext, passedInvMatrix, drawOptions); @@ -2560,7 +2560,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, doubleglyph->mPosition.y = glyph->mPosition.y; strikeOffset += synBoldOnePixelOffset; doubleglyph->mPosition = matInv * doubleglyph->mPosition; - glyphs.Flush(dt, aObjectPaint, scaledFont, + glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL, renderingOptions, aContext, passedInvMatrix, drawOptions); } while (--strikeCount > 0); @@ -2580,7 +2580,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, } } - glyphs.Flush(dt, aObjectPaint, scaledFont, aDrawMode, isRTL, + glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL, renderingOptions, aContext, passedInvMatrix, drawOptions, true); if (aCallbacks && emittedGlyphs) { @@ -2597,7 +2597,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, bool gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode, - uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint) + uint32_t aGlyphId, gfxTextContextPaint *aContextPaint) { if (!GetFontEntry()->HasSVGGlyph(aGlyphId)) { return false; @@ -2609,15 +2609,15 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMod aContext->Translate(gfxPoint(aPoint.x, aPoint.y)); aContext->Scale(devUnitsPerSVGUnit, devUnitsPerSVGUnit); - aObjectPaint->InitStrokeGeometry(aContext, devUnitsPerSVGUnit); + aContextPaint->InitStrokeGeometry(aContext, devUnitsPerSVGUnit); return GetFontEntry()->RenderSVGGlyph(aContext, aGlyphId, aDrawMode, - aObjectPaint); + aContextPaint); } bool gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode, - uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint, + uint32_t aGlyphId, gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks, bool& aEmittedGlyphs) { @@ -2629,7 +2629,7 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMod aCallbacks->NotifyBeforeSVGGlyphPainted(); } bool rendered = RenderSVGGlyph(aContext, aPoint, aDrawMode, aGlyphId, - aObjectPaint); + aContextPaint); if (aCallbacks) { aCallbacks->NotifyAfterSVGGlyphPainted(); } @@ -5441,7 +5441,7 @@ gfxTextRun::ShrinkToLigatureBoundaries(uint32_t *aStart, uint32_t *aEnd) void gfxTextRun::DrawGlyphs(gfxFont *aFont, gfxContext *aContext, gfxFont::DrawMode aDrawMode, gfxPoint *aPt, - gfxTextObjectPaint *aObjectPaint, + gfxTextContextPaint *aContextPaint, uint32_t aStart, uint32_t aEnd, PropertyProvider *aProvider, uint32_t aSpacingStart, uint32_t aSpacingEnd, @@ -5451,7 +5451,7 @@ gfxTextRun::DrawGlyphs(gfxFont *aFont, gfxContext *aContext, bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider, aSpacingStart, aSpacingEnd, &spacingBuffer); aFont->Draw(this, aStart, aEnd, aContext, aDrawMode, aPt, - haveSpacing ? spacingBuffer.Elements() : nullptr, aObjectPaint, + haveSpacing ? spacingBuffer.Elements() : nullptr, aContextPaint, aCallbacks); } @@ -5592,7 +5592,7 @@ void gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, gfxFont::DrawMode aDrawMode, uint32_t aStart, uint32_t aLength, PropertyProvider *aProvider, gfxFloat *aAdvanceWidth, - gfxTextObjectPaint *aObjectPaint, + gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks) { NS_ASSERTION(aStart + aLength <= GetLength(), "Substring out of range"); @@ -5650,7 +5650,7 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, gfxFont::DrawMode aDrawMode aProvider, aCallbacks); } - DrawGlyphs(font, aContext, aDrawMode, &pt, aObjectPaint, ligatureRunStart, + DrawGlyphs(font, aContext, aDrawMode, &pt, aContextPaint, ligatureRunStart, ligatureRunEnd, aProvider, ligatureRunStart, ligatureRunEnd, aCallbacks); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 47d340bb36c..48a8005f3e4 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -46,7 +46,7 @@ class gfxUserFontData; class gfxShapedText; class gfxShapedWord; class gfxSVGGlyphs; -class gfxTextObjectPaint; +class gfxTextContextPaint; class nsILanguageAtomService; @@ -313,7 +313,7 @@ public: bool GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId, gfxRect *aResult); bool RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, int aDrawMode, - gfxTextObjectPaint *aObjectPaint); + gfxTextContextPaint *aContextPaint); virtual bool MatchesGenericFamily(const nsACString& aGeneric) const { return true; @@ -1438,7 +1438,7 @@ public: * that there is no spacing. * @param aDrawMode specifies whether the fill or stroke of the glyph should be * drawn, or if it should be drawn into the current path - * @param aObjectPaint information about how to construct the fill and + * @param aContextPaint information about how to construct the fill and * stroke pattern. Can be NULL if we are not stroking the text, which * indicates that the current source from aContext should be used for filling * @@ -1451,7 +1451,7 @@ public: */ virtual void Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aBaselineOrigin, - Spacing *aSpacing, gfxTextObjectPaint *aObjectPaint, + Spacing *aSpacing, gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks); /** @@ -1852,9 +1852,9 @@ protected: void SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont); bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode, - uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint); + uint32_t aGlyphId, gfxTextContextPaint *aContextPaint); bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode, - uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint, + uint32_t aGlyphId, gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks, bool& aEmittedGlyphs); @@ -2708,7 +2708,7 @@ public: gfxFont::DrawMode aDrawMode, uint32_t aStart, uint32_t aLength, PropertyProvider *aProvider, - gfxFloat *aAdvanceWidth, gfxTextObjectPaint *aObjectPaint, + gfxFloat *aAdvanceWidth, gfxTextContextPaint *aContextPaint, gfxTextRunDrawCallbacks *aCallbacks = nullptr); /** @@ -3135,7 +3135,7 @@ private: // **** drawing helper **** void DrawGlyphs(gfxFont *aFont, gfxContext *aContext, gfxFont::DrawMode aDrawMode, gfxPoint *aPt, - gfxTextObjectPaint *aObjectPaint, uint32_t aStart, + gfxTextContextPaint *aContextPaint, uint32_t aStart, uint32_t aEnd, PropertyProvider *aProvider, uint32_t aSpacingStart, uint32_t aSpacingEnd, gfxTextRunDrawCallbacks *aCallbacks); diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp index 4c22705d0a5..93b29b8beb9 100644 --- a/gfx/thebes/gfxSVGGlyphs.cpp +++ b/gfx/thebes/gfxSVGGlyphs.cpp @@ -66,11 +66,11 @@ typedef mozilla::dom::Element Element; -mozilla::gfx::UserDataKey gfxTextObjectPaint::sUserDataKey; +mozilla::gfx::UserDataKey gfxTextContextPaint::sUserDataKey; const float gfxSVGGlyphs::SVG_UNITS_PER_EM = 1000.0f; -const gfxRGBA SimpleTextObjectPaint::sZero = gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f); +const gfxRGBA SimpleTextContextPaint::sZero = gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f); gfxSVGGlyphs::gfxSVGGlyphs(FallibleTArray& aSVGTable, const FallibleTArray& aCmapTable) @@ -218,7 +218,7 @@ gfxSVGGlyphsDocument::FindGlyphElements(Element *aElem, */ bool gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId, - DrawMode aDrawMode, gfxTextObjectPaint *aObjectPaint) + DrawMode aDrawMode, gfxTextContextPaint *aContextPaint) { if (aDrawMode == gfxFont::GLYPH_PATH) { return false; @@ -229,7 +229,7 @@ gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId, Element *glyph = mGlyphIdMap.Get(aGlyphId); NS_ASSERTION(glyph, "No glyph element. Should check with HasSVGGlyph() first!"); - return nsSVGUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aObjectPaint); + return nsSVGUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aContextPaint); } bool @@ -409,6 +409,8 @@ gfxSVGGlyphsDocument::InsertGlyphId(Element *aGlyphElement) } mGlyphIdMap.Put(glyphId, aGlyphElement); + + printf("Inserted glyph ID %d", (int)glyphId); } void @@ -447,10 +449,12 @@ gfxSVGGlyphsDocument::InsertGlyphChar(Element *aGlyphElement, if (glyphId) { mGlyphIdMap.Put(glyphId, aGlyphElement); } + + printf("Inserted glyph char %d", (int)glyphId); } void -gfxTextObjectPaint::InitStrokeGeometry(gfxContext *aContext, +gfxTextContextPaint::InitStrokeGeometry(gfxContext *aContext, float devUnitsPerSVGUnit) { mStrokeWidth = aContext->CurrentLineWidth() / devUnitsPerSVGUnit; diff --git a/gfx/thebes/gfxSVGGlyphs.h b/gfx/thebes/gfxSVGGlyphs.h index f0456b4ad53..9b7f9a97bce 100644 --- a/gfx/thebes/gfxSVGGlyphs.h +++ b/gfx/thebes/gfxSVGGlyphs.h @@ -137,11 +137,11 @@ public: /** * Render the SVG glyph for |aGlyphId| * @param aDrawMode Whether to fill or stroke or both; see gfxFont::DrawMode - * @param aObjectPaint Information on outer text object paints. - * See |gfxTextObjectPaint|. + * @param aContextPaint Information on text context paints. + * See |gfxTextContextPaint|. */ bool RenderGlyph(gfxContext *aContext, uint32_t aGlyphId, DrawMode aDrawMode, - gfxTextObjectPaint *aObjectPaint); + gfxTextContextPaint *aContextPaint); /** * Get the extents for the SVG glyph associated with |aGlyphId| @@ -177,18 +177,17 @@ private: /** * Used for trickling down paint information through to SVG glyphs. - * Will be extended in later patch. */ -class gfxTextObjectPaint +class gfxTextContextPaint { protected: - gfxTextObjectPaint() { } + gfxTextContextPaint() { } public: static mozilla::gfx::UserDataKey sUserDataKey; /* - * Get outer text object pattern with the specified opacity value. + * Get text context pattern with the specified opacity value. * This lets us inherit paints and paint opacities (i.e. fill/stroke and * fill-opacity/stroke-opacity) separately. */ @@ -223,7 +222,7 @@ public: return GetStrokePattern(GetStrokeOpacity(), aCTM); } - virtual ~gfxTextObjectPaint() { } + virtual ~gfxTextContextPaint() { } private: FallibleTArray mDashes; @@ -232,10 +231,10 @@ private: }; /** - * For passing in patterns where the outer text object has no separate pattern + * For passing in patterns where the text context has no separate pattern * opacity value. */ -class SimpleTextObjectPaint : public gfxTextObjectPaint +class SimpleTextContextPaint : public gfxTextContextPaint { private: static const gfxRGBA sZero; @@ -252,7 +251,7 @@ public: return deviceToUser * aPattern->GetMatrix(); } - SimpleTextObjectPaint(gfxPattern *aFillPattern, gfxPattern *aStrokePattern, + SimpleTextContextPaint(gfxPattern *aFillPattern, gfxPattern *aStrokePattern, const gfxMatrix& aCTM) : mFillPattern(aFillPattern ? aFillPattern : new gfxPattern(sZero)), mStrokePattern(aStrokePattern ? aStrokePattern : new gfxPattern(sZero)) diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 2d948207b4a..f87eccbf71a 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -374,7 +374,7 @@ public: // context. void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem, - gfxTextObjectPaint* aObjectPaint = nullptr, + gfxTextContextPaint* aContextPaint = nullptr, DrawPathCallbacks* aCallbacks = nullptr); // helper: paint text frame when we're impacted by at least one selection. // Return false if the text was not painted and we should continue with @@ -388,7 +388,7 @@ public: uint32_t aContentLength, nsTextPaintStyle& aTextPaintStyle, const nsCharClipDisplayItem::ClipEdges& aClipEdges, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, DrawPathCallbacks* aCallbacks); // helper: paint text with foreground and background colors determined // by selection(s). Also computes a mask of all selection types applying to @@ -650,7 +650,7 @@ protected: nscolor aTextColor, gfxFloat& aAdvanceWidth, bool aDrawSoftHyphen, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, DrawPathCallbacks* aCallbacks); void DrawTextRunAndDecorations(gfxContext* const aCtx, @@ -667,7 +667,7 @@ protected: bool aDrawSoftHyphen, const TextDecorations& aDecorations, const nscolor* const aDecorationOverrideColor, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, DrawPathCallbacks* aCallbacks); void DrawText(gfxContext* const aCtx, @@ -683,7 +683,7 @@ protected: gfxFloat& aAdvanceWidth, bool aDrawSoftHyphen, const nscolor* const aDecorationOverrideColor = nullptr, - gfxTextObjectPaint* aObjectPaint = nullptr, + gfxTextContextPaint* aContextPaint = nullptr, DrawPathCallbacks* aCallbacks = nullptr); // Set non empty rect to aRect, it should be overflow rect or frame rect. diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 04e651cff04..75d4cf0643a 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -5496,7 +5496,7 @@ nsTextFrame::PaintTextWithSelection(gfxContext* aCtx, uint32_t aContentOffset, uint32_t aContentLength, nsTextPaintStyle& aTextPaintStyle, const nsCharClipDisplayItem::ClipEdges& aClipEdges, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { NS_ASSERTION(GetContent()->IsSelectionDescendant(), "wrong paint path"); @@ -5710,7 +5710,7 @@ void nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { // Don't pass in aRenderingContext here, because we need a *reference* @@ -5753,7 +5753,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, tmp.ConvertSkippedToOriginal(startOffset + maxLength) - contentOffset; if (PaintTextWithSelection(ctx, framePt, textBaselinePt, dirtyRect, provider, contentOffset, contentLength, - textPaintStyle, clipEdges, aObjectPaint, + textPaintStyle, clipEdges, aContextPaint, aCallbacks)) { return; } @@ -5782,7 +5782,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, DrawText(ctx, dirtyRect, framePt, textBaselinePt, startOffset, maxLength, provider, textPaintStyle, foregroundColor, clipEdges, advanceWidth, (GetStateBits() & TEXT_HYPHEN_BREAK) != 0, - nullptr, aObjectPaint, aCallbacks); + nullptr, aContextPaint, aCallbacks); } static void @@ -5793,7 +5793,7 @@ DrawTextRun(gfxTextRun* aTextRun, PropertyProvider* aProvider, nscolor aTextColor, gfxFloat* aAdvanceWidth, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { gfxFont::DrawMode drawMode = aCallbacks ? gfxFont::GLYPH_PATH : @@ -5801,12 +5801,12 @@ DrawTextRun(gfxTextRun* aTextRun, if (aCallbacks) { aCallbacks->NotifyBeforeText(aTextColor); aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength, - aProvider, aAdvanceWidth, aObjectPaint, aCallbacks); + aProvider, aAdvanceWidth, aContextPaint, aCallbacks); aCallbacks->NotifyAfterText(); } else { aCtx->SetColor(gfxRGBA(aTextColor)); aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength, - aProvider, aAdvanceWidth, aObjectPaint); + aProvider, aAdvanceWidth, aContextPaint); } } @@ -5818,11 +5818,11 @@ nsTextFrame::DrawTextRun(gfxContext* const aCtx, nscolor aTextColor, gfxFloat& aAdvanceWidth, bool aDrawSoftHyphen, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { ::DrawTextRun(mTextRun, aCtx, aTextBaselinePt, aOffset, aLength, &aProvider, - aTextColor, &aAdvanceWidth, aObjectPaint, aCallbacks); + aTextColor, &aAdvanceWidth, aContextPaint, aCallbacks); if (aDrawSoftHyphen) { // Don't use ctx as the context, because we need a reference context here, @@ -5836,7 +5836,7 @@ nsTextFrame::DrawTextRun(gfxContext* const aCtx, ::DrawTextRun(hyphenTextRun.get(), aCtx, gfxPoint(hyphenBaselineX, aTextBaselinePt.y), 0, hyphenTextRun->GetLength(), - nullptr, aTextColor, nullptr, aObjectPaint, aCallbacks); + nullptr, aTextColor, nullptr, aContextPaint, aCallbacks); } } } @@ -5854,7 +5854,7 @@ nsTextFrame::DrawTextRunAndDecorations( bool aDrawSoftHyphen, const TextDecorations& aDecorations, const nscolor* const aDecorationOverrideColor, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { const gfxFloat app = aTextStyle.PresContext()->AppUnitsPerDevPixel(); @@ -5919,7 +5919,7 @@ nsTextFrame::DrawTextRunAndDecorations( // CSS 2.1 mandates that text be painted after over/underlines, and *then* // line-throughs DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider, aTextColor, - aAdvanceWidth, aDrawSoftHyphen, aObjectPaint, aCallbacks); + aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks); // Line-throughs for (uint32_t i = aDecorations.mStrikes.Length(); i-- > 0; ) { @@ -5955,7 +5955,7 @@ nsTextFrame::DrawText( gfxFloat& aAdvanceWidth, bool aDrawSoftHyphen, const nscolor* const aDecorationOverrideColor, - gfxTextObjectPaint* aObjectPaint, + gfxTextContextPaint* aContextPaint, nsTextFrame::DrawPathCallbacks* aCallbacks) { TextDecorations decorations; @@ -5970,10 +5970,10 @@ nsTextFrame::DrawText( DrawTextRunAndDecorations(aCtx, aDirtyRect, aFramePt, aTextBaselinePt, aOffset, aLength, aProvider, aTextStyle, aTextColor, aClipEdges, aAdvanceWidth, aDrawSoftHyphen, decorations, - aDecorationOverrideColor, aObjectPaint, aCallbacks); + aDecorationOverrideColor, aContextPaint, aCallbacks); } else { DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider, - aTextColor, aAdvanceWidth, aDrawSoftHyphen, aObjectPaint, aCallbacks); + aTextColor, aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks); } } diff --git a/layout/svg/nsSVGGlyphFrame.cpp b/layout/svg/nsSVGGlyphFrame.cpp index 522053459d5..a352959c612 100644 --- a/layout/svg/nsSVGGlyphFrame.cpp +++ b/layout/svg/nsSVGGlyphFrame.cpp @@ -420,11 +420,11 @@ nsSVGGlyphFrame::PaintSVG(nsRenderingContext *aContext, return NS_OK; } - gfxTextObjectPaint *outerObjectPaint = - (gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey); + gfxTextContextPaint *outerContextPaint = + (gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey); - nsAutoPtr objectPaint; - DrawMode drawMode = SetupCairoState(gfx, outerObjectPaint, getter_Transfers(objectPaint)); + nsAutoPtr objectPaint; + DrawMode drawMode = SetupCairoState(gfx, outerContextPaint, getter_Transfers(objectPaint)); if (drawMode) { DrawCharacters(&iter, gfx, drawMode, objectPaint); @@ -591,7 +591,7 @@ void nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter, gfxContext *aContext, DrawMode aDrawMode, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { if (aDrawMode & gfxFont::GLYPH_STROKE) { aIter->SetLineWidthAndDashesForDrawing(aContext); @@ -599,7 +599,7 @@ nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter, if (aIter->SetupForDirectTextRunDrawing(aContext)) { mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, 0, - mTextRun->GetLength(), nullptr, nullptr, aObjectPaint); + mTextRun->GetLength(), nullptr, nullptr, aContextPaint); return; } @@ -607,7 +607,7 @@ nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter, while ((i = aIter->NextCluster()) != aIter->InvalidCluster()) { aIter->SetupForDrawing(aContext); mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, i, - aIter->ClusterLength(), nullptr, nullptr, aObjectPaint); + aIter->ClusterLength(), nullptr, nullptr, aContextPaint); } } @@ -932,17 +932,17 @@ nsSVGGlyphFrame::GetBaselineOffset(float aMetricsScale) DrawMode nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - gfxTextObjectPaint **aThisObjectPaint) + gfxTextContextPaint *aOuterContextPaint, + gfxTextContextPaint **aThisContextPaint) { DrawMode toDraw = DrawMode(0); - SVGTextObjectPaint *thisObjectPaint = new SVGTextObjectPaint(); + SVGTextContextPaint *thisContextPaint = new SVGTextContextPaint(); - if (SetupCairoStroke(aContext, aOuterObjectPaint, thisObjectPaint)) { + if (SetupCairoStroke(aContext, aOuterContextPaint, thisContextPaint)) { toDraw = DrawMode(toDraw | gfxFont::GLYPH_STROKE); } - if (SetupCairoFill(aContext, aOuterObjectPaint, thisObjectPaint)) { + if (SetupCairoFill(aContext, aOuterContextPaint, thisContextPaint)) { toDraw = DrawMode(toDraw | gfxFont::GLYPH_FILL); } @@ -960,55 +960,55 @@ nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext, paintOrder >>= NS_STYLE_PAINT_ORDER_BITWIDTH; } - *aThisObjectPaint = thisObjectPaint; + *aThisContextPaint = thisContextPaint; return toDraw; } bool nsSVGGlyphFrame::SetupCairoStroke(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint *aThisObjectPaint) + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint *aThisContextPaint) { - if (!nsSVGUtils::HasStroke(this, aOuterObjectPaint)) { + if (!nsSVGUtils::HasStroke(this, aOuterContextPaint)) { return false; } const nsStyleSVG *style = StyleSVG(); - nsSVGUtils::SetupCairoStrokeHitGeometry(this, aContext, aOuterObjectPaint); + nsSVGUtils::SetupCairoStrokeHitGeometry(this, aContext, aOuterContextPaint); float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource, style->mStrokeOpacity, - aOuterObjectPaint); + aOuterContextPaint); - SetupInheritablePaint(aContext, opacity, aOuterObjectPaint, - aThisObjectPaint->mStrokePaint, &nsStyleSVG::mStroke, + SetupInheritablePaint(aContext, opacity, aOuterContextPaint, + aThisContextPaint->mStrokePaint, &nsStyleSVG::mStroke, nsSVGEffects::StrokeProperty()); - aThisObjectPaint->SetStrokeOpacity(opacity); + aThisContextPaint->SetStrokeOpacity(opacity); return opacity != 0.0f; } bool nsSVGGlyphFrame::SetupCairoFill(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint *aThisObjectPaint) + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint *aThisContextPaint) { const nsStyleSVG *style = StyleSVG(); if (style->mFill.mType == eStyleSVGPaintType_None) { - aThisObjectPaint->SetFillOpacity(0.0f); + aThisContextPaint->SetFillOpacity(0.0f); return false; } float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource, style->mFillOpacity, - aOuterObjectPaint); + aOuterContextPaint); - SetupInheritablePaint(aContext, opacity, aOuterObjectPaint, - aThisObjectPaint->mFillPaint, &nsStyleSVG::mFill, + SetupInheritablePaint(aContext, opacity, aOuterContextPaint, + aThisContextPaint->mFillPaint, &nsStyleSVG::mFill, nsSVGEffects::FillProperty()); - aThisObjectPaint->SetFillOpacity(opacity); + aThisContextPaint->SetFillOpacity(opacity); return true; } @@ -1016,8 +1016,8 @@ nsSVGGlyphFrame::SetupCairoFill(gfxContext *aContext, void nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext, float& aOpacity, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint::Paint& aTargetPaint, + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint::Paint& aTargetPaint, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, const FramePropertyDescriptor *aProperty) { @@ -1027,8 +1027,8 @@ nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext, if (ps && ps->SetupPaintServer(aContext, this, aFillOrStroke, aOpacity)) { aTargetPaint.SetPaintServer(this, aContext->CurrentMatrix(), ps); - } else if (SetupObjectPaint(aContext, aFillOrStroke, aOpacity, aOuterObjectPaint)) { - aTargetPaint.SetObjectPaint(aOuterObjectPaint, (style->*aFillOrStroke).mType); + } else if (SetupContextPaint(aContext, aFillOrStroke, aOpacity, aOuterContextPaint)) { + aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType); } else { nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext, StyleContext(), @@ -1046,12 +1046,12 @@ nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext, } bool -nsSVGGlyphFrame::SetupObjectPaint(gfxContext *aContext, +nsSVGGlyphFrame::SetupContextPaint(gfxContext *aContext, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float& aOpacity, - gfxTextObjectPaint *aOuterObjectPaint) + gfxTextContextPaint *aOuterContextPaint) { - if (!aOuterObjectPaint) { + if (!aOuterContextPaint) { NS_WARNING("Outer object paint value used outside SVG glyph"); return false; } @@ -1067,8 +1067,8 @@ nsSVGGlyphFrame::SetupObjectPaint(gfxContext *aContext, gfxMatrix current = aContext->CurrentMatrix(); nsRefPtr pattern = paint.mType == eStyleSVGPaintType_ObjectFill ? - aOuterObjectPaint->GetFillPattern(aOpacity, current) : - aOuterObjectPaint->GetStrokePattern(aOpacity, current); + aOuterContextPaint->GetFillPattern(aOpacity, current) : + aOuterContextPaint->GetStrokePattern(aOpacity, current); if (!pattern) { return false; } @@ -1078,24 +1078,24 @@ nsSVGGlyphFrame::SetupObjectPaint(gfxContext *aContext, } //---------------------------------------------------------------------- -// SVGTextObjectPaint methods: +// SVGTextContextPaint methods: already_AddRefed -mozilla::SVGTextObjectPaint::GetFillPattern(float aOpacity, +mozilla::SVGTextContextPaint::GetFillPattern(float aOpacity, const gfxMatrix& aCTM) { return mFillPaint.GetPattern(aOpacity, &nsStyleSVG::mFill, aCTM); } already_AddRefed -mozilla::SVGTextObjectPaint::GetStrokePattern(float aOpacity, +mozilla::SVGTextContextPaint::GetStrokePattern(float aOpacity, const gfxMatrix& aCTM) { return mStrokePaint.GetPattern(aOpacity, &nsStyleSVG::mStroke, aCTM); } already_AddRefed -mozilla::SVGTextObjectPaint::Paint::GetPattern(float aOpacity, +mozilla::SVGTextContextPaint::Paint::GetPattern(float aOpacity, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, const gfxMatrix& aCTM) { @@ -1136,13 +1136,13 @@ mozilla::SVGTextObjectPaint::Paint::GetPattern(float aOpacity, pattern->SetMatrix(aCTM * mPatternMatrix); break; case eStyleSVGPaintType_ObjectFill: - pattern = mPaintDefinition.mObjectPaint->GetFillPattern(aOpacity, aCTM); - // Don't cache this. mObjectPaint will have cached it anyway. If we + pattern = mPaintDefinition.mContextPaint->GetFillPattern(aOpacity, aCTM); + // Don't cache this. mContextPaint will have cached it anyway. If we // cache it, we'll have to compute mPatternMatrix, which is annoying. return pattern.forget(); case eStyleSVGPaintType_ObjectStroke: - pattern = mPaintDefinition.mObjectPaint->GetStrokePattern(aOpacity, aCTM); - // Don't cache this. mObjectPaint will have cached it anyway. If we + pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aOpacity, aCTM); + // Don't cache this. mContextPaint will have cached it anyway. If we // cache it, we'll have to compute mPatternMatrix, which is annoying. return pattern.forget(); default: diff --git a/layout/svg/nsSVGGlyphFrame.h b/layout/svg/nsSVGGlyphFrame.h index 9fbd26ba9cd..a0005549793 100644 --- a/layout/svg/nsSVGGlyphFrame.h +++ b/layout/svg/nsSVGGlyphFrame.h @@ -22,7 +22,7 @@ class nsRenderingContext; class nsSVGGlyphFrame; class nsSVGTextFrame; class nsSVGTextPathFrame; -class gfxTextObjectPaint; +class gfxTextContextPaint; struct CharacterPosition; @@ -33,7 +33,7 @@ class SVGIRect; } // Slightly horrible callback for deferring application of opacity -struct SVGTextObjectPaint : public gfxTextObjectPaint { +struct SVGTextContextPaint : public gfxTextContextPaint { already_AddRefed GetFillPattern(float aOpacity, const gfxMatrix& aCTM); already_AddRefed GetStrokePattern(float aOpacity, @@ -63,18 +63,18 @@ struct SVGTextObjectPaint : public gfxTextObjectPaint { mPaintDefinition.mColor = aColor; } - void SetObjectPaint(gfxTextObjectPaint *aObjectPaint, + void SetContextPaint(gfxTextContextPaint *aContextPaint, nsStyleSVGPaintType aPaintType) { NS_ASSERTION(aPaintType == eStyleSVGPaintType_ObjectFill || aPaintType == eStyleSVGPaintType_ObjectStroke, - "Invalid object paint type"); + "Invalid context paint type"); mPaintType = aPaintType; - mPaintDefinition.mObjectPaint = aObjectPaint; + mPaintDefinition.mContextPaint = aContextPaint; } union { nsSVGPaintServerFrame *mPaintServerFrame; - gfxTextObjectPaint *mObjectPaint; + gfxTextContextPaint *mContextPaint; nscolor mColor; } mPaintDefinition; @@ -312,7 +312,7 @@ private: void DrawCharacters(CharacterIterator *aIter, gfxContext *aContext, DrawMode aDrawMode, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); void NotifyGlyphMetricsChange(); void SetupGlobalTransform(gfxContext *aContext, uint32_t aFor); @@ -339,40 +339,40 @@ private: private: DrawMode SetupCairoState(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - gfxTextObjectPaint **aThisObjectPaint); + gfxTextContextPaint *aOuterContextPaint, + gfxTextContextPaint **aThisContextPaint); /** * Sets up the stroke style in |aContext| and stores stroke pattern - * information in |aThisObjectPaint|. + * information in |aThisContextPaint|. */ bool SetupCairoStroke(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint *aThisObjectPaint); + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint *aThisContextPaint); /** * Sets up the fill style in |aContext| and stores fill pattern information - * in |aThisObjectPaint|. + * in |aThisContextPaint|. */ bool SetupCairoFill(gfxContext *aContext, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint *aThisObjectPaint); + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint *aThisContextPaint); /** * Sets the current pattern to the fill or stroke style of the outer text - * object. Will also set the paint opacity to transparent if the paint is set + * context. Will also set the paint opacity to transparent if the paint is set * to "none". */ - bool SetupObjectPaint(gfxContext *aContext, + bool SetupContextPaint(gfxContext *aContext, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float& aOpacity, - gfxTextObjectPaint *aObjectPaint); + gfxTextContextPaint *aContextPaint); /** * Stores in |aTargetPaint| information on how to reconstruct the current * fill or stroke pattern. Will also set the paint opacity to transparent if * the paint is set to "none". - * @param aOuterObjectPaint pattern information from the outer text object + * @param aOuterContextPaint pattern information from the outer text context * @param aTargetPaint where to store the current pattern information * @param aFillOrStroke member pointer to the paint we are setting up * @param aProperty the frame property descriptor of the fill or stroke paint @@ -380,8 +380,8 @@ private: */ void SetupInheritablePaint(gfxContext *aContext, float& aOpacity, - gfxTextObjectPaint *aOuterObjectPaint, - SVGTextObjectPaint::Paint& aTargetPaint, + gfxTextContextPaint *aOuterContextPaint, + SVGTextContextPaint::Paint& aTargetPaint, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, const FramePropertyDescriptor *aProperty); diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index d3d3ee8125f..59d6f898a97 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -585,16 +585,16 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext, return; } - gfxTextObjectPaint *objectPaint = - (gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey); + gfxTextContextPaint *contextPaint = + (gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey); if ((aRenderComponents & eRenderFill) && - nsSVGUtils::SetupCairoFillPaint(this, gfx, objectPaint)) { + nsSVGUtils::SetupCairoFillPaint(this, gfx, contextPaint)) { gfx->Fill(); } if ((aRenderComponents & eRenderStroke) && - nsSVGUtils::SetupCairoStroke(this, gfx, objectPaint)) { + nsSVGUtils::SetupCairoStroke(this, gfx, contextPaint)) { gfx->Stroke(); } @@ -628,14 +628,14 @@ nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext, void nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext) { - gfxTextObjectPaint *objectPaint = - (gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey); + gfxTextContextPaint *contextPaint = + (gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey); if (static_cast(mContent)->IsMarkable()) { MarkerProperties properties = GetMarkerProperties(this); if (properties.MarkersExist()) { - float strokeWidth = nsSVGUtils::GetStrokeWidth(this, objectPaint); + float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint); nsTArray marks; static_cast diff --git a/layout/svg/nsSVGTextFrame2.cpp b/layout/svg/nsSVGTextFrame2.cpp index b3a33acc442..cd2a2602022 100644 --- a/layout/svg/nsSVGTextFrame2.cpp +++ b/layout/svg/nsSVGTextFrame2.cpp @@ -3351,11 +3351,11 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext, // Set up the fill and stroke so that SVG glyphs can get painted correctly // when they use -moz-objectFill values etc. gfx->SetMatrix(initialMatrix); - gfxTextObjectPaint *outerObjectPaint = - (gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey); + gfxTextContextPaint *outerContextPaint = + (gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey); - nsAutoPtr objectPaint; - SetupCairoState(gfx, frame, outerObjectPaint, getter_Transfers(objectPaint)); + nsAutoPtr contextPaint; + SetupCairoState(gfx, frame, outerContextPaint, getter_Transfers(contextPaint)); // Set up the transform for painting the text frame for the substring // indicated by the run. @@ -3370,10 +3370,10 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext, SVGTextDrawPathCallbacks callbacks(aContext, frame, matrixForPaintServers, paintSVGGlyphs); frame->PaintText(aContext, nsPoint(), frameRect, item, - objectPaint, &callbacks); + contextPaint, &callbacks); } else { frame->PaintText(aContext, nsPoint(), frameRect, item, - objectPaint, nullptr); + contextPaint, nullptr); } if (frame == caretFrame && ShouldPaintCaret(run, caret)) { @@ -5159,21 +5159,21 @@ nsSVGTextFrame2::TransformFrameRectFromTextChild(const nsRect& aRect, gfxFont::DrawMode nsSVGTextFrame2::SetupCairoState(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - gfxTextObjectPaint** aThisObjectPaint) + gfxTextContextPaint* aOuterContextPaint, + gfxTextContextPaint** aThisContextPaint) { gfxFont::DrawMode toDraw = gfxFont::DrawMode(0); - SVGTextObjectPaint *thisObjectPaint = new SVGTextObjectPaint(); + SVGTextContextPaint *thisContextPaint = new SVGTextContextPaint(); - if (SetupCairoStroke(aContext, aFrame, aOuterObjectPaint, thisObjectPaint)) { + if (SetupCairoStroke(aContext, aFrame, aOuterContextPaint, thisContextPaint)) { toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_STROKE); } - if (SetupCairoFill(aContext, aFrame, aOuterObjectPaint, thisObjectPaint)) { + if (SetupCairoFill(aContext, aFrame, aOuterContextPaint, thisContextPaint)) { toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_FILL); } - *aThisObjectPaint = thisObjectPaint; + *aThisContextPaint = thisContextPaint; return toDraw; } @@ -5181,28 +5181,28 @@ nsSVGTextFrame2::SetupCairoState(gfxContext* aContext, bool nsSVGTextFrame2::SetupCairoStroke(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint* aThisObjectPaint) + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint* aThisContextPaint) { const nsStyleSVG *style = aFrame->StyleSVG(); if (style->mStroke.mType == eStyleSVGPaintType_None) { - aThisObjectPaint->SetStrokeOpacity(0.0f); + aThisContextPaint->SetStrokeOpacity(0.0f); return false; } gfxContextMatrixAutoSaveRestore matrixRestore(aContext); aContext->IdentityMatrix(); - nsSVGUtils::SetupCairoStrokeHitGeometry(aFrame, aContext, aOuterObjectPaint); + nsSVGUtils::SetupCairoStrokeHitGeometry(aFrame, aContext, aOuterContextPaint); float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource, style->mStrokeOpacity, - aOuterObjectPaint); + aOuterContextPaint); - SetupInheritablePaint(aContext, aFrame, opacity, aOuterObjectPaint, - aThisObjectPaint->mStrokePaint, &nsStyleSVG::mStroke, + SetupInheritablePaint(aContext, aFrame, opacity, aOuterContextPaint, + aThisContextPaint->mStrokePaint, &nsStyleSVG::mStroke, nsSVGEffects::StrokeProperty()); - aThisObjectPaint->SetStrokeOpacity(opacity); + aThisContextPaint->SetStrokeOpacity(opacity); return opacity != 0.0f; } @@ -5210,24 +5210,24 @@ nsSVGTextFrame2::SetupCairoStroke(gfxContext* aContext, bool nsSVGTextFrame2::SetupCairoFill(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint* aThisObjectPaint) + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint* aThisContextPaint) { const nsStyleSVG *style = aFrame->StyleSVG(); if (style->mFill.mType == eStyleSVGPaintType_None) { - aThisObjectPaint->SetFillOpacity(0.0f); + aThisContextPaint->SetFillOpacity(0.0f); return false; } float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource, style->mFillOpacity, - aOuterObjectPaint); + aOuterContextPaint); - SetupInheritablePaint(aContext, aFrame, opacity, aOuterObjectPaint, - aThisObjectPaint->mFillPaint, &nsStyleSVG::mFill, + SetupInheritablePaint(aContext, aFrame, opacity, aOuterContextPaint, + aThisContextPaint->mFillPaint, &nsStyleSVG::mFill, nsSVGEffects::FillProperty()); - aThisObjectPaint->SetFillOpacity(opacity); + aThisContextPaint->SetFillOpacity(opacity); return true; } @@ -5236,8 +5236,8 @@ void nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext, nsIFrame* aFrame, float& aOpacity, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint::Paint& aTargetPaint, + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint::Paint& aTargetPaint, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, const FramePropertyDescriptor* aProperty) { @@ -5247,8 +5247,8 @@ nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext, if (ps && ps->SetupPaintServer(aContext, aFrame, aFillOrStroke, aOpacity)) { aTargetPaint.SetPaintServer(aFrame, aContext->CurrentMatrix(), ps); - } else if (SetupObjectPaint(aContext, aFrame, aFillOrStroke, aOpacity, aOuterObjectPaint)) { - aTargetPaint.SetObjectPaint(aOuterObjectPaint, (style->*aFillOrStroke).mType); + } else if (SetupContextPaint(aContext, aFrame, aFillOrStroke, aOpacity, aOuterContextPaint)) { + aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType); } else { nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext, aFrame->StyleContext(), @@ -5263,13 +5263,13 @@ nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext, } bool -nsSVGTextFrame2::SetupObjectPaint(gfxContext* aContext, +nsSVGTextFrame2::SetupContextPaint(gfxContext* aContext, nsIFrame* aFrame, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float& aOpacity, - gfxTextObjectPaint* aOuterObjectPaint) + gfxTextContextPaint* aOuterContextPaint) { - if (!aOuterObjectPaint) { + if (!aOuterContextPaint) { return false; } @@ -5284,8 +5284,8 @@ nsSVGTextFrame2::SetupObjectPaint(gfxContext* aContext, gfxMatrix current = aContext->CurrentMatrix(); nsRefPtr pattern = paint.mType == eStyleSVGPaintType_ObjectFill ? - aOuterObjectPaint->GetFillPattern(aOpacity, current) : - aOuterObjectPaint->GetStrokePattern(aOpacity, current); + aOuterContextPaint->GetFillPattern(aOpacity, current) : + aOuterContextPaint->GetStrokePattern(aOpacity, current); if (!pattern) { return false; } diff --git a/layout/svg/nsSVGTextFrame2.h b/layout/svg/nsSVGTextFrame2.h index d4f02c79479..1ccc962ca46 100644 --- a/layout/svg/nsSVGTextFrame2.h +++ b/layout/svg/nsSVGTextFrame2.h @@ -11,7 +11,7 @@ #include "gfxRect.h" #include "gfxSVGGlyphs.h" #include "nsStubMutationObserver.h" -#include "nsSVGGlyphFrame.h" // for SVGTextObjectPaint +#include "nsSVGGlyphFrame.h" // for SVGTextContextPaint #include "nsSVGTextContainerFrame.h" class nsDisplaySVGText; @@ -515,43 +515,43 @@ private: gfxFont::DrawMode SetupCairoState(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - gfxTextObjectPaint** aThisObjectPaint); + gfxTextContextPaint* aOuterContextPaint, + gfxTextContextPaint** aThisContextPaint); /** * Sets up the stroke style for |aFrame| in |aContext| and stores stroke - * pattern information in |aThisObjectPaint|. + * pattern information in |aThisContextPaint|. */ bool SetupCairoStroke(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint* aThisObjectPaint); + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint* aThisContextPaint); /** * Sets up the fill style for |aFrame| in |aContext| and stores fill pattern - * information in |aThisObjectPaint|. + * information in |aThisContextPaint|. */ bool SetupCairoFill(gfxContext* aContext, nsIFrame* aFrame, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint* aThisObjectPaint); + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint* aThisContextPaint); /** * Sets the current pattern for |aFrame| to the fill or stroke style of the - * outer text object. Will also set the paint opacity to transparent if the + * outer text context. Will also set the paint opacity to transparent if the * paint is set to "none". */ - bool SetupObjectPaint(gfxContext* aContext, + bool SetupContextPaint(gfxContext* aContext, nsIFrame* aFrame, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float& aOpacity, - gfxTextObjectPaint* aObjectPaint); + gfxTextContextPaint* aContextPaint); /** * Stores in |aTargetPaint| information on how to reconstruct the current * fill or stroke pattern. Will also set the paint opacity to transparent if * the paint is set to "none". - * @param aOuterObjectPaint pattern information from the outer text object + * @param aOuterContextPaint pattern information from the outer text context * @param aTargetPaint where to store the current pattern information * @param aFillOrStroke member pointer to the paint we are setting up * @param aProperty the frame property descriptor of the fill or stroke paint @@ -560,8 +560,8 @@ private: void SetupInheritablePaint(gfxContext* aContext, nsIFrame* aFrame, float& aOpacity, - gfxTextObjectPaint* aOuterObjectPaint, - SVGTextObjectPaint::Paint& aTargetPaint, + gfxTextContextPaint* aOuterContextPaint, + SVGTextContextPaint::Paint& aTargetPaint, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, const FramePropertyDescriptor* aProperty); diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index e296df7aa93..ab88f742344 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1580,23 +1580,23 @@ MaybeOptimizeOpacity(nsIFrame *aFrame, float aFillOrStrokeOpacity) } /* static */ bool -nsSVGUtils::SetupObjectPaint(gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint, +nsSVGUtils::SetupContextPaint(gfxContext *aContext, + gfxTextContextPaint *aContextPaint, const nsStyleSVGPaint &aPaint, float aOpacity) { nsRefPtr pattern; - if (!aObjectPaint) { + if (!aContextPaint) { return false; } switch (aPaint.mType) { case eStyleSVGPaintType_ObjectFill: - pattern = aObjectPaint->GetFillPattern(aOpacity, aContext->CurrentMatrix()); + pattern = aContextPaint->GetFillPattern(aOpacity, aContext->CurrentMatrix()); break; case eStyleSVGPaintType_ObjectStroke: - pattern = aObjectPaint->GetStrokePattern(aOpacity, aContext->CurrentMatrix()); + pattern = aContextPaint->GetStrokePattern(aOpacity, aContext->CurrentMatrix()); break; default: return false; @@ -1613,7 +1613,7 @@ nsSVGUtils::SetupObjectPaint(gfxContext *aContext, bool nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { const nsStyleSVG* style = aFrame->StyleSVG(); if (style->mFill.mType == eStyleSVGPaintType_None) @@ -1627,13 +1627,13 @@ nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext, float opacity = MaybeOptimizeOpacity(aFrame, GetOpacity(style->mFillOpacitySource, style->mFillOpacity, - aObjectPaint)); + aContextPaint)); nsSVGPaintServerFrame *ps = nsSVGEffects::GetPaintServer(aFrame, &style->mFill, nsSVGEffects::FillProperty()); if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mFill, opacity)) return true; - if (SetupObjectPaint(aContext, aObjectPaint, style->mFill, opacity)) { + if (SetupContextPaint(aContext, aContextPaint, style->mFill, opacity)) { return true; } @@ -1648,7 +1648,7 @@ nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext, bool nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { const nsStyleSVG* style = aFrame->StyleSVG(); if (style->mStroke.mType == eStyleSVGPaintType_None) @@ -1657,14 +1657,14 @@ nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext, float opacity = MaybeOptimizeOpacity(aFrame, GetOpacity(style->mStrokeOpacitySource, style->mStrokeOpacity, - aObjectPaint)); + aContextPaint)); nsSVGPaintServerFrame *ps = nsSVGEffects::GetPaintServer(aFrame, &style->mStroke, nsSVGEffects::StrokeProperty()); if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mStroke, opacity)) return true; - if (SetupObjectPaint(aContext, aObjectPaint, style->mStroke, opacity)) { + if (SetupContextPaint(aContext, aContextPaint, style->mStroke, opacity)) { return true; } @@ -1680,7 +1680,7 @@ nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext, /* static */ float nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType, const float& aOpacity, - gfxTextObjectPaint *aOuterObjectPaint) + gfxTextContextPaint *aOuterContextPaint) { float opacity = 1.0f; switch (aOpacityType) { @@ -1688,40 +1688,40 @@ nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType, opacity = aOpacity; break; case eStyleSVGOpacitySource_ObjectFillOpacity: - if (aOuterObjectPaint) { - opacity = aOuterObjectPaint->GetFillOpacity(); + if (aOuterContextPaint) { + opacity = aOuterContextPaint->GetFillOpacity(); } else { NS_WARNING("objectFillOpacity used outside of an SVG glyph"); } break; case eStyleSVGOpacitySource_ObjectStrokeOpacity: - if (aOuterObjectPaint) { - opacity = aOuterObjectPaint->GetStrokeOpacity(); + if (aOuterContextPaint) { + opacity = aOuterContextPaint->GetStrokeOpacity(); } else { NS_WARNING("objectStrokeOpacity used outside of an SVG glyph"); } break; default: - NS_NOTREACHED("Unknown object opacity inheritance type for SVG glyph"); + NS_NOTREACHED("Unknown context opacity inheritance type for SVG glyph"); } return opacity; } bool -nsSVGUtils::HasStroke(nsIFrame* aFrame, gfxTextObjectPaint *aObjectPaint) +nsSVGUtils::HasStroke(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint) { const nsStyleSVG *style = aFrame->StyleSVG(); return style->mStroke.mType != eStyleSVGPaintType_None && style->mStrokeOpacity > 0 && - GetStrokeWidth(aFrame, aObjectPaint) > 0; + GetStrokeWidth(aFrame, aContextPaint) > 0; } float -nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextObjectPaint *aObjectPaint) +nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint) { const nsStyleSVG *style = aFrame->StyleSVG(); - if (aObjectPaint && style->mStrokeWidthFromObject) { - return aObjectPaint->GetStrokeWidth(); + if (aContextPaint && style->mStrokeWidthFromObject) { + return aContextPaint->GetStrokeWidth(); } nsIContent* content = aFrame->GetContent(); @@ -1737,9 +1737,9 @@ nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextObjectPaint *aObjectPaint) void nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { - float width = GetStrokeWidth(aFrame, aObjectPaint); + float width = GetStrokeWidth(aFrame, aContextPaint); if (width <= 0) return; aContext->SetLineWidth(width); @@ -1780,7 +1780,7 @@ static bool GetStrokeDashData(nsIFrame* aFrame, FallibleTArray& aDashes, gfxFloat* aDashOffset, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { const nsStyleSVG* style = aFrame->StyleSVG(); nsPresContext *presContext = aFrame->PresContext(); @@ -1790,8 +1790,8 @@ GetStrokeDashData(nsIFrame* aFrame, content->GetParent() : content); gfxFloat totalLength = 0.0; - if (aObjectPaint && style->mStrokeDasharrayFromObject) { - aDashes = aObjectPaint->GetStrokeDashArray(); + if (aContextPaint && style->mStrokeDasharrayFromObject) { + aDashes = aContextPaint->GetStrokeDashArray(); for (uint32_t i = 0; i < aDashes.Length(); i++) { if (aDashes[i] < 0.0) { @@ -1829,8 +1829,8 @@ GetStrokeDashData(nsIFrame* aFrame, } } - if (aObjectPaint && style->mStrokeDashoffsetFromObject) { - *aDashOffset = aObjectPaint->GetStrokeDashOffset(); + if (aContextPaint && style->mStrokeDashoffsetFromObject) { + *aDashOffset = aContextPaint->GetStrokeDashOffset(); } else { *aDashOffset = nsSVGUtils::CoordToFloat(presContext, ctx, @@ -1846,13 +1846,13 @@ GetStrokeDashData(nsIFrame* aFrame, void nsSVGUtils::SetupCairoStrokeHitGeometry(nsIFrame* aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { - SetupCairoStrokeGeometry(aFrame, aContext, aObjectPaint); + SetupCairoStrokeGeometry(aFrame, aContext, aContextPaint); AutoFallibleTArray dashes; gfxFloat dashOffset; - if (GetStrokeDashData(aFrame, dashes, &dashOffset, aObjectPaint)) { + if (GetStrokeDashData(aFrame, dashes, &dashOffset, aContextPaint)) { aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset); } } @@ -1918,20 +1918,20 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame) bool nsSVGUtils::SetupCairoStroke(nsIFrame* aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint) + gfxTextContextPaint *aContextPaint) { - if (!HasStroke(aFrame, aObjectPaint)) { + if (!HasStroke(aFrame, aContextPaint)) { return false; } - SetupCairoStrokeHitGeometry(aFrame, aContext, aObjectPaint); + SetupCairoStrokeHitGeometry(aFrame, aContext, aContextPaint); - return SetupCairoStrokePaint(aFrame, aContext, aObjectPaint); + return SetupCairoStrokePaint(aFrame, aContext, aContextPaint); } bool nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext, gfxFont::DrawMode aDrawMode, - gfxTextObjectPaint* aObjectPaint) + gfxTextContextPaint* aContextPaint) { nsIFrame* frame = aElement->GetPrimaryFrame(); nsISVGChildFrame* svgFrame = do_QueryFrame(frame); @@ -1939,7 +1939,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext, if (svgFrame) { nsRenderingContext context; context.Init(frame->PresContext()->DeviceContext(), aContext); - context.AddUserData(&gfxTextObjectPaint::sUserDataKey, aObjectPaint, nullptr); + context.AddUserData(&gfxTextContextPaint::sUserDataKey, aContextPaint, nullptr); nsresult rv = svgFrame->PaintSVG(&context, nullptr); if (NS_SUCCEEDED(rv)) { return true; diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index 74ba1f4d1fb..c4d06273267 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -47,7 +47,7 @@ class nsSVGLength2; class nsSVGOuterSVGFrame; class nsSVGPathGeometryFrame; class nsTextFrame; -class gfxTextObjectPaint; +class gfxTextContextPaint; struct nsStyleSVG; struct nsStyleSVGPaint; @@ -589,8 +589,8 @@ public: /** * Set up cairo context with an object pattern */ - static bool SetupObjectPaint(gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint, + static bool SetupContextPaint(gfxContext *aContext, + gfxTextContextPaint *aContextPaint, const nsStyleSVGPaint& aPaint, float aOpacity); @@ -599,46 +599,46 @@ public: * for the given frame. */ static bool SetupCairoFillPaint(nsIFrame* aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); /** * Sets the current paint on the specified gfxContent to be the SVG 'stroke' * for the given frame. */ static bool SetupCairoStrokePaint(nsIFrame* aFrame, gfxContext* aContext, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); static float GetOpacity(nsStyleSVGOpacitySource aOpacityType, const float& aOpacity, - gfxTextObjectPaint *aOuterObjectPaint); + gfxTextContextPaint *aOuterContextPaint); /* * @return false if there is no stroke */ static bool HasStroke(nsIFrame* aFrame, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); static float GetStrokeWidth(nsIFrame* aFrame, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); /* * Set up a cairo context for measuring a stroked path */ static void SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); /* * Set up a cairo context for hit testing a stroked path */ static void SetupCairoStrokeHitGeometry(nsIFrame* aFrame, gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); /* * Set up a cairo context for stroking, including setting up any stroke-related * properties such as dashing and setting the current paint on the gfxContext. */ static bool SetupCairoStroke(nsIFrame* aFrame, gfxContext *aContext, - gfxTextObjectPaint *aObjectPaint = nullptr); + gfxTextContextPaint *aContextPaint = nullptr); /** * This function returns a set of bit flags indicating which parts of the @@ -657,7 +657,7 @@ public: */ static bool PaintSVGGlyph(Element* aElement, gfxContext* aContext, gfxFont::DrawMode aDrawMode, - gfxTextObjectPaint* aObjectPaint); + gfxTextContextPaint* aContextPaint); /** * Get the extents of a SVG glyph. * @param aElement the SVG glyph element From 2107f8d1f5e6748cdad7c4c1b8b2c72a410027a7 Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Thu, 16 May 2013 14:35:15 +1200 Subject: [PATCH 22/73] Bug 798843 - Rename -moz-objectFill, -moz-objectStroke, -moz-objectValue to context-fill, context-stroke, context-value r=dbaron --- layout/base/nsStyleConsts.h | 10 ++-- layout/reftests/text-svgglyphs/reftest.list | 2 +- .../resources/glyphs-objectcolor.svg | 8 ++-- .../resources/glyphs-objectopacity.svg | 34 +++++++------- .../resources/glyphs-objectstroke.svg | 8 ++-- .../text-svgglyphs/resources/svg.woff | Bin 86088 -> 86280 bytes layout/style/nsCSSKeywordList.h | 10 ++-- layout/style/nsCSSParser.cpp | 29 ++++++++++-- layout/style/nsCSSPropList.h | 22 ++++----- layout/style/nsCSSProps.cpp | 18 ++++---- layout/style/nsCSSProps.h | 6 +-- layout/style/nsComputedDOMStyle.cpp | 8 ++-- layout/style/nsRuleNode.cpp | 43 +++++++++--------- layout/style/nsStyleAnimation.cpp | 8 ++-- layout/style/nsStyleStruct.h | 8 ++-- layout/svg/nsSVGGlyphFrame.cpp | 10 ++-- layout/svg/nsSVGGlyphFrame.h | 4 +- layout/svg/nsSVGTextFrame2.cpp | 8 ++-- layout/svg/nsSVGUtils.cpp | 16 +++---- 19 files changed, 136 insertions(+), 116 deletions(-) diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index 2efcc647303..a3b8fa1ffa6 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -208,8 +208,8 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5 #define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6 // Only valid as paints in SVG glyphs -#define NS_COLOR_OBJECTFILL -7 -#define NS_COLOR_OBJECTSTROKE -8 +#define NS_COLOR_CONTEXT_FILL -7 +#define NS_COLOR_CONTEXT_STROKE -8 // See nsStyleDisplay #define NS_STYLE_ANIMATION_DIRECTION_NORMAL 0 @@ -885,7 +885,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_STROKE_LINEJOIN_BEVEL 2 // stroke-dasharray, stroke-dashoffset, stroke-width -#define NS_STYLE_STROKE_PROP_OBJECTVALUE 0 +#define NS_STYLE_STROKE_PROP_CONTEXT_VALUE 0 // text-anchor #define NS_STYLE_TEXT_ANCHOR_START 0 @@ -915,8 +915,8 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D 1 // object {fill,stroke}-opacity for SVG glyphs -#define NS_STYLE_OBJECT_FILL_OPACITY 0 -#define NS_STYLE_OBJECT_STROKE_OPACITY 1 +#define NS_STYLE_CONTEXT_FILL_OPACITY 0 +#define NS_STYLE_CONTEXT_STROKE_OPACITY 1 /***************************************************************************** * Constants for media features. * diff --git a/layout/reftests/text-svgglyphs/reftest.list b/layout/reftests/text-svgglyphs/reftest.list index 3ed9c3b1f8d..6efa6763d04 100644 --- a/layout/reftests/text-svgglyphs/reftest.list +++ b/layout/reftests/text-svgglyphs/reftest.list @@ -1,5 +1,5 @@ -pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-basic.svg svg-glyph-basic-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-positioning.svg svg-glyph-positioning-ref.svg pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-positioning.svg svg-glyph-positioning-ref.svg pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-html.html svg-glyph-html-ref.svg diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg b/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg index dab58194f39..7f5e5fe769d 100644 --- a/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg +++ b/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg @@ -6,19 +6,19 @@ + stroke="none" fill="context-fill" glyphchar="N"/> + fill="context-fill" stroke="none" glyphchar="O"/> + stroke="context-stroke" fill="burlywood" glyphchar="P"/> + fill="context-stroke" stroke="context-fill" glyphchar="Q"/> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg b/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg index a708885bfc5..35f14e57917 100644 --- a/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg +++ b/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg @@ -5,47 +5,47 @@ --> + fill="context-fill" stroke="context-stroke" + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" glyphchar="R"/> + fill="context-fill" stroke="context-stroke" + fill-opacity="context-stroke-opacity" + stroke-opacity="context-fill-opacity" glyphchar="S"/> + fill="context-stroke" stroke="context-fill" + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" glyphchar="T"/> - + + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" glyphchar="W"/> + fill-opacity="context-stroke-opacity" + stroke-opacity="context-fill-opacity" glyphchar="X"/> diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 8340b1e6ef2..0e08824004f 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -137,6 +137,7 @@ #include "nsIPrompt.h" #include "nsIPropertyBag2.h" #include "nsIDOMPageTransitionEvent.h" +#include "nsIDOMStyleRuleChangeEvent.h" #include "nsIDOMStyleSheetChangeEvent.h" #include "nsIDOMStyleSheetApplicableStateChangeEvent.h" #include "nsJSUtils.h" @@ -202,6 +203,8 @@ #include "nsITextControlElement.h" #include "nsIDOMNSEditableElement.h" #include "nsIEditor.h" +#include "nsIDOMCSSStyleRule.h" +#include "mozilla/css/Rule.h" using namespace mozilla; using namespace mozilla::dom; @@ -3904,8 +3907,6 @@ nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet, } } -#undef DO_STYLESHEET_NOTIFICATION - // These three functions are a lot like the implementation of the // corresponding API for regular stylesheets. @@ -4633,31 +4634,60 @@ nsDocument::DocumentStatesChanged(nsEventStates aStateMask) } void -nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet, +nsDocument::StyleRuleChanged(nsIStyleSheet* aSheet, nsIStyleRule* aOldStyleRule, nsIStyleRule* aNewStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, - (this, aStyleSheet, + (this, aSheet, aOldStyleRule, aNewStyleRule)); + + if (StyleSheetChangeEventsEnabled()) { + nsCOMPtr rule = do_QueryInterface(aNewStyleRule); + DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent, + nsIDOMStyleRuleChangeEvent, + InitStyleRuleChangeEvent, + "StyleRuleChanged", + rule ? rule->GetDOMRule() : nullptr); + } } void -nsDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet, +nsDocument::StyleRuleAdded(nsIStyleSheet* aSheet, nsIStyleRule* aStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, - (this, aStyleSheet, aStyleRule)); + (this, aSheet, aStyleRule)); + + if (StyleSheetChangeEventsEnabled()) { + nsCOMPtr rule = do_QueryInterface(aStyleRule); + DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent, + nsIDOMStyleRuleChangeEvent, + InitStyleRuleChangeEvent, + "StyleRuleAdded", + rule ? rule->GetDOMRule() : nullptr); + } } void -nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, +nsDocument::StyleRuleRemoved(nsIStyleSheet* aSheet, nsIStyleRule* aStyleRule) { NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, - (this, aStyleSheet, aStyleRule)); + (this, aSheet, aStyleRule)); + + if (StyleSheetChangeEventsEnabled()) { + nsCOMPtr rule = do_QueryInterface(aStyleRule); + DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent, + nsIDOMStyleRuleChangeEvent, + InitStyleRuleChangeEvent, + "StyleRuleRemoved", + rule ? rule->GetDOMRule() : nullptr); + } } +#undef DO_STYLESHEET_NOTIFICATION + // // nsIDOMDocument interface diff --git a/dom/interfaces/events/moz.build b/dom/interfaces/events/moz.build index b521ca3e499..797c0cd9cce 100644 --- a/dom/interfaces/events/moz.build +++ b/dom/interfaces/events/moz.build @@ -46,6 +46,7 @@ XPIDL_SOURCES += [ 'nsIDOMScrollAreaEvent.idl', 'nsIDOMSimpleGestureEvent.idl', 'nsIDOMSmartCardEvent.idl', + 'nsIDOMStyleRuleChangeEvent.idl', 'nsIDOMStyleSheetChangeEvent.idl', 'nsIDOMStyleSheetApplicableStateChangeEvent.idl', 'nsIDOMTouchEvent.idl', diff --git a/dom/interfaces/events/nsIDOMStyleRuleChangeEvent.idl b/dom/interfaces/events/nsIDOMStyleRuleChangeEvent.idl new file mode 100644 index 00000000000..a80bee21eb4 --- /dev/null +++ b/dom/interfaces/events/nsIDOMStyleRuleChangeEvent.idl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMEvent.idl" + +interface nsIDOMCSSRule; +interface nsIDOMCSSStyleSheet; + +[scriptable, builtinclass, uuid(36098d39-b471-47e9-976e-33fee3d81467)] +interface nsIDOMStyleRuleChangeEvent : nsIDOMEvent +{ + readonly attribute nsIDOMCSSStyleSheet stylesheet; + readonly attribute nsIDOMCSSRule rule; + [noscript] void initStyleRuleChangeEvent(in DOMString aTypeArg, + in boolean aCanBubbleArg, + in boolean aCancelableArg, + in nsIDOMCSSStyleSheet aStyleSheet, + in nsIDOMCSSRule aRule); +}; + +dictionary StyleRuleChangeEventInit : EventInit +{ + nsIDOMCSSStyleSheet stylesheet; + nsIDOMCSSRule rule; +}; + diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 956fa1add0e..215647dda56 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -546,6 +546,7 @@ var interfaceNamesInGlobalScope = "SpeechRecognitionError", "SpeechSynthesisEvent", "PushManager", + "StyleRuleChangeEvent", "StyleSheetChangeEvent", "StyleSheetApplicableStateChangeEvent", "MozMobileMessageThread", diff --git a/js/xpconnect/src/event_impl_gen.conf.in b/js/xpconnect/src/event_impl_gen.conf.in index eb46501fe41..7e072904cf1 100644 --- a/js/xpconnect/src/event_impl_gen.conf.in +++ b/js/xpconnect/src/event_impl_gen.conf.in @@ -24,6 +24,7 @@ simple_events = [ 'DeviceLightEvent', 'MozApplicationEvent', 'SmartCardEvent', + 'StyleRuleChangeEvent', 'StyleSheetChangeEvent', 'StyleSheetApplicableStateChangeEvent', #ifdef MOZ_B2G_BT diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 349452bb081..3e070a680d8 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -1386,12 +1386,13 @@ StyleRule::Clone() const /* virtual */ nsIDOMCSSRule* StyleRule::GetDOMRule() { - if (!GetStyleSheet()) { - // inline style rules aren't supposed to have a DOM rule object, only - // a declaration. - return nullptr; - } if (!mDOMRule) { + if (!GetStyleSheet()) { + // Inline style rules aren't supposed to have a DOM rule object, only + // a declaration. But if we do have one already, from a style sheet + // rule that used to be in a document, we still want to return it. + return nullptr; + } mDOMRule = new DOMCSSStyleRule(this); NS_ADDREF(mDOMRule); } diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index 48ff6948433..4dbe5bd85e0 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -2035,6 +2035,11 @@ nsCSSStyleSheet::DeleteRule(uint32_t aIndex) nsRefPtr rule = mInner->mOrderedRules.ObjectAt(aIndex); if (rule) { mInner->mOrderedRules.RemoveObjectAt(aIndex); + if (mDocument && mDocument->StyleSheetChangeEventsEnabled()) { + // Force creation of the DOM rule, so that it can be put on the + // StyleRuleRemoved event object. + rule->GetDOMRule(); + } rule->SetStyleSheet(nullptr); DidDirty(); From 9ab31528fe79487740cbaf56b5357b112d6f9ab4 Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Thu, 16 May 2013 09:34:49 +0100 Subject: [PATCH 50/73] Bug 872574 - Some IsEventAttributeName overrides just reimplement exactly the same thing they are overriding. r=jwatt --- content/svg/content/src/SVGAltGlyphElement.cpp | 7 ------- content/svg/content/src/SVGAltGlyphElement.h | 1 - content/svg/content/src/SVGTSpanElement.cpp | 7 ------- content/svg/content/src/SVGTSpanElement.h | 2 -- content/svg/content/src/SVGTextPathElement.cpp | 8 -------- content/svg/content/src/SVGTextPathElement.h | 2 -- 6 files changed, 27 deletions(-) diff --git a/content/svg/content/src/SVGAltGlyphElement.cpp b/content/svg/content/src/SVGAltGlyphElement.cpp index f6f9381132d..0e6a4d97e9e 100644 --- a/content/svg/content/src/SVGAltGlyphElement.cpp +++ b/content/svg/content/src/SVGAltGlyphElement.cpp @@ -5,7 +5,6 @@ #include "mozilla/dom/SVGAltGlyphElement.h" #include "mozilla/dom/SVGAltGlyphElementBinding.h" -#include "nsContentUtils.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(AltGlyph) @@ -85,12 +84,6 @@ SVGAltGlyphElement::IsAttributeMapped(const nsIAtom* name) const SVGAltGlyphElementBase::IsAttributeMapped(name); } -bool -SVGAltGlyphElement::IsEventAttributeName(nsIAtom* aName) -{ - return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic); -} - //---------------------------------------------------------------------- // nsSVGElement overrides diff --git a/content/svg/content/src/SVGAltGlyphElement.h b/content/svg/content/src/SVGAltGlyphElement.h index 23fd688e6e4..74e438b9679 100644 --- a/content/svg/content/src/SVGAltGlyphElement.h +++ b/content/svg/content/src/SVGAltGlyphElement.h @@ -31,7 +31,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; // WebIDL already_AddRefed Href(); diff --git a/content/svg/content/src/SVGTSpanElement.cpp b/content/svg/content/src/SVGTSpanElement.cpp index c6aa5011167..7f40d25d97f 100644 --- a/content/svg/content/src/SVGTSpanElement.cpp +++ b/content/svg/content/src/SVGTSpanElement.cpp @@ -5,7 +5,6 @@ #include "mozilla/dom/SVGTSpanElement.h" #include "mozilla/dom/SVGTSpanElementBinding.h" -#include "nsContentUtils.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TSpan) @@ -52,11 +51,5 @@ SVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const SVGTSpanElementBase::IsAttributeMapped(name); } -bool -SVGTSpanElement::IsEventAttributeName(nsIAtom* aName) -{ - return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic); -} - } // namespace dom } // namespace mozilla diff --git a/content/svg/content/src/SVGTSpanElement.h b/content/svg/content/src/SVGTSpanElement.h index 8cc16006e43..e4aa31271ee 100644 --- a/content/svg/content/src/SVGTSpanElement.h +++ b/content/svg/content/src/SVGTSpanElement.h @@ -30,8 +30,6 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE; virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - - virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; }; } // namespace dom diff --git a/content/svg/content/src/SVGTextPathElement.cpp b/content/svg/content/src/SVGTextPathElement.cpp index 8bd479058d5..f13b06476af 100644 --- a/content/svg/content/src/SVGTextPathElement.cpp +++ b/content/svg/content/src/SVGTextPathElement.cpp @@ -9,7 +9,6 @@ #include "nsGkAtoms.h" #include "nsIFrame.h" #include "nsError.h" -#include "nsContentUtils.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TextPath) @@ -115,13 +114,6 @@ SVGTextPathElement::IsAttributeMapped(const nsIAtom* name) const SVGTextPathElementBase::IsAttributeMapped(name); } - -bool -SVGTextPathElement::IsEventAttributeName(nsIAtom* aName) -{ - return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic); -} - //---------------------------------------------------------------------- // nsSVGElement overrides diff --git a/content/svg/content/src/SVGTextPathElement.h b/content/svg/content/src/SVGTextPathElement.h index 874bb2ac9c6..475a6c8ff67 100644 --- a/content/svg/content/src/SVGTextPathElement.h +++ b/content/svg/content/src/SVGTextPathElement.h @@ -51,8 +51,6 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE; - virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; - // WebIDL already_AddRefed StartOffset(); already_AddRefed Method(); From d645d2e812978c3e581600bbe7b4781c9e96aeaa Mon Sep 17 00:00:00 2001 From: Maria Grazia Alastra Date: Thu, 16 May 2013 08:26:55 -0400 Subject: [PATCH 51/73] Bug 331566 - Change idl interfaces to use @throws instead of @return NS_. r=bsmedberg --- content/base/public/nsISelectionDisplay.idl | 2 -- docshell/base/nsIWebPageDescriptor.idl | 3 +- .../public/nsIWebBrowserPersist.idl | 11 +++---- image/public/imgICache.idl | 3 +- modules/libpref/public/nsIPrefBranch.idl | 32 ++++++------------- .../libpref/public/nsIPrefLocalizedString.idl | 5 +-- modules/libpref/public/nsIPrefService.idl | 11 ++----- rdf/base/idl/nsIRDFDataSource.idl | 20 ++---------- xpcom/base/nsIInterfaceRequestor.idl | 5 ++- xpcom/base/nsIMemory.idl | 2 +- xpcom/components/nsIComponentRegistrar.idl | 3 +- xpcom/components/nsIFactory.idl | 9 ++---- xpcom/ds/nsIProperties.idl | 6 ++-- xpcom/ds/nsISimpleEnumerator.idl | 4 +-- xpcom/io/nsIFile.idl | 2 +- xpcom/io/nsIOutputStream.idl | 4 +-- xpcom/io/nsIUnicharInputStream.idl | 3 +- xpcom/threads/nsITimer.idl | 5 --- 18 files changed, 36 insertions(+), 94 deletions(-) diff --git a/content/base/public/nsISelectionDisplay.idl b/content/base/public/nsISelectionDisplay.idl index 8968ddc4244..87c9ba427af 100644 --- a/content/base/public/nsISelectionDisplay.idl +++ b/content/base/public/nsISelectionDisplay.idl @@ -22,7 +22,6 @@ interface nsISelectionDisplay : nsISupports This will tell the rendering engine to draw the different selection types. - @return NS_OK if successful. */ void setSelectionFlags(in short toggle); @@ -32,7 +31,6 @@ interface nsISelectionDisplay : nsISupports @param short *aReturn - This will be filled with DISPLAY_(TEXT,IMAGE,FRAMES,ALL) bit flags. - @return NS_OK if successful. */ short getSelectionFlags(); diff --git a/docshell/base/nsIWebPageDescriptor.idl b/docshell/base/nsIWebPageDescriptor.idl index 1326d35530a..96db7f34a6b 100644 --- a/docshell/base/nsIWebPageDescriptor.idl +++ b/docshell/base/nsIWebPageDescriptor.idl @@ -18,8 +18,7 @@ interface nsIWebPageDescriptor : nsISupports /** * Tells the object to load the page specified by the page descriptor * - * @return NS_OK - - * NS_ERROR_FAILURE - + * @throws NS_ERROR_FAILURE - */ void loadPage(in nsISupports aPageDescriptor, in unsigned long aDisplayType); diff --git a/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl b/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl index 42fa17697fc..38cafd061e7 100644 --- a/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl +++ b/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl @@ -95,9 +95,8 @@ interface nsIWebBrowserPersist : nsICancelable * Value indicating the success or failure of the persist * operation. * - * @return NS_OK Operation was successful or is still ongoing. - * @return NS_BINDING_ABORTED Operation cancelled. - * @return NS_ERROR_FAILURE Non-specific failure. + * @throws NS_BINDING_ABORTED Operation cancelled. + * @throws NS_ERROR_FAILURE Non-specific failure. */ readonly attribute nsresult result; @@ -141,8 +140,7 @@ interface nsIWebBrowserPersist : nsICancelable * @see nsIURI * @see nsIInputStream * - * @return NS_OK Operation has been started. - * @return NS_ERROR_INVALID_ARG One or more arguments was invalid. + * @throws NS_ERROR_INVALID_ARG One or more arguments was invalid. */ void saveURI(in nsIURI aURI, in nsISupports aCacheKey, in nsIURI aReferrer, in nsIInputStream aPostData, @@ -263,8 +261,7 @@ interface nsIWebBrowserPersist : nsICancelable * @see nsIFile * @see nsIURI * - * @return NS_OK Operation has been started. - * @return NS_ERROR_INVALID_ARG One or more arguments was invalid. + * @throws NS_ERROR_INVALID_ARG One or more arguments was invalid. */ void saveDocument(in nsIDOMDocument aDocument, in nsISupports aFile, in nsISupports aDataPath, diff --git a/image/public/imgICache.idl b/image/public/imgICache.idl index 2ab84f1a465..02fa7b91ab7 100644 --- a/image/public/imgICache.idl +++ b/image/public/imgICache.idl @@ -32,8 +32,7 @@ interface imgICache : nsISupports * Evict images from the cache. * * @param uri The URI to remove. - * @return NS_OK if \a uri was removed from the cache. - * NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from the cache. + * @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from the cache. */ void removeEntry(in nsIURI uri); diff --git a/modules/libpref/public/nsIPrefBranch.idl b/modules/libpref/public/nsIPrefBranch.idl index 22a8244f9a2..4b723461663 100644 --- a/modules/libpref/public/nsIPrefBranch.idl +++ b/modules/libpref/public/nsIPrefBranch.idl @@ -70,8 +70,7 @@ interface nsIPrefBranch : nsISupports * @param aPrefName The boolean preference to set the state of. * @param aValue The boolean value to set the preference to. * - * @return NS_OK The value was successfully set. - * @return Other The value was not set or is the wrong type. + * @throws Error if setting failed or the value is the wrong type. * * @see getBoolPref */ @@ -107,8 +106,7 @@ interface nsIPrefBranch : nsISupports * @param aPrefName The string preference to set. * @param aValue The string value to set the preference to. * - * @return NS_OK The value was successfully set. - * @return Other The value was not set or is the wrong type. + * @throws Error if setting failed or the value is the wrong type. * * @see getCharPref */ @@ -131,8 +129,7 @@ interface nsIPrefBranch : nsISupports * @param aPrefName The integer preference to set the value of. * @param aValue The integer value to set the preference to. * - * @return NS_OK The value was successfully set. - * @return Other The value was not set or is the wrong type. + * @throws Error if setting failed or the value is the wrong type. * * @see getIntPref */ @@ -152,8 +149,7 @@ interface nsIPrefBranch : nsISupports * @param aValue The XPCOM object into which to the complex preference * value should be retrieved. * - * @return NS_OK The value was successfully retrieved. - * @return Other The value does not exist or is the wrong type. + * @throws Error The value does not exist or is the wrong type. * * @see setComplexValue */ @@ -174,8 +170,7 @@ interface nsIPrefBranch : nsISupports * @param aValue The XPCOM object from which to set the complex preference * value. * - * @return NS_OK The value was successfully set. - * @return Other The value was not set or is the wrong type. + * @throws Error if setting failed or the value is the wrong type. * * @see getComplexValue */ @@ -190,8 +185,6 @@ interface nsIPrefBranch : nsISupports * * @note * This method does nothing if this object is a default branch. - * - * @return NS_OK The user preference was successfully cleared. */ void clearUserPref(in string aPrefName); @@ -206,8 +199,7 @@ interface nsIPrefBranch : nsISupports * This method can be called on either a default or user branch but, in * effect, always operates on the default branch. * - * @return NS_OK The preference was successfully locked. - * @return Other The preference does not exist or an error occurred. + * @throws Error The preference does not exist or an error occurred. * * @see unlockPref */ @@ -264,8 +256,7 @@ interface nsIPrefBranch : nsISupports * This method can be called on either a default or user branch but, in * effect, always operates on the default branch. * - * @return NS_OK The preference was successfully unlocked. - * @return Other The preference does not exist or an error occurred. + * @throws Error The preference does not exist or an error occurred. * * @see lockPref */ @@ -283,8 +274,7 @@ interface nsIPrefBranch : nsISupports * This method can be called on either a default or user branch but, in * effect, always operates on both. * - * @return NS_OK The preference(s) were successfully removed. - * @return Other The preference(s) do not exist or an error occurred. + * @throws Error The preference(s) do not exist or an error occurred. */ void deleteBranch(in string aStartingAt); @@ -302,8 +292,7 @@ interface nsIPrefBranch : nsISupports * This method can be called on either a default or user branch but, in * effect, always operates on both. * - * @return NS_OK The preference list was successfully retrieved. - * @return Other The preference(s) do not exist or an error occurred. + * @throws Error The preference(s) do not exist or an error occurred. */ void getChildList(in string aStartingAt, [optional] out unsigned long aCount, @@ -321,8 +310,7 @@ interface nsIPrefBranch : nsISupports * This method can be called on either a default or user branch but, in * effect, always operates on the user branch. * - * @return NS_OK The preference(s) were successfully reset. - * @return Other The preference(s) do not exist or an error occurred. + * @throws Error The preference(s) do not exist or an error occurred. */ void resetBranch(in string aStartingAt); diff --git a/modules/libpref/public/nsIPrefLocalizedString.idl b/modules/libpref/public/nsIPrefLocalizedString.idl index 935ef065665..f99d60f6f26 100644 --- a/modules/libpref/public/nsIPrefLocalizedString.idl +++ b/modules/libpref/public/nsIPrefLocalizedString.idl @@ -22,8 +22,7 @@ interface nsIPrefLocalizedString : nsISupports /** * Provides access to string data stored in this property. * - * @return NS_OK The operation succeeded. - * @return Other An error occurred. + * @throws Error An error occurred. */ attribute wstring data; @@ -45,8 +44,6 @@ interface nsIPrefLocalizedString : nsISupports * * @note * This makes a copy of the string argument passed in. - * - * @return NS_OK The data was successfully stored. */ void setDataWithLength(in unsigned long length, [size_is(length)] in wstring data); diff --git a/modules/libpref/public/nsIPrefService.idl b/modules/libpref/public/nsIPrefService.idl index 9b7c29894d5..e29fc245e56 100644 --- a/modules/libpref/public/nsIPrefService.idl +++ b/modules/libpref/public/nsIPrefService.idl @@ -39,8 +39,7 @@ interface nsIPrefService : nsISupports * If nullptr is passed in for the aFile parameter the default preferences * file(s) [prefs.js, user.js] will be read and processed. * - * @return NS_OK File was read and processed. - * @return Other File failed to read or contained invalid data. + * @throws Error File failed to read or contained invalid data. * * @see savePrefFile * @see nsIFile @@ -50,16 +49,13 @@ interface nsIPrefService : nsISupports /** * Called to completely flush and re-initialize the preferences system. * - * @return NS_OK The preference service was re-initialized correctly. - * @return Other The preference service failed to restart correctly. + * @throws Error The preference service failed to restart correctly. */ void resetPrefs(); /** * Called to reset all preferences with user set values back to the * application default values. - * - * @return NS_OK Always. */ void resetUserPrefs(); @@ -72,8 +68,7 @@ interface nsIPrefService : nsISupports * If nullptr is passed in for the aFile parameter the preference data is * written out to the current preferences file (usually prefs.js.) * - * @return NS_OK File was written. - * @return Other File failed to write. + * @throws Error File failed to write. * * @see readUserPrefs * @see nsIFile diff --git a/rdf/base/idl/nsIRDFDataSource.idl b/rdf/base/idl/nsIRDFDataSource.idl index d22d5c22f94..df383330a99 100644 --- a/rdf/base/idl/nsIRDFDataSource.idl +++ b/rdf/base/idl/nsIRDFDataSource.idl @@ -21,7 +21,7 @@ interface nsIRDFDataSource : nsISupports /** Find an RDF resource that points to a given node over the * specified arc & truth value * - * @return NS_RDF_NO_VALUE if there is no source that leads + * @throws NS_RDF_NO_VALUE if there is no source that leads * to the target with the specified property. */ nsIRDFResource GetSource(in nsIRDFResource aProperty, @@ -31,10 +31,6 @@ interface nsIRDFDataSource : nsISupports /** * Find all RDF resources that point to a given node over the * specified arc & truth value - * - * @return NS_OK unless a catastrophic error occurs. If the - * method returns NS_OK, you may assume that nsISimpleEnumerator points - * to a valid (but possibly empty) cursor. */ nsISimpleEnumerator GetSources(in nsIRDFResource aProperty, in nsIRDFNode aTarget, @@ -44,7 +40,7 @@ interface nsIRDFDataSource : nsISupports * Find a child of that is related to the source by the given arc * arc and truth value * - * @return NS_RDF_NO_VALUE if there is no target accessible from the + * @throws NS_RDF_NO_VALUE if there is no target accessible from the * source via the specified property. */ nsIRDFNode GetTarget(in nsIRDFResource aSource, @@ -54,10 +50,6 @@ interface nsIRDFDataSource : nsISupports /** * Find all children of that are related to the source by the given arc * arc and truth value. - * - * @return NS_OK unless a catastrophic error occurs. If the - * method returns NS_OK, you may assume that nsISimpleEnumerator points - * to a valid (but possibly empty) cursor. */ nsISimpleEnumerator GetTargets(in nsIRDFResource aSource, in nsIRDFResource aProperty, @@ -128,20 +120,12 @@ interface nsIRDFDataSource : nsISupports /** * Get a cursor to iterate over all the arcs that point into a node. - * - * @return NS_OK unless a catastrophic error occurs. If the method - * returns NS_OK, you may assume that labels points to a valid (but - * possible empty) nsISimpleEnumerator object. */ nsISimpleEnumerator ArcLabelsIn(in nsIRDFNode aNode); /** * Get a cursor to iterate over all the arcs that originate in * a resource. - * - * @return NS_OK unless a catastrophic error occurs. If the method - * returns NS_OK, you may assume that labels points to a valid (but - * possible empty) nsISimpleEnumerator object. */ nsISimpleEnumerator ArcLabelsOut(in nsIRDFResource aSource); diff --git a/xpcom/base/nsIInterfaceRequestor.idl b/xpcom/base/nsIInterfaceRequestor.idl index 0220c55e540..9727c53cb39 100644 --- a/xpcom/base/nsIInterfaceRequestor.idl +++ b/xpcom/base/nsIInterfaceRequestor.idl @@ -27,9 +27,8 @@ interface nsIInterfaceRequestor : nsISupports * @param uuid The IID of the interface being requested. * @param result [out] The interface pointer to be filled in if * the interface is accessible. - * @return NS_OK - interface was successfully returned. - * NS_NOINTERFACE - interface not accessible. - * NS_ERROR* - method failure. + * @throws NS_NOINTERFACE - interface not accessible. + * @throws NS_ERROR* - method failure. */ void getInterface(in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result); diff --git a/xpcom/base/nsIMemory.idl b/xpcom/base/nsIMemory.idl index 68b922bc3d5..eac430d1101 100644 --- a/xpcom/base/nsIMemory.idl +++ b/xpcom/base/nsIMemory.idl @@ -90,7 +90,7 @@ interface nsIMemory : nsISupports * immediately if the call was made on the main thread. If * false, the flush will be scheduled to happen when the app is * idle. - * @return NS_ERROR_FAILURE if 'immediate' is set an the call + * @throws NS_ERROR_FAILURE if 'immediate' is set an the call * was not on the application's main thread. */ void heapMinimize(in boolean immediate); diff --git a/xpcom/components/nsIComponentRegistrar.idl b/xpcom/components/nsIComponentRegistrar.idl index 3a944b1e8a1..e12acdf25b1 100644 --- a/xpcom/components/nsIComponentRegistrar.idl +++ b/xpcom/components/nsIComponentRegistrar.idl @@ -62,8 +62,7 @@ interface nsIComponentRegistrar : nsISupports * @param aFactory : Factory previously registered to create instances of * CID aClass. * - * @return NS_OK Unregistration was successful. - * NS_ERROR* Method failure. + * @throws NS_ERROR* Method failure. */ void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory); diff --git a/xpcom/components/nsIFactory.idl b/xpcom/components/nsIFactory.idl index de585999b3b..54152976f99 100644 --- a/xpcom/components/nsIFactory.idl +++ b/xpcom/components/nsIFactory.idl @@ -21,10 +21,8 @@ interface nsIFactory : nsISupports { * @param iid The IID of the interface being requested in * the component which is being currently created. * @param result [out] Pointer to the newly created instance, if successful. - * @return NS_OK - Component successfully created and the interface - * being requested was successfully returned in result. - * NS_NOINTERFACE - Interface not accessible. - * NS_ERROR_NO_AGGREGATION - if an 'outer' object is supplied, but the + * @throws NS_NOINTERFACE - Interface not accessible. + * @throws NS_ERROR_NO_AGGREGATION - if an 'outer' object is supplied, but the * component is not aggregatable. * NS_ERROR* - Method failure. */ @@ -38,8 +36,7 @@ interface nsIFactory : nsISupports { * to release the factory. * * @param lock - Must be PR_TRUE or PR_FALSE - * @return NS_OK - If the lock operation was successful. - * NS_ERROR* - Method failure. + * @throws NS_ERROR* - Method failure. */ void lockFactory(in boolean lock); }; diff --git a/xpcom/ds/nsIProperties.idl b/xpcom/ds/nsIProperties.idl index d2c6ceae5ae..a87e1444384 100644 --- a/xpcom/ds/nsIProperties.idl +++ b/xpcom/ds/nsIProperties.idl @@ -15,8 +15,8 @@ interface nsIProperties : nsISupports /** * Gets a property with a given name. * - * @return NS_ERROR_FAILURE if a property with that name doesn't exist. - * @return NS_ERROR_NO_INTERFACE if the found property fails to QI to the + * @throws NS_ERROR_FAILURE if a property with that name doesn't exist. + * @throws NS_ERROR_NO_INTERFACE if the found property fails to QI to the * given iid. */ void get(in string prop, in nsIIDRef iid, @@ -34,7 +34,7 @@ interface nsIProperties : nsISupports /** * Undefines a property. - * @return NS_ERROR_FAILURE if a property with that name doesn't + * @throws NS_ERROR_FAILURE if a property with that name doesn't * already exist. */ void undefine(in string prop); diff --git a/xpcom/ds/nsISimpleEnumerator.idl b/xpcom/ds/nsISimpleEnumerator.idl index 916c0642f59..cbb0cd2000c 100644 --- a/xpcom/ds/nsISimpleEnumerator.idl +++ b/xpcom/ds/nsISimpleEnumerator.idl @@ -38,9 +38,7 @@ interface nsISimpleEnumerator : nsISupports { * the elements in the enumerator. * * @see hasMoreElements() - * @return NS_OK if the call succeeded in returning a non-null - * value through the out parameter. - * NS_ERROR_FAILURE if there are no more elements + * @throws NS_ERROR_FAILURE if there are no more elements * to enumerate. * @return the next element in the enumeration. */ diff --git a/xpcom/io/nsIFile.idl b/xpcom/io/nsIFile.idl index a3338723e99..0f353ecb4d2 100644 --- a/xpcom/io/nsIFile.idl +++ b/xpcom/io/nsIFile.idl @@ -303,7 +303,7 @@ interface nsIFile : nsISupports * Returns an enumeration of the elements in a directory. Each * element in the enumeration is an nsIFile. * - * @return NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does + * @throws NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does * not specify a directory. */ readonly attribute nsISimpleEnumerator directoryEntries; diff --git a/xpcom/io/nsIOutputStream.idl b/xpcom/io/nsIOutputStream.idl index 80de493d578..d3181c51791 100644 --- a/xpcom/io/nsIOutputStream.idl +++ b/xpcom/io/nsIOutputStream.idl @@ -22,9 +22,7 @@ interface nsIInputStream; * * Implementers should return the following: * - * @return NS_OK and (*aReadCount > 0) if successfully provided some data - * @return NS_OK and (*aReadCount = 0) or - * @return if not interested in providing any data + * @throws if not interested in providing any data * * Errors are never passed to the caller of WriteSegments. */ diff --git a/xpcom/io/nsIUnicharInputStream.idl b/xpcom/io/nsIUnicharInputStream.idl index 8ef2d4fb902..f57557cc905 100644 --- a/xpcom/io/nsIUnicharInputStream.idl +++ b/xpcom/io/nsIUnicharInputStream.idl @@ -22,8 +22,7 @@ interface nsIInputStream; * * Implementers should return the following: * - * @return NS_OK and (*aWriteCount > 0) if consumed some data - * @return if not interested in consuming any data + * @throws if not interested in consuming any data * * Errors are never passed to the caller of ReadSegments. * diff --git a/xpcom/threads/nsITimer.idl b/xpcom/threads/nsITimer.idl index 26feffa9f22..4f65ccc00f1 100644 --- a/xpcom/threads/nsITimer.idl +++ b/xpcom/threads/nsITimer.idl @@ -16,11 +16,6 @@ interface nsIEventTarget; * * @param aTimer the timer which has expired * @param aClosure opaque parameter passed to initWithFuncCallback - * - * Implementers should return the following: - * - * @return NS_OK - * */ class nsITimer; typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure); From 62dbb66e4773e589c87a76170fa99e7090688818 Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Thu, 16 May 2013 11:16:22 +0200 Subject: [PATCH 52/73] Bug 841402 - Remove last piece of EnablePrivilege usage from CSP tests. r=bholley --- content/base/test/file_CSP_frameancestors.sjs | 7 ++----- .../base/test/file_CSP_frameancestors_spec_compliant.sjs | 7 ++----- content/base/test/test_CSP_frameancestors.html | 7 +++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/content/base/test/file_CSP_frameancestors.sjs b/content/base/test/file_CSP_frameancestors.sjs index d3e835e0f50..20dfef97321 100644 --- a/content/base/test/file_CSP_frameancestors.sjs +++ b/content/base/test/file_CSP_frameancestors.sjs @@ -21,13 +21,10 @@ function handleRequest(request, response) if (query['scriptedreport']) { // spit back a script that records that the page loaded response.setHeader("Content-Type", "text/javascript", false); - response.write('netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");'); if (query['double']) - response.write('window.parent.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' + - 'window.location.toString());'); + response.write('window.parent.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");'); else - response.write('window.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' + - 'window.location.toString());'); + response.write('window.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");'); } else if (query['internalframe']) { // spit back an internal iframe (one that might be blocked) response.setHeader("Content-Type", "text/html", false); diff --git a/content/base/test/file_CSP_frameancestors_spec_compliant.sjs b/content/base/test/file_CSP_frameancestors_spec_compliant.sjs index 0008b35d9e9..56d2e283fe3 100644 --- a/content/base/test/file_CSP_frameancestors_spec_compliant.sjs +++ b/content/base/test/file_CSP_frameancestors_spec_compliant.sjs @@ -21,13 +21,10 @@ function handleRequest(request, response) if (query['scriptedreport']) { // spit back a script that records that the page loaded response.setHeader("Content-Type", "text/javascript", false); - response.write('netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");'); if (query['double']) - response.write('window.parent.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' + - 'window.location.toString());'); + response.write('window.parent.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");'); else - response.write('window.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' + - 'window.location.toString());'); + response.write('window.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");'); } else if (query['internalframe']) { // spit back an internal iframe (one that might be blocked) response.setHeader("Content-Type", "text/html", false); diff --git a/content/base/test/test_CSP_frameancestors.html b/content/base/test/test_CSP_frameancestors.html index 847b7cec4c4..60aa2ccacfe 100644 --- a/content/base/test/test_CSP_frameancestors.html +++ b/content/base/test/test_CSP_frameancestors.html @@ -113,6 +113,13 @@ var checkTestResults = function() { SimpleTest.finish(); } +window.addEventListener("message", receiveMessage, false); + +function receiveMessage(event) { + if (event.data.call && event.data.call == 'frameLoaded') + frameLoaded(event.data.testname, event.data.uri); +} + ////////////////////////////////////////////////////////////////////// // set up and go window.examiner = new examiner(); From 4bdbb106c911026e7d381b2961942a83eab261c0 Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Thu, 16 May 2013 11:26:51 +0200 Subject: [PATCH 53/73] Bug 860887 - Having Array.prototype.remove and calling pushPermissions causes exception. r=ted --- dom/devicestorage/test/devicestorage_common.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dom/devicestorage/test/devicestorage_common.js b/dom/devicestorage/test/devicestorage_common.js index 2f7af753622..a732656d241 100644 --- a/dom/devicestorage/test/devicestorage_common.js +++ b/dom/devicestorage/test/devicestorage_common.js @@ -5,12 +5,17 @@ var oldVal = false; -// Array Remove - By John Resig (MIT Licensed) -Array.prototype.remove = function(from, to) { - var rest = this.slice((to || from) + 1 || this.length); - this.length = from < 0 ? this.length + from : from; - return this.push.apply(this, rest); -}; +Object.defineProperty(Array.prototype, "remove", { + enumerable: false, + configurable: false, + writable: false, + value: function(from, to) { + // Array Remove - By John Resig (MIT Licensed) + var rest = this.slice((to || from) + 1 || this.length); + this.length = from < 0 ? this.length + from : from; + return this.push.apply(this, rest); + } +}); function devicestorage_setup() { From 479d0df997195493f848622318e6adffdd141abe Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 28 Apr 2013 14:49:41 +0300 Subject: [PATCH 54/73] Bug 867098 - Don't implicitly convert to already_AddRefed in js/xpconnect/. r=peterv --- js/xpconnect/src/XPCWrappedNative.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index c1a559503e6..65dc890ee61 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -344,11 +344,10 @@ XPCWrappedNative::WrapNewGlobal(XPCCallContext &ccx, xpcObjectHelper &nativeHelp if (!success) return NS_ERROR_FAILURE; - // Construct the wrapper. - nsRefPtr wrapper = new XPCWrappedNative(identity, proto); - - // The wrapper takes over the strong reference to the native object. - nativeHelper.forgetCanonical(); + // Construct the wrapper, which takes over the strong reference to the + // native object. + nsRefPtr wrapper = + new XPCWrappedNative(nativeHelper.forgetCanonical(), proto); // // We don't call ::Init() on this wrapper, because our setup requirements @@ -588,9 +587,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, proto->CacheOffsets(identity); - wrapper = new XPCWrappedNative(identity, proto); - if (!wrapper) - return NS_ERROR_FAILURE; + wrapper = new XPCWrappedNative(helper.forgetCanonical(), proto); } else { AutoMarkingNativeInterfacePtr iface(ccx, Interface); if (!iface) @@ -602,17 +599,12 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, if (!set) return NS_ERROR_FAILURE; - wrapper = new XPCWrappedNative(identity, Scope, set); - if (!wrapper) - return NS_ERROR_FAILURE; + wrapper = + new XPCWrappedNative(helper.forgetCanonical(), Scope, set); DEBUG_ReportShadowedMembers(set, wrapper, nullptr); } - // The strong reference was taken over by the wrapper, so make the nsCOMPtr - // forget about it. - helper.forgetCanonical(); - NS_ASSERTION(!xpc::WrapperFactory::IsXrayWrapper(parent), "Xray wrapper being used to parent XPCWrappedNative?"); From 7f35fbcd56749a967074f4b5bd6c70ad7055fda7 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 17 May 2013 00:34:24 +1200 Subject: [PATCH 55/73] Bug 868082. Allow SetIsFixedPosition to be used on layers with transforms. In CompositorParent, use the animated transform value as the base transform in CompositorParent::TransformFixedLayers when it has been set by the animation sampler. r=cwiis --HG-- extra : rebase_source : 3b809428bf8740753a98defc30ad7b7d96339442 --- gfx/layers/Layers.h | 12 ++++++------ gfx/layers/composite/AsyncCompositionManager.cpp | 16 ++++++++++++++-- gfx/layers/composite/LayerManagerComposite.cpp | 1 + gfx/layers/composite/LayerManagerComposite.h | 6 ++++++ gfx/layers/ipc/CompositorParent.cpp | 1 + layout/base/FrameLayerBuilder.cpp | 7 +------ 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index d8fd283f0fe..7e98b205e17 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -910,6 +910,12 @@ public: uint64_t GetAnimationGeneration() { return mAnimationGeneration; } void SetAnimationGeneration(uint64_t aCount) { mAnimationGeneration = aCount; } + /** + * Returns the local transform for this layer: either mTransform or, + * for shadow layers, GetShadowTransform() + */ + const gfx3DMatrix GetLocalTransform(); + /** * DRAWING PHASE ONLY * @@ -1164,12 +1170,6 @@ protected: // appends additional info to aTo. virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix); - /** - * Returns the local transform for this layer: either mTransform or, - * for shadow layers, GetShadowTransform() - */ - const gfx3DMatrix GetLocalTransform(); - /** * Returns the local opacity for this layer: either mOpacity or, * for shadow layers, GetShadowOpacity() diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 2c70ffb9c71..24cca5ea133 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -169,7 +169,14 @@ AsyncCompositionManager::TransformFixedLayers(Layer* aLayer, // The transform already takes the resolution scale into account. Since we // will apply the resolution scale again when computing the effective // transform, we must apply the inverse resolution scale here. - gfx3DMatrix layerTransform = aLayer->GetTransform(); + LayerComposite* layerComposite = aLayer->AsLayerComposite(); + gfx3DMatrix layerTransform; + if (layerComposite->GetShadowTransformSetByAnimation()) { + // Start with the animated transform + layerTransform = aLayer->GetLocalTransform(); + } else { + layerTransform = aLayer->GetTransform(); + } Translate2D(layerTransform, translation); if (ContainerLayer* c = aLayer->AsContainerLayer()) { layerTransform.Scale(1.0f/c->GetPreXScale(), @@ -179,8 +186,8 @@ AsyncCompositionManager::TransformFixedLayers(Layer* aLayer, layerTransform.ScalePost(1.0f/aLayer->GetPostXScale(), 1.0f/aLayer->GetPostYScale(), 1); - LayerComposite* layerComposite = aLayer->AsLayerComposite(); layerComposite->SetShadowTransform(layerTransform); + layerComposite->SetShadowTransformSetByAnimation(false); const nsIntRect* clipRect = aLayer->GetClipRect(); if (clipRect) { @@ -308,6 +315,7 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint) } NS_ASSERTION(!aLayer->GetIsFixedPosition(), "Can't animate transforms on fixed-position layers"); layerComposite->SetShadowTransform(matrix); + layerComposite->SetShadowTransformSetByAnimation(true); break; } default: @@ -378,6 +386,8 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram 1.0f/aLayer->GetPostYScale(), 1); layerComposite->SetShadowTransform(transform); + NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(), + "overwriting animated transform!"); TransformFixedLayers( aLayer, @@ -512,6 +522,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const gfx3DMatr 1.0f/container->GetPostYScale(), 1); layerComposite->SetShadowTransform(computedTransform); + NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(), + "overwriting animated transform!"); TransformFixedLayers(aLayer, fixedOffset, scaleDiff, fixedLayerMargins); } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index d8cf1c275ec..3e8bf43259c 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -658,6 +658,7 @@ LayerComposite::LayerComposite(LayerManagerComposite *aManager) , mCompositor(aManager->GetCompositor()) , mShadowOpacity(1.0) , mUseShadowClipRect(false) + , mShadowTransformSetByAnimation(false) , mDestroyed(false) { } diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 4787d9fb6d8..f65c86d02f4 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -331,12 +331,17 @@ public: { mShadowTransform = aMatrix; } + void SetShadowTransformSetByAnimation(bool aSetByAnimation) + { + mShadowTransformSetByAnimation = aSetByAnimation; + } // These getters can be used anytime. float GetShadowOpacity() { return mShadowOpacity; } const nsIntRect* GetShadowClipRect() { return mUseShadowClipRect ? &mShadowClipRect : nullptr; } const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; } const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; } + bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; } protected: gfx3DMatrix mShadowTransform; @@ -346,6 +351,7 @@ protected: RefPtr mCompositor; float mShadowOpacity; bool mUseShadowClipRect; + bool mShadowTransformSetByAnimation; bool mDestroyed; }; diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 50d01ac24fd..ab63420c0f2 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -507,6 +507,7 @@ SetShadowProperties(Layer* aLayer) LayerComposite* layerComposite = aLayer->AsLayerComposite(); // Set the layerComposite's base transform to the layer's base transform. layerComposite->SetShadowTransform(aLayer->GetBaseTransform()); + layerComposite->SetShadowTransformSetByAnimation(false); layerComposite->SetShadowVisibleRegion(aLayer->GetVisibleRegion()); layerComposite->SetShadowClipRect(aLayer->GetClipRect()); layerComposite->SetShadowOpacity(aLayer->GetOpacity()); diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 2b3d6517dae..d0745048889 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2147,12 +2147,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, mParameters.mYScale); } - // If a transform layer is marked as fixed then the shadow transform gets - // overwritten by CompositorParent when doing scroll compensation on - // fixed layers. This means we need to make sure transform layers are not - // marked as fixed. - ownLayer->SetIsFixedPosition( - isFixed && item->GetType() != nsDisplayItem::TYPE_TRANSFORM); + ownLayer->SetIsFixedPosition(isFixed); // Update that layer's clip and visible rects. NS_ASSERTION(ownLayer->Manager() == mManager, "Wrong manager"); From f7a6e5b79868590f9f639b5af3226681af4317dd Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Wed, 15 May 2013 16:45:50 -0400 Subject: [PATCH 56/73] Bug 857538 - Diagnostic for HWNDGetter leak. r=ted --- widget/windows/WidgetTraceEvent.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/widget/windows/WidgetTraceEvent.cpp b/widget/windows/WidgetTraceEvent.cpp index a8f72fab40a..6691053d5f9 100644 --- a/widget/windows/WidgetTraceEvent.cpp +++ b/widget/windows/WidgetTraceEvent.cpp @@ -22,6 +22,7 @@ #include "nsAutoPtr.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" +#include "nsTraceRefcnt.h" #include "nsWindowDefs.h" namespace { @@ -33,7 +34,12 @@ HANDLE sEventHandle = NULL; // thread. class HWNDGetter : public nsRunnable { public: - HWNDGetter() : hidden_window_hwnd(NULL) {} + HWNDGetter() : hidden_window_hwnd(NULL) { + MOZ_COUNT_CTOR(HWNDGetter); + } + ~HWNDGetter() { + MOZ_COUNT_DTOR(HWNDGetter); + } HWND hidden_window_hwnd; From 4a68023aa5f953b9818c9d27fbd13b53536a34e4 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Thu, 16 May 2013 09:30:41 -0400 Subject: [PATCH 57/73] bug 871289 [1 of 2] standardize netwerk/protocol/http on moz_assert r=jduell --- netwerk/protocol/http/ASpdySession.cpp | 8 +- .../protocol/http/ConnectionDiagnostics.cpp | 3 +- netwerk/protocol/http/HttpBaseChannel.cpp | 2 +- netwerk/protocol/http/HttpChannelChild.cpp | 13 +- netwerk/protocol/http/HttpChannelParent.cpp | 2 +- .../http/HttpChannelParentListener.cpp | 4 +- netwerk/protocol/http/PHttpChannelParams.h | 4 +- netwerk/protocol/http/SpdySession2.cpp | 158 ++++++++--------- netwerk/protocol/http/SpdySession3.cpp | 160 ++++++++---------- netwerk/protocol/http/SpdyStream2.cpp | 97 +++++------ netwerk/protocol/http/SpdyStream2.h | 2 +- netwerk/protocol/http/SpdyStream3.cpp | 99 +++++------ netwerk/protocol/http/SpdyStream3.h | 2 +- netwerk/protocol/http/nsHttp.cpp | 4 +- netwerk/protocol/http/nsHttpChannel.cpp | 78 ++++----- .../http/nsHttpChannelAuthProvider.cpp | 18 +- netwerk/protocol/http/nsHttpConnection.cpp | 102 ++++++----- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 123 +++++++------- netwerk/protocol/http/nsHttpHandler.cpp | 18 +- netwerk/protocol/http/nsHttpHeaderArray.h | 4 +- netwerk/protocol/http/nsHttpPipeline.cpp | 31 ++-- netwerk/protocol/http/nsHttpResponseHead.cpp | 2 +- netwerk/protocol/http/nsHttpTransaction.cpp | 34 ++-- netwerk/protocol/http/nsHttpTransaction.h | 4 +- 24 files changed, 466 insertions(+), 506 deletions(-) diff --git a/netwerk/protocol/http/ASpdySession.cpp b/netwerk/protocol/http/ASpdySession.cpp index e54b9461729..ffbcab7e36b 100644 --- a/netwerk/protocol/http/ASpdySession.cpp +++ b/netwerk/protocol/http/ASpdySession.cpp @@ -24,9 +24,9 @@ ASpdySession::NewSpdySession(uint32_t version, { // This is a necko only interface, so we can enforce version // requests as a precondition - NS_ABORT_IF_FALSE(version == SpdyInformation::SPDY_VERSION_2 || - version == SpdyInformation::SPDY_VERSION_3, - "Unsupported spdy version"); + MOZ_ASSERT(version == SpdyInformation::SPDY_VERSION_2 || + version == SpdyInformation::SPDY_VERSION_3, + "Unsupported spdy version"); // Don't do a runtime check of IsSpdyV?Enabled() here because pref value // may have changed since starting negotiation. The selected protocol comes @@ -62,7 +62,7 @@ SpdyInformation::ProtocolEnabled(uint32_t index) if (index == 1) return gHttpHandler->IsSpdyV2Enabled(); - NS_ABORT_IF_FALSE(false, "index out of range"); + MOZ_ASSERT(false, "index out of range"); return false; } diff --git a/netwerk/protocol/http/ConnectionDiagnostics.cpp b/netwerk/protocol/http/ConnectionDiagnostics.cpp index ca3f839b448..1bb955dd1d5 100644 --- a/netwerk/protocol/http/ConnectionDiagnostics.cpp +++ b/netwerk/protocol/http/ConnectionDiagnostics.cpp @@ -24,8 +24,7 @@ nsHttpConnectionMgr::PrintDiagnostics() void nsHttpConnectionMgr::OnMsgPrintDiagnostics(int32_t, void *) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsCOMPtr consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID); diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 3c9f034eb56..eefed2f3a42 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -763,7 +763,7 @@ NS_IMPL_ISUPPORTS1(HttpBaseChannel::nsContentEncodings, nsIUTF8StringEnumerator) nsresult HttpBaseChannel::nsContentEncodings::PrepareForNext(void) { - NS_ASSERTION(mCurStart == mCurEnd, "Indeterminate state"); + MOZ_ASSERT(mCurStart == mCurEnd, "Indeterminate state"); // At this point both mCurStart and mCurEnd point to somewhere // past the end of the next thing we want to return diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 5b3628e9305..aec0f9bb516 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -107,7 +107,7 @@ NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel) void HttpChannelChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); mIPCOpen = true; AddRef(); } @@ -115,7 +115,7 @@ HttpChannelChild::AddIPDLReference() void HttpChannelChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); mIPCOpen = false; Release(); } @@ -372,9 +372,8 @@ HttpChannelChild::OnTransportAndData(const nsresult& status, { // OnStatus // - NS_ASSERTION(status == NS_NET_STATUS_RECEIVING_FROM || - status == NS_NET_STATUS_READING, - "unexpected status code"); + MOZ_ASSERT(status == NS_NET_STATUS_RECEIVING_FROM || + status == NS_NET_STATUS_READING); nsAutoCString host; mURI->GetHost(host); @@ -383,7 +382,7 @@ HttpChannelChild::OnTransportAndData(const nsresult& status, // OnProgress // if (progress > 0) { - NS_ASSERTION(progress <= progressMax, "unexpected progress values"); + MOZ_ASSERT(progress <= progressMax, "unexpected progress values"); mProgressSink->OnProgress(this, nullptr, progress, progressMax); } } @@ -522,7 +521,7 @@ HttpChannelChild::OnProgress(const uint64_t& progress, !(mLoadFlags & LOAD_BACKGROUND)) { if (progress > 0) { - NS_ASSERTION(progress <= progressMax, "unexpected progress values"); + MOZ_ASSERT(progress <= progressMax, "unexpected progress values"); mProgressSink->OnProgress(this, nullptr, progress, progressMax); } } diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 9e66298c3df..d59939d2341 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -47,7 +47,7 @@ HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding, // Ensure gHttpHandler is initialized: we need the atom table up and running. nsIHttpProtocolHandler* handler; CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &handler); - NS_ASSERTION(handler, "no http handler"); + MOZ_ASSERT(handler); mTabParent = static_cast(iframeEmbedding); } diff --git a/netwerk/protocol/http/HttpChannelParentListener.cpp b/netwerk/protocol/http/HttpChannelParentListener.cpp index 6427fc263fd..32150fffa12 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.cpp +++ b/netwerk/protocol/http/HttpChannelParentListener.cpp @@ -182,7 +182,7 @@ HttpChannelParentListener::OnRedirectResult(bool succeeded) nsCOMPtr newChannel; rv = registrar->GetRegisteredChannel(mRedirectChannelId, getter_AddRefs(newChannel)); - NS_ASSERTION(newChannel, "Already registered channel not found"); + MOZ_ASSERT(newChannel, "Already registered channel not found"); if (NS_SUCCEEDED(rv)) newChannel->Cancel(NS_BINDING_ABORTED); @@ -197,7 +197,7 @@ HttpChannelParentListener::OnRedirectResult(bool succeeded) nsCOMPtr activeRedirectingChannel = do_QueryInterface(mActiveChannel); - NS_ABORT_IF_FALSE(activeRedirectingChannel, + MOZ_ASSERT(activeRedirectingChannel, "Channel finished a redirect response, but doesn't implement " "nsIParentRedirectingChannel to complete it."); diff --git a/netwerk/protocol/http/PHttpChannelParams.h b/netwerk/protocol/http/PHttpChannelParams.h index efe60b8e01e..0014b203a89 100644 --- a/netwerk/protocol/http/PHttpChannelParams.h +++ b/netwerk/protocol/http/PHttpChannelParams.h @@ -65,7 +65,7 @@ struct ParamTraits static void Write(Message* aMsg, const paramType& aParam) { // aParam.get() cannot be null. - NS_ASSERTION(aParam.get(), "null nsHTTPAtom value"); + MOZ_ASSERT(aParam.get(), "null nsHTTPAtom value"); nsAutoCString value(aParam.get()); WriteParam(aMsg, value); } @@ -77,7 +77,7 @@ struct ParamTraits return false; *aResult = nsHttp::ResolveAtom(value.get()); - NS_ASSERTION(aResult->get(), "atom table not initialized"); + MOZ_ASSERT(aResult->get(), "atom table not initialized"); return true; } }; diff --git a/netwerk/protocol/http/SpdySession2.cpp b/netwerk/protocol/http/SpdySession2.cpp index 4bef2622dfc..73baa3e1045 100644 --- a/netwerk/protocol/http/SpdySession2.cpp +++ b/netwerk/protocol/http/SpdySession2.cpp @@ -63,7 +63,7 @@ SpdySession2::SpdySession2(nsAHttpTransaction *aHttpTransaction, mPingSentEpoch(0), mNextPingID(1) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::SpdySession2 %p transaction 1 = %p", this, aHttpTransaction)); @@ -192,7 +192,7 @@ static Control_FX sControlFunctions[] = bool SpdySession2::RoomForMoreConcurrent() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return (mConcurrent < mMaxConcurrent); } @@ -215,8 +215,8 @@ SpdySession2::IdleTime() void SpdySession2::ReadTimeoutTick(PRIntervalTime now) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mNextPingID & 1, "Ping Counter Not Odd"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mNextPingID & 1, "Ping Counter Not Odd"); if (!mPingThreshold) return; @@ -268,13 +268,12 @@ SpdySession2::ReadTimeoutTick(PRIntervalTime now) uint32_t SpdySession2::RegisterStreamID(SpdyStream2 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::RegisterStreamID session=%p stream=%p id=0x%X " "concurrent=%d",this, stream, mNextStreamID, mConcurrent)); - NS_ABORT_IF_FALSE(mNextStreamID < 0xfffffff0, - "should have stopped admitting streams"); + MOZ_ASSERT(mNextStreamID < 0xfffffff0, "should have stopped admitting streams"); uint32_t result = mNextStreamID; mNextStreamID += 2; @@ -288,7 +287,7 @@ SpdySession2::RegisterStreamID(SpdyStream2 *stream) // integrity check if (mStreamIDHash.Get(result)) { LOG3((" New ID already present\n")); - NS_ABORT_IF_FALSE(false, "New ID already present in mStreamIDHash"); + MOZ_ASSERT(false, "New ID already present in mStreamIDHash"); mShouldGoAway = true; return kDeadStreamID; } @@ -301,12 +300,12 @@ bool SpdySession2::AddStream(nsAHttpTransaction *aHttpTransaction, int32_t aPriority) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // integrity check if (mStreamTransactionHash.Get(aHttpTransaction)) { LOG3((" New transaction already present\n")); - NS_ABORT_IF_FALSE(false, "AddStream duplicate transaction pointer"); + MOZ_ASSERT(false, "AddStream duplicate transaction pointer"); return false; } @@ -341,7 +340,7 @@ SpdySession2::AddStream(nsAHttpTransaction *aHttpTransaction, void SpdySession2::ActivateStream(SpdyStream2 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); mConcurrent++; if (mConcurrent > mConcurrentHighWater) @@ -365,7 +364,7 @@ SpdySession2::ActivateStream(SpdyStream2 *stream) void SpdySession2::ProcessPending() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); while (RoomForMoreConcurrent()) { SpdyStream2 *stream = static_cast(mQueuedStreams.PopFront()); @@ -381,7 +380,7 @@ nsresult SpdySession2::NetworkRead(nsAHttpSegmentWriter *writer, char *buf, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (!count) { *countWritten = 0; @@ -459,7 +458,7 @@ SpdySession2::DontReuse() uint32_t SpdySession2::GetWriteQueueSize() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return mUrgentForWrite.GetSize() + mReadyForWrite.GetSize(); } @@ -467,7 +466,7 @@ SpdySession2::GetWriteQueueSize() void SpdySession2::ChangeDownstreamState(enum stateType newState) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream2::ChangeDownstreamState() %p from %X to %X", this, mDownstreamState, newState)); @@ -477,7 +476,7 @@ SpdySession2::ChangeDownstreamState(enum stateType newState) void SpdySession2::ResetDownstreamState() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream2::ResetDownstreamState() %p", this)); ChangeDownstreamState(BUFFERING_FRAME_HEADER); @@ -749,7 +748,7 @@ SpdySession2::ConvertHeaders(nsDependentCSubstring &status, void SpdySession2::GeneratePing(uint32_t aID) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::GeneratePing %p 0x%X\n", this, aID)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12, @@ -775,7 +774,7 @@ SpdySession2::GeneratePing(uint32_t aID) void SpdySession2::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::GenerateRst %p 0x%X %d\n", this, aID, aStatusCode)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16, @@ -803,7 +802,7 @@ SpdySession2::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) void SpdySession2::GenerateGoAway() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::GenerateGoAway %p\n", this)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12, @@ -829,7 +828,7 @@ bool SpdySession2::VerifyStream(SpdyStream2 *aStream, uint32_t aOptionalID = 0) { // This is annoying, but at least it is O(1) - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); #ifndef DEBUG // Only do the real verification in debug builds @@ -877,7 +876,7 @@ SpdySession2::VerifyStream(SpdyStream2 *aStream, uint32_t aOptionalID = 0) "optionalID=0x%x trans=%p test=%d\n", this, aStream, aStream->StreamID(), aOptionalID, aStream->Transaction(), test)); - NS_ABORT_IF_FALSE(false, "VerifyStream"); + MOZ_ASSERT(false, "VerifyStream"); return false; } @@ -885,7 +884,7 @@ void SpdySession2::CleanupStream(SpdyStream2 *aStream, nsresult aResult, rstReason aResetCode) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::CleanupStream %p %p 0x%x %X\n", this, aStream, aStream->StreamID(), aResult)); @@ -920,7 +919,7 @@ SpdySession2::CleanupStream(SpdyStream2 *aStream, nsresult aResult, void SpdySession2::CloseStream(SpdyStream2 *aStream, nsresult aResult) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::CloseStream %p %p 0x%x %X\n", this, aStream, aStream->StreamID(), aResult)); @@ -965,8 +964,7 @@ SpdySession2::CloseStream(SpdyStream2 *aStream, nsresult aResult) nsresult SpdySession2::HandleSynStream(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM); if (self->mInputFrameDataSize < 18) { LOG3(("SpdySession2::HandleSynStream %p SYN_STREAM too short data=%d", @@ -1027,8 +1025,7 @@ SpdySession2::SetInputFrameDataStream(uint32_t streamID) nsresult SpdySession2::HandleSynReply(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY); if (self->mInputFrameDataSize < 8) { LOG3(("SpdySession2::HandleSynReply %p SYN REPLY too short data=%d", @@ -1144,8 +1141,7 @@ SpdySession2::HandleSynReplyForValidStream() nsresult SpdySession2::HandleRstStream(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_RST_STREAM, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_RST_STREAM); if (self->mInputFrameDataSize != 8) { LOG3(("SpdySession2::HandleRstStream %p RST_STREAM wrong length data=%d", @@ -1199,8 +1195,7 @@ SpdySession2::HandleRstStream(SpdySession2 *self) nsresult SpdySession2::HandleSettings(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SETTINGS, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SETTINGS); if (self->mInputFrameDataSize < 4) { LOG3(("SpdySession2::HandleSettings %p SETTINGS wrong length data=%d", @@ -1282,8 +1277,7 @@ SpdySession2::HandleSettings(SpdySession2 *self) nsresult SpdySession2::HandleNoop(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_NOOP, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_NOOP); if (self->mInputFrameDataSize != 0) { LOG3(("SpdySession2::HandleNoop %p NOP had data %d", @@ -1300,8 +1294,7 @@ SpdySession2::HandleNoop(SpdySession2 *self) nsresult SpdySession2::HandlePing(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_PING, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_PING); if (self->mInputFrameDataSize != 4) { LOG3(("SpdySession2::HandlePing %p PING had wrong amount of data %d", @@ -1330,8 +1323,7 @@ SpdySession2::HandlePing(SpdySession2 *self) nsresult SpdySession2::HandleGoAway(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_GOAWAY, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_GOAWAY); if (self->mInputFrameDataSize != 4) { LOG3(("SpdySession2::HandleGoAway %p GOAWAY had wrong amount of data %d", @@ -1383,8 +1375,7 @@ SpdySession2::HandleGoAway(SpdySession2 *self) nsresult SpdySession2::HandleHeaders(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_HEADERS, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_HEADERS); if (self->mInputFrameDataSize < 10) { LOG3(("SpdySession2::HandleHeaders %p HEADERS had wrong amount of data %d", @@ -1412,8 +1403,8 @@ SpdySession2::HandleHeaders(SpdySession2 *self) nsresult SpdySession2::HandleWindowUpdate(SpdySession2 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE); + LOG3(("SpdySession2::HandleWindowUpdate %p WINDOW UPDATE was " "received. WINDOW UPDATE is no longer defined in v2. Ignoring.", self)); @@ -1432,7 +1423,7 @@ SpdySession2::OnTransportStatus(nsITransport* aTransport, nsresult aStatus, uint64_t aProgress) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); switch (aStatus) { // These should appear only once, deliver to the first @@ -1487,10 +1478,10 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, uint32_t count, uint32_t *countRead) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - NS_ABORT_IF_FALSE(!mSegmentReader || !reader || (mSegmentReader == reader), - "Inconsistent Write Function Callback"); + MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader), + "Inconsistent Write Function Callback"); if (reader) mSegmentReader = reader; @@ -1594,7 +1585,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; *countWritten = 0; @@ -1613,8 +1604,8 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, // we are going to want to strip before passing to http. That is // true of both control and data packets. - NS_ABORT_IF_FALSE(mInputFrameBufferUsed < 8, - "Frame Buffer Used Too Large for State"); + MOZ_ASSERT(mInputFrameBufferUsed < 8, + "Frame Buffer Used Too Large for State"); rv = NetworkRead(writer, mInputFrameBuffer + mInputFrameBufferUsed, 8 - mInputFrameBufferUsed, countWritten); @@ -1741,7 +1732,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, // The cleanup stream should only be set while stream->WriteSegments is // on the stack and then cleaned up in this code block afterwards. - NS_ABORT_IF_FALSE(!mNeedsCleanup, "cleanup stream set unexpectedly"); + MOZ_ASSERT(!mNeedsCleanup, "cleanup stream set unexpectedly"); mNeedsCleanup = nullptr; /* just in case */ mSegmentWriter = writer; @@ -1762,7 +1753,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, this, stream, stream ? stream->StreamID() : 0, mNeedsCleanup)); CleanupStream(stream, NS_OK, RST_CANCEL); - NS_ABORT_IF_FALSE(!mNeedsCleanup, "double cleanup out of data frame"); + MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame"); mNeedsCleanup = nullptr; /* just in case */ return NS_OK; } @@ -1811,12 +1802,12 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, if (mDownstreamState != BUFFERING_CONTROL_FRAME) { // this cannot happen - NS_ABORT_IF_FALSE(false, "Not in Bufering Control Frame State"); + MOZ_ASSERT(false, "Not in Bufering Control Frame State"); return NS_ERROR_UNEXPECTED; } - NS_ABORT_IF_FALSE(mInputFrameBufferUsed == 8, - "Frame Buffer Header Not Present"); + MOZ_ASSERT(mInputFrameBufferUsed == 8, + "Frame Buffer Header Not Present"); rv = NetworkRead(writer, mInputFrameBuffer + 8 + mInputFrameDataRead, mInputFrameDataSize - mInputFrameDataRead, countWritten); @@ -1844,14 +1835,14 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, if (mFrameControlType >= CONTROL_TYPE_LAST || mFrameControlType <= CONTROL_TYPE_FIRST) { - NS_ABORT_IF_FALSE(false, "control type out of range"); + MOZ_ASSERT(false, "control type out of range"); return NS_ERROR_ILLEGAL_VALUE; } rv = sControlFunctions[mFrameControlType](this); - NS_ABORT_IF_FALSE(NS_FAILED(rv) || - mDownstreamState != BUFFERING_CONTROL_FRAME, - "Control Handler returned OK but did not change state"); + MOZ_ASSERT(NS_FAILED(rv) || + mDownstreamState != BUFFERING_CONTROL_FRAME, + "Control Handler returned OK but did not change state"); if (mShouldGoAway && !mStreamTransactionHash.Count()) Close(NS_OK); @@ -1861,7 +1852,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, void SpdySession2::Close(nsresult aReason) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mClosed) return; @@ -1885,7 +1876,7 @@ void SpdySession2::CloseTransaction(nsAHttpTransaction *aTransaction, nsresult aResult) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::CloseTransaction %p %p %x", this, aTransaction, aResult)); // Generally this arrives as a cancel event from the connection manager. @@ -1914,7 +1905,7 @@ SpdySession2::OnReadSegment(const char *buf, uint32_t count, uint32_t *countRead) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; @@ -1996,9 +1987,8 @@ SpdySession2::CommitToSegmentSize(uint32_t count, bool forceCommitment) EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + count + kQueueReserved, mOutputQueueUsed, mOutputQueueSize); - NS_ABORT_IF_FALSE((mOutputQueueUsed + count) <= - (mOutputQueueSize - kQueueReserved), - "buffer not as large as expected"); + MOZ_ASSERT((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved), + "buffer not as large as expected"); return NS_OK; } @@ -2012,7 +2002,7 @@ SpdySession2::OnWriteSegment(char *buf, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; if (!mSegmentWriter) { @@ -2082,7 +2072,7 @@ SpdySession2::SetNeedsCleanup() mInputFrameDataStream->StreamID())); // This will result in Close() being called - NS_ABORT_IF_FALSE(!mNeedsCleanup, "mNeedsCleanup unexpectedly set"); + MOZ_ASSERT(!mNeedsCleanup, "mNeedsCleanup unexpectedly set"); mNeedsCleanup = mInputFrameDataStream; ResetDownstreamState(); } @@ -2094,7 +2084,7 @@ SpdySession2::SetNeedsCleanup() void SpdySession2::TransactionHasDataToWrite(nsAHttpTransaction *caller) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::TransactionHasDataToWrite %p trans=%p", this, caller)); // a trapped signal from the http transaction to the connection that @@ -2116,7 +2106,7 @@ SpdySession2::TransactionHasDataToWrite(nsAHttpTransaction *caller) void SpdySession2::TransactionHasDataToWrite(SpdyStream2 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession2::TransactionHasDataToWrite %p stream=%p ID=%x", this, stream, stream->StreamID())); @@ -2135,14 +2125,14 @@ SpdySession2::TakeTransport(nsISocketTransport **, nsIAsyncInputStream **, nsIAsyncOutputStream **) { - NS_ABORT_IF_FALSE(false, "TakeTransport of SpdySession2"); + MOZ_ASSERT(false, "TakeTransport of SpdySession2"); return NS_ERROR_UNEXPECTED; } nsHttpConnection * SpdySession2::TakeHttpConnection() { - NS_ABORT_IF_FALSE(false, "TakeHttpConnection of SpdySession2"); + MOZ_ASSERT(false, "TakeHttpConnection of SpdySession2"); return nullptr; } @@ -2171,20 +2161,20 @@ void SpdySession2::SetConnection(nsAHttpConnection *) { // This is unexpected - NS_ABORT_IF_FALSE(false, "SpdySession2::SetConnection()"); + MOZ_ASSERT(false, "SpdySession2::SetConnection()"); } void SpdySession2::GetSecurityCallbacks(nsIInterfaceRequestor **) { // This is unexpected - NS_ABORT_IF_FALSE(false, "SpdySession2::GetSecurityCallbacks()"); + MOZ_ASSERT(false, "SpdySession2::GetSecurityCallbacks()"); } void SpdySession2::SetProxyConnectFailed() { - NS_ABORT_IF_FALSE(false, "SpdySession2::SetProxyConnectFailed()"); + MOZ_ASSERT(false, "SpdySession2::SetProxyConnectFailed()"); } bool @@ -2196,31 +2186,31 @@ SpdySession2::IsDone() nsresult SpdySession2::Status() { - NS_ABORT_IF_FALSE(false, "SpdySession2::Status()"); + MOZ_ASSERT(false, "SpdySession2::Status()"); return NS_ERROR_UNEXPECTED; } uint32_t SpdySession2::Caps() { - NS_ABORT_IF_FALSE(false, "SpdySession2::Caps()"); + MOZ_ASSERT(false, "SpdySession2::Caps()"); return 0; } uint64_t SpdySession2::Available() { - NS_ABORT_IF_FALSE(false, "SpdySession2::Available()"); + MOZ_ASSERT(false, "SpdySession2::Available()"); return 0; } nsHttpRequestHead * SpdySession2::RequestHead() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(false, - "SpdySession2::RequestHead() " - "should not be called after SPDY is setup"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(false, + "SpdySession2::RequestHead() " + "should not be called after SPDY is setup"); return NULL; } @@ -2270,8 +2260,8 @@ SpdySession2::AddTransaction(nsAHttpTransaction *) // This API is meant for pipelining, SpdySession2's should be // extended with AddStream() - NS_ABORT_IF_FALSE(false, - "SpdySession2::AddTransaction() should not be called"); + MOZ_ASSERT(false, + "SpdySession2::AddTransaction() should not be called"); return NS_ERROR_NOT_IMPLEMENTED; } @@ -2288,8 +2278,8 @@ SpdySession2::SetPipelinePosition(int32_t position) // This API is meant for pipelining, SpdySession2's should be // extended with AddStream() - NS_ABORT_IF_FALSE(false, - "SpdySession2::SetPipelinePosition() should not be called"); + MOZ_ASSERT(false, + "SpdySession2::SetPipelinePosition() should not be called"); return NS_ERROR_NOT_IMPLEMENTED; } @@ -2307,7 +2297,7 @@ SpdySession2::PipelinePosition() nsAHttpConnection * SpdySession2::Connection() { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return mConnection; } diff --git a/netwerk/protocol/http/SpdySession3.cpp b/netwerk/protocol/http/SpdySession3.cpp index 831e5836f94..13bec7d62f0 100644 --- a/netwerk/protocol/http/SpdySession3.cpp +++ b/netwerk/protocol/http/SpdySession3.cpp @@ -63,7 +63,7 @@ SpdySession3::SpdySession3(nsAHttpTransaction *aHttpTransaction, mPingSentEpoch(0), mNextPingID(1) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::SpdySession3 %p transaction 1 = %p", this, aHttpTransaction)); @@ -193,7 +193,7 @@ static Control_FX sControlFunctions[] = bool SpdySession3::RoomForMoreConcurrent() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return (mConcurrent < mMaxConcurrent); } @@ -216,8 +216,8 @@ SpdySession3::IdleTime() void SpdySession3::ReadTimeoutTick(PRIntervalTime now) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mNextPingID & 1, "Ping Counter Not Odd"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mNextPingID & 1, "Ping Counter Not Odd"); if (!mPingThreshold) return; @@ -269,13 +269,13 @@ SpdySession3::ReadTimeoutTick(PRIntervalTime now) uint32_t SpdySession3::RegisterStreamID(SpdyStream3 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::RegisterStreamID session=%p stream=%p id=0x%X " "concurrent=%d",this, stream, mNextStreamID, mConcurrent)); - NS_ABORT_IF_FALSE(mNextStreamID < 0xfffffff0, - "should have stopped admitting streams"); + MOZ_ASSERT(mNextStreamID < 0xfffffff0, + "should have stopped admitting streams"); uint32_t result = mNextStreamID; mNextStreamID += 2; @@ -289,7 +289,7 @@ SpdySession3::RegisterStreamID(SpdyStream3 *stream) // integrity check if (mStreamIDHash.Get(result)) { LOG3((" New ID already present\n")); - NS_ABORT_IF_FALSE(false, "New ID already present in mStreamIDHash"); + MOZ_ASSERT(false, "New ID already present in mStreamIDHash"); mShouldGoAway = true; return kDeadStreamID; } @@ -302,12 +302,12 @@ bool SpdySession3::AddStream(nsAHttpTransaction *aHttpTransaction, int32_t aPriority) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // integrity check if (mStreamTransactionHash.Get(aHttpTransaction)) { LOG3((" New transaction already present\n")); - NS_ABORT_IF_FALSE(false, "AddStream duplicate transaction pointer"); + MOZ_ASSERT(false, "AddStream duplicate transaction pointer"); return false; } @@ -341,7 +341,7 @@ SpdySession3::AddStream(nsAHttpTransaction *aHttpTransaction, void SpdySession3::ActivateStream(SpdyStream3 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); mConcurrent++; if (mConcurrent > mConcurrentHighWater) @@ -365,7 +365,7 @@ SpdySession3::ActivateStream(SpdyStream3 *stream) void SpdySession3::ProcessPending() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); while (RoomForMoreConcurrent()) { SpdyStream3 *stream = static_cast(mQueuedStreams.PopFront()); @@ -381,7 +381,7 @@ nsresult SpdySession3::NetworkRead(nsAHttpSegmentWriter *writer, char *buf, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (!count) { *countWritten = 0; @@ -459,7 +459,7 @@ SpdySession3::DontReuse() uint32_t SpdySession3::GetWriteQueueSize() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return mReadyForWrite.GetSize(); } @@ -467,7 +467,7 @@ SpdySession3::GetWriteQueueSize() void SpdySession3::ChangeDownstreamState(enum stateType newState) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream3::ChangeDownstreamState() %p from %X to %X", this, mDownstreamState, newState)); @@ -477,7 +477,7 @@ SpdySession3::ChangeDownstreamState(enum stateType newState) void SpdySession3::ResetDownstreamState() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream3::ResetDownstreamState() %p", this)); ChangeDownstreamState(BUFFERING_FRAME_HEADER); @@ -587,7 +587,7 @@ SpdySession3::UncompressAndDiscard(uint32_t offset, void SpdySession3::GeneratePing(uint32_t aID) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::GeneratePing %p 0x%X\n", this, aID)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 12, @@ -614,7 +614,7 @@ SpdySession3::GeneratePing(uint32_t aID) void SpdySession3::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::GenerateRst %p 0x%X %d\n", this, aID, aStatusCode)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16, @@ -643,7 +643,7 @@ SpdySession3::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) void SpdySession3::GenerateGoAway(uint32_t aStatusCode) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::GenerateGoAway %p code=%X\n", this, aStatusCode)); EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 16, @@ -671,7 +671,7 @@ SpdySession3::GenerateGoAway(uint32_t aStatusCode) void SpdySession3::GenerateSettings() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::GenerateSettings %p\n", this)); static const uint32_t maxDataLen = 4 + 3 * 8; // sized for 3 settings @@ -731,7 +731,7 @@ bool SpdySession3::VerifyStream(SpdyStream3 *aStream, uint32_t aOptionalID = 0) { // This is annoying, but at least it is O(1) - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); #ifndef DEBUG // Only do the real verification in debug builds @@ -779,7 +779,7 @@ SpdySession3::VerifyStream(SpdyStream3 *aStream, uint32_t aOptionalID = 0) "optionalID=0x%X trans=%p test=%d\n", this, aStream, aStream->StreamID(), aOptionalID, aStream->Transaction(), test)); - NS_ABORT_IF_FALSE(false, "VerifyStream"); + MOZ_ASSERT(false, "VerifyStream"); return false; } @@ -787,7 +787,7 @@ void SpdySession3::CleanupStream(SpdyStream3 *aStream, nsresult aResult, rstReason aResetCode) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::CleanupStream %p %p 0x%X %X\n", this, aStream, aStream->StreamID(), aResult)); @@ -822,7 +822,7 @@ SpdySession3::CleanupStream(SpdyStream3 *aStream, nsresult aResult, void SpdySession3::CloseStream(SpdyStream3 *aStream, nsresult aResult) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::CloseStream %p %p 0x%x %X\n", this, aStream, aStream->StreamID(), aResult)); @@ -858,8 +858,7 @@ SpdySession3::CloseStream(SpdyStream3 *aStream, nsresult aResult) nsresult SpdySession3::HandleSynStream(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM); if (self->mInputFrameDataSize < 18) { LOG3(("SpdySession3::HandleSynStream %p SYN_STREAM too short data=%d", @@ -920,8 +919,7 @@ SpdySession3::SetInputFrameDataStream(uint32_t streamID) nsresult SpdySession3::HandleSynReply(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_REPLY); if (self->mInputFrameDataSize < 4) { LOG3(("SpdySession3::HandleSynReply %p SYN REPLY too short data=%d", @@ -1054,8 +1052,7 @@ SpdySession3::ResponseHeadersComplete() nsresult SpdySession3::HandleRstStream(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_RST_STREAM, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_RST_STREAM); if (self->mInputFrameDataSize != 8) { LOG3(("SpdySession3::HandleRstStream %p RST_STREAM wrong length data=%d", @@ -1120,8 +1117,7 @@ SpdySession3::UpdateServerRwinEnumerator(nsAHttpTransaction *key, nsresult SpdySession3::HandleSettings(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SETTINGS, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SETTINGS); if (self->mInputFrameDataSize < 4) { LOG3(("SpdySession3::HandleSettings %p SETTINGS wrong length data=%d", @@ -1213,8 +1209,7 @@ SpdySession3::HandleSettings(SpdySession3 *self) nsresult SpdySession3::HandleNoop(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_NOOP, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_NOOP); // Should not be receiving noop frames in spdy/3, so we'll just // make a log and ignore it @@ -1228,8 +1223,7 @@ SpdySession3::HandleNoop(SpdySession3 *self) nsresult SpdySession3::HandlePing(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_PING, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_PING); if (self->mInputFrameDataSize != 4) { LOG3(("SpdySession3::HandlePing %p PING had wrong amount of data %d", @@ -1258,8 +1252,7 @@ SpdySession3::HandlePing(SpdySession3 *self) nsresult SpdySession3::HandleGoAway(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_GOAWAY, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_GOAWAY); if (self->mInputFrameDataSize != 8) { LOG3(("SpdySession3::HandleGoAway %p GOAWAY had wrong amount of data %d", @@ -1313,8 +1306,7 @@ SpdySession3::HandleGoAway(SpdySession3 *self) nsresult SpdySession3::HandleHeaders(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_HEADERS, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_HEADERS); if (self->mInputFrameDataSize < 4) { LOG3(("SpdySession3::HandleHeaders %p HEADERS had wrong amount of data %d", @@ -1392,8 +1384,7 @@ SpdySession3::HandleHeaders(SpdySession3 *self) nsresult SpdySession3::HandleWindowUpdate(SpdySession3 *self) { - NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE, - "wrong control type"); + MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_WINDOW_UPDATE); if (self->mInputFrameDataSize < 8) { LOG3(("SpdySession3::HandleWindowUpdate %p Window Update wrong length %d\n", @@ -1452,7 +1443,7 @@ SpdySession3::OnTransportStatus(nsITransport* aTransport, nsresult aStatus, uint64_t aProgress) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); switch (aStatus) { // These should appear only once, deliver to the first @@ -1507,10 +1498,10 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, uint32_t count, uint32_t *countRead) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - NS_ABORT_IF_FALSE(!mSegmentReader || !reader || (mSegmentReader == reader), - "Inconsistent Write Function Callback"); + MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader), + "Inconsistent Write Function Callback"); if (reader) mSegmentReader = reader; @@ -1613,7 +1604,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; *countWritten = 0; @@ -1632,8 +1623,8 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, // we are going to want to strip before passing to http. That is // true of both control and data packets. - NS_ABORT_IF_FALSE(mInputFrameBufferUsed < 8, - "Frame Buffer Used Too Large for State"); + MOZ_ASSERT(mInputFrameBufferUsed < 8, + "Frame Buffer Used Too Large for State"); rv = NetworkRead(writer, mInputFrameBuffer + mInputFrameBufferUsed, 8 - mInputFrameBufferUsed, countWritten); @@ -1779,7 +1770,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, // The cleanup stream should only be set while stream->WriteSegments is // on the stack and then cleaned up in this code block afterwards. - NS_ABORT_IF_FALSE(!mNeedsCleanup, "cleanup stream set unexpectedly"); + MOZ_ASSERT(!mNeedsCleanup, "cleanup stream set unexpectedly"); mNeedsCleanup = nullptr; /* just in case */ mSegmentWriter = writer; @@ -1805,7 +1796,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, this, stream, stream ? stream->StreamID() : 0, mNeedsCleanup)); CleanupStream(stream, NS_OK, RST_CANCEL); - NS_ABORT_IF_FALSE(!mNeedsCleanup, "double cleanup out of data frame"); + MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame"); mNeedsCleanup = nullptr; /* just in case */ return NS_OK; } @@ -1852,12 +1843,12 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, if (mDownstreamState != BUFFERING_CONTROL_FRAME) { // this cannot happen - NS_ABORT_IF_FALSE(false, "Not in Bufering Control Frame State"); + MOZ_ASSERT(false, "Not in Bufering Control Frame State"); return NS_ERROR_UNEXPECTED; } - NS_ABORT_IF_FALSE(mInputFrameBufferUsed == 8, - "Frame Buffer Header Not Present"); + MOZ_ASSERT(mInputFrameBufferUsed == 8, + "Frame Buffer Header Not Present"); rv = NetworkRead(writer, mInputFrameBuffer + 8 + mInputFrameDataRead, mInputFrameDataSize - mInputFrameDataRead, countWritten); @@ -1885,14 +1876,14 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, if (mFrameControlType >= CONTROL_TYPE_LAST || mFrameControlType <= CONTROL_TYPE_FIRST) { - NS_ABORT_IF_FALSE(false, "control type out of range"); + MOZ_ASSERT(false, "control type out of range"); return NS_ERROR_ILLEGAL_VALUE; } rv = sControlFunctions[mFrameControlType](this); - NS_ABORT_IF_FALSE(NS_FAILED(rv) || - mDownstreamState != BUFFERING_CONTROL_FRAME, - "Control Handler returned OK but did not change state"); + MOZ_ASSERT(NS_FAILED(rv) || + mDownstreamState != BUFFERING_CONTROL_FRAME, + "Control Handler returned OK but did not change state"); if (mShouldGoAway && !mStreamTransactionHash.Count()) Close(NS_OK); @@ -1956,7 +1947,7 @@ SpdySession3::UpdateLocalRwin(SpdyStream3 *stream, void SpdySession3::Close(nsresult aReason) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mClosed) return; @@ -1980,7 +1971,7 @@ void SpdySession3::CloseTransaction(nsAHttpTransaction *aTransaction, nsresult aResult) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::CloseTransaction %p %p %x", this, aTransaction, aResult)); // Generally this arrives as a cancel event from the connection manager. @@ -2009,7 +2000,7 @@ SpdySession3::OnReadSegment(const char *buf, uint32_t count, uint32_t *countRead) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; @@ -2091,9 +2082,8 @@ SpdySession3::CommitToSegmentSize(uint32_t count, bool forceCommitment) EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + count + kQueueReserved, mOutputQueueUsed, mOutputQueueSize); - NS_ABORT_IF_FALSE((mOutputQueueUsed + count) <= - (mOutputQueueSize - kQueueReserved), - "buffer not as large as expected"); + MOZ_ASSERT((mOutputQueueUsed + count) <= (mOutputQueueSize - kQueueReserved), + "buffer not as large as expected"); return NS_OK; } @@ -2107,7 +2097,7 @@ SpdySession3::OnWriteSegment(char *buf, uint32_t count, uint32_t *countWritten) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; if (!mSegmentWriter) { @@ -2191,7 +2181,7 @@ SpdySession3::SetNeedsCleanup() mInputFrameDataStream->StreamID())); // This will result in Close() being called - NS_ABORT_IF_FALSE(!mNeedsCleanup, "mNeedsCleanup unexpectedly set"); + MOZ_ASSERT(!mNeedsCleanup, "mNeedsCleanup unexpectedly set"); mNeedsCleanup = mInputFrameDataStream; ResetDownstreamState(); } @@ -2203,7 +2193,7 @@ SpdySession3::SetNeedsCleanup() void SpdySession3::TransactionHasDataToWrite(nsAHttpTransaction *caller) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::TransactionHasDataToWrite %p trans=%p", this, caller)); // a trapped signal from the http transaction to the connection that @@ -2225,7 +2215,7 @@ SpdySession3::TransactionHasDataToWrite(nsAHttpTransaction *caller) void SpdySession3::TransactionHasDataToWrite(SpdyStream3 *stream) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdySession3::TransactionHasDataToWrite %p stream=%p ID=%x", this, stream, stream->StreamID())); @@ -2244,14 +2234,14 @@ SpdySession3::TakeTransport(nsISocketTransport **, nsIAsyncInputStream **, nsIAsyncOutputStream **) { - NS_ABORT_IF_FALSE(false, "TakeTransport of SpdySession3"); + MOZ_ASSERT(false, "TakeTransport of SpdySession3"); return NS_ERROR_UNEXPECTED; } nsHttpConnection * SpdySession3::TakeHttpConnection() { - NS_ABORT_IF_FALSE(false, "TakeHttpConnection of SpdySession3"); + MOZ_ASSERT(false, "TakeHttpConnection of SpdySession3"); return nullptr; } @@ -2280,20 +2270,20 @@ void SpdySession3::SetConnection(nsAHttpConnection *) { // This is unexpected - NS_ABORT_IF_FALSE(false, "SpdySession3::SetConnection()"); + MOZ_ASSERT(false, "SpdySession3::SetConnection()"); } void SpdySession3::GetSecurityCallbacks(nsIInterfaceRequestor **) { // This is unexpected - NS_ABORT_IF_FALSE(false, "SpdySession3::GetSecurityCallbacks()"); + MOZ_ASSERT(false, "SpdySession3::GetSecurityCallbacks()"); } void SpdySession3::SetProxyConnectFailed() { - NS_ABORT_IF_FALSE(false, "SpdySession3::SetProxyConnectFailed()"); + MOZ_ASSERT(false, "SpdySession3::SetProxyConnectFailed()"); } bool @@ -2305,31 +2295,31 @@ SpdySession3::IsDone() nsresult SpdySession3::Status() { - NS_ABORT_IF_FALSE(false, "SpdySession3::Status()"); + MOZ_ASSERT(false, "SpdySession3::Status()"); return NS_ERROR_UNEXPECTED; } uint32_t SpdySession3::Caps() { - NS_ABORT_IF_FALSE(false, "SpdySession3::Caps()"); + MOZ_ASSERT(false, "SpdySession3::Caps()"); return 0; } uint64_t SpdySession3::Available() { - NS_ABORT_IF_FALSE(false, "SpdySession3::Available()"); + MOZ_ASSERT(false, "SpdySession3::Available()"); return 0; } nsHttpRequestHead * SpdySession3::RequestHead() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(false, - "SpdySession3::RequestHead() " - "should not be called after SPDY is setup"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(false, + "SpdySession3::RequestHead() " + "should not be called after SPDY is setup"); return NULL; } @@ -2379,8 +2369,8 @@ SpdySession3::AddTransaction(nsAHttpTransaction *) // This API is meant for pipelining, SpdySession3's should be // extended with AddStream() - NS_ABORT_IF_FALSE(false, - "SpdySession3::AddTransaction() should not be called"); + MOZ_ASSERT(false, + "SpdySession3::AddTransaction() should not be called"); return NS_ERROR_NOT_IMPLEMENTED; } @@ -2397,8 +2387,8 @@ SpdySession3::SetPipelinePosition(int32_t position) // This API is meant for pipelining, SpdySession3's should be // extended with AddStream() - NS_ABORT_IF_FALSE(false, - "SpdySession3::SetPipelinePosition() should not be called"); + MOZ_ASSERT(false, + "SpdySession3::SetPipelinePosition() should not be called"); return NS_ERROR_NOT_IMPLEMENTED; } @@ -2416,7 +2406,7 @@ SpdySession3::PipelinePosition() nsAHttpConnection * SpdySession3::Connection() { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return mConnection; } diff --git a/netwerk/protocol/http/SpdyStream2.cpp b/netwerk/protocol/http/SpdyStream2.cpp index c6e40f5629a..f8731a32068 100644 --- a/netwerk/protocol/http/SpdyStream2.cpp +++ b/netwerk/protocol/http/SpdyStream2.cpp @@ -54,7 +54,7 @@ SpdyStream2::SpdyStream2(nsAHttpTransaction *httpTransaction, mTotalSent(0), mTotalRead(0) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream2::SpdyStream2 %p", this)); @@ -79,7 +79,7 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, LOG3(("SpdyStream2 %p ReadSegments reader=%p count=%d state=%x", this, reader, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv = NS_ERROR_UNEXPECTED; mRequestBlockedOnRead = 0; @@ -136,8 +136,8 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, mSegmentReader = reader; rv = TransmitFrame(nullptr, nullptr, false); mSegmentReader = nullptr; - NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed, - "Transmit Frame should be all or nothing"); + MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed, + "Transmit Frame should be all or nothing"); if (NS_SUCCEEDED(rv)) ChangeState(UPSTREAM_COMPLETE); } @@ -158,7 +158,7 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, break; default: - NS_ABORT_IF_FALSE(false, "SpdyStream2::ReadSegments unknown state"); + MOZ_ASSERT(false, "SpdyStream2::ReadSegments unknown state"); break; } @@ -178,8 +178,8 @@ SpdyStream2::WriteSegments(nsAHttpSegmentWriter *writer, LOG3(("SpdyStream2::WriteSegments %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mSegmentWriter, "segment writer in progress"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mSegmentWriter, "segment writer in progress"); mSegmentWriter = writer; nsresult rv = mTransaction->WriteSegments(writer, count, countWritten); @@ -207,8 +207,8 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, // Returns NS_OK even if the headers are incomplete // set mSynFrameComplete flag if they are complete - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mUpstreamState == GENERATING_SYN_STREAM, "wrong state"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mUpstreamState == GENERATING_SYN_STREAM); LOG3(("SpdyStream2::ParseHttpRequestHeaders %p avail=%d state=%x", this, avail, mUpstreamState)); @@ -240,8 +240,8 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, // be monotonically increasing amongst syn-streams on this // session mStreamID = mSession->RegisterStreamID(this); - NS_ABORT_IF_FALSE(mStreamID & 1, - "Spdy Stream Channel ID must be odd"); + MOZ_ASSERT(mStreamID & 1, + "Spdy Stream Channel ID must be odd"); if (mStreamID >= 0x80000000) { // streamID must fit in 31 bits. This is theoretically possible @@ -394,8 +394,8 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(mTxInlineFrameUsed - 8); - NS_ABORT_IF_FALSE(!mTxInlineFrame[4], - "Size greater than 24 bits"); + MOZ_ASSERT(!mTxInlineFrame[4], + "Size greater than 24 bits"); // Determine whether to put the fin bit on the syn stream frame or whether // to wait for a data packet to put it on. @@ -492,10 +492,10 @@ SpdyStream2::TransmitFrame(const char *buf, // flush internal buffers that were previously blocked on writing. You can // of course feed new data to it as well. - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "empty stream frame in transmit"); - NS_ABORT_IF_FALSE(mSegmentReader, "TransmitFrame with null mSegmentReader"); - NS_ABORT_IF_FALSE((buf && countUsed) || (!buf && !countUsed), - "TransmitFrame arguments inconsistent"); + MOZ_ASSERT(mTxInlineFrameUsed, "empty stream frame in transmit"); + MOZ_ASSERT(mSegmentReader, "TransmitFrame with null mSegmentReader"); + MOZ_ASSERT((buf && countUsed) || (!buf && !countUsed), + "TransmitFrame arguments inconsistent"); uint32_t transmittedCount; nsresult rv; @@ -526,7 +526,7 @@ SpdyStream2::TransmitFrame(const char *buf, forceCommitment); if (rv == NS_BASE_STREAM_WOULD_BLOCK) { - NS_ABORT_IF_FALSE(!forceCommitment, "forceCommitment with WOULD_BLOCK"); + MOZ_ASSERT(!forceCommitment, "forceCommitment with WOULD_BLOCK"); mSession->TransactionHasDataToWrite(this); } if (NS_FAILED(rv)) // this will include WOULD_BLOCK @@ -543,14 +543,14 @@ SpdyStream2::TransmitFrame(const char *buf, "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK, - "inconsistent inline commitment result"); + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, + "inconsistent inline commitment result"); if (NS_FAILED(rv)) return rv; - NS_ABORT_IF_FALSE(transmittedCount == mTxInlineFrameUsed, - "inconsistent inline commitment count"); + MOZ_ASSERT(transmittedCount == mTxInlineFrameUsed, + "inconsistent inline commitment count"); SpdySession2::LogIO(mSession, this, "Writing from Inline Buffer", mTxInlineFrame, transmittedCount); @@ -558,8 +558,8 @@ SpdyStream2::TransmitFrame(const char *buf, if (mTxStreamFrameSize) { if (!buf) { // this cannot happen - NS_ABORT_IF_FALSE(false, "Stream transmit with null buf argument to " - "TransmitFrame()"); + MOZ_ASSERT(false, "Stream transmit with null buf argument to " + "TransmitFrame()"); LOG(("Stream transmit with null buf argument to TransmitFrame()\n")); return NS_ERROR_UNEXPECTED; } @@ -571,14 +571,14 @@ SpdyStream2::TransmitFrame(const char *buf, "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK, - "inconsistent stream commitment result"); + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, + "inconsistent stream commitment result"); if (NS_FAILED(rv)) return rv; - NS_ABORT_IF_FALSE(transmittedCount == mTxStreamFrameSize, - "inconsistent stream commitment count"); + MOZ_ASSERT(transmittedCount == mTxStreamFrameSize, + "inconsistent stream commitment count"); SpdySession2::LogIO(mSession, this, "Writing from Transaction Buffer", buf, transmittedCount); @@ -610,18 +610,17 @@ SpdyStream2::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame) LOG3(("SpdyStream2::GenerateDataFrameHeader %p len=%d last=%d", this, dataLength, lastFrame)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mTxInlineFrameUsed, "inline frame not empty"); - NS_ABORT_IF_FALSE(!mTxStreamFrameSize, "stream frame not empty"); - NS_ABORT_IF_FALSE(!(dataLength & 0xff000000), "datalength > 24 bits"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty"); + MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty"); + MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits"); (reinterpret_cast(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID); (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(dataLength); - NS_ABORT_IF_FALSE(!(mTxInlineFrame[0] & 0x80), - "control bit set unexpectedly"); - NS_ABORT_IF_FALSE(!mTxInlineFrame[4], "flag bits set unexpectedly"); + MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly"); + MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly"); mTxInlineFrameUsed = 8; mTxStreamFrameSize = dataLength; @@ -770,8 +769,8 @@ SpdyStream2::OnReadSegment(const char *buf, LOG3(("SpdyStream2::OnReadSegment %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mSegmentReader, "OnReadSegment with null mSegmentReader"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mSegmentReader); nsresult rv = NS_ERROR_UNEXPECTED; uint32_t dataLength; @@ -791,21 +790,18 @@ SpdyStream2::OnReadSegment(const char *buf, LOG3(("ParseHttpRequestHeaders %p used %d of %d. complete = %d", this, *countRead, count, mSynFrameComplete)); if (mSynFrameComplete) { - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, - "OnReadSegment SynFrameComplete 0b"); + MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment SynFrameComplete 0b"); rv = TransmitFrame(nullptr, nullptr, true); if (rv == NS_BASE_STREAM_WOULD_BLOCK) { // this can't happen - NS_ABORT_IF_FALSE(false, - "Transmit Frame SYN_FRAME must at least buffer data"); + MOZ_ASSERT(false, "Transmit Frame SYN_FRAME must at least buffer data"); rv = NS_ERROR_UNEXPECTED; } ChangeState(GENERATING_REQUEST_BODY); break; } - NS_ABORT_IF_FALSE(*countRead == count, - "Header parsing not complete but unused data"); + MOZ_ASSERT(*countRead == count, "Header parsing not complete but unused data"); break; case GENERATING_REQUEST_BODY: @@ -821,10 +817,10 @@ SpdyStream2::OnReadSegment(const char *buf, // NO BREAK case SENDING_REQUEST_BODY: - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b"); + MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b"); rv = TransmitFrame(buf, countRead, false); - NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed, - "Transmit Frame should be all or nothing"); + MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed, + "Transmit Frame should be all or nothing"); LOG3(("TransmitFrame() rv=%x returning %d data bytes. " "Header is %d Body is %d.", @@ -842,12 +838,11 @@ SpdyStream2::OnReadSegment(const char *buf, break; case SENDING_FIN_STREAM: - NS_ABORT_IF_FALSE(false, - "resuming partial fin stream out of OnReadSegment"); + MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment"); break; default: - NS_ABORT_IF_FALSE(false, "SpdyStream2::OnReadSegment non-write state"); + MOZ_ASSERT(false, "SpdyStream2::OnReadSegment non-write state"); break; } @@ -866,8 +861,8 @@ SpdyStream2::OnWriteSegment(char *buf, LOG3(("SpdyStream2::OnWriteSegment %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mSegmentWriter, "OnWriteSegment with null mSegmentWriter"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mSegmentWriter, "OnWriteSegment with null mSegmentWriter"); return mSegmentWriter->OnWriteSegment(buf, count, countWritten); } diff --git a/netwerk/protocol/http/SpdyStream2.h b/netwerk/protocol/http/SpdyStream2.h index 61aa191329f..198ffe70cb1 100644 --- a/netwerk/protocol/http/SpdyStream2.h +++ b/netwerk/protocol/http/SpdyStream2.h @@ -37,7 +37,7 @@ public: bool GetFullyOpen() {return mFullyOpen;} void SetFullyOpen() { - NS_ABORT_IF_FALSE(!mFullyOpen, "SetFullyOpen already open"); + MOZ_ASSERT(!mFullyOpen); mFullyOpen = 1; } diff --git a/netwerk/protocol/http/SpdyStream3.cpp b/netwerk/protocol/http/SpdyStream3.cpp index 915ed426226..8f80ae2c851 100644 --- a/netwerk/protocol/http/SpdyStream3.cpp +++ b/netwerk/protocol/http/SpdyStream3.cpp @@ -61,7 +61,7 @@ SpdyStream3::SpdyStream3(nsAHttpTransaction *httpTransaction, mTotalSent(0), mTotalRead(0) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("SpdyStream3::SpdyStream3 %p", this)); @@ -88,7 +88,7 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, LOG3(("SpdyStream3 %p ReadSegments reader=%p count=%d state=%x", this, reader, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv = NS_ERROR_UNEXPECTED; mRequestBlockedOnRead = 0; @@ -147,8 +147,8 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, mSegmentReader = reader; rv = TransmitFrame(nullptr, nullptr, false); mSegmentReader = nullptr; - NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed, - "Transmit Frame should be all or nothing"); + MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed, + "Transmit Frame should be all or nothing"); if (NS_SUCCEEDED(rv)) ChangeState(UPSTREAM_COMPLETE); } @@ -169,7 +169,7 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, break; default: - NS_ABORT_IF_FALSE(false, "SpdyStream3::ReadSegments unknown state"); + MOZ_ASSERT(false, "SpdyStream3::ReadSegments unknown state"); break; } @@ -189,8 +189,8 @@ SpdyStream3::WriteSegments(nsAHttpSegmentWriter *writer, LOG3(("SpdyStream3::WriteSegments %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mSegmentWriter, "segment writer in progress"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mSegmentWriter, "segment writer in progress"); mSegmentWriter = writer; nsresult rv = mTransaction->WriteSegments(writer, count, countWritten); @@ -218,8 +218,8 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // Returns NS_OK even if the headers are incomplete // set mSynFrameComplete flag if they are complete - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mUpstreamState == GENERATING_SYN_STREAM, "wrong state"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mUpstreamState == GENERATING_SYN_STREAM); LOG3(("SpdyStream3::ParseHttpRequestHeaders %p avail=%d state=%x", this, avail, mUpstreamState)); @@ -251,8 +251,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // be monotonically increasing amongst syn-streams on this // session mStreamID = mSession->RegisterStreamID(this); - NS_ABORT_IF_FALSE(mStreamID & 1, - "Spdy Stream Channel ID must be odd"); + MOZ_ASSERT(mStreamID & 1, "Spdy Stream Channel ID must be odd"); if (mStreamID >= 0x80000000) { // streamID must fit in 31 bits. This is theoretically possible @@ -302,8 +301,8 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // breaking line in the priorities content assigns to // transactions. uint8_t calculatedPriority = 3 + ((mPriority + 1) / 5); - NS_ABORT_IF_FALSE (!(calculatedPriority & 0xf8), - "Calculated Priority Out Of Range"); + MOZ_ASSERT (!(calculatedPriority & 0xf8), + "Calculated Priority Out Of Range"); mTxInlineFrame[16] = calculatedPriority << 5; } @@ -414,8 +413,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(mTxInlineFrameUsed - 8); - NS_ABORT_IF_FALSE(!mTxInlineFrame[4], - "Size greater than 24 bits"); + MOZ_ASSERT(!mTxInlineFrame[4], "Size greater than 24 bits"); // Determine whether to put the fin bit on the syn stream frame or whether // to wait for a data packet to put it on. @@ -512,10 +510,10 @@ SpdyStream3::TransmitFrame(const char *buf, // flush internal buffers that were previously blocked on writing. You can // of course feed new data to it as well. - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "empty stream frame in transmit"); - NS_ABORT_IF_FALSE(mSegmentReader, "TransmitFrame with null mSegmentReader"); - NS_ABORT_IF_FALSE((buf && countUsed) || (!buf && !countUsed), - "TransmitFrame arguments inconsistent"); + MOZ_ASSERT(mTxInlineFrameUsed, "empty stream frame in transmit"); + MOZ_ASSERT(mSegmentReader, "TransmitFrame with null mSegmentReader"); + MOZ_ASSERT((buf && countUsed) || (!buf && !countUsed), + "TransmitFrame arguments inconsistent"); uint32_t transmittedCount; nsresult rv; @@ -546,7 +544,7 @@ SpdyStream3::TransmitFrame(const char *buf, forceCommitment); if (rv == NS_BASE_STREAM_WOULD_BLOCK) { - NS_ABORT_IF_FALSE(!forceCommitment, "forceCommitment with WOULD_BLOCK"); + MOZ_ASSERT(!forceCommitment, "forceCommitment with WOULD_BLOCK"); mSession->TransactionHasDataToWrite(this); } if (NS_FAILED(rv)) // this will include WOULD_BLOCK @@ -564,14 +562,14 @@ SpdyStream3::TransmitFrame(const char *buf, "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK, - "inconsistent inline commitment result"); + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, + "inconsistent inline commitment result"); if (NS_FAILED(rv)) return rv; - NS_ABORT_IF_FALSE(transmittedCount == mTxInlineFrameUsed, - "inconsistent inline commitment count"); + MOZ_ASSERT(transmittedCount == mTxInlineFrameUsed, + "inconsistent inline commitment count"); SpdySession3::LogIO(mSession, this, "Writing from Inline Buffer", reinterpret_cast(mTxInlineFrame.get()), @@ -580,8 +578,8 @@ SpdyStream3::TransmitFrame(const char *buf, if (mTxStreamFrameSize) { if (!buf) { // this cannot happen - NS_ABORT_IF_FALSE(false, "Stream transmit with null buf argument to " - "TransmitFrame()"); + MOZ_ASSERT(false, "Stream transmit with null buf argument to " + "TransmitFrame()"); LOG(("Stream transmit with null buf argument to TransmitFrame()\n")); return NS_ERROR_UNEXPECTED; } @@ -593,14 +591,14 @@ SpdyStream3::TransmitFrame(const char *buf, "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - NS_ABORT_IF_FALSE(rv != NS_BASE_STREAM_WOULD_BLOCK, - "inconsistent stream commitment result"); + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, + "inconsistent stream commitment result"); if (NS_FAILED(rv)) return rv; - NS_ABORT_IF_FALSE(transmittedCount == mTxStreamFrameSize, - "inconsistent stream commitment count"); + MOZ_ASSERT(transmittedCount == mTxStreamFrameSize, + "inconsistent stream commitment count"); SpdySession3::LogIO(mSession, this, "Writing from Transaction Buffer", buf, transmittedCount); @@ -632,18 +630,17 @@ SpdyStream3::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame) LOG3(("SpdyStream3::GenerateDataFrameHeader %p len=%d last=%d", this, dataLength, lastFrame)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mTxInlineFrameUsed, "inline frame not empty"); - NS_ABORT_IF_FALSE(!mTxStreamFrameSize, "stream frame not empty"); - NS_ABORT_IF_FALSE(!(dataLength & 0xff000000), "datalength > 24 bits"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty"); + MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty"); + MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits"); (reinterpret_cast(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID); (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(dataLength); - NS_ABORT_IF_FALSE(!(mTxInlineFrame[0] & 0x80), - "control bit set unexpectedly"); - NS_ABORT_IF_FALSE(!mTxInlineFrame[4], "flag bits set unexpectedly"); + MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly"); + MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly"); mTxInlineFrameUsed = 8; mTxStreamFrameSize = dataLength; @@ -1188,8 +1185,8 @@ SpdyStream3::OnReadSegment(const char *buf, LOG3(("SpdyStream3::OnReadSegment %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mSegmentReader, "OnReadSegment with null mSegmentReader"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mSegmentReader, "OnReadSegment with null mSegmentReader"); nsresult rv = NS_ERROR_UNEXPECTED; uint32_t dataLength; @@ -1209,21 +1206,18 @@ SpdyStream3::OnReadSegment(const char *buf, LOG3(("ParseHttpRequestHeaders %p used %d of %d. complete = %d", this, *countRead, count, mSynFrameComplete)); if (mSynFrameComplete) { - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, - "OnReadSegment SynFrameComplete 0b"); + MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment SynFrameComplete 0b"); rv = TransmitFrame(nullptr, nullptr, true); if (rv == NS_BASE_STREAM_WOULD_BLOCK) { // this can't happen - NS_ABORT_IF_FALSE(false, - "Transmit Frame SYN_FRAME must at least buffer data"); + MOZ_ASSERT(false, "Transmit Frame SYN_FRAME must at least buffer data"); rv = NS_ERROR_UNEXPECTED; } ChangeState(GENERATING_REQUEST_BODY); break; } - NS_ABORT_IF_FALSE(*countRead == count, - "Header parsing not complete but unused data"); + MOZ_ASSERT(*countRead == count, "Header parsing not complete but unused data"); break; case GENERATING_REQUEST_BODY: @@ -1256,10 +1250,10 @@ SpdyStream3::OnReadSegment(const char *buf, // NO BREAK case SENDING_REQUEST_BODY: - NS_ABORT_IF_FALSE(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b"); + MOZ_ASSERT(mTxInlineFrameUsed, "OnReadSegment Send Data Header 0b"); rv = TransmitFrame(buf, countRead, false); - NS_ABORT_IF_FALSE(NS_FAILED(rv) || !mTxInlineFrameUsed, - "Transmit Frame should be all or nothing"); + MOZ_ASSERT(NS_FAILED(rv) || !mTxInlineFrameUsed, + "Transmit Frame should be all or nothing"); LOG3(("TransmitFrame() rv=%x returning %d data bytes. " "Header is %d Body is %d.", @@ -1277,12 +1271,11 @@ SpdyStream3::OnReadSegment(const char *buf, break; case SENDING_FIN_STREAM: - NS_ABORT_IF_FALSE(false, - "resuming partial fin stream out of OnReadSegment"); + MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment"); break; default: - NS_ABORT_IF_FALSE(false, "SpdyStream3::OnReadSegment non-write state"); + MOZ_ASSERT(false, "SpdyStream3::OnReadSegment non-write state"); break; } @@ -1301,8 +1294,8 @@ SpdyStream3::OnWriteSegment(char *buf, LOG3(("SpdyStream3::OnWriteSegment %p count=%d state=%x", this, count, mUpstreamState)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mSegmentWriter, "OnWriteSegment with null mSegmentWriter"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mSegmentWriter, "OnWriteSegment with null mSegmentWriter"); return mSegmentWriter->OnWriteSegment(buf, count, countWritten); } diff --git a/netwerk/protocol/http/SpdyStream3.h b/netwerk/protocol/http/SpdyStream3.h index 03bbbe48912..17708719bb4 100644 --- a/netwerk/protocol/http/SpdyStream3.h +++ b/netwerk/protocol/http/SpdyStream3.h @@ -36,7 +36,7 @@ public: bool GetFullyOpen() {return mFullyOpen;} void SetFullyOpen() { - NS_ABORT_IF_FALSE(!mFullyOpen, "SetFullyOpen already open"); + MOZ_ASSERT(!mFullyOpen); mFullyOpen = 1; } diff --git a/netwerk/protocol/http/nsHttp.cpp b/netwerk/protocol/http/nsHttp.cpp index 78ea8a8ed9c..003cef1ac25 100644 --- a/netwerk/protocol/http/nsHttp.cpp +++ b/netwerk/protocol/http/nsHttp.cpp @@ -98,7 +98,7 @@ static const PLDHashTableOps ops = { nsresult nsHttp::CreateAtomTable() { - NS_ASSERTION(!sAtomTable.ops, "atom table already initialized"); + MOZ_ASSERT(!sAtomTable.ops, "atom table already initialized"); if (!sLock) { sLock = new Mutex("nsHttp.sLock"); @@ -127,7 +127,7 @@ nsHttp::CreateAtomTable() if (!stub) return NS_ERROR_OUT_OF_MEMORY; - NS_ASSERTION(!stub->key, "duplicate static atom"); + MOZ_ASSERT(!stub->key, "duplicate static atom"); stub->key = atoms[i]; } diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 406aec00401..2d2f1ad24fa 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -415,7 +415,7 @@ nsHttpChannel::Connect() // do not continue if asyncOpenCacheEntry is in progress if (mOnCacheEntryAvailableCallback) { - NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state"); return NS_OK; } @@ -925,7 +925,7 @@ nsHttpChannel::CallOnStartRequest() (mLoadFlags & LOAD_TREAT_APPLICATION_OCTET_STREAM_AS_UNKNOWN)))); if (shouldSniff) { - NS_ASSERTION(mConnectionInfo, "Should have connection info here"); + MOZ_ASSERT(mConnectionInfo, "Should have connection info here"); if (!mContentTypeHint.IsEmpty()) mResponseHead->SetContentType(mContentTypeHint); else if (mResponseHead->Version() == NS_HTTP_VERSION_0_9 && @@ -1019,8 +1019,8 @@ nsHttpChannel::ProcessFailedProxyConnect(uint32_t httpStatus) // body of the reply, and instead give the user a (hopefully helpful) // boilerplate error page, based on just the HTTP status of the reply. - NS_ABORT_IF_FALSE(mConnectionInfo->UsingConnect(), - "proxy connect failed but not using CONNECT?"); + MOZ_ASSERT(mConnectionInfo->UsingConnect(), + "proxy connect failed but not using CONNECT?"); nsresult rv; switch (httpStatus) { @@ -1135,8 +1135,8 @@ nsHttpChannel::ProcessSTSHeader() // Failure here means STS is broken. Don't prevent the load, but this // shouldn't fail. NS_ENSURE_SUCCESS(rv, NS_OK); - NS_ASSERTION(!(wasAlreadySTSHost && tlsIsBroken), - "connection should have been aborted by nss-bad-cert-handler"); + MOZ_ASSERT(!(wasAlreadySTSHost && tlsIsBroken), + "connection should have been aborted by nss-bad-cert-handler"); // Any STS header is ignored if the channel is not trusted due to // certificate errors (STS Spec 7.1) -- there is nothing else to do, and @@ -1195,7 +1195,7 @@ nsHttpChannel::ProcessResponse() } else { // Given a successful connection, process any STS data that's relevant. rv = ProcessSTSHeader(); - NS_ASSERTION(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load."); + MOZ_ASSERT(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load."); } MOZ_ASSERT(!mCachedContentIsValid); @@ -2239,8 +2239,8 @@ nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback) return NS_OK; } - NS_ASSERTION(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK, - "Fallback entry not marked correctly!"); + MOZ_ASSERT(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK, + "Fallback entry not marked correctly!"); // Kill any offline cache entry, and disable offline caching for the // fallback. @@ -2347,7 +2347,7 @@ nsHttpChannel::OpenCacheEntry(bool usingSSL) nsresult rv; - NS_ASSERTION(!mOnCacheEntryAvailableCallback, "Unexpected state"); + MOZ_ASSERT(!mOnCacheEntryAvailableCallback, "Unexpected state"); mLoadedFromApplicationCache = false; LOG(("nsHttpChannel::OpenCacheEntry [this=%p]", this)); @@ -2527,7 +2527,7 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry, nsresult nsHttpChannel::OpenNormalCacheEntry(bool usingSSL) { - NS_ASSERTION(!mCacheEntry, "We have already mCacheEntry"); + MOZ_ASSERT(!mCacheEntry, "We have already mCacheEntry"); nsresult rv; @@ -3559,7 +3559,7 @@ nsHttpChannel::CloseCacheEntry(bool doomOnFailure) bool doom = false; if (mInitedCacheEntry) { - NS_ASSERTION(mResponseHead, "oops"); + MOZ_ASSERT(mResponseHead, "oops"); if (NS_FAILED(mStatus) && doomOnFailure && (mCacheAccess & nsICache::ACCESS_WRITE) && !mResponseHead->IsResumable()) @@ -3833,8 +3833,8 @@ nsHttpChannel::InstallCacheListener(uint32_t offset) LOG(("Preparing to write data into the cache [uri=%s]\n", mSpec.get())); - NS_ASSERTION(mCacheEntry, "no cache entry"); - NS_ASSERTION(mListener, "no listener"); + MOZ_ASSERT(mCacheEntry); + MOZ_ASSERT(mListener); // If the content is compressible and the server has not compressed it, // mark the cache entry for compression. @@ -3906,8 +3906,8 @@ nsHttpChannel::InstallOfflineCacheListener() LOG(("Preparing to write data into the offline cache [uri=%s]\n", mSpec.get())); - NS_ASSERTION(mOfflineCacheEntry, "no offline cache entry"); - NS_ASSERTION(mListener, "no listener"); + MOZ_ASSERT(mOfflineCacheEntry); + MOZ_ASSERT(mListener); nsCOMPtr out; rv = mOfflineCacheEntry->OpenOutputStream(0, getter_AddRefs(out)); @@ -4873,10 +4873,10 @@ nsHttpChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt) this, request, mStatus)); // Make sure things are what we expect them to be... - NS_ASSERTION(request == mCachePump || request == mTransactionPump, - "Unexpected request"); - NS_ASSERTION(!(mTransactionPump && mCachePump) || mCachedContentIsPartial, - "If we have both pumps, the cache content must be partial"); + MOZ_ASSERT(request == mCachePump || request == mTransactionPump, + "Unexpected request"); + MOZ_ASSERT(!(mTransactionPump && mCachePump) || mCachedContentIsPartial, + "If we have both pumps, the cache content must be partial"); if (!mSecurityInfo && !mCachePump && mTransaction) { // grab the security info from the connection object; the transaction @@ -4986,8 +4986,8 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st if (mCachedContentIsPartial) { if (NS_SUCCEEDED(status)) { // mTransactionPump should be suspended - NS_ASSERTION(request != mTransactionPump, - "byte-range transaction finished prematurely"); + MOZ_ASSERT(request != mTransactionPump, + "byte-range transaction finished prematurely"); if (request == mCachePump) { bool streamDone; @@ -5056,7 +5056,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st // If DoAuthRetry failed, or if we have been cancelled since showing // the auth. dialog, then we need to send OnStartRequest now if (authRetry || (mAuthRetryPending && NS_FAILED(status))) { - NS_ASSERTION(NS_FAILED(status), "should have a failure code here"); + MOZ_ASSERT(NS_FAILED(status), "should have a failure code here"); // NOTE: since we have a failure status, we can ignore the return // value from onStartRequest. mListener->OnStartRequest(this, mListenerContext); @@ -5122,10 +5122,10 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, if (mCanceled) return mStatus; - NS_ASSERTION(mResponseHead, "No response head in ODA!!"); + MOZ_ASSERT(mResponseHead, "No response head in ODA!!"); - NS_ASSERTION(!(mCachedContentIsPartial && (request == mTransactionPump)), - "transaction pump not suspended"); + MOZ_ASSERT(!(mCachedContentIsPartial && (request == mTransactionPump)), + "transaction pump not suspended"); if (mAuthRetryPending || (request == mTransactionPump && mTransactionReplaced)) { uint32_t n; @@ -5151,7 +5151,7 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, uint64_t progressMax(uint64_t(mResponseHead->ContentLength())); uint64_t progress = mLogicalOffset + uint64_t(count); - NS_ASSERTION(progress <= progressMax, "unexpected progress values"); + MOZ_ASSERT(progress <= progressMax, "unexpected progress values"); OnTransportStatus(nullptr, transportStatus, progress, progressMax); @@ -5210,7 +5210,7 @@ nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status, NS_ConvertUTF8toUTF16(host).get()); if (progress > 0) { - NS_ASSERTION(progress <= progressMax, "unexpected progress values"); + MOZ_ASSERT(progress <= progressMax, "unexpected progress values"); mProgressSink->OnProgress(this, nullptr, progress, progressMax); } } @@ -5510,13 +5510,13 @@ nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntryDescriptor *entry, nsOnCacheEntryAvailableCallback callback = mOnCacheEntryAvailableCallback; mOnCacheEntryAvailableCallback = nullptr; - NS_ASSERTION(callback, - "nsHttpChannel::OnCacheEntryAvailable called without callback"); + MOZ_ASSERT(callback, + "nsHttpChannel::OnCacheEntryAvailable called without callback"); rv = ((*this).*callback)(entry, access, status); if (mOnCacheEntryAvailableCallback) { // callback fired another async open - NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state"); return NS_OK; } @@ -5544,7 +5544,7 @@ nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntryDescriptor *entry, if (mApplicationCacheForWrite) { rv = OpenOfflineCacheEntryForWriting(); if (mOnCacheEntryAvailableCallback) { - NS_ASSERTION(NS_SUCCEEDED(rv), "Unexpected state"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected state"); return NS_OK; } @@ -5571,7 +5571,7 @@ nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn) { LOG(("nsHttpChannel::DoAuthRetry [this=%p]\n", this)); - NS_ASSERTION(!mTransaction, "should not have a transaction"); + MOZ_ASSERT(!mTransaction, "should not have a transaction"); nsresult rv; // toggle mIsPending to allow nsIObserver implementations to modify @@ -5759,8 +5759,8 @@ nsHttpChannel::WaitForRedirectCallback() nsresult resume = #endif mTransactionPump->Resume(); - NS_ASSERTION(NS_SUCCEEDED(resume), - "Failed to resume transaction pump"); + MOZ_ASSERT(NS_SUCCEEDED(resume), + "Failed to resume transaction pump"); } NS_ENSURE_SUCCESS(rv, rv); } @@ -5775,8 +5775,8 @@ nsHttpChannel::OnRedirectVerifyCallback(nsresult result) LOG(("nsHttpChannel::OnRedirectVerifyCallback [this=%p] " "result=%x stack=%d mWaitingForRedirectCallback=%u\n", this, result, mRedirectFuncStack.Length(), mWaitingForRedirectCallback)); - NS_ASSERTION(mWaitingForRedirectCallback, - "Someone forgot to call WaitForRedirectCallback() ?!"); + MOZ_ASSERT(mWaitingForRedirectCallback, + "Someone forgot to call WaitForRedirectCallback() ?!"); mWaitingForRedirectCallback = false; if (mCanceled && NS_SUCCEEDED(result)) @@ -5833,8 +5833,8 @@ nsHttpChannel::PushRedirectAsyncFunc(nsContinueRedirectionFunc func) void nsHttpChannel::PopRedirectAsyncFunc(nsContinueRedirectionFunc func) { - NS_ASSERTION(func == mRedirectFuncStack[mRedirectFuncStack.Length() - 1], - "Trying to pop wrong method from redirect async stack!"); + MOZ_ASSERT(func == mRedirectFuncStack[mRedirectFuncStack.Length() - 1], + "Trying to pop wrong method from redirect async stack!"); mRedirectFuncStack.TruncateLength(mRedirectFuncStack.Length() - 1); } diff --git a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp index 06f4506ee5b..2b2ca0369f0 100644 --- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp +++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp @@ -51,7 +51,7 @@ nsHttpChannelAuthProvider::nsHttpChannelAuthProvider() nsHttpChannelAuthProvider::~nsHttpChannelAuthProvider() { - NS_ASSERTION(!mAuthChannel, "Disconnect wasn't called"); + MOZ_ASSERT(!mAuthChannel, "Disconnect wasn't called"); // release our reference to the handler nsHttpHandler *handler = gHttpHandler; @@ -61,7 +61,7 @@ nsHttpChannelAuthProvider::~nsHttpChannelAuthProvider() NS_IMETHODIMP nsHttpChannelAuthProvider::Init(nsIHttpAuthenticableChannel *channel) { - NS_ASSERTION(channel, "channel expected!"); + MOZ_ASSERT(channel, "channel expected!"); mAuthChannel = channel; @@ -95,7 +95,7 @@ nsHttpChannelAuthProvider::ProcessAuthentication(uint32_t httpStatus, "[this=%p channel=%p code=%u SSLConnectFailed=%d]\n", this, mAuthChannel, httpStatus, SSLConnectFailed)); - NS_ASSERTION(mAuthChannel, "Channel not initialized"); + MOZ_ASSERT(mAuthChannel, "Channel not initialized"); nsCOMPtr proxyInfo; nsresult rv = mAuthChannel->GetProxyInfo(getter_AddRefs(proxyInfo)); @@ -158,7 +158,7 @@ nsHttpChannelAuthProvider::AddAuthorizationHeaders() LOG(("nsHttpChannelAuthProvider::AddAuthorizationHeaders? " "[this=%p channel=%p]\n", this, mAuthChannel)); - NS_ASSERTION(mAuthChannel, "Channel not initialized"); + MOZ_ASSERT(mAuthChannel, "Channel not initialized"); nsCOMPtr proxyInfo; nsresult rv = mAuthChannel->GetProxyInfo(getter_AddRefs(proxyInfo)); @@ -209,7 +209,7 @@ nsHttpChannelAuthProvider::CheckForSuperfluousAuth() LOG(("nsHttpChannelAuthProvider::CheckForSuperfluousAuth? " "[this=%p channel=%p]\n", this, mAuthChannel)); - NS_ASSERTION(mAuthChannel, "Channel not initialized"); + MOZ_ASSERT(mAuthChannel, "Channel not initialized"); // we've been called because it has been determined that this channel is // getting loaded without taking the userpass from the URL. if the URL @@ -228,7 +228,7 @@ nsHttpChannelAuthProvider::CheckForSuperfluousAuth() NS_IMETHODIMP nsHttpChannelAuthProvider::Cancel(nsresult status) { - NS_ASSERTION(mAuthChannel, "Channel not initialized"); + MOZ_ASSERT(mAuthChannel, "Channel not initialized"); if (mAsyncPromptAuthCancelable) { mAsyncPromptAuthCancelable->Cancel(status); @@ -550,8 +550,8 @@ nsHttpChannelAuthProvider::GetAuthorizationMembers(bool proxyAut nsISupports**& continuationState) { if (proxyAuth) { - NS_ASSERTION (UsingHttpProxy(), - "proxyAuth is true, but no HTTP proxy is configured!"); + MOZ_ASSERT (UsingHttpProxy(), + "proxyAuth is true, but no HTTP proxy is configured!"); host = ProxyHost(); port = ProxyPort(); @@ -1039,7 +1039,7 @@ NS_IMETHODIMP nsHttpChannelAuthProvider::OnAuthAvailable(nsISupports *aContext, rv = GetAuthenticator(mCurrentChallenge.get(), unused, getter_AddRefs(auth)); if (NS_FAILED(rv)) { - NS_ASSERTION(false, "GetAuthenticator failed"); + MOZ_ASSERT(false, "GetAuthenticator failed"); OnAuthCancelled(aContext, true); return NS_OK; } diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index deaf179fd80..8a38aeb0b4e 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -109,8 +109,8 @@ nsHttpConnection::Init(nsHttpConnectionInfo *info, nsIInterfaceRequestor *callbacks, PRIntervalTime rtt) { - NS_ABORT_IF_FALSE(transport && instream && outstream, - "invalid socket information"); + MOZ_ASSERT(transport && instream && outstream, + "invalid socket information"); LOG(("nsHttpConnection::Init [this=%p " "transport=%p instream=%p outstream=%p rtt=%d]\n", this, transport, instream, outstream, @@ -145,7 +145,7 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion) { LOG(("nsHttpConnection::StartSpdy [this=%p]\n", this)); - NS_ABORT_IF_FALSE(!mSpdySession, "mSpdySession should be null"); + MOZ_ASSERT(!mSpdySession); mUsingSpdyVersion = spdyVersion; mEverUsedSpdy = true; @@ -167,9 +167,9 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion) // Has the interface for TakeSubTransactions() changed? LOG(("TakeSubTranscations somehow called after " "nsAHttpTransaction began processing\n")); - NS_ABORT_IF_FALSE(false, - "TakeSubTranscations somehow called after " - "nsAHttpTransaction began processing"); + MOZ_ASSERT(false, + "TakeSubTranscations somehow called after " + "nsAHttpTransaction began processing"); mTransaction->Close(NS_ERROR_ABORT); return; } @@ -177,15 +177,15 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion) if (NS_FAILED(rv) && rv != NS_ERROR_NOT_IMPLEMENTED) { // Has the interface for TakeSubTransactions() changed? LOG(("unexpected rv from nnsAHttpTransaction::TakeSubTransactions()")); - NS_ABORT_IF_FALSE(false, - "unexpected result from " - "nsAHttpTransaction::TakeSubTransactions()"); + MOZ_ASSERT(false, + "unexpected result from " + "nsAHttpTransaction::TakeSubTransactions()"); mTransaction->Close(NS_ERROR_ABORT); return; } if (NS_FAILED(rv)) { // includes NS_ERROR_NOT_IMPLEMENTED - NS_ABORT_IF_FALSE(list.IsEmpty(), "sub transaction list not empty"); + MOZ_ASSERT(list.IsEmpty(), "sub transaction list not empty"); // This is ok - treat mTransaction as a single real request. // Wrap the old http transaction into the new spdy session @@ -216,7 +216,7 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion) else { // AddStream() cannot fail if (!mSpdySession->AddStream(list[index], mPriority)) { - NS_ABORT_IF_FALSE(false, "SpdySession::AddStream failed"); + MOZ_ASSERT(false, "SpdySession::AddStream failed"); LOG(("SpdySession::AddStream failed\n")); mTransaction->Close(NS_ERROR_ABORT); return; @@ -238,10 +238,9 @@ nsHttpConnection::EnsureNPNComplete() // If for some reason the components to check on NPN aren't available, // this function will just return true to continue on and disable SPDY + MOZ_ASSERT(mSocketTransport); if (!mSocketTransport) { // this cannot happen - NS_ABORT_IF_FALSE(false, - "EnsureNPNComplete socket transport precondition"); mNPNComplete = true; return true; } @@ -302,7 +301,7 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri { nsresult rv; - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnection::Activate [this=%x trans=%x caps=%x]\n", this, trans, caps)); @@ -326,8 +325,7 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri // take ownership of the transaction mTransaction = trans; - NS_ABORT_IF_FALSE(!mIdleMonitoring, - "Activating a connection with an Idle Monitor"); + MOZ_ASSERT(!mIdleMonitoring, "Activating a connection with an Idle Monitor"); mIdleMonitoring = false; // set mKeepAlive according to what will be requested @@ -441,15 +439,15 @@ nsHttpConnection::AddTransaction(nsAHttpTransaction *httpTransaction, { LOG(("nsHttpConnection::AddTransaction for SPDY")); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mSpdySession && mUsingSpdyVersion, - "AddTransaction to live http connection without spdy"); - NS_ABORT_IF_FALSE(mTransaction, - "AddTransaction to idle http connection"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mSpdySession && mUsingSpdyVersion, + "AddTransaction to live http connection without spdy"); + MOZ_ASSERT(mTransaction, + "AddTransaction to idle http connection"); if (!mSpdySession->AddStream(httpTransaction, priority)) { - NS_ABORT_IF_FALSE(0, "AddStream should never fail due to" - "RoomForMore() admission check"); + MOZ_ASSERT(false, "AddStream should never fail due to" + "RoomForMore() admission check"); return NS_ERROR_FAILURE; } @@ -463,7 +461,7 @@ nsHttpConnection::Close(nsresult reason) { LOG(("nsHttpConnection::Close [this=%x reason=%x]\n", this, reason)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (NS_FAILED(reason)) { if (mIdleMonitoring) @@ -504,9 +502,7 @@ nsresult nsHttpConnection::ProxyStartSSL() { LOG(("nsHttpConnection::ProxyStartSSL [this=%x]\n", this)); -#ifdef DEBUG - NS_PRECONDITION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); -#endif + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsCOMPtr securityInfo; nsresult rv = mSocketTransport->GetSecurityInfo(getter_AddRefs(securityInfo)); @@ -709,9 +705,9 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, LOG(("nsHttpConnection::OnHeadersAvailable [this=%p trans=%p response-head=%p]\n", this, trans, responseHead)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); NS_ENSURE_ARG_POINTER(trans); - NS_ASSERTION(responseHead, "No response head?"); + MOZ_ASSERT(responseHead, "No response head?"); // If the server issued an explicit timeout, then we need to close down the // socket transport. We pass an error code of NS_ERROR_NET_RESET to @@ -850,8 +846,8 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, // the socket connection if using SSL. Finally, we have to wake up the // socket write request. if (mProxyConnectStream) { - NS_ABORT_IF_FALSE(!mUsingSpdyVersion, - "SPDY NPN Complete while using proxy connect stream"); + MOZ_ASSERT(!mUsingSpdyVersion, + "SPDY NPN Complete while using proxy connect stream"); mProxyConnectStream = 0; if (responseStatus == 200) { LOG(("proxy CONNECT succeeded! ssl=%s\n", @@ -867,7 +863,7 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, mProxyConnectInProgress = false; rv = mSocketOut->AsyncWait(this, 0, 0, nullptr); // XXX what if this fails -- need to handle this error - NS_ASSERTION(NS_SUCCEEDED(rv), "mSocketOut->AsyncWait failed"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "mSocketOut->AsyncWait failed"); } else { LOG(("proxy CONNECT failed! ssl=%s\n", @@ -953,7 +949,7 @@ nsHttpConnection::TakeTransport(nsISocketTransport **aTransport, void nsHttpConnection::ReadTimeoutTick(PRIntervalTime now) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // make sure timer didn't tick before Activate() if (!mTransaction) @@ -990,7 +986,7 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now) PR_IntervalToMilliseconds(delta), pipelineDepth)); nsHttpPipeline *pipeline = mTransaction->QueryPipeline(); - NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline"); + MOZ_ASSERT(pipeline, "pipelinedepth > 1 without pipeline"); // code this defensively for the moment and check for null in opt build // This will reschedule blocked members of the pipeline, but the // blocking transaction (i.e. response 0) will not be changed. @@ -1025,7 +1021,7 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now) void nsHttpConnection::GetSecurityInfo(nsISupports **secinfo) { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mSocketTransport) { if (NS_FAILED(mSocketTransport->GetSecurityInfo(secinfo))) @@ -1063,7 +1059,7 @@ nsHttpConnection::ResumeSend() { LOG(("nsHttpConnection::ResumeSend [this=%p]\n", this)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mSocketOut) return mSocketOut->AsyncWait(this, 0, 0, nullptr); @@ -1077,7 +1073,7 @@ nsHttpConnection::ResumeRecv() { LOG(("nsHttpConnection::ResumeRecv [this=%p]\n", this)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // the mLastReadTime timestamp is used for finding slowish readers // and can be pretty sensitive. For that reason we actually reset it @@ -1098,9 +1094,9 @@ void nsHttpConnection::BeginIdleMonitoring() { LOG(("nsHttpConnection::BeginIdleMonitoring [this=%p]\n", this)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mTransaction, "BeginIdleMonitoring() while active"); - NS_ABORT_IF_FALSE(!mUsingSpdyVersion, "Idle monitoring of spdy not allowed"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mTransaction, "BeginIdleMonitoring() while active"); + MOZ_ASSERT(!mUsingSpdyVersion, "Idle monitoring of spdy not allowed"); LOG(("Entering Idle Monitoring Mode [this=%p]", this)); mIdleMonitoring = true; @@ -1112,8 +1108,8 @@ void nsHttpConnection::EndIdleMonitoring() { LOG(("nsHttpConnection::EndIdleMonitoring [this=%p]\n", this)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(!mTransaction, "EndIdleMonitoring() while active"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mTransaction, "EndIdleMonitoring() while active"); if (mIdleMonitoring) { LOG(("Leaving Idle Monitoring Mode [this=%p]", this)); @@ -1133,8 +1129,8 @@ nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) LOG(("nsHttpConnection::CloseTransaction[this=%x trans=%x reason=%x]\n", this, trans, reason)); - NS_ASSERTION(trans == mTransaction, "wrong transaction"); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(trans == mTransaction, "wrong transaction"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mCurrentBytesRead > mMaxBytesRead) mMaxBytesRead = mCurrentBytesRead; @@ -1373,7 +1369,7 @@ nsHttpConnection::OnSocketReadable() if (gHttpHandler->GetPipelineRescheduleOnTimeout() && mTransaction->PipelineDepth() > 1) { nsHttpPipeline *pipeline = mTransaction->QueryPipeline(); - NS_ABORT_IF_FALSE(pipeline, "pipelinedepth > 1 without pipeline"); + MOZ_ASSERT(pipeline, "pipelinedepth > 1 without pipeline"); // code this defensively for the moment and check for null // This will reschedule blocked members of the pipeline, but the // blocking transaction (i.e. response 0) will not be changed. @@ -1445,8 +1441,8 @@ nsHttpConnection::SetupProxyConnect() LOG(("nsHttpConnection::SetupProxyConnect [this=%x]\n", this)); NS_ENSURE_TRUE(!mProxyConnectStream, NS_ERROR_ALREADY_INITIALIZED); - NS_ABORT_IF_FALSE(!mUsingSpdyVersion, - "SPDY NPN Complete while using proxy connect stream"); + MOZ_ASSERT(!mUsingSpdyVersion, + "SPDY NPN Complete while using proxy connect stream"); nsAutoCString buf; nsresult rv = nsHttpHandler::GenerateHostPort( @@ -1504,11 +1500,11 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConnection, NS_IMETHODIMP nsHttpConnection::OnInputStreamReady(nsIAsyncInputStream *in) { - NS_ASSERTION(in == mSocketIn, "unexpected stream"); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(in == mSocketIn, "unexpected stream"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mIdleMonitoring) { - NS_ABORT_IF_FALSE(!mTransaction, "Idle Input Event While Active"); + MOZ_ASSERT(!mTransaction, "Idle Input Event While Active"); // The only read event that is protocol compliant for an idle connection // is an EOF, which we check for with CanReuse(). If the data is @@ -1546,8 +1542,8 @@ nsHttpConnection::OnInputStreamReady(nsIAsyncInputStream *in) NS_IMETHODIMP nsHttpConnection::OnOutputStreamReady(nsIAsyncOutputStream *out) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(out == mSocketOut, "unexpected socket"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(out == mSocketOut, "unexpected socket"); // if the transaction was dropped... if (!mTransaction) { @@ -1594,7 +1590,7 @@ nsHttpConnection::GetInterface(const nsIID &iid, void **result) // nss thread, not the ui thread as the above comment says. So there is // indeed a chance of mTransaction going away. bug 615342 - NS_ASSERTION(PR_GetCurrentThread() != gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() != gSocketThread); nsCOMPtr callbacks; { diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 53fc31647e1..6da365ce21d 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -255,7 +255,7 @@ nsHttpConnectionMgr::Observe(nsISupports *subject, TimeoutTick(); } else { - NS_ABORT_IF_FALSE(false, "unexpected timer-callback"); + MOZ_ASSERT(false, "unexpected timer-callback"); LOG(("Unexpected timer object\n")); return NS_ERROR_UNEXPECTED; } @@ -489,7 +489,7 @@ nsHttpConnectionMgr::LookupConnectionEntry(nsHttpConnectionInfo *ci, nsresult nsHttpConnectionMgr::CloseIdleConnection(nsHttpConnection *conn) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::CloseIdleConnection %p conn=%p", this, conn)); @@ -520,7 +520,7 @@ void nsHttpConnectionMgr::ReportSpdyConnection(nsHttpConnection *conn, bool usingSpdy) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(), conn, nullptr); @@ -1035,7 +1035,7 @@ nsHttpConnectionMgr::ShutdownPassCB(const nsACString &key, bool nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent, bool considerAll) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::ProcessPendingQForEntry [ci=%s]\n", ent->mConnInfo->HashKey().get())); @@ -1093,7 +1093,7 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent, bool consid bool nsHttpConnectionMgr::ProcessPendingQForEntry(nsHttpConnectionInfo *ci) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsConnectionEntry *ent = mCT.Get(ci->HashKey()); if (ent) @@ -1104,7 +1104,7 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsHttpConnectionInfo *ci) bool nsHttpConnectionMgr::SupportsPipelining(nsHttpConnectionInfo *ci) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsConnectionEntry *ent = mCT.Get(ci->HashKey()); if (ent) @@ -1167,7 +1167,7 @@ nsHttpConnectionMgr::PipelineFeedbackInfo(nsHttpConnectionInfo *ci, void nsHttpConnectionMgr::ReportFailedToProcess(nsIURI *uri) { - NS_ABORT_IF_FALSE(uri, "precondition"); + MOZ_ASSERT(uri); nsAutoCString host; int32_t port = -1; @@ -1293,7 +1293,7 @@ nsHttpConnectionMgr::ClosePersistentConnectionsCB(const nsACString &key, bool nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // If this host is trying to negotiate a SPDY session right now, // don't create any new ssl connections until the result of the @@ -1344,7 +1344,7 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent, { LOG(("nsHttpConnectionMgr::MakeNewConnection %p ent=%p trans=%p", this, ent, trans)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); uint32_t halfOpenLength = ent->mHalfOpens.Length(); for (uint32_t i = 0; i < halfOpenLength; i++) { @@ -1547,7 +1547,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent, bool onlyReusedConnection, nsHttpTransaction *trans) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::TryDispatchTransaction without conn " "[ci=%s caps=%x]\n", ent->mConnInfo->HashKey().get(), uint32_t(trans->Caps()))); @@ -1742,7 +1742,7 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent, trans->ConnectionInfo()->Host(), conn->ConnectionInfo()->Host())); rv = conn->Activate(trans, caps, priority); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "SPDY Cannot Fail Dispatch"); if (NS_SUCCEEDED(rv) && !trans->GetPendingTime().IsNull()) { AccumulateTimeDelta(Telemetry::TRANSACTION_WAIT_TIME_SPDY, trans->GetPendingTime(), TimeStamp::Now()); @@ -1751,8 +1751,8 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent, return rv; } - NS_ABORT_IF_FALSE(conn && !conn->Transaction(), - "DispatchTranaction() on non spdy active connection"); + MOZ_ASSERT(conn && !conn->Transaction(), + "DispatchTranaction() on non spdy active connection"); if (!(caps & NS_HTTP_ALLOW_PIPELINING)) conn->Classify(nsAHttpTransaction::CLASS_SOLO); @@ -1785,8 +1785,8 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent, nsHttpConnection *conn, int32_t priority) { - NS_ABORT_IF_FALSE(!conn->UsingSpdy(), - "Spdy Must Not Use DispatchAbstractTransaction"); + MOZ_ASSERT(!conn->UsingSpdy(), + "Spdy Must Not Use DispatchAbstractTransaction"); LOG(("nsHttpConnectionMgr::DispatchAbstractTransaction " "[ci=%s trans=%x caps=%x conn=%x]\n", ent->mConnInfo->HashKey().get(), aTrans, caps, conn)); @@ -1847,7 +1847,7 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent, nsAHttpTransaction *firstTrans, nsHttpPipeline **result) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); /* form a pipeline here even if nothing is pending so that we can stream-feed it as new transactions arrive */ @@ -1877,7 +1877,7 @@ nsHttpConnectionMgr::ReportProxyTelemetry(nsConnectionEntry *ent) nsresult nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // since "adds" and "cancels" are processed asynchronously and because // various events might trigger an "add" directly on the socket thread, @@ -1892,7 +1892,7 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) nsresult rv = NS_OK; nsHttpConnectionInfo *ci = trans->ConnectionInfo(); - NS_ASSERTION(ci, "no connection info"); + MOZ_ASSERT(ci); nsConnectionEntry *ent = GetOrCreateConnectionEntry(ci); @@ -1919,10 +1919,9 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) conn = dont_AddRef(wrappedConnection->TakeHttpConnection()); if (conn) { - NS_ASSERTION(trans->Caps() & NS_HTTP_STICKY_CONNECTION, - "unexpected caps"); - NS_ABORT_IF_FALSE(((int32_t)ent->mActiveConns.IndexOf(conn)) != -1, - "Sticky Connection Not In Active List"); + MOZ_ASSERT(trans->Caps() & NS_HTTP_STICKY_CONNECTION); + MOZ_ASSERT(((int32_t)ent->mActiveConns.IndexOf(conn)) != -1, + "Sticky Connection Not In Active List"); trans->SetConnection(nullptr); rv = DispatchTransaction(ent, trans, conn); } @@ -1987,7 +1986,7 @@ nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent, uint32_t caps, bool speculative) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsRefPtr sock = new nsHalfOpenSocket(ent, trans, caps); nsresult rv = sock->SetupPrimaryStreams(); @@ -2028,7 +2027,7 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ(nsConnectionEntry *ent) if (NS_FAILED(rv)) { // this cannot happen, but if due to some bug it does then // close the transaction - NS_ABORT_IF_FALSE(false, "Dispatch SPDY Transaction"); + MOZ_ASSERT(false, "Dispatch SPDY Transaction"); LOG(("ProcessSpdyPendingQ Dispatch Transaction failed trans=%p\n", trans)); trans->Close(rv); @@ -2050,7 +2049,7 @@ nsHttpConnectionMgr::ProcessSpdyPendingQCB(const nsACString &key, void nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ(int32_t, void *) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ\n")); mCT.Enumerate(ProcessSpdyPendingQCB, this); } @@ -2058,8 +2057,8 @@ nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ(int32_t, void *) nsHttpConnection * nsHttpConnectionMgr::GetSpdyPreferredConn(nsConnectionEntry *ent) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(ent, "no connection entry"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(ent); nsConnectionEntry *preferred = GetSpdyPreferredEnt(ent); @@ -2091,7 +2090,7 @@ nsHttpConnectionMgr::GetSpdyPreferredConn(nsConnectionEntry *ent) void nsHttpConnectionMgr::OnMsgShutdown(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgShutdown\n")); mCT.Enumerate(ShutdownPassCB, this); @@ -2112,7 +2111,7 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, void *param) void nsHttpConnectionMgr::OnMsgShutdownConfirm(int32_t priority, void *param) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread()); LOG(("nsHttpConnectionMgr::OnMsgShutdownConfirm\n")); bool *shutdown = static_cast(param); @@ -2135,7 +2134,7 @@ nsHttpConnectionMgr::OnMsgNewTransaction(int32_t priority, void *param) void nsHttpConnectionMgr::OnMsgReschedTransaction(int32_t priority, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgReschedTransaction [trans=%p]\n", param)); nsHttpTransaction *trans = (nsHttpTransaction *) param; @@ -2158,7 +2157,7 @@ nsHttpConnectionMgr::OnMsgReschedTransaction(int32_t priority, void *param) void nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p]\n", param)); nsresult closeCode = static_cast(reason); @@ -2191,7 +2190,7 @@ nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param) void nsHttpConnectionMgr::OnMsgProcessPendingQ(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsHttpConnectionInfo *ci = (nsHttpConnectionInfo *) param; if (!ci) { @@ -2218,7 +2217,7 @@ nsHttpConnectionMgr::OnMsgProcessPendingQ(int32_t, void *param) void nsHttpConnectionMgr::OnMsgPruneDeadConnections(int32_t, void *) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgPruneDeadConnections\n")); // Reset mTimeOfNextWakeUp so that we can find a new shortest value. @@ -2247,7 +2246,7 @@ nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup(int32_t, void *param) void nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection [conn=%p]\n", param)); nsHttpConnection *conn = (nsHttpConnection *) param; @@ -2265,7 +2264,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) if (!ent) { // this should never happen LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection ent == null\n")); - NS_ABORT_IF_FALSE(false, "no connection entry"); + MOZ_ASSERT(false, "no connection entry"); NS_ADDREF(ci = conn->ConnectionInfo()); } else { @@ -2336,7 +2335,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) void nsHttpConnectionMgr::OnMsgCompleteUpgrade(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsCompleteUpgradeData *data = (nsCompleteUpgradeData *) param; LOG(("nsHttpConnectionMgr::OnMsgCompleteUpgrade " "this=%p conn=%p listener=%p\n", this, data->mConn.get(), @@ -2400,7 +2399,7 @@ nsHttpConnectionMgr::nsConnectionEntry::~nsConnectionEntry() void nsHttpConnectionMgr::OnMsgProcessFeedback(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsHttpPipelineFeedback *fb = (nsHttpPipelineFeedback *)param; PipelineFeedbackInfo(fb->mConnInfo, fb->mInfo, fb->mConn, fb->mData); @@ -2412,7 +2411,7 @@ nsHttpConnectionMgr::OnMsgProcessFeedback(int32_t, void *param) void nsHttpConnectionMgr::ActivateTimeoutTick() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG(("nsHttpConnectionMgr::ActivateTimeoutTick() " "this=%p mTimeoutTick=%p\n")); @@ -2432,7 +2431,7 @@ nsHttpConnectionMgr::ActivateTimeoutTick() mTimeoutTick->SetTarget(mSocketThreadTarget); } - NS_ABORT_IF_FALSE(!mTimeoutTickArmed, "timer tick armed"); + MOZ_ASSERT(!mTimeoutTickArmed, "timer tick armed"); mTimeoutTickArmed = true; mTimeoutTick->Init(this, 1000, nsITimer::TYPE_REPEATING_SLACK); } @@ -2440,8 +2439,8 @@ nsHttpConnectionMgr::ActivateTimeoutTick() void nsHttpConnectionMgr::TimeoutTick() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(mTimeoutTick, "no readtimeout tick"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mTimeoutTick, "no readtimeout tick"); LOG(("nsHttpConnectionMgr::TimeoutTick active=%d\n", mNumActiveConns)); @@ -2551,7 +2550,7 @@ nsConnectionHandle::TakeTransport(nsISocketTransport **aTransport, void nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsRefPtr trans = dont_AddRef(static_cast(param)); @@ -2623,16 +2622,16 @@ nsHalfOpenSocket::nsHalfOpenSocket(nsConnectionEntry *ent, mSpeculative(false), mHasConnected(false) { - NS_ABORT_IF_FALSE(ent && trans, "constructor with null arguments"); + MOZ_ASSERT(ent && trans, "constructor with null arguments"); LOG(("Creating nsHalfOpenSocket [this=%p trans=%p ent=%s]\n", this, trans, ent->mConnInfo->Host())); } nsHttpConnectionMgr::nsHalfOpenSocket::~nsHalfOpenSocket() { - NS_ABORT_IF_FALSE(!mStreamOut, "streamout not null"); - NS_ABORT_IF_FALSE(!mBackupStreamOut, "backupstreamout not null"); - NS_ABORT_IF_FALSE(!mSynTimer, "syntimer not null"); + MOZ_ASSERT(!mStreamOut); + MOZ_ASSERT(!mBackupStreamOut); + MOZ_ASSERT(!mSynTimer); LOG(("Destroying nsHalfOpenSocket [this=%p]\n", this)); if (mEnt) @@ -2725,7 +2724,7 @@ nsHalfOpenSocket::SetupStreams(nsISocketTransport **transport, nsresult nsHttpConnectionMgr::nsHalfOpenSocket::SetupPrimaryStreams() { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsresult rv; @@ -2770,7 +2769,7 @@ void nsHttpConnectionMgr::nsHalfOpenSocket::SetupBackupTimer() { uint16_t timeout = gHttpHandler->GetIdleSynTimeout(); - NS_ABORT_IF_FALSE(!mSynTimer, "timer already initd"); + MOZ_ASSERT(!mSynTimer, "timer already initd"); if (timeout && !mTransaction->IsDone()) { // Setup the timer that will establish a backup socket @@ -2812,7 +2811,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Abandon() LOG(("nsHalfOpenSocket::Abandon [this=%p ent=%s]", this, mEnt->mConnInfo->Host())); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsRefPtr deleteProtector(this); @@ -2847,8 +2846,8 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Duration(TimeStamp epoch) NS_IMETHODIMP // method for nsITimerCallback nsHttpConnectionMgr::nsHalfOpenSocket::Notify(nsITimer *timer) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(timer == mSynTimer, "wrong timer"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(timer == mSynTimer, "wrong timer"); SetupBackupStreams(); @@ -2861,9 +2860,9 @@ NS_IMETHODIMP nsHttpConnectionMgr:: nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ABORT_IF_FALSE(out == mStreamOut || - out == mBackupStreamOut, "stream mismatch"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(out == mStreamOut || out == mBackupStreamOut, + "stream mismatch"); LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n", this, mEnt->mConnInfo->Host(), out == mStreamOut ? "primary" : "backup")); @@ -2930,8 +2929,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) // if this is still in the pending list, remove it and dispatch it index = mEnt->mPendingQ.IndexOf(mTransaction); if (index != -1) { - NS_ABORT_IF_FALSE(!mSpeculative, - "Speculative Half Open found mTranscation"); + MOZ_ASSERT(!mSpeculative, + "Speculative Half Open found mTranscation"); nsRefPtr temp = dont_AddRef(mEnt->mPendingQ[index]); mEnt->mPendingQ.RemoveElementAt(index); gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt); @@ -2994,7 +2993,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans, uint64_t progress, uint64_t progressMax) { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mTransaction) mTransaction->OnTransportStatus(trans, status, progress); @@ -3085,7 +3084,7 @@ nsHttpConnectionMgr::nsConnectionHandle::TakeHttpConnection() // return our connection object to the caller and clear it internally // do not drop our reference - the caller now owns it. - NS_ASSERTION(mConn, "no connection"); + MOZ_ASSERT(mConn); nsHttpConnection *conn = mConn; mConn = nullptr; return conn; @@ -3155,7 +3154,7 @@ nsConnectionEntry::OnPipelineFeedbackInfo( nsHttpConnection *conn, uint32_t data) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mPipelineState == PS_YELLOW) { if (info & kPipelineInfoTypeBad) @@ -3241,7 +3240,7 @@ nsConnectionEntry::OnPipelineFeedbackInfo( break; default: - NS_ABORT_IF_FALSE(0, "Unknown Bad/Red Pipeline Feedback Event"); + MOZ_ASSERT(false, "Unknown Bad/Red Pipeline Feedback Event"); } const int16_t kPenalty = 25000; @@ -3274,8 +3273,8 @@ void nsHttpConnectionMgr:: nsConnectionEntry::SetYellowConnection(nsHttpConnection *conn) { - NS_ABORT_IF_FALSE(!mYellowConnection && mPipelineState == PS_YELLOW, - "yellow connection already set or state is not yellow"); + MOZ_ASSERT(!mYellowConnection && mPipelineState == PS_YELLOW, + "yellow connection already set or state is not yellow"); mYellowConnection = conn; mYellowGoodEvents = mYellowBadEvents = 0; } diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 870d5cb9655..5178264c102 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -202,7 +202,7 @@ nsHttpHandler::nsHttpHandler() LOG(("Creating nsHttpHandler [this=%x].\n", this)); - NS_ASSERTION(!gHttpHandler, "HTTP handler already created!"); + MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!"); gHttpHandler = this; } @@ -492,7 +492,7 @@ uint32_t nsHttpHandler::Get32BitsOfPseudoRandom() { // only confirm rand seeding on socket thread - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // rand() provides different amounts of PRNG on different platforms. // 15 or 31 bits are common amounts. @@ -561,9 +561,9 @@ nsHttpHandler::BuildUserAgent() { LOG(("nsHttpHandler::BuildUserAgent\n")); - NS_ASSERTION(!mLegacyAppName.IsEmpty() && - !mLegacyAppVersion.IsEmpty(), - "HTTP cannot send practical requests without this much"); + MOZ_ASSERT(!mLegacyAppName.IsEmpty() && + !mLegacyAppVersion.IsEmpty(), + "HTTP cannot send practical requests without this much"); // preallocate to worst-case size, which should always be better // than if we didn't preallocate at all. @@ -657,7 +657,7 @@ nsHttpHandler::InitUserAgentComponents() #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO) || defined(MOZ_B2G) nsCOMPtr infoService = do_GetService("@mozilla.org/system-info;1"); - NS_ASSERTION(infoService, "Could not find a system info service"); + MOZ_ASSERT(infoService, "Could not find a system info service"); bool isTablet; nsresult rv = infoService->GetPropertyAsBool(NS_LITERAL_STRING("tablet"), &isTablet); @@ -1440,7 +1440,7 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua q -= dec; p2 += wrote; available -= wrote; - NS_ASSERTION(available > 0, "allocated string not long enough"); + MOZ_ASSERT(available > 0, "allocated string not long enough"); } } nsCRT::free(o_Accept); @@ -1881,7 +1881,7 @@ nsHttpsHandler::Init() { nsCOMPtr httpHandler( do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http")); - NS_ASSERTION(httpHandler.get() != nullptr, "no http handler?"); + MOZ_ASSERT(httpHandler.get() != nullptr); return NS_OK; } @@ -1918,7 +1918,7 @@ nsHttpsHandler::NewURI(const nsACString &aSpec, NS_IMETHODIMP nsHttpsHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) { - NS_ABORT_IF_FALSE(gHttpHandler, "Should have a HTTP handler by now."); + MOZ_ASSERT(gHttpHandler); if (!gHttpHandler) return NS_ERROR_UNEXPECTED; return gHttpHandler->NewChannel(aURI, _retval); diff --git a/netwerk/protocol/http/nsHttpHeaderArray.h b/netwerk/protocol/http/nsHttpHeaderArray.h index a977c7d9ae0..a678fa89012 100644 --- a/netwerk/protocol/http/nsHttpHeaderArray.h +++ b/netwerk/protocol/http/nsHttpHeaderArray.h @@ -203,8 +203,8 @@ nsHttpHeaderArray::IsSuspectDuplicateHeader(nsHttpAtom header) header == nsHttp::Content_Disposition || header == nsHttp::Location; - NS_ASSERTION(!retval || IsSingletonHeader(header), - "Only non-mergeable headers should be in this list\n"); + MOZ_ASSERT(!retval || IsSingletonHeader(header), + "Only non-mergeable headers should be in this list\n"); return retval; } diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp index e8eb8a6fb26..9d863e5cd30 100644 --- a/netwerk/protocol/http/nsHttpPipeline.cpp +++ b/netwerk/protocol/http/nsHttpPipeline.cpp @@ -180,13 +180,12 @@ nsHttpPipeline::OnHeadersAvailable(nsAHttpTransaction *trans, { LOG(("nsHttpPipeline::OnHeadersAvailable [this=%x]\n", this)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ASSERTION(mConnection, "no connection"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mConnection, "no connection"); nsRefPtr ci; GetConnectionInfo(getter_AddRefs(ci)); - - NS_ABORT_IF_FALSE(ci, "no connection info"); + MOZ_ASSERT(ci); bool pipeliningBefore = gHttpHandler->ConnMgr()->SupportsPipelining(ci); @@ -210,8 +209,8 @@ nsHttpPipeline::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) LOG(("nsHttpPipeline::CloseTransaction [this=%x trans=%x reason=%x]\n", this, trans, reason)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ASSERTION(NS_FAILED(reason), "expecting failure code"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(NS_FAILED(reason), "expecting failure code"); // the specified transaction is to be closed with the given "reason" @@ -290,8 +289,8 @@ nsHttpPipeline::PushBack(const char *data, uint32_t length) { LOG(("nsHttpPipeline::PushBack [this=%x len=%u]\n", this, length)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ASSERTION(mPushBackLen == 0, "push back buffer already has data!"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(mPushBackLen == 0, "push back buffer already has data!"); // If we have no chance for a pipeline (e.g. due to an Upgrade) // then push this data down to original connection @@ -317,7 +316,7 @@ nsHttpPipeline::PushBack(const char *data, uint32_t length) } else if (length > mPushBackMax) { // grow push back buffer as necessary. - NS_ASSERTION(length <= nsIOService::gDefaultSegmentSize, "too big"); + MOZ_ASSERT(length <= nsIOService::gDefaultSegmentSize, "too big"); mPushBackMax = length; mPushBackBuf = (char *) realloc(mPushBackBuf, mPushBackMax); if (!mPushBackBuf) @@ -407,8 +406,8 @@ nsHttpPipeline::SetConnection(nsAHttpConnection *conn) { LOG(("nsHttpPipeline::SetConnection [this=%x conn=%x]\n", this, conn)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); - NS_ASSERTION(!mConnection, "already have a connection"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); + MOZ_ASSERT(!mConnection, "already have a connection"); NS_IF_ADDREF(mConnection = conn); } @@ -418,14 +417,14 @@ nsHttpPipeline::Connection() { LOG(("nsHttpPipeline::Connection [this=%x conn=%x]\n", this, mConnection)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); return mConnection; } void nsHttpPipeline::GetSecurityCallbacks(nsIInterfaceRequestor **result) { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // depending on timing this could be either the request or the response // that is needed - but they both go to the same host. A request for these @@ -448,7 +447,7 @@ nsHttpPipeline::OnTransportStatus(nsITransport* transport, LOG(("nsHttpPipeline::OnStatus [this=%x status=%x progress=%llu]\n", this, status, progress)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsAHttpTransaction *trans; int32_t i, count; @@ -591,7 +590,7 @@ nsHttpPipeline::ReadSegments(nsAHttpSegmentReader *reader, { LOG(("nsHttpPipeline::ReadSegments [this=%x count=%u]\n", this, count)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mClosed) { *countRead = 0; @@ -639,7 +638,7 @@ nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer, { LOG(("nsHttpPipeline::WriteSegments [this=%x count=%u]\n", this, count)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mClosed) return NS_SUCCEEDED(mStatus) ? NS_BASE_STREAM_CLOSED : mStatus; diff --git a/netwerk/protocol/http/nsHttpResponseHead.cpp b/netwerk/protocol/http/nsHttpResponseHead.cpp index 3a3959c4e19..d9f3894796c 100644 --- a/netwerk/protocol/http/nsHttpResponseHead.cpp +++ b/netwerk/protocol/http/nsHttpResponseHead.cpp @@ -238,7 +238,7 @@ nsHttpResponseHead::ComputeCurrentAge(uint32_t now, if (NS_SUCCEEDED(GetAgeValue(&ageValue))) *result = std::max(*result, ageValue); - NS_ASSERTION(now >= requestTime, "bogus request time"); + MOZ_ASSERT(now >= requestTime, "bogus request time"); // Compute current age *result += (now - requestTime); diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 8d772f9b217..6731cf3cf82 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -199,9 +199,9 @@ nsHttpTransaction::Init(uint32_t caps, LOG(("nsHttpTransaction::Init [this=%x caps=%x]\n", this, caps)); - NS_ASSERTION(cinfo, "ouch"); - NS_ASSERTION(requestHead, "ouch"); - NS_ASSERTION(target, "ouch"); + MOZ_ASSERT(cinfo); + MOZ_ASSERT(requestHead); + MOZ_ASSERT(target); mActivityDistributor = do_GetService(NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; @@ -346,7 +346,7 @@ nsHttpTransaction::Connection() nsHttpResponseHead * nsHttpTransaction::TakeResponseHead() { - NS_ABORT_IF_FALSE(!mResponseHeadTaken, "TakeResponseHead called 2x"); + MOZ_ASSERT(!mResponseHeadTaken, "TakeResponseHead called 2x"); // Lock RestartInProgress() and TakeResponseHead() against main thread MutexAutoLock lock(*nsHttp::GetLock()); @@ -458,7 +458,7 @@ nsHttpTransaction::OnTransportStatus(nsITransport* transport, if (!mTransportSink) return; - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // Need to do this before the STATUS_RECEIVING_FROM check below, to make // sure that the activity distributor gets told about all status events. @@ -495,7 +495,7 @@ nsHttpTransaction::OnTransportStatus(nsITransport* transport, return; nsCOMPtr seekable = do_QueryInterface(mRequestStream); - NS_ASSERTION(seekable, "Request stream isn't seekable?!?"); + MOZ_ASSERT(seekable, "Request stream isn't seekable?!?"); int64_t prog = 0; seekable->Tell(&prog); @@ -570,7 +570,7 @@ nsresult nsHttpTransaction::ReadSegments(nsAHttpSegmentReader *reader, uint32_t count, uint32_t *countRead) { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mTransactionDone) { *countRead = 0; @@ -637,7 +637,7 @@ nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream, "net::http::first-read"); } - NS_ASSERTION(*countWritten > 0, "bad writer"); + MOZ_ASSERT(*countWritten > 0, "bad writer"); trans->mReceivedData = true; // Let the transaction "play" with the buffer. It is free to modify @@ -657,7 +657,7 @@ nsresult nsHttpTransaction::WriteSegments(nsAHttpSegmentWriter *writer, uint32_t count, uint32_t *countWritten) { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mTransactionDone) return NS_SUCCEEDED(mStatus) ? NS_BASE_STREAM_CLOSED : mStatus; @@ -689,7 +689,7 @@ nsHttpTransaction::Close(nsresult reason) { LOG(("nsHttpTransaction::Close [this=%x reason=%x]\n", this, reason)); - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if (mClosed) { LOG((" already closed\n")); @@ -878,7 +878,7 @@ nsHttpTransaction::PipelinePosition() nsresult nsHttpTransaction::RestartInProgress() { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); if ((mRestartCount + 1) >= gHttpHandler->MaxRequestAttempts()) { LOG(("nsHttpTransaction::RestartInProgress() " @@ -939,7 +939,7 @@ nsHttpTransaction::RestartInProgress() nsresult nsHttpTransaction::Restart() { - NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // limit the number of restart attempts - bug 92224 if (++mRestartCount >= gHttpHandler->MaxRequestAttempts()) { @@ -971,7 +971,7 @@ char * nsHttpTransaction::LocateHttpStart(char *buf, uint32_t len, bool aAllowPartialMatch) { - NS_ASSERTION(!aAllowPartialMatch || mLineBuf.IsEmpty(), "ouch"); + MOZ_ASSERT(!aAllowPartialMatch || mLineBuf.IsEmpty()); static const char HTTPHeader[] = "HTTP/1."; static const uint32_t HTTPHeaderLen = sizeof(HTTPHeader) - 1; @@ -983,7 +983,7 @@ nsHttpTransaction::LocateHttpStart(char *buf, uint32_t len, // mLineBuf can contain partial match from previous search if (!mLineBuf.IsEmpty()) { - NS_ASSERTION(mLineBuf.Length() < HTTPHeaderLen, "ouch"); + MOZ_ASSERT(mLineBuf.Length() < HTTPHeaderLen); int32_t checkChars = std::min(len, HTTPHeaderLen - mLineBuf.Length()); if (PL_strncasecmp(buf, HTTPHeader + mLineBuf.Length(), checkChars) == 0) { @@ -1179,7 +1179,7 @@ nsHttpTransaction::ParseHead(char *buf, } // otherwise we can assume that we don't have a HTTP/0.9 response. - NS_ABORT_IF_FALSE (mHttpResponseMatched, "inconsistent"); + MOZ_ASSERT (mHttpResponseMatched); while ((eol = static_cast(memchr(buf, '\n', count - *countRead))) != nullptr) { // found line in range [buf:eol] len = eol - buf + 1; @@ -1344,7 +1344,7 @@ nsHttpTransaction::HandleContent(char *buf, *contentRead = 0; *contentRemaining = 0; - NS_ASSERTION(mConnection, "no connection"); + MOZ_ASSERT(mConnection); if (!mDidContentStart) { rv = HandleContentStart(); @@ -1517,7 +1517,7 @@ nsHttpTransaction::ProcessData(char *buf, uint32_t count, uint32_t *countRead) // we may have read more than our share, in which case we must give // the excess bytes back to the connection if (mResponseIsComplete && countRemaining) { - NS_ASSERTION(mConnection, "no connection"); + MOZ_ASSERT(mConnection); mConnection->PushBack(buf + *countRead, countRemaining); } } diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 0131442b990..917f3d09217 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -282,8 +282,8 @@ private: int64_t ToReadBeforeRestart() { return mToReadBeforeRestart; } void HaveReadBeforeRestart(uint32_t amt) { - NS_ABORT_IF_FALSE(amt <= mToReadBeforeRestart, - "too large of a HaveReadBeforeRestart deduction"); + MOZ_ASSERT(amt <= mToReadBeforeRestart, + "too large of a HaveReadBeforeRestart deduction"); mToReadBeforeRestart -= amt; } From e81bfaced378fc7ba07ffc6418b760bdb32549e0 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Thu, 16 May 2013 09:30:42 -0400 Subject: [PATCH 58/73] bug 871289 [2 of 2] fix trailing whitespace in netwerk/protocol/http/* r=jduell --- netwerk/protocol/http/ASpdySession.cpp | 2 +- .../protocol/http/ConnectionDiagnostics.cpp | 36 ++-- netwerk/protocol/http/HttpBaseChannel.cpp | 56 +++--- netwerk/protocol/http/HttpBaseChannel.h | 18 +- netwerk/protocol/http/HttpChannelChild.cpp | 50 +++--- netwerk/protocol/http/HttpChannelChild.h | 4 +- netwerk/protocol/http/HttpChannelParent.cpp | 48 +++--- .../http/HttpChannelParentListener.cpp | 18 +- netwerk/protocol/http/NullHttpTransaction.cpp | 4 +- netwerk/protocol/http/PHttpChannel.ipdl | 10 +- netwerk/protocol/http/README | 6 +- netwerk/protocol/http/SpdySession2.cpp | 162 +++++++++--------- netwerk/protocol/http/SpdySession2.h | 18 +- netwerk/protocol/http/SpdySession3.cpp | 156 ++++++++--------- netwerk/protocol/http/SpdySession3.h | 12 +- netwerk/protocol/http/SpdyStream2.cpp | 74 ++++---- netwerk/protocol/http/SpdyStream2.h | 4 +- netwerk/protocol/http/SpdyStream3.cpp | 78 ++++----- netwerk/protocol/http/SpdyStream3.h | 4 +- netwerk/protocol/http/nsAHttpTransaction.h | 8 +- netwerk/protocol/http/nsHttp.cpp | 2 +- netwerk/protocol/http/nsHttpAtomList.h | 2 +- netwerk/protocol/http/nsHttpAuthCache.cpp | 6 +- netwerk/protocol/http/nsHttpAuthCache.h | 10 +- netwerk/protocol/http/nsHttpChannel.cpp | 160 ++++++++--------- netwerk/protocol/http/nsHttpChannel.h | 8 +- .../protocol/http/nsHttpChannelAuthProvider.h | 2 +- .../protocol/http/nsHttpChunkedDecoder.cpp | 10 +- netwerk/protocol/http/nsHttpConnection.cpp | 54 +++--- netwerk/protocol/http/nsHttpConnection.h | 6 +- netwerk/protocol/http/nsHttpConnectionInfo.h | 8 +- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 122 ++++++------- netwerk/protocol/http/nsHttpConnectionMgr.h | 18 +- netwerk/protocol/http/nsHttpDigestAuth.cpp | 28 +-- netwerk/protocol/http/nsHttpHandler.h | 10 +- netwerk/protocol/http/nsHttpHeaderArray.cpp | 6 +- netwerk/protocol/http/nsHttpHeaderArray.h | 4 +- netwerk/protocol/http/nsHttpNTLMAuth.cpp | 24 +-- netwerk/protocol/http/nsHttpPipeline.cpp | 40 ++--- netwerk/protocol/http/nsHttpPipeline.h | 4 +- netwerk/protocol/http/nsHttpRequestHead.cpp | 2 +- netwerk/protocol/http/nsHttpResponseHead.cpp | 30 ++-- netwerk/protocol/http/nsHttpResponseHead.h | 4 +- netwerk/protocol/http/nsHttpTransaction.cpp | 60 +++---- netwerk/protocol/http/nsHttpTransaction.h | 8 +- .../protocol/http/nsIHttpActivityObserver.idl | 4 +- netwerk/protocol/http/nsIHttpAuthManager.idl | 2 +- .../http/nsIHttpAuthenticableChannel.idl | 4 +- .../protocol/http/nsIHttpAuthenticator.idl | 4 +- netwerk/protocol/http/nsIHttpChannel.idl | 4 +- .../protocol/http/nsIHttpChannelInternal.idl | 2 +- netwerk/protocol/http/nsIHttpEventSink.idl | 2 +- .../protocol/http/nsIHttpProtocolHandler.idl | 4 +- 53 files changed, 710 insertions(+), 712 deletions(-) diff --git a/netwerk/protocol/http/ASpdySession.cpp b/netwerk/protocol/http/ASpdySession.cpp index ffbcab7e36b..be108268acf 100644 --- a/netwerk/protocol/http/ASpdySession.cpp +++ b/netwerk/protocol/http/ASpdySession.cpp @@ -34,7 +34,7 @@ ASpdySession::NewSpdySession(uint32_t version, // versions, so there is no risk of the server ignoring our prefs. Telemetry::Accumulate(Telemetry::SPDY_VERSION2, version); - + if (version == SpdyInformation::SPDY_VERSION_2) return new SpdySession2(aTransaction, aTransport, aPriority); diff --git a/netwerk/protocol/http/ConnectionDiagnostics.cpp b/netwerk/protocol/http/ConnectionDiagnostics.cpp index 1bb955dd1d5..71ec7b7228c 100644 --- a/netwerk/protocol/http/ConnectionDiagnostics.cpp +++ b/netwerk/protocol/http/ConnectionDiagnostics.cpp @@ -37,8 +37,8 @@ nsHttpConnectionMgr::OnMsgPrintDiagnostics(int32_t, void *) mLogData.AppendPrintf("mNumActiveConns = %d\n", mNumActiveConns); mLogData.AppendPrintf("mNumIdleConns = %d\n", mNumIdleConns); - mCT.Enumerate(PrintDiagnosticsCB, this); - + mCT.Enumerate(PrintDiagnosticsCB, this); + consoleService->LogStringMessage(NS_ConvertUTF8toUTF16(mLogData).Data()); mLogData.Truncate(); } @@ -91,7 +91,7 @@ nsHttpConnectionMgr::PrintDiagnosticsCB(const nsACString &key, self->mLogData.AppendPrintf(" :: Pending Transaction #%u\n", i); ent->mPendingQ[i]->PrintDiagnostics(self->mLogData); } - + return PL_DHASH_NEXT; } @@ -102,7 +102,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::PrintDiagnostics(nsCString &log) HasConnected(), IsSpeculative()); TimeStamp now = TimeStamp::Now(); - + if (mPrimarySynStarted.IsNull()) log.AppendPrintf(" primary not started\n"); else @@ -114,7 +114,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::PrintDiagnostics(nsCString &log) else log.AppendPrintf(" backup started %.2f ago\n", (now - mBackupSynStarted).ToMilliseconds()); - + log.AppendPrintf(" primary transport %d, backup transport %d\n", !!mSocketTransport.get(), !!mBackupTransport.get()); } @@ -142,15 +142,15 @@ nsHttpConnection::PrintDiagnostics(nsCString &log) log.AppendPrintf(" max-read/read/written %lld/%lld/%lld\n", mMaxBytesRead, mTotalBytesRead, mTotalBytesWritten); - + log.AppendPrintf(" rtt = %ums\n", PR_IntervalToMilliseconds(mRtt)); log.AppendPrintf(" idlemonitoring = %d transactionCount=%d\n", mIdleMonitoring, mHttp1xTransactionCount); - + log.AppendPrintf(" supports pipeline = %d classification = 0x%x\n", mSupportsPipelining, mClassification); - + if (mSpdySession) mSpdySession->PrintDiagnostics(log); } @@ -164,26 +164,26 @@ SpdySession3::PrintDiagnostics(nsCString &log) log.AppendPrintf(" concurrent = %d maxconcurrent = %d\n", mConcurrent, mMaxConcurrent); - + log.AppendPrintf(" roomformorestreams = %d roomformoreconcurrent = %d\n", RoomForMoreStreams(), RoomForMoreConcurrent()); - + log.AppendPrintf(" transactionHashCount = %d streamIDHashCount = %d\n", mStreamTransactionHash.Count(), mStreamIDHash.Count()); log.AppendPrintf(" Queued Stream Size = %d\n", mQueuedStreams.GetSize()); - PRIntervalTime now = PR_IntervalNow(); + PRIntervalTime now = PR_IntervalNow(); log.AppendPrintf(" Ping Threshold = %ums next ping id = 0x%X\n", PR_IntervalToMilliseconds(mPingThreshold), mNextPingID); log.AppendPrintf(" Ping Timeout = %ums\n", PR_IntervalToMilliseconds(gHttpHandler->SpdyPingTimeout())); log.AppendPrintf(" Idle for Any Activity (ping) = %ums\n", - PR_IntervalToMilliseconds(now - mLastReadEpoch)); + PR_IntervalToMilliseconds(now - mLastReadEpoch)); log.AppendPrintf(" Idle for Data Activity = %ums\n", - PR_IntervalToMilliseconds(now - mLastDataReadEpoch)); + PR_IntervalToMilliseconds(now - mLastDataReadEpoch)); if (mPingSentEpoch) log.AppendPrintf(" Ping Outstanding (ping) = %ums, expired = %d\n", PR_IntervalToMilliseconds(now - mPingSentEpoch), @@ -201,26 +201,26 @@ SpdySession2::PrintDiagnostics(nsCString &log) log.AppendPrintf(" concurrent = %d maxconcurrent = %d\n", mConcurrent, mMaxConcurrent); - + log.AppendPrintf(" roomformorestreams = %d roomformoreconcurrent = %d\n", RoomForMoreStreams(), RoomForMoreConcurrent()); - + log.AppendPrintf(" transactionHashCount = %d streamIDHashCount = %d\n", mStreamTransactionHash.Count(), mStreamIDHash.Count()); log.AppendPrintf(" Queued Stream Size = %d\n", mQueuedStreams.GetSize()); - PRIntervalTime now = PR_IntervalNow(); + PRIntervalTime now = PR_IntervalNow(); log.AppendPrintf(" Ping Threshold = %ums next ping id = 0x%X\n", PR_IntervalToMilliseconds(mPingThreshold), mNextPingID); log.AppendPrintf(" Ping Timeout = %ums\n", PR_IntervalToMilliseconds(gHttpHandler->SpdyPingTimeout())); log.AppendPrintf(" Idle for Any Activity (ping) = %ums\n", - PR_IntervalToMilliseconds(now - mLastReadEpoch)); + PR_IntervalToMilliseconds(now - mLastReadEpoch)); log.AppendPrintf(" Idle for Data Activity = %ums\n", - PR_IntervalToMilliseconds(now - mLastDataReadEpoch)); + PR_IntervalToMilliseconds(now - mLastDataReadEpoch)); if (mPingSentEpoch) log.AppendPrintf(" Ping Outstanding (ping) = %ums, expired = %d\n", PR_IntervalToMilliseconds(now - mPingSentEpoch), diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index eefed2f3a42..dc8ed5818b0 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -334,7 +334,7 @@ HttpBaseChannel::SetContentType(const nsACString& aContentType) net_ParseContentType(aContentType, mContentTypeHint, mContentCharsetHint, &dummy); } - + return NS_OK; } @@ -515,7 +515,7 @@ HttpBaseChannel::ExplicitSetUploadStream(nsIInputStream *aStream, const nsACString &aMethod, bool aStreamHasHeaders) { - // Ensure stream is set and method is valid + // Ensure stream is set and method is valid NS_ENSURE_TRUE(aStream, NS_ERROR_FAILURE); if (aContentLength < 0 && !aStreamHasHeaders) { @@ -530,12 +530,12 @@ HttpBaseChannel::ExplicitSetUploadStream(nsIInputStream *aStream, NS_ENSURE_SUCCESS(rv, rv); if (!aStreamHasHeaders) { - // SetRequestHeader propagates headers to chrome if HttpChannelChild + // SetRequestHeader propagates headers to chrome if HttpChannelChild nsAutoCString contentLengthStr; contentLengthStr.AppendInt(aContentLength); - SetRequestHeader(NS_LITERAL_CSTRING("Content-Length"), contentLengthStr, + SetRequestHeader(NS_LITERAL_CSTRING("Content-Length"), contentLengthStr, false); - SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"), aContentType, + SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"), aContentType, false); } @@ -654,7 +654,7 @@ HttpBaseChannel::GetContentEncodings(nsIUTF8StringEnumerator** aEncodings) *aEncodings = nullptr; return NS_OK; } - + const char *encoding = mResponseHead->PeekHeader(nsHttp::Content_Encoding); if (!encoding) { *aEncodings = nullptr; @@ -678,7 +678,7 @@ HttpBaseChannel::nsContentEncodings::nsContentEncodings(nsIHttpChannel* aChannel mCurEnd = aEncodingHeader + strlen(aEncodingHeader); mCurStart = mCurEnd; } - + HttpBaseChannel::nsContentEncodings::~nsContentEncodings() { } @@ -730,7 +730,7 @@ HttpBaseChannel::nsContentEncodings::GetNext(nsACString& aNextEncoding) haveType = true; } } - + if (!haveType) { encoding.BeginReading(start); if (CaseInsensitiveFindInReadable(NS_LITERAL_CSTRING("deflate"), start, end)) { @@ -742,7 +742,7 @@ HttpBaseChannel::nsContentEncodings::GetNext(nsACString& aNextEncoding) // Prepare to fetch the next encoding mCurEnd = mCurStart; mReady = false; - + if (haveType) return NS_OK; @@ -764,10 +764,10 @@ nsresult HttpBaseChannel::nsContentEncodings::PrepareForNext(void) { MOZ_ASSERT(mCurStart == mCurEnd, "Indeterminate state"); - + // At this point both mCurStart and mCurEnd point to somewhere // past the end of the next thing we want to return - + while (mCurEnd != mEncodingHeader) { --mCurEnd; if (*mCurEnd != ',' && !nsCRT::IsAsciiSpace(*mCurEnd)) @@ -776,17 +776,17 @@ HttpBaseChannel::nsContentEncodings::PrepareForNext(void) if (mCurEnd == mEncodingHeader) return NS_ERROR_NOT_AVAILABLE; // no more encodings ++mCurEnd; - + // At this point mCurEnd points to the first char _after_ the // header we want. Furthermore, mCurEnd - 1 != mEncodingHeader - + mCurStart = mCurEnd - 1; while (mCurStart != mEncodingHeader && *mCurStart != ',' && !nsCRT::IsAsciiSpace(*mCurStart)) --mCurStart; if (*mCurStart == ',' || nsCRT::IsAsciiSpace(*mCurStart)) ++mCurStart; // we stopped because of a weird char, so move up one - + // At this point mCurStart and mCurEnd bracket the encoding string // we want. Check that it's not "identity" if (Substring(mCurStart, mCurEnd).Equals("identity", @@ -794,7 +794,7 @@ HttpBaseChannel::nsContentEncodings::PrepareForNext(void) mCurEnd = mCurStart; return PrepareForNext(); } - + mReady = true; return NS_OK; } @@ -871,7 +871,7 @@ HttpBaseChannel::SetReferrer(nsIURI *referrer) // perhaps some sort of generic nsINestedURI could be used. then, if an URI // fails the whitelist test, then we could check for an inner URI and try // that instead. though, that might be too automatic. - // + // rv = referrer->SchemeIs("wyciwyg", &match); if (NS_FAILED(rv)) return rv; if (match) { @@ -883,7 +883,7 @@ HttpBaseChannel::SetReferrer(nsIURI *referrer) if (pathLength <= 2) return NS_ERROR_FAILURE; // Path is of the form "//123/http://foo/bar", with a variable number of digits. - // To figure out where the "real" URL starts, search path for a '/', starting at + // To figure out where the "real" URL starts, search path for a '/', starting at // the third character. int32_t slashIndex = path.FindChar('/', 2); if (slashIndex == kNotFound) return NS_ERROR_FAILURE; @@ -1001,7 +1001,7 @@ HttpBaseChannel::SetRequestHeader(const nsACString& aHeader, // Header names are restricted to valid HTTP tokens. if (!nsHttp::IsValidToken(flatHeader)) return NS_ERROR_INVALID_ARG; - + // Header values MUST NOT contain line-breaks. RFC 2616 technically // permits CTL characters, including CR and LF, in header values provided // they are quoted. However, this can lead to problems if servers do not @@ -1040,8 +1040,8 @@ HttpBaseChannel::GetResponseHeader(const nsACString &header, nsACString &value) } NS_IMETHODIMP -HttpBaseChannel::SetResponseHeader(const nsACString& header, - const nsACString& value, +HttpBaseChannel::SetResponseHeader(const nsACString& header, + const nsACString& value, bool merge) { LOG(("HttpBaseChannel::SetResponseHeader [this=%p header=\"%s\" value=\"%s\" merge=%u]\n", @@ -1054,7 +1054,7 @@ HttpBaseChannel::SetResponseHeader(const nsACString& header, if (!atom) return NS_ERROR_NOT_AVAILABLE; - // these response headers must not be changed + // these response headers must not be changed if (atom == nsHttp::Content_Type || atom == nsHttp::Content_Length || atom == nsHttp::Content_Encoding || @@ -1347,7 +1347,7 @@ HttpBaseChannel::HTTPUpgrade(const nsACString &aProtocolName, { NS_ENSURE_ARG(!aProtocolName.IsEmpty()); NS_ENSURE_ARG_POINTER(aListener); - + mUpgradeProtocol = aProtocolName; mUpgradeProtocolCallback = aListener; return NS_OK; @@ -1524,7 +1524,7 @@ HttpBaseChannel::AddCookiesToRequest() return; } - bool useCookieService = + bool useCookieService = (XRE_GetProcessType() == GeckoProcessType_Default); nsXPIDLCString cookie; if (useCookieService) { @@ -1561,7 +1561,7 @@ CopyProperties(const nsAString& aKey, nsIVariant *aData, void *aClosure) } nsresult -HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, +HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, nsIChannel *newChannel, bool preserveMethod) { @@ -1583,7 +1583,7 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, // Do not pass along LOAD_CHECK_OFFLINE_CACHE newLoadFlags &= ~nsICachingChannel::LOAD_CHECK_OFFLINE_CACHE; - newChannel->SetLoadGroup(mLoadGroup); + newChannel->SetLoadGroup(mLoadGroup); newChannel->SetNotificationCallbacks(mCallbacks); newChannel->SetLoadFlags(newLoadFlags); @@ -1642,8 +1642,8 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, } } } - // since preserveMethod is true, we need to ensure that the appropriate - // request method gets set on the channel, regardless of whether or not + // since preserveMethod is true, we need to ensure that the appropriate + // request method gets set on the channel, regardless of whether or not // we set the upload stream above. This means SetRequestMethod() will // be called twice if ExplicitSetUploadStream() gets called above. @@ -1681,7 +1681,7 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, httpInternal->SetCacheKeysRedirectChain(mRedirectedCachekeys.forget()); } } - + // transfer application cache information nsCOMPtr appCacheChannel = do_QueryInterface(newChannel); diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h index 638a8ec328c..f96e5732bcb 100644 --- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -39,7 +39,7 @@ namespace net { /* * This class is a partial implementation of nsIHttpChannel. It contains code - * shared by nsHttpChannel and HttpChannelChild. + * shared by nsHttpChannel and HttpChannelChild. * - Note that this class has nothing to do with nsBaseChannel, which is an * earlier effort at a base class for channels that somehow never made it all * the way to the HTTP channel. @@ -109,11 +109,11 @@ public: NS_IMETHOD GetReferrer(nsIURI **referrer); NS_IMETHOD SetReferrer(nsIURI *referrer); NS_IMETHOD GetRequestHeader(const nsACString& aHeader, nsACString& aValue); - NS_IMETHOD SetRequestHeader(const nsACString& aHeader, + NS_IMETHOD SetRequestHeader(const nsACString& aHeader, const nsACString& aValue, bool aMerge); NS_IMETHOD VisitRequestHeaders(nsIHttpHeaderVisitor *visitor); NS_IMETHOD GetResponseHeader(const nsACString &header, nsACString &value); - NS_IMETHOD SetResponseHeader(const nsACString& header, + NS_IMETHOD SetResponseHeader(const nsACString& header, const nsACString& value, bool merge); NS_IMETHOD VisitResponseHeaders(nsIHttpHeaderVisitor *visitor); NS_IMETHOD GetAllowPipelining(bool *value); @@ -149,13 +149,13 @@ public: NS_IMETHOD SetLoadAsBlocking(bool aLoadAsBlocking); NS_IMETHOD GetLoadUnblocked(bool *aLoadUnblocked); NS_IMETHOD SetLoadUnblocked(bool aLoadUnblocked); - + inline void CleanRedirectCacheChainIfNecessary() { mRedirectedCachekeys = nullptr; } NS_IMETHOD HTTPUpgrade(const nsACString & aProtocolName, - nsIHttpUpgradeListener *aListener); + nsIHttpUpgradeListener *aListener); // nsISupportsPriority NS_IMETHOD GetPriority(int32_t *value); @@ -172,19 +172,19 @@ public: nsContentEncodings(nsIHttpChannel* aChannel, const char* aEncodingHeader); virtual ~nsContentEncodings(); - + private: nsresult PrepareForNext(void); - + // We do not own the buffer. The channel owns it. const char* mEncodingHeader; const char* mCurStart; // points to start of current header const char* mCurEnd; // points to end of current header - + // Hold a ref to our channel so that it can't go away and take the // header with it. nsCOMPtr mChannel; - + bool mReady; }; diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index aec0f9bb516..f1b4bc5e2c7 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -189,8 +189,8 @@ class StartRequestEvent : public ChannelEvent , mPeerAddr(peerAddr) {} - void Run() - { + void Run() + { mChild->OnStartRequest(mResponseHead, mUseResponseHead, mRequestHeaders, mIsFromCache, mCacheEntryAvailable, mCacheExpirationTime, mCachedCharset, @@ -210,7 +210,7 @@ class StartRequestEvent : public ChannelEvent NetAddr mPeerAddr; }; -bool +bool HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead, const bool& useResponseHead, const nsHttpHeaderArray& requestHeaders, @@ -237,7 +237,7 @@ HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead, return true; } -void +void HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead, const bool& useResponseHead, const nsHttpHeaderArray& requestHeaders, @@ -255,7 +255,7 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead, mResponseHead = new nsHttpResponseHead(responseHead); if (!securityInfoSerialization.IsEmpty()) { - NS_DeserializeObject(securityInfoSerialization, + NS_DeserializeObject(securityInfoSerialization, getter_AddRefs(mSecurityInfo)); } @@ -333,7 +333,7 @@ HttpChannelChild::RecvOnTransportAndData(const nsresult& status, { if (mEventQ.ShouldEnqueue()) { mEventQ.Enqueue(new TransportAndDataEvent(this, status, progress, - progressMax, data, offset, + progressMax, data, offset, count)); } else { OnTransportAndData(status, progress, progressMax, data, offset, count); @@ -424,7 +424,7 @@ class StopRequestEvent : public ChannelEvent nsresult mStatusCode; }; -bool +bool HttpChannelChild::RecvOnStopRequest(const nsresult& statusCode) { if (mEventQ.ShouldEnqueue()) { @@ -435,10 +435,10 @@ HttpChannelChild::RecvOnStopRequest(const nsresult& statusCode) return true; } -void +void HttpChannelChild::OnStopRequest(const nsresult& statusCode) { - LOG(("HttpChannelChild::OnStopRequest [this=%x status=%u]\n", + LOG(("HttpChannelChild::OnStopRequest [this=%x status=%u]\n", this, statusCode)); mIsPending = false; @@ -517,8 +517,8 @@ HttpChannelChild::OnProgress(const uint64_t& progress, // block socket status event after Cancel or OnStopRequest has been called, // or if channel has LOAD_BACKGROUND set - if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && - !(mLoadFlags & LOAD_BACKGROUND)) + if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && + !(mLoadFlags & LOAD_BACKGROUND)) { if (progress > 0) { MOZ_ASSERT(progress <= progressMax, "unexpected progress values"); @@ -568,8 +568,8 @@ HttpChannelChild::OnStatus(const nsresult& status) // block socket status event after Cancel or OnStopRequest has been called, // or if channel has LOAD_BACKGROUND set - if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && - !(mLoadFlags & LOAD_BACKGROUND)) + if (mProgressSink && NS_SUCCEEDED(mStatus) && mIsPending && + !(mLoadFlags & LOAD_BACKGROUND)) { nsAutoCString host; mURI->GetHost(host); @@ -669,10 +669,10 @@ class Redirect1Event : public ChannelEvent , mRedirectFlags(redirectFlags) , mResponseHead(responseHead) {} - void Run() - { + void Run() + { mChild->Redirect1Begin(mNewChannelId, mNewURI, mRedirectFlags, - mResponseHead); + mResponseHead); } private: HttpChannelChild* mChild; @@ -729,7 +729,7 @@ HttpChannelChild::Redirect1Begin(const uint32_t& newChannelId, bool rewriteToGET = nsHttp::ShouldRewriteRedirectToGET( mResponseHead->Status(), mRequestHead.Method()); - + rv = SetupReplacementChannel(uri, newChannel, !rewriteToGET); if (NS_FAILED(rv)) { // Veto redirect. nsHttpChannel decides to cancel or continue. @@ -744,7 +744,7 @@ HttpChannelChild::Redirect1Begin(const uint32_t& newChannelId, NS_ERROR("Redirecting to a protocol that doesn't support universal protocol redirect"); } - rv = gHttpHandler->AsyncOnChannelRedirect(this, + rv = gHttpHandler->AsyncOnChannelRedirect(this, newChannel, redirectFlags); if (NS_FAILED(rv)) @@ -825,7 +825,7 @@ HttpChannelChild::ConnectParent(uint32_t id) } NS_IMETHODIMP -HttpChannelChild::CompleteRedirectSetup(nsIStreamListener *listener, +HttpChannelChild::CompleteRedirectSetup(nsIStreamListener *listener, nsISupports *aContext) { LOG(("HttpChannelChild::FinishRedirectSetup [this=%x]\n", this)); @@ -845,7 +845,7 @@ HttpChannelChild::CompleteRedirectSetup(nsIStreamListener *listener, mListener = listener; mListenerContext = aContext; - // add ourselves to the load group. + // add ourselves to the load group. if (mLoadGroup) mLoadGroup->AddRequest(this, nullptr); @@ -1019,7 +1019,7 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext) mListener = listener; mListenerContext = aContext; - // add ourselves to the load group. + // add ourselves to the load group. if (mLoadGroup) mLoadGroup->AddRequest(this, nullptr); @@ -1097,8 +1097,8 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext) //----------------------------------------------------------------------------- NS_IMETHODIMP -HttpChannelChild::SetRequestHeader(const nsACString& aHeader, - const nsACString& aValue, +HttpChannelChild::SetRequestHeader(const nsACString& aHeader, + const nsACString& aValue, bool aMerge) { nsresult rv = HttpBaseChannel::SetRequestHeader(aHeader, aValue, aMerge); @@ -1352,7 +1352,7 @@ HttpChannelChild::GetAssociatedContentSecurity( } /* attribute unsigned long countSubRequestsBrokenSecurity; */ -NS_IMETHODIMP +NS_IMETHODIMP HttpChannelChild::GetCountSubRequestsBrokenSecurity( int32_t *aSubRequestsBrokenSecurity) { @@ -1362,7 +1362,7 @@ HttpChannelChild::GetCountSubRequestsBrokenSecurity( return assoc->GetCountSubRequestsBrokenSecurity(aSubRequestsBrokenSecurity); } -NS_IMETHODIMP +NS_IMETHODIMP HttpChannelChild::SetCountSubRequestsBrokenSecurity( int32_t aSubRequestsBrokenSecurity) { diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index eafa159a95e..4ae9de6f127 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -67,8 +67,8 @@ public: NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo); NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext); // HttpBaseChannel::nsIHttpChannel - NS_IMETHOD SetRequestHeader(const nsACString& aHeader, - const nsACString& aValue, + NS_IMETHOD SetRequestHeader(const nsACString& aHeader, + const nsACString& aValue, bool aMerge); NS_IMETHOD RedirectTo(nsIURI *newURI); // nsIHttpChannelInternal diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index d59939d2341..9b51ec7e8b3 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -107,7 +107,7 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void **result) // HttpChannelParent::PHttpChannelParent //----------------------------------------------------------------------------- -bool +bool HttpChannelParent::RecvAsyncOpen(const URIParams& aURI, const OptionalURIParams& aOriginalURI, const OptionalURIParams& aDocURI, @@ -142,7 +142,7 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI, nsCString uriSpec; uri->GetSpec(uriSpec); - LOG(("HttpChannelParent RecvAsyncOpen [this=%x uri=%s]\n", + LOG(("HttpChannelParent RecvAsyncOpen [this=%x uri=%s]\n", this, uriSpec.get())); nsresult rv; @@ -256,7 +256,7 @@ HttpChannelParent::RecvConnectChannel(const uint32_t& channelId) return true; } -bool +bool HttpChannelParent::RecvSetPriority(const uint16_t& priority) { if (mChannel) { @@ -322,7 +322,7 @@ HttpChannelParent::RecvUpdateAssociatedContentSecurity(const int32_t& broken, } bool -HttpChannelParent::RecvRedirect2Verify(const nsresult& result, +HttpChannelParent::RecvRedirect2Verify(const nsresult& result, const RequestHeaderTuples& changedHeaders, const OptionalURIParams& aAPIRedirectURI) { @@ -380,7 +380,7 @@ HttpChannelParent::RecvDocumentChannelCleanup() return true; } -bool +bool HttpChannelParent::RecvMarkOfflineCacheEntryAsForeign() { if (mOfflineForeignMarker) { @@ -420,7 +420,7 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) nsCString appCacheClientId; appCache->GetGroupID(appCacheGroupId); appCache->GetClientID(appCacheClientId); - if (mIPCClosed || + if (mIPCClosed || !SendAssociateApplicationCache(appCacheGroupId, appCacheClientId)) { return NS_ERROR_UNEXPECTED; @@ -446,30 +446,30 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) } nsHttpChannel *httpChan = static_cast(mChannel.get()); - if (mIPCClosed || - !SendOnStartRequest(responseHead ? *responseHead : nsHttpResponseHead(), + if (mIPCClosed || + !SendOnStartRequest(responseHead ? *responseHead : nsHttpResponseHead(), !!responseHead, requestHead->Headers(), isFromCache, mCacheDescriptor ? true : false, expirationTime, cachedCharset, secInfoSerialization, - httpChan->GetSelfAddr(), httpChan->GetPeerAddr())) + httpChan->GetSelfAddr(), httpChan->GetPeerAddr())) { - return NS_ERROR_UNEXPECTED; + return NS_ERROR_UNEXPECTED; } return NS_OK; } NS_IMETHODIMP -HttpChannelParent::OnStopRequest(nsIRequest *aRequest, - nsISupports *aContext, +HttpChannelParent::OnStopRequest(nsIRequest *aRequest, + nsISupports *aContext, nsresult aStatusCode) { - LOG(("HttpChannelParent::OnStopRequest: [this=%x status=%ul]\n", + LOG(("HttpChannelParent::OnStopRequest: [this=%x status=%ul]\n", this, aStatusCode)); if (mIPCClosed || !SendOnStopRequest(aStatusCode)) - return NS_ERROR_UNEXPECTED; + return NS_ERROR_UNEXPECTED; return NS_OK; } @@ -478,10 +478,10 @@ HttpChannelParent::OnStopRequest(nsIRequest *aRequest, //----------------------------------------------------------------------------- NS_IMETHODIMP -HttpChannelParent::OnDataAvailable(nsIRequest *aRequest, - nsISupports *aContext, - nsIInputStream *aInputStream, - uint64_t aOffset, +HttpChannelParent::OnDataAvailable(nsIRequest *aRequest, + nsISupports *aContext, + nsIInputStream *aInputStream, + uint64_t aOffset, uint32_t aCount) { LOG(("HttpChannelParent::OnDataAvailable [this=%x]\n", this)); @@ -508,9 +508,9 @@ HttpChannelParent::OnDataAvailable(nsIRequest *aRequest, //----------------------------------------------------------------------------- NS_IMETHODIMP -HttpChannelParent::OnProgress(nsIRequest *aRequest, - nsISupports *aContext, - uint64_t aProgress, +HttpChannelParent::OnProgress(nsIRequest *aRequest, + nsISupports *aContext, + uint64_t aProgress, uint64_t aProgressMax) { // OnStatus has always just set mStoredStatus. If it indicates this precedes @@ -532,9 +532,9 @@ HttpChannelParent::OnProgress(nsIRequest *aRequest, } NS_IMETHODIMP -HttpChannelParent::OnStatus(nsIRequest *aRequest, - nsISupports *aContext, - nsresult aStatus, +HttpChannelParent::OnStatus(nsIRequest *aRequest, + nsISupports *aContext, + nsresult aStatus, const PRUnichar *aStatusArg) { // If this precedes OnDataAvailable, store and ODA will send to child. diff --git a/netwerk/protocol/http/HttpChannelParentListener.cpp b/netwerk/protocol/http/HttpChannelParentListener.cpp index 32150fffa12..391b30acae8 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.cpp +++ b/netwerk/protocol/http/HttpChannelParentListener.cpp @@ -42,7 +42,7 @@ HttpChannelParentListener::~HttpChannelParentListener() // HttpChannelParentListener::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_ISUPPORTS5(HttpChannelParentListener, +NS_IMPL_ISUPPORTS5(HttpChannelParentListener, nsIInterfaceRequestor, nsIStreamListener, nsIRequestObserver, @@ -64,14 +64,14 @@ HttpChannelParentListener::OnStartRequest(nsIRequest *aRequest, nsISupports *aCo } NS_IMETHODIMP -HttpChannelParentListener::OnStopRequest(nsIRequest *aRequest, - nsISupports *aContext, +HttpChannelParentListener::OnStopRequest(nsIRequest *aRequest, + nsISupports *aContext, nsresult aStatusCode) { if (!mActiveChannel) return NS_ERROR_UNEXPECTED; - LOG(("HttpChannelParentListener::OnStopRequest: [this=%x status=%ul]\n", + LOG(("HttpChannelParentListener::OnStopRequest: [this=%x status=%ul]\n", this, aStatusCode)); nsresult rv = mActiveChannel->OnStopRequest(aRequest, aContext, aStatusCode); @@ -84,10 +84,10 @@ HttpChannelParentListener::OnStopRequest(nsIRequest *aRequest, //----------------------------------------------------------------------------- NS_IMETHODIMP -HttpChannelParentListener::OnDataAvailable(nsIRequest *aRequest, - nsISupports *aContext, - nsIInputStream *aInputStream, - uint64_t aOffset, +HttpChannelParentListener::OnDataAvailable(nsIRequest *aRequest, + nsISupports *aContext, + nsIInputStream *aInputStream, + uint64_t aOffset, uint32_t aCount) { if (!mActiveChannel) @@ -101,7 +101,7 @@ HttpChannelParentListener::OnDataAvailable(nsIRequest *aRequest, // HttpChannelParentListener::nsIInterfaceRequestor //----------------------------------------------------------------------------- -NS_IMETHODIMP +NS_IMETHODIMP HttpChannelParentListener::GetInterface(const nsIID& aIID, void **result) { if (aIID.Equals(NS_GET_IID(nsIChannelEventSink)) || diff --git a/netwerk/protocol/http/NullHttpTransaction.cpp b/netwerk/protocol/http/NullHttpTransaction.cpp index 84bc7db97ca..cd40af6c4b6 100644 --- a/netwerk/protocol/http/NullHttpTransaction.cpp +++ b/netwerk/protocol/http/NullHttpTransaction.cpp @@ -127,7 +127,7 @@ NullHttpTransaction::RequestHead() // the NullHttpTransaction and let them be retried from the pending queue // with a bound transcation } - + return mRequestHead; } @@ -168,7 +168,7 @@ NullHttpTransaction::SetPipelinePosition(int32_t position) { return NS_OK; } - + int32_t NullHttpTransaction::PipelinePosition() { diff --git a/netwerk/protocol/http/PHttpChannel.ipdl b/netwerk/protocol/http/PHttpChannel.ipdl index 2470d0e8257..f8826713ecb 100644 --- a/netwerk/protocol/http/PHttpChannel.ipdl +++ b/netwerk/protocol/http/PHttpChannel.ipdl @@ -76,20 +76,20 @@ parent: // For document loads we keep this protocol open after child's // OnStopRequest, and send this msg (instead of __delete__) to allow - // partial cleanup on parent. + // partial cleanup on parent. DocumentChannelCleanup(); // This might have to be sync. If this fails we must fail the document load // to avoid endless loop. // // Explanation: the document loaded was loaded from the offline cache. But - // the cache group id (the manifest URL) of the cache group it was loaded - // from is different then the manifest the document refers to in the html - // tag. If we detect this during the cache selection algorithm, we must not + // the cache group id (the manifest URL) of the cache group it was loaded + // from is different then the manifest the document refers to in the html + // tag. If we detect this during the cache selection algorithm, we must not // load this document from the offline cache group it was just loaded from. // Marking the cache entry as foreign in its cache group will prevent // the document to load from the bad offline cache group. After it is marked, - // we reload the document to take the effect. If we fail to mark the entry + // we reload the document to take the effect. If we fail to mark the entry // as foreign, we will end up in the same situation and reload again and // again, indefinitely. MarkOfflineCacheEntryAsForeign(); diff --git a/netwerk/protocol/http/README b/netwerk/protocol/http/README index 80658f01b8b..621e9e950c4 100644 --- a/netwerk/protocol/http/README +++ b/netwerk/protocol/http/README @@ -19,7 +19,7 @@ CLASS BREAKDOWN - initiates http transactions - processes http response codes - intercepts progress notifications - + nsHttpConnection - implements nsIStreamListener & nsIStreamProvider - talks to the socket transport service @@ -37,7 +37,7 @@ CLASS BREAKDOWN nsHttpChunkedDecoder - owned by a transaction - removes chunked decoding - + nsHttpRequestHead - owns a nsHttpHeaderArray - knows how to fill a request buffer @@ -70,7 +70,7 @@ TRANSACTION MODEL InitiateTransaction -> ActivateConnection -> AsyncWrite, AsyncRead The channel creates transactions, and passes them to the handler via - InitiateTransaction along with a nsHttpConnectionInfo object + InitiateTransaction along with a nsHttpConnectionInfo object identifying the requested connection. The handler either dispatches the transaction immediately or queues it up to be dispatched later, depending on whether or not the limit on the number of connections diff --git a/netwerk/protocol/http/SpdySession2.cpp b/netwerk/protocol/http/SpdySession2.cpp index 73baa3e1045..bf042bc1085 100644 --- a/netwerk/protocol/http/SpdySession2.cpp +++ b/netwerk/protocol/http/SpdySession2.cpp @@ -67,7 +67,7 @@ SpdySession2::SpdySession2(nsAHttpTransaction *aHttpTransaction, LOG3(("SpdySession2::SpdySession2 %p transaction 1 = %p", this, aHttpTransaction)); - + mStreamIDHash.Init(); mStreamTransactionHash.Init(); mConnection = aHttpTransaction->Connection(); @@ -75,12 +75,12 @@ SpdySession2::SpdySession2(nsAHttpTransaction *aHttpTransaction, mDecompressBuffer = new char[mDecompressBufferSize]; mOutputQueueBuffer = new char[mOutputQueueSize]; zlibInit(); - + mSendingChunkSize = gHttpHandler->SpdySendingChunkSize(); if (!aHttpTransaction->IsNullTransaction()) AddStream(aHttpTransaction, firstPriority); mLastDataReadEpoch = mLastReadEpoch; - + mPingThreshold = gHttpHandler->SpdyPingThreshold(); } @@ -90,7 +90,7 @@ SpdySession2::ShutdownEnumerator(nsAHttpTransaction *key, void *closure) { SpdySession2 *self = static_cast(closure); - + // On a clean server hangup the server sets the GoAwayID to be the ID of // the last transaction it processed. If the ID of stream in the // local stream is greater than that it can safely be restarted because the @@ -129,7 +129,7 @@ SpdySession2::~SpdySession2() inflateEnd(&mDownstreamZlib); deflateEnd(&mUpstreamZlib); - + mStreamTransactionHash.Enumerate(ShutdownEnumerator, this); Telemetry::Accumulate(Telemetry::SPDY_PARALLEL_STREAMS, mConcurrentHighWater); Telemetry::Accumulate(Telemetry::SPDY_REQUEST_PER_CONN, (mNextStreamID - 1) / 2); @@ -143,7 +143,7 @@ SpdySession2::LogIO(SpdySession2 *self, SpdyStream2 *stream, const char *label, { if (!LOG4_ENABLED()) return; - + LOG4(("SpdySession2::LogIO %p stream=%p id=0x%X [%s]", self, stream, stream ? stream->StreamID() : 0, label)); @@ -175,7 +175,7 @@ SpdySession2::LogIO(SpdySession2 *self, SpdyStream2 *stream, const char *label, } typedef nsresult (*Control_FX) (SpdySession2 *self); -static Control_FX sControlFunctions[] = +static Control_FX sControlFunctions[] = { nullptr, SpdySession2::HandleSynStream, @@ -241,7 +241,7 @@ SpdySession2::ReadTimeoutTick(PRIntervalTime now) } return; } - + LOG(("SpdySession2::ReadTimeoutTick %p generating ping 0x%x\n", this, mNextPingID)); @@ -274,7 +274,7 @@ SpdySession2::RegisterStreamID(SpdyStream2 *stream) "concurrent=%d",this, stream, mNextStreamID, mConcurrent)); MOZ_ASSERT(mNextStreamID < 0xfffffff0, "should have stopped admitting streams"); - + uint32_t result = mNextStreamID; mNextStreamID += 2; @@ -317,7 +317,7 @@ SpdySession2::AddStream(nsAHttpTransaction *aHttpTransaction, &mUpstreamZlib, aPriority); - + LOG3(("SpdySession2::AddStream session=%p stream=%p NextID=0x%X (tentative)", this, stream, mNextStreamID)); @@ -333,7 +333,7 @@ SpdySession2::AddStream(nsAHttpTransaction *aHttpTransaction, this, stream)); mQueuedStreams.Push(stream); } - + return true; } @@ -415,7 +415,7 @@ SpdySession2::FlushOutputQueue() { if (!mSegmentReader || !mOutputQueueUsed) return; - + nsresult rv; uint32_t countRead; uint32_t avail = mOutputQueueUsed - mOutputQueueSent; @@ -425,11 +425,11 @@ SpdySession2::FlushOutputQueue() &countRead); LOG3(("SpdySession2::FlushOutputQueue %p sz=%d rv=%x actual=%d", this, avail, rv, countRead)); - + // Dont worry about errors on write, we will pick this up as a read error too if (NS_FAILED(rv)) return; - + if (countRead == avail) { mOutputQueueUsed = 0; mOutputQueueSent = 0; @@ -440,7 +440,7 @@ SpdySession2::FlushOutputQueue() // If the output queue is close to filling up and we have sent out a good // chunk of data from the beginning then realign it. - + if ((mOutputQueueSent >= kQueueMinimumCleanup) && ((mOutputQueueSize - mOutputQueueUsed) < kQueueTailRoom)) { RealignOutputQueue(); @@ -501,13 +501,13 @@ SpdySession2::EnsureBuffer(nsAutoArrayPtr &buf, { if (objSize >= newSize) return; - + // Leave a little slop on the new allocation - add 2KB to // what we need and then round the result up to a 4KB (page) // boundary. objSize = (newSize + 2048 + 4095) & ~4095; - + nsAutoArrayPtr tmp(new char[objSize]); memcpy(tmp, buf, preserve); buf = tmp; @@ -557,20 +557,20 @@ SpdySession2::DownstreamUncompress(char *blockStart, uint32_t blockLen) LOG3(("SpdySession2::DownstreamUncompress %p Dictionary Error\n", this)); return NS_ERROR_FAILURE; } - + triedDictionary = true; inflateSetDictionary(&mDownstreamZlib, reinterpret_cast (SpdyStream2::kDictionary), strlen(SpdyStream2::kDictionary) + 1); } - + if (zlib_rv == Z_DATA_ERROR || zlib_rv == Z_MEM_ERROR) return NS_ERROR_FAILURE; mDecompressBufferUsed += mDecompressBufferSize - mDecompressBufferUsed - mDownstreamZlib.avail_out; - + // When there is no more output room, but input still available then // increase the output space if (zlib_rv == Z_OK && @@ -635,7 +635,7 @@ SpdySession2::ConvertHeaders(nsDependentCSubstring &status, // Content-Length is 'advisory'.. we will not strip it because it can // create UI feedback. - + mFlatHTTPResponseHeaders.Append(version); mFlatHTTPResponseHeaders.Append(NS_LITERAL_CSTRING(" ")); mFlatHTTPResponseHeaders.Append(status); @@ -713,7 +713,7 @@ SpdySession2::ConvertHeaders(nsDependentCSubstring &status, Substring(reinterpret_cast(nvpair) + 4 + nameLen, reinterpret_cast(nvpair) + 4 + nameLen + valueLen); - + mFlatHTTPResponseHeaders.Append(nameString); mFlatHTTPResponseHeaders.Append(NS_LITERAL_CSTRING(": ")); @@ -741,7 +741,7 @@ SpdySession2::ConvertHeaders(nsDependentCSubstring &status, NS_LITERAL_CSTRING("X-Firefox-Spdy: 2\r\n\r\n")); LOG (("decoded response headers are:\n%s", mFlatHTTPResponseHeaders.get())); - + return NS_OK; } @@ -764,7 +764,7 @@ SpdySession2::GeneratePing(uint32_t aID) packet[5] = 0; packet[6] = 0; packet[7] = 4; /* length */ - + aID = PR_htonl(aID); memcpy(packet + 8, &aID, 4); @@ -790,7 +790,7 @@ SpdySession2::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) packet[5] = 0; packet[6] = 0; packet[7] = 8; /* length */ - + aID = PR_htonl(aID); memcpy(packet + 8, &aID, 4); aStatusCode = PR_htonl(aStatusCode); @@ -815,7 +815,7 @@ SpdySession2::GenerateGoAway() packet[1] = 2; /* version 2 */ packet[3] = CONTROL_TYPE_GOAWAY; packet[7] = 4; /* data length */ - + // last-good-stream-id are bytes 8-11, when we accept server push this will // need to be set non zero @@ -839,21 +839,21 @@ SpdySession2::VerifyStream(SpdyStream2 *aStream, uint32_t aOptionalID = 0) return true; uint32_t test = 0; - + do { if (aStream->StreamID() == kDeadStreamID) break; nsAHttpTransaction *trans = aStream->Transaction(); - test++; + test++; if (!trans) break; test++; if (mStreamTransactionHash.Get(trans) != aStream) break; - + if (aStream->StreamID()) { SpdyStream2 *idStream = mStreamIDHash.Get(aStream->StreamID()); @@ -900,7 +900,7 @@ SpdySession2::CleanupStream(SpdyStream2 *aStream, nsresult aResult, --mConcurrent; ProcessPending(); } - + CloseStream(aStream, aResult); // Remove the stream from the ID hash table. (this one isn't short, which is @@ -965,7 +965,7 @@ nsresult SpdySession2::HandleSynStream(SpdySession2 *self) { MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM); - + if (self->mInputFrameDataSize < 18) { LOG3(("SpdySession2::HandleSynStream %p SYN_STREAM too short data=%d", self, self->mInputFrameDataSize)); @@ -980,7 +980,7 @@ SpdySession2::HandleSynStream(SpdySession2 *self) LOG3(("SpdySession2::HandleSynStream %p recv SYN_STREAM (push) " "for ID 0x%X associated with 0x%X.", self, streamID, associatedID)); - + if (streamID & 0x01) { // test for odd stream ID LOG3(("SpdySession2::HandleSynStream %p recvd SYN_STREAM id must be even.", self)); @@ -1033,7 +1033,7 @@ SpdySession2::HandleSynReply(SpdySession2 *self) // A framing error is a session wide error that cannot be recovered return NS_ERROR_ILLEGAL_VALUE; } - + // Uncompress the headers into mDecompressBuffer, leaving them in // spdy format for the time being. Make certain to do this // step before any error handling that might abort the stream but not @@ -1104,7 +1104,7 @@ SpdySession2::HandleSynReplyForValidStream() LOG3(("SpdySession2::HandleSynReplyForValidStream %p SYN_REPLY for 0x%X " "fin=%d", this, mInputFrameDataStream->StreamID(), mInputFrameDataLast)); - + Telemetry::Accumulate(Telemetry::SPDY_SYN_REPLY_SIZE, mInputFrameDataSize - 6); if (mDecompressBufferUsed) { @@ -1165,7 +1165,7 @@ SpdySession2::HandleRstStream(SpdySession2 *self) self)); return NS_ERROR_ILLEGAL_VALUE; } - + if (self->mDownstreamRstReason == RST_INVALID_STREAM || self->mDownstreamRstReason == RST_FLOW_CONTROL_ERROR) { // basically just ignore this @@ -1174,7 +1174,7 @@ SpdySession2::HandleRstStream(SpdySession2 *self) } nsresult rv = self->SetInputFrameDataStream(streamID); - + if (!self->mInputFrameDataStream) { if (NS_FAILED(rv)) LOG(("SpdySession2::HandleRstStream %p lookup streamID for RST Frame " @@ -1223,7 +1223,7 @@ SpdySession2::HandleSettings(SpdySession2 *self) // Each entry is a 24 bits of a little endian id // followed by 8 bits of flags // followed by a 32 bit big endian value - + unsigned char *setting = reinterpret_cast (self->mInputFrameBuffer.get()) + 12 + index * 8; @@ -1238,38 +1238,38 @@ SpdySession2::HandleSettings(SpdySession2 *self) case SETTINGS_TYPE_UPLOAD_BW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_UL_BW, value); break; - + case SETTINGS_TYPE_DOWNLOAD_BW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_DL_BW, value); break; - + case SETTINGS_TYPE_RTT: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_RTT, value); break; - + case SETTINGS_TYPE_MAX_CONCURRENT: self->mMaxConcurrent = value; Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_MAX_STREAMS, value); break; - + case SETTINGS_TYPE_CWND: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_CWND, value); break; - + case SETTINGS_TYPE_DOWNLOAD_RETRANS_RATE: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_RETRANS, value); break; - + case SETTINGS_TYPE_INITIAL_WINDOW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_IW, value >> 10); break; - + default: break; } - + } - + self->ResetDownstreamState(); return NS_OK; } @@ -1315,7 +1315,7 @@ SpdySession2::HandlePing(SpdySession2 *self) // Servers initiate even numbered pings, go ahead and echo it back self->GeneratePing(pingID); } - + self->ResetDownstreamState(); return NS_OK; } @@ -1336,7 +1336,7 @@ SpdySession2::HandleGoAway(SpdySession2 *self) PR_ntohl(reinterpret_cast(self->mInputFrameBuffer.get())[2]); self->mCleanShutdown = true; - // Find streams greater than the last-good ID and mark them for deletion + // Find streams greater than the last-good ID and mark them for deletion // in the mGoAwayStreamsToRestart queue with the GoAwayEnumerator. They can // be restarted. self->mStreamTransactionHash.Enumerate(GoAwayEnumerator, self); @@ -1479,7 +1479,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, uint32_t *countRead) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader), "Inconsistent Write Function Callback"); @@ -1498,7 +1498,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, LOG3(("SpdySession2::ReadSegments %p", this)); SpdyStream2 *stream; - + stream = static_cast(mUrgentForWrite.PopFront()); if (!stream) stream = static_cast(mReadyForWrite.PopFront()); @@ -1509,7 +1509,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, SetWriteCallbacks(); return NS_BASE_STREAM_WOULD_BLOCK; } - + LOG3(("SpdySession2 %p will write from SpdyStream2 %p", this, stream)); rv = stream->ReadSegments(this, count, countRead); @@ -1521,11 +1521,11 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, FlushOutputQueue(); if (stream->RequestBlockedOnRead()) { - + // We are blocked waiting for input - either more http headers or // any request body data. When more data from the request stream // becomes available the httptransaction will call conn->ResumeSend(). - + LOG3(("SpdySession2::ReadSegments %p dealing with block on read", this)); // call readsegments again if there are other streams ready @@ -1537,7 +1537,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, SetWriteCallbacks(); return rv; } - + if (NS_FAILED(rv)) { LOG3(("SpdySession2::ReadSegments %p returning FAIL code %X", this, rv)); @@ -1545,7 +1545,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, CleanupStream(stream, rv, RST_CANCEL); return rv; } - + if (*countRead > 0) { LOG3(("SpdySession2::ReadSegments %p stream=%p generated end of frame %d", this, stream, *countRead)); @@ -1553,10 +1553,10 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, SetWriteCallbacks(); return rv; } - + LOG3(("SpdySession2::ReadSegments %p stream=%p stream send complete", this, stream)); - + /* we now want to recv data */ ResumeRecv(); @@ -1574,7 +1574,7 @@ SpdySession2::ReadSegments(nsAHttpSegmentReader *reader, // OnWriteSegment(). That function will gateway it into http and feed // it to the appropriate transaction. -// we call writer->OnWriteSegment via NetworkRead() to get a spdy header.. +// we call writer->OnWriteSegment via NetworkRead() to get a spdy header.. // and decide if it is data or control.. if it is control, just deal with it. // if it is data, identify the spdy stream // call stream->WriteSegemnts which can call this::OnWriteSegment to get the @@ -1586,7 +1586,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, uint32_t *countWritten) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv; *countWritten = 0; @@ -1594,16 +1594,16 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, return NS_ERROR_FAILURE; SetWriteCallbacks(); - + // We buffer all control frames and act on them in this layer. // We buffer the first 8 bytes of data frames (the header) but // the actual data is passed through unprocessed. - + if (mDownstreamState == BUFFERING_FRAME_HEADER) { // The first 8 bytes of every frame is header information that // we are going to want to strip before passing to http. That is // true of both control and data packets. - + MOZ_ASSERT(mInputFrameBufferUsed < 8, "Frame Buffer Used Too Large for State"); @@ -1638,21 +1638,21 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, PR_ntohl(reinterpret_cast(mInputFrameBuffer.get())[1]); mInputFrameDataSize &= 0x00ffffff; mInputFrameDataRead = 0; - + if (mInputFrameBuffer[0] & kFlag_Control) { EnsureBuffer(mInputFrameBuffer, mInputFrameDataSize + 8, 8, mInputFrameBufferSize); ChangeDownstreamState(BUFFERING_CONTROL_FRAME); - + // The first 32 bit word of the header is // 1 ctrl - 15 version - 16 type uint16_t version = PR_ntohs(reinterpret_cast(mInputFrameBuffer.get())[0]); version &= 0x7fff; - + mFrameControlType = PR_ntohs(reinterpret_cast(mInputFrameBuffer.get())[1]); - + LOG3(("SpdySession2::WriteSegments %p - Control Frame Identified " "type %d version %d data len %d", this, mFrameControlType, version, mInputFrameDataSize)); @@ -1757,7 +1757,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, mNeedsCleanup = nullptr; /* just in case */ return NS_OK; } - + if (mNeedsCleanup) { LOG3(("SpdySession2::WriteSegments session=%p stream=%p 0x%X " "cleanup stream based on mNeedsCleanup.\n", @@ -1799,7 +1799,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, ResetDownstreamState(); return rv; } - + if (mDownstreamState != BUFFERING_CONTROL_FRAME) { // this cannot happen MOZ_ASSERT(false, "Not in Bufering Control Frame State"); @@ -1833,7 +1833,7 @@ SpdySession2::WriteSegments(nsAHttpSegmentWriter *writer, // checked to make sure it was in range, but we will check it again // at time of use to make sure a regression doesn't creep in. if (mFrameControlType >= CONTROL_TYPE_LAST || - mFrameControlType <= CONTROL_TYPE_FIRST) + mFrameControlType <= CONTROL_TYPE_FIRST) { MOZ_ASSERT(false, "control type out of range"); return NS_ERROR_ILLEGAL_VALUE; @@ -1906,9 +1906,9 @@ SpdySession2::OnReadSegment(const char *buf, uint32_t *countRead) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv; - + // If we can release old queued data then we can try and write the new // data directly to the network without using the output queue at all if (mOutputQueueUsed) @@ -1922,7 +1922,7 @@ SpdySession2::OnReadSegment(const char *buf, *countRead = 0; else if (NS_FAILED(rv)) return rv; - + if (*countRead < count) { uint32_t required = count - *countRead; // assuming a commitment() happened, this ensurebuffer is a nop @@ -1932,7 +1932,7 @@ SpdySession2::OnReadSegment(const char *buf, memcpy(mOutputQueueBuffer.get(), buf + *countRead, required); mOutputQueueUsed = required; } - + *countRead = count; return NS_OK; } @@ -1948,7 +1948,7 @@ SpdySession2::OnReadSegment(const char *buf, if ((mOutputQueueUsed + count) > (mOutputQueueSize - kQueueReserved)) return NS_BASE_STREAM_WOULD_BLOCK; - + memcpy(mOutputQueueBuffer.get() + mOutputQueueUsed, buf, count); mOutputQueueUsed += count; *countRead = count; @@ -2010,7 +2010,7 @@ SpdySession2::OnWriteSegment(char *buf, // stack with WriteSegments() return NS_ERROR_FAILURE; } - + if (mDownstreamState == PROCESSING_DATA_FRAME) { if (mInputFrameDataLast && @@ -2019,7 +2019,7 @@ SpdySession2::OnWriteSegment(char *buf, SetNeedsCleanup(); return NS_BASE_STREAM_CLOSED; } - + count = std::min(count, mInputFrameDataSize - mInputFrameDataRead); rv = NetworkRead(mSegmentWriter, buf, count, countWritten); if (NS_FAILED(rv)) @@ -2029,23 +2029,23 @@ SpdySession2::OnWriteSegment(char *buf, buf, *countWritten); mInputFrameDataRead += *countWritten; - + mInputFrameDataStream->UpdateTransportReadEvents(*countWritten); if ((mInputFrameDataRead == mInputFrameDataSize) && !mInputFrameDataLast) ResetDownstreamState(); return rv; } - + if (mDownstreamState == PROCESSING_CONTROL_SYN_REPLY) { - + if (mFlatHTTPResponseHeaders.Length() == mFlatHTTPResponseHeadersOut && mInputFrameDataLast) { *countWritten = 0; SetNeedsCleanup(); return NS_BASE_STREAM_CLOSED; } - + count = std::min(count, mFlatHTTPResponseHeaders.Length() - mFlatHTTPResponseHeadersOut); @@ -2096,7 +2096,7 @@ SpdySession2::TransactionHasDataToWrite(nsAHttpTransaction *caller) this, caller)); return; } - + LOG3(("SpdySession2::TransactionHasDataToWrite %p ID is %x", this, stream->StreamID())); diff --git a/netwerk/protocol/http/SpdySession2.h b/netwerk/protocol/http/SpdySession2.h index 9cd073a35d6..cd5f0a10c8c 100644 --- a/netwerk/protocol/http/SpdySession2.h +++ b/netwerk/protocol/http/SpdySession2.h @@ -46,7 +46,7 @@ public: // When the connection is active this is called every 1 second void ReadTimeoutTick(PRIntervalTime now); - + // Idle time represents time since "goodput".. e.g. a data or header frame PRIntervalTime IdleTime(); @@ -57,10 +57,10 @@ public: const static uint8_t kFlag_Data_FIN = 0x01; const static uint8_t kFlag_Data_UNI = 0x02; const static uint8_t kFlag_Data_ZLIB = 0x02; - + // The protocol document for v2 specifies that the // highest value (3) is the highest priority, but in - // reality 0 is the highest priority. + // reality 0 is the highest priority. // // Draft 3 notes here https://sites.google.com/a/chromium.org/dev/spdy/spdy-protocol/ // are the best guide to the mistake. Also see @@ -124,11 +124,11 @@ public: const static uint32_t kDefaultMaxConcurrent = 100; const static uint32_t kMaxStreamID = 0x7800000; - + // This is a sentinel for a deleted stream. It is not a valid // 31 bit stream ID. const static uint32_t kDeadStreamID = 0xffffdead; - + static nsresult HandleSynStream(SpdySession2 *); static nsresult HandleSynReply(SpdySession2 *); static nsresult HandleRstStream(SpdySession2 *); @@ -154,7 +154,7 @@ public: // an overload of nsAHttpSegementReader virtual nsresult CommitToSegmentSize(uint32_t size, bool forceCommitment); - + void PrintDiagnostics (nsCString &log); private: @@ -197,7 +197,7 @@ private: // a wrapper for all calls to the nshttpconnection level segment writer. Used // to track network I/O for timeout purposes nsresult NetworkRead(nsAHttpSegmentWriter *, char *, uint32_t, uint32_t *); - + static PLDHashOperator ShutdownEnumerator(nsAHttpTransaction *, nsAutoPtr &, void *); @@ -256,7 +256,7 @@ private: uint32_t mInputFrameBufferSize; uint32_t mInputFrameBufferUsed; nsAutoArrayPtr mInputFrameBuffer; - + // mInputFrameDataSize/Read are used for tracking the amount of data consumed // in a data frame. the data itself is not buffered in spdy // The frame size is mInputFrameDataSize + the constant 8 byte header @@ -268,7 +268,7 @@ private: // (e.g. a data frame after the stream-id has been decoded), this points // to the stream. SpdyStream2 *mInputFrameDataStream; - + // mNeedsCleanup is a state variable to defer cleanup of a closed stream // If needed, It is set in session::OnWriteSegments() and acted on and // cleared when the stack returns to session::WriteSegments(). The stream diff --git a/netwerk/protocol/http/SpdySession3.cpp b/netwerk/protocol/http/SpdySession3.cpp index 13bec7d62f0..f1a7a54dedf 100644 --- a/netwerk/protocol/http/SpdySession3.cpp +++ b/netwerk/protocol/http/SpdySession3.cpp @@ -67,21 +67,21 @@ SpdySession3::SpdySession3(nsAHttpTransaction *aHttpTransaction, LOG3(("SpdySession3::SpdySession3 %p transaction 1 = %p", this, aHttpTransaction)); - + mStreamIDHash.Init(); mStreamTransactionHash.Init(); mConnection = aHttpTransaction->Connection(); mInputFrameBuffer = new char[mInputFrameBufferSize]; mOutputQueueBuffer = new char[mOutputQueueSize]; zlibInit(); - + mSendingChunkSize = gHttpHandler->SpdySendingChunkSize(); GenerateSettings(); if (!aHttpTransaction->IsNullTransaction()) AddStream(aHttpTransaction, firstPriority); mLastDataReadEpoch = mLastReadEpoch; - + mPingThreshold = gHttpHandler->SpdyPingThreshold(); } @@ -91,7 +91,7 @@ SpdySession3::ShutdownEnumerator(nsAHttpTransaction *key, void *closure) { SpdySession3 *self = static_cast(closure); - + // On a clean server hangup the server sets the GoAwayID to be the ID of // the last transaction it processed. If the ID of stream in the // local stream is greater than that it can safely be restarted because the @@ -130,7 +130,7 @@ SpdySession3::~SpdySession3() inflateEnd(&mDownstreamZlib); deflateEnd(&mUpstreamZlib); - + mStreamTransactionHash.Enumerate(ShutdownEnumerator, this); Telemetry::Accumulate(Telemetry::SPDY_PARALLEL_STREAMS, mConcurrentHighWater); Telemetry::Accumulate(Telemetry::SPDY_REQUEST_PER_CONN, (mNextStreamID - 1) / 2); @@ -144,7 +144,7 @@ SpdySession3::LogIO(SpdySession3 *self, SpdyStream3 *stream, const char *label, { if (!LOG4_ENABLED()) return; - + LOG4(("SpdySession3::LogIO %p stream=%p id=0x%X [%s]", self, stream, stream ? stream->StreamID() : 0, label)); @@ -176,7 +176,7 @@ SpdySession3::LogIO(SpdySession3 *self, SpdyStream3 *stream, const char *label, } typedef nsresult (*Control_FX) (SpdySession3 *self); -static Control_FX sControlFunctions[] = +static Control_FX sControlFunctions[] = { nullptr, SpdySession3::HandleSynStream, @@ -242,7 +242,7 @@ SpdySession3::ReadTimeoutTick(PRIntervalTime now) } return; } - + LOG(("SpdySession3::ReadTimeoutTick %p generating ping 0x%X\n", this, mNextPingID)); @@ -276,7 +276,7 @@ SpdySession3::RegisterStreamID(SpdyStream3 *stream) MOZ_ASSERT(mNextStreamID < 0xfffffff0, "should have stopped admitting streams"); - + uint32_t result = mNextStreamID; mNextStreamID += 2; @@ -334,7 +334,7 @@ SpdySession3::AddStream(nsAHttpTransaction *aHttpTransaction, this, stream)); mQueuedStreams.Push(stream); } - + return true; } @@ -416,7 +416,7 @@ SpdySession3::FlushOutputQueue() { if (!mSegmentReader || !mOutputQueueUsed) return; - + nsresult rv; uint32_t countRead; uint32_t avail = mOutputQueueUsed - mOutputQueueSent; @@ -426,11 +426,11 @@ SpdySession3::FlushOutputQueue() &countRead); LOG3(("SpdySession3::FlushOutputQueue %p sz=%d rv=%x actual=%d", this, avail, rv, countRead)); - + // Dont worry about errors on write, we will pick this up as a read error too if (NS_FAILED(rv)) return; - + if (countRead == avail) { mOutputQueueUsed = 0; mOutputQueueSent = 0; @@ -441,7 +441,7 @@ SpdySession3::FlushOutputQueue() // If the output queue is close to filling up and we have sent out a good // chunk of data from the beginning then realign it. - + if ((mOutputQueueSent >= kQueueMinimumCleanup) && ((mOutputQueueSize - mOutputQueueUsed) < kQueueTailRoom)) { RealignOutputQueue(); @@ -502,7 +502,7 @@ SpdySession3::EnsureBuffer(nsAutoArrayPtr &buf, { if (objSize >= newSize) return; - + // Leave a little slop on the new allocation - add 2KB to // what we need and then round the result up to a 4KB (page) // boundary. @@ -571,7 +571,7 @@ SpdySession3::UncompressAndDiscard(uint32_t offset, LOG3(("SpdySession3::UncompressAndDiscard %p Dictionary Error\n", this)); return NS_ERROR_FAILURE; } - + triedDictionary = true; inflateSetDictionary(&mDownstreamZlib, SpdyStream3::kDictionary, sizeof(SpdyStream3::kDictionary)); @@ -603,7 +603,7 @@ SpdySession3::GeneratePing(uint32_t aID) packet[5] = 0; packet[6] = 0; packet[7] = 4; /* length */ - + aID = PR_htonl(aID); memcpy(packet + 8, &aID, 4); @@ -630,7 +630,7 @@ SpdySession3::GenerateRstStream(uint32_t aStatusCode, uint32_t aID) packet[5] = 0; packet[6] = 0; packet[7] = 8; /* length */ - + aID = PR_htonl(aID); memcpy(packet + 8, &aID, 4); aStatusCode = PR_htonl(aStatusCode); @@ -656,7 +656,7 @@ SpdySession3::GenerateGoAway(uint32_t aStatusCode) packet[1] = kVersion; packet[3] = CONTROL_TYPE_GOAWAY; packet[7] = 8; /* data length */ - + // last-good-stream-id are bytes 8-11, when we accept server push this will // need to be set non zero @@ -710,7 +710,7 @@ SpdySession3::GenerateSettings() memcpy(packet + 16 + 8 * numberOfEntries, &cwnd, 4); numberOfEntries++; } - + packet[15 + 8 * numberOfEntries] = SETTINGS_TYPE_INITIAL_WINDOW; uint32_t rwin = PR_htonl(kInitialRwin); memcpy(packet + 16 + 8 * numberOfEntries, &rwin, 4); @@ -742,21 +742,21 @@ SpdySession3::VerifyStream(SpdyStream3 *aStream, uint32_t aOptionalID = 0) return true; uint32_t test = 0; - + do { if (aStream->StreamID() == kDeadStreamID) break; nsAHttpTransaction *trans = aStream->Transaction(); - test++; + test++; if (!trans) break; test++; if (mStreamTransactionHash.Get(trans) != aStream) break; - + if (aStream->StreamID()) { SpdyStream3 *idStream = mStreamIDHash.Get(aStream->StreamID()); @@ -803,7 +803,7 @@ SpdySession3::CleanupStream(SpdyStream3 *aStream, nsresult aResult, --mConcurrent; ProcessPending(); } - + CloseStream(aStream, aResult); // Remove the stream from the ID hash table. (this one isn't short, which is @@ -859,7 +859,7 @@ nsresult SpdySession3::HandleSynStream(SpdySession3 *self) { MOZ_ASSERT(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM); - + if (self->mInputFrameDataSize < 18) { LOG3(("SpdySession3::HandleSynStream %p SYN_STREAM too short data=%d", self, self->mInputFrameDataSize)); @@ -874,7 +874,7 @@ SpdySession3::HandleSynStream(SpdySession3 *self) LOG3(("SpdySession3::HandleSynStream %p recv SYN_STREAM (push) " "for ID 0x%X associated with 0x%X.", self, streamID, associatedID)); - + if (streamID & 0x01) { // test for odd stream ID LOG3(("SpdySession3::HandleSynStream %p recvd SYN_STREAM id must be even.", self)); @@ -927,7 +927,7 @@ SpdySession3::HandleSynReply(SpdySession3 *self) // A framing error is a session wide error that cannot be recovered return NS_ERROR_ILLEGAL_VALUE; } - + LOG3(("SpdySession3::HandleSynReply %p lookup via streamID in syn_reply.\n", self)); uint32_t streamID = @@ -946,7 +946,7 @@ SpdySession3::HandleSynReply(SpdySession3 *self) if (streamID >= self->mNextStreamID) self->GenerateRstStream(RST_INVALID_STREAM, streamID); - + if (NS_FAILED(self->UncompressAndDiscard(12, self->mInputFrameDataSize - 4))) { LOG(("SpdySession3::HandleSynReply uncompress failed\n")); @@ -989,7 +989,7 @@ SpdySession3::HandleSynReply(SpdySession3 *self) self->mInputFrameDataStream->RecvdFin())); self->CleanupStream(self->mInputFrameDataStream, NS_ERROR_ALREADY_OPENED, - self->mInputFrameDataStream->RecvdFin() ? + self->mInputFrameDataStream->RecvdFin() ? RST_STREAM_ALREADY_CLOSED : RST_STREAM_IN_USE); self->ResetDownstreamState(); return NS_OK; @@ -1076,7 +1076,7 @@ SpdySession3::HandleRstStream(SpdySession3 *self) self)); return NS_ERROR_ILLEGAL_VALUE; } - + if (self->mDownstreamRstReason == RST_INVALID_STREAM || self->mDownstreamRstReason == RST_STREAM_IN_USE || self->mDownstreamRstReason == RST_FLOW_CONTROL_ERROR) { @@ -1155,21 +1155,21 @@ SpdySession3::HandleSettings(SpdySession3 *self) case SETTINGS_TYPE_UPLOAD_BW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_UL_BW, value); break; - + case SETTINGS_TYPE_DOWNLOAD_BW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_DL_BW, value); break; - + case SETTINGS_TYPE_RTT: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_RTT, value); break; - + case SETTINGS_TYPE_MAX_CONCURRENT: self->mMaxConcurrent = value; Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_MAX_STREAMS, value); break; - case SETTINGS_TYPE_CWND: + case SETTINGS_TYPE_CWND: if (flags & PERSIST_VALUE) { nsRefPtr ci; @@ -1183,7 +1183,7 @@ SpdySession3::HandleSettings(SpdySession3 *self) case SETTINGS_TYPE_DOWNLOAD_RETRANS_RATE: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_RETRANS, value); break; - + case SETTINGS_TYPE_INITIAL_WINDOW: Telemetry::Accumulate(Telemetry::SPDY_SETTINGS_IW, value >> 10); { @@ -1195,13 +1195,13 @@ SpdySession3::HandleSettings(SpdySession3 *self) &delta); } break; - + default: break; } - + } - + self->ResetDownstreamState(); return NS_OK; } @@ -1244,7 +1244,7 @@ SpdySession3::HandlePing(SpdySession3 *self) // Servers initiate even numbered pings, go ahead and echo it back self->GeneratePing(pingID); } - + self->ResetDownstreamState(); return NS_OK; } @@ -1265,7 +1265,7 @@ SpdySession3::HandleGoAway(SpdySession3 *self) PR_ntohl(reinterpret_cast(self->mInputFrameBuffer.get())[2]); self->mCleanShutdown = true; - // Find streams greater than the last-good ID and mark them for deletion + // Find streams greater than the last-good ID and mark them for deletion // in the mGoAwayStreamsToRestart queue with the GoAwayEnumerator. They can // be restarted. self->mStreamTransactionHash.Enumerate(GoAwayEnumerator, self); @@ -1294,7 +1294,7 @@ SpdySession3::HandleGoAway(SpdySession3 *self) } LOG3(("SpdySession3::HandleGoAway %p GOAWAY Last-Good-ID 0x%X status 0x%X " - "live streams=%d\n", self, self->mGoAwayID, + "live streams=%d\n", self, self->mGoAwayID, PR_ntohl(reinterpret_cast(self->mInputFrameBuffer.get())[3]), self->mStreamTransactionHash.Count())); @@ -1416,7 +1416,7 @@ SpdySession3::HandleWindowUpdate(SpdySession3 *self) int64_t oldRemoteWindow = self->mInputFrameDataStream->RemoteWindow(); self->mInputFrameDataStream->UpdateRemoteWindow(delta); - + LOG3(("SpdySession3::HandleWindowUpdate %p stream 0x%X window " "%d increased by %d.\n", self, streamID, oldRemoteWindow, delta)); @@ -1499,7 +1499,7 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, uint32_t *countRead) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + MOZ_ASSERT(!mSegmentReader || !reader || (mSegmentReader == reader), "Inconsistent Write Function Callback"); @@ -1519,7 +1519,7 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, SetWriteCallbacks(); return NS_BASE_STREAM_WOULD_BLOCK; } - + LOG3(("SpdySession3 %p will write from SpdyStream3 %p 0x%X " "block-input=%d block-output=%d\n", this, stream, stream->StreamID(), stream->RequestBlockedOnRead(), stream->BlockedOnRwin())); @@ -1537,11 +1537,11 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, ResumeRecv(); if (stream->RequestBlockedOnRead()) { - + // We are blocked waiting for input - either more http headers or // any request body data. When more data from the request stream // becomes available the httptransaction will call conn->ResumeSend(). - + LOG3(("SpdySession3::ReadSegments %p dealing with block on read", this)); // call readsegments again if there are other streams ready @@ -1553,7 +1553,7 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, SetWriteCallbacks(); return rv; } - + if (NS_FAILED(rv)) { LOG3(("SpdySession3::ReadSegments %p returning FAIL code %X", this, rv)); @@ -1561,7 +1561,7 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, CleanupStream(stream, rv, RST_CANCEL); return rv; } - + if (*countRead > 0) { LOG3(("SpdySession3::ReadSegments %p stream=%p countread=%d", this, stream, *countRead)); @@ -1575,10 +1575,10 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, this, stream, stream->StreamID())); return NS_BASE_STREAM_WOULD_BLOCK; } - + LOG3(("SpdySession3::ReadSegments %p stream=%p stream send complete", this, stream)); - + // call readsegments again if there are other streams ready // to go in this session SetWriteCallbacks(); @@ -1593,7 +1593,7 @@ SpdySession3::ReadSegments(nsAHttpSegmentReader *reader, // OnWriteSegment(). That function will gateway it into http and feed // it to the appropriate transaction. -// we call writer->OnWriteSegment via NetworkRead() to get a spdy header.. +// we call writer->OnWriteSegment via NetworkRead() to get a spdy header.. // and decide if it is data or control.. if it is control, just deal with it. // if it is data, identify the spdy stream // call stream->WriteSegemnts which can call this::OnWriteSegment to get the @@ -1605,7 +1605,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, uint32_t *countWritten) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv; *countWritten = 0; @@ -1613,16 +1613,16 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, return NS_ERROR_FAILURE; SetWriteCallbacks(); - + // We buffer all control frames and act on them in this layer. // We buffer the first 8 bytes of data frames (the header) but // the actual data is passed through unprocessed. - + if (mDownstreamState == BUFFERING_FRAME_HEADER) { // The first 8 bytes of every frame is header information that // we are going to want to strip before passing to http. That is // true of both control and data packets. - + MOZ_ASSERT(mInputFrameBufferUsed < 8, "Frame Buffer Used Too Large for State"); @@ -1657,21 +1657,21 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, PR_ntohl(reinterpret_cast(mInputFrameBuffer.get())[1]); mInputFrameDataSize &= 0x00ffffff; mInputFrameDataRead = 0; - + if (mInputFrameBuffer[0] & kFlag_Control) { EnsureBuffer(mInputFrameBuffer, mInputFrameDataSize + 8, 8, mInputFrameBufferSize); ChangeDownstreamState(BUFFERING_CONTROL_FRAME); - + // The first 32 bit word of the header is // 1 ctrl - 15 version - 16 type uint16_t version = PR_ntohs(reinterpret_cast(mInputFrameBuffer.get())[0]); version &= 0x7fff; - + mFrameControlType = PR_ntohs(reinterpret_cast(mInputFrameBuffer.get())[1]); - + LOG3(("SpdySession3::WriteSegments %p - Control Frame Identified " "type %d version %d data len %d", this, mFrameControlType, version, mInputFrameDataSize)); @@ -1800,7 +1800,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, mNeedsCleanup = nullptr; /* just in case */ return NS_OK; } - + if (mNeedsCleanup) { LOG3(("SpdySession3::WriteSegments session=%p stream=%p 0x%X " "cleanup stream based on mNeedsCleanup.\n", @@ -1840,7 +1840,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, ResetDownstreamState(); return rv; } - + if (mDownstreamState != BUFFERING_CONTROL_FRAME) { // this cannot happen MOZ_ASSERT(false, "Not in Bufering Control Frame State"); @@ -1874,7 +1874,7 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer, // checked to make sure it was in range, but we will check it again // at time of use to make sure a regression doesn't creep in. if (mFrameControlType >= CONTROL_TYPE_LAST || - mFrameControlType <= CONTROL_TYPE_FIRST) + mFrameControlType <= CONTROL_TYPE_FIRST) { MOZ_ASSERT(false, "control type out of range"); return NS_ERROR_ILLEGAL_VALUE; @@ -1918,11 +1918,11 @@ SpdySession3::UpdateLocalRwin(SpdyStream3 *stream, // Generate window updates directly out of spdysession instead of the stream // in order to avoid queue delays in getting the ACK out. uint32_t toack = unacked & 0x7fffffff; - + LOG3(("SpdySession3::UpdateLocalRwin Ack %p 0x%X %d\n", this, stream->StreamID(), toack)); stream->IncrementLocalWindow(toack); - + static const uint32_t dataLen = 8; EnsureBuffer(mOutputQueueBuffer, mOutputQueueUsed + 8 + dataLen, mOutputQueueUsed, mOutputQueueSize); @@ -1934,7 +1934,7 @@ SpdySession3::UpdateLocalRwin(SpdyStream3 *stream, packet[1] = kVersion; packet[3] = CONTROL_TYPE_WINDOW_UPDATE; packet[7] = dataLen; - + uint32_t id = PR_htonl(stream->StreamID()); memcpy(packet + 8, &id, 4); toack = PR_htonl(toack); @@ -2001,9 +2001,9 @@ SpdySession3::OnReadSegment(const char *buf, uint32_t *countRead) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv; - + // If we can release old queued data then we can try and write the new // data directly to the network without using the output queue at all if (mOutputQueueUsed) @@ -2017,7 +2017,7 @@ SpdySession3::OnReadSegment(const char *buf, *countRead = 0; else if (NS_FAILED(rv)) return rv; - + if (*countRead < count) { uint32_t required = count - *countRead; // assuming a commitment() happened, this ensurebuffer is a nop @@ -2027,7 +2027,7 @@ SpdySession3::OnReadSegment(const char *buf, memcpy(mOutputQueueBuffer.get(), buf + *countRead, required); mOutputQueueUsed = required; } - + *countRead = count; return NS_OK; } @@ -2043,7 +2043,7 @@ SpdySession3::OnReadSegment(const char *buf, if ((mOutputQueueUsed + count) > (mOutputQueueSize - kQueueReserved)) return NS_BASE_STREAM_WOULD_BLOCK; - + memcpy(mOutputQueueBuffer.get() + mOutputQueueUsed, buf, count); mOutputQueueUsed += count; *countRead = count; @@ -2105,7 +2105,7 @@ SpdySession3::OnWriteSegment(char *buf, // stack with WriteSegments() return NS_ERROR_FAILURE; } - + if (mDownstreamState == PROCESSING_DATA_FRAME) { if (mInputFrameDataLast && @@ -2114,7 +2114,7 @@ SpdySession3::OnWriteSegment(char *buf, SetNeedsCleanup(); return NS_BASE_STREAM_CLOSED; } - + count = std::min(count, mInputFrameDataSize - mInputFrameDataRead); rv = NetworkRead(mSegmentWriter, buf, count, countWritten); if (NS_FAILED(rv)) @@ -2124,23 +2124,23 @@ SpdySession3::OnWriteSegment(char *buf, buf, *countWritten); mInputFrameDataRead += *countWritten; - + mInputFrameDataStream->UpdateTransportReadEvents(*countWritten); if ((mInputFrameDataRead == mInputFrameDataSize) && !mInputFrameDataLast) ResetDownstreamState(); return rv; } - + if (mDownstreamState == PROCESSING_COMPLETE_HEADERS) { - + if (mFlatHTTPResponseHeaders.Length() == mFlatHTTPResponseHeadersOut && mInputFrameDataLast) { *countWritten = 0; SetNeedsCleanup(); return NS_BASE_STREAM_CLOSED; } - + count = std::min(count, mFlatHTTPResponseHeaders.Length() - mFlatHTTPResponseHeadersOut); @@ -2166,7 +2166,7 @@ SpdySession3::OnWriteSegment(char *buf, ResetDownstreamState(); } } - + return NS_OK; } @@ -2205,7 +2205,7 @@ SpdySession3::TransactionHasDataToWrite(nsAHttpTransaction *caller) this, caller)); return; } - + LOG3(("SpdySession3::TransactionHasDataToWrite %p ID is 0x%X\n", this, stream->StreamID())); diff --git a/netwerk/protocol/http/SpdySession3.h b/netwerk/protocol/http/SpdySession3.h index 2ce3c592f68..6446e6f1087 100644 --- a/netwerk/protocol/http/SpdySession3.h +++ b/netwerk/protocol/http/SpdySession3.h @@ -45,7 +45,7 @@ public: // When the connection is active this is called every 1 second void ReadTimeoutTick(PRIntervalTime now); - + // Idle time represents time since "goodput".. e.g. a data or header frame PRIntervalTime IdleTime(); @@ -57,7 +57,7 @@ public: const static uint8_t kFlag_Data_FIN = 0x01; const static uint8_t kFlag_Data_UNI = 0x02; - + enum { CONTROL_TYPE_FIRST = 0, @@ -170,7 +170,7 @@ public: // an overload of nsAHttpSegementReader virtual nsresult CommitToSegmentSize(uint32_t size, bool forceCommitment); - + uint32_t GetServerInitialWindow() { return mServerInitialWindow; } void PrintDiagnostics (nsCString &log); @@ -215,7 +215,7 @@ private: // a wrapper for all calls to the nshttpconnection level segment writer. Used // to track network I/O for timeout purposes nsresult NetworkRead(nsAHttpSegmentWriter *, char *, uint32_t, uint32_t *); - + static PLDHashOperator ShutdownEnumerator(nsAHttpTransaction *, nsAutoPtr &, void *); @@ -273,7 +273,7 @@ private: uint32_t mInputFrameBufferSize; uint32_t mInputFrameBufferUsed; nsAutoArrayPtr mInputFrameBuffer; - + // mInputFrameDataSize/Read are used for tracking the amount of data consumed // in a data frame. the data itself is not buffered in spdy // The frame size is mInputFrameDataSize + the constant 8 byte header @@ -285,7 +285,7 @@ private: // (e.g. a data frame after the stream-id has been decoded), this points // to the stream. SpdyStream3 *mInputFrameDataStream; - + // mNeedsCleanup is a state variable to defer cleanup of a closed stream // If needed, It is set in session::OnWriteSegments() and acted on and // cleared when the stack returns to session::WriteSegments(). The stream diff --git a/netwerk/protocol/http/SpdyStream2.cpp b/netwerk/protocol/http/SpdyStream2.cpp index f8731a32068..5971c055820 100644 --- a/netwerk/protocol/http/SpdyStream2.cpp +++ b/netwerk/protocol/http/SpdyStream2.cpp @@ -80,7 +80,7 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, this, reader, count, mUpstreamState)); MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv = NS_ERROR_UNEXPECTED; mRequestBlockedOnRead = 0; @@ -100,7 +100,7 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, mUpstreamState == GENERATING_SYN_STREAM && !mSynFrameComplete) mSession->TransactionHasDataToWrite(this); - + // mTxinlineFrameUsed represents any queued un-sent frame. It might // be 0 if there is no such frame, which is not a gurantee that we // don't have more request body to send - just that any data that was @@ -146,7 +146,7 @@ SpdyStream2::ReadSegments(nsAHttpSegmentReader *reader, mTxInlineFrameUsed = 0; // cancel fin data packet ChangeState(UPSTREAM_COMPLETE); } - + *countRead = 0; // don't change OK to WOULD BLOCK. we are really done sending if OK @@ -177,7 +177,7 @@ SpdyStream2::WriteSegments(nsAHttpSegmentWriter *writer, { LOG3(("SpdyStream2::WriteSegments %p count=%d state=%x", this, count, mUpstreamState)); - + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(!mSegmentWriter, "segment writer in progress"); @@ -218,7 +218,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, // We can use the simple double crlf because firefox is the // only client we are parsing int32_t endHeader = mFlatHttpRequestHeaders.Find("\r\n\r\n"); - + if (endHeader == kNotFound) { // We don't have all the headers yet LOG3(("SpdyStream2::ParseHttpRequestHeaders %p " @@ -227,7 +227,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, *countUsed = avail; return NS_OK; } - + // We have recvd all the headers, trim the local // buffer of the final empty line, and set countUsed to reflect // the whole header has been consumed. @@ -264,10 +264,10 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, mTxInlineFrame[2] = 0; mTxInlineFrame[3] = SpdySession2::CONTROL_TYPE_SYN_STREAM; // 4 to 7 are length and flags, we'll fill that in later - + uint32_t networkOrderID = PR_htonl(mStreamID); memcpy(mTxInlineFrame + 8, &networkOrderID, 4); - + // this is the associated-to field, which is not used sending // from the client in the http binding memset (mTxInlineFrame + 12, 0, 4); @@ -291,7 +291,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, mTxInlineFrame[16] = SpdySession2::kPri00; mTxInlineFrame[17] = 0; /* unused */ - + const char *methodHeader = mTransaction->RequestHead()->Method().get(); nsCString hostHeader; @@ -304,12 +304,12 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, versionHeader = NS_LITERAL_CSTRING("HTTP/1.0"); nsClassHashtable hdrHash; - + // use mRequestHead() to get a sense of how big to make the hash, // even though we are parsing the actual text stream because // it is legit to append headers. hdrHash.Init(1 + (mTransaction->RequestHead()->Headers().Count() * 2)); - + const char *beginBuffer = mFlatHttpRequestHeaders.BeginReading(); // need to hash all the headers together to remove duplicates, special @@ -322,12 +322,12 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, crlfIndex = mFlatHttpRequestHeaders.Find("\r\n", false, startIndex); if (crlfIndex == -1) break; - + int32_t colonIndex = mFlatHttpRequestHeaders.Find(":", false, startIndex, crlfIndex - startIndex); if (colonIndex == -1) break; - + nsDependentCSubstring name = Substring(beginBuffer + startIndex, beginBuffer + colonIndex); // all header names are lower case in spdy @@ -342,7 +342,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, name.Equals("connection") || name.Equals("url")) continue; - + nsCString *val = hdrHash.Get(name); if (!val) { val = new nsCString(); @@ -352,7 +352,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, int32_t valueIndex = colonIndex + 1; while (valueIndex < crlfIndex && beginBuffer[valueIndex] == ' ') ++valueIndex; - + nsDependentCSubstring v = Substring(beginBuffer + valueIndex, beginBuffer + crlfIndex); if (!val->IsEmpty()) @@ -365,7 +365,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, mRequestBodyLenRemaining = len; } } - + mTxInlineFrameUsed = 18; // Do not naively log the request headers here beacuse they might @@ -386,17 +386,17 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, CompressToFrame(mTransaction->RequestHead()->RequestURI()); CompressToFrame(NS_LITERAL_CSTRING("version")); CompressToFrame(versionHeader); - + hdrHash.Enumerate(hdrHashEnumerate, this); CompressFlushFrame(); - + // 4 to 7 are length and flags, which we can now fill in (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(mTxInlineFrameUsed - 8); MOZ_ASSERT(!mTxInlineFrame[4], "Size greater than 24 bits"); - + // Determine whether to put the fin bit on the syn stream frame or whether // to wait for a data packet to put it on. @@ -421,7 +421,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, mSentFinOnData = 1; mTxInlineFrame[4] = SpdySession2::kFlag_Data_FIN; } - + Telemetry::Accumulate(Telemetry::SPDY_SYN_SIZE, mTxInlineFrameUsed - 18); // The size of the input headers is approximate @@ -429,7 +429,7 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf, (mTxInlineFrameUsed - 18) * 100 / (11 + mTransaction->RequestHead()->RequestURI().Length() + mFlatHttpRequestHeaders.Length()); - + Telemetry::Accumulate(Telemetry::SPDY_SYN_RATIO, ratio); return NS_OK; } @@ -499,7 +499,7 @@ SpdyStream2::TransmitFrame(const char *buf, uint32_t transmittedCount; nsresult rv; - + LOG3(("SpdyStream2::TransmitFrame %p inline=%d stream=%d", this, mTxInlineFrameUsed, mTxStreamFrameSize)); if (countUsed) @@ -536,7 +536,7 @@ SpdyStream2::TransmitFrame(const char *buf, // bytes through to the SpdySession2 and then the HttpConnection which calls // the socket write function. It will accept all of the inline and stream // data because of the above 'commitment' even if it has to buffer - + rv = mSegmentReader->OnReadSegment(mTxInlineFrame, mTxInlineFrameUsed, &transmittedCount); LOG3(("SpdyStream2::TransmitFrame for inline session=%p " @@ -551,7 +551,7 @@ SpdyStream2::TransmitFrame(const char *buf, MOZ_ASSERT(transmittedCount == mTxInlineFrameUsed, "inconsistent inline commitment count"); - + SpdySession2::LogIO(mSession, this, "Writing from Inline Buffer", mTxInlineFrame, transmittedCount); @@ -570,7 +570,7 @@ SpdyStream2::TransmitFrame(const char *buf, LOG3(("SpdyStream2::TransmitFrame for regular session=%p " "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, "inconsistent stream commitment result"); @@ -579,13 +579,13 @@ SpdyStream2::TransmitFrame(const char *buf, MOZ_ASSERT(transmittedCount == mTxStreamFrameSize, "inconsistent stream commitment count"); - + SpdySession2::LogIO(mSession, this, "Writing from Transaction Buffer", buf, transmittedCount); *countUsed += mTxStreamFrameSize; } - + // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0 UpdateTransportSendEvents(mTxInlineFrameUsed + mTxStreamFrameSize); @@ -614,14 +614,14 @@ SpdyStream2::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame) MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty"); MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty"); MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits"); - + (reinterpret_cast(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID); (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(dataLength); - + MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly"); MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly"); - + mTxInlineFrameUsed = 8; mTxStreamFrameSize = dataLength; @@ -645,7 +645,7 @@ SpdyStream2::CompressToFrame(const nsACString *str) } // Dictionary taken from -// http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 +// http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 // Name/Value Header Block Format // spec indicates that the compression dictionary is not null terminated // but in reality it is. see: @@ -710,7 +710,7 @@ SpdyStream2::CompressToFrame(uint16_t data) { // convert the data to network byte order and write that // to the compressed stream - + data = PR_htons(data); mZlib->next_in = reinterpret_cast (&data); @@ -731,12 +731,12 @@ SpdyStream2::CompressToFrame(const char *data, uint32_t len) len = 0xffff; uint16_t networkLen = PR_htons(len); - + // write out the length mZlib->next_in = reinterpret_cast (&networkLen); mZlib->avail_in = 2; ExecuteCompress(Z_NO_FLUSH); - + // write out the data mZlib->next_in = (unsigned char *)data; mZlib->avail_in = len; @@ -771,7 +771,7 @@ SpdyStream2::OnReadSegment(const char *buf, MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(mSegmentReader); - + nsresult rv = NS_ERROR_UNEXPECTED; uint32_t dataLength; @@ -840,12 +840,12 @@ SpdyStream2::OnReadSegment(const char *buf, case SENDING_FIN_STREAM: MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment"); break; - + default: MOZ_ASSERT(false, "SpdyStream2::OnReadSegment non-write state"); break; } - + return rv; } diff --git a/netwerk/protocol/http/SpdyStream2.h b/netwerk/protocol/http/SpdyStream2.h index 198ffe70cb1..047ac476f22 100644 --- a/netwerk/protocol/http/SpdyStream2.h +++ b/netwerk/protocol/http/SpdyStream2.h @@ -35,7 +35,7 @@ public: // returns false if called more than once bool GetFullyOpen() {return mFullyOpen;} - void SetFullyOpen() + void SetFullyOpen() { MOZ_ASSERT(!mFullyOpen); mFullyOpen = 1; @@ -93,7 +93,7 @@ private: void CompressToFrame(uint16_t); void CompressFlushFrame(); void ExecuteCompress(uint32_t); - + // Each stream goes from syn_stream to upstream_complete, perhaps // looping on multiple instances of generating_request_body and // sending_request_body for each SPDY chunk in the upload. diff --git a/netwerk/protocol/http/SpdyStream3.cpp b/netwerk/protocol/http/SpdyStream3.cpp index 8f80ae2c851..7b98c2e8c8a 100644 --- a/netwerk/protocol/http/SpdyStream3.cpp +++ b/netwerk/protocol/http/SpdyStream3.cpp @@ -89,7 +89,7 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, this, reader, count, mUpstreamState)); MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsresult rv = NS_ERROR_UNEXPECTED; mRequestBlockedOnRead = 0; @@ -109,7 +109,7 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, mUpstreamState == GENERATING_SYN_STREAM && !mSynFrameComplete) mSession->TransactionHasDataToWrite(this); - + // mTxinlineFrameUsed represents any queued un-sent frame. It might // be 0 if there is no such frame, which is not a gurantee that we // don't have more request body to send - just that any data that was @@ -157,7 +157,7 @@ SpdyStream3::ReadSegments(nsAHttpSegmentReader *reader, mTxInlineFrameUsed = 0; // cancel fin data packet ChangeState(UPSTREAM_COMPLETE); } - + *countRead = 0; // don't change OK to WOULD BLOCK. we are really done sending if OK @@ -188,7 +188,7 @@ SpdyStream3::WriteSegments(nsAHttpSegmentWriter *writer, { LOG3(("SpdyStream3::WriteSegments %p count=%d state=%x", this, count, mUpstreamState)); - + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(!mSegmentWriter, "segment writer in progress"); @@ -229,7 +229,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // We can use the simple double crlf because firefox is the // only client we are parsing int32_t endHeader = mFlatHttpRequestHeaders.Find("\r\n\r\n"); - + if (endHeader == kNotFound) { // We don't have all the headers yet LOG3(("SpdyStream3::ParseHttpRequestHeaders %p " @@ -238,7 +238,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, *countUsed = avail; return NS_OK; } - + // We have recvd all the headers, trim the local // buffer of the final empty line, and set countUsed to reflect // the whole header has been consumed. @@ -274,10 +274,10 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, mTxInlineFrame[2] = 0; mTxInlineFrame[3] = SpdySession3::CONTROL_TYPE_SYN_STREAM; // 4 to 7 are length and flags, we'll fill that in later - + uint32_t networkOrderID = PR_htonl(mStreamID); memcpy(mTxInlineFrame + 8, &networkOrderID, 4); - + // this is the associated-to field, which is not used sending // from the client in the http binding memset (mTxInlineFrame + 12, 0, 4); @@ -285,7 +285,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // Priority flags are the E0 mask of byte 16. // 0 is highest priority, 7 is lowest. // The other 5 bits of byte 16 are unused. - + if (mPriority >= nsISupportsPriority::PRIORITY_LOWEST) mTxInlineFrame[16] = 7 << 5; else if (mPriority <= nsISupportsPriority::PRIORITY_HIGHEST) @@ -299,7 +299,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // Add one to the priority so that values such as -10 and -11 // get different spdy priorities - this appears to be an important // breaking line in the priorities content assigns to - // transactions. + // transactions. uint8_t calculatedPriority = 3 + ((mPriority + 1) / 5); MOZ_ASSERT (!(calculatedPriority & 0xf8), "Calculated Priority Out Of Range"); @@ -308,7 +308,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, // The client cert "slot". Right now we don't send client certs mTxInlineFrame[17] = 0; - + const char *methodHeader = mTransaction->RequestHead()->Method().get(); nsCString hostHeader; @@ -321,12 +321,12 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, versionHeader = NS_LITERAL_CSTRING("HTTP/1.0"); nsClassHashtable hdrHash; - + // use mRequestHead() to get a sense of how big to make the hash, // even though we are parsing the actual text stream because // it is legit to append headers. hdrHash.Init(1 + (mTransaction->RequestHead()->Headers().Count() * 2)); - + const char *beginBuffer = mFlatHttpRequestHeaders.BeginReading(); // need to hash all the headers together to remove duplicates, special @@ -339,12 +339,12 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, crlfIndex = mFlatHttpRequestHeaders.Find("\r\n", false, startIndex); if (crlfIndex == -1) break; - + int32_t colonIndex = mFlatHttpRequestHeaders.Find(":", false, startIndex, crlfIndex - startIndex); if (colonIndex == -1) break; - + nsDependentCSubstring name = Substring(beginBuffer + startIndex, beginBuffer + colonIndex); // all header names are lower case in spdy @@ -368,7 +368,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, int32_t valueIndex = colonIndex + 1; while (valueIndex < crlfIndex && beginBuffer[valueIndex] == ' ') ++valueIndex; - + nsDependentCSubstring v = Substring(beginBuffer + valueIndex, beginBuffer + crlfIndex); if (!val->IsEmpty()) @@ -381,7 +381,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, mRequestBodyLenRemaining = len; } } - + mTxInlineFrameUsed = 18; // Do not naively log the request headers here beacuse they might @@ -408,13 +408,13 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, hdrHash.Enumerate(hdrHashEnumerate, this); CompressFlushFrame(); - + // 4 to 7 are length and flags, which we can now fill in (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(mTxInlineFrameUsed - 8); MOZ_ASSERT(!mTxInlineFrame[4], "Size greater than 24 bits"); - + // Determine whether to put the fin bit on the syn stream frame or whether // to wait for a data packet to put it on. @@ -439,7 +439,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, mSentFinOnData = 1; mTxInlineFrame[4] = SpdySession3::kFlag_Data_FIN; } - + Telemetry::Accumulate(Telemetry::SPDY_SYN_SIZE, mTxInlineFrameUsed - 18); // The size of the input headers is approximate @@ -447,7 +447,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, (mTxInlineFrameUsed - 18) * 100 / (11 + mTransaction->RequestHead()->RequestURI().Length() + mFlatHttpRequestHeaders.Length()); - + Telemetry::Accumulate(Telemetry::SPDY_SYN_RATIO, ratio); return NS_OK; } @@ -517,7 +517,7 @@ SpdyStream3::TransmitFrame(const char *buf, uint32_t transmittedCount; nsresult rv; - + LOG3(("SpdyStream3::TransmitFrame %p inline=%d stream=%d", this, mTxInlineFrameUsed, mTxStreamFrameSize)); if (countUsed) @@ -590,7 +590,7 @@ SpdyStream3::TransmitFrame(const char *buf, LOG3(("SpdyStream3::TransmitFrame for regular session=%p " "stream=%p result %x len=%d", mSession, this, rv, transmittedCount)); - + MOZ_ASSERT(rv != NS_BASE_STREAM_WOULD_BLOCK, "inconsistent stream commitment result"); @@ -599,13 +599,13 @@ SpdyStream3::TransmitFrame(const char *buf, MOZ_ASSERT(transmittedCount == mTxStreamFrameSize, "inconsistent stream commitment count"); - + SpdySession3::LogIO(mSession, this, "Writing from Transaction Buffer", buf, transmittedCount); *countUsed += mTxStreamFrameSize; } - + // calling this will trigger waiting_for if mRequestBodyLenRemaining is 0 UpdateTransportSendEvents(mTxInlineFrameUsed + mTxStreamFrameSize); @@ -634,14 +634,14 @@ SpdyStream3::GenerateDataFrameHeader(uint32_t dataLength, bool lastFrame) MOZ_ASSERT(!mTxInlineFrameUsed, "inline frame not empty"); MOZ_ASSERT(!mTxStreamFrameSize, "stream frame not empty"); MOZ_ASSERT(!(dataLength & 0xff000000), "datalength > 24 bits"); - + (reinterpret_cast(mTxInlineFrame.get()))[0] = PR_htonl(mStreamID); (reinterpret_cast(mTxInlineFrame.get()))[1] = PR_htonl(dataLength); - + MOZ_ASSERT(!(mTxInlineFrame[0] & 0x80), "control bit set unexpectedly"); MOZ_ASSERT(!mTxInlineFrame[4], "flag bits set unexpectedly"); - + mTxInlineFrameUsed = 8; mTxStreamFrameSize = dataLength; @@ -885,11 +885,11 @@ SpdyStream3::Uncompress(z_stream *context, LOG3(("SpdySession3::Uncompress %p Dictionary Error\n", this)); return NS_ERROR_FAILURE; } - - triedDictionary = true; + + triedDictionary = true; inflateSetDictionary(context, kDictionary, sizeof(kDictionary)); } - + if (zlib_rv == Z_DATA_ERROR || zlib_rv == Z_MEM_ERROR) return NS_ERROR_FAILURE; @@ -898,7 +898,7 @@ SpdyStream3::Uncompress(z_stream *context, mDecompressBufferUsed += mDecompressBufferSize - mDecompressBufferUsed - context->avail_out; - + // When there is no more output room, but input still available then // increase the output space if (zlib_rv == Z_OK && @@ -985,7 +985,7 @@ SpdyStream3::ConvertHeaders(nsACString &aHeadersOut) // Content-Length is 'advisory'.. we will not strip it because it can // create UI feedback. - + aHeadersOut.Append(version); aHeadersOut.Append(NS_LITERAL_CSTRING(" ")); aHeadersOut.Append(status); @@ -1147,12 +1147,12 @@ SpdyStream3::CompressToFrame(const char *data, uint32_t len) // followed by the utf8 string uint32_t networkLen = PR_htonl(len); - + // write out the length mZlib->next_in = reinterpret_cast (&networkLen); mZlib->avail_in = 4; ExecuteCompress(Z_NO_FLUSH); - + // write out the data mZlib->next_in = (unsigned char *)data; mZlib->avail_in = len; @@ -1187,7 +1187,7 @@ SpdyStream3::OnReadSegment(const char *buf, MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(mSegmentReader, "OnReadSegment with null mSegmentReader"); - + nsresult rv = NS_ERROR_UNEXPECTED; uint32_t dataLength; @@ -1235,7 +1235,7 @@ SpdyStream3::OnReadSegment(const char *buf, if (dataLength > mRemoteWindow) dataLength = static_cast(mRemoteWindow); - LOG3(("SpdyStream3 this=%p id 0x%X remote window is %d. Chunk is %d\n", + LOG3(("SpdyStream3 this=%p id 0x%X remote window is %d. Chunk is %d\n", this, mStreamID, mRemoteWindow, dataLength)); mRemoteWindow -= dataLength; @@ -1273,12 +1273,12 @@ SpdyStream3::OnReadSegment(const char *buf, case SENDING_FIN_STREAM: MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment"); break; - + default: MOZ_ASSERT(false, "SpdyStream3::OnReadSegment non-write state"); break; } - + return rv; } diff --git a/netwerk/protocol/http/SpdyStream3.h b/netwerk/protocol/http/SpdyStream3.h index 17708719bb4..2b6c563251e 100644 --- a/netwerk/protocol/http/SpdyStream3.h +++ b/netwerk/protocol/http/SpdyStream3.h @@ -34,7 +34,7 @@ public: // returns false if called more than once bool GetFullyOpen() {return mFullyOpen;} - void SetFullyOpen() + void SetFullyOpen() { MOZ_ASSERT(!mFullyOpen); mFullyOpen = 1; @@ -115,7 +115,7 @@ private: void CompressFlushFrame(); void ExecuteCompress(uint32_t); nsresult FindHeader(nsCString, nsDependentCSubstring &); - + // Each stream goes from syn_stream to upstream_complete, perhaps // looping on multiple instances of generating_request_body and // sending_request_body for each SPDY chunk in the upload. diff --git a/netwerk/protocol/http/nsAHttpTransaction.h b/netwerk/protocol/http/nsAHttpTransaction.h index 1084620bf24..f93d87bb286 100644 --- a/netwerk/protocol/http/nsAHttpTransaction.h +++ b/netwerk/protocol/http/nsAHttpTransaction.h @@ -64,7 +64,7 @@ public: // called to indicate a failure with proxy CONNECT virtual void SetProxyConnectFailed() = 0; - + // called to retrieve the request headers of the transaction virtual nsHttpRequestHead *RequestHead() = 0; @@ -89,7 +89,7 @@ public: // classes that do not implement sub transactions // return NS_ERROR_NOT_IMPLEMENTED virtual nsresult AddTransaction(nsAHttpTransaction *transaction) = 0; - + // The total length of the outstanding pipeline comprised of transacations // and sub-transactions. virtual uint32_t PipelineDepth() = 0; @@ -109,7 +109,7 @@ public: // A null transaction is expected to return BASE_STREAM_CLOSED on all of // its IO functions all the time. virtual bool IsNullTransaction() { return false; } - + // Every transaction is classified into one of the types below. When using // HTTP pipelines, only transactions with the same type appear on the same // pipeline. @@ -123,7 +123,7 @@ public: // Transactions for content expected to be an image CLASS_IMAGE, - // Transactions that cannot involve a pipeline + // Transactions that cannot involve a pipeline CLASS_SOLO, // Transactions that do not fit any of the other categories. HTML diff --git a/netwerk/protocol/http/nsHttp.cpp b/netwerk/protocol/http/nsHttp.cpp index 003cef1ac25..f3970d308cc 100644 --- a/netwerk/protocol/http/nsHttp.cpp +++ b/netwerk/protocol/http/nsHttp.cpp @@ -126,7 +126,7 @@ nsHttp::CreateAtomTable() (PL_DHashTableOperate(&sAtomTable, atoms[i], PL_DHASH_ADD)); if (!stub) return NS_ERROR_OUT_OF_MEMORY; - + MOZ_ASSERT(!stub->key, "duplicate static atom"); stub->key = atoms[i]; } diff --git a/netwerk/protocol/http/nsHttpAtomList.h b/netwerk/protocol/http/nsHttpAtomList.h index 62e425a7368..1566d30bbfd 100644 --- a/netwerk/protocol/http/nsHttpAtomList.h +++ b/netwerk/protocol/http/nsHttpAtomList.h @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /****** - This file contains the list of all HTTP atoms + This file contains the list of all HTTP atoms See nsHttp.h for access to the atoms. It is designed to be used as inline input to nsHttp.cpp *only* diff --git a/netwerk/protocol/http/nsHttpAuthCache.cpp b/netwerk/protocol/http/nsHttpAuthCache.cpp index 0a384ce8022..eefa92f4ec1 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.cpp +++ b/netwerk/protocol/http/nsHttpAuthCache.cpp @@ -331,7 +331,7 @@ nsHttpAuthIdentity::Set(const PRUnichar *domain, int domainLen = domain ? NS_strlen(domain) : 0; int userLen = user ? NS_strlen(user) : 0; - int passLen = pass ? NS_strlen(pass) : 0; + int passLen = pass ? NS_strlen(pass) : 0; int len = userLen + 1 + passLen + 1 + domainLen + 1; newUser = (PRUnichar *) malloc(len * sizeof(PRUnichar)); @@ -414,7 +414,7 @@ nsHttpAuthEntry::AddPath(const char *aPath) tempPtr = tempPtr->mNext; } - + //Append the aPath nsHttpAuthPath *newAuthPath; int newpathLen = strlen(aPath); @@ -471,7 +471,7 @@ nsHttpAuthEntry::Set(const char *path, nsresult rv = NS_OK; if (ident) { rv = mIdent.Set(*ident); - } + } else if (mIdent.IsEmpty()) { // If we are not given an identity and our cached identity has not been // initialized yet (so is currently empty), initialize it now by diff --git a/netwerk/protocol/http/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h index 62960f96c59..5de315b82e8 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.h +++ b/netwerk/protocol/http/nsHttpAuthCache.h @@ -17,8 +17,6 @@ #include "nsCRT.h" #include "nsIObserver.h" - - struct nsHttpAuthPath { struct nsHttpAuthPath *mNext; char mPath[1]; @@ -85,9 +83,9 @@ public: nsHttpAuthPath *RootPath() { return mRoot; } const nsHttpAuthIdentity &Identity() const { return mIdent; } - + nsresult AddPath(const char *aPath); - + nsCOMPtr mMetaData; private: @@ -221,7 +219,7 @@ public: uint32_t appId, bool inBrowserElement); - // expire all existing auth list entries including proxy auths. + // expire all existing auth list entries including proxy auths. nsresult ClearAll(); private: @@ -250,7 +248,7 @@ private: }; void ClearAppData(uint32_t appId, bool browserOnly); - + private: PLHashTable *mDB; // "host:port" --> nsHttpAuthNode nsRefPtr mObserver; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 2d2f1ad24fa..d2c2df4a97f 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -38,7 +38,7 @@ #include "mozilla/VisualEventTracer.h" namespace mozilla { namespace net { - + namespace { // Device IDs for various cache types @@ -84,7 +84,7 @@ nsresult Hash(const char *buf, nsACString &hash) { nsresult rv; - + nsCOMPtr hasher = do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); @@ -132,7 +132,7 @@ MaybeMarkCacheEntryValid(const void * channel, channel, cacheEntry, int(cacheAccess), int(rv))); } else { LOG(("Not marking read-only cache entry valid " - "[channel=%p, entry=%p, access=%d]", + "[channel=%p, entry=%p, access=%d]", channel, cacheEntry, int(cacheAccess))); } } @@ -160,8 +160,8 @@ AutoRedirectVetoNotifier::ReportRedirectResult(bool succeeded) mChannel->mRedirectChannel = nullptr; nsCOMPtr vetoHook; - NS_QueryNotificationCallbacks(mChannel, - NS_GET_IID(nsIRedirectResultListener), + NS_QueryNotificationCallbacks(mChannel, + NS_GET_IID(nsIRedirectResultListener), getter_AddRefs(vetoHook)); #ifdef MOZ_VISUAL_EVENT_TRACER @@ -257,7 +257,7 @@ private: const bool mUsingSSL; const bool mLoadedFromApplicationCache; - // Used only internally + // Used only internally nsCOMPtr mCacheThread; nsCOMPtr mCacheEntry; nsCacheAccessMode mCacheAccess; @@ -469,7 +469,7 @@ nsHttpChannel::ContinueConnect() return rv; } else if (mLoadFlags & LOAD_ONLY_FROM_CACHE) { - // the cache contains the requested resource, but it must be + // the cache contains the requested resource, but it must be // validated before we can reuse it. since we are not allowed // to hit the net, there's nothing more to do. the document // is effectively not in the cache. @@ -516,7 +516,7 @@ nsHttpChannel::SpeculativeConnect() // if we are offline, when doing http upgrade (i.e. websockets bootstrap), // or if we can't do keep-alive (because then we couldn't reuse // the speculative connection anyhow). - if (mApplicationCache || gIOService->IsOffline() || + if (mApplicationCache || gIOService->IsOffline() || mUpgradeProtocolCallback || !(mCaps & NS_HTTP_ALLOW_KEEPALIVE)) return; @@ -526,7 +526,7 @@ nsHttpChannel::SpeculativeConnect() if (mLoadFlags & (LOAD_ONLY_FROM_CACHE | LOAD_FROM_CACHE | LOAD_NO_NETWORK_IO | LOAD_CHECK_OFFLINE_CACHE)) return; - + nsCOMPtr callbacks; NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup, getter_AddRefs(callbacks)); @@ -550,7 +550,7 @@ void nsHttpChannel::HandleAsyncRedirect() { NS_PRECONDITION(!mCallOnResume, "How did that happen?"); - + if (mSuspendCount) { LOG(("Waiting until resume to do async redirect [this=%p]\n", this)); mCallOnResume = &nsHttpChannel::HandleAsyncRedirect; @@ -610,14 +610,14 @@ void nsHttpChannel::HandleAsyncNotModified() { NS_PRECONDITION(!mCallOnResume, "How did that happen?"); - + if (mSuspendCount) { LOG(("Waiting until resume to do async not-modified [this=%p]\n", this)); mCallOnResume = &nsHttpChannel::HandleAsyncNotModified; return; } - + LOG(("nsHttpChannel::HandleAsyncNotModified [this=%p]\n", this)); DoNotifyListener(); @@ -875,7 +875,7 @@ nsHttpChannel::SetupTransaction() } SetupTransactionLoadGroupInfo(); - + rv = nsInputStreamPump::Create(getter_AddRefs(mTransactionPump), responseStream); return rv; @@ -914,7 +914,7 @@ nsHttpChannel::CallOnStartRequest() typeSniffersCalled = NS_SUCCEEDED(mCachePump->PeekStream(CallTypeSniffers, thisChannel)); } - + if (!typeSniffersCalled && mTransactionPump) { mTransactionPump->PeekStream(CallTypeSniffers, thisChannel); } @@ -990,7 +990,7 @@ nsHttpChannel::CallOnStartRequest() LOG(("writing to the offline cache")); rv = InitOfflineCacheEntry(); if (NS_FAILED(rv)) return rv; - + // InitOfflineCacheEntry may have closed mOfflineCacheEntry if (mOfflineCacheEntry) { rv = InstallOfflineCacheListener(); @@ -1022,7 +1022,7 @@ nsHttpChannel::ProcessFailedProxyConnect(uint32_t httpStatus) MOZ_ASSERT(mConnectionInfo->UsingConnect(), "proxy connect failed but not using CONNECT?"); nsresult rv; - switch (httpStatus) + switch (httpStatus) { case 300: case 301: case 302: case 303: case 307: case 308: // Bad redirect: not top-level, or it's a POST, bad/missing Location, @@ -1035,7 +1035,7 @@ nsHttpChannel::ProcessFailedProxyConnect(uint32_t httpStatus) case 407: // ProcessAuthentication() failed case 501: // HTTP/1.1: "Not Implemented" // user sees boilerplate Mozilla "Proxy Refused Connection" page. - rv = NS_ERROR_PROXY_CONNECTION_REFUSED; + rv = NS_ERROR_PROXY_CONNECTION_REFUSED; break; // Squid sends 404 if DNS fails (regular 404 from target is tunneled) case 404: // HTTP/1.1: "Not Found" @@ -1047,7 +1047,7 @@ nsHttpChannel::ProcessFailedProxyConnect(uint32_t httpStatus) /* User sees: "Address Not Found: Firefox can't find the server at * www.foo.com." */ - rv = NS_ERROR_UNKNOWN_HOST; + rv = NS_ERROR_UNKNOWN_HOST; break; case 502: // HTTP/1.1: "Bad Gateway" (invalid resp from target server) // Squid returns 503 if target request fails for anything but DNS. @@ -1061,18 +1061,18 @@ nsHttpChannel::ProcessFailedProxyConnect(uint32_t httpStatus) break; // RFC 2616 uses 504 for both DNS and target timeout, so not clear what to // do here: picking target timeout, as DNS covered by 400/404/500 - case 504: // HTTP/1.1: "Gateway Timeout" + case 504: // HTTP/1.1: "Gateway Timeout" // user sees: "Network Timeout: The server at www.foo.com // is taking too long to respond." rv = NS_ERROR_NET_TIMEOUT; break; // Confused proxy server or malicious response default: - rv = NS_ERROR_PROXY_CONNECTION_REFUSED; + rv = NS_ERROR_PROXY_CONNECTION_REFUSED; break; } LOG(("Cancelling failed proxy CONNECT [this=%p httpStatus=%u]\n", - this, httpStatus)); + this, httpStatus)); Cancel(rv); CallOnStartRequest(); return rv; @@ -1902,7 +1902,7 @@ nsHttpChannel::EnsureAssocReq() if (!mTransaction || !mURI) return NS_OK; - + if (!mTransaction->PipelinePosition()) { // "Pragma: X-Verify-Assoc-Req" can be used to verify even non pipelined // transactions. It is used by test harness. @@ -1917,17 +1917,17 @@ nsHttpChannel::EnsureAssocReq() char *method = net_FindCharNotInSet(assoc_val, HTTP_LWS); if (!method) return NS_OK; - + bool equals; char *endofmethod; - + assoc_val = nullptr; endofmethod = net_FindCharInSet(method, HTTP_LWS); if (endofmethod) assoc_val = net_FindCharNotInSet(endofmethod, HTTP_LWS); if (!assoc_val) return NS_OK; - + // check the method int32_t methodlen = strlen(mRequestHead.Method().get()); if ((methodlen != (endofmethod - method)) || @@ -1958,7 +1958,7 @@ nsHttpChannel::EnsureAssocReq() return NS_ERROR_CORRUPTED_CONTENT; return NS_OK; } - + // check the URL nsCOMPtr assoc_url; if (NS_FAILED(NS_NewURI(getter_AddRefs(assoc_url), assoc_val)) || @@ -2033,14 +2033,14 @@ nsHttpChannel::ProcessPartialContent() // we need to stream whatever data is in the cache out first, and then // pick up whatever data is on the wire, writing it into the cache. - LOG(("nsHttpChannel::ProcessPartialContent [this=%p]\n", this)); + LOG(("nsHttpChannel::ProcessPartialContent [this=%p]\n", this)); NS_ENSURE_TRUE(mCachedResponseHead, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_INITIALIZED); // Make sure to clear bogus content-encodings before looking at the header ClearBogusContentEncodingIfNeeded(); - + // Check if the content-encoding we now got is different from the one we // got before if (PL_strcasecmp(mResponseHead->PeekHeader(nsHttp::Content_Encoding), @@ -2128,10 +2128,10 @@ nsHttpChannel::ProcessNotModified() { nsresult rv; - LOG(("nsHttpChannel::ProcessNotModified [this=%p]\n", this)); + LOG(("nsHttpChannel::ProcessNotModified [this=%p]\n", this)); if (mCustomConditionalRequest) { - LOG(("Bypassing ProcessNotModified due to custom conditional headers")); + LOG(("Bypassing ProcessNotModified due to custom conditional headers")); return NS_ERROR_FAILURE; } @@ -2158,7 +2158,7 @@ nsHttpChannel::ProcessNotModified() rv = mCachedResponseHead->GetHeader(nsHttp::Last_Modified, lastModifiedCached); if (NS_SUCCEEDED(rv)) { - rv = mResponseHead->GetHeader(nsHttp::Last_Modified, + rv = mResponseHead->GetHeader(nsHttp::Last_Modified, lastModified304); } @@ -2547,7 +2547,7 @@ nsHttpChannel::OpenNormalCacheEntry(bool usingSSL) rv = DetermineCacheAccess(&accessRequested); if (NS_FAILED(rv)) return rv; - + mCacheQuery = new HttpCacheQuery( this, clientID, storagePolicy, mPrivateBrowsing, cacheKey, accessRequested, @@ -2743,13 +2743,13 @@ nsHttpChannel::AssembleCacheKey(const char *spec, uint32_t postID, // UpdateExpirationTime is called when a new response comes in from the server. // It updates the stored response-time and sets the expiration time on the -// cache entry. +// cache entry. // // From section 13.2.4 of RFC2616, we compute expiration time as follows: // // timeRemaining = freshnessLifetime - currentAge // expirationTime = now + timeRemaining -// +// nsresult nsHttpChannel::UpdateExpirationTime() { @@ -2767,7 +2767,7 @@ nsHttpChannel::UpdateExpirationTime() if (freshnessLifetime > 0) { uint32_t now = NowInSeconds(), currentAge = 0; - rv = mResponseHead->ComputeCurrentAge(now, mRequestTime, ¤tAge); + rv = mResponseHead->ComputeCurrentAge(now, mRequestTime, ¤tAge); if (NS_FAILED(rv)) return rv; LOG(("freshnessLifetime = %u, currentAge = %u\n", @@ -2812,7 +2812,7 @@ HttpCacheQuery::Dispatch() // XXX: Start the cache service; otherwise DispatchToCacheIOThread will // fail. - nsCOMPtr service = + nsCOMPtr service = do_GetService(NS_CACHESERVICE_CONTRACTID, &rv); // Ensure the stream transport service gets initialized on the main thread @@ -2872,7 +2872,7 @@ HttpCacheQuery::Run() rv = channel->OnCacheEntryAvailable(entry, mCacheAccess, mStatus); } - + return rv; } @@ -3148,7 +3148,7 @@ HttpCacheQuery::CheckCache() requestedETag = mRequestHead.PeekHeader(nsHttp::If_Match); if (cachedETag && (!strncmp(cachedETag, "W/", 2) || strcmp(requestedETag, cachedETag))) { - // User has defined If-Match header, if the cached entry is not + // User has defined If-Match header, if the cached entry is not // matching the provided header value or the cached ETag is weak, // force validation. doValidation = true; @@ -3369,7 +3369,7 @@ HttpCacheQuery::OpenCacheInputStream(bool startBuffering) if ((mLoadFlags & nsICachingChannel::LOAD_ONLY_IF_MODIFIED) && !mCachedContentIsPartial) { // For LOAD_ONLY_IF_MODIFIED, we usually don't have to deal with the - // cached entity. + // cached entity. if (!mCacheForOfflineUse) { LOG(("Will skip read from cache based on LOAD_ONLY_IF_MODIFIED " "load flag\n")); @@ -3413,7 +3413,7 @@ HttpCacheQuery::OpenCacheInputStream(bool startBuffering) // Have the stream transport service start reading the entity on one of its // background threads. - + nsCOMPtr transport; nsCOMPtr wrapper; @@ -3434,7 +3434,7 @@ HttpCacheQuery::OpenCacheInputStream(bool startBuffering) LOG(("Failed to open cache input stream [channel=%p, " "wrapper=%p, transport=%p, stream=%p]", this, wrapper.get(), transport.get(), stream.get())); - + stream->Close(); return rv; } @@ -3460,7 +3460,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) UpdateInhibitPersistentCachingFlag(); - // if we don't already have security info, try to get it from the cache + // if we don't already have security info, try to get it from the cache // entry. there are two cases to consider here: 1) we are just reading // from the cache, or 2) this may be due to a 304 not modified response, // in which case we could have security info from a socket transport. @@ -3489,7 +3489,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) LOG(("Skipping skip read of cached redirect entity\n")); return AsyncCall(&nsHttpChannel::HandleAsyncRedirect); } - + if ((mLoadFlags & LOAD_ONLY_IF_MODIFIED) && !mCachedContentIsPartial) { if (!mApplicationCacheForWrite) { LOG(("Skipping read from cache based on LOAD_ONLY_IF_MODIFIED " @@ -3499,7 +3499,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) // here, to avoid event dispatching latency. return AsyncCall(&nsHttpChannel::HandleAsyncNotModified); } - + if (!ShouldUpdateOfflineCacheEntry()) { LOG(("Skipping read from cache based on LOAD_ONLY_IF_MODIFIED " "load flag (mApplicationCacheForWrite not null case)\n")); @@ -3519,7 +3519,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) nsCOMPtr inputStream = mCacheInputStream.forget(); - + rv = nsInputStreamPump::Create(getter_AddRefs(mCachePump), inputStream, int64_t(-1), int64_t(-1), 0, 0, true); if (NS_FAILED(rv)) { @@ -3730,7 +3730,7 @@ nsHttpChannel::AddCacheEntryHeaders(nsICacheEntryDescriptor *entry) mResponseHead->GetHeader(nsHttp::Vary, buf); if (!buf.IsEmpty()) { NS_NAMED_LITERAL_CSTRING(prefix, "request-"); - + char *val = buf.BeginWriting(); // going to munge buf char *token = nsCRT::strtok(val, NS_HTTP_HEADER_SEPS, &val); while (token) { @@ -3849,11 +3849,11 @@ nsHttpChannel::InstallCacheListener(uint32_t offset) mResponseHead->ContentType().EqualsLiteral(APPLICATION_ECMASCRIPT) || mResponseHead->ContentType().EqualsLiteral(APPLICATION_XJAVASCRIPT) || mResponseHead->ContentType().EqualsLiteral(APPLICATION_XHTML_XML))) { - rv = mCacheEntry->SetMetaDataElement("uncompressed-len", "0"); + rv = mCacheEntry->SetMetaDataElement("uncompressed-len", "0"); if (NS_FAILED(rv)) { LOG(("unable to mark cache entry for compression")); } - } + } LOG(("Trading cache input stream for output stream [channel=%p]", this)); @@ -3954,7 +3954,7 @@ nsHttpChannel::ClearBogusContentEncodingIfNeeded() //----------------------------------------------------------------------------- nsresult -nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, +nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, nsIChannel *newChannel, bool preserveMethod) { @@ -4030,7 +4030,7 @@ nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType) if (mApplicationCache) { // if we are redirected to a different origin check if there is a fallback - // cache entry to fall back to. we don't care about file strict + // cache entry to fall back to. we don't care about file strict // checking, at least mURI is not a file URI. if (!NS_SecurityCompareURIs(mURI, mRedirectURI, false)) { PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessRedirectionAfterFallback); @@ -4097,7 +4097,7 @@ nsHttpChannel::ContinueProcessRedirectionAfterFallback(nsresult rv) bool rewriteToGET = nsHttp::ShouldRewriteRedirectToGET( mRedirectType, mRequestHead.Method()); - + // prompt if the method is not safe (such as POST, PUT, DELETE, ...) if (!rewriteToGET && !nsHttp::IsSafeMethod(mRequestHead.Method())) { @@ -4174,7 +4174,7 @@ nsHttpChannel::ContinueProcessRedirection(nsresult rv) // close down this channel Cancel(NS_BINDING_REDIRECTED); - + notifier.RedirectSucceeded(); ReleaseListeners(); @@ -4197,7 +4197,7 @@ NS_IMETHODIMP nsHttpChannel::OnAuthAvailable() mProxyAuthPending = false; LOG(("Resuming the transaction, we got credentials from user")); mTransactionPump->Resume(); - + return NS_OK; } @@ -4302,7 +4302,7 @@ NS_IMETHODIMP nsHttpChannel::Suspend() { NS_ENSURE_TRUE(mIsPending, NS_ERROR_NOT_AVAILABLE); - + LOG(("nsHttpChannel::Suspend [this=%p]\n", this)); ++mSuspendCount; @@ -4319,9 +4319,9 @@ NS_IMETHODIMP nsHttpChannel::Resume() { NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); - + LOG(("nsHttpChannel::Resume [this=%p]\n", this)); - + if (--mSuspendCount == 0 && mCallOnResume) { nsresult rv = AsyncCall(mCallOnResume); mCallOnResume = nullptr; @@ -4479,8 +4479,8 @@ nsHttpChannel::BeginConnect() gHttpHandler->AddConnectionHeader(&mRequestHead.Headers(), mCaps); if (!mConnectionInfo->UsingHttpProxy()) { - // Start a DNS lookup very early in case the real open is queued the DNS can - // happen in parallel. Do not do so in the presence of an HTTP proxy as + // Start a DNS lookup very early in case the real open is queued the DNS can + // happen in parallel. Do not do so in the presence of an HTTP proxy as // all lookups other than for the proxy itself are done by the proxy. // // We keep the DNS prefetch object around so that we can retrieve @@ -4493,14 +4493,14 @@ nsHttpChannel::BeginConnect() mDNSPrefetch = new nsDNSPrefetch(mURI, mTimingEnabled); mDNSPrefetch->PrefetchHigh(); } - + // Adjust mCaps according to our request headers: // - If "Connection: close" is set as a request header, then do not bother // trying to establish a keep-alive connection. if (mRequestHead.HasHeaderValue(nsHttp::Connection, "close")) mCaps &= ~(NS_HTTP_ALLOW_KEEPALIVE | NS_HTTP_ALLOW_PIPELINING); - - if ((mLoadFlags & VALIDATE_ALWAYS) || + + if ((mLoadFlags & VALIDATE_ALWAYS) || (BYPASS_LOCAL_CACHE(mLoadFlags))) mCaps |= NS_HTTP_REFRESH_DNS; @@ -4595,7 +4595,7 @@ nsHttpChannel::OnProxyAvailable(nsICancelable *request, nsIURI *uri, // proxy info. That is a non-fatal error assuming it wasn't because the // request was canceled. We just failover to DIRECT when proxy resolution // fails (failure can mean that the PAC URL could not be loaded). - + if (NS_SUCCEEDED(status)) mProxyInfo = pi; @@ -5001,7 +5001,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st } // Do not to leave the transaction in a suspended state in error cases. if (NS_FAILED(status) && mTransaction) - gHttpHandler->CancelTransaction(mTransaction, status); + gHttpHandler->CancelTransaction(mTransaction, status); } if (mTransaction) { @@ -5030,7 +5030,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st nsRefPtr stickyConn; if (mCaps & NS_HTTP_STICKY_CONNECTION) stickyConn = mTransaction->Connection(); - + // at this point, we're done with the transaction mTransactionTimings = mTransaction->Timings(); mTransaction = nullptr; @@ -5065,7 +5065,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st // if this transaction has been replaced, then bail. if (mTransactionReplaced) return NS_OK; - + if (mUpgradeProtocolCallback && stickyConn && mResponseHead && mResponseHead->Status() == 101) { gHttpHandler->ConnMgr()->CompleteUpgrade(stickyConn, @@ -5081,7 +5081,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st mRequestTimeInitialized){ FinalizeCacheEntry(); } - + if (mListener) { LOG((" calling OnStopRequest\n")); mListener->OnStopRequest(this, mListenerContext, status); @@ -5101,7 +5101,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st CleanRedirectCacheChainIfNecessary(); ReleaseListeners(); - + return NS_OK; } @@ -5157,7 +5157,7 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, // // we have to manually keep the logical offset of the stream up-to-date. - // we cannot depend solely on the offset provided, since we may have + // we cannot depend solely on the offset provided, since we may have // already streamed some data from another source (see, for example, // OnDoneReadingPartialCacheEntry). // @@ -5221,7 +5221,7 @@ nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status, #endif return NS_OK; -} +} //----------------------------------------------------------------------------- // nsHttpChannel::nsICacheInfoChannel @@ -5320,18 +5320,18 @@ class nsHttpChannelCacheKey MOZ_FINAL : public nsISupportsPRUint32, NS_DECL_NSISUPPORTSPRIMITIVE NS_FORWARD_NSISUPPORTSPRUINT32(mSupportsPRUint32->) - + // Both interfaces declares toString method with the same signature. // Thus we have to delegate only to nsISupportsPRUint32 implementation. - NS_IMETHOD GetData(nsACString & aData) - { + NS_IMETHOD GetData(nsACString & aData) + { return mSupportsCString->GetData(aData); } NS_IMETHOD SetData(const nsACString & aData) - { + { return mSupportsCString->SetData(aData); } - + public: nsresult SetData(uint32_t aPostID, const nsACString& aKey); @@ -5368,14 +5368,14 @@ nsresult nsHttpChannelCacheKey::SetData(uint32_t aPostID, { nsresult rv; - mSupportsCString = + mSupportsCString = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; mSupportsCString->SetData(aKey); if (NS_FAILED(rv)) return rv; - mSupportsPRUint32 = + mSupportsPRUint32 = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; @@ -5583,7 +5583,7 @@ nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn) // this authentication attempt (bug 84794). // TODO: save cookies from auth response and send them here (bug 572151). AddCookiesToRequest(); - + // notify "http-on-modify-request" observers CallOnModifyRequestObservers(); @@ -5595,7 +5595,7 @@ nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn) // set sticky connection flag and disable pipelining. mCaps |= NS_HTTP_STICKY_CONNECTION; mCaps &= ~NS_HTTP_ALLOW_PIPELINING; - + // and create a new one... rv = SetupTransaction(); if (NS_FAILED(rv)) return rv; @@ -5756,7 +5756,7 @@ nsHttpChannel::WaitForRedirectCallback() rv = mCachePump->Suspend(); if (NS_FAILED(rv) && mTransactionPump) { #ifdef DEBUG - nsresult resume = + nsresult resume = #endif mTransactionPump->Resume(); MOZ_ASSERT(NS_SUCCEEDED(resume), @@ -5864,7 +5864,7 @@ nsHttpChannel::MaybeInvalidateCacheEntryForSubsequentGet() // Pass 0 in first param to get the cache-key for a GET-request. nsAutoCString tmpCacheKey; GenerateCacheKey(0, tmpCacheKey); - LOG(("MaybeInvalidateCacheEntryForSubsequentGet [this=%p uri=%s]\n", + LOG(("MaybeInvalidateCacheEntryForSubsequentGet [this=%p uri=%s]\n", this, tmpCacheKey.get())); DoInvalidateCacheEntry(tmpCacheKey); diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index f47e1e8911b..3fd347bb06f 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -117,11 +117,11 @@ public: NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks); NS_IMETHOD SetLoadGroup(nsILoadGroup *aLoadGroup); -public: /* internal necko use only */ +public: /* internal necko use only */ - void InternalSetUploadStream(nsIInputStream *uploadStream) + void InternalSetUploadStream(nsIInputStream *uploadStream) { mUploadStream = uploadStream; } - void SetUploadStreamHasHeaders(bool hasHeaders) + void SetUploadStreamHasHeaders(bool hasHeaders) { mUploadStreamHasHeaders = hasHeaders; } nsresult SetReferrerInternal(nsIURI *referrer) { @@ -248,7 +248,7 @@ private: nsresult OpenRedirectChannel(nsresult rv); /** - * A function that takes care of reading STS headers and enforcing STS + * A function that takes care of reading STS headers and enforcing STS * load rules. After a secure channel is erected, STS requires the channel * to be trusted or any STS header data on the channel is ignored. * This is called from ProcessResponse. diff --git a/netwerk/protocol/http/nsHttpChannelAuthProvider.h b/netwerk/protocol/http/nsHttpChannelAuthProvider.h index 02230999208..af7a49a45b4 100644 --- a/netwerk/protocol/http/nsHttpChannelAuthProvider.h +++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.h @@ -100,7 +100,7 @@ private: nsresult DoRedirectChannelToHttps(); /** - * A function that takes care of reading STS headers and enforcing STS + * A function that takes care of reading STS headers and enforcing STS * load rules. After a secure channel is erected, STS requires the channel * to be trusted or any STS header data on the channel is ignored. * This is called from ProcessResponse. diff --git a/netwerk/protocol/http/nsHttpChunkedDecoder.cpp b/netwerk/protocol/http/nsHttpChunkedDecoder.cpp index 16856fca7eb..7be4d33291c 100644 --- a/netwerk/protocol/http/nsHttpChunkedDecoder.cpp +++ b/netwerk/protocol/http/nsHttpChunkedDecoder.cpp @@ -20,7 +20,7 @@ nsHttpChunkedDecoder::HandleChunkedContent(char *buf, LOG(("nsHttpChunkedDecoder::HandleChunkedContent [count=%u]\n", count)); *contentRead = 0; - + // from RFC2617 section 3.6.1, the chunked transfer coding is defined as: // // Chunked-Body = *chunk @@ -31,7 +31,7 @@ nsHttpChunkedDecoder::HandleChunkedContent(char *buf, // chunk-data CRLF // chunk-size = 1*HEX // last-chunk = 1*("0") [ chunk-extension ] CRLF - // + // // chunk-extension = *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) // chunk-ext-name = token // chunk-ext-val = token | quoted-string @@ -39,7 +39,7 @@ nsHttpChunkedDecoder::HandleChunkedContent(char *buf, // trailer = *(entity-header CRLF) // // the chunk-size field is a string of hex digits indicating the size of the - // chunk. the chunked encoding is ended by any chunk whose size is zero, + // chunk. the chunked encoding is ended by any chunk whose size is zero, // followed by the trailer, which is terminated by an empty line. while (count) { @@ -68,7 +68,7 @@ nsHttpChunkedDecoder::HandleChunkedContent(char *buf, } } } - + *contentRemaining = count; return NS_OK; } @@ -86,7 +86,7 @@ nsHttpChunkedDecoder::ParseChunkRemaining(char *buf, NS_PRECONDITION(count, "unexpected"); *bytesConsumed = 0; - + char *p = static_cast(memchr(buf, '\n', count)); if (p) { *p = 0; diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index 8a38aeb0b4e..cdf790ad798 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -210,7 +210,7 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion) for (int32_t index = 0; index < count; ++index) { if (!mSpdySession) { mSpdySession = ASpdySession::NewSpdySession(spdyVersion, - list[index], mSocketTransport, + list[index], mSocketTransport, mPriority); } else { @@ -247,13 +247,13 @@ nsHttpConnection::EnsureNPNComplete() if (mNPNComplete) return true; - + nsresult rv; nsCOMPtr securityInfo; nsCOMPtr ssl; nsAutoCString negotiatedNPN; - + rv = mSocketTransport->GetSecurityInfo(getter_AddRefs(securityInfo)); if (NS_FAILED(rv)) goto npnComplete; @@ -264,7 +264,7 @@ nsHttpConnection::EnsureNPNComplete() rv = ssl->GetNegotiatedNPN(negotiatedNPN); if (rv == NS_ERROR_NOT_CONNECTED) { - + // By writing 0 bytes to the socket the SSL handshake machine is // pushed forward. uint32_t count = 0; @@ -347,7 +347,7 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri mInputOverflow = nullptr; rv = OnOutputStreamReady(mSocketOut); - + failed_activation: if (NS_FAILED(rv)) { mTransaction = nullptr; @@ -444,7 +444,7 @@ nsHttpConnection::AddTransaction(nsAHttpTransaction *httpTransaction, "AddTransaction to live http connection without spdy"); MOZ_ASSERT(mTransaction, "AddTransaction to idle http connection"); - + if (!mSpdySession->AddStream(httpTransaction, priority)) { MOZ_ASSERT(false, "AddStream should never fail due to" "RoomForMore() admission check"); @@ -487,7 +487,7 @@ nsHttpConnection::Close(nsresult reason) while (NS_SUCCEEDED(rv) && count > 0 && total < 64000); LOG(("nsHttpConnection::Close drained %d bytes\n", total)); } - + mSocketTransport->SetSecurityCallbacks(nullptr); mSocketTransport->Close(reason); if (mSocketOut) @@ -551,7 +551,7 @@ nsHttpConnection::CanReuse() } bool canReuse; - + if (mSpdySession) canReuse = mSpdySession->CanReuse(); else @@ -581,7 +581,7 @@ nsHttpConnection::CanDirectlyActivate() // return true if a new transaction can be addded to ths connection at any // time through Activate(). In practice this means this is a healthy SPDY // connection with room for more concurrent streams. - + return UsingSpdy() && CanReuse() && mSpdySession && mSpdySession->RoomForMoreStreams(); } @@ -658,22 +658,22 @@ nsHttpConnection::SupportsPipelining(nsHttpResponseHead *responseHead) // The blacklist is indexed by the first character. All of these servers are // known to return their identifier as the first thing in the server string, - // so we can do a leading match. + // so we can do a leading match. static const char *bad_servers[26][6] = { { nullptr }, { nullptr }, { nullptr }, { nullptr }, // a - d { "EFAServer/", nullptr }, // e { nullptr }, { nullptr }, { nullptr }, { nullptr }, // f - i - { nullptr }, { nullptr }, { nullptr }, // j - l + { nullptr }, { nullptr }, { nullptr }, // j - l { "Microsoft-IIS/4.", "Microsoft-IIS/5.", nullptr }, // m - { "Netscape-Enterprise/3.", "Netscape-Enterprise/4.", + { "Netscape-Enterprise/3.", "Netscape-Enterprise/4.", "Netscape-Enterprise/5.", "Netscape-Enterprise/6.", nullptr }, // n { nullptr }, { nullptr }, { nullptr }, { nullptr }, // o - r { nullptr }, { nullptr }, { nullptr }, { nullptr }, // s - v { "WebLogic 3.", "WebLogic 4.","WebLogic 5.", "WebLogic 6.", - "Winstone Servlet Engine v0.", nullptr }, // w + "Winstone Servlet Engine v0.", nullptr }, // w { nullptr }, { nullptr }, { nullptr } // x - z - }; + }; int index = val[0] - 'A'; // the whole table begins with capital letters if ((index >= 0) && (index <= 25)) @@ -744,7 +744,7 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, mKeepAlive = true; else mKeepAlive = false; - + // We need at least version 1.1 to use pipelines gHttpHandler->ConnMgr()->PipelineFeedbackInfo( mConnInfo, nsHttpConnectionMgr::RedVersionTooLow, this, 0); @@ -799,13 +799,13 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, responseStatus != 304) { mClassification = nsAHttpTransaction::CLASS_GENERAL; } - + // if this connection is persistent, then the server may send a "Keep-Alive" // header specifying the maximum number of times the connection can be // reused as well as the maximum amount of time the connection can be idle // before the server will close it. we ignore the max reuse count, because // a "keep-alive" connection is by definition capable of being reused, and - // we only care about being able to reuse it once. if a timeout is not + // we only care about being able to reuse it once. if a timeout is not // specified then we use our advertized timeout value. bool foundKeepAliveMax = false; if (mKeepAlive) { @@ -830,7 +830,7 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, else { mIdleTimeout = gHttpHandler->SpdyTimeout(); } - + LOG(("Connection can be reused [this=%p idle-timeout=%usec]\n", this, PR_IntervalToSeconds(mIdleTimeout))); } @@ -871,7 +871,7 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, mTransaction->SetProxyConnectFailed(); } } - + const char *upgradeReq = requestHead->PeekHeader(nsHttp::Upgrade); // Don't use persistent connection for Upgrade unless there's an auth failure: // some proxies expect to see auth response on persistent connection. @@ -879,7 +879,7 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans, LOG(("HTTP Upgrade in play - disable keepalive\n")); DontReuse(); } - + if (responseStatus == 101) { const char *upgradeResp = responseHead->PeekHeader(nsHttp::Upgrade); if (!upgradeReq || !upgradeResp || @@ -904,7 +904,7 @@ nsHttpConnection::IsReused() return true; if (!mConsiderReusedAfterInterval) return false; - + // ReusedAfter allows a socket to be consider reused only after a certain // interval of time has passed return (PR_IntervalNow() - mConsiderReusedAfterEpoch) >= @@ -942,7 +942,7 @@ nsHttpConnection::TakeTransport(nsISocketTransport **aTransport, mSocketTransport = nullptr; mSocketIn = nullptr; mSocketOut = nullptr; - + return NS_OK; } @@ -960,7 +960,7 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now) mSpdySession->ReadTimeoutTick(now); return; } - + if (!gHttpHandler->GetPipelineRescheduleOnTimeout()) return; @@ -1002,7 +1002,7 @@ nsHttpConnection::ReadTimeoutTick(PRIntervalTime now) if (pipelineDepth <= 1 && !mTransaction->PipelinePosition()) return; - + // nothing has transpired on this pipelined socket for many // seconds. Call that a total stall and close the transaction. // There is a chance the transaction will be restarted again @@ -1049,7 +1049,7 @@ nsHttpConnection::PushBack(const char *data, uint32_t length) NS_ERROR("nsHttpConnection::PushBack only one buffer supported"); return NS_ERROR_UNEXPECTED; } - + mInputOverflow = new nsPreloadedStream(mSocketIn, data, length); return NS_OK; } @@ -1283,7 +1283,7 @@ nsHttpConnection::OnSocketWritable() rv = NS_OK; if (mTransaction) { // in case the ReadSegments stack called CloseTransaction() - // + // // at this point we've written out the entire transaction, and now we // must wait for the server's response. we manufacture a status message // here to reflect the fact that we are waiting. this message will be @@ -1347,7 +1347,7 @@ nsHttpConnection::OnSocketReadable() // are caused by server bottlenecks such as think-time, disk i/o, or // cpu exhaustion (as opposed to network latency) then we generate negative // pipelining feedback to prevent head of line problems - + // Reduce the estimate of the time since last read by up to 1 RTT to // accommodate exhausted sender TCP congestion windows or minor I/O delays. diff --git a/netwerk/protocol/http/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h index bd53bbbac96..b63058653f4 100644 --- a/netwerk/protocol/http/nsHttpConnection.h +++ b/netwerk/protocol/http/nsHttpConnection.h @@ -55,7 +55,7 @@ public: // Initialize the connection: // info - specifies the connection parameters. // maxHangTime - limits the amount of time this connection can spend on a - // single transaction before it should no longer be kept + // single transaction before it should no longer be kept // alive. a value of 0xffff indicates no limit. nsresult Init(nsHttpConnectionInfo *info, uint16_t maxHangTime, nsISocketTransport *, nsIAsyncInputStream *, @@ -123,7 +123,7 @@ public: static NS_METHOD ReadFromStream(nsIInputStream *, void *, const char *, uint32_t, uint32_t, uint32_t *); - // When a persistent connection is in the connection manager idle + // When a persistent connection is in the connection manager idle // connection pool, the nsHttpConnection still reads errors and hangups // on the socket so that it can be proactively released if the server // initiates a termination. Only call on socket thread. @@ -168,7 +168,7 @@ private: PRIntervalTime IdleTime(); bool IsAlive(); bool SupportsPipelining(nsHttpResponseHead *); - + // Makes certain the SSL handshake is complete and NPN negotiation // has had a chance to happen bool EnsureNPNComplete(); diff --git a/netwerk/protocol/http/nsHttpConnectionInfo.h b/netwerk/protocol/http/nsHttpConnectionInfo.h index ec43c0dcb73..8e082a23c76 100644 --- a/netwerk/protocol/http/nsHttpConnectionInfo.h +++ b/netwerk/protocol/http/nsHttpConnectionInfo.h @@ -45,7 +45,7 @@ public: SetOriginServer(host, port); } - + ~nsHttpConnectionInfo() { LOG(("Destroying nsHttpConnectionInfo @%x\n", this)); @@ -75,7 +75,7 @@ public: { SetOriginServer(nsDependentCString(host), port); } - + // OK to treat this as an infalible allocation nsHttpConnectionInfo* Clone() const; @@ -87,7 +87,7 @@ public: // Two connections are 'equal' if they end up talking the same // protocol to the same server. This is needed to properly manage // persistent connections to proxies - // Note that we don't care about transparent proxies - + // Note that we don't care about transparent proxies - // it doesn't matter if we're talking via socks or not, since // a request will end up at the same host. bool Equals(const nsHttpConnectionInfo *info) @@ -102,7 +102,7 @@ public: bool UsingSSL() const { return mUsingSSL; } bool UsingConnect() const { return mUsingConnect; } int32_t DefaultPort() const { return mUsingSSL ? NS_HTTPS_DEFAULT_PORT : NS_HTTP_DEFAULT_PORT; } - void SetAnonymous(bool anon) + void SetAnonymous(bool anon) { mHashKey.SetCharAt(anon ? 'A' : '.', 2); } bool GetAnonymous() const { return mHashKey.CharAt(2) == 'A'; } void SetPrivate(bool priv) { mHashKey.SetCharAt(priv ? 'P' : '.', 3); } diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 6da365ce21d..2f0eabda48c 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -368,14 +368,14 @@ nsHttpConnectionMgr::ReclaimConnection(nsHttpConnection *conn) } // A structure used to marshall 2 pointers across the various necessary -// threads to complete an HTTP upgrade. +// threads to complete an HTTP upgrade. class nsCompleteUpgradeData { public: nsCompleteUpgradeData(nsAHttpConnection *aConn, nsIHttpUpgradeListener *aListener) : mConn(aConn), mUpgradeListener(aListener) {} - + nsRefPtr mConn; nsCOMPtr mUpgradeListener; }; @@ -392,7 +392,7 @@ nsHttpConnectionMgr::CompleteUpgrade(nsAHttpConnection *aConn, delete data; return rv; } - + nsresult nsHttpConnectionMgr::UpdateParam(nsParamName name, uint16_t value) { @@ -432,7 +432,7 @@ nsresult nsHttpConnectionMgr::UpdateRequestTokenBucket(EventTokenBucket *aBucket) { nsRefPtr bucket(aBucket); - + // Call From main thread when a new EventTokenBucket has been made in order // to post the new value to the socket thread. nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgUpdateRequestTokenBucket, @@ -457,7 +457,7 @@ nsHttpConnectionMgr::LookupConnectionEntry(nsHttpConnectionInfo *ci, return nullptr; nsConnectionEntry *ent = mCT.Get(ci->HashKey()); - + // If there is no sign of coalescing (or it is disabled) then just // return the primary hash lookup if (!ent || !ent->mUsingSpdy || ent->mCoalescingKey.IsEmpty()) @@ -478,10 +478,10 @@ nsHttpConnectionMgr::LookupConnectionEntry(nsHttpConnectionInfo *ci, if (preferred->mIdleConns.Contains(conn)) return preferred; } - + if (trans && preferred->mPendingQ.Contains(trans)) return preferred; - + // Neither conn nor trans found in preferred, use the default entry return ent; } @@ -521,7 +521,7 @@ nsHttpConnectionMgr::ReportSpdyConnection(nsHttpConnection *conn, bool usingSpdy) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(), conn, nullptr); @@ -552,7 +552,7 @@ nsHttpConnectionMgr::ReportSpdyConnection(nsHttpConnection *conn, LOG(("ReportSpdyConnection %s %s ent=%p preferred=%p\n", ent->mConnInfo->Host(), ent->mCoalescingKey.get(), ent, preferred)); - + if (!preferred) { if (!ent->mCoalescingKey.IsEmpty()) { mSpdyPreferredHash.Put(ent->mCoalescingKey, ent); @@ -675,11 +675,11 @@ nsHttpConnectionMgr::ReportSpdyAlternateProtocol(nsHttpConnection *conn) // Check to see if this is already present if (mAlternateProtocolHash.Contains(hostPortKey)) return; - + if (mAlternateProtocolHash.Count() > 2000) mAlternateProtocolHash.EnumerateEntries(&TrimAlternateProtocolHash, this); - + mAlternateProtocolHash.PutEntry(hostPortKey); } @@ -698,7 +698,7 @@ nsHttpConnectionMgr::TrimAlternateProtocolHash(nsCStringHashKey *entry, void *closure) { nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure; - + if (self->mAlternateProtocolHash.Count() > 2000) return PL_DHASH_REMOVE; return PL_DHASH_STOP; @@ -722,7 +722,7 @@ nsHttpConnectionMgr::GetSpdyPreferredEnt(nsConnectionEntry *aOriginalEntry) // if there is no preferred host or it is no longer using spdy // then skip pooling if (!preferred || !preferred->mUsingSpdy) - return nullptr; + return nullptr; // if there is not an active spdy session in this entry then // we cannot pool because the cert upon activation may not @@ -758,7 +758,7 @@ nsHttpConnectionMgr::GetSpdyPreferredEnt(nsConnectionEntry *aOriginalEntry) nsCOMPtr securityInfo; nsCOMPtr sslSocketControl; nsAutoCString negotiatedNPN; - + activeSpdy->GetSecurityInfo(getter_AddRefs(securityInfo)); if (!securityInfo) { NS_WARNING("cannot obtain spdy security info"); @@ -813,7 +813,7 @@ nsHttpConnectionMgr::RemoveSpdyPreferredEnt(nsACString &aHashKey) { if (aHashKey.IsEmpty()) return; - + mSpdyPreferredHash.Remove(aHashKey); } @@ -936,7 +936,7 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key, } } } - + // If time to next expire found is shorter than time to next wake-up, we need to // change the time for next wake-up. if (timeToNextExpire != UINT32_MAX) { @@ -1126,11 +1126,11 @@ public: , mData(data) { } - + ~nsHttpPipelineFeedback() { } - + nsRefPtr mConnInfo; nsRefPtr mConn; nsHttpConnectionMgr::PipelineFeedbackInfoType mInfo; @@ -1242,7 +1242,7 @@ nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, uint32_t ca // Add in the in-progress tcp connections, we will assume they are // keepalive enabled. // Exclude half-open's that has already created a usable connection. - // This prevents the limit being stuck on ipv6 connections that + // This prevents the limit being stuck on ipv6 connections that // eventually time out after typical 21 seconds of no ACK+SYN reply. uint32_t totalCount = ent->mActiveConns.Length() + ent->UnconnectedHalfOpens(); @@ -1274,7 +1274,7 @@ nsHttpConnectionMgr::ClosePersistentConnections(nsConnectionEntry *ent) conn->Close(NS_ERROR_ABORT); NS_RELEASE(conn); } - + int32_t activeCount = ent->mActiveConns.Length(); for (int32_t i=0; i < activeCount; i++) ent->mActiveConns[i]->DontReuse(); @@ -1298,7 +1298,7 @@ nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent) // If this host is trying to negotiate a SPDY session right now, // don't create any new ssl connections until the result of the // negotiation is known. - + bool doRestrict = ent->mConnInfo->UsingSSL() && gHttpHandler->IsSpdyEnabled() && (!ent->mTestedSpdy || ent->mUsingSpdy) && @@ -1307,7 +1307,7 @@ nsHttpConnectionMgr::RestrictConnections(nsConnectionEntry *ent) // If there are no restrictions, we are done if (!doRestrict) return false; - + // If the restriction is based on a tcp handshake in progress // let that connect and then see if it was SPDY or not if (ent->UnconnectedHalfOpens()) @@ -1345,7 +1345,7 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent, LOG(("nsHttpConnectionMgr::MakeNewConnection %p ent=%p trans=%p", this, ent, trans)); MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + uint32_t halfOpenLength = ent->mHalfOpens.Length(); for (uint32_t i = 0; i < halfOpenLength; i++) { if (ent->mHalfOpens[i]->IsSpeculative()) { @@ -1416,7 +1416,7 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent, ent->CreditPenalty(); maxdepth = ent->MaxPipelineDepth(classification); } - + if (ent->PipelineState() == PS_RED) return false; @@ -1504,7 +1504,7 @@ bool nsHttpConnectionMgr::IsUnderPressure(nsConnectionEntry *ent, nsHttpTransaction::Classifier classification) { - // A connection entry is declared to be "under pressure" if most of the + // A connection entry is declared to be "under pressure" if most of the // allowed parallel connections are already used up. In that case we want to // favor existing pipelines over more parallelism so as to reserve any // unused parallel connections for types that don't have existing pipelines. @@ -1516,7 +1516,7 @@ nsHttpConnectionMgr::IsUnderPressure(nsConnectionEntry *ent, // using 3 or more of the connections. Failure to do this could result in // one class (e.g. images) establishing self replenishing queues on all the // connections that would starve the other transaction types. - + int32_t currentConns = ent->mActiveConns.Length(); int32_t maxConns = (ent->mConnInfo->UsingHttpProxy() && !ent->mConnInfo->UsingConnect()) ? @@ -1532,7 +1532,7 @@ nsHttpConnectionMgr::IsUnderPressure(nsConnectionEntry *ent, if (classification == ent->mActiveConns[i]->Classification()) if (++sameClass == 3) return true; /* prefer pipeline */ - + return false; /* normal behavior */ } @@ -1651,7 +1651,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent, mNumIdleConns--; nsHttpConnection *temp = conn; NS_RELEASE(temp); - + // we check if the connection can be reused before even checking if // it is a "matching" connection. if (!conn->CanReuse()) { @@ -1697,14 +1697,14 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent, // this function returns NOT_AVAILABLE for asynchronous connects return NS_ERROR_NOT_AVAILABLE; } - + if (rv != NS_ERROR_NOT_AVAILABLE) { // not available return codes should try next step as they are // not hard errors. Other codes should stop now return rv; } } - + // step 5 if (caps & NS_HTTP_ALLOW_PIPELINING) { if (AddToShortestPipeline(ent, trans, @@ -1713,7 +1713,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent, return NS_OK; } } - + // step 6 return NS_ERROR_NOT_AVAILABLE; /* queue it */ } @@ -1836,7 +1836,7 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent, // As transaction goes out of scope it will drop the last refernece to the // pipeline if activation failed, in which case this will destroy - // the pipeline, which will cause each the transactions owned by the + // the pipeline, which will cause each the transactions owned by the // pipeline to be restarted. return rv; @@ -1854,7 +1854,7 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent, /* the first transaction can go in unconditionally - 1 transaction on a nsHttpPipeline object is not a real HTTP pipeline */ - + nsRefPtr pipeline = new nsHttpPipeline(); pipeline->AddTransaction(firstTrans); NS_ADDREF(*result = pipeline); @@ -1932,7 +1932,7 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans) LOG((" ProcessNewTransaction Dispatch Immediately trans=%p\n", trans)); return rv; } - + if (rv == NS_ERROR_NOT_AVAILABLE) { LOG((" adding transaction to pending queue " "[trans=%p pending-count=%u]\n", @@ -1987,7 +1987,7 @@ nsHttpConnectionMgr::CreateTransport(nsConnectionEntry *ent, bool speculative) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + nsRefPtr sock = new nsHalfOpenSocket(ent, trans, caps); nsresult rv = sock->SetupPrimaryStreams(); NS_ENSURE_SUCCESS(rv, rv); @@ -2020,7 +2020,7 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ(nsConnectionEntry *ent) if (!(trans->Caps() & NS_HTTP_ALLOW_KEEPALIVE) || trans->Caps() & NS_HTTP_DISALLOW_SPDY) continue; - + ent->mPendingQ.RemoveElementAt(index); nsresult rv = DispatchTransaction(ent, trans, conn); @@ -2068,9 +2068,9 @@ nsHttpConnectionMgr::GetSpdyPreferredConn(nsConnectionEntry *ent) ent->mUsingSpdy = true; else preferred = ent; - + nsHttpConnection *conn = nullptr; - + if (preferred->mUsingSpdy) { for (uint32_t index = 0; index < preferred->mActiveConns.Length(); @@ -2081,7 +2081,7 @@ nsHttpConnectionMgr::GetSpdyPreferredConn(nsConnectionEntry *ent) } } } - + return conn; } @@ -2100,9 +2100,9 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, void *param) mTimeoutTick = nullptr; mTimeoutTickArmed = false; } - + // signal shutdown complete - nsRefPtr runnable = + nsRefPtr runnable = new nsConnEvent(this, &nsHttpConnectionMgr::OnMsgShutdownConfirm, 0, param); NS_DispatchToMainThread(runnable); @@ -2251,7 +2251,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) nsHttpConnection *conn = (nsHttpConnection *) param; - // + // // 1) remove the connection from the active list // 2) if keep-alive, add connection to idle list // 3) post event to process the pending transaction queue @@ -2327,7 +2327,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param) conn->Close(NS_ERROR_ABORT); } } - + OnMsgProcessPendingQ(0, ci); // releases |ci| NS_RELEASE(conn); } @@ -2401,7 +2401,7 @@ nsHttpConnectionMgr::OnMsgProcessFeedback(int32_t, void *param) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); nsHttpPipelineFeedback *fb = (nsHttpPipelineFeedback *)param; - + PipelineFeedbackInfo(fb->mConnInfo, fb->mInfo, fb->mConn, fb->mData); delete fb; } @@ -2633,7 +2633,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::~nsHalfOpenSocket() MOZ_ASSERT(!mBackupStreamOut); MOZ_ASSERT(!mSynTimer); LOG(("Destroying nsHalfOpenSocket [this=%p]\n", this)); - + if (mEnt) mEnt->RemoveHalfOpen(this); } @@ -2664,7 +2664,7 @@ nsHalfOpenSocket::SetupStreams(nsISocketTransport **transport, mEnt->mConnInfo->ProxyInfo(), getter_AddRefs(socketTransport)); NS_ENSURE_SUCCESS(rv, rv); - + uint32_t tmpFlags = 0; if (mCaps & NS_HTTP_REFRESH_DNS) tmpFlags = nsISocketTransport::BYPASS_CACHE; @@ -2770,7 +2770,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::SetupBackupTimer() { uint16_t timeout = gHttpHandler->GetIdleSynTimeout(); MOZ_ASSERT(!mSynTimer, "timer already initd"); - + if (timeout && !mTransaction->IsDone()) { // Setup the timer that will establish a backup socket // if we do not get a writable event on the main one. @@ -2863,12 +2863,12 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(out == mStreamOut || out == mBackupStreamOut, "stream mismatch"); - LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n", + LOG(("nsHalfOpenSocket::OnOutputStreamReady [this=%p ent=%s %s]\n", this, mEnt->mConnInfo->Host(), out == mStreamOut ? "primary" : "backup")); int32_t index; nsresult rv; - + gHttpHandler->ConnMgr()->RecvdConnect(); CancelBackupTimer(); @@ -3146,7 +3146,7 @@ nsHttpConnectionMgr::nsConnectionEntry::PipelineState() { return mPipelineState; } - + void nsHttpConnectionMgr:: nsConnectionEntry::OnPipelineFeedbackInfo( @@ -3155,14 +3155,14 @@ nsConnectionEntry::OnPipelineFeedbackInfo( uint32_t data) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + if (mPipelineState == PS_YELLOW) { if (info & kPipelineInfoTypeBad) mYellowBadEvents++; else if (info & (kPipelineInfoTypeNeutral | kPipelineInfoTypeGood)) mYellowGoodEvents++; } - + if (mPipelineState == PS_GREEN && info == GoodCompletedOK) { int32_t depth = data; LOG(("Transaction completed at pipeline depth of %d. Host = %s\n", @@ -3204,7 +3204,7 @@ nsConnectionEntry::OnPipelineFeedbackInfo( // Red* events impact the host globally via mPipeliningPenalty, while // Bad* events impact the per class penalty. - + // The individual penalties should be < 16bit-signed-maxint - 25000 // (approx 7500). Penalties are paid-off either when something promising // happens (a successful transaction, or promising headers) or when @@ -3242,12 +3242,12 @@ nsConnectionEntry::OnPipelineFeedbackInfo( default: MOZ_ASSERT(false, "Unknown Bad/Red Pipeline Feedback Event"); } - + const int16_t kPenalty = 25000; mPipeliningPenalty = std::min(mPipeliningPenalty, kPenalty); mPipeliningClassPenalty[classification] = std::min(mPipeliningClassPenalty[classification], kPenalty); - + LOG(("Assessing red penalty to %s class %d for event %d. " "Penalty now %d, throttle[%d] = %d\n", mConnInfo->Host(), classification, info, mPipeliningPenalty, classification, @@ -3309,7 +3309,7 @@ nsConnectionEntry::CreditPenalty() { if (mLastCreditTime.IsNull()) return; - + // Decrease penalty values by 1 for every 16 seconds // (i.e 3.7 per minute, or 1000 every 4h20m) @@ -3317,14 +3317,14 @@ nsConnectionEntry::CreditPenalty() TimeDuration elapsedTime = now - mLastCreditTime; uint32_t creditsEarned = static_cast(elapsedTime.ToSeconds()) >> 4; - + bool failed = false; if (creditsEarned > 0) { - mPipeliningPenalty = + mPipeliningPenalty = std::max(int32_t(mPipeliningPenalty - creditsEarned), 0); if (mPipeliningPenalty > 0) failed = true; - + for (int32_t i = 0; i < nsAHttpTransaction::CLASS_MAX; ++i) { mPipeliningClassPenalty[i] = std::max(int32_t(mPipeliningClassPenalty[i] - creditsEarned), 0); @@ -3349,7 +3349,7 @@ nsConnectionEntry::CreditPenalty() mConnInfo->Host())); mPipelineState = PS_YELLOW; mYellowConnection = nullptr; - } + } } uint32_t @@ -3357,7 +3357,7 @@ nsHttpConnectionMgr:: nsConnectionEntry::MaxPipelineDepth(nsAHttpTransaction::Classifier aClass) { // Still subject to configuration limit no matter return value - + if ((mPipelineState == PS_RED) || (mPipeliningClassPenalty[aClass] > 0)) return 0; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index f585ab285bf..85be8b439f8 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -115,7 +115,7 @@ public: nsresult SpeculativeConnect(nsHttpConnectionInfo *, nsIInterfaceRequestor *); - // called when a connection is done processing a transaction. if the + // called when a connection is done processing a transaction. if the // connection can be reused then it will be added to the idle list, else // it will be closed. nsresult ReclaimConnection(nsHttpConnection *conn); @@ -158,7 +158,7 @@ public: // Used when a HTTP Server response header that is on the banned from // pipelining list is received RedBannedServer = kPipelineInfoTypeRed | kPipelineInfoTypeBad | 0x0002, - + // Used when a response is terminated early, when it fails an // integrity check such as assoc-req or when a 304 contained a Last-Modified // differnet than the entry being validated. @@ -184,7 +184,7 @@ public: // Used when a response is received that is not framed with either chunked // encoding or a complete content length. BadInsufficientFraming = kPipelineInfoTypeBad | 0x0008, - + // Used when a very large response is recevied in a potential pipelining // context. Large responses cause head of line blocking. BadUnexpectedLarge = kPipelineInfoTypeBad | 0x000B, @@ -196,7 +196,7 @@ public: // Used when a response is received successfully to a pipelined request. GoodCompletedOK = kPipelineInfoTypeGood | 0x000A }; - + // called to provide information relevant to the pipelining manager // may be called from any thread void PipelineFeedbackInfo(nsHttpConnectionInfo *, @@ -236,7 +236,7 @@ public: // in future sessions to speed up the opening portions of the connection. void ReportSpdyCWNDSetting(nsHttpConnectionInfo *host, uint32_t cwndValue); uint32_t GetSpdyCWNDSetting(nsHttpConnectionInfo *host); - + bool SupportsPipelining(nsHttpConnectionInfo *); bool GetConnectionData(nsTArray *); @@ -262,7 +262,7 @@ private: // other positive experiences will eventually allow it to try again. PS_RED }; - + class nsHalfOpenSocket; // nsConnectionEntry @@ -294,7 +294,7 @@ private: const static uint32_t kPipelineUnlimited = 1024; // fully open - extended green const static uint32_t kPipelineOpen = 6; // 6 on each conn - normal green const static uint32_t kPipelineRestricted = 2; // 2 on just 1 conn in yellow - + nsHttpConnectionMgr::PipeliningState PipelineState(); void OnPipelineFeedbackInfo( nsHttpConnectionMgr::PipelineFeedbackInfoType info, @@ -422,7 +422,7 @@ private: nsAHttpTransaction *trans, uint32_t caps); ~nsHalfOpenSocket(); - + nsresult SetupStreams(nsISocketTransport **, nsIAsyncInputStream **, nsIAsyncOutputStream **, @@ -631,7 +631,7 @@ private: // that are accessed from mCT connection table uint32_t mNumHalfOpenConns; - // Holds time in seconds for next wake-up to prune dead connections. + // Holds time in seconds for next wake-up to prune dead connections. uint64_t mTimeOfNextWakeUp; // Timer for next pruning of dead connections. nsCOMPtr mTimer; diff --git a/netwerk/protocol/http/nsHttpDigestAuth.cpp b/netwerk/protocol/http/nsHttpDigestAuth.cpp index f314536ae3b..2a1cbc0d96d 100644 --- a/netwerk/protocol/http/nsHttpDigestAuth.cpp +++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp @@ -100,7 +100,7 @@ nsHttpDigestAuth::GetMethodAndPath(nsIHttpAuthenticableChannel *authChannel, path.AppendInt(port < 0 ? NS_HTTPS_DEFAULT_PORT : port); } } - else { + else { rv = authChannel->GetRequestMethod(httpMethod); rv2 = uri->GetPath(path); if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2)) { @@ -219,7 +219,7 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, /* TODO: to support auth-int, we need to get an MD5 digest of * TODO: the data uploaded with this request. * TODO: however, i am not sure how to read in the file in without - * TODO: disturbing the channel''s use of it. do i need to copy it + * TODO: disturbing the channel''s use of it. do i need to copy it * TODO: somehow? */ #if 0 @@ -251,7 +251,7 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, // // the following are for increasing security. see RFC 2617 for more // information. - // + // // nonce_count allows the server to keep track of auth challenges (to help // prevent spoofing). we increase this count every time. // @@ -268,7 +268,7 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, else { nsCOMPtr v( do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID)); - if (v) { + if (v) { v->SetData(1); NS_ADDREF(*sessionState = v); } @@ -280,7 +280,7 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, // returned Authentication-Info header). also used for session info. // nsAutoCString cnonce; - static const char hexChar[] = "0123456789abcdef"; + static const char hexChar[] = "0123456789abcdef"; for (int i=0; i<16; ++i) { cnonce.Append(hexChar[(int)(15.0 * rand()/(RAND_MAX + 1.0))]); } @@ -553,15 +553,15 @@ nsHttpDigestAuth::ParseChallenge(const char * challenge, // name int16_t nameStart = (p - challenge); - while (*p && !nsCRT::IsAsciiSpace(*p) && *p != '=') + while (*p && !nsCRT::IsAsciiSpace(*p) && *p != '=') ++p; if (!*p) return NS_ERROR_INVALID_ARG; int16_t nameLength = (p - challenge) - nameStart; - while (*p && (nsCRT::IsAsciiSpace(*p) || *p == '=')) + while (*p && (nsCRT::IsAsciiSpace(*p) || *p == '=')) ++p; - if (!*p) + if (!*p) return NS_ERROR_INVALID_ARG; bool quoted = false; @@ -574,15 +574,15 @@ nsHttpDigestAuth::ParseChallenge(const char * challenge, int16_t valueStart = (p - challenge); int16_t valueLength = 0; if (quoted) { - while (*p && *p != '"') + while (*p && *p != '"') ++p; - if (*p != '"') + if (*p != '"') return NS_ERROR_INVALID_ARG; valueLength = (p - challenge) - valueStart; ++p; } else { - while (*p && !nsCRT::IsAsciiSpace(*p) && *p != ',') - ++p; + while (*p && !nsCRT::IsAsciiSpace(*p) && *p != ',') + ++p; valueLength = (p - challenge) - valueStart; } @@ -634,12 +634,12 @@ nsHttpDigestAuth::ParseChallenge(const char * challenge, while (ipos < valueStart+valueLength) { while (ipos < valueStart+valueLength && (nsCRT::IsAsciiSpace(challenge[ipos]) || - challenge[ipos] == ',')) + challenge[ipos] == ',')) ipos++; int16_t algostart = ipos; while (ipos < valueStart+valueLength && !nsCRT::IsAsciiSpace(challenge[ipos]) && - challenge[ipos] != ',') + challenge[ipos] != ',') ipos++; if ((ipos - algostart) == 4 && nsCRT::strncasecmp(challenge+algostart, "auth", 4) == 0) diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index ea6e567c0b7..be68164866d 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -133,10 +133,10 @@ public: // // - the handler keeps a count of active connections to enforce the // steady-state max-connections pref. - // + // // Called to kick-off a new transaction, by default the transaction - // will be put on the pending transaction queue if it cannot be + // will be put on the pending transaction queue if it cannot be // initiated at this time. Callable from any thread. nsresult InitiateTransaction(nsHttpTransaction *trans, int32_t priority) { @@ -258,7 +258,7 @@ public: { return mPipelineRescheduleTimeout; } - + PRIntervalTime GetPipelineTimeout() { return mPipelineReadTimeout; } mozilla::net::SpdyInformation *SpdyInfo() { return &mSpdyInfo; } @@ -388,7 +388,7 @@ private: bool mUseCache; bool mPromptTempRedirect; - // mSendSecureXSiteReferrer: default is false, + // mSendSecureXSiteReferrer: default is false, // if true allow referrer headers between secure non-matching hosts bool mSendSecureXSiteReferrer; @@ -485,7 +485,7 @@ class nsHttpsHandler : public nsIHttpProtocolHandler public: // we basically just want to override GetScheme and GetDefaultPort... // all other methods should be forwarded to the nsHttpHandler instance. - + NS_DECL_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_FORWARD_NSIPROXIEDPROTOCOLHANDLER (gHttpHandler->) diff --git a/netwerk/protocol/http/nsHttpHeaderArray.cpp b/netwerk/protocol/http/nsHttpHeaderArray.cpp index 8b99f2348ab..9cf00b25cb2 100644 --- a/netwerk/protocol/http/nsHttpHeaderArray.cpp +++ b/netwerk/protocol/http/nsHttpHeaderArray.cpp @@ -135,7 +135,7 @@ nsHttpHeaderArray::ParseHeaderLine(const char *line, // and consisting of either *TEXT or combinations // of token, separators, and quoted-string> // - + // We skip over mal-formed headers in the hope that we'll still be able to // do something useful with the response. @@ -150,7 +150,7 @@ nsHttpHeaderArray::ParseHeaderLine(const char *line, LOG(("malformed header [%s]: field-name not a token\n", line)); return NS_OK; } - + *p = 0; // null terminate field-name nsHttpAtom atom = nsHttp::ResolveAtom(line); @@ -184,7 +184,7 @@ nsHttpHeaderArray::Flatten(nsACString &buf, bool pruneProxyHeaders) for (i = 0; i < count; ++i) { const nsEntry &entry = mHeaders[i]; // prune proxy headers if requested - if (pruneProxyHeaders && ((entry.header == nsHttp::Proxy_Authorization) || + if (pruneProxyHeaders && ((entry.header == nsHttp::Proxy_Authorization) || (entry.header == nsHttp::Proxy_Connection))) continue; buf.Append(entry.header); diff --git a/netwerk/protocol/http/nsHttpHeaderArray.h b/netwerk/protocol/http/nsHttpHeaderArray.h index a678fa89012..94b5e94ae20 100644 --- a/netwerk/protocol/http/nsHttpHeaderArray.h +++ b/netwerk/protocol/http/nsHttpHeaderArray.h @@ -61,7 +61,7 @@ public: void ClearHeader(nsHttpAtom h); // Find the location of the given header value, or null if none exists. - const char *FindHeaderValue(nsHttpAtom header, const char *value) const + const char *FindHeaderValue(nsHttpAtom header, const char *value) const { return nsHttp::FindToken(PeekHeader(header), value, HTTP_HEADER_VALUE_SEPS); @@ -75,7 +75,7 @@ public: nsresult VisitHeaders(nsIHttpHeaderVisitor *visitor); - // parse a header line, return the header atom and a pointer to the + // parse a header line, return the header atom and a pointer to the // header value (the substring of the header line -- do not free). nsresult ParseHeaderLine(const char *line, nsHttpAtom *header=nullptr, diff --git a/netwerk/protocol/http/nsHttpNTLMAuth.cpp b/netwerk/protocol/http/nsHttpNTLMAuth.cpp index 55689860c77..4f16cff6329 100644 --- a/netwerk/protocol/http/nsHttpNTLMAuth.cpp +++ b/netwerk/protocol/http/nsHttpNTLMAuth.cpp @@ -152,7 +152,7 @@ TestPref(nsIURI *uri, const char *pref) break; start = end + 1; } - + nsMemory::Free(hostList); return false; } @@ -249,7 +249,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel *channel, // instantiate a native NTLM module the last time, so skip trying again. bool forceGeneric = ForceGenericNTLM(); if (!forceGeneric && !*sessionState) { - // Check for approved default credentials hosts and proxies. If + // Check for approved default credentials hosts and proxies. If // *continuationState is non-null, the last authentication attempt // failed so skip default credential use. if (!*continuationState && CanUseDefaultCredentials(channel, isProxyAuth)) { @@ -296,7 +296,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel *channel, // see bug 520607 for details. LOG(("Trying to fall back on internal ntlm auth.\n")); module = do_CreateInstance(NS_AUTH_MODULE_CONTRACTID_PREFIX "ntlm"); - + mUseNative = false; // Prompt user for domain, username, and password. @@ -336,7 +336,7 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, // if user or password is empty, ChallengeReceived returned // identityInvalid = false, that means we are using default user - // credentials; see nsAuthSSPI::Init method for explanation of this + // credentials; see nsAuthSSPI::Init method for explanation of this // condition if (!user || !pass) *aFlags = USING_INTERNAL_IDENTITY; @@ -367,15 +367,15 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, return rv; // This update enables updated Windows machines (Win7 or patched previous -// versions) and Linux machines running Samba (updated for Channel -// Binding), to perform Channel Binding when authenticating using NTLMv2 +// versions) and Linux machines running Samba (updated for Channel +// Binding), to perform Channel Binding when authenticating using NTLMv2 // and an outer secure channel. -// -// Currently only implemented for Windows, linux support will be landing in +// +// Currently only implemented for Windows, linux support will be landing in // a separate patch, update this #ifdef accordingly then. #if defined (XP_WIN) /* || defined (LINUX) */ - // We should retrieve the server certificate and compute the CBT, - // but only when we are using the native NTLM implementation and + // We should retrieve the server certificate and compute the CBT, + // but only when we are using the native NTLM implementation and // not the internal one. // It is a valid case not having the security info object. This // occures when we connect an https site through an ntlm proxy. @@ -406,13 +406,13 @@ nsHttpNTLMAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel, uint32_t length; uint8_t* certArray; - cert->GetRawDER(&length, &certArray); + cert->GetRawDER(&length, &certArray); // If there is a server certificate, we pass it along the // first time we call GetNextToken(). inBufLen = length; inBuf = certArray; - } else { + } else { // If there is no server certificate, we don't pass anything. inBufLen = 0; inBuf = nullptr; diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp index 9d863e5cd30..ce9387947e6 100644 --- a/netwerk/protocol/http/nsHttpPipeline.cpp +++ b/netwerk/protocol/http/nsHttpPipeline.cpp @@ -99,7 +99,7 @@ nsHttpPipeline::AddTransaction(nsAHttpTransaction *trans) NS_ADDREF(trans); mRequestQ.AppendElement(trans); uint32_t qlen = PipelineDepth(); - + if (qlen != 1) { trans->SetPipelinePosition(qlen); } @@ -144,7 +144,7 @@ nsHttpPipeline::PipelinePosition() // The response queue is empty, so return oldest request if (mRequestQ.Length()) return Request(mRequestQ.Length() - 1)->PipelinePosition(); - + // No transactions in the pipeline return 0; } @@ -182,19 +182,19 @@ nsHttpPipeline::OnHeadersAvailable(nsAHttpTransaction *trans, MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(mConnection, "no connection"); - + nsRefPtr ci; GetConnectionInfo(getter_AddRefs(ci)); MOZ_ASSERT(ci); - + bool pipeliningBefore = gHttpHandler->ConnMgr()->SupportsPipelining(ci); - + // trans has now received its response headers; forward to the real connection nsresult rv = mConnection->OnHeadersAvailable(trans, requestHead, responseHead, reset); - + if (!pipeliningBefore && gHttpHandler->ConnMgr()->SupportsPipelining(ci)) // The received headers have expanded the eligible // pipeline depth for this connection @@ -213,7 +213,7 @@ nsHttpPipeline::CloseTransaction(nsAHttpTransaction *trans, nsresult reason) MOZ_ASSERT(NS_FAILED(reason), "expecting failure code"); // the specified transaction is to be closed with the given "reason" - + int32_t index; bool killPipeline = false; @@ -288,7 +288,7 @@ nsresult nsHttpPipeline::PushBack(const char *data, uint32_t length) { LOG(("nsHttpPipeline::PushBack [this=%x len=%u]\n", this, length)); - + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); MOZ_ASSERT(mPushBackLen == 0, "push back buffer already has data!"); @@ -322,7 +322,7 @@ nsHttpPipeline::PushBack(const char *data, uint32_t length) if (!mPushBackBuf) return NS_ERROR_OUT_OF_MEMORY; } - + memcpy(mPushBackBuf, data, length); mPushBackLen = length; @@ -480,7 +480,7 @@ nsHttpPipeline::OnTransportStatus(nsITransport* transport, if (mSuppressSendEvents) { mSuppressSendEvents = false; - + // catch up by sending the event to all the transactions that have // moved from request to response and any that have been partially // sent. Also send WAITING_FOR to those that were completely sent @@ -489,7 +489,7 @@ nsHttpPipeline::OnTransportStatus(nsITransport* transport, Response(i)->OnTransportStatus(transport, NS_NET_STATUS_SENDING_TO, progress); - Response(i)->OnTransportStatus(transport, + Response(i)->OnTransportStatus(transport, NS_NET_STATUS_WAITING_FOR, progress); } @@ -501,12 +501,12 @@ nsHttpPipeline::OnTransportStatus(nsITransport* transport, } // otherwise ignore it break; - - case NS_NET_STATUS_WAITING_FOR: + + case NS_NET_STATUS_WAITING_FOR: // Created by nsHttpConnection when request pipeline has been totally // sent. Ignore it here because it is simulated in FillSendBuf() when // a request is moved from request to response. - + // ignore it break; @@ -532,7 +532,7 @@ bool nsHttpPipeline::IsDone() { bool done = true; - + uint32_t i, count = mRequestQ.Length(); for (i = 0; done && (i < count); i++) done = Request(i)->IsDone(); @@ -540,7 +540,7 @@ nsHttpPipeline::IsDone() count = mResponseQ.Length(); for (i = 0; done && (i < count); i++) done = Response(i)->IsDone(); - + return done; } @@ -643,7 +643,7 @@ nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer, if (mClosed) return NS_SUCCEEDED(mStatus) ? NS_BASE_STREAM_CLOSED : mStatus; - nsAHttpTransaction *trans; + nsAHttpTransaction *trans; nsresult rv; trans = Response(0); @@ -665,7 +665,7 @@ nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer, rv = NS_BASE_STREAM_CLOSED; } else { - // + // // ask the transaction to consume data from the connection. // PushBack may be called recursively. // @@ -826,7 +826,7 @@ nsHttpPipeline::FillSendBuf() // when they have been completely read. nsresult rv; - + if (!mSendBufIn) { // allocate a single-segment pipe rv = NS_NewPipe(getter_AddRefs(mSendBufIn), @@ -854,7 +854,7 @@ nsHttpPipeline::FillSendBuf() response->SetPipelinePosition(1); rv = trans->ReadSegments(this, (uint32_t)std::min(avail, (uint64_t)UINT32_MAX), &n); if (NS_FAILED(rv)) return rv; - + if (n == 0) { LOG(("send pipe is full")); break; diff --git a/netwerk/protocol/http/nsHttpPipeline.h b/netwerk/protocol/http/nsHttpPipeline.h index 2dac2306654..32afe7bd801 100644 --- a/netwerk/protocol/http/nsHttpPipeline.h +++ b/netwerk/protocol/http/nsHttpPipeline.h @@ -29,7 +29,7 @@ public: private: nsresult FillSendBuf(); - + static NS_METHOD ReadFromPipe(nsIInputStream *, void *, const char *, uint32_t, uint32_t, uint32_t *); @@ -58,7 +58,7 @@ private: nsresult mStatus; // these flags indicate whether or not the first request or response - // is partial. a partial request means that Request(0) has been + // is partial. a partial request means that Request(0) has been // partially written out to the socket. a partial response means // that Response(0) has been partially read in from the socket. bool mRequestIsPartial; diff --git a/netwerk/protocol/http/nsHttpRequestHead.cpp b/netwerk/protocol/http/nsHttpRequestHead.cpp index 64b1a2f30e5..488664493de 100644 --- a/netwerk/protocol/http/nsHttpRequestHead.cpp +++ b/netwerk/protocol/http/nsHttpRequestHead.cpp @@ -13,7 +13,7 @@ void nsHttpRequestHead::Flatten(nsACString &buf, bool pruneProxyHeaders) { // note: the first append is intentional. - + buf.Append(mMethod.get()); buf.Append(' '); buf.Append(mRequestURI); diff --git a/netwerk/protocol/http/nsHttpResponseHead.cpp b/netwerk/protocol/http/nsHttpResponseHead.cpp index d9f3894796c..2b23c3ddb3e 100644 --- a/netwerk/protocol/http/nsHttpResponseHead.cpp +++ b/netwerk/protocol/http/nsHttpResponseHead.cpp @@ -134,10 +134,10 @@ nsHttpResponseHead::ParseStatusLine(const char *line) // // Parse Status-Line:: HTTP-Version SP Status-Code SP Reason-Phrase CRLF // - + // HTTP-Version ParseVersion(line); - + if ((mVersion == NS_HTTP_VERSION_0_9) || !(line = PL_strchr(line, ' '))) { mStatus = 200; mStatusText.AssignLiteral("OK"); @@ -169,11 +169,11 @@ nsHttpResponseHead::ParseHeaderLine(const char *line) nsHttpAtom hdr = {0}; char *val; nsresult rv; - + rv = mHeaders.ParseHeaderLine(line, &hdr, &val); if (NS_FAILED(rv)) return rv; - + // leading and trailing LWS has been removed from |val| // handle some special case headers... @@ -185,7 +185,7 @@ nsHttpResponseHead::ParseHeaderLine(const char *line) mContentLength = len; } else { - // If this is a negative content length then just ignore it + // If this is a negative content length then just ignore it LOG(("invalid content-length! %s\n", val)); } } @@ -278,7 +278,7 @@ nsHttpResponseHead::ComputeFreshnessLifetime(uint32_t *result) const // the Expires header can specify a date in the past. return NS_OK; } - + // Fallback on heuristic using last modified header... if (NS_SUCCEEDED(GetLastModifiedValue(&date2))) { LOG(("using last-modified to determine freshness-lifetime\n")); @@ -335,7 +335,7 @@ nsHttpResponseHead::MustValidate() const LOG(("Must validate since response is an uncacheable error page\n")); return true; } - + // The no-cache response header indicates that we must validate this // cached response before reusing. if (NoCache()) { @@ -369,8 +369,8 @@ nsHttpResponseHead::MustValidateIfExpired() const { // according to RFC2616, section 14.9.4: // - // When the must-revalidate directive is present in a response received by a - // cache, that cache MUST NOT use the entry after it becomes stale to respond to + // When the must-revalidate directive is present in a response received by a + // cache, that cache MUST NOT use the entry after it becomes stale to respond to // a subsequent request without first revalidating it with the origin server. // return HasHeaderValue(nsHttp::Cache_Control, "must-revalidate"); @@ -386,7 +386,7 @@ nsHttpResponseHead::IsResumable() const // non-2xx responses. return mStatus == 200 && mVersion >= NS_HTTP_VERSION_1_1 && - PeekHeader(nsHttp::Content_Length) && + PeekHeader(nsHttp::Content_Length) && (PeekHeader(nsHttp::ETag) || PeekHeader(nsHttp::Last_Modified)) && HasHeaderValue(nsHttp::Accept_Ranges, "bytes"); } @@ -395,12 +395,12 @@ bool nsHttpResponseHead::ExpiresInPast() const { uint32_t maxAgeVal, expiresVal, dateVal; - + // Bug #203271. Ensure max-age directive takes precedence over Expires if (NS_SUCCEEDED(GetMaxAgeValue(&maxAgeVal))) { return false; } - + return NS_SUCCEEDED(GetExpiresValue(&expiresVal)) && NS_SUCCEEDED(GetDateValue(&dateVal)) && expiresVal < dateVal; @@ -485,7 +485,7 @@ nsHttpResponseHead::ParseDateHeader(nsHttpAtom header, uint32_t *result) const if (st != PR_SUCCESS) return NS_ERROR_NOT_AVAILABLE; - *result = PRTimeToSeconds(time); + *result = PRTimeToSeconds(time); return NS_OK; } @@ -539,7 +539,7 @@ nsHttpResponseHead::GetExpiresValue(uint32_t *result) const if (time < 0) *result = 0; else - *result = PRTimeToSeconds(time); + *result = PRTimeToSeconds(time); return NS_OK; } @@ -627,7 +627,7 @@ nsHttpResponseHead::ParseCacheControl(const char *val) if (nsHttp::FindToken(val, "no-cache", HTTP_HEADER_VALUE_SEPS)) mCacheControlNoCache = true; - // search header value for occurrence of "no-store" + // search header value for occurrence of "no-store" if (nsHttp::FindToken(val, "no-store", HTTP_HEADER_VALUE_SEPS)) mCacheControlNoStore = true; } diff --git a/netwerk/protocol/http/nsHttpResponseHead.h b/netwerk/protocol/http/nsHttpResponseHead.h index 363e33be1cd..afd1e7bca5d 100644 --- a/netwerk/protocol/http/nsHttpResponseHead.h +++ b/netwerk/protocol/http/nsHttpResponseHead.h @@ -24,7 +24,7 @@ public: , mCacheControlNoStore(false) , mCacheControlNoCache(false) , mPragmaNoCache(false) {} - + const nsHttpHeaderArray & Headers() const { return mHeaders; } nsHttpHeaderArray &Headers() { return mHeaders; } nsHttpVersion Version() const { return mVersion; } @@ -90,7 +90,7 @@ public: bool ExpiresInPast() const; // update headers... - nsresult UpdateHeaders(const nsHttpHeaderArray &headers); + nsresult UpdateHeaders(const nsHttpHeaderArray &headers); // reset the response head to it's initial state void Reset(); diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 6731cf3cf82..a0a5148dc58 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -221,7 +221,7 @@ nsHttpTransaction::Init(uint32_t caps, mActivityDistributor = nullptr; } - // create transport event sink proxy. it coalesces all events if and only + // create transport event sink proxy. it coalesces all events if and only // if the activity observer is not active. when the observer is active // we need not to coalesce any events to get all expected notifications // of the transaction state, necessary for correct debugging and logging. @@ -258,10 +258,10 @@ nsHttpTransaction::Init(uint32_t caps, // grab a weak reference to the request head mRequestHead = requestHead; - // make sure we eliminate any proxy specific headers from + // make sure we eliminate any proxy specific headers from // the request if we are using CONNECT bool pruneProxyHeaders = cinfo->UsingConnect(); - + mReqHeaderBuf.Truncate(); requestHead->Flatten(mReqHeaderBuf, pruneProxyHeaders); @@ -361,7 +361,7 @@ nsHttpTransaction::TakeResponseHead() mForTakeResponseHead = nullptr; return head; } - + // Even in OnStartRequest() the headers won't be available if we were // canceled if (!mHaveAllHeaders) { @@ -527,7 +527,7 @@ nsHttpTransaction::Status() uint32_t nsHttpTransaction::Caps() -{ +{ return mCaps; } @@ -645,7 +645,7 @@ nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream, // - Bytes in HTTP headers don't count towards countWritten, so the input // side of pipe (aka nsHttpChannel's mTransactionPump) won't hit // OnInputStreamReady until all headers have been parsed. - // + // rv = trans->ProcessData(buf, *countWritten, countWritten); if (NS_FAILED(rv)) trans->Close(rv); @@ -720,7 +720,7 @@ nsHttpTransaction::Close(nsresult reason) PR_Now(), 0, EmptyCString()); } - // we must no longer reference the connection! find out if the + // we must no longer reference the connection! find out if the // connection was being reused before letting it go. bool connReused = false; if (mConnection) @@ -751,12 +751,12 @@ nsHttpTransaction::Close(nsresult reason) // a TLS session (perhaps via a tunnel) is setup. bool reallySentData = mSentData && (!mConnection || mConnection->BytesWritten()); - + if (!mReceivedData && (!reallySentData || connReused || mPipelinePosition)) { // if restarting fails, then we must proceed to close the pipe, // which will notify the channel that the transaction failed. - + if (mPipelinePosition) { gHttpHandler->ConnMgr()->PipelineFeedbackInfo( mConnInfo, nsHttpConnectionMgr::RedCanceledPipeline, @@ -864,7 +864,7 @@ nsHttpTransaction::SetPipelinePosition(int32_t position) mPipelinePosition = position; return NS_OK; } - + int32_t nsHttpTransaction::PipelinePosition() { @@ -879,7 +879,7 @@ nsresult nsHttpTransaction::RestartInProgress() { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); - + if ((mRestartCount + 1) >= gHttpHandler->MaxRequestAttempts()) { LOG(("nsHttpTransaction::RestartInProgress() " "reached max request attempts, failing transaction %p\n", this)); @@ -977,7 +977,7 @@ nsHttpTransaction::LocateHttpStart(char *buf, uint32_t len, static const uint32_t HTTPHeaderLen = sizeof(HTTPHeader) - 1; static const char HTTP2Header[] = "HTTP/2.0"; static const uint32_t HTTP2HeaderLen = sizeof(HTTP2Header) - 1; - + if (aAllowPartialMatch && (len < HTTPHeaderLen)) return (PL_strncasecmp(buf, HTTPHeader, len) == 0) ? buf : nullptr; @@ -1039,7 +1039,7 @@ nsHttpTransaction::ParseLine(char *line) { LOG(("nsHttpTransaction::ParseLine [%s]\n", line)); nsresult rv = NS_OK; - + if (!mHaveStatusLine) { mResponseHead->ParseStatusLine(line); mHaveStatusLine = true; @@ -1078,7 +1078,7 @@ nsHttpTransaction::ParseLineSegment(char *segment, uint32_t len) // append segment to mLineBuf... mLineBuf.Append(segment, len); - + // a line buf with only a new line char signifies the end of headers. if (mLineBuf.First() == '\n') { mLineBuf.Truncate(); @@ -1111,7 +1111,7 @@ nsHttpTransaction::ParseHead(char *buf, *countRead = 0; NS_PRECONDITION(!mHaveAllHeaders, "oops"); - + // allocate the response head object if necessary if (!mResponseHead) { mResponseHead = new nsHttpResponseHead(); @@ -1271,7 +1271,7 @@ nsHttpTransaction::HandleContentStart() LOG(("this response should not contain a body.\n")); break; } - + if (mResponseHead->Status() == 200 && mConnection->IsProxyConnectInProgress()) { // successful CONNECTs do not have response bodies @@ -1292,7 +1292,7 @@ nsHttpTransaction::HandleContentStart() if ((mClassification != CLASS_SOLO) && (mContentLength > mMaxPipelineObjectSize)) CancelPipeline(nsHttpConnectionMgr::BadUnexpectedLarge); - + // handle chunked encoding here, so we'll know immediately when // we're done with the socket. please note that _all_ other // decoding is done when the channel receives the content data @@ -1386,7 +1386,7 @@ nsHttpTransaction::HandleContent(char *buf, // (no explicit content-length given) *contentRead = count; } - + int64_t toReadBeforeRestart = mRestartInProgressVerifier.ToReadBeforeRestart(); @@ -1465,13 +1465,13 @@ nsHttpTransaction::ProcessData(char *buf, uint32_t count, uint32_t *countRead) uint32_t localBytesConsumed = 0; char *localBuf = buf + bytesConsumed; uint32_t localCount = count - bytesConsumed; - + rv = ParseHead(localBuf, localCount, &localBytesConsumed); if (NS_FAILED(rv) && rv != NS_ERROR_NET_INTERRUPT) return rv; bytesConsumed += localBytesConsumed; } while (rv == NS_ERROR_NET_INTERRUPT); - + count -= bytesConsumed; // if buf has some content in it, shift bytes to top of buf. @@ -1500,7 +1500,7 @@ nsHttpTransaction::ProcessData(char *buf, uint32_t count, uint32_t *countRead) uint32_t countRemaining = 0; // // buf layout: - // + // // +--------------------------------------+----------------+-----+ // | countRead | countRemaining | | // +--------------------------------------+----------------+-----+ @@ -1553,13 +1553,13 @@ nsHttpTransaction::DispatchedAsBlocking() return; LOG(("nsHttpTransaction %p dispatched as blocking\n", this)); - + if (!mLoadGroupCI) return; LOG(("nsHttpTransaction adding blocking channel %p from " "loadgroup %p\n", this, mLoadGroupCI.get())); - + mLoadGroupCI->AddBlockingTransaction(); mDispatchedAsBlocking = true; } @@ -1569,7 +1569,7 @@ nsHttpTransaction::RemoveDispatchedAsBlocking() { if (!mLoadGroupCI || !mDispatchedAsBlocking) return; - + uint32_t blockers = 0; nsresult rv = mLoadGroupCI->RemoveBlockingTransaction(&blockers); @@ -1582,7 +1582,7 @@ nsHttpTransaction::RemoveDispatchedAsBlocking() this)); gHttpHandler->ConnMgr()->ProcessPendingQ(); } - + mDispatchedAsBlocking = false; } @@ -1616,7 +1616,7 @@ void nsHttpTransaction::DeleteSelfOnConsumerThread() { LOG(("nsHttpTransaction::DeleteSelfOnConsumerThread [this=%x]\n", this)); - + bool val; if (!mConsumerTarget || (NS_SUCCEEDED(mConsumerTarget->IsOnCurrentThread(&val)) && val)) { @@ -1676,7 +1676,7 @@ nsHttpTransaction::Release() NS_LOG_RELEASE(this, count, "nsHttpTransaction"); if (0 == count) { mRefCnt = 1; /* stablize */ - // it is essential that the transaction be destroyed on the consumer + // it is essential that the transaction be destroyed on the consumer // thread (we could be holding the last reference to our consumer). DeleteSelfOnConsumerThread(); return 0; @@ -1728,7 +1728,7 @@ matchOld(nsHttpResponseHead *newHead, nsCString &old, nsHttpAtom headerAtom) { const char *val; - + val = newHead->PeekHeader(headerAtom); if (val && old.IsEmpty()) return false; @@ -1763,7 +1763,7 @@ nsHttpTransaction::RestartVerifier::Verify(int64_t contentLength, if (!matchOld(newHead, mTransferEncoding, nsHttp::Transfer_Encoding)) return false; - + return true; } @@ -1782,7 +1782,7 @@ nsHttpTransaction::RestartVerifier::Set(int64_t contentLength, return; mContentLength = contentLength; - + if (head) { const char *val; val = head->PeekHeader(nsHttp::ETag); diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 917f3d09217..6cc99429132 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -53,7 +53,7 @@ public: // // called to initialize the transaction - // + // // @param caps // the transaction capabilities (see nsHttp.h) // @param connInfo @@ -115,7 +115,7 @@ public: const mozilla::TimeStamp GetPendingTime() { return mPendingTime; } bool UsesPipelining() const { return mCaps & NS_HTTP_ALLOW_PIPELINING; } - void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI) { mLoadGroupCI = aLoadGroupCI; } + void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI) { mLoadGroupCI = aLoadGroupCI; } nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return mLoadGroupCI.get(); } void DispatchedAsBlocking(); void RemoveDispatchedAsBlocking(); @@ -250,7 +250,7 @@ private: // The time when the transaction was submitted to the Connection Manager mozilla::TimeStamp mPendingTime; - class RestartVerifier + class RestartVerifier { // When a idemptotent transaction has received part of its response body @@ -269,7 +269,7 @@ private: , mSetup(false) {} ~RestartVerifier() {} - + void Set(int64_t contentLength, nsHttpResponseHead *head); bool Verify(int64_t contentLength, nsHttpResponseHead *head); bool IsDiscardingContent() { return mToReadBeforeRestart != 0; } diff --git a/netwerk/protocol/http/nsIHttpActivityObserver.idl b/netwerk/protocol/http/nsIHttpActivityObserver.idl index 131eae29ba2..72a6f28d29a 100644 --- a/netwerk/protocol/http/nsIHttpActivityObserver.idl +++ b/netwerk/protocol/http/nsIHttpActivityObserver.idl @@ -72,9 +72,9 @@ interface nsIHttpActivityObserver : nsISupports /** * When aActivityType is ACTIVITY_TYPE_SOCKET_TRANSPORT * and aActivitySubtype is STATUS_SENDING_TO - * aExtraSizeData will contain the count of bytes sent + * aExtraSizeData will contain the count of bytes sent * There may be more than one of these activities reported - * for a single http transaction, each aExtraSizeData + * for a single http transaction, each aExtraSizeData * represents only that portion of the total bytes sent * * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION diff --git a/netwerk/protocol/http/nsIHttpAuthManager.idl b/netwerk/protocol/http/nsIHttpAuthManager.idl index 582ea60b614..9cfe1f6a730 100644 --- a/netwerk/protocol/http/nsIHttpAuthManager.idl +++ b/netwerk/protocol/http/nsIHttpAuthManager.idl @@ -10,7 +10,7 @@ interface nsIPrincipal; /** * nsIHttpAuthManager * - * This service provides access to cached HTTP authentication + * This service provides access to cached HTTP authentication * user credentials (domain, username, password) for sites * visited during the current browser session. * diff --git a/netwerk/protocol/http/nsIHttpAuthenticableChannel.idl b/netwerk/protocol/http/nsIHttpAuthenticableChannel.idl index 20d7669c969..ca785374e85 100644 --- a/netwerk/protocol/http/nsIHttpAuthenticableChannel.idl +++ b/netwerk/protocol/http/nsIHttpAuthenticableChannel.idl @@ -17,7 +17,7 @@ interface nsIHttpAuthenticableChannel : nsIProxiedChannel * If the channel being authenticated is using SSL. */ readonly attribute boolean isSSL; - + /** * Returns if the proxy HTTP method used is CONNECT. If no proxy is being * used it must return PR_FALSE. @@ -72,7 +72,7 @@ interface nsIHttpAuthenticableChannel : nsIProxiedChannel readonly attribute ACString WWWChallenges; /** - * Sets the Proxy-Authorization request header. An empty string + * Sets the Proxy-Authorization request header. An empty string * will clear it. */ void setProxyCredentials(in ACString credentials); diff --git a/netwerk/protocol/http/nsIHttpAuthenticator.idl b/netwerk/protocol/http/nsIHttpAuthenticator.idl index 2f25ddb678a..cee56b9f783 100644 --- a/netwerk/protocol/http/nsIHttpAuthenticator.idl +++ b/netwerk/protocol/http/nsIHttpAuthenticator.idl @@ -13,7 +13,7 @@ interface nsIHttpAuthenticableChannel; * Interface designed to allow for pluggable HTTP authentication modules. * Implementations are registered under the ContractID: * - * "@mozilla.org/network/http-authenticator;1?scheme=" + * "@mozilla.org/network/http-authenticator;1?scheme=" * * where is the lower-cased value of the authentication scheme * found in the server challenge per the rules of RFC 2617. @@ -104,7 +104,7 @@ interface nsIHttpAuthenticator : nsISupports /** * Indicates that the authenticator has used an out-of-band or internal - * source of identity and tells the consumer that it must not cache + * source of identity and tells the consumer that it must not cache * the returned identity because it might not be valid and would overwrite * the cached identity. See bug 542318 comment 32. */ diff --git a/netwerk/protocol/http/nsIHttpChannel.idl b/netwerk/protocol/http/nsIHttpChannel.idl index 7037f957b43..abb2ee4e5e9 100644 --- a/netwerk/protocol/http/nsIHttpChannel.idl +++ b/netwerk/protocol/http/nsIHttpChannel.idl @@ -42,7 +42,7 @@ interface nsIHttpChannel : nsIChannel * Get/set the HTTP referrer URI. This is the address (URI) of the * resource from which this channel's URI was obtained (see RFC2616 section * 14.36). - * + * * This attribute may only be set before the channel is opened. * * NOTE: The channel may silently refuse to set the Referer header if the @@ -215,7 +215,7 @@ interface nsIHttpChannel : nsIChannel * contents of |aValue|. * * If aValue is empty and aMerge is false, the header will be cleared. - * + * * @throws NS_ERROR_NOT_AVAILABLE if called before the response * has been received (before onStartRequest). * @throws NS_ERROR_ILLEGAL_VALUE if changing the value of this response diff --git a/netwerk/protocol/http/nsIHttpChannelInternal.idl b/netwerk/protocol/http/nsIHttpChannelInternal.idl index 974825ff097..f1301e401b0 100644 --- a/netwerk/protocol/http/nsIHttpChannelInternal.idl +++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl @@ -132,7 +132,7 @@ interface nsIHttpChannelInternal : nsISupports /** * HTTPUpgrade allows for the use of HTTP to bootstrap another protocol * via the RFC 2616 Upgrade request header in conjunction with a 101 level - * response. The nsIHttpUpgradeListener will have its + * response. The nsIHttpUpgradeListener will have its * onTransportAvailable() method invoked if a matching 101 is processed. * The arguments to onTransportAvailable provide the new protocol the low * level tranport streams that are no longer used by HTTP. diff --git a/netwerk/protocol/http/nsIHttpEventSink.idl b/netwerk/protocol/http/nsIHttpEventSink.idl index 0da46353e49..d003fbe15f6 100644 --- a/netwerk/protocol/http/nsIHttpEventSink.idl +++ b/netwerk/protocol/http/nsIHttpEventSink.idl @@ -32,6 +32,6 @@ interface nsIHttpEventSink : nsISupports * * @return failure cancels redirect */ - void onRedirect(in nsIHttpChannel httpChannel, + void onRedirect(in nsIHttpChannel httpChannel, in nsIChannel newChannel); }; diff --git a/netwerk/protocol/http/nsIHttpProtocolHandler.idl b/netwerk/protocol/http/nsIHttpProtocolHandler.idl index e491e2fa49d..82ac83fe478 100644 --- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl +++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl @@ -50,14 +50,14 @@ interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler }; %{C++ -// ----------- Categories ----------- +// ----------- Categories ----------- /** * At initialization time, the HTTP handler will initialize each service * registered under this category: */ #define NS_HTTP_STARTUP_CATEGORY "http-startup-category" -// ----------- Observer topics ----------- +// ----------- Observer topics ----------- /** * nsIObserver notification corresponding to startup category. Services * registered under the startup category will receive this observer topic at From 110919af4919ca95a5d35c240e400ca65d18c8ea Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Thu, 16 May 2013 09:33:26 -0400 Subject: [PATCH 59/73] bug 871712 - make MSVC PGO opt-in per-directory, and opt-in in the directories that matter. r=glandium --- caps/src/Makefile.in | 1 + chrome/src/Makefile.in | 1 + config/config.mk | 7 +++++++ content/base/src/Makefile.in | 1 + content/canvas/src/Makefile.in | 1 + content/events/src/Makefile.in | 1 + content/html/content/src/Makefile.in | 1 + content/html/document/src/Makefile.in | 1 + content/media/Makefile.in | 1 + content/xbl/src/Makefile.in | 1 + content/xml/content/src/Makefile.in | 1 + content/xml/document/src/Makefile.in | 1 + content/xul/content/src/Makefile.in | 1 + content/xul/document/src/Makefile.in | 1 + content/xul/templates/src/Makefile.in | 1 + docshell/base/Makefile.in | 1 + docshell/shistory/src/Makefile.in | 1 + dom/base/Makefile.in | 1 + dom/bindings/Makefile.in | 1 + dom/mobilemessage/src/Makefile.in | 1 + dom/plugins/base/Makefile.in | 1 + dom/quota/Makefile.in | 1 + dom/src/events/Makefile.in | 1 + dom/src/storage/Makefile.in | 1 + dom/workers/Makefile.in | 1 + extensions/cookie/Makefile.in | 1 + gfx/2d/Makefile.in | 1 + gfx/angle/Makefile.in | 1 + gfx/cairo/cairo/src/Makefile.in | 1 + gfx/cairo/libpixman/src/Makefile.in | 1 + gfx/gl/Makefile.in | 1 + gfx/graphite2/src/Makefile.in | 1 + gfx/harfbuzz/src/Makefile.in | 1 + gfx/layers/Makefile.in | 1 + gfx/ots/src/Makefile.in | 1 + gfx/qcms/Makefile.in | 1 + gfx/skia/Makefile.in | 1 + gfx/src/Makefile.in | 1 + gfx/thebes/Makefile.in | 1 + intl/hyphenation/src/Makefile.in | 1 + intl/locale/src/Makefile.in | 1 + intl/lwbrk/src/Makefile.in | 1 + intl/strres/src/Makefile.in | 1 + intl/uconv/src/Makefile.in | 1 + intl/uconv/util/Makefile.in | 1 + js/src/Makefile.in | 1 + js/src/config/config.mk | 7 +++++++ js/xpconnect/loader/Makefile.in | 1 + js/xpconnect/src/Makefile.in | 1 + js/xpconnect/wrappers/Makefile.in | 1 + layout/base/Makefile.in | 1 + layout/build/Makefile.in | 1 + layout/forms/Makefile.in | 1 + layout/generic/Makefile.in | 1 + layout/style/Makefile.in | 1 + layout/tables/Makefile.in | 1 + layout/xul/base/src/Makefile.in | 1 + media/libcubeb/src/Makefile.in | 1 + media/libjpeg/Makefile.in | 1 + media/libnestegg/src/Makefile.in | 1 + media/libogg/src/Makefile.in | 1 + media/libopus/Makefile.in | 1 + media/libpng/Makefile.in | 1 + media/libsoundtouch/src/Makefile.in | 1 + media/libspeex_resampler/src/Makefile.in | 1 + media/libtheora/lib/Makefile.in | 1 + media/libvorbis/lib/Makefile.in | 1 + media/libvpx/Makefile.in | 1 + modules/libjar/Makefile.in | 1 + modules/libjar/zipwriter/src/Makefile.in | 1 + modules/libpref/src/Makefile.in | 1 + netwerk/base/src/Makefile.in | 1 + netwerk/build/Makefile.in | 1 + netwerk/cache/Makefile.in | 1 + netwerk/cookie/Makefile.in | 1 + netwerk/dns/Makefile.in | 1 + netwerk/mime/Makefile.in | 1 + netwerk/protocol/file/Makefile.in | 1 + netwerk/protocol/ftp/Makefile.in | 1 + netwerk/protocol/http/Makefile.in | 1 + netwerk/protocol/res/Makefile.in | 1 + netwerk/protocol/websocket/Makefile.in | 1 + netwerk/streamconv/converters/Makefile.in | 1 + netwerk/streamconv/src/Makefile.in | 1 + parser/expat/lib/Makefile.in | 1 + parser/html/Makefile.in | 1 + parser/xml/src/Makefile.in | 1 + security/manager/boot/src/Makefile.in | 1 + toolkit/components/places/Makefile.in | 1 + toolkit/components/telemetry/Makefile.in | 1 + toolkit/components/url-classifier/Makefile.in | 1 + toolkit/crashreporter/Makefile.in | 1 + .../crashreporter/google-breakpad/src/common/Makefile.in | 1 + toolkit/library/Makefile.in | 1 + toolkit/xre/Makefile.in | 1 + uriloader/base/Makefile.in | 1 + view/src/Makefile.in | 1 + widget/windows/Makefile.in | 1 + widget/xpwidgets/Makefile.in | 1 + xpcom/base/Makefile.in | 1 + xpcom/build/Makefile.in | 1 + xpcom/components/Makefile.in | 1 + xpcom/ds/Makefile.in | 1 + xpcom/io/Makefile.in | 1 + xpcom/reflect/xptcall/src/Makefile.in | 1 + xpcom/reflect/xptinfo/src/Makefile.in | 1 + xpcom/string/src/Makefile.in | 1 + xpcom/threads/Makefile.in | 1 + xpfe/appshell/src/Makefile.in | 1 + 109 files changed, 121 insertions(+) diff --git a/caps/src/Makefile.in b/caps/src/Makefile.in index 1d1aea8929d..54fe37bc3e7 100644 --- a/caps/src/Makefile.in +++ b/caps/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = caps_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/chrome/src/Makefile.in b/chrome/src/Makefile.in index 167305e599d..6db8c103cc0 100644 --- a/chrome/src/Makefile.in +++ b/chrome/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = chrome_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/config/config.mk b/config/config.mk index 0dfc6bee5fa..5b36ca924a0 100644 --- a/config/config.mk +++ b/config/config.mk @@ -275,6 +275,13 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME) endif endif +# PGO on MSVC is opt-in +ifdef _MSC_VER +ifndef MSVC_ENABLE_PGO +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif +endif + # No sense in profiling tools ifdef INTERNAL_TOOLS NO_PROFILE_GUIDED_OPTIMIZE = 1 diff --git a/content/base/src/Makefile.in b/content/base/src/Makefile.in index 326f00d9413..208af67ccfb 100644 --- a/content/base/src/Makefile.in +++ b/content/base/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconbase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 CPPSRCS = \ diff --git a/content/canvas/src/Makefile.in b/content/canvas/src/Makefile.in index 47cff6df562..ce2afdee16f 100644 --- a/content/canvas/src/Makefile.in +++ b/content/canvas/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconcvs_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/events/src/Makefile.in b/content/events/src/Makefile.in index 5b0aee74629..44f44e8af4a 100644 --- a/content/events/src/Makefile.in +++ b/content/events/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconevents_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index cbb4a701086..d6d677c8b40 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconhtmlcon_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/html/document/src/Makefile.in b/content/html/document/src/Makefile.in index e99bd14fa03..96a96bcc888 100644 --- a/content/html/document/src/Makefile.in +++ b/content/html/document/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconhtmldoc_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/media/Makefile.in b/content/media/Makefile.in index 763b1fc28e1..d25c74d2565 100644 --- a/content/media/Makefile.in +++ b/content/media/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconmedia_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifndef _MSC_VER FAIL_ON_WARNINGS := 1 diff --git a/content/xbl/src/Makefile.in b/content/xbl/src/Makefile.in index 974718d477f..4a3a536ac67 100644 --- a/content/xbl/src/Makefile.in +++ b/content/xbl/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconxbl_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/xml/content/src/Makefile.in b/content/xml/content/src/Makefile.in index 07f893e7334..d5b991aa22c 100644 --- a/content/xml/content/src/Makefile.in +++ b/content/xml/content/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconxmlcon_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/xml/document/src/Makefile.in b/content/xml/document/src/Makefile.in index 058d2e9355c..ddb187dfdc6 100644 --- a/content/xml/document/src/Makefile.in +++ b/content/xml/document/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconxmldoc_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/content/xul/content/src/Makefile.in b/content/xul/content/src/Makefile.in index 923a8ba1070..ffa8ed33524 100644 --- a/content/xul/content/src/Makefile.in +++ b/content/xul/content/src/Makefile.in @@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk ifdef MOZ_XUL LIBRARY_NAME = gkconxulcon_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 endif diff --git a/content/xul/document/src/Makefile.in b/content/xul/document/src/Makefile.in index bcb57186729..b641990b643 100644 --- a/content/xul/document/src/Makefile.in +++ b/content/xul/document/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconxuldoc_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 diff --git a/content/xul/templates/src/Makefile.in b/content/xul/templates/src/Makefile.in index 13705a4ee73..ef69e807f70 100644 --- a/content/xul/templates/src/Makefile.in +++ b/content/xul/templates/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkconxultmpl_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 diff --git a/docshell/base/Makefile.in b/docshell/base/Makefile.in index ac65ec25d3d..6797c457d47 100644 --- a/docshell/base/Makefile.in +++ b/docshell/base/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = basedocshell_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifdef MOZ_TOOLKIT_SEARCH diff --git a/docshell/shistory/src/Makefile.in b/docshell/shistory/src/Makefile.in index 529e7645147..8531149e32e 100644 --- a/docshell/shistory/src/Makefile.in +++ b/docshell/shistory/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = shistory_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/dom/base/Makefile.in b/dom/base/Makefile.in index 9548b477dd2..41c64874298 100644 --- a/dom/base/Makefile.in +++ b/dom/base/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdombase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/bindings/Makefile.in b/dom/bindings/Makefile.in index 7c5eb6a06ed..3e540d8dfb2 100644 --- a/dom/bindings/Makefile.in +++ b/dom/bindings/Makefile.in @@ -8,6 +8,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ LIBRARY_NAME = dombindings_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 EXPORT_LIBRARY = 1 diff --git a/dom/mobilemessage/src/Makefile.in b/dom/mobilemessage/src/Makefile.in index 27e314fd7b7..b990939af80 100644 --- a/dom/mobilemessage/src/Makefile.in +++ b/dom/mobilemessage/src/Makefile.in @@ -21,6 +21,7 @@ VPATH += $(srcdir)/fallback endif LIBRARY_NAME = dom_mobilemessage_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/plugins/base/Makefile.in b/dom/plugins/base/Makefile.in index 325670fb32e..b43e532987b 100644 --- a/dom/plugins/base/Makefile.in +++ b/dom/plugins/base/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkplugin +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsPluginModule diff --git a/dom/quota/Makefile.in b/dom/quota/Makefile.in index 1ee7cd05d3c..2a7755e718a 100644 --- a/dom/quota/Makefile.in +++ b/dom/quota/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domquota_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/dom/src/events/Makefile.in b/dom/src/events/Makefile.in index fb23156e254..3e90c82acf9 100644 --- a/dom/src/events/Makefile.in +++ b/dom/src/events/Makefile.in @@ -12,6 +12,7 @@ FAIL_ON_WARNINGS := 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdomevents_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 diff --git a/dom/src/storage/Makefile.in b/dom/src/storage/Makefile.in index 81d82d1469d..2a98d4482e4 100644 --- a/dom/src/storage/Makefile.in +++ b/dom/src/storage/Makefile.in @@ -12,6 +12,7 @@ FAIL_ON_WARNINGS := 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsdomstorage_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 CPPSRCS = \ diff --git a/dom/workers/Makefile.in b/dom/workers/Makefile.in index 341136a43b4..9b85f4dfafd 100644 --- a/dom/workers/Makefile.in +++ b/dom/workers/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = domworkers_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/extensions/cookie/Makefile.in b/extensions/cookie/Makefile.in index e104557663c..b416ff5efb0 100644 --- a/extensions/cookie/Makefile.in +++ b/extensions/cookie/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = cookie +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsCookieModule diff --git a/gfx/2d/Makefile.in b/gfx/2d/Makefile.in index 05b481a7bef..6001b89217b 100644 --- a/gfx/2d/Makefile.in +++ b/gfx/2d/Makefile.in @@ -11,6 +11,7 @@ VPATH = $(srcdir) $(srcdir)/unittest include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gfx2d +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in index 2ceba098960..5782e18d9a5 100644 --- a/gfx/angle/Makefile.in +++ b/gfx/angle/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = angle +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/gfx/cairo/cairo/src/Makefile.in b/gfx/cairo/cairo/src/Makefile.in index 6be98895637..0b70722f248 100644 --- a/gfx/cairo/cairo/src/Makefile.in +++ b/gfx/cairo/cairo/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozcairo +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifdef GNU_CC diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index 0f9dddbf6e6..181a60bbddd 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozlibpixman +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifeq ($(OS_TARGET),Android) diff --git a/gfx/gl/Makefile.in b/gfx/gl/Makefile.in index fc4e98a2a8d..acc6c588eba 100644 --- a/gfx/gl/Makefile.in +++ b/gfx/gl/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gl +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/gfx/graphite2/src/Makefile.in b/gfx/graphite2/src/Makefile.in index f7dd9441c50..179824d83bb 100644 --- a/gfx/graphite2/src/Makefile.in +++ b/gfx/graphite2/src/Makefile.in @@ -22,6 +22,7 @@ endif include $(srcdir)/files.mk LIBRARY_NAME = mozgraphite2 +MSVC_ENABLE_PGO := 1 # on Windows, we're going to link graphite with gkmedias instead of libxul ifeq (WINNT,$(OS_TARGET)) diff --git a/gfx/harfbuzz/src/Makefile.in b/gfx/harfbuzz/src/Makefile.in index c2506aa06f5..ab255c64c9a 100644 --- a/gfx/harfbuzz/src/Makefile.in +++ b/gfx/harfbuzz/src/Makefile.in @@ -33,6 +33,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozharfbuzz +MSVC_ENABLE_PGO := 1 ifneq ($(OS_ARCH),WINNT) LIBXUL_LIBRARY = 1 endif diff --git a/gfx/layers/Makefile.in b/gfx/layers/Makefile.in index adca42ae82e..eb774ecfd84 100644 --- a/gfx/layers/Makefile.in +++ b/gfx/layers/Makefile.in @@ -21,6 +21,7 @@ VPATH = \ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = layers +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/gfx/ots/src/Makefile.in b/gfx/ots/src/Makefile.in index 969dfc44bed..bb79f937600 100644 --- a/gfx/ots/src/Makefile.in +++ b/gfx/ots/src/Makefile.in @@ -33,6 +33,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozots +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 ifeq (WINNT,$(OS_TARGET)) diff --git a/gfx/qcms/Makefile.in b/gfx/qcms/Makefile.in index 99353540dc8..676c26e5df8 100644 --- a/gfx/qcms/Makefile.in +++ b/gfx/qcms/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozqcms +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 CSRCS = \ diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in index 5b74b2eaa0f..453ace6c290 100644 --- a/gfx/skia/Makefile.in +++ b/gfx/skia/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = skia +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/gfx/src/Makefile.in b/gfx/src/Makefile.in index 203c57c316c..231af3ab692 100644 --- a/gfx/src/Makefile.in +++ b/gfx/src/Makefile.in @@ -12,6 +12,7 @@ include $(DEPTH)/config/autoconf.mk MODULE_NAME = nsGfxModule LIBRARY_NAME = gkgfx +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 IS_COMPONENT = 1 diff --git a/gfx/thebes/Makefile.in b/gfx/thebes/Makefile.in index caf2070c5a8..12128905053 100644 --- a/gfx/thebes/Makefile.in +++ b/gfx/thebes/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = thebes +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/intl/hyphenation/src/Makefile.in b/intl/hyphenation/src/Makefile.in index 3b82a497ab6..e08427f3762 100644 --- a/intl/hyphenation/src/Makefile.in +++ b/intl/hyphenation/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = hyphenation_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 CSRCS = hyphen.c \ diff --git a/intl/locale/src/Makefile.in b/intl/locale/src/Makefile.in index d252057c2e9..217d98cf876 100644 --- a/intl/locale/src/Makefile.in +++ b/intl/locale/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nslocale_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifeq ($(MOZ_WIDGET_TOOLKIT), qt) diff --git a/intl/lwbrk/src/Makefile.in b/intl/lwbrk/src/Makefile.in index 5f1b1291d58..f59e69c7900 100644 --- a/intl/lwbrk/src/Makefile.in +++ b/intl/lwbrk/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = lwbrk_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/strres/src/Makefile.in b/intl/strres/src/Makefile.in index 4c5a4452812..2e474fc6e09 100644 --- a/intl/strres/src/Makefile.in +++ b/intl/strres/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = strres_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/intl/uconv/src/Makefile.in b/intl/uconv/src/Makefile.in index 8c33d6dc6f5..cf171273a78 100644 --- a/intl/uconv/src/Makefile.in +++ b/intl/uconv/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = uconv +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsUConvModule diff --git a/intl/uconv/util/Makefile.in b/intl/uconv/util/Makefile.in index 0d2a1723770..aeec6e19a67 100644 --- a/intl/uconv/util/Makefile.in +++ b/intl/uconv/util/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = ucvutil_s +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 diff --git a/js/src/Makefile.in b/js/src/Makefile.in index e0b27cba474..7ef900f1715 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -18,6 +18,7 @@ LIBRARY_NAME = mozjs endif STATIC_LIBRARY_NAME = js_static +MSVC_ENABLE_PGO := 1 LIBS = $(NSPR_LIBS) # JavaScript must be built shared, even for static builds, as it is used by diff --git a/js/src/config/config.mk b/js/src/config/config.mk index 0dfc6bee5fa..5b36ca924a0 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -275,6 +275,13 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME) endif endif +# PGO on MSVC is opt-in +ifdef _MSC_VER +ifndef MSVC_ENABLE_PGO +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif +endif + # No sense in profiling tools ifdef INTERNAL_TOOLS NO_PROFILE_GUIDED_OPTIMIZE = 1 diff --git a/js/xpconnect/loader/Makefile.in b/js/xpconnect/loader/Makefile.in index 3c7d590aefa..45db36b0def 100644 --- a/js/xpconnect/loader/Makefile.in +++ b/js/xpconnect/loader/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = jsloader_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 LOCAL_INCLUDES += \ diff --git a/js/xpconnect/src/Makefile.in b/js/xpconnect/src/Makefile.in index ddf5b30e7c6..ed000131dcc 100644 --- a/js/xpconnect/src/Makefile.in +++ b/js/xpconnect/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpconnect_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 CPPSRCS = \ diff --git a/js/xpconnect/wrappers/Makefile.in b/js/xpconnect/wrappers/Makefile.in index 69b08cfe42b..1d1fccfb528 100644 --- a/js/xpconnect/wrappers/Makefile.in +++ b/js/xpconnect/wrappers/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcwrappers_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 CPPSRCS = \ diff --git a/layout/base/Makefile.in b/layout/base/Makefile.in index 83a639819be..04e0996c05f 100644 --- a/layout/base/Makefile.in +++ b/layout/base/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkbase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index a3d3504683c..e1010fd01b5 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -16,6 +16,7 @@ SHELL := ksh endif LIBRARY_NAME = gklayout +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsLayoutModule diff --git a/layout/forms/Makefile.in b/layout/forms/Makefile.in index 8d1d87883b0..c5221e6aad7 100644 --- a/layout/forms/Makefile.in +++ b/layout/forms/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkforms_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index 5b1861d793b..8757a7387cc 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkgeneric_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifndef _MSC_VER FAIL_ON_WARNINGS = 1 diff --git a/layout/style/Makefile.in b/layout/style/Makefile.in index f41f5a70db4..a2d148d4cb7 100644 --- a/layout/style/Makefile.in +++ b/layout/style/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkstyle_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/layout/tables/Makefile.in b/layout/tables/Makefile.in index bf35dd92299..46bf8ee1a29 100644 --- a/layout/tables/Makefile.in +++ b/layout/tables/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gktable_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/layout/xul/base/src/Makefile.in b/layout/xul/base/src/Makefile.in index c3a2e76186d..8f6ab248f42 100644 --- a/layout/xul/base/src/Makefile.in +++ b/layout/xul/base/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkxulbase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/media/libcubeb/src/Makefile.in b/media/libcubeb/src/Makefile.in index 52d485f96ac..17ae0999bf4 100644 --- a/media/libcubeb/src/Makefile.in +++ b/media/libcubeb/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = cubeb +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq ($(OS_TARGET),WINNT) VISIBILITY_FLAGS = diff --git a/media/libjpeg/Makefile.in b/media/libjpeg/Makefile.in index 58e129fb506..d0023b9f2bc 100644 --- a/media/libjpeg/Makefile.in +++ b/media/libjpeg/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozjpeg +MSVC_ENABLE_PGO := 1 ifeq ($(OS_ARCH),WINNT) VISIBILITY_FLAGS = diff --git a/media/libnestegg/src/Makefile.in b/media/libnestegg/src/Makefile.in index 83461224930..d4ee53fdfd8 100644 --- a/media/libnestegg/src/Makefile.in +++ b/media/libnestegg/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nestegg +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/media/libogg/src/Makefile.in b/media/libogg/src/Makefile.in index 5440837e6cd..52f683a1935 100644 --- a/media/libogg/src/Makefile.in +++ b/media/libogg/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = ogg +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/media/libopus/Makefile.in b/media/libopus/Makefile.in index 94e00e0da92..f9909444728 100644 --- a/media/libopus/Makefile.in +++ b/media/libopus/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = opus +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 DEFINES += \ diff --git a/media/libpng/Makefile.in b/media/libpng/Makefile.in index a94a5a730aa..08017bf0f87 100644 --- a/media/libpng/Makefile.in +++ b/media/libpng/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozpng +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq ($(OS_ARCH),WINNT) VISIBILITY_FLAGS= diff --git a/media/libsoundtouch/src/Makefile.in b/media/libsoundtouch/src/Makefile.in index 9221b1f6099..6cdfa90c0c7 100644 --- a/media/libsoundtouch/src/Makefile.in +++ b/media/libsoundtouch/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = soundtouch +MSVC_ENABLE_PGO := 1 SHORT_LIBNAME = soundt VISIBILITY_FLAGS = EXTRA_DSO_LDOPTS += $(MOZALLOC_LIB) diff --git a/media/libspeex_resampler/src/Makefile.in b/media/libspeex_resampler/src/Makefile.in index 83122d1b653..1402b8feca0 100644 --- a/media/libspeex_resampler/src/Makefile.in +++ b/media/libspeex_resampler/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = speex_resampler +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 # We don't compile the full speex codec, only the resampler. diff --git a/media/libtheora/lib/Makefile.in b/media/libtheora/lib/Makefile.in index c0943517caa..3c8d3e8211b 100644 --- a/media/libtheora/lib/Makefile.in +++ b/media/libtheora/lib/Makefile.in @@ -9,6 +9,7 @@ srcdir = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = theora +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/media/libvorbis/lib/Makefile.in b/media/libvorbis/lib/Makefile.in index d575e78748f..701f0b0c49b 100644 --- a/media/libvorbis/lib/Makefile.in +++ b/media/libvorbis/lib/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = vorbis +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/media/libvpx/Makefile.in b/media/libvpx/Makefile.in index 4e0ee50f9e6..b4ce8c4bae5 100644 --- a/media/libvpx/Makefile.in +++ b/media/libvpx/Makefile.in @@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk DEFINES += -DHAVE_CONFIG_H=vpx_config.h LIBRARY_NAME = vpx +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB= 1 ifeq (WINNT,$(OS_TARGET)) VISIBILITY_FLAGS = diff --git a/modules/libjar/Makefile.in b/modules/libjar/Makefile.in index a41f96b2d8e..36f42224ce2 100644 --- a/modules/libjar/Makefile.in +++ b/modules/libjar/Makefile.in @@ -12,6 +12,7 @@ include $(DEPTH)/config/autoconf.mk include $(srcdir)/objs.mk LIBRARY_NAME = jar$(VERSION_NUMBER) +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsJarModule diff --git a/modules/libjar/zipwriter/src/Makefile.in b/modules/libjar/zipwriter/src/Makefile.in index b582a095932..507b13efa58 100644 --- a/modules/libjar/zipwriter/src/Makefile.in +++ b/modules/libjar/zipwriter/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = zipwriter +MSVC_ENABLE_PGO := 1 MODULE_NAME = ZipWriterModule EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in index 4a65a1cf53a..c63da239dae 100644 --- a/modules/libpref/src/Makefile.in +++ b/modules/libpref/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = pref +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsPrefModule diff --git a/netwerk/base/src/Makefile.in b/netwerk/base/src/Makefile.in index ad64ad21670..cb51873956e 100644 --- a/netwerk/base/src/Makefile.in +++ b/netwerk/base/src/Makefile.in @@ -12,6 +12,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = neckobase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/netwerk/build/Makefile.in b/netwerk/build/Makefile.in index 55dd4b77215..746a3b6bd04 100644 --- a/netwerk/build/Makefile.in +++ b/netwerk/build/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = necko +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = necko diff --git a/netwerk/cache/Makefile.in b/netwerk/cache/Makefile.in index 6befbbd72b2..21ef53f7235 100644 --- a/netwerk/cache/Makefile.in +++ b/netwerk/cache/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkcache_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/netwerk/cookie/Makefile.in b/netwerk/cookie/Makefile.in index 3a4946e8584..5087db422c0 100644 --- a/netwerk/cookie/Makefile.in +++ b/netwerk/cookie/Makefile.in @@ -16,6 +16,7 @@ FAIL_ON_WARNINGS := 1 ifdef NECKO_COOKIES LIBRARY_NAME = neckocookie_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 CPPSRCS = \ diff --git a/netwerk/dns/Makefile.in b/netwerk/dns/Makefile.in index d68158ce019..d544c75f1a2 100644 --- a/netwerk/dns/Makefile.in +++ b/netwerk/dns/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = neckodns_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/netwerk/mime/Makefile.in b/netwerk/mime/Makefile.in index 0deafd76564..0b7c962c044 100644 --- a/netwerk/mime/Makefile.in +++ b/netwerk/mime/Makefile.in @@ -12,6 +12,7 @@ FAIL_ON_WARNINGS := 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkmime_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/netwerk/protocol/file/Makefile.in b/netwerk/protocol/file/Makefile.in index 2138538eb4d..a95b5b99b32 100644 --- a/netwerk/protocol/file/Makefile.in +++ b/netwerk/protocol/file/Makefile.in @@ -12,6 +12,7 @@ FAIL_ON_WARNINGS = 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkfile_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/netwerk/protocol/ftp/Makefile.in b/netwerk/protocol/ftp/Makefile.in index 20ebd7f8ea9..00a32b612e7 100644 --- a/netwerk/protocol/ftp/Makefile.in +++ b/netwerk/protocol/ftp/Makefile.in @@ -12,6 +12,7 @@ FAIL_ON_WARNINGS = 1 include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkftp_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/netwerk/protocol/http/Makefile.in b/netwerk/protocol/http/Makefile.in index 8ca3df0b00d..9b89e0e0009 100644 --- a/netwerk/protocol/http/Makefile.in +++ b/netwerk/protocol/http/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkhttp_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS := 1 diff --git a/netwerk/protocol/res/Makefile.in b/netwerk/protocol/res/Makefile.in index 0140130c9a1..44c838e9835 100644 --- a/netwerk/protocol/res/Makefile.in +++ b/netwerk/protocol/res/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkres_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/netwerk/protocol/websocket/Makefile.in b/netwerk/protocol/websocket/Makefile.in index d1084d0e2ea..4d49d8d2cab 100644 --- a/netwerk/protocol/websocket/Makefile.in +++ b/netwerk/protocol/websocket/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkwebsocket_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS = 1 diff --git a/netwerk/streamconv/converters/Makefile.in b/netwerk/streamconv/converters/Makefile.in index 4a1ff2f6cdc..9c42ea311bd 100644 --- a/netwerk/streamconv/converters/Makefile.in +++ b/netwerk/streamconv/converters/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkcnvts_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS := 1 diff --git a/netwerk/streamconv/src/Makefile.in b/netwerk/streamconv/src/Makefile.in index ecbcae85e84..40120d07682 100644 --- a/netwerk/streamconv/src/Makefile.in +++ b/netwerk/streamconv/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = nkconv_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) diff --git a/parser/expat/lib/Makefile.in b/parser/expat/lib/Makefile.in index 4b5294721bd..6d2d7641806 100644 --- a/parser/expat/lib/Makefile.in +++ b/parser/expat/lib/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozexpat_s +MSVC_ENABLE_PGO := 1 CSRCS = \ xmlparse.c \ diff --git a/parser/html/Makefile.in b/parser/html/Makefile.in index 9bfb1002616..60f4d966fa5 100644 --- a/parser/html/Makefile.in +++ b/parser/html/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = html5p_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 CPPSRCS = \ diff --git a/parser/xml/src/Makefile.in b/parser/xml/src/Makefile.in index 9ffd15ca34e..3db8563d71a 100644 --- a/parser/xml/src/Makefile.in +++ b/parser/xml/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = saxp +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 LIBXUL_LIBRARY = 1 diff --git a/security/manager/boot/src/Makefile.in b/security/manager/boot/src/Makefile.in index adeee47e538..5cc6eff5846 100644 --- a/security/manager/boot/src/Makefile.in +++ b/security/manager/boot/src/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = pipboot +MSVC_ENABLE_PGO := 1 IS_COMPONENT = 1 MODULE_NAME = BOOT EXPORT_LIBRARY = 1 diff --git a/toolkit/components/places/Makefile.in b/toolkit/components/places/Makefile.in index f71f1b6be51..6a44e871c22 100644 --- a/toolkit/components/places/Makefile.in +++ b/toolkit/components/places/Makefile.in @@ -11,6 +11,7 @@ include $(DEPTH)/config/autoconf.mk ifdef MOZ_PLACES LIBRARY_NAME = places +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 MODULE_NAME = nsPlacesModule diff --git a/toolkit/components/telemetry/Makefile.in b/toolkit/components/telemetry/Makefile.in index b97fb7a760f..c196e2c88c3 100644 --- a/toolkit/components/telemetry/Makefile.in +++ b/toolkit/components/telemetry/Makefile.in @@ -20,6 +20,7 @@ IS_COMPONENT = 1 FAIL_ON_WARNINGS = 1 LIBRARY_NAME = telemetry +MSVC_ENABLE_PGO := 1 EXTRA_PP_COMPONENTS = \ TelemetryPing.js \ diff --git a/toolkit/components/url-classifier/Makefile.in b/toolkit/components/url-classifier/Makefile.in index e5045dd6f7e..b1df56ed187 100644 --- a/toolkit/components/url-classifier/Makefile.in +++ b/toolkit/components/url-classifier/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = urlclassifier_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 FAIL_ON_WARNINGS = 1 diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 8cdb53926fe..93f1aba4c05 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -11,6 +11,7 @@ include $(DEPTH)/config/autoconf.mk LIBXUL_LIBRARY = 1 LIBRARY_NAME = exception_handler_s +MSVC_ENABLE_PGO := 1 ifeq ($(OS_ARCH),Darwin) CMMSRCS = mac_utils.mm diff --git a/toolkit/crashreporter/google-breakpad/src/common/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/Makefile.in index a41a8a0ae45..579272e39a5 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/Makefile.in +++ b/toolkit/crashreporter/google-breakpad/src/common/Makefile.in @@ -10,6 +10,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = breakpad_common_s +MSVC_ENABLE_PGO := 1 ifneq (WINNT,$(OS_TARGET)) ifdef MOZ_CRASHREPORTER HOST_LIBRARY_NAME = host_breakpad_common_s diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 72118a4fcb4..7f81f7a2787 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -13,6 +13,7 @@ include $(topsrcdir)/rdf/util/src/objs.mk include $(topsrcdir)/intl/unicharutil/util/objs.mk LIBRARY_NAME = xul +MSVC_ENABLE_PGO := 1 FORCE_SHARED_LIB = 1 MOZILLA_INTERNAL_API = 1 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index 844d64d1eaa..4d803c96bfc 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -18,6 +18,7 @@ include $(topsrcdir)/config/makefiles/makeutils.mk milestone_txt = $(topsrcdir)/config/milestone.txt LIBRARY_NAME = xulapp_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/uriloader/base/Makefile.in b/uriloader/base/Makefile.in index 367ed48267e..52999b2f113 100644 --- a/uriloader/base/Makefile.in +++ b/uriloader/base/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = uriloaderbase_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 FAIL_ON_WARNINGS = 1 diff --git a/view/src/Makefile.in b/view/src/Makefile.in index 91a86e9605c..fd3ee4cc307 100644 --- a/view/src/Makefile.in +++ b/view/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = gkview_s +MSVC_ENABLE_PGO := 1 FORCE_STATIC_LIB = 1 MODULE_NAME = nsViewModule LIBXUL_LIBRARY = 1 diff --git a/widget/windows/Makefile.in b/widget/windows/Makefile.in index 4537a9913f0..61bc679a81d 100644 --- a/widget/windows/Makefile.in +++ b/widget/windows/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = widget_windows +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 RESFILE = widget.res diff --git a/widget/xpwidgets/Makefile.in b/widget/xpwidgets/Makefile.in index 50bac7a3925..f12602f14d3 100644 --- a/widget/xpwidgets/Makefile.in +++ b/widget/xpwidgets/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpwidgets_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 DEFINES += \ diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index 653c81d038a..43e97a56c28 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcombase_s +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API =1 LIBXUL_LIBRARY = 1 diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in index c911daecbbb..cedbd7df97f 100644 --- a/xpcom/build/Makefile.in +++ b/xpcom/build/Makefile.in @@ -15,6 +15,7 @@ include $(srcdir)/../glue/objs.mk EXTRA_DEPS += $(srcdir)/../glue/objs.mk LIBRARY_NAME = xpcom_core +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in index 99e87e03521..5787e60a8e0 100644 --- a/xpcom/components/Makefile.in +++ b/xpcom/components/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcomcomponents_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 MOZILLA_INTERNAL_API = 1 diff --git a/xpcom/ds/Makefile.in b/xpcom/ds/Makefile.in index fb01f9e2a57..c572655ac6f 100644 --- a/xpcom/ds/Makefile.in +++ b/xpcom/ds/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcomds_s +MSVC_ENABLE_PGO := 1 LIBXUL_LIBRARY = 1 MOZILLA_INTERNAL_API = 1 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in index b8e2c4e6774..83ed2bfb692 100644 --- a/xpcom/io/Makefile.in +++ b/xpcom/io/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcomio_s +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 LIBXUL_LIBRARY = 1 diff --git a/xpcom/reflect/xptcall/src/Makefile.in b/xpcom/reflect/xptcall/src/Makefile.in index 951a5caf025..97bd681dbaa 100644 --- a/xpcom/reflect/xptcall/src/Makefile.in +++ b/xpcom/reflect/xptcall/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xptcall +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 CPPSRCS = xptcall.cpp diff --git a/xpcom/reflect/xptinfo/src/Makefile.in b/xpcom/reflect/xptinfo/src/Makefile.in index 647eda58737..32db1475166 100644 --- a/xpcom/reflect/xptinfo/src/Makefile.in +++ b/xpcom/reflect/xptinfo/src/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xptinfo +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 diff --git a/xpcom/string/src/Makefile.in b/xpcom/string/src/Makefile.in index cbab5ccdd52..a72e61846c6 100644 --- a/xpcom/string/src/Makefile.in +++ b/xpcom/string/src/Makefile.in @@ -12,6 +12,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = string_s +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 diff --git a/xpcom/threads/Makefile.in b/xpcom/threads/Makefile.in index 231fec599b6..fefce898d55 100644 --- a/xpcom/threads/Makefile.in +++ b/xpcom/threads/Makefile.in @@ -11,6 +11,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = xpcomthreads_s +MSVC_ENABLE_PGO := 1 MOZILLA_INTERNAL_API = 1 LIBXUL_LIBRARY = 1 diff --git a/xpfe/appshell/src/Makefile.in b/xpfe/appshell/src/Makefile.in index 8a2e84c3b35..945647569a5 100644 --- a/xpfe/appshell/src/Makefile.in +++ b/xpfe/appshell/src/Makefile.in @@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk IS_COMPONENT=1 MODULE_NAME = appshell LIBRARY_NAME = nsappshell +MSVC_ENABLE_PGO := 1 EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 From 746d21d29632ff3222fa838f9cdaee7bf05c2d3b Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Thu, 16 May 2013 08:54:54 -0500 Subject: [PATCH 60/73] Bug 847872: Make reflow-on-zoom happen on double-tap only. [r=blassey] --- .../base/locales/en-US/android_strings.dtd | 2 +- mobile/android/base/strings.xml.in | 2 +- mobile/android/chrome/content/browser.js | 100 ++++++++++++++++-- 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index 2bba747547c..570fa4462fe 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -100,7 +100,7 @@ - + diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index 89d85258edd..7c31595d782 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -115,7 +115,7 @@ &pref_font_size_set; &pref_font_size_adjust_char; &pref_font_size_preview_text; - &pref_reflow_on_zoom2; + &pref_reflow_on_zoom3; &pref_show_product_announcements; &pref_sync; &pref_search_suggestions; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index a63c9be1c13..5fcfa26babf 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -179,6 +179,14 @@ function fuzzyEquals(a, b) { return (Math.abs(a - b) < 1e-6); } +/** + * Convert a font size from CSS pixels (px) to twenteiths-of-a-point + * (twips). + */ +function convertFromPxToTwips(aSize) { + return (20.0 * 12.0 * (aSize/16.0)); +} + #ifdef MOZ_CRASHREPORTER Cu.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter", @@ -2596,16 +2604,45 @@ Tab.prototype = { } }, + /** + * Retrieves the font size in twips for a given element. + */ + getFontSizeInTwipsFor: function(aElement) { + // GetComputedStyle should always give us CSS pixels for a font size. + let fontSizeStr = this.window.getComputedStyle(aElement)['fontSize']; + let fontSize = fontSizeStr.slice(0, -2); + // This is in px, so we want to convert it to points then to twips. + return convertFromPxToTwips(fontSize); + }, + + /** + * This returns the zoom necessary to match the font size of an element to + * the minimum font size specified by the browser.zoom.reflowOnZoom.minFontSizeTwips + * preference. + */ + getZoomToMinFontSize: function(aElement) { + let currentZoom = this._zoom; + let minFontSize = Services.prefs.getIntPref("browser.zoom.reflowZoom.minFontSizeTwips"); + let curFontSize = this.getFontSizeInTwipsFor(aElement); + if (!fuzzyEquals(curFontSize*(currentZoom), minFontSize)) { + return 1.0 + minFontSize / curFontSize; + } + + return 1.0; + }, + performReflowOnZoom: function(aViewport) { - let viewportWidth = gScreenWidth / aViewport.zoom; + let zoom = this._drawZoom ? this._drawZoom : aViewport.zoom; + + let viewportWidth = gScreenWidth / zoom; let reflozTimeout = Services.prefs.getIntPref("browser.zoom.reflowZoom.reflowTimeout"); if (gReflowPending) { clearTimeout(gReflowPending); } - // We add in a bit of fudge just so that the end characters don't accidentally - // get clipped. 15px is an arbitrary choice. + // We add in a bit of fudge just so that the end characters + // don't accidentally get clipped. 15px is an arbitrary choice. gReflowPending = setTimeout(doChangeMaxLineBoxWidth, reflozTimeout, viewportWidth - 15); @@ -2960,7 +2997,21 @@ Tab.prototype = { // Adjust the max line box width to be no more than the viewport width, but // only if the reflow-on-zoom preference is enabled. - let isZooming = Math.abs(aViewport.zoom - this._zoom) >= 1e-6; + let isZooming = !fuzzyEquals(aViewport.zoom, this._zoom); + if (BrowserApp.selectedTab.reflozPinchSeen && + isZooming && aViewport.zoom < 1.0) { + // In this case, we want to restore the max line box width, + // because we are pinch-zooming to zoom out. + BrowserEventHandler.resetMaxLineBoxWidth(); + BrowserApp.selectedTab.reflozPinchSeen = false; + } else if (BrowserApp.selectedTab.reflozPinchSeen && + isZooming) { + // In this case, the user pinch-zoomed in, so we don't want to + // preserve position as we would with reflow-on-zoom. + BrowserApp.selectedTab.probablyNeedRefloz = false; + BrowserApp.selectedTab._mReflozPoint = null; + } + if (isZooming && BrowserEventHandler.mReflozPref && BrowserApp.selectedTab._mReflozPoint && @@ -3859,10 +3910,15 @@ var BrowserEventHandler = { }, resetMaxLineBoxWidth: function() { - let webNav = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation); - let docShell = webNav.QueryInterface(Ci.nsIDocShell); - let docViewer = docShell.contentViewer.QueryInterface(Ci.nsIMarkupDocumentViewer); - docViewer.changeMaxLineBoxWidth(0); + BrowserApp.selectedTab.probablyNeedRefloz = false; + + if (gReflowPending) { + clearTimeout(gReflowPending); + } + + let reflozTimeout = Services.prefs.getIntPref("browser.zoom.reflowZoom.reflowTimeout"); + gReflowPending = setTimeout(doChangeMaxLineBoxWidth, + reflozTimeout, 0); }, updateReflozPref: function() { @@ -4093,6 +4149,18 @@ var BrowserEventHandler = { onDoubleTap: function(aData) { let data = JSON.parse(aData); + // We only want to do this if reflow-on-zoom is enabled. + if (BrowserEventHandler.mReflozPref && + !BrowserApp.selectedTab._mReflozPoint) { + let data = JSON.parse(aData); + let zoomPointX = data.x; + let zoomPointY = data.y; + + BrowserApp.selectedTab._mReflozPoint = { x: zoomPointX, y: zoomPointY, + range: BrowserApp.selectedBrowser.contentDocument.caretPositionFromPoint(zoomPointX, zoomPointY) }; + BrowserApp.selectedTab.probablyNeedRefloz = true; + } + let zoom = BrowserApp.selectedTab._zoom; let element = ElementTouchHelper.anyElementFromPoint(data.x, data.y); if (!element) { @@ -4127,9 +4195,21 @@ var BrowserEventHandler = { // if the rect is already taking up most of the visible area and is stretching the // width of the page, then we want to zoom out instead. - if (this._isRectZoomedIn(bRect, viewport)) { - if (aCanZoomOut) + if (BrowserEventHandler.mReflozPref) { + let zoomFactor = BrowserApp.selectedTab.getZoomToMinFontSize(aElement); + + bRect.width = zoomFactor == 1.0 ? bRect.width : gScreenWidth / zoomFactor; + bRect.height = zoomFactor == 1.0 ? bRect.height : bRect.height / zoomFactor; + if (zoomFactor == 1.0 || this._isRectZoomedIn(bRect, viewport)) { + if (aCanZoomOut) { + this._zoomOut(); + } + return; + } + } else if (this._isRectZoomedIn(bRect, viewport)) { + if (aCanZoomOut) { this._zoomOut(); + } return; } From 78ef891bef36be8771a8c1373211628d032e9113 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 16 May 2013 17:10:30 +0300 Subject: [PATCH 61/73] Bug 847594 - Paris binding for DataContainerEvent, r=peterv --HG-- extra : rebase_source : ff4ad6b1b5a582c6e1b973fd1729aa2c6f7db314 --- .../events/src/nsDOMDataContainerEvent.cpp | 20 +++++++++++++ content/events/src/nsDOMDataContainerEvent.h | 17 +++++++++++ content/events/test/test_bug368835.html | 15 ++++++++++ dom/bindings/Bindings.conf | 4 +++ dom/webidl/DataContainerEvent.webidl | 29 +++++++++++++++++++ dom/webidl/WebIDL.mk | 1 + 6 files changed, 86 insertions(+) create mode 100644 dom/webidl/DataContainerEvent.webidl diff --git a/content/events/src/nsDOMDataContainerEvent.cpp b/content/events/src/nsDOMDataContainerEvent.cpp index a7711361a5a..2201436c8cb 100644 --- a/content/events/src/nsDOMDataContainerEvent.cpp +++ b/content/events/src/nsDOMDataContainerEvent.cpp @@ -5,6 +5,7 @@ #include "nsDOMDataContainerEvent.h" #include "nsDOMClassInfoID.h" +#include "nsContentUtils.h" nsDOMDataContainerEvent::nsDOMDataContainerEvent( mozilla::dom::EventTarget* aOwner, @@ -13,6 +14,7 @@ nsDOMDataContainerEvent::nsDOMDataContainerEvent( : nsDOMEvent(aOwner, aPresContext, aEvent) { mData.Init(); + SetIsDOMBinding(); } NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMDataContainerEvent, @@ -59,6 +61,24 @@ nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData) return NS_OK; } +void +nsDOMDataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey, + JS::Value aVal, mozilla::ErrorResult& aRv) +{ + if (!nsContentUtils::XPConnect()) { + aRv = NS_ERROR_FAILURE; + return; + } + nsCOMPtr val; + nsresult rv = + nsContentUtils::XPConnect()->JSToVariant(aCx, aVal, getter_AddRefs(val)); + if (NS_FAILED(rv)) { + aRv = rv; + return; + } + aRv = SetData(aKey, val); +} + nsresult NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, diff --git a/content/events/src/nsDOMDataContainerEvent.h b/content/events/src/nsDOMDataContainerEvent.h index e0c942a07ae..faedbf92af1 100644 --- a/content/events/src/nsDOMDataContainerEvent.h +++ b/content/events/src/nsDOMDataContainerEvent.h @@ -9,6 +9,7 @@ #include "nsIDOMDataContainerEvent.h" #include "nsDOMEvent.h" #include "nsInterfaceHashtable.h" +#include "mozilla/dom/DataContainerEventBinding.h" class nsDOMDataContainerEvent : public nsDOMEvent, public nsIDOMDataContainerEvent @@ -25,6 +26,22 @@ public: NS_DECL_NSIDOMDATACONTAINEREVENT + virtual JSObject* + WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE + { + return mozilla::dom::DataContainerEventBinding::Wrap(aCx, aScope, this); + } + + already_AddRefed GetData(const nsAString& aKey) + { + nsCOMPtr val; + GetData(aKey, getter_AddRefs(val)); + return val.forget(); + } + + void SetData(JSContext* aCx, const nsAString& aKey, JS::Value aVal, + mozilla::ErrorResult& aRv); + private: static PLDHashOperator TraverseEntry(const nsAString& aKey, nsIVariant *aDataItem, void* aUserArg); diff --git a/content/events/test/test_bug368835.html b/content/events/test/test_bug368835.html index 16687a43566..5665dd78830 100644 --- a/content/events/test/test_bug368835.html +++ b/content/events/test/test_bug368835.html @@ -35,6 +35,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=368835 ok(isPassed, "getData shouldn't fail."); ok(value == "data1", "Wrong value of data."); + is(aEvent.getData("document"), document); + is(aEvent.getData("window"), window); + is(aEvent.getData("event"), aEvent); + is(aEvent.getData("null"), null); + is(aEvent.getData("1"), 1); + is(aEvent.getData("1.1"), 1.1); + is(aEvent.getData("true"), true); + try { aEvent.setData("data3", "data3"); isPassed = false; @@ -64,6 +72,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=368835 try { event.setData("data1", "data1"); + event.setData("document", document); + event.setData("window", window); + event.setData("event", event); + event.setData("null", null); + event.setData("1", 1); + event.setData("1.1", 1.1); + event.setData("true", true); isPassed = true; } catch (e) { isPassed = false; diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index e7166932708..09c6e1dc3b3 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -231,6 +231,10 @@ DOMInterfaces = { 'nativeType': 'nsDOMCSSValueList' }, +'DataContainerEvent': { + 'nativeType': 'nsDOMDataContainerEvent', +}, + 'DelayNode': [ { 'resultNotAddRefed': [ 'delayTime' ], diff --git a/dom/webidl/DataContainerEvent.webidl b/dom/webidl/DataContainerEvent.webidl new file mode 100644 index 00000000000..8293063cfa7 --- /dev/null +++ b/dom/webidl/DataContainerEvent.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface nsIVariant; + +interface DataContainerEvent : Event { + /** + * Return the data associated with the given key. + * + * @param key the key + * @return the data associated with the key + */ + nsIVariant? getData(DOMString? key); + + /** + * Set the data for the given key. + * + * @param key the data key + * @param data the data + * @throws NS_ERROR_UNEXPECTED if the method is called during event + * dispatch + */ + [Throws] + void setData(DOMString? key, any data); +}; + diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index a2f0d7174ef..458df864e98 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -48,6 +48,7 @@ webidl_files = \ CSSStyleSheet.webidl \ CSSValue.webidl \ CSSValueList.webidl \ + DataContainerEvent.webidl \ DelayNode.webidl \ DesktopNotification.webidl \ DeviceMotionEvent.webidl \ From 0176968423c1be23c0efd2cb0518dca7dcd250a9 Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Thu, 16 May 2013 17:36:53 +0300 Subject: [PATCH 62/73] Add even more logging to try to diagnose the cause for test_dbgsocket.js failing intermittently (bug 775924); r=me --- .../debugger/tests/unit/test_dbgsocket.js | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/toolkit/devtools/debugger/tests/unit/test_dbgsocket.js b/toolkit/devtools/debugger/tests/unit/test_dbgsocket.js index 7fb9dbc03d4..e9b3d965486 100644 --- a/toolkit/devtools/debugger/tests/unit/test_dbgsocket.js +++ b/toolkit/devtools/debugger/tests/unit/test_dbgsocket.js @@ -84,6 +84,18 @@ function test_socket_shutdown() } }; + // Hack to get more logging for bug 775924. + transport.onDataAvailable = makeInfallible(function DT_onDataAvailable(aRequest, aContext, + aStream, aOffset, aCount) { + do_print("onDataAvailable. offset: "+aOffset+", count: "+aCount); + let buf = NetUtil.readInputStreamToString(aStream, aStream.available()); + transport._incoming += buf; + do_print("Read form stream("+buf.length+"): "+buf); + while (transport._processIncoming()) { + do_print("Look ma, I'm looping!"); + }; + }, "DebuggerTransport.prototype.onDataAvailable"); + do_print("Initializing input stream at " + new Date().toTimeString()); transport.ready(); } @@ -114,3 +126,36 @@ function try_open_listener() try_open_listener(); } } + +// Copied verbatim from dbg-transport.js. +// Hack to get more logging for bug 775924. +function makeInfallible(aHandler, aName) { + if (!aName) + aName = aHandler.name; + + return function (/* arguments */) { + try { + return aHandler.apply(this, arguments); + } catch (ex) { + let msg = "Handler function "; + if (aName) { + msg += aName + " "; + } + msg += "threw an exception: " + safeErrorString(ex); + if (ex.stack) { + msg += "\nCall stack:\n" + ex.stack; + } + + do_print(msg + "\n"); + + if (Cu.reportError) { + /* + * Note that the xpcshell test harness registers an observer for + * console messages, so when we're running tests, this will cause + * the test to quit. + */ + Cu.reportError(msg); + } + } + } +} From 1abd0d11bccabcd87d848d3466be3c41c5c887b3 Mon Sep 17 00:00:00 2001 From: Mike Habicher Date: Thu, 16 May 2013 10:39:13 -0400 Subject: [PATCH 63/73] Bug 872122 - clean up nsDOMCameraManager::GetListOfCameras(), r=bz --- dom/camera/FallbackCameraManager.cpp | 4 +- dom/camera/GonkCameraManager.cpp | 79 +++++++++++++++++----------- dom/camera/nsIDOMCameraManager.idl | 9 ++-- 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/dom/camera/FallbackCameraManager.cpp b/dom/camera/FallbackCameraManager.cpp index 101390fce77..bc7310d5404 100644 --- a/dom/camera/FallbackCameraManager.cpp +++ b/dom/camera/FallbackCameraManager.cpp @@ -17,9 +17,9 @@ nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName) return NS_ERROR_NOT_IMPLEMENTED; } -/* [implicit_jscontext] jsval getListOfCameras (); */ +/* void getListOfCameras ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aCameras); */ NS_IMETHODIMP -nsDOMCameraManager::GetListOfCameras(JSContext* cx, JS::Value* _retval) +nsDOMCameraManager::GetListOfCameras(uint32_t *aCount, char * **aCameras) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/dom/camera/GonkCameraManager.cpp b/dom/camera/GonkCameraManager.cpp index 25a45203e97..832b6e09554 100644 --- a/dom/camera/GonkCameraManager.cpp +++ b/dom/camera/GonkCameraManager.cpp @@ -33,7 +33,7 @@ nsresult nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName) { int32_t count = android::Camera::getNumberOfCameras(); - DOM_CAMERA_LOGI("getListOfCameras : getNumberOfCameras() returned %d\n", count); + DOM_CAMERA_LOGI("GetCameraName : getNumberOfCameras() returned %d\n", count); if (aDeviceNum > count) { DOM_CAMERA_LOGE("GetCameraName : invalid device number"); return NS_ERROR_NOT_AVAILABLE; @@ -63,53 +63,70 @@ nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName) return NS_OK; } -/* [implicit_jscontext] jsval getListOfCameras (); */ +/* void getListOfCameras ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aCameras); */ NS_IMETHODIMP -nsDOMCameraManager::GetListOfCameras(JSContext* cx, JS::Value* _retval) +nsDOMCameraManager::GetListOfCameras(uint32_t *aCount, char * **aCameras) { - JSObject* a = JS_NewArrayObject(cx, 0, nullptr); - uint32_t index = 0; - int32_t count; + int32_t count = android::Camera::getNumberOfCameras(); - if (!a) { - DOM_CAMERA_LOGE("getListOfCameras : Could not create array object"); - return NS_ERROR_OUT_OF_MEMORY; - } - count = android::Camera::getNumberOfCameras(); - if (count <= 0) { - return NS_ERROR_NOT_AVAILABLE; + DOM_CAMERA_LOGI("GetListOfCameras : getNumberOfCameras() returned %d\n", count); + if (count < 1) { + *aCameras = nullptr; + *aCount = 0; + return NS_OK; } - DOM_CAMERA_LOGI("getListOfCameras : getNumberOfCameras() returned %d\n", count); - while (count--) { + // Allocate 2 extra slots to reserve space for 'front' and 'back' cameras + // at the front of the array--we will collapse any empty slots below. + int32_t arraySize = count + 2; + char** cameras = static_cast(NS_Alloc(arraySize * sizeof(char*))); + for (int32_t i = 0; i < arraySize; ++i) { + cameras[i] = nullptr; + } + + uint32_t extraIndex = 2; + bool gotFront = false; + bool gotBack = false; + + for (int32_t i = 0; i < count; ++i) { nsCString cameraName; - nsresult result = GetCameraName(count, cameraName); + nsresult result = GetCameraName(i, cameraName); if (result != NS_OK) { continue; } - JSString* v = JS_NewStringCopyZ(cx, cameraName.get()); - JS::Value jv; - if (!cameraName.Compare("back")) { + // The first camera we find named 'back' gets slot 0; and the first + // we find named 'front' gets slot 1. All others appear after these. + uint32_t index; + if (!gotBack && !cameraName.Compare("back")) { index = 0; - } else if (!cameraName.Compare("front")) { + gotBack = true; + } else if (!gotFront && !cameraName.Compare("front")) { index = 1; + gotFront = true; } else { - static uint32_t extraIndex = 2; index = extraIndex++; } - if (!v) { - DOM_CAMERA_LOGE("getListOfCameras : out of memory populating camera list"); - return NS_ERROR_NOT_AVAILABLE; - } - jv = STRING_TO_JSVAL(v); - if (!JS_SetElement(cx, a, index, &jv)) { - DOM_CAMERA_LOGE("getListOfCameras : failed building list of cameras"); - return NS_ERROR_NOT_AVAILABLE; - } + MOZ_ASSERT(index < arraySize); + cameras[index] = ToNewCString(cameraName); } - *_retval = OBJECT_TO_JSVAL(a); + // Make a forward pass over the array to compact it; after this loop, + // 'offset' will contain the number of nullptrs in the array, which + // we use to adjust the value returned in 'aCount'. + int32_t offset = 0; + for (int32_t i = 0; i < arraySize; ++i) { + if (cameras[i] == nullptr) { + offset++; + } else if (offset != 0) { + cameras[i - offset] = cameras[i]; + cameras[i] = nullptr; + } + } + MOZ_ASSERT(offset >= 2); + + *aCameras = cameras; + *aCount = arraySize - offset; return NS_OK; } diff --git a/dom/camera/nsIDOMCameraManager.idl b/dom/camera/nsIDOMCameraManager.idl index a6d5cc4a8e0..cb5d4ef5adb 100644 --- a/dom/camera/nsIDOMCameraManager.idl +++ b/dom/camera/nsIDOMCameraManager.idl @@ -420,21 +420,20 @@ interface nsICameraGetCameraCallback : nsISupports void handleEvent(in nsICameraControl camera); }; -[scriptable, uuid(671ee624-0336-441a-a24e-26b5319f14fe)] +[scriptable, uuid(f01aabcd-b822-423a-b077-3d0748296428)] interface nsIDOMCameraManager : nsISupports { /* get a camera instance; options will be used to specify which camera to get from the list returned by getListOfCameras(), e.g.: { - camera: front + camera: "front" } */ [implicit_jscontext] void getCamera([optional] in jsval aOptions, in nsICameraGetCameraCallback onSuccess, [optional] in nsICameraErrorCallback onError); - /* return a JSON array of camera identifiers, e.g. + /* return an array of camera identifiers, e.g. [ "front", "back" ] */ - [implicit_jscontext] - jsval getListOfCameras(); + void getListOfCameras([optional] out unsigned long aCount, [retval, array, size_is(aCount)] out string aCameras); }; From 988caba6b9f6efd1510ce66ab3c29846db14834d Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Thu, 16 May 2013 10:06:03 -0500 Subject: [PATCH 64/73] Bug 862763: Cache whether font size inflation is enabled in the pres shell for efficiency. [r=dbaron] --- dom/base/nsDOMWindowUtils.cpp | 6 +- layout/base/nsIPresShell.h | 31 ++++++++++ layout/base/nsLayoutUtils.cpp | 59 +----------------- layout/base/nsPresShell.cpp | 112 ++++++++++++++++++++++++++++++++++ layout/base/nsPresShell.h | 3 +- 5 files changed, 152 insertions(+), 59 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 34506b8c96f..81900b6fb7e 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -293,10 +293,14 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext) { if (aPresContext) { nsIPresShell* presShell = aPresContext->GetPresShell(); - if (presShell && nsLayoutUtils::FontSizeInflationEnabled(aPresContext) && + bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled(); + presShell->NotifyFontSizeInflationEnabledIsDirty(); + if (presShell && presShell->FontSizeInflationEnabled() && presShell->FontSizeInflationMinTwips() != 0) { bool changed; aPresContext->ScreenWidthInchesForFontInflation(&changed); + changed = changed || + (fontInflationWasEnabled != presShell->FontSizeInflationEnabled()); if (changed) { nsCOMPtr container = aPresContext->GetContainer(); nsCOMPtr docShell = do_QueryInterface(container); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 20f83d7f065..4eaaf273ff3 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -1311,6 +1311,25 @@ public: return mFontSizeInflationDisabledInMasterProcess; } + /** + * Determine if font size inflation is enabled. This value is cached until + * it becomes dirty. + * + * @returns true, if font size inflation is enabled; false otherwise. + */ + bool FontSizeInflationEnabled(); + + /** + * Notify the pres shell that an event occurred making the current value of + * mFontSizeInflationEnabled invalid. This will schedule a recomputation of + * whether font size inflation is enabled on the next call to + * FontSizeInflationEnabled(). + */ + void NotifyFontSizeInflationEnabledIsDirty() + { + mFontSizeInflationEnabledIsDirty = true; + } + virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0; void InvalidatePresShellIfHidden(); @@ -1337,6 +1356,14 @@ protected: mozFlushType aFlushType); bool RemoveRefreshObserverInternal(nsARefreshObserver* aObserver, mozFlushType aFlushType); + + /** + * Do computations necessary to determine if font size inflation is enabled. + * This value is cached after computation, as the computation is somewhat + * expensive. + */ + void RecomputeFontSizeInflationEnabled(); + public: bool AddRefreshObserver(nsARefreshObserver* aObserver, mozFlushType aFlushType) { @@ -1518,6 +1545,10 @@ protected: uint32_t mFontSizeInflationLineThreshold; bool mFontSizeInflationForceEnabled; bool mFontSizeInflationDisabledInMasterProcess; + bool mFontSizeInflationEnabled; + + // Dirty bit indicating that mFontSizeInflationEnabled needs to be recomputed. + bool mFontSizeInflationEnabledIsDirty; // Flag to indicate whether or not there is a reflow on zoom event pending. // See IsReflowOnZoomPending() for more information. diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 10f9c487a38..879f412f6e9 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -5370,66 +5370,11 @@ nsLayoutUtils::FontSizeInflationEnabled(nsPresContext *aPresContext) { nsIPresShell* presShell = aPresContext->GetPresShell(); - if (!presShell || - (presShell->FontSizeInflationEmPerLine() == 0 && - presShell->FontSizeInflationMinTwips() == 0) || - aPresContext->IsChrome()) { + if (!presShell) { return false; } - // Force-enabling font inflation always trumps the heuristics here. - if (!presShell->FontSizeInflationForceEnabled()) { - if (TabChild* tab = GetTabChildFrom(presShell)) { - // We're in a child process. Cancel inflation if we're not - // async-pan zoomed. - if (!tab->IsAsyncPanZoomEnabled()) { - return false; - } - } else if (XRE_GetProcessType() == GeckoProcessType_Default) { - // We're in the master process. Cancel inflation if it's been - // explicitly disabled. - if (presShell->FontSizeInflationDisabledInMasterProcess()) { - return false; - } - } - } - // XXXjwir3: - // See bug 706918, comment 23 for more information on this particular section - // of the code. We're using "screen size" in place of the size of the content - // area, because on mobile, these are close or equal. This will work for our - // purposes (bug 706198), but it will need to be changed in the future to be - // more correct when we bring the rest of the viewport code into platform. - // We actually want the size of the content area, in the event that we don't - // have any metadata about the width and/or height. On mobile, the screen size - // and the size of the content area are very close, or the same value. - // In XUL fennec, the content area is the size of the widget, but - // in native fennec, the content area is the size of the Gecko LayerView - // object. - - // TODO: - // Once bug 716575 has been resolved, this code should be changed so that it - // does the right thing on all platforms. - nsresult rv; - nsCOMPtr screenMgr = - do_GetService("@mozilla.org/gfx/screenmanager;1", &rv); - NS_ENSURE_SUCCESS(rv, false); - - nsCOMPtr screen; - screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); - if (screen) { - int32_t screenLeft, screenTop, screenWidth, screenHeight; - screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight); - - nsViewportInfo vInf = - nsContentUtils::GetViewportInfo(aPresContext->PresShell()->GetDocument(), - screenWidth, screenHeight); - - if (vInf.GetDefaultZoom() >= 1.0 || vInf.IsAutoSizeEnabled()) { - return false; - } - } - - return true; + return presShell->FontSizeInflationEnabled(); } /* static */ nsRect diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9a1f80d586f..1c5d86dd3b0 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -87,6 +87,7 @@ #include "nsIBaseWindow.h" #include "nsError.h" #include "nsLayoutUtils.h" +#include "nsViewportInfo.h" #include "nsCSSRendering.h" // for |#ifdef DEBUG| code #include "prenv.h" @@ -4056,6 +4057,12 @@ PresShell::ContentAppended(nsIDocument *aDocument, mFrameConstructor->RestyleForAppend(aContainer->AsElement(), aFirstNewContent); mFrameConstructor->ContentAppended(aContainer, aFirstNewContent, true); + + if (static_cast(aContainer) == static_cast(aDocument) && + aFirstNewContent->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) { + NotifyFontSizeInflationEnabledIsDirty(); + } + VERIFY_STYLE_TREE; } @@ -4081,6 +4088,13 @@ PresShell::ContentInserted(nsIDocument* aDocument, mFrameConstructor->RestyleForInsertOrChange(aContainer->AsElement(), aChild); mFrameConstructor->ContentInserted(aContainer, aChild, nullptr, true); + + if (((!aContainer && aDocument) || + (static_cast(aContainer) == static_cast(aDocument))) && + aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) { + NotifyFontSizeInflationEnabledIsDirty(); + } + VERIFY_STYLE_TREE; } @@ -4101,6 +4115,12 @@ PresShell::ContentRemoved(nsIDocument *aDocument, // Notify the ESM that the content has been removed, so that // it can clean up any state related to the content. + + // XXX_jwir3: There is no null check for aDocument necessary, since, even + // though by nsIMutationObserver, aDocument could be null, the + // precondition check that mDocument == aDocument ensures that + // aDocument will not be null (since mDocument can't be null unless + // we're still intializing). mPresContext->EventStateManager()->ContentRemoved(aDocument, aChild); nsAutoCauseReflowNotifier crNotifier(this); @@ -4125,6 +4145,13 @@ PresShell::ContentRemoved(nsIDocument *aDocument, nsCSSFrameConstructor::REMOVE_CONTENT, &didReconstruct); + + if (((aContainer && + static_cast(aContainer) == static_cast(aDocument)) || + aDocument) && aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) { + NotifyFontSizeInflationEnabledIsDirty(); + } + VERIFY_STYLE_TREE; } @@ -9472,6 +9499,91 @@ PresShell::SetupFontInflation() mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold(); mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled(); mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess(); + + NotifyFontSizeInflationEnabledIsDirty(); +} + +void +nsIPresShell::RecomputeFontSizeInflationEnabled() +{ + mFontSizeInflationEnabledIsDirty = false; + + MOZ_ASSERT(mPresContext, "our pres context should not be null"); + if ((FontSizeInflationEmPerLine() == 0 && + FontSizeInflationMinTwips() == 0) || mPresContext->IsChrome()) { + mFontSizeInflationEnabled = false; + return; + } + + // Force-enabling font inflation always trumps the heuristics here. + if (!FontSizeInflationForceEnabled()) { + if (TabChild* tab = GetTabChildFrom(this)) { + // We're in a child process. Cancel inflation if we're not + // async-pan zoomed. + if (!tab->IsAsyncPanZoomEnabled()) { + mFontSizeInflationEnabled = false; + return; + } + } else if (XRE_GetProcessType() == GeckoProcessType_Default) { + // We're in the master process. Cancel inflation if it's been + // explicitly disabled. + if (FontSizeInflationDisabledInMasterProcess()) { + mFontSizeInflationEnabled = false; + return; + } + } + } + + // XXXjwir3: + // See bug 706918, comment 23 for more information on this particular section + // of the code. We're using "screen size" in place of the size of the content + // area, because on mobile, these are close or equal. This will work for our + // purposes (bug 706198), but it will need to be changed in the future to be + // more correct when we bring the rest of the viewport code into platform. + // We actually want the size of the content area, in the event that we don't + // have any metadata about the width and/or height. On mobile, the screen size + // and the size of the content area are very close, or the same value. + // In XUL fennec, the content area is the size of the widget, but + // in native fennec, the content area is the size of the Gecko LayerView + // object. + + // TODO: + // Once bug 716575 has been resolved, this code should be changed so that it + // does the right thing on all platforms. + nsresult rv; + nsCOMPtr screenMgr = + do_GetService("@mozilla.org/gfx/screenmanager;1", &rv); + if (!NS_SUCCEEDED(rv)) { + mFontSizeInflationEnabled = false; + return; + } + + nsCOMPtr screen; + screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); + if (screen) { + int32_t screenLeft, screenTop, screenWidth, screenHeight; + screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight); + + nsViewportInfo vInf = + nsContentUtils::GetViewportInfo(GetDocument(), screenWidth, screenHeight); + + if (vInf.GetDefaultZoom() >= 1.0 || vInf.IsAutoSizeEnabled()) { + mFontSizeInflationEnabled = false; + return; + } + } + + mFontSizeInflationEnabled = true; +} + +bool +nsIPresShell::FontSizeInflationEnabled() +{ + if (mFontSizeInflationEnabledIsDirty) { + RecomputeFontSizeInflationEnabled(); + } + + return mFontSizeInflationEnabled; } void diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index c5515759e6e..fd0e4732b99 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -394,7 +394,8 @@ protected: void DoScrollContentIntoView(); /** - * Initialize cached font inflation preference values. + * Initialize cached font inflation preference values and do an initial + * computation to determine if font inflation is enabled. * * @see nsLayoutUtils::sFontSizeInflationEmPerLine * @see nsLayoutUtils::sFontSizeInflationMinTwips From cfd62fd2ecf0c3e82009519a1288ac6ec680a668 Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Thu, 16 May 2013 10:06:04 -0500 Subject: [PATCH 65/73] Bug 862763, Followup 1: Make MaybeReflowForInflationScreenWidthChange trigger a reflow when font inflation prefs change in either direction. [r=dbaron] --- dom/base/nsDOMWindowUtils.cpp | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 81900b6fb7e..0edbcd484b7 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -295,33 +295,34 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext) nsIPresShell* presShell = aPresContext->GetPresShell(); bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled(); presShell->NotifyFontSizeInflationEnabledIsDirty(); + bool changed = false; if (presShell && presShell->FontSizeInflationEnabled() && presShell->FontSizeInflationMinTwips() != 0) { - bool changed; aPresContext->ScreenWidthInchesForFontInflation(&changed); - changed = changed || - (fontInflationWasEnabled != presShell->FontSizeInflationEnabled()); - if (changed) { - nsCOMPtr container = aPresContext->GetContainer(); - nsCOMPtr docShell = do_QueryInterface(container); - if (docShell) { - nsCOMPtr cv; - docShell->GetContentViewer(getter_AddRefs(cv)); - nsCOMPtr mudv = do_QueryInterface(cv); - if (mudv) { - nsTArray > array; - mudv->AppendSubtree(array); - for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) { - nsCOMPtr shell; - nsCOMPtr cv = do_QueryInterface(array[i]); - cv->GetPresShell(getter_AddRefs(shell)); - if (shell) { - nsIFrame *rootFrame = shell->GetRootFrame(); - if (rootFrame) { - shell->FrameNeedsReflow(rootFrame, - nsIPresShell::eStyleChange, - NS_FRAME_IS_DIRTY); - } + } + + changed = changed || + (fontInflationWasEnabled != presShell->FontSizeInflationEnabled()); + if (changed) { + nsCOMPtr container = aPresContext->GetContainer(); + nsCOMPtr docShell = do_QueryInterface(container); + if (docShell) { + nsCOMPtr cv; + docShell->GetContentViewer(getter_AddRefs(cv)); + nsCOMPtr mudv = do_QueryInterface(cv); + if (mudv) { + nsTArray > array; + mudv->AppendSubtree(array); + for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) { + nsCOMPtr shell; + nsCOMPtr cv = do_QueryInterface(array[i]); + cv->GetPresShell(getter_AddRefs(shell)); + if (shell) { + nsIFrame *rootFrame = shell->GetRootFrame(); + if (rootFrame) { + shell->FrameNeedsReflow(rootFrame, + nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } } } From 6937a45eae09571f91588fcd1df4f89ba1a9159c Mon Sep 17 00:00:00 2001 From: Ian Melven Date: Thu, 30 Aug 2012 10:58:24 -0700 Subject: [PATCH 66/73] Bug 763879 - implement inline stylesheet blocking for CSP (r=dbaron) --- .../base/public/nsIContentSecurityPolicy.idl | 18 ++- content/base/src/CSPUtils.jsm | 17 ++- content/base/src/contentSecurityPolicy.js | 15 ++ content/base/src/nsStyleLinkElement.cpp | 6 + content/base/src/nsStyledElement.cpp | 6 + content/base/test/Makefile.in | 8 + content/base/test/file_CSP.css | 20 +++ content/base/test/file_CSP.sjs | 1 - .../base/test/file_CSP_inlinescript_main.html | 5 + .../base/test/file_CSP_inlinestyle_main.html | 63 ++++++++ .../file_CSP_inlinestyle_main.html^headers^ | 2 + ...e_CSP_inlinestyle_main_spec_compliant.html | 79 ++++++++++ ...inestyle_main_spec_compliant.html^headers^ | 2 + ...linestyle_main_spec_compliant_allowed.html | 84 +++++++++++ ..._main_spec_compliant_allowed.html^headers^ | 2 + content/base/test/file_CSP_main.html | 18 +-- content/base/test/test_CSP_inlinestyle.html | 142 ++++++++++++++++++ content/smil/nsSMILCSSValueType.cpp | 8 + content/xul/content/src/nsXULElement.cpp | 3 + layout/style/nsStyleUtil.cpp | 59 ++++++++ layout/style/nsStyleUtil.h | 18 +++ testing/mochitest/b2g.json | 1 + 22 files changed, 560 insertions(+), 17 deletions(-) create mode 100644 content/base/test/file_CSP.css create mode 100644 content/base/test/file_CSP_inlinestyle_main.html create mode 100644 content/base/test/file_CSP_inlinestyle_main.html^headers^ create mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant.html create mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ create mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html create mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ create mode 100644 content/base/test/test_CSP_inlinestyle.html diff --git a/content/base/public/nsIContentSecurityPolicy.idl b/content/base/public/nsIContentSecurityPolicy.idl index 8d8210a193e..1145b2d871d 100644 --- a/content/base/public/nsIContentSecurityPolicy.idl +++ b/content/base/public/nsIContentSecurityPolicy.idl @@ -13,7 +13,7 @@ interface nsIDocShell; * Describes an XPCOM component used to model an enforce CSPs. */ -[scriptable, uuid(91E1F257-914C-4D4F-902C-F67F772839AB)] +[scriptable, uuid(230b126d-afc3-4588-9794-3e135594d626)] interface nsIContentSecurityPolicy : nsISupports { @@ -62,6 +62,21 @@ interface nsIContentSecurityPolicy : nsISupports */ boolean getAllowsEval(out boolean shouldReportViolation); + /** + * Whether this policy allows in-page styles. + * This includes + +
Link tag (external) stylesheet test (should be green)
+
Attribute stylesheet test (should be green)
+
Inline stylesheet test (should be green)
+ + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + This should be green since the <set> should be allowed by CSP. + + + + + diff --git a/content/base/test/file_CSP_inlinestyle_main.html^headers^ b/content/base/test/file_CSP_inlinestyle_main.html^headers^ new file mode 100644 index 00000000000..4cabc325127 --- /dev/null +++ b/content/base/test/file_CSP_inlinestyle_main.html^headers^ @@ -0,0 +1,2 @@ +X-Content-Security-Policy: default-src 'self' +Cache-Control: no-cache diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html new file mode 100644 index 00000000000..a0d29698836 --- /dev/null +++ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html @@ -0,0 +1,79 @@ + + + + CSP inline script tests + + + + + + + + + + +
Link tag (external) stylesheet test (should be green)
+
Inline stylesheet test (should be black)
+
Attribute stylesheet test (should be black)
+
cssText test (should be black)
+
modify rule from style sheet via cssText(should be green)
+ + + + + + + This shouldn't be red since the animation should be blocked by CSP. + + + + + + + This shouldn't be red since the animation should be blocked by CSP. + + + + + + + This shouldn't be red since the animation should be blocked by CSP. + + + + + + This shouldn't be red since the <set> should be blocked by CSP. + + + + + diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ new file mode 100644 index 00000000000..7b6a2516792 --- /dev/null +++ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ @@ -0,0 +1,2 @@ +Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline' +Cache-Control: no-cache diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html new file mode 100644 index 00000000000..9b533ef0741 --- /dev/null +++ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html @@ -0,0 +1,84 @@ + + + + CSP inline script tests + + + + + + + + + + +
Link tag (external) stylesheet test (should be green)
+
Inline stylesheet test (should be green)
+
Attribute stylesheet test (should be green)
+
style.cssText test (should be green)
+
modify rule from style sheet via cssText(should be green)
+ + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + + This should be green since the animation should be allowed by CSP. + + + + + + This should be green since the <set> should be allowed by CSP. + + + + + diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ new file mode 100644 index 00000000000..621d2536b08 --- /dev/null +++ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ @@ -0,0 +1,2 @@ +Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' +Cache-Control: no-cache diff --git a/content/base/test/file_CSP_main.html b/content/base/test/file_CSP_main.html index 8951d4ac084..e117b1366df 100644 --- a/content/base/test/file_CSP_main.html +++ b/content/base/test/file_CSP_main.html @@ -5,21 +5,11 @@ + + + + - diff --git a/content/base/test/test_CSP_inlinestyle.html b/content/base/test/test_CSP_inlinestyle.html new file mode 100644 index 00000000000..dac0dfbcddf --- /dev/null +++ b/content/base/test/test_CSP_inlinestyle.html @@ -0,0 +1,142 @@ + + + + Test for Content Security Policy inline stylesheets stuff + + + + +

+ + + + + + + + + diff --git a/content/smil/nsSMILCSSValueType.cpp b/content/smil/nsSMILCSSValueType.cpp index 6798c74139f..9c13b942f77 100644 --- a/content/smil/nsSMILCSSValueType.cpp +++ b/content/smil/nsSMILCSSValueType.cpp @@ -15,6 +15,7 @@ #include "nsPresContext.h" #include "mozilla/dom/Element.h" #include "nsDebug.h" +#include "nsStyleUtil.h" using namespace mozilla::dom; @@ -391,6 +392,13 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID, return; } + nsIDocument* doc = aTargetElement->GetCurrentDoc(); + if (doc && !nsStyleUtil::CSPAllowsInlineStyle(doc->NodePrincipal(), + doc->GetDocumentURI(), + 0, aString, nullptr)) { + return; + } + nsStyleAnimation::Value parsedValue; if (ValueFromStringHelper(aPropID, aTargetElement, presContext, aString, parsedValue, aIsContextSensitive)) { diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 8cdea75cd93..9dab14522f1 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2305,6 +2305,9 @@ nsXULPrototypeElement::SetAttrAt(uint32_t aPos, const nsAString& aValue, nsCSSParser parser; // XXX Get correct Base URI (need GetBaseURI on *prototype* element) + // TODO: If we implement Content Security Policy for chrome documents + // as has been discussed, the CSP should be checked here to see if + // inline styles are allowed to be applied. parser.ParseStyleAttribute(aValue, aDocumentURI, aDocumentURI, // This is basically duplicating what // nsINode::NodePrincipal() does diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index 2e4ff24d121..b20148e377f 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -10,6 +10,7 @@ #include "nsReadableUtils.h" #include "nsCSSProps.h" #include "nsRuleNode.h" +#include "nsIContentSecurityPolicy.h" using namespace mozilla; @@ -415,3 +416,61 @@ nsStyleUtil::IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, !aChild->TextIsOnlyWhitespace()); } +/* static */ bool +nsStyleUtil::CSPAllowsInlineStyle(nsIPrincipal* aPrincipal, + nsIURI* aSourceURI, + uint32_t aLineNumber, + const nsSubstring& aStyleText, + nsresult* aRv) +{ + nsresult rv; + + if (aRv) { + *aRv = NS_OK; + } + + nsCOMPtr csp; + rv = aPrincipal->GetCsp(getter_AddRefs(csp)); + + if (NS_FAILED(rv)) { + if (aRv) + *aRv = rv; + return false; + } + + if (csp) { + bool inlineOK = true; + bool reportViolation = false; + rv = csp->GetAllowsInlineStyle(&reportViolation, &inlineOK); + if (NS_FAILED(rv)) { + if (aRv) + *aRv = rv; + return false; + } + + if (reportViolation) { + // Inline styles are not allowed by CSP, so report the violation + nsAutoCString asciiSpec; + aSourceURI->GetAsciiSpec(asciiSpec); + nsAutoString styleText(aStyleText); + + // cap the length of the style sample at 40 chars. + if (styleText.Length() > 40) { + styleText.Truncate(40); + styleText.Append(NS_LITERAL_STRING("...")); + } + + csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_STYLE, + NS_ConvertUTF8toUTF16(asciiSpec), + aStyleText, + aLineNumber); + } + + if (!inlineOK) { + // The inline style should be blocked. + return false; + } + } + // No CSP or a CSP that allows inline styles. + return true; +} diff --git a/layout/style/nsStyleUtil.h b/layout/style/nsStyleUtil.h index 4fdfe9db6a7..2da72d62c47 100644 --- a/layout/style/nsStyleUtil.h +++ b/layout/style/nsStyleUtil.h @@ -7,6 +7,8 @@ #include "nsCoord.h" #include "nsCSSProperty.h" +#include "nsIPrincipal.h" +#include "nsSubstring.h" #include "gfxFontFeatures.h" class nsCSSValue; @@ -90,6 +92,22 @@ public: static bool IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, bool aWhitespaceIsSignificant); + /* + * Does this principal have a CSP that blocks the application of + * inline styles ? Returns false if application of the style should + * be blocked. + * + * Note that the principal passed in here needs to be the principal + * of the document, not of the style sheet. The document's principal + * is where any Content Security Policy that should be used to + * block or allow inline styles will be located. + */ + static bool CSPAllowsInlineStyle(nsIPrincipal* aPrincipal, + nsIURI* aSourceURI, + uint32_t aLineNumber, + const nsSubstring& aStyleText, + nsresult* aRv); + }; diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 96724e3cf33..5b9ad44611c 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -27,6 +27,7 @@ "dom/tests/mochitest/ajax/jquery/test_jQuery.html":"", "content/base/test/test_CSP_inlinescript.html":"", + "content/base/test/test_CSP_inlinestyle.html":"", "content/base/test/test_XHRSendData.html":"", "content/base/test/test_XHR_parameters.html":"", "content/base/test/test_XHR_system.html":"", From 43cbacf69156b2fb95631f25e89e1483eef41549 Mon Sep 17 00:00:00 2001 From: Ian Melven Date: Thu, 16 May 2013 08:06:43 -0700 Subject: [PATCH 67/73] Bug 842657 - Flip the pref to enable the CSP 1.0 parser for Firefox (r=jst) --- browser/app/profile/firefox.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 0687a578dda..ad72605e322 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1230,6 +1230,9 @@ pref("social.toast-notifications.enabled", true); pref("dom.identity.enabled", false); +// Turn on the CSP 1.0 parser for Content Security Policy headers +pref("security.csp.speccompliant", true); + // Block insecure active content on https pages pref("security.mixed_content.block_active_content", true); From dcdda90f46b3336c9b2729031b712409c284923f Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 16 May 2013 11:15:07 -0400 Subject: [PATCH 68/73] Backed out 2 changesets (bug 763879, bug 842657) for landing with an r-. DONTBUILD Backed out changeset 254c1ac4ab8b (bug 842657) Backed out changeset 58a2011beeac (bug 763879) --- browser/app/profile/firefox.js | 3 - .../base/public/nsIContentSecurityPolicy.idl | 18 +-- content/base/src/CSPUtils.jsm | 17 +-- content/base/src/contentSecurityPolicy.js | 15 -- content/base/src/nsStyleLinkElement.cpp | 6 - content/base/src/nsStyledElement.cpp | 6 - content/base/test/Makefile.in | 8 - content/base/test/file_CSP.css | 20 --- content/base/test/file_CSP.sjs | 1 + .../base/test/file_CSP_inlinescript_main.html | 5 - .../base/test/file_CSP_inlinestyle_main.html | 63 -------- .../file_CSP_inlinestyle_main.html^headers^ | 2 - ...e_CSP_inlinestyle_main_spec_compliant.html | 79 ---------- ...inestyle_main_spec_compliant.html^headers^ | 2 - ...linestyle_main_spec_compliant_allowed.html | 84 ----------- ..._main_spec_compliant_allowed.html^headers^ | 2 - content/base/test/file_CSP_main.html | 18 ++- content/base/test/test_CSP_inlinestyle.html | 142 ------------------ content/smil/nsSMILCSSValueType.cpp | 8 - content/xul/content/src/nsXULElement.cpp | 3 - layout/style/nsStyleUtil.cpp | 59 -------- layout/style/nsStyleUtil.h | 18 --- testing/mochitest/b2g.json | 1 - 23 files changed, 17 insertions(+), 563 deletions(-) delete mode 100644 content/base/test/file_CSP.css delete mode 100644 content/base/test/file_CSP_inlinestyle_main.html delete mode 100644 content/base/test/file_CSP_inlinestyle_main.html^headers^ delete mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant.html delete mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ delete mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html delete mode 100644 content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ delete mode 100644 content/base/test/test_CSP_inlinestyle.html diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index ad72605e322..0687a578dda 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1230,9 +1230,6 @@ pref("social.toast-notifications.enabled", true); pref("dom.identity.enabled", false); -// Turn on the CSP 1.0 parser for Content Security Policy headers -pref("security.csp.speccompliant", true); - // Block insecure active content on https pages pref("security.mixed_content.block_active_content", true); diff --git a/content/base/public/nsIContentSecurityPolicy.idl b/content/base/public/nsIContentSecurityPolicy.idl index 1145b2d871d..8d8210a193e 100644 --- a/content/base/public/nsIContentSecurityPolicy.idl +++ b/content/base/public/nsIContentSecurityPolicy.idl @@ -13,7 +13,7 @@ interface nsIDocShell; * Describes an XPCOM component used to model an enforce CSPs. */ -[scriptable, uuid(230b126d-afc3-4588-9794-3e135594d626)] +[scriptable, uuid(91E1F257-914C-4D4F-902C-F67F772839AB)] interface nsIContentSecurityPolicy : nsISupports { @@ -62,21 +62,6 @@ interface nsIContentSecurityPolicy : nsISupports */ boolean getAllowsEval(out boolean shouldReportViolation); - /** - * Whether this policy allows in-page styles. - * This includes - -
Link tag (external) stylesheet test (should be green)
-
Attribute stylesheet test (should be green)
-
Inline stylesheet test (should be green)
- - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - This should be green since the <set> should be allowed by CSP. - - - - - diff --git a/content/base/test/file_CSP_inlinestyle_main.html^headers^ b/content/base/test/file_CSP_inlinestyle_main.html^headers^ deleted file mode 100644 index 4cabc325127..00000000000 --- a/content/base/test/file_CSP_inlinestyle_main.html^headers^ +++ /dev/null @@ -1,2 +0,0 @@ -X-Content-Security-Policy: default-src 'self' -Cache-Control: no-cache diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html deleted file mode 100644 index a0d29698836..00000000000 --- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - CSP inline script tests - - - - - - - - - - -
Link tag (external) stylesheet test (should be green)
-
Inline stylesheet test (should be black)
-
Attribute stylesheet test (should be black)
-
cssText test (should be black)
-
modify rule from style sheet via cssText(should be green)
- - - - - - - This shouldn't be red since the animation should be blocked by CSP. - - - - - - - This shouldn't be red since the animation should be blocked by CSP. - - - - - - - This shouldn't be red since the animation should be blocked by CSP. - - - - - - This shouldn't be red since the <set> should be blocked by CSP. - - - - - diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ deleted file mode 100644 index 7b6a2516792..00000000000 --- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant.html^headers^ +++ /dev/null @@ -1,2 +0,0 @@ -Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline' -Cache-Control: no-cache diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html deleted file mode 100644 index 9b533ef0741..00000000000 --- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - CSP inline script tests - - - - - - - - - - -
Link tag (external) stylesheet test (should be green)
-
Inline stylesheet test (should be green)
-
Attribute stylesheet test (should be green)
-
style.cssText test (should be green)
-
modify rule from style sheet via cssText(should be green)
- - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - - This should be green since the animation should be allowed by CSP. - - - - - - This should be green since the <set> should be allowed by CSP. - - - - - diff --git a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ b/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ deleted file mode 100644 index 621d2536b08..00000000000 --- a/content/base/test/file_CSP_inlinestyle_main_spec_compliant_allowed.html^headers^ +++ /dev/null @@ -1,2 +0,0 @@ -Content-Security-Policy: default-src 'self' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' -Cache-Control: no-cache diff --git a/content/base/test/file_CSP_main.html b/content/base/test/file_CSP_main.html index e117b1366df..8951d4ac084 100644 --- a/content/base/test/file_CSP_main.html +++ b/content/base/test/file_CSP_main.html @@ -5,11 +5,21 @@ - - - - + diff --git a/content/base/test/test_CSP_inlinestyle.html b/content/base/test/test_CSP_inlinestyle.html deleted file mode 100644 index dac0dfbcddf..00000000000 --- a/content/base/test/test_CSP_inlinestyle.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - Test for Content Security Policy inline stylesheets stuff - - - - -

- - - - - - - - - diff --git a/content/smil/nsSMILCSSValueType.cpp b/content/smil/nsSMILCSSValueType.cpp index 9c13b942f77..6798c74139f 100644 --- a/content/smil/nsSMILCSSValueType.cpp +++ b/content/smil/nsSMILCSSValueType.cpp @@ -15,7 +15,6 @@ #include "nsPresContext.h" #include "mozilla/dom/Element.h" #include "nsDebug.h" -#include "nsStyleUtil.h" using namespace mozilla::dom; @@ -392,13 +391,6 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID, return; } - nsIDocument* doc = aTargetElement->GetCurrentDoc(); - if (doc && !nsStyleUtil::CSPAllowsInlineStyle(doc->NodePrincipal(), - doc->GetDocumentURI(), - 0, aString, nullptr)) { - return; - } - nsStyleAnimation::Value parsedValue; if (ValueFromStringHelper(aPropID, aTargetElement, presContext, aString, parsedValue, aIsContextSensitive)) { diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 9dab14522f1..8cdea75cd93 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2305,9 +2305,6 @@ nsXULPrototypeElement::SetAttrAt(uint32_t aPos, const nsAString& aValue, nsCSSParser parser; // XXX Get correct Base URI (need GetBaseURI on *prototype* element) - // TODO: If we implement Content Security Policy for chrome documents - // as has been discussed, the CSP should be checked here to see if - // inline styles are allowed to be applied. parser.ParseStyleAttribute(aValue, aDocumentURI, aDocumentURI, // This is basically duplicating what // nsINode::NodePrincipal() does diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index b20148e377f..2e4ff24d121 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -10,7 +10,6 @@ #include "nsReadableUtils.h" #include "nsCSSProps.h" #include "nsRuleNode.h" -#include "nsIContentSecurityPolicy.h" using namespace mozilla; @@ -416,61 +415,3 @@ nsStyleUtil::IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, !aChild->TextIsOnlyWhitespace()); } -/* static */ bool -nsStyleUtil::CSPAllowsInlineStyle(nsIPrincipal* aPrincipal, - nsIURI* aSourceURI, - uint32_t aLineNumber, - const nsSubstring& aStyleText, - nsresult* aRv) -{ - nsresult rv; - - if (aRv) { - *aRv = NS_OK; - } - - nsCOMPtr csp; - rv = aPrincipal->GetCsp(getter_AddRefs(csp)); - - if (NS_FAILED(rv)) { - if (aRv) - *aRv = rv; - return false; - } - - if (csp) { - bool inlineOK = true; - bool reportViolation = false; - rv = csp->GetAllowsInlineStyle(&reportViolation, &inlineOK); - if (NS_FAILED(rv)) { - if (aRv) - *aRv = rv; - return false; - } - - if (reportViolation) { - // Inline styles are not allowed by CSP, so report the violation - nsAutoCString asciiSpec; - aSourceURI->GetAsciiSpec(asciiSpec); - nsAutoString styleText(aStyleText); - - // cap the length of the style sample at 40 chars. - if (styleText.Length() > 40) { - styleText.Truncate(40); - styleText.Append(NS_LITERAL_STRING("...")); - } - - csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_INLINE_STYLE, - NS_ConvertUTF8toUTF16(asciiSpec), - aStyleText, - aLineNumber); - } - - if (!inlineOK) { - // The inline style should be blocked. - return false; - } - } - // No CSP or a CSP that allows inline styles. - return true; -} diff --git a/layout/style/nsStyleUtil.h b/layout/style/nsStyleUtil.h index 2da72d62c47..4fdfe9db6a7 100644 --- a/layout/style/nsStyleUtil.h +++ b/layout/style/nsStyleUtil.h @@ -7,8 +7,6 @@ #include "nsCoord.h" #include "nsCSSProperty.h" -#include "nsIPrincipal.h" -#include "nsSubstring.h" #include "gfxFontFeatures.h" class nsCSSValue; @@ -92,22 +90,6 @@ public: static bool IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, bool aWhitespaceIsSignificant); - /* - * Does this principal have a CSP that blocks the application of - * inline styles ? Returns false if application of the style should - * be blocked. - * - * Note that the principal passed in here needs to be the principal - * of the document, not of the style sheet. The document's principal - * is where any Content Security Policy that should be used to - * block or allow inline styles will be located. - */ - static bool CSPAllowsInlineStyle(nsIPrincipal* aPrincipal, - nsIURI* aSourceURI, - uint32_t aLineNumber, - const nsSubstring& aStyleText, - nsresult* aRv); - }; diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 5b9ad44611c..96724e3cf33 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -27,7 +27,6 @@ "dom/tests/mochitest/ajax/jquery/test_jQuery.html":"", "content/base/test/test_CSP_inlinescript.html":"", - "content/base/test/test_CSP_inlinestyle.html":"", "content/base/test/test_XHRSendData.html":"", "content/base/test/test_XHR_parameters.html":"", "content/base/test/test_XHR_system.html":"", From aa114592bdb52df798d08b9e4e820a603f130fdb Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 16 May 2013 11:16:30 -0400 Subject: [PATCH 69/73] Bug 873038 - Remove the old MSVC PGO exclusions across the tree; r=glandium --- accessible/defs.mk | 3 --- content/mathml/defs.mk | 3 --- content/smil/defs.mk | 3 --- content/svg/defs.mk | 3 --- content/xslt/defs.mk | 3 --- editor/defs.mk | 3 --- embedding/defs.mk | 3 --- image/defs.mk | 3 --- ipc/defs.mk | 3 --- layout/mathml/defs.mk | 3 --- layout/svg/defs.mk | 3 --- media/webrtc/defs.mk | 3 --- parser/htmlparser/defs.mk | 3 --- rdf/defs.mk | 3 --- storage/defs.mk | 3 --- 15 files changed, 45 deletions(-) delete mode 100644 accessible/defs.mk delete mode 100644 content/mathml/defs.mk delete mode 100644 content/smil/defs.mk delete mode 100644 content/svg/defs.mk delete mode 100644 content/xslt/defs.mk delete mode 100644 editor/defs.mk delete mode 100644 embedding/defs.mk delete mode 100644 image/defs.mk delete mode 100644 ipc/defs.mk delete mode 100644 layout/mathml/defs.mk delete mode 100644 layout/svg/defs.mk delete mode 100644 media/webrtc/defs.mk delete mode 100644 parser/htmlparser/defs.mk delete mode 100644 rdf/defs.mk delete mode 100644 storage/defs.mk diff --git a/accessible/defs.mk b/accessible/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/accessible/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/content/mathml/defs.mk b/content/mathml/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/content/mathml/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/content/smil/defs.mk b/content/smil/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/content/smil/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/content/svg/defs.mk b/content/svg/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/content/svg/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/content/xslt/defs.mk b/content/xslt/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/content/xslt/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/editor/defs.mk b/editor/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/editor/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/embedding/defs.mk b/embedding/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/embedding/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/image/defs.mk b/image/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/image/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/ipc/defs.mk b/ipc/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/ipc/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/layout/mathml/defs.mk b/layout/mathml/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/layout/mathml/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/layout/svg/defs.mk b/layout/svg/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/layout/svg/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/media/webrtc/defs.mk b/media/webrtc/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/media/webrtc/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/parser/htmlparser/defs.mk b/parser/htmlparser/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/parser/htmlparser/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/rdf/defs.mk b/rdf/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/rdf/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif diff --git a/storage/defs.mk b/storage/defs.mk deleted file mode 100644 index 4e2c31152de..00000000000 --- a/storage/defs.mk +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(OS_TARGET),WINNT) -NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO -endif From 69ab2f85f35d2c34447aa68e5b7a75e172b832da Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 16 May 2013 08:53:28 -0700 Subject: [PATCH 70/73] Bug 872292 - Update progress bar styling. r=mbrubeck --- browser/metro/base/content/WebProgress.js | 4 +++ browser/metro/base/content/browser-ui.js | 1 + browser/metro/base/content/browser.xul | 4 ++- browser/metro/theme/browser.css | 31 +++++++++++++++-------- browser/metro/theme/defines.inc | 2 +- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/browser/metro/base/content/WebProgress.js b/browser/metro/base/content/WebProgress.js index 4658af8e1e4..e811ba20330 100644 --- a/browser/metro/base/content/WebProgress.js +++ b/browser/metro/base/content/WebProgress.js @@ -144,6 +144,9 @@ const WebProgress = { this._progressActive = true; + // display the track + Elements.progressContainer.removeAttribute("collapsed"); + // 'Whoosh' in this._progressCount = kProgressMarginStart; Elements.progress.style.width = this._progressCount + "%"; @@ -198,6 +201,7 @@ const WebProgress = { // Close out fade finished, reset if (data.propertyName == "opacity") { Elements.progress.style.width = "0px"; + Elements.progressContainer.setAttribute("collapsed", true); } }, }; diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index 8a116c80788..19aefd19201 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -46,6 +46,7 @@ let Elements = {}; ["appbar", "appbar"], ["contentViewport", "content-viewport"], ["progress", "progress-control"], + ["progressContainer", "progress-container"], ["contentNavigator", "content-navigator"], ["aboutFlyout", "about-flyoutpanel"], ["prefsFlyout", "prefs-flyoutpanel"], diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index 66107f14a98..dcde4315352 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -306,7 +306,9 @@ - + + + diff --git a/browser/metro/theme/browser.css b/browser/metro/theme/browser.css index a7206b0d206..240e39f6c97 100644 --- a/browser/metro/theme/browser.css +++ b/browser/metro/theme/browser.css @@ -9,23 +9,26 @@ %define forward_width 22px %define forward_spacing 12px -/* Sliding Toolbar/Tab Tray ------------------------------------------------- */ +/* Progress meter ------------------------------------------------- */ -#tray { - transition: transform @metro_animation_duration@ @metro_animation_easing@; - transform: translateY(-@tabs_height@); - width: 100%; -} - -#progress-control { +#progress-container { display: block; position: absolute; top: -@progress_height@; height: @progress_height@; - max-height: @progress_height@; - background: linear-gradient(to right, @progress_start_color@, @progress_end_color@); + width: 100%; + background-color: hsla(210,5%,80%,1); + box-shadow: 0 1px 0 hsla(210,5%,50%,.1) inset; -moz-user-focus: ignore; +} + +#progress-control { + display: block; + height: @progress_height@; + background-image: -moz-linear-gradient(left, hsla(200,100%,83%,.5), hsla(200,100%,83%,0)), -moz-linear-gradient(top, #1ab2ff, #0091ff); + border-right: 1px solid #0082e5; transition: width .3s ease-in; + -moz-user-focus: ignore; } #progress-control:-moz-dir(rtl) { @@ -37,6 +40,14 @@ transition: width .3s ease-in, .5s opacity ease-in; } +/* Sliding Toolbar/Tab Tray ------------------------------------------------- */ + +#tray { + transition: transform @metro_animation_duration@ @metro_animation_easing@; + transform: translateY(-@tabs_height@); + width: 100%; +} + /* in non-tabsonly mode the navigation bar and tab tray float over content. In tabsonly mode they are always visible and offset content. */ #tray:not([tabsonly]) { diff --git a/browser/metro/theme/defines.inc b/browser/metro/theme/defines.inc index 8f656b3e015..7d922145f19 100644 --- a/browser/metro/theme/defines.inc +++ b/browser/metro/theme/defines.inc @@ -22,7 +22,7 @@ %define toolbar_height 68px %define tabs_height 178px -%define progress_height 3px +%define progress_height 5px %define progress_start_color #0095dd %define progress_end_color #97cbff From d3baed76f496eda0b9964176a5141c84393b7248 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 16 May 2013 08:53:34 -0700 Subject: [PATCH 71/73] Bug 868217 - Hide sync flyout description when sync is setup properly. r=ally --- browser/metro/base/content/browser.xul | 8 ++++---- browser/metro/base/content/sync.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index dcde4315352..14676d1b011 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -379,10 +379,10 @@ - &sync.setup.description; - - - + &sync.setup.description; + + +