Merge mozilla-central and mozilla-inbound

This commit is contained in:
Matt Brubeck 2011-12-01 11:17:54 -08:00
commit c3b764df03
52 changed files with 660 additions and 357 deletions

View File

@ -122,13 +122,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
mDocument->FireDelayedAccessibleEvent(textInsertEvent);
}
// Fire value change event.
if (mHyperText->Role() == nsIAccessibleRole::ROLE_ENTRY) {
nsRefPtr<AccEvent> valueChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, mHyperText,
eAutoDetect, AccEvent::eRemoveDupes);
mDocument->FireDelayedAccessibleEvent(valueChangeEvent);
}
mDocument->MaybeNotifyOfValueChange(mHyperText);
// Update the text.
mTextLeaf->SetText(aNewText);
@ -173,12 +167,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
for (PRInt32 idx = events.Length() - 1; idx >= 0; idx--)
mDocument->FireDelayedAccessibleEvent(events[idx]);
if (mHyperText->Role() == nsIAccessibleRole::ROLE_ENTRY) {
nsRefPtr<AccEvent> valueChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, mHyperText,
eAutoDetect, AccEvent::eRemoveDupes);
mDocument->FireDelayedAccessibleEvent(valueChangeEvent);
}
mDocument->MaybeNotifyOfValueChange(mHyperText);
// Update the text.
mTextLeaf->SetText(aNewText);

View File

@ -1851,11 +1851,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode,
}
}
// Fire value change event.
if (aContainer->Role() == nsIAccessibleRole::ROLE_ENTRY) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
aContainer->GetNode());
}
MaybeNotifyOfValueChange(aContainer);
// Fire reorder event so the MSAA clients know the children have changed. Also
// the event is used internally by MSAA layer.

View File

@ -204,6 +204,21 @@ public:
*/
nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
/**
* Fire value change event on the given accessible if applicable.
*/
inline void MaybeNotifyOfValueChange(nsAccessible* aAccessible)
{
PRUint32 role = aAccessible->Role();
if (role == nsIAccessibleRole::ROLE_ENTRY ||
role == nsIAccessibleRole::ROLE_COMBOBOX) {
nsRefPtr<AccEvent> valueChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
eAutoDetect, AccEvent::eRemoveDupes);
FireDelayedAccessibleEvent(valueChangeEvent);
}
}
/**
* Get/set the anchor jump.
*/

View File

