merge mozilla-central to autoland. r=merge a=merge on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-10-13 00:53:56 +02:00
commit 87cd48824a
107 changed files with 1826 additions and 1022 deletions

View File

@ -0,0 +1,2 @@
// Turn off budget throttling for the profile server
user_pref("dom.timeout.enable_budget_timer_throttling", false);

6
build/pgo/profileserver.py Normal file → Executable file
View File

@ -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(

View File

@ -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> 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<IdleRequestCallback> mCallback;
nsCOMPtr<nsIGlobalObject> mParent;
nsCOMPtr<nsITimer> 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<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
MOZ_ASSERT(global);
auto runnable = MakeRefPtr<IdleDispatchRunnable>(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,

View File

@ -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

View File

@ -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,6 +61,7 @@ IdleDeadline::TimeRemaining()
return 0.0;
}
if (mWindow) {
RefPtr<Performance> performance = mWindow->GetPerformance();
if (!performance) {
// If there is no performance object the window is partially torn
@ -58,6 +70,12 @@ IdleDeadline::TimeRemaining()
}
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

View File

@ -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<JSObject*> aGivenProto) override;
@ -45,6 +49,7 @@ private:
~IdleDeadline();
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsCOMPtr<nsIGlobalObject> mGlobal;
const bool mDidTimeout;
const DOMHighResTimeStamp mDeadline;
};

View File

@ -1666,18 +1666,17 @@ WebSocketImpl::Init(JSContext* aCx,
nsCOMPtr<nsPIDOMWindowInner> innerWindow;
while (true) {
if (principal) {
bool isNullPrincipal = true;
isNullPrincipal = principal->GetIsNullPrincipal();
if (isNullPrincipal || nsContentUtils::IsSystemPrincipal(principal)) {
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;
}
}

View File

@ -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,

View File

@ -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());
}

View File

@ -0,0 +1,65 @@
<html><body>
<iframe id="frame" sandbox="allow-scripts allow-popups"></iframe>
<script type="application/javascript;version=1.8">
onmessage = function(e) {
parent.postMessage(e.data, '*');
}
var ifr = document.getElementById('frame');
if (location.search == '?nested') {
var url = new URL(location);
url.search = "";
ifr.src = url.href;
} else if (location.search == '?popup') {
var url = new URL(location);
url.search = "?opener";
ifr.srcdoc = "<html><script>" +
"window.open('" + url.href + "', 'foobar');" +
"onmessage = function(e) { " +
" parent.postMessage(e.data, '*'); " +
"}" +
"</scr" + "ipt></html>";
} else if (location.search == '?opener') {
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
socket.onerror = function(e) {
opener.postMessage('WS onerror', '*');
close();
};
socket.onopen = function(event) {
opener.postMessage('WS onopen', '*');
close();
};
} catch(e) {
if (e.name == 'SecurityError') {
opener.postMessage('WS Throws!', '*');
} else {
opener.postMessage('WS Throws something else!', '*');
}
close();
}
} else {
ifr.srcdoc = `
<html><script>
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
socket.onerror = function(e) {
parent.postMessage('WS onerror', '*');
};
socket.onopen = function(event) {
parent.postMessage('WS onopen', '*');
};
} catch(e) {
if (e.name == 'SecurityError') {
parent.postMessage('WS Throws!', '*');
} else {
parent.postMessage('WS Throws something else!', '*');
}
}
</scr`+`ipt>
</html>`;
}
</script>
</body></html>

View File

@ -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]

View File

@ -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))

View File

@ -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.

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 1252751</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="container"></div>
<iframe id="frame"></iframe>
<script type="application/javascript;version=1.8">
var urls = [ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?nested",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?popup" ];
onmessage = function(e) {
is(e.data, "WS Throws!", "ws://URI cannot be used by a https iframe");
runTest();
}
function runTest() {
if (!urls.length) {
SimpleTest.finish();
return;
}
document.getElementById("frame").src = urls.shift();
}
SimpleTest.waitForExplicitFinish();
runTest();
</script>
</body>
</html>

