Merge last green changeset from mozilla-inbound to mozilla-central

This commit is contained in:
Marco Bonardo 2011-07-27 12:12:25 +02:00
commit 6575f7da72
96 changed files with 1656 additions and 188 deletions

View File

@ -843,6 +843,7 @@ var BookmarksEventHandler = {
var PlacesMenuDNDHandler = {
_springLoadDelay: 350, // milliseconds
_loadTimer: null,
_closerTimer: null,
/**
* Called when the user enters the <menu> element during a drag.
@ -883,8 +884,9 @@ var PlacesMenuDNDHandler = {
this._loadTimer.cancel();
this._loadTimer = null;
}
let closeTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
closeTimer.initWithCallback(function() {
this._closeTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this._closeTimer.initWithCallback(function() {
this._closeTimer = null;
let node = PlacesControllerDragHelper.currentDropTarget;
let inHierarchy = false;
while (node && !inHierarchy) {

View File

@ -95,6 +95,15 @@
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
#placesToolbar > toolbarbutton:-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorAqua@;
box-shadow: @focusRingShadow@;
}
#placesToolbar > toolbarbutton:-moz-system-metric(mac-graphite-theme):-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
}
#placesToolbar > toolbarbutton:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;

View File

@ -9415,6 +9415,11 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
cat >> $_CONFIG_TMP <<\EOF
/* The c99 defining the limit macros (UINT32_MAX for example), says:
* C++ implementations should define these macros only when __STDC_LIMIT_MACROS
* is defined before <stdint.h> is included. */
#define __STDC_LIMIT_MACROS
#endif /* _MOZILLA_CONFIG_H_ */
EOF

View File

@ -1724,6 +1724,13 @@ public:
* ontouch* event handler DOM attributes.
*/
static void InitializeTouchEventTable();
static nsresult Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String);
static nsresult Atob(const nsAString& aAsciiString,
nsAString& aBinaryData);
private:
static PRBool InitializeEventTable();

View File

@ -81,7 +81,7 @@ interface nsISyncMessageSender : nsIFrameMessageManager
void sendSyncMessage(/*in messageName, in JSON*/);
};
[scriptable, uuid(c56e85b8-6736-4ae2-ae90-66bcef952a82)]
[scriptable, uuid(6f23339f-2b5c-4f22-a03f-bb7ec101f83d)]
interface nsIContentFrameMessageManager : nsISyncMessageSender
{
/**
@ -104,6 +104,12 @@ interface nsIContentFrameMessageManager : nsISyncMessageSender
* process will intentionally crash.
*/
void privateNoteIntentionalCrash();
/**
* Ascii base64 data to binary data and vice versa
*/
DOMString atob(in DOMString aAsciiString);
DOMString btoa(in DOMString aBase64Data);
};
[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)]

View File

