merge mozilla-inbound to mozilla-central a=merge
@ -1019,15 +1019,20 @@ GetWrapperFor(ProxyAccessible* aProxy)
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
GetInterfacesForProxy(ProxyAccessible* aProxy)
|
||||
GetInterfacesForProxy(ProxyAccessible* aProxy, uint32_t aInterfaces)
|
||||
{
|
||||
return MAI_INTERFACE_COMPONENT;
|
||||
uint16_t interfaces = 1 << MAI_INTERFACE_COMPONENT;
|
||||
if (aInterfaces & Interfaces::HYPERTEXT)
|
||||
interfaces |= (1 << MAI_INTERFACE_HYPERTEXT) | (1 << MAI_INTERFACE_TEXT)
|
||||
| (1 << MAI_INTERFACE_EDITABLE_TEXT);
|
||||
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyCreated(ProxyAccessible* aProxy)
|
||||
a11y::ProxyCreated(ProxyAccessible* aProxy, uint32_t aInterfaces)
|
||||
{
|
||||
GType type = GetMaiAtkType(GetInterfacesForProxy(aProxy));
|
||||
GType type = GetMaiAtkType(GetInterfacesForProxy(aProxy, aInterfaces));
|
||||
NS_ASSERTION(type, "why don't we have a type!");
|
||||
|
||||
AtkObject* obj =
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Accessible-inl.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "nsMai.h"
|
||||
#include "ProxyAccessible.h"
|
||||
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
@ -110,21 +111,23 @@ static gchar*
|
||||
getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
nsAutoString autoStr;
|
||||
if (accWrap) {
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
text->TextSubstring(aStartOffset, aEndOffset, autoStr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
|
||||
proxy->TextSubstring(aStartOffset, aEndOffset, autoStr);
|
||||
}
|
||||
|
||||
//copy and return, libspi will free it.
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
|
||||
//copy and return, libspi will free it.
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
|
@ -549,5 +549,5 @@ DocManager::RemoteDocAdded(DocAccessibleParent* aDoc)
|
||||
MOZ_ASSERT(!sRemoteDocuments->Contains(aDoc),
|
||||
"How did we already have the doc!");
|
||||
sRemoteDocuments->AppendElement(aDoc);
|
||||
ProxyCreated(aDoc);
|
||||
ProxyCreated(aDoc, 0);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void PlatformShutdown();
|
||||
* called when a new ProxyAccessible is created, so the platform may setup a
|
||||
* wrapper for it, or take other action.
|
||||
*/
|
||||
void ProxyCreated(ProxyAccessible*);
|
||||
void ProxyCreated(ProxyAccessible* aProxy, uint32_t aInterfaces);
|
||||
|
||||
/**
|
||||
* Called just before a ProxyAccessible is destroyed so its wrapper can be
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "DocAccessibleChild.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "ProxyAccessible.h"
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
@ -14,12 +15,23 @@
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
void
|
||||
static uint32_t
|
||||
InterfacesFor(Accessible* aAcc)
|
||||
{
|
||||
uint32_t interfaces = 0;
|
||||
if (aAcc->IsHyperText() && aAcc->AsHyperText()->IsTextRole())
|
||||
interfaces |= Interfaces::HYPERTEXT;
|
||||
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
static void
|
||||
SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree)
|
||||
{
|
||||
uint64_t id = reinterpret_cast<uint64_t>(aRoot->UniqueID());
|
||||
uint32_t role = aRoot->Role();
|
||||
uint32_t childCount = aRoot->ChildCount();
|
||||
uint32_t interfaces = InterfacesFor(aRoot);
|
||||
|
||||
// OuterDocAccessibles are special because we don't want to serialize the
|
||||
// child doc here, we'll call PDocAccessibleConstructor in
|
||||
@ -27,7 +39,7 @@ SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree)
|
||||
if (childCount == 1 && aRoot->GetChildAt(0)->IsDoc())
|
||||
childCount = 0;
|
||||
|
||||
aTree.AppendElement(AccessibleData(id, role, childCount));
|
||||
aTree.AppendElement(AccessibleData(id, role, childCount, interfaces));
|
||||
for (uint32_t i = 0; i < childCount; i++)
|
||||
SerializeTree(aRoot->GetChildAt(i), aTree);
|
||||
}
|
||||
@ -117,5 +129,19 @@ DocAccessibleChild::RecvAttributes(const uint64_t& aID, nsTArray<Attribute>* aAt
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleChild::RecvTextSubstring(const uint64_t& aID,
|
||||
const int32_t& aStartOffset,
|
||||
const int32_t& aEndOffset,
|
||||
nsString* aText)
|
||||
{
|
||||
Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
|
||||
if (!acc || !acc->IsHyperText())
|
||||
return false;
|
||||
|
||||
acc->AsHyperText()->TextSubstring(aStartOffset, aEndOffset, *aText);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ public:
|
||||
virtual bool RecvDescription(const uint64_t& aID, nsString* aDesc) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvAttributes(const uint64_t& aID, nsTArray<Attribute> *aAttributes) MOZ_OVERRIDE;
|
||||
virtual bool RecvTextSubstring(const uint64_t& aID,
|
||||
const int32_t& aStartOffset,
|
||||
const int32_t& aEndOffset, nsString* aText)
|
||||
MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
DocAccessible* mDoc;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "DocAccessibleParent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/a11y/Platform.h"
|
||||
#include "ProxyAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
@ -74,7 +75,7 @@ DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
|
||||
new ProxyAccessible(newChild.ID(), aParent, this, role);
|
||||
aParent->AddChildAt(aIdxInParent, newProxy);
|
||||
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
|
||||
ProxyCreated(newProxy);
|
||||
ProxyCreated(newProxy, newChild.Interfaces());
|
||||
|
||||
uint32_t accessibles = 1;
|
||||
uint32_t kids = newChild.ChildrenCount();
|
||||
@ -142,7 +143,7 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
|
||||
outerDoc->SetChildDoc(aChildDoc);
|
||||
mChildDocs.AppendElement(aChildDoc);
|
||||
aChildDoc->mParentDoc = this;
|
||||
ProxyCreated(aChildDoc);
|
||||
ProxyCreated(aChildDoc, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -154,10 +155,12 @@ DocAccessibleParent::ShutdownAccessibles(ProxyEntry* entry, void*)
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessibleParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
DocAccessibleParent::Destroy()
|
||||
{
|
||||
MOZ_ASSERT(mChildDocs.IsEmpty(),
|
||||
"why wheren't the child docs destroyed already?");
|
||||
MOZ_ASSERT(!mShutdown);
|
||||
mShutdown = true;
|
||||
|
||||
mAccessibles.EnumerateEntries(ShutdownAccessibles, nullptr);
|
||||
ProxyDestroyed(this);
|
||||
|
@ -26,7 +26,7 @@ class DocAccessibleParent : public ProxyAccessible,
|
||||
{
|
||||
public:
|
||||
DocAccessibleParent() :
|
||||
ProxyAccessible(this), mParentDoc(nullptr)
|
||||
ProxyAccessible(this), mParentDoc(nullptr), mShutdown(false)
|
||||
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
|
||||
~DocAccessibleParent()
|
||||
{
|
||||
@ -45,7 +45,12 @@ public:
|
||||
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
|
||||
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
void Destroy();
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
|
||||
{
|
||||
if (!mShutdown)
|
||||
Destroy();
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the main processes representation of the parent document (if any)
|
||||
@ -115,6 +120,7 @@ private:
|
||||
* proxy object so we can't use a real map.
|
||||
*/
|
||||
nsTHashtable<ProxyEntry> mAccessibles;
|
||||
bool mShutdown;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ struct AccessibleData
|
||||
uint64_t ID;
|
||||
uint32_t Role;
|
||||
uint32_t ChildrenCount;
|
||||
uint32_t Interfaces;
|
||||
};
|
||||
|
||||
struct ShowEventData
|
||||
@ -49,6 +50,8 @@ child:
|
||||
prio(high) sync Name(uint64_t aID) returns(nsString name);
|
||||
prio(high) sync Description(uint64_t aID) returns(nsString desc);
|
||||
prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
|
||||
prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
|
||||
aEndOffset) returns(nsString aText);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,11 @@ ProxyAccessible::Shutdown()
|
||||
uint32_t childCount = mChildren.Length();
|
||||
for (uint32_t idx = 0; idx < childCount; idx++)
|
||||
mChildren[idx]->Shutdown();
|
||||
} else {
|
||||
if (mChildren.Length() != 1)
|
||||
MOZ_CRASH("outer doc doesn't own adoc!");
|
||||
|
||||
static_cast<DocAccessibleParent*>(mChildren[0])->Destroy();
|
||||
}
|
||||
|
||||
mChildren.Clear();
|
||||
@ -69,5 +74,12 @@ ProxyAccessible::Attributes(nsTArray<Attribute> *aAttrs) const
|
||||
{
|
||||
unused << mDoc->SendAttributes(mID, aAttrs);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
|
||||
nsString& aText) const
|
||||
{
|
||||
unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,12 @@ public:
|
||||
*/
|
||||
void Attributes(nsTArray<Attribute> *aAttrs) const;
|
||||
|
||||
/**
|
||||
* Get the text between the given offsets.
|
||||
*/
|
||||
void TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
|
||||
nsString& aText) const;
|
||||
|
||||
/**
|
||||
* Allow the platform to store a pointers worth of data on us.
|
||||
*/
|
||||
@ -108,6 +114,11 @@ private:
|
||||
bool mOuterDoc : 1;
|
||||
};
|
||||
|
||||
enum Interfaces
|
||||
{
|
||||
HYPERTEXT = 1
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ PlatformShutdown()
|
||||
}
|
||||
|
||||
void
|
||||
ProxyCreated(ProxyAccessible*)
|
||||
ProxyCreated(ProxyAccessible*, uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ a11y::PlatformShutdown()
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyCreated(ProxyAccessible*)
|
||||
a11y::ProxyCreated(ProxyAccessible*, uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ a11y::PlatformShutdown()
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyCreated(ProxyAccessible*)
|
||||
a11y::ProxyCreated(ProxyAccessible*, uint32_t)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,9 @@
|
||||
// we want a wmain entry point
|
||||
#define XRE_DONT_SUPPORT_XPSP2 // See https://bugzil.la/1023941#c32
|
||||
#include "nsWindowsWMain.cpp"
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,9 @@
|
||||
#define XRE_DONT_SUPPORT_XPSP2
|
||||
#endif
|
||||
#include "nsWindowsWMain.cpp"
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#include "BinaryPath.h"
|
||||
|
@ -4,6 +4,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --with-google-api-keyfile=/builds/gapi.data
|
||||
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
|
||||
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-desktop-geoloc-api.key
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux32
|
||||
|
||||
|
@ -3,8 +3,6 @@ ac_add_options --enable-dmd
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
||||
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux32
|
||||
|
@ -4,6 +4,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --with-google-api-keyfile=/builds/gapi.data
|
||||
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
|
||||
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-desktop-geoloc-api.key
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/debug"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -7,8 +7,6 @@ MOZ_AUTOMATION_L10N_CHECK=0
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
||||
|
||||
# Use Clang as specified in manifest
|
||||
export CC="$topsrcdir/clang/bin/clang"
|
||||
export CXX="$topsrcdir/clang/bin/clang++"
|
||||
|
@ -1,6 +0,0 @@
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
MOZ_AUTOMATION_PRETTY=1
|
||||
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -9,6 +9,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --with-google-api-keyfile=/builds/gapi.data
|
||||
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
|
||||
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-desktop-geoloc-api.key
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
@ -1,5 +0,0 @@
|
||||
MOZ_AUTOMATION_PRETTY=1
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
. "$topsrcdir/browser/config/mozconfigs/macosx-universal/nightly"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -5,8 +5,6 @@ ac_add_options --enable-debug
|
||||
ac_add_options --enable-optimize="-O1"
|
||||
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
. "$topsrcdir/browser/config/mozconfigs/macosx64/debug"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -20,6 +20,7 @@ else
|
||||
_google_oauth_api_keyfile=/e/builds/google-oauth-api.key
|
||||
fi
|
||||
ac_add_options --with-google-oauth-api-keyfile=${_google_oauth_api_keyfile}
|
||||
ac_add_options --with-mozilla-api-keyfile=/c/builds/mozilla-desktop-geoloc-api.key
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
@ -1,6 +0,0 @@
|
||||
. "$topsrcdir/build/mozconfig.win-common"
|
||||
MOZ_AUTOMATION_L10N_CHECK=0
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
. "$topsrcdir/browser/config/mozconfigs/win32/debug"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -1,6 +0,0 @@
|
||||
. "$topsrcdir/build/mozconfig.win-common"
|
||||
MOZ_AUTOMATION_PRETTY=1
|
||||
MOZ_AUTOMATION_UPLOAD=0
|
||||
. "$topsrcdir/browser/config/mozconfigs/win32/nightly"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -18,6 +18,7 @@ else
|
||||
_google_oauth_api_keyfile=/e/builds/google-oauth-api.key
|
||||
fi
|
||||
ac_add_options --with-google-oauth-api-keyfile=${_google_oauth_api_keyfile}
|
||||
ac_add_options --with-mozilla-api-keyfile=/c/builds/mozilla-desktop-geoloc-api.key
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
@ -1,3 +0,0 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/win64/debug"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -1,3 +0,0 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/win64/nightly"
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
@ -65,6 +65,8 @@ http://127.0.0.1:8888 privileged
|
||||
http://test:80 privileged
|
||||
http://mochi.test:8888 privileged
|
||||
http://test1.mochi.test:8888
|
||||
http://sub1.test1.mochi.test:8888
|
||||
http://sub2.xn--lt-uia.mochi.test:8888
|
||||
http://test2.mochi.test:8888
|
||||
http://example.org:80 privileged
|
||||
http://test1.example.org:80 privileged
|
||||
|
11
configure.in
@ -3542,17 +3542,6 @@ esac
|
||||
AC_SUBST(NIGHTLY_BUILD)
|
||||
AC_SUBST(RELEASE_BUILD)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Disable compiling sources in unified mode.
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(unified-compilation,
|
||||
[ --disable-unified-compilation
|
||||
Disable unified compilation of some C/C++ sources],
|
||||
MOZ_DISABLE_UNIFIED_COMPILATION=1,
|
||||
MOZ_DISABLE_UNIFIED_COMPILATION=)
|
||||
AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Multiprocess Firefox Nightly Testing UI
|
||||
dnl To be removed in Bug 1003313
|
||||
|
@ -5804,8 +5804,7 @@ nsDocShell::SetPosition(int32_t x, int32_t y)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetPosition(int32_t * aX, int32_t * aY)
|
||||
{
|
||||
int32_t dummyHolder;
|
||||
return GetPositionAndSize(aX, aY, &dummyHolder, &dummyHolder);
|
||||
return GetPositionAndSize(aX, aY, nullptr, nullptr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -5819,8 +5818,7 @@ nsDocShell::SetSize(int32_t aCX, int32_t aCY, bool aRepaint)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetSize(int32_t * aCX, int32_t * aCY)
|
||||
{
|
||||
int32_t dummyHolder;
|
||||
return GetPositionAndSize(&dummyHolder, &dummyHolder, aCX, aCY);
|
||||
return GetPositionAndSize(nullptr, nullptr, aCX, aCY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -9186,7 +9184,9 @@ nsDocShell::CheckLoadingPermissions()
|
||||
// Note - The check for a current JSContext here isn't necessarily sensical.
|
||||
// It's just designed to preserve the old semantics during a mass-conversion
|
||||
// patch.
|
||||
NS_ENSURE_TRUE(nsContentUtils::GetCurrentJSContext(), NS_OK);
|
||||
if (!nsContentUtils::GetCurrentJSContext()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check if the caller is from the same origin as this docshell,
|
||||
// or any of its ancestors.
|
||||
|
@ -213,13 +213,12 @@ NS_GetContentList(nsINode* aRootNode,
|
||||
ContentListHashtableHashKey,
|
||||
ContentListHashtableMatchEntry,
|
||||
PL_DHashMoveEntryStub,
|
||||
PL_DHashClearEntryStub,
|
||||
PL_DHashFinalizeStub
|
||||
PL_DHashClearEntryStub
|
||||
};
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops, nullptr,
|
||||
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops,
|
||||
sizeof(ContentListHashEntry));
|
||||
}
|
||||
|
||||
@ -326,14 +325,13 @@ GetFuncStringContentList(nsINode* aRootNode,
|
||||
FuncStringContentListHashtableHashKey,
|
||||
FuncStringContentListHashtableMatchEntry,
|
||||
PL_DHashMoveEntryStub,
|
||||
PL_DHashClearEntryStub,
|
||||
PL_DHashFinalizeStub
|
||||
PL_DHashClearEntryStub
|
||||
};
|
||||
|
||||
// Initialize the hashtable if needed.
|
||||
if (!gFuncStringContentListHashTable.ops) {
|
||||
PL_DHashTableInit(&gFuncStringContentListHashTable, &hash_table_ops,
|
||||
nullptr, sizeof(FuncStringContentListHashEntry));
|
||||
sizeof(FuncStringContentListHashEntry));
|
||||
}
|
||||
|
||||
FuncStringContentListHashEntry *entry = nullptr;
|
||||
|
@ -485,12 +485,11 @@ nsContentUtils::Init()
|
||||
PL_DHashMatchEntryStub,
|
||||
PL_DHashMoveEntryStub,
|
||||
EventListenerManagerHashClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
EventListenerManagerHashInitEntry
|
||||
};
|
||||
|
||||
PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
|
||||
nullptr, sizeof(EventListenerManagerMapEntry));
|
||||
sizeof(EventListenerManagerMapEntry));
|
||||
|
||||
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
|
||||
}
|
||||
@ -6258,16 +6257,32 @@ void nsContentUtils::RemoveNewlines(nsString &aString)
|
||||
|
||||
void
|
||||
nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
|
||||
{
|
||||
if (!PlatformToDOMLineBreaks(aString, mozilla::fallible_t())) {
|
||||
aString.AllocFailed(aString.Length());
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::PlatformToDOMLineBreaks(nsString& aString, const fallible_t& aFallible)
|
||||
{
|
||||
if (aString.FindChar(char16_t('\r')) != -1) {
|
||||
// Windows linebreaks: Map CRLF to LF:
|
||||
aString.ReplaceSubstring(MOZ_UTF16("\r\n"),
|
||||
MOZ_UTF16("\n"));
|
||||
if (!aString.ReplaceSubstring(MOZ_UTF16("\r\n"),
|
||||
MOZ_UTF16("\n"),
|
||||
aFallible)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mac linebreaks: Map any remaining CR to LF:
|
||||
aString.ReplaceSubstring(MOZ_UTF16("\r"),
|
||||
MOZ_UTF16("\n"));
|
||||
if (!aString.ReplaceSubstring(MOZ_UTF16("\r"),
|
||||
MOZ_UTF16("\n"),
|
||||
aFallible)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1715,6 +1715,8 @@ public:
|
||||
* @param aString the string to convert the newlines inside [in/out]
|
||||
*/
|
||||
static void PlatformToDOMLineBreaks(nsString &aString);
|
||||
static NS_WARN_UNUSED_RESULT bool PlatformToDOMLineBreaks(nsString &aString,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
/**
|
||||
* Populates aResultString with the contents of the string-buffer aBuf, up
|
||||
|
@ -3978,12 +3978,10 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
PL_DHashMatchEntryStub,
|
||||
PL_DHashMoveEntryStub,
|
||||
SubDocClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
SubDocInitEntry
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nullptr,
|
||||
sizeof(SubDocMapEntry));
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, sizeof(SubDocMapEntry));
|
||||
if (!mSubDocuments) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1963,10 +1963,11 @@ nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return UpdateBaseWindowPositionAndSize(aIFrame);
|
||||
UpdateBaseWindowPositionAndSize(aIFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
@ -1980,19 +1981,17 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
|
||||
|
||||
nsWeakFrame weakFrame(aIFrame);
|
||||
|
||||
baseWindow->GetPositionAndSize(&x, &y, nullptr, nullptr);
|
||||
baseWindow->GetPosition(&x, &y);
|
||||
|
||||
if (!weakFrame.IsAlive()) {
|
||||
// GetPositionAndSize() killed us
|
||||
return NS_OK;
|
||||
// GetPosition() killed us
|
||||
return;
|
||||
}
|
||||
|
||||
nsIntSize size = aIFrame->GetSubdocumentSize();
|
||||
|
||||
baseWindow->SetPositionAndSize(x, y, size.width, size.height, false);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -287,7 +287,7 @@ private:
|
||||
|
||||
// Updates the subdocument position and size. This gets called only
|
||||
// when we have our own in-process DocShell.
|
||||
nsresult UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame);
|
||||
void UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame);
|
||||
nsresult CheckURILoad(nsIURI* aURI);
|
||||
void FireErrorEvent();
|
||||
nsresult ReallyStartLoadingInternal();
|
||||
|
@ -280,7 +280,7 @@ nsPropertyTable::GetPropertyListFor(nsIAtom* aPropertyName) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
nsPropertyTable::PropertyList::PropertyList(nsIAtom *aName,
|
||||
NSPropertyDtorFunc aDtorFunc,
|
||||
void *aDtorData,
|
||||
@ -291,7 +291,7 @@ nsPropertyTable::PropertyList::PropertyList(nsIAtom *aName,
|
||||
mTransfer(aTransfer),
|
||||
mNext(nullptr)
|
||||
{
|
||||
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(), this,
|
||||
PL_DHashTableInit(&mObjectValueMap, PL_DHashGetStubOps(),
|
||||
sizeof(PropertyListMapEntry));
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ DestroyPropertyEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
uint32_t number, void *arg)
|
||||
{
|
||||
nsPropertyTable::PropertyList *propList =
|
||||
static_cast<nsPropertyTable::PropertyList*>(table->data);
|
||||
static_cast<nsPropertyTable::PropertyList*>(arg);
|
||||
PropertyListMapEntry* entry = static_cast<PropertyListMapEntry*>(hdr);
|
||||
|
||||
propList->mDtorFunc(const_cast<void*>(entry->key), propList->mName,
|
||||
@ -319,8 +319,7 @@ nsPropertyTable::PropertyList::Destroy()
|
||||
{
|
||||
// Enumerate any remaining object/value pairs and destroy the value object
|
||||
if (mDtorFunc)
|
||||
PL_DHashTableEnumerate(&mObjectValueMap, DestroyPropertyEnumerator,
|
||||
nullptr);
|
||||
PL_DHashTableEnumerate(&mObjectValueMap, DestroyPropertyEnumerator, this);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -326,18 +326,17 @@ nsScriptNameSpaceManager::Init()
|
||||
GlobalNameHashMatchEntry,
|
||||
PL_DHashMoveEntryStub,
|
||||
GlobalNameHashClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
GlobalNameHashInitEntry
|
||||
};
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
sizeof(GlobalNameMapEntry),
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mNavigatorNames, &hash_table_ops,
|
||||
nullptr, sizeof(GlobalNameMapEntry),
|
||||
sizeof(GlobalNameMapEntry),
|
||||
fallible_t(),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_LENGTH);
|
||||
if (!mIsInitialized) {
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
dom/canvas/test/reftest/colors-no-alpha.png
Normal file
After Width: | Height: | Size: 439 B |
BIN
dom/canvas/test/reftest/colors-non-premult.png
Normal file
After Width: | Height: | Size: 444 B |
BIN
dom/canvas/test/reftest/colors-premult.png
Normal file
After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB |
@ -2,183 +2,143 @@
|
||||
default-preferences pref(webgl.force-enabled,true)
|
||||
|
||||
# Check that disabling works:
|
||||
== webgl-disable-test.html?nogl wrapper.html?green.png
|
||||
pref(webgl.disabled,true) == webgl-disable-test.html wrapper.html?green.png
|
||||
== webgl-disable-test.html?nogl wrapper.html?green.png
|
||||
pref(webgl.disabled,true) == webgl-disable-test.html wrapper.html?green.png
|
||||
|
||||
# Basic WebGL tests:
|
||||
# Do we get pixels to the screen at all?
|
||||
# Try to just hit the different rendering paths here.
|
||||
# Neither of these should ever break.
|
||||
== webgl-clear-test.html wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback wrapper.html?green.png
|
||||
|
||||
# Android 2.2 ARMv6 slaves can't seem to use WebGL, but we can't seem to
|
||||
# disable the ARMv6 runs without disabling ARMv7, which works fine.
|
||||
# For now, just mark versions <15 (<4.0) as random, so we still get
|
||||
# assert coverage.
|
||||
|
||||
# Test: {aa, alpha, preserve, readback} = 16
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&_____&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&_____&________ wrapper.html?green.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&alpha&________ wrapper.html?green.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&alpha&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&_____&preserve wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&_____&preserve wrapper.html?green.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&alpha&preserve wrapper.html?green.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&alpha&preserve wrapper.html?green.png
|
||||
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&_____&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&_____&________ wrapper.html?green.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&alpha&________ wrapper.html?green.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&alpha&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&_____&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&_____&preserve wrapper.html?green.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&alpha&preserve wrapper.html?green.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,91) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&alpha&preserve wrapper.html?green.png
|
||||
# Make sure that our choice of attribs doesn't break rendering.
|
||||
== webgl-clear-test.html?depth wrapper.html?green.png
|
||||
== webgl-clear-test.html?stencil wrapper.html?green.png
|
||||
== webgl-clear-test.html?depth&stencil wrapper.html?green.png
|
||||
|
||||
# Check that resize works:
|
||||
random-if(Android&&AndroidVersion<15) == webgl-resize-test.html wrapper.html?green.png
|
||||
== webgl-resize-test.html wrapper.html?green.png
|
||||
|
||||
# Check orientation:
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&_____&________ wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&_____&________ wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&alpha&________ wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&alpha&________ wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&_____&preserve wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&_____&preserve wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&alpha&preserve wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
# Some of the failure conditions are a little crazy. I'm (jgilbert) setting these based on
|
||||
# failures encountered when running on Try, and then targetting the Try config by
|
||||
# differences in the `sandbox` contents. That is, I'm labeling based on symptoms rather
|
||||
# than cause.
|
||||
# Lin-R-e10s: gtk2Widget && browserIsRemote
|
||||
# WinXP-R: winWidget && layersGPUAccelerated && !d2d
|
||||
# Win7+-R: winWidget && layersGPUAccelerated && d2d
|
||||
# Win7+-Ru: winWidget && !layersGPUAccelerated
|
||||
# (Note that we have to remove spaces when used below)
|
||||
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&_____&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&_____&________ wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&alpha&________ wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&alpha&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&_____&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&_____&preserve wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&alpha&preserve wrapper.html?white-top-left.png
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,90) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
# IMPORTANT: Expected outcomes are evaluated left-to-right, and they replace eachother.
|
||||
# That means that if an unconditional status (`fuzzy()`) is to the right of another status
|
||||
# (such as fails-if), it will overwrite the old status.
|
||||
#
|
||||
# As such, all unconditional statuses should be to the left of conditional statuses.
|
||||
# (See /layout/tools/reftest/reftest.js:945)
|
||||
|
||||
# Does we draw the correct color in the correct places with all context creation options?
|
||||
# (Note that our context creation option matrix is 2^6 = 64)
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
# Does we draw the correct colors in the correct places?
|
||||
# Combinations: PowerSet([readback, aa, preserve, premult, alpha]) x [frame=1,frame=6]
|
||||
# This is 2^6 = 64 combinations.
|
||||
== webgl-color-test.html?frame=1&__&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&__&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=1&aa&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
== webgl-color-test.html?frame=6&__&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
fails-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-color-test.html?frame=6&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&__&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fails-if(winWidget&&layersGPUAccelerated&&d2d) == webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d2d)) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=6&aa&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
fails-if(winWidget&&layersGPUAccelerated&&d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
random-if(winWidget&&layersGPUAccelerated&&d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtk2Widget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d2d)) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
# Check for hanging bindings/state settings:
|
||||
== webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
|
||||
== webgl-hanging-fb-test.html?aa&________ wrapper.html?green.png
|
||||
== webgl-hanging-fb-test.html?__&preserve wrapper.html?green.png
|
||||
== webgl-hanging-fb-test.html?aa&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?readback&__&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?readback&aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?readback&__&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?readback&aa&preserve wrapper.html?green.png
|
||||
|
||||
# Check a smaller selection for readback:
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
random-if(gtk2Widget) pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
|
||||
|
||||
# Check alpha behavior:
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0 wrapper.html?colors.png
|
||||
# These tests don't use wrapper.html, as there appear to be invalidation issues with black.png and async image decoding - Bug 803299
|
||||
random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0 black.html
|
||||
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0 wrapper.html?colors.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha wrapper.html?white.png
|
||||
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0 wrapper.html?half-colors.png
|
||||
|
||||
# Test premult:
|
||||
# random-if(B2G) from bug 983650
|
||||
# Mark as failing on WinXP (winWidget&&!d2d), because Try said so. WFM outside of Try.
|
||||
# This might work on WinXP again if OMTC is disabled.
|
||||
fuzzy(1,65536) random-if(gtk2Widget) random-if(winWidget&&!d2d) random-if(B2G) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) random-if(gtk2Widget) fails-if(winWidget&&!d2d) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha wrapper.html?half-colors-half-alpha.png
|
||||
# random-if(B2G) from bug 983650
|
||||
fuzzy(1,65536) random-if(B2G) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult wrapper.html?colors-half-alpha.png
|
||||
|
||||
# Check for hanging framebuffer bindings:
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?aa&readback wrapper.html?green.png
|
||||
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?__&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?aa&readback wrapper.html?green.png
|
||||
== webgl-hanging-scissor-test.html?__ wrapper.html?green.png
|
||||
== webgl-hanging-scissor-test.html?aa wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-scissor-test.html?readback&__ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-scissor-test.html?readback&aa wrapper.html?green.png
|
||||
|
||||
|
||||
# Check that our experimental prefs still work:
|
||||
|
||||
# 16bpp:
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?16bpp wrapper.html?colors.png
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?16bpp&readback wrapper.html?colors.png
|
||||
# 16bpp for Android/B2G: [16bpp] * PowerSet([readback, premult, alpha])
|
||||
# RGB565 dithers 127 to [123,132]. (Max error: 5)
|
||||
# RGBA4444 dithers 128 to [119,136], and 191 to [192]. (Max error: 9)
|
||||
fuzzy(5,30000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?16bpp&________&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(5,30000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback&_______&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(5,30000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?16bpp&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(5,30000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(9,40000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?16bpp&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(9,40000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(9,40000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?16bpp&________&premult&alpha wrapper.html?colors-premult.png
|
||||
fuzzy(9,40000) skip-if(!(Android||B2G)) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
# Force native GL (Windows):
|
||||
skip-if(!winWidget) pref(webgl.disable-angle,true) == webgl-clear-test.html?native-gl wrapper.html?green.png
|
||||
skip-if(!winWidget) pref(webgl.disable-angle,true) == webgl-orientation-test.html?native-gl wrapper.html?white-top-left.png
|
||||
skip-if(!winWidget) pref(webgl.disable-angle,true) == webgl-color-test.html?native-gl wrapper.html?colors.png
|
||||
skip-if(!winWidget) pref(webgl.disable-angle,true) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?native-gl&16bpp wrapper.html?colors.png
|
||||
skip-if(!winWidget) pref(webgl.disable-angle,true) == webgl-color-test.html?native-gl wrapper.html?colors-no-alpha.png
|
||||
|
||||
|
||||
# Non-WebGL Reftests!
|
||||
|
@ -1,50 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<meta charset='UTF-8'>
|
||||
<!--
|
||||
Clear the canvas to green to test that we get pixels to the screen.
|
||||
|
||||
If this fails, something is seriously wrong.
|
||||
-->
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script type='text/javascript' src='webgl-utils.js'></script>
|
||||
<script type='text/javascript'>
|
||||
'use strict';
|
||||
|
||||
<script type="text/javascript" src="webgl-utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* Clear Test
|
||||
*
|
||||
* Clear the canvas to green to test that we get pixels to the screen.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function renderGL(gl) {
|
||||
gl.clearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
function setStatus(text) {
|
||||
var elem = document.getElementById('status');
|
||||
elem.innerHTML = text;
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
var canvas = document.getElementById('canvas');
|
||||
|
||||
var gl = initGL(canvas);
|
||||
if (!gl) {
|
||||
setStatus('WebGL context creation failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderFailure(canvas);
|
||||
|
||||
waitForComposite(testComplete);
|
||||
gl.clearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
function testComplete() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="rAF(runTest);">
|
||||
<canvas id="canvas" width="256" height="256"></canvas>
|
||||
<body onload='runTest();'>
|
||||
<canvas id='canvas' width='256' height='256'></canvas>
|
||||
<div id='status'></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,81 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<script type="text/javascript" src="webgl-utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* Color-Alpha Test
|
||||
*
|
||||
* Clear the four quadrants of the canvas as follows:
|
||||
* +------+------+
|
||||
* | red |green |
|
||||
* | | |
|
||||
* +------+------+
|
||||
* | blue |white |
|
||||
* | | |
|
||||
* +------+------+
|
||||
* However, unlike the Color test, clear with a given alpha value.
|
||||
* What effect this has depends on the context-creation args passed
|
||||
* to this page.
|
||||
*
|
||||
* Here we check that we handle various combinations of alpha and
|
||||
* premultipliedAlpha correctly.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function renderGL(gl, value, alpha) {
|
||||
gl.enable(gl.SCISSOR_TEST);
|
||||
|
||||
gl.scissor(0, 128, 128, 128);
|
||||
gl.clearColor(value, 0.0, 0.0, alpha);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(128, 128, 128, 128);
|
||||
gl.clearColor(0.0, value, 0.0, alpha);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(0, 0, 128, 128);
|
||||
gl.clearColor(0.0, 0.0, value, alpha);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(128, 0, 128, 128);
|
||||
gl.clearColor(value, value, value, alpha);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
var gl = initGL(canvas);
|
||||
|
||||
var value = arg("colorVal");
|
||||
var alpha = arg("alphaVal");
|
||||
|
||||
if (gl)
|
||||
renderGL(gl, value, alpha);
|
||||
else
|
||||
renderFailure(canvas);
|
||||
|
||||
waitForComposite(testComplete);
|
||||
}
|
||||
|
||||
function testComplete() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="rAF(runTest);">
|
||||
<canvas id="canvas" width="256" height="256"></canvas>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,76 +1,123 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<meta charset='UTF-8'>
|
||||
<!--
|
||||
Color Test
|
||||
|
||||
Clear the four quadrants of the canvas as follows:
|
||||
+------+------+
|
||||
| blue |black |
|
||||
| | |
|
||||
+------+------+
|
||||
| red |green |
|
||||
| | |
|
||||
+------+------+
|
||||
|
||||
Clear with a given alpha value. What effect this has depends on the
|
||||
context-creation args passed to this page.
|
||||
-->
|
||||
<html class='reftest-wait'>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script type='text/javascript' src='webgl-utils.js'></script>
|
||||
<script type='text/javascript'>
|
||||
'use strict';
|
||||
|
||||
<script type="text/javascript" src="webgl-utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* Color Test
|
||||
*
|
||||
* Clear the four quadrants of the canvas as follows:
|
||||
* +------+------+
|
||||
* | red |green |
|
||||
* | | |
|
||||
* +------+------+
|
||||
* | blue |white |
|
||||
* | | |
|
||||
* +------+------+
|
||||
*
|
||||
* This is for checking that we're getting the right colors when
|
||||
* we ask for them. This combined with the Orientation test assure
|
||||
* that we are getting the correct colors in the correct places.
|
||||
*/
|
||||
var COLOR_VALUE = 127.0 / 255.0;
|
||||
var ALPHA_VALUE = 127.0 / 255.0;
|
||||
|
||||
"use strict";
|
||||
|
||||
function renderGL(gl) {
|
||||
function renderFrame(gl) {
|
||||
gl.enable(gl.SCISSOR_TEST);
|
||||
|
||||
gl.scissor(0, 128, 128, 128);
|
||||
gl.clearColor(1.0, 0.0, 0.0, 1.0);
|
||||
gl.scissor(0, 0, 100, 100);
|
||||
gl.clearColor(COLOR_VALUE, 0.0, 0.0, ALPHA_VALUE);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(128, 128, 128, 128);
|
||||
gl.clearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.scissor(100, 0, 100, 100);
|
||||
gl.clearColor(0.0, COLOR_VALUE, 0.0, ALPHA_VALUE);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(0, 0, 128, 128);
|
||||
gl.clearColor(0.0, 0.0, 1.0, 1.0);
|
||||
gl.scissor(0, 100, 100, 100);
|
||||
gl.clearColor(0.0, 0.0, COLOR_VALUE, ALPHA_VALUE);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.scissor(128, 0, 128, 128);
|
||||
gl.clearColor(1.0, 1.0, 1.0, 1.0);
|
||||
gl.scissor(100, 100, 100, 100);
|
||||
gl.clearColor(0.0, 0.0, 0.0, ALPHA_VALUE);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Boilerplate
|
||||
|
||||
var TIMEOUT_MS = 10 * 1000;
|
||||
|
||||
function setStatus(text) {
|
||||
var elem = document.getElementById('status');
|
||||
elem.innerHTML = text;
|
||||
}
|
||||
|
||||
var gIsComplete = false;
|
||||
|
||||
function markComplete(statusText) {
|
||||
if (!statusText)
|
||||
statusText = '';
|
||||
|
||||
if (gIsComplete)
|
||||
return;
|
||||
gIsComplete = true;
|
||||
|
||||
setStatus(statusText);
|
||||
document.documentElement.removeAttribute('class');
|
||||
}
|
||||
|
||||
function markError(text) {
|
||||
markComplete('Error: ' + text);
|
||||
}
|
||||
|
||||
function markTimedOut() {
|
||||
markError('Timed out waiting on test completion.');
|
||||
}
|
||||
|
||||
function runFrame(gl, frameCount, maxFrameCount) {
|
||||
renderFrame(gl);
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= maxFrameCount) {
|
||||
console.log('Rendered ' + frameCount + ' frames.');
|
||||
markComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function(){
|
||||
runFrame(gl, frameCount, maxFrameCount);
|
||||
});
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
var canvas = document.getElementById('canvas');
|
||||
|
||||
var gl = initGL(canvas);
|
||||
if (!gl) {
|
||||
markError('WebGL context creation failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderFailure(canvas);
|
||||
var maxFrameCount = arg('frame', 1);
|
||||
if (maxFrameCount < 1) {
|
||||
markError('Invalid `frame` arg: ' + maxFrameCount);
|
||||
return;
|
||||
}
|
||||
|
||||
waitForComposite(testComplete);
|
||||
setStatus('Waiting...');
|
||||
|
||||
runFrame(gl, 0, maxFrameCount);
|
||||
setTimeout(markTimedOut, TIMEOUT_MS);
|
||||
}
|
||||
|
||||
function testComplete() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="rAF(runTest);">
|
||||
<canvas id="canvas" width="256" height="256"></canvas>
|
||||
<body onload='runTest();'>
|
||||
<canvas id='canvas' width='200' height='200'></canvas>
|
||||
<div id='status'></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,57 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<script type="text/javascript" src="webgl-utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* Orientation Test
|
||||
*
|
||||
* Clear the canvas to black, and clear the upper-left quadrant
|
||||
* to white. If this doesn't pass, but the Clear test does, then
|
||||
* likely y-flip is wrong.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function renderGL(gl) {
|
||||
gl.clearColor(0.0, 0.0, 0.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.enable(gl.SCISSOR_TEST);
|
||||
gl.scissor(0, 128, 128, 128);
|
||||
gl.clearColor(1.0, 1.0, 1.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
var gl = initGL(canvas);
|
||||
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderFailure(canvas);
|
||||
|
||||
waitForComposite(testComplete);
|
||||
}
|
||||
|
||||
function testComplete() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="rAF(runTest);">
|
||||
<canvas id="canvas" width="256" height="256"></canvas>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -22,16 +22,15 @@ function parseArgs() {
|
||||
}
|
||||
|
||||
var gArgs = null;
|
||||
function arg(key) {
|
||||
function arg(key, defaultVal) {
|
||||
if (gArgs === null) {
|
||||
gArgs = parseArgs();
|
||||
}
|
||||
|
||||
var ret = gArgs[key];
|
||||
if (ret === undefined)
|
||||
ret = false;
|
||||
if (!(key in gArgs))
|
||||
return defaultVal;
|
||||
|
||||
return ret;
|
||||
return gArgs[key];
|
||||
}
|
||||
|
||||
function initGL(canvas) {
|
||||
@ -40,12 +39,12 @@ function initGL(canvas) {
|
||||
|
||||
var gl = null;
|
||||
|
||||
var withAA = arg("aa");
|
||||
var withAlpha = arg("alpha");
|
||||
var withDepth = arg("depth");
|
||||
var withPremult = arg("premult");
|
||||
var withPreserve = arg("preserve");
|
||||
var withStencil = arg("stencil");
|
||||
var withAA = arg("aa", false);
|
||||
var withAlpha = arg("alpha", false);
|
||||
var withDepth = arg("depth", false);
|
||||
var withPremult = arg("premult", false);
|
||||
var withPreserve = arg("preserve", false);
|
||||
var withStencil = arg("stencil", false);
|
||||
|
||||
try {
|
||||
var argDict = {
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@ -971,8 +971,10 @@ FetchBody<Derived>::BeginConsumeBodyMainThread()
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
DerivedClass()->GetBody(getter_AddRefs(stream));
|
||||
if (!stream) {
|
||||
NS_WARNING("Could not get stream");
|
||||
return;
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(stream), EmptyCString());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStreamPump> pump;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsIUploadChannel2.h"
|
||||
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsCORSListenerProxy.h"
|
||||
#include "nsDataHandler.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -30,7 +31,9 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(FetchDriver, nsIStreamListener)
|
||||
NS_IMPL_ISUPPORTS(FetchDriver,
|
||||
nsIStreamListener, nsIChannelEventSink, nsIInterfaceRequestor,
|
||||
nsIAsyncVerifyRedirectCallback)
|
||||
|
||||
FetchDriver::FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
@ -88,13 +91,15 @@ FetchDriver::ContinueFetch(bool aCORSFlag)
|
||||
nsAutoCString url;
|
||||
mRequest->GetURL(url);
|
||||
nsCOMPtr<nsIURI> requestURI;
|
||||
// FIXME(nsm): Deal with relative URLs.
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(requestURI), url,
|
||||
nullptr, nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
// Begin Step 4 of the Fetch algorithm
|
||||
// https://fetch.spec.whatwg.org/#fetching
|
||||
|
||||
// FIXME(nsm): Bug 1039846: Add CSP checks
|
||||
|
||||
nsAutoCString scheme;
|
||||
@ -125,7 +130,7 @@ FetchDriver::ContinueFetch(bool aCORSFlag)
|
||||
|
||||
bool corsPreflight = false;
|
||||
if (mRequest->Mode() == RequestMode::Cors_with_forced_preflight ||
|
||||
(mRequest->UnsafeRequest() && (mRequest->HasSimpleMethod() || !mRequest->Headers()->HasOnlySimpleHeaders()))) {
|
||||
(mRequest->UnsafeRequest() && (!mRequest->HasSimpleMethod() || !mRequest->Headers()->HasOnlySimpleHeaders()))) {
|
||||
corsPreflight = true;
|
||||
}
|
||||
|
||||
@ -274,47 +279,15 @@ FetchDriver::BasicFetch()
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
// This function implements the "HTTP Fetch" algorithm from the Fetch spec.
|
||||
// Functionality is often split between here, the CORS listener proxy and the
|
||||
// Necko HTTP implementation.
|
||||
nsresult
|
||||
FetchDriver::HttpFetch(bool aCORSFlag, bool aPreflightCORSFlag, bool aAuthenticationFlag)
|
||||
FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthenticationFlag)
|
||||
{
|
||||
// Step 1. "Let response be null."
|
||||
mResponse = nullptr;
|
||||
|
||||
// XXXnsm: The ServiceWorker interception should happen automatically.
|
||||
return ContinueHttpFetchAfterServiceWorker();
|
||||
}
|
||||
|
||||
nsresult
|
||||
FetchDriver::ContinueHttpFetchAfterServiceWorker()
|
||||
{
|
||||
if (!mResponse) {
|
||||
// FIXME(nsm): Set skip SW flag.
|
||||
// FIXME(nsm): Deal with CORS flags cases which will also call
|
||||
// ContinueHttpFetchAfterCORSPreflight().
|
||||
return ContinueHttpFetchAfterCORSPreflight();
|
||||
}
|
||||
|
||||
// Otherwise ServiceWorker replied with a response.
|
||||
return ContinueHttpFetchAfterNetworkFetch();
|
||||
}
|
||||
|
||||
nsresult
|
||||
FetchDriver::ContinueHttpFetchAfterCORSPreflight()
|
||||
{
|
||||
// mResponse is currently the CORS response.
|
||||
// We may have to pass it via argument.
|
||||
if (mResponse && mResponse->IsError()) {
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
return HttpNetworkFetch();
|
||||
}
|
||||
|
||||
nsresult
|
||||
FetchDriver::HttpNetworkFetch()
|
||||
{
|
||||
// We don't create a HTTPRequest copy since Necko sets the information on the
|
||||
// nsIHttpChannel instead.
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
|
||||
@ -336,6 +309,13 @@ FetchDriver::HttpNetworkFetch()
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Step 2 deals with letting ServiceWorkers intercept requests. This is
|
||||
// handled by Necko after the channel is opened.
|
||||
// FIXME(nsm): Bug 1119026: The channel's skip service worker flag should be
|
||||
// set based on the Request's flag.
|
||||
|
||||
// From here on we create a channel and set its properties with the
|
||||
// information from the InternalRequest. This is an implementation detail.
|
||||
MOZ_ASSERT(mLoadGroup);
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
rv = NS_NewChannel(getter_AddRefs(chan),
|
||||
@ -353,8 +333,44 @@ FetchDriver::HttpNetworkFetch()
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Insert ourselves into the notification callbacks chain so we can handle
|
||||
// cross-origin redirects.
|
||||
chan->GetNotificationCallbacks(getter_AddRefs(mNotificationCallbacks));
|
||||
chan->SetNotificationCallbacks(this);
|
||||
|
||||
// Step 3.1 "If the CORS preflight flag is set and one of these conditions is
|
||||
// true..." is handled by the CORS proxy.
|
||||
//
|
||||
// Step 3.2 "Set request's skip service worker flag." This isn't required
|
||||
// since Necko will fall back to the network if the ServiceWorker does not
|
||||
// respond with a valid Response.
|
||||
//
|
||||
// NS_StartCORSPreflight() will automatically kick off the original request
|
||||
// if it succeeds, so we need to have everything setup for the original
|
||||
// request too.
|
||||
|
||||
// Step 3.3 "Let credentials flag be set if either request's credentials mode
|
||||
// is include, or request's credentials mode is same-origin and the CORS flag
|
||||
// is unset, and unset otherwise."
|
||||
bool useCredentials = false;
|
||||
if (mRequest->GetCredentialsMode() == RequestCredentials::Include ||
|
||||
(mRequest->GetCredentialsMode() == RequestCredentials::Same_origin && !aCORSFlag)) {
|
||||
useCredentials = true;
|
||||
}
|
||||
|
||||
// FIXME(nsm): Bug 1120715.
|
||||
// Step 3.4 "If request's cache mode is default and request's header list
|
||||
// contains a header named `If-Modified-Since`, `If-None-Match`,
|
||||
// `If-Unmodified-Since`, `If-Match`, or `If-Range`, set request's cache mode
|
||||
// to no-store."
|
||||
|
||||
// Step 3.5 begins "HTTP network or cache fetch".
|
||||
// HTTP network or cache fetch
|
||||
// ---------------------------
|
||||
// Step 1 "Let HTTPRequest..." The channel is the HTTPRequest.
|
||||
nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(chan);
|
||||
if (httpChan) {
|
||||
// Copy the method.
|
||||
nsAutoCString method;
|
||||
mRequest->GetMethod(method);
|
||||
rv = httpChan->SetRequestMethod(method);
|
||||
@ -363,39 +379,50 @@ FetchDriver::HttpNetworkFetch()
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Set the same headers.
|
||||
nsAutoTArray<InternalHeaders::Entry, 5> headers;
|
||||
mRequest->Headers()->GetEntries(headers);
|
||||
for (uint32_t i = 0; i < headers.Length(); ++i) {
|
||||
httpChan->SetRequestHeader(headers[i].mName, headers[i].mValue, false /* merge */);
|
||||
}
|
||||
|
||||
// Step 2. Set the referrer. This is handled better in Bug 1112922.
|
||||
MOZ_ASSERT(mRequest->ReferrerIsURL());
|
||||
nsCString referrer = mRequest->ReferrerAsURL();
|
||||
if (!referrer.IsEmpty()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), referrer, nullptr, nullptr, ios);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
rv = httpChan->SetReferrer(uri);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3 "If HTTPRequest's force Origin header flag is set..."
|
||||
if (mRequest->ForceOriginHeader()) {
|
||||
nsAutoString origin;
|
||||
rv = nsContentUtils::GetUTFOrigin(mPrincipal, origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
FailWithNetworkError();
|
||||
return rv;
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
httpChan->SetRequestHeader(NS_LITERAL_CSTRING("origin"),
|
||||
NS_ConvertUTF16toUTF8(origin),
|
||||
false /* merge */);
|
||||
}
|
||||
// Bug 1120722 - Authorization will be handled later.
|
||||
// Auth may require prompting, we don't support it yet.
|
||||
// The next patch in this same bug prevents this from aborting the request.
|
||||
// Credentials checks for CORS are handled by nsCORSListenerProxy,
|
||||
}
|
||||
|
||||
// Step 5. Proxy authentication will be handled by Necko.
|
||||
// FIXME(nsm): Bug 1120715.
|
||||
// Step 7-10. "If request's cache mode is neither no-store nor reload..."
|
||||
|
||||
// Continue setting up 'HTTPRequest'. Content-Type and body data.
|
||||
nsCOMPtr<nsIUploadChannel2> uploadChan = do_QueryInterface(chan);
|
||||
if (uploadChan) {
|
||||
nsAutoCString contentType;
|
||||
@ -404,7 +431,7 @@ FetchDriver::HttpNetworkFetch()
|
||||
// This is an error because the Request constructor explicitly extracts and
|
||||
// sets a content-type per spec.
|
||||
if (result.Failed()) {
|
||||
return result.ErrorCode();
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> bodyStream;
|
||||
@ -414,11 +441,47 @@ FetchDriver::HttpNetworkFetch()
|
||||
mRequest->GetMethod(method);
|
||||
rv = uploadChan->ExplicitSetUploadStream(bodyStream, contentType, -1, method, false /* aStreamHasHeaders */);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
}
|
||||
}
|
||||
return chan->AsyncOpen(this, nullptr);
|
||||
|
||||
// Set up a CORS proxy that will handle the various requirements of the CORS
|
||||
// protocol. It handles the preflight cache and CORS response headers.
|
||||
// If the request is allowed, it will start our original request
|
||||
// and our observer will be notified. On failure, our observer is notified
|
||||
// directly.
|
||||
nsRefPtr<nsCORSListenerProxy> corsListener =
|
||||
new nsCORSListenerProxy(this, mPrincipal, useCredentials);
|
||||
rv = corsListener->Init(chan, true /* allow data uri */);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
// If preflight is required, start a "CORS preflight fetch"
|
||||
// https://fetch.spec.whatwg.org/#cors-preflight-fetch-0. All the
|
||||
// implementation is handled by NS_StartCORSPreflight, we just set up the
|
||||
// unsafeHeaders so they can be verified against the response's
|
||||
// "Access-Control-Allow-Headers" header.
|
||||
if (aCORSPreflightFlag) {
|
||||
nsCOMPtr<nsIChannel> preflightChannel;
|
||||
nsAutoTArray<nsCString, 5> unsafeHeaders;
|
||||
mRequest->Headers()->GetUnsafeHeaders(unsafeHeaders);
|
||||
|
||||
rv = NS_StartCORSPreflight(chan, corsListener, mPrincipal,
|
||||
useCredentials,
|
||||
unsafeHeaders,
|
||||
getter_AddRefs(preflightChannel));
|
||||
} else {
|
||||
rv = chan->AsyncOpen(corsListener, nullptr);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return FailWithNetworkError();
|
||||
}
|
||||
|
||||
// Step 4 onwards of "HTTP Fetch" is handled internally by Necko.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -457,6 +520,7 @@ FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse)
|
||||
}
|
||||
|
||||
MOZ_ASSERT(filteredResponse);
|
||||
MOZ_ASSERT(mObserver);
|
||||
mObserver->OnResponseAvailable(filteredResponse);
|
||||
mResponseAvailableCalled = true;
|
||||
return filteredResponse.forget();
|
||||
@ -472,18 +536,25 @@ FetchDriver::BeginResponse(InternalResponse* aResponse)
|
||||
nsresult
|
||||
FetchDriver::SucceedWithResponse()
|
||||
{
|
||||
mObserver->OnResponseEnd();
|
||||
workers::AssertIsOnMainThread();
|
||||
if (mObserver) {
|
||||
mObserver->OnResponseEnd();
|
||||
mObserver = nullptr;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
FetchDriver::FailWithNetworkError()
|
||||
{
|
||||
MOZ_ASSERT(mObserver);
|
||||
workers::AssertIsOnMainThread();
|
||||
nsRefPtr<InternalResponse> error = InternalResponse::NetworkError();
|
||||
mObserver->OnResponseAvailable(error);
|
||||
mResponseAvailableCalled = true;
|
||||
mObserver->OnResponseEnd();
|
||||
if (mObserver) {
|
||||
mObserver->OnResponseAvailable(error);
|
||||
mResponseAvailableCalled = true;
|
||||
mObserver->OnResponseEnd();
|
||||
mObserver = nullptr;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -517,7 +588,9 @@ NS_IMETHODIMP
|
||||
FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext)
|
||||
{
|
||||
workers::AssertIsOnMainThread();
|
||||
MOZ_ASSERT(!mPipeOutputStream);
|
||||
MOZ_ASSERT(mObserver);
|
||||
nsresult rv;
|
||||
aRequest->GetStatus(&rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -607,8 +680,10 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatusCode)
|
||||
{
|
||||
MOZ_ASSERT(mPipeOutputStream);
|
||||
mPipeOutputStream->Close();
|
||||
workers::AssertIsOnMainThread();
|
||||
if (mPipeOutputStream) {
|
||||
mPipeOutputStream->Close();
|
||||
}
|
||||
|
||||
if (NS_FAILED(aStatusCode)) {
|
||||
FailWithNetworkError();
|
||||
@ -619,5 +694,157 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This is called when the channel is redirected.
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
|
||||
nsIChannel* aNewChannel,
|
||||
uint32_t aFlags,
|
||||
nsIAsyncVerifyRedirectCallback *aCallback)
|
||||
{
|
||||
NS_PRECONDITION(aNewChannel, "Redirect without a channel?");
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Section 4.2, Step 4.6-4.7, enforcing a redirect count is done by Necko.
|
||||
// The pref used is "network.http.redirection-limit" which is set to 20 by
|
||||
// default.
|
||||
//
|
||||
// Step 4.8. We only unset this for spec compatibility. Any actions we take
|
||||
// on mRequest here do not affect what the channel does.
|
||||
mRequest->UnsetSameOriginDataURL();
|
||||
|
||||
//
|
||||
// Requests that require preflight are not permitted to redirect.
|
||||
// Fetch spec section 4.2 "HTTP Fetch", step 4.9 just uses the manual
|
||||
// redirect flag to decide whether to execute step 4.10 or not. We do not
|
||||
// represent it in our implementation.
|
||||
// The only thing we do is to check if the request requires a preflight (part
|
||||
// of step 4.9), in which case we abort. This part cannot be done by
|
||||
// nsCORSListenerProxy since it does not have access to mRequest.
|
||||
// which case. Step 4.10.3 is handled by OnRedirectVerifyCallback(), and all
|
||||
// the other steps are handled by nsCORSListenerProxy.
|
||||
if (!NS_IsInternalSameURIRedirect(aOldChannel, aNewChannel, aFlags)) {
|
||||
rv = DoesNotRequirePreflight(aNewChannel);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsXMLHttpRequest::OnChannelRedirect: "
|
||||
"DoesNotRequirePreflight returned failure");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
mRedirectCallback = aCallback;
|
||||
mOldRedirectChannel = aOldChannel;
|
||||
mNewRedirectChannel = aNewChannel;
|
||||
|
||||
nsCOMPtr<nsIChannelEventSink> outer =
|
||||
do_GetInterface(mNotificationCallbacks);
|
||||
if (outer) {
|
||||
// The callee is supposed to call OnRedirectVerifyCallback() on success,
|
||||
// and nobody has to call it on failure, so we can just return after this
|
||||
// block.
|
||||
rv = outer->AsyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
aOldChannel->Cancel(rv);
|
||||
mRedirectCallback = nullptr;
|
||||
mOldRedirectChannel = nullptr;
|
||||
mNewRedirectChannel = nullptr;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
(void) OnRedirectVerifyCallback(NS_OK);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Returns NS_OK if no preflight is required, error otherwise.
|
||||
nsresult
|
||||
FetchDriver::DoesNotRequirePreflight(nsIChannel* aChannel)
|
||||
{
|
||||
// If this is a same-origin request or the channel's URI inherits
|
||||
// its principal, it's allowed.
|
||||
if (nsContentUtils::CheckMayLoad(mPrincipal, aChannel, true)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check if we need to do a preflight request.
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
NS_ENSURE_TRUE(httpChannel, NS_ERROR_DOM_BAD_URI);
|
||||
|
||||
nsAutoCString method;
|
||||
httpChannel->GetRequestMethod(method);
|
||||
if (mRequest->Mode() == RequestMode::Cors_with_forced_preflight ||
|
||||
!mRequest->Headers()->HasOnlySimpleHeaders() ||
|
||||
(!method.LowerCaseEqualsLiteral("get") &&
|
||||
!method.LowerCaseEqualsLiteral("post") &&
|
||||
!method.LowerCaseEqualsLiteral("head"))) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
|
||||
{
|
||||
if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
|
||||
*aResult = static_cast<nsIChannelEventSink*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mNotificationCallbacks) {
|
||||
rv = mNotificationCallbacks->GetInterface(aIID, aResult);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ASSERTION(*aResult, "Lying nsIInterfaceRequestor implementation!");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
|
||||
*aResult = static_cast<nsIStreamListener*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIRequestObserver))) {
|
||||
*aResult = static_cast<nsIRequestObserver*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::OnRedirectVerifyCallback(nsresult aResult)
|
||||
{
|
||||
// On a successful redirect we perform the following substeps of Section 4.2,
|
||||
// step 4.10.
|
||||
if (NS_SUCCEEDED(aResult)) {
|
||||
// Step 4.10.3 "Set request's url to locationURL." so that when we set the
|
||||
// Response's URL from the Request's URL in Section 4, step 6, we get the
|
||||
// final value.
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
nsresult rv = NS_GetFinalChannelURI(mNewRedirectChannel, getter_AddRefs(newURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aResult = rv;
|
||||
} else {
|
||||
// We need to update our request's URL.
|
||||
nsAutoCString newUrl;
|
||||
newURI->GetSpec(newUrl);
|
||||
mRequest->SetURL(newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(aResult)) {
|
||||
mOldRedirectChannel->Cancel(aResult);
|
||||
}
|
||||
|
||||
mOldRedirectChannel = nullptr;
|
||||
mNewRedirectChannel = nullptr;
|
||||
mRedirectCallback->OnRedirectVerifyCallback(aResult);
|
||||
mRedirectCallback = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -7,6 +7,9 @@
|
||||
#define mozilla_dom_FetchDriver_h
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsRefPtr.h"
|
||||
|
||||
@ -35,12 +38,18 @@ protected:
|
||||
{ };
|
||||
};
|
||||
|
||||
class FetchDriver MOZ_FINAL : public nsIStreamListener
|
||||
class FetchDriver MOZ_FINAL : public nsIStreamListener,
|
||||
public nsIChannelEventSink,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIAsyncVerifyRedirectCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
||||
|
||||
explicit FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
@ -53,6 +62,10 @@ private:
|
||||
nsRefPtr<InternalResponse> mResponse;
|
||||
nsCOMPtr<nsIOutputStream> mPipeOutputStream;
|
||||
nsRefPtr<FetchDriverObserver> mObserver;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mNotificationCallbacks;
|
||||
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
||||
nsCOMPtr<nsIChannel> mOldRedirectChannel;
|
||||
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
||||
uint32_t mFetchRecursionCount;
|
||||
|
||||
DebugOnly<bool> mResponseAvailableCalled;
|
||||
@ -65,10 +78,7 @@ private:
|
||||
nsresult Fetch(bool aCORSFlag);
|
||||
nsresult ContinueFetch(bool aCORSFlag);
|
||||
nsresult BasicFetch();
|
||||
nsresult HttpFetch(bool aCORSFlag = false, bool aPreflightCORSFlag = false, bool aAuthenticationFlag = false);
|
||||
nsresult ContinueHttpFetchAfterServiceWorker();
|
||||
nsresult ContinueHttpFetchAfterCORSPreflight();
|
||||
nsresult HttpNetworkFetch();
|
||||
nsresult HttpFetch(bool aCORSFlag = false, bool aCORSPreflightFlag = false, bool aAuthenticationFlag = false);
|
||||
nsresult ContinueHttpFetchAfterNetworkFetch();
|
||||
// Returns the filtered response sent to the observer.
|
||||
already_AddRefed<InternalResponse>
|
||||
@ -78,6 +88,7 @@ private:
|
||||
void BeginResponse(InternalResponse* aResponse);
|
||||
nsresult FailWithNetworkError();
|
||||
nsresult SucceedWithResponse();
|
||||
nsresult DoesNotRequirePreflight(nsIChannel* aChannel);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -303,10 +303,28 @@ InternalHeaders::CORSHeaders(InternalHeaders* aHeaders)
|
||||
nsRefPtr<InternalHeaders> cors = new InternalHeaders(aHeaders->mGuard);
|
||||
ErrorResult result;
|
||||
|
||||
nsAutoTArray<nsCString, 1> acExposedNames;
|
||||
aHeaders->GetAll(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), acExposedNames, result);
|
||||
nsAutoCString acExposedNames;
|
||||
aHeaders->Get(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), acExposedNames, result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
|
||||
nsAutoTArray<nsCString, 5> exposeNamesArray;
|
||||
nsCCharSeparatedTokenizer exposeTokens(acExposedNames, ',');
|
||||
while (exposeTokens.hasMoreTokens()) {
|
||||
const nsDependentCSubstring& token = exposeTokens.nextToken();
|
||||
if (token.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!NS_IsValidHTTPToken(token)) {
|
||||
NS_WARNING("Got invalid HTTP token in Access-Control-Expose-Headers. Header value is:");
|
||||
NS_WARNING(acExposedNames.get());
|
||||
exposeNamesArray.Clear();
|
||||
break;
|
||||
}
|
||||
|
||||
exposeNamesArray.AppendElement(token);
|
||||
}
|
||||
|
||||
nsCaseInsensitiveCStringArrayComparator comp;
|
||||
for (uint32_t i = 0; i < aHeaders->mList.Length(); ++i) {
|
||||
const Entry& entry = aHeaders->mList[i];
|
||||
@ -316,7 +334,7 @@ InternalHeaders::CORSHeaders(InternalHeaders* aHeaders)
|
||||
entry.mName.EqualsASCII("expires") ||
|
||||
entry.mName.EqualsASCII("last-modified") ||
|
||||
entry.mName.EqualsASCII("pragma") ||
|
||||
acExposedNames.Contains(entry.mName, comp)) {
|
||||
exposeNamesArray.Contains(entry.mName, comp)) {
|
||||
cors->Append(entry.mName, entry.mValue, result);
|
||||
MOZ_ASSERT(!result.Failed());
|
||||
}
|
||||
@ -331,5 +349,17 @@ InternalHeaders::GetEntries(nsTArray<InternalHeaders::Entry>& aEntries) const
|
||||
MOZ_ASSERT(aEntries.IsEmpty());
|
||||
aEntries.AppendElements(mList);
|
||||
}
|
||||
|
||||
void
|
||||
InternalHeaders::GetUnsafeHeaders(nsTArray<nsCString>& aNames) const
|
||||
{
|
||||
MOZ_ASSERT(aNames.IsEmpty());
|
||||
for (uint32_t i = 0; i < mList.Length(); ++i) {
|
||||
const Entry& header = mList[i];
|
||||
if (!InternalHeaders::IsSimpleHeader(header.mName, header.mValue)) {
|
||||
aNames.AppendElement(header.mName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -89,11 +89,12 @@ public:
|
||||
|
||||
void
|
||||
GetEntries(nsTArray<InternalHeaders::Entry>& aEntries) const;
|
||||
|
||||
void
|
||||
GetUnsafeHeaders(nsTArray<nsCString>& aNames) const;
|
||||
private:
|
||||
virtual ~InternalHeaders();
|
||||
|
||||
static bool IsSimpleHeader(const nsACString& aName,
|
||||
const nsACString& aValue);
|
||||
static bool IsInvalidName(const nsACString& aName, ErrorResult& aRv);
|
||||
static bool IsInvalidValue(const nsACString& aValue, ErrorResult& aRv);
|
||||
bool IsImmutable(ErrorResult& aRv) const;
|
||||
@ -120,6 +121,9 @@ private:
|
||||
IsForbiddenRequestNoCorsHeader(aName, aValue) ||
|
||||
IsForbiddenResponseHeader(aName);
|
||||
}
|
||||
|
||||
static bool IsSimpleHeader(const nsACString& aName,
|
||||
const nsACString& aValue);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -25,9 +25,16 @@ InternalRequest::GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult
|
||||
copy->mURL.Assign(mURL);
|
||||
copy->SetMethod(mMethod);
|
||||
copy->mHeaders = new InternalHeaders(*mHeaders);
|
||||
copy->SetUnsafeRequest();
|
||||
|
||||
copy->mBodyStream = mBodyStream;
|
||||
copy->mForceOriginHeader = true;
|
||||
// The "client" is not stored in our implementation. Fetch API users should
|
||||
// use the appropriate window/document/principal and other Gecko security
|
||||
// mechanisms as appropriate.
|
||||
copy->mSameOriginDataURL = true;
|
||||
copy->mPreserveContentCodings = true;
|
||||
// The default referrer is already about:client.
|
||||
|
||||
copy->mContext = nsIContentPolicy::TYPE_FETCH;
|
||||
copy->mMode = mMode;
|
||||
|
@ -62,10 +62,8 @@ public:
|
||||
, mCredentialsMode(RequestCredentials::Omit)
|
||||
, mResponseTainting(RESPONSETAINT_BASIC)
|
||||
, mCacheMode(RequestCache::Default)
|
||||
, mRedirectCount(0)
|
||||
, mAuthenticationFlag(false)
|
||||
, mForceOriginHeader(false)
|
||||
, mManualRedirect(false)
|
||||
, mPreserveContentCodings(false)
|
||||
// FIXME(nsm): This should be false by default, but will lead to the
|
||||
// algorithm never loading data: URLs right now. See Bug 1018872 about
|
||||
@ -92,10 +90,8 @@ public:
|
||||
, mCredentialsMode(aOther.mCredentialsMode)
|
||||
, mResponseTainting(aOther.mResponseTainting)
|
||||
, mCacheMode(aOther.mCacheMode)
|
||||
, mRedirectCount(aOther.mRedirectCount)
|
||||
, mAuthenticationFlag(aOther.mAuthenticationFlag)
|
||||
, mForceOriginHeader(aOther.mForceOriginHeader)
|
||||
, mManualRedirect(aOther.mManualRedirect)
|
||||
, mPreserveContentCodings(aOther.mPreserveContentCodings)
|
||||
, mSameOriginDataURL(aOther.mSameOriginDataURL)
|
||||
, mSandboxedStorageAreaURLs(aOther.mSandboxedStorageAreaURLs)
|
||||
@ -132,6 +128,12 @@ public:
|
||||
aURL.Assign(mURL);
|
||||
}
|
||||
|
||||
void
|
||||
SetURL(const nsACString& aURL)
|
||||
{
|
||||
mURL.Assign(aURL);
|
||||
}
|
||||
|
||||
bool
|
||||
ReferrerIsNone() const
|
||||
{
|
||||
@ -184,6 +186,12 @@ public:
|
||||
mMode = aMode;
|
||||
}
|
||||
|
||||
RequestCredentials
|
||||
GetCredentialsMode() const
|
||||
{
|
||||
return mCredentialsMode;
|
||||
}
|
||||
|
||||
void
|
||||
SetCredentialsMode(RequestCredentials aCredentialsMode)
|
||||
{
|
||||
@ -220,6 +228,12 @@ public:
|
||||
return mUnsafeRequest;
|
||||
}
|
||||
|
||||
void
|
||||
SetUnsafeRequest()
|
||||
{
|
||||
mUnsafeRequest = true;
|
||||
}
|
||||
|
||||
InternalHeaders*
|
||||
Headers()
|
||||
{
|
||||
@ -238,6 +252,12 @@ public:
|
||||
return mSameOriginDataURL;
|
||||
}
|
||||
|
||||
void
|
||||
UnsetSameOriginDataURL()
|
||||
{
|
||||
mSameOriginDataURL = false;
|
||||
}
|
||||
|
||||
void
|
||||
SetBody(nsIInputStream* aStream)
|
||||
{
|
||||
@ -262,12 +282,6 @@ public:
|
||||
private:
|
||||
~InternalRequest();
|
||||
|
||||
void
|
||||
SetURL(const nsACString& aURL)
|
||||
{
|
||||
mURL.Assign(aURL);
|
||||
}
|
||||
|
||||
nsCString mMethod;
|
||||
nsCString mURL;
|
||||
nsRefPtr<InternalHeaders> mHeaders;
|
||||
@ -288,11 +302,8 @@ private:
|
||||
ResponseTainting mResponseTainting;
|
||||
RequestCache mCacheMode;
|
||||
|
||||
uint32_t mRedirectCount;
|
||||
|
||||
bool mAuthenticationFlag;
|
||||
bool mForceOriginHeader;
|
||||
bool mManualRedirect;
|
||||
bool mPreserveContentCodings;
|
||||
bool mSameOriginDataURL;
|
||||
bool mSandboxedStorageAreaURLs;
|
||||
|
@ -13,10 +13,13 @@
|
||||
#include "mozilla/dom/FetchBinding.h"
|
||||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/URL.h"
|
||||
#include "mozilla/dom/workers/bindings/URL.h"
|
||||
|
||||
#include "nsDOMString.h"
|
||||
|
||||
#include "InternalResponse.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -52,12 +55,64 @@ Response::Error(const GlobalObject& aGlobal)
|
||||
|
||||
/* static */ already_AddRefed<Response>
|
||||
Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
uint16_t aStatus)
|
||||
uint16_t aStatus, ErrorResult& aRv)
|
||||
{
|
||||
ErrorResult result;
|
||||
ResponseInit init;
|
||||
nsAutoString parsedURL;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsCOMPtr<nsIURI> docURI = window->GetDocumentURI();
|
||||
nsAutoCString spec;
|
||||
aRv = docURI->GetSpec(spec);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<mozilla::dom::URL> url =
|
||||
dom::URL::Constructor(aGlobal, aUrl, NS_ConvertUTF8toUTF16(spec), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
url->Stringify(parsedURL, aRv);
|
||||
} else {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
worker->AssertIsOnWorkerThread();
|
||||
|
||||
NS_ConvertUTF8toUTF16 baseURL(worker->GetLocationInfo().mHref);
|
||||
nsRefPtr<workers::URL> url =
|
||||
workers::URL::Constructor(aGlobal, aUrl, baseURL, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
url->Stringify(parsedURL, aRv);
|
||||
}
|
||||
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aStatus != 301 && aStatus != 302 && aStatus != 303 && aStatus != 307 && aStatus != 308) {
|
||||
aRv.Throw(NS_ERROR_RANGE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Optional<ArrayBufferOrArrayBufferViewOrBlobOrUSVStringOrURLSearchParams> body;
|
||||
nsRefPtr<Response> r = Response::Constructor(aGlobal, body, init, result);
|
||||
ResponseInit init;
|
||||
init.mStatus = aStatus;
|
||||
nsRefPtr<Response> r = Response::Constructor(aGlobal, body, init, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
r->GetInternalHeaders()->Set(NS_LITERAL_CSTRING("Location"),
|
||||
NS_ConvertUTF16toUTF8(parsedURL), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return r.forget();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
Error(const GlobalObject& aGlobal);
|
||||
|
||||
static already_AddRefed<Response>
|
||||
Redirect(const GlobalObject& aGlobal, const nsAString& aUrl, uint16_t aStatus);
|
||||
Redirect(const GlobalObject& aGlobal, const nsAString& aUrl, uint16_t aStatus, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<Response>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
|
@ -1271,7 +1271,8 @@ HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) co
|
||||
nsAutoString value;
|
||||
GetValueInternal(value);
|
||||
// SetValueInternal handles setting the VALUE_CHANGED bit for us
|
||||
it->SetValueInternal(value, false, true);
|
||||
rv = it->SetValueInternal(value, false, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
break;
|
||||
case VALUE_MODE_FILENAME:
|
||||
@ -1446,7 +1447,8 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
// if @max in the example above were to change from 1 to -1.
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
SetValueInternal(value, false, false);
|
||||
nsresult rv = SetValueInternal(value, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
@ -1458,7 +1460,8 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
// See @max comment
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
SetValueInternal(value, false, false);
|
||||
nsresult rv = SetValueInternal(value, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
@ -1468,7 +1471,8 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
// See @max comment
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
SetValueInternal(value, false, false);
|
||||
nsresult rv = SetValueInternal(value, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
@ -1838,13 +1842,21 @@ HTMLInputElement::SetValue(const nsAString& aValue, ErrorResult& aRv)
|
||||
nsAutoString currentValue;
|
||||
GetValue(currentValue);
|
||||
|
||||
SetValueInternal(aValue, false, true);
|
||||
nsresult rv = SetValueInternal(aValue, false, true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFocusedValue.Equals(currentValue)) {
|
||||
GetValue(mFocusedValue);
|
||||
}
|
||||
} else {
|
||||
SetValueInternal(aValue, false, true);
|
||||
nsresult rv = SetValueInternal(aValue, false, true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2413,7 +2425,8 @@ HTMLInputElement::SetUserInput(const nsAString& aValue)
|
||||
MozSetFileNameArray(list);
|
||||
return NS_OK;
|
||||
} else {
|
||||
SetValueInternal(aValue, true, true);
|
||||
nsresult rv = SetValueInternal(aValue, true, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
@ -2839,7 +2852,9 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
}
|
||||
|
||||
if (IsSingleLineTextControl(false)) {
|
||||
mInputData.mState->SetValue(value, aUserInput, aSetValueChanged);
|
||||
if (!mInputData.mState->SetValue(value, aUserInput, aSetValueChanged)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (mType == NS_FORM_INPUT_EMAIL) {
|
||||
UpdateAllValidityStates(mParserCreating);
|
||||
}
|
||||
@ -3434,7 +3449,8 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
if (IsExperimentalMobileType(mType)) {
|
||||
nsAutoString aValue;
|
||||
GetValueInternal(aValue);
|
||||
SetValueInternal(aValue, false, false);
|
||||
nsresult rv = SetValueInternal(aValue, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
FireChangeEventIfNeeded();
|
||||
}
|
||||
@ -3554,7 +3570,8 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
numberControlFrame->GetValueOfAnonTextControl(value);
|
||||
numberControlFrame->HandlingInputEvent(true);
|
||||
nsWeakFrame weakNumberControlFrame(numberControlFrame);
|
||||
SetValueInternal(value, true, true);
|
||||
rv = SetValueInternal(value, true, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (weakNumberControlFrame.IsAlive()) {
|
||||
numberControlFrame->HandlingInputEvent(false);
|
||||
}
|
||||
@ -3628,6 +3645,8 @@ HTMLInputElement::CancelRangeThumbDrag(bool aIsForUserEvent)
|
||||
// TODO: decide what we should do here - bug 851782.
|
||||
nsAutoString val;
|
||||
ConvertNumberToString(mRangeThumbDragStartValue, val);
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// is small, so we should be fine here.)
|
||||
SetValueInternal(val, true, true);
|
||||
nsRangeFrame* frame = do_QueryFrame(GetPrimaryFrame());
|
||||
if (frame) {
|
||||
@ -3646,6 +3665,8 @@ HTMLInputElement::SetValueOfRangeForUserEvent(Decimal aValue)
|
||||
|
||||
nsAutoString val;
|
||||
ConvertNumberToString(aValue, val);
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// is small, so we should be fine here.)
|
||||
SetValueInternal(val, true, true);
|
||||
nsRangeFrame* frame = do_QueryFrame(GetPrimaryFrame());
|
||||
if (frame) {
|
||||
@ -3737,6 +3758,8 @@ HTMLInputElement::StepNumberControlForUserEvent(int32_t aDirection)
|
||||
|
||||
nsAutoString newVal;
|
||||
ConvertNumberToString(newValue, newVal);
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// is small, so we should be fine here.)
|
||||
SetValueInternal(newVal, true, true);
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
@ -4533,6 +4556,9 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType)
|
||||
} else {
|
||||
value = aOldValue;
|
||||
}
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// may potentially be big, but most likely we've failed to allocate
|
||||
// before the type change.)
|
||||
SetValueInternal(value, false, false);
|
||||
}
|
||||
break;
|
||||
@ -5216,7 +5242,11 @@ HTMLInputElement::SetRangeText(const nsAString& aReplacement, uint32_t aStart,
|
||||
|
||||
if (aStart <= aEnd) {
|
||||
value.Replace(aStart, aEnd - aStart, aReplacement);
|
||||
SetValueInternal(value, false, false);
|
||||
nsresult rv = SetValueInternal(value, false, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t newEnd = aStart + aReplacement.Length();
|
||||
@ -5775,6 +5805,9 @@ HTMLInputElement::DoneCreatingElement()
|
||||
if (GetValueMode() == VALUE_MODE_VALUE) {
|
||||
nsAutoString aValue;
|
||||
GetValue(aValue);
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// may potentially be big, but most likely we've failed to allocate
|
||||
// before the type change.)
|
||||
SetValueInternal(aValue, false, false);
|
||||
}
|
||||
|
||||
@ -5929,9 +5962,11 @@ HTMLInputElement::RestoreState(nsPresState* aState)
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: What should we do if SetValueInternal fails? (The allocation
|
||||
// may potentially be big, but most likely we've failed to allocate
|
||||
// before the type change.)
|
||||
SetValueInternal(inputState->GetValue(), false, true);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,9 @@ HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
|
||||
// nsTextControlFrame::UpdateValueDisplay retrieves the correct value
|
||||
// if needed.
|
||||
SetValueChanged(true);
|
||||
mState.SetValue(aValue, aUserInput, true);
|
||||
if (!mState.SetValue(aValue, aUserInput, true)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -321,7 +323,8 @@ HTMLTextAreaElement::SetValue(const nsAString& aValue)
|
||||
nsAutoString currentValue;
|
||||
GetValueInternal(currentValue, true);
|
||||
|
||||
SetValueInternal(aValue, false);
|
||||
nsresult rv = SetValueInternal(aValue, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mFocusedValue.Equals(currentValue)) {
|
||||
GetValueInternal(mFocusedValue, true);
|
||||
@ -336,8 +339,7 @@ HTMLTextAreaElement::SetUserInput(const nsAString& aValue)
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
SetValueInternal(aValue, true);
|
||||
return NS_OK;
|
||||
return SetValueInternal(aValue, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -966,7 +968,11 @@ HTMLTextAreaElement::SetRangeText(const nsAString& aReplacement,
|
||||
|
||||
if (aStart <= aEnd) {
|
||||
value.Replace(aStart, aEnd - aStart, aReplacement);
|
||||
SetValueInternal(value, false);
|
||||
nsresult rv = SetValueInternal(value, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t newEnd = aStart + aReplacement.Length();
|
||||
@ -1019,7 +1025,8 @@ HTMLTextAreaElement::Reset()
|
||||
|
||||
// To get the initial spellchecking, reset value to
|
||||
// empty string before setting the default value.
|
||||
SetValue(EmptyString());
|
||||
rv = SetValue(EmptyString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsAutoString resetVal;
|
||||
GetDefaultValue(resetVal);
|
||||
rv = SetValue(resetVal);
|
||||
@ -1110,7 +1117,8 @@ HTMLTextAreaElement::RestoreState(nsPresState* aState)
|
||||
if (state) {
|
||||
nsAutoString data;
|
||||
state->GetData(data);
|
||||
SetValue(data);
|
||||
nsresult rv = SetValue(data);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
}
|
||||
|
||||
if (aState->IsDisabledSet()) {
|
||||
@ -1294,7 +1302,7 @@ HTMLTextAreaElement::CopyInnerTo(Element* aDest)
|
||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||
nsAutoString value;
|
||||
GetValueInternal(value, true);
|
||||
static_cast<HTMLTextAreaElement*>(aDest)->SetValue(value);
|
||||
return static_cast<HTMLTextAreaElement*>(aDest)->SetValue(value);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1397,7 +1397,8 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
|
||||
rv = newEditor->EnableUndo(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SetValue(defaultValue, false, false);
|
||||
bool success = SetValue(defaultValue, false, false);
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = newEditor->EnableUndo(true);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"Transaction Manager must have failed");
|
||||
@ -1655,7 +1656,9 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
||||
// Now that we don't have a frame any more, store the value in the text buffer.
|
||||
// The only case where we don't do this is if a value transfer is in progress.
|
||||
if (!mValueTransferInProgress) {
|
||||
SetValue(value, false, false);
|
||||
bool success = SetValue(value, false, false);
|
||||
// TODO Find something better to do if this fails...
|
||||
NS_ENSURE_TRUE_VOID(success);
|
||||
}
|
||||
|
||||
if (mRootNode && mMutationObserver) {
|
||||
@ -1868,10 +1871,12 @@ nsTextEditorState::GetValue(nsAString& aValue, bool aIgnoreWrap) const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
bool aSetValueChanged)
|
||||
{
|
||||
mozilla::fallible_t fallible;
|
||||
|
||||
if (mEditor && mBoundFrame) {
|
||||
// The InsertText call below might flush pending notifications, which
|
||||
// could lead into a scheduled PrepareEditor to be called. That will
|
||||
@ -1901,16 +1906,21 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
// so convert windows and mac platform linebreaks to \n:
|
||||
// Unfortunately aValue is declared const, so we have to copy
|
||||
// in order to do this substitution.
|
||||
nsString newValue(aValue);
|
||||
nsString newValue;
|
||||
if (!newValue.Assign(aValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
if (aValue.FindChar(char16_t('\r')) != -1) {
|
||||
nsContentUtils::PlatformToDOMLineBreaks(newValue);
|
||||
if (!nsContentUtils::PlatformToDOMLineBreaks(newValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mEditor->GetDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) {
|
||||
NS_WARNING("Why don't we have a document?");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Time to mess with our security context... See comments in GetValue()
|
||||
@ -1947,7 +1957,7 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
nsCOMPtr<nsIPlaintextEditor> plaintextEditor = do_QueryInterface(mEditor);
|
||||
if (!plaintextEditor || !weakFrame.IsAlive()) {
|
||||
NS_WARNING("Somehow not a plaintext editor?");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
valueSetter.Init();
|
||||
@ -1986,13 +1996,15 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
// the existing selection -- see bug 574558), in which case we don't
|
||||
// need to reset the value here.
|
||||
if (!mBoundFrame) {
|
||||
SetValue(newValue, false, aSetValueChanged);
|
||||
return SetValue(newValue, false, aSetValueChanged);
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IsSingleLineTextControl()) {
|
||||
mCachedValue = newValue;
|
||||
if (!mCachedValue.Assign(newValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
plaintextEditor->SetMaxTextLength(savedMaxLength);
|
||||
@ -2005,9 +2017,16 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
if (!mValue) {
|
||||
mValue = new nsCString;
|
||||
}
|
||||
nsString value(aValue);
|
||||
nsContentUtils::PlatformToDOMLineBreaks(value);
|
||||
CopyUTF16toUTF8(value, *mValue);
|
||||
nsString value;
|
||||
if (!value.Assign(aValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
if (!nsContentUtils::PlatformToDOMLineBreaks(value, fallible)) {
|
||||
return false;
|
||||
}
|
||||
if (!CopyUTF16toUTF8(value, *mValue, fallible)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update the frame display if needed
|
||||
if (mBoundFrame) {
|
||||
@ -2020,6 +2039,8 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
|
||||
ValueWasChanged(!!mRootNode);
|
||||
|
||||
mTextCtrlElement->OnValueChanged(!!mRootNode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -142,8 +142,9 @@ public:
|
||||
nsresult PrepareEditor(const nsAString *aValue = nullptr);
|
||||
void InitializeKeyboardEventListeners();
|
||||
|
||||
void SetValue(const nsAString& aValue, bool aUserInput,
|
||||
bool aSetValueAsChanged);
|
||||
MOZ_WARN_UNUSED_RESULT bool SetValue(const nsAString& aValue,
|
||||
bool aUserInput,
|
||||
bool aSetValueAsChanged);
|
||||
void GetValue(nsAString& aValue, bool aIgnoreWrap) const;
|
||||
void EmptyValue() { if (mValue) mValue->Truncate(); }
|
||||
bool IsEmpty() const { return mValue ? mValue->IsEmpty() : true; }
|
||||
|
@ -20,8 +20,10 @@
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define strtoll _strtoi64
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf _snprintf_s
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -141,39 +141,39 @@ class SessionMessageTask : public nsRunnable {
|
||||
public:
|
||||
SessionMessageTask(CDMProxy* aProxy,
|
||||
const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL)
|
||||
GMPSessionMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage)
|
||||
: mProxy(aProxy)
|
||||
, mSid(NS_ConvertUTF8toUTF16(aSessionId))
|
||||
, mURL(NS_ConvertUTF8toUTF16(aDestinationURL))
|
||||
, mMsgType(aMessageType)
|
||||
{
|
||||
mMsg.AppendElements(aMessage);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
mProxy->OnSessionMessage(mSid, mMsg, mURL);
|
||||
mProxy->OnSessionMessage(mSid, mMsgType, mMsg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<CDMProxy> mProxy;
|
||||
dom::PromiseId mPid;
|
||||
nsString mSid;
|
||||
GMPSessionMessageType mMsgType;
|
||||
nsTArray<uint8_t> mMsg;
|
||||
nsString mURL;
|
||||
};
|
||||
|
||||
void
|
||||
CDMCallbackProxy::SessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL)
|
||||
GMPSessionMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage)
|
||||
{
|
||||
MOZ_ASSERT(mProxy->IsOnGMPThread());
|
||||
|
||||
nsRefPtr<nsIRunnable> task;
|
||||
task = new SessionMessageTask(mProxy,
|
||||
aSessionId,
|
||||
aMessage,
|
||||
aDestinationURL);
|
||||
aMessageType,
|
||||
aMessage);
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
const nsCString& aSessionId) MOZ_OVERRIDE;
|
||||
|
||||
virtual void SessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL) MOZ_OVERRIDE;
|
||||
GMPSessionMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ExpirationChange(const nsCString& aSessionId,
|
||||
GMPTimestamp aExpiryTime) MOZ_OVERRIDE;
|
||||
|
@ -409,10 +409,20 @@ CDMProxy::OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess)
|
||||
mKeys->OnSessionLoaded(aPromiseId, aSuccess);
|
||||
}
|
||||
|
||||
static dom::MediaKeyMessageType
|
||||
ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
|
||||
switch (aMessageType) {
|
||||
case kGMPLicenseRequest: return dom::MediaKeyMessageType::License_request;
|
||||
case kGMPLicenseRenewal: return dom::MediaKeyMessageType::License_renewal;
|
||||
case kGMPLicenseRelease: return dom::MediaKeyMessageType::License_release;
|
||||
default: return dom::MediaKeyMessageType::License_request;
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
CDMProxy::OnSessionMessage(const nsAString& aSessionId,
|
||||
nsTArray<uint8_t>& aMessage,
|
||||
const nsAString& aDestinationURL)
|
||||
GMPSessionMessageType aMessageType,
|
||||
nsTArray<uint8_t>& aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mKeys.IsNull()) {
|
||||
@ -420,7 +430,7 @@ CDMProxy::OnSessionMessage(const nsAString& aSessionId,
|
||||
}
|
||||
nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
|
||||
if (session) {
|
||||
session->DispatchKeyMessage(aMessage, aDestinationURL);
|
||||
session->DispatchKeyMessage(ToMediaKeyMessageType(aMessageType), aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,8 +120,8 @@ public:
|
||||
|
||||
// Main thread only.
|
||||
void OnSessionMessage(const nsAString& aSessionId,
|
||||
nsTArray<uint8_t>& aMessage,
|
||||
const nsAString& aDestinationURL);
|
||||
GMPSessionMessageType aMessageType,
|
||||
nsTArray<uint8_t>& aMessage);
|
||||
|
||||
// Main thread only.
|
||||
void OnExpirationChange(const nsAString& aSessionId,
|
||||
|
@ -63,13 +63,13 @@ MediaKeyMessageEvent::WrapObjectInternal(JSContext* aCx)
|
||||
|
||||
already_AddRefed<MediaKeyMessageEvent>
|
||||
MediaKeyMessageEvent::Constructor(EventTarget* aOwner,
|
||||
const nsAString& aURL,
|
||||
MediaKeyMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage)
|
||||
{
|
||||
nsRefPtr<MediaKeyMessageEvent> e = new MediaKeyMessageEvent(aOwner);
|
||||
e->InitEvent(NS_LITERAL_STRING("message"), false, false);
|
||||
e->mMessageType = aMessageType;
|
||||
e->mRawMessage = aMessage;
|
||||
e->mDestinationURL = aURL;
|
||||
e->SetTrusted(true);
|
||||
return e.forget();
|
||||
}
|
||||
@ -97,7 +97,7 @@ MediaKeyMessageEvent::Constructor(const GlobalObject& aGlobal,
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
e->mDestinationURL = aEventInitDict.mDestinationURL;
|
||||
e->mMessageType = aEventInitDict.mMessageType;
|
||||
e->SetTrusted(trusted);
|
||||
return e.forget();
|
||||
}
|
||||
@ -121,11 +121,5 @@ MediaKeyMessageEvent::GetMessage(JSContext* cx,
|
||||
aMessage.set(mMessage);
|
||||
}
|
||||
|
||||
void
|
||||
MediaKeyMessageEvent::GetDestinationURL(nsString& aRetVal) const
|
||||
{
|
||||
aRetVal = mDestinationURL;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -31,8 +31,8 @@ protected:
|
||||
virtual ~MediaKeyMessageEvent();
|
||||
explicit MediaKeyMessageEvent(EventTarget* aOwner);
|
||||
|
||||
MediaKeyMessageType mMessageType;
|
||||
JS::Heap<JSObject*> mMessage;
|
||||
nsString mDestinationURL;
|
||||
|
||||
public:
|
||||
virtual MediaKeyMessageEvent* AsMediaKeyMessageEvent();
|
||||
@ -40,9 +40,9 @@ public:
|
||||
virtual JSObject* WrapObjectInternal(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
static already_AddRefed<MediaKeyMessageEvent>
|
||||
Constructor(EventTarget* aOwner,
|
||||
const nsAString& aURL,
|
||||
const nsTArray<uint8_t>& aMessage);
|
||||
Constructor(EventTarget* aOwner,
|
||||
MediaKeyMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage);
|
||||
|
||||
static already_AddRefed<MediaKeyMessageEvent>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
@ -50,12 +50,12 @@ public:
|
||||
const MediaKeyMessageEventInit& aEventInitDict,
|
||||
ErrorResult& aRv);
|
||||
|
||||
MediaKeyMessageType MessageType() const { return mMessageType; }
|
||||
|
||||
void GetMessage(JSContext* cx,
|
||||
JS::MutableHandle<JSObject*> aMessage,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void GetDestinationURL(nsString& aRetVal) const;
|
||||
|
||||
private:
|
||||
nsTArray<uint8_t> mRawMessage;
|
||||
};
|
||||
|
@ -277,11 +277,11 @@ MediaKeySession::GetUsableKeyIds(ErrorResult& aRv)
|
||||
}
|
||||
|
||||
void
|
||||
MediaKeySession::DispatchKeyMessage(const nsTArray<uint8_t>& aMessage,
|
||||
const nsAString& aURL)
|
||||
MediaKeySession::DispatchKeyMessage(MediaKeyMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage)
|
||||
{
|
||||
nsRefPtr<MediaKeyMessageEvent> event(
|
||||
MediaKeyMessageEvent::Constructor(this, aURL, aMessage));
|
||||
MediaKeyMessageEvent::Constructor(this, aMessageType, aMessage));
|
||||
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, event);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/MediaKeySessionBinding.h"
|
||||
#include "mozilla/dom/MediaKeysBinding.h"
|
||||
#include "mozilla/dom/MediaKeyMessageEventBinding.h"
|
||||
|
||||
struct JSContext;
|
||||
|
||||
@ -79,8 +80,8 @@ public:
|
||||
|
||||
already_AddRefed<Promise> GetUsableKeyIds(ErrorResult& aRv);
|
||||
|
||||
void DispatchKeyMessage(const nsTArray<uint8_t>& aMessage,
|
||||
const nsAString& aURL);
|
||||
void DispatchKeyMessage(MediaKeyMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage);
|
||||
|
||||
void DispatchKeyError(uint32_t system_code);
|
||||
|
||||
|
@ -525,6 +525,14 @@ MP4Reader::RequestVideoData(bool aSkipToNextKeyframe,
|
||||
MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
|
||||
VLOG("RequestVideoData skip=%d time=%lld", aSkipToNextKeyframe, aTimeThreshold);
|
||||
|
||||
if (mShutdown) {
|
||||
NS_WARNING("RequestVideoData on shutdown MP4Reader!");
|
||||
MonitorAutoLock lock(mVideo.mMonitor);
|
||||
nsRefPtr<VideoDataPromise> p = mVideo.mPromise.Ensure(__func__);
|
||||
p->Reject(CANCELED, __func__);
|
||||
return p;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(HasVideo() && mPlatform && mVideo.mDecoder);
|
||||
|
||||
bool eos = false;
|
||||
@ -555,7 +563,12 @@ MP4Reader::RequestAudioData()
|
||||
VLOG("RequestAudioData");
|
||||
MonitorAutoLock lock(mAudio.mMonitor);
|
||||
nsRefPtr<AudioDataPromise> p = mAudio.mPromise.Ensure(__func__);
|
||||
ScheduleUpdate(kAudio);
|
||||
if (!mShutdown) {
|
||||
ScheduleUpdate(kAudio);
|
||||
} else {
|
||||
NS_WARNING("RequestAudioData on shutdown MP4Reader!");
|
||||
p->Reject(CANCELED, __func__);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -740,12 +753,16 @@ MP4Reader::ResetDecode()
|
||||
Flush(kVideo);
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
mDemuxer->SeekVideo(0);
|
||||
if (mDemuxer) {
|
||||
mDemuxer->SeekVideo(0);
|
||||
}
|
||||
}
|
||||
Flush(kAudio);
|
||||
{
|
||||
MonitorAutoLock mon(mDemuxerMonitor);
|
||||
mDemuxer->SeekAudio(0);
|
||||
if (mDemuxer) {
|
||||
mDemuxer->SeekAudio(0);
|
||||
}
|
||||
}
|
||||
return MediaDecoderReader::ResetDecode();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Name: fake
|
||||
Description: Fake GMP Plugin
|
||||
Version: 1.0
|
||||
APIs: encode-video[h264], decode-video[h264], eme-decrypt-v2[fake]
|
||||
APIs: encode-video[h264], decode-video[h264], eme-decrypt-v3[fake]
|
||||
Libraries: dxva2.dll
|
||||
|
@ -116,8 +116,8 @@ FakeDecryptor::Message(const std::string& aMessage)
|
||||
MOZ_ASSERT(sInstance);
|
||||
const static std::string sid("fake-session-id");
|
||||
sInstance->mCallback->SessionMessage(sid.c_str(), sid.size(),
|
||||
(const uint8_t*)aMessage.c_str(), aMessage.size(),
|
||||
nullptr, 0);
|
||||
kGMPLicenseRequest,
|
||||
(const uint8_t*)aMessage.c_str(), aMessage.size());
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
|
@ -83,16 +83,15 @@ GMPDecryptorChild::RejectPromise(uint32_t aPromiseId,
|
||||
void
|
||||
GMPDecryptorChild::SessionMessage(const char* aSessionId,
|
||||
uint32_t aSessionIdLength,
|
||||
GMPSessionMessageType aMessageType,
|
||||
const uint8_t* aMessage,
|
||||
uint32_t aMessageLength,
|
||||
const char* aDestinationURL,
|
||||
uint32_t aDestinationURLLength)
|
||||
uint32_t aMessageLength)
|
||||
{
|
||||
nsTArray<uint8_t> msg;
|
||||
msg.AppendElements(aMessage, aMessageLength);
|
||||
CALL_ON_GMP_THREAD(SendSessionMessage,
|
||||
nsAutoCString(aSessionId, aSessionIdLength), msg,
|
||||
nsAutoCString(aDestinationURL, aDestinationURLLength));
|
||||
nsAutoCString(aSessionId, aSessionIdLength),
|
||||
aMessageType, msg);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -45,10 +45,9 @@ public:
|
||||
|
||||
virtual void SessionMessage(const char* aSessionId,
|
||||
uint32_t aSessionIdLength,
|
||||
GMPSessionMessageType aMessageType,
|
||||
const uint8_t* aMessage,
|
||||
uint32_t aMessageLength,
|
||||
const char* aDestinationURL,
|
||||
uint32_t aDestinationURLLength) MOZ_OVERRIDE;
|
||||
uint32_t aMessageLength) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ExpirationChange(const char* aSessionId,
|
||||
uint32_t aSessionIdLength,
|
||||
|
@ -213,14 +213,14 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
|
||||
|
||||
bool
|
||||
GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL)
|
||||
const GMPSessionMessageType& aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage)
|
||||
{
|
||||
if (!mIsOpen) {
|
||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||
return false;
|
||||
}
|
||||
mCallback->SessionMessage(aSessionId, aMessage, aDestinationURL);
|
||||
mCallback->SessionMessage(aSessionId, aMessageType, aMessage);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ private:
|
||||
const nsCString& aMessage) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvSessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL) MOZ_OVERRIDE;
|
||||
const GMPSessionMessageType& aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvExpirationChange(const nsCString& aSessionId,
|
||||
const double& aExpiryTime) MOZ_OVERRIDE;
|
||||
|
@ -31,8 +31,8 @@ public:
|
||||
const nsCString& aSessionId) = 0;
|
||||
|
||||
virtual void SessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL) = 0;
|
||||
GMPSessionMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage) = 0;
|
||||
|
||||
virtual void ExpirationChange(const nsCString& aSessionId,
|
||||
GMPTimestamp aExpiryTime) = 0;
|
||||
|
@ -53,6 +53,13 @@ struct ParamTraits<GMPDOMException>
|
||||
: public EnumSerializer<GMPDOMException, GMPDomExceptionValidator>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<GMPSessionMessageType>
|
||||
: public ContiguousEnumSerializer<GMPSessionMessageType,
|
||||
kGMPLicenseRequest,
|
||||
kGMPMessageInvalid>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<GMPSessionType>
|
||||
: public ContiguousEnumSerializer<GMPSessionType,
|
||||
|
@ -6,6 +6,7 @@
|
||||
include protocol PGMP;
|
||||
include GMPTypes;
|
||||
|
||||
using GMPSessionMessageType from "gmp-decryption.h";
|
||||
using GMPSessionType from "gmp-decryption.h";
|
||||
using GMPDOMException from "gmp-decryption.h";
|
||||
using GMPErr from "gmp-errors.h";
|
||||
@ -64,8 +65,8 @@ parent:
|
||||
nsCString aMessage);
|
||||
|
||||
SessionMessage(nsCString aSessionId,
|
||||
uint8_t[] aMessage,
|
||||
nsCString aDestinationURL);
|
||||
GMPSessionMessageType aMessageType,
|
||||
uint8_t[] aMessage);
|
||||
|
||||
ExpirationChange(nsCString aSessionId, double aExpiryTime);
|
||||
|
||||
|
@ -68,6 +68,13 @@ enum GMPDOMException {
|
||||
kGMPTimeoutError = 23
|
||||
};
|
||||
|
||||
enum GMPSessionMessageType {
|
||||
kGMPLicenseRequest = 0,
|
||||
kGMPLicenseRenewal = 1,
|
||||
kGMPLicenseRelease = 2,
|
||||
kGMPMessageInvalid = 3 // Must always be last.
|
||||
};
|
||||
|
||||
// Time in milliseconds, as offset from epoch, 1 Jan 1970.
|
||||
typedef int64_t GMPTimestamp;
|
||||
|
||||
@ -139,10 +146,9 @@ public:
|
||||
// aSessionId must be null terminated.
|
||||
virtual void SessionMessage(const char* aSessionId,
|
||||
uint32_t aSessionIdLength,
|
||||
GMPSessionMessageType aMessageType,
|
||||
const uint8_t* aMessage,
|
||||
uint32_t aMessageLength,
|
||||
const char* aDestinationURL,
|
||||
uint32_t aDestinationURLLength) = 0;
|
||||
uint32_t aMessageLength) = 0;
|
||||
|
||||
// aSessionId must be null terminated.
|
||||
virtual void ExpirationChange(const char* aSessionId,
|
||||
@ -213,7 +219,7 @@ enum GMPSessionType {
|
||||
kGMPSessionInvalid = 2 // Must always be last.
|
||||
};
|
||||
|
||||
#define GMP_API_DECRYPTOR "eme-decrypt-v2"
|
||||
#define GMP_API_DECRYPTOR "eme-decrypt-v3"
|
||||
|
||||
// API exposed by plugin library to manage decryption sessions.
|
||||
// When the Host requests this by calling GMPGetAPIFunc().
|
||||
|
@ -1083,8 +1083,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
}
|
||||
|
||||
virtual void SessionMessage(const nsCString& aSessionId,
|
||||
const nsTArray<uint8_t>& aMessage,
|
||||
const nsCString& aDestinationURL) MOZ_OVERRIDE
|
||||
GMPSessionMessageType aMessageType,
|
||||
const nsTArray<uint8_t>& aMessage) MOZ_OVERRIDE
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
|
||||
|
@ -408,7 +408,7 @@ CreateNPObjWrapperTable()
|
||||
return false;
|
||||
}
|
||||
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(), nullptr,
|
||||
PL_DHashTableInit(&sNPObjWrappers, PL_DHashGetStubOps(),
|
||||
sizeof(NPObjWrapperHashEntry));
|
||||
return true;
|
||||
}
|
||||
|
@ -4,8 +4,10 @@ support-files =
|
||||
test_headers_mainthread.js
|
||||
worker_test_fetch_basic.js
|
||||
worker_test_fetch_basic_http.js
|
||||
worker_test_fetch_cors.js
|
||||
worker_wrapper.js
|
||||
|
||||
[test_headers.html]
|
||||
[test_fetch_basic.html]
|
||||
[test_fetch_basic_http.html]
|
||||
[test_fetch_cors.html]
|
||||
|
57
dom/tests/mochitest/fetch/test_fetch_cors.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1039846 - Test fetch() CORS mode</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var worker;
|
||||
function testOnWorker(done) {
|
||||
ok(true, "=== Start Worker Tests ===");
|
||||
worker = new Worker("worker_test_fetch_cors.js");
|
||||
worker.onmessage = function(event) {
|
||||
if (event.data.type == "finish") {
|
||||
ok(true, "=== Finish Worker Tests ===");
|
||||
done();
|
||||
} else if (event.data.type == "status") {
|
||||
ok(event.data.status, event.data.msg);
|
||||
}
|
||||
}
|
||||
|
||||
worker.onerror = function(event) {
|
||||
ok(false, "Worker had an error: " + event.message);
|
||||
ok(true, "=== Finish Worker Tests ===");
|
||||
done();
|
||||
};
|
||||
|
||||
worker.postMessage("start");
|
||||
}
|
||||
|
||||
//
|
||||
// Driver
|
||||
//
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.fetch.enabled", true]
|
||||
]}, function() {
|
||||
testOnWorker(function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -24,7 +24,11 @@ function testURL() {
|
||||
ok(res.type !== "error", "Response should not be an error for " + entry[0]);
|
||||
is(res.status, entry[2], "Status should match expected for " + entry[0]);
|
||||
is(res.statusText, entry[3], "Status text should match expected for " + entry[0]);
|
||||
ok(res.url.endsWith(path + entry[0]), "Response url should match request for simple fetch for " + entry[0]);
|
||||
// This file redirects to pass2
|
||||
if (entry[0] != "file_XHR_pass3.txt")
|
||||
ok(res.url.endsWith(path + entry[0]), "Response url should match request for simple fetch for " + entry[0]);
|
||||
else
|
||||
ok(res.url.endsWith(path + "file_XHR_pass2.txt"), "Response url should match request for simple fetch for " + entry[0]);
|
||||
is(res.headers.get('content-type'), entry[4], "Response should have content-type for " + entry[0]);
|
||||
});
|
||||
promises.push(p);
|
||||
@ -56,7 +60,10 @@ function testRequestGET() {
|
||||
ok(res.type !== "error", "Response should not be an error for " + entry[0]);
|
||||
is(res.status, entry[2], "Status should match expected for " + entry[0]);
|
||||
is(res.statusText, entry[3], "Status text should match expected for " + entry[0]);
|
||||
ok(res.url.endsWith(path + entry[0]), "Response url should match request for simple fetch for " + entry[0]);
|
||||
if (entry[0] != "file_XHR_pass3.txt")
|
||||
ok(res.url.endsWith(path + entry[0]), "Response url should match request for simple fetch for " + entry[0]);
|
||||
else
|
||||
ok(res.url.endsWith(path + "file_XHR_pass2.txt"), "Response url should match request for simple fetch for " + entry[0]);
|
||||
is(res.headers.get('content-type'), entry[4], "Response should have content-type for " + entry[0]);
|
||||
});
|
||||
promises.push(p);
|
||||
|
1209
dom/tests/mochitest/fetch/worker_test_fetch_cors.js
Normal file
@ -10,14 +10,20 @@
|
||||
* W3C liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
enum MediaKeyMessageType {
|
||||
"license-request",
|
||||
"license-renewal",
|
||||
"license-release"
|
||||
};
|
||||
|
||||
[Pref="media.eme.enabled", Constructor(DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
|
||||
interface MediaKeyMessageEvent : Event {
|
||||
readonly attribute MediaKeyMessageType messageType;
|
||||
[Throws]
|
||||
readonly attribute ArrayBuffer message;
|
||||
readonly attribute DOMString? destinationURL;
|
||||
};
|
||||
|
||||
dictionary MediaKeyMessageEventInit : EventInit {
|
||||
MediaKeyMessageType messageType = "license-request";
|
||||
ArrayBuffer message;
|
||||
DOMString? destinationURL = null;
|
||||
};
|
||||
|
@ -12,7 +12,8 @@
|
||||
Func="mozilla::dom::Headers::PrefEnabled"]
|
||||
interface Response {
|
||||
[NewObject] static Response error();
|
||||
[NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
|
||||
[Throws,
|
||||
NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
|
||||
|
||||
readonly attribute ResponseType type;
|
||||
|
||||
|
@ -68,7 +68,7 @@ WorkerThread::WorkerThread()
|
||||
: nsThread(nsThread::NOT_MAIN_THREAD, kWorkerStackSize)
|
||||
, mWorkerPrivateCondVar(mLock, "WorkerThread::mWorkerPrivateCondVar")
|
||||
, mWorkerPrivate(nullptr)
|
||||
, mOtherThreadDispatchingViaEventTarget(false)
|
||||
, mOtherThreadsDispatchingViaEventTarget(0)
|
||||
, mAcceptingNonWorkerRunnables(true)
|
||||
{
|
||||
}
|
||||
@ -76,7 +76,7 @@ WorkerThread::WorkerThread()
|
||||
WorkerThread::~WorkerThread()
|
||||
{
|
||||
MOZ_ASSERT(!mWorkerPrivate);
|
||||
MOZ_ASSERT(!mOtherThreadDispatchingViaEventTarget);
|
||||
MOZ_ASSERT(!mOtherThreadsDispatchingViaEventTarget);
|
||||
MOZ_ASSERT(mAcceptingNonWorkerRunnables);
|
||||
}
|
||||
|
||||
@ -123,11 +123,11 @@ WorkerThread::SetWorker(const WorkerThreadFriendKey& /* aKey */,
|
||||
|
||||
MOZ_ASSERT(mWorkerPrivate);
|
||||
MOZ_ASSERT(!mAcceptingNonWorkerRunnables);
|
||||
MOZ_ASSERT(!mOtherThreadDispatchingViaEventTarget,
|
||||
MOZ_ASSERT(!mOtherThreadsDispatchingViaEventTarget,
|
||||
"XPCOM Dispatch hapenning at the same time our thread is "
|
||||
"being unset! This should not be possible!");
|
||||
|
||||
while (mOtherThreadDispatchingViaEventTarget) {
|
||||
while (mOtherThreadsDispatchingViaEventTarget) {
|
||||
mWorkerPrivateCondVar.Wait();
|
||||
}
|
||||
|
||||
@ -234,14 +234,14 @@ WorkerThread::Dispatch(nsIRunnable* aRunnable, uint32_t aFlags)
|
||||
} else {
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
MOZ_ASSERT(!mOtherThreadDispatchingViaEventTarget);
|
||||
MOZ_ASSERT(mOtherThreadsDispatchingViaEventTarget < UINT32_MAX);
|
||||
|
||||
if (mWorkerPrivate) {
|
||||
workerPrivate = mWorkerPrivate;
|
||||
|
||||
// Setting this flag will make the worker thread sleep if it somehow tries
|
||||
// to unset mWorkerPrivate while we're using it.
|
||||
mOtherThreadDispatchingViaEventTarget = true;
|
||||
// Incrementing this counter will make the worker thread sleep if it
|
||||
// somehow tries to unset mWorkerPrivate while we're using it.
|
||||
mOtherThreadsDispatchingViaEventTarget++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,10 +270,11 @@ WorkerThread::Dispatch(nsIRunnable* aRunnable, uint32_t aFlags)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
MOZ_ASSERT(mOtherThreadDispatchingViaEventTarget);
|
||||
mOtherThreadDispatchingViaEventTarget = false;
|
||||
MOZ_ASSERT(mOtherThreadsDispatchingViaEventTarget);
|
||||
|
||||
mWorkerPrivateCondVar.Notify();
|
||||
if (!--mOtherThreadsDispatchingViaEventTarget) {
|
||||
mWorkerPrivateCondVar.Notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class WorkerThread MOZ_FINAL
|
||||
nsRefPtr<Observer> mObserver;
|
||||
|
||||
// Protected by nsThread::mLock and waited on with mWorkerPrivateCondVar.
|
||||
bool mOtherThreadDispatchingViaEventTarget;
|
||||
uint32_t mOtherThreadsDispatchingViaEventTarget;
|
||||
|
||||
// Protected by nsThread::mLock.
|
||||
DebugOnly<bool> mAcceptingNonWorkerRunnables;
|
||||
|