зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1008236, bug 1010344, bug 1004458, bug 1008719) for mochitest crashes on a CLOSED TREE.
Backed out changeset 28ecab881472 (bug 1008719) Backed out changeset 7eebcecb7e26 (bug 1004458) Backed out changeset 17ea7f2276ac (bug 1010344) Backed out changeset 184ead7f6e37 (bug 1008236)
This commit is contained in:
Родитель
fed316d6b8
Коммит
c53951f788
|
@ -94,7 +94,7 @@ exports.testSettingActiveWindowDoesNotIgnorePrivateWindow = function(assert, don
|
|||
// PWPB case
|
||||
if (isWindowPBSupported) {
|
||||
assert.ok(isPrivate(window), "window is private");
|
||||
assert.notStrictEqual(winUtils.activeBrowserWindow, browserWindow);
|
||||
assert.notDeepEqual(winUtils.activeBrowserWindow, browserWindow);
|
||||
}
|
||||
// Global case
|
||||
else {
|
||||
|
@ -131,19 +131,19 @@ exports.testSettingActiveWindowDoesNotIgnorePrivateWindow = function(assert, don
|
|||
continueAfterFocus(winUtils.activeWindow = window);
|
||||
},
|
||||
function() {
|
||||
assert.strictEqual(winUtils.activeBrowserWindow, window,
|
||||
"Correct active browser window [3]");
|
||||
assert.strictEqual(winUtils.activeWindow, window,
|
||||
"Correct active window [3]");
|
||||
assert.deepEqual(winUtils.activeBrowserWindow, window,
|
||||
"Correct active browser window [3]");
|
||||
assert.deepEqual(winUtils.activeWindow, window,
|
||||
"Correct active window [3]");
|
||||
|
||||
// just to get back to original state
|
||||
continueAfterFocus(winUtils.activeWindow = browserWindow);
|
||||
},
|
||||
function() {
|
||||
assert.strictEqual(winUtils.activeBrowserWindow, browserWindow,
|
||||
"Correct active browser window when pb mode is supported [4]");
|
||||
assert.strictEqual(winUtils.activeWindow, browserWindow,
|
||||
"Correct active window when pb mode is supported [4]");
|
||||
assert.deepEqual(winUtils.activeBrowserWindow, browserWindow,
|
||||
"Correct active browser window when pb mode is supported [4]");
|
||||
assert.deepEqual(winUtils.activeWindow, browserWindow,
|
||||
"Correct active window when pb mode is supported [4]");
|
||||
|
||||
close(window).then(done).then(null, assert.fail);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ exports.testSettingActiveWindowDoesNotIgnorePrivateWindow = function(assert, don
|
|||
// PWPB case
|
||||
if (isWindowPBSupported) {
|
||||
assert.ok(isPrivate(window), "window is private");
|
||||
assert.notStrictEqual(windowUtils.activeBrowserWindow, browserWindow);
|
||||
assert.notDeepEqual(windowUtils.activeBrowserWindow, browserWindow);
|
||||
}
|
||||
// Global case
|
||||
else {
|
||||
|
@ -127,18 +127,18 @@ exports.testSettingActiveWindowDoesNotIgnorePrivateWindow = function(assert, don
|
|||
// test setting a private window
|
||||
return onFocus(windowUtils.activeWindow = window);
|
||||
}).then(function() {
|
||||
assert.strictEqual(windowUtils.activeBrowserWindow, window,
|
||||
"Correct active browser window [3]");
|
||||
assert.strictEqual(windowUtils.activeWindow, window,
|
||||
"Correct active window [3]");
|
||||
assert.deepEqual(windowUtils.activeBrowserWindow, window,
|
||||
"Correct active browser window [3]");
|
||||
assert.deepEqual(windowUtils.activeWindow, window,
|
||||
"Correct active window [3]");
|
||||
|
||||
// just to get back to original state
|
||||
return onFocus(windowUtils.activeWindow = browserWindow);
|
||||
}).then(_ => {
|
||||
assert.strictEqual(windowUtils.activeBrowserWindow, browserWindow,
|
||||
"Correct active browser window when pb mode is supported [4]");
|
||||
assert.strictEqual(windowUtils.activeWindow, browserWindow,
|
||||
"Correct active window when pb mode is supported [4]");
|
||||
assert.deepEqual(windowUtils.activeBrowserWindow, browserWindow,
|
||||
"Correct active browser window when pb mode is supported [4]");
|
||||
assert.deepEqual(windowUtils.activeWindow, browserWindow,
|
||||
"Correct active window when pb mode is supported [4]");
|
||||
|
||||
return close(window);
|
||||
})
|
||||
|
|
|
@ -8430,7 +8430,7 @@ nsGlobalWindow::ReallyCloseWindow()
|
|||
void
|
||||
nsGlobalWindow::EnterModalState()
|
||||
{
|
||||
MOZ_ASSERT(IsOuterWindow(), "Modal state is maintained on outer windows");
|
||||
FORWARD_TO_OUTER_VOID(EnterModalState, ());
|
||||
|
||||
// GetScriptableTop, not GetTop, so that EnterModalState works properly with
|
||||
// <iframe mozbrowser>.
|
||||
|
@ -8563,7 +8563,7 @@ private:
|
|||
void
|
||||
nsGlobalWindow::LeaveModalState()
|
||||
{
|
||||
MOZ_ASSERT(IsOuterWindow(), "Modal state is maintained on outer windows");
|
||||
FORWARD_TO_OUTER_VOID(LeaveModalState, ());
|
||||
|
||||
nsGlobalWindow* topWin = GetScriptableTop();
|
||||
|
||||
|
|
|
@ -2258,13 +2258,7 @@ GenericBindingGetter(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||
|
||||
MOZ_ASSERT(info->type() == JSJitInfo::Getter);
|
||||
JSJitGetterOp getter = info->getter;
|
||||
bool ok = getter(cx, obj, self, JSJitGetterCallArgs(args));
|
||||
#ifdef DEBUG
|
||||
if (ok) {
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
return getter(cx, obj, self, JSJitGetterCallArgs(args));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2297,10 +2291,7 @@ GenericBindingSetter(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||
if (!setter(cx, obj, self, JSJitSetterCallArgs(args))) {
|
||||
return false;
|
||||
}
|
||||
args.rval().setUndefined();
|
||||
#ifdef DEBUG
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
#endif
|
||||
args.rval().set(JSVAL_VOID);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2328,13 +2319,7 @@ GenericBindingMethod(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||
}
|
||||
MOZ_ASSERT(info->type() == JSJitInfo::Method);
|
||||
JSJitMethodOp method = info->method;
|
||||
bool ok = method(cx, obj, self, JSJitMethodCallArgs(args));
|
||||
#ifdef DEBUG
|
||||
if (ok) {
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
return method(cx, obj, self, JSJitMethodCallArgs(args));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2372,14 +2357,9 @@ GenericPromiseReturningBindingMethod(JSContext* cx, unsigned argc, JS::Value* vp
|
|||
JSJitMethodOp method = info->method;
|
||||
bool ok = method(cx, obj, self, JSJitMethodCallArgs(args));
|
||||
if (ok) {
|
||||
#ifdef DEBUG
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
// Promise-returning methods always return objects
|
||||
MOZ_ASSERT(info->returnType() == JSVAL_TYPE_OBJECT);
|
||||
return ConvertExceptionToPromise(cx, xpc::XrayAwareCalleeGlobal(callee),
|
||||
args.rval());
|
||||
}
|
||||
|
@ -2449,44 +2429,5 @@ CreateGlobalOptions<nsGlobalWindow>::PostCreateGlobal(JSContext* aCx,
|
|||
return XPCWrappedNativeScope::GetNewOrUsed(aCx, aGlobal);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
AssertReturnTypeMatchesJitinfo(const JSJitInfo* aJitInfo,
|
||||
JS::Handle<JS::Value> aValue)
|
||||
{
|
||||
switch (aJitInfo->returnType()) {
|
||||
case JSVAL_TYPE_UNKNOWN:
|
||||
// Any value is good.
|
||||
break;
|
||||
case JSVAL_TYPE_DOUBLE:
|
||||
// The value could actually be an int32 value as well.
|
||||
MOZ_ASSERT(aValue.isNumber());
|
||||
break;
|
||||
case JSVAL_TYPE_INT32:
|
||||
MOZ_ASSERT(aValue.isInt32());
|
||||
break;
|
||||
case JSVAL_TYPE_UNDEFINED:
|
||||
MOZ_ASSERT(aValue.isUndefined());
|
||||
break;
|
||||
case JSVAL_TYPE_BOOLEAN:
|
||||
MOZ_ASSERT(aValue.isBoolean());
|
||||
break;
|
||||
case JSVAL_TYPE_STRING:
|
||||
MOZ_ASSERT(aValue.isString());
|
||||
break;
|
||||
case JSVAL_TYPE_NULL:
|
||||
MOZ_ASSERT(aValue.isNull());
|
||||
break;
|
||||
case JSVAL_TYPE_OBJECT:
|
||||
MOZ_ASSERT(aValue.isObject());
|
||||
break;
|
||||
default:
|
||||
// Someone messed up their jitinfo type.
|
||||
MOZ_ASSERT(false, "Unexpected JSValueType stored in jitinfo");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -2744,12 +2744,6 @@ GlobalPropertiesAreOwn()
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
AssertReturnTypeMatchesJitinfo(const JSJitInfo* aJitinfo,
|
||||
JS::Handle<JS::Value> aValue);
|
||||
#endif
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ def indent(s, indentLevel=2):
|
|||
Indent C++ code.
|
||||
|
||||
Weird secret feature: this doesn't indent lines that start with # (such as
|
||||
#include lines or #ifdef/#endif).
|
||||
#include lines).
|
||||
"""
|
||||
if s == "":
|
||||
return s
|
||||
|
@ -6683,13 +6683,7 @@ class CGGenericMethod(CGAbstractBindingMethod):
|
|||
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
|
||||
MOZ_ASSERT(info->type() == JSJitInfo::Method);
|
||||
JSJitMethodOp method = info->method;
|
||||
bool ok = method(cx, obj, self, JSJitMethodCallArgs(args));
|
||||
#ifdef DEBUG
|
||||
if (ok) {
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
return method(cx, obj, self, JSJitMethodCallArgs(args));
|
||||
""")))
|
||||
|
||||
|
||||
|
@ -6987,13 +6981,7 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
|
||||
MOZ_ASSERT(info->type() == JSJitInfo::Getter);
|
||||
JSJitGetterOp getter = info->getter;
|
||||
bool ok = getter(cx, obj, self, JSJitGetterCallArgs(args));
|
||||
#ifdef DEBUG
|
||||
if (ok) {
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
return getter(cx, obj, self, JSJitGetterCallArgs(args));
|
||||
""")))
|
||||
|
||||
|
||||
|
@ -7128,9 +7116,6 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
return false;
|
||||
}
|
||||
args.rval().set(JSVAL_VOID);
|
||||
#ifdef DEBUG
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
#endif
|
||||
return true;
|
||||
""",
|
||||
name=self.descriptor.interface.identifier.name)))
|
||||
|
|
|
@ -19,19 +19,23 @@ using namespace mozilla::dom;
|
|||
****************** nsAutoWindowStateHelper *********************
|
||||
****************************************************************/
|
||||
|
||||
nsAutoWindowStateHelper::nsAutoWindowStateHelper(nsPIDOMWindow *aWindow)
|
||||
nsAutoWindowStateHelper::nsAutoWindowStateHelper(nsIDOMWindow *aWindow)
|
||||
: mWindow(aWindow),
|
||||
mDefaultEnabled(DispatchEventToChrome("DOMWillOpenModalDialog"))
|
||||
{
|
||||
if (mWindow) {
|
||||
mWindow->EnterModalState();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
|
||||
|
||||
if (window) {
|
||||
window->EnterModalState();
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoWindowStateHelper::~nsAutoWindowStateHelper()
|
||||
{
|
||||
if (mWindow) {
|
||||
mWindow->LeaveModalState();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
|
||||
|
||||
if (window) {
|
||||
window->LeaveModalState();
|
||||
}
|
||||
|
||||
if (mDefaultEnabled) {
|
||||
|
@ -42,15 +46,14 @@ nsAutoWindowStateHelper::~nsAutoWindowStateHelper()
|
|||
bool
|
||||
nsAutoWindowStateHelper::DispatchEventToChrome(const char *aEventName)
|
||||
{
|
||||
// XXXbz should we skip dispatching the event if the inner changed?
|
||||
// That is, should we store both the inner and the outer?
|
||||
if (!mWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mWindow);
|
||||
if (!window || (window->IsInnerWindow() && !window->IsCurrentInnerWindow())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// The functions of nsContentUtils do not provide the required behavior,
|
||||
// so the following is inlined.
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
nsIDocument* doc = window->GetExtantDoc();
|
||||
if (!doc) {
|
||||
return true;
|
||||
}
|
||||
|
@ -64,7 +67,7 @@ nsAutoWindowStateHelper::DispatchEventToChrome(const char *aEventName)
|
|||
event->SetTrusted(true);
|
||||
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
|
||||
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(mWindow);
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(window);
|
||||
bool defaultActionEnabled;
|
||||
target->DispatchEvent(event, &defaultActionEnabled);
|
||||
return defaultActionEnabled;
|
||||
|
|
|
@ -7,19 +7,18 @@
|
|||
#define __nsAutoWindowStateHelper_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
/**
|
||||
* Helper class for dealing with notifications around opening modal
|
||||
* windows.
|
||||
*/
|
||||
|
||||
class nsPIDOMWindow;
|
||||
class nsIDOMWindow;
|
||||
|
||||
class nsAutoWindowStateHelper
|
||||
{
|
||||
public:
|
||||
nsAutoWindowStateHelper(nsPIDOMWindow *aWindow);
|
||||
nsAutoWindowStateHelper(nsIDOMWindow *aWindow);
|
||||
~nsAutoWindowStateHelper();
|
||||
|
||||
bool DefaultEnabled()
|
||||
|
@ -30,7 +29,7 @@ public:
|
|||
protected:
|
||||
bool DispatchEventToChrome(const char *aEventName);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsIDOMWindow *mWindow;
|
||||
bool mDefaultEnabled;
|
||||
};
|
||||
|
||||
|
|
|
@ -955,10 +955,7 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
|||
// we're opening a modal content window (the helper classes are
|
||||
// no-ops if given no window), for chrome dialogs we don't want to
|
||||
// do any of that (it's done elsewhere for us).
|
||||
// Make sure we maintain the state on an outer window, because
|
||||
// that's where it lives; inner windows assert if you try to
|
||||
// maintain the state on them.
|
||||
nsAutoWindowStateHelper windowStateHelper(parentWindow->GetOuterWindow());
|
||||
nsAutoWindowStateHelper windowStateHelper(aParent);
|
||||
|
||||
if (!windowStateHelper.DefaultEnabled()) {
|
||||
// Default to cancel not opening the modal window.
|
||||
|
|
|
@ -81,16 +81,13 @@ void nsStyleUtil::AppendEscapedCSSString(const nsAString& aString,
|
|||
nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
|
||||
{
|
||||
// The relevant parts of the CSS grammar are:
|
||||
// ident ([-]?{nmstart}|[-][-]){nmchar}*
|
||||
// ident [-]?{nmstart}{nmchar}*
|
||||
// nmstart [_a-z]|{nonascii}|{escape}
|
||||
// nmchar [_a-z0-9-]|{nonascii}|{escape}
|
||||
// nonascii [^\0-\177]
|
||||
// escape {unicode}|\\[^\n\r\f0-9a-f]
|
||||
// unicode \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
|
||||
// from http://www.w3.org/TR/CSS21/syndata.html#tokenization but
|
||||
// modified for idents by
|
||||
// http://dev.w3.org/csswg/cssom/#serialize-an-identifier and
|
||||
// http://dev.w3.org/csswg/css-syntax/#would-start-an-identifier
|
||||
// from http://www.w3.org/TR/CSS21/syndata.html#tokenization
|
||||
|
||||
const char16_t* in = aIdent.BeginReading();
|
||||
const char16_t* const end = aIdent.EndReading();
|
||||
|
@ -100,13 +97,7 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
|
|||
|
||||
// A leading dash does not need to be escaped as long as it is not the
|
||||
// *only* character in the identifier.
|
||||
if (*in == '-') {
|
||||
if (in + 1 == end) {
|
||||
aReturn.Append(char16_t('\\'));
|
||||
aReturn.Append(char16_t('-'));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (in + 1 != end && *in == '-') {
|
||||
aReturn.Append(char16_t('-'));
|
||||
++in;
|
||||
}
|
||||
|
@ -114,8 +105,16 @@ nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent, nsAString& aReturn)
|
|||
// Escape a digit at the start (including after a dash),
|
||||
// numerically. If we didn't escape it numerically, it would get
|
||||
// interpreted as a numeric escape for the wrong character.
|
||||
if (in != end && ('0' <= *in && *in <= '9')) {
|
||||
aReturn.AppendPrintf("\\%hX ", *in);
|
||||
// A second dash immediately after a leading dash must also be
|
||||
// escaped, but this may be done symbolically.
|
||||
if (in != end && (*in == '-' ||
|
||||
('0' <= *in && *in <= '9'))) {
|
||||
if (*in == '-') {
|
||||
aReturn.Append(char16_t('\\'));
|
||||
aReturn.Append(char16_t('-'));
|
||||
} else {
|
||||
aReturn.AppendPrintf("\\%hX ", *in);
|
||||
}
|
||||
++in;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ is(CSS.escape('-7a'), '-\\37 a', "escapingFailed Char: -7a");
|
|||
is(CSS.escape('-8a'), '-\\38 a', "escapingFailed Char: -8a");
|
||||
is(CSS.escape('-9a'), '-\\39 a', "escapingFailed Char: -9a");
|
||||
|
||||
is(CSS.escape('--a'), '--a', 'Should not need to escape leading "--"');
|
||||
is(CSS.escape('--a'), '-\\-a', "escapingFailed Char: --a");
|
||||
|
||||
is(CSS.escape('\x80\x2D\x5F\xA9'), '\\80 \x2D\x5F\xA9', "escapingFailed Char: \\x80\\x2D\\x5F\\xA9");
|
||||
is(CSS.escape('\xA0\xA1\xA2'), '\xA0\xA1\xA2', "escapingFailed Char: \\xA0\\xA1\\xA2");
|
||||
|
|
|
@ -74,7 +74,7 @@ const substitutions = [
|
|||
{ t: "\\37 ", i: "\\37 ", s: "7" },
|
||||
{ t: "\\38 ", i: "\\38 ", s: "8" },
|
||||
{ t: "\\39 ", i: "\\39 ", s: "9" },
|
||||
{ t: "-\\-", i: "--", s: "--" },
|
||||
{ t: "-\\-", i: "-\\-", s: "--" },
|
||||
{ t: "-\\30 ", i: "-\\30 ", s: "-0" },
|
||||
{ t: "-\\31 ", i: "-\\31 ", s: "-1" },
|
||||
{ t: "-\\32 ", i: "-\\32 ", s: "-2" },
|
||||
|
|
Загрузка…
Ссылка в новой задаче