@ -634,6 +634,61 @@ nsContentUtils::InitializeTouchEventTable()
}
}
static PRBool
Is8bit(const nsAString& aString)
{
static const PRUnichar EIGHT_BIT = PRUnichar(~0x00FF);
nsAString::const_iterator done_reading;
aString.EndReading(done_reading);
// for each chunk of |aString|...
PRUint32 fragmentLength = 0;
nsAString::const_iterator iter;
for (aString.BeginReading(iter); iter != done_reading;
iter.advance(PRInt32(fragmentLength))) {
fragmentLength = PRUint32(iter.size_forward());
const PRUnichar* c = iter.get();
const PRUnichar* fragmentEnd = c + fragmentLength;
// for each character in this chunk...
while (c < fragmentEnd) {
if (*c++ & EIGHT_BIT) {
return PR_FALSE;
}
}
}
return PR_TRUE;
}
nsresult
nsContentUtils::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
if (!Is8bit(aBinaryData)) {
aAsciiBase64String.Truncate();
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
return nsXPConnect::Base64Encode(aBinaryData, aAsciiBase64String);
}
nsresult
nsContentUtils::Atob(const nsAString& aAsciiBase64String,
nsAString& aBinaryData)
{
if (!Is8bit(aAsciiBase64String)) {
aBinaryData.Truncate();
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
nsresult rv = nsXPConnect::Base64Decode(aAsciiBase64String, aBinaryData);
if (NS_FAILED(rv) && rv == NS_ERROR_INVALID_ARG) {
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
return rv;
}
/**
* Access a cached parser service. Don't addref. We need only one

View File

@ -323,6 +323,20 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::Atob(const nsAString& aAsciiString,
nsAString& aBinaryData)
{
return NS_OK;
}
nsresult
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
const nsAString& aMessage,

View File

@ -188,6 +188,21 @@ nsInProcessTabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
return NS_OK;
}
NS_IMETHODIMP
nsInProcessTabChildGlobal::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
}
NS_IMETHODIMP
nsInProcessTabChildGlobal::Atob(const nsAString& aAsciiString,
nsAString& aBinaryData)
{
return nsContentUtils::Atob(aAsciiString, aBinaryData);
}
NS_IMETHODIMP
nsInProcessTabChildGlobal::PrivateNoteIntentionalCrash()
{

View File

@ -78,6 +78,11 @@ public:
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
}
NS_IMETHOD PrivateNoteIntentionalCrash();
NS_IMETHOD Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String);
NS_IMETHOD Atob(const nsAString& aAsciiString,
nsAString& aBinaryData);
NS_DECL_NSIINPROCESSCONTENTFRAMEMESSAGEMANAGER
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);

View File

@ -42,6 +42,7 @@
#include "mozilla/ReentrantMonitor.h"
#include "nsRect.h"
#include "nsIThreadManager.h"
// This file contains stuff we'd rather put elsewhere, but which is
// dependent on other changes which we don't want to wait for. We plan to
@ -157,4 +158,12 @@ PRBool UsecsToSamples(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutSamples);
// before being used!
void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio);
// The amount of virtual memory reserved for thread stacks.
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)
#define MEDIA_THREAD_STACK_SIZE (128 * 1024)
#else
// All other platforms use their system defaults.
#define MEDIA_THREAD_STACK_SIZE nsIThreadManager::DEFAULT_STACK_SIZE
#endif
#endif

View File

@ -360,7 +360,9 @@ nsIThread *
nsAudioStream::GetThread()
{
if (!mAudioPlaybackThread) {
NS_NewThread(getter_AddRefs(mAudioPlaybackThread));
NS_NewThread(getter_AddRefs(mAudioPlaybackThread),
nsnull,
MEDIA_THREAD_STACK_SIZE);
}
return mAudioPlaybackThread;
}

View File

@ -226,7 +226,9 @@ nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDe
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (gStateMachineCount == 0) {
NS_ASSERTION(!gStateMachineThread, "Should have null state machine thread!");
nsresult res = NS_NewThread(&gStateMachineThread);
nsresult res = NS_NewThread(&gStateMachineThread,
nsnull,
MEDIA_THREAD_STACK_SIZE);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(res), "Can't create media state machine thread");
}
gStateMachineCount++;
@ -1052,7 +1054,9 @@ nsBuiltinDecoderStateMachine::StartDecodeThread()
return NS_OK;
if (!mDecodeThread) {
nsresult rv = NS_NewThread(getter_AddRefs(mDecodeThread));
nsresult rv = NS_NewThread(getter_AddRefs(mDecodeThread),
nsnull,
MEDIA_THREAD_STACK_SIZE);
if (NS_FAILED(rv)) {
mState = DECODER_STATE_SHUTDOWN;
return rv;
@ -1073,7 +1077,9 @@ nsBuiltinDecoderStateMachine::StartAudioThread()
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mStopAudioThread = PR_FALSE;
if (HasAudio() && !mAudioThread) {
nsresult rv = NS_NewThread(getter_AddRefs(mAudioThread));
nsresult rv = NS_NewThread(getter_AddRefs(mAudioThread),
nsnull,
MEDIA_THREAD_STACK_SIZE);
if (NS_FAILED(rv)) {
mState = DECODER_STATE_SHUTDOWN;
return rv;

View File

@ -7169,58 +7169,18 @@ nsGlobalWindow::Find(const nsAString& aStr, PRBool aCaseSensitive,
return rv;
}
static PRBool
Is8bit(const nsAString& aString)
{
static const PRUnichar EIGHT_BIT = PRUnichar(~0x00FF);
nsAString::const_iterator done_reading;
aString.EndReading(done_reading);
// for each chunk of |aString|...
PRUint32 fragmentLength = 0;
nsAString::const_iterator iter;
for (aString.BeginReading(iter); iter != done_reading;
iter.advance(PRInt32(fragmentLength))) {
fragmentLength = PRUint32(iter.size_forward());
const PRUnichar* c = iter.get();
const PRUnichar* fragmentEnd = c + fragmentLength;
// for each character in this chunk...
while (c < fragmentEnd)
if (*c++ & EIGHT_BIT)
return PR_FALSE;
}
return PR_TRUE;
}
NS_IMETHODIMP
nsGlobalWindow::Atob(const nsAString& aAsciiBase64String,
nsAString& aBinaryData)
{
if (!Is8bit(aAsciiBase64String)) {
aBinaryData.Truncate();
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
nsresult rv = nsXPConnect::Base64Decode(aAsciiBase64String, aBinaryData);
if (NS_FAILED(rv) && rv == NS_ERROR_INVALID_ARG) {
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
return rv;
return nsContentUtils::Atob(aAsciiBase64String, aBinaryData);
}
NS_IMETHODIMP
nsGlobalWindow::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
if (!Is8bit(aBinaryData)) {
aAsciiBase64String.Truncate();
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
}
return nsXPConnect::Base64Encode(aBinaryData, aAsciiBase64String);
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
}
//*****************************************************************************

View File

@ -1078,6 +1078,20 @@ TabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
return NS_OK;
}
NS_IMETHODIMP
TabChildGlobal::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
}
NS_IMETHODIMP
TabChildGlobal::Atob(const nsAString& aAsciiString,
nsAString& aBinaryData)
{
return nsContentUtils::Atob(aAsciiString, aBinaryData);
}
JSContext*
TabChildGlobal::GetJSContextForEventHandlers()
{

View File

@ -110,6 +110,10 @@ public:
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
}
NS_IMETHOD PrivateNoteIntentionalCrash();
NS_IMETHOD Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String);
NS_IMETHOD Atob(const nsAString& aAsciiString,
nsAString& aBinaryData);
NS_IMETHOD AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,

View File

@ -39,6 +39,7 @@
include protocol PPluginIdentifier;
include protocol PPluginInstance;
include protocol PPluginScriptableObject;
include "npapi.h";
include "mozilla/plugins/PluginMessageUtils.h";
@ -153,6 +154,9 @@ parent:
async PushCursor(NSCursorInfo cursorInfo);
async PopCursor();
sync GetNativeCursorsSupported() returns (bool supported);
sync NPN_SetException(nullable PPluginScriptableObject actor,
nsCString message);
};
} // namespace plugins

View File

@ -1516,7 +1516,19 @@ _setexception(NPObject* aNPObj,
{
PLUGIN_LOG_DEBUG_FUNCTION;
ENSURE_PLUGIN_THREAD_VOID();
NS_WARNING("Not yet implemented!");
PluginModuleChild* self = PluginModuleChild::current();
PluginScriptableObjectChild* actor = NULL;
if (aNPObj) {
actor = self->GetActorForNPObject(aNPObj);
if (!actor) {
NS_ERROR("Failed to get actor!");
return;
}
}
self->SendNPN_SetException(static_cast<PPluginScriptableObjectChild*>(actor),
NullableString(aMessage));
}
void NP_CALLBACK

View File

@ -1209,3 +1209,21 @@ PluginModuleParent::RemoveFromRefreshTimer(PluginInstanceParent *aInstance) {
}
}
#endif
bool
PluginModuleParent::RecvNPN_SetException(PPluginScriptableObjectParent* aActor,
const nsCString& aMessage)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
NPObject* aNPObj = NULL;
if (aActor) {
aNPObj = static_cast<PluginScriptableObjectParent*>(aActor)->GetObject(true);
if (!aNPObj) {
NS_ERROR("Failed to get object!");
return false;
}
}
mozilla::plugins::parent::_setexception(aNPObj, NullableStringGet(aMessage));
return true;
}

View File

@ -210,6 +210,10 @@ protected:
NS_OVERRIDE virtual bool
RecvGetNativeCursorsSupported(bool* supported);
NS_OVERRIDE virtual bool
RecvNPN_SetException(PPluginScriptableObjectParent* aActor,
const nsCString& aMessage);
static PluginInstanceParent* InstCast(NPP instance);
static BrowserStreamParent* StreamCast(NPP instance, NPStream* s);

View File

@ -102,10 +102,10 @@ _MOCHITEST_FILES = \
test_clear_site_data.html \
test_zero_opacity.html \
test_NPPVpluginWantsAllNetworkStreams.html \
test_npruntime_npnsetexception.html \
$(NULL)
# test_plugin_scroll_painting.html \ bug 596491
# test_npruntime_npnsetexception.html \ Disabled for e10s
ifeq ($(OS_ARCH),WINNT)
_MOCHITEST_FILES += \

View File

@ -1,3 +1,4 @@
var timer = null; // declare timer outside to prevent premature GC
function handleRequest(request, response)
{
response.processAsync();
@ -6,7 +7,7 @@ function handleRequest(request, response)
for (var i = 0; i < 1000; ++i)
response.write("Hello... ");
var timer = Components.classes["@mozilla.org/timer;1"]
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function() {
response.write("world.\n");

View File

@ -49,6 +49,9 @@
#include "nsIPrefService.h"
#include "nsDOMDeviceMotionEvent.h"
static const nsTPtrArray<nsIDOMWindow>::index_type NoIndex =
nsTPtrArray<nsIDOMWindow>::NoIndex;
class nsDeviceMotionData : public nsIDeviceMotionData
{
public:
@ -171,7 +174,7 @@ nsDeviceMotion::TimeoutHandler(nsITimer *aTimer, void *aClosure)
NS_IMETHODIMP nsDeviceMotion::AddListener(nsIDeviceMotionListener *aListener)
{
if (mListeners.IndexOf(aListener) >= 0)
if (mListeners.IndexOf(aListener) != -1)
return NS_OK; // already exists
if (mStarted == PR_FALSE) {
@ -185,7 +188,7 @@ NS_IMETHODIMP nsDeviceMotion::AddListener(nsIDeviceMotionListener *aListener)
NS_IMETHODIMP nsDeviceMotion::RemoveListener(nsIDeviceMotionListener *aListener)
{
if (mListeners.IndexOf(aListener) < 0)
if (mListeners.IndexOf(aListener) == -1)
return NS_OK; // doesn't exist
mListeners.RemoveObject(aListener);
@ -199,12 +202,16 @@ NS_IMETHODIMP nsDeviceMotion::AddWindowListener(nsIDOMWindow *aWindow)
mStarted = PR_TRUE;
Startup();
}
mWindowListeners.AppendElement(aWindow);
if (mWindowListeners.IndexOf(aWindow) != NoIndex)
mWindowListeners.AppendElement(aWindow);
return NS_OK;
}
NS_IMETHODIMP nsDeviceMotion::RemoveWindowListener(nsIDOMWindow *aWindow)
{
if (mWindowListeners.IndexOf(aWindow) != NoIndex)
return NS_OK;
mWindowListeners.RemoveElement(aWindow);
StartDisconnectTimer();
return NS_OK;

View File

@ -143,6 +143,9 @@ _TEST_FILES = \
test_window_bar.html \
file_window_bar.html \
test_resize_move_windows.html \
test_devicemotion_multiple_listeners.html \
devicemotion_outer.html \
devicemotion_inner.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<body>
<script>
function handler(ev) {}
window.addEventListener("devicemotion", handler);
window.ondeviceorientation = handler;
</script>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<body>
<script>
var total = 50;
var loaded = 0;
for (var i = 0; i < total; i++) {
var f = document.createElement("iframe");
document.body.appendChild(f);
f.onload = function() {
loaded++;
if (loaded == total - 1)
document.location.replace("about:blank");
}
f.setAttribute('src', 'devicemotion_inner.html');
}
</script>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=673472
-->
<head>
<title>Test for Bug 673472</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<base href="http://mochi.test:8888/tests/dom/tests/mochitest/bugs/">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=673472">Mozilla Bug 673472</a>
<pre id="test">
<script type="application/javascript">
function f() {
try {
var ifr = document.getElementById('i');
if (ifr.contentWindow.document.location == 'about:blank') {
ifr.parentNode.removeChild(ifr);
ok(true, "no crash received");
SpecialPowers.executeSoon(SimpleTest.finish);
}
} catch(e) {
ok(false, e);
}
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<iframe src="devicemotion_outer.html" onload="f()" id=i></iframe>
</body>
</html>

View File

@ -60,11 +60,8 @@
#include "RuntimeService.h"
#include "XMLHttpRequest.h"
USING_WORKERS_NAMESPACE
using mozilla::dom::workers::xhr::XMLHttpRequestPrivate;
using mozilla::dom::workers::xhr::Proxy;
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
BEGIN_WORKERS_NAMESPACE
namespace xhr {
class Proxy : public nsIDOMEventListener
{
@ -188,6 +185,15 @@ public:
}
};
} // namespace xhr
END_WORKERS_NAMESPACE
USING_WORKERS_NAMESPACE
using mozilla::dom::workers::xhr::XMLHttpRequestPrivate;
using mozilla::dom::workers::xhr::Proxy;
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
namespace {
inline intN

View File

@ -649,7 +649,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
{
bDidInsert = PR_TRUE;
insertedContextParent = parent;
lastInsertNode = parent;
lastInsertNode = GetChildAt(parentNode, offsetOfNewNode);
}
}
curNode = parent;

View File

@ -1549,7 +1549,7 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
// initialize out param
// we want to ignore result of WillInsert()
*aCancel = PR_FALSE;
// split any mailcites in the way.
// should we abort this if we encounter table cell boundaries?
if (IsMailEditor())
@ -1562,25 +1562,36 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo
// smart splitting rules
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, getter_AddRefs(node), &offset);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
// do nothing if the node is read-only
if (!mHTMLEditor->IsModifiableNode(node))
{
*aCancel = PR_TRUE;
return NS_OK;
}
// identify the block
nsCOMPtr<nsIDOMNode> blockParent;
if (IsBlockNode(node))
blockParent = node;
else
blockParent = mHTMLEditor->GetBlockNodeParent(node);
NS_ENSURE_TRUE(blockParent, NS_ERROR_FAILURE);
// do nothing if the node is read-only
if (!mHTMLEditor->IsModifiableNode(blockParent))
// if the active editing host is an inline element,
// or if the active editing host is the block parent itself,
// just append a br.
nsCOMPtr<nsIContent> hostContent = mHTMLEditor->GetActiveEditingHost();
nsCOMPtr<nsIDOMNode> hostNode = do_QueryInterface(hostContent);
if (!nsEditorUtils::IsDescendantOf(blockParent, hostNode))
{
*aCancel = PR_TRUE;
res = StandardBreakImpl(node, offset, aSelection);
NS_ENSURE_SUCCESS(res, res);
*aHandled = PR_TRUE;
return NS_OK;
}

View File

@ -763,7 +763,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
}
if ( aProperty == nsEditProperty::font && // or node is big or small and we are setting font size
(nsHTMLEditUtils::IsBig(aNode) || nsHTMLEditUtils::IsSmall(aNode)) &&
aAttribute->LowerCaseEqualsLiteral("size"))
aAttribute && aAttribute->LowerCaseEqualsLiteral("size"))
{
res = RemoveContainer(aNode); // if we are setting font size, remove any nested bigs and smalls
}
@ -1075,7 +1075,8 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
// style not set, but if it is a default then it will appear if
// content is inserted, so we should report it as set (analogous to TypeInState).
PRInt32 index;
if (TypeInState::FindPropInList(aProperty, *aAttribute, outValue, mDefaultStyles, index))
if (aAttribute &&
TypeInState::FindPropInList(aProperty, *aAttribute, outValue, mDefaultStyles, index))
{
*aFirst = *aAny = *aAll = PR_TRUE;
if (outValue)

View File

@ -58,6 +58,7 @@ _TEST_FILES = \
test_bug449243.html \
test_bug455992.html \
test_bug456244.html \
test_bug460740.html \
test_bug478725.html \
test_bug480972.html \
test_bug484181.html \
@ -97,6 +98,7 @@ _DATA_FILES = \
_CHROME_TEST_FILES = \
test_contenteditable_text_input_handling.html \
test_bug489202.xul \
test_bug490879.xul \
test_bug607584.xul \
test_bug616590.xul \

View File

@ -0,0 +1,125 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=460740
-->
<head>
<title>Test for Bug 460740</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=460740">Mozilla Bug 460740</a>
<p id="display"></p>
<div id="content">
<ul>
<li contenteditable>
Editable LI
</li>
<li>
<div contenteditable>
Editable DIV inside LI
</div>
</li>
<li>
<div>
<div contenteditable>
Editable DIV inside DIV inside LI
</div>
</div>
</li>
<li>
<h3>
<div contenteditable>
Editable DIV inside H3 inside LI
</div>
</h3>
</li>
</ul>
<div contenteditable>
Editable DIV
</div>
<h3 contenteditable>
Editable H3
</h3>
<p contenteditable>
Editable P
</p>
<div>
<p contenteditable>
Editable P in a DIV
</p>
</div>
<p><span contenteditable>Editable SPAN in a P</span></p>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 460740 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
const CARET_BEGIN = 0;
const CARET_MIDDLE = 1;
const CARET_END = 2;
function split(element, caretPos) {
// compute the requested position
var len = element.textContent.length;
var pos = -1;
switch (caretPos) {
case CARET_BEGIN:
pos = 0;
break;
case CARET_MIDDLE:
pos = Math.floor(len/2);
break;
case CARET_END:
pos = len;
break;
}
// put the caret on the requested position
var range = document.createRange();
var sel = window.getSelection();
range.setStart(element.firstChild, len);
range.setEnd(element.firstChild, len);
sel.addRange(range);
// simulates a [Return] keypress
synthesizeKey("VK_RETURN", {});
}
// count the number of non-BR elements in #content
function getBlockCount() {
return document.querySelectorAll("#content *:not(br)").length;
}
// count the number of BRs in element
function checkBR(element) {
return element.querySelectorAll("br").length;
}
function runTests() {
var count = getBlockCount();
var nodes = document.querySelectorAll("#content [contenteditable]");
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
node.focus();
is(checkBR(node), 0, "This node should not have any <br> element yet.");
for (var j = 0; j < 3; j++) { // CARET_BEGIN|MIDDLE|END
split(node, j);
ok(checkBR(node) > 0, "Pressing [Return] should add (at least) one <br> element.");
is(getBlockCount(), count, "Pressing [Return] should not change the number of non-<br> elements.");
document.execCommand("Undo", false, null);
}
}
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,79 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=489202
-->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Mozilla Bug 489202" onload="runTest();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=489202"
target="_blank">Mozilla Bug 489202</a>
<p/>
<editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="i1"
type="content"
editortype="htmlmail"
style="width: 400px; height: 100px;"/>
<p/>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
<![CDATA[
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
var Cc = Components.classes;
var Ci = Components.interfaces;
function runTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var trans = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
trans.addDataFlavor("text/html");
var test_data = '<meta/><a href="http://mozilla.org/">mozilla.org</a>';
var cstr = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
cstr.data = test_data;
trans.setTransferData("text/html", cstr, test_data.length*2);
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIDocShell)
.appType = Components.interfaces.nsIDocShell.APP_TYPE_EDITOR;
var e = document.getElementById('i1');
var doc = e.contentDocument;
doc.designMode = "on";
doc.body.innerHTML = "";
doc.defaultView.focus();
var selection = doc.defaultView.getSelection();
selection.removeAllRanges();
selection.selectAllChildren(doc.body);
selection.collapseToEnd();
var point = doc.defaultView.getSelection().getRangeAt(0).startOffset;
ok(point==0, "Cursor should be at editor start before paste");
utils.sendContentCommandEvent("pasteTransferable", trans);
point = doc.defaultView.getSelection().getRangeAt(0).startOffset;
ok(point>0, "Cursor should not be at editor start after paste");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
]]>
</script>
</window>

View File

@ -98,6 +98,15 @@ inline nscoord NSToCoordRound(float aValue)
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
}
inline nscoord NSToCoordRound(double aValue)
{
#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
return NS_lroundup30((float)aValue);
#else
return nscoord(NS_floor(aValue + 0.5f));
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
}
inline nscoord NSToCoordRoundWithClamp(float aValue)
{
#ifndef NS_COORD_IS_FLOAT
@ -354,6 +363,11 @@ inline nscoord NSToCoordFloor(float aValue)
return nscoord(NS_floorf(aValue));
}
inline nscoord NSToCoordFloor(double aValue)
{
return nscoord(NS_floor(aValue));
}
inline nscoord NSToCoordFloorClamped(float aValue)
{
#ifndef NS_COORD_IS_FLOAT
@ -377,6 +391,11 @@ inline nscoord NSToCoordCeil(float aValue)
return nscoord(NS_ceilf(aValue));
}
inline nscoord NSToCoordCeil(double aValue)
{
return nscoord(NS_ceil(aValue));
}
inline nscoord NSToCoordCeilClamped(float aValue)
{
#ifndef NS_COORD_IS_FLOAT
@ -395,6 +414,24 @@ inline nscoord NSToCoordCeilClamped(float aValue)
return NSToCoordCeil(aValue);
}
inline nscoord NSToCoordCeilClamped(double aValue)
{
#ifndef NS_COORD_IS_FLOAT
// Bounds-check before converting out of double, to avoid overflow
NS_WARN_IF_FALSE(aValue <= nscoord_MAX,
"Overflowed nscoord_MAX in conversion to nscoord");
if (aValue >= nscoord_MAX) {
return nscoord_MAX;
}
NS_WARN_IF_FALSE(aValue >= nscoord_MIN,
"Overflowed nscoord_MIN in conversion to nscoord");
if (aValue <= nscoord_MIN) {
return nscoord_MIN;
}
#endif
return NSToCoordCeil(aValue);
}
/*
* Int Rounding Functions
*/
@ -413,6 +450,11 @@ inline PRInt32 NSToIntRound(float aValue)
return NS_lroundf(aValue);
}
inline PRInt32 NSToIntRound(double aValue)
{
return NS_lround(aValue);
}
inline PRInt32 NSToIntRoundUp(float aValue)
{
return PRInt32(NS_floorf(aValue + 0.5f));

View File

@ -5942,6 +5942,11 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
cat >> $_CONFIG_TMP <<\EOF
/* The c99 defining the limit macros (UINT32_MAX for example), says:
* C++ implementations should define these macros only when __STDC_LIMIT_MACROS
* is defined before <stdint.h> is included. */
#define __STDC_LIMIT_MACROS
#endif /* _JS_CONFDEFS_H_ */
EOF

View File

@ -0,0 +1,23 @@
function f(code) {
a = code.replace(/s/, "");
wtt = a
code = code.replace(/\/\*DUPTRY\d+\*\//, function(k) {
n = parseInt(k.substr(8), 0);
return g("try{}catch(e){}", n)
});
f = eval("(function(){" + code + "})")
if (typeof disassemble == 'function') {
disassemble("-r", f)
}
}
function g(s, n) {
if (n == 0) {
return s
}
s2 = s + s
r = n % 2
d = (n - r) / 2
m = g(s2, d)
return r ? m + s : m
}
f("switch(''){default:break;/*DUPTRY525*/}")

View File

@ -165,7 +165,7 @@ ArenaHeader::checkSynchronizedWithFreeList() const
* Do not allow to access the free list when its real head is still stored
* in FreeLists and is not synchronized with this one.
*/
JS_ASSERT(compartment);
JS_ASSERT(allocated());
/*
* We can be called from the background finalization thread when the free
@ -195,7 +195,7 @@ template<typename T>
inline bool
Arena::finalize(JSContext *cx)
{
JS_ASSERT(aheader.compartment);
JS_ASSERT(aheader.allocated());
JS_ASSERT(!aheader.getMarkingDelay()->link);
uintptr_t thing = thingsStart(sizeof(T));
@ -320,18 +320,21 @@ Chunk::init(JSRuntime *rt)
{
info.runtime = rt;
info.age = 0;
info.emptyArenaListHead = &arenas[0].aheader;
ArenaHeader *aheader = &arenas[0].aheader;
ArenaHeader *last = &arenas[JS_ARRAY_LENGTH(arenas) - 1].aheader;
while (aheader < last) {
ArenaHeader *following = reinterpret_cast<ArenaHeader *>(aheader->address() + ArenaSize);
aheader->next = following;
aheader->compartment = NULL;
aheader = following;
}
last->next = NULL;
last->compartment = NULL;
info.numFree = ArenasPerChunk;
/* Assemble all arenas into a linked list and mark them as not allocated. */
ArenaHeader **prevp = &info.emptyArenaListHead;
Arena *end = &arenas[JS_ARRAY_LENGTH(arenas)];
for (Arena *a = &arenas[0]; a != end; ++a) {
#ifdef DEBUG
memset(a, ArenaSize, JS_FREE_PATTERN);
#endif
*prevp = &a->aheader;
a->aheader.setAsNotAllocated();
prevp = &a->aheader.next;
}
*prevp = NULL;
for (size_t i = 0; i != JS_ARRAY_LENGTH(markingDelay); ++i)
markingDelay[i].init();
}
@ -381,6 +384,7 @@ Chunk::allocateArena(JSContext *cx, unsigned thingKind)
void
Chunk::releaseArena(ArenaHeader *aheader)
{
JS_ASSERT(aheader->allocated());
JSRuntime *rt = info.runtime;
#ifdef JS_THREADSAFE
Maybe<AutoLockGC> maybeLock;
@ -400,42 +404,15 @@ Chunk::releaseArena(ArenaHeader *aheader)
#endif
JS_ATOMIC_ADD(&rt->gcBytes, -int32(ArenaSize));
JS_ATOMIC_ADD(&comp->gcBytes, -int32(ArenaSize));
aheader->setAsNotAllocated();
aheader->next = info.emptyArenaListHead;
info.emptyArenaListHead = aheader;
aheader->compartment = NULL;
++info.numFree;
if (unused())
info.age = 0;
}
JSRuntime *
Chunk::getRuntime()
{
return info.runtime;
}
inline jsuword
GetGCChunk(JSRuntime *rt)
{
void *p = rt->gcChunkAllocator->alloc();
#ifdef MOZ_GCTIMER
if (p)
JS_ATOMIC_INCREMENT(&newChunkCount);
#endif
return reinterpret_cast<jsuword>(p);
}
inline void
ReleaseGCChunk(JSRuntime *rt, jsuword chunk)
{
void *p = reinterpret_cast<void *>(chunk);
JS_ASSERT(p);
#ifdef MOZ_GCTIMER
JS_ATOMIC_INCREMENT(&destroyChunkCount);
#endif
rt->gcChunkAllocator->free_(p);
}
inline Chunk *
AllocateGCChunk(JSRuntime *rt)
{
@ -676,7 +653,7 @@ template <typename T>
inline ConservativeGCTest
MarkArenaPtrConservatively(JSTracer *trc, ArenaHeader *aheader, uintptr_t addr)
{
JS_ASSERT(aheader->compartment);
JS_ASSERT(aheader->allocated());
JS_ASSERT(sizeof(T) == aheader->getThingSize());
uintptr_t offset = addr & ArenaMask;
@ -742,7 +719,7 @@ MarkIfGCThingWord(JSTracer *trc, jsuword w)
Chunk *chunk = Chunk::fromAddress(addr);
if (!trc->context->runtime->gcUserChunkSet.has(chunk) &&
if (!trc->context->runtime->gcUserChunkSet.has(chunk) &&
!trc->context->runtime->gcSystemChunkSet.has(chunk))
return CGCT_NOTCHUNK;
@ -756,7 +733,7 @@ MarkIfGCThingWord(JSTracer *trc, jsuword w)
ArenaHeader *aheader = &chunk->arenas[Chunk::arenaIndex(addr)].aheader;
if (!aheader->compartment)
if (!aheader->allocated())
return CGCT_FREEARENA;
ConservativeGCTest test;
@ -2822,7 +2799,7 @@ TraceRuntime(JSTracer *trc)
void
IterateCompartmentsArenasCells(JSContext *cx, void *data,
IterateCompartmentCallback compartmentCallback,
IterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
IterateCellCallback cellCallback)
{

View File

@ -238,6 +238,13 @@ struct ArenaHeader {
uint16_t firstFreeSpanStart;
uint16_t firstFreeSpanEnd;
/*
* One of FinalizeKind constants or FINALIZE_LIMIT when the arena does not
* contain any GC things and is on the list of empty arenas in the GC
* chunk. The later allows to quickly check if the arena is allocated
* during the conservative GC scanning without searching the arena in the
* list.
*/
unsigned thingKind;
friend struct FreeLists;
@ -246,6 +253,14 @@ struct ArenaHeader {
inline uintptr_t address() const;
inline Chunk *chunk() const;
void setAsNotAllocated() {
thingKind = FINALIZE_LIMIT;
}
bool allocated() const {
return thingKind < FINALIZE_LIMIT;
}
inline void init(JSCompartment *comp, unsigned thingKind, size_t thingSize);
Arena *getArena() {
@ -253,6 +268,7 @@ struct ArenaHeader {
}
unsigned getThingKind() const {
JS_ASSERT(allocated());
return thingKind;
}
@ -487,9 +503,8 @@ struct Chunk {
ArenaHeader *allocateArena(JSContext *cx, unsigned thingKind);
void releaseArena(ArenaHeader *aheader);
JSRuntime *getRuntime();
};
JS_STATIC_ASSERT(sizeof(Chunk) <= GC_CHUNK_SIZE);
JS_STATIC_ASSERT(sizeof(Chunk) + BytesPerArena > GC_CHUNK_SIZE);
@ -530,7 +545,7 @@ Cell::isAligned() const
inline void
ArenaHeader::init(JSCompartment *comp, unsigned kind, size_t thingSize)
{
JS_ASSERT(!compartment);
JS_ASSERT(!allocated());
JS_ASSERT(!getMarkingDelay()->link);
compartment = comp;
thingKind = kind;
@ -1345,7 +1360,7 @@ typedef void (*IterateCellCallback)(JSContext *cx, void *data, void *thing, size
*/
extern JS_FRIEND_API(void)
IterateCompartmentsArenasCells(JSContext *cx, void *data,
IterateCompartmentCallback compartmentCallback,
IterateCompartmentCallback compartmentCallback,
IterateArenaCallback arenaCallback,
IterateCellCallback cellCallback);

View File

@ -112,8 +112,8 @@ Mark(JSTracer *trc, T *thing)
JS_ASSERT(thing->isAligned());
JSRuntime *rt = trc->context->runtime;
JS_ASSERT(thing->arenaHeader()->compartment);
JS_ASSERT(thing->arenaHeader()->compartment->rt == rt);
JS_ASSERT(thing->compartment());
JS_ASSERT(thing->compartment()->rt == rt);
if (rt->gcCheckCompartment && thing->compartment() != rt->gcCheckCompartment &&
thing->compartment() != rt->atomsCompartment)

View File

@ -5740,6 +5740,8 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool str
if (!CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, SHAPE_USERID(shape), rval))
return false;
if (rval->isFalse())
return true;
if (obj->containsSlot(shape->slot)) {
const Value &v = obj->nativeGetSlot(shape->slot);

View File

@ -355,20 +355,22 @@ struct JSObject : js::gc::Cell {
inline bool nativeContains(const js::Shape &shape);
enum {
DELEGATE = 0x01,
SYSTEM = 0x02,
NOT_EXTENSIBLE = 0x04,
BRANDED = 0x08,
GENERIC = 0x10,
METHOD_BARRIER = 0x20,
INDEXED = 0x40,
OWN_SHAPE = 0x80,
BOUND_FUNCTION = 0x100,
HAS_EQUALITY = 0x200,
VAROBJ = 0x400,
METHOD_THRASH_COUNT_MASK = 0x3000,
METHOD_THRASH_COUNT_SHIFT = 12,
METHOD_THRASH_COUNT_MAX = METHOD_THRASH_COUNT_MASK >> METHOD_THRASH_COUNT_SHIFT
DELEGATE = 0x01,
SYSTEM = 0x02,
NOT_EXTENSIBLE = 0x04,
BRANDED = 0x08,
GENERIC = 0x10,
METHOD_BARRIER = 0x20,
INDEXED = 0x40,
OWN_SHAPE = 0x80,
METHOD_THRASH_COUNT_MASK = 0x300,
METHOD_THRASH_COUNT_SHIFT = 8,
METHOD_THRASH_COUNT_MAX = METHOD_THRASH_COUNT_MASK >> METHOD_THRASH_COUNT_SHIFT,
BOUND_FUNCTION = 0x400,
HAS_EQUALITY = 0x800,
VAROBJ = 0x1000,
UNUSED_FLAG_BITS = 0xFFFFE000
};
/*

View File

@ -1175,6 +1175,8 @@ JS_FRIEND_API(JSObject *)
NewProxyObject(JSContext *cx, JSProxyHandler *handler, const Value &priv, JSObject *proto,
JSObject *parent, JSObject *call, JSObject *construct)
{
JS_ASSERT_IF(proto, cx->compartment == proto->compartment());
JS_ASSERT_IF(parent, cx->compartment == parent->compartment());
bool fun = call || construct;
Class *clasp;
if (fun)

View File

@ -1892,8 +1892,9 @@ SrcNotes(JSContext *cx, JSScript *script, Sprinter *sp)
Sprint(sp, " function %u (%s)", index, !!bytes ? bytes.ptr() : "N/A");
break;
}
case SRC_SWITCH:
if (js_GetOpcode(cx, script, script->code + offset) == JSOP_GOTO)
case SRC_SWITCH: {
JSOp op = js_GetOpcode(cx, script, script->code + offset);
if (op == JSOP_GOTO || op == JSOP_GOTOX)
break;
Sprint(sp, " length %u", uintN(js_GetSrcNoteOffset(sn, 0)));
caseOff = (uintN) js_GetSrcNoteOffset(sn, 1);
@ -1902,6 +1903,7 @@ SrcNotes(JSContext *cx, JSScript *script, Sprinter *sp)
UpdateSwitchTableBounds(cx, script, offset,
&switchTableStart, &switchTableEnd);
break;
}
case SRC_CATCH:
delta = (uintN) js_GetSrcNoteOffset(sn, 0);
if (delta) {

View File

@ -42,6 +42,7 @@ var summary = 'No Syntax Error when trailing space and XML.ignoreWhitespace ' +
var BUGNUMBER = 324688;
var actual = 'No Error';
var expect = 'No Error';
var t; // use global scope to prevent timer from being GC'ed
START(summary);
function init()
@ -78,7 +79,7 @@ function init()
}
};
var t = Components.classes["@mozilla.org/timer;1"].
t = Components.classes["@mozilla.org/timer;1"].
createInstance(Components.interfaces.nsITimer);
t.init(TestObject, 100, t.TYPE_ONE_SHOT);
}

View File

@ -0,0 +1,85 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 671947;
var summary = "Unqualified function invocation uses the global object of the called property as |this|";
var actual = "------------------------";
var expect = "ooaoboabuuaubuabooaoboab";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
this.name = "o";
function f() {
return this ? this.name : "t";
}
function g() {
"use strict";
return this ? this.name : "u";
}
function h() {
return this ? this.name : "v";
}
var sb = newGlobal('same-compartment');
sb.parent = this;
evalcx('\n' +
' this.name="i";\n' +
' this.f = parent.f;\n' +
' this.g = parent.g;\n' +
' this.a = { name:"a", f:parent.f, g:parent.g };\n' +
' this.b = { name:"b", f:parent.f, g:parent.g };\n' +
' Object.defineProperty(this, "h", { get: (function(){ return parent.h; })});\n' +
' Object.defineProperty(a, "h", { get: (function(){ return parent.h; })});\n' +
' Object.defineProperty(b, "h", { get: (function(){ return parent.h; })});\n' +
' var results = "";\n' +
' /* Three of the first four cases pass undefined (promoted inside the callee to the callee\'s global object). */\n' +
' /* a.f() is the one exception, which passes the base, a, as the this object. */\n' +
' results += (function(){return f();})();\n' +
' results += (function(){return (1,f)();})();\n' +
' results += (function(){return a.f();})();\n' +
' results += (function(){return eval("f()");})();\n' +
' /* Same cases as above, but wrapped in a with. The first & last of these cases pass b, */\n' +
' /* the object scoped by the with, as the this value. */\n' +
' /* a.f() still passes the explicit base, a. (1,f)() is a little tricksier - this passes */\n' +
' /* undefined (promoted to the callee global object) since the comma operator calles GetValue */\n' +
' /* on the reference (see ES5 11.14.) */\n' +
' results += (function(){with(b){ return (function(){ return f();})(); }})();\n' +
' results += (function(){with(b){ return (function(){ return (1,f)();})(); }})();\n' +
' results += (function(){with(b){ return (function(){ return a.f();})(); }})();\n' +
' results += (function(){with(b){ return (function(){ return eval("f()");})(); }})();\n' +
' /* Same tests as above, but with a strict callee. */\n' +
' /* We expect the same results, except undefined this is not replaced with the global object. */\n' +
' results += (function(){return g();})();\n' +
' results += (function(){return (1,g)();})();\n' +
' results += (function(){return a.g();})();\n' +
' results += (function(){return eval("g()");})();\n' +
' results += (function(){with(b){ return g(); }})();\n' +
' results += (function(){with(b){ return (1,g)(); }})();\n' +
' results += (function(){with(b){ return a.g(); }})();\n' +
' results += (function(){with(b){ return (function(){ return eval("g()");})(); }})();\n' +
' /* Same as the first set, but h is a getter property. */\n' +
' results += (function(){return h();})();\n' +
' results += (function(){return (1,h)();})();\n' +
' results += (function(){return a.h();})();\n' +
' results += (function(){return eval("h()");})();\n' +
' results += (function(){with(b){ return h(); }})();\n' +
' results += (function(){with(b){ return (1,h)(); }})();\n' +
' results += (function(){with(b){ return a.h(); }})();\n' +
' results += (function(){with(b){ return (function(){ return eval("h()");})(); }})();\n' +
' parent.actual = results;\n' +
'',
sb);
reportCompare(expect, actual, "ok");

View File

@ -111,7 +111,7 @@ WrapperFactory::WaiveXray(JSContext *cx, JSObject *obj)
return nsnull;
JSAutoEnterCompartment ac;
if (!ac.enter(cx, obj))
if (!ac.enter(cx, obj) || !JS_WrapObject(cx, &proto))
return nsnull;
wobj = JSWrapper::New(cx, obj, proto, JS_GetGlobalForObject(cx, obj),
&WaiveXrayWrapperWrapper);

View File

@ -2649,9 +2649,10 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
// Actually process the new index and let the selection code
// do the scrolling for us
if (newIndex != kNothingSelected) {
// If you hold control, no key will actually do anything except space.
// If you hold control, but not shift, no key will actually do anything
// except space.
PRBool wasChanged = PR_FALSE;
if (isControl && charcode != ' ') {
if (isControl && !isShift && charcode != ' ') {
mStartSelectionIndex = newIndex;
mEndSelectionIndex = newIndex;
InvalidateFocus();

View File

@ -77,6 +77,7 @@ _TEST_FILES = test_bug231389.html \
test_bug620936.html \
test_bug595310.html \
test_bug644542.html \
test_bug672810.html \
$(NULL)
_CHROME_FILES = \

View File

@ -0,0 +1,117 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=672810
-->
<head>
<title>Test for Bug 672810</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=672810">Mozilla Bug 672810</a>
<p id="display"></p>
<div id="content">
<select id="s1" multiple size="10"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select>
<select id="s2" size="10"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select>
<select id="s3" size="1"><option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x<option>x</select>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 672810 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var sel = document.getElementsByTagName('select');
sel[0].addEventListener('focus', function() {
s = sel[0];
s.removeEventListener('focus', arguments.callee, false);
synthesizeKey('VK_DOWN', {});
is(s.selectedIndex,0, s.id + ": initial DOWN selects first option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": CTRL+DOWN did not select 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": 2nd option is still unselected");
ok(s[2].selected,s.id + ": 3rd option is selected");
ok(s[3].selected,s.id + ": 4th option is selected");
ok(!s[4].selected,s.id + ": 5th option is unselected");
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": 2nd option is still unselected");
ok(s[2].selected,s.id + ": 3rd option is still selected");
ok(s[3].selected,s.id + ": 4th option is still selected");
ok(s[4].selected,s.id + ": 5th option is selected");
ok(!s[5].selected,s.id + ": 6th option is unselected");
synthesizeKey('VK_UP', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": 2nd option is still unselected");
ok(s[2].selected,s.id + ": 3rd option is still selected");
ok(s[3].selected,s.id + ": 4th option is still selected");
ok(s[4].selected,s.id + ": 5th option is still selected");
ok(!s[5].selected,s.id + ": 6th option is still unselected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": 2nd option is still unselected");
ok(s[2].selected,s.id + ": 3rd option is still selected");
ok(!s[3].selected,s.id + ": 4th option is unselected");
ok(s[4].selected,s.id + ": 5th option is still selected");
ok(!s[5].selected,s.id + ": 6th option is still unselected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,0, s.id + ": first option is still selected");
ok(!s[1].selected,s.id + ": 2nd option is still unselected");
ok(s[2].selected,s.id + ": 3rd option is still selected");
ok(s[3].selected,s.id + ": 4th option is selected");
ok(s[4].selected,s.id + ": 5th option is still selected");
ok(!s[5].selected,s.id + ": 6th option is still unselected");
setTimeout(function(){sel[1].focus()},0);
}, false);
sel[1].addEventListener('focus', function() {
s = sel[1];
s.removeEventListener('focus', arguments.callee, false);
synthesizeKey('VK_DOWN', {});
is(s.selectedIndex,0, s.id + ": initial DOWN selects first option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
is(s.selectedIndex,1, s.id + ": 2nd option is selected");
ok(!s[0].selected,s.id + ": CTRL+DOWN deselected first option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is selected");
ok(!s[1].selected,s.id + ": CTRL+SHIFT+DOWN deselected 2nd option");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
setTimeout(function(){sel[2].focus()},0);
}, false);
sel[2].addEventListener('focus', function() {
s = sel[2];
s.removeEventListener('focus', arguments.callee, false);
synthesizeKey('VK_DOWN', {});
is(s.selectedIndex,1, s.id + ": initial DOWN selects 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true});
is(s.selectedIndex,2, s.id + ": 3rd option is selected");
ok(!s[1].selected,s.id + ": CTRL+DOWN deselected 2nd option");
synthesizeKey('VK_DOWN', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is selected");
ok(!s[2].selected,s.id + ": CTRL+SHIFT+DOWN deselected 3rd option");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
synthesizeKey(' ', {ctrlKey: true, shiftKey: true});
is(s.selectedIndex,3, s.id + ": 4th option is still selected");
setTimeout(function(){SimpleTest.finish()},0);
}, false);
sel[0].focus();
});
</script>
</pre>
</body>
</html>

View File

@ -44,3 +44,15 @@ fails == float-continuations-000.html float-continuations-000.ref.html
== row-page-break-after-always-2.html table-page-break-before-auto-2-ref.html
== rowgroup-thead-page-break-after-always-1.html table-page-break-before-auto-3-ref.html
== rowgroup-tfoot-page-break-after-always-1.html table-page-break-before-auto-3-ref.html
== table-caption-splitrowgroup-1.html table-caption-splitrowgroup-1-ref.html
== table-caption-splitaftercaption-1.html table-caption-splitaftercaption-1-ref.html
== table-caption-splitaftercaption-2.html table-caption-splitaftercaption-2-ref.html
== table-caption-splitaftercaption-3.html table-caption-splitaftercaption-3-ref.html
== table-caption-splitaftercaption-4.html table-caption-splitaftercaption-4-ref.html
== table-caption-splitaftercaption-5.html table-caption-splitaftercaption-5-ref.html
== table-caption-splitaftercaption-6.html table-caption-splitaftercaption-6-ref.html
== table-caption-splitaftercaption-7.html table-caption-splitaftercaption-7-ref.html
# == table-caption-splitaftercaption-8.html blank.html # bug 672654
# == table-caption-splitaftercaption-9.html blank.html # bug 672654
# == table-caption-splitaftercaption-10.html blank.html # bug 672654
# == table-caption-splitaftercaption-11.html blank.html # bug 672654

View File

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 90px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 90px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:top-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer" style="padding-top:160px"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:bottom-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer" style="padding-top:160px"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,27 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 10px; margin-bottom:20px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 10px; margin-bottom:20px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:bottom}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:bottom}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:15px; caption-side:top-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:15px; caption-side:top-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 25px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:15px; caption-side:bottom-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:15px; caption-side:bottom-outside}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
tfoot div {border-color:orange;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:top}
table {margin-top: 5px; margin-bottom:5px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer" style="padding-top:160px"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height:5px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
caption {margin-top: 5px; margin-bottom:5px; caption-side:bottom}
table {margin-top: 5px; margin-bottom:5px}
tfoot div.spacer {border-color:orange;}
tbody div.spacer{border-width: 4px}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer" style="padding-top:1060px"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
</table>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 80px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" style="page-break-before:always">
<tr><td><div class="spacer"></div></td></tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US" class="reftest-print">
<head>
<style type="text/css">
div.filler {height: 80px; width: 50px; border:thin solid blue;}
div.spacer { height: 0px; width: 0px; padding: 20px;border:thin solid green;}
</style>
</head>
<body>
<div class=filler></div>
<table cellspacing="0" cellpadding="0">
<caption><div class="spacer"></div></caption>
<tbody>
<tr><td><div class="spacer"></div></td></tr>
<tr><td><div class="spacer"></div></td></tr>
</tbody>
</table>
</body>
</html>

View File

@ -17,3 +17,4 @@ HTTP(..) == marker-shadow.html marker-shadow-ref.html
== aligned-baseline.html aligned-baseline-ref.html
skip-if(Android) == clipped-elements.html clipped-elements-ref.html
== theme-overflow.html theme-overflow-ref.html
HTTP(..) == table-cell.html table-cell-ref.html

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test text-overflow:ellipsis on table-cell</title>
<style type="text/css">
@font-face {
font-family: DejaVuSansMono;
src: url(../fonts/DejaVuSansMono.woff);
}
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0; font-family:DejaVuSansMono;
}
.table {
color: black;
display: table;
table-layout: fixed;
height: 5em;
width: 5em;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
white-space: nowrap;
overflow: hidden;
}
</style>
</head>
<body>
<div class="table">
<div class="row">
<div class="cell">|||||||&#x2026;</div>
</div>
<div class="row">
<div class="cell"><span>|||||||&#x2026;</span></div>
</div>
</div>
</body></html>

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
Test: text-overflow:ellipsis on table-cell
-->
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test text-overflow:ellipsis on table-cell</title>
<style type="text/css">
@font-face {
font-family: DejaVuSansMono;
src: url(../fonts/DejaVuSansMono.woff);
}
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0; font-family:DejaVuSansMono;
}
.table {
color: black;
display: table;
table-layout: fixed;
height: 5em;
width: 5em;
}
.row {
display: table-row;
}
.cell {
display: table-cell;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div class="table">
<div class="row">
<div class="cell">||||||||||||||</div>
</div>
<div class="row">
<div class="cell"><span>||||||||||||||</span></div>
</div>
</div>
</body></html>

View File

@ -2829,6 +2829,16 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
aLastChildReflowed = prevKidFrame;
break;
}
else { // we can't push so lets make clear how much space we need
PlaceChild(aReflowState, kidFrame, desiredSize, oldKidRect,
oldKidVisualOverflow);
aLastChildReflowed = kidFrame;
if (allowRepeatedFooter) {
PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
aLastChildReflowed = tfoot;
}
break;
}
}
}

View File

@ -1076,6 +1076,37 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
captionSize.width = captionMet.width;
captionSize.height = captionMet.height;
captionMargin = captionRS->mComputedMargin;
// Now that we know the height of the caption, reduce the available height
// for the table frame if we are height constrained and the caption is above
// or below the inner table.
if (NS_UNCONSTRAINEDSIZE != aOuterRS.availableHeight) {
nscoord captionHeight = 0;
switch (captionSide) {
case NS_STYLE_CAPTION_SIDE_TOP:
case NS_STYLE_CAPTION_SIDE_BOTTOM: {
captionHeight = captionSize.height + captionMargin.TopBottom();
break;
}
case NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE: {
nsCollapsingMargin belowCaptionMargin;
belowCaptionMargin.Include(captionMargin.bottom);
belowCaptionMargin.Include(innerRS->mComputedMargin.top);
captionHeight = captionSize.height + captionMargin.top +
belowCaptionMargin.get();
break;
}
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
nsCollapsingMargin aboveCaptionMargin;
aboveCaptionMargin.Include(captionMargin.top);
aboveCaptionMargin.Include(innerRS->mComputedMargin.bottom);
captionHeight = captionSize.height + captionMargin.bottom +
aboveCaptionMargin.get();
break;
}
}
innerRS->availableHeight =
NS_MAX(0, innerRS->availableHeight - captionHeight);
}
} else {
captionSize.SizeTo(0,0);
captionMargin.SizeTo(0,0,0,0);

View File

@ -263,7 +263,8 @@ LogCookie(nsCookie *aCookie)
PR_LOG(sCookieLog, PR_LOG_DEBUG,("%s: %s\n", aCookie->IsDomain() ? "domain" : "host", aCookie->Host().get()));
PR_LOG(sCookieLog, PR_LOG_DEBUG,("path: %s\n", aCookie->Path().get()));
PR_ExplodeTime(aCookie->Expiry() * PR_USEC_PER_SEC, PR_GMTParameters, &explodedTime);
PR_ExplodeTime(aCookie->Expiry() * PRInt64(PR_USEC_PER_SEC),
PR_GMTParameters, &explodedTime);
PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime);
PR_LOG(sCookieLog, PR_LOG_DEBUG,
("expires: %s%s", timeString, aCookie->IsSession() ? " (at end of session)" : ""));
@ -1543,7 +1544,7 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
PRStatus result = PR_ParseTimeString(aServerTime.get(), PR_TRUE,
&tempServerTime);
if (result == PR_SUCCESS) {
serverTime = tempServerTime / PR_USEC_PER_SEC;
serverTime = tempServerTime / PRInt64(PR_USEC_PER_SEC);
} else {
serverTime = PR_Now() / PR_USEC_PER_SEC;
}
@ -3273,7 +3274,7 @@ nsCookieService::GetExpiry(nsCookieAttributes &aCookieAttributes,
return PR_TRUE;
}
delta = expires / PR_USEC_PER_SEC - aServerTime;
delta = expires / PRInt64(PR_USEC_PER_SEC) - aServerTime;
// default to session cookie if no attributes found
} else {

View File

@ -0,0 +1,17 @@
function makeURI(str) {
return Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(str, null, null);
}
function run_test() {
var serv = Components.classes["@mozilla.org/cookieService;1"]
.getService(Components.interfaces.nsICookieService);
var uri = makeURI("http://example.com/");
// Try an expiration time before the epoch
serv.setCookieString(uri, null, "test=test; path=/; domain=example.com; expires=Sun, 31-Dec-1899 16:00:00 GMT;", null);
do_check_eq(serv.getCookieString(uri, null), null);
// Now sanity check
serv.setCookieString(uri, null, "test2=test2; path=/; domain=example.com;", null);
do_check_eq(serv.getCookieString(uri, null), "test2=test2");
}

View File

@ -71,6 +71,7 @@ tail =
[test_bug651185.js]
[test_bug667907.js]
[test_bug670333.js]
[test_bug667818.js]
[test_cacheflags.js]
[test_channel_close.js]
[test_compareURIs.js]

View File

@ -1,3 +1,5 @@
var timer = null; // Declare outside to prevent premature GC
function handleRequest(request, response)
{
response.setHeader("Cache-Control", "no-cache", false);
@ -5,7 +7,7 @@ function handleRequest(request, response)
response.write("var i = 0;");
response.bodyOutputStream.flush();
response.processAsync();
var timer = Components.classes["@mozilla.org/timer;1"]
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function() {
response.finish();

View File

@ -1,3 +1,5 @@
var timer; // Place timer in global scope to avoid it getting GC'ed prematurely
function handleRequest(request, response)
{
response.setHeader("Cache-Control", "no-cache", false);
@ -10,7 +12,7 @@ function handleRequest(request, response)
response.write("</div>");
response.bodyOutputStream.flush();
response.processAsync();
var timer = Components.classes["@mozilla.org/timer;1"]
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function() {
response.finish();

View File

@ -37,9 +37,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include <string.h>
#include "mozilla/Telemetry.h"
#include "sqlite3.h"
#include <string.h>
#include "nsThreadUtils.h"
namespace {
@ -74,6 +75,27 @@ Histograms gHistograms[] = {
Telemetry::MOZ_SQLITE_OTHER_SYNC }
};
/** RAII class for measuring how long io takes on/off main thread */
class IOThreadAutoTimer {
public:
IOThreadAutoTimer(MOZILLA_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: start(TimeStamp::Now())
{
MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
}
~IOThreadAutoTimer() {
Accumulate(NS_IsMainThread() ? Telemetry::MOZ_SQLITE_MAIN_THREAD_WAIT_MS
: Telemetry::MOZ_SQLITE_OTHER_THREAD_WAIT_MS
, (TimeStamp::Now() - start).ToMilliseconds());
}
private:
const TimeStamp start;
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct telemetry_file {
sqlite3_file base; // Base class. Must be first
Histograms *histograms; // histograms pertaining to this file
@ -102,6 +124,7 @@ xClose(sqlite3_file *pFile)
int
xRead(sqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOfst)
{
IOThreadAutoTimer ioTimer;
telemetry_file *p = (telemetry_file *)pFile;
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_READ_MS> timer;
int rc;
@ -118,6 +141,7 @@ xRead(sqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOfst)
int
xWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst)
{
IOThreadAutoTimer ioTimer;
telemetry_file *p = (telemetry_file *)pFile;
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_WRITE_MS> timer;
int rc;
@ -132,6 +156,7 @@ xWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst)
int
xTruncate(sqlite3_file *pFile, sqlite_int64 size)
{
IOThreadAutoTimer ioTimer;
telemetry_file *p = (telemetry_file *)pFile;
int rc;
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_TRUNCATE> timer;
@ -145,6 +170,7 @@ xTruncate(sqlite3_file *pFile, sqlite_int64 size)
int
xSync(sqlite3_file *pFile, int flags)
{
IOThreadAutoTimer ioTimer;
telemetry_file *p = (telemetry_file *)pFile;
const TimeStamp start = TimeStamp::Now();
int rc = p->pReal->pMethods->xSync(p->pReal, flags);
@ -271,6 +297,7 @@ int
xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
int flags, int *pOutFlags)
{
IOThreadAutoTimer ioTimer;
Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_OPEN> timer;
sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
int rc;

View File

@ -100,6 +100,7 @@ function modalDialog(callback)
this.observer.handler = callback;
this.observer.startTimer = this.start;
this.observer.docFinder = this.getDialog;
this.modalDialogTimer = null; // put timer in class def so it doesn't get GC'ed
}
/**
@ -125,19 +126,19 @@ modalDialog.prototype.start = function modalDialog_start(delay, observer)
{
const dialogDelay = (delay == undefined) ? 100 : delay;
var modalDialogTimer = Cc["@mozilla.org/timer;1"].
this.modalDialogTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
// If we are not called from the observer, we have to use the supplied
// observer instead of this.observer
if (observer) {
modalDialogTimer.init(observer,
dialogDelay,
Ci.nsITimer.TYPE_ONE_SHOT);
this.modalDialogTimer.init(observer,
dialogDelay,
Ci.nsITimer.TYPE_ONE_SHOT);
} else {
modalDialogTimer.init(this.observer,
dialogDelay,
Ci.nsITimer.TYPE_ONE_SHOT);
this.modalDialogTimer.init(this.observer,
dialogDelay,
Ci.nsITimer.TYPE_ONE_SHOT);
}
}

View File

@ -570,8 +570,8 @@ INFO | Failed: %d
INFO | Todo: %d""" % (self.passCount, self.failCount, self.todoCount))
if gotSIGINT and not keepGoing:
log.error("TEST-UNEXPECTED-FAIL | Received SIGINT (control-C), so stopped run. " \
"(Use --keep-going to keep running tests after killing one with SIGINT)")
self.log.error("TEST-UNEXPECTED-FAIL | Received SIGINT (control-C), so stopped run. " \
"(Use --keep-going to keep running tests after killing one with SIGINT)")
return False
return self.failCount == 0

View File

@ -103,21 +103,23 @@ HTTP_HISTOGRAMS(SUB, "subitem: ")
#undef HTTP_HISTOGRAMS
HISTOGRAM(FIND_PLUGINS, 1, 3000, 10, EXPONENTIAL, "Time spent scanning filesystem for plugins (ms)")
HISTOGRAM(CHECK_JAVA_ENABLED, 1, 3000, 10, EXPONENTIAL, "Time spent checking if Java is enabled (ms)")
HISTOGRAM(MOZ_SQLITE_OPEN, 1, 3000, 10, EXPONENTIAL, "Time spent on sqlite open() (ms)")
HISTOGRAM(MOZ_SQLITE_READ_MS, 1, 3000, 10, EXPONENTIAL, "Time spent on sqlite read() (ms)")
HISTOGRAM(MOZ_SQLITE_OTHER_READ_B, 1, 32768, 3, LINEAR, "Sqlite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_PLACES_READ_B, 1, 32768, 3, LINEAR, "Sqlite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_COOKIES_READ_B, 1, 32768, 3, LINEAR, "Sqlite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_READ_B, 1, 32768, 3, LINEAR, "Sqlite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_WRITE_MS, 1, 3000, 10, EXPONENTIAL, "Time spent on sqlite write() (ms)")
HISTOGRAM(MOZ_SQLITE_PLACES_WRITE_B, 1, 32768, 3, LINEAR, "Sqlite write (bytes)")
HISTOGRAM(MOZ_SQLITE_COOKIES_WRITE_B, 1, 32768, 3, LINEAR, "Sqlite write (bytes)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_WRITE_B, 1, 32768, 3, LINEAR, "Sqlite write (bytes)")
HISTOGRAM(MOZ_SQLITE_OTHER_WRITE_B, 1, 32768, 3, LINEAR, "Sqlite write (bytes)")
HISTOGRAM(MOZ_SQLITE_TRUNCATE, 1, 3000, 10, EXPONENTIAL, "Time spent on sqlite truncate() (ms)")
HISTOGRAM(MOZ_SQLITE_PLACES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on sqlite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_COOKIES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on sqlite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on sqlite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_OTHER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on sqlite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_OPEN, 1, 3000, 10, EXPONENTIAL, "Time spent on SQLite open() (ms)")
HISTOGRAM(MOZ_SQLITE_READ_MS, 1, 3000, 10, EXPONENTIAL, "Time spent on SQLite read() (ms)")
HISTOGRAM(MOZ_SQLITE_OTHER_READ_B, 1, 32768, 3, LINEAR, "SQLite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_PLACES_READ_B, 1, 32768, 3, LINEAR, "SQLite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_COOKIES_READ_B, 1, 32768, 3, LINEAR, "SQLite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_READ_B, 1, 32768, 3, LINEAR, "SQLite read() (bytes)")
HISTOGRAM(MOZ_SQLITE_WRITE_MS, 1, 3000, 10, EXPONENTIAL, "Time spent on SQLite write() (ms)")
HISTOGRAM(MOZ_SQLITE_PLACES_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_COOKIES_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_OTHER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
HISTOGRAM(MOZ_SQLITE_TRUNCATE, 1, 3000, 10, EXPONENTIAL, "Time spent on SQLite truncate() (ms)")
HISTOGRAM(MOZ_SQLITE_PLACES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_COOKIES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
HISTOGRAM(MOZ_SQLITE_OTHER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
HISTOGRAM(STARTUP_MEASUREMENT_ERRORS, 1, 3, 4, LINEAR, "Flags errors in startup calculation()")
HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10000, 10, EXPONENTIAL, "Time spent opening disk cache (ms)")
HISTOGRAM(MOZ_SQLITE_MAIN_THREAD_WAIT_MS, 1, 3000, 10, EXPONENTIAL, "Time spent waiting on SQLite IO on main thread (ms)")
HISTOGRAM(MOZ_SQLITE_OTHER_THREAD_WAIT_MS, 1, 3000, 10, EXPONENTIAL, "Time spent waiting on SQLite IO off main thread (ms)")

View File

@ -286,10 +286,13 @@ function runTests(tests)
runNextTest();
}
var timerArray = [];
function Timer(delay, cb) {
this.cb = cb;
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(this, delay, timer.TYPE_ONE_SHOT);
timerArray.push(timer);
}
Timer.prototype = {

View File

@ -64,6 +64,7 @@ function bug413985obs(aWin)
this.mWin = aWin;
this.wasPaused = false;
this.wasResumed = false;
this.timer = null; // timer declared here to prevent premature GC
}
bug413985obs.prototype = {
observe: function(aSubject, aTopic, aData)
@ -88,8 +89,8 @@ bug413985obs.prototype = {
this.wasResumed = true;
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) {

View File

@ -27,6 +27,8 @@
%define toolbarbuttonBorderColor rgba(59, 59, 59, 0.9)
%define toolbarbuttonCornerRadius 3px
%define toolbarbuttonBackground -moz-linear-gradient(top, #FFF, #ADADAD) repeat-x
%define toolbarbuttonFocusedBorderColorAqua rgba(102, 122, 155, 0.9)
%define toolbarbuttonFocusedBorderColorGraphite rgba(59, 59, 59, 0.7)
%define toolbarbuttonPressedInnerShadow inset rgba(0, 0, 0, 0.3) 0 -6px 10px, inset #000 0 1px 3px, inset rgba(0, 0, 0, 0.2) 0 1px 3px
%define toolbarbuttonPressedBackgroundColor #B5B5B5
%define toolbarbuttonInactiveBorderColor rgba(146, 146, 146, 0.84)

View File

@ -130,6 +130,15 @@ richlistitem[type="download"] button {
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
#clearListButton:-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorAqua@;
box-shadow: @focusRingShadow@;
}
#clearListButton:-moz-system-metric(mac-graphite-theme):-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
}
#clearListButton:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;

View File

@ -57,6 +57,15 @@ wizardpage {
box-shadow: @toolbarbuttonPressedInnerShadow@, @loweredShadow@;
}
.wizard-buttons button:-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorAqua@;
box-shadow: @focusRingShadow@;
}
.wizard-buttons button:-moz-system-metric(mac-graphite-theme):-moz-focusring {
border-color: @toolbarbuttonFocusedBorderColorGraphite@;
}
.wizard-buttons button:-moz-window-inactive {
border-color: @toolbarbuttonInactiveBorderColor@;
background-image: @toolbarbuttonInactiveBackgroundImage@;

View File

@ -66,19 +66,19 @@ nsRunnable::Run()
//-----------------------------------------------------------------------------
NS_METHOD
NS_NewThread(nsIThread **result, nsIRunnable *event)
NS_NewThread(nsIThread **result, nsIRunnable *event, PRUint32 stackSize)
{
nsCOMPtr<nsIThread> thread;
#ifdef MOZILLA_INTERNAL_API
nsresult rv = nsThreadManager::get()->
nsThreadManager::NewThread(0, getter_AddRefs(thread));
nsThreadManager::NewThread(0, stackSize, getter_AddRefs(thread));
#else
nsresult rv;
nsCOMPtr<nsIThreadManager> mgr =
do_GetService(NS_THREADMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = mgr->NewThread(0, getter_AddRefs(thread));
rv = mgr->NewThread(0, stackSize, getter_AddRefs(thread));
#endif
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -75,12 +75,16 @@
* The resulting nsIThread object.
* @param initialEvent
* The initial event to run on this thread. This parameter may be null.
* @param stackSize
* The size in bytes to reserve for the thread's stack.
*
* @returns NS_ERROR_INVALID_ARG
* Indicates that the given name is not unique.
*/
extern NS_COM_GLUE NS_METHOD
NS_NewThread(nsIThread **result, nsIRunnable *initialEvent = nsnull);
NS_NewThread(nsIThread **result,
nsIRunnable *initialEvent = nsnull,
PRUint32 stackSize = nsIThreadManager::DEFAULT_STACK_SIZE);
/**
* Get a reference to the current thread.

View File

@ -45,20 +45,28 @@ interface nsIThread;
/**
* An interface for creating and locating nsIThread instances.
*/
[scriptable, uuid(487c10bf-0a22-4148-89fa-790d819dd559)]
[scriptable, uuid(2bbbc38c-cf96-4099-ba6b-f6a44d8b014c)]
interface nsIThreadManager : nsISupports
{
/**
* Default number of bytes reserved for a thread's stack, if no stack size
* is specified in newThread(). 0 means use platform default.
*/
const unsigned long DEFAULT_STACK_SIZE = 0;
/**
* Create a new thread (a global, user PRThread).
*
* @param creationFlags
* Reserved for future use. Pass 0.
* @param stackSize
* Number of bytes to reserve for the thread's stack.
*
* @returns
* The newly created nsIThread object.
*/
nsIThread newThread(in unsigned long creationFlags);
nsIThread newThread(in unsigned long creationFlags, [optional] in unsigned long stackSize);
/**
* Get the nsIThread object (if any) corresponding to the given PRThread.
* This method returns null if there is no corresponding nsIThread.

View File

@ -312,6 +312,20 @@ nsThread::nsThread()
, mPriority(PRIORITY_NORMAL)
, mThread(nsnull)
, mRunningEvent(0)
, mStackSize(0)
, mShutdownContext(nsnull)
, mShutdownRequired(PR_FALSE)
, mEventsAreDoomed(PR_FALSE)
{
}
nsThread::nsThread(PRUint32 aStackSize)
: mLock("nsThread.mLock")
, mEvents(&mEventsRoot)
, mPriority(PRIORITY_NORMAL)
, mThread(nsnull)
, mRunningEvent(0)
, mStackSize(aStackSize)
, mShutdownContext(nsnull)
, mShutdownRequired(PR_FALSE)
, mEventsAreDoomed(PR_FALSE)
@ -336,7 +350,7 @@ nsThread::Init()
// ThreadFunc is responsible for setting mThread
PRThread *thr = PR_CreateThread(PR_USER_THREAD, ThreadFunc, this,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_JOINABLE_THREAD, 0);
PR_JOINABLE_THREAD, mStackSize);
if (!thr) {
NS_RELEASE_THIS();
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -58,6 +58,7 @@ public:
NS_DECL_NSISUPPORTSPRIORITY
nsThread();
nsThread(PRUint32 aStackSize);
// Initialize this as a wrapper for a new PRThread.
nsresult Init();
@ -138,6 +139,7 @@ private:
PRInt32 mPriority;
PRThread *mThread;
PRUint32 mRunningEvent; // counter
PRUint32 mStackSize;
struct nsThreadShutdownContext *mShutdownContext;

View File

@ -232,12 +232,14 @@ nsThreadManager::GetCurrentThread()
}
NS_IMETHODIMP
nsThreadManager::NewThread(PRUint32 creationFlags, nsIThread **result)
nsThreadManager::NewThread(PRUint32 creationFlags,
PRUint32 stackSize,
nsIThread **result)
{
// No new threads during Shutdown
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
nsThread *thr = new nsThread();
nsThread *thr = new nsThread(stackSize);
if (!thr)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(thr);

View File

@ -110,7 +110,9 @@ nsThreadPool::PutEvent(nsIRunnable *event)
return NS_OK;
nsCOMPtr<nsIThread> thread;
nsThreadManager::get()->NewThread(0, getter_AddRefs(thread));
nsThreadManager::get()->NewThread(0,
nsIThreadManager::DEFAULT_STACK_SIZE,
getter_AddRefs(thread));
NS_ENSURE_STATE(thread);
PRBool killThread = PR_FALSE;