@ -312,22 +312,25 @@ STDMETHODIMP nsAccessibleWrap::get_accValue(
{
__try {
*pszValue = NULL;
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
if (xpAccessible) {
nsAutoString value;
if (NS_FAILED(xpAccessible->GetValue(value)))
return E_FAIL;
// see bug 438784: Need to expose URL on doc's value attribute.
// For this, reverting part of fix for bug 425693 to make this MSAA method
// behave IAccessible2-style.
if (value.IsEmpty())
return S_FALSE;
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
if (!xpAccessible || xpAccessible->IsDefunct())
return E_FAIL;
nsAutoString value;
if (NS_FAILED(xpAccessible->GetValue(value)))
return E_FAIL;
// See bug 438784: need to expose URL on doc's value attribute. For this,
// reverting part of fix for bug 425693 to make this MSAA method behave
// IAccessible2-style.
if (value.IsEmpty())
return S_FALSE;
*pszValue = ::SysAllocStringLen(value.get(), value.Length());
if (!*pszValue)
return E_OUTOFMEMORY;
*pszValue = ::SysAllocStringLen(value.get(), value.Length());
if (!*pszValue)
return E_OUTOFMEMORY;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

View File

@ -58,6 +58,27 @@
}
}
function changeInputValue(aID, aValue)
{
this.DOMNode = getNode(aID);
this.invoke = function changeInputValue_invoke()
{
this.DOMNode.value = aValue;
}
this.check = function changeInputValue_check()
{
var acc = getAccessible(this.DOMNode);
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
}
this.getID = function changeInputValue_getID()
{
return prettyName(aID) + " value changed";
}
}
function doTests()
{
// Test initial values
@ -74,6 +95,8 @@
gQueue.push(new changeValue("slider_vnvt", "3", "sweet"));
gQueue.push(new changeValue("scrollbar", "6", undefined));
gQueue.push(new changeInputValue("combobox", "hello"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -94,6 +117,11 @@
title="We dont expose new aria role 'scrollbar' and property aria-orientation">
Mozilla Bug 529289
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=703202"
title="ARIA comboboxes don't fire value change events">
Mozilla Bug 703202
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -114,5 +142,8 @@
<!-- ARIA scrollbar -->
<div id="scrollbar" role="scrollbar" aria-valuenow="5"
aria-valuemin="0" aria-valuemax="1000">slider</div>
<!-- ARIA combobox -->
<input id="combobox" role="combobox" aria-autocomplete="inline">
</body>
</html>

View File

@ -39,11 +39,9 @@ mk_add_options MOZ_UNIFY_BDATE=1
mk_add_options MOZ_POSTFLIGHT_ALL+=build/macosx/universal/flight.mk
# Note, the version (10) is used by libffi's configure.
ac_add_app_options ppc --target=powerpc-apple-darwin10
ac_add_app_options i386 --target=i386-apple-darwin10
ac_add_app_options x86_64 --target=x86_64-apple-darwin10
ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_app_options i386 --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
ac_add_app_options x86_64 --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
@ -51,7 +49,7 @@ ac_add_app_options x86_64 --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
# problem, because the variables it affects only need to be set for
# configure.
if test -n "$MOZ_BUILD_APP" ; then
if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "ppc" -o "$MOZ_BUILD_APP" = "x86_64"; then
if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "x86_64"; then
TARGET_CPU=$MOZ_BUILD_APP
if test -z "$CC" ; then
@ -68,9 +66,6 @@ if test "$MOZ_BUILD_APP" = "i386" -o "$MOZ_BUILD_APP" = "ppc" -o "$MOZ_BUILD_AP
HOST_CXX=$CXX
NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
if test "$NATIVE_CPU" = "powerpc" ; then
NATIVE_CPU=ppc
fi
# It's not strictly necessary to specify -arch during native builds, but it
# makes the merged about:buildconfig easier to follow, and it reduces

View File

@ -2671,8 +2671,8 @@ ia64*-hpux*)
fi
if test -n "$GNU_CC"; then
CFLAGS="$CFLAGS -mstackrealign"
CXXFLAGS="$CXXFLAGS -mstackrealign"
CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
else
AC_DEFINE(HAVE_STDCALL)
fi

View File

@ -1971,6 +1971,10 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
{
NS_ASSERTION(mLoadingSrc, "mLoadingSrc set up");
nsCAutoString src;
GetCurrentSpec(src);
printf("*** nsHTMLElement::FinishDecoderSetup() mDecoder=%p src=%s\n",
aDecoder, src.get());
mDecoder = aDecoder;
AddMediaElementToURITable();

View File

@ -751,6 +751,8 @@ private:
void
nsMediaChannelStream::CacheClientNotifyDataEnded(nsresult aStatus)
{
printf("*** nsMediaChannelStream::CacheClientNotifyDataEnded() mDecoder=%p\n", mDecoder);
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
// NOTE: this can be called with the media cache lock held, so don't
// block or do anything which might try to acquire a lock!
@ -764,6 +766,8 @@ nsMediaChannelStream::CacheClientSeek(PRInt64 aOffset, bool aResume)
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
printf("*** nsMediaChannelStream::CacheClientSeek() mDecoder=%p\n", mDecoder);
CloseChannel();
if (aResume) {
@ -783,6 +787,8 @@ nsMediaChannelStream::CacheClientSeek(PRInt64 aOffset, bool aResume)
nsresult
nsMediaChannelStream::CacheClientSuspend()
{
printf("*** nsMediaChannelStream::CacheClientSuspend() mDecoder=%p\n", mDecoder);
Suspend(false);
mDecoder->NotifySuspendedStatusChanged();
@ -792,6 +798,8 @@ nsMediaChannelStream::CacheClientSuspend()
nsresult
nsMediaChannelStream::CacheClientResume()
{
printf("*** nsMediaChannelStream::CacheClientResume() mDecoder=%p\n", mDecoder);
Resume();
mDecoder->NotifySuspendedStatusChanged();

View File

@ -90,28 +90,16 @@ Navigator::Init()
false);
}
Navigator::Navigator(nsIDocShell* aDocShell)
: mDocShell(aDocShell)
Navigator::Navigator(nsPIDOMWindow* aWindow)
: mWindow(do_GetWeakReference(aWindow))
{
NS_ASSERTION(aWindow->IsInnerWindow(),
"Navigator must get an inner window!");
}
Navigator::~Navigator()
{
if (mMimeTypes) {
mMimeTypes->Invalidate();
}
if (mPlugins) {
mPlugins->Invalidate();
}
if (mBatteryManager) {
mBatteryManager->Shutdown();
}
if (mSmsManager) {
mSmsManager->Shutdown();
}
Invalidate();
}
NS_INTERFACE_MAP_BEGIN(Navigator)
@ -129,12 +117,13 @@ NS_IMPL_ADDREF(Navigator)
NS_IMPL_RELEASE(Navigator)
void
Navigator::SetDocShell(nsIDocShell* aDocShell)
Navigator::Invalidate()
{
mDocShell = aDocShell;
mWindow = nsnull;
if (mPlugins) {
mPlugins->SetDocShell(aDocShell);
mPlugins->Invalidate();
mPlugins = nsnull;
}
// If there is a page transition, make sure delete the geolocation object.
@ -159,6 +148,15 @@ Navigator::SetDocShell(nsIDocShell* aDocShell)
}
}
nsPIDOMWindow *
Navigator::GetWindow()
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
return win;
}
//*****************************************************************************
// Navigator::nsIDOMNavigator
//*****************************************************************************
@ -366,7 +364,9 @@ NS_IMETHODIMP
Navigator::GetPlugins(nsIDOMPluginArray** aPlugins)
{
if (!mPlugins) {
mPlugins = new nsPluginArray(this, mDocShell);
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
mPlugins = new nsPluginArray(this, win ? win->GetDocShell() : nsnull);
}
NS_ADDREF(*aPlugins = mPlugins);
@ -388,7 +388,13 @@ Navigator::GetCookieEnabled(bool* aCookieEnabled)
// Check whether an exception overrides the global cookie behavior
// Note that the code for getting the URI here matches that in
// nsHTMLDocument::SetCookie.
nsCOMPtr<nsIDocument> doc = do_GetInterface(mDocShell);
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
if (!win || !win->GetDocShell()) {
return NS_OK;
}
nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());
if (!doc) {
return NS_OK;
}
@ -508,50 +514,11 @@ Navigator::JavaEnabled(bool* aReturn)
}
void
Navigator::LoadingNewDocument()
{
// Release these so that they will be recreated for the
// new document (if requested). The plugins or mime types
// arrays may have changed. See bug 150087.
if (mMimeTypes) {
mMimeTypes->Invalidate();
mMimeTypes = nsnull;
}
if (mPlugins) {
mPlugins->Invalidate();
mPlugins = nsnull;
}
if (mGeolocation) {
mGeolocation->Shutdown();
mGeolocation = nsnull;
}
if (mNotification) {
mNotification->Shutdown();
mNotification = nsnull;
}
if (mBatteryManager) {
mBatteryManager->Shutdown();
mBatteryManager = nsnull;
}
if (mSmsManager) {
mSmsManager->Shutdown();
mSmsManager = nsnull;
}
}
nsresult
Navigator::RefreshMIMEArray()
{
if (mMimeTypes) {
return mMimeTypes->Refresh();
mMimeTypes->Refresh();
}
return NS_OK;
}
bool
@ -569,7 +536,9 @@ Navigator::RegisterContentHandler(const nsAString& aMIMEType,
const nsAString& aURI,
const nsAString& aTitle)
{
if (!mDocShell) {
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
return NS_OK;
}
@ -579,13 +548,8 @@ Navigator::RegisterContentHandler(const nsAString& aMIMEType,
return NS_OK;
}
nsCOMPtr<nsIDOMWindow> contentDOMWindow = do_GetInterface(mDocShell);
if (!contentDOMWindow) {
return NS_OK;
}
return registrar->RegisterContentHandler(aMIMEType, aURI, aTitle,
contentDOMWindow);
win->GetOuterWindow());
}
NS_IMETHODIMP
@ -593,7 +557,9 @@ Navigator::RegisterProtocolHandler(const nsAString& aProtocol,
const nsAString& aURI,
const nsAString& aTitle)
{
if (!mDocShell) {
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
return NS_OK;
}
@ -603,13 +569,8 @@ Navigator::RegisterProtocolHandler(const nsAString& aProtocol,
return NS_OK;
}
nsCOMPtr<nsIDOMWindow> contentDOMWindow = do_GetInterface(mDocShell);
if (!contentDOMWindow) {
return NS_OK;
}
return registrar->RegisterProtocolHandler(aProtocol, aURI, aTitle,
contentDOMWindow);
win->GetOuterWindow());
}
NS_IMETHODIMP
@ -702,12 +663,9 @@ NS_IMETHODIMP Navigator::GetGeolocation(nsIDOMGeoGeolocation** _retval)
return NS_OK;
}
if (!mDocShell) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
nsCOMPtr<nsIDOMWindow> contentDOMWindow = do_GetInterface(mDocShell);
if (!contentDOMWindow) {
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
return NS_ERROR_FAILURE;
}
@ -716,7 +674,7 @@ NS_IMETHODIMP Navigator::GetGeolocation(nsIDOMGeoGeolocation** _retval)
return NS_ERROR_FAILURE;
}
if (NS_FAILED(mGeolocation->Init(contentDOMWindow))) {
if (NS_FAILED(mGeolocation->Init(win->GetOuterWindow()))) {
mGeolocation = nsnull;
return NS_ERROR_FAILURE;
}
@ -739,20 +697,14 @@ NS_IMETHODIMP Navigator::GetMozNotification(nsIDOMDesktopNotificationCenter** aR
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> document = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
nsIScriptGlobalObject* sgo = document->GetScopeObject();
NS_ENSURE_TRUE(sgo, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(win));
NS_ENSURE_TRUE(sgo && win->GetDocShell(), NS_ERROR_FAILURE);
nsIScriptContext* scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, NS_ERROR_FAILURE);
mNotification = new nsDesktopNotificationCenter(window->GetCurrentInnerWindow(),
scx);
mNotification = new nsDesktopNotificationCenter(win, scx);
NS_ADDREF(*aRetVal = mNotification);
return NS_OK;
@ -768,20 +720,15 @@ Navigator::GetMozBattery(nsIDOMMozBatteryManager** aBattery)
if (!mBatteryManager) {
*aBattery = nsnull;
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(window, NS_OK);
nsCOMPtr<nsIDocument> document = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(document, NS_OK);
nsIScriptGlobalObject* sgo = document->GetScopeObject();
NS_ENSURE_TRUE(sgo, NS_OK);
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(win));
NS_ENSURE_TRUE(sgo && win->GetDocShell(), NS_OK);
nsIScriptContext* scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, NS_OK);
mBatteryManager = new battery::BatteryManager();
mBatteryManager->Init(window->GetCurrentInnerWindow(), scx);
mBatteryManager->Init(win, scx);
}
NS_ADDREF(*aBattery = mBatteryManager);
@ -809,7 +756,13 @@ Navigator::IsSmsAllowed() const
// For local files, "file://" must be listed.
// For data-urls: "moz-nullprincipal:".
// Chrome files also have to be whitelisted for the moment.
nsCOMPtr<nsIDocument> doc = do_GetInterface(mDocShell);
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
if (!win || !win->GetDocShell()) {
return defaultSmsPermission;
}
nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());
if (!doc) {
return defaultSmsPermission;
}
@ -864,20 +817,17 @@ Navigator::GetMozSms(nsIDOMMozSmsManager** aSmsManager)
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(window, NS_OK);
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
nsCOMPtr<nsIDocument> document = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(document, NS_OK);
nsIScriptGlobalObject* sgo = document->GetScopeObject();
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
NS_ENSURE_TRUE(sgo, NS_OK);
nsIScriptContext* scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, NS_OK);
mSmsManager = new sms::SmsManager();
mSmsManager->Init(window->GetCurrentInnerWindow(), scx);
mSmsManager->Init(window, scx);
}
NS_ADDREF(*aSmsManager = mSmsManager);

View File

@ -50,12 +50,13 @@
#include "nsIDOMNavigatorBattery.h"
#include "nsIDOMNavigatorSms.h"
#include "nsAutoPtr.h"
#include "nsWeakReference.h"
class nsPluginArray;
class nsMimeTypeArray;
class nsGeolocation;
class nsDesktopNotificationCenter;
class nsIDocShell;
class nsPIDOMWindow;
//*****************************************************************************
// Navigator: Script "navigator" object
@ -80,7 +81,7 @@ class Navigator : public nsIDOMNavigator,
public nsIDOMMozNavigatorSms
{
public:
Navigator(nsIDocShell *aDocShell);
Navigator(nsPIDOMWindow *aInnerWindow);
virtual ~Navigator();
NS_DECL_ISUPPORTS
@ -93,14 +94,10 @@ public:
static void Init();
void SetDocShell(nsIDocShell *aDocShell);
nsIDocShell *GetDocShell()
{
return mDocShell;
}
void Invalidate();
nsPIDOMWindow *GetWindow();
void LoadingNewDocument();
nsresult RefreshMIMEArray();
void RefreshMIMEArray();
static bool HasDesktopNotificationSupport();
@ -118,7 +115,7 @@ private:
nsRefPtr<nsDesktopNotificationCenter> mNotification;
nsRefPtr<battery::BatteryManager> mBatteryManager;
nsRefPtr<sms::SmsManager> mSmsManager;
nsIDocShell* mDocShell; // weak reference
nsWeakPtr mWindow;
};
} // namespace dom

View File

@ -6822,6 +6822,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
&v, getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);
// Hold on to the navigator object as a global property so we
// don't need to worry about losing expando properties etc.
if (!::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
JSPROP_READONLY | JSPROP_PERMANENT |
JSPROP_ENUMERATE)) {
@ -7154,11 +7156,9 @@ nsresult
nsNavigatorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj)
{
// window.navigator is persisted across document transitions if
// we're loading a page from the same origin. Because of that we
// need to parent the navigator wrapper at the outer window to avoid
// holding on to the inner window where the navigator was initially
// created too long.
// window.navigator can hold expandos and thus we need to only ever
// create one wrapper per navigator object so that expandos are
// visible independently of who's looking it up.
*parentObj = globalObj;
nsCOMPtr<nsIDOMNavigator> safeNav(do_QueryInterface(nativeObj));
@ -7170,20 +7170,17 @@ nsNavigatorSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
}
Navigator *nav = static_cast<Navigator*>(safeNav.get());
nsIDocShell *ds = nav->GetDocShell();
if (!ds) {
nsGlobalWindow *win = static_cast<nsGlobalWindow*>(nav->GetWindow());
if (!win) {
NS_WARNING("Refusing to create a navigator in the wrong scope");
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIScriptGlobalObject> sgo = do_GetInterface(ds);
JSObject *global = win->GetGlobalJSObject();
if (sgo) {
JSObject *global = sgo->GetGlobalJSObject();
if (global) {
*parentObj = global;
}
if (global) {
*parentObj = global;
}
return NS_OK;

View File

@ -1272,6 +1272,11 @@ nsGlobalWindow::FreeInnerObjects(bool aClearScope)
{
NS_ASSERTION(IsInnerWindow(), "Don't free inner objects on an outer window");
// Make sure that this is called before we null out the document and
// other members that the window destroyed observers could
// re-create.
NotifyDOMWindowDestroyed(this);
// Kill all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
@ -1296,6 +1301,11 @@ nsGlobalWindow::FreeInnerObjects(bool aClearScope)
mLocation = nsnull;
mHistory = nsnull;
if (mNavigator) {
mNavigator->Invalidate();
mNavigator = nsnull;
}
if (mDocument) {
NS_ASSERTION(mDoc, "Why is mDoc null?");
@ -1308,9 +1318,6 @@ nsGlobalWindow::FreeInnerObjects(bool aClearScope)
nsCycleCollector_DEBUG_shouldBeFreed(nsCOMPtr<nsISupports>(do_QueryInterface(mDocument)));
#endif
// Make sure that this is called before we null out the document.
NotifyDOMWindowDestroyed(this);
// Remove our reference to the document and the document principal.
mDocument = nsnull;
mDoc = nsnull;
@ -1733,7 +1740,6 @@ public:
WindowStateHolder(nsGlobalWindow *aWindow,
nsIXPConnectJSObjectHolder *aHolder,
Navigator *aNavigator,
nsIXPConnectJSObjectHolder *aOuterProto,
nsIXPConnectJSObjectHolder *aOuterRealProto);
@ -1741,7 +1747,6 @@ public:
nsIXPConnectJSObjectHolder *GetInnerWindowHolder()
{ return mInnerWindowHolder; }
Navigator* GetNavigator() { return mNavigator; }
nsIXPConnectJSObjectHolder* GetOuterProto() { return mOuterProto; }
nsIXPConnectJSObjectHolder* GetOuterRealProto() { return mOuterRealProto; }
@ -1750,7 +1755,6 @@ public:
mInnerWindow = nsnull;
mInnerWindowHolder = nsnull;
mNavigator = nsnull;
mOuterProto = nsnull;
mOuterRealProto = nsnull;
}
@ -1762,7 +1766,6 @@ protected:
// We hold onto this to make sure the inner window doesn't go away. The outer
// window ends up recalculating it anyway.
nsCOMPtr<nsIXPConnectJSObjectHolder> mInnerWindowHolder;
nsRefPtr<Navigator> mNavigator;
nsCOMPtr<nsIXPConnectJSObjectHolder> mOuterProto;
nsCOMPtr<nsIXPConnectJSObjectHolder> mOuterRealProto;
};
@ -1771,11 +1774,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(WindowStateHolder, WINDOWSTATEHOLDER_IID)
WindowStateHolder::WindowStateHolder(nsGlobalWindow *aWindow,
nsIXPConnectJSObjectHolder *aHolder,
Navigator *aNavigator,
nsIXPConnectJSObjectHolder *aOuterProto,
nsIXPConnectJSObjectHolder *aOuterRealProto)
: mInnerWindow(aWindow),
mNavigator(aNavigator),
mOuterProto(aOuterProto),
mOuterRealProto(aOuterRealProto)
{
@ -1930,32 +1931,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsresult rv = NS_OK;
// Drop our reference to the navigator object unless we're reusing
// the existing inner window or the new document is from the same
// origin as the old document.
if (!reUseInnerWindow && mNavigator && oldPrincipal) {
bool equal;
rv = oldPrincipal->Equals(aDocument->NodePrincipal(), &equal);
if (NS_FAILED(rv) || !equal) {
// Different origins. Release the navigator object so it gets
// recreated for the new document. The plugins or mime types
// arrays may have changed. See bug 150087.
mNavigator->SetDocShell(nsnull);
mNavigator = nsnull;
}
}
if (mNavigator && aDocument != oldDoc) {
// We didn't drop our reference to our old navigator object and
// we're loading a new document. Notify the navigator object about
// the new document load so that it can make sure it is ready for
// the new document.
mNavigator->LoadingNewDocument();
}
// Set mDocument even if this is an outer window to avoid
// having to *always* reach into the inner window to find the
// document.
@ -1973,8 +1948,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsRefPtr<nsGlobalWindow> newInnerWindow;
bool thisChrome = IsChromeWindow();
nsCOMPtr<nsIXPConnectJSObjectHolder> navigatorHolder;
jsval nav;
bool isChrome = false;
@ -1994,11 +1967,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// inner scope.
mContext->ClearScope(mJSObject, false);
// This code should not be called during shutdown any more (now that
// we don't ever call SetNewDocument(nsnull), so no need to null
// check xpc here.
nsIXPConnect *xpc = nsContentUtils::XPConnect();
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
if (reUseInnerWindow) {
// We're reusing the current inner window.
NS_ASSERTION(!currentInner->IsFrozen(),
@ -2023,15 +1991,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
mInnerWindowHolder = wsh->GetInnerWindowHolder();
NS_ASSERTION(newInnerWindow, "Got a state without inner window");
// These assignments addref.
mNavigator = wsh->GetNavigator();
if (mNavigator) {
// Update mNavigator's docshell pointer now.
mNavigator->SetDocShell(mDocShell);
mNavigator->LoadingNewDocument();
}
} else if (thisChrome) {
newInnerWindow = new nsGlobalChromeWindow(this);
isChrome = true;
@ -2041,21 +2000,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
newInnerWindow = new nsGlobalWindow(this);
}
if (currentInner && currentInner->mJSObject) {
if (mNavigator && !aState) {
// Hold on to the navigator wrapper so that we can set
// window.navigator in the new window to point to the same
// object (assuming we didn't change origins etc). See bug
// 163645 for more on why we need this.
nsIDOMNavigator* navigator =
static_cast<nsIDOMNavigator*>(mNavigator.get());
nsContentUtils::WrapNative(cx, currentInner->mJSObject, navigator,
&NS_GET_IID(nsIDOMNavigator), &nav,
getter_AddRefs(navigatorHolder));
}
}
if (!aState) {
// This is redundant if we're restoring from a previous inner window.
nsIScriptGlobalObject *sgo =
@ -2289,33 +2233,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// Initialize DOM classes etc on the inner window.
rv = mContext->InitClasses(newInnerWindow->mJSObject);
NS_ENSURE_SUCCESS(rv, rv);
if (navigatorHolder) {
JS_ASSERT(JSVAL_IS_OBJECT(nav));
if (js::GetObjectCompartment(JSVAL_TO_OBJECT(nav)) ==
js::GetObjectCompartment(newInnerWindow->mJSObject)) {
// Restore window.navigator onto the new inner window.
::JS_DefineProperty(cx, newInnerWindow->mJSObject, "navigator",
nav, nsnull, nsnull,
JSPROP_ENUMERATE | JSPROP_PERMANENT |
JSPROP_READONLY);
// The Navigator's prototype object keeps a reference to the
// window in which it was first created and can thus cause that
// window to stay alive for too long. Reparenting it here allows
// the window to be collected sooner.
nsIDOMNavigator* navigator =
static_cast<nsIDOMNavigator*>(mNavigator);
xpc->
ReparentWrappedNativeIfFound(cx, JSVAL_TO_OBJECT(nav),
newInnerWindow->mJSObject,
navigator,
getter_AddRefs(navigatorHolder));
}
}
}
if (mArguments) {
@ -2502,8 +2419,8 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
mDocShell = aDocShell; // Weak Reference
if (mNavigator)
mNavigator->SetDocShell(aDocShell);
NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
if (mFrames)
mFrames->SetDocShell(aDocShell);
if (mScreen)
@ -2999,12 +2916,12 @@ nsGlobalWindow::GetSelf(nsIDOMWindow** aWindow)
NS_IMETHODIMP
nsGlobalWindow::GetNavigator(nsIDOMNavigator** aNavigator)
{
FORWARD_TO_OUTER(GetNavigator, (aNavigator), NS_ERROR_NOT_INITIALIZED);
FORWARD_TO_INNER(GetNavigator, (aNavigator), NS_ERROR_NOT_INITIALIZED);
*aNavigator = nsnull;
if (!mNavigator) {
mNavigator = new Navigator(mDocShell);
mNavigator = new Navigator(this);
}
NS_ADDREF(*aNavigator = mNavigator);
@ -9960,7 +9877,6 @@ nsGlobalWindow::SaveWindowState(nsISupports **aState)
nsCOMPtr<nsISupports> state = new WindowStateHolder(inner,
mInnerWindowHolder,
mNavigator,
proto,
realProtoHolder);
NS_ENSURE_TRUE(state, NS_ERROR_OUT_OF_MEMORY);

View File

@ -210,20 +210,23 @@ nsMimeTypeArray::NamedItem(const nsAString& aName, nsIDOMMimeType** aReturn)
return rv;
}
void nsMimeTypeArray::Clear()
void
nsMimeTypeArray::Clear()
{
mInited = false;
mMimeTypeArray.Clear();
mPluginMimeTypeCount = 0;
}
nsresult nsMimeTypeArray::Refresh()
void
nsMimeTypeArray::Refresh()
{
Clear();
return GetMimeTypes();
GetMimeTypes();
}
nsresult nsMimeTypeArray::GetMimeTypes()
nsresult
nsMimeTypeArray::GetMimeTypes()
{
NS_PRECONDITION(!mInited && mPluginMimeTypeCount==0,
"already initialized");

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMIMETYPEARRAY
nsresult Refresh();
void Refresh();
nsIDOMMimeType* GetItemAt(PRUint32 aIndex, nsresult* aResult);
nsIDOMMimeType* GetNamedItem(const nsAString& aName, nsresult* aResult);

View File

@ -55,13 +55,12 @@ using namespace mozilla::dom;
nsPluginArray::nsPluginArray(Navigator* navigator,
nsIDocShell *aDocShell)
: mNavigator(navigator),
mPluginHost(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID)),
mPluginCount(0),
mPluginArray(nsnull),
mDocShell(do_GetWeakReference(aDocShell))
{
nsresult rv;
mNavigator = navigator; // don't ADDREF here, needed for parent of script object.
mPluginHost = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID, &rv);
mPluginCount = 0;
mPluginArray = nsnull;
mDocShell = aDocShell;
}
nsPluginArray::~nsPluginArray()
@ -101,8 +100,10 @@ bool
nsPluginArray::AllowPlugins()
{
bool allowPlugins = false;
if (mDocShell)
if (NS_FAILED(mDocShell->GetAllowPlugins(&allowPlugins)))
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell);
if (docShell)
if (NS_FAILED(docShell->GetAllowPlugins(&allowPlugins)))
allowPlugins = false;
return allowPlugins;
@ -193,12 +194,6 @@ nsPluginArray::GetPluginHost(nsIPluginHost** aPluginHost)
return rv;
}
void
nsPluginArray::SetDocShell(nsIDocShell *aDocShell)
{
mDocShell = aDocShell;
}
void
nsPluginArray::Invalidate()
{
@ -232,7 +227,7 @@ nsPluginArray::Refresh(bool aReloadDocuments)
if(pluginsNotChanged)
return res;
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mDocShell);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryReferent(mDocShell);
if (mPluginArray != nsnull) {
for (PRUint32 i = 0; i < mPluginCount; i++)

View File

@ -43,6 +43,7 @@
#include "nsIDOMPlugin.h"
#include "nsIPluginHost.h"
#include "nsIURL.h"
#include "nsWeakReference.h"
namespace mozilla {
namespace dom {
@ -92,7 +93,6 @@ private:
bool AllowPlugins();
public:
void SetDocShell(nsIDocShell *aDocShell);
void Invalidate();
protected:
@ -100,7 +100,7 @@ protected:
nsCOMPtr<nsIPluginHost> mPluginHost;
PRUint32 mPluginCount;
nsIDOMPlugin** mPluginArray;
nsIDocShell* mDocShell; // weak reference
nsWeakPtr mDocShell;
};
class nsPluginElement : public nsIDOMPlugin

View File

@ -87,7 +87,7 @@ NS_IMPL_RELEASE_INHERITED(BatteryManager, nsDOMEventTargetWrapperCache)
BatteryManager::BatteryManager()
: mLevel(kDefaultLevel)
, mCharging(kDefaultCharging)
, mRemainingTime(kUnknownRemainingTime)
, mRemainingTime(kDefaultRemainingTime)
{
}
@ -191,6 +191,14 @@ BatteryManager::UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInf
mLevel = aBatteryInfo.level();
mCharging = aBatteryInfo.charging();
mRemainingTime = aBatteryInfo.remainingTime();
// Add some guards to make sure the values are coherent.
if (mLevel == 1.0 && mCharging == true &&
mRemainingTime != kDefaultRemainingTime) {
mRemainingTime = kDefaultRemainingTime;
NS_ERROR("Battery API: When charging and level at 1.0, remaining time "
"should be 0. Please fix your backend!");
}
}
void

View File

@ -48,6 +48,7 @@ namespace battery {
static const double kDefaultLevel = 1.0;
static const bool kDefaultCharging = true;
static const double kDefaultRemainingTime = 0;
static const double kUnknownRemainingTime = -1;
} // namespace battery

View File

@ -26,7 +26,7 @@ var battery = navigator.mozBattery;
is(battery.level, 1.0, "Default battery level should be 1.0");
is(battery.charging, true, "Default charging value should be true");
is(battery.dischargingTime, Infinity, "Default dischargingTime should be Inifinity");
is(battery.chargingTime, Infinity, "Default chargingTime should be Inifinity");
is(battery.chargingTime, 0, "Default chargingTime should be 0");
</script>
</pre>

View File

@ -85,9 +85,7 @@ doubleVariantToIdentifier(NPVariant variant)
}
/*
* Parse a color in hex format, like AARRGGBB
* If the string is short, portions to the left are assumed omitted.
* R G B default to 0, A defaults to 0xFF
* Parse a color in hex format, #AARRGGBB or AARRGGBB.
*/
PRUint32
parseHexColor(const char* color, int len)
@ -95,19 +93,14 @@ parseHexColor(const char* color, int len)
PRUint8 bgra[4] = { 0, 0, 0, 0xFF };
int i = 0;
assert(len == 9 || len == 8);
// start from the right and work to the left
while (len > 0) {
while (len >= 2) { // we have at least #AA or AA left.
char byte[3];
if (len > 1) {
// parse two hex digits
byte[0] = color[len - 2];
byte[1] = color[len - 1];
}
else {
// only one digit left
byte[0] = '0';
byte[1] = color[len - 1];
}
// parse two hex digits
byte[0] = color[len - 2];
byte[1] = color[len - 1];
byte[2] = '\0';
bgra[i] = (PRUint8)(strtoul(byte, NULL, 16) & 0xFF);

View File

@ -304,8 +304,6 @@ nsDOMStorageManager::Initialize()
// Used for temporary table flushing
rv = os->AddObserver(gStorageManager, "profile-before-change", true);
NS_ENSURE_SUCCESS(rv, rv);
rv = os->AddObserver(gStorageManager, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
NS_ENSURE_SUCCESS(rv, rv);
rv = os->AddObserver(gStorageManager, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC, true);
NS_ENSURE_SUCCESS(rv, rv);
@ -329,6 +327,13 @@ nsDOMStorageManager::Shutdown()
NS_IF_RELEASE(gStorageManager);
gStorageManager = nsnull;
ShutdownDB();
}
//static
void
nsDOMStorageManager::ShutdownDB()
{
delete DOMStorageImpl::gStorageDB;
DOMStorageImpl::gStorageDB = nsnull;
}
@ -484,13 +489,14 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
NS_ENSURE_SUCCESS(rv, rv);
DOMStorageImpl::gStorageDB->RemoveOwner(aceDomain, true);
} else if (!strcmp(aTopic, "profile-before-change") ||
!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
} else if (!strcmp(aTopic, "profile-before-change")) {
if (DOMStorageImpl::gStorageDB) {
DebugOnly<nsresult> rv =
DOMStorageImpl::gStorageDB->FlushAndDeleteTemporaryTables(true);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"DOMStorage: temporary table commit failed");
DOMStorageImpl::gStorageDB->Close();
nsDOMStorageManager::ShutdownDB();
}
} else if (!strcmp(aTopic, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC)) {
if (DOMStorageImpl::gStorageDB) {

View File

@ -129,6 +129,7 @@ public:
static nsresult Initialize();
static nsDOMStorageManager* GetInstance();
static void Shutdown();
static void ShutdownDB();
/**
* Checks whether there is any data waiting to be flushed from a temp table.

View File

@ -78,6 +78,13 @@ nsDOMStorageDBWrapper::~nsDOMStorageDBWrapper()
{
}
void
nsDOMStorageDBWrapper::Close()
{
mPersistentDB.Close();
mChromePersistentDB.Close();
}
nsresult
nsDOMStorageDBWrapper::Init()
{

View File

@ -89,6 +89,11 @@ public:
nsDOMStorageDBWrapper();
~nsDOMStorageDBWrapper();
/**
* Close the connections, finalizing all the cached statements.
*/
void Close();
nsresult
Init();

View File

@ -54,6 +54,8 @@
#include "mozIStorageFunction.h"
#include "nsNetUtil.h"
using namespace mozilla;
// Temporary tables for a storage scope will be flushed if found older
// then this time in seconds since the load
#define TEMP_TABLE_MAX_AGE (10) // seconds
@ -447,6 +449,28 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
return NS_OK;
}
void
nsDOMStoragePersistentDB::Close()
{
// Null the statements, this will finalize them.
mCopyToTempTableStatement = nsnull;
mCopyBackToDiskStatement = nsnull;
mDeleteTemporaryTableStatement = nsnull;
mGetAllKeysStatement = nsnull;
mGetKeyValueStatement = nsnull;
mInsertKeyStatement = nsnull;
mSetSecureStatement = nsnull;
mRemoveKeyStatement = nsnull;
mRemoveOwnerStatement = nsnull;
mRemoveStorageStatement = nsnull;
mRemoveAllStatement = nsnull;
mGetOfflineExcludedUsageStatement = nsnull;
mGetFullUsageStatement = nsnull;
DebugOnly<nsresult> rv = mConnection->Close();
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsresult
nsDOMStoragePersistentDB::EnsureLoadTemporaryTableForStorage(DOMStorageImpl* aStorage)
{

View File

@ -62,6 +62,12 @@ public:
nsresult
Init(const nsString& aDatabaseName);
/**
* Close the connection, finalizing all the cached statements.
*/
void
Close();
/**
* Retrieve a list of all the keys associated with a particular domain.
*/
@ -199,6 +205,7 @@ protected:
nsCOMPtr<mozIStorageStatement> mRemoveAllStatement;
nsCOMPtr<mozIStorageStatement> mGetOfflineExcludedUsageStatement;
nsCOMPtr<mozIStorageStatement> mGetFullUsageStatement;
// If you add an statement, remember to null in in Close.
nsCString mCachedOwner;
PRInt32 mCachedUsage;

View File

@ -100,10 +100,10 @@ function WifiGeoPositionProvider() {
gTestingEnabled = Services.prefs.getBoolPref("geo.wifi.testing");
} catch (e) {}
wifiService = null;
timer = null;
hasSeenWiFi = false;
started = false;
this.wifiService = null;
this.timer = null;
this.hasSeenWiFi = false;
this.started = false;
}
WifiGeoPositionProvider.prototype = {

View File

@ -55,13 +55,14 @@ public class GeckoBatteryManager
// dom/battery/Constants.h
private final static double kDefaultLevel = 1.0;
private final static boolean kDefaultCharging = true;
private final static double kDefaultRemainingTime = -1.0;
private final static double kUnknownRemainingTime = -1.0;
private static Date sLastLevelChange = new Date(0);
private static boolean sNotificationsEnabled = false;
private static double sLevel = kDefaultLevel;
private static boolean sCharging = kDefaultCharging;
private static double sRemainingTime = kUnknownRemainingTime;;
private static double sRemainingTime = kDefaultRemainingTime;;
@Override
public void onReceive(Context context, Intent intent) {
@ -135,7 +136,7 @@ public class GeckoBatteryManager
} else {
sLevel = kDefaultLevel;
sCharging = kDefaultCharging;
sRemainingTime = kUnknownRemainingTime;
sRemainingTime = kDefaultRemainingTime;
}
/*

View File

@ -199,7 +199,7 @@ UPowerClient::UPowerClient()
, mTrackedDevice(nsnull)
, mLevel(kDefaultLevel)
, mCharging(kDefaultCharging)
, mRemainingTime(kUnknownRemainingTime)
, mRemainingTime(kDefaultRemainingTime)
{
}
@ -279,7 +279,7 @@ UPowerClient::StopListening()
// We should now show the default values, not the latest we got.
mLevel = kDefaultLevel;
mCharging = kDefaultCharging;
mRemainingTime = kUnknownRemainingTime;
mRemainingTime = kDefaultRemainingTime;
}
void

View File

@ -2497,8 +2497,8 @@ ia64*-hpux*)
fi
if test -n "$GNU_CC"; then
CFLAGS="$CFLAGS -mstackrealign"
CXXFLAGS="$CXXFLAGS -mstackrealign"
CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
fi
MOZ_CHECK_HEADERS(mmintrin.h)

View File

@ -154,8 +154,6 @@ IsPermitted(const char *name, JSFlatString *prop, bool set)
NAME('L', "Location",
PROP('h', W("hash") W("href"))
PROP('r', R("replace")))
NAME('N', "Navigator",
PROP('p', RW("preference")))
NAME('W', "Window",
PROP('b', R("blur"))
PROP('c', R("close") R("closed"))

View File

@ -70,6 +70,7 @@ DIRS += build
ifdef ENABLE_TESTS
PARALLEL_DIRS += \
mathml/tests \
xul/test \
xul/base/test \
$(NULL)

View File

@ -84,12 +84,12 @@ nsMathMLmactionFrame::~nsMathMLmactionFrame()
// unregister us as a mouse event listener ...
// printf("maction:%p unregistering as mouse event listener ...\n", this);
if (mListener) {
mContent->RemoveEventListener(NS_LITERAL_STRING("click"), mListener,
false);
mContent->RemoveEventListener(NS_LITERAL_STRING("mouseover"), mListener,
false);
mContent->RemoveEventListener(NS_LITERAL_STRING("mouseout"), mListener,
false);
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("click"), mListener,
false);
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseover"), mListener,
false);
mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseout"), mListener,
false);
}
}
@ -228,12 +228,12 @@ nsMathMLmactionFrame::SetInitialChildList(ChildListID aListID,
// create mouse event listener and register it
mListener = new nsMathMLmactionFrame::MouseListener(this);
// printf("maction:%p registering as mouse event listener ...\n", this);
mContent->AddEventListener(NS_LITERAL_STRING("click"), mListener,
false, false);
mContent->AddEventListener(NS_LITERAL_STRING("mouseover"), mListener,
false, false);
mContent->AddEventListener(NS_LITERAL_STRING("mouseout"), mListener,
false, false);
mContent->AddSystemEventListener(NS_LITERAL_STRING("click"), mListener,
false, false);
mContent->AddSystemEventListener(NS_LITERAL_STRING("mouseover"), mListener,
false, false);
mContent->AddSystemEventListener(NS_LITERAL_STRING("mouseout"), mListener,
false, false);
}
return rv;
}

View File

@ -0,0 +1,52 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = layout/mathml/tests
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_bug706406.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=706406
-->
<head>
<title>Test for Bug 706406</title>
<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=706406">Mozilla Bug 706406</a>
<p id="display"></p>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<maction actiontype="toggle" id="maction">
<mn>1</mn>
<mn>2</mn>
</maction>
</math>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 706406 **/
function doTest()
{
function doStopPropagation(aEvent) {
aEvent.stopPropagation();
}
var maction = document.getElementById("maction");
synthesizeMouseAtCenter(maction, {});
is(maction.getAttribute("selection"), "2",
"maction's selection attribute isn't 2 by first click");
synthesizeMouseAtCenter(maction, {});
is(maction.getAttribute("selection"), "1",
"maction's selection attribute isn't 1 by second click");
window.addEventListener("mousedown", doStopPropagation, true);
window.addEventListener("mouseup", doStopPropagation, true);
window.addEventListener("click", doStopPropagation, true);
synthesizeMouseAtCenter(maction, {});
is(maction.getAttribute("selection"), "2",
"maction's selection attribute isn't 2 by first click called stopPropagation()");
synthesizeMouseAtCenter(maction, {});
is(maction.getAttribute("selection"), "1",
"maction's selection attribute isn't 1 by second click called stopPropagation()");
window.removeEventListener("mousedown", doStopPropagation, true);
window.removeEventListener("mouseup", doStopPropagation, true);
window.removeEventListener("click", doStopPropagation, true);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(doTest);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-print"><head>
<style>
div.spacer {
height: 5px;
width: 10px;
}
img, td.spacer {
height: 140px;
width: 30px;
}
</style>
<title>rowspan pagination</title>
</head>
<body>
<div class="spacer"> </div>
<table>
<tbody>
<tr><td class="spacer"></td></tr>
<tr style="page-break-before:always">
<td rowspan="2">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAAAwACigABtnCV2AAAAABJRU5ErkJggg==">
</td>
</tr>
<tr></tr>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-print"><head>
<style>
div.spacer {
height: 5px;
width: 10px;
}
img, td.spacer {
height: 140px;
width: 30px;
}
</style>
<title>rowspan pagination</title>
</head>
<body>
<div class="spacer"> </div>
<table>
<tbody>
<tr><td class="spacer"></td></tr>
<tr>
<td rowspan="2">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAAAwACigABtnCV2AAAAABJRU5ErkJggg==">
</td>
</tr>
<tr></tr>
</tbody>
</table>
</body>
</html>

View File

@ -1233,6 +1233,7 @@ fails-if(cocoaWidget) == 456147.xul 456147-ref.html # bug 458047
== 466395-2.html 466395-2-ref.html
== 467084-1.html 467084-1-ref.html
== 467084-2.html 467084-2-ref.html
== 467444-1.html 467444-1-ref.html
== 467460-1.html 467460-1-ref.html
== 468546-1.xhtml 468546-1-ref.xhtml
== 468473-1.xul 468473-1-ref.xul

View File

@ -1236,7 +1236,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
UndoContinuedRow(aPresContext, contRow);
contRow = nsnull;
nsTableRowFrame* oldLastRowThisPage = lastRowThisPage;
lastRowThisPage = firstTruncatedRow;
lastRowThisPage = rowBefore;
aStatus = NS_FRAME_NOT_COMPLETE;
// Call SplitSpanningCells again with rowBefore as the last row on the page

View File

@ -418,10 +418,6 @@ pref("capability.policy.default.Location.hash.set", "allAccess");
pref("capability.policy.default.Location.href.set", "allAccess");
pref("capability.policy.default.Location.replace.get", "allAccess");
pref("capability.policy.default.Navigator.preference", "allAccess");
pref("capability.policy.default.Navigator.preferenceinternal.get", "UniversalPreferencesRead");
pref("capability.policy.default.Navigator.preferenceinternal.set", "UniversalPreferencesWrite");
pref("capability.policy.default.Window.blur.get", "allAccess");
pref("capability.policy.default.Window.close.get", "allAccess");
pref("capability.policy.default.Window.closed.get", "allAccess");

View File

@ -124,6 +124,10 @@ public:
// Transfer the base http connection object along with a
// reference to it to the caller.
virtual nsHttpConnection *TakeHttpConnection() = 0;
// Get the nsISocketTransport used by the connection without changing
// references or ownership.
virtual nsISocketTransport *Transport() = 0;
};
#define NS_DECL_NSAHTTPCONNECTION \
@ -141,6 +145,7 @@ public:
nsresult PushBack(const char *, PRUint32); \
bool LastTransactionExpectedNoContent(); \
void SetLastTransactionExpectedNoContent(bool); \
nsHttpConnection *TakeHttpConnection();
nsHttpConnection *TakeHttpConnection(); \
nsISocketTransport *Transport();
#endif // nsAHttpConnection_h__

View File

@ -123,6 +123,7 @@ public:
mLastTransactionExpectedNoContent = val;
}
nsISocketTransport *Transport() { return mSocketTransport; }
nsAHttpTransaction *Transaction() { return mTransaction; }
nsHttpConnectionInfo *ConnectionInfo() { return mConnInfo; }

View File

@ -1693,3 +1693,11 @@ nsConnectionHandle::SetLastTransactionExpectedNoContent(bool val)
{
mConn->SetLastTransactionExpectedNoContent(val);
}
nsISocketTransport *
nsHttpConnectionMgr::nsConnectionHandle::Transport()
{
if (!mConn)
return nsnull;
return mConn->Transport();
}

View File

@ -101,6 +101,9 @@ nsHttpPipeline::nsHttpPipeline()
, mPushBackBuf(nsnull)
, mPushBackLen(0)
, mPushBackMax(0)
, mReceivingFromProgress(0)
, mSendingToProgress(0)
, mSuppressSendEvents(true)
{
}
@ -325,6 +328,14 @@ nsHttpPipeline::TakeHttpConnection()
return nsnull;
}
nsISocketTransport *
nsHttpPipeline::Transport()
{
if (!mConnection)
return nsnull;
return mConnection->Transport();
}
void
nsHttpPipeline::SetSSLConnectFailed()
{
@ -390,21 +401,80 @@ nsHttpPipeline::OnTransportStatus(nsITransport* transport,
NS_ASSERTION(PR_GetCurrentThread() == gSocketThread, "wrong thread");
nsAHttpTransaction *trans;
PRInt32 i, count;
switch (status) {
case NS_NET_STATUS_RECEIVING_FROM:
// forward this only to the transaction currently recieving data
trans = Response(0);
case NS_NET_STATUS_RESOLVING_HOST:
case NS_NET_STATUS_RESOLVED_HOST:
case NS_NET_STATUS_CONNECTING_TO:
case NS_NET_STATUS_CONNECTED_TO:
// These should only appear at most once per pipeline.
// Deliver to the first transaction.
trans = Request(0);
if (!trans)
trans = Response(0);
if (trans)
trans->OnTransportStatus(transport, status, progress);
break;
default:
// forward other notifications to all transactions
PRInt32 i, count = mRequestQ.Length();
for (i=0; i<count; ++i) {
trans = Request(i);
if (trans)
trans->OnTransportStatus(transport, status, progress);
case NS_NET_STATUS_SENDING_TO:
// This is generated by the socket transport when (part) of
// a transaction is written out
//
// In pipelining this is generated out of FillSendBuf(), but it cannot do
// so until the connection is confirmed by CONNECTED_TO.
// See patch for bug 196827.
//
if (mSuppressSendEvents) {
mSuppressSendEvents = false;
// catch up by sending the event to all the transactions that have
// moved from request to response and any that have been partially
// sent. Also send WAITING_FOR to those that were completely sent
count = mResponseQ.Length();
for (i = 0; i < count; ++i) {
Response(i)->OnTransportStatus(transport,
NS_NET_STATUS_SENDING_TO,
progress);
Response(i)->OnTransportStatus(transport,
NS_NET_STATUS_WAITING_FOR,
progress);
}
if (mRequestIsPartial && Request(0))
Request(0)->OnTransportStatus(transport,
NS_NET_STATUS_SENDING_TO,
progress);
mSendingToProgress = progress;
}
// otherwise ignore it
break;
case NS_NET_STATUS_WAITING_FOR:
// Created by nsHttpConnection when request pipeline has been totally
// sent. Ignore it here because it is simulated in FillSendBuf() when
// a request is moved from request to response.
// ignore it
break;
case NS_NET_STATUS_RECEIVING_FROM:
// Forward this only to the transaction currently recieving data. It is
// normally generated by the socket transport, but can also
// be repeated by the pushbackwriter if necessary.
mReceivingFromProgress = progress;
if (Response(0))
Response(0)->OnTransportStatus(transport, status, progress);
break;
default:
// forward other notifications to all request transactions
count = mRequestQ.Length();
for (i = 0; i < count; ++i)
Request(i)->OnTransportStatus(transport, status, progress);
break;
}
}
@ -548,6 +618,16 @@ nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer,
nsHttpPushBackWriter writer(mPushBackBuf, mPushBackLen);
PRUint32 len = mPushBackLen, n;
mPushBackLen = 0;
// This progress notification has previously been sent from
// the socket transport code, but it was delivered to the
// previous transaction on the pipeline.
nsITransport *transport = Transport();
if (transport)
OnTransportStatus(transport,
nsISocketTransport::STATUS_RECEIVING_FROM,
mReceivingFromProgress);
// the push back buffer is never larger than NS_HTTP_SEGMENT_SIZE,
// so we are guaranteed that the next response will eat the entire
// push back buffer (even though it might again call PushBack).
@ -638,6 +718,8 @@ nsHttpPipeline::FillSendBuf()
PRUint32 n, avail;
nsAHttpTransaction *trans;
nsITransport *transport = Transport();
while ((trans = Request(0)) != nsnull) {
avail = trans->Available();
if (avail) {
@ -648,13 +730,29 @@ nsHttpPipeline::FillSendBuf()
LOG(("send pipe is full"));
break;
}
mSendingToProgress += n;
if (!mSuppressSendEvents && transport) {
// Simulate a SENDING_TO event
trans->OnTransportStatus(transport,
NS_NET_STATUS_SENDING_TO,
mSendingToProgress);
}
}
avail = trans->Available();
if (avail == 0) {
// move transaction from request queue to response queue
mRequestQ.RemoveElementAt(0);
mResponseQ.AppendElement(trans);
mRequestIsPartial = false;
if (!mSuppressSendEvents && transport) {
// Simulate a WAITING_FOR event
trans->OnTransportStatus(transport,
NS_NET_STATUS_WAITING_FOR,
mSendingToProgress);
}
}
else
mRequestIsPartial = true;

View File

@ -111,6 +111,11 @@ private:
char *mPushBackBuf;
PRUint32 mPushBackLen;
PRUint32 mPushBackMax;
// For support of OnTransportStatus()
PRUint64 mReceivingFromProgress;
PRUint64 mSendingToProgress;
bool mSuppressSendEvents;
};
#endif // nsHttpPipeline_h__

View File

@ -824,6 +824,7 @@ if [ "$ENABLE_TESTS" ]; then
layout/generic/test/Makefile
layout/inspector/tests/Makefile
layout/inspector/tests/chrome/Makefile
layout/mathml/tests/Makefile
layout/reftests/fonts/Makefile
layout/reftests/fonts/mplus/Makefile
layout/style/test/Makefile

View File

@ -82,7 +82,7 @@ ifeq ($(OS_TARGET),Android)
DEFINES += -DMOZ_ENABLE_PROFILER_SPS
CPPSRCS += \
platform.cc \
platform-linux.cc \
TableTicker.cpp \
$(NULL)
endif

View File

@ -34,6 +34,7 @@
#include <strings.h> // index
#include <errno.h>
#include <stdarg.h>
#include "v8-support.h"
#include "platform.h"
#include <string.h>
@ -187,8 +188,7 @@ void tgkill(pid_t tgid, pid_t tid, int signalno) {
syscall(SYS_tgkill, tgid, tid, signalno);
}
//class Sampler::PlatformData : public Malloced {
class Sampler::PlatformData {
class Sampler::PlatformData : public Malloced {
public:
explicit PlatformData(Sampler* sampler)
: sampler_(sampler),

View File

@ -59,7 +59,7 @@ extern pthread_key_t pkey_ticker;
// memory stores from being reordered
// Uses: pLinuxKernelMemoryBarrier
# define STORE_SEQUENCER() base::subtle::MemoryBarrier();
#elif ARCH_CPU_ARM_FAMILY
#elif ARCH_CPU_X86_FAMILY
# define STORE_SEQUENCER() asm volatile("" ::: "memory");
#else
# error "Memory clobber not supported for your platform."

View File

@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Muizelaar <jmuizelaar@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* This contains stubs and infrastructure to support code from v8 */
class Malloced {
};

View File

@ -183,6 +183,7 @@ bool nsCocoaAppModalWindowList::GeckoModalAboveCocoaModal()
@end
@implementation GeckoNSApplication
- (void)sendEvent:(NSEvent *)anEvent
{
mozilla::HangMonitor::NotifyActivity();
@ -193,6 +194,19 @@ bool nsCocoaAppModalWindowList::GeckoModalAboveCocoaModal()
}
[super sendEvent:anEvent];
}
- (NSEvent*)nextEventMatchingMask:(NSUInteger)mask
untilDate:(NSDate*)expiration
inMode:(NSString*)mode
dequeue:(BOOL)flag
{
if (expiration) {
mozilla::HangMonitor::Suspend();
}
return [super nextEventMatchingMask:mask
untilDate:expiration inMode:mode dequeue:flag];
}
@end