зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central. a=merge
This commit is contained in:
Коммит
e487e6e564
|
@ -1165,7 +1165,6 @@ pref("services.sync.prefs.sync.lightweightThemes.selectedThemeID", true);
|
|||
pref("services.sync.prefs.sync.lightweightThemes.usedThemes", true);
|
||||
pref("services.sync.prefs.sync.network.cookie.cookieBehavior", true);
|
||||
pref("services.sync.prefs.sync.network.cookie.lifetimePolicy", true);
|
||||
pref("services.sync.prefs.sync.network.cookie.lifetime.days", true);
|
||||
pref("services.sync.prefs.sync.network.cookie.thirdparty.sessionOnly", true);
|
||||
pref("services.sync.prefs.sync.permissions.default.image", true);
|
||||
pref("services.sync.prefs.sync.pref.advanced.images.disable_button.view_image", true);
|
||||
|
|
|
@ -2417,14 +2417,7 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
|
|||
* @resolves { url, postData, mayInheritPrincipal }. If it's not possible
|
||||
* to discern a keyword or an alias, url will be the input string.
|
||||
*/
|
||||
function getShortcutOrURIAndPostData(url, callback = null) {
|
||||
if (callback) {
|
||||
Deprecated.warning("Please use the Promise returned by " +
|
||||
"getShortcutOrURIAndPostData() instead of passing a " +
|
||||
"callback",
|
||||
"https://bugzilla.mozilla.org/show_bug.cgi?id=1100294");
|
||||
}
|
||||
return (async function() {
|
||||
async function getShortcutOrURIAndPostData(url) {
|
||||
let mayInheritPrincipal = false;
|
||||
let postData = null;
|
||||
// Split on the first whitespace.
|
||||
|
@ -2472,12 +2465,6 @@ function getShortcutOrURIAndPostData(url, callback = null) {
|
|||
}
|
||||
|
||||
return { url, postData, mayInheritPrincipal };
|
||||
})().then(data => {
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
function getPostDataStream(aPostDataString,
|
||||
|
|
|
@ -169,11 +169,6 @@ whitelist = new Set(whitelist.filter(item =>
|
|||
).map(item => item.file));
|
||||
|
||||
const ignorableWhitelist = new Set([
|
||||
// These 2 files are unreferenced only when building without the crash
|
||||
// reporter (eg. Linux x64 asan builds on treeherder)
|
||||
"chrome://global/locale/crashes.dtd",
|
||||
"chrome://global/locale/crashes.properties",
|
||||
|
||||
// The following files are outside of the omni.ja file, so we only catch them
|
||||
// when testing on a non-packaged build.
|
||||
|
||||
|
|
|
@ -134,6 +134,21 @@ def install_import_library(build_dir, clang_dir):
|
|||
os.path.join(clang_dir, "lib"))
|
||||
|
||||
|
||||
def install_asan_symbols(build_dir, clang_dir):
|
||||
lib_path_pattern = os.path.join("lib", "clang", "*.*.*", "lib", "windows")
|
||||
src_path = glob.glob(os.path.join(build_dir, lib_path_pattern,
|
||||
"clang_rt.asan_dynamic-*.pdb"))
|
||||
dst_path = glob.glob(os.path.join(clang_dir, lib_path_pattern))
|
||||
|
||||
if len(src_path) != 1:
|
||||
raise Exception("Source path pattern did not resolve uniquely")
|
||||
|
||||
if len(src_path) != 1:
|
||||
raise Exception("Destination path pattern did not resolve uniquely")
|
||||
|
||||
shutil.copy2(src_path[0], dst_path[0])
|
||||
|
||||
|
||||
def svn_co(source_dir, url, directory, revision):
|
||||
run_in(source_dir, ["svn", "co", "-q", "-r", revision, url, directory])
|
||||
|
||||
|
@ -226,6 +241,7 @@ def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool,
|
|||
# installed, so we copy it by ourselves.
|
||||
if is_windows():
|
||||
install_import_library(build_dir, inst_dir)
|
||||
install_asan_symbols(build_dir, inst_dir)
|
||||
|
||||
|
||||
# Return the absolute path of a build tool. We first look to see if the
|
||||
|
|
|
@ -50,6 +50,7 @@ OBJDIR_FILES += ['!/dist/bin/.gdbinit_python']
|
|||
# Install the clang-cl runtime library for ASAN next to the binaries we produce.
|
||||
if CONFIG['MOZ_ASAN'] and CONFIG['CC_TYPE'] == 'clang-cl':
|
||||
FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
|
||||
FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH'].replace(".dll", ".pdb")]
|
||||
|
||||
if CONFIG['LLVM_SYMBOLIZER']:
|
||||
FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "ExpandedPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURIWithSpecialOrigin.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
|
@ -411,6 +412,21 @@ BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI,
|
|||
}
|
||||
|
||||
// Check whether the URI knows what its principal is supposed to be.
|
||||
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
|
||||
nsCOMPtr<nsIURIWithSpecialOrigin> uriWithSpecialOrigin = do_QueryInterface(aURI);
|
||||
if (uriWithSpecialOrigin) {
|
||||
nsCOMPtr<nsIURI> origin;
|
||||
rv = uriWithSpecialOrigin->GetOrigin(getter_AddRefs(origin));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(origin);
|
||||
OriginAttributes attrs;
|
||||
RefPtr<BasePrincipal> principal = CreateCodebasePrincipal(origin, attrs);
|
||||
return principal.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIStandardURL.h"
|
||||
#include "nsIURIWithSpecialOrigin.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
|
@ -270,6 +271,21 @@ ContentPrincipal::MayLoadInternal(nsIURI* aURI)
|
|||
{
|
||||
MOZ_ASSERT(aURI);
|
||||
|
||||
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
|
||||
nsCOMPtr<nsIURIWithSpecialOrigin> uriWithSpecialOrigin = do_QueryInterface(aURI);
|
||||
if (uriWithSpecialOrigin) {
|
||||
nsCOMPtr<nsIURI> origin;
|
||||
nsresult rv = uriWithSpecialOrigin->GetOrigin(getter_AddRefs(origin));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(origin);
|
||||
OriginAttributes attrs;
|
||||
RefPtr<BasePrincipal> principal = BasePrincipal::CreateCodebasePrincipal(origin, attrs);
|
||||
return nsIPrincipal::Subsumes(principal);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
|
|
|
@ -9083,7 +9083,6 @@ exports.PSEUDO_ELEMENTS = [
|
|||
":-moz-range-progress",
|
||||
":-moz-range-thumb",
|
||||
":-moz-meter-bar",
|
||||
":-moz-placeholder",
|
||||
":placeholder",
|
||||
":-moz-color-swatch"
|
||||
];
|
||||
|
|
|
@ -443,8 +443,7 @@ CharacterData::ToCString(nsAString& aBuf, int32_t aOffset,
|
|||
nsresult
|
||||
CharacterData::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
|
||||
MOZ_ASSERT(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
|
||||
|
|
|
@ -143,8 +143,7 @@ public:
|
|||
// Implementation for nsIContent
|
||||
nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
void UnbindFromTree(bool aDeep = true, bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -63,9 +63,9 @@ public:
|
|||
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override
|
||||
nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override
|
||||
{
|
||||
NS_ASSERTION(false, "Trying to bind a fragment to a tree");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -1602,8 +1602,7 @@ EditableInclusiveDescendantCount(nsIContent* aContent)
|
|||
|
||||
nsresult
|
||||
Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
|
||||
MOZ_ASSERT((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
|
||||
|
@ -1767,8 +1766,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
nsresult rv;
|
||||
for (nsIContent* child = GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(aDocument, this, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
rv = child->BindToTree(aDocument, this, aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
editableDescendantCount += EditableInclusiveDescendantCount(child);
|
||||
|
@ -1815,11 +1813,10 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
// Call BindToTree on shadow root children.
|
||||
if (ShadowRoot* shadowRoot = GetShadowRoot()) {
|
||||
shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc());
|
||||
MOZ_ASSERT(shadowRoot->GetBindingParent() == this);
|
||||
for (nsIContent* child = shadowRoot->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
rv = child->BindToTree(nullptr, shadowRoot,
|
||||
shadowRoot->GetBindingParent(),
|
||||
aCompileEventHandlers);
|
||||
rv = child->BindToTree(nullptr, shadowRoot, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,12 +664,13 @@ public:
|
|||
RemoveStates(aStates);
|
||||
}
|
||||
|
||||
virtual void UpdateEditableState(bool aNotify) override;
|
||||
void UpdateEditableState(bool aNotify) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURIWithSpecialOrigin.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
|
@ -6344,9 +6345,22 @@ nsresult
|
|||
nsContentUtils::GetUTFOrigin(nsIURI* aURI, nsAString& aOrigin)
|
||||
{
|
||||
MOZ_ASSERT(aURI, "missing uri");
|
||||
nsresult rv;
|
||||
|
||||
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
|
||||
// Check if either URI has a special origin.
|
||||
nsCOMPtr<nsIURIWithSpecialOrigin> uriWithSpecialOrigin = do_QueryInterface(aURI);
|
||||
if (uriWithSpecialOrigin) {
|
||||
nsCOMPtr<nsIURI> origin;
|
||||
rv = uriWithSpecialOrigin->GetOrigin(getter_AddRefs(origin));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return GetUTFOrigin(origin, aOrigin);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isBlobURL = false;
|
||||
nsresult rv = aURI->SchemeIs(BLOBURI_SCHEME, &isBlobURL);
|
||||
rv = aURI->SchemeIs(BLOBURI_SCHEME, &isBlobURL);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// For Blob URI, the path is the URL of the owning page.
|
||||
|
|
|
@ -93,8 +93,6 @@ public:
|
|||
* This is must either be non-null if a particular
|
||||
* binding parent is desired or match aParent's binding
|
||||
* parent.
|
||||
* @param aCompileEventHandlers whether to initialize the event handlers in
|
||||
* the document (used by nsXULElement)
|
||||
* @note either aDocument or aParent must be non-null. If both are null,
|
||||
* this method _will_ crash.
|
||||
* @note This method must not be called by consumers of nsIContent on a node
|
||||
|
@ -103,10 +101,13 @@ public:
|
|||
* changing their binding parent as needed).
|
||||
* @note This method does not add the content node to aParent's child list
|
||||
* @throws NS_ERROR_OUT_OF_MEMORY if that happens
|
||||
*
|
||||
* TODO(emilio): Should we move to nsIContent::BindToTree most of the
|
||||
* FragmentOrElement / CharacterData duplicated code?
|
||||
*/
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) = 0;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) = 0;
|
||||
|
||||
/**
|
||||
* Unbind this content node from a tree. This will set its current document
|
||||
|
|
|
@ -1386,8 +1386,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
|||
|
||||
bool wasInXBLScope = ShouldUseXBLScope(aKid);
|
||||
rv = aKid->BindToTree(doc, parent,
|
||||
parent ? parent->GetBindingParent() : nullptr,
|
||||
true);
|
||||
parent ? parent->GetBindingParent() : nullptr);
|
||||
if (NS_SUCCEEDED(rv) && !wasInXBLScope && ShouldUseXBLScope(aKid)) {
|
||||
MOZ_ASSERT(ShouldUseXBLScope(this),
|
||||
"Why does the kid need to use an XBL scope?");
|
||||
|
|
|
@ -1498,8 +1498,7 @@ nsImageLoadingContent::HaveSize(imgIRequest *aImage)
|
|||
|
||||
void
|
||||
nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
// We may be entering the document, so if our image should be tracked,
|
||||
// track it.
|
||||
|
|
|
@ -212,7 +212,7 @@ protected:
|
|||
|
||||
// Subclasses are *required* to call BindToTree/UnbindFromTree.
|
||||
void BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent, bool aCompileEventHandlers);
|
||||
nsIContent* aBindingParent);
|
||||
void UnbindFromTree(bool aDeep, bool aNullParent);
|
||||
|
||||
nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
|
||||
|
|
|
@ -94,11 +94,12 @@ nsJSUtils::CompileFunction(AutoJSAPI& jsapi,
|
|||
|
||||
// Compile.
|
||||
JS::Rooted<JSFunction*> fun(cx);
|
||||
JS::SourceBufferHolder source(PromiseFlatString(aBody).get(), aBody.Length(),
|
||||
JS::SourceBufferHolder::NoOwnership);
|
||||
if (!JS::CompileFunction(cx, aScopeChain, aOptions,
|
||||
PromiseFlatCString(aName).get(),
|
||||
aArgCount, aArgArray,
|
||||
PromiseFlatString(aBody).get(),
|
||||
aBody.Length(), &fun))
|
||||
source, &fun))
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -600,11 +600,9 @@ nsObjectLoadingContent::SetupDocShell(nsIURI* aRecursionCheckURI)
|
|||
nsresult
|
||||
nsObjectLoadingContent::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent);
|
||||
|
||||
if (aDocument) {
|
||||
aDocument->AddPlugin(this);
|
||||
|
|
|
@ -337,9 +337,9 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
|
||||
void DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner);
|
||||
|
||||
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandler);
|
||||
nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent);
|
||||
void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ public:
|
|||
}
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
@ -137,11 +136,10 @@ nsTextNode::AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
|
|||
|
||||
nsresult
|
||||
nsTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent, bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = CharacterData::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SetDirectionFromNewTextNode(this);
|
||||
|
@ -236,14 +234,13 @@ NS_IMPL_ISUPPORTS_INHERITED(nsAttributeTextNode, nsTextNode,
|
|||
|
||||
nsresult
|
||||
nsAttributeTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
MOZ_ASSERT(aParent && aParent->GetParent(),
|
||||
"This node can't be a child of the document or of the document root");
|
||||
|
||||
nsresult rv = nsTextNode::BindToTree(aDocument, aParent,
|
||||
aBindingParent, aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(!mGrandparent, "We were already bound!");
|
||||
|
|
|
@ -53,8 +53,7 @@ public:
|
|||
bool aCloneText) const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -3262,46 +3262,6 @@ CallerSubsumes(JS::Handle<JS::Value> aValue)
|
|||
return CallerSubsumes(&aValue.toObject());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool
|
||||
WrappedJSToDictionary(JSContext* aCx, nsISupports* aObject, T& aDictionary)
|
||||
{
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(aObject);
|
||||
if (!wrappedObj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, wrappedObj->GetJSObject());
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JSAutoRealmAllowCCW ar(aCx, obj);
|
||||
JS::Rooted<JS::Value> v(aCx, JS::ObjectValue(*obj));
|
||||
return aDictionary.Init(aCx, v);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool
|
||||
WrappedJSToDictionary(nsISupports* aObject, T& aDictionary)
|
||||
{
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(aObject);
|
||||
NS_ENSURE_TRUE(wrappedObj, false);
|
||||
JS::Rooted<JSObject*> obj(RootingCx(), wrappedObj->GetJSObject());
|
||||
NS_ENSURE_TRUE(obj, false);
|
||||
|
||||
nsIGlobalObject* global = xpc::NativeGlobal(obj);
|
||||
NS_ENSURE_TRUE(global, false);
|
||||
|
||||
// we need this AutoEntryScript here because the spec requires us to execute
|
||||
// getters when parsing a dictionary
|
||||
AutoEntryScript aes(global, "WebIDL dictionary creation");
|
||||
|
||||
JS::Rooted<JS::Value> v(aes.cx(), JS::ObjectValue(*obj));
|
||||
return aDictionary.Init(aes.cx(), v);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class S>
|
||||
inline RefPtr<T>
|
||||
StrongOrRawPtr(already_AddRefed<S>&& aPtr)
|
||||
|
|
|
@ -196,8 +196,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
|||
globalObject = win;
|
||||
} else {
|
||||
// No DOM Window. Store the global.
|
||||
JSObject* global = JS::GetNonCCWObjectGlobal(realCallback);
|
||||
globalObject = xpc::NativeGlobal(global);
|
||||
globalObject = xpc::NativeGlobal(realCallback);
|
||||
MOZ_ASSERT(globalObject);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,14 +117,12 @@ HTMLAnchorElement::HasDeferredDNSPrefetchRequest()
|
|||
|
||||
nsresult
|
||||
HTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Prefetch links
|
||||
|
|
|
@ -48,8 +48,7 @@ public:
|
|||
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
||||
|
|
|
@ -92,13 +92,11 @@ HTMLAreaElement::RelList()
|
|||
|
||||
nsresult
|
||||
HTMLAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
|
|
|
@ -46,8 +46,7 @@ public:
|
|||
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -292,12 +292,10 @@ HTMLBodyElement::IsEventAttributeNameInternal(nsAtom *aName)
|
|||
|
||||
nsresult
|
||||
HTMLBodyElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return mAttrsAndChildren.ForceMapped(this, OwnerDoc());
|
||||
}
|
||||
|
|
|
@ -136,8 +136,7 @@ public:
|
|||
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
/**
|
||||
* Called when an attribute has just been changed
|
||||
*/
|
||||
|
|
|
@ -318,12 +318,10 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
|
||||
nsresult
|
||||
HTMLButtonElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent, aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Update our state; we may now be the default submit element
|
||||
|
|
|
@ -62,8 +62,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual void DoneCreatingElement() override;
|
||||
|
|
|
@ -86,17 +86,14 @@ HTMLEmbedElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
|
|||
nsresult
|
||||
HTMLEmbedElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent *aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsObjectLoadingContent::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Don't kick off load from being bound to a plugin document - the plugin
|
||||
|
|
|
@ -37,8 +37,7 @@ public:
|
|||
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent *aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -277,12 +277,10 @@ HTMLFormElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
nsresult
|
||||
HTMLFormElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(aDocument));
|
||||
|
|
|
@ -99,8 +99,7 @@ public:
|
|||
EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
|
|
|
@ -548,16 +548,13 @@ HTMLImageElement::IsHTMLFocusable(bool aWithMouse,
|
|||
|
||||
nsresult
|
||||
HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent);
|
||||
|
||||
if (aParent) {
|
||||
UpdateFormOwner();
|
||||
|
|
|
@ -75,8 +75,7 @@ public:
|
|||
bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual EventStates IntrinsicState() const override;
|
||||
|
|
|
@ -4603,16 +4603,13 @@ HTMLInputElement::MaybeLoadImage()
|
|||
|
||||
nsresult
|
||||
HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent);
|
||||
|
||||
if (mType == NS_FORM_INPUT_IMAGE) {
|
||||
// Our base URI may have changed; claim that our URI changed, and the
|
||||
|
|
|
@ -196,8 +196,7 @@ public:
|
|||
void SetValueOfRangeForUserEvent(Decimal aValue);
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -72,12 +72,10 @@ HTMLLegendElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
|||
|
||||
nsresult
|
||||
HTMLLegendElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
return nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -31,9 +31,9 @@ public:
|
|||
bool aIsTrustedEvent) override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
|
|
|
@ -127,14 +127,12 @@ HTMLLinkElement::HasDeferredDNSPrefetchRequest()
|
|||
nsresult
|
||||
HTMLLinkElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (nsIDocument* doc = GetComposedDoc()) {
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
|
|
|
@ -4538,11 +4538,10 @@ HTMLMediaElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
|
|||
nsresult
|
||||
HTMLMediaElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(
|
||||
aDocument, aParent, aBindingParent, aCompileEventHandlers);
|
||||
aDocument, aParent, aBindingParent);
|
||||
|
||||
mUnboundFromTree = false;
|
||||
|
||||
|
|
|
@ -154,8 +154,7 @@ public:
|
|||
nsAttrValue& aResult) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual void DoneCreatingElement() override;
|
||||
|
|
|
@ -300,12 +300,10 @@ HTMLMenuItemElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
|
||||
nsresult
|
||||
HTMLMenuItemElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && aDocument && mType == CMD_TYPE_RADIO) {
|
||||
AddedToRadioGroup();
|
||||
|
|
|
@ -36,9 +36,9 @@ public:
|
|||
virtual nsresult PostHandleEvent(
|
||||
EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute,
|
||||
|
|
|
@ -80,12 +80,10 @@ HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
|
||||
nsresult
|
||||
HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (aDocument &&
|
||||
AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, nsGkAtoms::viewport, eIgnoreCase)) {
|
||||
|
|
|
@ -22,8 +22,7 @@ public:
|
|||
NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement, nsGenericHTMLElement)
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -230,17 +230,14 @@ HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
nsresult
|
||||
HTMLObjectElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent *aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsObjectLoadingContent::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Don't kick off load from being bound to a plugin document - the plugin
|
||||
|
|
|
@ -50,8 +50,7 @@ public:
|
|||
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent *aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -270,12 +270,10 @@ HTMLOptionElement::SetText(const nsAString& aText, ErrorResult& aRv)
|
|||
|
||||
nsresult
|
||||
HTMLOptionElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Our new parent might change :disabled/:enabled state.
|
||||
|
|
|
@ -76,8 +76,7 @@ public:
|
|||
void UpdateDisabledState(bool aNotify);
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -119,12 +119,10 @@ HTMLOutputElement::IntrinsicState() const
|
|||
|
||||
nsresult
|
||||
HTMLOutputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Unfortunately, we can actually end up having to change our state
|
||||
|
|
|
@ -47,8 +47,7 @@ public:
|
|||
EventStates IntrinsicState() const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
// This function is called when a callback function from nsIMutationObserver
|
||||
// has to be used to update the defaultValue attribute.
|
||||
|
|
|
@ -54,12 +54,10 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLScriptElement, nsGenericHTMLElement,
|
|||
|
||||
nsresult
|
||||
HTMLScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (GetComposedDoc()) {
|
||||
|
|
|
@ -40,8 +40,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
|
|
@ -1108,12 +1108,10 @@ HTMLSelectElement::SelectSomething(bool aNotify)
|
|||
|
||||
nsresult
|
||||
HTMLSelectElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If there is a disabled fieldset in the parent chain, the element is now
|
||||
|
|
|
@ -318,8 +318,7 @@ public:
|
|||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
|
|
|
@ -228,12 +228,10 @@ HTMLSharedElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
|||
|
||||
nsresult
|
||||
HTMLSharedElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The document stores a pointer to its base URI and base target, which we may
|
||||
|
|
|
@ -37,8 +37,7 @@ public:
|
|||
nsAttrValue& aResult) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
|
|
@ -51,14 +51,12 @@ NS_IMPL_ELEMENT_CLONE(HTMLSlotElement)
|
|||
nsresult
|
||||
HTMLSlotElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
RefPtr<ShadowRoot> oldContainingShadow = GetContainingShadow();
|
||||
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ShadowRoot* containingShadow = GetContainingShadow();
|
||||
|
|
|
@ -27,11 +27,10 @@ public:
|
|||
bool aPreallocateChildren) const override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
|
|
|
@ -143,13 +143,11 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
nsresult
|
||||
HTMLSourceElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent *aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
|
||||
aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (auto* media = HTMLMediaElement::FromNodeOrNull(aParent)) {
|
||||
|
|
|
@ -36,8 +36,7 @@ public:
|
|||
// Override BindToTree() so that we can trigger a load when we add a
|
||||
// child source element.
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
|
||||
// If this element's media attr matches for its owner document. Returns true
|
||||
// if no media attr was set.
|
||||
|
|
|
@ -100,12 +100,10 @@ HTMLStyleElement::ContentChanged(nsIContent* aContent)
|
|||
|
||||
nsresult
|
||||
HTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
void (HTMLStyleElement::*update)() = &HTMLStyleElement::UpdateStyleSheetInternal;
|
||||
|
|
|
@ -41,8 +41,7 @@ public:
|
|||
mozilla::ErrorResult& aError) override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
|
|
|
@ -1115,13 +1115,11 @@ HTMLTableElement::ReleaseInheritedAttributes()
|
|||
|
||||
nsresult
|
||||
HTMLTableElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
ReleaseInheritedAttributes();
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
BuildInheritedAttributes();
|
||||
return NS_OK;
|
||||
|
|
|
@ -194,8 +194,7 @@ public:
|
|||
bool aPreallocateChildren) const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
/**
|
||||
|
|
|
@ -911,12 +911,10 @@ HTMLTextAreaElement::IntrinsicState() const
|
|||
|
||||
nsresult
|
||||
HTMLTextAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If there is a disabled fieldset in the parent chain, the element is now
|
||||
|
|
|
@ -104,8 +104,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
|
|
|
@ -82,13 +82,11 @@ HTMLTitleElement::ContentRemoved(nsIContent* aChild,
|
|||
nsresult
|
||||
HTMLTitleElement::BindToTree(nsIDocument *aDocument,
|
||||
nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent *aBindingParent)
|
||||
{
|
||||
// Let this fall through.
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SendTitleChangeEvent(true);
|
||||
|
|
|
@ -41,8 +41,7 @@ public:
|
|||
bool aPreallocateChildren) const override;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent *aBindingParent) override;
|
||||
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
|
|
@ -350,13 +350,11 @@ HTMLTrackElement::LoadResource()
|
|||
nsresult
|
||||
HTMLTrackElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
|
||||
aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
LOG(LogLevel::Debug, ("Track Element bound to tree."));
|
||||
|
|
|
@ -102,8 +102,7 @@ public:
|
|||
// the child of a media element.
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
void DispatchTrackRunnable(const nsString& aEventName);
|
||||
|
|
|
@ -418,12 +418,10 @@ nsGenericHTMLElement::EditableInclusiveDescendantCount()
|
|||
|
||||
nsresult
|
||||
nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aDocument) {
|
||||
|
@ -1751,12 +1749,10 @@ nsGenericHTMLFormElement::GetDesiredIMEState()
|
|||
nsresult
|
||||
nsGenericHTMLFormElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// An autofocus event has to be launched if the autofocus attribute is
|
||||
|
|
|
@ -270,9 +270,9 @@ public:
|
|||
|
||||
public:
|
||||
// Implementation for nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
@ -1012,8 +1012,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual IMEState GetDesiredIMEState() override;
|
||||
|
|
|
@ -231,12 +231,10 @@ nsGenericHTMLFrameElement::LoadSrc()
|
|||
nsresult
|
||||
nsGenericHTMLFrameElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (IsInComposedDoc()) {
|
||||
|
|
|
@ -59,8 +59,7 @@ public:
|
|||
// nsIContent
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
virtual void DestroyContent() override;
|
||||
|
|
|
@ -92,14 +92,12 @@ nsMathMLElement::nsMathMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNod
|
|||
|
||||
nsresult
|
||||
nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsresult rv = nsMathMLElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aDocument) {
|
||||
|
|
|
@ -36,8 +36,7 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
|
||||
|
|
|
@ -119,12 +119,15 @@ ScriptLoadHandler::DecodeRawData(const uint8_t* aData,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
uint32_t haveRead = mRequest->ScriptText().length();
|
||||
// Reference to the script source buffer which we will update.
|
||||
ScriptLoadRequest::ScriptTextBuffer& scriptText = mRequest->ScriptText();
|
||||
|
||||
uint32_t haveRead = scriptText.length();
|
||||
|
||||
CheckedInt<uint32_t> capacity = haveRead;
|
||||
capacity += needed.value();
|
||||
|
||||
if (!capacity.isValid() || !mRequest->ScriptText().reserve(capacity.value())) {
|
||||
if (!capacity.isValid() || !scriptText.resize(capacity.value())) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -134,7 +137,7 @@ ScriptLoadHandler::DecodeRawData(const uint8_t* aData,
|
|||
bool hadErrors;
|
||||
Tie(result, read, written, hadErrors) = mDecoder->DecodeToUTF16(
|
||||
MakeSpan(aData, aDataLength),
|
||||
MakeSpan(mRequest->ScriptText().begin() + haveRead, needed.value()),
|
||||
MakeSpan(scriptText.begin() + haveRead, needed.value()),
|
||||
aEndOfStream);
|
||||
MOZ_ASSERT(result == kInputEmpty);
|
||||
MOZ_ASSERT(read == aDataLength);
|
||||
|
@ -143,7 +146,8 @@ ScriptLoadHandler::DecodeRawData(const uint8_t* aData,
|
|||
|
||||
haveRead += written;
|
||||
MOZ_ASSERT(haveRead <= capacity.value(), "mDecoder produced more data than expected");
|
||||
MOZ_ALWAYS_TRUE(mRequest->ScriptText().resizeUninitialized(haveRead));
|
||||
MOZ_ALWAYS_TRUE(scriptText.resize(haveRead));
|
||||
mRequest->mScriptTextLength = scriptText.length();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
|
|||
, mWasCompiledOMT(false)
|
||||
, mIsTracking(false)
|
||||
, mOffThreadToken(nullptr)
|
||||
, mScriptTextLength(0)
|
||||
, mScriptBytecode()
|
||||
, mBytecodeOffset(0)
|
||||
, mURI(aURI)
|
||||
|
@ -166,7 +167,7 @@ ScriptLoadRequest::SetTextSource()
|
|||
{
|
||||
MOZ_ASSERT(IsUnknownDataType());
|
||||
mDataType = DataType::eTextSource;
|
||||
mScriptData.emplace(VariantType<Vector<char16_t>>());
|
||||
mScriptData.emplace(VariantType<ScriptTextBuffer>());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -175,7 +176,7 @@ ScriptLoadRequest::SetBinASTSource()
|
|||
#ifdef JS_BUILD_BINAST
|
||||
MOZ_ASSERT(IsUnknownDataType());
|
||||
mDataType = DataType::eBinASTSource;
|
||||
mScriptData.emplace(VariantType<Vector<uint8_t>>());
|
||||
mScriptData.emplace(VariantType<BinASTSourceBuffer>());
|
||||
#else
|
||||
MOZ_CRASH("BinAST not supported");
|
||||
#endif
|
||||
|
|
|
@ -171,21 +171,28 @@ public:
|
|||
void SetBinASTSource();
|
||||
void SetBytecode();
|
||||
|
||||
const Vector<char16_t>& ScriptText() const {
|
||||
using ScriptTextBuffer = Vector<char16_t, 0, JSMallocAllocPolicy>;
|
||||
using BinASTSourceBuffer = Vector<uint8_t>;
|
||||
|
||||
const ScriptTextBuffer& ScriptText() const
|
||||
{
|
||||
MOZ_ASSERT(IsTextSource());
|
||||
return mScriptData->as<Vector<char16_t>>();
|
||||
return mScriptData->as<ScriptTextBuffer>();
|
||||
}
|
||||
Vector<char16_t>& ScriptText() {
|
||||
ScriptTextBuffer& ScriptText()
|
||||
{
|
||||
MOZ_ASSERT(IsTextSource());
|
||||
return mScriptData->as<Vector<char16_t>>();
|
||||
return mScriptData->as<ScriptTextBuffer>();
|
||||
}
|
||||
const Vector<uint8_t>& ScriptBinASTData() const {
|
||||
const BinASTSourceBuffer& ScriptBinASTData() const
|
||||
{
|
||||
MOZ_ASSERT(IsBinASTSource());
|
||||
return mScriptData->as<Vector<uint8_t>>();
|
||||
return mScriptData->as<BinASTSourceBuffer>();
|
||||
}
|
||||
Vector<uint8_t>& ScriptBinASTData() {
|
||||
BinASTSourceBuffer& ScriptBinASTData()
|
||||
{
|
||||
MOZ_ASSERT(IsBinASTSource());
|
||||
return mScriptData->as<Vector<uint8_t>>();
|
||||
return mScriptData->as<BinASTSourceBuffer>();
|
||||
}
|
||||
|
||||
enum class ScriptMode : uint8_t {
|
||||
|
@ -252,7 +259,11 @@ public:
|
|||
// Holds script source data for non-inline scripts. Don't use nsString so we
|
||||
// can give ownership to jsapi. Holds either char16_t source text characters
|
||||
// or BinAST encoded bytes depending on mSourceEncoding.
|
||||
Maybe<Variant<Vector<char16_t>, Vector<uint8_t>>> mScriptData;
|
||||
Maybe<Variant<ScriptTextBuffer, BinASTSourceBuffer>> mScriptData;
|
||||
|
||||
// The length of script source text, set when reading completes. This is used
|
||||
// since mScriptData is cleared when the source is passed to the JS engine.
|
||||
size_t mScriptTextLength;
|
||||
|
||||
// Holds the SRI serialized hash and the script bytecode for non-inline
|
||||
// scripts.
|
||||
|
|
|
@ -491,8 +491,7 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest)
|
|||
rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString inlineData;
|
||||
SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
|
||||
SourceBufferHolder srcBuf = GetScriptSource(cx, aRequest);
|
||||
rv = nsJSUtils::CompileModule(cx, srcBuf, global, options, &module);
|
||||
}
|
||||
}
|
||||
|
@ -870,13 +869,6 @@ ScriptLoader::ProcessLoadedModuleTree(ModuleLoadRequest* aRequest)
|
|||
MOZ_ASSERT(aRequest->IsReadyToRun());
|
||||
|
||||
if (aRequest->IsTopLevel()) {
|
||||
ModuleScript* moduleScript = aRequest->mModuleScript;
|
||||
if (moduleScript && !moduleScript->HasErrorToRethrow()) {
|
||||
if (!InstantiateModuleTree(aRequest)) {
|
||||
aRequest->mModuleScript = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (aRequest->mIsInline &&
|
||||
aRequest->mElement->GetParserCreated() == NOT_FROM_PARSER)
|
||||
{
|
||||
|
@ -1778,14 +1770,16 @@ OffThreadScriptLoaderCallback(JS::OffThreadToken* aToken, void* aCallbackData)
|
|||
}
|
||||
|
||||
nsresult
|
||||
ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
|
||||
ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
|
||||
bool* aCouldCompileOut)
|
||||
{
|
||||
MOZ_ASSERT_IF(!aRequest->IsModuleRequest(), aRequest->IsReadyToRun());
|
||||
MOZ_ASSERT(!aRequest->mWasCompiledOMT);
|
||||
MOZ_ASSERT(aCouldCompileOut && !*aCouldCompileOut);
|
||||
|
||||
// Don't off-thread compile inline scripts.
|
||||
if (aRequest->mIsInline) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject = GetScriptGlobalObject();
|
||||
|
@ -1809,19 +1803,19 @@ ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
|
|||
|
||||
if (aRequest->IsTextSource()) {
|
||||
if (!JS::CanCompileOffThread(cx, options, aRequest->ScriptText().length())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
#ifdef JS_BUILD_BINAST
|
||||
} else if (aRequest->IsBinASTSource()) {
|
||||
if (!JS::CanDecodeBinASTOffThread(cx, options, aRequest->ScriptBinASTData().length())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
MOZ_ASSERT(aRequest->IsBytecode());
|
||||
size_t length = aRequest->mScriptBytecode.length() - aRequest->mBytecodeOffset;
|
||||
if (!JS::CanDecodeOffThread(cx, options, length)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1830,9 +1824,9 @@ ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
|
|||
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
MOZ_ASSERT(aRequest->IsTextSource());
|
||||
SourceBufferHolder srcBuf = GetScriptSource(cx, aRequest);
|
||||
if (!JS::CompileOffThreadModule(cx, options,
|
||||
aRequest->ScriptText().begin(),
|
||||
aRequest->ScriptText().length(),
|
||||
srcBuf,
|
||||
OffThreadScriptLoaderCallback,
|
||||
static_cast<void*>(runnable))) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1858,9 +1852,9 @@ ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
|
|||
#endif
|
||||
} else {
|
||||
MOZ_ASSERT(aRequest->IsTextSource());
|
||||
SourceBufferHolder srcBuf = GetScriptSource(cx, aRequest);
|
||||
if (!JS::CompileOffThread(cx, options,
|
||||
aRequest->ScriptText().begin(),
|
||||
aRequest->ScriptText().length(),
|
||||
srcBuf,
|
||||
OffThreadScriptLoaderCallback,
|
||||
static_cast<void*>(runnable))) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1873,6 +1867,7 @@ ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest)
|
|||
// to call ScriptLoader::ProcessOffThreadRequest with the same request.
|
||||
aRequest->mProgress = ScriptLoadRequest::Progress::eCompiling;
|
||||
|
||||
*aCouldCompileOut = true;
|
||||
Unused << runnable.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1887,33 +1882,42 @@ ScriptLoader::CompileOffThreadOrProcessRequest(ScriptLoadRequest* aRequest)
|
|||
NS_ASSERTION(!aRequest->InCompilingStage(),
|
||||
"Candidate for off-thread compile is already in compiling stage.");
|
||||
|
||||
nsresult rv = AttemptAsyncScriptCompile(aRequest);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool couldCompile = false;
|
||||
nsresult rv = AttemptAsyncScriptCompile(aRequest, &couldCompile);
|
||||
if (NS_FAILED(rv)) {
|
||||
HandleLoadError(aRequest, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (couldCompile) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return ProcessRequest(aRequest);
|
||||
}
|
||||
|
||||
SourceBufferHolder
|
||||
ScriptLoader::GetScriptSource(ScriptLoadRequest* aRequest, nsAutoString& inlineData)
|
||||
ScriptLoader::GetScriptSource(JSContext* aCx, ScriptLoadRequest* aRequest)
|
||||
{
|
||||
// Return a SourceBufferHolder object holding the script's source text.
|
||||
// |inlineData| is used to hold the text for inline objects.
|
||||
// Ownership of the buffer is transferred to the resulting SourceBufferHolder.
|
||||
|
||||
// If there's no script text, we try to get it from the element
|
||||
if (aRequest->mIsInline) {
|
||||
// XXX This is inefficient - GetText makes multiple
|
||||
// copies.
|
||||
nsAutoString inlineData;
|
||||
aRequest->mElement->GetScriptText(inlineData);
|
||||
return SourceBufferHolder(inlineData.get(),
|
||||
inlineData.Length(),
|
||||
SourceBufferHolder::NoOwnership);
|
||||
|
||||
size_t nbytes = inlineData.Length() * sizeof(char16_t);
|
||||
JS::UniqueTwoByteChars chars(static_cast<char16_t*>(JS_malloc(aCx, nbytes)));
|
||||
MOZ_RELEASE_ASSERT(chars);
|
||||
memcpy(chars.get(), inlineData.get(), nbytes);
|
||||
return SourceBufferHolder(std::move(chars), inlineData.Length());
|
||||
}
|
||||
|
||||
return SourceBufferHolder(aRequest->ScriptText().begin(),
|
||||
aRequest->ScriptText().length(),
|
||||
SourceBufferHolder::NoOwnership);
|
||||
size_t length = aRequest->ScriptText().length();
|
||||
return SourceBufferHolder(aRequest->ScriptText().extractOrCopyRawBuffer(),
|
||||
length,
|
||||
SourceBufferHolder::GiveOwnership);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1928,14 +1932,21 @@ ScriptLoader::ProcessRequest(ScriptLoadRequest* aRequest)
|
|||
|
||||
NS_ENSURE_ARG(aRequest);
|
||||
|
||||
if (aRequest->IsModuleRequest() &&
|
||||
!aRequest->AsModuleRequest()->mModuleScript)
|
||||
{
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
ModuleLoadRequest* request = aRequest->AsModuleRequest();
|
||||
if (request->mModuleScript && !request->mModuleScript->HasErrorToRethrow()) {
|
||||
if (!InstantiateModuleTree(request)) {
|
||||
request->mModuleScript = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!request->mModuleScript) {
|
||||
// There was an error fetching a module script. Nothing to do here.
|
||||
LOG(("ScriptLoadRequest (%p): Error loading request, firing error", aRequest));
|
||||
FireScriptAvailable(NS_ERROR_FAILURE, aRequest);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> scriptElem = do_QueryInterface(aRequest->mElement);
|
||||
|
||||
|
@ -2186,7 +2197,7 @@ ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest)
|
|||
size_t sourceLength;
|
||||
size_t minLength;
|
||||
if (aRequest->IsTextSource()) {
|
||||
sourceLength = aRequest->ScriptText().length();
|
||||
sourceLength = aRequest->mScriptTextLength;
|
||||
minLength = sourceLengthMin;
|
||||
} else {
|
||||
MOZ_ASSERT(aRequest->IsBinASTSource());
|
||||
|
@ -2358,8 +2369,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
|||
&script);
|
||||
} else {
|
||||
MOZ_ASSERT(aRequest->IsTextSource());
|
||||
nsAutoString inlineData;
|
||||
SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
|
||||
SourceBufferHolder srcBuf = GetScriptSource(cx, aRequest);
|
||||
|
||||
if (recordreplay::IsRecordingOrReplaying()) {
|
||||
recordreplay::NoteContentParse(this, options.filename(), "application/javascript",
|
||||
|
@ -3194,11 +3204,12 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
|
|||
channel->GetURI(getter_AddRefs(request->mBaseURL));
|
||||
}
|
||||
|
||||
|
||||
// Attempt to compile off main thread.
|
||||
rv = AttemptAsyncScriptCompile(request);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
bool couldCompile = false;
|
||||
rv = AttemptAsyncScriptCompile(request, &couldCompile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (couldCompile) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise compile it right away and start fetching descendents.
|
||||
|
@ -3211,18 +3222,15 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
|
|||
// If this is currently blocking the parser, attempt to compile it off-main-thread.
|
||||
if (aRequest == mParserBlockingRequest && NumberOfProcessors() > 1) {
|
||||
MOZ_ASSERT(!aRequest->IsModuleRequest());
|
||||
nsresult rv = AttemptAsyncScriptCompile(aRequest);
|
||||
if (rv == NS_OK) {
|
||||
bool couldCompile = false;
|
||||
nsresult rv = AttemptAsyncScriptCompile(aRequest, &couldCompile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (couldCompile) {
|
||||
MOZ_ASSERT(aRequest->mProgress == ScriptLoadRequest::Progress::eCompiling,
|
||||
"Request should be off-thread compiling now.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If off-thread compile errored, return the error.
|
||||
if (rv != NS_ERROR_FAILURE) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// If off-thread compile was rejected, continue with regular processing.
|
||||
}
|
||||
|
||||
|
|
|
@ -454,7 +454,8 @@ private:
|
|||
|
||||
void ReportErrorToConsole(ScriptLoadRequest *aRequest, nsresult aResult) const;
|
||||
|
||||
nsresult AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest);
|
||||
nsresult AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest,
|
||||
bool* aCouldCompileOut);
|
||||
nsresult ProcessRequest(ScriptLoadRequest* aRequest);
|
||||
nsresult CompileOffThreadOrProcessRequest(ScriptLoadRequest* aRequest);
|
||||
void FireScriptAvailable(nsresult aResult,
|
||||
|
@ -504,8 +505,8 @@ private:
|
|||
|
||||
void MaybeMoveToLoadedList(ScriptLoadRequest* aRequest);
|
||||
|
||||
JS::SourceBufferHolder GetScriptSource(ScriptLoadRequest* aRequest,
|
||||
nsAutoString& inlineData);
|
||||
JS::SourceBufferHolder GetScriptSource(JSContext* aCx,
|
||||
ScriptLoadRequest* aRequest);
|
||||
|
||||
void SetModuleFetchStarted(ModuleLoadRequest *aRequest);
|
||||
void SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest* aRequest,
|
||||
|
|
|
@ -55,6 +55,10 @@ CreateCacheStorage(JSContext* aCx, nsIPrincipal* aPrincipal, ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// This is called when the JSContext is not in a realm, so CreateSandbox
|
||||
// returned an unwrapped global.
|
||||
MOZ_ASSERT(JS_IsGlobalObject(sandbox));
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> sandboxGlobalObject = xpc::NativeGlobal(sandbox);
|
||||
if (!sandboxGlobalObject) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
|
|
@ -212,14 +212,12 @@ void SVGAElement::SetText(const nsAString& aText, mozilla::ErrorResult& rv)
|
|||
|
||||
nsresult
|
||||
SVGAElement::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent *aBindingParent)
|
||||
{
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsresult rv = SVGAElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent *aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true) override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
|
|
@ -161,14 +161,12 @@ SVGAnimationElement::GetSimpleDuration(ErrorResult& rv)
|
|||
nsresult
|
||||
SVGAnimationElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
MOZ_ASSERT(!mHrefTarget.get(),
|
||||
"Shouldn't have href-target yet (or it should've been cleared)");
|
||||
nsresult rv = SVGAnimationElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Add myself to the animation controller's master set of animation elements.
|
||||
|
|
|
@ -44,8 +44,7 @@ public:
|
|||
|
||||
// nsIContent specializations
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
|
|
|
@ -156,16 +156,13 @@ SVGFEImageElement::MaybeLoadSVGImage()
|
|||
|
||||
nsresult
|
||||
SVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = SVGFEImageElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent);
|
||||
|
||||
if (mStringAttributes[HREF].IsExplicitlySet() ||
|
||||
mStringAttributes[XLINK_HREF].IsExplicitlySet()) {
|
||||
|
|
|
@ -64,8 +64,7 @@ public:
|
|||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
virtual EventStates IntrinsicState() const override;
|
||||
|
||||
|
|
|
@ -187,16 +187,13 @@ SVGImageElement::MaybeLoadSVGImage()
|
|||
|
||||
nsresult
|
||||
SVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsresult rv = SVGImageElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent);
|
||||
|
||||
if (mStringAttributes[HREF].IsExplicitlySet() ||
|
||||
mStringAttributes[XLINK_HREF].IsExplicitlySet()) {
|
||||
|
|
|
@ -51,8 +51,7 @@ public:
|
|||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
virtual EventStates IntrinsicState() const override;
|
||||
|
|
|
@ -82,14 +82,12 @@ SVGMPathElement::Href()
|
|||
nsresult
|
||||
SVGMPathElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
MOZ_ASSERT(!mPathTracker.get(),
|
||||
"Shouldn't have href-target yet (or it should've been cleared)");
|
||||
nsresult rv = SVGMPathElementBase::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (aDocument) {
|
||||
|
|
|
@ -45,8 +45,7 @@ public:
|
|||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
||||
bool aPreallocateChildren) const override;
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
nsIContent* aBindingParent) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
|
||||
// Element specializations
|
||||
|
|
|
@ -466,8 +466,7 @@ SVGSVGElement::GetTimedDocumentRoot()
|
|||
nsresult
|
||||
SVGSVGElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
nsIContent* aBindingParent)
|
||||
{
|
||||
nsSMILAnimationController* smilController = nullptr;
|
||||
|
||||
|
@ -491,8 +490,7 @@ SVGSVGElement::BindToTree(nsIDocument* aDocument,
|
|||
}
|
||||
|
||||
nsresult rv = SVGGraphicsElement::BindToTree(aDocument, aParent,
|
||||
aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
aBindingParent);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (mTimedDocumentRoot && smilController) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче