This commit is contained in:
Robert Sayre 2008-12-10 15:40:30 -08:00
Родитель 5e01ae0dd0 460fad9c68
Коммит 932d95c81c
47 изменённых файлов: 671 добавлений и 643 удалений

Просмотреть файл

@ -271,8 +271,9 @@ endif
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
$(MOZ_APP_NAME):: mozilla.in $(GLOBAL_DEPS)
cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" > $@
$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
chmod +x $@
libs:: $(MOZ_APP_NAME)

Просмотреть файл

@ -244,6 +244,14 @@ pref("browser.urlbar.restrict.tag", "+");
pref("browser.urlbar.match.title", "#");
pref("browser.urlbar.match.url", "@");
// The default behavior for the urlbar can be configured to use any combination
// of the restrict or match filters with each additional filter restricting
// more (intersection). Add the following values to set the behavior as the
// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url
// E.g., 0 = show all results (no filtering), 1 = only visited pages in history,
// 2 = only bookmarks, 3 = visited bookmarks, 1+16 = history matching in the url
pref("browser.urlbar.default.behavior", 0);
// Number of milliseconds to wait for the http headers (and thus
// the Content-Disposition filename) before giving up and falling back to
// picking a filename without that info in hand so that the user sees some

13
browser/app/mozilla.in → build/unix/mozilla.in Executable file → Normal file
Просмотреть файл

@ -13,7 +13,7 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org Code.
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
@ -36,17 +36,15 @@
#
# ***** END LICENSE BLOCK *****
## $Id: mozilla.in,v 1.16 2007/10/05 07:29:26 reed%reedloden.com Exp $
##
## Usage:
##
## $ mozilla [args]
##
## This script is meant to run the mozilla-bin binary from either
## mozilla/xpfe/bootstrap or mozilla/dist/bin.
## This script is meant to run the application binary from mozilla/dist/bin.
##
## The script will setup all the environment voodoo needed to make
## the mozilla-bin binary to work.
## the application binary to work.
##
#uncomment for debugging
@ -90,8 +88,9 @@ if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin="$moz_libdir"
else
echo "Cannot find mozilla runtime directory. Exiting."
run_moz="$moz_libdir/run-mozilla.sh"
else
echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
exit 1
fi
fi

Просмотреть файл

@ -961,6 +961,15 @@ nsresult nsOggDecodeStateMachine::Run()
oggplay_seek(mPlayer, ogg_int64_t(seekTime * 1000));
// Reactivate all tracks. Liboggplay deactivates tracks when it
// reads to the end of stream, but they must be reactivated in order
// to start reading from them again.
for (int i = 0; i < oggplay_get_num_tracks(mPlayer); ++i) {
if (oggplay_set_track_active(mPlayer, i) < 0) {
LOG(PR_LOG_ERROR, ("Could not set track %d active", i));
}
}
mon.Enter();
if (mState == DECODER_STATE_SHUTDOWN)
continue;
@ -982,6 +991,7 @@ nsresult nsOggDecodeStateMachine::Run()
mLastFrameTime = 0;
FrameData* frame = NextFrame();
NS_ASSERTION(frame != nsnull, "No frame after seek!");
if (frame) {
mDecodedFrames.Push(frame);
UpdatePlaybackPosition(frame->mDecodedFrameTime);
@ -1386,12 +1396,16 @@ void nsOggDecoder::MetadataLoaded()
if (mShuttingDown)
return;
// Only inform the element of MetadataLoaded if not doing a load() in order
// to fulfill a seek, otherwise we'll get multiple metadataloaded events.
PRBool notifyElement = PR_TRUE;
{
nsAutoMonitor mon(mMonitor);
mDuration = mDecodeStateMachine ? mDecodeStateMachine->GetDuration() : -1;
notifyElement = mNextState != PLAY_STATE_SEEKING;
}
if (mElement) {
if (mElement && notifyElement) {
mElement->MetadataLoaded();
}
}
@ -1400,8 +1414,16 @@ void nsOggDecoder::FirstFrameLoaded()
{
if (mShuttingDown)
return;
// Only inform the element of FirstFrameLoaded if not doing a load() in order
// to fulfill a seek, otherwise we'll get multiple loadedfirstframe events.
PRBool notifyElement = PR_TRUE;
{
nsAutoMonitor mon(mMonitor);
notifyElement = mNextState != PLAY_STATE_SEEKING;
}
if (mElement) {
if (mElement && notifyElement) {
mElement->FirstFrameLoaded();
}

Просмотреть файл

@ -52,6 +52,7 @@ _TEST_FILES = test_autoplay.html \
test_ended1.html \
test_ended2.html \
test_networkState.html \
test_onloadedmetadata.html \
test_paused.html \
test_readyState.html \
test_seek1.html \

Просмотреть файл

@ -0,0 +1,88 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=467972
-->
<head>
<title>Test for Bug 467972</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=467972">Mozilla Bug 467972</a>
<video id="v"
src="320x240.ogg"
onloadedmetadata="return loadedMetaData();"
onended="playbackEnded();"
onloadedfirstframe="return loadedFirstFrame();"
onseeking="seekStarted();"
onseeked="seekEnded();"
controls></video>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 467972 **/
var gEnded = false;
var gSeekStarted = false;
var gSeekEnded = false;
var gLoadedFirstFrameCount = 0;
var gLoadedMetaDataCount = 0;
function get(id) {
return document.getElementById(id);
}
function video() {
return get('v');
}
function seekStarted() {
gSeekStarted = true;
}
function seekEnded() {
gSeekEnded = true;
video().play();
}
function loadedFirstFrame() {
gLoadedFirstFrameCount++;
ok(gLoadedFirstFrameCount <= 1, "No more than 1 onloadedfirstframe events");
}
function loadedMetaData() {
gLoadedMetaDataCount++;
ok(gLoadedMetaDataCount <= 1, "No more than 1 onloadedmetadata events");
video().play();
return false;
}
function playbackEnded() {
if (!gEnded) {
video().currentTime = 0;
gEnded = true;
} else {
ok(gSeekEnded, "Should have received seekended");
ok(gSeekStarted, "Should have received seekstarted");
ok(gLoadedFirstFrameCount == 1, "Should have 1 onloadedfirstframe event");
ok(gLoadedMetaDataCount == 1, "Should have 1 onloadedmetadata event");
SimpleTest.finish();
}
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -40,6 +40,7 @@
#include "nsTransactionManager.h"
#include "nsTransactionItem.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
nsTransactionItem::nsTransactionItem(nsITransaction *aTransaction)
: mTransaction(aTransaction), mUndoStack(0), mRedoStack(0)
@ -53,8 +54,27 @@ nsTransactionItem::~nsTransactionItem()
if (mUndoStack)
delete mUndoStack;
}
NS_IF_RELEASE(mTransaction);
nsrefcnt
nsTransactionItem::AddRef()
{
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "nsTransactionItem",
sizeof(nsTransactionItem));
return mRefCnt;
}
nsrefcnt
nsTransactionItem::Release() {
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsTransactionItem");
if (mRefCnt == 0) {
mRefCnt = 1;
delete this;
return 0;
}
return mRefCnt;
}
nsresult
@ -80,7 +100,7 @@ nsTransactionItem::GetTransaction(nsITransaction **aTransaction)
if (!aTransaction)
return NS_ERROR_NULL_POINTER;
*aTransaction = mTransaction;
NS_IF_ADDREF(*aTransaction = mTransaction);
return NS_OK;
}
@ -207,7 +227,7 @@ nsTransactionItem::UndoTransaction(nsTransactionManager *aTxMgr)
nsresult
nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr)
{
nsTransactionItem *item;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
PRInt32 sz = 0;
@ -225,15 +245,15 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr)
return result;
while (sz-- > 0) {
result = mUndoStack->Peek(&item);
result = mUndoStack->Peek(getter_AddRefs(item));
if (NS_FAILED(result)) {
return result;
}
nsITransaction *t = 0;
nsCOMPtr<nsITransaction> t;
result = item->GetTransaction(&t);
result = item->GetTransaction(getter_AddRefs(t));
if (NS_FAILED(result)) {
return result;
@ -254,7 +274,7 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr)
result = item->UndoTransaction(aTxMgr);
if (NS_SUCCEEDED(result)) {
result = mUndoStack->Pop(&item);
result = mUndoStack->Pop(getter_AddRefs(item));
if (NS_SUCCEEDED(result)) {
result = mRedoStack->Push(item);
@ -281,6 +301,7 @@ nsTransactionItem::RedoTransaction(nsTransactionManager *aTxMgr)
{
nsresult result;
nsCOMPtr<nsITransaction> kungfuDeathGrip(mTransaction);
if (mTransaction) {
result = mTransaction->RedoTransaction();
@ -301,7 +322,7 @@ nsTransactionItem::RedoTransaction(nsTransactionManager *aTxMgr)
nsresult
nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr)
{
nsTransactionItem *item;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
PRInt32 sz = 0;
@ -316,15 +337,15 @@ nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr)
while (sz-- > 0) {
result = mRedoStack->Peek(&item);
result = mRedoStack->Peek(getter_AddRefs(item));
if (NS_FAILED(result)) {
return result;
}
nsITransaction *t = 0;
nsCOMPtr<nsITransaction> t;
result = item->GetTransaction(&t);
result = item->GetTransaction(getter_AddRefs(t));
if (NS_FAILED(result)) {
return result;
@ -345,7 +366,7 @@ nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr)
result = item->RedoTransaction(aTxMgr);
if (NS_SUCCEEDED(result)) {
result = mRedoStack->Pop(&item);
result = mRedoStack->Pop(getter_AddRefs(item));
if (NS_SUCCEEDED(result)) {
result = mUndoStack->Push(item);

Просмотреть файл

@ -38,21 +38,26 @@
#ifndef nsTransactionItem_h__
#define nsTransactionItem_h__
class nsITransaction;
#include "nsITransaction.h"
#include "nsCOMPtr.h"
class nsTransactionStack;
class nsTransactionRedoStack;
class nsTransactionManager;
class nsTransactionItem
{
nsITransaction *mTransaction;
nsTransactionStack *mUndoStack;
nsTransactionRedoStack *mRedoStack;
nsCOMPtr<nsITransaction> mTransaction;
nsTransactionStack *mUndoStack;
nsTransactionRedoStack *mRedoStack;
nsAutoRefCnt mRefCnt;
public:
nsTransactionItem(nsITransaction *aTransaction);
virtual ~nsTransactionItem();
nsrefcnt AddRef();
nsrefcnt Release();
virtual nsresult AddChild(nsTransactionItem *aTransactionItem);
virtual nsresult GetTransaction(nsITransaction **aTransaction);

Просмотреть файл

@ -100,14 +100,14 @@ NS_IMETHODIMP nsTransactionList::ItemIsBatch(PRInt32 aIndex, PRBool *aIsBatch)
if (!txMgr)
return NS_ERROR_FAILURE;
nsTransactionItem *item = 0;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_ERROR_FAILURE;
if (mTxnStack)
result = mTxnStack->GetItem(aIndex, &item);
result = mTxnStack->GetItem(aIndex, getter_AddRefs(item));
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, &item);
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
if (NS_FAILED(result))
return result;
@ -131,14 +131,14 @@ NS_IMETHODIMP nsTransactionList::GetItem(PRInt32 aIndex, nsITransaction **aItem)
if (!txMgr)
return NS_ERROR_FAILURE;
nsTransactionItem *item = 0;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_ERROR_FAILURE;
if (mTxnStack)
result = mTxnStack->GetItem(aIndex, &item);
result = mTxnStack->GetItem(aIndex, getter_AddRefs(item));
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, &item);
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
if (NS_FAILED(result))
return result;
@ -146,14 +146,7 @@ NS_IMETHODIMP nsTransactionList::GetItem(PRInt32 aIndex, nsITransaction **aItem)
if (!item)
return NS_ERROR_FAILURE;
result = item->GetTransaction(aItem);
if (NS_FAILED(result))
return result;
NS_IF_ADDREF(*aItem);
return NS_OK;
return item->GetTransaction(aItem);
}
/* long getNumChildrenForItem (in long aIndex); */
@ -169,14 +162,14 @@ NS_IMETHODIMP nsTransactionList::GetNumChildrenForItem(PRInt32 aIndex, PRInt32 *
if (!txMgr)
return NS_ERROR_FAILURE;
nsTransactionItem *item = 0;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_ERROR_FAILURE;
if (mTxnStack)
result = mTxnStack->GetItem(aIndex, &item);
result = mTxnStack->GetItem(aIndex, getter_AddRefs(item));
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, &item);
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
if (NS_FAILED(result))
return result;
@ -200,14 +193,14 @@ NS_IMETHODIMP nsTransactionList::GetChildListForItem(PRInt32 aIndex, nsITransact
if (!txMgr)
return NS_ERROR_FAILURE;
nsTransactionItem *item = 0;
nsRefPtr<nsTransactionItem> item;
nsresult result = NS_ERROR_FAILURE;
if (mTxnStack)
result = mTxnStack->GetItem(aIndex, &item);
result = mTxnStack->GetItem(aIndex, getter_AddRefs(item));
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, &item);
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
if (NS_FAILED(result))
return result;

Просмотреть файл

@ -40,10 +40,11 @@
#include "nsWeakReference.h"
#include "nsITransactionList.h"
#include "nsTransactionItem.h"
#include "nsAutoPtr.h"
class nsITransaction;
class nsITransactionManager;
class nsTransactionItem;
class nsTransactionStack;
class nsTransactionRedoStack;
@ -54,9 +55,9 @@ class nsTransactionList : public nsITransactionList
{
private:
nsWeakPtr mTxnMgr;
nsTransactionStack *mTxnStack;
nsTransactionItem *mTxnItem;
nsWeakPtr mTxnMgr;
nsTransactionStack *mTxnStack;
nsRefPtr<nsTransactionItem> mTxnItem;
public:

Просмотреть файл

@ -43,7 +43,7 @@
#include "nsVoidArray.h"
#include "nsTransactionManager.h"
#include "nsTransactionList.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#define LOCK_TX_MANAGER(mgr) (mgr)->Lock()
@ -153,7 +153,7 @@ NS_IMETHODIMP
nsTransactionManager::UndoTransaction()
{
nsresult result = NS_OK;
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
LOCK_TX_MANAGER(this);
@ -161,7 +161,7 @@ nsTransactionManager::UndoTransaction()
// executing a transaction's DoTransaction() method! If this happens,
// the UndoTransaction() request is ignored, and we return NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
result = mDoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -175,7 +175,7 @@ nsTransactionManager::UndoTransaction()
// Peek at the top of the undo stack. Don't remove the transaction
// until it has successfully completed.
result = mUndoStack.Peek(&tx);
result = mUndoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -188,9 +188,9 @@ nsTransactionManager::UndoTransaction()
return NS_OK;
}
nsITransaction *t = 0;
nsCOMPtr<nsITransaction> t;
result = tx->GetTransaction(&t);
result = tx->GetTransaction(getter_AddRefs(t));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -214,7 +214,7 @@ nsTransactionManager::UndoTransaction()
result = tx->UndoTransaction(this);
if (NS_SUCCEEDED(result)) {
result = mUndoStack.Pop(&tx);
result = mUndoStack.Pop(getter_AddRefs(tx));
if (NS_SUCCEEDED(result))
result = mRedoStack.Push(tx);
@ -234,7 +234,7 @@ NS_IMETHODIMP
nsTransactionManager::RedoTransaction()
{
nsresult result = NS_OK;
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
LOCK_TX_MANAGER(this);
@ -242,7 +242,7 @@ nsTransactionManager::RedoTransaction()
// executing a transaction's DoTransaction() method! If this happens,
// the RedoTransaction() request is ignored, and we return NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
result = mDoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -256,7 +256,7 @@ nsTransactionManager::RedoTransaction()
// Peek at the top of the redo stack. Don't remove the transaction
// until it has successfully completed.
result = mRedoStack.Peek(&tx);
result = mRedoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -269,9 +269,9 @@ nsTransactionManager::RedoTransaction()
return NS_OK;
}
nsITransaction *t = 0;
nsCOMPtr<nsITransaction> t;
result = tx->GetTransaction(&t);
result = tx->GetTransaction(getter_AddRefs(t));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -295,7 +295,7 @@ nsTransactionManager::RedoTransaction()
result = tx->RedoTransaction(this);
if (NS_SUCCEEDED(result)) {
result = mRedoStack.Pop(&tx);
result = mRedoStack.Pop(getter_AddRefs(tx));
if (NS_SUCCEEDED(result))
result = mUndoStack.Push(tx);
@ -373,8 +373,8 @@ nsTransactionManager::BeginBatch()
NS_IMETHODIMP
nsTransactionManager::EndBatch()
{
nsTransactionItem *tx = 0;
nsITransaction *ti = 0;
nsRefPtr<nsTransactionItem> tx;
nsCOMPtr<nsITransaction> ti;
nsresult result;
LOCK_TX_MANAGER(this);
@ -390,7 +390,7 @@ nsTransactionManager::EndBatch()
// future when we allow users to execute a transaction when beginning
// a batch!!!!
result = mDoStack.Peek(&tx);
result = mDoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -398,7 +398,7 @@ nsTransactionManager::EndBatch()
}
if (tx)
tx->GetTransaction(&ti);
tx->GetTransaction(getter_AddRefs(ti));
if (!tx || ti) {
UNLOCK_TX_MANAGER(this);
@ -472,7 +472,7 @@ NS_IMETHODIMP
nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
{
PRInt32 numUndoItems = 0, numRedoItems = 0, total = 0;
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
nsresult result;
LOCK_TX_MANAGER(this);
@ -483,7 +483,7 @@ nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
// SetMaxTransactionCount() request is ignored, and we return
// NS_ERROR_FAILURE.
result = mDoStack.Peek(&tx);
result = mDoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result)) {
UNLOCK_TX_MANAGER(this);
@ -534,16 +534,13 @@ nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
// the bottom of the stack and pop towards the top.
while (numUndoItems > 0 && (numRedoItems + numUndoItems) > aMaxCount) {
tx = 0;
result = mUndoStack.PopBottom(&tx);
result = mUndoStack.PopBottom(getter_AddRefs(tx));
if (NS_FAILED(result) || !tx) {
UNLOCK_TX_MANAGER(this);
return result;
}
delete tx;
--numUndoItems;
}
@ -551,16 +548,13 @@ nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
// the bottom of the stack and pop towards the top.
while (numRedoItems > 0 && (numRedoItems + numUndoItems) > aMaxCount) {
tx = 0;
result = mRedoStack.PopBottom(&tx);
result = mRedoStack.PopBottom(getter_AddRefs(tx));
if (NS_FAILED(result) || !tx) {
UNLOCK_TX_MANAGER(this);
return result;
}
delete tx;
--numRedoItems;
}
@ -574,7 +568,7 @@ nsTransactionManager::SetMaxTransactionCount(PRInt32 aMaxCount)
NS_IMETHODIMP
nsTransactionManager::PeekUndoStack(nsITransaction **aTransaction)
{
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
nsresult result;
if (!aTransaction)
@ -584,7 +578,7 @@ nsTransactionManager::PeekUndoStack(nsITransaction **aTransaction)
LOCK_TX_MANAGER(this);
result = mUndoStack.Peek(&tx);
result = mUndoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result) || !tx) {
UNLOCK_TX_MANAGER(this);
@ -595,15 +589,13 @@ nsTransactionManager::PeekUndoStack(nsITransaction **aTransaction)
UNLOCK_TX_MANAGER(this);
NS_IF_ADDREF(*aTransaction);
return result;
}
NS_IMETHODIMP
nsTransactionManager::PeekRedoStack(nsITransaction **aTransaction)
{
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
nsresult result;
if (!aTransaction)
@ -613,7 +605,7 @@ nsTransactionManager::PeekRedoStack(nsITransaction **aTransaction)
LOCK_TX_MANAGER(this);
result = mRedoStack.Peek(&tx);
result = mRedoStack.Peek(getter_AddRefs(tx));
if (NS_FAILED(result) || !tx) {
UNLOCK_TX_MANAGER(this);
@ -624,8 +616,6 @@ nsTransactionManager::PeekRedoStack(nsITransaction **aTransaction)
UNLOCK_TX_MANAGER(this);
NS_IF_ADDREF(*aTransaction);
return result;
}
@ -1044,35 +1034,29 @@ nsTransactionManager::DidMergeNotify(nsITransaction *aTop,
nsresult
nsTransactionManager::BeginTransaction(nsITransaction *aTransaction)
{
nsTransactionItem *tx;
nsresult result = NS_OK;
// No need for LOCK/UNLOCK_TX_MANAGER() calls since the calling routine
// should have done this already!
NS_IF_ADDREF(aTransaction);
// XXX: POSSIBLE OPTIMIZATION
// We could use a factory that pre-allocates/recycles transaction items.
tx = new nsTransactionItem(aTransaction);
nsRefPtr<nsTransactionItem> tx = new nsTransactionItem(aTransaction);
if (!tx) {
NS_IF_RELEASE(aTransaction);
return NS_ERROR_OUT_OF_MEMORY;
}
result = mDoStack.Push(tx);
if (NS_FAILED(result)) {
delete tx;
return result;
}
result = tx->DoTransaction();
if (NS_FAILED(result)) {
mDoStack.Pop(&tx);
delete tx;
mDoStack.Pop(getter_AddRefs(tx));
return result;
}
@ -1082,19 +1066,19 @@ nsTransactionManager::BeginTransaction(nsITransaction *aTransaction)
nsresult
nsTransactionManager::EndTransaction()
{
nsITransaction *tint = 0;
nsTransactionItem *tx = 0;
nsCOMPtr<nsITransaction> tint;
nsRefPtr<nsTransactionItem> tx;
nsresult result = NS_OK;
// No need for LOCK/UNLOCK_TX_MANAGER() calls since the calling routine
// should have done this already!
result = mDoStack.Pop(&tx);
result = mDoStack.Pop(getter_AddRefs(tx));
if (NS_FAILED(result) || !tx)
return result;
result = tx->GetTransaction(&tint);
result = tx->GetTransaction(getter_AddRefs(tint));
if (NS_FAILED(result)) {
// XXX: What do we do with the transaction item at this point?
@ -1110,7 +1094,6 @@ nsTransactionManager::EndTransaction()
tx->GetNumberOfChildren(&nc);
if (!nc) {
delete tx;
return result;
}
}
@ -1126,17 +1109,16 @@ nsTransactionManager::EndTransaction()
if (NS_FAILED(result) || isTransient || !mMaxTransactionCount) {
// XXX: Should we be clearing the redo stack if the transaction
// is transient and there is nothing on the do stack?
delete tx;
return result;
}
nsTransactionItem *top = 0;
nsRefPtr<nsTransactionItem> top;
// Check if there is a transaction on the do stack. If there is,
// the current transaction is a "sub" transaction, and should
// be added to the transaction at the top of the do stack.
result = mDoStack.Peek(&top);
result = mDoStack.Peek(getter_AddRefs(top));
if (top) {
result = top->AddChild(tx);
@ -1157,13 +1139,13 @@ nsTransactionManager::EndTransaction()
// of the undo stack.
top = 0;
result = mUndoStack.Peek(&top);
result = mUndoStack.Peek(getter_AddRefs(top));
if (tint && top) {
PRBool didMerge = PR_FALSE;
nsITransaction *topTransaction = 0;
nsCOMPtr<nsITransaction> topTransaction;
result = top->GetTransaction(&topTransaction);
result = top->GetTransaction(getter_AddRefs(topTransaction));
if (topTransaction) {
@ -1187,7 +1169,6 @@ nsTransactionManager::EndTransaction()
}
if (didMerge) {
delete tx;
return result;
}
}
@ -1202,14 +1183,11 @@ nsTransactionManager::EndTransaction()
result = mUndoStack.GetSize(&sz);
if (mMaxTransactionCount > 0 && sz >= mMaxTransactionCount) {
nsTransactionItem *overflow = 0;
nsRefPtr<nsTransactionItem> overflow;
result = mUndoStack.PopBottom(&overflow);
result = mUndoStack.PopBottom(getter_AddRefs(overflow));
// XXX: What do we do in the case where this fails?
if (overflow)
delete overflow;
}
// Push the transaction on the undo stack:

Просмотреть файл

@ -39,12 +39,11 @@
#include "nsTransactionItem.h"
#include "nsTransactionStack.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
nsTransactionStack::nsTransactionStack()
: mQue(0)
{
nsTransactionReleaseFunctor* theFunctor=new nsTransactionReleaseFunctor();
mQue.SetDeallocator(theFunctor);
}
nsTransactionStack::~nsTransactionStack()
@ -61,6 +60,7 @@ nsTransactionStack::Push(nsTransactionItem *aTransaction)
/* nsDeque's Push() method adds new items at the back
* of the deque.
*/
NS_ADDREF(aTransaction);
mQue.Push(aTransaction);
return NS_OK;
@ -105,7 +105,7 @@ nsTransactionStack::Peek(nsTransactionItem **aTransaction)
return NS_OK;
}
*aTransaction = (nsTransactionItem *)(mQue.Last());
NS_IF_ADDREF(*aTransaction = static_cast<nsTransactionItem*>(mQue.Last()));
return NS_OK;
}
@ -119,7 +119,8 @@ nsTransactionStack::GetItem(PRInt32 aIndex, nsTransactionItem **aTransaction)
if (aIndex < 0 || aIndex >= mQue.GetSize())
return NS_ERROR_FAILURE;
*aTransaction = (nsTransactionItem *)(mQue.ObjectAt(aIndex));
NS_IF_ADDREF(*aTransaction =
static_cast<nsTransactionItem*>(mQue.ObjectAt(aIndex)));
return NS_OK;
}
@ -127,20 +128,18 @@ nsTransactionStack::GetItem(PRInt32 aIndex, nsTransactionItem **aTransaction)
nsresult
nsTransactionStack::Clear(void)
{
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
nsresult result = NS_OK;
/* Pop all transactions off the stack and release them. */
result = Pop(&tx);
result = Pop(getter_AddRefs(tx));
if (NS_FAILED(result))
return result;
while (tx) {
delete tx;
result = Pop(&tx);
result = Pop(getter_AddRefs(tx));
if (NS_FAILED(result))
return result;
@ -168,22 +167,20 @@ nsTransactionRedoStack::~nsTransactionRedoStack()
nsresult
nsTransactionRedoStack::Clear(void)
{
nsTransactionItem *tx = 0;
nsRefPtr<nsTransactionItem> tx;
nsresult result = NS_OK;
/* When clearing a Redo stack, we have to clear from the
* bottom of the stack towards the top!
*/
result = PopBottom(&tx);
result = PopBottom(getter_AddRefs(tx));
if (NS_FAILED(result))
return result;
while (tx) {
delete tx;
result = PopBottom(&tx);
result = PopBottom(getter_AddRefs(tx));
if (NS_FAILED(result))
return result;
@ -192,10 +189,3 @@ nsTransactionRedoStack::Clear(void)
return NS_OK;
}
void *
nsTransactionReleaseFunctor::operator()(void *aObject)
{
nsTransactionItem *item = (nsTransactionItem *)aObject;
delete item;
return 0;
}

Просмотреть файл

@ -42,15 +42,6 @@
class nsTransactionItem;
class nsTransactionReleaseFunctor : public nsDequeFunctor
{
public:
nsTransactionReleaseFunctor() {}
virtual ~nsTransactionReleaseFunctor() {}
virtual void *operator()(void *aObject);
};
class nsTransactionStack
{
nsDeque mQue;

Просмотреть файл

@ -60,7 +60,7 @@ static const PRUint32 gLBClass00[32] = {
0x77777777, // U+0090 - U+0097
0x77777777, // U+0098 - U+009F
0xAA9A9AAB, // U+00A0 - U+00A7
0x77A9A77A, // U+00A8 - U+00AF
0x77A9777A, // U+00A8 - U+00AF
0xAAAAAAAA, // U+00B0 - U+00B7
0xAAAAAAAA, // U+00B8 - U+00BF
0x77777777, // U+00C0 - U+00C7
@ -77,7 +77,7 @@ static const PRUint32 gLBClass20[32] = {
0xB5555555, // U+2000 - U+2007
0x77775555, // U+2008 - U+200F
0x777277B7, // U+2010 - U+2017
0x77777777, // U+2018 - U+201F
0x77A777A7, // U+2018 - U+201F
0xAAAA7777, // U+2020 - U+2027
0xB7777777, // U+2028 - U+202F
0x77744444, // U+2030 - U+2037

Просмотреть файл

@ -307,7 +307,7 @@ static const PRUint16 gPair[MAX_CLASSES] = {
18 0000 1111 1101 1111 = 0x0FDF
COMPLEX 0000 1111 1100 0010 = 0x0FC2
[c] 0000 1111 1111 1111 = 0x0FFF
[d] 0000 1111 1101 1111 = 0x0EDF
[d] 0000 1111 1101 1111 = 0x0FDF
[e] 0000 1111 1111 1111 = 0x0FFF
*/
@ -322,7 +322,7 @@ static const PRUint16 gPairConservative[MAX_CLASSES] = {
0x0FDF,
0x0FC2,
0x0FFF,
0x0EDF,
0x0FDF,
0x0FFF
};
@ -384,13 +384,19 @@ static const PRUint16 gPairConservative[MAX_CLASSES] = {
#define U_AMPERSAND PRUnichar('&')
#define U_SEMICOLON PRUnichar(';')
#define U_BACKSLASH PRUnichar('\\')
#define U_OPEN_SINGLE_QUOTE PRUnichar(0x2018)
#define U_OPEN_DOUBLE_QUOTE PRUnichar(0x201C)
#define U_OPEN_GUILLEMET PRUnichar(0x00AB)
#define NEED_CONTEXTUAL_ANALYSIS(c) (IS_HYPHEN(c) || \
(c) == U_SLASH || \
(c) == U_PERCENT || \
(c) == U_AMPERSAND || \
(c) == U_SEMICOLON || \
(c) == U_BACKSLASH)
(c) == U_BACKSLASH || \
(c) == U_OPEN_SINGLE_QUOTE || \
(c) == U_OPEN_DOUBLE_QUOTE || \
(c) == U_OPEN_GUILLEMET)
#define IS_ASCII_DIGIT(u) (0x0030 <= (u) && (u) <= 0x0039)
@ -719,6 +725,14 @@ ContextualAnalysis(PRUnichar prev, PRUnichar cur, PRUnichar next,
if (!aState.UseConservativeBreaking(1) &&
aState.HasCharacterAlready(U_EQUAL))
return CLASS_CLOSE;
} else if (cur == U_OPEN_SINGLE_QUOTE ||
cur == U_OPEN_DOUBLE_QUOTE ||
cur == U_OPEN_GUILLEMET) {
// for CJK usage, we treat these as openers to allow a break before them,
// but otherwise treat them as normal characters because quote mark usage
// in various Western languages varies too much; see bug #450088 discussion.
if (!aState.UseConservativeBreaking() && IS_CJK_CHAR(next))
return CLASS_OPEN;
} else {
NS_ERROR("Forgot to handle the current character!");
}

Просмотреть файл

@ -326,10 +326,10 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD>157</TD>
<TD></TD>
<TD>33</TD>
<TD>57</TD>
<TD>56</TD>
<TD>125</TD>
<TD>3</TD>
<TD BGCOLOR=white>394</TD>
<TD BGCOLOR=white>393</TD>
<TD></TD>
<TD>19</TD>
<TD></TD>
@ -348,8 +348,8 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD>4</TD>
<TD>5</TD>
<TD>2</TD>
<TD>2</TD>
<TD>4</TD>
<TD></TD>
<TD>5</TD>
<TD>36</TD>
<TD>4</TD>
<TD></TD>
@ -443,10 +443,10 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD>2</TD>
<TD></TD>
<TD>6</TD>
<TD>25</TD>
<TD>26</TD>
<TD>16</TD>
<TD></TD>
<TD BGCOLOR=white>50</TD>
<TD BGCOLOR=white>51</TD>
<TD></TD>
<TD>1</TD>
<TD></TD>
@ -465,8 +465,8 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD></TD>
<TD></TD>
<TD>3</TD>
<TD>1</TD>
<TD>1</TD>
<TD>3</TD>
<TD></TD>
<TD>20</TD>
<TD></TD>
<TD>2</TD>
@ -580,10 +580,10 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD></TD>
<TD>33</TD>
<TD>10</TD>
<TD>126</TD>
<TD>127</TD>
<TD></TD>
<TD>7</TD>
<TD>45</TD>
<TD>44</TD>
<TD>2</TD>
<TD></TD>
</TR>
@ -610,10 +610,10 @@ Analysis of JIS X 4051 to Unicode General Category Mapping
<TD>5</TD>
<TD>12</TD>
<TD></TD>
<TD>104</TD>
<TD>102</TD>
<TD></TD>
<TD></TD>
<TD>5</TD>
<TD>7</TD>
<TD>3</TD>
<TD></TD>
</TR>

Просмотреть файл

@ -24,6 +24,7 @@
00A5;;22
00A9;;18
00AA;;18
00AB;;18
00AC;;22
00AE;;18
00AF;;18
@ -49,6 +50,8 @@
2014;;7
2015;;18
2016;2017;18
2019;;23
201D;;23
2018;201F;18
2020;2023;18
2024;2026;23

Просмотреть файл

@ -3737,6 +3737,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
NS_ASSERTION(anEvent.message == NS_MOUSE_BUTTON_DOWN ||
anEvent.message == NS_MOUSE_BUTTON_UP ||
anEvent.message == NS_MOUSE_DOUBLECLICK ||
anEvent.message == NS_MOUSE_ENTER_SYNTH ||
anEvent.message == NS_MOUSE_EXIT_SYNTH ||
anEvent.message == NS_MOUSE_MOVE,
"Incorrect event type for coordinate translation");
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mOwner);

Просмотреть файл

@ -0,0 +1,18 @@
<html>
<head>
<style type="text/css"> p { margin: 5px 1em; width: 0; white-space: nowrap; } </style>
</head>
<body>
<p>&#x5B57;<br>&#x2018;&#x5B57;&#x2019;<br>&#x5B57;<br>&#x201C;&#x5B57;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF0C;<br>&#x2018;&#x5B57;&#xFF0C;&#x2019;<br>&#x5B57;&#xFF0C;<br>&#x201C;&#x5B57;&#xFF0C;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF0E;<br>&#x2018;&#x5B57;&#xFF0E;&#x2019;<br>&#x5B57;&#xFF0E;<br>&#x201C;&#x5B57;&#xFF0E;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF1A;<br>&#x2018;&#x5B57;&#xFF1A;&#x2019;<br>&#x5B57;&#xFF1A;<br>&#x201C;&#x5B57;&#xFF1A;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF1B;<br>&#x2018;&#x5B57;&#xFF1B;&#x2019;<br>&#x5B57;&#xFF1B;<br>&#x201C;&#x5B57;&#xFF1B;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF01;<br>&#x2018;&#x5B57;&#xFF01;&#x2019;<br>&#x5B57;&#xFF01;<br>&#x201C;&#x5B57;&#xFF01;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;&#xFF1F;<br>&#x2018;&#x5B57;&#xFF1F;&#x2019;<br>&#x5B57;&#xFF1F;<br>&#x201C;&#x5B57;&#xFF1F;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;<br>&#x2018;&#xFF08;&#x5B57;&#xFF09;&#x2019;<br>&#x5B57;<br>&#x201C;&#xFF08;&#x5B57;&#xFF09;&#x201D;<br>&#x5B57;</p>
<p>&#x5B57;<br>&#xFF08;&#x2018;&#x5B57;&#x2019;&#xFF09;<br>&#x5B57;<br>&#xFF08;&#x201C;&#x5B57;&#x201D;&#xFF09;<br>&#x5B57;</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,19 @@
<html>
<head>
<meta content-type="text/html" charset="utf8">
<style type="text/css"> p { margin: 5px 1em; width: 0; } </style>
</head>
<body>
<p>&#x5B57;&#x2018;&#x5B57;&#x2019;&#x5B57;&#x201C;&#x5B57;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF0C;&#x2018;&#x5B57;&#xFF0C;&#x2019;&#x5B57;&#xFF0C;&#x201C;&#x5B57;&#xFF0C;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF0E;&#x2018;&#x5B57;&#xFF0E;&#x2019;&#x5B57;&#xFF0E;&#x201C;&#x5B57;&#xFF0E;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF1A;&#x2018;&#x5B57;&#xFF1A;&#x2019;&#x5B57;&#xFF1A;&#x201C;&#x5B57;&#xFF1A;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF1B;&#x2018;&#x5B57;&#xFF1B;&#x2019;&#x5B57;&#xFF1B;&#x201C;&#x5B57;&#xFF1B;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF01;&#x2018;&#x5B57;&#xFF01;&#x2019;&#x5B57;&#xFF01;&#x201C;&#x5B57;&#xFF01;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF1F;&#x2018;&#x5B57;&#xFF1F;&#x2019;&#x5B57;&#xFF1F;&#x201C;&#x5B57;&#xFF1F;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#x2018;&#xFF08;&#x5B57;&#xFF09;&#x2019;&#x5B57;&#x201C;&#xFF08;&#x5B57;&#xFF09;&#x201D;&#x5B57;</p>
<p>&#x5B57;&#xFF08;&#x2018;&#x5B57;&#x2019;&#xFF09;&#x5B57;&#xFF08;&#x201C;&#x5B57;&#x201D;&#xFF09;&#x5B57;</p>
</body>
</html>

Просмотреть файл

@ -12,6 +12,9 @@
== numerics-1.html numerics-1-ref.html
== parentheses-1.html parentheses-1-ref.html
== quotationmarks-1.html quotationmarks-1-ref.html
# The following is currently disabled on Linux because of a rendering issue with missing-glyph
# representations on the test boxes. See bug #450088 for discussion.
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") == quotationmarks-cjk-1.html quotationmarks-cjk-1-ref.html
== smileys-1.html smileys-1-ref.html
== smileys-2.html smileys-2-ref.html
== url-1.html url-1-ref.html

Просмотреть файл

@ -82,6 +82,7 @@
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "nsIReflowCallback.h"
#include "nsISound.h"
#define NS_MENU_POPUP_LIST_INDEX 0
@ -1172,6 +1173,10 @@ nsMenuFrame::Execute(nsGUIEvent *aEvent)
}
}
nsCOMPtr<nsISound> sound(do_CreateInstance("@mozilla.org/sound;1"));
if (sound)
sound->PlaySystemSound(NS_SYSSOUND_MENU_EXECUTE);
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm && mMenuParent)
pm->ExecuteMenu(mContent, aEvent);

Просмотреть файл

@ -83,9 +83,7 @@
#include "nsBindingManager.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIBaseWindow.h"
#ifdef XP_WIN
#include "nsISound.h"
#endif
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
@ -625,6 +623,11 @@ nsMenuPopupFrame::ShowPopup(PRBool aIsContextMenu, PRBool aSelectFirstItem)
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (mPopupType == ePopupTypeMenu) {
nsCOMPtr<nsISound> sound(do_CreateInstance("@mozilla.org/sound;1"));
if (sound)
sound->PlaySystemSound(NS_SYSSOUND_MENU_POPUP);
}
}
mShouldAutoPosition = PR_TRUE;

Просмотреть файл

@ -174,7 +174,7 @@
* XXX OS X over-commits, so we should probably use mmap() instead of
* vm_allocate(), so that MALLOC_PAGEFILE works.
*/
//# define MALLOC_PAGEFILE
#define MALLOC_PAGEFILE
#endif
#ifdef MALLOC_PAGEFILE

Просмотреть файл

@ -124,6 +124,7 @@
#define PREF_AUTOCOMPLETE_FILTER_JAVASCRIPT "urlbar.filter.javascript"
#define PREF_AUTOCOMPLETE_ENABLED "urlbar.autocomplete.enabled"
#define PREF_AUTOCOMPLETE_MAX_RICH_RESULTS "urlbar.maxRichResults"
#define PREF_AUTOCOMPLETE_DEFAULT_BEHAVIOR "urlbar.default.behavior"
#define PREF_AUTOCOMPLETE_RESTRICT_HISTORY "urlbar.restrict.history"
#define PREF_AUTOCOMPLETE_RESTRICT_BOOKMARK "urlbar.restrict.bookmark"
#define PREF_AUTOCOMPLETE_RESTRICT_TAG "urlbar.restrict.tag"
@ -320,6 +321,12 @@ const PRInt32 nsNavHistory::kAutoCompleteIndex_BookmarkTitle = 4;
const PRInt32 nsNavHistory::kAutoCompleteIndex_Tags = 5;
const PRInt32 nsNavHistory::kAutoCompleteIndex_VisitCount = 6;
const PRInt32 nsNavHistory::kAutoCompleteBehaviorHistory = 1 << 0;
const PRInt32 nsNavHistory::kAutoCompleteBehaviorBookmark = 1 << 1;
const PRInt32 nsNavHistory::kAutoCompleteBehaviorTag = 1 << 2;
const PRInt32 nsNavHistory::kAutoCompleteBehaviorTitle = 1 << 3;
const PRInt32 nsNavHistory::kAutoCompleteBehaviorUrl = 1 << 4;
static const char* gQuitApplicationMessage = "quit-application";
static const char* gXpcomShutdown = "xpcom-shutdown";
static const char* gAutoCompleteFeedback = "autocomplete-will-enter-text";
@ -372,11 +379,8 @@ nsNavHistory::nsNavHistory() : mBatchLevel(0),
mAutoCompleteMatchUrl(NS_LITERAL_STRING("@")),
mAutoCompleteSearchChunkSize(100),
mAutoCompleteSearchTimeout(100),
mRestrictHistory(PR_FALSE),
mRestrictBookmark(PR_FALSE),
mRestrictTag(PR_FALSE),
mMatchTitle(PR_FALSE),
mMatchUrl(PR_FALSE),
mAutoCompleteDefaultBehavior(0),
mAutoCompleteCurrentBehavior(0),
mPreviousChunkOffset(-1),
mAutoCompleteFinishedSearch(PR_FALSE),
mExpireDaysMin(0),
@ -502,6 +506,7 @@ nsNavHistory::Init()
pbi->AddObserver(PREF_AUTOCOMPLETE_SEARCH_SOURCES, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_FILTER_JAVASCRIPT, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_MAX_RICH_RESULTS, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_DEFAULT_BEHAVIOR, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_RESTRICT_HISTORY, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_RESTRICT_BOOKMARK, this, PR_FALSE);
pbi->AddObserver(PREF_AUTOCOMPLETE_RESTRICT_TAG, this, PR_FALSE);
@ -2068,6 +2073,8 @@ nsNavHistory::LoadPrefs(PRBool aInitializing)
&mAutoCompleteSearchChunkSize);
mPrefBranch->GetIntPref(PREF_AUTOCOMPLETE_SEARCH_TIMEOUT,
&mAutoCompleteSearchTimeout);
mPrefBranch->GetIntPref(PREF_AUTOCOMPLETE_DEFAULT_BEHAVIOR,
&mAutoCompleteDefaultBehavior);
nsXPIDLCString prefStr;
mPrefBranch->GetCharPref(PREF_AUTOCOMPLETE_RESTRICT_HISTORY,
getter_Copies(prefStr));

Просмотреть файл

@ -737,11 +737,14 @@ protected:
PRInt32 mAutoCompleteSearchTimeout;
nsCOMPtr<nsITimer> mAutoCompleteTimer;
PRBool mRestrictHistory;
PRBool mRestrictBookmark;
PRBool mRestrictTag;
PRBool mMatchTitle;
PRBool mMatchUrl;
static const PRInt32 kAutoCompleteBehaviorHistory;
static const PRInt32 kAutoCompleteBehaviorBookmark;
static const PRInt32 kAutoCompleteBehaviorTag;
static const PRInt32 kAutoCompleteBehaviorTitle;
static const PRInt32 kAutoCompleteBehaviorUrl;
PRInt32 mAutoCompleteDefaultBehavior; // kAutoCompleteBehavior* bitmap
PRInt32 mAutoCompleteCurrentBehavior; // kAutoCompleteBehavior* bitmap
// Original search string for case-sensitive usage
nsString mOrigSearchString;

Просмотреть файл

@ -83,6 +83,12 @@
#define NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID \
"@mozilla.org/autocomplete/simple-result;1"
// Helpers to get and set fields in the mAutoCompleteCurrentBehavior bitmap
#define GET_BEHAVIOR(aBitName) \
(mAutoCompleteCurrentBehavior & kAutoCompleteBehavior##aBitName)
#define SET_BEHAVIOR(aBitName) \
mAutoCompleteCurrentBehavior |= kAutoCompleteBehavior##aBitName
// Helper to get a particular column with a desired name from the bookmark and
// tags table based on if we want to include tags or not
#define SQL_STR_FRAGMENT_GET_BOOK_TAG(name, column, comparison, getMostRecent) \
@ -792,18 +798,14 @@ nsNavHistory::AddSearchToken(nsAutoString &aToken)
void
nsNavHistory::ProcessTokensForSpecialSearch()
{
// If any of the special searches are empty, automatically use it
mRestrictHistory = mAutoCompleteRestrictHistory.IsEmpty();
mRestrictBookmark = mAutoCompleteRestrictBookmark.IsEmpty();
mRestrictTag = mAutoCompleteRestrictTag.IsEmpty();
mMatchTitle = mAutoCompleteMatchTitle.IsEmpty();
mMatchUrl = mAutoCompleteMatchUrl.IsEmpty();
// Start with the default behavior
mAutoCompleteCurrentBehavior = mAutoCompleteDefaultBehavior;
// If we're searching only one of history or bookmark, we can use filters
if (mAutoCompleteSearchSources == SEARCH_HISTORY)
mRestrictHistory = PR_TRUE;
SET_BEHAVIOR(History);
else if (mAutoCompleteSearchSources == SEARCH_BOOKMARK)
mRestrictBookmark = PR_TRUE;
SET_BEHAVIOR(Bookmark);
// SEARCH_BOTH doesn't require any filtering
// Determine which special searches to apply
@ -812,15 +814,15 @@ nsNavHistory::ProcessTokensForSpecialSearch()
const nsString *token = mCurrentSearchTokens.StringAt(i);
if (token->Equals(mAutoCompleteRestrictHistory))
mRestrictHistory = PR_TRUE;
SET_BEHAVIOR(History);
else if (token->Equals(mAutoCompleteRestrictBookmark))
mRestrictBookmark = PR_TRUE;
SET_BEHAVIOR(Bookmark);
else if (token->Equals(mAutoCompleteRestrictTag))
mRestrictTag = PR_TRUE;
SET_BEHAVIOR(Tag);
else if (token->Equals(mAutoCompleteMatchTitle))
mMatchTitle = PR_TRUE;
SET_BEHAVIOR(Title);
else if (token->Equals(mAutoCompleteMatchUrl))
mMatchUrl = PR_TRUE;
SET_BEHAVIOR(Url);
else
needToRemove = PR_FALSE;
@ -831,9 +833,9 @@ nsNavHistory::ProcessTokensForSpecialSearch()
// We can use optimized queries for restricts, so check for the most
// restrictive query first
mDBCurrentQuery = mRestrictTag ? GetDBAutoCompleteTagsQuery() :
mRestrictBookmark ? GetDBAutoCompleteStarQuery() :
mRestrictHistory ? GetDBAutoCompleteHistoryQuery() :
mDBCurrentQuery = GET_BEHAVIOR(Tag) ? GetDBAutoCompleteTagsQuery() :
GET_BEHAVIOR(Bookmark) ? GetDBAutoCompleteStarQuery() :
GET_BEHAVIOR(History) ? GetDBAutoCompleteHistoryQuery() :
static_cast<mozIStorageStatement *>(mDBAutoCompleteQuery);
}
@ -1026,9 +1028,9 @@ nsNavHistory::AutoCompleteProcessSearch(mozIStorageStatement* aQuery,
// only history items, only bookmarks, only tags. If a given restrict
// is active, make sure a corresponding condition is *not* true. If
// any are violated, matchAll will be false.
PRBool matchAll = !((mRestrictHistory && visitCount == 0) ||
(mRestrictBookmark && !parentId) ||
(mRestrictTag && entryTags.IsEmpty()));
PRBool matchAll = !((GET_BEHAVIOR(History) && visitCount == 0) ||
(GET_BEHAVIOR(Bookmark) && !parentId) ||
(GET_BEHAVIOR(Tag) && entryTags.IsEmpty()));
// Unescape the url to search for unescaped terms
nsString entryURL = FixupURIText(escapedEntryURL);
@ -1045,14 +1047,14 @@ nsNavHistory::AutoCompleteProcessSearch(mozIStorageStatement* aQuery,
// Make sure we match something in the title or tags if we have to
matchAll = matchTags || matchTitle;
if (mMatchTitle && !matchAll)
if (GET_BEHAVIOR(Title) && !matchAll)
break;
// Check if the url matches the search term
PRBool matchUrl = (*tokenMatchesTarget)(*token, entryURL);
// If we don't match the url when we have to, reset matchAll to
// false; otherwise keep track that we did match the current search
if (mMatchUrl && !matchUrl)
if (GET_BEHAVIOR(Url) && !matchUrl)
matchAll = PR_FALSE;
else
matchAll |= matchUrl;

Просмотреть файл

@ -39,8 +39,9 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const NH_CONTRACTID = "@mozilla.org/browser/nav-history-service;1";
const BMS_CONTRACTID = "@mozilla.org/browser/nav-bookmarks-service;1";
@ -55,15 +56,14 @@ var gIoService = Cc[IO_CONTRACTID].getService(Ci.nsIIOService);
* The Places Tagging Service
*/
function TaggingService() {
this._bms = Cc[BMS_CONTRACTID].getService(Ci.nsINavBookmarksService);
this._bms.addObserver(this, false);
this._obss = Cc[OBSS_CONTRACTID].getService(Ci.nsIObserverService);
this._obss.addObserver(this, "xpcom-shutdown", false);
}
TaggingService.prototype = {
get _bms() {
if (!this.__bms)
this.__bms = Cc[BMS_CONTRACTID].getService(Ci.nsINavBookmarksService);
return this.__bms;
},
get _history() {
if (!this.__history)
this.__history = Cc[NH_CONTRACTID].getService(Ci.nsINavHistoryService);
@ -76,22 +76,6 @@ TaggingService.prototype = {
return this.__annos;
},
get _tagsResult() {
if (!this.__tagsResult) {
var options = this._history.getNewQueryOptions();
var query = this._history.getNewQuery();
query.setFolders([this._bms.tagsFolder], 1);
this.__tagsResult = this._history.executeQuery(query, options);
this.__tagsResult.root.containerOpen = true;
this.__tagsResult.viewer = this;
// we need to null out the result on shutdown
var observerSvc = Cc[OBSS_CONTRACTID].getService(Ci.nsIObserverService);
observerSvc.addObserver(this, "xpcom-shutdown", false);
}
return this.__tagsResult;
},
// Feed XPCOMUtils
classDescription: "Places Tagging Service",
contractID: "@mozilla.org/browser/tagging-service;1",
@ -99,29 +83,30 @@ TaggingService.prototype = {
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsITaggingService,
Ci.nsINavBookmarkObserver,
Ci.nsIObserver]),
/**
* If there's no tag with the given name, null is returned;
* If there's no tag with the given name or id, null is returned;
*/
_getTagNode: function TS__getTagIndex(aTagNameOrId) {
_getTagResult: function TS__getTagResult(aTagNameOrId) {
if (!aTagNameOrId)
throw Cr.NS_ERROR_INVALID_ARG;
var nameLower = null;
var tagId = null;
if (typeof(aTagNameOrId) == "string")
nameLower = aTagNameOrId.toLowerCase();
tagId = this._getItemIdForTag(aTagNameOrId);
else
tagId = aTagNameOrId;
var root = this._tagsResult.root;
var cc = root.childCount;
for (var i=0; i < cc; i++) {
var child = root.getChild(i);
if ((nameLower && child.title.toLowerCase() == nameLower) ||
child.itemId === aTagNameOrId)
return child;
}
if (tagId == -1)
return null;
return null;
var options = this._history.getNewQueryOptions();
var query = this._history.getNewQuery();
query.setFolders([tagId], 1);
var result = this._history.executeQuery(query, options);
return result;
},
/**
@ -141,23 +126,36 @@ TaggingService.prototype = {
*
* @param [in] aURI
* url to check for
* @param [in] aTagId
* id of the folder representing the tag to check
* @param [out] aItemId
* the id of the item found under the tag container
* @returns true if the given uri is tagged with the given tag, false
* @param [in] aTagName
* the tag to check for
* @returns the item id if the URI is tagged with the given tag, -1
* otherwise.
*/
_isURITaggedInternal: function TS__uriTagged(aURI, aTagId, aItemId) {
_getItemIdForTaggedURI: function TS__getItemIdForTaggedURI(aURI, aTagName) {
var tagId = this._getItemIdForTag(aTagName);
if (tagId == -1)
return -1;
var bookmarkIds = this._bms.getBookmarkIdsForURI(aURI, {});
for (var i=0; i < bookmarkIds.length; i++) {
var parent = this._bms.getFolderIdForItem(bookmarkIds[i]);
if (parent == aTagId) {
aItemId.value = bookmarkIds[i];
return true;
}
if (parent == tagId)
return bookmarkIds[i];
}
return false;
return -1;
},
/**
* Returns the folder id for a tag, or -1 if not found.
* @param [in] aTag
* string tag to search for
* @returns integer id for the bookmark folder for the tag
*/
_getItemIdForTag: function TS_getItemIdForTag(aTagName) {
for (var i in this._tagFolders) {
if (aTagName.toLowerCase() == this._tagFolders[i].toLowerCase())
return parseInt(i);
}
return -1;
},
// nsITaggingService
@ -166,24 +164,33 @@ TaggingService.prototype = {
throw Cr.NS_ERROR_INVALID_ARG;
for (var i=0; i < aTags.length; i++) {
var tagNode = this._getTagNode(aTags[i]);
if (!tagNode) {
if (typeof(aTags[i]) == "number")
var tag = aTags[i];
var tagId = null;
if (typeof(tag) == "number") {
// is it a tag folder id?
if (this._tagFolders[tag]) {
tagId = tag;
tag = this._tagFolders[tagId];
}
else
throw Cr.NS_ERROR_INVALID_ARG;
var tagId = this._createTag(aTags[i]);
this._bms.insertBookmark(tagId, aURI, this._bms.DEFAULT_INDEX, null);
}
else {
var tagId = tagNode.itemId;
if (!this._isURITaggedInternal(aURI, tagNode.itemId, {}))
this._bms.insertBookmark(tagId, aURI, this._bms.DEFAULT_INDEX, null);
tagId = this._getItemIdForTag(tag);
if (tagId == -1)
tagId = this._createTag(tag);
}
// _getTagNode ignores case sensitivity
// rename the tag container so the places view would match the
// user-typed values
if (typeof(aTags[i]) == "string" && tagNode.title != aTags[i])
this._bms.setItemTitle(tagNode.itemId, aTags[i]);
var itemId = this._getItemIdForTaggedURI(aURI, tag);
if (itemId == -1)
this._bms.insertBookmark(tagId, aURI, this._bms.DEFAULT_INDEX, null);
// Rename the tag container so the Places view would match the
// most-recent user-typed values.
var currentTagTitle = this._bms.getItemTitle(tagId);
if (currentTagTitle != tag) {
this._bms.setItemTitle(tagId, tag);
this._tagFolders[tagId] = tag;
}
}
},
@ -195,16 +202,16 @@ TaggingService.prototype = {
* the item-id of the tag element under the tags root
*/
_removeTagIfEmpty: function TS__removeTagIfEmpty(aTagId) {
var node = this._getTagNode(aTagId).QueryInterface(Ci.nsINavHistoryContainerResultNode);
var wasOpen = node.containerOpen;
if (!wasOpen)
node.containerOpen = true;
var result = this._getTagResult(aTagId);
if (!result)
return;
var node = result.root;
node.QueryInterface(Ci.nsINavHistoryContainerResultNode);
node.containerOpen = true;
var cc = node.childCount;
if (wasOpen)
node.containerOpen = false;
if (cc == 0) {
node.containerOpen = false;
if (cc == 0)
this._bms.removeFolder(node.itemId);
}
},
// nsITaggingService
@ -219,16 +226,27 @@ TaggingService.prototype = {
}
for (var i=0; i < aTags.length; i++) {
var tagNode = this._getTagNode(aTags[i]);
if (tagNode) {
var itemId = { };
if (this._isURITaggedInternal(aURI, tagNode.itemId, itemId)) {
this._bms.removeItem(itemId.value);
this._removeTagIfEmpty(tagNode.itemId);
var tag = aTags[i];
var tagId = null;
if (typeof(tag) == "number") {
// is it a tag folder id?
if (this._tagFolders[tag]) {
tagId = tag;
tag = this._tagFolders[tagId];
}
else
throw Cr.NS_ERROR_INVALID_ARG;
}
else
tagId = this._getItemIdForTag(tag);
if (tagId != -1) {
var itemId = this._getItemIdForTaggedURI(aURI, tag);
if (itemId != -1) {
this._bms.removeItem(itemId);
this._removeTagIfEmpty(tagId);
}
}
else if (typeof(aTags[i]) == "number")
throw Cr.NS_ERROR_INVALID_ARG;
}
},
@ -238,8 +256,9 @@ TaggingService.prototype = {
throw Cr.NS_ERROR_INVALID_ARG;
var uris = [];
var tagNode = this._getTagNode(aTag);
if (tagNode) {
var tagResult = this._getTagResult(aTag);
if (tagResult) {
var tagNode = tagResult.root;
tagNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
tagNode.containerOpen = true;
var cc = tagNode.childCount;
@ -263,15 +282,10 @@ TaggingService.prototype = {
var tags = [];
var bookmarkIds = this._bms.getBookmarkIdsForURI(aURI, {});
var root = this._tagsResult.root;
var cc = root.childCount;
for (var i=0; i < bookmarkIds.length; i++) {
var parent = this._bms.getFolderIdForItem(bookmarkIds[i]);
for (var j=0; j < cc; j++) {
var child = root.getChild(j);
if (child.itemId == parent)
tags.push(child.title);
}
var folderId = this._bms.getFolderIdForItem(bookmarkIds[i]);
if (this._tagFolders[folderId])
tags.push(this._tagFolders[folderId]);
}
// sort the tag list
@ -280,48 +294,75 @@ TaggingService.prototype = {
return tags;
},
// nsITaggingService
_allTags: null,
get allTags() {
if (!this._allTags) {
this._allTags = [];
var root = this._tagsResult.root;
__tagFolders: null,
get _tagFolders() {
if (!this.__tagFolders) {
this.__tagFolders = [];
var options = this._history.getNewQueryOptions();
options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY;
options.expandQueries = 0;
var query = this._history.getNewQuery();
var tagsResult = this._history.executeQuery(query, options);
var root = tagsResult.root;
root.containerOpen = true;
var cc = root.childCount;
for (var j=0; j < cc; j++) {
var child = root.getChild(j);
this._allTags.push(child.title);
for (var i=0; i < cc; i++) {
var child = root.getChild(i);
this.__tagFolders[child.itemId] = child.title;
}
// sort the tag list
this.allTags.sort();
root.containerOpen = false;
}
return this._allTags;
return this.__tagFolders;
},
// nsITaggingService
get allTags() {
var allTags = [];
for (var i in this._tagFolders)
allTags.push(this._tagFolders[i]);
// sort the tag list
allTags.sort();
return allTags;
},
// nsIObserver
observe: function TS_observe(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
this.__tagsResult.root.containerOpen = false;
this.__tagsResult.viewer = null;
this.__tagsResult = null;
var observerSvc = Cc[OBSS_CONTRACTID].getService(Ci.nsIObserverService);
observerSvc.removeObserver(this, "xpcom-shutdown");
this._bms.removeObserver(this);
this._obss.removeObserver(this, "xpcom-shutdown");
}
},
// nsINavHistoryResultViewer
// Used to invalidate the cached tag list
itemInserted: function() this._allTags = null,
itemRemoved: function() this._allTags = null,
itemMoved: function() {},
itemChanged: function() {},
itemReplaced: function() {},
containerOpened: function() {},
containerClosed: function() {},
invalidateContainer: function() this._allTags = null,
invalidateAll: function() this._allTags = null,
sortingChanged: function() {},
result: null
// boolean to indicate if we're in a batch
_inBatch: false,
// nsINavBookmarkObserver
onBeginUpdateBatch: function() {
this._inBatch = true;
},
onEndUpdateBatch: function() {
this._inBatch = false;
},
onItemAdded: function(aItemId, aFolderId, aIndex) {
if (aFolderId == this._bms.tagsFolder &&
this._bms.getItemType(aItemId) == this._bms.TYPE_FOLDER)
this._tagFolders[aItemId] = this._bms.getItemTitle(aItemId);
},
onItemRemoved: function(aItemId, aFolderId, aIndex){
if (aFolderId == this._bms.tagsFolder && this._tagFolders[aItemId])
delete this._tagFolders[aItemId];
},
onItemChanged: function(aItemId, aProperty, aIsAnnotationProperty, aValue){
if (this._tagFolders[aItemId])
this._tagFolders[aItemId] = this._bms.getItemTitle(aItemId);
},
onItemVisited: function(aItemId, aVisitID, time){},
onItemMoved: function(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex){
if (this._tagFolders[aItemId] && this._bms.tagFolder == aOldParent &&
this._bms.tagFolder != aNewParent)
delete this._tagFolders[aItemId];
}
};
// Implements nsIAutoCompleteResult

Просмотреть файл

@ -204,6 +204,9 @@ function addPageBook(aURI, aTitle, aBook, aTags, aKey)
function run_test() {
print("\n");
// always search in history + bookmarks, no matter what the default is
prefs.setIntPref("browser.urlbar.search.sources", 3);
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();

Просмотреть файл

@ -135,15 +135,21 @@ let gTests = [
["20: foo @ + -> in url, is tag",
"foo @ +", [10,11]],
// Test default usage by making the special search empty
// Test default usage by setting certain bits of default.behavior to 1
["21: foo -> default history",
"foo", [1,2,3,5,10], function() makeDefault("restrict.history")],
"foo", [1,2,3,5,10], function() makeDefault(1)],
["22: foo -> default history, is star",
"foo", [5,10], function() makeDefault("restrict.bookmark")],
"foo", [5,10], function() makeDefault(3)],
["23: foo -> default history, is star, in url",
"foo", [10], function() makeDefault("match.url")],
"foo", [10], function() makeDefault(19)],
// Change the default to be less restrictive to make sure we find more
["24: foo -> default is star, in url",
"foo", [6,7,10,11], function() makeDefault(18)],
["25: foo -> default in url",
"foo", [2,3,6,7,10,11], function() makeDefault(16)],
];
function makeDefault(pref) {
prefs.setCharPref("browser.urlbar." + pref, "");
function makeDefault(aDefault) {
prefs.setIntPref("browser.urlbar.default.behavior", aDefault);
}

Просмотреть файл

@ -18,6 +18,11 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
var wccrID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
/* abort the test if web feed handlers are not available */
if (!Cc[wccrID])
SimpleTest.finish()
/* Turn off the first run UI */
var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("browser.feeds.showFirstRunUI", false);
@ -25,7 +30,6 @@
/* register a handler for the feed type */
const MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
var handlerPage = "http://localhost:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=%s";
var wccrID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
var wccr = Cc[wccrID].getService(Ci.nsIWebContentConverterService);
wccr.registerContentHandler(MAYBE_FEED, handlerPage, "Demo handler", null);
var demoHandler = wccr.getWebContentHandlerByURI(MAYBE_FEED, handlerPage);

Просмотреть файл

@ -32,7 +32,7 @@
var dialog = doc.getElementById("commonDialog");
var desc = doc.getElementById("info.body");
var errmsg = desc.childNodes[0].data;
ok(errmsg.match(/\(place\)/), "Check for the correct message");
ok(errmsg.match(/\(place\)/) || errmsg.match(/^place /), "Check for the correct message");
// Clear the dialog
dialog.acceptDialog();

Просмотреть файл

@ -245,6 +245,9 @@ function run_test() {
controller.input = input;
// always search in history + bookmarks, no matter what the default is
prefs.setIntPref("browser.urlbar.search.sources", 3);
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();

Просмотреть файл

@ -163,6 +163,11 @@ var tests = [function() { ensure_tag_results([uri1, uri2, uri3], "foo"); },
* Test bug #408221
*/
function run_test() {
// always search in history + bookmarks, no matter what the default is
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefs.setIntPref("browser.urlbar.search.sources", 3);
tagssvc.tagURI(uri1, ["Foo"]);
tagssvc.tagURI(uri2, ["FOO"]);
tagssvc.tagURI(uri3, ["foO"]);

Просмотреть файл

@ -186,6 +186,11 @@ var tests = [
* Test history autocomplete
*/
function run_test() {
// always search in history + bookmarks, no matter what the default is
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefs.setIntPref("browser.urlbar.search.sources", 3);
tagssvc.tagURI(uri1, ["foo"]);
tagssvc.tagURI(uri2, ["bar"]);
tagssvc.tagURI(uri3, ["cheese"]);

Просмотреть файл

@ -88,8 +88,18 @@ function run_test() {
"view-source:http://www.google.com/"];
for each (var currentURL in urlsToIgnore) {
var cantAddUri = uri(currentURL);
add_uri_to_history(cantAddUri);
do_check_false(gh.isVisited(cantAddUri));
try {
var cantAddUri = uri(currentURL);
}
catch(e) {
// nsIIOService.newURI() can throw if e.g. our app knows about imap://
// but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test.
print("Exception thrown for '" + currentURL + "', ignored.");
}
if (cantAddUri) {
add_uri_to_history(cantAddUri);
do_check_false(gh.isVisited(cantAddUri));
}
}
}

Просмотреть файл

@ -1101,8 +1101,10 @@ let observer = {
current_test.setup();
PlacesDBUtils.maintenanceOnIdle();
}
else
else {
os.removeObserver(this, FINISHED_MAINTANANCE_NOTIFICATION_TOPIC);
do_test_finished();
}
}
}
}

Просмотреть файл

@ -90,7 +90,7 @@ function run_test() {
tag1node.containerOpen = true;
do_check_eq(tag1node.childCount, 2);
// Tagging the same url twice (or even trice!) with the same tag should be a
// Tagging the same url twice (or even thrice!) with the same tag should be a
// no-op
tagssvc.tagURI(uri1, ["tag 1"]);
do_check_eq(tag1node.childCount, 2);
@ -132,4 +132,30 @@ function run_test() {
tagssvc.untagURI(uri2, ["tag 1"]);
do_check_eq(tagRoot.childCount, 1);
// get array of tag folder ids => title
// for testing tagging with mixed folder ids and tags
var options = histsvc.getNewQueryOptions();
var query = histsvc.getNewQuery();
query.setFolders([bmsvc.tagsFolder], 1);
var result = histsvc.executeQuery(query, options);
var tagRoot = result.root;
tagRoot.containerOpen = true;
var tagFolders = [];
var child = tagRoot.getChild(0);
var tagId = child.itemId;
var tagTitle = child.title;
// test mixed id/name tagging
// as well as non-id numeric tags
var uri3 = uri("http://testuri/3");
tagssvc.tagURI(uri3, [tagId, "tag 3", "456"]);
var tags = tagssvc.getTagsForURI(uri3, {});
do_check_true(tags.indexOf(tagTitle) != -1);
do_check_true(tags.indexOf("tag 3") != -1);
do_check_true(tags.indexOf("456") != -1);
// test mixed id/name tagging
tagssvc.untagURI(uri3, [tagId, "tag 3", "456"]);
tags = tagssvc.getTagsForURI(uri3, {});
do_check_eq(tags.length, 0);
}

Просмотреть файл

@ -2415,7 +2415,10 @@ nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
event.time = PR_IntervalNow();
// XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
pointVM->GetViewObserver()->DispatchSynthMouseMove(&event, !aFromScroll);
nsCOMPtr<nsIViewObserver> observer = pointVM->GetViewObserver();
if (observer) {
observer->DispatchSynthMouseMove(&event, !aFromScroll);
}
if (!aFromScroll)
mSynthMouseMoveEvent.Forget();

Просмотреть файл

@ -66,6 +66,8 @@ interface nsISound : nsISupports
#define NS_SYSSOUND_CONFIRM_DIALOG NS_LITERAL_STRING("_moz_confirmdialog")
#define NS_SYSSOUND_PROMPT_DIALOG NS_LITERAL_STRING("_moz_promptdialog")
#define NS_SYSSOUND_SELECT_DIALOG NS_LITERAL_STRING("_moz_selectdialog")
#define NS_SYSSOUND_MENU_EXECUTE NS_LITERAL_STRING("_moz_menucommand")
#define NS_SYSSOUND_MENU_POPUP NS_LITERAL_STRING("_moz_menupopup")
#define NS_IsMozAliasSound(aSoundAlias) \
StringBeginsWith(aSoundAlias, NS_SYSSOUND_PREFIX)

Просмотреть файл

@ -88,14 +88,19 @@ nsMenuX::nsMenuX()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (nsToolkit::OnLeopardOrLater() && !gMenuMethodsSwizzled) {
nsToolkit::SwizzleMethods([NSMenu class], @selector(_addItem:toTable:),
@selector(nsMenuX_NSMenu_addItem:toTable:), PR_TRUE);
nsToolkit::SwizzleMethods([NSMenu class], @selector(_removeItem:fromTable:),
@selector(nsMenuX_NSMenu_removeItem:fromTable:), PR_TRUE);
Class SCTGRLIndexClass = ::NSClassFromString(@"SCTGRLIndex");
nsToolkit::SwizzleMethods(SCTGRLIndexClass, @selector(indexMenuBarDynamically),
@selector(nsMenuX_SCTGRLIndex_indexMenuBarDynamically));
if (!gMenuMethodsSwizzled) {
if (nsToolkit::OnLeopardOrLater()) {
nsToolkit::SwizzleMethods([NSMenu class], @selector(_addItem:toTable:),
@selector(nsMenuX_NSMenu_addItem:toTable:), PR_TRUE);
nsToolkit::SwizzleMethods([NSMenu class], @selector(_removeItem:fromTable:),
@selector(nsMenuX_NSMenu_removeItem:fromTable:), PR_TRUE);
Class SCTGRLIndexClass = ::NSClassFromString(@"SCTGRLIndex");
nsToolkit::SwizzleMethods(SCTGRLIndexClass, @selector(indexMenuBarDynamically),
@selector(nsMenuX_SCTGRLIndex_indexMenuBarDynamically));
} else {
nsToolkit::SwizzleMethods([NSMenu class], @selector(performKeyEquivalent:),
@selector(nsMenuX_NSMenu_performKeyEquivalent:));
}
gMenuMethodsSwizzled = PR_TRUE;
}
@ -1120,6 +1125,7 @@ static NSMutableDictionary *gShadowKeyEquivDB = nil;
@interface NSMenu (MethodSwizzling)
+ (void)nsMenuX_NSMenu_addItem:(NSMenuItem *)aItem toTable:(NSMapTable *)aTable;
+ (void)nsMenuX_NSMenu_removeItem:(NSMenuItem *)aItem fromTable:(NSMapTable *)aTable;
- (BOOL)nsMenuX_NSMenu_performKeyEquivalent:(NSEvent *)theEvent;
@end
@implementation NSMenu (MethodSwizzling)
@ -1165,6 +1171,20 @@ static NSMutableDictionary *gShadowKeyEquivDB = nil;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (BOOL)nsMenuX_NSMenu_performKeyEquivalent:(NSEvent *)theEvent
{
// On OS X 10.4.X (Tiger), Objective-C exceptions can occur during calls to
// [NSMenu performKeyEquivalent:] (from [GeckoNSMenu performKeyEquivalent:]
// or otherwise) that shouldn't be fatal (see bmo bug 461381). So on Tiger
// we hook this system call to eat (and log) all Objective-C exceptions that
// occur during its execution. Since we don't call XPCOM code from here,
// this will never cause XPCOM objects to be left on the stack without
// cleanup.
NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK_RETURN;
return [self nsMenuX_NSMenu_performKeyEquivalent:theEvent];
NS_OBJC_END_TRY_LOGONLY_BLOCK_RETURN(NO);
}
@end
// This class is needed to keep track of when the OS is (re)indexing all of

Просмотреть файл

@ -142,7 +142,7 @@ setup_widget_prototype(GtkWidget* widget)
gtk_container_add(GTK_CONTAINER(protoLayout), widget);
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
return MOZ_GTK_SUCCESS;
}
@ -287,7 +287,7 @@ moz_gtk_get_combo_box_inner_button(GtkWidget *widget, gpointer client_data)
g_object_add_weak_pointer(G_OBJECT(widget),
(gpointer) &gComboBoxButtonWidget);
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
}
@ -306,7 +306,7 @@ moz_gtk_get_combo_box_button_inner_widgets(GtkWidget *widget,
} else
return;
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
static gint
@ -347,7 +347,7 @@ ensure_combo_box_widgets()
&gComboBoxArrowWidget);
gtk_widget_realize(gComboBoxArrowWidget);
g_object_set_data(G_OBJECT(gComboBoxArrowWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
} else {
/* Shouldn't be reached with current internal gtk implementation; we
@ -397,7 +397,7 @@ moz_gtk_get_combo_box_entry_inner_widgets(GtkWidget *widget,
} else
return;
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
static void
@ -408,7 +408,7 @@ moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data)
g_object_add_weak_pointer(G_OBJECT(widget),
(gpointer) &gComboBoxEntryArrowWidget);
gtk_widget_realize(widget);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
}
@ -460,7 +460,7 @@ ensure_combo_box_entry_widgets()
&gComboBoxEntryArrowWidget);
gtk_widget_realize(gComboBoxEntryArrowWidget);
g_object_set_data(G_OBJECT(gComboBoxEntryArrowWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
} else {
/* Shouldn't be reached with current internal gtk implementation;
@ -500,7 +500,7 @@ ensure_toolbar_widget()
gToolbarWidget = gtk_toolbar_new();
gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget);
gtk_widget_realize(gToolbarWidget);
g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -589,7 +589,7 @@ ensure_menu_bar_item_widget()
gMenuBarItemWidget);
gtk_widget_realize(gMenuBarItemWidget);
g_object_set_data(G_OBJECT(gMenuBarItemWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -604,7 +604,7 @@ ensure_menu_popup_widget()
gMenuPopupWidget);
gtk_widget_realize(gMenuPopupWidget);
g_object_set_data(G_OBJECT(gMenuPopupWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -619,7 +619,7 @@ ensure_menu_item_widget()
gMenuItemWidget);
gtk_widget_realize(gMenuItemWidget);
g_object_set_data(G_OBJECT(gMenuItemWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -634,7 +634,7 @@ ensure_image_menu_item_widget()
gImageMenuItemWidget);
gtk_widget_realize(gImageMenuItemWidget);
g_object_set_data(G_OBJECT(gImageMenuItemWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -649,7 +649,7 @@ ensure_menu_separator_widget()
gMenuSeparatorWidget);
gtk_widget_realize(gMenuSeparatorWidget);
g_object_set_data(G_OBJECT(gMenuSeparatorWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -664,7 +664,7 @@ ensure_check_menu_item_widget()
gCheckMenuItemWidget);
gtk_widget_realize(gCheckMenuItemWidget);
g_object_set_data(G_OBJECT(gCheckMenuItemWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -719,9 +719,9 @@ ensure_tree_header_cell_widget()
gTreeHeaderCellWidget = GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn)->button;
gTreeHeaderSortArrowWidget = GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn)->arrow;
g_object_set_data(G_OBJECT(gTreeHeaderCellWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
g_object_set_data(G_OBJECT(gTreeHeaderSortArrowWidget),
"transparent-bg-hint", TRUE);
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
}
return MOZ_GTK_SUCCESS;
}
@ -1533,11 +1533,11 @@ moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
* If the theme is able to cope with transparency, then we can skip pre-filling
* and notify the theme it will paint directly on the canvas. */
if (theme_honors_transparency) {
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
} else {
gdk_draw_rectangle(drawable, style->base_gc[bg_state], TRUE,
cliprect->x, cliprect->y, cliprect->width, cliprect->height);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", FALSE);
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(FALSE));
}
/* Get the position of the inner window, see _gtk_entry_get_borders */

Просмотреть файл

@ -179,6 +179,10 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
sound = L"SystemQuestion";
else if (aSoundAlias.Equals(NS_SYSSOUND_ALERT_DIALOG))
sound = L"SystemExclamation";
else if (aSoundAlias.Equals(NS_SYSSOUND_MENU_EXECUTE))
sound = L"MenuCommand";
else if (aSoundAlias.Equals(NS_SYSSOUND_MENU_POPUP))
sound = L"MenuPopup";
if (sound)
::PlaySoundW(sound, nsnull, SND_NODEFAULT | SND_ALIAS | SND_ASYNC);

Просмотреть файл

@ -81,7 +81,6 @@ endif
EXPORTS = \
nsAgg.h \
nsAutoPtr.h \
nsAutoRef.h \
nsCom.h \
nsDebugImpl.h \
@ -112,6 +111,7 @@ SDK_XPIDLSRCS = \
nsrootidl.idl
SDK_HEADERS = \
nsAutoPtr.h \
nsError.h \
nsISupportsBase.h \
nscore.h \

Просмотреть файл

@ -240,4 +240,10 @@ NS_OBJC_TRY(_e, )
nsObjCExceptionLog(_exn); \
}
#define NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK_RETURN @try {
#define NS_OBJC_END_TRY_LOGONLY_BLOCK_RETURN(_rv) } @catch(NSException *_exn) { \
nsObjCExceptionLog(_exn); \
} \
return _rv;
#endif // nsObjCExceptions_h_

Просмотреть файл

@ -208,10 +208,10 @@ endif
ifneq (,$(filter-out OS2 WINCE WINNT Darwin BeOS,$(OS_ARCH)))
xulrunner:: mozilla.in $(GLOBAL_DEPS)
cat $< | sed -e "s|%MOZAPPDIR%|$(mozappdir)|" \
xulrunner:: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
-e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
-e "s|%MREDIR%|$(mredir)|" > $@
-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
chmod +x $@
libs:: xulrunner

Просмотреть файл

@ -1,289 +0,0 @@
#!/bin/sh
#
# ***** 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
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# 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 *****
## $Id: mozilla.in,v 1.4 2008/01/07 23:17:05 reed%reedloden.com Exp $
##
## Usage:
##
## $ mozilla [args]
##
## This script is meant to run the mozilla-bin binary from either
## mozilla/xpfe/bootstrap or mozilla/dist/bin.
##
## The script will setup all the environment voodoo needed to make
## the mozilla-bin binary to work.
##
moz_pis_startstop_scripts()
{
MOZ_USER_DIR="%MOZ_USER_DIR%"
# MOZ_PIS_ is the name space for "Mozilla Plugable Init Scripts"
# These variables and there meaning are specified in
# mozilla/xpfe/bootstrap/init.d/README
MOZ_PIS_API=2
MOZ_PIS_MOZBINDIR="${dist_bin}"
MOZ_PIS_SESSION_PID="$$"
MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
case "${1}" in
"start")
for curr_pis in "${dist_bin}/init.d"/S* "${HOME}/${MOZ_USER_DIR}/init.d"/S* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "start" ;;
esac
fi
done
;;
"stop")
for curr_pis in "${HOME}/${MOZ_USER_DIR}/init.d"/K* "${dist_bin}/init.d"/K* ; do
if [ -x "${curr_pis}" ] ; then
case "${curr_pis}" in
*.sh) . "${curr_pis}" ;;
*) "${curr_pis}" "stop" ;;
esac
fi
done
;;
*)
echo 1>&2 "$0: Internal error in moz_pis_startstop_scripts."
exit 1
;;
esac
}
#uncomment for debugging
#set -x
moz_libdir=%MOZAPPDIR%
MRE_HOME=%MREDIR%
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
found=0
progname="$0"
curdir=`dirname "$progname"`
progbase=`basename "$progname"`
profile=""
run_moz="$curdir/run-mozilla.sh"
if test -x "$run_moz"; then
dist_bin="$curdir"
found=1
else
here=`/bin/pwd`
while [ -h "$progname" ]; do
bn=`basename "$progname"`
cd `dirname "$progname"`
progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
progbase=`basename "$progname"`
if [ ! -x "$progname" ]; then
break
fi
curdir=`dirname "$progname"`
run_moz="$curdir/run-mozilla.sh"
if [ -x "$run_moz" ]; then
cd "$curdir"
dist_bin=`pwd`
found=1
break
fi
done
cd "$here"
fi
if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin="$moz_libdir"
else
echo "Cannot find mozilla runtime directory. Exiting."
exit 1
fi
fi
script_args=""
debugging=0
MOZILLA_BIN="${progbase}-bin"
MOZ_CLIENT_PROGRAM="$dist_bin/mozilla-xremote-client"
run_xremote_client() {
if [ -n "${profile}" ]; then
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" -p "${profile}" "$1"
else
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "$1"
fi
}
# The following is to check for a currently running instance.
# This is taken almost verbatim from the Mozilla RPM package's launch script.
check_running() {
run_xremote_client 'ping()' 2>/dev/null >/dev/null
RETURN_VAL=$?
if [ $RETURN_VAL -eq 0 ]; then
echo 1
return 1
else
echo 0
return 0
fi
}
if [ "$OSTYPE" = "beos" ]; then
mimeset -F "$MOZILLA_BIN"
fi
################################################################ Parse Arguments
# If there's a command line argument but it doesn't begin with a -
# it's probably a url. Try to send it to a running instance.
_USE_EXIST=0
_NEW_WINDOW=
_optOne="$1"
case "${_optOne}" in
-*)
;;
*)
_USE_EXIST=1
;;
esac
_optOthers=
_optLast=
for i in "$@"; do
_optLast="${i}"
done #last arg
for i in "$@"; do
[ "$i" = "${_optLast}" ] && break
_optOthers="${_optOthers} ${i}"
done #others arg
#???: needs check if othersopt begin with -* ?
if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
# Last argument seems to be a local file/directory
# Check, if it is absolutely specified (ie. /home/foo/file vs. ./file)
# If it is just "relatively" (./file) specified, make it absolutely
[ `expr "${_optLast}" : '/.*'` -eq 0 ] && _optLast="file://`pwd`/${_optLast}"
elif [ `expr "${_optLast}" : '.*:/.*'` -gt 0 -o -n "${_optOthers}" ]; then #???? like before...
_NEW_WINDOW=1
fi
# check for -P argument used to select a user profile
_expectProfileName=0
for i in "$@"; do
if [ "$i" = "-P" ]; then
_expectProfileName=1
profile=""
elif [ ${_expectProfileName} = 1 ]; then
_expectProfileName=0
profile="$i"
fi
done
################################################################ Parse Arguments
########################################################################### Main
ALREADY_RUNNING=`check_running`
if [ $ALREADY_RUNNING -eq 1 ]; then
# There's an instance already running. Use it.
# Any command line args passed in?
if [ $# -gt 0 ]; then
# There were "some" command line args.
if [ ${_USE_EXIST} -eq 1 ]; then
# We should use an existing instance, as _USE_EXIST=$_USE_EXIST=-1
_open_type="window"
#_open_type="tab"
_remote_cmd="openURL(${_optLast} , new-${_open_type})"
run_xremote_client "${_remote_cmd}"
unset _remote_cmd _open_type
exit $?
fi
else
# No command line args. Open new window/tab
run_xremote_client "xfeDoCommand(openBrowser)"
exit $?
fi
fi
# Default action - no running instance or _USE_EXIST (${_USE_EXIST}) ! -eq 1
########################################################################### Main
pass_arg_count=0
while [ $# -gt $pass_arg_count ]
do
case "$1" in
-p | --pure | -pure)
MOZILLA_BIN="${MOZILLA_BIN}.pure"
shift
;;
-g | --debug)
script_args="$script_args -g"
debugging=1
shift
;;
-d | --debugger)
script_args="$script_args -d $2"
shift 2
;;
*)
# Move the unrecognized argument to the end of the list.
arg="$1"
shift
set -- "$@" "$arg"
pass_arg_count=`expr $pass_arg_count + 1`
;;
esac
done
export MRE_HOME
## Start addon scripts
moz_pis_startstop_scripts "start"
if [ $debugging = 1 ]
then
echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
fi
"$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
exitcode=$?
## Stop addon scripts
moz_pis_startstop_scripts "stop"
exit $exitcode
# EOF.