Merge mozilla-central to autoland a=merge on a CLOSED TREE

--HG--
rename : third_party/rust/core-foundation/.cargo-checksum.json => third_party/rust/core-foundation-0.5.1/.cargo-checksum.json
rename : third_party/rust/core-foundation/Cargo.toml => third_party/rust/core-foundation-0.5.1/Cargo.toml
rename : third_party/rust/core-foundation/src/array.rs => third_party/rust/core-foundation-0.5.1/src/array.rs
rename : third_party/rust/core-foundation/src/base.rs => third_party/rust/core-foundation-0.5.1/src/base.rs
rename : third_party/rust/core-foundation/src/bundle.rs => third_party/rust/core-foundation-0.5.1/src/bundle.rs
rename : third_party/rust/core-foundation/src/dictionary.rs => third_party/rust/core-foundation-0.5.1/src/dictionary.rs
rename : third_party/rust/core-foundation/src/filedescriptor.rs => third_party/rust/core-foundation-0.5.1/src/filedescriptor.rs
rename : third_party/rust/core-foundation/src/lib.rs => third_party/rust/core-foundation-0.5.1/src/lib.rs
rename : third_party/rust/core-foundation/src/propertylist.rs => third_party/rust/core-foundation-0.5.1/src/propertylist.rs
rename : third_party/rust/core-foundation/src/runloop.rs => third_party/rust/core-foundation-0.5.1/src/runloop.rs
rename : third_party/rust/core-foundation/src/set.rs => third_party/rust/core-foundation-0.5.1/src/set.rs
rename : third_party/rust/core-foundation/tests/use_macro_outside_crate.rs => third_party/rust/core-foundation-0.5.1/tests/use_macro_outside_crate.rs
rename : third_party/rust/core-foundation-sys/.cargo-checksum.json => third_party/rust/core-foundation-sys-0.5.1/.cargo-checksum.json
rename : third_party/rust/core-foundation-sys/Cargo.toml => third_party/rust/core-foundation-sys-0.5.1/Cargo.toml
rename : third_party/rust/core-foundation-sys/src/array.rs => third_party/rust/core-foundation-sys-0.5.1/src/array.rs
rename : third_party/rust/core-foundation-sys/src/base.rs => third_party/rust/core-foundation-sys-0.5.1/src/base.rs
rename : third_party/rust/core-foundation-sys/src/bundle.rs => third_party/rust/core-foundation-sys-0.5.1/src/bundle.rs
rename : third_party/rust/core-foundation-sys/src/data.rs => third_party/rust/core-foundation-sys-0.5.1/src/data.rs
rename : third_party/rust/core-foundation-sys/src/date.rs => third_party/rust/core-foundation-sys-0.5.1/src/date.rs
rename : third_party/rust/core-foundation-sys/src/dictionary.rs => third_party/rust/core-foundation-sys-0.5.1/src/dictionary.rs
rename : third_party/rust/core-foundation-sys/src/error.rs => third_party/rust/core-foundation-sys-0.5.1/src/error.rs
rename : third_party/rust/core-foundation-sys/src/filedescriptor.rs => third_party/rust/core-foundation-sys-0.5.1/src/filedescriptor.rs
rename : third_party/rust/core-foundation-sys/src/lib.rs => third_party/rust/core-foundation-sys-0.5.1/src/lib.rs
rename : third_party/rust/core-foundation-sys/src/messageport.rs => third_party/rust/core-foundation-sys-0.5.1/src/messageport.rs
rename : third_party/rust/core-foundation-sys/src/number.rs => third_party/rust/core-foundation-sys-0.5.1/src/number.rs
rename : third_party/rust/core-foundation-sys/src/propertylist.rs => third_party/rust/core-foundation-sys-0.5.1/src/propertylist.rs
rename : third_party/rust/core-foundation-sys/src/runloop.rs => third_party/rust/core-foundation-sys-0.5.1/src/runloop.rs
rename : third_party/rust/core-foundation-sys/src/set.rs => third_party/rust/core-foundation-sys-0.5.1/src/set.rs
rename : third_party/rust/core-foundation-sys/src/string.rs => third_party/rust/core-foundation-sys-0.5.1/src/string.rs
rename : third_party/rust/core-foundation-sys/src/timezone.rs => third_party/rust/core-foundation-sys-0.5.1/src/timezone.rs
rename : third_party/rust/core-foundation-sys/src/url.rs => third_party/rust/core-foundation-sys-0.5.1/src/url.rs
rename : third_party/rust/core-foundation-sys/src/uuid.rs => third_party/rust/core-foundation-sys-0.5.1/src/uuid.rs
rename : toolkit/mozapps/extensions/internal/UpdateRDFConverter.jsm => toolkit/mozapps/extensions/internal/RDFManifestConverter.jsm
extra : rebase_source : 82ff5278cf9bd559763cc24e3f6d87139466bfe5
This commit is contained in:
Coroiu Cristina 2018-05-08 18:54:28 +03:00
Родитель f1f60ea6e5 5ff2d76830
Коммит f39a811db2
504 изменённых файлов: 9524 добавлений и 18020 удалений

19
Cargo.lock сгенерированный
Просмотреть файл

@ -338,6 +338,15 @@ dependencies = [
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation-sys"
version = "0.5.1"
@ -346,6 +355,11 @@ dependencies = [
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "core-graphics"
version = "0.13.0"
@ -2125,7 +2139,8 @@ version = "0.1.0"
dependencies = [
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2489,7 +2504,9 @@ dependencies = [
"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
"checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb"
"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980"
"checksum core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7caa6cb9e76ddddbea09a03266d6b3bc98cd41e9fb9b017c473e7cca593ec25"
"checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa"
"checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a"
"checksum core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb0ed45fdc32f9ab426238fba9407dfead7bacd7900c9b4dd3f396f46eafdae3"
"checksum core-text 9.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bd581c37283d0c23311d179aefbb891f2324ee0405da58a26e8594ab76e5748"
"checksum cose 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72fa26cb151d3ae4b70f63d67d0fed57ce04220feafafbae7f503bef7aae590d"

Просмотреть файл

@ -239,7 +239,7 @@ void
FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
Accessible* aTarget)
{
NS_PRECONDITION(aDocument, "No document for focused accessible!");
MOZ_ASSERT(aDocument, "No document for focused accessible!");
if (aDocument) {
RefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
@ -292,8 +292,8 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
void
FocusManager::ProcessFocusEvent(AccEvent* aEvent)
{
NS_PRECONDITION(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS,
"Focus event is expected!");
MOZ_ASSERT(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS,
"Focus event is expected!");
// Emit focus event if event target is the active item. Otherwise then check
// if it's still focused and then update active item and emit focus event.

Просмотреть файл

@ -37,13 +37,13 @@ TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
// 3. Offset accessible and result hyper text offsets must not be specified
// but include default text attributes flag and attributes list must be
// specified in the case of default text attributes.
NS_PRECONDITION(mHyperTextAcc &&
((mOffsetAcc && mOffsetAccIdx != -1 &&
aStartOffset && aEndOffset) ||
(!mOffsetAcc && mOffsetAccIdx == -1 &&
!aStartOffset && !aEndOffset &&
mIncludeDefAttrs && aAttributes)),
"Wrong usage of TextAttrsMgr!");
MOZ_ASSERT(mHyperTextAcc &&
((mOffsetAcc && mOffsetAccIdx != -1 &&
aStartOffset && aEndOffset) ||
(!mOffsetAcc && mOffsetAccIdx == -1 &&
!aStartOffset && !aEndOffset &&
mIncludeDefAttrs && aAttributes)),
"Wrong usage of TextAttrsMgr!");
// Embedded objects are combined into own range with empty attributes set.
if (mOffsetAcc && !mOffsetAcc->IsText()) {

Просмотреть файл

@ -2356,7 +2356,7 @@ Accessible::IsLink() const
uint32_t
Accessible::StartOffset()
{
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
MOZ_ASSERT(IsLink(), "StartOffset is called not on hyper link!");
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
return hyperText ? hyperText->GetChildOffset(this) : 0;
@ -2365,7 +2365,7 @@ Accessible::StartOffset()
uint32_t
Accessible::EndOffset()
{
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
MOZ_ASSERT(IsLink(), "EndOffset is called on not hyper link!");
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
@ -2374,21 +2374,21 @@ Accessible::EndOffset()
uint32_t
Accessible::AnchorCount()
{
NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
MOZ_ASSERT(IsLink(), "AnchorCount is called on not hyper link!");
return 1;
}
Accessible*
Accessible::AnchorAt(uint32_t aAnchorIndex)
{
NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
MOZ_ASSERT(IsLink(), "GetAnchor is called on not hyper link!");
return aAnchorIndex == 0 ? this : nullptr;
}
already_AddRefed<nsIURI>
Accessible::AnchorURIAt(uint32_t aAnchorIndex)
{
NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
MOZ_ASSERT(IsLink(), "AnchorURIAt is called on not hyper link!");
return nullptr;
}

Просмотреть файл

@ -743,7 +743,7 @@ public:
*/
inline bool IsLinkValid()
{
NS_PRECONDITION(IsLink(), "IsLinkValid is called on not hyper link!");
MOZ_ASSERT(IsLink(), "IsLinkValid is called on not hyper link!");
// XXX In order to implement this we would need to follow every link
// Perhaps we can get information about invalid links from the cache

Просмотреть файл

@ -17,7 +17,7 @@ using namespace mozilla::a11y;
inline bool
ToNSRange(id aValue, NSRange* aRange)
{
NS_PRECONDITION(aRange, "aRange is nil");
MOZ_ASSERT(aRange, "aRange is nil");
if ([aValue isKindOfClass:[NSValue class]] &&
strcmp([(NSValue*)aValue objCType], @encode(NSRange)) == 0) {
@ -547,7 +547,7 @@ ToNSString(id aValue)
- (NSString*)stringFromRange:(NSRange*)range
{
NS_PRECONDITION(range, "no range");
MOZ_ASSERT(range, "no range");
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];

Просмотреть файл

@ -19,7 +19,7 @@ xpcAccessibleSelectable::GetSelectedItems(nsIArray** aSelectedItems)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
AutoTArray<Accessible*, 10> items;
Intl()->SelectedItems(&items);
@ -48,7 +48,7 @@ xpcAccessibleSelectable::GetSelectedItemCount(uint32_t* aSelectionCount)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aSelectionCount = Intl()->SelectedItemCount();
return NS_OK;
@ -63,7 +63,7 @@ xpcAccessibleSelectable::GetSelectedItemAt(uint32_t aIndex,
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aSelected = ToXPC(Intl()->GetSelectedItem(aIndex));
if (*aSelected) {
@ -82,7 +82,7 @@ xpcAccessibleSelectable::IsItemSelected(uint32_t aIndex, bool* aIsSelected)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aIsSelected = Intl()->IsItemSelected(aIndex);
return NS_OK;
@ -93,7 +93,7 @@ xpcAccessibleSelectable::AddItemToSelection(uint32_t aIndex)
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
return Intl()->AddItemToSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
}
@ -103,7 +103,7 @@ xpcAccessibleSelectable::RemoveItemFromSelection(uint32_t aIndex)
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
return Intl()->RemoveItemFromSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
}
@ -116,7 +116,7 @@ xpcAccessibleSelectable::SelectAll(bool* aIsMultiSelect)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aIsMultiSelect = Intl()->SelectAll();
return NS_OK;
@ -127,7 +127,7 @@ xpcAccessibleSelectable::UnselectAll()
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
Intl()->UnselectAll();
return NS_OK;

Просмотреть файл

@ -371,7 +371,7 @@ XULTreeGridRowAccessible::ChildCount() const
XULTreeGridCellAccessible*
XULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn) const
{
NS_PRECONDITION(aColumn, "No tree column!");
MOZ_ASSERT(aColumn, "No tree column!");
void* key = static_cast<void*>(aColumn);
XULTreeGridCellAccessible* cachedCell = mAccessibleCache.GetWeak(key);

Просмотреть файл

@ -20,7 +20,6 @@
#include "nsIEHistoryEnumerator.h"
#endif
#include "rdf.h"
#include "nsFeedSniffer.h"
#include "AboutRedirector.h"
#include "nsIAboutModule.h"

Просмотреть файл

@ -330,7 +330,7 @@ ContentPrincipal::MayLoadInternal(nsIURI* aURI)
NS_IMETHODIMP
ContentPrincipal::GetHashValue(uint32_t* aValue)
{
NS_PRECONDITION(mCodebase, "Need a codebase");
MOZ_ASSERT(mCodebase, "Need a codebase");
*aValue = nsScriptSecurityManager::HashPrincipalByOrigin(this);
return NS_OK;

Просмотреть файл

@ -28,7 +28,7 @@ NS_IMETHODIMP_(MozExternalRefCountType)
nsJSPrincipals::AddRef()
{
MOZ_ASSERT(NS_IsMainThread());
NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt");
MOZ_ASSERT(int32_t(refcount) >= 0, "illegal refcnt");
nsrefcnt count = ++refcount;
NS_LOG_ADDREF(this, count, "nsJSPrincipals", sizeof(*this));
return count;
@ -38,7 +38,7 @@ NS_IMETHODIMP_(MozExternalRefCountType)
nsJSPrincipals::Release()
{
MOZ_ASSERT(NS_IsMainThread());
NS_PRECONDITION(0 != refcount, "dup release");
MOZ_ASSERT(0 != refcount, "dup release");
nsrefcnt count = --refcount;
NS_LOG_RELEASE(this, count, "nsJSPrincipals");
if (count == 0) {

Просмотреть файл

@ -77,10 +77,76 @@ using namespace mozilla;
using namespace mozilla::dom;
nsIIOService *nsScriptSecurityManager::sIOService = nullptr;
nsIStringBundle *nsScriptSecurityManager::sStrBundle = nullptr;
JSContext *nsScriptSecurityManager::sContext = nullptr;
bool nsScriptSecurityManager::sStrictFileOriginPolicy = true;
namespace {
class BundleHelper
{
public:
NS_INLINE_DECL_REFCOUNTING(BundleHelper)
static nsIStringBundle*
GetOrCreate()
{
MOZ_ASSERT(!sShutdown);
// Already shutting down. Nothing should require the use of the string
// bundle when shutting down.
if (sShutdown) {
return nullptr;
}
if (!sSelf) {
sSelf = new BundleHelper();
}
return sSelf->GetOrCreateInternal();
}
static void
Shutdown()
{
sSelf = nullptr;
sShutdown = true;
}
private:
~BundleHelper() = default;
nsIStringBundle*
GetOrCreateInternal()
{
if (!mBundle) {
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
if (NS_WARN_IF(!bundleService)) {
return nullptr;
}
nsresult rv =
bundleService->CreateBundle("chrome://global/locale/security/caps.properties",
getter_AddRefs(mBundle));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
}
return mBundle;
}
nsCOMPtr<nsIStringBundle> mBundle;
static StaticRefPtr<BundleHelper> sSelf;
static bool sShutdown;
};
StaticRefPtr<BundleHelper> BundleHelper::sSelf;
bool BundleHelper::sShutdown = false;
} // anonymous
///////////////////////////
// Convenience Functions //
///////////////////////////
@ -260,7 +326,8 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
nsIPrincipal** aPrincipal,
bool aIgnoreSandboxing)
{
NS_PRECONDITION(aChannel, "Must have channel!");
MOZ_ASSERT(aChannel, "Must have channel!");
// Check whether we have an nsILoadInfo that says what we should do.
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (loadInfo && loadInfo->GetForceInheritPrincipalOverruleOwner()) {
@ -349,7 +416,7 @@ NS_IMETHODIMP
nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
nsIPrincipal** aPrincipal)
{
NS_PRECONDITION(aChannel, "Must have channel!");
MOZ_ASSERT(aChannel, "Must have channel!");
// Get the principal from the URI. Make sure this does the same thing
// as nsDocument::Reset and XULDocument::StartDocumentLoad.
@ -517,7 +584,7 @@ nsScriptSecurityManager::CheckLoadURIFromScript(JSContext *cx, nsIURI *aURI)
static nsresult
DenyAccessIfURIHasFlags(nsIURI* aURI, uint32_t aURIFlags)
{
NS_PRECONDITION(aURI, "Must have URI!");
MOZ_ASSERT(aURI, "Must have URI!");
bool uriHasFlags;
nsresult rv =
@ -565,7 +632,8 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
nsIURI *aTargetURI,
uint32_t aFlags)
{
NS_PRECONDITION(aPrincipal, "CheckLoadURIWithPrincipal must have a principal");
MOZ_ASSERT(aPrincipal, "CheckLoadURIWithPrincipal must have a principal");
// If someone passes a flag that we don't understand, we should
// fail, because they may need a security check that we don't
// provide.
@ -979,20 +1047,22 @@ nsScriptSecurityManager::CheckLoadURIFlags(nsIURI *aSourceURI,
&hasSubsumersFlag);
NS_ENSURE_SUCCESS(rv, rv);
if (!hasFlags && !hasSubsumersFlag) {
nsAutoString message;
NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
const char16_t* formatStrings[] = { ucsTargetScheme.get() };
rv = sStrBundle->
FormatStringFromName("ProtocolFlagError",
formatStrings,
ArrayLength(formatStrings),
message);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIConsoleService> console(
do_GetService("@mozilla.org/consoleservice;1"));
NS_ENSURE_TRUE(console, NS_ERROR_FAILURE);
nsCOMPtr<nsIStringBundle> bundle = BundleHelper::GetOrCreate();
if (bundle) {
nsAutoString message;
NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
const char16_t* formatStrings[] = { ucsTargetScheme.get() };
rv = bundle->FormatStringFromName("ProtocolFlagError",
formatStrings,
ArrayLength(formatStrings),
message);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIConsoleService> console(
do_GetService("@mozilla.org/consoleservice;1"));
NS_ENSURE_TRUE(console, NS_ERROR_FAILURE);
console->LogStringMessage(message.get());
console->LogStringMessage(message.get());
}
}
}
@ -1016,15 +1086,20 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const char* aMessageTag,
rv = aTarget->GetAsciiSpec(targetSpec);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> bundle = BundleHelper::GetOrCreate();
if (NS_WARN_IF(!bundle)) {
return NS_OK;
}
// Localize the error message
nsAutoString message;
NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec);
NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec);
const char16_t *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() };
rv = sStrBundle->FormatStringFromName(aMessageTag,
formatStrings,
ArrayLength(formatStrings),
message);
rv = bundle->FormatStringFromName(aMessageTag,
formatStrings,
ArrayLength(formatStrings),
message);
NS_ENSURE_SUCCESS(rv, rv);
// If a JS context was passed in, set a JS exception.
@ -1235,22 +1310,28 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
if (classInfoNameUTF8.IsEmpty()) {
classInfoNameUTF8.AssignLiteral("UnnamedClass");
}
nsCOMPtr<nsIStringBundle> bundle = BundleHelper::GetOrCreate();
if (NS_WARN_IF(!bundle)) {
return NS_OK;
}
NS_ConvertUTF8toUTF16 classInfoUTF16(classInfoNameUTF8);
nsresult rv;
nsAutoString errorMsg;
if (originUTF16.IsEmpty()) {
const char16_t* formatStrings[] = { classInfoUTF16.get() };
rv = sStrBundle->FormatStringFromName("CreateWrapperDenied",
formatStrings,
1,
errorMsg);
rv = bundle->FormatStringFromName("CreateWrapperDenied",
formatStrings,
1,
errorMsg);
} else {
const char16_t* formatStrings[] = { classInfoUTF16.get(),
originUTF16.get() };
rv = sStrBundle->FormatStringFromName("CreateWrapperDeniedForOrigin",
formatStrings,
2,
errorMsg);
rv = bundle->FormatStringFromName("CreateWrapperDeniedForOrigin",
formatStrings,
2,
errorMsg);
}
NS_ENSURE_SUCCESS(rv, rv);
@ -1334,14 +1415,6 @@ nsresult nsScriptSecurityManager::Init()
InitPrefs();
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
if (!bundleService)
return NS_ERROR_FAILURE;
rv = bundleService->CreateBundle("chrome://global/locale/security/caps.properties", &sStrBundle);
NS_ENSURE_SUCCESS(rv, rv);
// Create our system principal singleton
RefPtr<SystemPrincipal> system = SystemPrincipal::Create();
@ -1390,7 +1463,7 @@ nsScriptSecurityManager::Shutdown()
}
NS_IF_RELEASE(sIOService);
NS_IF_RELEASE(sStrBundle);
BundleHelper::Shutdown();
}
nsScriptSecurityManager *

Просмотреть файл

@ -113,7 +113,7 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aLoadInfo);
NS_PRECONDITION(aResult, "Null out param");
MOZ_ASSERT(aResult, "Null out param");
#ifdef DEBUG
// Check that the uri we got is already canonified

Просмотреть файл

@ -261,7 +261,7 @@ nsDSURIContentListener::CanHandleContent(const char* aContentType,
char** aDesiredContentType,
bool* aCanHandleContent)
{
NS_PRECONDITION(aCanHandleContent, "Null out param?");
MOZ_ASSERT(aCanHandleContent, "Null out param?");
NS_ENSURE_ARG_POINTER(aDesiredContentType);
*aCanHandleContent = false;

Просмотреть файл

@ -537,7 +537,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
NS_IMETHODIMP
nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
{
NS_PRECONDITION(aSink, "null out param");
MOZ_ASSERT(aSink, "null out param");
*aSink = nullptr;
@ -668,9 +668,9 @@ nsDocShell::LoadURI(nsIURI* aURI,
uint32_t aLoadFlags,
bool aFirstParty)
{
NS_PRECONDITION(aLoadInfo || (aLoadFlags & EXTRA_LOAD_FLAGS) == 0,
"Unexpected flags");
NS_PRECONDITION((aLoadFlags & 0xf) == 0, "Should not have these flags set");
MOZ_ASSERT(aLoadInfo || (aLoadFlags & EXTRA_LOAD_FLAGS) == 0,
"Unexpected flags");
MOZ_ASSERT((aLoadFlags & 0xf) == 0, "Should not have these flags set");
// Note: we allow loads to get through here even if mFiredUnloadEvent is
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
@ -3127,7 +3127,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsIDocShellTreeItem* aAccessingItem,
bool aConsiderOpener)
{
NS_PRECONDITION(aTargetItem, "Must have target item!");
MOZ_ASSERT(aTargetItem, "Must have target item!");
if (!gValidateOrigin || !aAccessingItem) {
// Good to go
@ -5291,7 +5291,7 @@ nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType)
NS_IMETHODIMP
nsDocShell::GetCurrentDescriptor(nsISupports** aPageDescriptor)
{
NS_PRECONDITION(aPageDescriptor, "Null out param?");
MOZ_ASSERT(aPageDescriptor, "Null out param?");
*aPageDescriptor = nullptr;
@ -6345,7 +6345,7 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
bool aMetaRefresh,
nsITimer* aTimer)
{
NS_PRECONDITION(aTimer, "Must have a timer here");
MOZ_ASSERT(aTimer, "Must have a timer here");
// Remove aTimer from mRefreshURIList if needed
if (mRefreshURIList) {
@ -9758,8 +9758,8 @@ nsDocShell::InternalLoad(nsIURI* aURI,
if (mFiredUnloadEvent) {
if (IsOKToLoadURI(aURI)) {
NS_PRECONDITION(aWindowTarget.IsEmpty(),
"Shouldn't have a window target here!");
MOZ_ASSERT(aWindowTarget.IsEmpty(),
"Shouldn't have a window target here!");
// If this is a replace load, make whatever load triggered
// the unload event also a replace load, so we don't
@ -11340,8 +11340,8 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
uint32_t aLoadType, bool aFireOnLocationChange,
bool aAddToGlobalHistory, bool aCloneSHChildren)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(aURI, "uri is null");
MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(!aPrincipalToInherit || (aPrincipalToInherit && aTriggeringPrincipal));
@ -11992,8 +11992,8 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
bool aCloneChildren,
nsISHEntry** aNewEntry)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(aURI, "uri is null");
MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
#if defined(DEBUG)
if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
@ -13153,7 +13153,7 @@ nsDocShell::GetIsContent(bool* aIsContent)
bool
nsDocShell::IsOKToLoadURI(nsIURI* aURI)
{
NS_PRECONDITION(aURI, "Must have a URI!");
MOZ_ASSERT(aURI, "Must have a URI!");
if (!mFiredUnloadEvent) {
return true;

Просмотреть файл

@ -31,7 +31,7 @@ nsWebNavigationInfo::IsTypeSupported(const nsACString& aType,
nsIWebNavigation* aWebNav,
uint32_t* aIsTypeSupported)
{
NS_PRECONDITION(aIsTypeSupported, "null out param?");
MOZ_ASSERT(aIsTypeSupported, "null out param?");
// Note to self: aWebNav could be an nsWebBrowser or an nsDocShell here (or
// an nsSHistory, but not much we can do with that). So if we start using
@ -94,7 +94,7 @@ nsresult
nsWebNavigationInfo::IsTypeSupportedInternal(const nsCString& aType,
uint32_t* aIsSupported)
{
NS_PRECONDITION(aIsSupported, "Null out param?");
MOZ_ASSERT(aIsSupported, "Null out param?");
nsContentUtils::ContentViewerType vtype = nsContentUtils::TYPE_UNSUPPORTED;

Просмотреть файл

@ -53,7 +53,7 @@ static bool gInitialized = false;
static nsresult
Initialize()
{
NS_PRECONDITION(!gInitialized, "docshell module already initialized");
MOZ_ASSERT(!gInitialized, "docshell module already initialized");
if (gInitialized) {
return NS_OK;
}

Просмотреть файл

@ -139,8 +139,8 @@ nsSHEntryShared::DropPresentationState()
nsresult
nsSHEntryShared::SetContentViewer(nsIContentViewer* aViewer)
{
NS_PRECONDITION(!aViewer || !mContentViewer,
"SHEntryShared already contains viewer");
MOZ_ASSERT(!aViewer || !mContentViewer,
"SHEntryShared already contains viewer");
if (mContentViewer || !aViewer) {
DropPresentationState();

Просмотреть файл

@ -689,7 +689,7 @@ nsSHistory::GetCount(int32_t* aResult)
NS_IMETHODIMP
nsSHistory::GetIndex(int32_t* aResult)
{
NS_PRECONDITION(aResult, "null out param?");
MOZ_ASSERT(aResult, "null out param?");
*aResult = mIndex;
return NS_OK;
}
@ -698,7 +698,7 @@ nsSHistory::GetIndex(int32_t* aResult)
NS_IMETHODIMP
nsSHistory::GetRequestedIndex(int32_t* aResult)
{
NS_PRECONDITION(aResult, "null out param?");
MOZ_ASSERT(aResult, "null out param?");
*aResult = mRequestedIndex;
return NS_OK;
}

Просмотреть файл

@ -66,8 +66,8 @@ CharacterData::CharacterData(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
CharacterData::~CharacterData()
{
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
MOZ_ASSERT(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
}
@ -246,8 +246,8 @@ CharacterData::SetTextInternal(uint32_t aOffset, uint32_t aCount,
uint32_t aLength, bool aNotify,
CharacterDataChangeInfo::Details* aDetails)
{
NS_PRECONDITION(aBuffer || !aLength,
"Null buffer passed to SetTextInternal!");
MOZ_ASSERT(aBuffer || !aLength,
"Null buffer passed to SetTextInternal!");
// sanitize arguments
uint32_t textLength = mText.GetLength();
@ -446,28 +446,28 @@ CharacterData::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetUncomposedDoc() && !IsInUncomposedDoc(),
"Already have a document. Unbind first!");
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
MOZ_ASSERT(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
"Must have the same owner document");
MOZ_ASSERT(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
MOZ_ASSERT(!GetUncomposedDoc() && !IsInUncomposedDoc(),
"Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
NS_PRECONDITION(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
NS_PRECONDITION(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
MOZ_ASSERT(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
MOZ_ASSERT(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
MOZ_ASSERT(aBindingParent != this,
"Content must not be its own binding parent");
MOZ_ASSERT(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
if (!aBindingParent && aParent) {
aBindingParent = aParent->GetBindingParent();

Просмотреть файл

@ -1534,30 +1534,30 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetUncomposedDoc(), "Already have a document. Unbind first!");
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
MOZ_ASSERT((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
"Must have the same owner document");
MOZ_ASSERT(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
MOZ_ASSERT(!GetUncomposedDoc(), "Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
NS_PRECONDITION(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
NS_PRECONDITION(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
NS_PRECONDITION(aBindingParent || !aParent ||
aBindingParent == aParent->GetBindingParent(),
"We should be passed the right binding parent");
MOZ_ASSERT(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
MOZ_ASSERT(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
MOZ_ASSERT(aBindingParent != this,
"Content must not be its own binding parent");
MOZ_ASSERT(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
MOZ_ASSERT(aBindingParent || !aParent ||
aBindingParent == aParent->GetBindingParent(),
"We should be passed the right binding parent");
#ifdef MOZ_XUL
// First set the binding parent
@ -1841,7 +1841,7 @@ RemoveFromBindingManagerRunnable::Run()
void
Element::UnbindFromTree(bool aDeep, bool aNullParent)
{
NS_PRECONDITION(aDeep || (!GetUncomposedDoc() && !GetBindingParent()),
MOZ_ASSERT(aDeep || (!GetUncomposedDoc() && !GetBindingParent()),
"Shallow unbind won't clear document and binding parent on "
"kids!");
@ -2218,9 +2218,9 @@ Element::DispatchEvent(nsPresContext* aPresContext,
bool aFullDispatch,
nsEventStatus* aStatus)
{
NS_PRECONDITION(aTarget, "Must have target");
NS_PRECONDITION(aEvent, "Must have source event");
NS_PRECONDITION(aStatus, "Null out param?");
MOZ_ASSERT(aTarget, "Must have target");
MOZ_ASSERT(aEvent, "Must have source event");
MOZ_ASSERT(aStatus, "Null out param?");
if (!aPresContext) {
return NS_OK;
@ -2247,9 +2247,9 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
const EventFlags* aExtraEventFlags,
nsEventStatus* aStatus)
{
NS_PRECONDITION(aTarget, "Must have target");
NS_PRECONDITION(aSourceEvent, "Must have source event");
NS_PRECONDITION(aStatus, "Null out param?");
MOZ_ASSERT(aTarget, "Must have target");
MOZ_ASSERT(aSourceEvent, "Must have source event");
MOZ_ASSERT(aStatus, "Null out param?");
WidgetMouseEvent event(aSourceEvent->IsTrusted(), eMouseClick,
aSourceEvent->mWidget, WidgetMouseEvent::eReal);
@ -2322,7 +2322,7 @@ Element::SetEventHandler(nsAtom* aEventName,
return NS_OK;
}
NS_PRECONDITION(aEventName, "Must have event name!");
MOZ_ASSERT(aEventName, "Must have event name!");
bool defer = true;
EventListenerManager* manager =
GetEventListenerManagerForAttr(aEventName, &defer);

Просмотреть файл

@ -603,22 +603,22 @@ protected:
// those in EXTERNALLY_MANAGED_STATES.
virtual void AddStates(EventStates aStates)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be adding externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be adding externally-managed states here");
AddStatesSilently(aStates);
NotifyStateChange(aStates);
}
virtual void RemoveStates(EventStates aStates)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
RemoveStatesSilently(aStates);
NotifyStateChange(aStates);
}
virtual void ToggleStates(EventStates aStates, bool aNotify)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
mState ^= aStates;
if (aNotify) {
NotifyStateChange(aStates);

Просмотреть файл

@ -835,12 +835,12 @@ EventSourceImpl::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
return NS_ERROR_ABORT;
}
nsCOMPtr<nsIRequest> aOldRequest = do_QueryInterface(aOldChannel);
NS_PRECONDITION(aOldRequest, "Redirect from a null request?");
MOZ_ASSERT(aOldRequest, "Redirect from a null request?");
nsresult rv = CheckHealthOfRequestCallback(aOldRequest);
NS_ENSURE_SUCCESS(rv, rv);
NS_PRECONDITION(aNewChannel, "Redirect without a channel?");
MOZ_ASSERT(aNewChannel, "Redirect without a channel?");
nsCOMPtr<nsIURI> newURI;
rv = NS_GetFinalChannelURI(aNewChannel, getter_AddRefs(newURI));
@ -1373,8 +1373,7 @@ EventSourceImpl::TimerCallback(nsITimer* aTimer, void* aClosure)
return;
}
NS_PRECONDITION(!thisObject->mHttpChannel,
"the channel hasn't been cancelled!!");
MOZ_ASSERT(!thisObject->mHttpChannel, "the channel hasn't been cancelled!!");
if (!thisObject->IsFrozen()) {
nsresult rv = thisObject->InitChannelAndRequestEventSource();

Просмотреть файл

@ -814,8 +814,8 @@ FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>&&
FragmentOrElement::~FragmentOrElement()
{
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
MOZ_ASSERT(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
}
@ -1187,7 +1187,7 @@ FragmentOrElement::InsertChildBefore(nsIContent* aKid,
nsIContent* aBeforeThis,
bool aNotify)
{
NS_PRECONDITION(aKid, "null ptr");
MOZ_ASSERT(aKid, "null ptr");
int32_t index = aBeforeThis ? ComputeIndexOf(aBeforeThis) : GetChildCount();
MOZ_ASSERT(index >= 0);
@ -1200,7 +1200,7 @@ FragmentOrElement::InsertChildAt_Deprecated(nsIContent* aKid,
uint32_t aIndex,
bool aNotify)
{
NS_PRECONDITION(aKid, "null ptr");
MOZ_ASSERT(aKid, "null ptr");
return doInsertChildAt(aKid, aIndex, aNotify, mAttrsAndChildren);
}

Просмотреть файл

@ -122,7 +122,7 @@ private:
explicit Notification(IDTracker* aTarget)
: mTarget(aTarget)
{
NS_PRECONDITION(aTarget, "Must have a target");
MOZ_ASSERT(aTarget, "Must have a target");
}
IDTracker* mTarget;
};

Просмотреть файл

@ -2122,7 +2122,7 @@ nsresult
Selection::StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint,
uint32_t aDelay)
{
NS_PRECONDITION(aFrame, "Need a frame");
MOZ_ASSERT(aFrame, "Need a frame");
nsresult result;
if (!mFrameSelection) {
@ -2160,7 +2160,7 @@ Selection::StopAutoScrollTimer()
nsresult
Selection::DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint)
{
NS_PRECONDITION(aFrame, "Need a frame");
MOZ_ASSERT(aFrame, "Need a frame");
if (mAutoScrollTimer) {
(void)mAutoScrollTimer->Stop();

Просмотреть файл

@ -614,7 +614,7 @@ nsAttrAndChildArray::SetAndSwapMappedAttr(nsAtom* aLocalName,
nsresult
nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
{
NS_PRECONDITION(mImpl && mImpl->mMappedAttrs,
MOZ_ASSERT(mImpl && mImpl->mMappedAttrs,
"Should have mapped attrs here!");
if (aSheet == mImpl->mMappedAttrs->GetStyleSheet()) {
return NS_OK;
@ -800,7 +800,7 @@ nsAttrAndChildArray::GetMapped() const
nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
bool aAllocateChildren)
{
NS_PRECONDITION(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
MOZ_ASSERT(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
uint32_t attrCount = aOther.NonMappedAttrCount();
uint32_t childCount = 0;
@ -930,8 +930,8 @@ inline void
nsAttrAndChildArray::SetChildAtPos(void** aPos, nsIContent* aChild,
uint32_t aIndex, uint32_t aChildCount)
{
NS_PRECONDITION(!aChild->GetNextSibling(), "aChild with next sibling?");
NS_PRECONDITION(!aChild->GetPreviousSibling(), "aChild with prev sibling?");
MOZ_ASSERT(!aChild->GetNextSibling(), "aChild with next sibling?");
MOZ_ASSERT(!aChild->GetPreviousSibling(), "aChild with prev sibling?");
*aPos = aChild;
NS_ADDREF(aChild);
@ -965,4 +965,3 @@ nsAttrAndChildArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) co
return n;
}

Просмотреть файл

@ -184,7 +184,7 @@ private:
bool AttrSlotIsTaken(uint32_t aSlot) const
{
NS_PRECONDITION(aSlot < AttrSlotCount(), "out-of-bounds");
MOZ_ASSERT(aSlot < AttrSlotCount(), "out-of-bounds");
return mImpl->mBuffer[aSlot * ATTRSIZE];
}

Просмотреть файл

@ -737,7 +737,7 @@ nsAttrValue::GetAsAtom() const
const nsCheapString
nsAttrValue::GetStringValue() const
{
NS_PRECONDITION(Type() == eString, "wrong type");
MOZ_ASSERT(Type() == eString, "wrong type");
return nsCheapString(static_cast<nsStringBuffer*>(GetPtr()));
}
@ -758,7 +758,7 @@ nsAttrValue::GetColorValue(nscolor& aColor) const
void
nsAttrValue::GetEnumString(nsAString& aResult, bool aRealTag) const
{
NS_PRECONDITION(Type() == eEnum, "wrong type");
MOZ_ASSERT(Type() == eEnum, "wrong type");
uint32_t allEnumBits =
(BaseType() == eIntegerBase) ? static_cast<uint32_t>(GetIntInternal())
@ -800,8 +800,8 @@ nsAttrValue::GetAtomCount() const
nsAtom*
nsAttrValue::AtomAt(int32_t aIndex) const
{
NS_PRECONDITION(aIndex >= 0, "Index must not be negative");
NS_PRECONDITION(GetAtomCount() > uint32_t(aIndex), "aIndex out of range");
MOZ_ASSERT(aIndex >= 0, "Index must not be negative");
MOZ_ASSERT(GetAtomCount() > uint32_t(aIndex), "aIndex out of range");
if (BaseType() == eAtomBase) {
return GetAtomValue();
@ -1400,8 +1400,8 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
}
if (aDefaultValue) {
NS_PRECONDITION(aTable <= aDefaultValue && aDefaultValue < tableEntry,
"aDefaultValue not inside aTable?");
MOZ_ASSERT(aTable <= aDefaultValue && aDefaultValue < tableEntry,
"aDefaultValue not inside aTable?");
SetIntValueAndType(EnumTableEntryToValue(aTable, aDefaultValue),
eEnum, &aValue);
return true;
@ -1443,7 +1443,7 @@ bool
nsAttrValue::ParseIntWithBounds(const nsAString& aString,
int32_t aMin, int32_t aMax)
{
NS_PRECONDITION(aMin < aMax, "bad boundaries");
MOZ_ASSERT(aMin < aMax, "bad boundaries");
ResetIfSet();
@ -1965,4 +1965,3 @@ nsAttrValue::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
return n;
}

Просмотреть файл

@ -128,7 +128,7 @@ public:
inline int32_t
nsAttrValue::GetIntegerValue() const
{
NS_PRECONDITION(Type() == eInteger, "wrong type");
MOZ_ASSERT(Type() == eInteger, "wrong type");
return (BaseType() == eIntegerBase)
? GetIntInternal()
: GetMiscContainer()->mValue.mInteger;
@ -137,7 +137,7 @@ nsAttrValue::GetIntegerValue() const
inline int16_t
nsAttrValue::GetEnumValue() const
{
NS_PRECONDITION(Type() == eEnum, "wrong type");
MOZ_ASSERT(Type() == eEnum, "wrong type");
// We don't need to worry about sign extension here since we're
// returning an int16_t which will cut away the top bits.
return static_cast<int16_t>((
@ -150,7 +150,7 @@ nsAttrValue::GetEnumValue() const
inline float
nsAttrValue::GetPercentValue() const
{
NS_PRECONDITION(Type() == ePercent, "wrong type");
MOZ_ASSERT(Type() == ePercent, "wrong type");
return ((BaseType() == eIntegerBase)
? GetIntInternal()
: GetMiscContainer()->mValue.mPercent)
@ -160,35 +160,35 @@ nsAttrValue::GetPercentValue() const
inline mozilla::AtomArray*
nsAttrValue::GetAtomArrayValue() const
{
NS_PRECONDITION(Type() == eAtomArray, "wrong type");
MOZ_ASSERT(Type() == eAtomArray, "wrong type");
return GetMiscContainer()->mValue.mAtomArray;
}
inline mozilla::DeclarationBlock*
nsAttrValue::GetCSSDeclarationValue() const
{
NS_PRECONDITION(Type() == eCSSDeclaration, "wrong type");
MOZ_ASSERT(Type() == eCSSDeclaration, "wrong type");
return GetMiscContainer()->mValue.mCSSDeclaration;
}
inline nsIURI*
nsAttrValue::GetURLValue() const
{
NS_PRECONDITION(Type() == eURL, "wrong type");
MOZ_ASSERT(Type() == eURL, "wrong type");
return GetMiscContainer()->mValue.mURL;
}
inline double
nsAttrValue::GetDoubleValue() const
{
NS_PRECONDITION(Type() == eDoubleValue, "wrong type");
MOZ_ASSERT(Type() == eDoubleValue, "wrong type");
return GetMiscContainer()->mDoubleValue;
}
inline bool
nsAttrValue::GetIntMarginValue(nsIntMargin& aMargin) const
{
NS_PRECONDITION(Type() == eIntMarginValue, "wrong type");
MOZ_ASSERT(Type() == eIntMarginValue, "wrong type");
nsIntMargin* m = GetMiscContainer()->mValue.mIntMargin;
if (!m)
return false;
@ -269,7 +269,7 @@ nsAttrValue::Type() const
inline nsAtom*
nsAttrValue::GetAtomValue() const
{
NS_PRECONDITION(Type() == eAtom, "wrong type");
MOZ_ASSERT(Type() == eAtom, "wrong type");
return reinterpret_cast<nsAtom*>(GetPtr());
}

Просмотреть файл

@ -542,8 +542,8 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
nsIContent** aDragNode,
nsACString& aPrincipalURISpec)
{
NS_PRECONDITION(aCanDrag && aSelection && aDataTransfer && aDragNode,
"null pointer passed to Produce");
MOZ_ASSERT(aCanDrag && aSelection && aDataTransfer && aDragNode,
"null pointer passed to Produce");
NS_ASSERTION(mWindow, "window not set");
NS_ASSERTION(mSelectionTargetNode, "selection target node should have been set");

Просмотреть файл

@ -628,7 +628,7 @@ nsContentList::AttributeChanged(Element* aElement,
int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_PRECONDITION(aElement, "Must have a content node to work with");
MOZ_ASSERT(aElement, "Must have a content node to work with");
if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY ||
!MayContainRelevantNodes(aElement->GetParentNode()) ||
@ -658,7 +658,7 @@ void
nsContentList::ContentAppended(nsIContent* aFirstNewContent)
{
nsIContent* container = aFirstNewContent->GetParent();
NS_PRECONDITION(container, "Can't get at the new content if no container!");
MOZ_ASSERT(container, "Can't get at the new content if no container!");
/*
* If the state is LIST_DIRTY then we have no useful information in our list
@ -827,9 +827,9 @@ nsContentList::Match(Element *aElement)
bool
nsContentList::MatchSelf(nsIContent *aContent)
{
NS_PRECONDITION(aContent, "Can't match null stuff, you know");
NS_PRECONDITION(mDeep || aContent->GetParentNode() == mRootNode,
"MatchSelf called on a node that we can't possibly match");
MOZ_ASSERT(aContent, "Can't match null stuff, you know");
MOZ_ASSERT(mDeep || aContent->GetParentNode() == mRootNode,
"MatchSelf called on a node that we can't possibly match");
if (!aContent->IsElement()) {
return false;

Просмотреть файл

@ -387,8 +387,8 @@ public:
// most common namespace id is kNameSpaceID_Unknown. So check the
// string first. Cases in which whether our root's ownerDocument
// is HTML changes are extremely rare, so check those last.
NS_PRECONDITION(mXMLMatchAtom,
"How did we get here with a null match atom on our list?");
MOZ_ASSERT(mXMLMatchAtom,
"How did we get here with a null match atom on our list?");
return
mXMLMatchAtom->Equals(aKey.mTagname) &&
mRootNode == aKey.mRootNode &&

Просмотреть файл

@ -88,7 +88,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
}
//sanity-check passed-through parameters
NS_PRECONDITION(decision, "Null out pointer");
MOZ_ASSERT(decision, "Null out pointer");
WARN_IF_URI_UNINITIALIZED(contentLocation, "Request URI");
WARN_IF_URI_UNINITIALIZED(requestingLocation, "Requesting URI");
@ -208,7 +208,7 @@ nsContentPolicy::ShouldLoad(nsIURI *contentLocation,
int16_t *decision)
{
// ShouldProcess does not need a content location, but we do
NS_PRECONDITION(contentLocation, "Must provide request location");
MOZ_ASSERT(contentLocation, "Must provide request location");
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldLoad,
contentLocation, loadInfo,
mimeType, decision);

Просмотреть файл

@ -56,6 +56,7 @@
#include "HTMLLinkElement.h"
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
LazyLogModule gContentSinkLogModuleInfo("nscontentsink");
@ -195,8 +196,8 @@ nsContentSink::Init(nsIDocument* aDoc,
nsISupports* aContainer,
nsIChannel* aChannel)
{
NS_PRECONDITION(aDoc, "null ptr");
NS_PRECONDITION(aURI, "null ptr");
MOZ_ASSERT(aDoc, "null ptr");
MOZ_ASSERT(aURI, "null ptr");
if (!aDoc || !aURI) {
return NS_ERROR_NULL_POINTER;
@ -783,18 +784,22 @@ nsContentSink::ProcessStyleLinkFromHeader(const nsAString& aHref,
return NS_OK;
}
mozilla::net::ReferrerPolicy referrerPolicy =
mozilla::net::AttributeReferrerPolicyFromString(aReferrerPolicy);
if (referrerPolicy == net::RP_Unset) {
referrerPolicy = mDocument->GetReferrerPolicy();
}
// If this is a fragment parser, we don't want to observe.
// We don't support CORS for processing instructions
Loader::SheetInfo info {
*mDocument,
nullptr,
url.forget(),
nullptr,
net::AttributeReferrerPolicyFromString(aReferrerPolicy),
CORS_NONE,
aTitle,
aMedia,
aAlternate ? Loader::HasAlternateRel::Yes : Loader::HasAlternateRel::No,
Loader::IsInline::No,
};
auto loadResultOrErr =
mCSSLoader->LoadStyleLink(nullptr, url, nullptr, aTitle, aMedia, aAlternate,
CORS_NONE, referrerPolicy,
/* integrity = */ EmptyString(),
mRunsToCompletion ? nullptr : this);
mCSSLoader->LoadStyleLink(info, mRunsToCompletion ? nullptr : this);
if (loadResultOrErr.isErr()) {
return loadResultOrErr.unwrapErr();
}

Просмотреть файл

@ -770,7 +770,7 @@ nsresult nsContentUtils::RemoveWyciwygScheme(nsIURI* aURI, nsIURI** aReturn)
#ifdef DEBUG
bool isWyciwyg = false;
aURI->SchemeIs("wyciwyg", &isWyciwyg);
NS_PRECONDITION(isWyciwyg, "Scheme should be wyciwyg");
MOZ_ASSERT(isWyciwyg, "Scheme should be wyciwyg");
#endif
nsAutoCString path;
nsresult rv = aURI->GetPathQueryRef(path);
@ -1061,7 +1061,7 @@ nsContentUtils::Atob(const nsAString& aAsciiBase64String,
bool
nsContentUtils::IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput)
{
NS_PRECONDITION(aInput, "aInput should not be null!");
MOZ_ASSERT(aInput, "aInput should not be null!");
nsAutoString autocomplete;
aInput->GetAutocomplete(autocomplete);
@ -2193,7 +2193,7 @@ nsContentUtils::IsAbsoluteURL(const nsACString& aURL)
bool
nsContentUtils::InProlog(nsINode *aNode)
{
NS_PRECONDITION(aNode, "missing node to nsContentUtils::InProlog");
MOZ_ASSERT(aNode, "missing node to nsContentUtils::InProlog");
nsINode* parent = aNode->GetParentNode();
if (!parent || !parent->IsDocument()) {
@ -2391,7 +2391,7 @@ nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
nsINode*
nsContentUtils::GetCrossDocParentNode(nsINode* aChild)
{
NS_PRECONDITION(aChild, "The child is null!");
MOZ_ASSERT(aChild, "The child is null!");
nsINode* parent = aChild->GetParentNode();
if (parent && parent->IsContent() && aChild->IsContent()) {
@ -2412,8 +2412,8 @@ bool
nsContentUtils::ContentIsDescendantOf(const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2428,8 +2428,8 @@ bool
nsContentUtils::ContentIsHostIncludingDescendantOf(
const nsINode* aPossibleDescendant, const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2478,8 +2478,8 @@ bool
nsContentUtils::ContentIsCrossDocDescendantOf(nsINode* aPossibleDescendant,
nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2497,8 +2497,8 @@ nsContentUtils::ContentIsFlattenedTreeDescendantOf(
const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor) {
@ -2516,8 +2516,8 @@ nsContentUtils::ContentIsFlattenedTreeDescendantOfForStyle(
const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor) {
@ -3451,9 +3451,9 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsINode* aNode,
int16_t* aImageBlockingStatus,
uint32_t aContentType)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aLoadingDocument, "Must have a document");
NS_PRECONDITION(aLoadingPrincipal, "Must have a loading principal");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aLoadingDocument, "Must have a document");
MOZ_ASSERT(aLoadingPrincipal, "Must have a loading principal");
nsresult rv;
@ -3676,11 +3676,11 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsINode* aContext,
uint32_t aContentPolicyType,
bool aUseUrgentStartForChannel)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aContext, "Must have a context");
NS_PRECONDITION(aLoadingDocument, "Must have a document");
NS_PRECONDITION(aLoadingPrincipal, "Must have a principal");
NS_PRECONDITION(aRequest, "Null out param");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aContext, "Must have a context");
MOZ_ASSERT(aLoadingDocument, "Must have a document");
MOZ_ASSERT(aLoadingPrincipal, "Must have a principal");
MOZ_ASSERT(aRequest, "Null out param");
imgLoader* imgLoader = GetImgLoaderForDocument(aLoadingDocument);
if (!imgLoader) {
@ -3788,7 +3788,7 @@ nsContentUtils::ContentIsDraggable(nsIContent* aContent)
bool
nsContentUtils::IsDraggableImage(nsIContent* aContent)
{
NS_PRECONDITION(aContent, "Must have content node to test");
MOZ_ASSERT(aContent, "Must have content node to test");
nsCOMPtr<nsIImageLoadingContent> imageContent(do_QueryInterface(aContent));
if (!imageContent) {
@ -4590,7 +4590,7 @@ nsContentUtils::MatchElementId(nsIContent *aContent, const nsAtom* aId)
Element *
nsContentUtils::MatchElementId(nsIContent *aContent, const nsAString& aId)
{
NS_PRECONDITION(!aId.IsEmpty(), "Will match random elements");
MOZ_ASSERT(!aId.IsEmpty(), "Will match random elements");
// ID attrs are generally stored as atoms, so just atomize this up front
RefPtr<nsAtom> id(NS_Atomize(aId));
@ -4737,9 +4737,9 @@ void
nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
nsIDocument* aOwnerDoc)
{
NS_PRECONDITION(aChild, "Missing child");
NS_PRECONDITION(aChild->GetParentNode() == aParent, "Wrong parent");
NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
MOZ_ASSERT(aChild, "Missing child");
MOZ_ASSERT(aChild->GetParentNode() == aParent, "Wrong parent");
MOZ_ASSERT(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
// Having an explicit check here since it's an easy mistake to fall into,
// and there might be existing code with problems. We'd rather be safe
@ -5407,10 +5407,8 @@ bool
nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
const nsIContent* aContent)
{
NS_PRECONDITION(aNode,
"Must have a node to work with");
NS_PRECONDITION(aContent,
"Must have a content to work with");
MOZ_ASSERT(aNode, "Must have a node to work with");
MOZ_ASSERT(aContent, "Must have a content to work with");
if (!aNode->IsContent()) {
/**
@ -5494,7 +5492,7 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
bool aClick, bool aIsTrusted)
{
NS_ASSERTION(aPresContext, "Need a nsPresContext");
NS_PRECONDITION(aLinkURI, "No link URI");
MOZ_ASSERT(aLinkURI, "No link URI");
if (aContent->IsEditable()) {
return;
@ -6279,7 +6277,7 @@ SameOriginCheckerImpl::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
uint32_t aFlags,
nsIAsyncVerifyRedirectCallback* cb)
{
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
MOZ_ASSERT(aNewChannel, "Redirecting to null channel?");
nsresult rv = nsContentUtils::CheckSameOrigin(aOldChannel, aNewChannel);
if (NS_SUCCEEDED(rv)) {
@ -6299,7 +6297,7 @@ SameOriginCheckerImpl::GetInterface(const nsIID& aIID, void** aResult)
nsresult
nsContentUtils::GetASCIIOrigin(nsIPrincipal* aPrincipal, nsACString& aOrigin)
{
NS_PRECONDITION(aPrincipal, "missing principal");
MOZ_ASSERT(aPrincipal, "missing principal");
aOrigin.Truncate();
@ -6320,7 +6318,7 @@ nsContentUtils::GetASCIIOrigin(nsIPrincipal* aPrincipal, nsACString& aOrigin)
nsresult
nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin)
{
NS_PRECONDITION(aURI, "missing uri");
MOZ_ASSERT(aURI, "missing uri");
// For Blob URI we have to return the origin of page using its principal.
nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(aURI);
@ -6374,7 +6372,7 @@ nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin)
nsresult
nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin)
{
NS_PRECONDITION(aPrincipal, "missing principal");
MOZ_ASSERT(aPrincipal, "missing principal");
aOrigin.Truncate();
@ -6395,7 +6393,7 @@ nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin)
nsresult
nsContentUtils::GetUTFOrigin(nsIURI* aURI, nsAString& aOrigin)
{
NS_PRECONDITION(aURI, "missing uri");
MOZ_ASSERT(aURI, "missing uri");
bool isBlobURL = false;
nsresult rv = aURI->SchemeIs(BLOBURI_SCHEME, &isBlobURL);

Просмотреть файл

@ -2191,7 +2191,7 @@ public:
static already_AddRefed<nsContentList>
GetElementsByClassName(nsINode* aRootNode, const nsAString& aClasses)
{
NS_PRECONDITION(aRootNode, "Must have root node");
MOZ_ASSERT(aRootNode, "Must have root node");
return GetFuncStringContentList<nsCacheableFuncStringHTMLCollection>(aRootNode,
MatchClassNames,

Просмотреть файл

@ -505,8 +505,8 @@ struct PositionComparator
bool
nsIdentifierMapEntry::AddIdElement(Element* aElement)
{
NS_PRECONDITION(aElement, "Must have element");
NS_PRECONDITION(!mIdContentList.Contains(nullptr),
MOZ_ASSERT(aElement, "Must have element");
MOZ_ASSERT(!mIdContentList.Contains(nullptr),
"Why is null in our list?");
#ifdef DEBUG
@ -549,7 +549,7 @@ nsIdentifierMapEntry::AddIdElement(Element* aElement)
void
nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
{
NS_PRECONDITION(aElement, "Missing element");
MOZ_ASSERT(aElement, "Missing element");
// This should only be called while the document is in an update.
// Assertions near the call to this method guarantee this.
@ -820,8 +820,8 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
// If we ever start allowing non-same-origin loads here, we might need to do
// something interesting with aRequestingPrincipal even for the hashtable
// gets.
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
*aPendingLoad = nullptr;
if (mHaveShutDown) {
return nullptr;
@ -958,9 +958,9 @@ nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
nsILoadGroup* aLoadGroup,
nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(aURI, "Unexpected call");
NS_PRECONDITION((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
"Must have both or neither");
MOZ_ASSERT(aURI, "Unexpected call");
MOZ_ASSERT((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
"Must have both or neither");
RefPtr<PendingLoad> load;
mPendingLoads.Remove(aURI, getter_AddRefs(load));
@ -1050,7 +1050,7 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup)
{
NS_PRECONDITION(!mTargetListener, "Unexpected call to OnStartRequest");
MOZ_ASSERT(!mTargetListener, "Unexpected call to OnStartRequest");
*aViewer = nullptr;
*aLoadGroup = nullptr;
@ -1161,8 +1161,8 @@ nsresult
nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
nsINode* aRequestingNode)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
nsCOMPtr<nsILoadGroup> loadGroup =
aRequestingNode->OwnerDoc()->GetDocumentLoadGroup();
@ -1754,7 +1754,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocument)
NS_IMETHODIMP_(MozExternalRefCountType)
nsDocument::Release()
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
MOZ_ASSERT(0 != mRefCnt, "dup release");
NS_ASSERT_OWNINGTHREAD(nsDocument);
nsISupports* base = NS_CYCLE_COLLECTION_CLASSNAME(nsDocument)::Upcast(this);
bool shouldDelete = false;
@ -2229,7 +2229,7 @@ nsIDocument::ResetToURI(nsIURI* aURI,
nsILoadGroup* aLoadGroup,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aURI, "Null URI passed to ResetToURI");
MOZ_ASSERT(aURI, "Null URI passed to ResetToURI");
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p ResetToURI %s", this, aURI->GetSpecOrDefault().get()));
@ -2532,9 +2532,9 @@ AppendSheetsToStyleSet(ServoStyleSet* aStyleSet,
void
nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
{
NS_PRECONDITION(aStyleSet, "Must have a style set");
NS_PRECONDITION(aStyleSet->SheetCount(SheetType::Doc) == 0,
"Style set already has document sheets?");
MOZ_ASSERT(aStyleSet, "Must have a style set");
MOZ_ASSERT(aStyleSet->SheetCount(SheetType::Doc) == 0,
"Style set already has document sheets?");
MOZ_ASSERT(!mStyleSetFilled);
@ -4375,7 +4375,7 @@ nsIDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
void
nsIDocument::RemoveStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
MOZ_ASSERT(aSheet, "null arg");
RefPtr<StyleSheet> sheet = aSheet; // hold ref so it won't die too soon
if (!mStyleSheets.RemoveElement(aSheet)) {
@ -4401,8 +4401,8 @@ nsIDocument::UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
BeginUpdate(UPDATE_STYLE);
// XXX Need to set the sheet on the ownernode, if any
NS_PRECONDITION(aOldSheets.Length() == aNewSheets.Length(),
"The lists must be the same length!");
MOZ_ASSERT(aOldSheets.Length() == aNewSheets.Length(),
"The lists must be the same length!");
int32_t count = aOldSheets.Length();
RefPtr<StyleSheet> oldSheet;
@ -4453,7 +4453,7 @@ nsIDocument::InsertStyleSheetAt(StyleSheet* aSheet, size_t aIndex)
void
nsIDocument::SetStyleSheetApplicableState(StyleSheet* aSheet, bool aApplicable)
{
NS_PRECONDITION(aSheet, "null arg");
MOZ_ASSERT(aSheet, "null arg");
// If we're actually in the document style sheet list
if (mStyleSheets.IndexOf(aSheet) != mStyleSheets.NoIndex) {
@ -4537,7 +4537,7 @@ nsresult
nsIDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI)
{
NS_PRECONDITION(aSheetURI, "null arg");
MOZ_ASSERT(aSheetURI, "null arg");
// Checking if we have loaded this one already.
if (FindSheet(mAdditionalSheets[aType], aSheetURI) >= 0)
@ -5472,8 +5472,8 @@ nsIDocument::UnblockDOMContentLoaded()
void
nsIDocument::ContentStateChanged(nsIContent* aContent, EventStates aStateMask)
{
NS_PRECONDITION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a scriptblocker");
MOZ_ASSERT(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a scriptblocker");
NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStateChanged,
(this, aContent, aStateMask));
}
@ -6740,8 +6740,8 @@ nsIDocument::RequestExternalResource(nsIURI* aURI,
nsINode* aRequestingNode,
ExternalResourceLoad** aPendingLoad)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
if (mDisplayDocument) {
return mDisplayDocument->RequestExternalResource(aURI,
aRequestingNode,
@ -6915,7 +6915,7 @@ bool
nsIDocument::MatchNameAttribute(Element* aElement, int32_t aNamespaceID,
nsAtom* aAtom, void* aData)
{
NS_PRECONDITION(aElement, "Must have element to work with!");
MOZ_ASSERT(aElement, "Must have element to work with!");
if (!aElement->HasName()) {
return false;
@ -8386,11 +8386,11 @@ nsIDocument::PostUnblockOnloadEvent()
void
nsIDocument::DoUnblockOnload()
{
NS_PRECONDITION(!mDisplayDocument,
MOZ_ASSERT(!mDisplayDocument,
"Shouldn't get here for resource document");
NS_PRECONDITION(mOnloadBlockCount != 0,
"Shouldn't have a count of zero here, since we stabilized in "
"PostUnblockOnloadEvent");
MOZ_ASSERT(mOnloadBlockCount != 0,
"Shouldn't have a count of zero here, since we stabilized in "
"PostUnblockOnloadEvent");
--mOnloadBlockCount;

Просмотреть файл

@ -99,7 +99,7 @@ protected:
bool IsVisibleNode(nsINode* aNode)
{
NS_PRECONDITION(aNode, "");
MOZ_ASSERT(aNode, "null node");
if (mFlags & SkipInvisibleContent) {
// Treat the visibility of the ShadowRoot as if it were
@ -1754,7 +1754,7 @@ nsHTMLCopyEncoder::GetChildAt(nsINode *aParent, int32_t aOffset)
return resultNode;
nsCOMPtr<nsIContent> content = do_QueryInterface(aParent);
NS_PRECONDITION(content, "null content in nsHTMLCopyEncoder::GetChildAt");
MOZ_ASSERT(content, "null content in nsHTMLCopyEncoder::GetChildAt");
resultNode = content->GetChildAt_Deprecated(aOffset);

Просмотреть файл

@ -1563,8 +1563,8 @@ nsFocusManager::IsWindowVisible(nsPIDOMWindowOuter* aWindow)
bool
nsFocusManager::IsNonFocusableRoot(nsIContent* aContent)
{
NS_PRECONDITION(aContent, "aContent must not be NULL");
NS_PRECONDITION(aContent->IsInComposedDoc(), "aContent must be in a document");
MOZ_ASSERT(aContent, "aContent must not be NULL");
MOZ_ASSERT(aContent->IsInComposedDoc(), "aContent must be in a document");
// If aContent is in designMode, the root element is not focusable.
// NOTE: in designMode, most elements are not focusable, just the document is

Просмотреть файл

@ -630,7 +630,7 @@ SetTreeOwnerAndChromeEventHandlerOnDocshellTree(nsIDocShellTreeItem* aItem,
nsIDocShellTreeOwner* aOwner,
EventTarget* aHandler)
{
NS_PRECONDITION(aItem, "Must have item");
MOZ_ASSERT(aItem, "Must have item");
aItem->SetTreeOwner(aOwner);
@ -662,8 +662,8 @@ nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
int32_t aParentType,
nsIDocShell* aParentNode)
{
NS_PRECONDITION(aItem, "Must have docshell treeitem");
NS_PRECONDITION(mOwnerContent, "Must have owning content");
MOZ_ASSERT(aItem, "Must have docshell treeitem");
MOZ_ASSERT(mOwnerContent, "Must have owning content");
nsAutoString value;
bool isContent = mOwnerContent->AttrValueIs(

Просмотреть файл

@ -91,7 +91,7 @@ namespace dom {
already_AddRefed<nsIContent>
CreateGenConImageContent(nsIDocument* aDocument, imgRequestProxy* aImageRequest)
{
NS_PRECONDITION(aImageRequest, "Must have request!");
MOZ_ASSERT(aImageRequest, "Must have request!");
RefPtr<NodeInfo> nodeInfo =
aDocument->NodeInfoManager()->
GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage,

Просмотреть файл

@ -1667,8 +1667,8 @@ nsGlobalWindowInner::SetNewDocument(nsIDocument* aDocument,
nsISupports* aState,
bool aForceReuseInnerWindow)
{
NS_PRECONDITION(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(aDocument);
if (!mOuterWindow) {
@ -4780,7 +4780,7 @@ public:
NS_IMETHOD Run() override
{
NS_PRECONDITION(NS_IsMainThread(), "Should be called on the main thread.");
MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread.");
return mWindow->FireHashchange(mOldURL, mNewURL);
}

Просмотреть файл

@ -1415,7 +1415,7 @@ WindowStateHolder::WindowStateHolder(nsGlobalWindowInner* aWindow)
: mInnerWindow(aWindow),
mInnerWindowReflector(RootingCx(), aWindow->GetWrapper())
{
NS_PRECONDITION(aWindow, "null window");
MOZ_ASSERT(aWindow, "null window");
aWindow->Suspend();
@ -1640,7 +1640,7 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
nsISupports* aState,
bool aForceReuseInnerWindow)
{
NS_PRECONDITION(mDocumentPrincipal == nullptr,
MOZ_ASSERT(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(aDocument);
@ -3850,7 +3850,7 @@ nsGlobalWindowOuter::WindowExists(const nsAString& aName,
bool aForceNoOpener,
bool aLookForCallerOnJSStack)
{
NS_PRECONDITION(mDocShell, "Must have docshell");
MOZ_ASSERT(mDocShell, "Must have docshell");
if (aForceNoOpener) {
return aName.LowerCaseEqualsLiteral("_self") ||
@ -6901,10 +6901,11 @@ nsGlobalWindowOuter::OpenInternal(const nsAString& aUrl, const nsAString& aName,
if (argv)
argv->GetLength(&argc);
#endif
NS_PRECONDITION(!aExtraArgument || (!argv && argc == 0),
"Can't pass in arguments both ways");
NS_PRECONDITION(!aCalledNoScript || (!argv && argc == 0),
"Can't pass JS args when called via the noscript methods");
MOZ_ASSERT(!aExtraArgument || (!argv && argc == 0),
"Can't pass in arguments both ways");
MOZ_ASSERT(!aCalledNoScript || (!argv && argc == 0),
"Can't pass JS args when called via the noscript methods");
mozilla::Maybe<AutoUnblockScriptClosing> closeUnblocker;
@ -7731,4 +7732,3 @@ nsAutoPopupStatePusherInternal::~nsAutoPopupStatePusherInternal()
{
nsContentUtils::PopPopupControlState(mOldState);
}

Просмотреть файл

@ -33,8 +33,10 @@ inline void
nsIContent::SetPrimaryFrame(nsIFrame* aFrame)
{
MOZ_ASSERT(IsInUncomposedDoc() || IsInShadowTree(), "This will end badly!");
NS_PRECONDITION(!aFrame || !mPrimaryFrame || aFrame == mPrimaryFrame,
"Losing track of existing primary frame");
// FIXME bug 749326
NS_ASSERTION(!aFrame || !mPrimaryFrame || aFrame == mPrimaryFrame,
"Losing track of existing primary frame");
if (aFrame) {
if (MOZ_LIKELY(!IsHTMLElement(nsGkAtoms::area)) ||

Просмотреть файл

@ -11,7 +11,9 @@
#include "mozilla/StyleSheet.h"
#include "mozilla/Result.h"
class nsIContent;
class nsICSSLoaderObserver;
class nsIPrincipal;
class nsIURI;
#define NS_ISTYLESHEETLINKINGELEMENT_IID \
@ -26,16 +28,28 @@ public:
No,
};
enum class Completed
{
Yes,
No,
};
enum class HasAlternateRel
{
Yes,
No
};
enum class IsAlternate
{
Yes,
No,
};
enum class Completed
enum class IsInline
{
Yes,
No,
No
};
enum class MediaMatched
@ -79,6 +93,39 @@ public:
}
};
struct MOZ_STACK_CLASS SheetInfo
{
nsIContent* mContent;
// FIXME(emilio): do these really need to be strong refs?
nsCOMPtr<nsIURI> mURI;
// The principal of the scripted caller that initiated the load, if
// available. Otherwise null.
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
mozilla::net::ReferrerPolicy mReferrerPolicy;
mozilla::CORSMode mCORSMode;
nsString mTitle;
nsString mMedia;
nsString mIntegrity;
bool mHasAlternateRel;
bool mIsInline;
SheetInfo(const nsIDocument&,
nsIContent*,
already_AddRefed<nsIURI> aURI,
already_AddRefed<nsIPrincipal> aTriggeringPrincipal,
mozilla::net::ReferrerPolicy aReferrerPolicy,
mozilla::CORSMode aCORSMode,
const nsAString& aTitle,
const nsAString& aMedia,
HasAlternateRel aHasAlternateRel,
IsInline aIsInline);
~SheetInfo();
};
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID)
/**

Просмотреть файл

@ -148,8 +148,8 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
// We should definitely have a request here
MOZ_ASSERT(aRequest, "no request?");
NS_PRECONDITION(aRequest == mCurrentRequest || aRequest == mPendingRequest,
"Unknown request");
MOZ_ASSERT(aRequest == mCurrentRequest || aRequest == mPendingRequest,
"Unknown request");
}
{
@ -342,7 +342,7 @@ nsImageLoadingContent::SetLoadingEnabled(bool aLoadingEnabled)
NS_IMETHODIMP
nsImageLoadingContent::GetImageBlockingStatus(int16_t* aStatus)
{
NS_PRECONDITION(aStatus, "Null out param");
MOZ_ASSERT(aStatus, "Null out param");
*aStatus = ImageBlockingStatus();
return NS_OK;
}
@ -719,7 +719,7 @@ NS_IMETHODIMP
nsImageLoadingContent::GetRequestType(imgIRequest* aRequest,
int32_t* aRequestType)
{
NS_PRECONDITION(aRequestType, "Null out param");
MOZ_ASSERT(aRequestType, "Null out param");
ErrorResult result;
*aRequestType = GetRequestType(aRequest, result);
@ -1239,8 +1239,8 @@ nsImageLoadingContent::StringToURI(const nsAString& aSpec,
nsIDocument* aDocument,
nsIURI** aURI)
{
NS_PRECONDITION(aDocument, "Must have a document");
NS_PRECONDITION(aURI, "Null out param");
MOZ_ASSERT(aDocument, "Must have a document");
MOZ_ASSERT(aURI, "Null out param");
// (1) Get the base URI
nsIContent* thisContent = AsContent();
@ -1748,4 +1748,4 @@ mozilla::net::ReferrerPolicy
nsImageLoadingContent::GetImageReferrerPolicy()
{
return mozilla::net::RP_Unset;
};
}

Просмотреть файл

@ -814,7 +814,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports* aArgs,
nsresult
nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
{
NS_PRECONDITION(aArg, "Empty arg");
MOZ_ASSERT(aArg, "Empty arg");
nsCOMPtr<nsISupportsPrimitive> argPrimitive(do_QueryInterface(aArg));
if (!argPrimitive)

Просмотреть файл

@ -152,7 +152,7 @@ void
nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
bool* aValueWasSet)
{
NS_PRECONDITION(aAttrName, "null name");
MOZ_ASSERT(aAttrName, "null name");
*aValueWasSet = false;
uint32_t i;
for (i = 0; i < mAttrCount && !Attrs()[i].mName.IsSmaller(aAttrName); ++i) {
@ -178,7 +178,7 @@ nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
const nsAttrValue*
nsMappedAttributes::GetAttr(nsAtom* aAttrName) const
{
NS_PRECONDITION(aAttrName, "null name");
MOZ_ASSERT(aAttrName, "null name");
for (uint32_t i = 0; i < mAttrCount; ++i) {
if (Attrs()[i].mName.Equals(aAttrName)) {

Просмотреть файл

@ -126,7 +126,7 @@ nsNameSpaceManager::RegisterNameSpace(already_AddRefed<nsAtom> aURI,
nsresult
nsNameSpaceManager::GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI)
{
NS_PRECONDITION(aNameSpaceID >= 0, "Bogus namespace ID");
MOZ_ASSERT(aNameSpaceID >= 0, "Bogus namespace ID");
// We have historically treated GetNameSpaceURI calls for kNameSpaceID_None
// as erroneous.

Просмотреть файл

@ -107,7 +107,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
nsresult
nsNodeInfoManager::Init(nsIDocument *aDocument)
{
NS_PRECONDITION(!mPrincipal,
MOZ_ASSERT(!mPrincipal,
"Being inited when we already have a principal?");
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
@ -319,7 +319,7 @@ nsNodeInfoManager::SetDocumentPrincipal(nsIPrincipal *aPrincipal)
void
nsNodeInfoManager::RemoveNodeInfo(NodeInfo *aNodeInfo)
{
NS_PRECONDITION(aNodeInfo, "Trying to remove null nodeinfo from manager!");
MOZ_ASSERT(aNodeInfo, "Trying to remove null nodeinfo from manager!");
if (aNodeInfo == mDocumentNodeInfo) {
mDocumentNodeInfo = nullptr;

Просмотреть файл

@ -210,8 +210,8 @@ void
nsNodeUtils::ContentInserted(nsINode* aContainer,
nsIContent* aChild)
{
NS_PRECONDITION(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
nsIDocument* doc = aContainer->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer, (aChild),
IsRemoveNotification::No);
@ -222,8 +222,8 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
NS_PRECONDITION(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
nsIDocument* doc = aContainer->OwnerDoc();
MOZ_ASSERT(aChild->GetParentNode() == aContainer,
"We expect the parent link to be still around at this point");
@ -383,11 +383,10 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
nsCOMArray<nsINode> *aNodesWithProperties,
nsINode* aParent, ErrorResult& aError)
{
NS_PRECONDITION((!aClone && aNewNodeInfoManager) || !aReparentScope,
"If cloning or not getting a new nodeinfo we shouldn't "
"rewrap");
NS_PRECONDITION(!aParent || aNode->IsContent(),
"Can't insert document or attribute nodes into a parent");
MOZ_ASSERT((!aClone && aNewNodeInfoManager) || !aReparentScope,
"If cloning or not getting a new nodeinfo we shouldn't rewrap");
MOZ_ASSERT(!aParent || aNode->IsContent(),
"Can't insert document or attribute nodes into a parent");
// First deal with aNode and walk its attributes (and their children). Then,
// if aDeep is true, deal with aNode's children (and recurse into their
@ -713,4 +712,3 @@ nsNodeUtils::GetFirstChildOfTemplateOrNode(nsINode* aNode)
return aNode->GetFirstChild();
}

Просмотреть файл

@ -140,7 +140,7 @@ nsPropertyTable::GetPropertyInternal(nsPropertyOwner aObject,
bool aRemove,
nsresult* aResult)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
nsresult rv = NS_PROPTABLE_PROP_NOT_THERE;
void *propValue = nullptr;
@ -172,7 +172,7 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
void* aPropDtorData,
bool aTransfer)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
@ -218,7 +218,7 @@ nsresult
nsPropertyTable::DeleteProperty(nsPropertyOwner aObject,
nsAtom* aPropertyName)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
if (propertyList) {

Просмотреть файл

@ -60,7 +60,7 @@ nsRange::GetDocGroup() const
static void InvalidateAllFrames(nsINode* aNode)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
nsIFrame* frame = nullptr;
switch (aNode->NodeType()) {
@ -199,7 +199,7 @@ struct IsItemInRangeComparator
nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset,
uint32_t aEndOffset)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
nsINode* n = GetNextRangeCommonAncestor(aNode);
NS_ASSERTION(n || !aNode->IsSelectionDescendant(),
@ -461,7 +461,7 @@ static void UnmarkDescendants(nsINode* aNode)
void
nsRange::RegisterCommonAncestor(nsINode* aNode)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
MOZ_DIAGNOSTIC_ASSERT(IsInSelection(), "registering range not in selection");
@ -482,7 +482,7 @@ nsRange::RegisterCommonAncestor(nsINode* aNode)
void
nsRange::UnregisterCommonAncestor(nsINode* aNode, bool aIsUnlinking)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
NS_ASSERTION(aNode->IsCommonAncestorForRangeInSelection(), "wrong node");
MOZ_DIAGNOSTIC_ASSERT(aNode == mRegisteredCommonAncestor, "wrong node");
LinkedList<nsRange>* ranges = aNode->GetExistingCommonAncestorRanges();
@ -964,29 +964,32 @@ nsRange::DoSetRange(const RawRangeBoundary& aStart,
const RawRangeBoundary& aEnd,
nsINode* aRoot, bool aNotInsertedYet)
{
NS_PRECONDITION((aStart.IsSet() && aEnd.IsSet() && aRoot) ||
(!aStart.IsSet() && !aEnd.IsSet() && !aRoot),
"Set all or none");
NS_PRECONDITION(!aRoot || aNotInsertedYet ||
(nsContentUtils::ContentIsDescendantOf(aStart.Container(), aRoot) &&
nsContentUtils::ContentIsDescendantOf(aEnd.Container(), aRoot) &&
aRoot == IsValidBoundary(aStart.Container()) &&
aRoot == IsValidBoundary(aEnd.Container())),
"Wrong root");
NS_PRECONDITION(!aRoot ||
(aStart.Container()->IsContent() &&
aEnd.Container()->IsContent() &&
aRoot ==
static_cast<nsIContent*>(aStart.Container())->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
(!aRoot->GetParentNode() &&
(aRoot->IsDocument() ||
aRoot->IsAttr() ||
aRoot->IsDocumentFragment() ||
/*For backward compatibility*/
aRoot->IsContent())),
"Bad root");
MOZ_ASSERT((aStart.IsSet() && aEnd.IsSet() && aRoot) ||
(!aStart.IsSet() && !aEnd.IsSet() && !aRoot),
"Set all or none");
MOZ_ASSERT(!aRoot || aNotInsertedYet ||
(nsContentUtils::ContentIsDescendantOf(aStart.Container(), aRoot) &&
nsContentUtils::ContentIsDescendantOf(aEnd.Container(), aRoot) &&
aRoot == IsValidBoundary(aStart.Container()) &&
aRoot == IsValidBoundary(aEnd.Container())),
"Wrong root");
MOZ_ASSERT(!aRoot ||
(aStart.Container()->IsContent() &&
aEnd.Container()->IsContent() &&
aRoot ==
static_cast<nsIContent*>(aStart.Container())->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
(!aRoot->GetParentNode() &&
(aRoot->IsDocument() ||
aRoot->IsAttr() ||
aRoot->IsDocumentFragment() ||
/*For backward compatibility*/
aRoot->IsContent())),
"Bad root");
if (mRoot != aRoot) {
if (mRoot) {
mRoot->RemoveMutationObserver(this);

Просмотреть файл

@ -35,6 +35,44 @@
using namespace mozilla;
using namespace mozilla::dom;
nsStyleLinkElement::SheetInfo::SheetInfo(
const nsIDocument& aDocument,
nsIContent* aContent,
already_AddRefed<nsIURI> aURI,
already_AddRefed<nsIPrincipal> aTriggeringPrincipal,
mozilla::net::ReferrerPolicy aReferrerPolicy,
mozilla::CORSMode aCORSMode,
const nsAString& aTitle,
const nsAString& aMedia,
HasAlternateRel aHasAlternateRel,
IsInline aIsInline
)
: mContent(aContent)
, mURI(aURI)
, mTriggeringPrincipal(aTriggeringPrincipal)
, mReferrerPolicy(aReferrerPolicy)
, mCORSMode(aCORSMode)
, mTitle(aTitle)
, mMedia(aMedia)
, mHasAlternateRel(aHasAlternateRel == HasAlternateRel::Yes)
, mIsInline(aIsInline == IsInline::Yes)
{
MOZ_ASSERT(!mIsInline || aContent);
MOZ_ASSERT_IF(aContent, aContent->OwnerDoc() == &aDocument);
if (mReferrerPolicy == net::ReferrerPolicy::RP_Unset) {
mReferrerPolicy = aDocument.GetReferrerPolicy();
}
if (!mIsInline && aContent && aContent->IsElement()) {
aContent->AsElement()->GetAttr(kNameSpaceID_None,
nsGkAtoms::integrity,
mIntegrity);
}
}
nsStyleLinkElement::SheetInfo::~SheetInfo() = default;
nsStyleLinkElement::nsStyleLinkElement()
: mDontLoadStyle(false)
, mUpdatesEnabled(true)
@ -261,14 +299,15 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
return Update { };
}
bool isInline;
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
nsCOMPtr<nsIURI> uri = GetStyleSheetURL(&isInline, getter_AddRefs(triggeringPrincipal));
if (aForceUpdate == ForceUpdate::No && mStyleSheet && !isInline && uri) {
Maybe<SheetInfo> info = GetStyleSheetInfo();
if (aForceUpdate == ForceUpdate::No &&
mStyleSheet &&
info &&
!info->mIsInline &&
info->mURI) {
if (nsIURI* oldURI = mStyleSheet->GetSheetURI()) {
bool equal;
nsresult rv = oldURI->Equals(uri, &equal);
nsresult rv = oldURI->Equals(info->mURI, &equal);
if (NS_SUCCEEDED(rv) && equal) {
return Update { };
}
@ -288,28 +327,18 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
nsStyleLinkElement::SetStyleSheet(nullptr);
}
if (!uri && !isInline) {
if (!info) {
return Update { };
}
MOZ_ASSERT(info->mReferrerPolicy != net::RP_Unset ||
info->mReferrerPolicy == doc->GetReferrerPolicy());
if (!info->mURI && !info->mIsInline) {
// If href is empty and this is not inline style then just bail
return Update { };
}
nsAutoString title, type, media;
bool hasAlternateRel;
GetStyleSheetInfo(title, type, media, &hasAlternateRel);
if (!type.LowerCaseEqualsLiteral("text/css")) {
return Update { };
}
// Load the link's referrerpolicy attribute. If the link does not provide a
// referrerpolicy attribute, ignore this and use the document's referrer
// policy
net::ReferrerPolicy referrerPolicy = GetLinkReferrerPolicy();
if (referrerPolicy == net::RP_Unset) {
referrerPolicy = doc->GetReferrerPolicy();
}
if (isInline) {
if (info->mIsInline) {
nsAutoString text;
if (!nsContentUtils::GetNodeTextContent(thisContent, false, text, fallible)) {
return Err(NS_ERROR_OUT_OF_MEMORY);
@ -322,7 +351,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
nsresult rv = NS_OK;
if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent->AsElement(),
thisContent->NodePrincipal(),
triggeringPrincipal,
info->mTriggeringPrincipal,
doc->GetDocumentURI(),
mLineNumber, text, &rv)) {
if (NS_FAILED(rv)) {
@ -332,10 +361,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
}
// Parse the style sheet.
return doc->CSSLoader()->
LoadInlineStyle(thisContent, text, triggeringPrincipal, mLineNumber,
title, media, referrerPolicy,
aObserver);
return doc->CSSLoader()->LoadInlineStyle(*info, text, mLineNumber, aObserver);
}
nsAutoString integrity;
if (thisContent->IsElement()) {
@ -347,17 +373,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
("nsStyleLinkElement::DoUpdateStyleSheet, integrity=%s",
NS_ConvertUTF16toUTF8(integrity).get()));
}
auto resultOrError =
doc->CSSLoader()->LoadStyleLink(thisContent,
uri,
triggeringPrincipal,
title,
media,
hasAlternateRel,
GetCORSMode(),
referrerPolicy,
integrity,
aObserver);
auto resultOrError = doc->CSSLoader()->LoadStyleLink(*info, aObserver);
if (resultOrError.isErr()) {
// Don't propagate LoadStyleLink() errors further than this, since some
// consumers (e.g. nsXMLContentSink) will completely abort on innocuous

Просмотреть файл

@ -93,22 +93,7 @@ protected:
mozilla::dom::ShadowRoot* aOldShadowRoot,
ForceUpdate = ForceUpdate::No);
virtual already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal) = 0;
virtual void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate) = 0;
virtual mozilla::CORSMode GetCORSMode() const
{
// Default to no CORS
return mozilla::CORS_NONE;
}
virtual mozilla::net::ReferrerPolicy GetLinkReferrerPolicy()
{
return mozilla::net::RP_Unset;
}
virtual mozilla::Maybe<SheetInfo> GetStyleSheetInfo() = 0;
// CC methods
void Unlink();

Просмотреть файл

@ -289,7 +289,7 @@ nsSyncLoader::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
uint32_t aFlags,
nsIAsyncVerifyRedirectCallback *callback)
{
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
MOZ_ASSERT(aNewChannel, "Redirecting to null channel?");
mChannel = aNewChannel;

Просмотреть файл

@ -215,9 +215,9 @@ NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
int32_t aNameSpaceID, nsAtom* aAttrName,
nsIContent** aResult)
{
NS_PRECONDITION(aNodeInfoManager, "Missing nodeInfoManager");
NS_PRECONDITION(aAttrName, "Must have an attr name");
NS_PRECONDITION(aNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
MOZ_ASSERT(aNodeInfoManager, "Missing nodeInfoManager");
MOZ_ASSERT(aAttrName, "Must have an attr name");
MOZ_ASSERT(aNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
*aResult = nullptr;
@ -239,8 +239,8 @@ nsAttributeTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent && aParent->GetParent(),
"This node can't be a child of the document or of the document root");
MOZ_ASSERT(aParent && aParent->GetParent(),
"This node can't be a child of the document or of the document root");
nsresult rv = nsTextNode::BindToTree(aDocument, aParent,
aBindingParent, aCompileEventHandlers);
@ -305,4 +305,3 @@ nsAttributeTextNode::UpdateText(bool aNotify)
SetText(attrValue, aNotify);
}
}

Просмотреть файл

@ -1357,7 +1357,7 @@ nsTreeSanitizer::Sanitize(DocumentFragment* aFragment)
// If you want to relax these preconditions, be sure to check the code in
// here that notifies / does not notify or that fires mutation events if
// in tree.
NS_PRECONDITION(!aFragment->IsInUncomposedDoc(), "The fragment is in doc?");
MOZ_ASSERT(!aFragment->IsInUncomposedDoc(), "The fragment is in doc?");
mFullDocument = false;
SanitizeChildren(aFragment);
@ -1370,9 +1370,9 @@ nsTreeSanitizer::Sanitize(nsIDocument* aDocument)
// here that notifies / does not notify or that fires mutation events if
// in tree.
#ifdef DEBUG
NS_PRECONDITION(!aDocument->GetContainer(), "The document is in a shell.");
MOZ_ASSERT(!aDocument->GetContainer(), "The document is in a shell.");
RefPtr<mozilla::dom::Element> root = aDocument->GetRootElement();
NS_PRECONDITION(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
MOZ_ASSERT(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
#endif
mFullDocument = true;
@ -1542,7 +1542,7 @@ nsTreeSanitizer::LogMessage(const char* aMessage, nsIDocument* aDoc,
void
nsTreeSanitizer::InitializeStatics()
{
NS_PRECONDITION(!sElementsHTML, "Initializing a second time.");
MOZ_ASSERT(!sElementsHTML, "Initializing a second time.");
sElementsHTML = new AtomsTable(ArrayLength(kElementsHTML));
for (uint32_t i = 0; kElementsHTML[i]; i++) {

Просмотреть файл

@ -1707,9 +1707,6 @@ addExternalIface('LoadInfo', nativeType='nsILoadInfo',
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
addExternalIface('XULControllers', nativeType='nsIControllers', notflattened=True)
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
notflattened=True)
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
addExternalIface('MozTreeView', nativeType='nsITreeView',
headerFile='nsITreeView.h', notflattened=True)
addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')

Просмотреть файл

@ -257,7 +257,7 @@ DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
if (CORSUsed)
return;
NS_PRECONDITION(aPrincipal, "Must have a principal here");
MOZ_ASSERT(aPrincipal, "Must have a principal here");
if (aCanvasElement->NodePrincipal()->Subsumes(aPrincipal)) {
// This canvas has access to that image anyway

Просмотреть файл

@ -197,7 +197,7 @@ nsControllerCommandTable::GetSupportedCommands(uint32_t* aCount,
nsresult
NS_NewControllerCommandTable(nsIControllerCommandTable** aResult)
{
NS_PRECONDITION(aResult != nullptr, "null ptr");
MOZ_ASSERT(aResult != nullptr, "null ptr");
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}

Просмотреть файл

@ -503,7 +503,7 @@ nsresult
ContentEventHandler::QueryContentRect(nsIContent* aContent,
WidgetQueryContentEvent* aEvent)
{
NS_PRECONDITION(aContent, "aContent must not be null");
MOZ_ASSERT(aContent, "aContent must not be null");
nsIFrame* frame = aContent->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
@ -2699,7 +2699,7 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
// The root frame's widget might be different, e.g., the event was fired on
// a popup but the rootFrame is the document root.
if (rootWidget != aEvent->mWidget) {
NS_PRECONDITION(aEvent->mWidget, "The event must have the widget");
MOZ_ASSERT(aEvent->mWidget, "The event must have the widget");
nsView* view = nsView::GetViewFor(aEvent->mWidget);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
rootFrame = view->GetFrame();

Просмотреть файл

@ -303,7 +303,7 @@ EventListenerService::AddSystemEventListener(EventTarget *aTarget,
bool aUseCapture,
JSContext* aCx)
{
NS_PRECONDITION(aTarget, "Missing target");
MOZ_ASSERT(aTarget, "Missing target");
NS_ENSURE_TRUE(aTarget, NS_ERROR_UNEXPECTED);
@ -329,7 +329,7 @@ EventListenerService::RemoveSystemEventListener(EventTarget *aTarget,
bool aUseCapture,
JSContext* aCx)
{
NS_PRECONDITION(aTarget, "Missing target");
MOZ_ASSERT(aTarget, "Missing target");
NS_ENSURE_TRUE(aTarget, NS_ERROR_UNEXPECTED);

Просмотреть файл

@ -5288,11 +5288,11 @@ EventStateManager::SetContentState(nsIContent* aContent, EventStates aState)
{
// We manage 4 states here: ACTIVE, HOVER, DRAGOVER, URLTARGET
// The input must be exactly one of them.
NS_PRECONDITION(aState == NS_EVENT_STATE_ACTIVE ||
aState == NS_EVENT_STATE_HOVER ||
aState == NS_EVENT_STATE_DRAGOVER ||
aState == NS_EVENT_STATE_URLTARGET,
"Unexpected state");
MOZ_ASSERT(aState == NS_EVENT_STATE_ACTIVE ||
aState == NS_EVENT_STATE_HOVER ||
aState == NS_EVENT_STATE_DRAGOVER ||
aState == NS_EVENT_STATE_URLTARGET,
"Unexpected state");
nsCOMPtr<nsIContent> notifyContent1;
nsCOMPtr<nsIContent> notifyContent2;
@ -5530,7 +5530,7 @@ EventStateManager::EnsureDocument(nsPresContext* aPresContext)
void
EventStateManager::FlushPendingEvents(nsPresContext* aPresContext)
{
NS_PRECONDITION(nullptr != aPresContext, "nullptr ptr");
MOZ_ASSERT(nullptr != aPresContext, "nullptr ptr");
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
shell->FlushPendingNotifications(FlushType::InterruptibleLayout);

Просмотреть файл

@ -310,7 +310,7 @@ WheelTransaction::Shutdown()
/* static */ void
WheelTransaction::OnFailToScrollTarget()
{
NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
MOZ_ASSERT(sTargetFrame, "We don't have mouse scrolling transaction");
if (Prefs::sTestMouseScroll) {
// This event is used for automated tests, see bug 442774.

Просмотреть файл

@ -1762,9 +1762,9 @@ HTMLFormElement::GetActionURL(nsIURI** aActionURL,
NS_IMETHODIMP_(nsIFormControl*)
HTMLFormElement::GetDefaultSubmitElement() const
{
NS_PRECONDITION(mDefaultSubmitElement == mFirstSubmitInElements ||
mDefaultSubmitElement == mFirstSubmitNotInElements,
"What happened here?");
MOZ_ASSERT(mDefaultSubmitElement == mFirstSubmitInElements ||
mDefaultSubmitElement == mFirstSubmitNotInElements,
"What happened here?");
return mDefaultSubmitElement;
}
@ -1772,7 +1772,7 @@ HTMLFormElement::GetDefaultSubmitElement() const
bool
HTMLFormElement::IsDefaultSubmitElement(const nsIFormControl* aControl) const
{
NS_PRECONDITION(aControl, "Unexpected call");
MOZ_ASSERT(aControl, "Unexpected call");
if (aControl == mDefaultSubmitElement) {
// Yes, it is
@ -1821,7 +1821,7 @@ HTMLFormElement::ImplicitSubmissionIsDisabled() const
bool
HTMLFormElement::IsLastActiveElement(const nsIFormControl* aControl) const
{
NS_PRECONDITION(aControl, "Unexpected call");
MOZ_ASSERT(aControl, "Unexpected call");
for (auto* element : Reversed(mControls->mElements)) {
if (element->IsSingleLineTextOrNumberControl(false) &&

Просмотреть файл

@ -74,8 +74,8 @@ nsresult
HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
MOZ_ASSERT(aNumValues, "Must have a pointer to an integer here!");
MOZ_ASSERT(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;
@ -104,8 +104,8 @@ nsresult
HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
MOZ_ASSERT(aNumValues, "Must have a pointer to an integer here!");
MOZ_ASSERT(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;

Просмотреть файл

@ -865,7 +865,7 @@ HTMLImageElement::GetForm() const
void
HTMLImageElement::SetForm(HTMLFormElement* aForm)
{
NS_PRECONDITION(aForm, "Don't pass null here");
MOZ_ASSERT(aForm, "Don't pass null here");
NS_ASSERTION(!mForm,
"We don't support switching from one non-null form to another.");

Просмотреть файл

@ -876,12 +876,12 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
nsIFilePicker* aFilePicker,
nsIFilePickerShownCallback* aFpCallback)
{
NS_PRECONDITION(aDoc, "aDoc is null");
NS_PRECONDITION(aFilePicker, "aFilePicker is null");
NS_PRECONDITION(aFpCallback, "aFpCallback is null");
MOZ_ASSERT(aDoc, "aDoc is null");
MOZ_ASSERT(aFilePicker, "aFilePicker is null");
MOZ_ASSERT(aFpCallback, "aFpCallback is null");
nsIURI* docURI = aDoc->GetDocumentURI();
NS_PRECONDITION(docURI, "docURI is null");
MOZ_ASSERT(docURI, "docURI is null");
nsCOMPtr<nsILoadContext> loadContext = aDoc->GetLoadContext();
nsCOMPtr<nsIContentPrefCallback2> prefCallback =
@ -906,13 +906,13 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
nsresult
UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
{
NS_PRECONDITION(aDoc, "aDoc is null");
MOZ_ASSERT(aDoc, "aDoc is null");
if (!aDir) {
return NS_OK;
}
nsCOMPtr<nsIURI> docURI = aDoc->GetDocumentURI();
NS_PRECONDITION(docURI, "docURI is null");
MOZ_ASSERT(docURI, "docURI is null");
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService2> contentPrefService =
@ -2794,8 +2794,8 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue,
const nsAString* aOldValue,
uint32_t aFlags)
{
NS_PRECONDITION(GetValueMode() != VALUE_MODE_FILENAME,
"Don't call SetValueInternal for file inputs");
MOZ_ASSERT(GetValueMode() != VALUE_MODE_FILENAME,
"Don't call SetValueInternal for file inputs");
// We want to remember if the SetValueInternal() call is being made for a XUL
// element. We do that by looking at the parent node here, and if that node

Просмотреть файл

@ -420,80 +420,64 @@ HTMLLinkElement::GetHrefURI() const
return GetHrefURIForAnchors();
}
already_AddRefed<nsIURI>
HTMLLinkElement::GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal)
Maybe<nsStyleLinkElement::SheetInfo>
HTMLLinkElement::GetStyleSheetInfo()
{
*aIsInline = false;
*aTriggeringPrincipal = nullptr;
nsAutoString href;
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
if (href.IsEmpty()) {
return nullptr;
}
nsCOMPtr<nsIPrincipal> prin = mTriggeringPrincipal;
prin.forget(aTriggeringPrincipal);
nsCOMPtr<nsIURI> uri = Link::GetURI();
return uri.forget();
}
void
HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate)
{
aTitle.Truncate();
aType.Truncate();
aMedia.Truncate();
*aIsAlternate = false;
nsAutoString rel;
GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel);
uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(rel);
// Is it a stylesheet link?
if (!(linkTypes & nsStyleLinkElement::eSTYLESHEET)) {
return;
return Nothing();
}
nsAutoString title;
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
title.CompressWhitespace();
aTitle.Assign(title);
// If alternate, does it have title?
if (linkTypes & nsStyleLinkElement::eALTERNATE) {
if (aTitle.IsEmpty()) { // alternates must have title
return;
} else {
*aIsAlternate = true;
}
bool alternate = linkTypes & nsStyleLinkElement::eALTERNATE;
if (alternate && title.IsEmpty()) {
// alternates must have title.
return Nothing();
}
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
// that media queries should be ASCII lowercased during serialization.
nsContentUtils::ASCIIToLower(aMedia);
nsAutoString type;
nsAutoString mimeType;
nsAutoString notUsed;
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
nsContentUtils::SplitMimeType(type, mimeType, notUsed);
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
return;
return Nothing();
}
// If we get here we assume that we're loading a css file, so set the
// type to 'text/css'
aType.AssignLiteral("text/css");
}
nsAutoString href;
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
if (href.IsEmpty()) {
return Nothing();
}
CORSMode
HTMLLinkElement::GetCORSMode() const
{
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
nsAutoString media;
GetAttr(kNameSpaceID_None, nsGkAtoms::media, media);
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
// that media queries should be ASCII lowercased during serialization.
//
// FIXME(emilio): How does it matter? This is going to be parsed anyway, CSS
// should take care of serializing it properly.
nsContentUtils::ASCIIToLower(media);
nsCOMPtr<nsIURI> uri = Link::GetURI();
nsCOMPtr<nsIPrincipal> prin = mTriggeringPrincipal;
return Some(SheetInfo {
*OwnerDoc(),
this,
uri.forget(),
prin.forget(),
GetReferrerPolicyAsEnum(),
GetCORSMode(),
title,
media,
alternate ? HasAlternateRel::Yes : HasAlternateRel::No,
IsInline::No,
});
}
EventStates

Просмотреть файл

@ -189,12 +189,11 @@ public:
{
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
}
mozilla::net::ReferrerPolicy GetLinkReferrerPolicy() override
{
return GetReferrerPolicyAsEnum();
}
virtual CORSMode GetCORSMode() const override;
CORSMode GetCORSMode() const
{
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
}
void NodeInfoChanged(nsIDocument* aOldDoc) final
{
@ -208,13 +207,8 @@ protected:
virtual ~HTMLLinkElement();
// nsStyleLinkElement
already_AddRefed<nsIURI>
GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal) final;
Maybe<SheetInfo> GetStyleSheetInfo() final;
void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate) final;
protected:
RefPtr<nsDOMTokenList> mRelList;
};

Просмотреть файл

@ -120,7 +120,7 @@ HTMLSharedElement::IsAttributeMapped(const nsAtom* aAttribute) const
static void
SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
{
NS_PRECONDITION(aDocument, "Need a document!");
MOZ_ASSERT(aDocument, "Need a document!");
for (nsIContent* child = aDocument->GetFirstChild(); child;
child = child->GetNextNode()) {
@ -173,7 +173,7 @@ static void
SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
nsIContent* aMustMatch)
{
NS_PRECONDITION(aDocument, "Need a document!");
MOZ_ASSERT(aDocument, "Need a document!");
for (nsIContent* child = aDocument->GetFirstChild(); child;
child = child->GetNextNode()) {

Просмотреть файл

@ -194,47 +194,43 @@ HTMLStyleElement::SetTextContentInternal(const nsAString& aTextContent,
Unused << UpdateStyleSheetInternal(nullptr, nullptr);
}
already_AddRefed<nsIURI>
HTMLStyleElement::GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal)
Maybe<nsStyleLinkElement::SheetInfo>
HTMLStyleElement::GetStyleSheetInfo()
{
*aIsInline = true;
*aTriggeringPrincipal = do_AddRef(mTriggeringPrincipal).take();
return nullptr;
}
void
HTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate)
{
aTitle.Truncate();
aType.Truncate();
aMedia.Truncate();
*aIsAlternate = false;
nsAutoString title;
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
title.CompressWhitespace();
aTitle.Assign(title);
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
nsAutoString media;
GetAttr(kNameSpaceID_None, nsGkAtoms::media, media);
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
// that media queries should be ASCII lowercased during serialization.
nsContentUtils::ASCIIToLower(aMedia);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
//
// FIXME(emilio): Doesn't matter I'd think, style should take care of that.
nsContentUtils::ASCIIToLower(media);
nsAutoString type;
nsAutoString mimeType;
nsAutoString notUsed;
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
nsContentUtils::SplitMimeType(type, mimeType, notUsed);
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
return;
return Nothing();
}
// If we get here we assume that we're loading a css file, so set the
// type to 'text/css'
aType.AssignLiteral("text/css");
nsCOMPtr<nsIPrincipal> prin = mTriggeringPrincipal;
return Some(SheetInfo {
*OwnerDoc(),
this,
nullptr,
prin.forget(),
net::ReferrerPolicy::RP_Unset,
CORS_NONE,
title,
media,
HasAlternateRel::No,
IsInline::Yes,
});
}
JSObject*

Просмотреть файл

@ -84,12 +84,8 @@ public:
protected:
virtual ~HTMLStyleElement();
already_AddRefed<nsIURI>
GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal) final;
void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate) final;
Maybe<SheetInfo> GetStyleSheetInfo() final;
/**
* Common method to call from the various mutation observer methods.
* aContent is a content node that's either the one that changed or its

Просмотреть файл

@ -544,8 +544,8 @@ bool
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
EventChainVisitor& aVisitor)
{
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
"should be called only when |this| implements |Link|");
MOZ_ASSERT(nsCOMPtr<Link>(do_QueryObject(this)),
"should be called only when |this| implements |Link|");
if (!aVisitor.mPresContext) {
// We need a pres context to do link stuff. Some events (e.g. mutation
@ -589,7 +589,7 @@ nsGenericHTMLElement::PostHandleEventForAnchors(EventChainPostVisitor& aVisitor)
bool
nsGenericHTMLElement::IsHTMLLink(nsIURI** aURI) const
{
NS_PRECONDITION(aURI, "Must provide aURI out param");
MOZ_ASSERT(aURI, "Must provide aURI out param");
*aURI = GetHrefURIForAnchors().take();
// We promise out param is non-null if we return true, so base rv on it
@ -1683,7 +1683,7 @@ nsGenericHTMLFormElement::SaveSubtreeState()
void
nsGenericHTMLFormElement::SetForm(HTMLFormElement* aForm)
{
NS_PRECONDITION(aForm, "Don't pass null here");
MOZ_ASSERT(aForm, "Don't pass null here");
NS_ASSERTION(!mForm,
"We don't support switching from one non-null form to another.");
@ -2223,8 +2223,8 @@ void
nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
Element* aFormIdElement)
{
NS_PRECONDITION(!aBindToTree || !aFormIdElement,
"aFormIdElement shouldn't be set if aBindToTree is true!");
MOZ_ASSERT(!aBindToTree || !aFormIdElement,
"aFormIdElement shouldn't be set if aBindToTree is true!");
bool needStateUpdate = false;
if (!aBindToTree) {

Просмотреть файл

@ -84,7 +84,7 @@ nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
nsresult
nsGenericHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_PRECONDITION(aContentDocument, "Null out param");
MOZ_ASSERT(aContentDocument, "Null out param");
nsCOMPtr<nsIDOMDocument> document =
do_QueryInterface(GetContentDocument(*nsContentUtils::SubjectPrincipal()));
document.forget(aContentDocument);

Просмотреть файл

@ -785,7 +785,7 @@ HTMLContentSink::DidBuildModel(bool aTerminated)
NS_IMETHODIMP
HTMLContentSink::SetParser(nsParserBase* aParser)
{
NS_PRECONDITION(aParser, "Should have a parser here!");
MOZ_ASSERT(aParser, "Should have a parser here!");
mParser = aParser;
return NS_OK;
}
@ -968,7 +968,7 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
void
HTMLContentSink::NotifyRootInsertion()
{
NS_PRECONDITION(!mNotifiedRootInsertion, "Double-notifying on root?");
MOZ_ASSERT(!mNotifiedRootInsertion, "Double-notifying on root?");
NS_ASSERTION(!mLayoutStarted,
"How did we start layout without notifying on root?");
// Now make sure to notify that we have now inserted our root. If

Просмотреть файл

@ -1415,7 +1415,7 @@ nsJSURI::EqualsInternal(nsIURI* aOther,
bool* aResult)
{
NS_ENSURE_ARG_POINTER(aOther);
NS_PRECONDITION(aResult, "null pointer for outparam");
MOZ_ASSERT(aResult, "null pointer for outparam");
RefPtr<nsJSURI> otherJSURI;
nsresult rv = aOther->QueryInterface(kJSURICID,

Просмотреть файл

@ -64,13 +64,13 @@ public:
*/
nsIURI* GetScriptURI()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mUri;
}
nsIPrincipal* GetScriptURITriggeringPrincipal()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mSrcTriggeringPrincipal;
}
@ -97,7 +97,7 @@ public:
*/
bool GetScriptIsModule()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mIsModule;
}
@ -106,7 +106,7 @@ public:
*/
bool GetScriptDeferred()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mDefer;
}
@ -115,7 +115,7 @@ public:
*/
bool GetScriptAsync()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mAsync;
}
@ -124,7 +124,7 @@ public:
*/
bool GetScriptExternal()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mExternal;
}

Просмотреть файл

@ -734,8 +734,8 @@ NS_IMETHODIMP
nsCSPContext::SetRequestContext(nsIDOMDocument* aDOMDocument,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aDOMDocument || aPrincipal,
"Can't set context without doc or principal");
MOZ_ASSERT(aDOMDocument || aPrincipal,
"Can't set context without doc or principal");
NS_ENSURE_ARG(aDOMDocument || aPrincipal);
if (aDOMDocument) {

Просмотреть файл

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILBoolType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mBool = false;
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILBoolType::Init(nsSMILValue& aValue) const
void
SMILBoolType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mBool = false;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILBoolType::Destroy(nsSMILValue& aValue) const
nsresult
SMILBoolType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mBool = aSrc.mU.mBool;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILBoolType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mBool == aRight.mU.mBool;
}
@ -50,9 +50,8 @@ nsresult
SMILBoolType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // bool values can't be added to each other
}
@ -61,8 +60,8 @@ SMILBoolType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between bool values
}
@ -72,11 +71,11 @@ SMILBoolType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // bool values do not interpolate
}

Просмотреть файл

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILEnumType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mUint = 0;
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILEnumType::Init(nsSMILValue& aValue) const
void
SMILEnumType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mUint = 0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILEnumType::Destroy(nsSMILValue& aValue) const
nsresult
SMILEnumType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mUint = aSrc.mU.mUint;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILEnumType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mUint == aRight.mU.mUint;
}
@ -50,9 +50,9 @@ nsresult
SMILEnumType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // enum values can't be added to each other
}
@ -61,8 +61,8 @@ SMILEnumType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between enum values
}
@ -72,11 +72,11 @@ SMILEnumType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // enum values do not interpolate
}

Просмотреть файл

@ -22,7 +22,7 @@ SMILIntegerType::Init(nsSMILValue& aValue) const
void
SMILIntegerType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mInt = 0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILIntegerType::Destroy(nsSMILValue& aValue) const
nsresult
SMILIntegerType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mInt = aSrc.mU.mInt;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILIntegerType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mInt == aRight.mU.mInt;
}
@ -50,9 +50,9 @@ nsresult
SMILIntegerType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mInt += aValueToAdd.mU.mInt * aCount;
return NS_OK;
}
@ -62,8 +62,8 @@ SMILIntegerType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
aDistance = fabs(double(aTo.mU.mInt - aFrom.mU.mInt));
return NS_OK;
}
@ -74,11 +74,10 @@ SMILIntegerType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const double startVal = double(aStartVal.mU.mInt);
const double endVal = double(aEndVal.mU.mInt);

Просмотреть файл

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILStringType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mPtr = new nsString();
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILStringType::Init(nsSMILValue& aValue) const
void
SMILStringType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
delete static_cast<nsAString*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -31,8 +31,8 @@ SMILStringType::Destroy(nsSMILValue& aValue) const
nsresult
SMILStringType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const nsAString* src = static_cast<const nsAString*>(aSrc.mU.mPtr);
nsAString* dst = static_cast<nsAString*>(aDest.mU.mPtr);
@ -44,8 +44,8 @@ bool
SMILStringType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
const nsAString* leftString =
static_cast<const nsAString*>(aLeft.mU.mPtr);
@ -58,9 +58,9 @@ nsresult
SMILStringType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // string values can't be added to each other
}
@ -69,8 +69,8 @@ SMILStringType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between string values
}
@ -80,11 +80,10 @@ SMILStringType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // string values do not interpolate
}

Просмотреть файл

@ -12,7 +12,7 @@
void
nsSMILFloatType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mDouble = 0.0;
aValue.mType = this;
}
@ -20,7 +20,7 @@ nsSMILFloatType::Init(nsSMILValue& aValue) const
void
nsSMILFloatType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mDouble = 0.0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -28,8 +28,8 @@ nsSMILFloatType::Destroy(nsSMILValue& aValue) const
nsresult
nsSMILFloatType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mDouble = aSrc.mU.mDouble;
return NS_OK;
}
@ -38,8 +38,8 @@ bool
nsSMILFloatType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mDouble == aRight.mU.mDouble;
}
@ -48,9 +48,9 @@ nsresult
nsSMILFloatType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mDouble += aValueToAdd.mU.mDouble * aCount;
return NS_OK;
}
@ -60,8 +60,8 @@ nsSMILFloatType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
const double &from = aFrom.mU.mDouble;
const double &to = aTo.mU.mDouble;
@ -77,11 +77,11 @@ nsSMILFloatType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const double &startVal = aStartVal.mU.mDouble;
const double &endVal = aEndVal.mU.mDouble;

Просмотреть файл

@ -18,8 +18,8 @@ nsSMILNullType::Singleton()
nsresult
nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aSrc.mType == this, "Unexpected source type");
aDest.mU = aSrc.mU;
aDest.mType = Singleton();
return NS_OK;
@ -29,8 +29,8 @@ bool
nsSMILNullType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return true; // All null-typed values are equivalent.
}

Просмотреть файл

@ -24,7 +24,7 @@ SVGIntegerPairSMILType::Init(nsSMILValue& aValue) const
void
SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mIntPair[0] = 0;
aValue.mU.mIntPair[1] = 0;
aValue.mType = nsSMILNullType::Singleton();
@ -33,8 +33,8 @@ SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGIntegerPairSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mIntPair[0] = aSrc.mU.mIntPair[0];
aDest.mU.mIntPair[1] = aSrc.mU.mIntPair[1];
@ -45,8 +45,8 @@ bool
SVGIntegerPairSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mIntPair[0] == aRight.mU.mIntPair[0] &&
aLeft.mU.mIntPair[1] == aRight.mU.mIntPair[1];
@ -56,9 +56,9 @@ nsresult
SVGIntegerPairSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mIntPair[0] += aValueToAdd.mU.mIntPair[0] * aCount;
aDest.mU.mIntPair[1] += aValueToAdd.mU.mIntPair[1] * aCount;
@ -71,8 +71,8 @@ SVGIntegerPairSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
double delta[2];
delta[0] = aTo.mU.mIntPair[0] - aFrom.mU.mIntPair[0];
@ -88,11 +88,10 @@ SVGIntegerPairSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
double currentVal[2];
currentVal[0] = aStartVal.mU.mIntPair[0] +

Просмотреть файл

@ -36,7 +36,7 @@ SVGLengthListSMILType::Init(nsSMILValue &aValue) const
void
SVGLengthListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGLengthListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -46,8 +46,8 @@ nsresult
SVGLengthListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGLengthListAndInfo* src =
static_cast<const SVGLengthListAndInfo*>(aSrc.mU.mPtr);
@ -61,8 +61,8 @@ bool
SVGLengthListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGLengthListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGLengthListAndInfo*>(aRight.mU.mPtr);
@ -73,8 +73,8 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGLengthListAndInfo& dest =
*static_cast<SVGLengthListAndInfo*>(aDest.mU.mPtr);
@ -161,8 +161,8 @@ SVGLengthListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGLengthListAndInfo& from =
*static_cast<const SVGLengthListAndInfo*>(aFrom.mU.mPtr);
@ -231,11 +231,10 @@ SVGLengthListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGLengthListAndInfo& start =
*static_cast<const SVGLengthListAndInfo*>(aStartVal.mU.mPtr);

Просмотреть файл

@ -49,7 +49,7 @@ SVGNumberListSMILType::Init(nsSMILValue &aValue) const
void
SVGNumberListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGNumberListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -59,8 +59,8 @@ nsresult
SVGNumberListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGNumberListAndInfo* src =
static_cast<const SVGNumberListAndInfo*>(aSrc.mU.mPtr);
@ -74,8 +74,8 @@ bool
SVGNumberListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGNumberListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGNumberListAndInfo*>(aRight.mU.mPtr);
@ -86,8 +86,8 @@ SVGNumberListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGNumberListAndInfo& dest =
*static_cast<SVGNumberListAndInfo*>(aDest.mU.mPtr);
@ -133,8 +133,8 @@ SVGNumberListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGNumberListAndInfo& from =
*static_cast<const SVGNumberListAndInfo*>(aFrom.mU.mPtr);
@ -171,11 +171,10 @@ SVGNumberListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGNumberListAndInfo& start =
*static_cast<const SVGNumberListAndInfo*>(aStartVal.mU.mPtr);

Просмотреть файл

@ -26,7 +26,7 @@ SVGNumberPairSMILType::Init(nsSMILValue& aValue) const
void
SVGNumberPairSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mNumberPair[0] = 0;
aValue.mU.mNumberPair[1] = 0;
aValue.mType = nsSMILNullType::Singleton();
@ -35,8 +35,8 @@ SVGNumberPairSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGNumberPairSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mNumberPair[0] = aSrc.mU.mNumberPair[0];
aDest.mU.mNumberPair[1] = aSrc.mU.mNumberPair[1];
@ -47,8 +47,8 @@ bool
SVGNumberPairSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mNumberPair[0] == aRight.mU.mNumberPair[0] &&
aLeft.mU.mNumberPair[1] == aRight.mU.mNumberPair[1];
@ -58,9 +58,9 @@ nsresult
SVGNumberPairSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mNumberPair[0] += aValueToAdd.mU.mNumberPair[0] * aCount;
aDest.mU.mNumberPair[1] += aValueToAdd.mU.mNumberPair[1] * aCount;
@ -73,8 +73,8 @@ SVGNumberPairSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
double delta[2];
delta[0] = aTo.mU.mNumberPair[0] - aFrom.mU.mNumberPair[0];
@ -90,11 +90,10 @@ SVGNumberPairSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
aResult.mU.mNumberPair[0] =
float(aStartVal.mU.mNumberPair[0] +

Просмотреть файл

@ -32,7 +32,7 @@ SVGOrientSMILType::Init(nsSMILValue& aValue) const
void
SVGOrientSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value.");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value.");
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
}
@ -40,8 +40,8 @@ SVGOrientSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGOrientSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types.");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value.");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types.");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value.");
aDest.mU.mOrient.mAngle = aSrc.mU.mOrient.mAngle;
aDest.mU.mOrient.mUnit = aSrc.mU.mOrient.mUnit;
@ -53,8 +53,8 @@ bool
SVGOrientSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return
aLeft.mU.mOrient.mAngle == aRight.mU.mOrient.mAngle &&
@ -66,9 +66,9 @@ nsresult
SVGOrientSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
if (aDest.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aValueToAdd.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {
@ -98,8 +98,8 @@ SVGOrientSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
if (aFrom.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aTo.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {
@ -124,11 +124,10 @@ SVGOrientSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation.");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type.");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation.");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type.");
if (aStartVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aEndVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {

Просмотреть файл

@ -32,7 +32,7 @@ SVGPathSegListSMILType::Init(nsSMILValue &aValue) const
void
SVGPathSegListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGPathDataAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -42,8 +42,8 @@ nsresult
SVGPathSegListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGPathDataAndInfo* src =
static_cast<const SVGPathDataAndInfo*>(aSrc.mU.mPtr);
@ -57,8 +57,8 @@ bool
SVGPathSegListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGPathDataAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGPathDataAndInfo*>(aRight.mU.mPtr);
@ -400,8 +400,8 @@ SVGPathSegListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGPathDataAndInfo& dest =
*static_cast<SVGPathDataAndInfo*>(aDest.mU.mPtr);
@ -440,8 +440,8 @@ SVGPathSegListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
// See https://bugzilla.mozilla.org/show_bug.cgi?id=522306#c18
@ -455,11 +455,10 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGPathDataAndInfo& start =
*static_cast<const SVGPathDataAndInfo*>(aStartVal.mU.mPtr);

Просмотреть файл

@ -32,7 +32,7 @@ SVGPointListSMILType::Init(nsSMILValue &aValue) const
void
SVGPointListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGPointListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -42,8 +42,8 @@ nsresult
SVGPointListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGPointListAndInfo* src =
static_cast<const SVGPointListAndInfo*>(aSrc.mU.mPtr);
@ -57,8 +57,8 @@ bool
SVGPointListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGPointListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGPointListAndInfo*>(aRight.mU.mPtr);
@ -69,8 +69,8 @@ SVGPointListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGPointListAndInfo& dest =
*static_cast<SVGPointListAndInfo*>(aDest.mU.mPtr);
@ -112,8 +112,8 @@ SVGPointListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGPointListAndInfo& from =
*static_cast<const SVGPointListAndInfo*>(aFrom.mU.mPtr);
@ -151,11 +151,10 @@ SVGPointListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGPointListAndInfo& start =
*static_cast<const SVGPointListAndInfo*>(aStartVal.mU.mPtr);

Просмотреть файл

@ -216,42 +216,38 @@ SVGStyleElement::SetTitle(const nsAString& aTitle, ErrorResult& rv)
//----------------------------------------------------------------------
// nsStyleLinkElement methods
already_AddRefed<nsIURI>
SVGStyleElement::GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal)
Maybe<nsStyleLinkElement::SheetInfo>
SVGStyleElement::GetStyleSheetInfo()
{
*aIsInline = true;
*aTriggeringPrincipal = nullptr;
return nullptr;
}
void
SVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate)
{
*aIsAlternate = false;
nsAutoString title;
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
title.CompressWhitespace();
aTitle.Assign(title);
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
nsAutoString media;
GetAttr(kNameSpaceID_None, nsGkAtoms::media, media);
// The SVG spec is formulated in terms of the CSS2 spec,
// which specifies that media queries are case insensitive.
nsContentUtils::ASCIIToLower(aMedia);
nsContentUtils::ASCIIToLower(media);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
if (aType.IsEmpty()) {
aType.AssignLiteral("text/css");
// FIXME(emilio): Why doesn't this do the same as HTMLStyleElement?
nsAutoString type;
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
if (!type.IsEmpty() && !type.LowerCaseEqualsLiteral("text/css")) {
return Nothing();
}
}
CORSMode
SVGStyleElement::GetCORSMode() const
{
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
return Some(SheetInfo {
*OwnerDoc(),
this,
nullptr,
nullptr,
net::ReferrerPolicy::RP_Unset,
AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)),
title,
media,
HasAlternateRel::No,
IsInline::Yes,
});
}
} // namespace dom

Просмотреть файл

@ -84,15 +84,7 @@ protected:
}
// nsStyleLinkElement overrides
already_AddRefed<nsIURI>
GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal) final;
void GetStyleSheetInfo(nsAString& aTitle,
nsAString& aType,
nsAString& aMedia,
bool* aIsAlternate) final;
CORSMode GetCORSMode() const final;
Maybe<SheetInfo> GetStyleSheetInfo() final;
/**
* Common method to call from the various mutation observer methods.

Просмотреть файл

@ -22,7 +22,7 @@ typedef FallibleTArray<SVGTransformSMILData> TransformArray;
void
SVGTransformListSMILType::Init(nsSMILValue &aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
TransformArray* transforms = new TransformArray(1);
aValue.mU.mPtr = transforms;
@ -32,7 +32,7 @@ SVGTransformListSMILType::Init(nsSMILValue &aValue) const
void
SVGTransformListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
TransformArray* params = static_cast<TransformArray*>(aValue.mU.mPtr);
delete params;
aValue.mU.mPtr = nullptr;
@ -43,8 +43,8 @@ nsresult
SVGTransformListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const TransformArray* srcTransforms =
static_cast<const TransformArray*>(aSrc.mU.mPtr);
@ -60,8 +60,8 @@ bool
SVGTransformListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL type");
const TransformArray& leftArr
(*static_cast<const TransformArray*>(aLeft.mU.mPtr));
@ -90,8 +90,8 @@ SVGTransformListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
TransformArray& dstTransforms(*static_cast<TransformArray*>(aDest.mU.mPtr));
const TransformArray& srcTransforms
@ -142,8 +142,8 @@ nsresult
SVGTransformListSMILType::SandwichAdd(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
// For <animateTransform> a sandwich add means a matrix post-multiplication
// which just means to put the additional transform on the end of the array
@ -180,9 +180,9 @@ SVGTransformListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,
MOZ_ASSERT(aFrom.mType == aTo.mType,
"Can't compute difference between different SMIL types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
const TransformArray* fromTransforms =
static_cast<const TransformArray*>(aFrom.mU.mPtr);
@ -245,11 +245,10 @@ SVGTransformListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Can't interpolate between different SMIL types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected type for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Can't interpolate between different SMIL types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected type for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const TransformArray& startTransforms =
(*static_cast<const TransformArray*>(aStartVal.mU.mPtr));
@ -319,7 +318,7 @@ SVGTransformListSMILType::AppendTransform(
const SVGTransformSMILData& aTransform,
nsSMILValue& aValue)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
return transforms.AppendElement(aTransform, fallible) ?
@ -331,7 +330,7 @@ bool
SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList,
nsSMILValue& aValue)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
@ -352,7 +351,7 @@ bool
SVGTransformListSMILType::GetTransforms(const nsSMILValue& aValue,
FallibleTArray<nsSVGTransform>& aTransforms)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
const TransformArray& smilTransforms =
*static_cast<const TransformArray*>(aValue.mU.mPtr);

Просмотреть файл

@ -26,7 +26,7 @@ SVGViewBoxSMILType::Init(nsSMILValue& aValue) const
void
SVGViewBoxSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
delete static_cast<nsSVGViewBoxRect*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -35,8 +35,8 @@ SVGViewBoxSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGViewBoxSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const nsSVGViewBoxRect* src = static_cast<const nsSVGViewBoxRect*>(aSrc.mU.mPtr);
nsSVGViewBoxRect* dst = static_cast<nsSVGViewBoxRect*>(aDest.mU.mPtr);
@ -48,8 +48,8 @@ bool
SVGViewBoxSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
const nsSVGViewBoxRect* leftBox =
static_cast<const nsSVGViewBoxRect*>(aLeft.mU.mPtr);
@ -62,9 +62,9 @@ nsresult
SVGViewBoxSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
// See https://bugzilla.mozilla.org/show_bug.cgi?id=541884#c3 and the two
// comments that follow that one for arguments for and against allowing
@ -78,8 +78,8 @@ SVGViewBoxSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
const nsSVGViewBoxRect* from = static_cast<const nsSVGViewBoxRect*>(aFrom.mU.mPtr);
const nsSVGViewBoxRect* to = static_cast<const nsSVGViewBoxRect*>(aTo.mU.mPtr);
@ -110,11 +110,10 @@ SVGViewBoxSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const nsSVGViewBoxRect* start = static_cast<const nsSVGViewBoxRect*>(aStartVal.mU.mPtr);
const nsSVGViewBoxRect* end = static_cast<const nsSVGViewBoxRect*>(aEndVal.mU.mPtr);

Просмотреть файл

@ -7,7 +7,8 @@ authors = ["Kyle Machulis <kyle@nonpolynomial.com>", "J.C. Jones <jc@mozilla.com
libudev = "^0.2"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation-sys = "0.5.1"
core-foundation-sys = "0.6.0"
core-foundation = "0.6.0"
[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.2.8"

Просмотреть файл

@ -15,6 +15,9 @@ pub mod platform;
#[cfg(any(target_os = "macos"))]
extern crate core_foundation_sys;
#[cfg(any(target_os = "macos"))]
extern crate core_foundation;
#[cfg(any(target_os = "macos"))]
#[path = "macos/mod.rs"]
pub mod platform;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше