mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c on a CLOSED TREE.
This commit is contained in:
commit
e87437d94f
@ -1997,7 +1997,8 @@ public:
|
||||
}
|
||||
already_AddRefed<nsContentList>
|
||||
GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName);
|
||||
const nsAString& aLocalName,
|
||||
mozilla::ErrorResult& aResult);
|
||||
already_AddRefed<nsContentList>
|
||||
GetElementsByClassName(const nsAString& aClasses);
|
||||
// GetElementById defined above
|
||||
|
@ -217,9 +217,7 @@ void
|
||||
Link::SetSearch(const nsAString& aSearch)
|
||||
{
|
||||
SetSearchInternal(aSearch);
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
@ -487,9 +485,7 @@ Link::ResetLinkState(bool aNotify, bool aHasHref)
|
||||
|
||||
// If we've cached the URI, reset always invalidates it.
|
||||
mCachedURI = nullptr;
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
|
||||
// Update our state back to the default.
|
||||
mLinkState = defaultState;
|
||||
@ -589,16 +585,13 @@ Link::SetSearchParams(URLSearchParams* aSearchParams)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aSearchParams->HasURLAssociated()) {
|
||||
MOZ_ASSERT(aSearchParams->IsValid());
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->SetObserver(this);
|
||||
} else {
|
||||
CreateSearchParamsIfNeeded();
|
||||
mSearchParams->CopyFromURLSearchParams(*aSearchParams);
|
||||
if (mSearchParams) {
|
||||
mSearchParams->RemoveObserver(this);
|
||||
}
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->AddObserver(this);
|
||||
|
||||
nsAutoString search;
|
||||
mSearchParams->Serialize(search);
|
||||
SetSearchInternal(search);
|
||||
@ -607,7 +600,7 @@ Link::SetSearchParams(URLSearchParams* aSearchParams)
|
||||
void
|
||||
Link::URLSearchParamsUpdated()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams && mSearchParams->IsValid());
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
|
||||
nsString search;
|
||||
mSearchParams->Serialize(search);
|
||||
@ -615,9 +608,11 @@ Link::URLSearchParamsUpdated()
|
||||
}
|
||||
|
||||
void
|
||||
Link::URLSearchParamsNeedsUpdates()
|
||||
Link::UpdateURLSearchParams()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
if (!mSearchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString search;
|
||||
nsCOMPtr<nsIURI> uri(GetURI());
|
||||
@ -629,7 +624,7 @@ Link::URLSearchParamsNeedsUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
mSearchParams->ParseInput(search);
|
||||
mSearchParams->ParseInput(search, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -637,8 +632,8 @@ Link::CreateSearchParamsIfNeeded()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
mSearchParams = new URLSearchParams();
|
||||
mSearchParams->SetObserver(this);
|
||||
mSearchParams->Invalidate();
|
||||
mSearchParams->AddObserver(this);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,6 @@ public:
|
||||
|
||||
// URLSearchParamsObserver
|
||||
void URLSearchParamsUpdated() MOZ_OVERRIDE;
|
||||
void URLSearchParamsNeedsUpdates() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual ~Link();
|
||||
@ -134,6 +133,8 @@ protected:
|
||||
nsIURI* GetCachedURI() const { return mCachedURI; }
|
||||
bool HasCachedURI() const { return !!mCachedURI; }
|
||||
|
||||
void UpdateURLSearchParams();
|
||||
|
||||
// CC methods
|
||||
void Unlink();
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||
|
@ -5403,15 +5403,18 @@ nsDocument::GetElementsByTagName(const nsAString& aTagname,
|
||||
|
||||
already_AddRefed<nsContentList>
|
||||
nsIDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName)
|
||||
const nsAString& aLocalName,
|
||||
ErrorResult& aResult)
|
||||
{
|
||||
int32_t nameSpaceId = kNameSpaceID_Wildcard;
|
||||
|
||||
if (!aNamespaceURI.EqualsLiteral("*")) {
|
||||
nsresult rv =
|
||||
aResult =
|
||||
nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
if (aResult.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(nameSpaceId != kNameSpaceID_Unknown, "Unexpected namespace ID!");
|
||||
@ -5424,9 +5427,12 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
nsRefPtr<nsContentList> list =
|
||||
nsIDocument::GetElementsByTagNameNS(aNamespaceURI, aLocalName);
|
||||
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsIDocument::GetElementsByTagNameNS(aNamespaceURI, aLocalName, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
// transfer ref to aReturn
|
||||
*aReturn = list.forget().get();
|
||||
|
@ -221,10 +221,7 @@ URL::SetHref(const nsAString& aHref, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
aRv = mURI->SetSpec(href);
|
||||
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
@ -304,7 +301,7 @@ URL::SetHost(const nsAString& aHost)
|
||||
void
|
||||
URL::URLSearchParamsUpdated()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams && mSearchParams->IsValid());
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
|
||||
nsAutoString search;
|
||||
mSearchParams->Serialize(search);
|
||||
@ -312,9 +309,11 @@ URL::URLSearchParamsUpdated()
|
||||
}
|
||||
|
||||
void
|
||||
URL::URLSearchParamsNeedsUpdates()
|
||||
URL::UpdateURLSearchParams()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
if (!mSearchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString search;
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
|
||||
@ -325,7 +324,7 @@ URL::URLSearchParamsNeedsUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
mSearchParams->ParseInput(search);
|
||||
mSearchParams->ParseInput(search, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -426,10 +425,7 @@ void
|
||||
URL::SetSearch(const nsAString& aSearch)
|
||||
{
|
||||
SetSearchInternal(aSearch);
|
||||
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
@ -458,16 +454,14 @@ URL::SetSearchParams(URLSearchParams* aSearchParams)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aSearchParams->HasURLAssociated()) {
|
||||
MOZ_ASSERT(aSearchParams->IsValid());
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->SetObserver(this);
|
||||
} else {
|
||||
CreateSearchParamsIfNeeded();
|
||||
mSearchParams->CopyFromURLSearchParams(*aSearchParams);
|
||||
if (mSearchParams) {
|
||||
mSearchParams->RemoveObserver(this);
|
||||
}
|
||||
|
||||
// the observer will be cleared using the cycle collector.
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->AddObserver(this);
|
||||
|
||||
nsAutoString search;
|
||||
mSearchParams->Serialize(search);
|
||||
SetSearchInternal(search);
|
||||
@ -506,8 +500,8 @@ URL::CreateSearchParamsIfNeeded()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
mSearchParams = new URLSearchParams();
|
||||
mSearchParams->SetObserver(this);
|
||||
mSearchParams->Invalidate();
|
||||
mSearchParams->AddObserver(this);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,6 @@ public:
|
||||
|
||||
// URLSearchParamsObserver
|
||||
void URLSearchParamsUpdated() MOZ_OVERRIDE;
|
||||
void URLSearchParamsNeedsUpdates() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsIURI* GetURI() const
|
||||
@ -137,6 +136,8 @@ private:
|
||||
|
||||
void SetSearchInternal(const nsAString& aSearch);
|
||||
|
||||
void UpdateURLSearchParams();
|
||||
|
||||
static void CreateObjectURLInternal(const GlobalObject& aGlobal,
|
||||
nsISupports* aObject,
|
||||
const nsACString& aScheme,
|
||||
|
@ -9,7 +9,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(URLSearchParams, mObserver)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(URLSearchParams, mObservers)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(URLSearchParams)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(URLSearchParams)
|
||||
|
||||
@ -19,7 +19,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URLSearchParams)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
URLSearchParams::URLSearchParams()
|
||||
: mValid(false)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
@ -41,7 +40,7 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<URLSearchParams> sp = new URLSearchParams();
|
||||
sp->ParseInput(NS_ConvertUTF16toUTF8(aInit));
|
||||
sp->ParseInput(NS_ConvertUTF16toUTF8(aInit), nullptr);
|
||||
return sp.forget();
|
||||
}
|
||||
|
||||
@ -52,12 +51,12 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
||||
{
|
||||
nsRefPtr<URLSearchParams> sp = new URLSearchParams();
|
||||
aInit.mSearchParams.EnumerateRead(CopyEnumerator, sp);
|
||||
sp->mValid = true;
|
||||
return sp.forget();
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::ParseInput(const nsACString& aInput)
|
||||
URLSearchParams::ParseInput(const nsACString& aInput,
|
||||
URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
// Remove all the existing data before parsing a new input.
|
||||
DeleteAll();
|
||||
@ -109,7 +108,7 @@ URLSearchParams::ParseInput(const nsACString& aInput)
|
||||
NS_ConvertUTF8toUTF16(decodedValue));
|
||||
}
|
||||
|
||||
mValid = true;
|
||||
NotifyObservers(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
@ -165,18 +164,6 @@ URLSearchParams::DecodeString(const nsACString& aInput, nsACString& aOutput)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::CopyFromURLSearchParams(URLSearchParams& aSearchParams)
|
||||
{
|
||||
// The other SearchParams must be valid before copying its data.
|
||||
aSearchParams.Validate();
|
||||
|
||||
// Remove all the existing data before parsing a new input.
|
||||
DeleteAll();
|
||||
aSearchParams.mSearchParams.EnumerateRead(CopyEnumerator, this);
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
/* static */ PLDHashOperator
|
||||
URLSearchParams::CopyEnumerator(const nsAString& aName,
|
||||
nsTArray<nsString>* aArray,
|
||||
@ -192,27 +179,24 @@ URLSearchParams::CopyEnumerator(const nsAString& aName,
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::SetObserver(URLSearchParamsObserver* aObserver)
|
||||
URLSearchParams::AddObserver(URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(!mObserver);
|
||||
mObserver = aObserver;
|
||||
MOZ_ASSERT(aObserver);
|
||||
MOZ_ASSERT(!mObservers.Contains(aObserver));
|
||||
mObservers.AppendElement(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Validate()
|
||||
URLSearchParams::RemoveObserver(URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(mValid || mObserver);
|
||||
if (!mValid) {
|
||||
mObserver->URLSearchParamsNeedsUpdates();
|
||||
MOZ_ASSERT(mValid);
|
||||
}
|
||||
MOZ_ASSERT(aObserver);
|
||||
MOZ_ASSERT(mObservers.Contains(aObserver));
|
||||
mObservers.RemoveElement(aObserver);
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Get(const nsAString& aName, nsString& aRetval)
|
||||
{
|
||||
Validate();
|
||||
|
||||
nsTArray<nsString>* array;
|
||||
if (!mSearchParams.Get(aName, &array)) {
|
||||
aRetval.Truncate();
|
||||
@ -225,8 +209,6 @@ URLSearchParams::Get(const nsAString& aName, nsString& aRetval)
|
||||
void
|
||||
URLSearchParams::GetAll(const nsAString& aName, nsTArray<nsString>& aRetval)
|
||||
{
|
||||
Validate();
|
||||
|
||||
nsTArray<nsString>* array;
|
||||
if (!mSearchParams.Get(aName, &array)) {
|
||||
return;
|
||||
@ -238,10 +220,6 @@ URLSearchParams::GetAll(const nsAString& aName, nsTArray<nsString>& aRetval)
|
||||
void
|
||||
URLSearchParams::Set(const nsAString& aName, const nsAString& aValue)
|
||||
{
|
||||
// Before setting any new value we have to be sure to have all the previous
|
||||
// values in place.
|
||||
Validate();
|
||||
|
||||
nsTArray<nsString>* array;
|
||||
if (!mSearchParams.Get(aName, &array)) {
|
||||
array = new nsTArray<nsString>();
|
||||
@ -251,18 +229,14 @@ URLSearchParams::Set(const nsAString& aName, const nsAString& aValue)
|
||||
array->ElementAt(0) = aValue;
|
||||
}
|
||||
|
||||
NotifyObserver();
|
||||
NotifyObservers(nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Append(const nsAString& aName, const nsAString& aValue)
|
||||
{
|
||||
// Before setting any new value we have to be sure to have all the previous
|
||||
// values in place.
|
||||
Validate();
|
||||
|
||||
AppendInternal(aName, aValue);
|
||||
NotifyObserver();
|
||||
NotifyObservers(nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
@ -280,17 +254,12 @@ URLSearchParams::AppendInternal(const nsAString& aName, const nsAString& aValue)
|
||||
bool
|
||||
URLSearchParams::Has(const nsAString& aName)
|
||||
{
|
||||
Validate();
|
||||
return mSearchParams.Get(aName, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Delete(const nsAString& aName)
|
||||
{
|
||||
// Before deleting any value we have to be sure to have all the previous
|
||||
// values in place.
|
||||
Validate();
|
||||
|
||||
nsTArray<nsString>* array;
|
||||
if (!mSearchParams.Get(aName, &array)) {
|
||||
return;
|
||||
@ -298,7 +267,7 @@ URLSearchParams::Delete(const nsAString& aName)
|
||||
|
||||
mSearchParams.Remove(aName);
|
||||
|
||||
NotifyObserver();
|
||||
NotifyObservers(nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
@ -343,8 +312,6 @@ public:
|
||||
void
|
||||
URLSearchParams::Serialize(nsAString& aValue) const
|
||||
{
|
||||
MOZ_ASSERT(mValid);
|
||||
|
||||
SerializeData data;
|
||||
mSearchParams.EnumerateRead(SerializeEnumerator, &data);
|
||||
aValue.Assign(data.mValue);
|
||||
@ -373,18 +340,14 @@ URLSearchParams::SerializeEnumerator(const nsAString& aName,
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::NotifyObserver()
|
||||
URLSearchParams::NotifyObservers(URLSearchParamsObserver* aExceptObserver)
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->URLSearchParamsUpdated();
|
||||
for (uint32_t i = 0; i < mObservers.Length(); ++i) {
|
||||
if (mObservers[i] != aExceptObserver) {
|
||||
mObservers[i]->URLSearchParamsUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Invalidate()
|
||||
{
|
||||
mValid = false;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -23,7 +23,6 @@ public:
|
||||
virtual ~URLSearchParamsObserver() {}
|
||||
|
||||
virtual void URLSearchParamsUpdated() = 0;
|
||||
virtual void URLSearchParamsNeedsUpdates() = 0;
|
||||
};
|
||||
|
||||
class URLSearchParams MOZ_FINAL : public nsISupports,
|
||||
@ -36,11 +35,6 @@ public:
|
||||
URLSearchParams();
|
||||
~URLSearchParams();
|
||||
|
||||
bool HasURLAssociated() const
|
||||
{
|
||||
return !!mObserver;
|
||||
}
|
||||
|
||||
// WebIDL methods
|
||||
nsISupports* GetParentObject() const
|
||||
{
|
||||
@ -58,18 +52,11 @@ public:
|
||||
Constructor(const GlobalObject& aGlobal, URLSearchParams& aInit,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void ParseInput(const nsACString& aInput);
|
||||
void ParseInput(const nsACString& aInput,
|
||||
URLSearchParamsObserver* aObserver);
|
||||
|
||||
void CopyFromURLSearchParams(URLSearchParams& aSearchParams);
|
||||
|
||||
void SetObserver(URLSearchParamsObserver* aObserver);
|
||||
|
||||
void Invalidate();
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
return mValid;
|
||||
}
|
||||
void AddObserver(URLSearchParamsObserver* aObserver);
|
||||
void RemoveObserver(URLSearchParamsObserver* aObserver);
|
||||
|
||||
void Serialize(nsAString& aValue) const;
|
||||
|
||||
@ -87,7 +74,6 @@ public:
|
||||
|
||||
void Stringify(nsString& aRetval)
|
||||
{
|
||||
Validate();
|
||||
Serialize(aRetval);
|
||||
}
|
||||
|
||||
@ -98,7 +84,7 @@ private:
|
||||
|
||||
void DecodeString(const nsACString& aInput, nsACString& aOutput);
|
||||
|
||||
void NotifyObserver();
|
||||
void NotifyObservers(URLSearchParamsObserver* aExceptObserver);
|
||||
|
||||
static PLDHashOperator
|
||||
CopyEnumerator(const nsAString& aName, nsTArray<nsString>* aArray,
|
||||
@ -108,14 +94,9 @@ private:
|
||||
SerializeEnumerator(const nsAString& aName, nsTArray<nsString>* aArray,
|
||||
void *userData);
|
||||
|
||||
void
|
||||
Validate();
|
||||
|
||||
nsClassHashtable<nsStringHashKey, nsTArray<nsString>> mSearchParams;
|
||||
|
||||
nsRefPtr<URLSearchParamsObserver> mObserver;
|
||||
|
||||
bool mValid;
|
||||
nsTArray<nsRefPtr<URLSearchParamsObserver>> mObservers;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -238,6 +238,16 @@ KillTimers()
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
}
|
||||
|
||||
// If we collected a substantial amount of cycles, poke the GC since more objects
|
||||
// might be unreachable now.
|
||||
static bool
|
||||
NeedsGCAfterCC()
|
||||
{
|
||||
return sCCollectedWaitingForGC > 250 ||
|
||||
sLikelyShortLivingObjectsNeedingGC > 2500 ||
|
||||
sNeedsGCAfterCC;
|
||||
}
|
||||
|
||||
class nsJSEnvironmentObserver MOZ_FINAL : public nsIObserver
|
||||
{
|
||||
public:
|
||||
@ -263,6 +273,12 @@ nsJSEnvironmentObserver::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
nsJSContext::NonCompartmentGC,
|
||||
nsJSContext::ShrinkingGC);
|
||||
nsJSContext::CycleCollectNow();
|
||||
if (NeedsGCAfterCC()) {
|
||||
nsJSContext::GarbageCollectNow(JS::gcreason::MEM_PRESSURE,
|
||||
nsJSContext::NonIncrementalGC,
|
||||
nsJSContext::NonCompartmentGC,
|
||||
nsJSContext::ShrinkingGC);
|
||||
}
|
||||
} else if (!nsCRT::strcmp(aTopic, "quit-application")) {
|
||||
sShuttingDown = true;
|
||||
KillTimers();
|
||||
@ -2215,11 +2231,7 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
||||
|
||||
sCCollectedWaitingForGC += aResults.mFreedRefCounted + aResults.mFreedGCed;
|
||||
|
||||
// If we collected a substantial amount of cycles, poke the GC since more objects
|
||||
// might be unreachable now.
|
||||
if (sCCollectedWaitingForGC > 250 ||
|
||||
sLikelyShortLivingObjectsNeedingGC > 2500 ||
|
||||
sNeedsGCAfterCC) {
|
||||
if (NeedsGCAfterCC()) {
|
||||
PokeGC(JS::gcreason::CC_WAITING);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
|
||||
var url2 = new URL('http://www.example.net?e=f');
|
||||
url.searchParams = url2.searchParams;
|
||||
isnot(url.searchParams, url2.searchParams, "URL.searchParams is not the same object");
|
||||
is(url.searchParams, url2.searchParams, "URL.searchParams is not the same object");
|
||||
is(url.searchParams.get('e'), 'f', "URL.searchParams.get('e')");
|
||||
|
||||
url.href = "http://www.example.net?bar=foo";
|
||||
@ -170,7 +170,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
|
||||
var url2 = new URL('http://www.example.net?e=f');
|
||||
e.searchParams = url2.searchParams;
|
||||
isnot(e.searchParams, url2.searchParams, "e.searchParams is not the same object");
|
||||
is(e.searchParams, url2.searchParams, "e.searchParams is not the same object");
|
||||
is(e.searchParams.get('e'), 'f', "e.searchParams.get('e')");
|
||||
|
||||
e.href = "http://www.example.net?bar=foo";
|
||||
@ -203,6 +203,45 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testMultiURL() {
|
||||
var a = new URL('http://www.example.net?a=b&c=d');
|
||||
var b = new URL('http://www.example.net?e=f');
|
||||
var c = document.createElement('a');
|
||||
var d = document.createElement('area');
|
||||
ok(a.searchParams.has('a'), "a.searchParams.has('a')");
|
||||
ok(a.searchParams.has('c'), "a.searchParams.has('c')");
|
||||
ok(b.searchParams.has('e'), "b.searchParams.has('e')");
|
||||
ok(c.searchParams, "c.searchParams");
|
||||
ok(d.searchParams, "d.searchParams");
|
||||
|
||||
var u = new URLSearchParams();
|
||||
a.searchParams = b.searchParams = c.searchParams = d.searchParams = u;
|
||||
is(a.searchParams, u, "a.searchParams === u");
|
||||
is(b.searchParams, u, "b.searchParams === u");
|
||||
is(c.searchParams, u, "c.searchParams === u");
|
||||
is(d.searchParams, u, "d.searchParams === u");
|
||||
ok(!a.searchParams.has('a'), "!a.searchParams.has('a')");
|
||||
ok(!a.searchParams.has('c'), "!a.searchParams.has('c')");
|
||||
ok(!b.searchParams.has('e'), "!b.searchParams.has('e')");
|
||||
|
||||
u.append('foo', 'bar');
|
||||
is(a.searchParams.get('foo'), 'bar', "a has foo=bar");
|
||||
is(b.searchParams.get('foo'), 'bar', "b has foo=bar");
|
||||
is(c.searchParams.get('foo'), 'bar', "c has foo=bar");
|
||||
is(d.searchParams.get('foo'), 'bar', "d has foo=bar");
|
||||
is(a + "", b + "", "stringify a == b");
|
||||
is(c.searchParams + "", b.searchParams + "", "stringify c.searchParams == b.searchParams");
|
||||
is(d.searchParams + "", b.searchParams + "", "stringify d.searchParams == b.searchParams");
|
||||
|
||||
a.search = "?bar=foo";
|
||||
is(a.searchParams.get('bar'), 'foo', "a has bar=foo");
|
||||
is(b.searchParams.get('bar'), 'foo', "b has bar=foo");
|
||||
is(c.searchParams.get('bar'), 'foo', "c has bar=foo");
|
||||
is(d.searchParams.get('bar'), 'foo', "d has bar=foo");
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
var tests = [
|
||||
testSimpleURLSearchParams,
|
||||
testCopyURLSearchParams,
|
||||
@ -210,7 +249,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
testURL,
|
||||
function() { testElement(document.getElementById('anchor')) },
|
||||
function() { testElement(document.getElementById('area')) },
|
||||
testEncoding
|
||||
testEncoding,
|
||||
testMultiURL
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
|
@ -32,5 +32,6 @@ support-files =
|
||||
[test_namedNoIndexed.html]
|
||||
[test_queryInterface.html]
|
||||
[test_sequence_wrapping.html]
|
||||
[test_throwing_method_noDCE.html]
|
||||
[test_treat_non_object_as_null.html]
|
||||
[test_traceProtos.html]
|
||||
|
27
dom/bindings/test/test_throwing_method_noDCE.html
Normal file
27
dom/bindings/test/test_throwing_method_noDCE.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that we don't DCE functions that can throw</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
function test(root) {
|
||||
var threw = false;
|
||||
try {
|
||||
root.querySelectorAll("");
|
||||
} catch(e){ threw = true; };
|
||||
// Hot loop to make sure the JIT heuristics ion-compile this function even
|
||||
// though it's throwing exceptions (which would normally make us back off
|
||||
// of ion compilation).
|
||||
for (var i=0; i<1500; i++) {}
|
||||
return threw;
|
||||
}
|
||||
|
||||
var threw = false;
|
||||
var el = document.createElement("div");
|
||||
for (var i=0; i<200; i++)
|
||||
threw = test(el);
|
||||
assert_true(threw);
|
||||
}, "Shouldn't optimize away throwing functions");
|
||||
</script>
|
@ -13,10 +13,9 @@
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Network API **/
|
||||
|
||||
function checkInterface(aInterface) {
|
||||
ok(!(aInterface in window), aInterface + " should be prefixed");
|
||||
ok(("Moz" + aInterface) in window, aInterface + " should be prefixed");
|
||||
ok(!(aInterface in window), aInterface + " should not exist");
|
||||
ok(!(("Moz" + aInterface) in window), aInterface + " should not exist");
|
||||
}
|
||||
|
||||
function test() {
|
||||
@ -24,8 +23,6 @@ function test() {
|
||||
|
||||
ok(navigator.mozConnection, "navigator.mozConnection returns an object");
|
||||
|
||||
ok(navigator.mozConnection instanceof MozConnection,
|
||||
"navigator.mozConnection is a MozConnection object");
|
||||
ok(navigator.mozConnection instanceof EventTarget,
|
||||
"navigator.mozConnection is a EventTarget object");
|
||||
|
||||
|
@ -610,8 +610,6 @@ var interfaceNamesInGlobalScope =
|
||||
{name: "MozCellBroadcast", b2g: true, pref: "dom.cellbroadcast.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MozCellBroadcastEvent", b2g: true, pref: "dom.cellbroadcast.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MozConnection", pref: "dom.network.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"mozContact",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
@ -45,7 +45,7 @@ interface Document : Node {
|
||||
readonly attribute Element? documentElement;
|
||||
[Pure]
|
||||
HTMLCollection getElementsByTagName(DOMString localName);
|
||||
[Pure]
|
||||
[Pure, Throws]
|
||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||
[Pure]
|
||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.network.enabled"]
|
||||
[Pref="dom.network.enabled", NoInterfaceObject]
|
||||
interface MozConnection : EventTarget {
|
||||
readonly attribute unrestricted double bandwidth;
|
||||
readonly attribute boolean metered;
|
||||
|
@ -614,9 +614,7 @@ URL::SetHref(const nsAString& aHref, ErrorResult& aRv)
|
||||
JS_ReportPendingException(mWorkerPrivate->GetJSContext());
|
||||
}
|
||||
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
@ -822,10 +820,7 @@ void
|
||||
URL::SetSearch(const nsAString& aSearch)
|
||||
{
|
||||
SetSearchInternal(aSearch);
|
||||
|
||||
if (mSearchParams) {
|
||||
mSearchParams->Invalidate();
|
||||
}
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
@ -855,16 +850,12 @@ URL::SetSearchParams(URLSearchParams* aSearchParams)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aSearchParams->HasURLAssociated()) {
|
||||
MOZ_ASSERT(aSearchParams->IsValid());
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->SetObserver(this);
|
||||
} else {
|
||||
CreateSearchParamsIfNeeded();
|
||||
mSearchParams->CopyFromURLSearchParams(*aSearchParams);
|
||||
if (mSearchParams) {
|
||||
mSearchParams->RemoveObserver(this);
|
||||
}
|
||||
|
||||
mSearchParams = aSearchParams;
|
||||
mSearchParams->AddObserver(this);
|
||||
|
||||
nsString search;
|
||||
mSearchParams->Serialize(search);
|
||||
@ -950,7 +941,7 @@ URL::RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aUrl)
|
||||
void
|
||||
URL::URLSearchParamsUpdated()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams && mSearchParams->IsValid());
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
|
||||
nsString search;
|
||||
mSearchParams->Serialize(search);
|
||||
@ -958,13 +949,13 @@ URL::URLSearchParamsUpdated()
|
||||
}
|
||||
|
||||
void
|
||||
URL::URLSearchParamsNeedsUpdates()
|
||||
URL::UpdateURLSearchParams()
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
|
||||
nsString search;
|
||||
GetSearch(search);
|
||||
mSearchParams->ParseInput(NS_ConvertUTF16toUTF8(Substring(search, 1)));
|
||||
if (mSearchParams) {
|
||||
nsString search;
|
||||
GetSearch(search);
|
||||
mSearchParams->ParseInput(NS_ConvertUTF16toUTF8(Substring(search, 1)), this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -972,8 +963,8 @@ URL::CreateSearchParamsIfNeeded()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
mSearchParams = new URLSearchParams();
|
||||
mSearchParams->SetObserver(this);
|
||||
mSearchParams->Invalidate();
|
||||
mSearchParams->AddObserver(this);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,6 @@ public:
|
||||
|
||||
// IURLSearchParamsObserver
|
||||
void URLSearchParamsUpdated() MOZ_OVERRIDE;
|
||||
void URLSearchParamsNeedsUpdates() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
URLProxy* GetURLProxy() const
|
||||
@ -131,6 +130,8 @@ private:
|
||||
|
||||
void SetSearchInternal(const nsAString& aSearch);
|
||||
|
||||
void UpdateURLSearchParams();
|
||||
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
nsRefPtr<URLProxy> mURLProxy;
|
||||
nsRefPtr<URLSearchParams> mSearchParams;
|
||||
|
@ -8,11 +8,6 @@ function is(a, b, msg) {
|
||||
postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
|
||||
}
|
||||
|
||||
function isnot(a, b, msg) {
|
||||
dump("ISNOT: " + (a!==b) + " => " + a + " | " + b + " " + msg + "\n");
|
||||
postMessage({type: 'status', status: a !== b, msg: a + " !== " + b + ": " + msg });
|
||||
}
|
||||
|
||||
onmessage = function() {
|
||||
status = false;
|
||||
try {
|
||||
@ -134,7 +129,7 @@ onmessage = function() {
|
||||
|
||||
var url2 = new URL('http://www.example.net?e=f');
|
||||
url.searchParams = url2.searchParams;
|
||||
isnot(url.searchParams, url2.searchParams, "URL.searchParams is not the same object");
|
||||
is(url.searchParams, url2.searchParams, "URL.searchParams is not the same object");
|
||||
is(url.searchParams.get('e'), 'f', "URL.searchParams.get('e')");
|
||||
|
||||
url.href = "http://www.example.net?bar=foo";
|
||||
@ -164,12 +159,39 @@ onmessage = function() {
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testMultiURL() {
|
||||
var a = new URL('http://www.example.net?a=b&c=d');
|
||||
var b = new URL('http://www.example.net?e=f');
|
||||
ok(a.searchParams.has('a'), "a.searchParams.has('a')");
|
||||
ok(a.searchParams.has('c'), "a.searchParams.has('c')");
|
||||
ok(b.searchParams.has('e'), "b.searchParams.has('e')");
|
||||
|
||||
var u = new URLSearchParams();
|
||||
a.searchParams = b.searchParams = u;
|
||||
is(a.searchParams, u, "a.searchParams === u");
|
||||
is(b.searchParams, u, "b.searchParams === u");
|
||||
ok(!a.searchParams.has('a'), "!a.searchParams.has('a')");
|
||||
ok(!a.searchParams.has('c'), "!a.searchParams.has('c')");
|
||||
ok(!b.searchParams.has('e'), "!b.searchParams.has('e')");
|
||||
|
||||
u.append('foo', 'bar');
|
||||
is(a.searchParams.get('foo'), 'bar', "a has foo=bar");
|
||||
is(b.searchParams.get('foo'), 'bar', "b has foo=bar");
|
||||
is(a + "", b + "", "stringify a == b");
|
||||
|
||||
a.search = "?bar=foo";
|
||||
is(a.searchParams.get('bar'), 'foo', "a has bar=foo");
|
||||
is(b.searchParams.get('bar'), 'foo', "b has bar=foo");
|
||||
|
||||
runTest();
|
||||
}
|
||||
var tests = [
|
||||
testSimpleURLSearchParams,
|
||||
testCopyURLSearchParams,
|
||||
testParserURLSearchParams,
|
||||
testURL,
|
||||
testEncoding
|
||||
testEncoding,
|
||||
testMultiURL
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
|
@ -672,10 +672,7 @@ MCall::New(TempAllocator &alloc, JSFunction *target, size_t maxArgc, size_t numA
|
||||
AliasSet
|
||||
MCallDOMNative::getAliasSet() const
|
||||
{
|
||||
JS_ASSERT(getSingleTarget() && getSingleTarget()->isNative());
|
||||
|
||||
const JSJitInfo *jitInfo = getSingleTarget()->jitInfo();
|
||||
JS_ASSERT(jitInfo);
|
||||
const JSJitInfo *jitInfo = getJitInfo();
|
||||
|
||||
JS_ASSERT(jitInfo->aliasSet() != JSJitInfo::AliasNone);
|
||||
// If we don't know anything about the types of our arguments, we have to
|
||||
@ -723,10 +720,7 @@ MCallDOMNative::computeMovable()
|
||||
// We are movable if the jitinfo says we can be and if we're also not
|
||||
// effectful. The jitinfo can't check for the latter, since it depends on
|
||||
// the types of our arguments.
|
||||
JS_ASSERT(getSingleTarget() && getSingleTarget()->isNative());
|
||||
|
||||
const JSJitInfo *jitInfo = getSingleTarget()->jitInfo();
|
||||
JS_ASSERT(jitInfo);
|
||||
const JSJitInfo *jitInfo = getJitInfo();
|
||||
|
||||
JS_ASSERT_IF(jitInfo->isMovable,
|
||||
jitInfo->aliasSet() != JSJitInfo::AliasEverything);
|
||||
@ -770,6 +764,17 @@ MCallDOMNative::congruentTo(MDefinition *ins) const
|
||||
return true;
|
||||
}
|
||||
|
||||
const JSJitInfo *
|
||||
MCallDOMNative::getJitInfo() const
|
||||
{
|
||||
JS_ASSERT(getSingleTarget() && getSingleTarget()->isNative());
|
||||
|
||||
const JSJitInfo *jitInfo = getSingleTarget()->jitInfo();
|
||||
JS_ASSERT(jitInfo);
|
||||
|
||||
return jitInfo;
|
||||
}
|
||||
|
||||
MApplyArgs *
|
||||
MApplyArgs::New(TempAllocator &alloc, JSFunction *target, MDefinition *fun, MDefinition *argc,
|
||||
MDefinition *self)
|
||||
|
@ -1954,11 +1954,20 @@ class MCallDOMNative : public MCall
|
||||
MCallDOMNative(JSFunction *target, uint32_t numActualArgs)
|
||||
: MCall(target, numActualArgs, false)
|
||||
{
|
||||
// If our jitinfo is not marked movable, that means that our C++
|
||||
// implementation is fallible or that we have no hope of ever doing the
|
||||
// sort of argument analysis that would allow us to detemine that we're
|
||||
// side-effect-free. In the latter case we wouldn't get DCEd no matter
|
||||
// what, but for the former case we have to explicitly say that we can't
|
||||
// be DCEd.
|
||||
if (!getJitInfo()->isMovable)
|
||||
setGuard();
|
||||
}
|
||||
|
||||
friend MCall *MCall::New(TempAllocator &alloc, JSFunction *target, size_t maxArgc,
|
||||
size_t numActualArgs, bool construct, bool isDOMCall);
|
||||
|
||||
const JSJitInfo *getJitInfo() const;
|
||||
public:
|
||||
virtual AliasSet getAliasSet() const MOZ_OVERRIDE;
|
||||
|
||||
@ -8032,6 +8041,11 @@ class MGetDOMProperty
|
||||
if (isDomMovable()) {
|
||||
JS_ASSERT(jitinfo->aliasSet() != JSJitInfo::AliasEverything);
|
||||
setMovable();
|
||||
} else {
|
||||
// If we're not movable, that means we shouldn't be DCEd either,
|
||||
// because we might throw an exception when called, and getting rid
|
||||
// of that is observable.
|
||||
setGuard();
|
||||
}
|
||||
|
||||
setResultType(MIRType_Value);
|
||||
|
@ -67,11 +67,11 @@ fuzzy-if(B2G,10,3) random-if(winWidget) == flexbox-align-self-baseline-horiz-3.x
|
||||
# (with existing [div | span | text] inside the flexbox, and new content
|
||||
# inserted adjacent to that existing content.)
|
||||
== flexbox-dyn-insertAroundDiv-1.xhtml flexbox-dyn-insertAroundDiv-1-ref.xhtml
|
||||
fuzzy-if(d2d&&layersGPUAccelerated,24,14) == flexbox-dyn-insertAroundDiv-2.xhtml flexbox-dyn-insertAroundDiv-2-ref.xhtml # bug 849692
|
||||
== flexbox-dyn-insertAroundDiv-2.xhtml flexbox-dyn-insertAroundDiv-2-ref.xhtml
|
||||
== flexbox-dyn-insertAroundDiv-3.xhtml flexbox-dyn-insertAroundDiv-3-ref.xhtml
|
||||
|
||||
== flexbox-dyn-insertAroundSpan-1.xhtml flexbox-dyn-insertAroundDiv-1-ref.xhtml
|
||||
fuzzy-if(d2d&&layersGPUAccelerated,24,14) == flexbox-dyn-insertAroundSpan-2.xhtml flexbox-dyn-insertAroundDiv-2-ref.xhtml # bug 849692
|
||||
== flexbox-dyn-insertAroundSpan-2.xhtml flexbox-dyn-insertAroundDiv-2-ref.xhtml
|
||||
== flexbox-dyn-insertAroundSpan-3.xhtml flexbox-dyn-insertAroundDiv-3-ref.xhtml
|
||||
|
||||
== flexbox-dyn-insertAroundText-1.xhtml flexbox-dyn-insertAroundText-1-ref.xhtml
|
||||
|
@ -301,7 +301,7 @@ public class GeckoAccessibility {
|
||||
default:
|
||||
info.setParent(host);
|
||||
info.setSource(host, virtualDescendantId);
|
||||
info.setVisibleToUser(host.isFocused());
|
||||
info.setVisibleToUser(host.isShown());
|
||||
info.setPackageName(GeckoAppShell.getContext().getPackageName());
|
||||
info.setClassName(host.getClass().getName());
|
||||
info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
|
||||
|
@ -2644,7 +2644,7 @@ PlacesEditBookmarkURITransaction.prototype = {
|
||||
// only untag the old URI if this is the only bookmark
|
||||
if (PlacesUtils.getBookmarksForURI(this.item.uri, {}).length == 0)
|
||||
PlacesUtils.tagging.untagURI(this.item.uri, this.item.tags);
|
||||
PlacesUtils.tagging.tagURI(this.new.URI, this.item.tags);
|
||||
PlacesUtils.tagging.tagURI(this.new.uri, this.item.tags);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -123,9 +123,9 @@ Link::URLSearchParamsUpdated()
|
||||
}
|
||||
|
||||
void
|
||||
Link::URLSearchParamsNeedsUpdates()
|
||||
Link::UpdateURLSearchParams()
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to Link::URLSearchParamsNeedsUpdates");
|
||||
NS_NOTREACHED("Unexpected call to Link::UpdateURLSearchParams");
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(URLSearchParams)
|
||||
@ -159,19 +159,20 @@ URLSearchParams::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::ParseInput(const nsACString& aInput)
|
||||
URLSearchParams::ParseInput(const nsACString& aInput,
|
||||
URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::ParseInput");
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::CopyFromURLSearchParams(URLSearchParams& aSearchParams)
|
||||
URLSearchParams::AddObserver(URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::CopyFromURLSearchParams");
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::SetObserver");
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::SetObserver(URLSearchParamsObserver* aObserver)
|
||||
URLSearchParams::RemoveObserver(URLSearchParamsObserver* aObserver)
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::SetObserver");
|
||||
}
|
||||
@ -232,18 +233,11 @@ URLSearchParams::DeleteAll()
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::NotifyObserver()
|
||||
URLSearchParams::NotifyObservers(URLSearchParamsObserver* aExceptObserver)
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::NotifyObserver");
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::NotifyObservers");
|
||||
}
|
||||
|
||||
void
|
||||
URLSearchParams::Invalidate()
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to URLSearchParams::Invalidate");
|
||||
}
|
||||
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -4,111 +4,92 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Get history services
|
||||
try {
|
||||
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
var bhist = histsvc.QueryInterface(Ci.nsIBrowserHistory);
|
||||
} catch(ex) {
|
||||
do_throw("Could not get history services\n");
|
||||
}
|
||||
|
||||
// Get bookmark service
|
||||
try {
|
||||
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
}
|
||||
catch(ex) {
|
||||
do_throw("Could not get the nav-bookmarks-service\n");
|
||||
}
|
||||
|
||||
// Get tagging service
|
||||
try {
|
||||
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
|
||||
getService(Ci.nsITaggingService);
|
||||
} catch(ex) {
|
||||
do_throw("Could not get tagging service\n");
|
||||
}
|
||||
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
var uri1 = uri("http://foo.bar/");
|
||||
let uri1 = NetUtil.newURI("http://foo.bar/");
|
||||
|
||||
// create 2 bookmarks
|
||||
var bookmark1id = bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, uri1,
|
||||
bmsvc.DEFAULT_INDEX, "title 1");
|
||||
var bookmark2id = bmsvc.insertBookmark(bmsvc.toolbarFolder, uri1,
|
||||
bmsvc.DEFAULT_INDEX, "title 2");
|
||||
let bookmark1id = PlacesUtils.bookmarks
|
||||
.insertBookmark(PlacesUtils.bookmarksMenuFolderId,
|
||||
uri1,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"title 1");
|
||||
let bookmark2id = PlacesUtils.bookmarks
|
||||
.insertBookmark(PlacesUtils.toolbarFolderId,
|
||||
uri1,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"title 2");
|
||||
// add a new tag
|
||||
tagssvc.tagURI(uri1, ["foo"]);
|
||||
PlacesUtils.tagging.tagURI(uri1, ["foo"]);
|
||||
|
||||
// get tag folder id
|
||||
var options = histsvc.getNewQueryOptions();
|
||||
var query = histsvc.getNewQuery();
|
||||
query.setFolders([bmsvc.tagsFolder], 1);
|
||||
var result = histsvc.executeQuery(query, options);
|
||||
var tagRoot = result.root;
|
||||
let options = PlacesUtils.history.getNewQueryOptions();
|
||||
let query = PlacesUtils.history.getNewQuery();
|
||||
query.setFolders([PlacesUtils.tagsFolderId], 1);
|
||||
let result = PlacesUtils.history.executeQuery(query, options);
|
||||
let tagRoot = result.root;
|
||||
tagRoot.containerOpen = true;
|
||||
var tagNode = tagRoot.getChild(0)
|
||||
let tagNode = tagRoot.getChild(0)
|
||||
.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
var tagItemId = tagNode.itemId;
|
||||
let tagItemId = tagNode.itemId;
|
||||
tagRoot.containerOpen = false;
|
||||
|
||||
// change bookmark 1 title
|
||||
bmsvc.setItemTitle(bookmark1id, "new title 1");
|
||||
PlacesUtils.bookmarks.setItemTitle(bookmark1id, "new title 1");
|
||||
|
||||
// Workaround timers resolution and time skews.
|
||||
let bookmark2LastMod = PlacesUtils.bookmarks.getItemLastModified(bookmark2id);
|
||||
PlacesUtils.bookmarks.setItemLastModified(bookmark1id, bookmark2LastMod + 1);
|
||||
|
||||
// Query the tag.
|
||||
options = histsvc.getNewQueryOptions();
|
||||
options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
|
||||
options.resultType = options.RESULTS_AS_TAG_QUERY;
|
||||
|
||||
query = histsvc.getNewQuery();
|
||||
result = histsvc.executeQuery(query, options);
|
||||
var root = result.root;
|
||||
query = PlacesUtils.history.getNewQuery();
|
||||
result = PlacesUtils.history.executeQuery(query, options);
|
||||
let root = result.root;
|
||||
root.containerOpen = true;
|
||||
do_check_eq(root.childCount, 1);
|
||||
|
||||
var theTag = root.getChild(0)
|
||||
let theTag = root.getChild(0)
|
||||
.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
// Bug 524219: Check that renaming the tag shows up in the result.
|
||||
do_check_eq(theTag.title, "foo")
|
||||
bmsvc.setItemTitle(tagItemId, "bar");
|
||||
PlacesUtils.bookmarks.setItemTitle(tagItemId, "bar");
|
||||
|
||||
// Check that the item has been replaced
|
||||
do_check_neq(theTag, root.getChild(0));
|
||||
var theTag = root.getChild(0)
|
||||
theTag = root.getChild(0)
|
||||
.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
do_check_eq(theTag.title, "bar");
|
||||
|
||||
// Check that tag container contains new title
|
||||
theTag.containerOpen = true;
|
||||
do_check_eq(theTag.childCount, 1);
|
||||
var node = theTag.getChild(0);
|
||||
let node = theTag.getChild(0);
|
||||
do_check_eq(node.title, "new title 1");
|
||||
theTag.containerOpen = false;
|
||||
root.containerOpen = false;
|
||||
|
||||
// Change bookmark 2 title.
|
||||
bmsvc.setItemTitle(bookmark2id, "new title 2");
|
||||
PlacesUtils.bookmarks.setItemTitle(bookmark2id, "new title 2");
|
||||
|
||||
// Workaround VM timers issues.
|
||||
var bookmark1LastMod = bmsvc.getItemLastModified(bookmark1id);
|
||||
bmsvc.setItemLastModified(bookmark2id, bookmark1LastMod + 1);
|
||||
// Workaround timers resolution and time skews.
|
||||
let bookmark1LastMod = PlacesUtils.bookmarks.getItemLastModified(bookmark1id);
|
||||
PlacesUtils.bookmarks.setItemLastModified(bookmark2id, bookmark1LastMod + 1);
|
||||
|
||||
// Check that tag container contains new title
|
||||
options = histsvc.getNewQueryOptions();
|
||||
options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
|
||||
options.resultType = options.RESULTS_AS_TAG_CONTENTS;
|
||||
|
||||
query = histsvc.getNewQuery();
|
||||
query = PlacesUtils.history.getNewQuery();
|
||||
query.setFolders([tagItemId], 1);
|
||||
result = histsvc.executeQuery(query, options);
|
||||
result = PlacesUtils.history.executeQuery(query, options);
|
||||
root = result.root;
|
||||
|
||||
root.containerOpen = true;
|
||||
var cc = root.childCount;
|
||||
do_check_eq(cc, 1);
|
||||
do_check_eq(root.childCount, 1);
|
||||
node = root.getChild(0);
|
||||
do_check_eq(node.title, "new title 2");
|
||||
root.containerOpen = false;
|
||||
|
@ -45,6 +45,10 @@ let observer = {
|
||||
|
||||
onItemChanged: function(id, property, isAnnotationProperty, newValue,
|
||||
lastModified, itemType) {
|
||||
// The transaction manager is being rewritten in bug 891303, so just
|
||||
// skip checking this for now.
|
||||
if (property == "tags")
|
||||
return;
|
||||
this._itemChangedId = id;
|
||||
this._itemChangedProperty = property;
|
||||
this._itemChanged_isAnnotationProperty = isAnnotationProperty;
|
||||
@ -473,31 +477,41 @@ add_test(function test_editing_item_title() {
|
||||
});
|
||||
|
||||
add_test(function test_editing_item_uri() {
|
||||
const OLD_TEST_URL = "http://old.test_editing_item_uri.com/";
|
||||
const NEW_TEST_URL = "http://new.test_editing_item_uri.com/";
|
||||
let testBkmId = bmsvc.insertBookmark(root, NetUtil.newURI(OLD_TEST_URL), bmsvc.DEFAULT_INDEX, "Test editing item title");
|
||||
const OLD_TEST_URI = NetUtil.newURI("http://old.test_editing_item_uri.com/");
|
||||
const NEW_TEST_URI = NetUtil.newURI("http://new.test_editing_item_uri.com/");
|
||||
let testBkmId = bmsvc.insertBookmark(root, OLD_TEST_URI, bmsvc.DEFAULT_INDEX,
|
||||
"Test editing item title");
|
||||
tagssvc.tagURI(OLD_TEST_URI, ["tag"]);
|
||||
|
||||
let txn = new PlacesEditBookmarkURITransaction(testBkmId, NetUtil.newURI(NEW_TEST_URL));
|
||||
let txn = new PlacesEditBookmarkURITransaction(testBkmId, NEW_TEST_URI);
|
||||
|
||||
txn.doTransaction();
|
||||
do_check_eq(observer._itemChangedId, testBkmId);
|
||||
do_check_eq(observer._itemChangedProperty, "uri");
|
||||
do_check_eq(observer._itemChangedValue, NEW_TEST_URL);
|
||||
do_check_eq(observer._itemChangedValue, NEW_TEST_URI.spec);
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(NEW_TEST_URI)), JSON.stringify(["tag"]));
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(OLD_TEST_URI)), JSON.stringify([]));
|
||||
|
||||
txn.undoTransaction();
|
||||
do_check_eq(observer._itemChangedId, testBkmId);
|
||||
do_check_eq(observer._itemChangedProperty, "uri");
|
||||
do_check_eq(observer._itemChangedValue, OLD_TEST_URL);
|
||||
do_check_eq(observer._itemChangedValue, OLD_TEST_URI.spec);
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(OLD_TEST_URI)), JSON.stringify(["tag"]));
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(NEW_TEST_URI)), JSON.stringify([]));
|
||||
|
||||
txn.redoTransaction();
|
||||
do_check_eq(observer._itemChangedId, testBkmId);
|
||||
do_check_eq(observer._itemChangedProperty, "uri");
|
||||
do_check_eq(observer._itemChangedValue, NEW_TEST_URL);
|
||||
do_check_eq(observer._itemChangedValue, NEW_TEST_URI.spec);
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(NEW_TEST_URI)), JSON.stringify(["tag"]));
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(OLD_TEST_URI)), JSON.stringify([]));
|
||||
|
||||
txn.undoTransaction();
|
||||
do_check_eq(observer._itemChangedId, testBkmId);
|
||||
do_check_eq(observer._itemChangedProperty, "uri");
|
||||
do_check_eq(observer._itemChangedValue, OLD_TEST_URL);
|
||||
do_check_eq(observer._itemChangedValue, OLD_TEST_URI.spec);
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(OLD_TEST_URI)), JSON.stringify(["tag"]));
|
||||
do_check_eq(JSON.stringify(tagssvc.getTagsForURI(NEW_TEST_URI)), JSON.stringify([]));
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -102,6 +102,7 @@ typedef struct _nsCocoaWindowList {
|
||||
- (NSView*)trackingAreaView;
|
||||
|
||||
- (void)setBeingShown:(BOOL)aValue;
|
||||
- (BOOL)isBeingShown;
|
||||
- (BOOL)isVisibleOrBeingShown;
|
||||
|
||||
- (ChildView*)mainChildView;
|
||||
|
@ -590,7 +590,7 @@ bool nsCocoaWindow::IsVisible() const
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
return (mWindow && ([mWindow isVisible] || mSheetNeedsShow));
|
||||
return (mWindow && ([mWindow isVisibleOrBeingShown] || mSheetNeedsShow));
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
@ -686,6 +686,10 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
if (!mSheetNeedsShow && !bState && ![mWindow isVisible])
|
||||
return NS_OK;
|
||||
|
||||
// Protect against re-entering.
|
||||
if (bState && [mWindow isBeingShown])
|
||||
return NS_OK;
|
||||
|
||||
[mWindow setBeingShown:bState];
|
||||
|
||||
nsIWidget* parentWidget = mParent;
|
||||
@ -694,6 +698,11 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
(NSWindow*)parentWidget->GetNativeData(NS_NATIVE_WINDOW) : nil;
|
||||
|
||||
if (bState && !mBounds.IsEmpty()) {
|
||||
if (mPopupContentView) {
|
||||
// Ensure our content view is visible. We never need to hide it.
|
||||
mPopupContentView->Show(true);
|
||||
}
|
||||
|
||||
if (mWindowType == eWindowType_sheet) {
|
||||
// bail if no parent window (its basically what we do in Carbon)
|
||||
if (!nativeParentWindow || !piParentWidget)
|
||||
@ -756,6 +765,7 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
// NSException. These errors shouldn't be fatal. So we need to wrap
|
||||
// calls to ...orderFront: in LOGONLY blocks. See bmo bug 470864.
|
||||
NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK;
|
||||
[[mWindow contentView] setNeedsDisplay:YES];
|
||||
[mWindow orderFront:nil];
|
||||
NS_OBJC_END_TRY_LOGONLY_BLOCK;
|
||||
SendSetZLevelEvent();
|
||||
@ -902,11 +912,6 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mPopupContentView) {
|
||||
mPopupContentView->Show(bState);
|
||||
[[mWindow contentView] setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
[mWindow setBeingShown:NO];
|
||||
|
||||
@ -2637,6 +2642,11 @@ static NSMutableSet *gSwizzledFrameViewClasses = nil;
|
||||
mBeingShown = aValue;
|
||||
}
|
||||
|
||||
- (BOOL)isBeingShown
|
||||
{
|
||||
return mBeingShown;
|
||||
}
|
||||
|
||||
- (BOOL)isVisibleOrBeingShown
|
||||
{
|
||||
return [super isVisible] || mBeingShown;
|
||||
|
Loading…
Reference in New Issue
Block a user