View File

@ -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) {
if (Preferences::GetBool("network.preload")) {
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues);
} else {
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValuesNoPreload);
}
}
return mRelList;
}

View File

@ -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<Promise>
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 = 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<Promise>
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 = Promise::Create(global, rv);
if(rv.Failed()) {
if (rv.Failed()) {
return nullptr;
}
@ -690,6 +700,7 @@ WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent,
void
WebAuthnManager::FinishMakeCredential(nsTArray<uint8_t>& aRegBuffer)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mTransactionPromise);
MOZ_ASSERT(mInfo.isSome());
@ -813,6 +824,7 @@ void
WebAuthnManager::FinishGetAssertion(nsTArray<uint8_t>& aCredentialId,
nsTArray<uint8_t>& 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!");
}

View File

@ -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);
};
/**

View File

@ -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;

View File

@ -0,0 +1,18 @@
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
let r = new Request("#a#a");
setTimeout(function(){
r.formData();
setTimeout(function(){
r.blob();
}, 0);
}, 0);
}
addEventListener("DOMContentLoaded", boom);
</script>
</head>
</html>

View File

@ -3,3 +3,4 @@ load 943516.html
load 1153636.html
load 1158031.html
load 1228456.html
load 1348882.html

View File

@ -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

View File

@ -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);
};

View File

@ -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

View File

@ -0,0 +1,15 @@
<html>
<head>
<script>
try { o1 = window.getSelection() } catch(e) { }
try { o2 = document.createElement('map') } catch(e) { };
try { o3 = document.createElement('select') } catch(e) { }
try { document.documentElement.appendChild(o2) } catch(e) { };
try { o2.contentEditable = 'true' } catch(e) { };
try { o2.offsetTop } catch(e) { };
try { document.replaceChild(document.implementation.createHTMLDocument().documentElement, document.documentElement); } catch(e) { }
try { document.documentElement.appendChild(o3) } catch(e) { }
try { o1.modify('extend', 'forward', 'word') } catch(e) { }
</script>
</head>
</html>

View File

@ -0,0 +1,17 @@
<xsl:stylesheet id='xsl'>
<script id='script'>
try { o1 = document.createElement('table') } catch(e) { }
try { o3 = document.createElement('area') } catch(e) { }
try { o4 = document.createElement('script'); } catch(e) { }
try { o5 = document.getSelection() } catch(e) { }
try { document.implementation.createDocument('', '', null).adoptNode(o1); } catch(e) { }
try { o1.appendChild(o3) } catch(e) { }
try { o5.addRange(new Range()); } catch(e) { }
try { document.documentElement.appendChild(o4) } catch(e) { }
try { o4.textContent = 'XX' } catch(e) { }
try { o7 = o4.firstChild } catch(e) { }
try { o4.parentNode.insertBefore(o7, o4); } catch(e) { }
try { o5.modify('extend', 'forward', 'line') } catch(e) { }
try { o5.selectAllChildren(o3) } catch(e) { }
try { o7.splitText(1) } catch(e) { }
</script>

View File

@ -0,0 +1,17 @@
<html>
<head>
<script>
try { o1 = document.createElement('caption') } catch(e) { }
try { o2 = document.createElement('select') } catch(e) { }
try { o3 = document.createElement('map') } catch(e) { }
try { o4 = window.getSelection() } catch(e) { }
try { document.documentElement.appendChild(o1) } catch(e) { }
try { o1.style.display = 'contents' } catch(e) { }
try { document.prepend(o2, document) } catch(e) { }
try { document.designMode = 'on'; } catch(e) { }
try { o3.ownerDocument.execCommand('outdent', false, null) } catch(e) { }
try { document.designMode = 'off'; } catch(e) { }
try { o4.extend(o2, 0) } catch(e) { }
</script>
</head>
</html>

View File

@ -0,0 +1,10 @@
<script>
window.onload=function(){
window.getSelection().addRange(document.createRange());
document.getElementById('a').appendChild(document.createElement('option'));
window.getSelection().modify('extend','backward','lineboundary');
}
</script>
<div></div>
<textarea autofocus='true'></textarea>
<del id='a'>

View File

@ -80,8 +80,12 @@ load 1364133.html
load 1366176.html
load 1375131.html
load 1381541.html
load 1383747.html
load 1383755.html
load 1383763.html
load 1384161.html
load 1388075.html
load 1393171.html
load 1402469.html
load 1402904.html
load 1405747.html

View File

@ -520,6 +520,9 @@ 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);
/* 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))
{
@ -528,7 +531,6 @@ retry:
}
/* Not found. */
hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props,
user_features, num_user_features,
coords, num_coords,

View File

@ -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);

View File

@ -41,10 +41,18 @@ ShmSegmentsWriter::Write(Range<uint8_t> 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<uint8_t> 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<uint8_t> 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<uint8_t> 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<uint8_t> 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<uint8_t> 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<uint8_t> aBytes, uint32_t aIndex)
{
auto bytes = mWriter.Write(aBytes);
if (!bytes.length()) {
return false;
}
mUpdates.AppendElement(layers::OpAddRawFont(bytes, aIndex, aKey));
return true;
}
void

View File

@ -34,7 +34,7 @@ public:
void Clear();
protected:
void AllocChunk();
bool AllocChunk();
layers::OffsetRange AllocLargeChunk(size_t aSize);
nsTArray<ipc::Shmem> 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<uint8_t> aBytes);
void AddBlobImage(wr::ImageKey aKey,
bool AddBlobImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
void AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey aKey);
void UpdateImageBuffer(wr::ImageKey aKey,
bool UpdateImageBuffer(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
void UpdateBlobImage(wr::ImageKey aKey,
bool UpdateBlobImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
@ -93,7 +93,7 @@ public:
void DeleteImage(wr::ImageKey aKey);
void AddRawFont(wr::FontKey aKey, Range<uint8_t> aBytes, uint32_t aIndex);
bool AddRawFont(wr::FontKey aKey, Range<uint8_t> aBytes, uint32_t aIndex);
void DeleteFont(wr::FontKey aKey);

View File

@ -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()
{

View File

@ -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();

View File

@ -614,6 +614,48 @@ WebRenderBridgeParent::RecvSetDisplayListSync(const gfx::IntSize &aSize,
aIdNamespace, aTxnStartTime, aFwdTime);
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvEmptyTransaction(const FocusTarget& aFocusTarget,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& 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)
{

View File

@ -106,6 +106,14 @@ public:
const wr::IdNamespace& aIdNamespace,
const TimeStamp& aTxnStartTime,
const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvEmptyTransaction(const FocusTarget& aFocusTarget,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& 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<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture) override;

View File

@ -31,6 +31,23 @@ 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<WebRenderCanvasData> canvasData = iter.Get()->GetKey();
WebRenderCanvasRendererAsync* canvas = canvasData->GetCanvasRenderer();
canvas->UpdateCompositableClient();
}
}
bool
WebRenderCommandBuilder::NeedsEmptyTransaction()
{
return !mLastCanvasDatas.IsEmpty();
}
void
WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResourceUpdates,
@ -499,7 +516,9 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
Range<uint8_t> 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();

View File

@ -40,6 +40,10 @@ public:
void Destroy();
void EmptyTransaction();
bool NeedsEmptyTransaction();
void BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResourceUpdates,
nsDisplayList* aDisplayList,

View File

@ -178,21 +178,38 @@ WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
// "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.
// 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);
// 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<WebRenderCanvasData> canvasData = iter.Get()->GetKey();
// WebRenderCanvasRendererAsync* canvas = canvasData->GetCanvasRenderer();
// canvas->UpdateCompositableClient();
//}
if (!(aFlags & EndTransactionFlags::END_NO_COMPOSITE)) {
ScheduleComposite();
return true;
}
LayoutDeviceIntSize size = mWidget->GetClientSize();
WrBridge()->BeginTransaction();
mWebRenderCommandBuilder.EmptyTransaction();
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;
}

View File

@ -0,0 +1,20 @@
<html>
<head>
<style>
body {
mask: url(#mymask);
}
div::after {
content: counter(n);
}
</style>
<script>
window.onload = function(){
document.getElementsByTagName('body')[0].animate(
[{"transform": "skewy(11rad)"},
{"transform": "rotatex(0.125turn)"}],
{"fill":"forwards", "iterations": 0.75, "duration": 1});
};
</script></head>
<body><div></div></body>
</html>

View File

@ -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

View File

@ -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<const hb_variation_t*>(vars.Elements());
hb_font_set_variations(mHBFont, hbVars, len);
}
return true;
}

View File

@ -34,6 +34,7 @@ namespace gc {
typedef Vector<ZoneGroup*, 4, SystemAllocPolicy> ZoneGroupVector;
using BlackGrayEdgeVector = Vector<TenuredCell*, 0, SystemAllocPolicy>;
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<bool> fullCompartmentChecks;
ActiveThreadData<uint32_t> gcBeginCallbackDepth;
Callback<JSGCCallback> gcCallback;
Callback<JS::DoCycleCollectionCallback> gcDoCycleCollectionCallback;
Callback<JSObjectsTenuredCallback> tenuredCallback;

View File

@ -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)

View File

@ -695,6 +695,7 @@ struct Zone : public JS::shadow::Zone,
js::ZoneGroupData<js::jit::JitZone*> jitZone_;
js::ActiveThreadData<bool> gcScheduled_;
js::ActiveThreadData<bool> gcScheduledSaved_;
js::ZoneGroupData<bool> gcPreserveCode_;
js::ZoneGroupData<bool> keepShapeTables_;

View File

@ -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();

View File

@ -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();

View File

@ -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*

View File

@ -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);

View File

@ -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

View File

@ -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());

View File

@ -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

View File

@ -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; }

View File

@ -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
{

View File

@ -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.
*

View File

@ -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;
}

View File

@ -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.

View File

@ -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);

View File

@ -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<nsPrintObject>& 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;

View File

@ -2111,7 +2111,7 @@ pref("network.dir.format", 2);
// <link rel="prefetch"> URLs).
pref("network.prefetch-next", true);
// enables the preloading (i.e., preloading of <link rel="preload"> URLs).
pref("network.preload", true);
pref("network.preload", false);
// enables the predictive service
pref("network.predictor.enabled", true);

View File

@ -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);
};

View File

@ -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);
/**

View File

@ -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);

View File

@ -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

View File

@ -8,7 +8,7 @@
/*****************************************************************************/
#include <stdint.h>
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

View File

@ -1 +1 @@
6fb9c5396d52
f3766809817b

View File

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

View File

@ -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<Pkcs11EcdsaTestParams> {
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());

View File

@ -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 &params_; }
SECOidTag hashOID() { return SEC_OID_SHA1; }
const SECItem* parameters() const { return &params_; }
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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<Pkcs11SignatureTestParams> {};
// RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(1),
// RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(2),
// RSA-PSS test vectors, pss-vect.txt, Example 3.1: A 1026-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(3),
// RSA-PSS test vectors, pss-vect.txt, Example 4.1: A 1027-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(4),
// RSA-PSS test vectors, pss-vect.txt, Example 5.1: A 1028-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(5),
// RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(6),
// RSA-PSS test vectors, pss-vect.txt, Example 7.1: A 1030-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(7),
// RSA-PSS test vectors, pss-vect.txt, Example 8.1: A 1031-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(8),
// RSA-PSS test vectors, pss-vect.txt, Example 9.1: A 1536-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(9),
// RSA-PSS test vectors, pss-vect.txt, Example 10.1: A 2048-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
VECTOR_N(10)};
// RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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
// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
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

View File

