Backout changeset 2e466ccc7bd0 for devtools test failures.

This commit is contained in:
Ms2ger 2013-10-26 17:02:20 +02:00
parent 4d2c73133b
commit 34f7a76bb1
42 changed files with 1147 additions and 2818 deletions

View File

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 918345 needs a clobber due to WebIDL binding dependency issues (bug 928195).
Bug 914270 needs a clobber since moving variables to moz.build always requires a clobber (bug 852814)

View File

@ -31,10 +31,8 @@ function testPropertyProvider() {
completion = JSPropertyProvider(content, strComplete);
ok(completion.matches.length == 2, "two matches found");
ok(completion.matchProp == "locatio", "matching part is 'test'");
var matches = completion.matches;
matches.sort();
ok(matches[0] == "location", "the first match is 'location'");
ok(matches[1] == "locationbar", "the second match is 'locationbar'");
ok(completion.matches[0] == "location", "the first match is 'location'");
ok(completion.matches[1] == "locationbar", "the second match is 'locationbar'");
finishTest();
}

View File

@ -88,7 +88,6 @@
#include "mozilla/dom/HTMLVideoElement.h"
#include "mozilla/dom/TextMetrics.h"
#include "mozilla/dom/UnionTypes.h"
#include "nsGlobalWindow.h"
#ifdef USE_SKIA_GPU
#undef free // apparently defined by some windows header, clashing with a free()
@ -3225,7 +3224,7 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
}
void
CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* window, double x,
double y, double w, double h,
const nsAString& bgColor,
uint32_t flags, ErrorResult& error)
@ -3254,13 +3253,16 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
// Flush layout updates
if (!(flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH)) {
nsContentUtils::FlushLayoutForTree(&window);
nsContentUtils::FlushLayoutForTree(window);
}
nsRefPtr<nsPresContext> presContext;
nsIDocShell* docshell = window.GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
if (win) {
nsIDocShell* docshell = win->GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
}
}
if (!presContext) {
error.Throw(NS_ERROR_FAILURE);

View File

@ -24,7 +24,6 @@
#include "gfx2DGlue.h"
#include "imgIEncoder.h"
class nsGlobalWindow;
class nsXULElement;
namespace mozilla {
@ -370,7 +369,7 @@ public:
}
}
void DrawWindow(nsGlobalWindow& window, double x, double y, double w, double h,
void DrawWindow(nsIDOMWindow* window, double x, double y, double w, double h,
const nsAString& bgColor, uint32_t flags,
mozilla::ErrorResult& error);
void AsyncDrawXULElement(nsXULElement& elem, double x, double y, double w,

View File

@ -8751,7 +8751,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
nsISupports* context = requestingElement;
if (!context) {
context = ToSupports(mScriptGlobal);
context = nsGlobalWindow::ToSupports(mScriptGlobal);
}
// XXXbz would be nice to know the loading principal here... but we don't

View File

@ -91,7 +91,7 @@ WindowNamedPropertiesHandler::getOwnPropertyDescriptor(JSContext* aCx,
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryWrappedNative(wrapper);
MOZ_ASSERT(piWin);
nsGlobalWindow* win = static_cast<nsGlobalWindow*>(piWin.get());
if (win->Length() > 0) {
if (win->GetLength() > 0) {
nsCOMPtr<nsIDOMWindow> childWin = win->GetChildWindow(str);
if (childWin && ShouldExposeChildWindow(str, childWin)) {
// We found a subframe of the right name. Shadowing via |var foo| in

View File

@ -63,8 +63,7 @@ DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
DOMCI_CASTABLE_INTERFACE(nsDOMMouseEvent, nsDOMEventBase, 10, _extra) \
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
// have been declared.

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,7 @@
#include "nsIIdleObserver.h"
#include "nsIDocument.h"
#include "nsIDOMTouchEvent.h"
#include "mozilla/dom/EventTarget.h"
#include "Units.h"
#include "nsComponentManagerUtils.h"
@ -78,7 +79,6 @@
class nsIArray;
class nsIBaseWindow;
class nsIContent;
class nsICSSDeclaration;
class nsIDocShellTreeOwner;
class nsIDOMCrypto;
class nsIDOMOfflineResourceList;
@ -106,7 +106,6 @@ class nsWindowSizes;
namespace mozilla {
namespace dom {
class BarProp;
class Function;
class Gamepad;
class Navigator;
class SpeechSynthesis;
@ -122,17 +121,6 @@ NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
int32_t *aInterval,
nsIScriptTimeoutHandler **aRet);
extern already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
mozilla::dom::Function& aFunction,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
extern already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
const nsAString& aExpression,
mozilla::ErrorResult& aError);
/*
* Timeout struct that holds information about each script
* timeout. Holds a strong reference to an nsIScriptTimeoutHandler, which
@ -318,6 +306,7 @@ class nsGlobalWindow : public mozilla::dom::EventTarget,
public:
typedef mozilla::TimeStamp TimeStamp;
typedef mozilla::TimeDuration TimeDuration;
typedef mozilla::dom::Navigator Navigator;
typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindow*> WindowByIdTable;
// public methods
@ -467,6 +456,7 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
// WebIDL interface.
uint32_t GetLength();
already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex, bool& aFound);
void GetSupportedNames(nsTArray<nsString>& aNames);
@ -479,6 +469,11 @@ public:
// Make sure this matches the casts we do in QueryInterface().
return (nsGlobalWindow *)(mozilla::dom::EventTarget *)supports;
}
static nsISupports *ToSupports(nsGlobalWindow *win)
{
// Make sure this matches the casts we do in QueryInterface().
return (nsISupports *)(mozilla::dom::EventTarget *)win;
}
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
{
return FromSupports(wrapper->Native());
@ -507,7 +502,10 @@ public:
{
nsCOMPtr<nsIDOMWindow> top;
GetScriptableTop(getter_AddRefs(top));
return static_cast<nsGlobalWindow *>(top.get());
if (top) {
return static_cast<nsGlobalWindow *>(top.get());
}
return nullptr;
}
already_AddRefed<nsIDOMWindow> GetChildWindow(const nsAString& aName);
@ -763,177 +761,11 @@ public:
#undef ERROR_EVENT
#undef EVENT
nsISupports* GetParentObject()
{
return nullptr;
}
nsIDOMWindow* GetWindow(mozilla::ErrorResult& aError);
nsIDOMWindow* GetSelf(mozilla::ErrorResult& aError);
nsIDocument* GetDocument()
{
return GetDoc();
}
void GetName(nsAString& aName, mozilla::ErrorResult& aError);
void SetName(const nsAString& aName, mozilla::ErrorResult& aError);
nsIDOMLocation* GetLocation(mozilla::ErrorResult& aError);
nsHistory* GetHistory(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetToolbar(mozilla::ErrorResult& aError);
void GetStatus(nsAString& aStatus, mozilla::ErrorResult& aError);
void SetStatus(const nsAString& aStatus, mozilla::ErrorResult& aError);
void Close(mozilla::ErrorResult& aError);
bool GetClosed(mozilla::ErrorResult& aError);
void Stop(mozilla::ErrorResult& aError);
void Focus(mozilla::ErrorResult& aError);
void Blur(mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMWindow> GetFrames(mozilla::ErrorResult& aError);
uint32_t Length();
already_AddRefed<nsIDOMWindow> GetTop(mozilla::ErrorResult& aError)
{
nsCOMPtr<nsIDOMWindow> top;
aError = GetScriptableTop(getter_AddRefs(top));
return top.forget();
}
nsIDOMWindow* GetOpener(mozilla::ErrorResult& aError);
void SetOpener(nsIDOMWindow* aOpener, mozilla::ErrorResult& aError);
using nsIDOMWindow::GetParent;
already_AddRefed<nsIDOMWindow> GetParent(mozilla::ErrorResult& aError);
mozilla::dom::Element* GetFrameElement(mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMWindow> Open(const nsAString& aUrl,
const nsAString& aName,
const nsAString& aOptions,
mozilla::ErrorResult& aError);
mozilla::dom::Navigator* GetNavigator(mozilla::ErrorResult& aError);
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
void Alert(const nsAString& aMessage, mozilla::ErrorResult& aError);
bool Confirm(const nsAString& aMessage, mozilla::ErrorResult& aError);
void Prompt(const nsAString& aMessage, const nsAString& aInitial,
nsAString& aReturn, mozilla::ErrorResult& aError);
void Print(mozilla::ErrorResult& aError);
JS::Value ShowModalDialog(JSContext* aCx, const nsAString& aUrl, const mozilla::dom::Optional<JS::Handle<JS::Value> >& aArgument, const nsAString& aOptions, mozilla::ErrorResult& aError);
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const nsAString& aTargetOrigin,
const mozilla::dom::Optional<mozilla::dom::Sequence<JS::Value > >& aTransfer,
mozilla::ErrorResult& aError);
int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler,
int32_t aTimeout, mozilla::ErrorResult& aError);
void ClearTimeout(int32_t aHandle, mozilla::ErrorResult& aError);
int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction,
const mozilla::dom::Optional<int32_t>& aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
const mozilla::dom::Optional<int32_t>& aTimeout,
mozilla::ErrorResult& aError);
void ClearInterval(int32_t aHandle, mozilla::ErrorResult& aError);
void Atob(const nsAString& aAsciiBase64String, nsAString& aBinaryData,
mozilla::ErrorResult& aError);
void Btoa(const nsAString& aBinaryData, nsAString& aAsciiBase64String,
mozilla::ErrorResult& aError);
nsIDOMStorage* GetSessionStorage(mozilla::ErrorResult& aError);
nsIDOMStorage* GetLocalStorage(mozilla::ErrorResult& aError);
nsISelection* GetSelection(mozilla::ErrorResult& aError);
mozilla::dom::indexedDB::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
already_AddRefed<nsICSSDeclaration>
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMMediaQueryList> MatchMedia(const nsAString& aQuery,
mozilla::ErrorResult& aError);
nsScreen* GetScreen(mozilla::ErrorResult& aError);
void MoveTo(int32_t aXPos, int32_t aYPos, mozilla::ErrorResult& aError);
void MoveBy(int32_t aXDif, int32_t aYDif, mozilla::ErrorResult& aError);
void ResizeTo(int32_t aWidth, int32_t aHeight,
mozilla::ErrorResult& aError);
void ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
mozilla::ErrorResult& aError);
int32_t GetInnerWidth(mozilla::ErrorResult& aError);
void SetInnerWidth(int32_t aInnerWidth, mozilla::ErrorResult& aError);
int32_t GetInnerHeight(mozilla::ErrorResult& aError);
void SetInnerHeight(int32_t aInnerHeight, mozilla::ErrorResult& aError);
int32_t GetScrollX(mozilla::ErrorResult& aError);
int32_t GetPageXOffset(mozilla::ErrorResult& aError)
{
return GetScrollX(aError);
}
int32_t GetScrollY(mozilla::ErrorResult& aError);
int32_t GetPageYOffset(mozilla::ErrorResult& aError)
{
return GetScrollY(aError);
}
int32_t GetScreenX(mozilla::ErrorResult& aError);
void SetScreenX(int32_t aScreenX, mozilla::ErrorResult& aError);
int32_t GetScreenY(mozilla::ErrorResult& aError);
void SetScreenY(int32_t aScreenY, mozilla::ErrorResult& aError);
int32_t GetOuterWidth(mozilla::ErrorResult& aError);
void SetOuterWidth(int32_t aOuterWidth, mozilla::ErrorResult& aError);
int32_t GetOuterHeight(mozilla::ErrorResult& aError);
void SetOuterHeight(int32_t aOuterHeight, mozilla::ErrorResult& aError);
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
mozilla::ErrorResult& aError);
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
nsPerformance* GetPerformance(mozilla::ErrorResult& aError);
#ifdef MOZ_WEBSPEECH
mozilla::dom::SpeechSynthesis*
GetSpeechSynthesis(mozilla::ErrorResult& aError);
mozilla::dom::SpeechSynthesis* GetSpeechSynthesisInternal();
#endif
already_AddRefed<nsICSSDeclaration>
GetDefaultComputedStyle(mozilla::dom::Element& aElt,
const nsAString& aPseudoElt,
mozilla::ErrorResult& aError);
mozilla::dom::indexedDB::IDBFactory*
GetMozIndexedDB(mozilla::ErrorResult& aError)
{
return GetIndexedDB(aError);
}
int32_t MozRequestAnimationFrame(nsIFrameRequestCallback* aRequestCallback,
mozilla::ErrorResult& aError);
void MozCancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError)
{
return CancelAnimationFrame(aHandle, aError);
}
void MozCancelRequestAnimationFrame(int32_t aHandle,
mozilla::ErrorResult& aError)
{
return CancelAnimationFrame(aHandle, aError);
}
int64_t GetMozAnimationStartTime(mozilla::ErrorResult& aError);
void SizeToContent(mozilla::ErrorResult& aError);
nsIDOMCrypto* GetCrypto(mozilla::ErrorResult& aError);
nsIDOMPkcs11* GetPkcs11()
{
return nullptr;
}
nsIControllers* GetControllers(mozilla::ErrorResult& aError);
float GetMozInnerScreenX(mozilla::ErrorResult& aError);
float GetMozInnerScreenY(mozilla::ErrorResult& aError);
float GetDevicePixelRatio(mozilla::ErrorResult& aError);
int32_t GetScrollMaxX(mozilla::ErrorResult& aError);
int32_t GetScrollMaxY(mozilla::ErrorResult& aError);
bool GetFullScreen(mozilla::ErrorResult& aError);
void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
void Back(mozilla::ErrorResult& aError);
void Forward(mozilla::ErrorResult& aError);
void Home(mozilla::ErrorResult& aError);
bool Find(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
bool aShowDialog, mozilla::ErrorResult& aError);
uint64_t GetMozPaintCount(mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMWindow> OpenDialog(JSContext* aCx,
const nsAString& aUrl,
const nsAString& aName,
const nsAString& aOptions,
const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
mozilla::ErrorResult& aError);
JSObject* GetContent(JSContext* aCx, mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetScrollbars();
protected:
// Array of idle observers that are notified of idle events.
@ -1085,21 +917,7 @@ protected:
nsresult SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
int32_t interval,
bool aIsInterval, int32_t *aReturn);
int32_t SetTimeoutOrInterval(mozilla::dom::Function& aFunction,
int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
bool aIsInterval, mozilla::ErrorResult& aError);
int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
int32_t aTimeout, bool aIsInterval,
mozilla::ErrorResult& aError);
void ClearTimeoutOrInterval(int32_t aTimerID,
mozilla::ErrorResult& aError);
nsresult ClearTimeoutOrInterval(int32_t aTimerID)
{
mozilla::ErrorResult rv;
ClearTimeoutOrInterval(aTimerID, rv);
return rv.ErrorCode();
}
nsresult ClearTimeoutOrInterval(int32_t aTimerID);
// JS specific timeout functions (JS args grabbed from context).
nsresult SetTimeoutOrInterval(bool aIsInterval, int32_t* aReturn);
@ -1167,17 +985,15 @@ protected:
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
// just flush our parent and only flush ourselves if we think we need to.
mozilla::CSSIntPoint GetScrollXY(bool aDoFlush, mozilla::ErrorResult& aError);
nsresult GetScrollXY(int32_t* aScrollX, int32_t* aScrollY, bool aDoFlush);
void GetScrollMaxXY(int32_t* aScrollMaxX, int32_t* aScrollMaxY,
mozilla::ErrorResult& aError);
nsresult GetScrollXY(int32_t* aScrollX, int32_t* aScrollY,
bool aDoFlush);
nsresult GetScrollMaxXY(int32_t* aScrollMaxX, int32_t* aScrollMaxY);
// Outer windows only.
nsresult GetInnerSize(mozilla::CSSIntSize& aSize);
nsIntSize GetOuterSize(mozilla::ErrorResult& aError);
void SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
mozilla::ErrorResult& aError);
nsresult GetOuterSize(nsIntSize* aSizeCSSPixels);
nsresult SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth);
nsRect GetInnerScreenRect();
void ScrollTo(const mozilla::CSSIntPoint& aScroll);
@ -1263,11 +1079,6 @@ protected:
nsDOMWindowList* GetWindowList();
// Helper for getComputedStyle and getDefaultComputedStyle
already_AddRefed<nsICSSDeclaration>
GetComputedStyleHelper(mozilla::dom::Element& aElt,
const nsAString& aPseudoElt,
bool aDefaultStylesOnly,
mozilla::ErrorResult& aError);
nsresult GetComputedStyleHelper(nsIDOMElement* aElt,
const nsAString& aPseudoElt,
bool aDefaultStylesOnly,
@ -1275,27 +1086,8 @@ protected:
void PreloadLocalStorage();
// Returns device pixels.
nsIntPoint GetScreenXY(mozilla::ErrorResult& aError);
int32_t RequestAnimationFrame(const nsIDocument::FrameRequestCallbackHolder& aCallback,
mozilla::ErrorResult& aError);
nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError);
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const nsAString& aTargetOrigin,
JS::Handle<JS::Value> aTransfer,
mozilla::ErrorResult& aError);
already_AddRefed<nsIVariant>
ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
const nsAString& aOptions, mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMWindow>
GetContentInternal(mozilla::ErrorResult& aError);
nsresult RequestAnimationFrame(const nsIDocument::FrameRequestCallbackHolder& aCallback,
int32_t* aHandle);
// When adding new member variables, be careful not to create cycles
// through JavaScript. If there is any chance that a member variable
@ -1386,7 +1178,7 @@ protected:
// For |window.dialogArguments|, via |showModalDialog|.
nsRefPtr<DialogValueHolder> mDialogArguments;
nsRefPtr<mozilla::dom::Navigator> mNavigator;
nsRefPtr<Navigator> mNavigator;
nsRefPtr<nsScreen> mScreen;
nsRefPtr<nsDOMWindowList> mFrames;
nsRefPtr<mozilla::dom::BarProp> mMenubar;
@ -1492,18 +1284,6 @@ protected:
static bool sWarnedAboutWindowInternal;
};
inline nsISupports*
ToSupports(nsGlobalWindow *p)
{
return static_cast<nsIDOMEventTarget*>(p);
}
inline nsISupports*
ToCanonicalSupports(nsGlobalWindow *p)
{
return static_cast<nsIDOMEventTarget*>(p);
}
/*
* nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
* object created for a Chrome Window only.

View File

@ -22,7 +22,6 @@
static const char kSetIntervalStr[] = "setInterval";
static const char kSetTimeoutStr[] = "setTimeout";
using namespace mozilla;
using namespace mozilla::dom;
// Our JS nsIScriptTimeoutHandler implementation.
@ -34,13 +33,6 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsJSScriptTimeoutHandler)
nsJSScriptTimeoutHandler();
// This will call SwapElements on aArguments with an empty array.
nsJSScriptTimeoutHandler(nsGlobalWindow *aWindow, Function& aFunction,
FallibleTArray<JS::Heap<JS::Value> >& aArguments,
ErrorResult& aError);
nsJSScriptTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
const nsAString& aExpression, bool* aAllowEval,
ErrorResult& aError);
~nsJSScriptTimeoutHandler();
virtual const PRUnichar *GetHandlerText();
@ -60,7 +52,7 @@ public:
}
nsresult Init(nsGlobalWindow *aWindow, bool *aIsInterval,
int32_t *aInterval, bool* aAllowEval);
int32_t *aInterval);
void ReleaseJSObjects();
@ -71,9 +63,9 @@ private:
uint32_t mLineNo;
nsTArray<JS::Heap<JS::Value> > mArgs;
// The expression to evaluate or function to call. If mFunction is non-null
// it should be used, else use mExpr.
nsString mExpr;
// The JS expression to evaluate or function to call, if !mExpr
// Note this is always a flat string.
JS::Heap<JSString*> mExpr;
nsRefPtr<Function> mFunction;
};
@ -88,7 +80,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSScriptTimeoutHandler)
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
nsAutoCString name("nsJSScriptTimeoutHandler");
if (tmp->mFunction) {
if (tmp->mExpr) {
name.AppendLiteral(" [");
name.Append(tmp->mFileName);
name.AppendLiteral(":");
name.AppendInt(tmp->mLineNo);
name.AppendLiteral("]");
}
else if (tmp->mFunction) {
JSFunction* fun =
JS_GetObjectFunction(js::UncheckedUnwrap(tmp->mFunction->Callable()));
if (fun && JS_GetFunctionId(fun)) {
@ -103,12 +102,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSScriptTimeoutHandler)
name.AppendLiteral("]");
}
}
} else {
name.AppendLiteral(" [");
name.Append(tmp->mFileName);
name.AppendLiteral(":");
name.AppendInt(tmp->mLineNo);
name.AppendLiteral("]");
}
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name.get());
}
@ -117,13 +110,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSScriptTimeoutHandler)
tmp->mRefCnt.get())
}
if (tmp->mFunction) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFunction)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFunction)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSScriptTimeoutHandler)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mExpr)
for (uint32_t i = 0; i < tmp->mArgs.Length(); ++i) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mArgs[i])
}
@ -137,104 +129,10 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsJSScriptTimeoutHandler)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsJSScriptTimeoutHandler)
static bool
CheckCSPForEval(JSContext* aCx, nsGlobalWindow* aWindow, ErrorResult& aError)
{
// if CSP is enabled, and setTimeout/setInterval was called with a string,
// disable the registration and log an error
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
if (!doc) {
// if there's no document, we don't have to do anything.
return true;
}
nsCOMPtr<nsIContentSecurityPolicy> csp;
aError = doc->NodePrincipal()->GetCsp(getter_AddRefs(csp));
if (aError.Failed()) {
return false;
}
if (!csp) {
return true;
}
bool allowsEval = true;
bool reportViolation = false;
aError = csp->GetAllowsEval(&reportViolation, &allowsEval);
if (aError.Failed()) {
return false;
}
if (reportViolation) {
// TODO : need actual script sample in violation report.
NS_NAMED_LITERAL_STRING(scriptSample,
"call to eval() or related function blocked by CSP");
// Get the calling location.
uint32_t lineNum = 0;
const char *fileName;
nsAutoString fileNameString;
if (nsJSUtils::GetCallingLocation(aCx, &fileName, &lineNum)) {
AppendUTF8toUTF16(fileName, fileNameString);
} else {
fileNameString.AssignLiteral("unknown");
}
csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_EVAL,
fileNameString, scriptSample, lineNum);
}
return allowsEval;
}
nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler() :
mLineNo(0)
{
}
nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(nsGlobalWindow *aWindow,
Function& aFunction,
FallibleTArray<JS::Heap<JS::Value> >& aArguments,
ErrorResult& aError) :
mLineNo(0),
mFunction(&aFunction)
mExpr(nullptr)
{
if (!aWindow->GetContextInternal() || !aWindow->FastGetGlobalJSObject()) {
// This window was already closed, or never properly initialized,
// don't let a timer be scheduled on such a window.
aError.Throw(NS_ERROR_NOT_INITIALIZED);
return;
}
mozilla::HoldJSObjects(this);
mArgs.SwapElements(aArguments);
}
nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(JSContext* aCx,
nsGlobalWindow *aWindow,
const nsAString& aExpression,
bool* aAllowEval,
ErrorResult& aError) :
mLineNo(0),
mExpr(aExpression)
{
if (!aWindow->GetContextInternal() || !aWindow->FastGetGlobalJSObject()) {
// This window was already closed, or never properly initialized,
// don't let a timer be scheduled on such a window.
aError.Throw(NS_ERROR_NOT_INITIALIZED);
return;
}
*aAllowEval = CheckCSPForEval(aCx, aWindow, aError);
if (aError.Failed() || !*aAllowEval) {
return;
}
// Get the calling location.
const char *filename;
if (nsJSUtils::GetCallingLocation(aCx, &filename, &mLineNo)) {
mFileName.Assign(filename);
}
}
nsJSScriptTimeoutHandler::~nsJSScriptTimeoutHandler()
@ -245,16 +143,18 @@ nsJSScriptTimeoutHandler::~nsJSScriptTimeoutHandler()
void
nsJSScriptTimeoutHandler::ReleaseJSObjects()
{
if (mFunction) {
if (mExpr) {
mExpr = nullptr;
} else {
mFunction = nullptr;
mArgs.Clear();
mozilla::DropJSObjects(this);
}
mozilla::DropJSObjects(this);
}
nsresult
nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
int32_t *aInterval, bool *aAllowEval)
int32_t *aInterval)
{
if (!aWindow->GetContextInternal() || !aWindow->FastGetGlobalJSObject()) {
// This window was already closed, or never properly initialized,
@ -338,16 +238,51 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
}
if (expr) {
// if CSP is enabled, and setTimeout/setInterval was called with a string,
// disable the registration and log an error
ErrorResult error;
*aAllowEval = CheckCSPForEval(cx, aWindow, error);
if (error.Failed() || !*aAllowEval) {
return error.ErrorCode();
}
// if CSP is enabled, and setTimeout/setInterval was called with a string
// or object, disable the registration and log an error
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
mExpr.Append(JS_GetFlatStringChars(expr),
JS_GetStringLength(JS_FORGET_STRING_FLATNESS(expr)));
if (doc) {
nsCOMPtr<nsIContentSecurityPolicy> csp;
nsresult rv = doc->NodePrincipal()->GetCsp(getter_AddRefs(csp));
NS_ENSURE_SUCCESS(rv, rv);
if (csp) {
bool allowsEval = true;
bool reportViolation = false;
rv = csp->GetAllowsEval(&reportViolation, &allowsEval);
NS_ENSURE_SUCCESS(rv, rv);
if (reportViolation) {
// TODO : need actual script sample in violation report.
NS_NAMED_LITERAL_STRING(scriptSample, "call to eval() or related function blocked by CSP");
// Get the calling location.
uint32_t lineNum = 0;
const char *fileName;
nsAutoCString aFileName;
if (nsJSUtils::GetCallingLocation(cx, &fileName, &lineNum)) {
aFileName.Assign(fileName);
} else {
aFileName.Assign("unknown");
}
csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_EVAL,
NS_ConvertUTF8toUTF16(aFileName),
scriptSample,
lineNum);
}
if (!allowsEval) {
// Note: Our only caller knows to turn NS_ERROR_DOM_TYPE_ERR into NS_OK.
return NS_ERROR_DOM_TYPE_ERR;
}
}
} // if there's no document, we don't have to do anything.
mozilla::HoldJSObjects(this);
mExpr = JS_FORGET_STRING_FLATNESS(expr);
// Get the calling location.
const char *filename;
@ -355,8 +290,6 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
mFileName.Assign(filename);
}
} else if (funobj) {
*aAllowEval = true;
mozilla::HoldJSObjects(this);
mFunction = new Function(funobj);
@ -387,8 +320,8 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
const PRUnichar *
nsJSScriptTimeoutHandler::GetHandlerText()
{
NS_ASSERTION(!mFunction, "No expression, so no handler text!");
return mExpr.get();
NS_ASSERTION(mExpr, "No expression, so no handler text!");
return ::JS_GetFlatStringChars(JS_ASSERT_STRING_IS_FLAT(mExpr));
}
nsresult NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
@ -398,9 +331,8 @@ nsresult NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
{
*aRet = nullptr;
nsRefPtr<nsJSScriptTimeoutHandler> handler = new nsJSScriptTimeoutHandler();
bool allowEval;
nsresult rv = handler->Init(aWindow, aIsInterval, aInterval, &allowEval);
if (NS_FAILED(rv) || !allowEval) {
nsresult rv = handler->Init(aWindow, aIsInterval, aInterval);
if (NS_FAILED(rv)) {
return rv;
}
@ -408,34 +340,3 @@ nsresult NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
return NS_OK;
}
already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow, Function& aFunction,
const Sequence<JS::Value>& aArguments,
ErrorResult& aError)
{
FallibleTArray<JS::Heap<JS::Value> > args;
if (!args.AppendElements(aArguments)) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return 0;
}
nsRefPtr<nsJSScriptTimeoutHandler> handler =
new nsJSScriptTimeoutHandler(aWindow, aFunction, args, aError);
return aError.Failed() ? nullptr : handler.forget();
}
already_AddRefed<nsIScriptTimeoutHandler>
NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
const nsAString& aExpression, ErrorResult& aError)
{
ErrorResult rv;
bool allowEval = false;
nsRefPtr<nsJSScriptTimeoutHandler> handler =
new nsJSScriptTimeoutHandler(aCx, aWindow, aExpression, &allowEval, rv);
if (rv.Failed() || !allowEval) {
return nullptr;
}
return handler.forget();
}

View File

@ -451,10 +451,7 @@ GetWrapperCache(nsWrapperCache* cache)
}
inline nsWrapperCache*
GetWrapperCache(nsGlobalWindow*)
{
return nullptr;
}
GetWrapperCache(nsGlobalWindow* not_allowed);
inline nsWrapperCache*
GetWrapperCache(void* p)

View File

@ -1417,16 +1417,6 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::DOMWheelEvent',
},
'Window': {
'nativeType': 'nsGlobalWindow',
'hasXPConnectImpls': True,
'register': False,
'implicitJSContext': [ 'setInterval', 'setTimeout' ],
'binaryNames': {
'postMessage': 'postMessageMoz',
},
},
'WindowProxy': [
{
'nativeType': 'nsIDOMWindow',
@ -1447,18 +1437,12 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::workers::MessagePort',
'headerFile': 'mozilla/dom/workers/bindings/MessagePort.h',
'implicitJSContext': [ 'postMessage' ],
'binaryNames': {
'postMessage': 'postMessageMoz',
},
},
{
'nativeType': 'mozilla::dom::workers::WorkerMessagePort',
'headerFile': 'mozilla/dom/workers/bindings/WorkerMessagePort.h',
'workers': True,
'nativeOwnership': 'worker',
'binaryNames': {
'postMessage': 'postMessageMoz',
},
}],
'WorkerNavigator': {
@ -1812,7 +1796,6 @@ def addExternalIface(iface, nativeType=None, headerFile=None,
domInterface['notflattened'] = notflattened
DOMInterfaces[iface] = domInterface
addExternalIface('ApplicationCache', nativeType='nsIDOMOfflineResourceList')
addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
headerFile='nsIDOMActivityOptions.h')
addExternalIface('Counter')
@ -1829,14 +1812,11 @@ addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserve
addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
addExternalIface('LockedFile')
addExternalIface('MediaList')
addExternalIface('MediaQueryList')
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
addExternalIface('MozConnection', headerFile='nsIDOMConnection.h')
addExternalIface('MozControllers', nativeType='nsIControllers')
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
addExternalIface('MozFrameRequestCallback', nativeType='nsIFrameRequestCallback',
notflattened=True);
addExternalIface('MozIccManager', headerFile='nsIDOMIccManager.h')
addExternalIface('MozMobileConnection', headerFile='nsIDOMMobileConnection.h')
addExternalIface('MozMobileMessageManager', headerFile='nsIDOMMobileMessageManager.h')
@ -1853,8 +1833,6 @@ addExternalIface('MozWakeLock', headerFile='nsIDOMWakeLock.h')
addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
addExternalIface('nsIControllers', nativeType='nsIControllers')
addExternalIface('nsIDOMCrypto', nativeType='nsIDOMCrypto',
headerFile='Crypto.h')
addExternalIface('nsIInputStreamCallback', nativeType='nsIInputStreamCallback',
headerFile='nsIAsyncInputStream.h')
addExternalIface('nsIStreamListener', nativeType='nsIStreamListener', notflattened=True)
@ -1863,7 +1841,6 @@ addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
addExternalIface('nsIVariant', nativeType='nsIVariant', notflattened=True)
addExternalIface('OutputStream', nativeType='nsIOutputStream',
notflattened=True)
addExternalIface('Pkcs11')
addExternalIface('Principal', nativeType='nsIPrincipal',
headerFile='nsIPrincipal.h', notflattened=True)
addExternalIface('Selection', nativeType='nsISelection')
@ -1875,6 +1852,7 @@ addExternalIface('SVGNumber')
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
notflattened=True)
addExternalIface('UserDataHandler')
addExternalIface('Window')
addExternalIface('XPathResult', nativeType='nsISupports')
addExternalIface('XPathExpression')
addExternalIface('XPathNSResolver')

View File

@ -171,6 +171,8 @@ class CGDOMJSClass(CGThing):
def __init__(self, descriptor):
CGThing.__init__(self)
self.descriptor = descriptor
# Our current reserved slot situation is unsafe for globals. Fix bug 760095!
assert "Window" not in descriptor.interface.identifier.name
def declare(self):
return ""
def define(self):
@ -2152,11 +2154,6 @@ def CreateBindingJSObject(descriptor, properties, parent):
js::SetReservedSlot(obj, DOM_OBJECT_SLOT, PRIVATE_TO_JSVAL(aObject));
"""
if "Window" in descriptor.interface.identifier.name:
create = """ MOZ_ASSERT(false,
"Our current reserved slot situation is unsafe for globals. Fix "
"bug 760095!");
""" + create
create = objDecl + create
if descriptor.nativeOwnership == 'refcounted':

View File

@ -13,6 +13,7 @@
#include "XPCWrapper.h"
#include "WrapperFactory.h"
#include "nsDOMClassInfo.h"
#include "nsGlobalWindow.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/BindingUtils.h"

View File

@ -452,7 +452,7 @@ GamepadService::SetWindowHasSeenGamepad(nsGlobalWindow* aWindow,
if (aHasSeen) {
aWindow->SetHasSeenGamepadInput(true);
nsCOMPtr<nsISupports> window = ToSupports(aWindow);
nsCOMPtr<nsISupports> window = nsGlobalWindow::ToSupports(aWindow);
nsRefPtr<Gamepad> gamepad = mGamepads[aIndex]->Clone(window);
aWindow->AddGamepad(aIndex, gamepad);
} else {

View File

@ -30,5 +30,13 @@
"Window unforgeable attribute: document": true,
"Window unforgeable attribute: location": true,
"Window unforgeable attribute: top": true,
"Window replaceable attribute: locationbar": true,
"Window replaceable attribute: menubar": true,
"Window replaceable attribute: personalbar": true,
"Window replaceable attribute: scrollbars": true,
"Window replaceable attribute: statusbar": true,
"Window replaceable attribute: toolbar": true,
"Window replaceable attribute: frames": true,
"Window replaceable attribute: length": true,
"constructor": true
}

View File

@ -1,2 +1,4 @@
{
"btoa(null) == \"bnVsbA==\"": true,
"atob(null) == \"\u009e\u00e9e\"": true
}

View File

@ -9,7 +9,7 @@
var event = location.hash.split("#").pop();
send(document.getElementById("nested link"), event, function() {
var popup = window.open("http://example.com"),
grandparent = window.open("", "parent260264");
grandparent = window.open(null, "parent260264");
try { grandparent.report(popup) }
finally { popup && popup.close() }
});

View File

@ -12,6 +12,7 @@
*/
interface HitRegionOptions;
interface Window;
enum CanvasWindingRule { "nonzero", "evenodd" };

View File

@ -3,6 +3,7 @@
* 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/. */
interface Window;
interface nsISupports;
enum DOMRequestReadyState { "pending", "done" };

View File

@ -7,6 +7,7 @@
// Dummy bindings that we need to force generation of things that
// aren't actually referenced anywhere in IDL yet but are used in C++.
[Global]
interface DummyInterface : EventTarget {
readonly attribute OnErrorEventHandlerNonNull onErrorEventHandler;
FilePropertyBag fileBag();

View File

@ -122,7 +122,7 @@ interface OnErrorEventHandlerForNodes {
attribute EventHandler onerror;
};
[NoInterfaceObject]
interface OnErrorEventHandlerForWindow {
attribute OnErrorEventHandler onerror;
};
//[NoInterfaceObject]
//interface OnErrorEventHandlerForWindow {
// attribute OnErrorEventHandler onerror;
//};

View File

@ -1,19 +0,0 @@
/* -*- 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:
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
*/
[NoInterfaceObject]
interface IDBEnvironment {
//[Throws] readonly attribute IDBFactory indexedDB;
[Throws] readonly attribute IDBFactory? indexedDB;
};
// Mozilla-specific stuff
partial interface IDBEnvironment {
[Throws] readonly attribute IDBFactory? mozIndexedDB;
};

View File

@ -13,6 +13,7 @@
*
*/
interface Window;
interface nsISupports;
/* Must be created first. Observer events will be dispatched on the thread provided */

View File

@ -3,6 +3,7 @@
* 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/.
*/
interface Window;
interface URI;
[Constructor(DOMString type, optional PopupBlockedEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]

View File

@ -4,337 +4,9 @@
* 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/
* https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
* http://dev.w3.org/csswg/cssom/
* http://dev.w3.org/csswg/cssom-view/
* https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
* https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
* https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
* http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
*/
interface ApplicationCache;
interface MediaQueryList;
interface MozFrameRequestCallback;
interface nsIDOMCrypto;
interface Pkcs11;
typedef any Transferable;
// http://www.whatwg.org/specs/web-apps/current-work/
[Global]
/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable, Throws] readonly attribute WindowProxy window;
[Replaceable, Throws] readonly attribute WindowProxy self;
[Unforgeable] readonly attribute Document? document;
[Throws] attribute DOMString name;
[PutForwards=href, Unforgeable, Throws] readonly attribute Location? location;
[Throws] readonly attribute History history;
[Replaceable, Throws] readonly attribute BarProp locationbar;
[Replaceable, Throws] readonly attribute BarProp menubar;
[Replaceable, Throws] readonly attribute BarProp personalbar;
[Replaceable, Throws] readonly attribute BarProp scrollbars;
[Replaceable, Throws] readonly attribute BarProp statusbar;
[Replaceable, Throws] readonly attribute BarProp toolbar;
[Throws] attribute DOMString status;
[Throws] void close();
[Throws] readonly attribute boolean closed;
[Throws] void stop();
[Throws] void focus();
[Throws] void blur();
// other browsing contexts
[Replaceable, Throws] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
[Unforgeable, Throws] readonly attribute WindowProxy top;
[Throws] attribute WindowProxy? opener;
//[Throws] readonly attribute WindowProxy parent;
[Replaceable, Throws] readonly attribute WindowProxy? parent;
[Throws] readonly attribute Element? frameElement;
//[Throws] WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false);
[Throws] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", optional DOMString features = "");
// We think the indexed getter is a bug in the spec, it actually needs to live
// on the WindowProxy
//getter WindowProxy (unsigned long index);
//getter object (DOMString name);
// the user agent
[Throws] readonly attribute Navigator navigator;
//(Not implemented)readonly attribute External external;
[Throws] readonly attribute ApplicationCache applicationCache;
// user prompts
[Throws] void alert(optional DOMString message = "");
[Throws] boolean confirm(optional DOMString message = "");
[Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
[Throws] void print();
//[Throws] any showModalDialog(DOMString url, optional any argument);
[Throws] any showModalDialog(DOMString url, optional any argument, optional DOMString options = "");
[Throws] void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
// also has obsolete members
};
Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
interface WindowTimers {
[Throws] long setTimeout(Function handler, optional long timeout = 0, any... arguments);
[Throws] long setTimeout(DOMString handler, optional long timeout = 0);
[Throws] void clearTimeout(long handle);
[Throws] long setInterval(Function handler, optional long timeout, any... arguments);
[Throws] long setInterval(DOMString handler, optional long timeout);
[Throws] void clearInterval(long handle);
};
Window implements WindowTimers;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
interface WindowBase64 {
[Throws] DOMString btoa(DOMString btoa);
[Throws] DOMString atob(DOMString atob);
};
Window implements WindowBase64;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
interface WindowSessionStorage {
//[Throws] readonly attribute Storage sessionStorage;
[Throws] readonly attribute Storage? sessionStorage;
};
Window implements WindowSessionStorage;
// http://www.whatwg.org/specs/web-apps/current-work/
[NoInterfaceObject]
interface WindowLocalStorage {
[Throws] readonly attribute Storage? localStorage;
};
Window implements WindowLocalStorage;
// http://www.whatwg.org/specs/web-apps/current-work/
partial interface Window {
void captureEvents(long dummy);
void releaseEvents(long dummy);
};
// https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
partial interface Window {
//[Throws] Selection getSelection();
[Throws] Selection? getSelection();
};
// https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
Window implements IDBEnvironment;
// http://dev.w3.org/csswg/cssom/
partial interface Window {
//[NewObject, Throws] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt = "");
[NewObject, Throws] CSSStyleDeclaration? getComputedStyle(Element elt, optional DOMString pseudoElt = "");
};
// http://dev.w3.org/csswg/cssom-view/
enum ScrollBehavior { "auto", "instant", "smooth" };
dictionary ScrollOptions {
ScrollBehavior behavior = "auto";
};
partial interface Window {
//[Throws] MediaQueryList matchMedia(DOMString query);
[Throws] MediaQueryList? matchMedia(DOMString query);
//[SameObject]
[Throws] readonly attribute Screen screen;
// browsing context
//[Throws] void moveTo(double x, double y);
//[Throws] void moveBy(double x, double y);
//[Throws] void resizeTo(double x, double y);
//[Throws] void resizeBy(double x, double y);
[Throws] void moveTo(long x, long y);
[Throws] void moveBy(long x, long y);
[Throws] void resizeTo(long x, long y);
[Throws] void resizeBy(long x, long y);
// viewport
//[Throws] readonly attribute double innerWidth;
//[Throws] readonly attribute double innerHeight;
[Throws] attribute long innerWidth;
[Throws] attribute long innerHeight;
// viewport scrolling
//[Throws] readonly attribute double scrollX;
//[Throws] readonly attribute double pageXOffset;
//[Throws] readonly attribute double scrollY;
//[Throws] readonly attribute double pageYOffset;
//void scroll(double x, double y, optional ScrollOptions options);
//void scrollTo(double x, double y, optional ScrollOptions options);
//void scrollBy(double x, double y, optional ScrollOptions options);
[Replaceable, Throws] readonly attribute long scrollX;
[Throws] readonly attribute long pageXOffset;
[Replaceable, Throws] readonly attribute long scrollY;
[Throws] readonly attribute long pageYOffset;
void scroll(long x, long y);
void scrollTo(long x, long y);
void scrollBy(long x, long y);
// client
//[Throws] readonly attribute double screenX;
//[Throws] readonly attribute double screenY;
//[Throws] readonly attribute double outerWidth;
//[Throws] readonly attribute double outerHeight;
[Throws] attribute long screenX;
[Throws] attribute long screenY;
[Throws] attribute long outerWidth;
[Throws] attribute long outerHeight;
};
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
partial interface Window {
[Throws] long requestAnimationFrame(FrameRequestCallback callback);
[Throws] void cancelAnimationFrame(long handle);
};
callback FrameRequestCallback = void (DOMHighResTimeStamp time);
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
partial interface Window {
[Replaceable, Throws] readonly attribute Performance? performance;
};
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html
partial interface Window {
//[Throws] readonly attribute Crypto crypto;
[Throws] readonly attribute nsIDOMCrypto crypto;
};
#ifdef MOZ_WEBSPEECH
// http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
[NoInterfaceObject]
interface SpeechSynthesisGetter {
[Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis;
};
Window implements SpeechSynthesisGetter;
#endif
// Mozilla-specific stuff
partial interface Window {
//[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
[NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
[Throws] long mozRequestAnimationFrame(MozFrameRequestCallback aCallback);
/**
* Cancel a refresh callback.
*/
[Throws] void mozCancelAnimationFrame(long aHandle);
// Backwards-compat shim for now to make Google maps work
[Throws] void mozCancelRequestAnimationFrame(long aHandle);
/**
* The current animation start time in milliseconds since the epoch.
*/
[Throws] readonly attribute long long mozAnimationStartTime;
// Mozilla extensions
/**
* Method for scrolling this window by a number of lines.
*/
void scrollByLines(long numLines);
/**
* Method for scrolling this window by a number of pages.
*/
void scrollByPages(long numPages);
/**
* Method for sizing this window to the content in the window.
*/
[Throws] void sizeToContent();
readonly attribute Pkcs11? pkcs11;
// XXX Shouldn't this be in nsIDOMChromeWindow?
[Replaceable, Throws] readonly attribute MozControllers controllers;
[Throws] readonly attribute float mozInnerScreenX;
[Throws] readonly attribute float mozInnerScreenY;
[Throws] readonly attribute float devicePixelRatio;
/* The maximum offset that the window can be scrolled to
(i.e., the document width/height minus the scrollport width/height) */
[Replaceable, Throws] readonly attribute long scrollMaxX;
[Replaceable, Throws] readonly attribute long scrollMaxY;
[Throws] attribute boolean fullScreen;
[Throws] void back();
[Throws] void forward();
[Throws] void home();
// XXX Should this be in nsIDOMChromeWindow?
void updateCommands(DOMString action);
/* Find in page.
* @param str: the search pattern
* @param caseSensitive: is the search caseSensitive
* @param backwards: should we search backwards
* @param wrapAround: should we wrap the search
* @param wholeWord: should we search only for whole words
* @param searchInFrames: should we search through all frames
* @param showDialog: should we show the Find dialog
*/
[Throws] boolean find(optional DOMString str = "",
optional boolean caseSensitive = false,
optional boolean backwards = false,
optional boolean wrapAround = false,
optional boolean wholeWord = false,
optional boolean searchInFrames = false,
optional boolean showDialog = false);
/**
* Returns the number of times this document for this window has
* been painted to the screen.
*/
[Throws] readonly attribute unsigned long long mozPaintCount;
attribute EventHandler ondevicemotion;
attribute EventHandler ondeviceorientation;
attribute EventHandler ondeviceproximity;
attribute EventHandler onuserproximity;
attribute EventHandler ondevicelight;
#ifdef MOZ_B2G
attribute EventHandler onmoztimechange;
attribute EventHandler onmoznetworkupload;
attribute EventHandler onmoznetworkdownload;
#endif
void dump(DOMString str);
/**
* This method is here for backwards compatibility with 4.x only,
* its implementation is a no-op
*/
void setResizable(boolean resizable);
/**
* This is the scriptable version of
* nsIDOMWindow::openDialog() that takes 3 optional
* arguments, plus any additional arguments are passed on as
* arguments on the dialog's window object (window.arguments).
*/
[Throws] WindowProxy? openDialog(optional DOMString url = "",
optional DOMString name = "",
optional DOMString options = "",
any... extraArguments);
[Replaceable, Throws] readonly attribute object content;
};
Window implements TouchEventHandlers;
Window implements OnErrorEventHandlerForWindow;
//Window implements OnErrorEventHandlerForWindow;

View File

@ -13,7 +13,6 @@ GENERATED_WEBIDL_FILES = [
PREPROCESSED_WEBIDL_FILES = [
'Crypto.webidl',
'Navigator.webidl',
'Window.webidl',
]
WEBIDL_FILES = [
@ -182,7 +181,6 @@ WEBIDL_FILES = [
'HTMLVideoElement.webidl',
'IDBCursor.webidl',
'IDBDatabase.webidl',
'IDBEnvironment.webidl',
'IDBFactory.webidl',
'IDBFileHandle.webidl',
'IDBIndex.webidl',
@ -413,6 +411,7 @@ WEBIDL_FILES = [
'WebSocket.webidl',
'WheelEvent.webidl',
'WifiOptions.webidl',
'Window.webidl',
'WorkerLocation.webidl',
'WorkerMessagePort.webidl',
'WorkerNavigator.webidl',

View File

@ -66,9 +66,9 @@ MessagePort::PrefEnabled()
}
void
MessagePort::PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)
MessagePort::PostMessage(JSContext* aCx, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)
{
AssertIsOnMainThread();

View File

@ -34,9 +34,9 @@ public:
PrefEnabled();
void
PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);
PostMessage(JSContext* aCx, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);
void
Start();

View File

@ -125,7 +125,7 @@ WorkerMessagePort::_finalize(JSFreeOp* aFop)
}
void
WorkerMessagePort::PostMessageMoz(
WorkerMessagePort::PostMessage(
JSContext* /* aCx */, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv)

View File

@ -39,7 +39,7 @@ public:
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
void
PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
PostMessage(JSContext* aCx, JS::HandleValue aMessage,
const Optional<Sequence<JS::Value>>& aTransferable,
ErrorResult& aRv);

View File

@ -17,7 +17,7 @@ if (typeof setTimeout != 'undefined')
expect = 'error';
try
{
setTimeout();
setTimeout(2);
}
catch(ex)
{

View File

@ -19,7 +19,7 @@ if (typeof window == 'undefined')
}
else
{
expect = /TypeError: Not enough arguments to Window.showModalDialog./;
expect = /NS_ERROR_XPC_NOT_ENOUGH_ARGS/;
window._onerror = window.onerror;
window.onerror = (function (msg, page, line) {

View File

@ -28,6 +28,23 @@ members = [
# (And nsIDOMModalContentWindow.returnValue is an attribute of type
# nsIVariant, which qsgen.py can't handle.)
#
'nsIDOMWindow.name',
'nsIDOMWindow.parent',
'nsIDOMWindow.top',
'nsIDOMWindow.self',
# Several window properties are magically resolved, including
# location, _content, navigator, document, and window itself.
# These do not need quick stubs.
#'nsIDOMWindow.document',
'nsIDOMWindow.getSelection',
'nsIDOMWindow.scrollByLines',
'nsIDOMWindow.getComputedStyle',
'nsIDOMWindow.sessionStorage',
'nsIDOMWindow.localStorage',
'nsIDOMWindow.onmouseenter',
'nsIDOMWindow.onmouseleave',
'nsIDOMWindowPerformance.performance',
'nsIDOMJSWindow.dump',
# nsLocationSH has ~ALLOW_PROP_MODS_TO_PROTOTYPE, so don't try.
#'nsIDOMLocation.hostname',
#'nsIDOMLocation.href',
@ -88,12 +105,14 @@ irregularFilenames = {
'nsIDOMBlob': 'nsIDOMFile',
'nsIIndexedDatabaseUsageCallback': 'nsIIndexedDatabaseManager',
'nsITelephoneCallback': 'nsITelephone',
'nsIDOMWindowPerformance': 'nsIDOMWindow',
}
customIncludes = [
'nsPerformance.h',
'nsPIDOMWindow.h',
'mozilla/dom/BindingUtils.h',
'mozilla/dom/EventTargetBinding.h',
'mozilla/dom/WindowBinding.h',
]
nsIDOMStorage_Clear_customMethodCallCode = """
@ -106,11 +125,31 @@ customMethodCalls = {
'nsIDOMStorage_Clear': {
'code': nsIDOMStorage_Clear_customMethodCallCode
},
'nsIDOMWindow_GetOnmouseenter' : {
'thisType' : 'nsIDOMWindow',
'unwrapThisFailureFatal' : False
},
'nsIDOMWindow_SetOnmouseenter' : {
'thisType' : 'nsIDOMWindow',
'unwrapThisFailureFatal' : False
},
'nsIDOMWindow_GetOnmouseleave' : {
'thisType' : 'nsIDOMWindow',
'unwrapThisFailureFatal' : False
},
'nsIDOMWindow_SetOnmouseleave' : {
'thisType' : 'nsIDOMWindow',
'unwrapThisFailureFatal' : False
},
'nsIDOMWindowPerformance_GetPerformance' : {
'thisType': 'nsPIDOMWindow',
'code' : ' nsPerformance* result = self->GetPerformance();\n',
'canFail': False,
},
}
newBindingProperties = {
# Once the last entry here goes away, we can make the sNativePropertyHooks
# of bindings static.
'nsIDOMEventTarget': 'mozilla::dom::EventTargetBinding::sNativePropertyHooks->mNativeProperties.regular',
'nsIDOMWindow': 'mozilla::dom::WindowBinding::sNativePropertyHooks->mNativeProperties.regular',
}

View File

@ -72,6 +72,5 @@ xpidl_to_native = [
['nsIDOMDocument', 'nsIDocument', 'nsIDocument'],
['nsIDOMElement', 'mozilla::dom::Element', 'mozilla::dom::Element'],
['nsIDOMCSSStyleSheet', 'nsCSSStyleSheet', 'nsIStyleSheet'],
['nsIDOMWindow', 'nsGlobalWindow', 'nsIDOMEventTarget']
]

View File

@ -27,7 +27,6 @@
#include "mozilla/dom/SVGElementBinding.h"
#include "mozilla/dom/HTMLDocumentBinding.h"
#include "XPCQuickStubs.h"
#include "nsGlobalWindow.h"
template<class T>
struct ProtoIDAndDepth

View File

@ -1374,7 +1374,7 @@ Base64Encode(JSContext *cx, JS::Value val, JS::Value *out)
JS::RootedValue root(cx, val);
xpc_qsACString encodedString(cx, root, &root, false,
xpc_qsACString::eStringify,
xpc_qsACString::eNull,
xpc_qsACString::eStringify);
if (!encodedString.IsValid())
return false;
@ -1401,8 +1401,8 @@ Base64Decode(JSContext *cx, JS::Value val, JS::Value *out)
JS::RootedValue root(cx, val);
xpc_qsACString encodedString(cx, root, &root, false,
xpc_qsACString::eStringify,
xpc_qsACString::eStringify);
xpc_qsACString::eNull,
xpc_qsACString::eNull);
if (!encodedString.IsValid())
return false;

View File

@ -1873,8 +1873,9 @@ nsPresContext::HandleMediaFeatureValuesChangedEvent()
}
}
already_AddRefed<nsIDOMMediaQueryList>
nsPresContext::MatchMedia(const nsAString& aMediaQueryList)
void
nsPresContext::MatchMedia(const nsAString& aMediaQueryList,
nsIDOMMediaQueryList** aResult)
{
nsRefPtr<nsDOMMediaQueryList> result =
new nsDOMMediaQueryList(this, aMediaQueryList);
@ -1882,7 +1883,7 @@ nsPresContext::MatchMedia(const nsAString& aMediaQueryList)
// Insert the new item at the end of the linked list.
PR_INSERT_BEFORE(result, &mDOMMediaQueryLists);
return result.forget();
result.forget(aResult);
}
nsCompatibility

View File

@ -265,8 +265,8 @@ public:
/**
* Support for window.matchMedia()
*/
already_AddRefed<nsIDOMMediaQueryList>
MatchMedia(const nsAString& aMediaQueryList);
void MatchMedia(const nsAString& aMediaQueryList,
nsIDOMMediaQueryList** aResult);
/**
* Access compatibility mode for this context. This is the same as

View File

@ -36,12 +36,12 @@
#include "PeerConnectionCtx.h"
#include "PeerConnectionImpl.h"
#include "PeerConnectionMedia.h"
#include "nsPIDOMWindow.h"
#include "nsDOMDataChannelDeclarations.h"
#include "dtlsidentity.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsPerformance.h"
#include "nsGlobalWindow.h"
#include "nsDOMDataChannel.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
@ -623,7 +623,7 @@ PeerConnectionImpl::ConvertRTCConfiguration(const RTCConfiguration& aSrc,
NS_IMETHODIMP
PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow* aWindow,
nsIDOMWindow* aWindow,
const IceConfiguration* aConfiguration,
const RTCConfiguration* aRTCConfiguration,
nsISupports* aThread)
@ -652,7 +652,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
// Currently no standalone unit tests for DataChannel,
// which is the user of mWindow
MOZ_ASSERT(aWindow);
mWindow = aWindow;
mWindow = do_QueryInterface(aWindow);
NS_ENSURE_STATE(mWindow);
#endif

View File

@ -254,7 +254,7 @@ public:
// Initialize PeerConnection from an IceConfiguration object (unit-tests)
nsresult Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow* aWindow,
nsIDOMWindow* aWindow,
const IceConfiguration& aConfiguration,
nsIThread* aThread) {
return Initialize(aObserver, aWindow, &aConfiguration, nullptr, aThread);
@ -262,12 +262,12 @@ public:
// Initialize PeerConnection from an RTCConfiguration object (JS entrypoint)
void Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow& aWindow,
nsIDOMWindow* aWindow,
const RTCConfiguration& aConfiguration,
nsISupports* aThread,
ErrorResult &rv)
{
nsresult r = Initialize(aObserver, &aWindow, nullptr, &aConfiguration, aThread);
nsresult r = Initialize(aObserver, aWindow, nullptr, &aConfiguration, aThread);
if (NS_FAILED(r)) {
rv.Throw(r);
}
@ -447,7 +447,7 @@ private:
PeerConnectionImpl(const PeerConnectionImpl&rhs);
PeerConnectionImpl& operator=(PeerConnectionImpl);
NS_IMETHODIMP Initialize(PeerConnectionObserver& aObserver,
nsGlobalWindow* aWindow,
nsIDOMWindow* aWindow,
const IceConfiguration* aConfiguration,
const RTCConfiguration* aRTCConfiguration,
nsISupports* aThread);

View File

@ -1962,10 +1962,10 @@ void nsXULWindow::SetContentScrollbarVisibility(bool aVisible)
{
nsCOMPtr<nsPIDOMWindow> contentWin(do_GetInterface(mPrimaryContentShell));
if (contentWin) {
mozilla::ErrorResult rv;
nsRefPtr<nsGlobalWindow> window = static_cast<nsGlobalWindow*>(contentWin.get());
nsRefPtr<mozilla::dom::BarProp> scrollbars = window->GetScrollbars(rv);
nsRefPtr<mozilla::dom::BarProp> scrollbars = window->GetScrollbars();
if (scrollbars) {
mozilla::ErrorResult rv;
scrollbars->SetVisible(aVisible, rv);
}
}