зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central and inbound
This commit is contained in:
Коммит
43712ddab0
|
@ -59,6 +59,7 @@ endif
|
|||
# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
|
||||
|
||||
# browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
|
||||
# browser_bug386835.js is disabled for intermittent failures (bug 880226)
|
||||
|
||||
_BROWSER_FILES = \
|
||||
head.js \
|
||||
|
@ -73,7 +74,6 @@ _BROWSER_FILES = \
|
|||
browser_bug329212.js \
|
||||
browser_bug356571.js \
|
||||
browser_bug380960.js \
|
||||
browser_bug386835.js \
|
||||
browser_bug405137.js \
|
||||
browser_bug406216.js \
|
||||
browser_bug409481.js \
|
||||
|
|
|
@ -15,6 +15,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
# browser_589246.js is disabled for leaking browser windows (bug 752467)
|
||||
# browser_580512.js is disabled for leaking browser windows (bug 752467)
|
||||
# browser_capabilities.js is disabled for using resources outside of the build network (bug 882575)
|
||||
# browser_707862.js & browser_705597.js are disabled whilst waiting for review (bug 861700 & bug 883592)
|
||||
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
head.js \
|
||||
|
@ -132,8 +133,6 @@ MOCHITEST_BROWSER_FILES = \
|
|||
browser_687710_2.js \
|
||||
browser_694378.js \
|
||||
browser_701377.js \
|
||||
browser_705597.js \
|
||||
browser_707862.js \
|
||||
browser_739531.js \
|
||||
browser_739531_sample.html \
|
||||
browser_739805.js \
|
||||
|
|
|
@ -10,7 +10,6 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = stdc++compat
|
||||
DISABLED_HOST_LIBRARY_NAME = host_stdc++compat
|
||||
FORCE_STATIC_LIB= 1
|
||||
STL_FLAGS =
|
||||
NO_EXPAND_LIBS = 1
|
||||
|
|
|
@ -374,7 +374,7 @@ private:
|
|||
static JSBool
|
||||
CheckObjectAccess(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSAccessMode mode,
|
||||
JSMutableHandleValue vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
// Decides, based on CSP, whether or not eval() and stuff can be executed.
|
||||
static JSBool
|
||||
|
|
|
@ -486,7 +486,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
|
|||
JSBool
|
||||
nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSAccessMode mode,
|
||||
JSMutableHandleValue vp)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
// Get the security manager
|
||||
nsScriptSecurityManager *ssm =
|
||||
|
|
|
@ -17,6 +17,7 @@ endif
|
|||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
DIRS \
|
||||
HOST_CSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
MODULE \
|
||||
PARALLEL_DIRS \
|
||||
TEST_DIRS \
|
||||
|
|
|
@ -43,16 +43,6 @@
|
|||
#define NS_HTMLCOPY_TEXT_ENCODER_CID \
|
||||
{ 0x7f915b01, 0x98fc, 0x11d4, { 0x8e, 0xb0, 0xa8, 0x03, 0xf8, 0x0f, 0xf1, 0xbc } }
|
||||
|
||||
#define NS_HTMLIMAGEELEMENT_CID \
|
||||
{ /* d6008c40-4dad-11d2-b328-00805f8a3859 */ \
|
||||
0xd6008c40, 0x4dad, 0x11d2, \
|
||||
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
|
||||
|
||||
#define NS_HTMLOPTIONELEMENT_CID \
|
||||
{ /* a6cf90f5-15b3-11d2-932e-00805f8add32 */ \
|
||||
0xa6cf90f5, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
#define NS_NAMESPACEMANAGER_CID \
|
||||
{ /* d9783472-8fe9-11d2-9d3c-0060088f9ff7 */ \
|
||||
0xd9783472, 0x8fe9, 0x11d2, \
|
||||
|
|
|
@ -277,7 +277,7 @@ public:
|
|||
// - HTMLBodyElement: mContentStyleRule
|
||||
// - HTMLDataListElement: mOptions
|
||||
// - HTMLFieldSetElement: mElements, mDependentElements, mFirstLegend
|
||||
// - nsHTMLFormElement: many!
|
||||
// - HTMLFormElement: many!
|
||||
// - HTMLFrameSetElement: mRowSpecs, mColSpecs
|
||||
// - HTMLInputElement: mInputData, mFiles, mFileList, mStaticDocfileList
|
||||
// - nsHTMLMapElement: mAreas
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "nsIVariant.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/FormDataBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
@ -109,13 +109,13 @@ nsFormData::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
|||
|
||||
/* static */ already_AddRefed<nsFormData>
|
||||
nsFormData::Constructor(const GlobalObject& aGlobal,
|
||||
const Optional<nsHTMLFormElement*>& aFormElement,
|
||||
const Optional<NonNull<HTMLFormElement> >& aFormElement,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<nsFormData> formData = new nsFormData(aGlobal.Get());
|
||||
if (aFormElement.WasPassed()) {
|
||||
MOZ_ASSERT(aFormElement.Value());
|
||||
aRv = aFormElement.Value()->WalkFormElements(formData);
|
||||
// TODO: this should ...Value().WalkFromElements(formData); - Bug 883827
|
||||
aRv = aFormElement.Value().get()->WalkFormElements(formData);
|
||||
}
|
||||
return formData.forget();
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
||||
class nsHTMLFormElement;
|
||||
class nsIDOMFile;
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
|
||||
namespace dom {
|
||||
class HTMLFormElement;
|
||||
class GlobalObject;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
}
|
||||
static already_AddRefed<nsFormData>
|
||||
Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const mozilla::dom::Optional<nsHTMLFormElement*>& aFormElement,
|
||||
const mozilla::dom::Optional<mozilla::dom::NonNull<mozilla::dom::HTMLFormElement> >& aFormElement,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void Append(const nsAString& aName, const nsAString& aValue);
|
||||
void Append(const nsAString& aName, nsIDOMBlob* aBlob,
|
||||
|
|
|
@ -298,7 +298,7 @@ nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
|
|||
{
|
||||
NS_ENSURE_TRUE(aOwner, nullptr);
|
||||
nsIDocument* doc = aOwner->OwnerDoc();
|
||||
NS_ENSURE_TRUE(!doc->GetDisplayDocument() &&
|
||||
NS_ENSURE_TRUE(!doc->IsResourceDoc() &&
|
||||
((!doc->IsLoadedAsData() && aOwner->GetCurrentDoc()) ||
|
||||
doc->IsStaticDocument()),
|
||||
nullptr);
|
||||
|
@ -1792,7 +1792,7 @@ nsFrameLoader::GetWindowDimensions(nsRect& aRect)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (doc->GetDisplayDocument()) {
|
||||
if (doc->IsResourceDoc()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1967,7 +1967,7 @@ nsFrameLoader::TryRemoteBrowser()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (doc->GetDisplayDocument()) {
|
||||
if (doc->IsResourceDoc()) {
|
||||
// Don't allow subframe loads in external reference documents
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1061,8 +1061,40 @@ nsObjectLoadingContent::GetContentTypeForMIMEType(const nsACString& aMIMEType,
|
|||
}
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
// We use a shim class to implement this so that JS consumers still
|
||||
// see an interface requestor even though WebIDL bindings don't expose
|
||||
// that stuff.
|
||||
class ObjectInterfaceRequestorShim MOZ_FINAL : public nsIInterfaceRequestor,
|
||||
public nsIChannelEventSink
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ObjectInterfaceRequestorShim,
|
||||
nsIInterfaceRequestor)
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_FORWARD_NSICHANNELEVENTSINK(mContent->)
|
||||
|
||||
ObjectInterfaceRequestorShim(nsIChannelEventSink* aContent)
|
||||
: mContent(aContent)
|
||||
{}
|
||||
|
||||
protected:
|
||||
nsRefPtr<nsIChannelEventSink> mContent;
|
||||
};
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(ObjectInterfaceRequestorShim, mContent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ObjectInterfaceRequestorShim)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(ObjectInterfaceRequestorShim)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(ObjectInterfaceRequestorShim)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetInterface(const nsIID & aIID, void **aResult)
|
||||
ObjectInterfaceRequestorShim::GetInterface(const nsIID & aIID, void **aResult)
|
||||
{
|
||||
if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
|
||||
nsIChannelEventSink* sink = this;
|
||||
|
@ -2079,7 +2111,9 @@ nsObjectLoadingContent::OpenChannel()
|
|||
channelPolicy->SetContentSecurityPolicy(csp);
|
||||
channelPolicy->SetLoadType(nsIContentPolicy::TYPE_OBJECT);
|
||||
}
|
||||
rv = NS_NewChannel(getter_AddRefs(chan), mURI, nullptr, group, this,
|
||||
nsRefPtr<ObjectInterfaceRequestorShim> shim =
|
||||
new ObjectInterfaceRequestorShim(this);
|
||||
rv = NS_NewChannel(getter_AddRefs(chan), mURI, nullptr, group, shim,
|
||||
nsIChannel::LOAD_CALL_CONTENT_SNIFFERS |
|
||||
nsIChannel::LOAD_CLASSIFY_URI,
|
||||
channelPolicy);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsIRunnable.h"
|
||||
|
@ -36,7 +35,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
, public nsIStreamListener
|
||||
, public nsIFrameLoaderOwner
|
||||
, public nsIObjectLoadingContent
|
||||
, public nsIInterfaceRequestor
|
||||
, public nsIChannelEventSink
|
||||
{
|
||||
friend class AutoSetInstantiatingToFalse;
|
||||
|
@ -100,7 +98,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSIFRAMELOADEROWNER
|
||||
NS_DECL_NSIOBJECTLOADINGCONTENT
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "mozilla/Services.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "TextComposition.h"
|
||||
|
@ -487,7 +487,7 @@ nsIMEStateManager::SetIMEState(const IMEState &aState,
|
|||
willSubmit = true;
|
||||
// is this an html form and does it only have a single text input element?
|
||||
} else if (formElement && formElement->Tag() == nsGkAtoms::form && formElement->IsHTML() &&
|
||||
static_cast<nsHTMLFormElement*>(formElement)->HasSingleTextControl()) {
|
||||
static_cast<dom::HTMLFormElement*>(formElement)->HasSingleTextControl()) {
|
||||
willSubmit = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "nsPresState.h"
|
||||
#include "nsError.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
|
||||
#define NS_IN_SUBMIT_CLICK (1 << 0)
|
||||
|
@ -371,7 +371,7 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
|||
// TODO: removing this code and have the submit event sent by the form
|
||||
// see bug 592124.
|
||||
// Hold a strong ref while dispatching
|
||||
nsRefPtr<nsHTMLFormElement> form(mForm);
|
||||
nsRefPtr<HTMLFormElement> form(mForm);
|
||||
presShell->HandleDOMEventWithTarget(mForm, &event, &status);
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLFieldSetElement.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/ValidityState.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -3,8 +3,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsHTMLFormElement_h__
|
||||
#define nsHTMLFormElement_h__
|
||||
#ifndef mozilla_dom_HTMLFormElement_h
|
||||
#define mozilla_dom_HTMLFormElement_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -28,7 +28,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
class nsFormControlList;
|
||||
class nsIMutableArray;
|
||||
class nsIURI;
|
||||
|
||||
|
@ -38,15 +37,22 @@ class HTMLImageElement;
|
|||
}
|
||||
}
|
||||
|
||||
class nsHTMLFormElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFormElement,
|
||||
public nsIWebProgressListener,
|
||||
public nsIForm,
|
||||
public nsIRadioGroupContainer
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class nsFormControlList;
|
||||
|
||||
class HTMLFormElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLFormElement,
|
||||
public nsIWebProgressListener,
|
||||
public nsIForm,
|
||||
public nsIRadioGroupContainer
|
||||
{
|
||||
friend class nsFormControlList;
|
||||
|
||||
public:
|
||||
nsHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLFormElement();
|
||||
HTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~HTMLFormElement();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
|
@ -127,8 +133,8 @@ public:
|
|||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLFormElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(HTMLFormElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
/**
|
||||
* Remove an element from this form's list of elements
|
||||
|
@ -311,21 +317,121 @@ public:
|
|||
already_AddRefed<nsISupports>
|
||||
FindNamedItem(const nsAString& aName, nsWrapperCache** aCache);
|
||||
|
||||
// WebIDL
|
||||
|
||||
void GetAcceptCharset(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::acceptcharset, aValue);
|
||||
}
|
||||
|
||||
void SetAcceptCharset(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::acceptcharset, aValue, aRv);
|
||||
}
|
||||
|
||||
// XPCOM GetAction() is OK
|
||||
void SetAction(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::action, aValue, aRv);
|
||||
}
|
||||
|
||||
// XPCOM GetAutocomplete() is OK
|
||||
void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
|
||||
}
|
||||
|
||||
// XPCOM GetEnctype() is OK
|
||||
void SetEnctype(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::enctype, aValue, aRv);
|
||||
}
|
||||
|
||||
// XPCOM GetEncoding() is OK
|
||||
void SetEncoding(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetEnctype(aValue, aRv);
|
||||
}
|
||||
|
||||
// XPCOM GetMethod() is OK
|
||||
void SetMethod(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::method, aValue, aRv);
|
||||
}
|
||||
|
||||
void GetName(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::name, aValue);
|
||||
}
|
||||
|
||||
void SetName(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
|
||||
}
|
||||
|
||||
bool NoValidate() const
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::novalidate);
|
||||
}
|
||||
|
||||
void SetNoValidate(bool aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::novalidate, aValue, aRv);
|
||||
}
|
||||
|
||||
void GetTarget(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::target, aValue);
|
||||
}
|
||||
|
||||
void SetTarget(const nsAString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::target, aValue, aRv);
|
||||
}
|
||||
|
||||
// it's only out-of-line because the class definition is not available in the
|
||||
// header
|
||||
nsIHTMLCollection* Elements();
|
||||
|
||||
int32_t Length();
|
||||
|
||||
void Submit(ErrorResult& aRv);
|
||||
|
||||
// XPCOM Reset() is OK
|
||||
|
||||
bool CheckValidity()
|
||||
{
|
||||
return CheckFormValidity(nullptr);
|
||||
}
|
||||
|
||||
Element*
|
||||
IndexedGetter(uint32_t aIndex, bool &aFound);
|
||||
|
||||
already_AddRefed<nsISupports>
|
||||
NamedGetter(const nsAString& aName, bool &aFound);
|
||||
|
||||
void GetSupportedNames(nsTArray<nsString >& aRetval);
|
||||
|
||||
js::ExpandoAndGeneration mExpandoAndGeneration;
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
void PostPasswordEvent();
|
||||
void EventHandled() { mFormPasswordEvent = nullptr; }
|
||||
|
||||
class FormPasswordEvent : public nsAsyncDOMEvent
|
||||
{
|
||||
public:
|
||||
FormPasswordEvent(nsHTMLFormElement* aEventNode,
|
||||
FormPasswordEvent(HTMLFormElement* aEventNode,
|
||||
const nsAString& aEventType)
|
||||
: nsAsyncDOMEvent(aEventNode, aEventType, true, true)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
static_cast<nsHTMLFormElement*>(mEventNode.get())->EventHandled();
|
||||
static_cast<HTMLFormElement*>(mEventNode.get())->EventHandled();
|
||||
return nsAsyncDOMEvent::Run();
|
||||
}
|
||||
};
|
||||
|
@ -337,7 +443,7 @@ protected:
|
|||
|
||||
class RemoveElementRunnable : public nsRunnable {
|
||||
public:
|
||||
RemoveElementRunnable(nsHTMLFormElement* aForm)
|
||||
RemoveElementRunnable(HTMLFormElement* aForm)
|
||||
: mForm(aForm)
|
||||
{}
|
||||
|
||||
|
@ -347,7 +453,7 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<nsHTMLFormElement> mForm;
|
||||
nsRefPtr<HTMLFormElement> mForm;
|
||||
};
|
||||
|
||||
nsresult DoSubmitOrReset(nsEvent* aEvent,
|
||||
|
@ -362,7 +468,7 @@ protected:
|
|||
//
|
||||
//
|
||||
/**
|
||||
* Attempt to submit (submission might be deferred)
|
||||
* Attempt to submit (submission might be deferred)
|
||||
* (called by DoSubmitOrReset)
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
|
@ -376,7 +482,7 @@ protected:
|
|||
* @param aFormSubmission the submission object
|
||||
* @param aEvent the DOM event that was passed to us for the submit
|
||||
*/
|
||||
nsresult BuildSubmission(nsFormSubmission** aFormSubmission,
|
||||
nsresult BuildSubmission(nsFormSubmission** aFormSubmission,
|
||||
nsEvent* aEvent);
|
||||
/**
|
||||
* Perform the submission (called by DoSubmit and FlushPendingSubmission)
|
||||
|
@ -426,6 +532,16 @@ protected:
|
|||
// Insert a element into the past names map.
|
||||
void AddToPastNamesMap(const nsAString& aName, nsISupports* aChild);
|
||||
|
||||
nsresult
|
||||
AddElementToTableInternal(
|
||||
nsInterfaceHashtable<nsStringHashKey,nsISupports>& aTable,
|
||||
nsIContent* aChild, const nsAString& aName);
|
||||
|
||||
nsresult
|
||||
RemoveElementFromTableInternal(
|
||||
nsInterfaceHashtable<nsStringHashKey,nsISupports>& aTable,
|
||||
nsIContent* aChild, const nsAString& aName);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Flush a possible pending submission. If there was a scripted submission
|
||||
|
@ -519,4 +635,7 @@ protected:
|
|||
static bool gPasswordManagerInitialized;
|
||||
};
|
||||
|
||||
#endif // nsHTMLFormElement_h__
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_HTMLFormElement_h
|
|
@ -25,7 +25,7 @@
|
|||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
||||
#include "imgIContainer.h"
|
||||
#include "imgILoader.h"
|
||||
|
@ -41,27 +41,7 @@
|
|||
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser)
|
||||
{
|
||||
/*
|
||||
* HTMLImageElement's will be created without a nsINodeInfo passed in
|
||||
* if someone says "var img = new Image();" in JavaScript, in a case like
|
||||
* that we request the nsINodeInfo from the document's nodeinfo list.
|
||||
*/
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
|
||||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromCaller();
|
||||
NS_ENSURE_TRUE(doc, nullptr);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::img, nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
}
|
||||
|
||||
return new mozilla::dom::HTMLImageElement(nodeInfo.forget());
|
||||
}
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Image)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -312,7 +292,7 @@ HTMLImageElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
if (!tmp.IsEmpty()) {
|
||||
mForm->RemoveImageElementFromTable(this, tmp,
|
||||
nsHTMLFormElement::AttributeUpdated);
|
||||
HTMLFormElement::AttributeUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -674,7 +654,7 @@ HTMLImageElement::SetForm(nsIDOMHTMLFormElement* aForm)
|
|||
NS_ASSERTION(!mForm,
|
||||
"We don't support switching from one non-null form to another.");
|
||||
|
||||
mForm = static_cast<nsHTMLFormElement*>(aForm);
|
||||
mForm = static_cast<HTMLFormElement*>(aForm);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -696,12 +676,12 @@ HTMLImageElement::ClearForm(bool aRemoveFromForm)
|
|||
|
||||
if (!nameVal.IsEmpty()) {
|
||||
mForm->RemoveImageElementFromTable(this, nameVal,
|
||||
nsHTMLFormElement::ElementRemoved);
|
||||
HTMLFormElement::ElementRemoved);
|
||||
}
|
||||
|
||||
if (!idVal.IsEmpty()) {
|
||||
mForm->RemoveImageElementFromTable(this, idVal,
|
||||
nsHTMLFormElement::ElementRemoved);
|
||||
HTMLFormElement::ElementRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ protected:
|
|||
|
||||
// This is a weak reference that this element and the HTMLFormElement
|
||||
// cooperate in maintaining.
|
||||
nsHTMLFormElement* mForm;
|
||||
HTMLFormElement* mForm;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -2324,7 +2324,7 @@ HTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext)
|
|||
// bug 592124.
|
||||
// If there's only one text control, just submit the form
|
||||
// Hold strong ref across the event
|
||||
nsRefPtr<nsHTMLFormElement> form = mForm;
|
||||
nsRefPtr<mozilla::dom::HTMLFormElement> form = mForm;
|
||||
nsFormEvent event(true, NS_FORM_SUBMIT);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
shell->HandleDOMEventWithTarget(mForm, &event, &status);
|
||||
|
@ -3165,7 +3165,7 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
|||
HasAttr(kNameSpaceID_None, nsGkAtoms::formnovalidate) ||
|
||||
mForm->CheckValidFormSubmission())) {
|
||||
// Hold a strong ref while dispatching
|
||||
nsRefPtr<nsHTMLFormElement> form(mForm);
|
||||
nsRefPtr<mozilla::dom::HTMLFormElement> form(mForm);
|
||||
presShell->HandleDOMEventWithTarget(mForm, &event, &status);
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsHTMLFormElement.h" // for ShouldShowInvalidUI()
|
||||
#include "mozilla/dom/HTMLFormElement.h" // for ShouldShowInvalidUI()
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFilePicker.h"
|
||||
#include "nsIContentPrefService2.h"
|
||||
|
|
|
@ -164,12 +164,12 @@ HTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
|
|||
Focus(rv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsHTMLFormElement>
|
||||
already_AddRefed<HTMLFormElement>
|
||||
HTMLLegendElement::GetForm()
|
||||
{
|
||||
Element* form = GetFormElement();
|
||||
MOZ_ASSERT_IF(form, form->IsHTML(nsGkAtoms::form));
|
||||
nsRefPtr<nsHTMLFormElement> ret = static_cast<nsHTMLFormElement*>(form);
|
||||
nsRefPtr<HTMLFormElement> ret = static_cast<HTMLFormElement*>(form);
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMHTMLLegendElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
* WebIDL Interface
|
||||
*/
|
||||
|
||||
already_AddRefed<nsHTMLFormElement> GetForm();
|
||||
already_AddRefed<HTMLFormElement> GetForm();
|
||||
|
||||
// The XPCOM GetAlign is OK for us
|
||||
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
||||
|
|
|
@ -80,7 +80,7 @@ NS_IMPL_RELEASE_INHERITED(HTMLObjectElement, Element)
|
|||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement)
|
||||
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement)
|
||||
NS_INTERFACE_TABLE_INHERITED11(HTMLObjectElement,
|
||||
NS_INTERFACE_TABLE_INHERITED10(HTMLObjectElement,
|
||||
nsIDOMHTMLObjectElement,
|
||||
imgINotificationObserver,
|
||||
nsIRequestObserver,
|
||||
|
@ -89,7 +89,6 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement)
|
|||
nsIObjectLoadingContent,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
nsIInterfaceRequestor,
|
||||
nsIChannelEventSink,
|
||||
nsIConstraintValidation)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
|
|
|
@ -32,27 +32,7 @@
|
|||
* Implementation of <option>
|
||||
*/
|
||||
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLOptionElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser)
|
||||
{
|
||||
/*
|
||||
* HTMLOptionElement's will be created without a nsINodeInfo passed in
|
||||
* if someone says "var opt = new Option();" in JavaScript, in a case like
|
||||
* that we request the nsINodeInfo from the document's nodeinfo list.
|
||||
*/
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
|
||||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromCaller();
|
||||
NS_ENSURE_TRUE(doc, nullptr);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
}
|
||||
|
||||
return new mozilla::dom::HTMLOptionElement(nodeInfo.forget());
|
||||
}
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Option)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -99,7 +79,7 @@ HTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLFormElement*
|
||||
mozilla::dom::HTMLFormElement*
|
||||
HTMLOptionElement::GetForm()
|
||||
{
|
||||
HTMLSelectElement* selectControl = GetSelect();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv);
|
||||
}
|
||||
|
||||
nsHTMLFormElement* GetForm();
|
||||
HTMLFormElement* GetForm();
|
||||
|
||||
// The XPCOM GetLabel is OK for us
|
||||
void SetLabel(const nsAString& aLabel, ErrorResult& aError)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "nsDOMSettableTokenList.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Output)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "nsCheapSets.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
|
||||
class nsIDOMHTMLOptionElement;
|
||||
class nsISelectControlFrame;
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::disabled, aVal, aRv);
|
||||
}
|
||||
nsHTMLFormElement* GetForm() const
|
||||
HTMLFormElement* GetForm() const
|
||||
{
|
||||
return nsGenericHTMLFormElement::GetForm();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ NS_IMPL_RELEASE_INHERITED(HTMLSharedObjectElement, Element)
|
|||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement)
|
||||
NS_HTML_CONTENT_INTERFACES_AMBIGUOUS(nsGenericHTMLElement,
|
||||
nsIDOMHTMLAppletElement)
|
||||
NS_INTERFACE_TABLE_INHERITED9(HTMLSharedObjectElement,
|
||||
NS_INTERFACE_TABLE_INHERITED8(HTMLSharedObjectElement,
|
||||
nsIRequestObserver,
|
||||
nsIStreamListener,
|
||||
nsIFrameLoaderOwner,
|
||||
|
@ -101,7 +101,6 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement)
|
|||
imgINotificationObserver,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
nsIInterfaceRequestor,
|
||||
nsIChannelEventSink)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLAppletElement, applet)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "nsEventStates.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
#include "nsTextEditorState.h"
|
||||
|
|
|
@ -24,6 +24,7 @@ EXPORTS.mozilla.dom += [
|
|||
'HTMLDivElement.h',
|
||||
'HTMLFieldSetElement.h',
|
||||
'HTMLFontElement.h',
|
||||
'HTMLFormElement.h',
|
||||
'HTMLFrameElement.h',
|
||||
'HTMLFrameSetElement.h',
|
||||
'HTMLHRElement.h',
|
||||
|
@ -147,7 +148,7 @@ CPP_SOURCES += [
|
|||
'nsGenericHTMLElement.cpp',
|
||||
'nsGenericHTMLFrameElement.cpp',
|
||||
'nsHTMLDNSPrefetch.cpp',
|
||||
'nsHTMLFormElement.cpp',
|
||||
'HTMLFormElement.cpp',
|
||||
'nsIConstraintValidation.cpp',
|
||||
'nsRadioVisitor.cpp',
|
||||
'nsTextEditorState.cpp',
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
|
||||
|
@ -651,8 +651,8 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
nsStyledElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
nsHTMLFormElement*
|
||||
nsGenericHTMLElement::FindAncestorForm(nsHTMLFormElement* aCurrentForm)
|
||||
HTMLFormElement*
|
||||
nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||
{
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form),
|
||||
"FindAncestorForm should not be called if @form is set!");
|
||||
|
@ -677,7 +677,7 @@ nsGenericHTMLElement::FindAncestorForm(nsHTMLFormElement* aCurrentForm)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
return static_cast<nsHTMLFormElement*>(content);
|
||||
return static_cast<HTMLFormElement*>(content);
|
||||
}
|
||||
|
||||
nsIContent *prevContent = content;
|
||||
|
@ -2158,7 +2158,7 @@ nsGenericHTMLFormElement::SetForm(nsIDOMHTMLFormElement* aForm)
|
|||
"We don't support switching from one non-null form to another.");
|
||||
|
||||
// keep a *weak* ref to the form here
|
||||
mForm = static_cast<nsHTMLFormElement*>(aForm);
|
||||
mForm = static_cast<HTMLFormElement*>(aForm);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2180,12 +2180,12 @@ nsGenericHTMLFormElement::ClearForm(bool aRemoveFromForm)
|
|||
|
||||
if (!nameVal.IsEmpty()) {
|
||||
mForm->RemoveElementFromTable(this, nameVal,
|
||||
nsHTMLFormElement::ElementRemoved);
|
||||
HTMLFormElement::ElementRemoved);
|
||||
}
|
||||
|
||||
if (!idVal.IsEmpty()) {
|
||||
mForm->RemoveElementFromTable(this, idVal,
|
||||
nsHTMLFormElement::ElementRemoved);
|
||||
HTMLFormElement::ElementRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2317,7 +2317,7 @@ nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
if (!tmp.IsEmpty()) {
|
||||
mForm->RemoveElementFromTable(this, tmp,
|
||||
nsHTMLFormElement::AttributeUpdated);
|
||||
HTMLFormElement::AttributeUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2326,14 +2326,14 @@ nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
|
||||
if (!tmp.IsEmpty()) {
|
||||
mForm->RemoveElementFromTable(this, tmp,
|
||||
nsHTMLFormElement::AttributeUpdated);
|
||||
HTMLFormElement::AttributeUpdated);
|
||||
}
|
||||
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
mForm->RemoveElementFromTable(this, tmp,
|
||||
nsHTMLFormElement::AttributeUpdated);
|
||||
HTMLFormElement::AttributeUpdated);
|
||||
}
|
||||
|
||||
mForm->RemoveElement(this, false);
|
||||
|
@ -2655,7 +2655,7 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
|||
ClearForm(true);
|
||||
}
|
||||
|
||||
nsHTMLFormElement *oldForm = mForm;
|
||||
HTMLFormElement *oldForm = mForm;
|
||||
|
||||
if (!mForm) {
|
||||
// If @form is set, we have to use that to find the form.
|
||||
|
@ -2678,7 +2678,7 @@ nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
|||
"associated with the id in @form!");
|
||||
|
||||
if (element && element->IsHTML(nsGkAtoms::form)) {
|
||||
mForm = static_cast<nsHTMLFormElement*>(element);
|
||||
mForm = static_cast<HTMLFormElement*>(element);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -33,13 +33,13 @@ class nsILayoutHistoryState;
|
|||
class nsIEditor;
|
||||
struct nsRect;
|
||||
struct nsSize;
|
||||
class nsHTMLFormElement;
|
||||
class nsIDOMHTMLMenuElement;
|
||||
class nsIDOMHTMLCollection;
|
||||
class nsDOMSettableTokenList;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom{
|
||||
class HTMLFormElement;
|
||||
class HTMLPropertiesCollection;
|
||||
class HTMLMenuElement;
|
||||
}
|
||||
|
@ -666,7 +666,8 @@ public:
|
|||
* current form that they're not descendants of.
|
||||
* @note This method should not be called if the element has a form attribute.
|
||||
*/
|
||||
nsHTMLFormElement* FindAncestorForm(nsHTMLFormElement* aCurrentForm = nullptr);
|
||||
mozilla::dom::HTMLFormElement*
|
||||
FindAncestorForm(mozilla::dom::HTMLFormElement* aCurrentForm = nullptr);
|
||||
|
||||
virtual void RecompileScriptEventListeners() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -1087,7 +1088,7 @@ public:
|
|||
|
||||
// nsIFormControl
|
||||
virtual mozilla::dom::Element* GetFormElement() MOZ_OVERRIDE;
|
||||
nsHTMLFormElement* GetForm() const
|
||||
mozilla::dom::HTMLFormElement* GetForm() const
|
||||
{
|
||||
return mForm;
|
||||
}
|
||||
|
@ -1221,7 +1222,7 @@ protected:
|
|||
FocusTristate FocusState();
|
||||
|
||||
/** The form that contains this control */
|
||||
nsHTMLFormElement* mForm;
|
||||
mozilla::dom::HTMLFormElement* mForm;
|
||||
|
||||
/* This is a pointer to our closest fieldset parent if any */
|
||||
mozilla::dom::HTMLFieldSetElement* mFieldSet;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "nsAString.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/ValidityState.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -136,8 +136,8 @@ nsIConstraintValidation::SetValidityState(ValidityStateType aState,
|
|||
nsCOMPtr<nsIFormControl> formCtrl = do_QueryInterface(this);
|
||||
NS_ASSERTION(formCtrl, "This interface should be used by form elements!");
|
||||
|
||||
nsHTMLFormElement* form =
|
||||
static_cast<nsHTMLFormElement*>(formCtrl->GetFormElement());
|
||||
mozilla::dom::HTMLFormElement* form =
|
||||
static_cast<mozilla::dom::HTMLFormElement*>(formCtrl->GetFormElement());
|
||||
if (form) {
|
||||
form->UpdateValidity(IsValid());
|
||||
}
|
||||
|
@ -164,8 +164,8 @@ nsIConstraintValidation::SetBarredFromConstraintValidation(bool aBarred)
|
|||
nsCOMPtr<nsIFormControl> formCtrl = do_QueryInterface(this);
|
||||
NS_ASSERTION(formCtrl, "This interface should be used by form elements!");
|
||||
|
||||
nsHTMLFormElement* form =
|
||||
static_cast<nsHTMLFormElement*>(formCtrl->GetFormElement());
|
||||
mozilla::dom::HTMLFormElement* form =
|
||||
static_cast<mozilla::dom::HTMLFormElement*>(formCtrl->GetFormElement());
|
||||
if (form) {
|
||||
// If the element is going to be barred from constraint validation,
|
||||
// we can inform the form that we are now valid.
|
||||
|
|
|
@ -58,30 +58,18 @@ function reflectString(aParameters)
|
|||
element.removeAttribute(contentAttr);
|
||||
|
||||
element[idlAttr] = null;
|
||||
// TODO: remove this ugly hack when null stringification will work as expected.
|
||||
var todoAttrs = {
|
||||
form: [ "acceptCharset", "name", "target" ],
|
||||
};
|
||||
if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {
|
||||
if (treatNullAs == "EmptyString") {
|
||||
is(element.getAttribute(contentAttr), "",
|
||||
"null should have been stringified to '' for '" + contentAttr + "'");
|
||||
is(element[idlAttr], "",
|
||||
"null should have been stringified to '' for '" + idlAttr + "'");
|
||||
} else {
|
||||
is(element.getAttribute(contentAttr), "null",
|
||||
"null should have been stringified to 'null' for '" + contentAttr + "'");
|
||||
is(element[idlAttr], "null",
|
||||
"null should have been stringified to 'null' for '" + contentAttr + "'");
|
||||
}
|
||||
element.removeAttribute(contentAttr);
|
||||
if (treatNullAs == "EmptyString") {
|
||||
is(element.getAttribute(contentAttr), "",
|
||||
"null should have been stringified to '' for '" + contentAttr + "'");
|
||||
is(element[idlAttr], "",
|
||||
"null should have been stringified to '' for '" + idlAttr + "'");
|
||||
} else {
|
||||
todo_is(element.getAttribute(contentAttr), "null",
|
||||
is(element.getAttribute(contentAttr), "null",
|
||||
"null should have been stringified to 'null' for '" + contentAttr + "'");
|
||||
todo_is(element[idlAttr], "null",
|
||||
is(element[idlAttr], "null",
|
||||
"null should have been stringified to 'null' for '" + contentAttr + "'");
|
||||
element.removeAttribute(contentAttr);
|
||||
}
|
||||
element.removeAttribute(contentAttr);
|
||||
|
||||
// Tests various strings.
|
||||
var stringsToTest = [
|
||||
|
|
|
@ -72,8 +72,7 @@ function HTML_TAG(aTagName, aImplClass) {
|
|||
|
||||
const objectIfaces = [
|
||||
"imgINotificationObserver", "nsIRequestObserver", "nsIStreamListener",
|
||||
"nsIFrameLoaderOwner", "nsIObjectLoadingContent", "nsIInterfaceRequestor",
|
||||
"nsIChannelEventSink"
|
||||
"nsIFrameLoaderOwner", "nsIObjectLoadingContent", "nsIChannelEventSink"
|
||||
];
|
||||
|
||||
var objectIfaces2 = [];
|
||||
|
|
|
@ -52,9 +52,9 @@ is(form.foo0, input0, "Form.foo0 is still here");
|
|||
|
||||
input0.setAttribute("form", "");
|
||||
ok(!("foo0" in form.elements), "foo0 is not in form.elements");
|
||||
todo_is(form.foo0, undefined, "Form.foo0 should not still be here");
|
||||
todo_is(form.tmp0, undefined, "Form.tmp0 should not still be here");
|
||||
todo_is(form.tmp1, undefined, "Form.tmp1 should not still be here");
|
||||
is(form.foo0, undefined, "Form.foo0 should not still be here");
|
||||
is(form.tmp0, undefined, "Form.tmp0 should not still be here");
|
||||
is(form.tmp1, undefined, "Form.tmp1 should not still be here");
|
||||
|
||||
var input1 = document.getElementById("input1");
|
||||
ok(input1, "input1 exists");
|
||||
|
@ -73,17 +73,18 @@ ok(input2, "input2 exists");
|
|||
is(form.foo2, input2, "Form.foo2 should exist");
|
||||
input2.parentNode.removeChild(input2);
|
||||
ok(!("foo2" in form.elements), "foo2 is not in form.elements");
|
||||
todo_is(form.foo2, undefined, "Form.foo2 should not longer be there");
|
||||
is(form.foo2, undefined, "Form.foo2 should not longer be there");
|
||||
|
||||
var img0 = document.getElementById("img0");
|
||||
ok(img0, "img0 exists");
|
||||
is(form.bar0, img0, "Form.bar0 should exist");
|
||||
|
||||
img0.setAttribute("name", "old_bar0");
|
||||
is(form.old_bar0, img0, "Form.bar0 is still here");
|
||||
is(form.bar0, img0, "Form.bar0 is still here");
|
||||
|
||||
img0.parentNode.removeChild(img0);
|
||||
todo_is(form.bar0, undefined, "Form.bar0 should not be here");
|
||||
is(form.bar0, undefined, "Form.bar0 should not be here");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -108,6 +108,12 @@ public:
|
|||
{
|
||||
return mLastChunks;
|
||||
}
|
||||
virtual bool MainThreadNeedsUpdates() const MOZ_OVERRIDE
|
||||
{
|
||||
// Only source and external streams need updates on the main thread.
|
||||
return (mKind == MediaStreamGraph::SOURCE_STREAM && mFinished) ||
|
||||
mKind == MediaStreamGraph::EXTERNAL_STREAM;
|
||||
}
|
||||
|
||||
// Any thread
|
||||
AudioNodeEngine* Engine() { return mEngine; }
|
||||
|
|
|
@ -893,8 +893,12 @@ MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate)
|
|||
{
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
|
||||
mStreamUpdates.SetCapacity(mStreamUpdates.Length() + mStreams.Length());
|
||||
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
|
||||
MediaStream* stream = mStreams[i];
|
||||
if (!stream->MainThreadNeedsUpdates()) {
|
||||
continue;
|
||||
}
|
||||
StreamUpdate* update = mStreamUpdates.AppendElement();
|
||||
update->mGraphUpdateIndex = stream->mGraphUpdateIndices.GetAt(mCurrentTime);
|
||||
update->mStream = stream;
|
||||
|
@ -904,7 +908,9 @@ MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate)
|
|||
stream->mFinished &&
|
||||
StreamTimeToGraphTime(stream, stream->GetBufferEnd()) <= mCurrentTime;
|
||||
}
|
||||
mUpdateRunnables.MoveElementsFrom(mPendingUpdateRunnables);
|
||||
if (!mPendingUpdateRunnables.IsEmpty()) {
|
||||
mUpdateRunnables.MoveElementsFrom(mPendingUpdateRunnables);
|
||||
}
|
||||
|
||||
// Don't send the message to the main thread if it's not going to have
|
||||
// any work to do.
|
||||
|
|
|
@ -443,6 +443,12 @@ public:
|
|||
return mWrapper;
|
||||
}
|
||||
|
||||
// Return true if the main thread needs to observe updates from this stream.
|
||||
virtual bool MainThreadNeedsUpdates() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void AdvanceTimeVaryingValuesToCurrentTime(GraphTime aCurrentTime, GraphTime aBlockedTime)
|
||||
{
|
||||
|
@ -937,7 +943,7 @@ public:
|
|||
// Internal AudioNodeStreams can only pass their output to another
|
||||
// AudioNode, whereas external AudioNodeStreams can pass their output
|
||||
// to an nsAudioStream for playback.
|
||||
enum AudioNodeStreamKind { INTERNAL_STREAM, EXTERNAL_STREAM };
|
||||
enum AudioNodeStreamKind { SOURCE_STREAM, INTERNAL_STREAM, EXTERNAL_STREAM };
|
||||
/**
|
||||
* Create a stream that will process audio for an AudioNode.
|
||||
* Takes ownership of aEngine. aSampleRate is the sampling rate used
|
||||
|
|
|
@ -438,7 +438,7 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
|||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(
|
||||
new AudioBufferSourceNodeEngine(this, aContext->Destination()),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
MediaStreamGraph::SOURCE_STREAM);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
|||
|
||||
static JSBool
|
||||
nsXBLDocGlobalObject_getProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
return nsXBLDocGlobalObject::
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
|
||||
|
@ -127,7 +127,7 @@ nsXBLDocGlobalObject_getProperty(JSContext *cx, JSHandleObject obj,
|
|||
|
||||
static JSBool
|
||||
nsXBLDocGlobalObject_setProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSBool strict, JSMutableHandleValue vp)
|
||||
JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
return nsXBLDocGlobalObject::
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
|
||||
|
@ -135,7 +135,7 @@ nsXBLDocGlobalObject_setProperty(JSContext *cx, JSHandleObject obj,
|
|||
|
||||
static JSBool
|
||||
nsXBLDocGlobalObject_checkAccess(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSAccessMode mode, JSMutableHandleValue vp)
|
||||
JSAccessMode mode, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
uint32_t translated;
|
||||
if (mode & JSACC_WRITE) {
|
||||
|
|
|
@ -65,16 +65,16 @@ private:
|
|||
JSObject* mCompiled;
|
||||
};
|
||||
|
||||
friend class js::RootMethods<nsXBLMaybeCompiled<UncompiledT> >;
|
||||
friend class js::GCMethods<nsXBLMaybeCompiled<UncompiledT> >;
|
||||
};
|
||||
|
||||
/* Add support for JS::Heap<nsXBLMaybeCompiled>. */
|
||||
namespace js {
|
||||
|
||||
template <class UncompiledT>
|
||||
struct RootMethods<nsXBLMaybeCompiled<UncompiledT> > : public RootMethods<JSObject *>
|
||||
struct GCMethods<nsXBLMaybeCompiled<UncompiledT> > : public GCMethods<JSObject *>
|
||||
{
|
||||
typedef struct RootMethods<JSObject *> Base;
|
||||
typedef struct GCMethods<JSObject *> Base;
|
||||
|
||||
static nsXBLMaybeCompiled<UncompiledT> initial() { return nsXBLMaybeCompiled<UncompiledT>(); }
|
||||
|
||||
|
|
|
@ -12149,7 +12149,7 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
|
|||
|
||||
// XXX When the linking node was HTMLFormElement, it is synchronous event.
|
||||
// That is, the caller of this method is not |OnLinkClickEvent::Run()|
|
||||
// but |nsHTMLFormElement::SubmitSubmission(...)|.
|
||||
// but |HTMLFormElement::SubmitSubmission(...)|.
|
||||
if (nsGkAtoms::form == aContent->Tag() && ShouldBlockLoadingForBackButton()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ function storeCache(applicationCache, url, file, itemType) {
|
|||
|
||||
function readFile(aFile, aCallback) {
|
||||
let channel = NetUtil.newChannel(aFile);
|
||||
channel.contentType = "pain/text";
|
||||
channel.contentType = "plain/text";
|
||||
NetUtil.asyncFetch(channel, function(aStream, aResult) {
|
||||
if (!Components.isSuccessCode(aResult)) {
|
||||
Cu.reportError("OfflineCacheInstaller: Could not read file " + aFile.path);
|
||||
|
|
|
@ -526,7 +526,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// HTML element classes
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLFormElement, nsHTMLFormElementSH,
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLFormElement, HTMLFormElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_GETPROPERTY |
|
||||
nsIXPCScriptable::WANT_NEWENUMERATE)
|
||||
|
@ -2652,7 +2652,7 @@ static JSClass sGlobalScopePolluterClass = {
|
|||
// static
|
||||
JSBool
|
||||
nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
// Someone is accessing a element by referencing its name/id in the
|
||||
// global scope, do a security check to make sure that's ok.
|
||||
|
@ -2675,7 +2675,7 @@ nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
|
|||
// Gets a subframe.
|
||||
static JSBool
|
||||
ChildWindowGetter(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSMutableHandleValue vp)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
MOZ_ASSERT(JSID_IS_STRING(id));
|
||||
// Grab the native DOM window.
|
||||
|
@ -3158,7 +3158,7 @@ static const IDBConstant sIDBConstants[] = {
|
|||
};
|
||||
|
||||
static JSBool
|
||||
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
JSString *idstr = JSID_TO_STRING(id);
|
||||
unsigned index;
|
||||
|
@ -4295,7 +4295,7 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp)
|
|||
template<class Interface>
|
||||
static JSBool
|
||||
LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
JSMutableHandleValue vp)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
nsresult rv = LocationSetterGuts<Interface>(cx, obj, vp.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -4308,7 +4308,7 @@ LocationSetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
|||
|
||||
static JSBool
|
||||
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
|
||||
JSMutableHandleValue vp)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
JS::RootedObject obj(cx, obj_);
|
||||
|
||||
|
@ -5701,7 +5701,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx,
|
|||
|
||||
JSBool
|
||||
nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
|
||||
JSHandleId id, JSMutableHandleValue vp)
|
||||
JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, obj_);
|
||||
|
||||
|
@ -5891,10 +5891,10 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
|||
// HTMLFormElement helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *aObj, jsid aId,
|
||||
uint32_t flags, JSObject **objp,
|
||||
bool *_retval)
|
||||
HTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *aObj, jsid aId,
|
||||
uint32_t flags, JSObject **objp,
|
||||
bool *_retval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, aObj);
|
||||
JS::Rooted<jsid> id(cx, aId);
|
||||
|
@ -5907,7 +5907,7 @@ nsHTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
|||
nsDependentJSString name(id);
|
||||
nsWrapperCache* cache;
|
||||
nsCOMPtr<nsISupports> result =
|
||||
static_cast<nsHTMLFormElement*>(form.get())->FindNamedItem(name, &cache);
|
||||
static_cast<HTMLFormElement*>(form.get())->FindNamedItem(name, &cache);
|
||||
|
||||
if (result) {
|
||||
*_retval = ::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, nullptr,
|
||||
|
@ -5924,9 +5924,9 @@ nsHTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *aObj, jsid aId,
|
||||
jsval *vp, bool *_retval)
|
||||
HTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *aObj, jsid aId,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, aObj);
|
||||
JS::Rooted<jsid> id(cx, aId);
|
||||
|
@ -5937,7 +5937,7 @@ nsHTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
|||
nsDependentJSString name(id);
|
||||
nsWrapperCache* cache;
|
||||
nsCOMPtr<nsISupports> result =
|
||||
static_cast<nsHTMLFormElement*>(form.get())->FindNamedItem(name, &cache);
|
||||
static_cast<HTMLFormElement*>(form.get())->FindNamedItem(name, &cache);
|
||||
|
||||
if (result) {
|
||||
// Wrap result, result can be either an element or a list of
|
||||
|
@ -5965,10 +5965,10 @@ nsHTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElementSH::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj,
|
||||
uint32_t enum_op, jsval *statep,
|
||||
jsid *idp, bool *_retval)
|
||||
HTMLFormElementSH::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj,
|
||||
uint32_t enum_op, jsval *statep,
|
||||
jsid *idp, bool *_retval)
|
||||
{
|
||||
switch (enum_op) {
|
||||
case JSENUMERATE_INIT:
|
||||
|
|
|
@ -372,7 +372,7 @@ public:
|
|||
JSHandleId id, unsigned flags,
|
||||
JS::MutableHandle<JSObject*> objp);
|
||||
static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, JSMutableHandleValue vp);
|
||||
JSHandleId id, JS::MutableHandle<JS::Value> vp);
|
||||
static JSBool InvalidateGlobalScopePolluter(JSContext *cx,
|
||||
JS::Handle<JSObject*> obj);
|
||||
static nsresult InstallGlobalScopePolluter(JSContext *cx,
|
||||
|
@ -602,7 +602,7 @@ protected:
|
|||
nsContentList **nodeList);
|
||||
public:
|
||||
static JSBool DocumentAllGetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSMutableHandleValue vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
static JSBool DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
unsigned flags, JS::MutableHandle<JSObject*> objp);
|
||||
static void ReleaseDocument(JSFreeOp *fop, JSObject *obj);
|
||||
|
@ -612,14 +612,14 @@ public:
|
|||
|
||||
// HTMLFormElement helper
|
||||
|
||||
class nsHTMLFormElementSH : public nsElementSH
|
||||
class HTMLFormElementSH : public nsElementSH
|
||||
{
|
||||
protected:
|
||||
nsHTMLFormElementSH(nsDOMClassInfoData* aData) : nsElementSH(aData)
|
||||
HTMLFormElementSH(nsDOMClassInfoData* aData) : nsElementSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsHTMLFormElementSH()
|
||||
virtual ~HTMLFormElementSH()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ public:
|
|||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsHTMLFormElementSH(aData);
|
||||
return new HTMLFormElementSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -428,6 +428,72 @@ private:
|
|||
const nsAString* mStr;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class NonNull
|
||||
{
|
||||
public:
|
||||
NonNull()
|
||||
#ifdef DEBUG
|
||||
: inited(false)
|
||||
#endif
|
||||
{}
|
||||
|
||||
operator T&() {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
operator const T&() const {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void operator=(T* t) {
|
||||
ptr = t;
|
||||
MOZ_ASSERT(ptr);
|
||||
#ifdef DEBUG
|
||||
inited = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
void operator=(U* t) {
|
||||
ptr = t->ToAStringPtr();
|
||||
MOZ_ASSERT(ptr);
|
||||
#ifdef DEBUG
|
||||
inited = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
T** Slot() {
|
||||
#ifdef DEBUG
|
||||
inited = true;
|
||||
#endif
|
||||
return &ptr;
|
||||
}
|
||||
|
||||
T* Ptr() {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// Make us work with smart-ptr helpers that expect a get()
|
||||
T* get() const {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
T* ptr;
|
||||
#ifdef DEBUG
|
||||
bool inited;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Class for representing sequences in arguments. We use a non-auto array
|
||||
// because that allows us to use sequences of sequences and the like. This
|
||||
// needs to be fallible because web content controls the length of the array,
|
||||
|
|
|
@ -1755,7 +1755,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
|||
}
|
||||
|
||||
JSBool
|
||||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
||||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp,
|
||||
JSBool* bp)
|
||||
{
|
||||
if (!vp.isObject()) {
|
||||
|
|
|
@ -1350,65 +1350,6 @@ HasPropertyOnPrototype(JSContext* cx, JS::Handle<JSObject*> proxy,
|
|||
DOMProxyHandler* handler,
|
||||
JS::Handle<jsid> id);
|
||||
|
||||
template<class T>
|
||||
class NonNull
|
||||
{
|
||||
public:
|
||||
NonNull()
|
||||
#ifdef DEBUG
|
||||
: inited(false)
|
||||
#endif
|
||||
{}
|
||||
|
||||
operator T&() {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
operator const T&() const {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void operator=(T* t) {
|
||||
ptr = t;
|
||||
MOZ_ASSERT(ptr);
|
||||
#ifdef DEBUG
|
||||
inited = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
void operator=(U* t) {
|
||||
ptr = t->ToAStringPtr();
|
||||
MOZ_ASSERT(ptr);
|
||||
#ifdef DEBUG
|
||||
inited = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
T* Ptr() {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr, "NonNull<T> was set to null");
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// Make us work with smart-ptr helpers that expect a get()
|
||||
T* get() const {
|
||||
MOZ_ASSERT(inited);
|
||||
MOZ_ASSERT(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
T* ptr;
|
||||
#ifdef DEBUG
|
||||
bool inited;
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class OwningNonNull
|
||||
{
|
||||
|
@ -2029,7 +1970,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
|||
JS::Handle<JSObject*> instance,
|
||||
JSBool* bp);
|
||||
JSBool
|
||||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
|
||||
InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp,
|
||||
JSBool* bp);
|
||||
|
||||
// Helper for lenient getters/setters to report to console. If this
|
||||
|
|
|
@ -1606,14 +1606,6 @@ def addExternalIface(iface, nativeType=None, headerFile=None,
|
|||
domInterface['notflattened'] = notflattened
|
||||
DOMInterfaces[iface] = domInterface
|
||||
|
||||
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
|
||||
# macros added for it
|
||||
def addExternalHTMLElement(element):
|
||||
nativeElement = 'ns' + element
|
||||
addExternalIface(element, nativeType=nativeElement,
|
||||
headerFile=nativeElement + '.h')
|
||||
|
||||
addExternalHTMLElement('HTMLFormElement')
|
||||
addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
|
||||
headerFile='nsIDOMActivityOptions.h')
|
||||
addExternalIface('Counter')
|
||||
|
|
|
@ -931,7 +931,7 @@ class CGAddPropertyHook(CGAbstractClassHook):
|
|||
"""
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'),
|
||||
Argument('JSHandleId', 'id'), Argument('JSMutableHandleValue', 'vp')]
|
||||
Argument('JSHandleId', 'id'), Argument('JS::MutableHandle<JS::Value>', 'vp')]
|
||||
CGAbstractClassHook.__init__(self, descriptor, ADDPROPERTY_HOOK_NAME,
|
||||
'JSBool', args)
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ class CGNamedConstructors(CGThing):
|
|||
class CGClassHasInstanceHook(CGAbstractStaticMethod):
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'),
|
||||
Argument('JSMutableHandleValue', 'vp'), Argument('JSBool*', 'bp')]
|
||||
Argument('JS::MutableHandle<JS::Value>', 'vp'), Argument('JSBool*', 'bp')]
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME,
|
||||
'JSBool', args)
|
||||
|
||||
|
|
|
@ -109,17 +109,17 @@ NPClass nsJSObjWrapper::sJSObjWrapperNPClass =
|
|||
};
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
JSMutableHandleValue vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_newEnumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
|
||||
|
@ -130,7 +130,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsign
|
|||
JS::MutableHandle<JSObject*> objp);
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
|
||||
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
static void
|
||||
NPObjWrapper_Finalize(JSFreeOp *fop, JSObject *obj);
|
||||
|
@ -171,7 +171,7 @@ typedef struct NPObjectMemberPrivate {
|
|||
} NPObjectMemberPrivate;
|
||||
|
||||
static JSBool
|
||||
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
|
||||
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
static void
|
||||
NPObjectMember_Finalize(JSFreeOp *fop, JSObject *obj);
|
||||
|
@ -1108,7 +1108,7 @@ GetNPObject(JSContext *cx, JSObject *obj)
|
|||
// Does not actually add a property because this is always followed by a
|
||||
// SetProperty call.
|
||||
static JSBool
|
||||
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
NPObjWrapper_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
NPObject *npobj = GetNPObject(cx, obj);
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ NPObjWrapper_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
|
|||
|
||||
static JSBool
|
||||
NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
|
||||
JSMutableHandleValue vp)
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
NPObject *npobj = GetNPObject(cx, obj);
|
||||
|
||||
|
@ -1242,7 +1242,7 @@ NPObjWrapper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBoo
|
|||
}
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
NPObjWrapper_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
NPObject *npobj = GetNPObject(cx, obj);
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ NPObjWrapper_NewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsign
|
|||
}
|
||||
|
||||
static JSBool
|
||||
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType hint, JSMutableHandleValue vp)
|
||||
NPObjWrapper_Convert(JSContext *cx, JSHandleObject obj, JSType hint, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
|
||||
|
||||
|
@ -2026,7 +2026,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
|
|||
}
|
||||
|
||||
static JSBool
|
||||
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp)
|
||||
NPObjectMember_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
NPObjectMemberPrivate *memberPrivate =
|
||||
(NPObjectMemberPrivate *)::JS_GetInstancePrivate(cx, obj,
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
* http://xhr.spec.whatwg.org
|
||||
*/
|
||||
|
||||
interface HTMLFormElement;
|
||||
|
||||
[Constructor(optional HTMLFormElement form)]
|
||||
interface FormData {
|
||||
void append(DOMString name, Blob value, optional DOMString filename);
|
||||
void append(DOMString name, DOMString value);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#htmlformelement
|
||||
*
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
[OverrideBuiltins]
|
||||
interface HTMLFormElement : HTMLElement {
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString acceptCharset;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString action;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString autocomplete;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString enctype;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString encoding;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString method;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString name;
|
||||
[Pure, SetterThrows]
|
||||
attribute boolean noValidate;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString target;
|
||||
|
||||
[Constant]
|
||||
readonly attribute HTMLCollection elements;
|
||||
[Pure]
|
||||
readonly attribute long length;
|
||||
|
||||
getter Element (unsigned long index);
|
||||
// TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
|
||||
getter nsISupports (DOMString name);
|
||||
|
||||
[Throws]
|
||||
void submit();
|
||||
void reset();
|
||||
boolean checkValidity();
|
||||
};
|
|
@ -109,6 +109,7 @@ webidl_files = \
|
|||
HTMLEmbedElement.webidl \
|
||||
HTMLFieldSetElement.webidl \
|
||||
HTMLFontElement.webidl \
|
||||
HTMLFormElement.webidl \
|
||||
HTMLFrameElement.webidl \
|
||||
HTMLFrameSetElement.webidl \
|
||||
HTMLHeadElement.webidl \
|
||||
|
|
|
@ -220,7 +220,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
|
||||
|
@ -236,7 +236,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JSMutableHandleValue aVp)
|
||||
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(idval));
|
||||
JS_ASSERT(JSID_TO_INT(idval) >= CAPTURING_PHASE &&
|
||||
|
@ -505,7 +505,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
|
||||
|
@ -712,7 +712,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
|
||||
|
@ -891,7 +891,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
|
||||
|
@ -146,7 +146,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JSMutableHandleValue aVp)
|
||||
GetConstant(JSContext* aCx, JSHandleObject aObj, JSHandleId idval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(idval));
|
||||
aVp.set(INT_TO_JSVAL(JSID_TO_INT(idval)));
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetSize(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetSize(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "size");
|
||||
if (!blob) {
|
||||
|
@ -132,7 +132,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetType(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetType(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
nsIDOMBlob* blob = GetInstancePrivate(aCx, aObj, "type");
|
||||
if (!blob) {
|
||||
|
@ -302,7 +302,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetMozFullPath(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetMozFullPath(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "mozFullPath");
|
||||
if (!file) {
|
||||
|
@ -328,7 +328,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetName(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetName(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "name");
|
||||
if (!file) {
|
||||
|
@ -350,7 +350,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetLastModifiedDate(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetLastModifiedDate(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
nsIDOMFile* file = GetInstancePrivate(aCx, aObj, "lastModifiedDate");
|
||||
if (!file) {
|
||||
|
|
|
@ -115,7 +115,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
|
|
|
@ -129,7 +129,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetProperty(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
|
|
|
@ -175,7 +175,7 @@ private:
|
|||
~Worker();
|
||||
|
||||
static JSBool
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
@ -200,7 +200,7 @@ private:
|
|||
|
||||
static JSBool
|
||||
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
|
||||
JSMutableHandleValue aVp)
|
||||
JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
|
|
@ -142,7 +142,7 @@ protected:
|
|||
|
||||
private:
|
||||
static JSBool
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
@ -169,7 +169,7 @@ private:
|
|||
|
||||
static JSBool
|
||||
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
|
||||
JSMutableHandleValue aVp)
|
||||
JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
@ -209,7 +209,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetSelf(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetSelf(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
if (!GetInstancePrivate(aCx, aObj, "self")) {
|
||||
return false;
|
||||
|
@ -220,7 +220,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetLocation(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetLocation(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
WorkerGlobalScope* scope =
|
||||
GetInstancePrivate(aCx, aObj, sProperties[SLOT_location].name);
|
||||
|
@ -309,7 +309,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetOnErrorListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetOnErrorListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
const char* name = sEventStrings[STRING_onerror];
|
||||
WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name);
|
||||
|
@ -341,7 +341,7 @@ private:
|
|||
|
||||
static JSBool
|
||||
SetOnErrorListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval,
|
||||
JSBool aStrict, JSMutableHandleValue aVp)
|
||||
JSBool aStrict, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
const char* name = sEventStrings[STRING_onerror];
|
||||
WorkerGlobalScope* scope = GetInstancePrivate(aCx, aObj, name);
|
||||
|
@ -383,7 +383,7 @@ private:
|
|||
}
|
||||
|
||||
static JSBool
|
||||
GetNavigator(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetNavigator(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
WorkerGlobalScope* scope =
|
||||
GetInstancePrivate(aCx, aObj, sProperties[SLOT_navigator].name);
|
||||
|
@ -732,7 +732,7 @@ private:
|
|||
using EventTarget::SetEventListener;
|
||||
|
||||
static JSBool
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSMutableHandleValue aVp)
|
||||
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
@ -759,7 +759,7 @@ private:
|
|||
|
||||
static JSBool
|
||||
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
|
||||
JSMutableHandleValue aVp)
|
||||
JS::MutableHandle<JS::Value> aVp)
|
||||
{
|
||||
JS_ASSERT(JSID_IS_INT(aIdval));
|
||||
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
|
||||
|
|
|
@ -99,6 +99,11 @@ SourceSurfaceD2DTarget::DrawTargetWillChange()
|
|||
D3D10_TEXTURE2D_DESC desc;
|
||||
mTexture->GetDesc(&desc);
|
||||
|
||||
// Our original texture might implement the keyed mutex flag. We shouldn't
|
||||
// need that here. We actually specifically don't want it since we don't lock
|
||||
// our texture for usage!
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
// Get a copy of the surface data so the content at snapshot time was saved.
|
||||
Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture));
|
||||
Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture);
|
||||
|
|
|
@ -19,7 +19,6 @@ namespace layers {
|
|||
* the PGrallocBuffer constructor).
|
||||
*/
|
||||
async protocol PGrallocBuffer {
|
||||
// FIXME: Bug 783451: shouldn't be managed by PCompositor or PImageContainer
|
||||
manager PImageBridge or PLayerTransaction;
|
||||
|
||||
/** Gralloc buffers can be "owned" by either parent or child. */
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include "base/pickle.h"
|
||||
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <limits>
|
||||
|
@ -11,6 +15,9 @@
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
MOZ_STATIC_ASSERT(MOZ_ALIGNOF(Pickle::memberAlignmentType) >= MOZ_ALIGNOF(uint32_t),
|
||||
"Insufficient alignment");
|
||||
|
||||
// static
|
||||
const int Pickle::kPayloadUnit = 64;
|
||||
|
||||
|
@ -19,7 +26,75 @@ static const uint32_t kCapacityReadOnly = (uint32_t) -1;
|
|||
|
||||
static const char kBytePaddingMarker = char(0xbf);
|
||||
|
||||
// Payload is uint32_t aligned.
|
||||
namespace {
|
||||
|
||||
// We want to copy data to our payload as efficiently as possible.
|
||||
// memcpy fits the bill for copying, but not all compilers or
|
||||
// architectures support inlining memcpy from void*, which has unknown
|
||||
// static alignment. However, we know that all the members of our
|
||||
// payload will be aligned on memberAlignmentType boundaries. We
|
||||
// therefore use that knowledge to construct a copier that will copy
|
||||
// efficiently (via standard C++ assignment mechanisms) if the datatype
|
||||
// needs that alignment or less, and memcpy otherwise. (The compiler
|
||||
// may still inline memcpy, of course.)
|
||||
|
||||
template<typename T, size_t size, bool hasSufficientAlignment>
|
||||
struct Copier
|
||||
{
|
||||
static void Copy(T* dest, void** iter) {
|
||||
memcpy(dest, *iter, sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
// Copying 64-bit quantities happens often enough and can easily be made
|
||||
// worthwhile on 32-bit platforms, so handle it specially. Only do it
|
||||
// if 64-bit types aren't sufficiently aligned; the alignment
|
||||
// requirements for them vary between 32-bit platforms.
|
||||
#ifndef HAVE_64BIT_OS
|
||||
template<typename T>
|
||||
struct Copier<T, sizeof(uint64_t), false>
|
||||
{
|
||||
static void Copy(T* dest, void** iter) {
|
||||
#if MOZ_LITTLE_ENDIAN
|
||||
static const int loIndex = 0, hiIndex = 1;
|
||||
#else
|
||||
static const int loIndex = 1, hiIndex = 0;
|
||||
#endif
|
||||
MOZ_STATIC_ASSERT(MOZ_ALIGNOF(uint32_t*) == MOZ_ALIGNOF(void*),
|
||||
"Pointers have different alignments");
|
||||
uint32_t* src = *reinterpret_cast<uint32_t**>(iter);
|
||||
uint32_t* uint32dest = reinterpret_cast<uint32_t*>(dest);
|
||||
uint32dest[loIndex] = src[loIndex];
|
||||
uint32dest[hiIndex] = src[hiIndex];
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename T, size_t size>
|
||||
struct Copier<T, size, true>
|
||||
{
|
||||
static void Copy(T* dest, void** iter) {
|
||||
// The reinterpret_cast is only safe if two conditions hold:
|
||||
// (1) If the alignment of T* is the same as void*;
|
||||
// (2) The alignment of the data in *iter is at least as
|
||||
// big as MOZ_ALIGNOF(T).
|
||||
// Check the first condition, as the second condition is already
|
||||
// known to be true, or we wouldn't be here.
|
||||
MOZ_STATIC_ASSERT(MOZ_ALIGNOF(T*) == MOZ_ALIGNOF(void*),
|
||||
"Pointers have different alignments");
|
||||
*dest = *(*reinterpret_cast<T**>(iter));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void CopyFromIter(T* dest, void** iter) {
|
||||
MOZ_STATIC_ASSERT(mozilla::IsPod<T>::value, "Copied type must be a POD type");
|
||||
Copier<T, sizeof(T), (MOZ_ALIGNOF(T) <= sizeof(Pickle::memberAlignmentType))>::Copy(dest, iter);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// Payload is sizeof(Pickle::memberAlignmentType) aligned.
|
||||
|
||||
Pickle::Pickle()
|
||||
: header_(NULL),
|
||||
|
@ -32,10 +107,10 @@ Pickle::Pickle()
|
|||
|
||||
Pickle::Pickle(int header_size)
|
||||
: header_(NULL),
|
||||
header_size_(AlignInt(header_size, sizeof(uint32_t))),
|
||||
header_size_(AlignInt(header_size)),
|
||||
capacity_(0),
|
||||
variable_buffer_offset_(0) {
|
||||
DCHECK(static_cast<uint32_t>(header_size) >= sizeof(Header));
|
||||
DCHECK(static_cast<memberAlignmentType>(header_size) >= sizeof(Header));
|
||||
DCHECK(header_size <= kPayloadUnit);
|
||||
Resize(kPayloadUnit);
|
||||
header_->payload_size = 0;
|
||||
|
@ -47,7 +122,7 @@ Pickle::Pickle(const char* data, int data_len)
|
|||
capacity_(kCapacityReadOnly),
|
||||
variable_buffer_offset_(0) {
|
||||
DCHECK(header_size_ >= sizeof(Header));
|
||||
DCHECK(header_size_ == AlignInt(header_size_, sizeof(uint32_t)));
|
||||
DCHECK(header_size_ == AlignInt(header_size_));
|
||||
}
|
||||
|
||||
Pickle::Pickle(const Pickle& other)
|
||||
|
@ -98,7 +173,7 @@ bool Pickle::ReadInt16(void** iter, int16_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -112,7 +187,7 @@ bool Pickle::ReadUInt16(void** iter, uint16_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -126,10 +201,7 @@ bool Pickle::ReadInt(void** iter, int* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
// TODO(jar) bug 1129285: Pickle should be cleaned up, and not dependent on
|
||||
// alignment.
|
||||
// Next line is otherwise the same as: memcpy(result, *iter, sizeof(*result));
|
||||
*result = *reinterpret_cast<int*>(*iter);
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -146,9 +218,7 @@ bool Pickle::ReadLong(void** iter, long* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(bigResult)))
|
||||
return false;
|
||||
|
||||
// TODO(jar) bug 1129285: Pickle should be cleaned up, and not dependent on
|
||||
// alignment.
|
||||
memcpy(&bigResult, *iter, sizeof(bigResult));
|
||||
CopyFromIter(&bigResult, iter);
|
||||
DCHECK(bigResult <= LONG_MAX && bigResult >= LONG_MIN);
|
||||
*result = static_cast<long>(bigResult);
|
||||
|
||||
|
@ -167,9 +237,7 @@ bool Pickle::ReadULong(void** iter, unsigned long* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(bigResult)))
|
||||
return false;
|
||||
|
||||
// TODO(jar) bug 1129285: Pickle should be cleaned up, and not dependent on
|
||||
// alignment.
|
||||
memcpy(&bigResult, *iter, sizeof(bigResult));
|
||||
CopyFromIter(&bigResult, iter);
|
||||
DCHECK(bigResult <= ULONG_MAX);
|
||||
*result = static_cast<unsigned long>(bigResult);
|
||||
|
||||
|
@ -194,9 +262,7 @@ bool Pickle::ReadSize(void** iter, size_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(bigResult)))
|
||||
return false;
|
||||
|
||||
// TODO(jar) bug 1129285: Pickle should be cleaned up, and not dependent on
|
||||
// alignment.
|
||||
memcpy(&bigResult, *iter, sizeof(bigResult));
|
||||
CopyFromIter(&bigResult, iter);
|
||||
DCHECK(bigResult <= std::numeric_limits<size_t>::max());
|
||||
*result = static_cast<size_t>(bigResult);
|
||||
|
||||
|
@ -212,7 +278,7 @@ bool Pickle::ReadInt32(void** iter, int32_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -226,7 +292,7 @@ bool Pickle::ReadUInt32(void** iter, uint32_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -240,7 +306,7 @@ bool Pickle::ReadInt64(void** iter, int64_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -254,7 +320,7 @@ bool Pickle::ReadUInt64(void** iter, uint64_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -268,7 +334,7 @@ bool Pickle::ReadDouble(void** iter, double* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -285,7 +351,7 @@ bool Pickle::ReadIntPtr(void** iter, intptr_t* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(bigResult)))
|
||||
return false;
|
||||
|
||||
memcpy(&bigResult, *iter, sizeof(bigResult));
|
||||
CopyFromIter(&bigResult, iter);
|
||||
DCHECK(bigResult <= std::numeric_limits<intptr_t>::max() && bigResult >= std::numeric_limits<intptr_t>::min());
|
||||
*result = static_cast<intptr_t>(bigResult);
|
||||
|
||||
|
@ -301,7 +367,7 @@ bool Pickle::ReadUnsignedChar(void** iter, unsigned char* result) const {
|
|||
if (!IteratorHasRoomFor(*iter, sizeof(*result)))
|
||||
return false;
|
||||
|
||||
memcpy(result, *iter, sizeof(*result));
|
||||
CopyFromIter(result, iter);
|
||||
|
||||
UpdateIter(iter, sizeof(*result));
|
||||
return true;
|
||||
|
@ -411,9 +477,9 @@ char* Pickle::BeginWrite(uint32_t length, uint32_t alignment) {
|
|||
DCHECK(alignment % 4 == 0) << "Must be at least 32-bit aligned!";
|
||||
|
||||
// write at an alignment-aligned offset from the beginning of the header
|
||||
uint32_t offset = AlignInt(header_->payload_size, sizeof(uint32_t));
|
||||
uint32_t offset = AlignInt(header_->payload_size);
|
||||
uint32_t padding = (header_size_ + offset) % alignment;
|
||||
uint32_t new_size = offset + padding + AlignInt(length, sizeof(uint32_t));
|
||||
uint32_t new_size = offset + padding + AlignInt(length);
|
||||
uint32_t needed_size = header_size_ + new_size;
|
||||
|
||||
if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
|
||||
|
@ -441,8 +507,9 @@ char* Pickle::BeginWrite(uint32_t length, uint32_t alignment) {
|
|||
void Pickle::EndWrite(char* dest, int length) {
|
||||
// Zero-pad to keep tools like purify from complaining about uninitialized
|
||||
// memory.
|
||||
if (length % sizeof(uint32_t))
|
||||
memset(dest + length, 0, sizeof(uint32_t) - (length % sizeof(uint32_t)));
|
||||
if (length % sizeof(memberAlignmentType))
|
||||
memset(dest + length, 0,
|
||||
sizeof(memberAlignmentType) - (length % sizeof(memberAlignmentType)));
|
||||
}
|
||||
|
||||
bool Pickle::WriteBytes(const void* data, int data_len, uint32_t alignment) {
|
||||
|
@ -494,7 +561,7 @@ char* Pickle::BeginWriteData(int length) {
|
|||
if (!WriteInt(length))
|
||||
return NULL;
|
||||
|
||||
char *data_ptr = BeginWrite(length, sizeof(uint32_t));
|
||||
char *data_ptr = BeginWrite(length, sizeof(memberAlignmentType));
|
||||
if (!data_ptr)
|
||||
return NULL;
|
||||
|
||||
|
@ -525,7 +592,7 @@ void Pickle::TrimWriteData(int new_length) {
|
|||
}
|
||||
|
||||
bool Pickle::Resize(uint32_t new_capacity) {
|
||||
new_capacity = AlignInt(new_capacity, kPayloadUnit);
|
||||
new_capacity = ConstantAligner<kPayloadUnit>::align(new_capacity);
|
||||
|
||||
void* p = realloc(header_, new_capacity);
|
||||
if (!p)
|
||||
|
@ -540,8 +607,8 @@ bool Pickle::Resize(uint32_t new_capacity) {
|
|||
const char* Pickle::FindNext(uint32_t header_size,
|
||||
const char* start,
|
||||
const char* end) {
|
||||
DCHECK(header_size == AlignInt(header_size, sizeof(uint32_t)));
|
||||
DCHECK(header_size <= static_cast<uint32_t>(kPayloadUnit));
|
||||
DCHECK(header_size == AlignInt(header_size));
|
||||
DCHECK(header_size <= static_cast<memberAlignmentType>(kPayloadUnit));
|
||||
|
||||
const Header* hdr = reinterpret_cast<const Header*>(start);
|
||||
const char* payload_base = start + header_size;
|
||||
|
|
|
@ -84,7 +84,7 @@ class Pickle {
|
|||
bool ReadString16(void** iter, string16* result) const;
|
||||
bool ReadData(void** iter, const char** data, int* length) const;
|
||||
bool ReadBytes(void** iter, const char** data, int length,
|
||||
uint32_t alignment = sizeof(uint32_t)) const;
|
||||
uint32_t alignment = sizeof(memberAlignmentType)) const;
|
||||
|
||||
// Safer version of ReadInt() checks for the result not being negative.
|
||||
// Use it for reading the object sizes.
|
||||
|
@ -149,7 +149,7 @@ class Pickle {
|
|||
bool WriteString16(const string16& value);
|
||||
bool WriteData(const char* data, int length);
|
||||
bool WriteBytes(const void* data, int data_len,
|
||||
uint32_t alignment = sizeof(uint32_t));
|
||||
uint32_t alignment = sizeof(memberAlignmentType));
|
||||
|
||||
// Same as WriteData, but allows the caller to write directly into the
|
||||
// Pickle. This saves a copy in cases where the data is not already
|
||||
|
@ -206,6 +206,8 @@ class Pickle {
|
|||
return (iter <= end_of_region) && (end_of_region <= end_of_payload());
|
||||
}
|
||||
|
||||
typedef uint32_t memberAlignmentType;
|
||||
|
||||
protected:
|
||||
uint32_t payload_size() const { return header_->payload_size; }
|
||||
|
||||
|
@ -246,16 +248,25 @@ class Pickle {
|
|||
// the return result for true (i.e., successful resizing).
|
||||
bool Resize(uint32_t new_capacity);
|
||||
|
||||
// Aligns 'i' by rounding it up to the next multiple of 'alignment'
|
||||
static uint32_t AlignInt(uint32_t i, int alignment) {
|
||||
return i + (alignment - (i % alignment)) % alignment;
|
||||
// Round 'bytes' up to the next multiple of 'alignment'. 'alignment' must be
|
||||
// a power of 2.
|
||||
template<uint32_t alignment> struct ConstantAligner {
|
||||
static uint32_t align(int bytes) {
|
||||
MOZ_STATIC_ASSERT((alignment & (alignment - 1)) == 0,
|
||||
"alignment must be a power of two");
|
||||
return (bytes + (alignment - 1)) & ~static_cast<uint32_t>(alignment - 1);
|
||||
}
|
||||
};
|
||||
|
||||
static uint32_t AlignInt(int bytes) {
|
||||
return ConstantAligner<sizeof(memberAlignmentType)>::align(bytes);
|
||||
}
|
||||
|
||||
// Moves the iterator by the given number of bytes, making sure it is aligned.
|
||||
// Pointer (iterator) is NOT aligned, but the change in the pointer
|
||||
// is guaranteed to be a multiple of sizeof(uint32_t).
|
||||
// is guaranteed to be a multiple of sizeof(memberAlignmentType).
|
||||
static void UpdateIter(void** iter, int bytes) {
|
||||
*iter = static_cast<char*>(*iter) + AlignInt(bytes, sizeof(uint32_t));
|
||||
*iter = static_cast<char*>(*iter) + AlignInt(bytes);
|
||||
}
|
||||
|
||||
// Find the end of the pickled data that starts at range_start. Returns NULL
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
include protocol PTestIndirectProtocolParamSecond;
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
struct IndirectParamStruct {
|
||||
PTestIndirectProtocolParamSecond actor;
|
||||
};
|
||||
|
||||
union IndirectParamUnion {
|
||||
IndirectParamStruct;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
include protocol PTestIndirectProtocolParamManage;
|
||||
// FIXME/bug 792908 protocol PTestIndirectProtocolParamSecond is
|
||||
// already included in PTestIndirectProtocolParam.ipdlh
|
||||
include protocol PTestIndirectProtocolParamSecond;
|
||||
include PTestIndirectProtocolParam;
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
sync protocol PTestIndirectProtocolParamFirst {
|
||||
manager PTestIndirectProtocolParamManage;
|
||||
parent:
|
||||
sync Test(IndirectParamUnion actor);
|
||||
both:
|
||||
__delete__();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
include protocol PTestIndirectProtocolParamFirst;
|
||||
include protocol PTestIndirectProtocolParamSecond;
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
sync protocol PTestIndirectProtocolParamManage {
|
||||
manages PTestIndirectProtocolParamFirst;
|
||||
manages PTestIndirectProtocolParamSecond;
|
||||
both:
|
||||
PTestIndirectProtocolParamFirst();
|
||||
PTestIndirectProtocolParamSecond();
|
||||
__delete__();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
include protocol PTestIndirectProtocolParamManage;
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
sync protocol PTestIndirectProtocolParamSecond {
|
||||
manager PTestIndirectProtocolParamManage;
|
||||
both:
|
||||
__delete__();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -50,4 +50,8 @@ IPDLSRCS = \
|
|||
PTestSysVShmem.ipdl \
|
||||
PTestBadActor.ipdl \
|
||||
PTestBadActorSub.ipdl \
|
||||
PTestIndirectProtocolParam.ipdlh \
|
||||
PTestIndirectProtocolParamManage.ipdl \
|
||||
PTestIndirectProtocolParamFirst.ipdl \
|
||||
PTestIndirectProtocolParamSecond.ipdl \
|
||||
$(NULL)
|
||||
|
|
|
@ -388,7 +388,7 @@ jsval_to_nsString(JSContext* cx, jsid from, nsString* to)
|
|||
|
||||
/*static*/ JSBool
|
||||
ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSMutableHandleValue vp)
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_AddProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
@ -415,7 +415,7 @@ ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
|||
|
||||
/*static*/ JSBool
|
||||
ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSMutableHandleValue vp)
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_GetProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
@ -442,7 +442,7 @@ ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
|||
|
||||
/*static*/ JSBool
|
||||
ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSBool strict, JSMutableHandleValue vp)
|
||||
JSBool strict, MutableHandleValue vp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_SetProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
@ -614,7 +614,7 @@ ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandle
|
|||
|
||||
/*static*/ JSBool
|
||||
ObjectWrapperParent::CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type,
|
||||
JSMutableHandleValue vp)
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_Convert (to %s)...",
|
||||
JS_GetTypeName(cx, type)));
|
||||
|
@ -708,7 +708,7 @@ ObjectWrapperParent::CPOW_Construct(JSContext* cx, unsigned argc, jsval* vp)
|
|||
}
|
||||
|
||||
/*static*/ JSBool
|
||||
ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutableHandleValue v,
|
||||
ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSHandleObject obj, MutableHandleValue v,
|
||||
JSBool *bp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_HasInstance..."));
|
||||
|
|
|
@ -59,16 +59,16 @@ private:
|
|||
mutable JSObject* mObj;
|
||||
|
||||
static JSBool
|
||||
CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandleValue vp);
|
||||
|
||||
static JSBool
|
||||
CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
|
||||
|
||||
static JSBool
|
||||
CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandleValue vp);
|
||||
|
||||
static JSBool
|
||||
CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
|
||||
CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandleValue vp);
|
||||
|
||||
JSBool NewEnumerateInit(JSContext* cx, jsval* statep, jsid* idp);
|
||||
JSBool NewEnumerateNext(JSContext* cx, jsval* statep, jsid* idp);
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
JS::MutableHandleObject objp);
|
||||
|
||||
static JSBool
|
||||
CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
|
||||
CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandleValue vp);
|
||||
|
||||
static void
|
||||
CPOW_Finalize(js::FreeOp* fop, JSObject* obj);
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
CPOW_Construct(JSContext *cx, unsigned argc, jsval *vp);
|
||||
|
||||
static JSBool
|
||||
CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutableHandleValue vp, JSBool *bp);
|
||||
CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JS::MutableHandleValue vp, JSBool *bp);
|
||||
|
||||
static bool jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to);
|
||||
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
|
||||
|
|
|
@ -102,7 +102,7 @@ class Module;
|
|||
class ScriptSourceObject;
|
||||
|
||||
template <typename T>
|
||||
struct RootMethods {};
|
||||
struct GCMethods {};
|
||||
|
||||
template <typename T>
|
||||
class RootedBase {};
|
||||
|
@ -181,13 +181,13 @@ class Heap : public js::HeapBase<T>
|
|||
Heap() {
|
||||
MOZ_STATIC_ASSERT(sizeof(T) == sizeof(Heap<T>),
|
||||
"Heap<T> must be binary compatible with T.");
|
||||
init(js::RootMethods<T>::initial());
|
||||
init(js::GCMethods<T>::initial());
|
||||
}
|
||||
explicit Heap(T p) { init(p); }
|
||||
explicit Heap(const Heap<T> &p) { init(p.ptr); }
|
||||
|
||||
~Heap() {
|
||||
if (js::RootMethods<T>::needsPostBarrier(ptr))
|
||||
if (js::GCMethods<T>::needsPostBarrier(ptr))
|
||||
relocate();
|
||||
}
|
||||
|
||||
|
@ -207,11 +207,11 @@ class Heap : public js::HeapBase<T>
|
|||
}
|
||||
|
||||
void set(T newPtr) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(newPtr));
|
||||
if (js::RootMethods<T>::needsPostBarrier(newPtr)) {
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(newPtr));
|
||||
if (js::GCMethods<T>::needsPostBarrier(newPtr)) {
|
||||
ptr = newPtr;
|
||||
post();
|
||||
} else if (js::RootMethods<T>::needsPostBarrier(ptr)) {
|
||||
} else if (js::GCMethods<T>::needsPostBarrier(ptr)) {
|
||||
relocate(); /* Called before overwriting ptr. */
|
||||
ptr = newPtr;
|
||||
} else {
|
||||
|
@ -221,22 +221,22 @@ class Heap : public js::HeapBase<T>
|
|||
|
||||
private:
|
||||
void init(T newPtr) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(newPtr));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(newPtr));
|
||||
ptr = newPtr;
|
||||
if (js::RootMethods<T>::needsPostBarrier(ptr))
|
||||
if (js::GCMethods<T>::needsPostBarrier(ptr))
|
||||
post();
|
||||
}
|
||||
|
||||
void post() {
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
JS_ASSERT(js::RootMethods<T>::needsPostBarrier(ptr));
|
||||
js::RootMethods<T>::postBarrier(&ptr);
|
||||
JS_ASSERT(js::GCMethods<T>::needsPostBarrier(ptr));
|
||||
js::GCMethods<T>::postBarrier(&ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void relocate() {
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
js::RootMethods<T>::relocate(&ptr);
|
||||
js::GCMethods<T>::relocate(&ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T>
|
|||
inline MutableHandle(Rooted<T> *root);
|
||||
|
||||
void set(T v) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(v));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(v));
|
||||
*ptr = v;
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ struct RootKind<T *>
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
struct RootMethods<T *>
|
||||
struct GCMethods<T *>
|
||||
{
|
||||
static T *initial() { return NULL; }
|
||||
static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
|
||||
|
@ -528,7 +528,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
public:
|
||||
Rooted(JSContext *cx
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: ptr(js::RootMethods<T>::initial())
|
||||
: ptr(js::GCMethods<T>::initial())
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
init(cx);
|
||||
|
@ -544,7 +544,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
|
||||
Rooted(js::PerThreadData *pt
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: ptr(js::RootMethods<T>::initial())
|
||||
: ptr(js::GCMethods<T>::initial())
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
init(js::PerThreadDataFriendFields::get(pt));
|
||||
|
@ -560,7 +560,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
|
||||
Rooted(JSRuntime *rt
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: ptr(js::RootMethods<T>::initial())
|
||||
: ptr(js::GCMethods<T>::initial())
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
init(js::PerThreadDataFriendFields::getMainThread(rt));
|
||||
|
@ -597,7 +597,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
const T &get() const { return ptr; }
|
||||
|
||||
T &operator=(T value) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(value));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(value));
|
||||
ptr = value;
|
||||
return ptr;
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
}
|
||||
|
||||
void set(T value) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(value));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(value));
|
||||
ptr = value;
|
||||
}
|
||||
|
||||
|
@ -618,12 +618,12 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
|
|||
private:
|
||||
void commonInit(Rooted<void*> **thingGCRooters) {
|
||||
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
|
||||
js::ThingRootKind kind = js::RootMethods<T>::kind();
|
||||
js::ThingRootKind kind = js::GCMethods<T>::kind();
|
||||
this->stack = &thingGCRooters[kind];
|
||||
this->prev = *stack;
|
||||
*stack = reinterpret_cast<Rooted<void*>*>(this);
|
||||
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(ptr));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(ptr));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -748,7 +748,7 @@ class FakeRooted : public RootedBase<T>
|
|||
public:
|
||||
FakeRooted(JSContext *cx
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: ptr(RootMethods<T>::initial())
|
||||
: ptr(GCMethods<T>::initial())
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ class FakeRooted : public RootedBase<T>
|
|||
const T &get() const { return ptr; }
|
||||
|
||||
T &operator=(T value) {
|
||||
JS_ASSERT(!RootMethods<T>::poisoned(value));
|
||||
JS_ASSERT(!GCMethods<T>::poisoned(value));
|
||||
ptr = value;
|
||||
return ptr;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ class FakeMutableHandle : public js::MutableHandleBase<T>
|
|||
}
|
||||
|
||||
void set(T v) {
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(v));
|
||||
JS_ASSERT(!js::GCMethods<T>::poisoned(v));
|
||||
*ptr = v;
|
||||
}
|
||||
|
||||
|
|
|
@ -1401,14 +1401,14 @@ JS_PUBLIC_API(void) HeapValueRelocate(Value *valuep);
|
|||
|
||||
namespace js {
|
||||
|
||||
template <> struct RootMethods<const JS::Value>
|
||||
template <> struct GCMethods<const JS::Value>
|
||||
{
|
||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_VALUE; }
|
||||
static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); }
|
||||
};
|
||||
|
||||
template <> struct RootMethods<JS::Value>
|
||||
template <> struct GCMethods<JS::Value>
|
||||
{
|
||||
static JS::Value initial() { return JS::UndefinedValue(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_VALUE; }
|
||||
|
|
|
@ -17,6 +17,7 @@ endif
|
|||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
DIRS \
|
||||
HOST_CSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
MODULE \
|
||||
PARALLEL_DIRS \
|
||||
TEST_DIRS \
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace CType {
|
|||
static JSBool CreateArray(JSContext* cx, unsigned argc, jsval* vp);
|
||||
static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp);
|
||||
static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp);
|
||||
static JSBool HasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue v, JSBool* bp);
|
||||
static JSBool HasInstance(JSContext* cx, JSHandleObject obj, MutableHandleValue v, JSBool* bp);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -3747,7 +3747,7 @@ CType::ToSource(JSContext* cx, unsigned argc, jsval* vp)
|
|||
}
|
||||
|
||||
JSBool
|
||||
CType::HasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue v, JSBool* bp)
|
||||
CType::HasInstance(JSContext* cx, JSHandleObject obj, MutableHandleValue v, JSBool* bp)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
|
|
|
@ -6503,10 +6503,9 @@ Parser<FullParseHandler>::newRegExp(const jschar *buf, size_t length, RegExpFlag
|
|||
return NULL;
|
||||
|
||||
const StableCharPtr chars(buf, length);
|
||||
RegExpStatics *res = context->regExpStatics();
|
||||
|
||||
Rooted<RegExpObject*> reobj(context);
|
||||
if (context->hasfp())
|
||||
if (RegExpStatics *res = context->regExpStatics())
|
||||
reobj = RegExpObject::create(context, res, chars.get(), length, flags, &tokenStream);
|
||||
else
|
||||
reobj = RegExpObject::createNoStatics(context, chars.get(), length, flags, &tokenStream);
|
||||
|
@ -6528,10 +6527,9 @@ Parser<SyntaxParseHandler>::newRegExp(const jschar *buf, size_t length, RegExpFl
|
|||
{
|
||||
// Create the regexp even when doing a syntax parse, to check the regexp's syntax.
|
||||
const StableCharPtr chars(buf, length);
|
||||
RegExpStatics *res = context->regExpStatics();
|
||||
|
||||
RegExpObject *reobj;
|
||||
if (context->hasfp())
|
||||
if (RegExpStatics *res = context->regExpStatics())
|
||||
reobj = RegExpObject::create(context, res, chars.get(), length, flags, &tokenStream);
|
||||
else
|
||||
reobj = RegExpObject::createNoStatics(context, chars.get(), length, flags, &tokenStream);
|
||||
|
|
|
@ -1215,7 +1215,7 @@ ion::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo)
|
|||
RootedScript innerScript(cx, NULL);
|
||||
RootedScript outerScript(cx, NULL);
|
||||
|
||||
JS_ASSERT(cx->mainThread().currentlyRunningInJit());
|
||||
JS_ASSERT(cx->currentlyRunningInJit());
|
||||
IonFrameIterator iter(cx->mainThread().ionTop);
|
||||
|
||||
uint32_t frameno = 0;
|
||||
|
|
|
@ -676,7 +676,7 @@ ICStubCompiler::emitPostWriteBarrierSlot(MacroAssembler &masm, Register obj, Reg
|
|||
static bool
|
||||
IsTopFrameConstructing(JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(cx->mainThread().currentlyRunningInJit());
|
||||
JS_ASSERT(cx->currentlyRunningInJit());
|
||||
JitActivationIterator activations(cx->runtime());
|
||||
IonFrameIterator iter(activations);
|
||||
JS_ASSERT(iter.type() == IonFrame_Exit);
|
||||
|
|
|
@ -127,7 +127,7 @@ EnterBaseline(JSContext *cx, StackFrame *fp, void *jitcode, bool osr)
|
|||
scopeChain = fp->scopeChain();
|
||||
|
||||
// For OSR, pass the number of locals + stack values.
|
||||
uint32_t numStackValues = osr ? fp->script()->nfixed + cx->regs().stackDepth() : 0;
|
||||
uint32_t numStackValues = osr ? fp->script()->nfixed + cx->stack.regs().stackDepth() : 0;
|
||||
JS_ASSERT_IF(osr, !IsJSDEnabled(cx));
|
||||
|
||||
AutoFlushInhibitor afi(cx->compartment()->ionCompartment());
|
||||
|
@ -138,7 +138,6 @@ EnterBaseline(JSContext *cx, StackFrame *fp, void *jitcode, bool osr)
|
|||
fp->clearRunningInJit();
|
||||
}
|
||||
|
||||
JS_ASSERT(fp == cx->fp());
|
||||
JS_ASSERT(!cx->runtime()->hasIonReturnOverride());
|
||||
|
||||
// The trampoline wrote the return value but did not set the HAS_RVAL flag.
|
||||
|
@ -247,7 +246,7 @@ ion::CanEnterBaselineJIT(JSContext *cx, JSScript *scriptArg, StackFrame *fp, boo
|
|||
// is enabled, so that we don't have to OSR and don't have to update the
|
||||
// frame pointer stored in JSD's frames list.
|
||||
if (IsJSDEnabled(cx)) {
|
||||
if (JSOp(*cx->regs().pc) == JSOP_LOOPENTRY) // No OSR.
|
||||
if (JSOp(*cx->stack.regs().pc) == JSOP_LOOPENTRY) // No OSR.
|
||||
return Method_Skipped;
|
||||
} else if (script->incUseCount() <= js_IonOptions.baselineUsesBeforeCompile) {
|
||||
return Method_Skipped;
|
||||
|
|
|
@ -1856,7 +1856,6 @@ EnterIon(JSContext *cx, StackFrame *fp, void *jitcode)
|
|||
fp->clearRunningInJit();
|
||||
}
|
||||
|
||||
JS_ASSERT(fp == cx->fp());
|
||||
JS_ASSERT(!cx->runtime()->hasIonReturnOverride());
|
||||
|
||||
// The trampoline wrote the return value but did not set the HAS_RVAL flag.
|
||||
|
|
|
@ -936,7 +936,7 @@ GenerateCallGetter(JSContext *cx, IonScript *ion, MacroAssembler &masm,
|
|||
|
||||
PropertyOp target = shape->getterOp();
|
||||
JS_ASSERT(target);
|
||||
// JSPropertyOp: JSBool fn(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
// JSPropertyOp: JSBool fn(JSContext *cx, JSHandleObject obj, JSHandleId id, MutableHandleValue vp)
|
||||
|
||||
// Push args on stack first so we can take pointers to make handles.
|
||||
masm.Push(UndefinedValue());
|
||||
|
@ -1846,7 +1846,7 @@ SetPropertyIC::attachSetterCall(JSContext *cx, IonScript *ion,
|
|||
StrictPropertyOp target = shape->setterOp();
|
||||
JS_ASSERT(target);
|
||||
// JSStrictPropertyOp: JSBool fn(JSContext *cx, JSHandleObject obj,
|
||||
// JSHandleId id, JSBool strict, JSMutableHandleValue vp);
|
||||
// JSHandleId id, JSBool strict, MutableHandleValue vp);
|
||||
|
||||
// Push args on stack first so we can take pointers to make handles.
|
||||
if (value().constant())
|
||||
|
|
|
@ -350,7 +350,7 @@ class IonOOLPropertyOpExitFrameLayout
|
|||
// id for JSHandleId
|
||||
jsid id_;
|
||||
|
||||
// space for JSMutableHandleValue result
|
||||
// space for MutableHandleValue result
|
||||
// use two uint32_t so compiler doesn't align.
|
||||
uint32_t vp0_;
|
||||
uint32_t vp1_;
|
||||
|
@ -398,7 +398,7 @@ class IonOOLProxyGetExitFrameLayout
|
|||
// id for JSHandleId
|
||||
jsid id_;
|
||||
|
||||
// space for JSMutableHandleValue result
|
||||
// space for MutableHandleValue result
|
||||
// use two uint32_t so compiler doesn't align.
|
||||
uint32_t vp0_;
|
||||
uint32_t vp1_;
|
||||
|
|
|
@ -314,7 +314,7 @@ class IonOOLPropertyOpExitFrameLayout
|
|||
// id for JSHandleId
|
||||
jsid id_;
|
||||
|
||||
// space for JSMutableHandleValue result
|
||||
// space for MutableHandleValue result
|
||||
// use two uint32_t so compiler doesn't align.
|
||||
uint32_t vp0_;
|
||||
uint32_t vp1_;
|
||||
|
@ -362,7 +362,7 @@ class IonOOLProxyGetExitFrameLayout
|
|||
// id for JSHandleId
|
||||
jsid id_;
|
||||
|
||||
// space for JSMutableHandleValue result
|
||||
// space for MutableHandleValue result
|
||||
// use two uint32_t so compiler doesn't align.
|
||||
uint32_t vp0_;
|
||||
uint32_t vp1_;
|
||||
|
|
|
@ -414,12 +414,12 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
|
|||
case JSOP_THROW:
|
||||
case JSOP_EXCEPTION:
|
||||
case JSOP_DEBUGGER:
|
||||
case JSOP_FUNCALL:
|
||||
isIonInlineable = false;
|
||||
break;
|
||||
|
||||
/* Additional opcodes which can be both compiled both normally and inline. */
|
||||
case JSOP_ARGUMENTS:
|
||||
case JSOP_FUNCALL:
|
||||
case JSOP_FUNAPPLY:
|
||||
case JSOP_CALLEE:
|
||||
case JSOP_NOP:
|
||||
|
|
|
@ -3209,13 +3209,13 @@ JS_DefaultValue(JSContext *cx, JSObject *objArg, JSType hint, jsval *vp)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
|
||||
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, MutableHandleValue vp)
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp)
|
||||
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, MutableHandleValue vp)
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -3240,7 +3240,7 @@ JS_ResolveStub(JSContext *cx, JSHandleObject obj, JSHandleId id)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp)
|
||||
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, MutableHandleValue vp)
|
||||
{
|
||||
JS_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION);
|
||||
JS_ASSERT(obj);
|
||||
|
@ -5965,7 +5965,7 @@ JS_TriggerOperationCallback(JSRuntime *rt)
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_IsRunning(JSContext *cx)
|
||||
{
|
||||
return cx->hasfp();
|
||||
return cx->currentlyRunning();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -718,10 +718,6 @@ typedef JS::Handle<JSString*> JSHandleString;
|
|||
typedef JS::Handle<JS::Value> JSHandleValue;
|
||||
typedef JS::Handle<jsid> JSHandleId;
|
||||
|
||||
typedef JS::MutableHandle<JSFunction*> JSMutableHandleFunction;
|
||||
typedef JS::MutableHandle<JSString*> JSMutableHandleString;
|
||||
typedef JS::MutableHandle<JS::Value> JSMutableHandleValue;
|
||||
|
||||
/* JSClass operation signatures. */
|
||||
|
||||
/*
|
||||
|
@ -730,7 +726,7 @@ typedef JS::MutableHandle<JS::Value> JSMutableHandleValue;
|
|||
* *vp out parameter, on success, is the new property value after the action.
|
||||
*/
|
||||
typedef JSBool
|
||||
(* JSPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
(* JSPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
/*
|
||||
* Set a property named by id in obj, treating the assignment as strict
|
||||
|
@ -740,7 +736,7 @@ typedef JSBool
|
|||
* set.
|
||||
*/
|
||||
typedef JSBool
|
||||
(* JSStrictPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
|
||||
(* JSStrictPropertyOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
/*
|
||||
* Delete a property named by id in obj.
|
||||
|
@ -794,7 +790,7 @@ typedef JSBool
|
|||
*/
|
||||
typedef JSBool
|
||||
(* JSNewEnumerateOp)(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
|
||||
JSMutableHandleValue statep, JS::MutableHandleId idp);
|
||||
JS::MutableHandle<JS::Value> statep, JS::MutableHandleId idp);
|
||||
|
||||
/*
|
||||
* The old-style JSClass.enumerate op should define all lazy properties not
|
||||
|
@ -839,7 +835,7 @@ typedef JSBool
|
|||
* *vp on success, and returning false on error or exception.
|
||||
*/
|
||||
typedef JSBool
|
||||
(* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
|
||||
(* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
typedef struct JSFreeOp JSFreeOp;
|
||||
|
||||
|
@ -882,7 +878,7 @@ struct JSStringFinalizer {
|
|||
*/
|
||||
typedef JSBool
|
||||
(* JSCheckAccessOp)(JSContext *cx, JSHandleObject obj, JSHandleId id, JSAccessMode mode,
|
||||
JSMutableHandleValue vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
/*
|
||||
* Check whether v is an instance of obj. Return false on error or exception,
|
||||
|
@ -890,7 +886,7 @@ typedef JSBool
|
|||
* *bp otherwise.
|
||||
*/
|
||||
typedef JSBool
|
||||
(* JSHasInstanceOp)(JSContext *cx, JSHandleObject obj, JSMutableHandleValue vp, JSBool *bp);
|
||||
(* JSHasInstanceOp)(JSContext *cx, JSHandleObject obj, JS::MutableHandle<JS::Value> vp, JSBool *bp);
|
||||
|
||||
/*
|
||||
* Function type for trace operation of the class called to enumerate all
|
||||
|
@ -1030,17 +1026,17 @@ typedef const JSErrorFormatString *
|
|||
const unsigned errorNumber);
|
||||
|
||||
typedef JSBool
|
||||
(* JSLocaleToUpperCase)(JSContext *cx, JSHandleString src, JSMutableHandleValue rval);
|
||||
(* JSLocaleToUpperCase)(JSContext *cx, JSHandleString src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
typedef JSBool
|
||||
(* JSLocaleToLowerCase)(JSContext *cx, JSHandleString src, JSMutableHandleValue rval);
|
||||
(* JSLocaleToLowerCase)(JSContext *cx, JSHandleString src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
typedef JSBool
|
||||
(* JSLocaleCompare)(JSContext *cx, JSHandleString src1, JSHandleString src2,
|
||||
JSMutableHandleValue rval);
|
||||
JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
typedef JSBool
|
||||
(* JSLocaleToUnicode)(JSContext *cx, const char *src, JSMutableHandleValue rval);
|
||||
(* JSLocaleToUnicode)(JSContext *cx, const char *src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
/*
|
||||
* Security protocol types.
|
||||
|
@ -1786,7 +1782,7 @@ IsPoisonedId(jsid iden)
|
|||
|
||||
namespace js {
|
||||
|
||||
template <> struct RootMethods<jsid>
|
||||
template <> struct GCMethods<jsid>
|
||||
{
|
||||
static jsid initial() { return JSID_VOID; }
|
||||
static ThingRootKind kind() { return THING_ROOT_ID; }
|
||||
|
@ -2864,7 +2860,7 @@ struct JSClass {
|
|||
* with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was
|
||||
* prevously allowed, but is now an ES5 violation and thus unsupported.
|
||||
*/
|
||||
#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 26)
|
||||
#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 25)
|
||||
#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
|
||||
(JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n)))
|
||||
#define JSCLASS_GLOBAL_FLAGS \
|
||||
|
@ -2967,10 +2963,10 @@ extern JS_PUBLIC_API(JSBool)
|
|||
JS_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp);
|
||||
JS_PropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
|
||||
JS_StrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeletePropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool *succeeded);
|
||||
|
@ -2982,7 +2978,7 @@ extern JS_PUBLIC_API(JSBool)
|
|||
JS_ResolveStub(JSContext *cx, JSHandleObject obj, JSHandleId id);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
|
||||
JS_ConvertStub(JSContext *cx, JSHandleObject obj, JSType type, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
struct JSConstDoubleSpec {
|
||||
double dval;
|
||||
|
@ -3343,7 +3339,7 @@ class PropertyDescriptorOperations
|
|||
namespace js {
|
||||
|
||||
template <>
|
||||
struct RootMethods<JSPropertyDescriptor> {
|
||||
struct GCMethods<JSPropertyDescriptor> {
|
||||
static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_PROPERTY_DESCRIPTOR; }
|
||||
static bool poisoned(const JSPropertyDescriptor &desc) {
|
||||
|
|
|
@ -171,8 +171,6 @@ js_InitBooleanClass(JSContext *cx, HandleObject obj)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
global->setBooleanValueOf(valueOf);
|
||||
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Boolean, ctor, booleanProto))
|
||||
return NULL;
|
||||
|
||||
|
@ -195,16 +193,16 @@ js::ToBooleanSlow(const Value &v)
|
|||
return !EmulatesUndefined(&v.toObject());
|
||||
}
|
||||
|
||||
/*
|
||||
* This slow path is only ever taken for Boolean objects from other
|
||||
* compartments. The only caller of the fast path, JSON's PreprocessValue,
|
||||
* makes sure of that.
|
||||
*/
|
||||
bool
|
||||
js::BooleanGetPrimitiveValueSlow(JSContext *cx, HandleObject obj, Value *vp)
|
||||
js::BooleanGetPrimitiveValueSlow(HandleObject wrappedBool, JSContext *cx)
|
||||
{
|
||||
InvokeArgsGuard ag;
|
||||
if (!cx->stack.pushInvokeArgs(cx, 0, &ag))
|
||||
return false;
|
||||
ag.setCallee(cx->compartment()->maybeGlobal()->booleanValueOf());
|
||||
ag.setThis(ObjectValue(*obj));
|
||||
if (!Invoke(cx, ag))
|
||||
return false;
|
||||
*vp = ag.rval();
|
||||
return true;
|
||||
JS_ASSERT(wrappedBool->isCrossCompartmentWrapper());
|
||||
JSObject *obj = Wrapper::wrappedObject(wrappedBool);
|
||||
JS_ASSERT(obj);
|
||||
return obj->asBoolean().unbox();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ js_BooleanToString(JSContext *cx, JSBool b);
|
|||
namespace js {
|
||||
|
||||
inline bool
|
||||
BooleanGetPrimitiveValue(JSContext *cx, HandleObject obj, Value *vp);
|
||||
BooleanGetPrimitiveValue(HandleObject obj, JSContext *cx);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
|
|
|
@ -16,17 +16,16 @@
|
|||
|
||||
namespace js {
|
||||
|
||||
bool BooleanGetPrimitiveValueSlow(JSContext *, HandleObject, Value *);
|
||||
bool
|
||||
BooleanGetPrimitiveValueSlow(HandleObject, JSContext *);
|
||||
|
||||
inline bool
|
||||
BooleanGetPrimitiveValue(JSContext *cx, HandleObject obj, Value *vp)
|
||||
BooleanGetPrimitiveValue(HandleObject obj, JSContext *cx)
|
||||
{
|
||||
if (obj->isBoolean()) {
|
||||
*vp = BooleanValue(obj->asBoolean().unbox());
|
||||
return true;
|
||||
}
|
||||
if (obj->isBoolean())
|
||||
return obj->asBoolean().unbox();
|
||||
|
||||
return BooleanGetPrimitiveValueSlow(cx, obj, vp);
|
||||
return BooleanGetPrimitiveValueSlow(obj, cx);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -387,7 +387,7 @@ IsPoisonedSpecialId(js::SpecialId iden)
|
|||
return false;
|
||||
}
|
||||
|
||||
template <> struct RootMethods<SpecialId>
|
||||
template <> struct GCMethods<SpecialId>
|
||||
{
|
||||
static SpecialId initial() { return SpecialId(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_ID; }
|
||||
|
|
|
@ -1299,6 +1299,20 @@ JSContext::restoreFrameChain()
|
|||
wrapPendingException();
|
||||
}
|
||||
|
||||
bool
|
||||
JSContext::currentlyRunning() const
|
||||
{
|
||||
for (ActivationIterator iter(runtime()); !iter.done(); ++iter) {
|
||||
if (iter.activation()->cx() == this) {
|
||||
if (iter.activation()->hasSavedFrameChain())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
JSRuntime::setGCMaxMallocBytes(size_t value)
|
||||
{
|
||||
|
|
|
@ -521,12 +521,6 @@ class PerThreadData : public js::PerThreadDataFriendFields
|
|||
js::Activation *activation() const {
|
||||
return activation_;
|
||||
}
|
||||
bool currentlyRunningInInterpreter() const {
|
||||
return activation_->isInterpreter();
|
||||
}
|
||||
bool currentlyRunningInJit() const {
|
||||
return activation_->isJit();
|
||||
}
|
||||
|
||||
/*
|
||||
* When this flag is non-zero, any attempt to GC will be skipped. It is used
|
||||
|
@ -1527,7 +1521,7 @@ struct JSContext : js::ContextFriendFields,
|
|||
JS_ASSERT_IF(compartment(), js::GetCompartmentZone(compartment()) == zone_);
|
||||
return zone_;
|
||||
}
|
||||
js::PerThreadData &mainThread() { return runtime()->mainThread; }
|
||||
js::PerThreadData &mainThread() const { return runtime()->mainThread; }
|
||||
|
||||
private:
|
||||
/* See JSContext::findVersion. */
|
||||
|
@ -1617,13 +1611,6 @@ struct JSContext : js::ContextFriendFields,
|
|||
*/
|
||||
inline js::Handle<js::GlobalObject*> global() const;
|
||||
|
||||
/* ContextStack convenience functions */
|
||||
inline bool hasfp() const { return stack.hasfp(); }
|
||||
inline js::StackFrame* fp() const { return stack.fp(); }
|
||||
inline js::StackFrame* maybefp() const { return stack.maybefp(); }
|
||||
inline js::FrameRegs& regs() const { return stack.regs(); }
|
||||
inline js::FrameRegs* maybeRegs() const { return stack.maybeRegs(); }
|
||||
|
||||
/* Wrap cx->exception for the current compartment. */
|
||||
void wrapPendingException();
|
||||
|
||||
|
@ -1733,6 +1720,22 @@ struct JSContext : js::ContextFriendFields,
|
|||
|
||||
void updateJITEnabled();
|
||||
|
||||
/* Whether this context has JS frames on the stack. */
|
||||
bool currentlyRunning() const;
|
||||
|
||||
bool currentlyRunningInInterpreter() const {
|
||||
return mainThread().activation()->isInterpreter();
|
||||
}
|
||||
bool currentlyRunningInJit() const {
|
||||
return mainThread().activation()->isJit();
|
||||
}
|
||||
js::StackFrame *interpreterFrame() const {
|
||||
return mainThread().activation()->asInterpreter()->current();
|
||||
}
|
||||
js::FrameRegs &interpreterRegs() const {
|
||||
return mainThread().activation()->asInterpreter()->regs();
|
||||
}
|
||||
|
||||
#ifdef MOZ_TRACE_JSCALLS
|
||||
/* Function entry/exit debugging callback. */
|
||||
JSFunctionCallback functionCallback;
|
||||
|
|
|
@ -126,11 +126,11 @@ NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::Initi
|
|||
struct PreserveRegsGuard
|
||||
{
|
||||
PreserveRegsGuard(JSContext *cx, FrameRegs ®s)
|
||||
: prevContextRegs(cx->maybeRegs()), cx(cx), regs_(regs) {
|
||||
: prevContextRegs(cx->stack.maybeRegs()), cx(cx), regs_(regs) {
|
||||
cx->stack.repointRegs(®s_);
|
||||
}
|
||||
~PreserveRegsGuard() {
|
||||
JS_ASSERT(cx->maybeRegs() == ®s_);
|
||||
JS_ASSERT(cx->stack.maybeRegs() == ®s_);
|
||||
*prevContextRegs = regs_;
|
||||
cx->stack.repointRegs(prevContextRegs);
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, un
|
|||
inline bool
|
||||
JSContext::canSetDefaultVersion() const
|
||||
{
|
||||
return !stack.hasfp() && !hasVersionOverride;
|
||||
return !currentlyRunning() && !hasVersionOverride;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -518,7 +518,7 @@ JSContext::setDefaultCompartmentObject(JSObject *obj)
|
|||
* final leaveCompartment call to set the context's compartment back to
|
||||
* defaultCompartmentObject->compartment()).
|
||||
*/
|
||||
JS_ASSERT(!hasfp());
|
||||
JS_ASSERT(!currentlyRunning());
|
||||
setCompartment(obj ? obj->compartment() : NULL);
|
||||
if (throwing)
|
||||
wrapPendingException();
|
||||
|
|
|
@ -76,7 +76,7 @@ IsTopFrameConstructing(JSContext *cx, AbstractFramePtr frame)
|
|||
JSTrapStatus
|
||||
js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame)
|
||||
{
|
||||
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->fp());
|
||||
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame());
|
||||
|
||||
if (!frame.script()->selfHosted) {
|
||||
if (frame.isFramePushedByExecute()) {
|
||||
|
@ -113,7 +113,8 @@ js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame)
|
|||
bool
|
||||
js::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, bool okArg)
|
||||
{
|
||||
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->fp());
|
||||
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame());
|
||||
|
||||
JSBool ok = okArg;
|
||||
|
||||
// We don't add hook data for self-hosted scripts, so we don't need to check for them, here.
|
||||
|
|
|
@ -404,14 +404,14 @@ js::IsOriginalScriptFunction(JSFunction *fun)
|
|||
JS_FRIEND_API(JSScript *)
|
||||
js::GetOutermostEnclosingFunctionOfScriptedCaller(JSContext *cx)
|
||||
{
|
||||
if (!cx->hasfp())
|
||||
ScriptFrameIter iter(cx);
|
||||
if (iter.done())
|
||||
return NULL;
|
||||
|
||||
StackFrame *fp = cx->fp();
|
||||
if (!fp->isFunctionFrame())
|
||||
if (!iter.isFunctionFrame())
|
||||
return NULL;
|
||||
|
||||
RootedFunction scriptedCaller(cx, fp->fun());
|
||||
RootedFunction scriptedCaller(cx, iter.callee());
|
||||
RootedScript outermost(cx, scriptedCaller->nonLazyScript());
|
||||
for (StaticScopeIter i(cx, scriptedCaller); !i.done(); i++) {
|
||||
if (i.type() == StaticScopeIter::FUNCTION)
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче