From 00d7367b44af558763efc2c8c123f8d9559bf967 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 23 Sep 2017 22:12:32 -0700 Subject: [PATCH 01/39] Bug 1404652: Part 1 - Add ChromeUtils.idleDispatch helper method. r=ehsan This is similar to Services.tm.idleDispatchToMainThread, but provides an IdleDeadline argument to its callbacks, the same way that Window.requestIdleCallback does. The IdleDeadline argument was necessary for my first attempt at this bug. It's not necessary for the current version, but I suspect it will be useful in other areas, and it also avoids some XPConnect overhead, so it's probably worth keeping. MozReview-Commit-ID: FtrbNkE7Vz5 --HG-- extra : rebase_source : d28973641e914c8d180f66125669aabc29ab857f --- dom/base/ChromeUtils.cpp | 107 +++++++++++++++++++++++++++++++++ dom/base/ChromeUtils.h | 7 +++ dom/base/IdleDeadline.cpp | 32 +++++++--- dom/base/IdleDeadline.h | 7 ++- dom/webidl/ChromeUtils.webidl | 9 +++ dom/webidl/IdleDeadline.webidl | 3 +- 6 files changed, 156 insertions(+), 9 deletions(-) diff --git a/dom/base/ChromeUtils.cpp b/dom/base/ChromeUtils.cpp index 908eb6bb54e1..24bbf98686fa 100644 --- a/dom/base/ChromeUtils.cpp +++ b/dom/base/ChromeUtils.cpp @@ -10,6 +10,10 @@ #include "mozilla/Base64.h" #include "mozilla/BasePrincipal.h" +#include "mozilla/TimeStamp.h" +#include "mozilla/dom/IdleDeadline.h" +#include "mozilla/dom/WindowBinding.h" // For IdleRequestCallback/Options +#include "nsThreadUtils.h" namespace mozilla { namespace dom { @@ -264,6 +268,109 @@ ChromeUtils::ShallowClone(GlobalObject& aGlobal, aRetval.set(obj); } +namespace { + class IdleDispatchRunnable final : public IdleRunnable + , public nsITimerCallback + { + public: + NS_DECL_ISUPPORTS_INHERITED + + IdleDispatchRunnable(nsIGlobalObject* aParent, + IdleRequestCallback& aCallback) + : IdleRunnable("ChromeUtils::IdleDispatch") + , mCallback(&aCallback) + , mParent(aParent) + {} + + NS_IMETHOD Run() override + { + if (mCallback) { + CancelTimer(); + + auto deadline = mDeadline - TimeStamp::ProcessCreation(); + + ErrorResult rv; + RefPtr idleDeadline = + new IdleDeadline(mParent, mTimedOut, deadline.ToMilliseconds()); + + mCallback->Call(*idleDeadline, rv, "ChromeUtils::IdleDispatch handler"); + mCallback = nullptr; + mParent = nullptr; + + rv.SuppressException(); + return rv.StealNSResult(); + } + return NS_OK; + } + + void SetDeadline(TimeStamp aDeadline) override + { + mDeadline = aDeadline; + } + + NS_IMETHOD Notify(nsITimer* aTimer) override + { + mTimedOut = true; + SetDeadline(TimeStamp::Now()); + return Run(); + } + + void SetTimer(uint32_t aDelay, nsIEventTarget* aTarget) override + { + MOZ_ASSERT(aTarget); + MOZ_ASSERT(!mTimer); + mTimer = do_CreateInstance(NS_TIMER_CONTRACTID); + if (mTimer) { + mTimer->SetTarget(aTarget); + mTimer->InitWithCallback(this, aDelay, nsITimer::TYPE_ONE_SHOT); + } + } + + protected: + virtual ~IdleDispatchRunnable() + { + CancelTimer(); + } + + private: + void CancelTimer() + { + if (mTimer) { + mTimer->Cancel(); + mTimer = nullptr; + } + } + + RefPtr mCallback; + nsCOMPtr mParent; + + nsCOMPtr mTimer; + + TimeStamp mDeadline{}; + bool mTimedOut = false; + }; + + NS_IMPL_ISUPPORTS_INHERITED(IdleDispatchRunnable, IdleRunnable, nsITimerCallback) +} // anonymous namespace + +/* static */ void +ChromeUtils::IdleDispatch(const GlobalObject& aGlobal, + IdleRequestCallback& aCallback, + const IdleRequestOptions& aOptions, + ErrorResult& aRv) +{ + nsCOMPtr global = do_QueryInterface(aGlobal.GetAsSupports()); + MOZ_ASSERT(global); + + auto runnable = MakeRefPtr(global, aCallback); + + if (aOptions.mTimeout.WasPassed()) { + aRv = NS_IdleDispatchToCurrentThread(runnable.forget(), aOptions.mTimeout.Value()); + } else { + aRv = NS_IdleDispatchToCurrentThread(runnable.forget()); + } +} + /* static */ void ChromeUtils::OriginAttributesToSuffix(dom::GlobalObject& aGlobal, const dom::OriginAttributesDictionary& aAttrs, diff --git a/dom/base/ChromeUtils.h b/dom/base/ChromeUtils.h index ce331bca6b5c..d25f2b8a168d 100644 --- a/dom/base/ChromeUtils.h +++ b/dom/base/ChromeUtils.h @@ -21,6 +21,8 @@ class HeapSnapshot; namespace dom { class ArrayBufferViewOrArrayBuffer; +class IdleRequestCallback; +struct IdleRequestOptions; class PrecompiledScript; class Promise; @@ -145,6 +147,11 @@ public: JS::HandleObject aTarget, JS::MutableHandleObject aRetval, ErrorResult& aRv); + + static void IdleDispatch(const GlobalObject& global, + IdleRequestCallback& callback, + const IdleRequestOptions& options, + ErrorResult& aRv); }; } // namespace dom diff --git a/dom/base/IdleDeadline.cpp b/dom/base/IdleDeadline.cpp index ef475e5433b6..462ac192ef06 100644 --- a/dom/base/IdleDeadline.cpp +++ b/dom/base/IdleDeadline.cpp @@ -17,7 +17,7 @@ namespace mozilla { namespace dom { -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IdleDeadline, mWindow) +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IdleDeadline, mWindow, mGlobal) NS_IMPL_CYCLE_COLLECTING_ADDREF(IdleDeadline) NS_IMPL_CYCLE_COLLECTING_RELEASE(IdleDeadline) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleDeadline) @@ -30,6 +30,17 @@ IdleDeadline::IdleDeadline(nsPIDOMWindowInner* aWindow, bool aDidTimeout, : mWindow(aWindow) , mDidTimeout(aDidTimeout) , mDeadline(aDeadline) +{ + bool hasHadSHO; + mGlobal = aWindow->GetDoc()->GetScriptHandlingObject(hasHadSHO); +} + +IdleDeadline::IdleDeadline(nsIGlobalObject* aGlobal, bool aDidTimeout, + DOMHighResTimeStamp aDeadline) + : mWindow(nullptr) + , mGlobal(aGlobal) + , mDidTimeout(aDidTimeout) + , mDeadline(aDeadline) { } @@ -50,14 +61,21 @@ IdleDeadline::TimeRemaining() return 0.0; } - RefPtr performance = mWindow->GetPerformance(); - if (!performance) { - // If there is no performance object the window is partially torn - // down, so we can safely say that there is no time remaining. - return 0.0; + if (mWindow) { + RefPtr performance = mWindow->GetPerformance(); + if (!performance) { + // If there is no performance object the window is partially torn + // down, so we can safely say that there is no time remaining. + return 0.0; + } + + return std::max(mDeadline - performance->Now(), 0.0); } - return std::max(mDeadline - performance->Now(), 0.0); + // If there's no window, we're in a system scope, and can just use + // a high-resolution TimeStamp::Now(); + auto timestamp = TimeStamp::Now() - TimeStamp::ProcessCreation(); + return std::max(mDeadline - timestamp.ToMilliseconds(), 0.0); } bool diff --git a/dom/base/IdleDeadline.h b/dom/base/IdleDeadline.h index 000d6da8a4f0..0a2a46d2345c 100644 --- a/dom/base/IdleDeadline.h +++ b/dom/base/IdleDeadline.h @@ -17,6 +17,7 @@ #include "nsDOMNavigationTiming.h" #include "nsWrapperCache.h" +class nsIGlobalObject; class nsPIDOMWindowInner; namespace mozilla { @@ -30,7 +31,10 @@ public: IdleDeadline(nsPIDOMWindowInner* aWindow, bool aDidTimeout, DOMHighResTimeStamp aDeadline); - nsPIDOMWindowInner* GetParentObject() const { return mWindow; } + IdleDeadline(nsIGlobalObject* aGlobal, bool aDidTimeout, + DOMHighResTimeStamp aDeadline); + + nsIGlobalObject* GetParentObject() const { return mGlobal; } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; @@ -45,6 +49,7 @@ private: ~IdleDeadline(); nsCOMPtr mWindow; + nsCOMPtr mGlobal; const bool mDidTimeout; const DOMHighResTimeStamp mDeadline; }; diff --git a/dom/webidl/ChromeUtils.webidl b/dom/webidl/ChromeUtils.webidl index 8f3a76ae9934..156d2ad5b5f6 100644 --- a/dom/webidl/ChromeUtils.webidl +++ b/dom/webidl/ChromeUtils.webidl @@ -101,6 +101,15 @@ interface ChromeUtils : ThreadSafeChromeUtils { */ [Throws] static object shallowClone(object obj, optional object? target = null); + + /** + * Dispatches the given callback to the main thread when it would be + * otherwise idle. Similar to Window.requestIdleCallback, but not bound to a + * particular DOM windw. + */ + [Throws] + static void idleDispatch(IdleRequestCallback callback, + optional IdleRequestOptions options); }; /** diff --git a/dom/webidl/IdleDeadline.webidl b/dom/webidl/IdleDeadline.webidl index f15eafa0e940..7a8e4555a71e 100644 --- a/dom/webidl/IdleDeadline.webidl +++ b/dom/webidl/IdleDeadline.webidl @@ -7,7 +7,8 @@ * https://w3c.github.io/requestidlecallback/ */ -[Func="nsGlobalWindow::IsRequestIdleCallbackEnabled"] +[Exposed=(Window,System), + Func="nsGlobalWindow::IsRequestIdleCallbackEnabled"] interface IdleDeadline { DOMHighResTimeStamp timeRemaining(); readonly attribute boolean didTimeout; From 2fc1dbc67c5405bee31ef3c1d4c1b3768bb95918 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 28 Sep 2017 20:14:17 -0700 Subject: [PATCH 02/39] Bug 1404652: Part 2 - Coalesce multiple event dispatches into a single message during an idle slice. r=zombie Sending MessageManager messages is expensive, but a lot of the overhead is per-message more than it's tied to the complexity of the message. In particular: - Each sendAsyncMessage call incurs separate XPConnect method call overhead. - Each message requires acquiring a lock, and separate message setup overhead for IPC. - The message data itself must be structured cloned, which requires (expensive) allocation of buffers to hold the serialized data. Each buffer segment is 4KB, which is generally enough to hold multiple serialized messages, so coalescing messages means fewer buffer allocations. Moving some of this work into idle slices also means less likelihood of interfering with UI responsiveness. MozReview-Commit-ID: 5SAMZNLVaY3 --HG-- extra : rebase_source : 752f7a8dff392c127b2cb3207c7509a57c734f32 --- .../components/extensions/ExtensionParent.jsm | 6 +- .../components/extensions/MessageChannel.jsm | 319 +++++++++++++++--- 2 files changed, 268 insertions(+), 57 deletions(-) diff --git a/toolkit/components/extensions/ExtensionParent.jsm b/toolkit/components/extensions/ExtensionParent.jsm index eb4255313d30..310c48640919 100644 --- a/toolkit/components/extensions/ExtensionParent.jsm +++ b/toolkit/components/extensions/ExtensionParent.jsm @@ -771,6 +771,7 @@ ParentAPIManager = { let {childId} = data; let handlingUserInput = false; + let lowPriority = data.path.startsWith("webRequest."); function listener(...listenerArgs) { return context.sendMessage( @@ -781,9 +782,12 @@ ParentAPIManager = { handlingUserInput, listenerId: data.listenerId, path: data.path, - args: new StructuredCloneHolder(listenerArgs), + get args() { + return new StructuredCloneHolder(listenerArgs); + }, }, { + lowPriority, recipient: {childId}, }).then(result => { return result && result.deserialize(global); diff --git a/toolkit/components/extensions/MessageChannel.jsm b/toolkit/components/extensions/MessageChannel.jsm index 0581ff44d3d1..0242c9b376d5 100644 --- a/toolkit/components/extensions/MessageChannel.jsm +++ b/toolkit/components/extensions/MessageChannel.jsm @@ -112,6 +112,52 @@ const { const {DEBUG} = AppConstants; +// Idle callback timeout for low-priority message dispatch. +const LOW_PRIORITY_TIMEOUT_MS = 250; + +const MESSAGE_MESSAGES = "MessageChannel:Messages"; +const MESSAGE_RESPONSE = "MessageChannel:Response"; + +// ESLint can't tell that these are referenced, so tell it that they're +// exported to make it happy. +/* exported _deferredResult, _makeDeferred */ +var _deferredResult; +var _makeDeferred = (resolve, reject) => { + // We use arrow functions here and refer to the outer variables via + // `this`, to avoid a lexical name lookup. Yes, it makes a difference. + // No, I don't like it any more than you do. + this._deferredResult.resolve = resolve; + this._deferredResult.reject = reject; +}; + +/** + * Helper to create a new Promise without allocating any closures to + * receive its resolution functions. + * + * I know what you're thinking: "This is crazy. There is no possible way + * this can be necessary. Just use the ordinary Promise constructor the + * way it was meant to be used, you lunatic." + * + * And, against all odds, it turns out that you're wrong. Creating + * lambdas to receive promise resolution functions consistently turns + * out to be one of the most expensive parts of message dispatch in this + * code. + * + * So we do the stupid micro-optimization, and try to live with + * ourselves for it. + * + * (See also bug 1404950.) + * + * @returns {object} + */ +let Deferred = () => { + let res = {}; + this._deferredResult = res; + res.promise = new Promise(this._makeDeferred); + this._deferredResult = null; + return res; +}; + /** * Handles the mapping and dispatching of messages to their registered * handlers. There is one broker per message manager and class of @@ -149,14 +195,20 @@ class FilteringMessageManager { } /** - * Receives a message from our message manager, maps it to a handler, and - * passes the result to our message callback. + * Receives a set of messages from our message manager, maps each to a + * handler, and passes the results to our message callbacks. */ receiveMessage({data, target}) { - let handlers = Array.from(this.getHandlers(data.messageName, data.sender || null, data.recipient)); + data.forEach(msg => { + if (msg) { + let handlers = Array.from(this.getHandlers(msg.messageName, + msg.sender || null, + msg.recipient)); - data.target = target; - this.callback(handlers, data); + msg.target = target; + this.callback(handlers, msg); + } + }); } /** @@ -173,8 +225,8 @@ class FilteringMessageManager { * getHandlers(messageName, sender, recipient) { let handlers = this.handlers.get(messageName) || new Set(); for (let handler of handlers) { - if (MessageChannel.matchesFilter(handler.messageFilterStrict || {}, recipient) && - MessageChannel.matchesFilter(handler.messageFilterPermissive || {}, recipient, false) && + if (MessageChannel.matchesFilter(handler.messageFilterStrict || null, recipient) && + MessageChannel.matchesFilter(handler.messageFilterPermissive || null, recipient, false) && (!handler.filterMessage || handler.filterMessage(sender, recipient))) { yield handler; } @@ -218,10 +270,86 @@ class FilteringMessageManager { } /** - * A simplified subclass of FilteringMessageManager that only supports - * one handler per message, and does not support filtering. + * A message dispatch and response manager that wrapse a single native + * message manager. Handles dispatching messages through the manager + * (optionally coalescing several low-priority messages and dispatching + * them during an idle slice), and mapping their responses to the + * appropriate response callbacks. + * + * Note that this is a simplified subclass of FilteringMessageManager + * that only supports one handler per message, and does not support + * filtering. */ class ResponseManager extends FilteringMessageManager { + constructor(messageName, callback, messageManager) { + super(messageName, callback, messageManager); + + this.idleMessages = []; + this.idleScheduled = false; + this.onIdle = this.onIdle.bind(this); + } + + /** + * Schedules a new idle callback to dispatch pending low-priority + * messages, if one is not already scheduled. + */ + scheduleIdleCallback() { + if (!this.idleScheduled) { + ChromeUtils.idleDispatch(this.onIdle, {timeout: LOW_PRIORITY_TIMEOUT_MS}); + this.idleScheduled = true; + } + } + + /** + * Called when the event queue is idle, and dispatches any pending + * low-priority messages in a single chunk. + * + * @param {IdleDeadline} deadline + */ + onIdle(deadline) { + this.idleScheduled = false; + + let messages = this.idleMessages; + this.idleMessages = []; + + let msgs = messages.map(msg => msg.getMessage()); + try { + this.messageManager.sendAsyncMessage(MESSAGE_MESSAGES, msgs); + } catch (e) { + for (let msg of messages) { + msg.reject(e); + } + } + } + + /** + * Sends a message through our wrapped message manager, or schedules + * it for low-priority dispatch during an idle callback. + * + * @param {any} message + * The message to send. + * @param {object} [options] + * Message dispatch options. + * @param {boolean} [options.lowPriority = false] + * If true, dispatches the message in a single chunk with other + * low-priority messages the next time the event queue is idle. + */ + sendMessage(message, options = {}) { + if (options.lowPriority) { + this.idleMessages.push(message); + this.scheduleIdleCallback(); + } else { + this.messageManager.sendAsyncMessage(MESSAGE_MESSAGES, [message.getMessage()]); + } + } + + receiveMessage({data, target}) { + data.target = target; + + this.callback(this.handlers.get(data.messageName), + data); + } + * getHandlers(messageName, sender, recipient) { let handler = this.handlers.get(messageName); if (handler) { @@ -291,11 +419,12 @@ class FilteringMessageManagerMap extends Map { * @returns {FilteringMessageManager} */ get(target) { - if (this.has(target)) { - return super.get(target); + let broker = super.get(target); + if (broker) { + return broker; } - let broker = new this._constructor(this.messageName, this.callback, target); + broker = new this._constructor(this.messageName, this.callback, target); this.set(target, broker); if (target instanceof Ci.nsIDOMEventTarget) { @@ -310,8 +439,102 @@ class FilteringMessageManagerMap extends Map { } } -const MESSAGE_MESSAGE = "MessageChannel:Message"; -const MESSAGE_RESPONSE = "MessageChannel:Response"; +/** + * Represents a message being sent through a MessageChannel, which may + * or may not have been dispatched yet, and is pending a response. + * + * When a response has been received, or the message has been canceled, + * this class is responsible for settling the response promise as + * appropriate. + * + * @param {number} channelId + * The unique ID for this message. + * @param {any} message + * The message contents. + * @param {object} sender + * An object describing the sender of the message, used by + * `abortResponses` to determine whether the message should be + * aborted. + * @param {ResponseManager} broker + * The response broker on which we're expected to receive a + * reply. + */ +class PendingMessage { + constructor(channelId, message, sender, broker) { + this.channelId = channelId; + this.message = message; + this.sender = sender; + this.broker = broker; + this.deferred = Deferred(); + + MessageChannel.pendingResponses.add(this); + } + + /** + * Cleans up after this message once we've received or aborted a + * response. + */ + cleanup() { + if (this.broker) { + this.broker.removeHandler(this.channelId, this); + MessageChannel.pendingResponses.delete(this); + + this.message = null; + this.broker = null; + } + } + + /** + * Returns the promise which will resolve when we've received or + * aborted a response to this message. + */ + get promise() { + return this.deferred.promise; + } + + /** + * Resolves the message's response promise, and cleans up. + * + * @param {any} value + */ + resolve(value) { + this.cleanup(); + this.deferred.resolve(value); + } + + /** + * Rejects the message's response promise, and cleans up. + * + * @param {any} value + */ + reject(value) { + this.cleanup(); + this.deferred.reject(value); + } + + get messageManager() { + return this.broker.messageManager; + } + + /** + * Returns the contents of the message to be sent over a message + * manager, and registers the response with our response broker. + * + * Returns null if the response has already been canceled, and the + * message should not be sent. + * + * @returns {any} + */ + getMessage() { + let msg = null; + if (this.broker) { + this.broker.addHandler(this.channelId, this); + msg = this.message; + this.message = null; + } + return msg; + } +} this.MessageChannel = { init() { @@ -319,7 +542,7 @@ this.MessageChannel = { Services.obs.addObserver(this, "message-manager-disconnect"); this.messageManagers = new FilteringMessageManagerMap( - MESSAGE_MESSAGE, this._handleMessage.bind(this)); + MESSAGE_MESSAGES, this._handleMessage.bind(this)); this.responseManagers = new FilteringMessageManagerMap( MESSAGE_RESPONSE, this._handleResponse.bind(this), @@ -436,7 +659,7 @@ this.MessageChannel = { * and the behavior varies depending on the value of the `strict` * parameter. * - * @param {object} filter + * @param {object?} filter * The filter object to match against. * @param {object} data * The data object being matched. @@ -448,6 +671,9 @@ this.MessageChannel = { * @returns {boolean} True if the objects match. */ matchesFilter(filter, data, strict = true) { + if (!filter) { + return true; + } if (strict) { return Object.keys(filter).every(key => { return key in data && data[key] === filter[key]; @@ -575,7 +801,12 @@ this.MessageChannel = { * message to the sender, and as a filter to prematurely * abort responses when the sender is being destroyed. * @see `abortResponses`. - * @param {integer} [options.responseType=RESPONSE_SINGLE] + * @param {boolean} [options.lowPriority = false] + * If true, treat this as a low-priority message, and attempt to + * send it in the same chunk as other messages to the same target + * the next time the event queue is idle. This option reduces + * messaging overhead at the expense of adding some latency. + * @param {integer} [options.responseType = RESPONSE_SINGLE] * Specifies the type of response expected. See the `RESPONSE_*` * contents for details. * @returns {Promise} @@ -591,7 +822,7 @@ this.MessageChannel = { if (responseType == this.RESPONSE_NONE) { try { - target.sendAsyncMessage(MESSAGE_MESSAGE, message); + target.sendAsyncMessage(MESSAGE_MESSAGES, [message]); } catch (e) { // Caller is not expecting a reply, so dump the error to the console. Cu.reportError(e); @@ -600,36 +831,15 @@ this.MessageChannel = { return Promise.resolve(); // Not expecting any reply. } - let deferred = {}; - deferred.promise = new Promise((resolve, reject) => { - deferred.resolve = resolve; - deferred.reject = reject; - }); - deferred.sender = recipient; - deferred.messageManager = target; - deferred.channelId = channelId; - - // The channel ID is used as the message name when routing responses. - // Add a message listener to the response broker, and remove it once - // we've gotten (or canceled) a response. let broker = this.responseManagers.get(target); - broker.addHandler(channelId, deferred); - - this.pendingResponses.add(deferred); - - let cleanup = () => { - broker.removeHandler(channelId, deferred); - this.pendingResponses.delete(deferred); - }; - deferred.promise.then(cleanup, cleanup); - - try { - target.sendAsyncMessage(MESSAGE_MESSAGE, message); - } catch (e) { - deferred.reject(e); - } + let pending = new PendingMessage(channelId, message, recipient, broker); message = null; - return deferred.promise; + try { + broker.sendMessage(pending, options); + } catch (e) { + pending.reject(e); + } + return pending.promise; }, _callHandlers(handlers, data) { @@ -781,29 +991,26 @@ this.MessageChannel = { /** * Handles message callbacks from the response brokers. * - * Each handler object is a deferred object created by `sendMessage`, and - * should be resolved or rejected based on the contents of the response. - * - * @param {Array} handlers + * @param {MessageHandler?} handler + * A deferred object created by `sendMessage`, to be resolved + * or rejected based on the contents of the response. * @param {object} data * @param {nsIMessageSender|{messageManager:nsIMessageSender}} data.target */ - _handleResponse(handlers, data) { + _handleResponse(handler, data) { // If we have an error at this point, we have handler to report it to, // so just log it. - if (handlers.length == 0) { + if (!handler) { if (this.abortedResponses.has(data.messageName)) { this.abortedResponses.delete(data.messageName); Services.console.logStringMessage(`Ignoring response to aborted listener for ${data.messageName}`); } else { Cu.reportError(`No matching message response handler for ${data.messageName}`); } - } else if (handlers.length > 1) { - Cu.reportError(`Multiple matching response handlers for ${data.messageName}`); } else if (data.result === this.RESULT_SUCCESS) { - handlers[0].resolve(data.value); + handler.resolve(data.value); } else { - handlers[0].reject(data.error); + handler.reject(data.error); } }, From 87b8d9ecb912943631f327ab42122ffc7c890ede Mon Sep 17 00:00:00 2001 From: "Kevin Pellet (Ilphrin)" Date: Wed, 11 Oct 2017 19:06:10 -0400 Subject: [PATCH 03/39] Bug 1406488 - Use a set instead of array to store current visits in `_recordToPlaceInfo` r=kitcambridge MozReview-Commit-ID: LW6Gg7i5lun --- services/sync/modules/engines/history.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/sync/modules/engines/history.js b/services/sync/modules/engines/history.js index 9571c2cdb071..53e2e1319c2f 100644 --- a/services/sync/modules/engines/history.js +++ b/services/sync/modules/engines/history.js @@ -245,16 +245,17 @@ HistoryStore.prototype = { // the same timestamp and type as a local one won't get applied. // To avoid creating new objects, we rewrite the query result so we // can simply check for containment below. - let curVisits = []; + let curVisitsAsArray = []; + let curVisits = new Set(); try { - curVisits = await PlacesSyncUtils.history.fetchVisitsForURL(record.histUri); + curVisitsAsArray = await PlacesSyncUtils.history.fetchVisitsForURL(record.histUri); } catch (e) { this._log.error("Error while fetching visits for URL ${record.histUri}", record.histUri); } let i, k; - for (i = 0; i < curVisits.length; i++) { - curVisits[i] = curVisits[i].date + "," + curVisits[i].type; + for (i = 0; i < curVisitsAsArray.length; i++) { + curVisits.add(curVisitsAsArray[i].date + "," + curVisitsAsArray[i].type); } // Walk through the visits, make sure we have sound data, and eliminate @@ -282,7 +283,7 @@ HistoryStore.prototype = { let visitDateAsPRTime = PlacesUtils.toPRTime(visit.date); let visitKey = visitDateAsPRTime + "," + visit.type; - if (curVisits.indexOf(visitKey) != -1) { + if (curVisits.has(visitKey)) { // Visit is a dupe, don't increment 'k' so the element will be // overwritten. continue; @@ -290,7 +291,7 @@ HistoryStore.prototype = { // Note the visit key, so that we don't add duplicate visits with // clamped timestamps. - curVisits.push(visitKey); + curVisits.add(visitKey); visit.transition = visit.type; k += 1; From fdf09b88f255a90e81cf30ec97c49b6904af3c6d Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 12 Oct 2017 13:10:27 +1300 Subject: [PATCH 04/39] Bug 1261175. r=tnikkel, a=abillings --- view/nsViewManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index f3540f3478da..230512c0dcc0 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -100,7 +100,7 @@ nsViewManager::~nsViewManager() gViewManagers = nullptr; } - mPresShell = nullptr; + MOZ_RELEASE_ASSERT(!mPresShell, "Releasing nsViewManager without having called Destroy on the PresShell!"); } // We don't hold a reference to the presentation context because it From fa5fde2e25b2899b5f6d68a07b0bcfcb485fa9d5 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:08 -0400 Subject: [PATCH 05/39] Bug 1383747 - Add crashtest. r=me --HG-- extra : rebase_source : 82d9e01850c972d5228accacd90cf38e407136c8 --- editor/libeditor/crashtests/1383747.html | 15 +++++++++++++++ editor/libeditor/crashtests/crashtests.list | 1 + 2 files changed, 16 insertions(+) create mode 100644 editor/libeditor/crashtests/1383747.html diff --git a/editor/libeditor/crashtests/1383747.html b/editor/libeditor/crashtests/1383747.html new file mode 100644 index 000000000000..1c926cc7eaa4 --- /dev/null +++ b/editor/libeditor/crashtests/1383747.html @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index 8ada7b4685f7..a48c98d2d1a7 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -79,6 +79,7 @@ load 1350772.html load 1366176.html load 1375131.html load 1381541.html +load 1383747.html load 1383755.html load 1388075.html load 1402469.html From 2517ed27334e8648418bfdbd985ae6ce751aa151 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:09 -0400 Subject: [PATCH 06/39] Bug 1384161 - Add crashtest. r=me --HG-- extra : rebase_source : 2916754a521a451766b1b154c8f80e91dca8ab88 --- editor/libeditor/crashtests/1384161.html | 17 +++++++++++++++++ editor/libeditor/crashtests/crashtests.list | 1 + 2 files changed, 18 insertions(+) create mode 100644 editor/libeditor/crashtests/1384161.html diff --git a/editor/libeditor/crashtests/1384161.html b/editor/libeditor/crashtests/1384161.html new file mode 100644 index 000000000000..c7d8ccc2920b --- /dev/null +++ b/editor/libeditor/crashtests/1384161.html @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index a48c98d2d1a7..1782f910fe82 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -81,6 +81,7 @@ load 1375131.html load 1381541.html load 1383747.html load 1383755.html +load 1384161.html load 1388075.html load 1402469.html load 1402904.html From fee107246e89bef7d11a0f26150334676534804b Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:09 -0400 Subject: [PATCH 07/39] Bug 1383763 - Add crashtest. r=me --HG-- extra : rebase_source : 64f0ebc53170c3b8871f77365829bbdbc5c094eb --- editor/libeditor/crashtests/1383763.html | 17 +++++++++++++++++ editor/libeditor/crashtests/crashtests.list | 1 + 2 files changed, 18 insertions(+) create mode 100644 editor/libeditor/crashtests/1383763.html diff --git a/editor/libeditor/crashtests/1383763.html b/editor/libeditor/crashtests/1383763.html new file mode 100644 index 000000000000..a97d68536868 --- /dev/null +++ b/editor/libeditor/crashtests/1383763.html @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index 1782f910fe82..e71472c78c0b 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -81,6 +81,7 @@ load 1375131.html load 1381541.html load 1383747.html load 1383755.html +load 1383763.html load 1384161.html load 1388075.html load 1402469.html From f5ad9c3d4455750cd4388e29fe5968bd1c4067e8 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:09 -0400 Subject: [PATCH 08/39] Bug 1348882 - Add crashtest. r=me --HG-- extra : rebase_source : d6dfdc7752b99992f26bca05e983478104b0aebd --- dom/workers/test/crashtests/1348882.html | 18 ++++++++++++++++++ dom/workers/test/crashtests/crashtests.list | 1 + 2 files changed, 19 insertions(+) create mode 100644 dom/workers/test/crashtests/1348882.html diff --git a/dom/workers/test/crashtests/1348882.html b/dom/workers/test/crashtests/1348882.html new file mode 100644 index 000000000000..e0288c4ccbcc --- /dev/null +++ b/dom/workers/test/crashtests/1348882.html @@ -0,0 +1,18 @@ + + + + + + + diff --git a/dom/workers/test/crashtests/crashtests.list b/dom/workers/test/crashtests/crashtests.list index a7518d3c2f46..8fb677aa57cc 100644 --- a/dom/workers/test/crashtests/crashtests.list +++ b/dom/workers/test/crashtests/crashtests.list @@ -3,3 +3,4 @@ load 943516.html load 1153636.html load 1158031.html load 1228456.html +load 1348882.html From fa211766ae464aefc9037e1c689ce20bb8e9e349 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:09 -0400 Subject: [PATCH 09/39] Bug 1278305 - Add crashtest. r=me --HG-- extra : rebase_source : c3a14fcd3c6c089ea9e0de4eaee1a42761d563a3 --- gfx/tests/crashtests/1278305.html | 20 ++++++++++++++++++++ gfx/tests/crashtests/crashtests.list | 1 + 2 files changed, 21 insertions(+) create mode 100644 gfx/tests/crashtests/1278305.html diff --git a/gfx/tests/crashtests/1278305.html b/gfx/tests/crashtests/1278305.html new file mode 100644 index 000000000000..a068cf35f3b0 --- /dev/null +++ b/gfx/tests/crashtests/1278305.html @@ -0,0 +1,20 @@ + + + + +
+ diff --git a/gfx/tests/crashtests/crashtests.list b/gfx/tests/crashtests/crashtests.list index 23d998cd5247..7ad2436b14ec 100644 --- a/gfx/tests/crashtests/crashtests.list +++ b/gfx/tests/crashtests/crashtests.list @@ -131,6 +131,7 @@ load 1134549-1.svg load balinese-letter-spacing.html load 1216832-1.html load 1225125-1.html +load 1278305.html load 1308394.html load 1317403-1.html # bug 1331533 load 1325159-1.html From 60909897719176fe6c4d2ec5e6a3924d419b7eb1 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 11 Oct 2017 19:54:10 -0400 Subject: [PATCH 10/39] Bug 1393171 - Add crashtest. r=me --HG-- extra : rebase_source : 76957b4f171ebf0de582eeffc73330b71425f363 --- editor/libeditor/crashtests/1393171.html | 10 ++++++++++ editor/libeditor/crashtests/crashtests.list | 1 + 2 files changed, 11 insertions(+) create mode 100644 editor/libeditor/crashtests/1393171.html diff --git a/editor/libeditor/crashtests/1393171.html b/editor/libeditor/crashtests/1393171.html new file mode 100644 index 000000000000..0aca3304e768 --- /dev/null +++ b/editor/libeditor/crashtests/1393171.html @@ -0,0 +1,10 @@ + +
+ + diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index e71472c78c0b..30849e58a609 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -84,6 +84,7 @@ load 1383755.html load 1383763.html load 1384161.html load 1388075.html +load 1393171.html load 1402469.html load 1402904.html load 1405747.html From a0a80f919e501a07e94d2b9d9358273d49c61a3f Mon Sep 17 00:00:00 2001 From: sotaro Date: Thu, 12 Oct 2017 10:13:10 +0900 Subject: [PATCH 11/39] Bug 1405481 - Push canvas updates to the compositor on empty transactions r=jrmuizel --- gfx/layers/ipc/PWebRenderBridge.ipdl | 3 ++ gfx/layers/wr/WebRenderBridgeChild.cpp | 22 ++++++++++++ gfx/layers/wr/WebRenderBridgeChild.h | 3 ++ gfx/layers/wr/WebRenderBridgeParent.cpp | 42 +++++++++++++++++++++++ gfx/layers/wr/WebRenderBridgeParent.h | 8 +++++ gfx/layers/wr/WebRenderCommandBuilder.cpp | 11 ++++++ gfx/layers/wr/WebRenderCommandBuilder.h | 2 ++ gfx/layers/wr/WebRenderLayerManager.cpp | 34 +++++++++++------- 8 files changed, 113 insertions(+), 12 deletions(-) diff --git a/gfx/layers/ipc/PWebRenderBridge.ipdl b/gfx/layers/ipc/PWebRenderBridge.ipdl index 71292075cfd7..8ca79254184a 100644 --- a/gfx/layers/ipc/PWebRenderBridge.ipdl +++ b/gfx/layers/ipc/PWebRenderBridge.ipdl @@ -59,6 +59,9 @@ parent: WebRenderScrollData aScrollData, OpUpdateResource[] aResourceUpdates, Shmem[] aSmallShmems, Shmem[] aLargeShmems, IdNamespace aIdNamespace, TimeStamp txnStartTime, TimeStamp fwdTime); + async EmptyTransaction(FocusTarget focusTarget, + WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId, + IdNamespace aIdNamespace, TimeStamp txnStartTime, TimeStamp fwdTime); async SetFocusTarget(FocusTarget focusTarget); async UpdateResources(OpUpdateResource[] aResourceUpdates, Shmem[] aSmallShmems, Shmem[] aLargeShmems); async ParentCommands(WebRenderParentCommand[] commands); diff --git a/gfx/layers/wr/WebRenderBridgeChild.cpp b/gfx/layers/wr/WebRenderBridgeChild.cpp index 522a2914127b..feb42e042e91 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -157,6 +157,28 @@ WebRenderBridgeChild::EndTransaction(const wr::LayoutSize& aContentSize, mIsInTransaction = false; } +void +WebRenderBridgeChild::EndEmptyTransaction(const FocusTarget& aFocusTarget, + uint64_t aTransactionId, + const mozilla::TimeStamp& aTxnStartTime) +{ + MOZ_ASSERT(!mDestroyed); + MOZ_ASSERT(mIsInTransaction); + + TimeStamp fwdTime; +#if defined(ENABLE_FRAME_LATENCY_LOG) + fwdTime = TimeStamp::Now(); +#endif + + this->SendEmptyTransaction(aFocusTarget, + mParentCommands, mDestroyedActors, + GetFwdTransactionId(), aTransactionId, + mIdNamespace, aTxnStartTime, fwdTime); + mParentCommands.Clear(); + mDestroyedActors.Clear(); + mIsInTransaction = false; +} + void WebRenderBridgeChild::ProcessWebRenderParentCommands() { diff --git a/gfx/layers/wr/WebRenderBridgeChild.h b/gfx/layers/wr/WebRenderBridgeChild.h index 3c1c29457acd..578f3d0e0062 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -75,6 +75,9 @@ public: bool aIsSync, uint64_t aTransactionId, const WebRenderScrollData& aScrollData, const mozilla::TimeStamp& aTxnStartTime); + void EndEmptyTransaction(const FocusTarget& aFocusTarget, + uint64_t aTransactionId, + const mozilla::TimeStamp& aTxnStartTime); void ProcessWebRenderParentCommands(); CompositorBridgeChild* GetCompositorBridgeChild(); diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index e258590199ef..4968d5efef17 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -614,6 +614,48 @@ WebRenderBridgeParent::RecvSetDisplayListSync(const gfx::IntSize &aSize, aIdNamespace, aTxnStartTime, aFwdTime); } +mozilla::ipc::IPCResult +WebRenderBridgeParent::RecvEmptyTransaction(const FocusTarget& aFocusTarget, + InfallibleTArray&& aCommands, + InfallibleTArray&& aToDestroy, + const uint64_t& aFwdTransactionId, + const uint64_t& aTransactionId, + const wr::IdNamespace& aIdNamespace, + const TimeStamp& aTxnStartTime, + const TimeStamp& aFwdTime) +{ + if (mDestroyed) { + for (const auto& op : aToDestroy) { + DestroyActor(op); + } + return IPC_OK(); + } + + AutoProfilerTracing tracing("Paint", "EmptyTransaction"); + UpdateFwdTransactionId(aFwdTransactionId); + AutoClearReadLocks clearLocks(mReadLocks); + + // This ensures that destroy operations are always processed. It is not safe + // to early-return without doing so. + AutoWebRenderBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy); + + if (!aCommands.IsEmpty()) { + mAsyncImageManager->SetCompositionTime(TimeStamp::Now()); + ProcessWebRenderParentCommands(aCommands); + mCompositorScheduler->ScheduleComposition(); + } + + mScrollData.SetFocusTarget(aFocusTarget); + UpdateAPZ(false); + + // XXX Call DidComposite at correct timing. + TimeStamp now = TimeStamp::Now(); + HoldPendingTransactionId(mWrEpoch, aTransactionId, aTxnStartTime, aFwdTime); + mCompositorBridge->DidComposite(wr::AsUint64(mPipelineId), now, now); + + return IPC_OK(); +} + mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetFocusTarget(const FocusTarget& aFocusTarget) { diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 9de4887db382..1d55f0da10e2 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -106,6 +106,14 @@ public: const wr::IdNamespace& aIdNamespace, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime) override; + mozilla::ipc::IPCResult RecvEmptyTransaction(const FocusTarget& aFocusTarget, + InfallibleTArray&& aCommands, + InfallibleTArray&& aToDestroy, + const uint64_t& aFwdTransactionId, + const uint64_t& aTransactionId, + const wr::IdNamespace& aIdNamespace, + const TimeStamp& aTxnStartTime, + const TimeStamp& aFwdTime) override; mozilla::ipc::IPCResult RecvSetFocusTarget(const FocusTarget& aFocusTarget) override; mozilla::ipc::IPCResult RecvParentCommands(nsTArray&& commands) override; mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture) override; diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 1c9f1c89e6ef..61145f27cf6e 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -31,6 +31,17 @@ void WebRenderCommandBuilder::Destroy() RemoveUnusedAndResetWebRenderUserData(); } +void +WebRenderCommandBuilder::EmptyTransaction() +{ + // We need to update canvases that might have changed. + for (auto iter = mLastCanvasDatas.Iter(); !iter.Done(); iter.Next()) { + RefPtr canvasData = iter.Get()->GetKey(); + WebRenderCanvasRendererAsync* canvas = canvasData->GetCanvasRenderer(); + canvas->UpdateCompositableClient(); + } +} + void WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResourceUpdates, diff --git a/gfx/layers/wr/WebRenderCommandBuilder.h b/gfx/layers/wr/WebRenderCommandBuilder.h index 2b2c07c1e381..c84e90766417 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.h +++ b/gfx/layers/wr/WebRenderCommandBuilder.h @@ -40,6 +40,8 @@ public: void Destroy(); + void EmptyTransaction(); + void BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResourceUpdates, nsDisplayList* aDisplayList, diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index a32dda2b8832..3f30cb7ed4d1 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -174,25 +174,35 @@ WebRenderLayerManager::BeginTransaction() bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) { + LayoutDeviceIntSize size = mWidget->GetClientSize(); + WrBridge()->BeginTransaction(); + // With the WebRenderLayerManager we reject attempts to set most kind of // "pending data" for empty transactions. Any place that attempts to update // transforms or scroll offset, for example, will get failure return values // back, and will fall back to a full transaction. Therefore the only piece - // of "pending" information we need to send in an empty transaction is the - // APZ focus state. - WrBridge()->SendSetFocusTarget(mFocusTarget); + // of "pending" information we need to send in an empty transaction are the + // APZ focus state and canvases's CompositableOperations. - // We also need to update canvases that might have changed, but this code - // as-is causes crashes so comment it out for now. - //for (auto iter = mLastCanvasDatas.Iter(); !iter.Done(); iter.Next()) { - // RefPtr canvasData = iter.Get()->GetKey(); - // WebRenderCanvasRendererAsync* canvas = canvasData->GetCanvasRenderer(); - // canvas->UpdateCompositableClient(); - //} + mWebRenderCommandBuilder.EmptyTransaction(); - if (!(aFlags & EndTransactionFlags::END_NO_COMPOSITE)) { - ScheduleComposite(); + WrBridge()->ClearReadLocks(); + + mLatestTransactionId = mTransactionIdAllocator->GetTransactionId(/*aThrottle*/ true); + TimeStamp transactionStart = mTransactionIdAllocator->GetTransactionStart(); + + // Skip the synchronization for buffer since we also skip the painting during + // device-reset status. + if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) { + if (WrBridge()->GetSyncObject() && + WrBridge()->GetSyncObject()->IsSyncObjectValid()) { + WrBridge()->GetSyncObject()->Synchronize(); + } } + + WrBridge()->EndEmptyTransaction(mFocusTarget, mLatestTransactionId, transactionStart); + + MakeSnapshotIfRequired(size); return true; } From 715045bde3bd7768b74da150693defb1dd94fa1b Mon Sep 17 00:00:00 2001 From: sotaro Date: Thu, 12 Oct 2017 10:13:31 +0900 Subject: [PATCH 12/39] Bug 1405481 - Suppress to composite when END_NO_COMPOSITE is set r=jrmuizel --- gfx/layers/wr/WebRenderCommandBuilder.cpp | 6 ++++++ gfx/layers/wr/WebRenderCommandBuilder.h | 2 ++ gfx/layers/wr/WebRenderLayerManager.cpp | 13 ++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 61145f27cf6e..e3dfa45c6907 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -42,6 +42,12 @@ WebRenderCommandBuilder::EmptyTransaction() } } +bool +WebRenderCommandBuilder::NeedsEmptyTransaction() +{ + return !mLastCanvasDatas.IsEmpty(); +} + void WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResourceUpdates, diff --git a/gfx/layers/wr/WebRenderCommandBuilder.h b/gfx/layers/wr/WebRenderCommandBuilder.h index c84e90766417..a639320d185b 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.h +++ b/gfx/layers/wr/WebRenderCommandBuilder.h @@ -42,6 +42,8 @@ public: void EmptyTransaction(); + bool NeedsEmptyTransaction(); + void BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResourceUpdates, nsDisplayList* aDisplayList, diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index 3f30cb7ed4d1..83259b771f1c 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -174,9 +174,6 @@ WebRenderLayerManager::BeginTransaction() bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) { - LayoutDeviceIntSize size = mWidget->GetClientSize(); - WrBridge()->BeginTransaction(); - // With the WebRenderLayerManager we reject attempts to set most kind of // "pending data" for empty transactions. Any place that attempts to update // transforms or scroll offset, for example, will get failure return values @@ -184,6 +181,16 @@ WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) // of "pending" information we need to send in an empty transaction are the // APZ focus state and canvases's CompositableOperations. + if (aFlags & EndTransactionFlags::END_NO_COMPOSITE && + !mWebRenderCommandBuilder.NeedsEmptyTransaction()) { + MOZ_ASSERT(!mTarget); + WrBridge()->SendSetFocusTarget(mFocusTarget); + return true; + } + + LayoutDeviceIntSize size = mWidget->GetClientSize(); + WrBridge()->BeginTransaction(); + mWebRenderCommandBuilder.EmptyTransaction(); WrBridge()->ClearReadLocks(); From b54a014b55186cfd03a3e12ce25d3b6756ff7a77 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 26 Sep 2017 16:20:57 +1000 Subject: [PATCH 13/39] Bug 1406829 (part 1) - Add a comment about nsAtom::hash(). r=froydnj. --- xpcom/ds/nsAtom.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xpcom/ds/nsAtom.h b/xpcom/ds/nsAtom.h index b5e26ce4c5a6..b29af9e21c60 100644 --- a/xpcom/ds/nsAtom.h +++ b/xpcom/ds/nsAtom.h @@ -67,7 +67,10 @@ public: } // A hashcode that is better distributed than the actual atom pointer, for - // use in situations that need a well-distributed hashcode. + // use in situations that need a well-distributed hashcode. It's called hash() + // rather than Hash() so we can use mozilla::BloomFilter, because + // BloomFilter requires elements to implement a function called hash(). + // uint32_t hash() const { MOZ_ASSERT(!IsHTML5Atom()); From 1de4b467c1a42afb48ad5c42738430455fdd70c6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 26 Sep 2017 16:43:31 +1000 Subject: [PATCH 14/39] Bug 1406829 (part 2) - Use initializer lists more in nsAtom constructors. r=froydnj. --- xpcom/ds/nsAtomTable.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index d6399d86989f..96c35269067a 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -138,10 +138,11 @@ UniquePtr> gFakeBuffers; // This constructor is for dynamic atoms and HTML5 atoms. nsAtom::nsAtom(AtomKind aKind, const nsAString& aString, uint32_t aHash) : mRefCnt(1) + , mLength(aString.Length()) + , mKind(static_cast(aKind)) + , mHash(aHash) { - mLength = aString.Length(); - SetKind(aKind); - MOZ_ASSERT(IsDynamicAtom() || IsHTML5Atom()); + MOZ_ASSERT(aKind == AtomKind::DynamicAtom || aKind == AtomKind::HTML5Atom); RefPtr buf = nsStringBuffer::FromString(aString); if (buf) { mString = static_cast(buf->Data()); @@ -158,13 +159,12 @@ nsAtom::nsAtom(AtomKind aKind, const nsAString& aString, uint32_t aHash) mString[mLength] = char16_t(0); } - mHash = aHash; MOZ_ASSERT_IF(IsDynamicAtom(), mHash == HashString(mString, mLength)); - NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated"); - NS_ASSERTION(buf && buf->StorageSize() >= (mLength + 1) * sizeof(char16_t), - "enough storage"); - NS_ASSERTION(Equals(aString), "correct data"); + MOZ_ASSERT(mString[mLength] == char16_t(0), "null terminated"); + MOZ_ASSERT(buf && buf->StorageSize() >= (mLength + 1) * sizeof(char16_t), + "enough storage"); + MOZ_ASSERT(Equals(aString), "correct data"); // Take ownership of buffer mozilla::Unused << buf.forget(); @@ -172,11 +172,11 @@ nsAtom::nsAtom(AtomKind aKind, const nsAString& aString, uint32_t aHash) // This constructor is for static atoms. nsAtom::nsAtom(nsStringBuffer* aStringBuffer, uint32_t aLength, uint32_t aHash) + : mLength(aLength) + , mKind(static_cast(AtomKind::StaticAtom)) + , mHash(aHash) + , mString(static_cast(aStringBuffer->Data())) { - mLength = aLength; - SetKind(AtomKind::StaticAtom); - mString = static_cast(aStringBuffer->Data()); - #if defined(NS_BUILD_REFCNT_LOGGING) MOZ_ASSERT(NS_IsMainThread()); if (!gFakeBuffers) { @@ -189,7 +189,6 @@ nsAtom::nsAtom(nsStringBuffer* aStringBuffer, uint32_t aLength, uint32_t aHash) // the static atom buffers have an initial refcount of 2. aStringBuffer->AddRef(); - mHash = aHash; MOZ_ASSERT(mHash == HashString(mString, mLength)); MOZ_ASSERT(mString[mLength] == char16_t(0), "null terminated"); From f4bf41508632a27f112e5719f2b3927d2365fa01 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 11 Oct 2017 08:34:38 +1100 Subject: [PATCH 15/39] Bug 1406829 (part 3) - Use `[ptr] native` for nsAtom pointers in .idl files. r=froydnj. Even though it's more verbose because of the `%{C++` section, it's the proper way to do this kind of thing, rather than faking it with `interface`. --- dom/xul/templates/nsIXULTemplateBuilder.idl | 8 ++++++-- .../templates/nsIXULTemplateQueryProcessor.idl | 16 ++++++++++------ dom/xul/templates/nsIXULTemplateResult.idl | 10 +++++++--- rdf/base/nsIRDFXMLSerializer.idl | 7 +++++-- rdf/base/nsIRDFXMLSink.idl | 7 +++++-- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/dom/xul/templates/nsIXULTemplateBuilder.idl b/dom/xul/templates/nsIXULTemplateBuilder.idl index cea82086d2de..6c03cd6fb6fd 100644 --- a/dom/xul/templates/nsIXULTemplateBuilder.idl +++ b/dom/xul/templates/nsIXULTemplateBuilder.idl @@ -5,7 +5,6 @@ #include "domstubs.idl" -interface nsAtom; // not a real interface; used in [noscript] methods only interface nsIContent; interface nsIXULBuilderListener; interface nsIXULTemplateResult; @@ -15,6 +14,11 @@ interface nsIRDFResource; interface nsIRDFCompositeDataSource; interface nsIDOMDataTransfer; +%{C++ +class nsAtom; +%} +[ptr] native nsAtomPtr(nsAtom); + /** * A template builder, given an input source of data, a template, and a * reference point, generates a list of results from the input, and copies @@ -268,7 +272,7 @@ interface nsIXULTemplateBuilder : nsISupports * @param aTag tag that must match */ [noscript] boolean hasGeneratedContent(in nsIRDFResource aNode, - in nsAtom aTag); + in nsAtomPtr aTag); /** * Adds a rule filter for a given rule, which may be used for specialized diff --git a/dom/xul/templates/nsIXULTemplateQueryProcessor.idl b/dom/xul/templates/nsIXULTemplateQueryProcessor.idl index 73fc66ff2d76..5bf8d9a01cad 100644 --- a/dom/xul/templates/nsIXULTemplateQueryProcessor.idl +++ b/dom/xul/templates/nsIXULTemplateQueryProcessor.idl @@ -5,13 +5,17 @@ #include "domstubs.idl" -interface nsAtom; // not a real interface; used in [noscript] methods only interface nsIArray; interface nsISimpleEnumerator; interface nsIXULTemplateResult; interface nsIXULTemplateRuleFilter; interface nsIXULTemplateBuilder; +%{C++ +class nsAtom; +%} +[ptr] native nsAtomPtr(nsAtom); + /** * A query processor takes a template query and generates results for it given * a datasource and a reference point. There is a one-to-one relationship @@ -164,8 +168,8 @@ interface nsIXULTemplateQueryProcessor : nsISupports */ [noscript] nsISupports compileQuery(in nsIXULTemplateBuilder aBuilder, in nsIDOMNode aQuery, - in nsAtom aRefVariable, - in nsAtom aMemberVariable); + in nsAtomPtr aRefVariable, + in nsAtomPtr aMemberVariable); /** * Generate the results of a query and return them in an enumerator. The @@ -223,8 +227,8 @@ interface nsIXULTemplateQueryProcessor : nsISupports * @param aExpr expression used to compute the value to assign */ [noscript] void addBinding(in nsIDOMNode aRuleNode, - in nsAtom aVar, - in nsAtom aRef, + in nsAtomPtr aVar, + in nsAtomPtr aRef, in AString aExpr); /** @@ -271,6 +275,6 @@ interface nsIXULTemplateQueryProcessor : nsISupports */ [noscript] int32_t compareResults(in nsIXULTemplateResult aLeft, in nsIXULTemplateResult aRight, - in nsAtom aVar, + in nsAtomPtr aVar, in unsigned long aSortHints); }; diff --git a/dom/xul/templates/nsIXULTemplateResult.idl b/dom/xul/templates/nsIXULTemplateResult.idl index 30c50c8a86ac..55d1a3c0482a 100644 --- a/dom/xul/templates/nsIXULTemplateResult.idl +++ b/dom/xul/templates/nsIXULTemplateResult.idl @@ -5,10 +5,14 @@ #include "nsISupports.idl" -interface nsAtom; // not a real interface; used in [noscript] methods only interface nsIDOMNode; interface nsIRDFResource; +%{C++ +class nsAtom; +%} +[ptr] native nsAtomPtr(nsAtom); + /** * A single result generated from a template query. Each result is identified * by an id, which must be unique within the set of results produced from a @@ -80,7 +84,7 @@ interface nsIXULTemplateResult : nsISupports * * @return the value for the variable or a null string if it has no value */ - [noscript] AString getBindingFor(in nsAtom aVar); + [noscript] AString getBindingFor(in nsAtomPtr aVar); /** * Get an object value for a variable such as ?name for this result. @@ -93,7 +97,7 @@ interface nsIXULTemplateResult : nsISupports * * @return the value for the variable or null if it has no value */ - [noscript] nsISupports getBindingObjectFor(in nsAtom aVar); + [noscript] nsISupports getBindingObjectFor(in nsAtomPtr aVar); /** * Indicate that a particular rule of a query has matched and that output diff --git a/rdf/base/nsIRDFXMLSerializer.idl b/rdf/base/nsIRDFXMLSerializer.idl index 08399e327821..edf113d4bead 100644 --- a/rdf/base/nsIRDFXMLSerializer.idl +++ b/rdf/base/nsIRDFXMLSerializer.idl @@ -7,7 +7,10 @@ #include "nsISupports.idl" #include "nsIRDFDataSource.idl" -interface nsAtom; // not a real interface; used in [noscript] methods only +%{C++ +class nsAtom; +%} +[ptr] native nsAtomPtr(nsAtom); [scriptable, uuid(8ae1fbf8-1dd2-11b2-bd21-d728069cca92)] interface nsIRDFXMLSerializer : nsISupports @@ -24,5 +27,5 @@ interface nsIRDFXMLSerializer : nsISupports * @param aPrefix the attribute namespace prefix * @param aURI the namespace URI */ - [noscript] void addNameSpace(in nsAtom aPrefix, in DOMString aURI); + [noscript] void addNameSpace(in nsAtomPtr aPrefix, in DOMString aURI); }; diff --git a/rdf/base/nsIRDFXMLSink.idl b/rdf/base/nsIRDFXMLSink.idl index 3f3963d545f9..1c950c867ab4 100644 --- a/rdf/base/nsIRDFXMLSink.idl +++ b/rdf/base/nsIRDFXMLSink.idl @@ -12,7 +12,10 @@ #include "nsISupports.idl" -interface nsAtom; // not a real interface; used in [noscript] methods only +%{C++ +class nsAtom; +%} +[ptr] native nsAtomPtr(nsAtom); // XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace() [ref] native nsStringRef(nsString); @@ -102,7 +105,7 @@ interface nsIRDFXMLSink : nsISupports * @param aPrefix the namespace prefix * @param aURI the namespace URI */ - [noscript] void addNameSpace(in nsAtom aPrefix, + [noscript] void addNameSpace(in nsAtomPtr aPrefix, [const] in nsStringRef aURI); /** From 1475bf4ce515eb1d708f2477956234e8342977e1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 11 Oct 2017 22:19:06 -0400 Subject: [PATCH 16/39] Bug 1407375. Make sure to call NodeInfoChanged whenever we change the nodeinfo on a node. r=peterv MozReview-Commit-ID: 71k1jv8thFA --- dom/base/nsNodeUtils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp index 961258b599f2..868c40fde037 100644 --- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -616,6 +616,9 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep, aNode->OwnerDoc()->UnregisterActivityObserver(aNode->AsElement()); } aNode->mNodeInfo.swap(newNodeInfo); + if (elem) { + elem->NodeInfoChanged(newDoc); + } if (wasRegistered) { aNode->OwnerDoc()->RegisterActivityObserver(aNode->AsElement()); } From fb61ca82197cd17b7de684015ea2afbdad1ad2c4 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 11 Oct 2017 22:19:10 -0400 Subject: [PATCH 17/39] Bug 1324463. Fix crash when xbl:children is stuck into shadow DOM. r=smaug MozReview-Commit-ID: C602pPbIfih --- dom/base/ShadowRoot.cpp | 2 +- dom/base/crashtests/1324463.html | 16 ++++++++++++++++ dom/base/crashtests/crashtests.list | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 dom/base/crashtests/1324463.html diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index ccb0a2b931dd..fdbc2995df1c 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -508,7 +508,7 @@ ShadowRoot::ContentAppended(nsIDocument* aDocument, // Add insertion point to destination insertion points of fallback content. if (nsContentUtils::IsContentInsertionPoint(aContainer)) { HTMLContentElement* content = HTMLContentElement::FromContent(aContainer); - if (content->MatchedNodes().IsEmpty()) { + if (content && content->MatchedNodes().IsEmpty()) { currentChild->DestInsertionPoints().AppendElement(aContainer); } } diff --git a/dom/base/crashtests/1324463.html b/dom/base/crashtests/1324463.html new file mode 100644 index 000000000000..a90358f37731 --- /dev/null +++ b/dom/base/crashtests/1324463.html @@ -0,0 +1,16 @@ + + + + diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index 89c5ee4139a4..11f6230cd721 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -231,3 +231,4 @@ load 1400701.html load 1403377.html load 1405771.html load 1406109-1.html +pref(dom.webcomponents.enabled,true) load 1324463.html From eaa646a782a9faf1bc0f9b5ec58152ca4c115b72 Mon Sep 17 00:00:00 2001 From: vincentliu Date: Thu, 12 Oct 2017 10:25:34 +0800 Subject: [PATCH 18/39] Bug 1403539 - Skip to PushImage in WebRenderCommandsBuilder if AddXXXImage fails to return. r=nical --- gfx/layers/wr/IpcResourceUpdateQueue.cpp | 53 ++++++++++++++++++----- gfx/layers/wr/IpcResourceUpdateQueue.h | 12 ++--- gfx/layers/wr/WebRenderCommandBuilder.cpp | 4 +- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/gfx/layers/wr/IpcResourceUpdateQueue.cpp b/gfx/layers/wr/IpcResourceUpdateQueue.cpp index 19169e6355a5..37e9947722dc 100644 --- a/gfx/layers/wr/IpcResourceUpdateQueue.cpp +++ b/gfx/layers/wr/IpcResourceUpdateQueue.cpp @@ -41,10 +41,18 @@ ShmSegmentsWriter::Write(Range aBytes) size_t srcCursor = 0; size_t dstCursor = mCursor; + size_t currAllocLen = mSmallAllocs.Length(); while (remainingBytesToCopy > 0) { if (dstCursor >= mSmallAllocs.Length() * mChunkSize) { - AllocChunk(); + if (!AllocChunk()) { + for (size_t i = mSmallAllocs.Length() ; currAllocLen <= i ; i--) { + ipc::Shmem shm = mSmallAllocs.ElementAt(i); + mShmAllocator->DeallocShmem(shm); + mSmallAllocs.RemoveElementAt(i); + } + return layers::OffsetRange(0, start, 0); + } continue; } @@ -75,16 +83,18 @@ ShmSegmentsWriter::Write(Range aBytes) return layers::OffsetRange(0, start, length); } -void +bool ShmSegmentsWriter::AllocChunk() { ipc::Shmem shm; auto shmType = ipc::SharedMemory::SharedMemoryType::TYPE_BASIC; if (!mShmAllocator->AllocShmem(mChunkSize, shmType, &shm)) { - gfxCriticalError() << "ShmSegmentsWriter failed to allocate chunk #" << mSmallAllocs.Length(); - MOZ_CRASH(); + gfxCriticalNote << "ShmSegmentsWriter failed to allocate chunk #" << mSmallAllocs.Length(); + MOZ_ASSERT(false, "ShmSegmentsWriter fails to allocate chunk"); + return false; } mSmallAllocs.AppendElement(shm); + return true; } layers::OffsetRange @@ -93,8 +103,9 @@ ShmSegmentsWriter::AllocLargeChunk(size_t aSize) ipc::Shmem shm; auto shmType = ipc::SharedMemory::SharedMemoryType::TYPE_BASIC; if (!mShmAllocator->AllocShmem(aSize, shmType, &shm)) { - gfxCriticalError() << "ShmSegmentsWriter failed to allocate large chunk of size " << aSize; - MOZ_CRASH(); + gfxCriticalNote << "ShmSegmentsWriter failed to allocate large chunk of size " << aSize; + MOZ_ASSERT(false, "ShmSegmentsWriter fails to allocate large chunk"); + return layers::OffsetRange(0, 0, 0); } mLargeAllocs.AppendElement(shm); @@ -222,20 +233,28 @@ IpcResourceUpdateQueue::IpcResourceUpdateQueue(ipc::IShmemAllocator* aAllocator, : mWriter(Move(aAllocator), aChunkSize) {} -void +bool IpcResourceUpdateQueue::AddImage(ImageKey key, const ImageDescriptor& aDescriptor, Range aBytes) { auto bytes = mWriter.Write(aBytes); + if (!bytes.length()) { + return false; + } mUpdates.AppendElement(layers::OpAddImage(aDescriptor, bytes, 0, key)); + return true; } -void +bool IpcResourceUpdateQueue::AddBlobImage(ImageKey key, const ImageDescriptor& aDescriptor, Range aBytes) { auto bytes = mWriter.Write(aBytes); + if (!bytes.length()) { + return false; + } mUpdates.AppendElement(layers::OpAddBlobImage(aDescriptor, bytes, 0, key)); + return true; } void @@ -244,22 +263,30 @@ IpcResourceUpdateQueue::AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKe mUpdates.AppendElement(layers::OpAddExternalImage(aExtId, aKey)); } -void +bool IpcResourceUpdateQueue::UpdateImageBuffer(ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes) { auto bytes = mWriter.Write(aBytes); + if (!bytes.length()) { + return false; + } mUpdates.AppendElement(layers::OpUpdateImage(aDescriptor, bytes, aKey)); + return true; } -void +bool IpcResourceUpdateQueue::UpdateBlobImage(ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes) { auto bytes = mWriter.Write(aBytes); + if (!bytes.length()) { + return false; + } mUpdates.AppendElement(layers::OpUpdateBlobImage(aDescriptor, bytes, aKey)); + return true; } void @@ -268,11 +295,15 @@ IpcResourceUpdateQueue::DeleteImage(ImageKey aKey) mUpdates.AppendElement(layers::OpDeleteImage(aKey)); } -void +bool IpcResourceUpdateQueue::AddRawFont(wr::FontKey aKey, Range aBytes, uint32_t aIndex) { auto bytes = mWriter.Write(aBytes); + if (!bytes.length()) { + return false; + } mUpdates.AppendElement(layers::OpAddRawFont(bytes, aIndex, aKey)); + return true; } void diff --git a/gfx/layers/wr/IpcResourceUpdateQueue.h b/gfx/layers/wr/IpcResourceUpdateQueue.h index 224a47bb3167..026703df2745 100644 --- a/gfx/layers/wr/IpcResourceUpdateQueue.h +++ b/gfx/layers/wr/IpcResourceUpdateQueue.h @@ -34,7 +34,7 @@ public: void Clear(); protected: - void AllocChunk(); + bool AllocChunk(); layers::OffsetRange AllocLargeChunk(size_t aSize); nsTArray mSmallAllocs; @@ -67,21 +67,21 @@ public: // So we pick 64k - 2 * 4k = 57344 bytes as the defautl alloc explicit IpcResourceUpdateQueue(ipc::IShmemAllocator* aAllocator, size_t aChunkSize = 57344); - void AddImage(wr::ImageKey aKey, + bool AddImage(wr::ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes); - void AddBlobImage(wr::ImageKey aKey, + bool AddBlobImage(wr::ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes); void AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey); - void UpdateImageBuffer(wr::ImageKey aKey, + bool UpdateImageBuffer(wr::ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes); - void UpdateBlobImage(wr::ImageKey aKey, + bool UpdateBlobImage(wr::ImageKey aKey, const ImageDescriptor& aDescriptor, Range aBytes); @@ -93,7 +93,7 @@ public: void DeleteImage(wr::ImageKey aKey); - void AddRawFont(wr::FontKey aKey, Range aBytes, uint32_t aIndex); + bool AddRawFont(wr::FontKey aKey, Range aBytes, uint32_t aIndex); void DeleteFont(wr::FontKey aKey); diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index e3dfa45c6907..06b82500c12a 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -516,7 +516,9 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem, Range bytes((uint8_t*)recorder->mOutputStream.mData, recorder->mOutputStream.mLength); wr::ImageKey key = mManager->WrBridge()->GetNextImageKey(); wr::ImageDescriptor descriptor(paintSize.ToUnknownSize(), 0, dt->GetFormat(), isOpaque); - aResources.AddBlobImage(key, descriptor, bytes); + if (!aResources.AddBlobImage(key, descriptor, bytes)) { + return nullptr; + } fallbackData->SetKey(key); } else { fallbackData->CreateImageClientIfNeeded(); From 2790ca829ab6c1b1dc2f3916ce38e7ec076f54e1 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 11 Oct 2017 20:03:11 -0700 Subject: [PATCH 19/39] Bug 1404652: Follow-up: Fix timing issues in webRequest HSTS tests. MozReview-Commit-ID: HFW73u6wp5S --HG-- extra : rebase_source : 6238ba74796e650b3a6cb9ce4c8d8354db976ab6 --- .../extensions/test/mochitest/test_ext_webrequest_hsts.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html index a75593067f2f..31c9009fc191 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html @@ -54,6 +54,7 @@ add_task(async function test_hsts_request() { }, {urls}); browser.webRequest.onCompleted.addListener(details => { browser.test.assertEq(expect.shift(), "onCompleted"); + browser.test.sendMessage("onCompleted", details.url); }, {urls}); browser.webRequest.onErrorOccurred.addListener(details => { browser.test.notifyFail(`onErrorOccurred ${JSON.stringify(details)}`); @@ -84,6 +85,7 @@ add_task(async function test_hsts_request() { "onResponseStarted", "onCompleted"]); // redirect_auto adds a query string ok((await extension.awaitMessage("tabs-done")).startsWith(sample), "redirection ok"); + ok((await extension.awaitMessage("onCompleted")).startsWith(sample), "redirection ok"); // priming hsts extension.sendMessage(`https://${testPath}/hsts.sjs`, @@ -92,6 +94,8 @@ add_task(async function test_hsts_request() { is(await extension.awaitMessage("tabs-done"), "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs", "hsts primed"); + is(await extension.awaitMessage("onCompleted"), + "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs"); // test upgrade extension.sendMessage(`http://${testPath}/hsts.sjs`, @@ -101,6 +105,8 @@ add_task(async function test_hsts_request() { is(await extension.awaitMessage("tabs-done"), "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs", "hsts upgraded"); + is(await extension.awaitMessage("onCompleted"), + "https://example.org/tests/toolkit/components/extensions/test/mochitest/hsts.sjs"); await extension.unload(); }); From c0a1cf9b49f2eece3b3e30a54e769604ca95604d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 9 Oct 2017 10:08:09 +1100 Subject: [PATCH 20/39] Bug 1407103 - Convert wstring attributes to AString in widget/nsIPrint*.idl. r=bobowen. This avoids a lot of mismatches between nsAString and char16_t*, thus removing many getter_Copies() and ToNewUnicode() and get() calls, and generally making things simpler. Note: the patch removes GetDefaultPrinterNameFromGlobalPrinters() by simply inlining it at its two callsites, which is easy with the changed types. --HG-- extra : rebase_source : 9ab9b3694f093fc9b22c7f8e2394a98674d76c11 --- dom/base/nsGlobalWindow.cpp | 8 +- layout/generic/nsPageFrame.cpp | 12 +- layout/printing/nsPrintEngine.cpp | 25 +-- .../printingui/ipc/PrintingParent.cpp | 11 +- .../printingui/win/nsPrintDialogUtil.cpp | 14 +- widget/android/nsDeviceContextAndroid.cpp | 2 +- widget/android/nsPrintOptionsAndroid.cpp | 3 +- widget/cocoa/nsPrintDialogX.mm | 24 +-- widget/cocoa/nsPrintSettingsX.h | 2 +- widget/cocoa/nsPrintSettingsX.mm | 7 +- widget/gtk/nsDeviceContextSpecG.cpp | 23 +-- widget/gtk/nsPrintDialogGTK.cpp | 30 +-- widget/gtk/nsPrintSettingsGTK.cpp | 36 ++-- widget/gtk/nsPrintSettingsGTK.h | 12 +- widget/nsIPrintSettings.idl | 22 +-- widget/nsIPrintSettingsService.idl | 5 +- widget/nsIPrintSettingsWin.idl | 4 +- widget/nsIPrinterEnumerator.idl | 5 +- widget/nsPrintOptionsImpl.cpp | 125 +++++------- widget/nsPrintSettingsImpl.cpp | 185 ++++++------------ widget/nsPrintSettingsImpl.h | 3 - widget/windows/nsDeviceContextSpecWin.cpp | 120 ++++-------- widget/windows/nsDeviceContextSpecWin.h | 15 +- widget/windows/nsPrintOptionsWin.cpp | 15 +- widget/windows/nsPrintSettingsWin.cpp | 44 ++--- widget/windows/nsPrintSettingsWin.h | 4 +- 26 files changed, 286 insertions(+), 470 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 020417ba4e88..74c0045bb967 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -8156,7 +8156,7 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError) printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings)); nsAutoString printerName; - printSettings->GetPrinterName(getter_Copies(printerName)); + printSettings->GetPrinterName(printerName); bool shouldGetDefaultPrinterName = printerName.IsEmpty(); #ifdef MOZ_X11 @@ -8170,10 +8170,10 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError) } #endif if (shouldGetDefaultPrinterName) { - printSettingsService->GetDefaultPrinterName(getter_Copies(printerName)); - printSettings->SetPrinterName(printerName.get()); + printSettingsService->GetDefaultPrinterName(printerName); + printSettings->SetPrinterName(printerName); } - printSettingsService->InitPrintSettingsFromPrinter(printerName.get(), + printSettingsService->InitPrintSettingsFromPrinter(printerName, printSettings); printSettingsService->InitPrintSettingsFromPrefs(printSettings, true, diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index a6b7df8c5403..14ef1e874c19 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -642,17 +642,17 @@ nsPageFrame::PaintHeaderFooter(gfxContext& aRenderingContext, // print document headers and footers nsString headerLeft, headerCenter, headerRight; - mPD->mPrintSettings->GetHeaderStrLeft(getter_Copies(headerLeft)); - mPD->mPrintSettings->GetHeaderStrCenter(getter_Copies(headerCenter)); - mPD->mPrintSettings->GetHeaderStrRight(getter_Copies(headerRight)); + mPD->mPrintSettings->GetHeaderStrLeft(headerLeft); + mPD->mPrintSettings->GetHeaderStrCenter(headerCenter); + mPD->mPrintSettings->GetHeaderStrRight(headerRight); DrawHeaderFooter(aRenderingContext, *fontMet, eHeader, headerLeft, headerCenter, headerRight, rect, ascent, visibleHeight); nsString footerLeft, footerCenter, footerRight; - mPD->mPrintSettings->GetFooterStrLeft(getter_Copies(footerLeft)); - mPD->mPrintSettings->GetFooterStrCenter(getter_Copies(footerCenter)); - mPD->mPrintSettings->GetFooterStrRight(getter_Copies(footerRight)); + mPD->mPrintSettings->GetFooterStrLeft(footerLeft); + mPD->mPrintSettings->GetFooterStrCenter(footerCenter); + mPD->mPrintSettings->GetFooterStrRight(footerRight); DrawHeaderFooter(aRenderingContext, *fontMet, eFooter, footerLeft, footerCenter, footerRight, rect, ascent, visibleHeight); diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 860726d777e5..fcf0f9dc8c6f 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -1011,7 +1011,7 @@ nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings) // See if aPrintSettings already has a printer nsString printerName; - nsresult rv = aPrintSettings->GetPrinterName(getter_Copies(printerName)); + nsresult rv = aPrintSettings->GetPrinterName(printerName); if (NS_SUCCEEDED(rv) && !printerName.IsEmpty()) { return NS_OK; } @@ -1021,9 +1021,9 @@ nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings) do_GetService(sPrintSettingsServiceContractID, &rv); NS_ENSURE_SUCCESS(rv, rv); - rv = printSettingsService->GetDefaultPrinterName(getter_Copies(printerName)); + rv = printSettingsService->GetDefaultPrinterName(printerName); if (NS_SUCCEEDED(rv) && !printerName.IsEmpty()) { - rv = aPrintSettings->SetPrinterName(printerName.get()); + rv = aPrintSettings->SetPrinterName(printerName); } return rv; #endif @@ -1455,21 +1455,8 @@ nsPrintEngine::GetDisplayTitleAndURL(const UniquePtr& aPO, // First check to see if the PrintSettings has defined an alternate title // and use that if it did if (mPrt->mPrintSettings) { - char16_t * docTitleStrPS = nullptr; - char16_t * docURLStrPS = nullptr; - mPrt->mPrintSettings->GetTitle(&docTitleStrPS); - mPrt->mPrintSettings->GetDocURL(&docURLStrPS); - - if (docTitleStrPS) { - aTitle = docTitleStrPS; - } - - if (docURLStrPS) { - aURLStr = docURLStrPS; - } - - free(docTitleStrPS); - free(docURLStrPS); + mPrt->mPrintSettings->GetTitle(aTitle); + mPrt->mPrintSettings->GetDocURL(aURLStr); } nsAutoString docTitle; @@ -1828,7 +1815,7 @@ nsPrintEngine::SetupToPrintContent() printData->mPrintSettings->GetPrintToFile(&isPrintToFile); if (isPrintToFile) { // On some platforms The BeginDocument needs to know the name of the file. - printData->mPrintSettings->GetToFileName(getter_Copies(fileNameStr)); + printData->mPrintSettings->GetToFileName(fileNameStr); } nsAutoString docTitleStr; diff --git a/toolkit/components/printingui/ipc/PrintingParent.cpp b/toolkit/components/printingui/ipc/PrintingParent.cpp index 309702af5dde..b44fea5cc036 100644 --- a/toolkit/components/printingui/ipc/PrintingParent.cpp +++ b/toolkit/components/printingui/ipc/PrintingParent.cpp @@ -137,17 +137,17 @@ PrintingParent::ShowPrintDialog(PBrowserParent* aParent, NS_ENSURE_SUCCESS(rv, rv); nsString printerName; - settings->GetPrinterName(getter_Copies(printerName)); + settings->GetPrinterName(printerName); #ifdef MOZ_X11 // Requesting the default printer name on Linux has been removed in the child, // because it was causing a sandbox violation (see Bug 1329216). // If no printer name is set at this point, use the print settings service // to get the default printer name. if (printerName.IsEmpty()) { - mPrintSettingsSvc->GetDefaultPrinterName(getter_Copies(printerName)); - settings->SetPrinterName(printerName.get()); + mPrintSettingsSvc->GetDefaultPrinterName(printerName); + settings->SetPrinterName(printerName); } - mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName.get(), settings); + mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings); #endif // If this is for print preview or we are printing silently then we just need @@ -155,8 +155,7 @@ PrintingParent::ShowPrintDialog(PBrowserParent* aParent, if (isPrintPreview || printSilently || Preferences::GetBool("print.always_print_silent", printSilently)) { settings->SetIsInitializedFromPrinter(false); - mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName.get(), - settings); + mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings); } else { rv = pps->ShowPrintDialog(parentWin, wbp, settings); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/components/printingui/win/nsPrintDialogUtil.cpp b/toolkit/components/printingui/win/nsPrintDialogUtil.cpp index 2a95a5140184..1bd8a2383053 100644 --- a/toolkit/components/printingui/win/nsPrintDialogUtil.cpp +++ b/toolkit/components/printingui/win/nsPrintDialogUtil.cpp @@ -535,7 +535,7 @@ static void GetDefaultPrinterNameFromGlobalPrinters(nsAString &printerName) { nsCOMPtr prtEnum = do_GetService("@mozilla.org/gfx/printerenumerator;1"); if (prtEnum) { - prtEnum->GetDefaultPrinterName(getter_Copies(printerName)); + prtEnum->GetDefaultPrinterName(printerName); } } @@ -570,7 +570,7 @@ ShowNativePrintDialog(HWND aHWnd, // Get the Print Name to be used nsString printerName; - aPrintSettings->GetPrinterName(getter_Copies(printerName)); + aPrintSettings->GetPrinterName(printerName); // If there is no name then use the default printer if (printerName.IsEmpty()) { @@ -696,12 +696,12 @@ ShowNativePrintDialog(HWND aHWnd, if (prntdlg.Flags & PD_PRINTTOFILE) { char16ptr_t fileName = &(((wchar_t *)devnames)[devnames->wOutputOffset]); NS_ASSERTION(wcscmp(fileName, L"FILE:") == 0, "FileName must be `FILE:`"); - aPrintSettings->SetToFileName(fileName); + aPrintSettings->SetToFileName(nsDependentString(fileName)); aPrintSettings->SetPrintToFile(true); } else { // clear "print to file" info aPrintSettings->SetPrintToFile(false); - aPrintSettings->SetToFileName(nullptr); + aPrintSettings->SetToFileName(EmptyString()); } nsCOMPtr psWin(do_QueryInterface(aPrintSettings)); @@ -710,15 +710,15 @@ ShowNativePrintDialog(HWND aHWnd, } // Setup local Data members - psWin->SetDeviceName(device); - psWin->SetDriverName(driver); + psWin->SetDeviceName(nsDependentString(device)); + psWin->SetDriverName(nsDependentString(driver)); #if defined(DEBUG_rods) || defined(DEBUG_dcone) wprintf(L"printer: driver %s, device %s flags: %d\n", driver, device, prntdlg.Flags); #endif // fill the print options with the info from the dialog - aPrintSettings->SetPrinterName(device); + aPrintSettings->SetPrinterName(nsDependentString(device)); if (prntdlg.Flags & PD_SELECTION) { aPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSelection); diff --git a/widget/android/nsDeviceContextAndroid.cpp b/widget/android/nsDeviceContextAndroid.cpp index 6a1542875551..43d4e8101fb3 100644 --- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -62,7 +62,7 @@ nsDeviceContextSpecAndroid::EndDocument() { nsString targetPath; nsCOMPtr destFile; - mPrintSettings->GetToFileName(getter_Copies(targetPath)); + mPrintSettings->GetToFileName(targetPath); nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/widget/android/nsPrintOptionsAndroid.cpp b/widget/android/nsPrintOptionsAndroid.cpp index 03afba827152..9c5ea485919b 100644 --- a/widget/android/nsPrintOptionsAndroid.cpp +++ b/widget/android/nsPrintOptionsAndroid.cpp @@ -12,8 +12,7 @@ public: { // The aim here is to set up the objects enough that silent printing works SetOutputFormat(nsIPrintSettings::kOutputFormatPDF); - SetPrinterName(u"PDF printer"); - + SetPrinterName(NS_LITERAL_STRING("PDF printer")); } }; diff --git a/widget/cocoa/nsPrintDialogX.mm b/widget/cocoa/nsPrintDialogX.mm index fd648f809ea8..6de96a480129 100644 --- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -515,32 +515,32 @@ static const char sHeaderFooterTags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"}; // Lists nsString sel; - mSettings->GetHeaderStrLeft(getter_Copies(sel)); + mSettings->GetHeaderStrLeft(sel); mHeaderLeftList = [self headerFooterItemListWithFrame:NSMakeRect(156, 44, 100, 22) selectedItem:sel]; [self addSubview:mHeaderLeftList]; - mSettings->GetHeaderStrCenter(getter_Copies(sel)); + mSettings->GetHeaderStrCenter(sel); mHeaderCenterList = [self headerFooterItemListWithFrame:NSMakeRect(256, 44, 100, 22) selectedItem:sel]; [self addSubview:mHeaderCenterList]; - mSettings->GetHeaderStrRight(getter_Copies(sel)); + mSettings->GetHeaderStrRight(sel); mHeaderRightList = [self headerFooterItemListWithFrame:NSMakeRect(356, 44, 100, 22) selectedItem:sel]; [self addSubview:mHeaderRightList]; - mSettings->GetFooterStrLeft(getter_Copies(sel)); + mSettings->GetFooterStrLeft(sel); mFooterLeftList = [self headerFooterItemListWithFrame:NSMakeRect(156, 0, 100, 22) selectedItem:sel]; [self addSubview:mFooterLeftList]; - mSettings->GetFooterStrCenter(getter_Copies(sel)); + mSettings->GetFooterStrCenter(sel); mFooterCenterList = [self headerFooterItemListWithFrame:NSMakeRect(256, 0, 100, 22) selectedItem:sel]; [self addSubview:mFooterCenterList]; - mSettings->GetFooterStrRight(getter_Copies(sel)); + mSettings->GetFooterStrRight(sel); mFooterRightList = [self headerFooterItemListWithFrame:NSMakeRect(356, 0, 100, 22) selectedItem:sel]; [self addSubview:mFooterRightList]; @@ -570,22 +570,22 @@ static const char sHeaderFooterTags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"}; { const char* headerFooterStr; headerFooterStr = [self headerFooterStringForList:mHeaderLeftList]; - mSettings->SetHeaderStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetHeaderStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr)); headerFooterStr = [self headerFooterStringForList:mHeaderCenterList]; - mSettings->SetHeaderStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetHeaderStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr)); headerFooterStr = [self headerFooterStringForList:mHeaderRightList]; - mSettings->SetHeaderStrRight(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetHeaderStrRight(NS_ConvertUTF8toUTF16(headerFooterStr)); headerFooterStr = [self headerFooterStringForList:mFooterLeftList]; - mSettings->SetFooterStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetFooterStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr)); headerFooterStr = [self headerFooterStringForList:mFooterCenterList]; - mSettings->SetFooterStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetFooterStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr)); headerFooterStr = [self headerFooterStringForList:mFooterRightList]; - mSettings->SetFooterStrRight(NS_ConvertUTF8toUTF16(headerFooterStr).get()); + mSettings->SetFooterStrRight(NS_ConvertUTF8toUTF16(headerFooterStr)); } // Summary diff --git a/widget/cocoa/nsPrintSettingsX.h b/widget/cocoa/nsPrintSettingsX.h index a0e2fae46ddd..5b45af83454f 100644 --- a/widget/cocoa/nsPrintSettingsX.h +++ b/widget/cocoa/nsPrintSettingsX.h @@ -68,7 +68,7 @@ public: NS_IMETHOD SetScaling(double aScaling) override; NS_IMETHOD GetScaling(double *aScaling) override; - NS_IMETHOD SetToFileName(const char16_t * aToFileName) override; + NS_IMETHOD SetToFileName(const nsAString& aToFileName) override; NS_IMETHOD GetOrientation(int32_t *aOrientation) override; NS_IMETHOD SetOrientation(int32_t aOrientation) override; diff --git a/widget/cocoa/nsPrintSettingsX.mm b/widget/cocoa/nsPrintSettingsX.mm index a30736dee987..8275efa9e84a 100644 --- a/widget/cocoa/nsPrintSettingsX.mm +++ b/widget/cocoa/nsPrintSettingsX.mm @@ -328,7 +328,7 @@ nsPrintSettingsX::GetScaling(double *aScaling) } NS_IMETHODIMP -nsPrintSettingsX::SetToFileName(const char16_t *aToFileName) +nsPrintSettingsX::SetToFileName(const nsAString& aToFileName) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; @@ -341,10 +341,9 @@ nsPrintSettingsX::SetToFileName(const char16_t *aToFileName) NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; - if (aToFileName && aToFileName[0]) { + if (!aToFileName.IsEmpty()) { NSURL* jobSavingURL = - [NSURL fileURLWithPath: nsCocoaUtils::ToNSString( - nsDependentString(aToFileName))]; + [NSURL fileURLWithPath: nsCocoaUtils::ToNSString(aToFileName)]; if (jobSavingURL) { [printInfoDict setObject: NSPrintSaveJob forKey: NSPrintJobDisposition]; [printInfoDict setObject: jobSavingURL forKey: NSPrintJobSavingURL]; diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index 62f775e4c439..f0de247407f0 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -63,7 +63,7 @@ public: uint32_t GetNumPrinters() { return mGlobalPrinterList ? mGlobalPrinterList->Length() : 0; } nsString* GetStringAt(int32_t aInx) { return &mGlobalPrinterList->ElementAt(aInx); } - void GetDefaultPrinterName(char16_t **aDefaultPrinterName); + void GetDefaultPrinterName(nsAString& aDefaultPrinterName); protected: GlobalPrinters() {} @@ -246,7 +246,7 @@ gboolean nsDeviceContextSpecGTK::PrinterEnumerator(GtkPrinter *aPrinter, // Find the printer whose name matches the one inside the settings. nsString printerName; nsresult rv = - spec->mPrintSettings->GetPrinterName(getter_Copies(printerName)); + spec->mPrintSettings->GetPrinterName(printerName); if (NS_SUCCEEDED(rv) && !printerName.IsVoid()) { NS_ConvertUTF16toUTF8 requestedName(printerName); const char* currentName = gtk_printer_get_name(aPrinter); @@ -328,7 +328,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument() // Handle print-to-file ourselves for the benefit of embedders nsString targetPath; nsCOMPtr destFile; - mPrintSettings->GetToFileName(getter_Copies(targetPath)); + mPrintSettings->GetToFileName(targetPath); nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); NS_ENSURE_SUCCESS(rv, rv); @@ -388,18 +388,19 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::GetPrinterNameList(nsIStringEnumerator **a return NS_NewAdoptingStringEnumerator(aPrinterNameList, printers); } -NS_IMETHODIMP nsPrinterEnumeratorGTK::GetDefaultPrinterName(char16_t **aDefaultPrinterName) +NS_IMETHODIMP nsPrinterEnumeratorGTK::GetDefaultPrinterName(nsAString& aDefaultPrinterName) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorGTK::GetDefaultPrinterName()\n")); - NS_ENSURE_ARG_POINTER(aDefaultPrinterName); GlobalPrinters::GetInstance()->GetDefaultPrinterName(aDefaultPrinterName); - DO_PR_DEBUG_LOG(("GetDefaultPrinterName(): default printer='%s'.\n", NS_ConvertUTF16toUTF8(*aDefaultPrinterName).get())); + DO_PR_DEBUG_LOG(("GetDefaultPrinterName(): default printer='%s'.\n", NS_ConvertUTF16toUTF8(aDefaultPrinterName).get())); return NS_OK; } -NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) +NS_IMETHODIMP +nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const nsAString& aPrinterName, + nsIPrintSettings *aPrintSettings) { DO_PR_DEBUG_LOG(("nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter()")); @@ -418,7 +419,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const char16_ filename.AssignLiteral("mozilla.pdf"); DO_PR_DEBUG_LOG(("Setting default filename to '%s'\n", filename.get())); - aPrintSettings->SetToFileName(NS_ConvertUTF8toUTF16(filename).get()); + aPrintSettings->SetToFileName(NS_ConvertUTF8toUTF16(filename)); aPrintSettings->SetIsInitializedFromPrinter(true); @@ -470,9 +471,9 @@ void GlobalPrinters::FreeGlobalPrinters() } void -GlobalPrinters::GetDefaultPrinterName(char16_t **aDefaultPrinterName) +GlobalPrinters::GetDefaultPrinterName(nsAString& aDefaultPrinterName) { - *aDefaultPrinterName = nullptr; + aDefaultPrinterName.Truncate(); bool allocate = !GlobalPrinters::GetInstance()->PrintersAreAllocated(); @@ -487,7 +488,7 @@ GlobalPrinters::GetDefaultPrinterName(char16_t **aDefaultPrinterName) if (GlobalPrinters::GetInstance()->GetNumPrinters() == 0) return; - *aDefaultPrinterName = ToNewUnicode(*GlobalPrinters::GetInstance()->GetStringAt(0)); + aDefaultPrinterName = *GlobalPrinters::GetInstance()->GetStringAt(0); if (allocate) { GlobalPrinters::GetInstance()->FreeGlobalPrinters(); diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp index 08b288c0642c..91c6c5861a12 100644 --- a/widget/gtk/nsPrintDialogGTK.cpp +++ b/widget/gtk/nsPrintDialogGTK.cpp @@ -277,9 +277,9 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter *aParent, GtkWidget* header_footer_table = gtk_table_new(3, 3, FALSE); // 3x3 table nsString header_footer_str[3]; - aSettings->GetHeaderStrLeft(getter_Copies(header_footer_str[0])); - aSettings->GetHeaderStrCenter(getter_Copies(header_footer_str[1])); - aSettings->GetHeaderStrRight(getter_Copies(header_footer_str[2])); + aSettings->GetHeaderStrLeft(header_footer_str[0]); + aSettings->GetHeaderStrCenter(header_footer_str[1]); + aSettings->GetHeaderStrRight(header_footer_str[2]); for (unsigned int i = 0; i < ArrayLength(header_dropdown); i++) { header_dropdown[i] = ConstructHeaderFooterDropdown(header_footer_str[i].get()); @@ -296,9 +296,9 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter *aParent, i, (i + 1), 1, 2, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 2, 2); } - aSettings->GetFooterStrLeft(getter_Copies(header_footer_str[0])); - aSettings->GetFooterStrCenter(getter_Copies(header_footer_str[1])); - aSettings->GetFooterStrRight(getter_Copies(header_footer_str[2])); + aSettings->GetFooterStrLeft(header_footer_str[0]); + aSettings->GetFooterStrCenter(header_footer_str[1]); + aSettings->GetFooterStrRight(header_footer_str[2]); for (unsigned int i = 0; i < ArrayLength(footer_dropdown); i++) { footer_dropdown[i] = ConstructHeaderFooterDropdown(header_footer_str[i].get()); @@ -371,22 +371,22 @@ nsPrintDialogWidgetGTK::ExportHeaderFooter(nsIPrintSettings *aNS) { const char* header_footer_str; header_footer_str = OptionWidgetToString(header_dropdown[0]); - aNS->SetHeaderStrLeft(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetHeaderStrLeft(NS_ConvertUTF8toUTF16(header_footer_str)); header_footer_str = OptionWidgetToString(header_dropdown[1]); - aNS->SetHeaderStrCenter(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetHeaderStrCenter(NS_ConvertUTF8toUTF16(header_footer_str)); header_footer_str = OptionWidgetToString(header_dropdown[2]); - aNS->SetHeaderStrRight(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetHeaderStrRight(NS_ConvertUTF8toUTF16(header_footer_str)); header_footer_str = OptionWidgetToString(footer_dropdown[0]); - aNS->SetFooterStrLeft(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetFooterStrLeft(NS_ConvertUTF8toUTF16(header_footer_str)); header_footer_str = OptionWidgetToString(footer_dropdown[1]); - aNS->SetFooterStrCenter(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetFooterStrCenter(NS_ConvertUTF8toUTF16(header_footer_str)); header_footer_str = OptionWidgetToString(footer_dropdown[2]); - aNS->SetFooterStrRight(NS_ConvertUTF8toUTF16(header_footer_str).get()); + aNS->SetFooterStrRight(NS_ConvertUTF8toUTF16(header_footer_str)); } nsresult @@ -583,10 +583,10 @@ nsPrintDialogServiceGTK::ShowPageSetup(nsPIDOMWindowOuter *aParent, nsCOMPtr psService = do_GetService("@mozilla.org/gfx/printsettings-service;1"); if (psService) { nsString printName; - aNSSettings->GetPrinterName(getter_Copies(printName)); + aNSSettings->GetPrinterName(printName); if (printName.IsVoid()) { - psService->GetDefaultPrinterName(getter_Copies(printName)); - aNSSettings->SetPrinterName(printName.get()); + psService->GetDefaultPrinterName(printName); + aNSSettings->SetPrinterName(printName); } psService->InitPrintSettingsFromPrefs(aNSSettings, true, nsIPrintSettings::kInitSaveAll); } diff --git a/widget/gtk/nsPrintSettingsGTK.cpp b/widget/gtk/nsPrintSettingsGTK.cpp index 013fc671e11e..c063af52c90a 100644 --- a/widget/gtk/nsPrintSettingsGTK.cpp +++ b/widget/gtk/nsPrintSettingsGTK.cpp @@ -409,12 +409,12 @@ nsPrintSettingsGTK::SetOrientation(int32_t aOrientation) } NS_IMETHODIMP -nsPrintSettingsGTK::GetToFileName(char16_t * *aToFileName) +nsPrintSettingsGTK::GetToFileName(nsAString& aToFileName) { // Get the gtk output filename const char* gtk_output_uri = gtk_print_settings_get(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI); if (!gtk_output_uri) { - *aToFileName = ToNewUnicode(mToFileName); + aToFileName = mToFileName; return NS_OK; } @@ -426,33 +426,27 @@ nsPrintSettingsGTK::GetToFileName(char16_t * *aToFileName) return rv; // Extract the path - nsAutoString path; - rv = file->GetPath(path); - NS_ENSURE_SUCCESS(rv, rv); - - *aToFileName = ToNewUnicode(path); - return NS_OK; + return file->GetPath(aToFileName); } NS_IMETHODIMP -nsPrintSettingsGTK::SetToFileName(const char16_t * aToFileName) +nsPrintSettingsGTK::SetToFileName(const nsAString& aToFileName) { - if (aToFileName[0] == 0) { + if (aToFileName.IsEmpty()) { mToFileName.SetLength(0); gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI, nullptr); return NS_OK; } - if (StringEndsWith(nsDependentString(aToFileName), NS_LITERAL_STRING(".ps"))) { + if (StringEndsWith(aToFileName, NS_LITERAL_STRING(".ps"))) { gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "ps"); } else { gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf"); } nsCOMPtr file; - nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), true, - getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(aToFileName, true, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); // Convert the nsIFile to a URL @@ -467,7 +461,7 @@ nsPrintSettingsGTK::SetToFileName(const char16_t * aToFileName) } NS_IMETHODIMP -nsPrintSettingsGTK::GetPrinterName(char16_t * *aPrinter) +nsPrintSettingsGTK::GetPrinterName(nsAString& aPrinter) { const char* gtkPrintName = gtk_print_settings_get_printer(mPrintSettings); if (!gtkPrintName) { @@ -475,17 +469,16 @@ nsPrintSettingsGTK::GetPrinterName(char16_t * *aPrinter) gtkPrintName = gtk_printer_get_name(mGTKPrinter); } else { // This mimics what nsPrintSettingsImpl does when we try to Get before we Set - nsString nullPrintName; - *aPrinter = ToNewUnicode(nullPrintName); + aPrinter.Truncate(); return NS_OK; } } - *aPrinter = UTF8ToNewUnicode(nsDependentCString(gtkPrintName)); + aPrinter = NS_ConvertUTF8toUTF16(gtkPrintName); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsGTK::SetPrinterName(const char16_t * aPrinter) +nsPrintSettingsGTK::SetPrinterName(const nsAString& aPrinter) { NS_ConvertUTF16toUTF8 gtkPrinter(aPrinter); @@ -537,16 +530,15 @@ nsPrintSettingsGTK::SetScaling(double aScaling) } NS_IMETHODIMP -nsPrintSettingsGTK::GetPaperName(char16_t * *aPaperName) +nsPrintSettingsGTK::GetPaperName(nsAString& aPaperName) { - NS_ENSURE_ARG_POINTER(aPaperName); const gchar* name = gtk_paper_size_get_name(gtk_page_setup_get_paper_size(mPageSetup)); - *aPaperName = ToNewUnicode(NS_ConvertUTF8toUTF16(name)); + aPaperName = NS_ConvertUTF8toUTF16(name); return NS_OK; } NS_IMETHODIMP -nsPrintSettingsGTK::SetPaperName(const char16_t * aPaperName) +nsPrintSettingsGTK::SetPaperName(const nsAString& aPaperName) { NS_ConvertUTF16toUTF8 gtkPaperName(aPaperName); diff --git a/widget/gtk/nsPrintSettingsGTK.h b/widget/gtk/nsPrintSettingsGTK.h index 21f38944913d..202a67fa537f 100644 --- a/widget/gtk/nsPrintSettingsGTK.h +++ b/widget/gtk/nsPrintSettingsGTK.h @@ -68,13 +68,13 @@ public: NS_IMETHOD GetOrientation(int32_t *aOrientation) override; NS_IMETHOD SetOrientation(int32_t aOrientation) override; - NS_IMETHOD GetToFileName(char16_t * *aToFileName) override; - NS_IMETHOD SetToFileName(const char16_t * aToFileName) override; + NS_IMETHOD GetToFileName(nsAString& aToFileName) override; + NS_IMETHOD SetToFileName(const nsAString& aToFileName) override; // Gets/Sets the printer name in the GtkPrintSettings. If no printer name is specified there, // you will get back the name of the current internal GtkPrinter. - NS_IMETHOD GetPrinterName(char16_t * *aPrinter) override; - NS_IMETHOD SetPrinterName(const char16_t * aPrinter) override; + NS_IMETHOD GetPrinterName(nsAString& Printer) override; + NS_IMETHOD SetPrinterName(const nsAString& aPrinter) override; // Number of copies is stored/gotten from the GtkPrintSettings. NS_IMETHOD GetNumCopies(int32_t *aNumCopies) override; @@ -84,8 +84,8 @@ public: NS_IMETHOD SetScaling(double aScaling) override; // A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize. - NS_IMETHOD GetPaperName(char16_t * *aPaperName) override; - NS_IMETHOD SetPaperName(const char16_t * aPaperName) override; + NS_IMETHOD GetPaperName(nsAString& aPaperName) override; + NS_IMETHOD SetPaperName(const nsAString& aPaperName) override; NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin) override; NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override; diff --git a/widget/nsIPrintSettings.idl b/widget/nsIPrintSettings.idl index 5c391c1ac894..947687028553 100644 --- a/widget/nsIPrintSettings.idl +++ b/widget/nsIPrintSettings.idl @@ -202,16 +202,16 @@ interface nsIPrintSettings : nsISupports attribute short printRange; - attribute wstring title; - attribute wstring docURL; + attribute AString title; + attribute AString docURL; - attribute wstring headerStrLeft; - attribute wstring headerStrCenter; - attribute wstring headerStrRight; + attribute AString headerStrLeft; + attribute AString headerStrCenter; + attribute AString headerStrRight; - attribute wstring footerStrLeft; - attribute wstring footerStrCenter; - attribute wstring footerStrRight; + attribute AString footerStrLeft; + attribute AString footerStrCenter; + attribute AString footerStrRight; attribute short howToEnableFrameUI; /* indicates how to enable the frameset UI */ attribute boolean isCancelled; /* indicates whether the print job has been cancelled */ @@ -222,7 +222,7 @@ interface nsIPrintSettings : nsISupports attribute boolean showPrintProgress; /* indicates whether the progress dialog should be shown */ /* Additional XP Related */ - attribute wstring paperName; /* name of paper */ + attribute AString paperName; /* name of paper */ attribute short paperData; /* native data value */ attribute double paperWidth; /* width of the paper in inches or mm */ attribute double paperHeight; /* height of the paper in inches or mm */ @@ -233,10 +233,10 @@ interface nsIPrintSettings : nsISupports attribute long orientation; /* see orientation consts */ attribute long numCopies; - attribute wstring printerName; /* name of destination printer */ + attribute AString printerName; /* name of destination printer */ attribute boolean printToFile; - attribute wstring toFileName; + attribute AString toFileName; attribute short outputFormat; attribute long printPageDelay; /* in milliseconds */ diff --git a/widget/nsIPrintSettingsService.idl b/widget/nsIPrintSettingsService.idl index 198581b34308..846881fd9276 100644 --- a/widget/nsIPrintSettingsService.idl +++ b/widget/nsIPrintSettingsService.idl @@ -58,7 +58,7 @@ interface nsIPrintSettingsService : nsISupports /** * The name of the last printer used, or else the system default printer. */ - readonly attribute wstring defaultPrinterName; + readonly attribute AString defaultPrinterName; /** * Initializes certain settings from the native printer into the PrintSettings @@ -68,7 +68,8 @@ interface nsIPrintSettingsService : nsISupports * Page Size * Number of Copies */ - void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); + void initPrintSettingsFromPrinter(in AString aPrinterName, + in nsIPrintSettings aPrintSettings); /** * Reads PrintSettings values from Prefs, diff --git a/widget/nsIPrintSettingsWin.idl b/widget/nsIPrintSettingsWin.idl index ae840b085543..65bb304bd1c9 100644 --- a/widget/nsIPrintSettingsWin.idl +++ b/widget/nsIPrintSettingsWin.idl @@ -35,8 +35,8 @@ interface nsIPrintSettingsWin : nsISupports * via the "m_pd" data member of the CPrintDialog * in MFC. */ - [noscript] attribute wstring deviceName; - [noscript] attribute wstring driverName; + [noscript] attribute AString deviceName; + [noscript] attribute AString driverName; [noscript] attribute nsDevMode devMode; diff --git a/widget/nsIPrinterEnumerator.idl b/widget/nsIPrinterEnumerator.idl index d9d00be3424a..b5dde214d3f6 100644 --- a/widget/nsIPrinterEnumerator.idl +++ b/widget/nsIPrinterEnumerator.idl @@ -18,7 +18,7 @@ interface nsIPrinterEnumerator : nsISupports * default printer; see nsIPrintSettingsService.defaultPrinterName * for that. */ - readonly attribute wstring defaultPrinterName; + readonly attribute AString defaultPrinterName; /** * Initializes certain settings from the native printer into the PrintSettings @@ -27,7 +27,8 @@ interface nsIPrinterEnumerator : nsISupports * Page Size * Number of Copies */ - void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); + void initPrintSettingsFromPrinter(in AString aPrinterName, + in nsIPrintSettings aPrintSettings); /** * The list of printer names diff --git a/widget/nsPrintOptionsImpl.cpp b/widget/nsPrintOptionsImpl.cpp index c2b5e113612e..7c77a8a35b92 100644 --- a/widget/nsPrintOptionsImpl.cpp +++ b/widget/nsPrintOptionsImpl.cpp @@ -138,40 +138,16 @@ nsPrintOptions::SerializeToPrintData(nsIPrintSettings* aSettings, aSettings->GetPrintBGImages(&data->printBGImages()); aSettings->GetPrintRange(&data->printRange()); - // I have no idea if I'm doing this string copying correctly... - nsString title; - aSettings->GetTitle(getter_Copies(title)); - data->title() = title; + aSettings->GetTitle(data->title()); + aSettings->GetDocURL(data->docURL()); - nsString docURL; - aSettings->GetDocURL(getter_Copies(docURL)); - data->docURL() = docURL; + aSettings->GetHeaderStrLeft(data->headerStrLeft()); + aSettings->GetHeaderStrCenter(data->headerStrCenter()); + aSettings->GetHeaderStrRight(data->headerStrRight()); - // Header strings... - nsString headerStrLeft; - aSettings->GetHeaderStrLeft(getter_Copies(headerStrLeft)); - data->headerStrLeft() = headerStrLeft; - - nsString headerStrCenter; - aSettings->GetHeaderStrCenter(getter_Copies(headerStrCenter)); - data->headerStrCenter() = headerStrCenter; - - nsString headerStrRight; - aSettings->GetHeaderStrRight(getter_Copies(headerStrRight)); - data->headerStrRight() = headerStrRight; - - // Footer strings... - nsString footerStrLeft; - aSettings->GetFooterStrLeft(getter_Copies(footerStrLeft)); - data->footerStrLeft() = footerStrLeft; - - nsString footerStrCenter; - aSettings->GetFooterStrCenter(getter_Copies(footerStrCenter)); - data->footerStrCenter() = footerStrCenter; - - nsString footerStrRight; - aSettings->GetFooterStrRight(getter_Copies(footerStrRight)); - data->footerStrRight() = footerStrRight; + aSettings->GetFooterStrLeft(data->footerStrLeft()); + aSettings->GetFooterStrCenter(data->footerStrCenter()); + aSettings->GetFooterStrRight(data->footerStrRight()); aSettings->GetHowToEnableFrameUI(&data->howToEnableFrameUI()); aSettings->GetIsCancelled(&data->isCancelled()); @@ -181,10 +157,7 @@ nsPrintOptions::SerializeToPrintData(nsIPrintSettings* aSettings, aSettings->GetShrinkToFit(&data->shrinkToFit()); aSettings->GetShowPrintProgress(&data->showPrintProgress()); - nsString paperName; - aSettings->GetPaperName(getter_Copies(paperName)); - data->paperName() = paperName; - + aSettings->GetPaperName(data->paperName()); aSettings->GetPaperData(&data->paperData()); aSettings->GetPaperWidth(&data->paperWidth()); aSettings->GetPaperHeight(&data->paperHeight()); @@ -196,15 +169,11 @@ nsPrintOptions::SerializeToPrintData(nsIPrintSettings* aSettings, aSettings->GetNumCopies(&data->numCopies()); - nsString printerName; - aSettings->GetPrinterName(getter_Copies(printerName)); - data->printerName() = printerName; + aSettings->GetPrinterName(data->printerName()); aSettings->GetPrintToFile(&data->printToFile()); - nsString toFileName; - aSettings->GetToFileName(getter_Copies(toFileName)); - data->toFileName() = toFileName; + aSettings->GetToFileName(data->toFileName()); aSettings->GetOutputFormat(&data->outputFormat()); aSettings->GetPrintPageDelay(&data->printPageDelay()); @@ -276,19 +245,18 @@ nsPrintOptions::DeserializeToPrintSettings(const PrintData& data, settings->SetPrintBGImages(data.printBGImages()); settings->SetPrintRange(data.printRange()); - // I have no idea if I'm doing this string copying correctly... - settings->SetTitle(data.title().get()); - settings->SetDocURL(data.docURL().get()); + settings->SetTitle(data.title()); + settings->SetDocURL(data.docURL()); // Header strings... - settings->SetHeaderStrLeft(data.headerStrLeft().get()); - settings->SetHeaderStrCenter(data.headerStrCenter().get()); - settings->SetHeaderStrRight(data.headerStrRight().get()); + settings->SetHeaderStrLeft(data.headerStrLeft()); + settings->SetHeaderStrCenter(data.headerStrCenter()); + settings->SetHeaderStrRight(data.headerStrRight()); // Footer strings... - settings->SetFooterStrLeft(data.footerStrLeft().get()); - settings->SetFooterStrCenter(data.footerStrCenter().get()); - settings->SetFooterStrRight(data.footerStrRight().get()); + settings->SetFooterStrLeft(data.footerStrLeft()); + settings->SetFooterStrCenter(data.footerStrCenter()); + settings->SetFooterStrRight(data.footerStrRight()); settings->SetHowToEnableFrameUI(data.howToEnableFrameUI()); settings->SetIsCancelled(data.isCancelled()); @@ -298,7 +266,7 @@ nsPrintOptions::DeserializeToPrintSettings(const PrintData& data, settings->SetShrinkToFit(data.shrinkToFit()); settings->SetShowPrintProgress(data.showPrintProgress()); - settings->SetPaperName(data.paperName().get()); + settings->SetPaperName(data.paperName()); settings->SetPaperData(data.paperData()); settings->SetPaperWidth(data.paperWidth()); @@ -311,11 +279,11 @@ nsPrintOptions::DeserializeToPrintSettings(const PrintData& data, settings->SetNumCopies(data.numCopies()); - settings->SetPrinterName(data.printerName().get()); + settings->SetPrinterName(data.printerName()); settings->SetPrintToFile(data.printToFile()); - settings->SetToFileName(data.toFileName().get()); + settings->SetToFileName(data.toFileName()); settings->SetOutputFormat(data.outputFormat()); settings->SetPrintPageDelay(data.printPageDelay()); @@ -533,7 +501,7 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, DUMP_DBL(kReadStr, kPrintPaperWidth, width); aPS->SetPaperHeight(height); DUMP_DBL(kReadStr, kPrintPaperHeight, height); - aPS->SetPaperName(str.get()); + aPS->SetPaperName(str); DUMP_STR(kReadStr, kPrintPaperName, str.get()); #if defined(XP_WIN) if (saveSanitizedSizePrefs) { @@ -560,42 +528,42 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) { if (GETSTRPREF(kPrintHeaderStrLeft, str)) { - aPS->SetHeaderStrLeft(str.get()); + aPS->SetHeaderStrLeft(str); DUMP_STR(kReadStr, kPrintHeaderStrLeft, str.get()); } } if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) { if (GETSTRPREF(kPrintHeaderStrCenter, str)) { - aPS->SetHeaderStrCenter(str.get()); + aPS->SetHeaderStrCenter(str); DUMP_STR(kReadStr, kPrintHeaderStrCenter, str.get()); } } if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) { if (GETSTRPREF(kPrintHeaderStrRight, str)) { - aPS->SetHeaderStrRight(str.get()); + aPS->SetHeaderStrRight(str); DUMP_STR(kReadStr, kPrintHeaderStrRight, str.get()); } } if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) { if (GETSTRPREF(kPrintFooterStrLeft, str)) { - aPS->SetFooterStrLeft(str.get()); + aPS->SetFooterStrLeft(str); DUMP_STR(kReadStr, kPrintFooterStrLeft, str.get()); } } if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) { if (GETSTRPREF(kPrintFooterStrCenter, str)) { - aPS->SetFooterStrCenter(str.get()); + aPS->SetFooterStrCenter(str); DUMP_STR(kReadStr, kPrintFooterStrCenter, str.get()); } } if (aFlags & nsIPrintSettings::kInitSaveFooterRight) { if (GETSTRPREF(kPrintFooterStrRight, str)) { - aPS->SetFooterStrRight(str.get()); + aPS->SetFooterStrRight(str); DUMP_STR(kReadStr, kPrintFooterStrRight, str.get()); } } @@ -651,7 +619,7 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, if (aFlags & nsIPrintSettings::kInitSaveToFileName) { if (GETSTRPREF(kPrintToFileName, str)) { - aPS->SetToFileName(str.get()); + aPS->SetToFileName(str); DUMP_STR(kReadStr, kPrintToFileName, str.get()); } } @@ -771,7 +739,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, NS_SUCCEEDED(aPS->GetPaperSizeUnit(&sizeUnit)) && NS_SUCCEEDED(aPS->GetPaperWidth(&width)) && NS_SUCCEEDED(aPS->GetPaperHeight(&height)) && - NS_SUCCEEDED(aPS->GetPaperName(getter_Copies(name))) + NS_SUCCEEDED(aPS->GetPaperName(name)) ) { DUMP_INT(kWriteStr, kPrintPaperSizeUnit, sizeUnit); Preferences::SetInt(GetPrefName(kPrintPaperSizeUnit, aPrinterName), @@ -822,7 +790,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) { - if (NS_SUCCEEDED(aPS->GetHeaderStrLeft(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetHeaderStrLeft(uStr))) { DUMP_STR(kWriteStr, kPrintHeaderStrLeft, uStr.get()); Preferences::SetString(GetPrefName(kPrintHeaderStrLeft, aPrinterName), uStr); @@ -830,7 +798,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) { - if (NS_SUCCEEDED(aPS->GetHeaderStrCenter(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetHeaderStrCenter(uStr))) { DUMP_STR(kWriteStr, kPrintHeaderStrCenter, uStr.get()); Preferences::SetString(GetPrefName(kPrintHeaderStrCenter, aPrinterName), uStr); @@ -838,7 +806,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) { - if (NS_SUCCEEDED(aPS->GetHeaderStrRight(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetHeaderStrRight(uStr))) { DUMP_STR(kWriteStr, kPrintHeaderStrRight, uStr.get()); Preferences::SetString(GetPrefName(kPrintHeaderStrRight, aPrinterName), uStr); @@ -846,7 +814,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) { - if (NS_SUCCEEDED(aPS->GetFooterStrLeft(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetFooterStrLeft(uStr))) { DUMP_STR(kWriteStr, kPrintFooterStrLeft, uStr.get()); Preferences::SetString(GetPrefName(kPrintFooterStrLeft, aPrinterName), uStr); @@ -854,7 +822,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) { - if (NS_SUCCEEDED(aPS->GetFooterStrCenter(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetFooterStrCenter(uStr))) { DUMP_STR(kWriteStr, kPrintFooterStrCenter, uStr.get()); Preferences::SetString(GetPrefName(kPrintFooterStrCenter, aPrinterName), uStr); @@ -862,7 +830,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveFooterRight) { - if (NS_SUCCEEDED(aPS->GetFooterStrRight(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetFooterStrRight(uStr))) { DUMP_STR(kWriteStr, kPrintFooterStrRight, uStr.get()); Preferences::SetString(GetPrefName(kPrintFooterStrRight, aPrinterName), uStr); @@ -915,7 +883,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, // Only the general version of this pref is saved if ((aFlags & nsIPrintSettings::kInitSavePrinterName) && aPrinterName.IsEmpty()) { - if (NS_SUCCEEDED(aPS->GetPrinterName(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetPrinterName(uStr))) { DUMP_STR(kWriteStr, kPrinterName, uStr.get()); Preferences::SetString(kPrinterName, uStr); } @@ -929,7 +897,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName, } if (aFlags & nsIPrintSettings::kInitSaveToFileName) { - if (NS_SUCCEEDED(aPS->GetToFileName(getter_Copies(uStr)))) { + if (NS_SUCCEEDED(aPS->GetToFileName(uStr))) { DUMP_STR(kWriteStr, kPrintToFileName, uStr.get()); Preferences::SetString(GetPrefName(kPrintToFileName, aPrinterName), uStr); } @@ -985,9 +953,9 @@ nsresult nsPrintOptions::_CreatePrintSettings(nsIPrintSettings **_retval) NS_ADDREF(*_retval = printSettings); // ref count nsString printerName; - nsresult rv = GetDefaultPrinterName(getter_Copies(printerName)); + nsresult rv = GetDefaultPrinterName(printerName); NS_ENSURE_SUCCESS(rv, rv); - (*_retval)->SetPrinterName(printerName.get()); + (*_retval)->SetPrinterName(printerName); (void)InitPrintSettingsFromPrefs(*_retval, false, nsIPrintSettings::kInitSaveAll); @@ -1015,7 +983,7 @@ nsPrintOptions::GetNewPrintSettings(nsIPrintSettings * *aNewPrintSettings) } NS_IMETHODIMP -nsPrintOptions::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) +nsPrintOptions::GetDefaultPrinterName(nsAString& aDefaultPrinterName) { nsresult rv; nsCOMPtr prtEnum = @@ -1040,7 +1008,7 @@ nsPrintOptions::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) } } if (isValid) { - *aDefaultPrinterName = ToNewUnicode(lastPrinterName); + aDefaultPrinterName = lastPrinterName; return NS_OK; } } @@ -1052,7 +1020,7 @@ nsPrintOptions::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) } NS_IMETHODIMP -nsPrintOptions::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, +nsPrintOptions::InitPrintSettingsFromPrinter(const nsAString& aPrinterName, nsIPrintSettings *aPrintSettings) { // Don't get print settings from the printer in the child when printing via @@ -1062,11 +1030,10 @@ nsPrintOptions::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, } NS_ENSURE_ARG_POINTER(aPrintSettings); - NS_ENSURE_ARG_POINTER(aPrinterName); #ifdef DEBUG nsString printerName; - aPrintSettings->GetPrinterName(getter_Copies(printerName)); + aPrintSettings->GetPrinterName(printerName); if (!printerName.Equals(aPrinterName)) { NS_WARNING("Printer names should match!"); } @@ -1105,7 +1072,7 @@ GetAdjustedPrinterName(nsIPrintSettings* aPS, bool aUsePNP, // Get the Printer Name from the PrintSettings // to use as a prefix for Pref Names - nsresult rv = aPS->GetPrinterName(getter_Copies(aPrinterName)); + nsresult rv = aPS->GetPrinterName(aPrinterName); NS_ENSURE_SUCCESS(rv, rv); // Convert any whitespaces, carriage returns or newlines to _ diff --git a/widget/nsPrintSettingsImpl.cpp b/widget/nsPrintSettingsImpl.cpp index 48cce8625df5..d8a81e7cc239 100644 --- a/widget/nsPrintSettingsImpl.cpp +++ b/widget/nsPrintSettingsImpl.cpp @@ -192,19 +192,15 @@ NS_IMETHODIMP nsPrintSettings::SetDuplex(const int32_t aDuplex) return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetPrinterName(char16_t * *aPrinter) +NS_IMETHODIMP nsPrintSettings::GetPrinterName(nsAString& aPrinter) { - NS_ENSURE_ARG_POINTER(aPrinter); - - *aPrinter = ToNewUnicode(mPrinter); - NS_ENSURE_TRUE(*aPrinter, NS_ERROR_OUT_OF_MEMORY); - + aPrinter = mPrinter; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPrinterName(const char16_t * aPrinter) +NS_IMETHODIMP nsPrintSettings::SetPrinterName(const nsAString& aPrinter) { - if (!aPrinter || !mPrinter.Equals(aPrinter)) { + if (!mPrinter.Equals(aPrinter)) { mIsInitedFromPrinter = false; mIsInitedFromPrefs = false; } @@ -237,19 +233,14 @@ NS_IMETHODIMP nsPrintSettings::SetPrintToFile(bool aPrintToFile) return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetToFileName(char16_t * *aToFileName) +NS_IMETHODIMP nsPrintSettings::GetToFileName(nsAString& aToFileName) { - //NS_ENSURE_ARG_POINTER(aToFileName); - *aToFileName = ToNewUnicode(mToFileName); + aToFileName = mToFileName; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetToFileName(const char16_t * aToFileName) +NS_IMETHODIMP nsPrintSettings::SetToFileName(const nsAString& aToFileName) { - if (aToFileName) { - mToFileName = aToFileName; - } else { - mToFileName.SetLength(0); - } + mToFileName = aToFileName; return NS_OK; } @@ -501,43 +492,25 @@ NS_IMETHODIMP nsPrintSettings::SetPrintRange(int16_t aPrintRange) return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetTitle(char16_t * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetTitle(nsAString& aTitle) { - NS_ENSURE_ARG_POINTER(aTitle); - if (!mTitle.IsEmpty()) { - *aTitle = ToNewUnicode(mTitle); - } else { - *aTitle = nullptr; - } + aTitle = mTitle; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetTitle(const char16_t * aTitle) +NS_IMETHODIMP nsPrintSettings::SetTitle(const nsAString& aTitle) { - if (aTitle) { - mTitle = aTitle; - } else { - mTitle.SetLength(0); - } + mTitle = aTitle; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetDocURL(char16_t * *aDocURL) +NS_IMETHODIMP nsPrintSettings::GetDocURL(nsAString& aDocURL) { - NS_ENSURE_ARG_POINTER(aDocURL); - if (!mURL.IsEmpty()) { - *aDocURL = ToNewUnicode(mURL); - } else { - *aDocURL = nullptr; - } + aDocURL = mURL; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetDocURL(const char16_t * aDocURL) +NS_IMETHODIMP nsPrintSettings::SetDocURL(const nsAString& aDocURL) { - if (aDocURL) { - mURL = aDocURL; - } else { - mURL.SetLength(0); - } + mURL = aDocURL; return NS_OK; } @@ -586,103 +559,70 @@ nsPrintSettings::SetPrintOptionsBits(int32_t aBits) return NS_OK; } -nsresult -nsPrintSettings::GetMarginStrs(char16_t * *aTitle, - nsHeaderFooterEnum aType, - int16_t aJust) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(nsAString& aTitle) { - NS_ENSURE_ARG_POINTER(aTitle); - *aTitle = nullptr; - if (aType == eHeader) { - switch (aJust) { - case kJustLeft: *aTitle = ToNewUnicode(mHeaderStrs[0]);break; - case kJustCenter: *aTitle = ToNewUnicode(mHeaderStrs[1]);break; - case kJustRight: *aTitle = ToNewUnicode(mHeaderStrs[2]);break; - } //switch - } else { - switch (aJust) { - case kJustLeft: *aTitle = ToNewUnicode(mFooterStrs[0]);break; - case kJustCenter: *aTitle = ToNewUnicode(mFooterStrs[1]);break; - case kJustRight: *aTitle = ToNewUnicode(mFooterStrs[2]);break; - } //switch - } + aTitle = mHeaderStrs[0]; + return NS_OK; +} +NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const nsAString& aTitle) +{ + mHeaderStrs[0] = aTitle; return NS_OK; } -nsresult -nsPrintSettings::SetMarginStrs(const char16_t * aTitle, - nsHeaderFooterEnum aType, - int16_t aJust) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(nsAString& aTitle) { - NS_ENSURE_ARG_POINTER(aTitle); - if (aType == eHeader) { - switch (aJust) { - case kJustLeft: mHeaderStrs[0] = aTitle;break; - case kJustCenter: mHeaderStrs[1] = aTitle;break; - case kJustRight: mHeaderStrs[2] = aTitle;break; - } //switch - } else { - switch (aJust) { - case kJustLeft: mFooterStrs[0] = aTitle;break; - case kJustCenter: mFooterStrs[1] = aTitle;break; - case kJustRight: mFooterStrs[2] = aTitle;break; - } //switch - } + aTitle = mHeaderStrs[1]; + return NS_OK; +} +NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const nsAString& aTitle) +{ + mHeaderStrs[1] = aTitle; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(char16_t * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(nsAString& aTitle) { - return GetMarginStrs(aTitle, eHeader, kJustLeft); + aTitle = mHeaderStrs[2]; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const char16_t * aTitle) +NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const nsAString& aTitle) { - return SetMarginStrs(aTitle, eHeader, kJustLeft); + mHeaderStrs[2] = aTitle; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(char16_t * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(nsAString& aTitle) { - return GetMarginStrs(aTitle, eHeader, kJustCenter); + aTitle = mFooterStrs[0]; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const char16_t * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const nsAString& aTitle) { - return SetMarginStrs(aTitle, eHeader, kJustCenter); + mFooterStrs[0] = aTitle; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(char16_t * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(nsAString& aTitle) { - return GetMarginStrs(aTitle, eHeader, kJustRight); + aTitle = mFooterStrs[1]; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const char16_t * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const nsAString& aTitle) { - return SetMarginStrs(aTitle, eHeader, kJustRight); + mFooterStrs[1] = aTitle; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(char16_t * *aTitle) +NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(nsAString& aTitle) { - return GetMarginStrs(aTitle, eFooter, kJustLeft); + aTitle = mFooterStrs[2]; + return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const char16_t * aTitle) +NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const nsAString& aTitle) { - return SetMarginStrs(aTitle, eFooter, kJustLeft); -} - -NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(char16_t * *aTitle) -{ - return GetMarginStrs(aTitle, eFooter, kJustCenter); -} -NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const char16_t * aTitle) -{ - return SetMarginStrs(aTitle, eFooter, kJustCenter); -} - -NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(char16_t * *aTitle) -{ - return GetMarginStrs(aTitle, eFooter, kJustRight); -} -NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const char16_t * aTitle) -{ - return SetMarginStrs(aTitle, eFooter, kJustRight); + mFooterStrs[2] = aTitle; + return NS_OK; } NS_IMETHODIMP nsPrintSettings::GetPrintFrameTypeUsage(int16_t *aPrintFrameTypeUsage) @@ -745,23 +685,14 @@ NS_IMETHODIMP nsPrintSettings::SetShowPrintProgress(bool aShowPrintProgress) return NS_OK; } -NS_IMETHODIMP nsPrintSettings::GetPaperName(char16_t * *aPaperName) +NS_IMETHODIMP nsPrintSettings::GetPaperName(nsAString& aPaperName) { - NS_ENSURE_ARG_POINTER(aPaperName); - if (!mPaperName.IsEmpty()) { - *aPaperName = ToNewUnicode(mPaperName); - } else { - *aPaperName = nullptr; - } + aPaperName = mPaperName; return NS_OK; } -NS_IMETHODIMP nsPrintSettings::SetPaperName(const char16_t * aPaperName) +NS_IMETHODIMP nsPrintSettings::SetPaperName(const nsAString& aPaperName) { - if (aPaperName) { - mPaperName = aPaperName; - } else { - mPaperName.SetLength(0); - } + mPaperName = aPaperName; return NS_OK; } diff --git a/widget/nsPrintSettingsImpl.h b/widget/nsPrintSettingsImpl.h index 8e344d06fdfc..32b2a69b0f68 100644 --- a/widget/nsPrintSettingsImpl.h +++ b/widget/nsPrintSettingsImpl.h @@ -42,9 +42,6 @@ protected: } nsHeaderFooterEnum; - nsresult GetMarginStrs(char16_t * *aTitle, nsHeaderFooterEnum aType, int16_t aJust); - nsresult SetMarginStrs(const char16_t * aTitle, nsHeaderFooterEnum aType, int16_t aJust); - // Members nsWeakPtr mSession; // Should never be touched by Clone or Assign diff --git a/widget/windows/nsDeviceContextSpecWin.cpp b/widget/windows/nsDeviceContextSpecWin.cpp index ff5278faa622..ef0cfc593356 100644 --- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -68,7 +68,7 @@ public: bool PrintersAreAllocated() { return mPrinters != nullptr; } LPWSTR GetItemFromList(int32_t aInx) { return mPrinters?mPrinters->ElementAt(aInx):nullptr; } nsresult EnumeratePrinterList(); - void GetDefaultPrinterName(nsString& aDefaultPrinterName); + void GetDefaultPrinterName(nsAString& aDefaultPrinterName); uint32_t GetNumPrinters() { return mPrinters?mPrinters->Length():0; } protected: @@ -94,8 +94,6 @@ struct AutoFreeGlobalPrinters //---------------------------------------------------------------------------------- nsDeviceContextSpecWin::nsDeviceContextSpecWin() { - mDriverName = nullptr; - mDeviceName = nullptr; mDevMode = nullptr; #ifdef MOZ_ENABLE_SKIA_PDF mPrintViaSkPDF = false; @@ -113,14 +111,12 @@ NS_IMPL_ISUPPORTS(nsDeviceContextSpecWin, nsIDeviceContextSpec) nsDeviceContextSpecWin::~nsDeviceContextSpecWin() { - SetDeviceName(nullptr); - SetDriverName(nullptr); SetDevMode(nullptr); nsCOMPtr psWin(do_QueryInterface(mPrintSettings)); if (psWin) { - psWin->SetDeviceName(nullptr); - psWin->SetDriverName(nullptr); + psWin->SetDeviceName(EmptyString()); + psWin->SetDriverName(EmptyString()); psWin->SetDevMode(nullptr); } @@ -133,16 +129,6 @@ nsDeviceContextSpecWin::~nsDeviceContextSpecWin() GlobalPrinters::GetInstance()->FreeGlobalPrinters(); } - -//------------------------------------------------------------------ -// helper -static char16_t * GetDefaultPrinterNameFromGlobalPrinters() -{ - nsAutoString printerName; - GlobalPrinters::GetInstance()->GetDefaultPrinterName(printerName); - return ToNewUnicode(printerName); -} - //---------------------------------------------------------------------------------- NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, nsIPrintSettings* aPrintSettings, @@ -171,15 +157,15 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, nsCOMPtr psWin(do_QueryInterface(aPrintSettings)); if (psWin) { - char16_t* deviceName; - char16_t* driverName; - psWin->GetDeviceName(&deviceName); // creates new memory (makes a copy) - psWin->GetDriverName(&driverName); // creates new memory (makes a copy) + nsAutoString deviceName; + nsAutoString driverName; + psWin->GetDeviceName(deviceName); + psWin->GetDriverName(driverName); LPDEVMODEW devMode; psWin->GetDevMode(&devMode); // creates new memory (makes a copy) - if (deviceName && driverName && devMode) { + if (!deviceName.IsEmpty() && !driverName.IsEmpty() && devMode) { // Scaling is special, it is one of the few // devMode items that we control in layout if (devMode->dmFields & DM_SCALE) { @@ -194,15 +180,9 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, SetDriverName(driverName); SetDevMode(devMode); - // clean up - free(deviceName); - free(driverName); - return NS_OK; } else { PR_PL(("***** nsDeviceContextSpecWin::Init - deviceName/driverName/devMode was NULL!\n")); - if (deviceName) free(deviceName); - if (driverName) free(driverName); if (devMode) ::HeapFree(::GetProcessHeap(), 0, devMode); } } @@ -211,41 +191,24 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, } // Get the Printer Name to be used and output format. - char16_t * printerName = nullptr; + nsAutoString printerName; if (mPrintSettings) { - mPrintSettings->GetPrinterName(&printerName); + mPrintSettings->GetPrinterName(printerName); } // If there is no name then use the default printer - if (!printerName || (printerName && !*printerName)) { - printerName = GetDefaultPrinterNameFromGlobalPrinters(); + if (printerName.IsEmpty()) { + GlobalPrinters::GetInstance()->GetDefaultPrinterName(printerName); } - NS_ASSERTION(printerName, "We have to have a printer name"); - if (!printerName || !*printerName) return rv; + if (printerName.IsEmpty()) { + return rv; + } return GetDataFromPrinter(printerName, mPrintSettings); } //---------------------------------------------------------- -// Helper Function - Free and reallocate the string -static void CleanAndCopyString(wchar_t*& aStr, const wchar_t* aNewStr) -{ - if (aStr != nullptr) { - if (aNewStr != nullptr && wcslen(aStr) > wcslen(aNewStr)) { // reuse it if we can - wcscpy(aStr, aNewStr); - return; - } else { - free(aStr); - aStr = nullptr; - } - } - - if (nullptr != aNewStr) { - aStr = (wchar_t*) malloc(sizeof(wchar_t) * (wcslen(aNewStr) + 1)); - wcscpy(aStr, aNewStr); - } -} already_AddRefed nsDeviceContextSpecWin::MakePrintTarget() { @@ -266,7 +229,7 @@ already_AddRefed nsDeviceContextSpecWin::MakePrintTarget() if (mOutputFormat == nsIPrintSettings::kOutputFormatPDF) { nsString filename; - mPrintSettings->GetToFileName(getter_Copies(filename)); + mPrintSettings->GetToFileName(filename); nsAutoCString printFile(NS_ConvertUTF16toUTF8(filename).get()); auto skStream = MakeUnique(printFile.get()); @@ -311,7 +274,7 @@ already_AddRefed nsDeviceContextSpecWin::MakePrintTarget() if (mOutputFormat == nsIPrintSettings::kOutputFormatPDF) { nsString filename; - mPrintSettings->GetToFileName(getter_Copies(filename)); + mPrintSettings->GetToFileName(filename); double width, height; mPrintSettings->GetEffectivePageSize(&width, &height); @@ -339,8 +302,8 @@ already_AddRefed nsDeviceContextSpecWin::MakePrintTarget() } if (mDevMode) { - NS_WARNING_ASSERTION(mDriverName, "No driver!"); - HDC dc = ::CreateDCW(mDriverName, mDeviceName, nullptr, mDevMode); + NS_WARNING_ASSERTION(!mDriverName.IsEmpty(), "No driver!"); + HDC dc = ::CreateDCW(mDriverName.get(), mDeviceName.get(), nullptr, mDevMode); if (!dc) { gfxCriticalError(gfxCriticalError::DefaultOptions(false)) << "Failed to create device context in GetSurfaceForPrinter"; @@ -457,8 +420,8 @@ nsDeviceContextSpecWin::BeginDocument(const nsAString& aTitle, // to once we reach EndDocument. The only reason we create it here rather // than in EndDocument is so that we don't need to store aTitle and // aPrintToFileName as member data. - NS_WARNING_ASSERTION(mDriverName, "No driver!"); - mDC = ::CreateDCW(mDriverName, mDeviceName, nullptr, mDevMode); + NS_WARNING_ASSERTION(!mDriverName.IsEmpty(), "No driver!"); + mDC = ::CreateDCW(mDriverName.get(), mDeviceName.get(), nullptr, mDevMode); if (mDC == NULL) { gfxCriticalError(gfxCriticalError::DefaultOptions(false)) << "Failed to create device context in GetSurfaceForPrinter"; @@ -527,15 +490,15 @@ nsDeviceContextSpecWin::EndDocument() } //---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetDeviceName(char16ptr_t aDeviceName) +void nsDeviceContextSpecWin::SetDeviceName(const nsAString& aDeviceName) { - CleanAndCopyString(mDeviceName, aDeviceName); + mDeviceName = aDeviceName; } //---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetDriverName(char16ptr_t aDriverName) +void nsDeviceContextSpecWin::SetDriverName(const nsAString& aDriverName) { - CleanAndCopyString(mDriverName, aDriverName); + mDriverName = aDriverName; } //---------------------------------------------------------------------------------- @@ -560,7 +523,8 @@ nsDeviceContextSpecWin::GetDevMode(LPDEVMODEW &aDevMode) //---------------------------------------------------------------------------------- // Setup the object's data member with the selected printer's data nsresult -nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS) +nsDeviceContextSpecWin::GetDataFromPrinter(const nsAString& aName, + nsIPrintSettings* aPS) { nsresult rv = NS_ERROR_FAILURE; @@ -574,7 +538,8 @@ nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* } nsHPRINTER hPrinter = nullptr; - wchar_t *name = (wchar_t*)aName; // Windows APIs use non-const name argument + const nsString& flat = PromiseFlatString(aName); + wchar_t* name = (wchar_t*)flat.get(); // Windows APIs use non-const name argument BOOL status = ::OpenPrinterW(name, &hPrinter, nullptr); if (status) { @@ -589,7 +554,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* PR_PL(("**** nsDeviceContextSpecWin::GetDataFromPrinter - Couldn't get " "size of DEVMODE using DocumentPropertiesW(pDeviceName = \"%s\"). " "GetLastEror() = %08x\n", - aName ? NS_ConvertUTF16toUTF8(aName).get() : "", GetLastError())); + NS_ConvertUTF16toUTF8(aName).get(), GetLastError())); return NS_ERROR_FAILURE; } @@ -614,7 +579,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* // because they may have been set from invalid prefs. if (ret == IDOK) { // We need to get information from the device as well. - nsAutoHDC printerDC(::CreateICW(kDriverName, aName, nullptr, pDevMode)); + nsAutoHDC printerDC(::CreateICW(kDriverName, name, nullptr, pDevMode)); if (NS_WARN_IF(!printerDC)) { ::HeapFree(::GetProcessHeap(), 0, pDevMode); return NS_ERROR_FAILURE; @@ -635,7 +600,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* SetDeviceName(aName); - SetDriverName(kDriverName); + SetDriverName(nsDependentString(kDriverName)); rv = NS_OK; } else { @@ -664,22 +629,19 @@ NS_IMPL_ISUPPORTS(nsPrinterEnumeratorWin, nsIPrinterEnumerator) //---------------------------------------------------------------------------------- // Return the Default Printer name NS_IMETHODIMP -nsPrinterEnumeratorWin::GetDefaultPrinterName(char16_t * *aDefaultPrinterName) +nsPrinterEnumeratorWin::GetDefaultPrinterName(nsAString& aDefaultPrinterName) { - NS_ENSURE_ARG_POINTER(aDefaultPrinterName); - - *aDefaultPrinterName = GetDefaultPrinterNameFromGlobalPrinters(); // helper - + GlobalPrinters::GetInstance()->GetDefaultPrinterName(aDefaultPrinterName); return NS_OK; } NS_IMETHODIMP -nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const char16_t *aPrinterName, nsIPrintSettings *aPrintSettings) +nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const nsAString& aPrinterName, + nsIPrintSettings *aPrintSettings) { - NS_ENSURE_ARG_POINTER(aPrinterName); NS_ENSURE_ARG_POINTER(aPrintSettings); - if (!*aPrinterName) { + if (aPrinterName.IsEmpty()) { return NS_OK; } @@ -724,7 +686,8 @@ nsPrinterEnumeratorWin::InitPrintSettingsFromPrinter(const char16_t *aPrinterNam aPrintSettings->SetPrinterName(aPrinterName); // We need to get information from the device as well. - char16ptr_t printerName = aPrinterName; + const nsString& flat = PromiseFlatString(aPrinterName); + char16ptr_t printerName = flat.get(); HDC dc = ::CreateICW(kDriverName, printerName, nullptr, devmode); if (NS_WARN_IF(!dc)) { return NS_ERROR_FAILURE; @@ -833,7 +796,7 @@ GlobalPrinters::EnumerateNativePrinters() //------------------------------------------------------------------ // Uses the GetProfileString to get the default printer from the registry void -GlobalPrinters::GetDefaultPrinterName(nsString& aDefaultPrinterName) +GlobalPrinters::GetDefaultPrinterName(nsAString& aDefaultPrinterName) { aDefaultPrinterName.Truncate(); WCHAR szDefaultPrinterName[1024]; @@ -853,7 +816,8 @@ GlobalPrinters::GetDefaultPrinterName(nsString& aDefaultPrinterName) aDefaultPrinterName = EmptyString(); } - PR_PL(("DEFAULT PRINTER [%s]\n", aDefaultPrinterName.get())); + PR_PL(("DEFAULT PRINTER [%s]\n", + PromiseFlatString(aDefaultPrinterName).get())); } //---------------------------------------------------------------------------------- diff --git a/widget/windows/nsDeviceContextSpecWin.h b/widget/windows/nsDeviceContextSpecWin.h index 4548445a3ea3..ec65fc0fab66 100644 --- a/widget/windows/nsDeviceContextSpecWin.h +++ b/widget/windows/nsDeviceContextSpecWin.h @@ -51,8 +51,8 @@ public: float GetPrintingScale() final; - void GetDriverName(wchar_t *&aDriverName) const { aDriverName = mDriverName; } - void GetDeviceName(wchar_t *&aDeviceName) const { aDeviceName = mDeviceName; } + void GetDriverName(nsAString& aDriverName) const { aDriverName = mDriverName; } + void GetDeviceName(nsAString& aDeviceName) const { aDeviceName = mDeviceName; } // The GetDevMode will return a pointer to a DevMode // whether it is from the Global memory handle or just the DevMode @@ -61,18 +61,19 @@ public: void GetDevMode(LPDEVMODEW &aDevMode); // helper functions - nsresult GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS = nullptr); + nsresult GetDataFromPrinter(const nsAString& aName, + nsIPrintSettings* aPS = nullptr); protected: - void SetDeviceName(char16ptr_t aDeviceName); - void SetDriverName(char16ptr_t aDriverName); + void SetDeviceName(const nsAString& aDeviceName); + void SetDriverName(const nsAString& aDriverName); void SetDevMode(LPDEVMODEW aDevMode); virtual ~nsDeviceContextSpecWin(); - wchar_t* mDriverName; - wchar_t* mDeviceName; + nsString mDriverName; + nsString mDeviceName; LPDEVMODEW mDevMode; nsCOMPtr mPrintSettings; diff --git a/widget/windows/nsPrintOptionsWin.cpp b/widget/windows/nsPrintOptionsWin.cpp index 97b15fa3fbc5..162660f88ad6 100644 --- a/widget/windows/nsPrintOptionsWin.cpp +++ b/widget/windows/nsPrintOptionsWin.cpp @@ -55,18 +55,15 @@ nsPrintOptionsWin::SerializeToPrintData(nsIPrintSettings* aSettings, return NS_ERROR_FAILURE; } - char16_t* deviceName; - char16_t* driverName; + nsAutoString deviceName; + nsAutoString driverName; - psWin->GetDeviceName(&deviceName); - psWin->GetDriverName(&driverName); + psWin->GetDeviceName(deviceName); + psWin->GetDriverName(driverName); data->deviceName().Assign(deviceName); data->driverName().Assign(driverName); - free(deviceName); - free(driverName); - // When creating the print dialog on Windows, we only need to send certain // print settings information from the parent to the child not vice versa. if (XRE_IsParentProcess()) { @@ -117,8 +114,8 @@ nsPrintOptionsWin::DeserializeToPrintSettings(const PrintData& data, } if (XRE_IsContentProcess()) { - psWin->SetDeviceName(data.deviceName().get()); - psWin->SetDriverName(data.driverName().get()); + psWin->SetDeviceName(data.deviceName()); + psWin->SetDriverName(data.driverName()); psWin->SetPrintableWidthInInches(data.printableWidthInInches()); psWin->SetPrintableHeightInInches(data.printableHeightInInches()); diff --git a/widget/windows/nsPrintSettingsWin.cpp b/widget/windows/nsPrintSettingsWin.cpp index 80e73e530b98..4aff0aed80e6 100644 --- a/widget/windows/nsPrintSettingsWin.cpp +++ b/widget/windows/nsPrintSettingsWin.cpp @@ -154,10 +154,8 @@ nsPrintSettingsWin::nsPrintSettingsWin() : * See documentation in nsPrintSettingsWin.h * @update */ -nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin& aPS) : - mDeviceName(nullptr), - mDriverName(nullptr), - mDevMode(nullptr) +nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin& aPS) + : mDevMode(nullptr) { *this = aPS; } @@ -168,38 +166,28 @@ nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin& aPS) : */ nsPrintSettingsWin::~nsPrintSettingsWin() { - if (mDeviceName) free(mDeviceName); - if (mDriverName) free(mDriverName); if (mDevMode) ::HeapFree(::GetProcessHeap(), 0, mDevMode); } -NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const char16_t * aDeviceName) +NS_IMETHODIMP nsPrintSettingsWin::SetDeviceName(const nsAString& aDeviceName) { - if (mDeviceName) { - free(mDeviceName); - } - mDeviceName = aDeviceName?wcsdup(char16ptr_t(aDeviceName)):nullptr; + mDeviceName = aDeviceName; return NS_OK; } -NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(char16_t **aDeviceName) +NS_IMETHODIMP nsPrintSettingsWin::GetDeviceName(nsAString& aDeviceName) { - NS_ENSURE_ARG_POINTER(aDeviceName); - *aDeviceName = mDeviceName?reinterpret_cast(wcsdup(mDeviceName)):nullptr; + aDeviceName = mDeviceName; return NS_OK; } -NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const char16_t * aDriverName) +NS_IMETHODIMP nsPrintSettingsWin::SetDriverName(const nsAString& aDriverName) { - if (mDriverName) { - free(mDriverName); - } - mDriverName = aDriverName?wcsdup(char16ptr_t(aDriverName)):nullptr; + mDriverName = aDriverName; return NS_OK; } -NS_IMETHODIMP nsPrintSettingsWin::GetDriverName(char16_t **aDriverName) +NS_IMETHODIMP nsPrintSettingsWin::GetDriverName(nsAString& aDriverName) { - NS_ENSURE_ARG_POINTER(aDriverName); - *aDriverName = mDriverName?reinterpret_cast(wcsdup(mDriverName)):nullptr; + aDriverName = mDriverName; return NS_OK; } @@ -425,21 +413,13 @@ nsPrintSettingsWin& nsPrintSettingsWin::operator=(const nsPrintSettingsWin& rhs) ((nsPrintSettings&) *this) = rhs; - if (mDeviceName) { - free(mDeviceName); - } - - if (mDriverName) { - free(mDriverName); - } - // Use free because we used the native malloc to create the memory if (mDevMode) { ::HeapFree(::GetProcessHeap(), 0, mDevMode); } - mDeviceName = rhs.mDeviceName?wcsdup(rhs.mDeviceName):nullptr; - mDriverName = rhs.mDriverName?wcsdup(rhs.mDriverName):nullptr; + mDeviceName = rhs.mDeviceName; + mDriverName = rhs.mDriverName; if (rhs.mDevMode) { CopyDevMode(rhs.mDevMode, mDevMode); diff --git a/widget/windows/nsPrintSettingsWin.h b/widget/windows/nsPrintSettingsWin.h index d4a31b41e20a..db25e447e82f 100644 --- a/widget/windows/nsPrintSettingsWin.h +++ b/widget/windows/nsPrintSettingsWin.h @@ -47,8 +47,8 @@ public: protected: void CopyDevMode(DEVMODEW* aInDevMode, DEVMODEW *& aOutDevMode); - wchar_t* mDeviceName; - wchar_t* mDriverName; + nsString mDeviceName; + nsString mDriverName; LPDEVMODEW mDevMode; double mPrintableWidthInInches = 0l; double mPrintableHeightInInches = 0l; From cc0c227c0029824e70edca5ce61d5069ee9ba1d3 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 4 Oct 2017 14:18:19 +0200 Subject: [PATCH 21/39] Bug 1404910 - WebSocket should consider the corrent top-level window principal, r=smaug --- dom/base/WebSocket.cpp | 15 +++-- dom/base/test/iframe_webSocket_sandbox.html | 65 +++++++++++++++++++++ dom/base/test/mochitest.ini | 3 + dom/base/test/test_webSocket_sandbox.html | 34 +++++++++++ 4 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 dom/base/test/iframe_webSocket_sandbox.html create mode 100644 dom/base/test/test_webSocket_sandbox.html diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index 45f136d3ad26..8560b08deaa4 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -1666,18 +1666,17 @@ WebSocketImpl::Init(JSContext* aCx, nsCOMPtr innerWindow; while (true) { - if (principal) { - bool isNullPrincipal = true; - isNullPrincipal = principal->GetIsNullPrincipal(); - if (isNullPrincipal || nsContentUtils::IsSystemPrincipal(principal)) { - break; - } + if (principal && !principal->GetIsNullPrincipal()) { + break; } if (!innerWindow) { innerWindow = do_QueryInterface(globalObject); - if (NS_WARN_IF(!innerWindow)) { - return NS_ERROR_DOM_SECURITY_ERR; + if (!innerWindow) { + // If we are in a XPConnect sandbox or in a JS component, + // innerWindow will be null. There is nothing on top of this to be + // considered. + break; } } diff --git a/dom/base/test/iframe_webSocket_sandbox.html b/dom/base/test/iframe_webSocket_sandbox.html new file mode 100644 index 000000000000..d889a79b05da --- /dev/null +++ b/dom/base/test/iframe_webSocket_sandbox.html @@ -0,0 +1,65 @@ + + + + diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index ff03a6db5e10..664e851d5f36 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -806,6 +806,9 @@ skip-if = toolkit == 'android' skip-if = toolkit == 'android' [test_websocket_permessage_deflate.html] skip-if = toolkit == 'android' +[test_webSocket_sandbox.html] +skip-if = toolkit == 'android' +support-files = iframe_webSocket_sandbox.html [test_websocket1.html] skip-if = toolkit == 'android' [test_websocket2.html] diff --git a/dom/base/test/test_webSocket_sandbox.html b/dom/base/test/test_webSocket_sandbox.html new file mode 100644 index 000000000000..b343fa784f39 --- /dev/null +++ b/dom/base/test/test_webSocket_sandbox.html @@ -0,0 +1,34 @@ + + + + Bug 1252751 + + + + +
+ + + + From 17a6cb2cbf99f9fce0d800e4202e4d05cc0ca894 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Wed, 11 Oct 2017 18:00:18 -0500 Subject: [PATCH 22/39] Bug 1407766 - Remove symantec dlls from the content process dll blocklist due to process startup issues associated with symantec av products. r=bobowen MozReview-Commit-ID: JMOIptO2y7F --- security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp index 0ba5e2526f72..33b676fcff15 100644 --- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp +++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp @@ -38,10 +38,6 @@ const std::vector kDllsToUnload = { // K7 Computing (bug 1400637) L"k7pswsen.dll", - // Symantec (bug 1400637) - L"prntm64.dll", - L"sysfer.dll", - // Avast Antivirus (bug 1400637) L"snxhk64.dll", L"snxhk.dll", From bf13779edabf1b4a5266d4f14ae50e09201ce96a Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 12 Oct 2017 09:42:53 +0200 Subject: [PATCH 23/39] Backed out changeset 76fb9cb1078c (bug 1324463) for failing own crashtest in non-stylo builds. r=backout on a CLOSED TREE --HG-- extra : amend_source : 41a2653de93c450e89a005beb532177cf224eea7 --- dom/base/ShadowRoot.cpp | 2 +- dom/base/crashtests/1324463.html | 16 ---------------- dom/base/crashtests/crashtests.list | 1 - 3 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 dom/base/crashtests/1324463.html diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index fdbc2995df1c..ccb0a2b931dd 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -508,7 +508,7 @@ ShadowRoot::ContentAppended(nsIDocument* aDocument, // Add insertion point to destination insertion points of fallback content. if (nsContentUtils::IsContentInsertionPoint(aContainer)) { HTMLContentElement* content = HTMLContentElement::FromContent(aContainer); - if (content && content->MatchedNodes().IsEmpty()) { + if (content->MatchedNodes().IsEmpty()) { currentChild->DestInsertionPoints().AppendElement(aContainer); } } diff --git a/dom/base/crashtests/1324463.html b/dom/base/crashtests/1324463.html deleted file mode 100644 index a90358f37731..000000000000 --- a/dom/base/crashtests/1324463.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index 11f6230cd721..89c5ee4139a4 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -231,4 +231,3 @@ load 1400701.html load 1403377.html load 1405771.html load 1406109-1.html -pref(dom.webcomponents.enabled,true) load 1324463.html From 9885b4245edef0edcbcc244e90f915bfe2a2df32 Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Thu, 12 Oct 2017 15:57:41 +0800 Subject: [PATCH 24/39] Backed out changeset 20571bff3967 (bug 1389561) --- dom/quota/ActorsParent.cpp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index f6517a3101ae..38beaa13030e 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -3838,13 +3838,6 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType, return nullptr; } -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); - MOZ_DIAGNOSTIC_ASSERT(mTemporaryStorageInitialized); - } -#endif - nsString path; nsresult rv = aFile->GetPath(path); NS_ENSURE_SUCCESS(rv, nullptr); @@ -3930,13 +3923,6 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType, { NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!"); -#if defined(NIGHTLY_BUILD) - if (aPersistenceType != PERSISTENCE_TYPE_PERSISTENT){ - MutexAutoLock autoLock(mQuotaMutex); - MOZ_DIAGNOSTIC_ASSERT(mTemporaryStorageInitialized); - } -#endif - if (aFileSizeOut) { *aFileSizeOut = 0; } @@ -5256,14 +5242,7 @@ QuotaManager::EnsureOriginIsInitializedInternal( NS_ENSURE_SUCCESS(rv, rv); } -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); mTemporaryStorageInitialized = true; - } -#else - mTemporaryStorageInitialized = true; -#endif CheckTemporaryStorageLimits(); } @@ -5349,16 +5328,7 @@ QuotaManager::ResetOrClearCompleted() AssertIsOnIOThread(); mInitializedOrigins.Clear(); - -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); - mTemporaryStorageInitialized = false; - } -#else - mTemporaryStorageInitialized = false; -#endif - + mTemporaryStorageInitialized = false; mStorageInitialized = false; ReleaseIOThreadObjects(); From 4f3b63ae99324f94975bece42288e6eb2e4d923e Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 12 Oct 2017 11:04:46 +0200 Subject: [PATCH 25/39] Bug 1406957 part 4 - Remove now-dead InterpreterFrame createSingleton flag. r=tcampbell --- js/src/vm/Interpreter.cpp | 3 --- js/src/vm/Stack-inl.h | 8 -------- js/src/vm/Stack.h | 15 +-------------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index dab4e4cecfce..e3e6ee04a585 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -3135,9 +3135,6 @@ CASE(JSOP_FUNCALL) if (!activation.pushInlineFrame(args, funScript, construct)) goto error; - - if (createSingleton) - REGS.fp()->setCreateSingleton(); } SET_SCRIPT(REGS.fp()->script()); diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 9b9f82d1fc28..08cf21862e99 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -562,14 +562,6 @@ AbstractFramePtr::hasInitialEnvironment() const return asRematerializedFrame()->hasInitialEnvironment(); } -inline bool -AbstractFramePtr::createSingleton() const -{ - if (isInterpreterFrame()) - return asInterpreterFrame()->createSingleton(); - return false; -} - inline bool AbstractFramePtr::isGlobalFrame() const { diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 8dbbda2914e3..590699d9424f 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -270,7 +270,6 @@ class AbstractFramePtr inline bool hasArgsObj() const; inline ArgumentsObject& argsObj() const; inline void initArgsObj(ArgumentsObject& argsobj) const; - inline bool createSingleton() const; inline Value& unaliasedLocal(uint32_t i); inline Value& unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING); @@ -339,15 +338,12 @@ class InterpreterFrame */ RUNNING_IN_JIT = 0x100, - /* Miscellaneous state. */ - CREATE_SINGLETON = 0x200, /* Constructed |this| object should be singleton. */ - /* * If set, this frame has been on the stack when * |js::SavedStacks::saveCurrentStack| was called, and so there is a * |js::SavedFrame| object cached for this frame. */ - HAS_CACHED_SAVED_FRAME = 0x400, + HAS_CACHED_SAVED_FRAME = 0x200, }; mutable uint32_t flags_; /* bits described by Flags */ @@ -759,15 +755,6 @@ class InterpreterFrame return flags_ & HAS_ARGS_OBJ; } - void setCreateSingleton() { - MOZ_ASSERT(isConstructing()); - flags_ |= CREATE_SINGLETON; - } - bool createSingleton() const { - MOZ_ASSERT(isConstructing()); - return flags_ & CREATE_SINGLETON; - } - /* * Debugger eval frames. * From b39bc4656aa29d81e7dec4241c624b1820370868 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 12 Oct 2017 11:06:55 +0200 Subject: [PATCH 26/39] Bug 1407058 - Fix isDataProperty to return false for accessors with nullptr getter/setter. r=evilpie --- js/src/jit-test/tests/basic/bug1407058.js | 16 ++++++++++++++++ js/src/vm/Shape.cpp | 6 +++--- js/src/vm/Shape.h | 8 ++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 js/src/jit-test/tests/basic/bug1407058.js diff --git a/js/src/jit-test/tests/basic/bug1407058.js b/js/src/jit-test/tests/basic/bug1407058.js new file mode 100644 index 000000000000..7c0953986b63 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug1407058.js @@ -0,0 +1,16 @@ +"use strict"; +function f() { + var o = {}; + Object.defineProperty(o, "x", {get: undefined, set: undefined}); + for (var i = 0; i < 20; i++) { + var ex = null; + try { + o.x = 9; + } catch (e) { + ex = e; + } + assertEq(ex instanceof TypeError, true); + assertEq(o.x, undefined); + } +} +f(); diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index bbd010d1af1a..9a123055f073 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -746,7 +746,7 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id, */ bool hadSlot = shape->isDataProperty(); uint32_t oldSlot = shape->maybeSlot(); - bool needSlot = !getter && !setter; + bool needSlot = Shape::isDataProperty(attrs, getter, setter); if (needSlot && slot == SHAPE_INVALID_SLOT && hadSlot) slot = oldSlot; @@ -789,7 +789,7 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id, * is also the last property). */ bool updateLast = (shape == obj->lastProperty()); - bool accessorShape = getter || setter || (attrs & (JSPROP_GETTER | JSPROP_SETTER)); + bool accessorShape = !Shape::isDataProperty(attrs, getter, setter); shape = NativeObject::replaceWithNewEquivalentShape(cx, obj, shape, nullptr, accessorShape); if (!shape) @@ -872,7 +872,7 @@ NativeObject::changeProperty(JSContext* cx, HandleNativeObject obj, HandleShape /* Allow only shared (slotless) => unshared (slotful) transition. */ #ifdef DEBUG - bool needSlot = !getter && !setter; + bool needSlot = Shape::isDataProperty(attrs, getter, setter); MOZ_ASSERT_IF(shape->isDataProperty() != needSlot, needSlot); #endif diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index c8294a1f1736..5524eca1d751 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -1013,9 +1013,13 @@ class Shape : public gc::TenuredCell BaseShape* base() const { return base_.get(); } + static bool isDataProperty(unsigned attrs, GetterOp getter, SetterOp setter) { + return !(attrs & (JSPROP_GETTER | JSPROP_SETTER)) && !getter && !setter; + } + bool isDataProperty() const { MOZ_ASSERT(!isEmptyShape()); - return !getter() && !setter(); + return isDataProperty(attrs, getter(), setter()); } uint32_t slot() const { MOZ_ASSERT(isDataProperty() && !hasMissingSlot()); return maybeSlot(); } uint32_t maybeSlot() const { @@ -1476,7 +1480,7 @@ struct StackShape bool isDataProperty() const { MOZ_ASSERT(!JSID_IS_EMPTY(propid)); - return !rawGetter && !rawSetter; + return Shape::isDataProperty(attrs, rawGetter, rawSetter); } bool hasMissingSlot() const { return maybeSlot() == SHAPE_INVALID_SLOT; } From 5f676753c030c7b87beacfd998bde2429bfd2f9d Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 12 Oct 2017 10:32:24 +0100 Subject: [PATCH 27/39] Bug 1395744 - Save scheduled zones at the start of GC in case begin callback changes them r=sfink --- js/src/gc/GCRuntime.h | 7 +++++ js/src/gc/Zone.cpp | 1 + js/src/gc/Zone.h | 1 + js/src/jsgc.cpp | 71 ++++++++++++++++++++++++++++++------------- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index b048c72a6120..ecbb42bd7b4d 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -34,6 +34,7 @@ namespace gc { typedef Vector ZoneGroupVector; using BlackGrayEdgeVector = Vector; +class AutoCallGCCallbacks; class AutoMaybeStartBackgroundAllocation; class AutoRunParallelTask; class AutoTraceSession; @@ -1050,6 +1051,10 @@ class GCRuntime void incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason reason, AutoLockForExclusiveAccess& lock); + friend class AutoCallGCCallbacks; + void maybeCallBeginCallback(); + void maybeCallEndCallback(); + void pushZealSelectedObjects(); void purgeRuntime(AutoLockForExclusiveAccess& lock); MOZ_MUST_USE bool beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAccess& lock); @@ -1408,6 +1413,8 @@ class GCRuntime ActiveThreadData fullCompartmentChecks; + ActiveThreadData gcBeginCallbackDepth; + Callback gcCallback; Callback gcDoCycleCollectionCallback; Callback tenuredCallback; diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index e60eac7b10e2..044e78e0a56c 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -58,6 +58,7 @@ JS::Zone::Zone(JSRuntime* rt, ZoneGroup* group) #endif jitZone_(group, nullptr), gcScheduled_(false), + gcScheduledSaved_(false), gcPreserveCode_(group, false), keepShapeTables_(group, false), listNext_(group, NotOnList) diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index dc1b526d2b60..de2bae432497 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -695,6 +695,7 @@ struct Zone : public JS::shadow::Zone, js::ZoneGroupData jitZone_; js::ActiveThreadData gcScheduled_; + js::ActiveThreadData gcScheduledSaved_; js::ZoneGroupData gcPreserveCode_; js::ZoneGroupData keepShapeTables_; diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index e76d8fa48032..85fde8a0c9d0 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -941,6 +941,7 @@ GCRuntime::GCRuntime(JSRuntime* rt) : incrementalLimit(0), #endif fullCompartmentChecks(false), + gcBeginCallbackDepth(0), alwaysPreserveCode(false), #ifdef DEBUG arenasEmptyAtShutdown(true), @@ -1648,25 +1649,6 @@ GCRuntime::callObjectsTenuredCallback() tenuredCallback.op(TlsContext.get(), tenuredCallback.data); } -namespace { - -class AutoNotifyGCActivity { - public: - explicit AutoNotifyGCActivity(GCRuntime& gc) : gc_(gc) { - if (!gc_.isIncrementalGCInProgress()) - gc_.callGCCallback(JSGC_BEGIN); - } - ~AutoNotifyGCActivity() { - if (!gc_.isIncrementalGCInProgress()) - gc_.callGCCallback(JSGC_END); - } - - private: - GCRuntime& gc_; -}; - -} // (anon) - bool GCRuntime::addFinalizeCallback(JSFinalizeCallback callback, void* data) { @@ -7105,6 +7087,53 @@ class AutoScheduleZonesForGC } /* anonymous namespace */ +class js::gc::AutoCallGCCallbacks { + GCRuntime& gc_; + + public: + explicit AutoCallGCCallbacks(GCRuntime& gc) : gc_(gc) { + gc_.maybeCallBeginCallback(); + } + ~AutoCallGCCallbacks() { + gc_.maybeCallEndCallback(); + } +}; + +void +GCRuntime::maybeCallBeginCallback() +{ + if (isIncrementalGCInProgress()) + return; + + if (gcBeginCallbackDepth == 0) { + // Save scheduled zone information in case the callback changes it. + for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) + zone->gcScheduledSaved_ = zone->gcScheduled_; + } + + gcBeginCallbackDepth++; + + callGCCallback(JSGC_BEGIN); + + MOZ_ASSERT(gcBeginCallbackDepth != 0); + gcBeginCallbackDepth--; + + if (gcBeginCallbackDepth == 0) { + // Restore scheduled zone information again. + for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) + zone->gcScheduled_ = zone->gcScheduledSaved_; + } +} + +void +GCRuntime::maybeCallEndCallback() +{ + if (isIncrementalGCInProgress()) + return; + + callGCCallback(JSGC_END); +} + /* * Run one GC "cycle" (either a slice of incremental GC or an entire * non-incremental GC. We disable inlining to ensure that the bottom of the @@ -7117,8 +7146,8 @@ class AutoScheduleZonesForGC MOZ_NEVER_INLINE GCRuntime::IncrementalResult GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason::Reason reason) { - // Note that the following is allowed to re-enter GC in the finalizer. - AutoNotifyGCActivity notify(*this); + // Note that GC callbacks are allowed to re-enter GC. + AutoCallGCCallbacks callCallbacks(*this); gcstats::AutoGCSlice agc(stats(), scanZonesBeforeGC(), invocationKind, budget, reason); From 74c8c8384a55a8ee7c369f96bdc46f2819fd58c3 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 9 Oct 2017 12:08:46 +0200 Subject: [PATCH 28/39] Bug 1406883: Make the constructing of MutableHandleValue explicit in CoerceInPlace calls; r=luke, r=jonco MozReview-Commit-ID: 5Xfc8W9TR6v --HG-- extra : amend_source : a8689c5e2206ec6bd06ab5455a638f19427f854f --- js/src/wasm/WasmBuiltins.cpp | 18 ++++++++++++------ js/src/wasm/WasmStubs.cpp | 9 +++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/js/src/wasm/WasmBuiltins.cpp b/js/src/wasm/WasmBuiltins.cpp index b263b23b5640..108908a56f29 100644 --- a/js/src/wasm/WasmBuiltins.cpp +++ b/js/src/wasm/WasmBuiltins.cpp @@ -292,28 +292,34 @@ WasmReportUnalignedAccess() } static int32_t -CoerceInPlace_ToInt32(MutableHandleValue val) +CoerceInPlace_ToInt32(Value* rawVal) { JSContext* cx = TlsContext.get(); int32_t i32; - if (!ToInt32(cx, val, &i32)) + RootedValue val(cx, *rawVal); + if (!ToInt32(cx, val, &i32)) { + *rawVal = PoisonedObjectValue(0x42); return false; - val.set(Int32Value(i32)); + } + *rawVal = Int32Value(i32); return true; } static int32_t -CoerceInPlace_ToNumber(MutableHandleValue val) +CoerceInPlace_ToNumber(Value* rawVal) { JSContext* cx = TlsContext.get(); double dbl; - if (!ToNumber(cx, val, &dbl)) + RootedValue val(cx, *rawVal); + if (!ToNumber(cx, val, &dbl)) { + *rawVal = PoisonedObjectValue(0x42); return false; - val.set(DoubleValue(dbl)); + } + *rawVal = DoubleValue(dbl); return true; } diff --git a/js/src/wasm/WasmStubs.cpp b/js/src/wasm/WasmStubs.cpp index 88b4e4a8f3d7..b459f4fe1e05 100644 --- a/js/src/wasm/WasmStubs.cpp +++ b/js/src/wasm/WasmStubs.cpp @@ -770,6 +770,15 @@ GenerateImportJitExit(MacroAssembler& masm, const FuncImport& fi, Label* throwLa AssertStackAlignment(masm, JitStackAlignment, sizeOfRetAddr); masm.callJitNoProfiler(callee); + // Note that there might be a GC thing in the JSReturnOperand now. + // In all the code paths from here: + // - either the value is unboxed because it was a primitive and we don't + // need to worry about rooting anymore. + // - or the value needs to be rooted, but nothing can cause a GC between + // here and CoerceInPlace, which roots before coercing to a primitive. + // In particular, this is true because wasm::InInterruptibleCode will + // return false when PC is in the jit exit. + // The JIT callee clobbers all registers, including WasmTlsReg and // FramePointer, so restore those here. During this sequence of // instructions, FP can't be trusted by the profiling frame iterator. From cafdee7c6272a3f7ecbfb1022097bf961cf7b4f2 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 12 Oct 2017 13:16:29 +0200 Subject: [PATCH 29/39] Bug 1407565 - Add NS_IsMainThread() assertions to WebAuthnManager r=jcj Bug #: 1407565 Differential Revision: https://phabricator.services.mozilla.com/D116 --HG-- extra : amend_source : 264a25a0343042fe7dfa9f5cc22c05c9b908f93a --- dom/webauthn/WebAuthnManager.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dom/webauthn/WebAuthnManager.cpp b/dom/webauthn/WebAuthnManager.cpp index 6bb0ff121afa..85c40cab5357 100644 --- a/dom/webauthn/WebAuthnManager.cpp +++ b/dom/webauthn/WebAuthnManager.cpp @@ -234,6 +234,7 @@ WebAuthnManager::MaybeClearTransaction() WebAuthnManager::~WebAuthnManager() { + MOZ_ASSERT(NS_IsMainThread()); MaybeClearTransaction(); } @@ -263,6 +264,7 @@ WebAuthnManager* WebAuthnManager::GetOrCreate() { MOZ_ASSERT(NS_IsMainThread()); + if (gWebAuthnManager) { return gWebAuthnManager; } @@ -284,6 +286,7 @@ already_AddRefed WebAuthnManager::MakeCredential(nsPIDOMWindowInner* aParent, const MakePublicKeyCredentialOptions& aOptions) { + MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aParent); MaybeClearTransaction(); @@ -292,7 +295,7 @@ WebAuthnManager::MakeCredential(nsPIDOMWindowInner* aParent, ErrorResult rv; RefPtr promise = Promise::Create(global, rv); - if(rv.Failed()) { + if (rv.Failed()) { return nullptr; } @@ -516,6 +519,8 @@ WebAuthnManager::MakeCredential(nsPIDOMWindowInner* aParent, void WebAuthnManager::StartRegister() { + MOZ_ASSERT(NS_IsMainThread()); + if (mChild) { mChild->SendRequestRegister(mInfo.ref()); } @@ -523,6 +528,8 @@ WebAuthnManager::StartRegister() { void WebAuthnManager::StartSign() { + MOZ_ASSERT(NS_IsMainThread()); + if (mChild) { mChild->SendRequestSign(mInfo.ref()); } @@ -530,6 +537,8 @@ WebAuthnManager::StartSign() { void WebAuthnManager::StartCancel() { + MOZ_ASSERT(NS_IsMainThread()); + if (mChild) { mChild->SendRequestCancel(); } @@ -539,6 +548,7 @@ already_AddRefed WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent, const PublicKeyCredentialRequestOptions& aOptions) { + MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aParent); MaybeClearTransaction(); @@ -547,7 +557,7 @@ WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent, ErrorResult rv; RefPtr promise = Promise::Create(global, rv); - if(rv.Failed()) { + if (rv.Failed()) { return nullptr; } @@ -690,6 +700,7 @@ WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent, void WebAuthnManager::FinishMakeCredential(nsTArray& aRegBuffer) { + MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mTransactionPromise); MOZ_ASSERT(mInfo.isSome()); @@ -813,6 +824,7 @@ void WebAuthnManager::FinishGetAssertion(nsTArray& aCredentialId, nsTArray& aSigBuffer) { + MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mTransactionPromise); MOZ_ASSERT(mInfo.isSome()); @@ -905,6 +917,7 @@ WebAuthnManager::Cancel(const nsresult& aError) NS_IMETHODIMP WebAuthnManager::HandleEvent(nsIDOMEvent* aEvent) { + MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aEvent); nsAutoString type; @@ -954,12 +967,14 @@ WebAuthnManager::ActorCreated(PBackgroundChild* aActor) void WebAuthnManager::ActorDestroyed() { + MOZ_ASSERT(NS_IsMainThread()); mChild = nullptr; } void WebAuthnManager::ActorFailed() { + MOZ_ASSERT(NS_IsMainThread()); MOZ_CRASH("We shouldn't be here!"); } From 5537b2c13691e38ddede91d65f36afdd4f2f86e6 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 12 Oct 2017 13:34:56 +0100 Subject: [PATCH 30/39] Bug 1407505 - Relax assertion in ExecutableAllocator destructor if the embedding leaked r=jandem --- js/src/jit/ExecutableAllocator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/jit/ExecutableAllocator.cpp b/js/src/jit/ExecutableAllocator.cpp index 696b1775183f..214cecbd76c1 100644 --- a/js/src/jit/ExecutableAllocator.cpp +++ b/js/src/jit/ExecutableAllocator.cpp @@ -128,7 +128,8 @@ ExecutableAllocator::~ExecutableAllocator() m_smallPools[i]->release(/* willDestroy = */true); // If this asserts we have a pool leak. - MOZ_ASSERT_IF(m_pools.initialized(), m_pools.empty()); + MOZ_ASSERT_IF(m_pools.initialized() && rt_->gc.shutdownCollectedEverything(), + m_pools.empty()); } ExecutablePool* From dfa8f6d79d29243325e5abb31a6028976bf745eb Mon Sep 17 00:00:00 2001 From: Andreas Farre Date: Wed, 11 Oct 2017 16:29:39 +0200 Subject: [PATCH 31/39] Bug 1407207 - Make it possible to turn off budget throttling for pgo. r=ted When generating the pgo profile the timeout background budget depletes for build/pgo/index.html, due to the profiling build actually being slower than ordinary builds. This defeats the purpose of budget, so turn off background throttling with budget when generating the profile. --- build/pgo/prefs_override.js | 2 ++ build/pgo/profileserver.py | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 build/pgo/prefs_override.js mode change 100644 => 100755 build/pgo/profileserver.py diff --git a/build/pgo/prefs_override.js b/build/pgo/prefs_override.js new file mode 100644 index 000000000000..9c10afa6811e --- /dev/null +++ b/build/pgo/prefs_override.js @@ -0,0 +1,2 @@ +// Turn off budget throttling for the profile server +user_pref("dom.timeout.enable_budget_timer_throttling", false); diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py old mode 100644 new mode 100755 index c79a477cc33c..ead72ed6903e --- a/build/pgo/profileserver.py +++ b/build/pgo/profileserver.py @@ -45,13 +45,19 @@ if __name__ == '__main__': # TODO: refactor this into mozprofile prefpath = os.path.join( build.topsrcdir, "testing", "profiles", "prefs_general.js") + overridepath = os.path.join( + build.topsrcdir, "build", "pgo", "prefs_override.js") + prefs = {} prefs.update(Preferences.read_prefs(prefpath)) + prefs.update(Preferences.read_prefs(overridepath)) + interpolation = {"server": "%s:%d" % httpd.httpd.server_address, "OOP": "false"} prefs = json.loads(json.dumps(prefs) % interpolation) for pref in prefs: prefs[pref] = Preferences.cast(prefs[pref]) + profile = FirefoxProfile(profile=profilePath, preferences=prefs, addons=[os.path.join( From 589b1b4dc79da71da2dc2571cf229823c376c565 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 12 Oct 2017 14:25:11 +0100 Subject: [PATCH 32/39] Bug 1360128 - Pass values from font-variation-settings through to the harfbuzz font object, so that shaping can take variations into account. r=jrmuizel --- gfx/thebes/gfxHarfBuzzShaper.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index d1f370f14e72..c070f04caa76 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -1283,6 +1283,15 @@ gfxHarfBuzzShaper::Initialize() uint32_t scale = FloatToFixed(mFont->GetAdjustedSize()); // 16.16 fixed-point hb_font_set_scale(mHBFont, scale, scale); + const auto& vars = mFont->GetStyle()->variationSettings; + size_t len = vars.Length(); + if (len > 0) { + // Fortunately, the hb_variation_t struct is compatible with our + // gfxFontFeature, so we can simply cast here. + auto hbVars = reinterpret_cast(vars.Elements()); + hb_font_set_variations(mHBFont, hbVars, len); + } + return true; } From 5610a0e1a84491f343ae145cf03194d166bf18d2 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 12 Oct 2017 14:25:42 +0100 Subject: [PATCH 33/39] Bug 1360128 pt 2 - Cherry-pick commit 19e77e01bc13f44138e1d50533327d314dd0a018 from upstream harfbuzz, to avoid incorrect shape-plan caching in harfbuzz with variation fonts. r=jrmuizel --- gfx/harfbuzz/src/hb-shape-plan.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gfx/harfbuzz/src/hb-shape-plan.cc b/gfx/harfbuzz/src/hb-shape-plan.cc index 3abf555c5f0c..5573cd224415 100644 --- a/gfx/harfbuzz/src/hb-shape-plan.cc +++ b/gfx/harfbuzz/src/hb-shape-plan.cc @@ -520,15 +520,17 @@ hb_shape_plan_create_cached2 (hb_face_t *face, retry: hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans); - for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next) - if (hb_shape_plan_matches (node->shape_plan, &proposal)) - { - DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache"); - return hb_shape_plan_reference (node->shape_plan); - } + + /* Don't look for plan in the cache if there were variation coordinates XXX Fix me. */ + if (!hb_coords_present (coords, num_coords)) + for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next) + if (hb_shape_plan_matches (node->shape_plan, &proposal)) + { + DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache"); + return hb_shape_plan_reference (node->shape_plan); + } /* Not found. */ - hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props, user_features, num_user_features, coords, num_coords, From e1285cf36bcdac5ce4c0579abccf5df733fff445 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 11 Oct 2017 16:03:47 +0200 Subject: [PATCH 34/39] Bug 1406879: Skip wasm frames when when enabling profiler and setting profiling FP; r=jandem MozReview-Commit-ID: EIjjda2AorV --HG-- extra : rebase_source : 826c31104983b0207ff4ce1f9a7a89ea75f2630c --- .../regress/enable-profiling-in-import.js | 9 ++++++++ js/src/jit/JSJitFrameIter.h | 2 +- js/src/vm/GeckoProfiler.cpp | 21 +++++++++++++------ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 js/src/jit-test/tests/wasm/regress/enable-profiling-in-import.js diff --git a/js/src/jit-test/tests/wasm/regress/enable-profiling-in-import.js b/js/src/jit-test/tests/wasm/regress/enable-profiling-in-import.js new file mode 100644 index 000000000000..07679a3d44ba --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/enable-profiling-in-import.js @@ -0,0 +1,9 @@ +var module = new WebAssembly.Module(wasmTextToBinary(` + (module + (import "global" "func") + (func (export "f") + call 0 + ) + ) +`)); +new WebAssembly.Instance(module, { global: { func: enableGeckoProfiling } }).exports.f(); diff --git a/js/src/jit/JSJitFrameIter.h b/js/src/jit/JSJitFrameIter.h index a31221d133ea..fe55e99e833b 100644 --- a/js/src/jit/JSJitFrameIter.h +++ b/js/src/jit/JSJitFrameIter.h @@ -303,7 +303,7 @@ class JSJitProfilingFrameIterator public: JSJitProfilingFrameIterator(JSContext* cx, - const JS::ProfilingFrameIterator::RegisterState& state); + const JS::ProfilingFrameIterator::RegisterState& state); explicit JSJitProfilingFrameIterator(void* exitFrame); void operator++(); diff --git a/js/src/vm/GeckoProfiler.cpp b/js/src/vm/GeckoProfiler.cpp index e0a453a33ee7..61ac31b9ec9f 100644 --- a/js/src/vm/GeckoProfiler.cpp +++ b/js/src/vm/GeckoProfiler.cpp @@ -69,14 +69,23 @@ GetTopProfilingJitFrame(Activation* act) if (!act || !act->isJit()) return nullptr; - // For null exitFrame, there is no previous exit frame, just return. - uint8_t* jsExitFP = act->asJit()->jsExitFP(); - if (!jsExitFP) + jit::JitActivation* jitActivation = act->asJit(); + + // If there is no exit frame set, just return. + if (!jitActivation->hasExitFP()) return nullptr; - jit::JSJitProfilingFrameIterator iter(jsExitFP); - MOZ_ASSERT(!iter.done()); - return iter.fp(); + // Skip wasm frames that might be in the way. + JitFrameIter iter(jitActivation); + while (!iter.done() && iter.isWasm()) + ++iter; + + if (!iter.isJSJit()) + return nullptr; + + jit::JSJitProfilingFrameIterator jitIter(iter.asJSJit().fp()); + MOZ_ASSERT(!jitIter.done()); + return jitIter.fp(); } void From 6ecc0e0e1a883d847a698c3eda02779302d07a10 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 12 Oct 2017 15:34:02 +0200 Subject: [PATCH 35/39] Bug 1401594 - land NSS 4bf658832d89 UPGRADE_NSS_RELEASE, r=me --- security/nss/TAG-INFO | 2 +- security/nss/coreconf/coreconf.dep | 1 - .../gtests/pk11_gtest/pk11_ecdsa_unittest.cc | 130 ++++++++------- .../gtests/pk11_gtest/pk11_rsapss_unittest.cc | 153 ++++++------------ .../gtests/pk11_gtest/pk11_signature_test.h | 142 ++++++++-------- .../gtests/softoken_gtest/softoken_gtest.cc | 106 ++++++++++++ security/nss/lib/softoken/sftkdb.c | 9 +- security/nss/lib/softoken/sftkdbti.h | 1 + security/nss/lib/softoken/sftkpwd.c | 7 + 9 files changed, 313 insertions(+), 238 deletions(-) diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO index b6e659675038..2af2cb1227de 100644 --- a/security/nss/TAG-INFO +++ b/security/nss/TAG-INFO @@ -1 +1 @@ -6fb9c5396d52 +f3766809817b diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep index 590d1bfaeee3..5182f75552c8 100644 --- a/security/nss/coreconf/coreconf.dep +++ b/security/nss/coreconf/coreconf.dep @@ -10,4 +10,3 @@ */ #error "Do not include this header file." - diff --git a/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc b/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc index a54190c7c929..fb0659852581 100644 --- a/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc +++ b/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc @@ -15,103 +15,117 @@ namespace nss_test { -class Pkcs11EcdsaTest : public Pk11SignatureTest { +class Pkcs11EcdsaTestBase : public Pk11SignatureTest { protected: - CK_MECHANISM_TYPE mechanism() { return CKM_ECDSA; } - SECItem* parameters() { return nullptr; } + Pkcs11EcdsaTestBase(SECOidTag hash_oid) + : Pk11SignatureTest(CKM_ECDSA, hash_oid) {} }; -class Pkcs11EcdsaSha256Test : public Pkcs11EcdsaTest { - protected: - SECOidTag hashOID() { return SEC_OID_SHA256; } +struct Pkcs11EcdsaTestParams { + SECOidTag hash_oid_; + Pkcs11SignatureTestParams sig_params_; }; -class Pkcs11EcdsaSha384Test : public Pkcs11EcdsaTest { - protected: - SECOidTag hashOID() { return SEC_OID_SHA384; } +class Pkcs11EcdsaTest + : public Pkcs11EcdsaTestBase, + public ::testing::WithParamInterface { + public: + Pkcs11EcdsaTest() : Pkcs11EcdsaTestBase(GetParam().hash_oid_) {} }; -class Pkcs11EcdsaSha512Test : public Pkcs11EcdsaTest { - protected: - SECOidTag hashOID() { return SEC_OID_SHA512; } +TEST_P(Pkcs11EcdsaTest, Verify) { Verify(GetParam().sig_params_); } + +TEST_P(Pkcs11EcdsaTest, SignAndVerify) { + SignAndVerify(GetParam().sig_params_); +} + +static const Pkcs11EcdsaTestParams kEcdsaVectors[] = { + {SEC_OID_SHA256, + {DataBuffer(kP256Pkcs8, sizeof(kP256Pkcs8)), + DataBuffer(kP256Spki, sizeof(kP256Spki)), + DataBuffer(kP256Data, sizeof(kP256Data)), + DataBuffer(kP256Signature, sizeof(kP256Signature))}}, + {SEC_OID_SHA384, + {DataBuffer(kP384Pkcs8, sizeof(kP384Pkcs8)), + DataBuffer(kP384Spki, sizeof(kP384Spki)), + DataBuffer(kP384Data, sizeof(kP384Data)), + DataBuffer(kP384Signature, sizeof(kP384Signature))}}, + {SEC_OID_SHA512, + {DataBuffer(kP521Pkcs8, sizeof(kP521Pkcs8)), + DataBuffer(kP521Spki, sizeof(kP521Spki)), + DataBuffer(kP521Data, sizeof(kP521Data)), + DataBuffer(kP521Signature, sizeof(kP521Signature))}}}; + +INSTANTIATE_TEST_CASE_P(EcdsaSignVerify, Pkcs11EcdsaTest, + ::testing::ValuesIn(kEcdsaVectors)); + +class Pkcs11EcdsaSha256Test : public Pkcs11EcdsaTestBase { + public: + Pkcs11EcdsaSha256Test() : Pkcs11EcdsaTestBase(SEC_OID_SHA256) {} }; -TEST_F(Pkcs11EcdsaSha256Test, VerifyP256) { - SIG_TEST_VECTOR_VERIFY(kP256Spki, kP256Data, kP256Signature) -} -TEST_F(Pkcs11EcdsaSha256Test, SignAndVerifyP256) { - SIG_TEST_VECTOR_SIGN_VERIFY(kP256Pkcs8, kP256Spki, kP256Data) -} - -TEST_F(Pkcs11EcdsaSha384Test, VerifyP384) { - SIG_TEST_VECTOR_VERIFY(kP384Spki, kP384Data, kP384Signature) -} -TEST_F(Pkcs11EcdsaSha384Test, SignAndVerifyP384) { - SIG_TEST_VECTOR_SIGN_VERIFY(kP384Pkcs8, kP384Spki, kP384Data) -} - -TEST_F(Pkcs11EcdsaSha512Test, VerifyP521) { - SIG_TEST_VECTOR_VERIFY(kP521Spki, kP521Data, kP521Signature) -} -TEST_F(Pkcs11EcdsaSha512Test, SignAndVerifyP521) { - SIG_TEST_VECTOR_SIGN_VERIFY(kP521Pkcs8, kP521Spki, kP521Data) -} - // Importing a private key in PKCS#8 format must fail when the outer AlgID // struct contains neither id-ecPublicKey nor a namedCurve parameter. TEST_F(Pkcs11EcdsaSha256Test, ImportNoCurveOIDOrAlgorithmParams) { - EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8NoCurveOIDOrAlgorithmParams, - sizeof(kP256Pkcs8NoCurveOIDOrAlgorithmParams))); + DataBuffer k(kP256Pkcs8NoCurveOIDOrAlgorithmParams, + sizeof(kP256Pkcs8NoCurveOIDOrAlgorithmParams)); + EXPECT_FALSE(ImportPrivateKey(k)); }; // Importing a private key in PKCS#8 format must succeed when only the outer // AlgID struct contains the namedCurve parameters. TEST_F(Pkcs11EcdsaSha256Test, ImportOnlyAlgorithmParams) { - EXPECT_TRUE(ImportPrivateKeyAndSignHashedData( - kP256Pkcs8OnlyAlgorithmParams, sizeof(kP256Pkcs8OnlyAlgorithmParams), - kP256Data, sizeof(kP256Data))); + DataBuffer k(kP256Pkcs8OnlyAlgorithmParams, + sizeof(kP256Pkcs8OnlyAlgorithmParams)); + DataBuffer data(kP256Data, sizeof(kP256Data)); + DataBuffer sig; + EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig)); }; // Importing a private key in PKCS#8 format must succeed when the outer AlgID // struct and the inner ECPrivateKey contain the same namedCurve parameters. // The inner curveOID is always ignored, so only the outer one will be used. TEST_F(Pkcs11EcdsaSha256Test, ImportMatchingCurveOIDAndAlgorithmParams) { - EXPECT_TRUE(ImportPrivateKeyAndSignHashedData( - kP256Pkcs8MatchingCurveOIDAndAlgorithmParams, - sizeof(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams), kP256Data, - sizeof(kP256Data))); + DataBuffer k(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams, + sizeof(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams)); + DataBuffer data(kP256Data, sizeof(kP256Data)); + DataBuffer sig; + EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig)); }; // Importing a private key in PKCS#8 format must succeed when the outer AlgID // struct and the inner ECPrivateKey contain dissimilar namedCurve parameters. // The inner curveOID is always ignored, so only the outer one will be used. TEST_F(Pkcs11EcdsaSha256Test, ImportDissimilarCurveOIDAndAlgorithmParams) { - EXPECT_TRUE(ImportPrivateKeyAndSignHashedData( - kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams, - sizeof(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams), kP256Data, - sizeof(kP256Data))); + DataBuffer k(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams, + sizeof(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams)); + DataBuffer data(kP256Data, sizeof(kP256Data)); + DataBuffer sig; + EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig)); }; // Importing a private key in PKCS#8 format must fail when the outer ASN.1 // AlgorithmID struct contains only id-ecPublicKey but no namedCurve parameter. TEST_F(Pkcs11EcdsaSha256Test, ImportNoAlgorithmParams) { - EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8NoAlgorithmParams, - sizeof(kP256Pkcs8NoAlgorithmParams))); + DataBuffer k(kP256Pkcs8NoAlgorithmParams, + sizeof(kP256Pkcs8NoAlgorithmParams)); + EXPECT_FALSE(ImportPrivateKey(k)); }; // Importing a private key in PKCS#8 format must fail when id-ecPublicKey is // given (so we know it's an EC key) but the namedCurve parameter is unknown. TEST_F(Pkcs11EcdsaSha256Test, ImportInvalidAlgorithmParams) { - EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8InvalidAlgorithmParams, - sizeof(kP256Pkcs8InvalidAlgorithmParams))); + DataBuffer k(kP256Pkcs8InvalidAlgorithmParams, + sizeof(kP256Pkcs8InvalidAlgorithmParams)); + EXPECT_FALSE(ImportPrivateKey(k)); }; // Importing a private key in PKCS#8 format with a point not on the curve will // succeed. Using the contained public key however will fail when trying to // import it before using it for any operation. TEST_F(Pkcs11EcdsaSha256Test, ImportPointNotOnCurve) { - ScopedSECKEYPrivateKey privKey(ImportPrivateKey( - kP256Pkcs8PointNotOnCurve, sizeof(kP256Pkcs8PointNotOnCurve))); + DataBuffer k(kP256Pkcs8PointNotOnCurve, sizeof(kP256Pkcs8PointNotOnCurve)); + ScopedSECKEYPrivateKey privKey(ImportPrivateKey(k)); ASSERT_TRUE(privKey); ScopedSECKEYPublicKey pubKey(SECKEY_ConvertToPublicKey(privKey.get())); @@ -127,23 +141,23 @@ TEST_F(Pkcs11EcdsaSha256Test, ImportPointNotOnCurve) { // Importing a private key in PKCS#8 format must fail when no point is given. // PK11 currently offers no APIs to derive raw public keys from private values. TEST_F(Pkcs11EcdsaSha256Test, ImportNoPublicKey) { - EXPECT_FALSE( - ImportPrivateKey(kP256Pkcs8NoPublicKey, sizeof(kP256Pkcs8NoPublicKey))); + DataBuffer k(kP256Pkcs8NoPublicKey, sizeof(kP256Pkcs8NoPublicKey)); + EXPECT_FALSE(ImportPrivateKey(k)); }; // Importing a public key in SPKI format must fail when id-ecPublicKey is // given (so we know it's an EC key) but the namedCurve parameter is missing. TEST_F(Pkcs11EcdsaSha256Test, ImportSpkiNoAlgorithmParams) { - EXPECT_FALSE(ImportPublicKey(kP256SpkiNoAlgorithmParams, - sizeof(kP256SpkiNoAlgorithmParams))); + DataBuffer k(kP256SpkiNoAlgorithmParams, sizeof(kP256SpkiNoAlgorithmParams)); + EXPECT_FALSE(ImportPublicKey(k)); } // Importing a public key in SPKI format with a point not on the curve will // succeed. Using the public key however will fail when trying to import // it before using it for any operation. TEST_F(Pkcs11EcdsaSha256Test, ImportSpkiPointNotOnCurve) { - ScopedSECKEYPublicKey pubKey(ImportPublicKey( - kP256SpkiPointNotOnCurve, sizeof(kP256SpkiPointNotOnCurve))); + DataBuffer k(kP256SpkiPointNotOnCurve, sizeof(kP256SpkiPointNotOnCurve)); + ScopedSECKEYPublicKey pubKey(ImportPublicKey(k)); ASSERT_TRUE(pubKey); ScopedPK11SlotInfo slot(PK11_GetInternalSlot()); diff --git a/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc b/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc index 012bae0e9e4c..6c8c5ab4e907 100644 --- a/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc +++ b/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc @@ -12,14 +12,14 @@ #include "gtest/gtest.h" #include "scoped_ptrs.h" -#include "pk11_rsapss_vectors.h" #include "pk11_signature_test.h" +#include "pk11_rsapss_vectors.h" namespace nss_test { -class Pkcs11RsaPssVectorTest : public Pk11SignatureTest { +class Pkcs11RsaPssTest : public Pk11SignatureTest { public: - Pkcs11RsaPssVectorTest() { + Pkcs11RsaPssTest() : Pk11SignatureTest(CKM_RSA_PKCS_PSS, SEC_OID_SHA1) { rsaPssParams_.hashAlg = CKM_SHA_1; rsaPssParams_.mgf = CKG_MGF1_SHA1; rsaPssParams_.sLen = HASH_ResultLenByOidTag(SEC_OID_SHA1); @@ -30,16 +30,14 @@ class Pkcs11RsaPssVectorTest : public Pk11SignatureTest { } protected: - CK_MECHANISM_TYPE mechanism() { return CKM_RSA_PKCS_PSS; } - SECItem* parameters() { return ¶ms_; } - SECOidTag hashOID() { return SEC_OID_SHA1; } + const SECItem* parameters() const { return ¶ms_; } private: CK_RSA_PKCS_PSS_PARAMS rsaPssParams_; SECItem params_; }; -TEST_F(Pkcs11RsaPssVectorTest, GenerateAndSignAndVerify) { +TEST_F(Pkcs11RsaPssTest, GenerateAndSignAndVerify) { // Sign data with a 1024-bit RSA key, using PSS/SHA-256. SECOidTag hashOid = SEC_OID_SHA256; CK_MECHANISM_TYPE hashMech = CKM_SHA256; @@ -95,105 +93,56 @@ TEST_F(Pkcs11RsaPssVectorTest, GenerateAndSignAndVerify) { EXPECT_EQ(rv, SECFailure); } -// RSA-PSS test vectors, pss-vect.txt, Example 1.1: A 1024-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature1) { - SIG_TEST_VECTOR_VERIFY(kTestVector1Spki, kTestVector1Data, kTestVector1Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify1) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector1Pkcs8, kTestVector1Spki, - kTestVector1Data); -} +class Pkcs11RsaPssVectorTest + : public Pkcs11RsaPssTest, + public ::testing::WithParamInterface {}; -// RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature2) { - SIG_TEST_VECTOR_VERIFY(kTestVector2Spki, kTestVector2Data, kTestVector2Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify2) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector2Pkcs8, kTestVector2Spki, - kTestVector2Data); -} +TEST_P(Pkcs11RsaPssVectorTest, Verify) { Verify(GetParam()); } -// RSA-PSS test vectors, pss-vect.txt, Example 3.1: A 1026-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature3) { - SIG_TEST_VECTOR_VERIFY(kTestVector3Spki, kTestVector3Data, kTestVector3Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify3) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector3Pkcs8, kTestVector3Spki, - kTestVector3Data); -} +TEST_P(Pkcs11RsaPssVectorTest, SignAndVerify) { SignAndVerify(GetParam()); } -// RSA-PSS test vectors, pss-vect.txt, Example 4.1: A 1027-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature4) { - SIG_TEST_VECTOR_VERIFY(kTestVector4Spki, kTestVector4Data, kTestVector4Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify4) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector4Pkcs8, kTestVector4Spki, - kTestVector4Data); -} +#define VECTOR(pkcs8, spki, data, sig) \ + { \ + DataBuffer(pkcs8, sizeof(pkcs8)), DataBuffer(spki, sizeof(spki)), \ + DataBuffer(data, sizeof(data)), DataBuffer(sig, sizeof(sig)) \ + } +#define VECTOR_N(n) \ + VECTOR(kTestVector##n##Pkcs8, kTestVector##n##Spki, kTestVector##n##Data, \ + kTestVector##n##Sig) -// RSA-PSS test vectors, pss-vect.txt, Example 5.1: A 1028-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature5) { - SIG_TEST_VECTOR_VERIFY(kTestVector5Spki, kTestVector5Data, kTestVector5Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify5) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector5Pkcs8, kTestVector5Spki, - kTestVector5Data); -} +static const Pkcs11SignatureTestParams kRsaPssVectors[] = { + // RSA-PSS test vectors, pss-vect.txt, Example 1.1: A 1024-bit RSA Key Pair + // + VECTOR_N(1), + // RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair + // + VECTOR_N(2), + // RSA-PSS test vectors, pss-vect.txt, Example 3.1: A 1026-bit RSA Key Pair + // + VECTOR_N(3), + // RSA-PSS test vectors, pss-vect.txt, Example 4.1: A 1027-bit RSA Key Pair + // + VECTOR_N(4), + // RSA-PSS test vectors, pss-vect.txt, Example 5.1: A 1028-bit RSA Key Pair + // + VECTOR_N(5), + // RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair + // + VECTOR_N(6), + // RSA-PSS test vectors, pss-vect.txt, Example 7.1: A 1030-bit RSA Key Pair + // + VECTOR_N(7), + // RSA-PSS test vectors, pss-vect.txt, Example 8.1: A 1031-bit RSA Key Pair + // + VECTOR_N(8), + // RSA-PSS test vectors, pss-vect.txt, Example 9.1: A 1536-bit RSA Key Pair + // + VECTOR_N(9), + // RSA-PSS test vectors, pss-vect.txt, Example 10.1: A 2048-bit RSA Key Pair + // + VECTOR_N(10)}; -// RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature6) { - SIG_TEST_VECTOR_VERIFY(kTestVector6Spki, kTestVector6Data, kTestVector6Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify6) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector6Pkcs8, kTestVector6Spki, - kTestVector6Data); -} - -// RSA-PSS test vectors, pss-vect.txt, Example 7.1: A 1030-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature7) { - SIG_TEST_VECTOR_VERIFY(kTestVector7Spki, kTestVector7Data, kTestVector7Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify7) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector7Pkcs8, kTestVector7Spki, - kTestVector7Data); -} - -// RSA-PSS test vectors, pss-vect.txt, Example 8.1: A 1031-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature8) { - SIG_TEST_VECTOR_VERIFY(kTestVector8Spki, kTestVector8Data, kTestVector8Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify8) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector8Pkcs8, kTestVector8Spki, - kTestVector8Data); -} - -// RSA-PSS test vectors, pss-vect.txt, Example 9.1: A 1536-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature9) { - SIG_TEST_VECTOR_VERIFY(kTestVector9Spki, kTestVector9Data, kTestVector9Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify9) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector9Pkcs8, kTestVector9Spki, - kTestVector9Data); -} - -// RSA-PSS test vectors, pss-vect.txt, Example 10.1: A 2048-bit RSA Key Pair -// -TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature10) { - SIG_TEST_VECTOR_VERIFY(kTestVector10Spki, kTestVector10Data, - kTestVector10Sig); -} -TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify10) { - SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector10Pkcs8, kTestVector10Spki, - kTestVector10Data); -} +INSTANTIATE_TEST_CASE_P(RsaPssSignVerify, Pkcs11RsaPssVectorTest, + ::testing::ValuesIn(kRsaPssVectors)); } // namespace nss_test diff --git a/security/nss/gtests/pk11_gtest/pk11_signature_test.h b/security/nss/gtests/pk11_gtest/pk11_signature_test.h index e6a0a9c579af..b14104371687 100644 --- a/security/nss/gtests/pk11_gtest/pk11_signature_test.h +++ b/security/nss/gtests/pk11_gtest/pk11_signature_test.h @@ -9,26 +9,37 @@ #include "cpputil.h" #include "scoped_ptrs.h" +#include "databuffer.h" #include "gtest/gtest.h" namespace nss_test { +// For test vectors. +struct Pkcs11SignatureTestParams { + const DataBuffer pkcs8_; + const DataBuffer spki_; + const DataBuffer data_; + const DataBuffer signature_; +}; + class Pk11SignatureTest : public ::testing::Test { protected: - virtual CK_MECHANISM_TYPE mechanism() = 0; - virtual SECItem* parameters() = 0; - virtual SECOidTag hashOID() = 0; + Pk11SignatureTest(CK_MECHANISM_TYPE mechanism, SECOidTag hash_oid) + : mechanism_(mechanism), hash_oid_(hash_oid) {} - ScopedSECKEYPrivateKey ImportPrivateKey(const uint8_t* pkcs8, - size_t pkcs8_len) { + virtual const SECItem* parameters() const { return nullptr; } + CK_MECHANISM_TYPE mechanism() const { return mechanism_; } + + ScopedSECKEYPrivateKey ImportPrivateKey(const DataBuffer& pkcs8) { ScopedPK11SlotInfo slot(PK11_GetInternalSlot()); if (!slot) { + ADD_FAILURE() << "No slot"; return nullptr; } - SECItem pkcs8Item = {siBuffer, toUcharPtr(pkcs8), - static_cast(pkcs8_len)}; + SECItem pkcs8Item = {siBuffer, toUcharPtr(pkcs8.data()), + static_cast(pkcs8.len())}; SECKEYPrivateKey* key = nullptr; SECStatus rv = PK11_ImportDERPrivateKeyInfoAndReturnKey( @@ -42,9 +53,9 @@ class Pk11SignatureTest : public ::testing::Test { return ScopedSECKEYPrivateKey(key); } - ScopedSECKEYPublicKey ImportPublicKey(const uint8_t* spki, size_t spki_len) { - SECItem spkiItem = {siBuffer, toUcharPtr(spki), - static_cast(spki_len)}; + ScopedSECKEYPublicKey ImportPublicKey(const DataBuffer& spki) { + SECItem spkiItem = {siBuffer, toUcharPtr(spki.data()), + static_cast(spki.len())}; ScopedCERTSubjectPublicKeyInfo certSpki( SECKEY_DecodeDERSubjectPublicKeyInfo(&spkiItem)); @@ -52,87 +63,74 @@ class Pk11SignatureTest : public ::testing::Test { return ScopedSECKEYPublicKey(SECKEY_ExtractPublicKey(certSpki.get())); } - ScopedSECItem ComputeHash(const uint8_t* data, size_t len) { - unsigned int hLen = HASH_ResultLenByOidTag(hashOID()); - ScopedSECItem hash(SECITEM_AllocItem(nullptr, nullptr, hLen)); - if (!hash) { - return nullptr; - } - - SECStatus rv = PK11_HashBuf(hashOID(), hash->data, data, len); - if (rv != SECSuccess) { - return nullptr; - } - - return hash; + bool ComputeHash(const DataBuffer& data, DataBuffer* hash) { + hash->Allocate(static_cast(HASH_ResultLenByOidTag(hash_oid_))); + SECStatus rv = + PK11_HashBuf(hash_oid_, hash->data(), data.data(), data.len()); + return rv == SECSuccess; } - ScopedSECItem SignHashedData(ScopedSECKEYPrivateKey& privKey, - ScopedSECItem& hash) { - unsigned int sLen = PK11_SignatureLen(privKey.get()); - ScopedSECItem sig(SECITEM_AllocItem(nullptr, nullptr, sLen)); - if (!sig) { - return nullptr; - } - - SECStatus rv = PK11_SignWithMechanism(privKey.get(), mechanism(), - parameters(), sig.get(), hash.get()); - if (rv != SECSuccess) { - return nullptr; - } - - return sig; + bool SignHashedData(ScopedSECKEYPrivateKey& privKey, const DataBuffer& hash, + DataBuffer* sig) { + SECItem hashItem = {siBuffer, toUcharPtr(hash.data()), + static_cast(hash.len())}; + int sigLen = PK11_SignatureLen(privKey.get()); + EXPECT_LT(0, sigLen); + sig->Allocate(static_cast(sigLen)); + SECItem sigItem = {siBuffer, toUcharPtr(sig->data()), + static_cast(sig->len())}; + SECStatus rv = PK11_SignWithMechanism(privKey.get(), mechanism_, + parameters(), &sigItem, &hashItem); + return rv == SECSuccess; } - ScopedSECItem ImportPrivateKeyAndSignHashedData(const uint8_t* pkcs8, - size_t pkcs8_len, - const uint8_t* data, - size_t data_len) { - ScopedSECKEYPrivateKey privKey(ImportPrivateKey(pkcs8, pkcs8_len)); + bool ImportPrivateKeyAndSignHashedData(const DataBuffer& pkcs8, + const DataBuffer& data, + DataBuffer* sig) { + ScopedSECKEYPrivateKey privKey(ImportPrivateKey(pkcs8)); if (!privKey) { - return nullptr; + return false; } - ScopedSECItem hash(ComputeHash(data, data_len)); - if (!hash) { - return nullptr; + DataBuffer hash; + if (!ComputeHash(data, &hash)) { + ADD_FAILURE() << "Failed to compute hash"; + return false; } - - return ScopedSECItem(SignHashedData(privKey, hash)); + return SignHashedData(privKey, hash, sig); } - void Verify(const uint8_t* spki, size_t spki_len, const uint8_t* data, - size_t data_len, const uint8_t* sig, size_t sig_len) { - ScopedSECKEYPublicKey pubKey(ImportPublicKey(spki, spki_len)); + void Verify(const Pkcs11SignatureTestParams& params, const DataBuffer& sig) { + ScopedSECKEYPublicKey pubKey(ImportPublicKey(params.spki_)); ASSERT_TRUE(pubKey); - ScopedSECItem hash(ComputeHash(data, data_len)); - ASSERT_TRUE(hash); - - SECItem sigItem = {siBuffer, toUcharPtr(sig), - static_cast(sig_len)}; + DataBuffer hash; + ASSERT_TRUE(ComputeHash(params.data_, &hash)); // Verify. + SECItem hashItem = {siBuffer, toUcharPtr(hash.data()), + static_cast(hash.len())}; + SECItem sigItem = {siBuffer, toUcharPtr(sig.data()), + static_cast(sig.len())}; SECStatus rv = PK11_VerifyWithMechanism( - pubKey.get(), mechanism(), parameters(), &sigItem, hash.get(), nullptr); + pubKey.get(), mechanism_, parameters(), &sigItem, &hashItem, nullptr); EXPECT_EQ(rv, SECSuccess); } - void SignAndVerify(const uint8_t* pkcs8, size_t pkcs8_len, - const uint8_t* spki, size_t spki_len, const uint8_t* data, - size_t data_len) { - ScopedSECItem sig( - ImportPrivateKeyAndSignHashedData(pkcs8, pkcs8_len, data, data_len)); - ASSERT_TRUE(sig); - - Verify(spki, spki_len, data, data_len, sig->data, sig->len); + void Verify(const Pkcs11SignatureTestParams& params) { + Verify(params, params.signature_); } + + void SignAndVerify(const Pkcs11SignatureTestParams& params) { + DataBuffer sig; + ASSERT_TRUE( + ImportPrivateKeyAndSignHashedData(params.pkcs8_, params.data_, &sig)); + Verify(params, sig); + } + + private: + CK_MECHANISM_TYPE mechanism_; + SECOidTag hash_oid_; }; -#define SIG_TEST_VECTOR_VERIFY(spki, data, sig) \ - Verify(spki, sizeof(spki), data, sizeof(data), sig, sizeof(sig)); - -#define SIG_TEST_VECTOR_SIGN_VERIFY(pkcs8, spki, data) \ - SignAndVerify(pkcs8, sizeof(pkcs8), spki, sizeof(spki), data, sizeof(data)); - } // namespace nss_test diff --git a/security/nss/gtests/softoken_gtest/softoken_gtest.cc b/security/nss/gtests/softoken_gtest/softoken_gtest.cc index 23def6720181..9b9927a7417f 100644 --- a/security/nss/gtests/softoken_gtest/softoken_gtest.cc +++ b/security/nss/gtests/softoken_gtest/softoken_gtest.cc @@ -1,5 +1,7 @@ #include +#include "cert.h" +#include "certdb.h" #include "nspr.h" #include "nss.h" #include "pk11pub.h" @@ -200,6 +202,110 @@ TEST_F(SoftokenTest, CreateObjectChangeToEmptyPassword) { EXPECT_NE(nullptr, obj); } +// This is just any X509 certificate. Its contents don't matter. +static unsigned char certDER[] = { + 0x30, 0x82, 0x01, 0xEF, 0x30, 0x82, 0x01, 0x94, 0xA0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x14, 0x49, 0xC4, 0xC4, 0x4A, 0xB6, 0x86, 0x07, 0xA3, 0x06, + 0xDC, 0x4D, 0xC8, 0xC3, 0xFE, 0xC7, 0x21, 0x3A, 0x2D, 0xE4, 0xDA, 0x30, + 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, + 0x30, 0x0F, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, + 0x04, 0x74, 0x65, 0x73, 0x74, 0x30, 0x22, 0x18, 0x0F, 0x32, 0x30, 0x31, + 0x35, 0x31, 0x31, 0x32, 0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A, + 0x18, 0x0F, 0x32, 0x30, 0x31, 0x38, 0x30, 0x32, 0x30, 0x35, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x5A, 0x30, 0x0F, 0x31, 0x0D, 0x30, 0x0B, 0x06, + 0x03, 0x55, 0x04, 0x03, 0x0C, 0x04, 0x74, 0x65, 0x73, 0x74, 0x30, 0x82, + 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, + 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, + 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBA, 0x88, 0x51, 0xA8, 0x44, + 0x8E, 0x16, 0xD6, 0x41, 0xFD, 0x6E, 0xB6, 0x88, 0x06, 0x36, 0x10, 0x3D, + 0x3C, 0x13, 0xD9, 0xEA, 0xE4, 0x35, 0x4A, 0xB4, 0xEC, 0xF5, 0x68, 0x57, + 0x6C, 0x24, 0x7B, 0xC1, 0xC7, 0x25, 0xA8, 0xE0, 0xD8, 0x1F, 0xBD, 0xB1, + 0x9C, 0x06, 0x9B, 0x6E, 0x1A, 0x86, 0xF2, 0x6B, 0xE2, 0xAF, 0x5A, 0x75, + 0x6B, 0x6A, 0x64, 0x71, 0x08, 0x7A, 0xA5, 0x5A, 0xA7, 0x45, 0x87, 0xF7, + 0x1C, 0xD5, 0x24, 0x9C, 0x02, 0x7E, 0xCD, 0x43, 0xFC, 0x1E, 0x69, 0xD0, + 0x38, 0x20, 0x29, 0x93, 0xAB, 0x20, 0xC3, 0x49, 0xE4, 0xDB, 0xB9, 0x4C, + 0xC2, 0x6B, 0x6C, 0x0E, 0xED, 0x15, 0x82, 0x0F, 0xF1, 0x7E, 0xAD, 0x69, + 0x1A, 0xB1, 0xD3, 0x02, 0x3A, 0x8B, 0x2A, 0x41, 0xEE, 0xA7, 0x70, 0xE0, + 0x0F, 0x0D, 0x8D, 0xFD, 0x66, 0x0B, 0x2B, 0xB0, 0x24, 0x92, 0xA4, 0x7D, + 0xB9, 0x88, 0x61, 0x79, 0x90, 0xB1, 0x57, 0x90, 0x3D, 0xD2, 0x3B, 0xC5, + 0xE0, 0xB8, 0x48, 0x1F, 0xA8, 0x37, 0xD3, 0x88, 0x43, 0xEF, 0x27, 0x16, + 0xD8, 0x55, 0xB7, 0x66, 0x5A, 0xAA, 0x7E, 0x02, 0x90, 0x2F, 0x3A, 0x7B, + 0x10, 0x80, 0x06, 0x24, 0xCC, 0x1C, 0x6C, 0x97, 0xAD, 0x96, 0x61, 0x5B, + 0xB7, 0xE2, 0x96, 0x12, 0xC0, 0x75, 0x31, 0xA3, 0x0C, 0x91, 0xDD, 0xB4, + 0xCA, 0xF7, 0xFC, 0xAD, 0x1D, 0x25, 0xD3, 0x09, 0xEF, 0xB9, 0x17, 0x0E, + 0xA7, 0x68, 0xE1, 0xB3, 0x7B, 0x2F, 0x22, 0x6F, 0x69, 0xE3, 0xB4, 0x8A, + 0x95, 0x61, 0x1D, 0xEE, 0x26, 0xD6, 0x25, 0x9D, 0xAB, 0x91, 0x08, 0x4E, + 0x36, 0xCB, 0x1C, 0x24, 0x04, 0x2C, 0xBF, 0x16, 0x8B, 0x2F, 0xE5, 0xF1, + 0x8F, 0x99, 0x17, 0x31, 0xB8, 0xB3, 0xFE, 0x49, 0x23, 0xFA, 0x72, 0x51, + 0xC4, 0x31, 0xD5, 0x03, 0xAC, 0xDA, 0x18, 0x0A, 0x35, 0xED, 0x8D, 0x02, + 0x03, 0x01, 0x00, 0x01, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, + 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, + 0x5C, 0x75, 0x51, 0x9F, 0x13, 0x11, 0x50, 0xCD, 0x5D, 0x8A, 0xDE, 0x20, + 0xA3, 0xBC, 0x06, 0x30, 0x91, 0xFF, 0xB2, 0x73, 0x75, 0x5F, 0x31, 0x64, + 0xEC, 0xFD, 0xCB, 0x42, 0x80, 0x0A, 0x70, 0xE6, 0x02, 0x21, 0x00, 0x82, + 0x12, 0xF7, 0xE5, 0xEA, 0x40, 0x27, 0xFD, 0xF7, 0xC0, 0x0E, 0x25, 0xF3, + 0x3E, 0x34, 0x95, 0x80, 0xB9, 0xA3, 0x38, 0xE0, 0x56, 0x68, 0xDA, 0xE5, + 0xC1, 0xF5, 0x37, 0xC7, 0xB5, 0xCE, 0x0D}; + +struct PasswordPair { + const char *mInitialPassword; + const char *mSecondPassword; +}; + +class SoftokenPasswordChangeTest + : public SoftokenTest, + public ::testing::WithParamInterface {}; + +TEST_P(SoftokenPasswordChangeTest, KeepTrustAfterPasswordChange) { + const PasswordPair &passwords = GetParam(); + ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot()); + ASSERT_TRUE(slot); + // Set a password. + EXPECT_EQ(SECSuccess, + PK11_InitPin(slot.get(), nullptr, passwords.mInitialPassword)); + SECItem certDERItem = {siBuffer, certDER, sizeof(certDER)}; + // Import a certificate. + ScopedCERTCertificate cert(CERT_NewTempCertificate( + CERT_GetDefaultCertDB(), &certDERItem, nullptr, true, true)); + EXPECT_TRUE(cert); + SECStatus result = + PK11_ImportCert(slot.get(), cert.get(), CK_INVALID_HANDLE, "test", false); + EXPECT_EQ(SECSuccess, result); + // Set a trust value. + CERTCertTrust trust = {CERTDB_TRUSTED_CLIENT_CA | CERTDB_NS_TRUSTED_CA | + CERTDB_TRUSTED_CA | CERTDB_VALID_CA, + 0, 0}; + result = CERT_ChangeCertTrust(nullptr, cert.get(), &trust); + EXPECT_EQ(SECSuccess, result); + // Release the certificate to ensure we get it from the DB rather than an + // in-memory cache, below. + cert = nullptr; + // Change the password. + result = PK11_ChangePW(slot.get(), passwords.mInitialPassword, + passwords.mSecondPassword); + EXPECT_EQ(SECSuccess, result); + // Look up the certificate again. + ScopedCERTCertificate newCert( + PK11_FindCertFromDERCertItem(slot.get(), &certDERItem, nullptr)); + EXPECT_TRUE(newCert.get()); + // The trust should be the same as before. + CERTCertTrust newTrust = {0, 0, 0}; + result = CERT_GetCertTrust(newCert.get(), &newTrust); + EXPECT_EQ(SECSuccess, result); + EXPECT_EQ(trust.sslFlags, newTrust.sslFlags); + EXPECT_EQ(trust.emailFlags, newTrust.emailFlags); + EXPECT_EQ(trust.objectSigningFlags, newTrust.objectSigningFlags); +} + +static const PasswordPair PASSWORD_CHANGE_TESTS[] = { + {"password", ""}, // non-empty to empty password + {"", "password"}, // empty to non-empty password + {"password", "password2"}, // non-empty to non-empty password +}; + +INSTANTIATE_TEST_CASE_P(SoftokenPasswordChangeTests, SoftokenPasswordChangeTest, + ::testing::ValuesIn(PASSWORD_CHANGE_TESTS)); + class SoftokenNoDBTest : public ::testing::Test {}; TEST_F(SoftokenNoDBTest, NeedUserInitNoDB) { diff --git a/security/nss/lib/softoken/sftkdb.c b/security/nss/lib/softoken/sftkdb.c index 4be6e5dffed6..716f62c0bfc6 100644 --- a/security/nss/lib/softoken/sftkdb.c +++ b/security/nss/lib/softoken/sftkdb.c @@ -40,7 +40,7 @@ */ #define BBP 8 -static PRBool +PRBool sftkdb_isULONGAttribute(CK_ATTRIBUTE_TYPE type) { switch (type) { @@ -1370,7 +1370,8 @@ sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object, } /* make sure we don't have attributes that conflict with the existing DB */ - crv = sftkdb_checkConflicts(db, object->objclass, template, count, objectID); + crv = sftkdb_checkConflicts(db, object->objclass, ntemplate, count, + objectID); if (crv != CKR_OK) { goto loser; } @@ -1386,8 +1387,8 @@ sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object, goto loser; } inTransaction = PR_TRUE; - crv = sftkdb_setAttributeValue(arena, handle, db, - objectID, template, count); + crv = sftkdb_setAttributeValue(arena, handle, db, objectID, ntemplate, + count); if (crv != CKR_OK) { goto loser; } diff --git a/security/nss/lib/softoken/sftkdbti.h b/security/nss/lib/softoken/sftkdbti.h index 4942e1b12ee2..7b1db45607f1 100644 --- a/security/nss/lib/softoken/sftkdbti.h +++ b/security/nss/lib/softoken/sftkdbti.h @@ -49,6 +49,7 @@ SECStatus sftkdb_VerifyAttribute(SECItem *passKey, CK_ATTRIBUTE_TYPE attrType, SECItem *plainText, SECItem *sigText); +PRBool sftkdb_isULONGAttribute(CK_ATTRIBUTE_TYPE type); void sftk_ULong2SDBULong(unsigned char *data, CK_ULONG value); CK_RV sftkdb_Update(SFTKDBHandle *handle, SECItem *key); CK_RV sftkdb_PutAttributeSignature(SFTKDBHandle *handle, diff --git a/security/nss/lib/softoken/sftkpwd.c b/security/nss/lib/softoken/sftkpwd.c index 0b8c91bfda01..e0d2df9ab4bf 100644 --- a/security/nss/lib/softoken/sftkpwd.c +++ b/security/nss/lib/softoken/sftkpwd.c @@ -926,6 +926,13 @@ sftk_updateMacs(PLArenaPool *arena, SFTKDBHandle *handle, continue; } + if (authAttrs[i].ulValueLen == sizeof(CK_ULONG) && + sftkdb_isULONGAttribute(authAttrs[i].type)) { + CK_ULONG value = *(CK_ULONG *)authAttrs[i].pValue; + sftk_ULong2SDBULong(authAttrs[i].pValue, value); + authAttrs[i].ulValueLen = SDB_ULONG_SIZE; + } + plainText.data = authAttrs[i].pValue; plainText.len = authAttrs[i].ulValueLen; rv = sftkdb_SignAttribute(arena, newKey, id, From dc118fd91df04ec6a7bb850bca9cede2e799d6cc Mon Sep 17 00:00:00 2001 From: Dragana Damjanovic Date: Wed, 11 Oct 2017 03:20:00 -0400 Subject: [PATCH 36/39] Bug 1405761 - If the preload pref is disabled rel=preload should be shown as not supported. r=smaug --HG-- extra : rebase_source : 3e32d5d8beceedca7ab3eaaf528385f4e73f1164 --- dom/base/test/test_bug1222633.html | 4 +++- .../test/test_bug1222633_link_update.html | 4 +++- dom/html/HTMLLinkElement.cpp | 19 ++++++++++++++++++- modules/libpref/init/all.js | 2 +- .../wptrunner/wptrunner/browsers/firefox.py | 3 ++- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dom/base/test/test_bug1222633.html b/dom/base/test/test_bug1222633.html index 52fecff16e9b..099345dab0b7 100644 --- a/dom/base/test/test_bug1222633.html +++ b/dom/base/test/test_bug1222633.html @@ -88,8 +88,10 @@ const CROSS_ORIGIN = "http://example.com" + SJS_PATH; SimpleTest.waitForExplicitFinish(); +SpecialPowers.pushPrefEnv({"set": [["network.preload", true]]}) + // test same origin -testPreloadEvent(SAME_ORIGIN + "?statusCode=200&cacheControl=no-cache", false, false) +.then(() => testPreloadEvent(SAME_ORIGIN + "?statusCode=200&cacheControl=no-cache", false, false)) .then(() => testPreloadEvent(SAME_ORIGIN + "?statusCode=404&cacheControl=no-cache", false, false)) .then(() => testPreloadEvent(SAME_ORIGIN + "?statusCode=200&cacheControl=max-age%3D120", false, true)) .then(() => testPreloadEvent(SAME_ORIGIN + "?statusCode=404&cacheControl=max-age%3D120", false, false)) diff --git a/dom/base/test/test_bug1222633_link_update.html b/dom/base/test/test_bug1222633_link_update.html index 97508d3596cf..1f18284c9470 100644 --- a/dom/base/test/test_bug1222633_link_update.html +++ b/dom/base/test/test_bug1222633_link_update.html @@ -122,8 +122,10 @@ const CROSS_ORIGIN = "http://example.com" + SJS_PATH; SimpleTest.waitForExplicitFinish(); +SpecialPowers.pushPrefEnv({"set": [["network.preload", true]]}) + // Test changing as parameter from a wrong to a correct one. -testPreloadEventAsAttributeChange(SAME_ORIGIN + "?statusCode=200&cacheControl=max-age%3D120") +.then(() => testPreloadEventAsAttributeChange(SAME_ORIGIN + "?statusCode=200&cacheControl=max-age%3D120")) // Test changing type parameter from a wrong to a correct one for given as parameter. .then(() => testPreloadEventAttributeChange(SAME_ORIGIN + "?statusCode=200&cacheControl=max-age%3D120", "type", "text/vtt", "image/png", false, true)) // Test changing media parameter from a wrong to a correct one. diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index e4f812d004e7..0d085e33f7c6 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -391,11 +391,28 @@ static const DOMTokenListSupportedToken sSupportedRelValues[] = { nullptr }; +static const DOMTokenListSupportedToken sSupportedRelValuesNoPreload[] = { + // Keep this in sync with ToLinkMask in nsStyleLinkElement.cpp. + // "import" must come first because it's conditional. + "prefetch", + "dns-prefetch", + "stylesheet", + "next", + "alternate", + "preconnect", + "icon", + "search", + nullptr +}; nsDOMTokenList* HTMLLinkElement::RelList() { if (!mRelList) { - mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues); + if (Preferences::GetBool("network.preload")) { + mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues); + } else { + mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValuesNoPreload); + } } return mRelList; } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index ad83b69705c2..7876c9a17231 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2112,7 +2112,7 @@ pref("network.dir.format", 2); // URLs). pref("network.prefetch-next", true); // enables the preloading (i.e., preloading of URLs). -pref("network.preload", true); +pref("network.preload", false); // enables the predictive service pref("network.predictor.enabled", true); diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py index f869c82a8ed0..43da63c7ca4e 100644 --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py @@ -190,7 +190,8 @@ class FirefoxBrowser(Browser): "network.dns.localDomains": ",".join(hostnames), "network.proxy.type": 0, "places.history.enabled": False, - "dom.send_after_paint_to_content": True}) + "dom.send_after_paint_to_content": True, + "network.preload": True}) if self.e10s: self.profile.set_preferences({"browser.tabs.remote.autostart": True}) From ed1d5223adcdc07e9a2589ee20f4e5ee91b4df10 Mon Sep 17 00:00:00 2001 From: Shawn Huang Date: Thu, 12 Oct 2017 15:57:41 +0800 Subject: [PATCH 37/39] Backed out changeset 20571bff3967 (bug 1389561). r=backout a=backout MozReview-Commit-ID: 8GLZx2ls2C4 --HG-- extra : amend_source : 0fb28e72650bbebb2e9484987b34510bfe5750f6 extra : transplant_source : %24%8C_MV%D4%FB%A6%10%F1w%3FE%BD%BB9H%FC2%D6 --- dom/quota/ActorsParent.cpp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index f6517a3101ae..38beaa13030e 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -3838,13 +3838,6 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType, return nullptr; } -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); - MOZ_DIAGNOSTIC_ASSERT(mTemporaryStorageInitialized); - } -#endif - nsString path; nsresult rv = aFile->GetPath(path); NS_ENSURE_SUCCESS(rv, nullptr); @@ -3930,13 +3923,6 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType, { NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!"); -#if defined(NIGHTLY_BUILD) - if (aPersistenceType != PERSISTENCE_TYPE_PERSISTENT){ - MutexAutoLock autoLock(mQuotaMutex); - MOZ_DIAGNOSTIC_ASSERT(mTemporaryStorageInitialized); - } -#endif - if (aFileSizeOut) { *aFileSizeOut = 0; } @@ -5256,14 +5242,7 @@ QuotaManager::EnsureOriginIsInitializedInternal( NS_ENSURE_SUCCESS(rv, rv); } -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); mTemporaryStorageInitialized = true; - } -#else - mTemporaryStorageInitialized = true; -#endif CheckTemporaryStorageLimits(); } @@ -5349,16 +5328,7 @@ QuotaManager::ResetOrClearCompleted() AssertIsOnIOThread(); mInitializedOrigins.Clear(); - -#if defined(NIGHTLY_BUILD) - { - MutexAutoLock autoLock(mQuotaMutex); - mTemporaryStorageInitialized = false; - } -#else - mTemporaryStorageInitialized = false; -#endif - + mTemporaryStorageInitialized = false; mStorageInitialized = false; ReleaseIOThreadObjects(); From ee7b9d0f4248813d0da378e6ade9a874a43fcc37 Mon Sep 17 00:00:00 2001 From: ffxbld Date: Thu, 12 Oct 2017 10:52:23 -0700 Subject: [PATCH 38/39] No bug, Automated HSTS preload list update from host bld-linux64-spot-306 - a=hsts-update --- security/manager/ssl/nsSTSPreloadList.errors | 131 ++++++++++--------- security/manager/ssl/nsSTSPreloadList.inc | 99 ++++++++++---- 2 files changed, 141 insertions(+), 89 deletions(-) diff --git a/security/manager/ssl/nsSTSPreloadList.errors b/security/manager/ssl/nsSTSPreloadList.errors index 98c105a044f4..0a44b3a370b3 100644 --- a/security/manager/ssl/nsSTSPreloadList.errors +++ b/security/manager/ssl/nsSTSPreloadList.errors @@ -7,7 +7,6 @@ 47tech.com: could not connect to host 4loc.us: could not connect to host 4x4.lk: could not connect to host -68277.me: could not connect to host 724go.com: could not connect to host 8560.be: could not connect to host 87577.com: could not connect to host @@ -29,7 +28,6 @@ akul.co.in: could not connect to host alrait.com: could not connect to host altahrim.net: could not connect to host amua.fr: could not connect to host -annetaan.fi: could not connect to host arent.kz: could not connect to host arksan.com.tr: could not connect to host artisense.de: could not connect to host @@ -40,14 +38,13 @@ aviv.nyc: could not connect to host azabani.com: could not connect to host backschues.com: could not connect to host backschues.net: could not connect to host +baitulongbaycruises.com: could not connect to host balonmano.co: could not connect to host -batfoundry.com: could not connect to host bbdos.ru: could not connect to host bencorby.com: could not connect to host benjamin-horvath.com: could not connect to host benjamindietrich.com: could not connect to host benjamindietrich.de: could not connect to host -berdu.id: could not connect to host berna.fr: could not connect to host bip.gov.sa: could not connect to host blumen-garage.de: could not connect to host @@ -64,9 +61,9 @@ cake-time.co.uk: could not connect to host calculatoaresecondhand.xyz: could not connect to host callabs.net: could not connect to host capekeen.com: could not connect to host -capellidipremoli.com: could not connect to host +carloshmm.stream: could not connect to host casperpanel.com: could not connect to host -cbdev.de: could not connect to host +charr.xyz: could not connect to host china-line.org: could not connect to host chloehorler.com: could not connect to host chonghe.org: could not connect to host @@ -76,22 +73,24 @@ clearviewwealthprojector.com.au: could not connect to host cloudbleed.info: could not connect to host cmpr.es: could not connect to host cnlic.com: could not connect to host -cocaine.ninja: could not connect to host coinmewallet.com: could not connect to host colleencornez.com: could not connect to host comssa.org.au: could not connect to host consejosdenutricion.com: could not connect to host +corbax.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 119" data: no] corinnanese.de: could not connect to host cpaneltips.com: could not connect to host +crapouill.es: could not connect to host creative-wave.fr: could not connect to host criticalaim.com: could not connect to host cryptopartyutah.org: could not connect to host cselzer.com: could not connect to host csgo77.com: could not connect to host +ctnguyen.de: could not connect to host +ctnguyen.net: could not connect to host cypherpunk.ws: could not connect to host czlx.co: could not connect to host dahlberg.cologne: could not connect to host -dao.spb.su: could not connect to host dataprotectionadvisors.com: could not connect to host datorb.com: could not connect to host davevelopment.net: could not connect to host @@ -107,13 +106,15 @@ devops.moe: could not connect to host dick.red: could not connect to host digioccumss.ddns.net: could not connect to host dijks.com: could not connect to host +dingcc.org: could not connect to host dingcc.xyz: could not connect to host disco-crazy-world.de: could not connect to host +djieno.com: could not connect to host dkravchenko.su: could not connect to host donotspellitgav.in: could not connect to host -dostavkakurierom.ru: could not connect to host dreizwosechs.de: could not connect to host drkmtrx.xyz: could not connect to host +drlazarina.net: could not connect to host duch.cloud: could not connect to host duelsow.eu: could not connect to host duo.money: could not connect to host @@ -122,7 +123,6 @@ ectora.com: could not connect to host edit.yahoo.com: could not connect to host educatoys.com.br: could not connect to host eeb98.com: could not connect to host -eez.ee: could not connect to host ehuber.info: could not connect to host endlessdiy.ca: could not connect to host estan.cn: could not connect to host @@ -130,6 +130,8 @@ etzi.myds.me: could not connect to host eurostrategy.vn.ua: could not connect to host exceed.global: could not connect to host expatads.com: could not connect to host +exploit.cz: could not connect to host +familletouret.fr: could not connect to host farm24.co.uk: could not connect to host ficklenote.net: could not connect to host filhomes.ph: could not connect to host @@ -141,18 +143,17 @@ fixmyglitch.com: could not connect to host fossewayflowers.co.uk: could not connect to host fossewayflowers.com: could not connect to host foxmay.co.uk: could not connect to host +freaksites.dk: could not connect to host fsf.moe: could not connect to host fukuko.biz: could not connect to host fukuko.xyz: could not connect to host funfunmstdn.tokyo: could not connect to host funideas.org: could not connect to host funksteckdosen24.de: could not connect to host -fuwafuwa.moe: could not connect to host fyol.pw: could not connect to host g4w.co: could not connect to host gam3rs.de: could not connect to host gaygeeks.de: could not connect to host -gdevpenze.ru: could not connect to host geeks.berlin: could not connect to host geneve.guide: could not connect to host getwarden.net: could not connect to host @@ -162,7 +163,6 @@ ggs.jp: could not connect to host ggx.us: could not connect to host globalgivingtime.com: could not connect to host google: could not connect to host -gorn.ch: could not connect to host gottfridsberg.org: could not connect to host gradsm-ci.net: could not connect to host gritte.net: could not connect to host @@ -175,19 +175,20 @@ here.ml: could not connect to host hg881.com: could not connect to host hoodoo.io: could not connect to host hoodoo.tech: could not connect to host -hukkatavara.com: could not connect to host hundter.com: could not connect to host ifxnet.com: could not connect to host -imouyang.com: could not connect to host industreiler.com: could not connect to host industreiler.com.br: could not connect to host inexpensivecomputers.net: could not connect to host +injust.eu.org: could not connect to host +injust.me: could not connect to host installgentoo.net: could not connect to host ipv6.watch: could not connect to host iskai.net: could not connect to host islief.com: could not connect to host isoroc-nidzica.pl: could not connect to host issuesofconcern.in: could not connect to host +ixio.cz: could not connect to host jaredfraser.com: could not connect to host javascriptlab.fr: could not connect to host jcyz.cf: could not connect to host @@ -207,13 +208,11 @@ kenrogers.co: could not connect to host kenvix.com: could not connect to host kieranweightman.me: could not connect to host kinepolis-studio.ga: could not connect to host -kingdomcrc.org: could not connect to host knapp.noip.me: could not connect to host kollawat.me: could not connect to host kousaku.jp: could not connect to host kozmik.co: could not connect to host kteen.info: could not connect to host -laboiteanem.fr: could not connect to host lacasa.fr: could not connect to host lachawoj.de: could not connect to host lathamlabs.com: could not connect to host @@ -248,18 +247,18 @@ mchopkins.net: could not connect to host meanevo.com: could not connect to host metachris.com: could not connect to host mhjuma.com: could not connect to host -mikes.tk: could not connect to host -minakov.pro: could not connect to host mingy.ddns.net: could not connect to host +missionsgemeinde.de: could not connect to host mmstick.tk: could not connect to host modded-minecraft-server-list.com: could not connect to host mosaique-lachenaie.fr: could not connect to host moskva.guide: could not connect to host mrliu.me: could not connect to host -muh.io: could not connect to host muj-svet.cz: could not connect to host munduch.cz: could not connect to host +napcae.de: could not connect to host narada.com.ua: could not connect to host +narodsovety.ru: could not connect to host navdeep.ca: could not connect to host ncdesigns-studio.com: could not connect to host nedcf.org.uk: could not connect to host @@ -278,7 +277,6 @@ oliverspringer.eu: could not connect to host onewebdev.info: could not connect to host onstud.com: could not connect to host optimist.bg: could not connect to host -oranges.tokyo: could not connect to host oscsdp.cz: could not connect to host osterkraenzchen.de: could not connect to host oxygaming.com: could not connect to host @@ -291,14 +289,12 @@ pengisatelier.net: could not connect to host perkbrian.com: could not connect to host persjrp.ca: could not connect to host persoform.ch: could not connect to host -petrachuk.ru: could not connect to host philippa.cool: could not connect to host picallo.es: could not connect to host pkautodesign.com: could not connect to host pkov.cz: could not connect to host plaasprodukte.com: could not connect to host -pm13.cz: could not connect to host -pm13.org: could not connect to host +podemos.info: could not connect to host pointagri.com: could not connect to host polit.im: could not connect to host poolinstallers.co.za: could not connect to host @@ -329,6 +325,7 @@ scrumbleship.com: could not connect to host securitymap.wiki: could not connect to host sellmoretires.com: could not connect to host semantheme.fr: could not connect to host +sgtsnookums.net: could not connect to host shadowplus.net: could not connect to host shadowrocket.net: could not connect to host sharevari.com: could not connect to host @@ -337,13 +334,13 @@ sheratan.web.id: could not connect to host shirakaba-cc.com: could not connect to host simbolo.co.uk: could not connect to host simplerses.com: could not connect to host +sistemy48.ru: could not connect to host sky-aroma.com: could not connect to host -snille.com: could not connect to host +sl1pkn07.wtf: could not connect to host socialworkout.com: could not connect to host socialworkout.net: could not connect to host socialworkout.org: could not connect to host socialworkout.tv: could not connect to host -solariiknight.org: could not connect to host somali-derp.com: could not connect to host sonic.sk: could not connect to host soontm.de: could not connect to host @@ -361,7 +358,6 @@ stytt.com: could not connect to host sufix.cz: could not connect to host surdam.casa: could not connect to host sviz.pro: could not connect to host -systemreboot.net: could not connect to host tenispopular.com: could not connect to host terminalvelocity.co.nz: could not connect to host theprivacysolution.com: could not connect to host @@ -375,32 +371,41 @@ totot.net: could not connect to host transcendmotor.sg: could not connect to host turn-sticks.com: could not connect to host tusb.ml: could not connect to host +twiri.net: could not connect to host +unseen.tw: could not connect to host upr.com.ua: could not connect to host +varta.io: could not connect to host +vcelin-na-doliku.cz: could not connect to host venmos.com: could not connect to host viditut.com: could not connect to host vilog.me: could not connect to host -visionless.me: could not connect to host vitapingu.de: could not connect to host vmgirls.com: could not connect to host +voidptr.eu: could not connect to host vxapps.com: could not connect to host +wachter.biz: could not connect to host warhaggis.com: could not connect to host -warlions.info: could not connect to host watchweasel.com: could not connect to host weareincognito.org: could not connect to host webart-factory.de: could not connect to host webduck.nl: could not connect to host webthings.com.br: could not connect to host +weed.ren: could not connect to host weicn.org: could not connect to host welby.cat: could not connect to host werhatunsverraten.eu: could not connect to host werkinc.de: could not connect to host whilsttraveling.com: could not connect to host +wipc.net: could not connect to host wm-talk.net: could not connect to host wnnc.co.uk: could not connect to host wordpresspro.cl: could not connect to host +wormdisk.net: could not connect to host www-8887999.com: could not connect to host www.simbolo.co.uk: could not connect to host +x64architecture.com: could not connect to host xa1.uk: could not connect to host +xecureit.com: could not connect to host xing.ml: could not connect to host xtremenutrition.com.br: could not connect to host yoitsu.moe: could not connect to host @@ -457,7 +462,7 @@ zzw.ca: could not connect to host 166166.com: could not connect to host 16deza.com: did not receive HSTS header 16packets.com: could not connect to host -173vpn.cn: did not receive HSTS header +173vpn.cn: could not connect to host 173vpns.com: did not receive HSTS header 188betwarriors.co.uk: could not connect to host 188trafalgar.ca: did not receive HSTS header @@ -475,6 +480,7 @@ zzw.ca: could not connect to host 1years.cc: could not connect to host 206rc.net: max-age too low: 2592000 20hs.cn: did not receive HSTS header +21.co.uk: did not receive HSTS header 21lg.co: could not connect to host 22228522.com: could not connect to host 247quickbooks.com: did not receive HSTS header @@ -500,7 +506,7 @@ zzw.ca: could not connect to host 33338522.com: could not connect to host 3338522.com: could not connect to host 33drugstore.com: did not receive HSTS header -341.mg: did not receive HSTS header +341.mg: could not connect to host 3555aa.com: could not connect to host 35792.de: could not connect to host 360gradus.com: did not receive HSTS header @@ -535,7 +541,7 @@ zzw.ca: could not connect to host 4w-performers.link: could not connect to host 50millionablaze.org: could not connect to host 513vpn.net: did not receive HSTS header -517vpn.cn: did not receive HSTS header +517vpn.cn: could not connect to host 540.co: did not receive HSTS header 54bf.com: could not connect to host 55558522.com: could not connect to host @@ -594,7 +600,7 @@ zzw.ca: could not connect to host 9651678.ru: could not connect to host 98laba.com: could not connect to host 98laba.net: could not connect to host -99511.fi: did not receive HSTS header +99511.fi: could not connect to host 99998522.com: could not connect to host 9jadirect.com: did not receive HSTS header 9point6.com: could not connect to host @@ -684,6 +690,7 @@ aderal.io: could not connect to host adfa-1.com: could not connect to host adhs-chaoten.net: did not receive HSTS header adindexr.com: could not connect to host +adiponectinsupplement.net: did not receive HSTS header admin.google.com: did not receive HSTS header (error ignored - included regardless) admiral.dp.ua: did not receive HSTS header admitcard.co.in: did not receive HSTS header @@ -965,6 +972,7 @@ approlys.fr: did not receive HSTS header apps-for-fishing.com: could not connect to host appsbystudio.co.uk: did not receive HSTS header appsdash.io: could not connect to host +aquariumaccessories.shop: did not receive HSTS header aquilalab.com: could not connect to host arabdigitalexpression.org: did not receive HSTS header aradulconteaza.ro: could not connect to host @@ -1131,6 +1139,7 @@ bacchanallia.com: could not connect to host back-bone.nl: did not receive HSTS header backschues.de: could not connect to host bad.show: could not connect to host +badai.at: did not receive HSTS header badcronjob.com: could not connect to host badenhard.eu: could not connect to host badkamergigant.com: could not connect to host @@ -1250,6 +1259,7 @@ bestbeards.ca: could not connect to host bestbridal.top: could not connect to host bestcellular.com: did not receive HSTS header besthost.cz: did not receive HSTS header +bestmodels.su: did not receive HSTS header bestof1001.de: did not receive HSTS header bestorangeseo.com: could not connect to host bestschools.top: could not connect to host @@ -1320,7 +1330,6 @@ birkman.com: did not receive HSTS header bisterfeldt.com: could not connect to host bit-rapid.com: could not connect to host bitbit.org: did not receive HSTS header -bitcantor.com: did not receive HSTS header bitchan.it: could not connect to host bitcoinprivacy.net: did not receive HSTS header bitcoinworld.me: could not connect to host @@ -1342,6 +1351,7 @@ bitwrought.net: could not connect to host bivsi.com: could not connect to host bizcms.com: did not receive HSTS header bizon.sk: did not receive HSTS header +bizpare.com: did not receive HSTS header bkb-skandal.ch: could not connect to host black-armada.com: could not connect to host black-armada.com.pl: could not connect to host @@ -1443,7 +1453,6 @@ brandspray.com: could not connect to host brasilien.guide: could not connect to host brasilmorar.com: could not connect to host bratteng.xyz: could not connect to host -brava.bg: did not receive HSTS header bravz.de: could not connect to host bremensaki.com: max-age too low: 2592000 brenden.net.au: did not receive HSTS header @@ -1692,6 +1701,7 @@ cg.search.yahoo.com: did not receive HSTS header cganx.org: could not connect to host cgerstner.eu: could not connect to host cgsshelper.tk: could not connect to host +chabik.com: did not receive HSTS header chahub.com: could not connect to host chainmonitor.com: could not connect to host championsofregnum.com: did not receive HSTS header @@ -1705,7 +1715,7 @@ charlipopkids.com.au: could not connect to host charnleyhouse.co.uk: did not receive HSTS header charp.eu: could not connect to host chartstoffarm.de: max-age too low: 10 -chaska.co.za: could not connect to host +chaska.co.za: did not receive HSTS header chat-porc.eu: did not receive HSTS header chatbot.me: did not receive HSTS header chateauconstellation.ch: did not receive HSTS header @@ -2055,6 +2065,7 @@ csohack.tk: could not connect to host cspbuilder.info: could not connect to host cssps.org: could not connect to host cssu.in: did not receive HSTS header +csvalpha.nl: did not receive HSTS header csvape.com: did not receive HSTS header ct-status.org: could not connect to host ct.search.yahoo.com: did not receive HSTS header @@ -2071,7 +2082,6 @@ cujba.com: could not connect to host culinae.nl: could not connect to host culture-school.top: could not connect to host cumshots-video.ru: could not connect to host -cunha.be: could not connect to host cuntflaps.me: could not connect to host cuongquach.com: did not receive HSTS header curlyroots.com: did not receive HSTS header @@ -2269,7 +2279,6 @@ devnsec.com: could not connect to host devnull.team: could not connect to host devopps.me: did not receive HSTS header devopsconnected.com: could not connect to host -devpsy.info: could not connect to host devtub.com: did not receive HSTS header devuan.org: did not receive HSTS header dewebwerf.nl: did not receive HSTS header @@ -2287,7 +2296,6 @@ dicelab.co.uk: could not connect to host dicionariofinanceiro.com: did not receive HSTS header die-borts.ch: could not connect to host dieb.photo: could not connect to host -diegorbaquero.com: did not receive HSTS header dierenkruiden.nl: could not connect to host diewebstube.de: could not connect to host diezel.com: could not connect to host @@ -2456,11 +2464,10 @@ dubik.su: did not receive HSTS header duelysthub.com: could not connect to host duerls.de: did not receive HSTS header dukec.me: could not connect to host -dullsir.com: could not connect to host +dullsir.com: did not receive HSTS header dungi.org: could not connect to host duongpho.com: did not receive HSTS header duskopy.top: could not connect to host -dutchessuganda.com: did not receive HSTS header dutchrank.com: did not receive HSTS header duuu.ch: could not connect to host dycontrol.de: could not connect to host @@ -2567,6 +2574,7 @@ eicfood.com: could not connect to host eidolonhost.com: did not receive HSTS header eigo.work: could not connect to host einhorn.space: could not connect to host +ejusu.com: did not receive HSTS header ekbanden.nl: could not connect to host eksik.com: could not connect to host elaintehtaat.fi: did not receive HSTS header @@ -2589,7 +2597,6 @@ elemprendedor.com.ve: did not receive HSTS header elenag.ga: could not connect to host elenagherta.ga: could not connect to host elenoon.ir: did not receive HSTS header -elexprimidor.com: did not receive HSTS header elgacien.de: could not connect to host elimdengelen.com: did not receive HSTS header elite-porno.ru: could not connect to host @@ -3015,6 +3022,7 @@ freematthale.net: did not receive HSTS header freesoftwaredriver.com: did not receive HSTS header freethought.org.au: could not connect to host freeutopia.org: did not receive HSTS header +freifunk-burgaltendorf.de: could not connect to host freqlabs.com: did not receive HSTS header freshfind.xyz: could not connect to host freshlymind.com: did not receive HSTS header @@ -3310,7 +3318,7 @@ graph.no: did not receive HSTS header graphsearchengine.com: could not connect to host gratis-app.com: did not receive HSTS header gratis-lovecheck.de: could not connect to host -gravitation.pro: did not receive HSTS header +gravitation.pro: could not connect to host gravito.nl: did not receive HSTS header gravity-net.de: could not connect to host graycell.net: could not connect to host @@ -3713,7 +3721,6 @@ icq-project.net: could not connect to host icreative.nl: did not receive HSTS header id-co.in: could not connect to host id-conf.com: did not receive HSTS header -idcrane.com: could not connect to host ideal-envelopes.co.uk: did not receive HSTS header idealmoto.com: did not receive HSTS header idealmykonos.com: did not receive HSTS header @@ -3787,6 +3794,7 @@ imolug.org: did not receive HSTS header imoni-blog.net: could not connect to host imoto.me: could not connect to host imouto.my: max-age too low: 5184000 +imouyang.com: did not receive HSTS header imperialwebsolutions.com: did not receive HSTS header imu.li: did not receive HSTS header imusic.dk: did not receive HSTS header @@ -4070,7 +4078,6 @@ jhburton.uk: could not connect to host jhejderup.me: could not connect to host jia1hao.com: could not connect to host jiaidu.com: could not connect to host -jiangzm.com: did not receive HSTS header jichi.me: could not connect to host jikken.de: could not connect to host jimas.eu: did not receive HSTS header @@ -4439,7 +4446,7 @@ land-links.org: did not receive HSTS header landgoedverkopen.nl: could not connect to host landhuisverkopen.nl: could not connect to host landscape.canonical.com: max-age too low: 2592000 -landscapingmedic.com: did not receive HSTS header +landscapingmedic.com: could not connect to host langenbach.rocks: could not connect to host langendries.eu: could not connect to host langhun.me: did not receive HSTS header @@ -4559,6 +4566,7 @@ lightarmory.com: could not connect to host lightning-ashe.com: did not receive HSTS header lightpaste.com: could not connect to host lightworx.io: did not receive HSTS header +likc.me: max-age too low: 0 lila.pink: did not receive HSTS header lillepuu.com: did not receive HSTS header lillpopp.eu: max-age too low: 10 @@ -4904,7 +4912,6 @@ mclist.it: could not connect to host mclyr.com: max-age too low: 7776000 mcooperlaw.com: did not receive HSTS header mdfnet.se: did not receive HSTS header -mdkr.nl: did not receive HSTS header mdscomp.net: did not receive HSTS header meadowfen.farm: could not connect to host meadowfenfarm.com: could not connect to host @@ -5011,7 +5018,7 @@ midonet.org: did not receive HSTS header midwestwomenworkers.org: could not connect to host miegl.cz: could not connect to host miemie.jp: could not connect to host -migeeks.de: did not receive HSTS header +migeeks.de: could not connect to host mightydicks.io: could not connect to host mightydicks.tech: could not connect to host mightysounds.cz: max-age too low: 0 @@ -5244,9 +5251,10 @@ mvsecurity.nl: could not connect to host mw.search.yahoo.com: did not receive HSTS header mwohlfarth.de: did not receive HSTS header my-owncloud.com: could not connect to host +my-pawnshop.com.ua: did not receive HSTS header my-voice.nl: did not receive HSTS header my.alfresco.com: did not receive HSTS header -my.swedbank.se: could not connect to host +my.swedbank.se: did not receive HSTS header myairshop.gr: could not connect to host myandroid.tools: could not connect to host myandroidtools.cc: could not connect to host @@ -5360,7 +5368,7 @@ nedwave.com: could not connect to host nedzad.me: could not connect to host neftaly.com: did not receive HSTS header negativzinsen.info: did not receive HSTS header -neilgreen.net: did not receive HSTS header +neilgreen.net: could not connect to host neko-life.com: did not receive HSTS header neko-system.com: did not receive HSTS header nemno.de: could not connect to host @@ -5410,7 +5418,6 @@ newportpropertygroup.com: could not connect to host newstarnootropics.com: max-age too low: 7776000 newtonwarp.com: could not connect to host next176.sk: did not receive HSTS header -next24.io: did not receive HSTS header next47.com: did not receive HSTS header nextcloud.org: could not connect to host nexth.de: could not connect to host @@ -5494,7 +5501,6 @@ nothing.net.nz: max-age too low: 7776000 noticia.do: did not receive HSTS header notjustbitchy.com: did not receive HSTS header nottheonion.net: did not receive HSTS header -nottres.com: did not receive HSTS header nou.si: could not connect to host nouvelle-vague-saint-cast.fr: did not receive HSTS header nova-elearning.com: did not receive HSTS header @@ -5590,6 +5596,7 @@ oganek.ie: could not connect to host ogogoshop.com: could not connect to host ohai.su: could not connect to host ohling.org: could not connect to host +ohm2013.org: did not receive HSTS header ohsocool.org: could not connect to host ohyooo.com: could not connect to host oiepoie.nl: could not connect to host @@ -5822,7 +5829,6 @@ pastenib.com: could not connect to host paster.li: could not connect to host pataua.kiwi: did not receive HSTS header paternitydnatest.com: could not connect to host -paterno-gaming.com: did not receive HSTS header patfs.com: did not receive HSTS header pathwaytofaith.com: could not connect to host patientinsight.net: did not receive HSTS header @@ -5993,6 +5999,7 @@ playnation.io: could not connect to host pleasure.forsale: could not connect to host pleier-it.de: did not receive HSTS header pleier.it: did not receive HSTS header +plexhome13.ddns.net: could not connect to host plfgr.eu.org: could not connect to host plhdb.org: did not receive HSTS header plirt.ru: could not connect to host @@ -6181,7 +6188,6 @@ purplemoon.mobi: did not receive HSTS header purplestar.mobi: did not receive HSTS header push.world: did not receive HSTS header pushapp.org: did not receive HSTS header -pv-paderborn-now.de: did not receive HSTS header pwd.ovh: could not connect to host pwm.jp: could not connect to host pwnsdx.pw: could not connect to host @@ -6274,7 +6280,7 @@ rannseier.org: did not receive HSTS header rany.duckdns.org: could not connect to host rany.io: could not connect to host rany.pw: could not connect to host -rapido.nu: did not receive HSTS header +rapido.nu: could not connect to host rapidresearch.me: could not connect to host rapidthunder.io: could not connect to host rasing.me: did not receive HSTS header @@ -6568,6 +6574,7 @@ samegoal.org: did not receive HSTS header sametovymesic.cz: could not connect to host samfunnet.no: max-age too low: 0 saml2.com: could not connect to host +samm.com.au: did not receive HSTS header sampcup.com: could not connect to host sampoznay.ru: did not receive HSTS header samraskauskas.com: could not connect to host @@ -6956,7 +6963,6 @@ snailing.org: could not connect to host snakehosting.dk: did not receive HSTS header snapappts.com: could not connect to host snapworks.net: did not receive HSTS header -sneeuwhoogtes.eu: could not connect to host snekchat.moe: could not connect to host snel4u.nl: could not connect to host snelwerk.be: could not connect to host @@ -7108,7 +7114,6 @@ stargatepartners.com: did not receive HSTS header starmusic.ga: did not receive HSTS header starttraffic.com: did not receive HSTS header startuponcloud.com: max-age too low: 2678400 -startuppeople.co.uk: could not connect to host stash.ai: did not receive HSTS header stassi.ch: did not receive HSTS header state-sponsored-actors.net: could not connect to host @@ -7207,6 +7212,7 @@ sumoatm.com: did not receive HSTS header sumoscout.de: could not connect to host suncountrymarine.com: did not receive HSTS header sundanceusa.com: did not receive HSTS header +sunflyer.cn: did not receive HSTS header sunlandsg.vn: did not receive HSTS header sunnyfruit.ru: could not connect to host sunshinepress.org: could not connect to host @@ -7310,7 +7316,6 @@ talkitup.online: did not receive HSTS header talklifestyle.nl: could not connect to host tallr.se: could not connect to host tallshoe.com: could not connect to host -talon.rip: did not receive HSTS header tamex.xyz: could not connect to host tandarts-haarlem.nl: did not receive HSTS header tangel.me: could not connect to host @@ -7893,6 +7898,7 @@ unplugg3r.dk: could not connect to host unravel.ie: could not connect to host unsystem.net: could not connect to host unwiredbrain.com: could not connect to host +unwomen.is: did not receive HSTS header unyq.me: could not connect to host uonstaffhub.com: could not connect to host uow.ninja: could not connect to host @@ -7907,7 +7913,6 @@ ur-lauber.de: did not receive HSTS header urandom.eu.org: did not receive HSTS header urban-garden.lt: could not connect to host urban-garden.lv: could not connect to host -urbanfi.sh: did not receive HSTS header urbanstylestaging.com: did not receive HSTS header urbpic.com: could not connect to host urlchomp.com: did not receive HSTS header @@ -8130,7 +8135,6 @@ w4xzr.top: could not connect to host w4xzr.xyz: could not connect to host waaw.tv: did not receive HSTS header wachtwoordencheck.nl: could not connect to host -wafairhaven.com.au: did not receive HSTS header wait.moe: could not connect to host waixingrenfuli7.vip: could not connect to host wakapp.de: could not connect to host @@ -8219,7 +8223,6 @@ weddingibiza.nl: could not connect to host weekly.fyi: could not connect to host wegenaer.nl: could not connect to host weiji.ga: did not receive HSTS header -weisse-liste.de: did not receive HSTS header welkers.org: could not connect to host wellastore.ru: did not receive HSTS header wellcomp.com.br: did not receive HSTS header @@ -8518,7 +8521,7 @@ yasinaydin.net: max-age too low: 2592000 yasutomonodokoiko.com: did not receive HSTS header yatesun.com: did not receive HSTS header ycc.wtf: could not connect to host -ychon.com: did not receive HSTS header +ychon.com: could not connect to host ycm2.wtf: could not connect to host yd.io: could not connect to host ydy.jp: could not connect to host @@ -8567,12 +8570,12 @@ ypiresia.fr: could not connect to host ytcuber.xyz: could not connect to host ytvwld.de: did not receive HSTS header yu7.jp: did not receive HSTS header +yufan.me: did not receive HSTS header yugege.cf: could not connect to host yuhen.ru: did not receive HSTS header yukiminami.net: could not connect to host yuko.moe: could not connect to host yukonrefugees.com: could not connect to host -yum0.cn: did not receive HSTS header yummyfamilyrecipes.com: could not connect to host yunpan.blue: did not receive HSTS header yuntama.xyz: did not receive HSTS header @@ -8599,7 +8602,6 @@ zao.fi: did not receive HSTS header zaoshanghao-dajia.rhcloud.com: did not receive HSTS header zap.yt: did not receive HSTS header zarooba.com: could not connect to host -zary.me: did not receive HSTS header zavca.com: did not receive HSTS header zbigniewgalucki.eu: did not receive HSTS header zcon.nl: could not connect to host @@ -8665,6 +8667,7 @@ zmy.im: did not receive HSTS header zocken.com: did not receive HSTS header zoe.vc: could not connect to host zohar.link: could not connect to host +zolotoy-standart.com.ua: did not receive HSTS header zomiac.pp.ua: could not connect to host zoneminder.com: did not receive HSTS header zoners.si: could not connect to host diff --git a/security/manager/ssl/nsSTSPreloadList.inc b/security/manager/ssl/nsSTSPreloadList.inc index 2019864f516b..23234c1ab9e9 100644 --- a/security/manager/ssl/nsSTSPreloadList.inc +++ b/security/manager/ssl/nsSTSPreloadList.inc @@ -8,7 +8,7 @@ /*****************************************************************************/ #include -const PRTime gPreloadListExpirationTime = INT64_C(1518675616440000); +const PRTime gPreloadListExpirationTime = INT64_C(1518716942697000); %% 0.me.uk, 1 00001.am, 1 @@ -135,6 +135,7 @@ const PRTime gPreloadListExpirationTime = INT64_C(1518675616440000); 1750studios.com, 0 17hats.com, 1 1844329061.rsc.cdn77.org, 1 +188522.com, 1 18888msc.com, 1 1888zr.com, 1 18f.gov, 1 @@ -182,7 +183,6 @@ const PRTime gPreloadListExpirationTime = INT64_C(1518675616440000); 2048-spiel.de, 1 2048game.co.uk, 1 208.es, 1 -21.co.uk, 1 21stnc.com, 1 21x9.org, 1 22scc.com, 1 @@ -709,7 +709,6 @@ adigitali.biz, 1 adimaja.com, 1 adinariversloveschool.com, 1 adiponectinsupplement.info, 1 -adiponectinsupplement.net, 1 adjagu.org, 1 adlershop.ch, 1 adlerweb.info, 1 @@ -1732,7 +1731,6 @@ aqualifeprojects.com, 1 aqualogy.de, 1 aquapoint.kiev.ua, 1 aquarium-supplement.net, 1 -aquariumaccessories.shop, 1 aquaron.com, 1 aquaselect.eu, 1 aquatechnologygroup.com, 1 @@ -1748,6 +1746,7 @@ arab.dating, 1 arabsexi.info, 1 arachina.com, 1 arados.de, 1 +arai21.net, 1 araleeniken.com, 1 aramado.com, 1 aramido.de, 1 @@ -1902,6 +1901,7 @@ artlogo.cz, 1 artlogo.sk, 1 artmaxi.eu, 1 artmoney.com, 1 +arto.bg, 1 artofeyes.nl, 1 artofwhere.com, 1 artroot.jp, 1 @@ -1919,6 +1919,7 @@ arveron.ch, 1 arvid.io, 1 arvindhariharan.com, 1 arvindhariharan.me, 1 +arvutiladu.ee, 1 arw.me, 1 arxell.com, 1 aryan-nation.com, 1 @@ -2268,6 +2269,7 @@ awaro.net, 1 awccanadianpharmacy.com, 1 awei.pub, 1 awen.me, 1 +awf0.xyz, 1 awin.la, 1 awk.tw, 1 awksolutions.com, 1 @@ -2275,6 +2277,7 @@ awningsaboveus.com, 1 awomaninherprime.com, 1 awsmdev.de, 1 ax25.org, 1 +axel-fischer.science, 1 axelteichmann.net, 1 axem.co.jp, 1 axg.io, 1 @@ -2374,7 +2377,6 @@ bacontreeconsulting.com, 1 bacula.jp, 1 bad.horse, 1 bad.pet, 1 -badai.at, 1 badam.co, 1 badbee.cc, 1 badf00d.de, 1 @@ -2867,7 +2869,6 @@ besthotsales.com, 1 bestlashesandbrows.com, 1 bestlashesandbrows.hu, 1 bestleftwild.com, 1 -bestmodels.su, 1 bestmotherfucking.website, 1 bestperfumebrands.com, 1 bestseries.tv, 1 @@ -3124,6 +3125,7 @@ bitbucket.com, 1 bitbucket.io, 1 bitbucket.org, 1 bitburner.de, 1 +bitcantor.com, 1 bitcoin-class.com, 1 bitcoin-daijin.com, 1 bitcoin-india.net, 1 @@ -3202,7 +3204,6 @@ bizeau.ch, 1 bizedge.co.nz, 1 bizniskatalog.mk, 1 biznpro.ru, 1 -bizpare.com, 1 biztera.com, 1 biztok.eu, 1 bizzartech.com, 1 @@ -3655,6 +3656,7 @@ bratvanov.com, 1 brauingenieur.de, 1 braunsteinpc.com, 1 braunwarth.info, 1 +brava.bg, 1 brave-foods.ch, 1 brave-foods.com, 1 brave.com, 1 @@ -3990,6 +3992,7 @@ by77.com, 1 by777.com, 1 byatte.com, 1 bygningsregistrering.dk, 1 +byiu.info, 1 byji.com, 1 bymark.co, 1 bymike.co, 1 @@ -4084,6 +4087,7 @@ cake-time.co.uk, 1 cakestart.net, 1 caketoindia.com, 1 cakingandbaking.com, 1 +cal.goip.de, 1 calaad.net, 1 calabasaselectrical.com, 1 calaborlawnews.com, 1 @@ -4538,7 +4542,6 @@ ch-sc.de, 1 ch.search.yahoo.com, 0 chabaojia.com, 1 chabaudparfum.com, 1 -chabik.com, 0 chad.ch, 1 chadstoneapartments.com.au, 1 chaifeng.com, 1 @@ -5039,6 +5042,7 @@ clinicaferrusbratos.com, 1 clinicaltrials.gov, 1 cliniko.com, 1 clintonlibrary.gov, 1 +clintonplasticsurgery.com, 1 clip.mx, 0 clipclip.com, 1 clmde.de, 1 @@ -5069,6 +5073,7 @@ cloud2go.de, 1 cloudapps.digital, 1 cloudbased.info, 1 cloudbasedsite.com, 1 +cloudberlin.goip.de, 1 cloudbleed.info, 1 cloudbolin.es, 1 cloudbreaker.de, 1 @@ -5417,6 +5422,7 @@ computernetwerkwestland.nl, 1 computerslotopschool.nl, 1 comssa.org.au, 1 comunidadmontepinar.es, 1 +comw.cc, 1 comyuno.com, 1 conaudisa.com, 0 concentrade.de, 1 @@ -5877,7 +5883,6 @@ cssaunion.com, 1 cstb.ch, 1 cstp-marketing.com, 1 csuw.net, 1 -csvalpha.nl, 1 cthomas.work, 1 ctj.im, 1 ctliu.com, 1 @@ -5917,6 +5922,7 @@ cultivo.bio, 1 cultofperf.org.uk, 1 culturedcode.com, 1 cultureroll.com, 1 +cunha.be, 1 cuni-cuni-club.com, 1 cuni-rec.com, 1 cuoc.org.uk, 1 @@ -6201,6 +6207,7 @@ danseressen.nl, 1 dansk-skole.de, 1 danskoferie.dk, 1 danskringsporta.be, 1 +dantransports.fr, 1 danw.io, 1 danwin1210.me, 1 danyabanya.com, 1 @@ -6746,6 +6753,7 @@ devonsawatzky.ca, 1 devops-survey.com, 1 devops.moe, 1 devpgsv.com, 1 +devpsy.info, 1 devstaff.gr, 1 devyn.ca, 1 devzero.io, 1 @@ -6838,6 +6846,7 @@ diedrich.me, 1 diegelernten.de, 1 diegerbers.de, 1 diegogelin.com, 1 +diegorbaquero.com, 1 diehl.io, 1 diejanssens.net, 1 diemattels.at, 1 @@ -6981,7 +6990,7 @@ discofitta.com, 1 disconformity.net, 1 discord-chan.net, 1 discordapp.com, 1 -discotek.club, 1 +discotek.club, 0 discount24.de, 1 discountmania.eu, 1 discountmetaux.fr, 1 @@ -7536,6 +7545,7 @@ dustygroove.com, 1 dustyspokesbnb.ca, 1 dutch.desi, 1 dutch1.nl, 1 +dutchessuganda.com, 1 dutchrank.nl, 1 dutchwanderers.nl, 1 dutchweballiance.nl, 1 @@ -7905,7 +7915,6 @@ eiyoushi-shigoto.com, 1 ejdv-anmeldung.de, 1 ejeff.org, 1 ejgconsultancy.co.uk, 1 -ejusu.com, 1 ekd.de, 1 ekedc.com, 1 ekedp.com, 1 @@ -7976,6 +7985,7 @@ eletesstilus.hu, 1 eleusis-zur-verschwiegenheit.de, 1 elevateandprosper.com, 1 elexel.ru, 1 +elexprimidor.com, 1 elglobo.com.mx, 1 elgosblanc.com, 1 elhall.pro, 1 @@ -8720,6 +8730,7 @@ extranetpuc.com.br, 1 extrapagetab.com, 1 extreme-gaming.de, 1 extreme-gaming.us, 1 +extreme-players.com, 1 extreme-players.de, 1 extrememanual.net, 0 exvs.org, 1 @@ -9018,6 +9029,7 @@ feisim.com, 1 feisim.org, 1 feistyduck.com, 1 feitobrasilcosmeticos.com.br, 1 +fejes.house, 1 feld.design, 1 feld.saarland, 1 feldhousen.com, 1 @@ -9846,6 +9858,7 @@ fukakukeiba.com, 1 fukuko.biz, 1 fukuko.xyz, 1 fukuoka-cityliner.jp, 1 +fukushimacoffee.com, 1 fulgenzis.com, 1 fuli.am, 1 fuliwang.info, 1 @@ -9939,6 +9952,7 @@ fyfywka.com, 1 fyn.nl, 1 fyodorpi.com, 1 fyol.pw, 1 +fysesbjerg.dk, 1 fysiotherapieholtenbroek.nl, 1 fysiotherapierossum.nl, 1 fysiovdberg.nl, 1 @@ -11260,6 +11274,7 @@ hbvip.com, 1 hcbj.io, 1 hcfhomelottery.ca, 1 hcoe.fi, 1 +hcstr.com, 1 hd-gaming.com, 1 hd-offensive.at, 0 hd-only.org, 1 @@ -11939,6 +11954,7 @@ huguesditciles.com, 1 huihui.moe, 1 huirongis.me, 1 huiser.nl, 1 +huislaw.com, 1 huitaodang.com, 1 hukaloh.com, 1 hukkatavara.com, 1 @@ -12061,7 +12077,7 @@ iaeste.no, 1 iainsimms.me, 1 ialis.me, 1 iamcarrico.com, 1 -iamprophet.pw, 1 +iamprophet.pw, 0 iamsoareyou.se, 1 iamtheib.me, 1 iamusingtheinter.net, 1 @@ -12143,6 +12159,7 @@ idaspis.com, 1 idatha.de, 1 idc-business.be, 1 idconsult.nl, 1 +idcrane.com, 1 iddconnect.com, 1 iddconnect.org, 1 ideadozz.hu, 1 @@ -12161,7 +12178,7 @@ idexxpublicationportal.com, 1 idgard.de, 1 idhosts.co.id, 1 idid.tk, 1 -idinby.dk, 1 +idinby.dk, 0 idiopolis.org, 1 idiotentruppe.de, 1 idmanagement.gov, 1 @@ -12321,6 +12338,7 @@ imanudin.net, 1 imawhale.com, 1 imbrian.org, 1 imbushuo.net, 1 +imcsx.co, 1 imed.com.pt, 1 imed.pt, 1 imedi.co.uk, 1 @@ -12362,7 +12380,6 @@ immortal.run, 1 imokuri123.com, 1 imoner.com, 1 imoner.ga, 1 -imouyang.com, 1 impact.health.nz, 1 impacter.eu, 1 impactfestival.be, 1 @@ -13348,6 +13365,7 @@ jhollandtranslations.com, 1 jhuang.me, 1 jhwestover.com, 1 jialinwu.com, 0 +jiangzm.com, 1 jianjia.io, 0 jiaqiang.vip, 1 jichi.io, 1 @@ -13631,6 +13649,7 @@ juanmaguitar.com, 1 juanxt.ddns.net, 1 jubileum.online, 1 juch.cc, 1 +juchheim-methode.de, 1 juchit.at, 1 judc-ge.ch, 1 judoprodeti.cz, 1 @@ -13680,6 +13699,7 @@ juni.io, 1 juniperroots.ca, 1 juniwalk.cz, 1 junkdrome.org, 1 +junqueiropolis.com, 1 jurassicbarkharrogate.co.uk, 1 jurassicgolf.nl, 1 juridoc.com.br, 1 @@ -13789,6 +13809,7 @@ kakoo.nl, 1 kakoomedia.nl, 1 kalastus.com, 1 kalender.com, 1 +kalender.goip.de, 1 kalevlamps.co.uk, 1 kaliaa.fi, 1 kalian.cz, 1 @@ -14148,6 +14169,7 @@ kinderbasar-luhe.de, 1 kinderbuecher-kostenlos.de, 1 kinderopvangengeltjes.nl, 1 kindleworth.com, 1 +kinepolis-studio.be, 1 kinepolis-studio.ga, 1 kinetiq.com, 1 kineto.space, 1 @@ -14532,6 +14554,8 @@ krumberconsulting.com, 1 krupa.net.pl, 0 krutka.cz, 1 kruu.de, 1 +kry.no, 1 +kry.se, 1 kryglik.com, 1 krypsys.com, 1 kryptera.se, 1 @@ -15267,7 +15291,6 @@ lignoma.com, 1 ligonier.com, 1 lihaul.dnsalias.net, 1 lijero.co, 1 -likc.me, 1 likeablehub.com, 1 likeabox.de, 1 likeaross.com, 0 @@ -15297,6 +15320,7 @@ limpens.net, 0 limpid.nl, 1 limules.ch, 1 limunana.com, 1 +linan.blog, 1 lincdavis.com, 1 linden.me, 1 lindeskar.se, 1 @@ -15935,6 +15959,7 @@ mae-berlinistanbul.com, 1 maedchenflohmarkt.at, 1 maedchenflohmarkt.de, 1 maelstrom.ninja, 1 +maeplasticsurgery.com, 1 maestrano.com, 1 maff.co.uk, 1 maff.scot, 0 @@ -16531,6 +16556,7 @@ mdcloudps.com, 1 mdek.at, 1 mdewendt.de, 1 mdf-bis.com, 1 +mdkr.nl, 1 mdma.net, 1 mdmed.clinic, 1 mdosch.de, 1 @@ -17346,6 +17372,7 @@ moodfoods.com, 1 moodzshop.com, 1 moojp.co.jp, 1 moonagic.com, 1 +moonchart.co.uk, 1 moondrop.org, 1 moonmelo.com, 1 moonraptor.co.uk, 1 @@ -17693,7 +17720,6 @@ my-floor.com, 1 my-host.ovh, 1 my-hps.de, 1 my-ip.work, 1 -my-pawnshop.com.ua, 0 my-plancha.ch, 1 my-static-demo-808795.c.cdn77.org, 1 my-static-live-808795.c.cdn77.org, 1 @@ -18038,6 +18064,7 @@ natuterra.com.br, 1 nauck.org, 1 naude.co, 0 naughty.audio, 1 +nautiljon.com, 1 nautsch.de, 1 navdeep.ca, 1 navigate-it-services.de, 0 @@ -18371,6 +18398,7 @@ nexicafiles.com, 1 nexlab.org, 1 next-log.ru, 0 next-taxi.ru, 1 +next24.io, 1 nextads.ch, 1 nextcairn.com, 1 nextcloud.com, 1 @@ -18722,6 +18750,7 @@ notnize.net, 1 notnl.com, 1 notoriousdev.com, 1 notrecourrier.net, 1 +nottres.com, 1 notypiesni.sk, 0 noudjalink.nl, 1 nouma.fr, 1 @@ -19000,7 +19029,6 @@ ohiohealthfortune100.com, 1 ohlmeier.com, 0 ohlmeier.net, 0 ohlmeier.org, 0 -ohm2013.org, 1 ohnemusik.com, 1 ohreally.de, 1 oilpaintingsonly.com, 1 @@ -19223,6 +19251,7 @@ openiocdb.com, 1 openitforum.pl, 1 openkim.org, 1 openkvk.nl, 1 +openmirrors.cf, 1 opennippon.com, 1 opennippon.ru, 1 openpictures.ch, 1 @@ -19715,6 +19744,7 @@ pasztor.at, 1 patadanabouca.pw, 1 patechmasters.com, 1 patentfamily.de, 1 +paterno-gaming.com, 1 patflix.com, 1 pathwaystoresilience.org, 1 patikabiztositas.hu, 1 @@ -20802,6 +20832,7 @@ pro-bike.ro, 1 pro-ing.com, 1 pro-link.eu, 1 pro-mile.pl, 1 +pro-netz.de, 1 proactive.run, 1 probas.de, 1 probase.ph, 1 @@ -21083,6 +21114,7 @@ puzz.gg, 1 puzz.me, 1 puzzle-welt.ch, 1 puzzlepoint.ch, 1 +pv-paderborn-now.de, 1 pvagner.tk, 1 pvcvoordeel.nl, 0 pvpcraft.ca, 1 @@ -21363,7 +21395,7 @@ randomkoalafacts.com, 1 randomprecision.co.uk, 1 randomquotesapp.com, 1 randstaddirect.nl, 1 -randy.su, 1 +randy.su, 0 rangde.org, 1 ranking-deli.jp, 1 ranos.org, 1 @@ -22511,7 +22543,6 @@ samirnassar.com, 1 samizdat.cz, 1 samkelleher.com, 1 saml-gateway.org, 1 -samm.com.au, 1 sammyjohnson.com, 0 sammyservers.com, 1 samp.im, 1 @@ -22748,6 +22779,7 @@ schmaeh-coaching.ch, 1 schmelzle.io, 1 schmetterlingsapp.at, 1 schmidthomes.com, 1 +schmidtplasticsurgery.com, 1 schmidttulskie.de, 1 schmitt-max.com, 1 schmitt.ws, 1 @@ -24006,6 +24038,7 @@ sneed.company, 1 sneed.it, 1 sneedit.com, 1 sneedit.de, 1 +sneeuwhoogtes.eu, 1 sneezry.com, 1 snelbv.nl, 1 snelshops.nl, 1 @@ -24477,6 +24510,7 @@ sslpoint.com, 1 ssls.cz, 1 sslsurvey.de, 1 sslzilla.de, 1 +ssnet.vip, 1 sss3s.com, 1 sstaging.com, 1 sstewartgallus.com, 1 @@ -24553,6 +24587,7 @@ startrek.in, 1 starttraffic.uk, 1 startup.melbourne, 1 startuplevel.com, 1 +startuppeople.co.uk, 1 startupsort.com, 1 startupum.ru, 1 starwatches.eu, 1 @@ -24929,7 +24964,6 @@ sundaycooks.com, 1 sundayfundayjapan.com, 1 suneilpatel.com, 1 sunfireshop.com.br, 1 -sunflyer.cn, 0 sunfox.cz, 1 sunfulong.me, 1 sungo.wtf, 1 @@ -25253,6 +25287,7 @@ talkwithyourbaby.org, 1 tallcraft.com, 1 talldude.net, 1 talltreeskv.com.au, 1 +talon.rip, 1 talsi.eu, 1 talun.de, 1 tam7t.com, 1 @@ -25611,6 +25646,7 @@ testsuite.org, 1 testuje.net, 1 tetedelacourse.ch, 1 tetrarch.co, 1 +tetsai.com, 1 tetsugakunomichi.jp, 1 tetsumaki.net, 1 teuniz.nl, 1 @@ -25736,6 +25772,7 @@ thecustomizewindows.com, 0 thedailyupvote.com, 1 thedark1337.com, 1 thedarkartsandcrafts.com, 1 +thederminstitute.com, 1 thedevilwearswibra.nl, 1 thedevrycommonsbrasil.com, 0 thediaryofadam.com, 1 @@ -26863,8 +26900,10 @@ twenty71.com, 1 twentymilliseconds.com, 1 twilleys.com, 1 twincitynissantxparts.com, 1 +twinkieman.com, 1 twiri.net, 1 twistapp.com, 1 +twisted-brains.org, 1 twistedwave.com, 1 twisto.cz, 1 twit-guide.com, 1 @@ -27034,6 +27073,7 @@ unblocked.cam, 1 unblocked.ink, 1 unblocked.live, 1 unblocked.one, 1 +unblocked.pro, 1 unblocked.pub, 1 unblocked.uno, 1 unblocked.vip, 1 @@ -27150,7 +27190,6 @@ untoldstory.eu, 1 unun.fi, 1 unusualhatclub.com, 1 unveiledgnosis.com, 1 -unwomen.is, 1 unx.dk, 1 unxicdellum.cat, 1 upandclear.org, 1 @@ -27159,6 +27198,7 @@ upay.ru, 1 upbad.com, 1 upbeatrobot.com, 1 upbeatrobot.eu, 1 +upd.jp, 1 upgamerengine.com, 1 upgamerengine.com.br, 1 upgamerengine.net, 1 @@ -27194,6 +27234,7 @@ urbalex.ch, 1 urban-culture.fr, 1 urban.melbourne, 1 urbanesecurity.com, 1 +urbanfi.sh, 1 urbanguerillas.de, 1 urbanietz-immobilien.de, 1 urbanmelbourne.info, 1 @@ -27231,6 +27272,7 @@ usakitchensandflooring.com, 1 usap.gov, 0 usbcraft.com, 1 uscloud.nl, 1 +uscp8.com, 1 usd.de, 1 use.be, 1 usebean.com, 1 @@ -27571,6 +27613,7 @@ victornet.de, 1 vicyu.com, 1 vid-immobilien.de, 1 vid.me, 1 +vida.es, 1 vidbooster.com, 1 vide-dressing.org, 0 vide-greniers.org, 0 @@ -27593,6 +27636,7 @@ viemeister.com, 1 viemontante.be, 1 viennan.net, 1 vientos.coop, 1 +viepixel.at, 1 vierdaagsehotel.nl, 1 vierpfeile.de, 1 vierpluseins.wtf, 1 @@ -27923,6 +27967,7 @@ wadvisor.com, 1 waelisch.de, 1 waelti.xxx, 1 wafa4hw.com, 1 +wafairhaven.com.au, 0 waffle.at, 1 wafni.com, 1 wahhoi.net, 0 @@ -28218,6 +28263,7 @@ weinbergerlawgroup.com, 1 weinhandel-preissler.de, 1 weirdesigns.com, 1 weirdserver.com, 1 +weisse-liste.de, 1 weissman.agency, 1 weiterbildung-vdz.de, 1 weiyuz.com, 1 @@ -28599,6 +28645,7 @@ wnu.com, 1 wo-ist-elvira.net, 1 wo2forum.nl, 0 wobble.ninja, 1 +wochennummern.de, 1 wod-stavby.cz, 1 wodboss.com, 1 wodinaz.com, 1 @@ -28722,6 +28769,7 @@ wpenhance.com, 1 wphostingblog.nl, 1 wpinfos.de, 1 wpinter.com, 1 +wplatin.com, 1 wpldn.uk, 1 wpletter.de, 0 wpmeetup-berlin.de, 1 @@ -28871,6 +28919,7 @@ www.theguardian.com, 1 www.therapynotes.com, 1 www.tinfoilsecurity.com, 0 www.torproject.org, 0 +www.tumblr.com, 0 www.twitter.com, 0 www.united.com, 1 www.usaa.com, 0 @@ -29446,7 +29495,6 @@ yudan.com.br, 1 yude.ml, 1 yue.la, 1 yue2.net, 1 -yufan.me, 1 yuhuo.org, 1 yuka.one, 1 yuki.xyz, 1 @@ -29454,6 +29502,7 @@ yukonconnector.com, 1 yukonlip.com, 1 yukontec.com, 1 yum.beer, 1 +yum0.cn, 1 yumeconcert.com, 1 yuna.love, 1 yuna.tg, 1 @@ -29521,6 +29570,7 @@ zappbuildapps.com, 1 zaratan.fr, 1 zarmarket.org, 1 zarpo.com.br, 1 +zary.me, 1 zaufanatrzeciastrona.pl, 1 zavec.com.ec, 1 zavetaji.lv, 1 @@ -29655,8 +29705,8 @@ zittingskalender.be, 1 zivava.ge, 1 zivmergers.com, 1 zivver.com, 1 -zivy-ruzenec.cz, 1 -zivyruzenec.cz, 1 +zivy-ruzenec.cz, 0 +zivyruzenec.cz, 0 zixiao.wang, 1 zkrypt.cc, 1 zlatakus.cz, 1 @@ -29679,7 +29729,6 @@ zojadravai.com, 1 zoki.art, 1 zokster.net, 1 zolokar.xyz, 1 -zolotoy-standart.com.ua, 1 zombiesecured.com, 1 zomerschoen.nl, 1 zone-produkte.de, 1 From ef0d419a79b340090b185c5fead1d6df907351ec Mon Sep 17 00:00:00 2001 From: ffxbld Date: Thu, 12 Oct 2017 10:52:26 -0700 Subject: [PATCH 39/39] No bug, Automated HPKP preload list update from host bld-linux64-spot-306 - a=hpkp-update --- security/manager/ssl/StaticHPKPins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/manager/ssl/StaticHPKPins.h b/security/manager/ssl/StaticHPKPins.h index 80ea3657fcd0..e0787b9afdae 100644 --- a/security/manager/ssl/StaticHPKPins.h +++ b/security/manager/ssl/StaticHPKPins.h @@ -1159,4 +1159,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = { static const int32_t kUnknownId = -1; -static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1516256426469000); +static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1516297752722000);