@ -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<unsigned int>(pkcs8_len)};
SECItem pkcs8Item = {siBuffer, toUcharPtr(pkcs8.data()),
static_cast<unsigned int>(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<unsigned int>(spki_len)};
ScopedSECKEYPublicKey ImportPublicKey(const DataBuffer& spki) {
SECItem spkiItem = {siBuffer, toUcharPtr(spki.data()),
static_cast<unsigned int>(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;
bool ComputeHash(const DataBuffer& data, DataBuffer* hash) {
hash->Allocate(static_cast<size_t>(HASH_ResultLenByOidTag(hash_oid_)));
SECStatus rv =
PK11_HashBuf(hash_oid_, hash->data(), data.data(), data.len());
return rv == SECSuccess;
}
SECStatus rv = PK11_HashBuf(hashOID(), hash->data, data, len);
if (rv != SECSuccess) {
return nullptr;
bool SignHashedData(ScopedSECKEYPrivateKey& privKey, const DataBuffer& hash,
DataBuffer* sig) {
SECItem hashItem = {siBuffer, toUcharPtr(hash.data()),
static_cast<unsigned int>(hash.len())};
int sigLen = PK11_SignatureLen(privKey.get());
EXPECT_LT(0, sigLen);
sig->Allocate(static_cast<size_t>(sigLen));
SECItem sigItem = {siBuffer, toUcharPtr(sig->data()),
static_cast<unsigned int>(sig->len())};
SECStatus rv = PK11_SignWithMechanism(privKey.get(), mechanism_,
parameters(), &sigItem, &hashItem);
return rv == SECSuccess;
}
return hash;
}
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;
}
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 SignHashedData(privKey, hash, sig);
}
return ScopedSECItem(SignHashedData(privKey, hash));
}
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<unsigned int>(sig_len)};
DataBuffer hash;
ASSERT_TRUE(ComputeHash(params.data_, &hash));
// Verify.
SECItem hashItem = {siBuffer, toUcharPtr(hash.data()),
static_cast<unsigned int>(hash.len())};
SECItem sigItem = {siBuffer, toUcharPtr(sig.data()),
static_cast<unsigned int>(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

View File

@ -1,5 +1,7 @@
#include <cstdlib>
#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<PasswordPair> {};
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) {

View File

@ -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;
}

View File

@ -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,

View File

@ -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,

View File

@ -38,10 +38,6 @@ const std::vector<std::wstring> 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",

View File

@ -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;

View File

@ -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})

View File

@ -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);

View File

@ -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<MessageHandler>} 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);
}
},

View File

@ -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();
});

View File

@ -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);

View File

@ -535,7 +535,7 @@ static void GetDefaultPrinterNameFromGlobalPrinters(nsAString &printerName)
{
nsCOMPtr<nsIPrinterEnumerator> 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<nsIPrintSettingsWin> 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);

View File

@ -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

View File

@ -62,7 +62,7 @@ nsDeviceContextSpecAndroid::EndDocument()
{
nsString targetPath;
nsCOMPtr<nsIFile> destFile;
mPrintSettings->GetToFileName(getter_Copies(targetPath));
mPrintSettings->GetToFileName(targetPath);
nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -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"));
}
};

View File

@ -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

View File

@ -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;

View File

@ -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];

View File

@ -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<nsIFile> 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();

View File

@ -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<nsIPrintSettingsService> 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);
}

View File

@ -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<nsIFile> 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);

View File

@ -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;

View File

@ -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 */

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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<nsIPrinterEnumerator> 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 _

View File

@ -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);
}
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);
}
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);
}
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);
}
return NS_OK;
}

View File

@ -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

View File

@ -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<nsIPrintSettingsWin> 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<nsIPrintSettingsWin> 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<PrintTarget> nsDeviceContextSpecWin::MakePrintTarget()
{
@ -266,7 +229,7 @@ already_AddRefed<PrintTarget> 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<SkFILEWStream>(printFile.get());
@ -311,7 +274,7 @@ already_AddRefed<PrintTarget> 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<PrintTarget> 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()));
}
//----------------------------------------------------------------------------------

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