Merge mozilla-central to tracemonkey.

This commit is contained in:
Robert Sayre 2009-11-07 11:33:47 -08:00
commit e57049cd34
748 changed files with 28717 additions and 15876 deletions

View File

@ -197,12 +197,12 @@ ifdef MOZ_CRASHREPORTER
$(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME) $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
echo packing symbols echo packing symbols
cd $(DIST)/crashreporter-symbols && \ cd $(DIST)/crashreporter-symbols && \
zip -r9D ../"$(SYMBOL_ARCHIVE_BASENAME).zip" . zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
endif # MOZ_CRASHREPORTER endif # MOZ_CRASHREPORTER
uploadsymbols: uploadsymbols:
ifdef MOZ_CRASHREPORTER ifdef MOZ_CRASHREPORTER
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip" $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip"
endif endif
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)

View File

@ -46,7 +46,7 @@ interface nsObjectFrame;
interface nsIContent; interface nsIContent;
interface nsITimer; interface nsITimer;
[uuid(6a58f7e8-587c-40dd-b684-dc3e54f1342a)] [uuid(29384ba1-f9ce-425d-afb5-54e2ee949d87)]
interface nsIAccessibilityService : nsIAccessibleRetrieval interface nsIAccessibilityService : nsIAccessibleRetrieval
{ {
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode); nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
@ -114,6 +114,12 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
*/ */
void processDocLoadEvent(in nsITimer aTimer, in voidPtr aClosure, in PRUint32 aEventType); void processDocLoadEvent(in nsITimer aTimer, in voidPtr aClosure, in PRUint32 aEventType);
/**
* Notify accessibility that anchor jump has been accomplished to the given
* target. Used by layout.
*/
void notifyOfAnchorJumpTo(in nsIContent aTarget);
/** /**
* Fire accessible event of the given type for the given target. * Fire accessible event of the given type for the given target.
* *

View File

@ -127,8 +127,7 @@ nsAccessibilityService::nsAccessibilityService()
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID)); nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress) { if (progress) {
progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this), progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this),
nsIWebProgress::NOTIFY_STATE_DOCUMENT | nsIWebProgress::NOTIFY_STATE_DOCUMENT);
nsIWebProgress::NOTIFY_LOCATION);
} }
// Initialize accessibility. // Initialize accessibility.
@ -265,6 +264,35 @@ NS_IMETHODIMP nsAccessibilityService::ProcessDocLoadEvent(nsITimer *aTimer, void
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent *aTarget)
{
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aTarget));
nsCOMPtr<nsIAccessible> targetAcc;
GetAccessibleFor(targetNode, getter_AddRefs(targetAcc));
// If the jump target is not accessible then fire an event for nearest
// accessible in parent chain.
if (!targetAcc) {
nsIDocument *document = aTarget->GetCurrentDoc();
nsCOMPtr<nsIDOMNode> documentNode(do_QueryInterface(document));
if (documentNode) {
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(documentNode);
if (accessibleDoc)
accessibleDoc->GetAccessibleInParentChain(targetNode, PR_TRUE,
getter_AddRefs(targetAcc));
}
}
if (targetAcc)
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
targetAcc);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent, nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
nsIAccessible *aTarget) nsIAccessible *aTarget)
@ -309,28 +337,7 @@ NS_IMETHODIMP nsAccessibilityService::OnProgressChange(nsIWebProgress *aWebProgr
NS_IMETHODIMP nsAccessibilityService::OnLocationChange(nsIWebProgress *aWebProgress, NS_IMETHODIMP nsAccessibilityService::OnLocationChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, nsIURI *location) nsIRequest *aRequest, nsIURI *location)
{ {
// If the document is already loaded, this will just check to see NS_NOTREACHED("notification excluded in AddProgressListener(...)");
// if an anchor jump event needs to be fired.
// If there is no accessible for the document, we will ignore
// this and the anchor jump event will be fired via OnStateChange
// and nsIAccessibleStates::STATE_STOP
nsCOMPtr<nsIDOMWindow> domWindow;
aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
NS_ASSERTION(domWindow, "DOM Window for state change is null");
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDoc;
domWindow->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDOMNode> domDocRootNode(do_QueryInterface(domDoc));
NS_ENSURE_TRUE(domDocRootNode, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(domDocRootNode);
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(accessibleDoc);
if (docAcc)
docAcc->FireAnchorJumpEvent();
return NS_OK; return NS_OK;
} }

View File

@ -3117,7 +3117,7 @@ nsAccessible::GetNameInternal(nsAString& aName)
// nsAccessible private methods // nsAccessible private methods
already_AddRefed<nsIAccessible> already_AddRefed<nsIAccessible>
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode, PRBool aRequireLeaf) nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode)
{ {
nsIAccessibilityService *accService = GetAccService(); nsIAccessibilityService *accService = GetAccService();
nsCOMPtr<nsIAccessible> accessible; nsCOMPtr<nsIAccessible> accessible;
@ -3126,11 +3126,9 @@ nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode, PRBool aRequir
while (currentNode) { while (currentNode) {
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, getter_AddRefs(accessible)); // AddRef'd accService->GetAccessibleInWeakShell(currentNode, mWeakShell, getter_AddRefs(accessible)); // AddRef'd
if (accessible && (!aRequireLeaf || nsAccUtils::IsLeaf(accessible))) { if (accessible)
nsIAccessible *retAccessible = accessible; return accessible.forget();
NS_ADDREF(retAccessible);
return retAccessible;
}
if (!walker) { if (!walker) {
// Instantiate walker lazily since we won't need it in 90% of the cases // Instantiate walker lazily since we won't need it in 90% of the cases
// where the first DOM node we're given provides an accessible // where the first DOM node we're given provides an accessible

View File

@ -326,13 +326,15 @@ protected:
already_AddRefed<nsIAccessible> GetNextWithState(nsIAccessible *aStart, PRUint32 matchState); already_AddRefed<nsIAccessible> GetNextWithState(nsIAccessible *aStart, PRUint32 matchState);
/** /**
* Return an accessible for the given DOM node, or if that node isn't accessible, return the * Return an accessible for the given DOM node, or if that node isn't
* accessible for the next DOM node which has one (based on forward depth first search) * accessible, return the accessible for the next DOM node which has one
* @param aStartNode, the DOM node to start from * (based on forward depth first search).
* @param aRequireLeaf, only accept leaf accessible nodes *
* @return the resulting accessible * @param aStartNode [in] the DOM node to start from
* @return the resulting accessible
*/ */
already_AddRefed<nsIAccessible> GetFirstAvailableAccessible(nsIDOMNode *aStartNode, PRBool aRequireLeaf = PR_FALSE); already_AddRefed<nsIAccessible>
GetFirstAvailableAccessible(nsIDOMNode *aStartNode);
// Hyperlink helpers // Hyperlink helpers
virtual nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset); virtual nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset);

View File

@ -307,17 +307,17 @@ nsAccEvent::GetAccessibleByNode()
/* static */ /* static */
void void
nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire) nsAccEvent::ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire)
{ {
PRUint32 numQueuedEvents = aEventsToFire.Length(); PRUint32 numQueuedEvents = aEventsToFire.Length();
PRInt32 tail = numQueuedEvents - 1; PRInt32 tail = numQueuedEvents - 1;
nsRefPtr<nsAccEvent> tailEvent = GetAccEventPtr(aEventsToFire[tail]); nsAccEvent* tailEvent = aEventsToFire[tail];
switch(tailEvent->mEventRule) { switch(tailEvent->mEventRule) {
case nsAccEvent::eCoalesceFromSameSubtree: case nsAccEvent::eCoalesceFromSameSubtree:
{ {
for (PRInt32 index = 0; index < tail; index ++) { for (PRInt32 index = 0; index < tail; index ++) {
nsRefPtr<nsAccEvent> thisEvent = GetAccEventPtr(aEventsToFire[index]); nsAccEvent* thisEvent = aEventsToFire[index];
if (thisEvent->mEventType != tailEvent->mEventType) if (thisEvent->mEventType != tailEvent->mEventType)
continue; // Different type continue; // Different type
@ -381,7 +381,7 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
{ {
// Check for repeat events. // Check for repeat events.
for (PRInt32 index = 0; index < tail; index ++) { for (PRInt32 index = 0; index < tail; index ++) {
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]); nsAccEvent* accEvent = aEventsToFire[index];
if (accEvent->mEventType == tailEvent->mEventType && if (accEvent->mEventType == tailEvent->mEventType &&
accEvent->mEventRule == tailEvent->mEventRule && accEvent->mEventRule == tailEvent->mEventRule &&
accEvent->mDOMNode == tailEvent->mDOMNode) { accEvent->mDOMNode == tailEvent->mDOMNode) {
@ -397,13 +397,13 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
/* static */ /* static */
void void
nsAccEvent::ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire, nsAccEvent::ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
PRUint32 aStart, PRUint32 aEnd, PRUint32 aStart, PRUint32 aEnd,
PRUint32 aEventType, nsIDOMNode* aDOMNode, PRUint32 aEventType, nsIDOMNode* aDOMNode,
EEventRule aEventRule) EEventRule aEventRule)
{ {
for (PRUint32 index = aStart; index < aEnd; index ++) { for (PRUint32 index = aStart; index < aEnd; index ++) {
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]); nsAccEvent* accEvent = aEventsToFire[index];
if (accEvent->mEventType == aEventType && if (accEvent->mEventType == aEventType &&
accEvent->mEventRule != nsAccEvent::eDoNotEmit && accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
nsCoreUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) { nsCoreUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) {

View File

@ -50,6 +50,7 @@
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsString.h" #include "nsString.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsAccUtils.h"
class nsIPresShell; class nsIPresShell;
@ -126,11 +127,13 @@ public:
return eventType; return eventType;
} }
static EEventRule EventRule(nsIAccessibleEvent *aAccEvent) { static EEventRule EventRule(nsIAccessibleEvent *aAccEvent) {
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent); nsRefPtr<nsAccEvent> accEvent =
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
return accEvent->mEventRule; return accEvent->mEventRule;
} }
static PRBool IsAsyncEvent(nsIAccessibleEvent *aAccEvent) { static PRBool IsAsyncEvent(nsIAccessibleEvent *aAccEvent) {
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent); nsRefPtr<nsAccEvent> accEvent =
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
return accEvent->mIsAsync; return accEvent->mIsAsync;
} }
static PRBool IsFromUserInput(nsIAccessibleEvent *aAccEvent) { static PRBool IsFromUserInput(nsIAccessibleEvent *aAccEvent) {
@ -169,15 +172,9 @@ public:
* Event rule of filtered events will be set to eDoNotEmit. * Event rule of filtered events will be set to eDoNotEmit.
* Events with other event rule are good to emit. * Events with other event rule are good to emit.
*/ */
static void ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire); static void ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire);
private: private:
static already_AddRefed<nsAccEvent> GetAccEventPtr(nsIAccessibleEvent *aAccEvent) {
nsAccEvent* accEvent = nsnull;
aAccEvent->QueryInterface(NS_GET_IID(nsAccEvent), (void**)&accEvent);
return accEvent;
}
/** /**
* Apply aEventRule to same type event that from sibling nodes of aDOMNode. * Apply aEventRule to same type event that from sibling nodes of aDOMNode.
* @param aEventsToFire array of pending events * @param aEventsToFire array of pending events
@ -188,7 +185,7 @@ private:
* @param aEventRule the event rule to be applied * @param aEventRule the event rule to be applied
* (should be eDoNotEmit or eAllowDupes) * (should be eDoNotEmit or eAllowDupes)
*/ */
static void ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire, static void ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
PRUint32 aStart, PRUint32 aEnd, PRUint32 aStart, PRUint32 aEnd,
PRUint32 aEventType, nsIDOMNode* aDOMNode, PRUint32 aEventType, nsIDOMNode* aDOMNode,
EEventRule aEventRule); EEventRule aEventRule);

View File

@ -860,41 +860,6 @@ nsresult nsDocAccessible::RemoveEventListeners()
return NS_OK; return NS_OK;
} }
void
nsDocAccessible::FireAnchorJumpEvent()
{
if (!mIsContentLoaded || !mDocument)
return;
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(container));
nsCAutoString theURL;
if (webNav) {
nsCOMPtr<nsIURI> pURI;
webNav->GetCurrentURI(getter_AddRefs(pURI));
if (pURI) {
pURI->GetSpec(theURL);
}
}
static nsCAutoString lastAnchor;
const char kHash = '#';
nsCAutoString currentAnchor;
PRInt32 hasPosition = theURL.FindChar(kHash);
if (hasPosition > 0 && hasPosition < (PRInt32)theURL.Length() - 1) {
mIsAnchor = PR_TRUE;
currentAnchor.Assign(Substring(theURL,
hasPosition+1,
(PRInt32)theURL.Length()-hasPosition-1));
}
if (currentAnchor.Equals(lastAnchor)) {
mIsAnchorJumped = PR_FALSE;
} else {
mIsAnchorJumped = PR_TRUE;
lastAnchor.Assign(currentAnchor);
}
}
void void
nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType) nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
{ {
@ -948,7 +913,6 @@ nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
nsCOMPtr<nsIAccessibleEvent> accEvent = nsCOMPtr<nsIAccessibleEvent> accEvent =
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE); new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE);
FireAccessibleEvent(accEvent); FireAccessibleEvent(accEvent);
FireAnchorJumpEvent();
} }
} }
} }
@ -1626,7 +1590,8 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent)
{ {
NS_ENSURE_ARG(aEvent); NS_ENSURE_ARG(aEvent);
mEventsToFire.AppendElement(aEvent); nsRefPtr<nsAccEvent> accEvent = nsAccUtils::QueryObject<nsAccEvent>(aEvent);
mEventsToFire.AppendElement(accEvent);
// Filter events. // Filter events.
nsAccEvent::ApplyEventRules(mEventsToFire); nsAccEvent::ApplyEventRules(mEventsToFire);

View File

@ -56,11 +56,11 @@ class nsIScrollableView;
const PRUint32 kDefaultCacheSize = 256; const PRUint32 kDefaultCacheSize = 256;
#define NS_DOCACCESSIBLE_IMPL_CID \ #define NS_DOCACCESSIBLE_IMPL_CID \
{ /* 9735bc5f-a4b6-4668-ab73-6f8434c8e750 */ \ { /* 9e97d7af-b20a-4a5a-a8d9-bcae0de0b7a2 */ \
0x9735bc5f, \ 0x9e97d7af, \
0xa4b6, \ 0xb20a, \
0x4668, \ 0x4a5a, \
{ 0xab, 0x73, 0x6f, 0x84, 0x34, 0xc8, 0xe7, 0x50 } \ { 0xa8, 0xd9, 0xbc, 0xae, 0x0d, 0xe0, 0xb7, 0xa2 } \
} }
class nsDocAccessible : public nsHyperTextAccessibleWrap, class nsDocAccessible : public nsHyperTextAccessibleWrap,
@ -172,11 +172,6 @@ public:
*/ */
virtual void FireDocLoadEvents(PRUint32 aEventType); virtual void FireDocLoadEvents(PRUint32 aEventType);
/**
* Process the case when anchor was clicked.
*/
virtual void FireAnchorJumpEvent();
/** /**
* Used to flush pending events, called after timeout. See FlushPendingEvents. * Used to flush pending events, called after timeout. See FlushPendingEvents.
*/ */
@ -298,12 +293,10 @@ protected:
PRPackedBool mIsLoadCompleteFired; PRPackedBool mIsLoadCompleteFired;
protected: protected:
PRBool mIsAnchor;
PRBool mIsAnchorJumped;
PRBool mInFlushPendingEvents; PRBool mInFlushPendingEvents;
PRBool mFireEventTimerStarted; PRBool mFireEventTimerStarted;
nsTArray<nsCOMPtr<nsIAccessibleEvent> > mEventsToFire; nsTArray<nsRefPtr<nsAccEvent> > mEventsToFire;
static PRUint32 gLastFocusedAccessiblesState; static PRUint32 gLastFocusedAccessiblesState;
static nsIAtom *gLastFocusedFrameType; static nsIAtom *gLastFocusedFrameType;

View File

@ -563,7 +563,7 @@ PRUint32 nsTextEquivUtils::gRoleToNameRulesMap[] =
eFromValue, // ROLE_ENTRY eFromValue, // ROLE_ENTRY
eNoRule, // ROLE_CAPTION eNoRule, // ROLE_CAPTION
eNoRule, // ROLE_DOCUMENT_FRAME eNoRule, // ROLE_DOCUMENT_FRAME
eNoRule, // ROLE_HEADING eFromSubtreeIfRec, // ROLE_HEADING
eNoRule, // ROLE_PAGE eNoRule, // ROLE_PAGE
eFromSubtreeIfRec, // ROLE_SECTION eFromSubtreeIfRec, // ROLE_SECTION
eNoRule, // ROLE_REDUNDANT_OBJECT eNoRule, // ROLE_REDUNDANT_OBJECT

View File

@ -61,14 +61,8 @@
* *
* Comboboxes: * Comboboxes:
* - nsHTMLComboboxAccessible * - nsHTMLComboboxAccessible
* - nsHTMLComboboxTextFieldAccessible (#ifdef COMBO_BOX_WITH_THREE_CHILDREN)
* - nsHTMLComboboxButtonAccessible (#ifdef COMBO_BOX_WITH_THREE_CHILDREN)
* - nsHTMLComboboxListAccessible [ inserted in accessible tree ] * - nsHTMLComboboxListAccessible [ inserted in accessible tree ]
* - nsHTMLSelectOptionAccessible(s) * - nsHTMLSelectOptionAccessible(s)
*
* XXX COMBO_BOX_WITH_THREE_CHILDREN is not currently defined.
* If we start using it again, we should pass the correct frame into those accessibles.
* They share a DOM node with the parent combobox.
*/ */
@ -982,30 +976,6 @@ void nsHTMLComboboxAccessible::CacheChildren()
if (mAccChildCount == eChildCountUninitialized) { if (mAccChildCount == eChildCountUninitialized) {
mAccChildCount = 0; mAccChildCount = 0;
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
// We no longer create textfield and button accessible, in order to have
// harmonization between IAccessible2, ATK/AT-SPI and OS X
nsHTMLComboboxTextFieldAccessible* textFieldAccessible =
new nsHTMLComboboxTextFieldAccessible(this, mDOMNode, mWeakShell);
SetFirstChild(textFieldAccessible);
if (!textFieldAccessible) {
return;
}
textFieldAccessible->SetParent(this);
textFieldAccessible->Init();
mAccChildCount = 1; // Textfield accessible child successfully added
nsHTMLComboboxButtonAccessible* buttonAccessible =
new nsHTMLComboboxButtonAccessible(mParent, mDOMNode, mWeakShell);
textFieldAccessible->SetNextSibling(buttonAccessible);
if (!buttonAccessible) {
return;
}
buttonAccessible->SetParent(this);
buttonAccessible->Init();
mAccChildCount = 2; // Button accessible child successfully added
#endif
nsIFrame *frame = GetFrame(); nsIFrame *frame = GetFrame();
if (!frame) { if (!frame) {
@ -1029,11 +999,7 @@ void nsHTMLComboboxAccessible::CacheChildren()
mListAccessible->Init(); mListAccessible->Init();
} }
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
buttonAccessible->SetNextSibling(mListAccessible);
#else
SetFirstChild(mListAccessible); SetFirstChild(mListAccessible);
#endif
mListAccessible->SetParent(this); mListAccessible->SetParent(this);
mListAccessible->SetNextSibling(nsnull); mListAccessible->SetNextSibling(nsnull);
@ -1188,222 +1154,9 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
return NS_OK; return NS_OK;
} }
////////////////////////////////////////////////////////////////////////////////
#ifdef COMBO_BOX_WITH_THREE_CHILDREN // nsHTMLComboboxListAccessible
/** ----- nsHTMLComboboxTextFieldAccessible ----- */ ////////////////////////////////////////////////////////////////////////////////
/** Constructor */
nsHTMLComboboxTextFieldAccessible::nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsHTMLTextFieldAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same as for our parent, use |this| pointer as the unique Id
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}
/**
* Gets the bounds for the BlockFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxTextFieldAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
{
// get our first child's frame
nsIFrame* frame = nsAccessible::GetBoundsFrame();
if (!frame)
return;
frame = frame->GetFirstChild(nsnull);
*aBoundingFrame = frame;
aBounds = frame->GetRect();
}
void nsHTMLComboboxTextFieldAccessible::CacheChildren()
{
// Allow single text anonymous child, so that nsHyperTextAccessible can operate correctly
// We must override this otherwise we get the dropdown button as a child of the textfield,
// and at least for now we want to keep it as a sibling
if (!mWeakShell) {
// This node has been shut down
mAccChildCount = eChildCountUninitialized;
return;
}
// Allows only 1 child
if (mAccChildCount == eChildCountUninitialized) {
mAccChildCount = 0; // Prevent reentry
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
// Seed the frame hint early while we're still on a container node.
// This is better than doing the GetPrimaryFrameFor() later on
// a text node, because text nodes aren't in the frame map.
walker.mState.frame = GetFrame();
walker.GetFirstChild();
SetFirstChild(walker.mState.accessible);
nsRefPtr<nsAccessible> child =
nsAccUtils::QueryAccessible(walker.mState.accessible);
child->SetParent(this);
child->SetNextSibling(nsnull);
mAccChildCount = 1;
}
}
/** -----ComboboxButtonAccessible ----- */
/** Constructor -- cache our parent */
nsHTMLComboboxButtonAccessible::nsHTMLComboboxButtonAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsLeafAccessible(aDOMNode, aShell)
{
}
/** Just one action ( click ). */
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetNumActions(PRUint8 *aNumActions)
{
*aNumActions = 1;
return NS_OK;
}
/**
* Programmaticaly click on the button, causing either the display or
* the hiding of the drop down box ( window ).
* Walks the Frame tree and checks for proper frames.
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::DoAction(PRUint8 aIndex)
{
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsPresContext *context = GetPresContext();
if (!frame || !context)
return NS_ERROR_FAILURE;
frame = frame->GetFirstChild(nsnull)->GetNextSibling();
// We only have one action, click. Any other index is meaningless(wrong)
if (aIndex == eAction_Click) {
nsCOMPtr<nsIDOMHTMLInputElement>
element(do_QueryInterface(frame->GetContent()));
if (element)
{
element->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
/**
* Our action name is the reverse of our state:
* if we are closed -> open is our name.
* if we are open -> closed is our name.
* Uses the frame to get the state, updated on every click
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame)
return NS_ERROR_FAILURE;
if (comboFrame->IsDroppedDown())
aName.AssignLiteral("close");
else
aName.AssignLiteral("open");
return NS_OK;
}
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}
/**
* Gets the bounds for the gfxButtonControlFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
{
// get our second child's frame
// bounding frame is the ComboboxControlFrame
nsIFrame *frame = nsAccessible::GetBoundsFrame();
*aBoundingFrame = frame;
nsPresContext *context = GetPresContext();
if (!frame || !context)
return;
aBounds = frame->GetFirstChild(nsnull)->GetNextSibling()->GetRect();
// sibling frame is for the button
}
/** We are a button. */
nsresult
nsHTMLComboboxButtonAccessible::GetRoleInternal(PRUint32 *aRole)
{
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
return NS_OK;
}
/** Return our cached parent */
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetParent(nsIAccessible **aParent)
{
NS_IF_ADDREF(*aParent = mParent);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLComboboxButtonAccessible::GetName(nsAString& aName)
{
// Native anonymous content, no way to use ARIA here.
aName.Truncate();
return GetActionName(eAction_Click, aName);
}
/**
* As a nsHTMLComboboxButtonAccessible we can have the following states:
* STATE_PRESSED
* STATE_FOCUSED
* STATE_FOCUSABLE
* STATE_INVISIBLE
*/
nsresult
nsHTMLComboboxButtonAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;
if (boundsFrame)
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame) {
*aState |= nsIAccessibleStates::STATE_INVISIBLE;
}
else {
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
if (comboFrame->IsDroppedDown()) {
*aState |= nsIAccessibleStates::STATE_PRESSED;
}
}
return NS_OK;
}
#endif
/** ----- nsHTMLComboboxListAccessible ----- */
nsHTMLComboboxListAccessible::nsHTMLComboboxListAccessible(nsIAccessible *aParent, nsHTMLComboboxListAccessible::nsHTMLComboboxListAccessible(nsIAccessible *aParent,
nsIDOMNode* aDOMNode, nsIDOMNode* aDOMNode,

View File

@ -244,59 +244,6 @@ private:
nsRefPtr<nsHTMLComboboxListAccessible> mListAccessible; nsRefPtr<nsHTMLComboboxListAccessible> mListAccessible;
}; };
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
/*
* A class the represents the text field in the Select to the left
* of the drop down button
*/
class nsHTMLComboboxTextFieldAccessible : public nsHTMLTextFieldAccessible
{
public:
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxTextFieldAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetUniqueID(void **aUniqueID);
virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
protected:
void CacheChildren();
};
/**
* A class that represents the button inside the Select to the
* right of the text field
*/
class nsHTMLComboboxButtonAccessible : public nsLeafAccessible
{
public:
enum { eAction_Click = 0 };
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxButtonAccessible() {}
// nsIAccessible
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetParent(nsIAccessible **_retval);
NS_IMETHOD GetName(nsAString& aName);
// nsIAccessNode
NS_IMETHOD GetUniqueID(void **aUniqueID);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
};
#endif
/* /*
* A class that represents the window that lives to the right * A class that represents the window that lives to the right
* of the drop down button inside the Select. This is the window * of the drop down button inside the Select. This is the window

View File

@ -142,41 +142,6 @@ __try {
return E_FAIL; return E_FAIL;
} }
void
nsDocAccessibleWrap::FireAnchorJumpEvent()
{
// Staying on the same page, jumping to a named anchor
// Fire EVENT_SCROLLING_START on first leaf accessible -- because some
// assistive technologies only cache the child numbers for leaf accessibles
// the can only relate events back to their internal model if it's a leaf.
// There is usually an accessible for the focus node, but if it's an empty text node
// we have to move forward in the document to get one
nsDocAccessible::FireAnchorJumpEvent();
if (!mIsAnchorJumped)
return;
nsCOMPtr<nsIDOMNode> focusNode;
if (mIsAnchor) {
nsCOMPtr<nsISelectionController> selCon(do_QueryReferent(mWeakShell));
if (!selCon)
return;
nsCOMPtr<nsISelection> domSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
if (!domSel)
return;
domSel->GetFocusNode(getter_AddRefs(focusNode));
}
else {
focusNode = mDOMNode; // Moved to top, so event is for 1st leaf after root
}
nsCOMPtr<nsIAccessible> accessible = GetFirstAvailableAccessible(focusNode, PR_TRUE);
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
accessible);
}
STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL) STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL)
{ {
__try { __try {

View File

@ -92,8 +92,6 @@ public:
/* [optional][in] */ VARIANT varChild, /* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue); /* [retval][out] */ BSTR __RPC_FAR *pszValue);
virtual void FireAnchorJumpEvent();
// nsDocAccessibleWrap // nsDocAccessibleWrap
/** /**

View File

@ -54,6 +54,7 @@ _TEST_FILES =\
attributes.js \ attributes.js \
common.js \ common.js \
events.js \ events.js \
events_scroll.html \
grid.js \ grid.js \
layout.js \ layout.js \
name.css \ name.css \
@ -91,6 +92,7 @@ _TEST_FILES =\
test_elm_listbox.xul \ test_elm_listbox.xul \
$(warning test_elm_media.html temporarily disabled) \ $(warning test_elm_media.html temporarily disabled) \
test_elm_plugin.html \ test_elm_plugin.html \
test_elm_select.html \
test_elm_tree.xul \ test_elm_tree.xul \
test_elm_txtcntnr.html \ test_elm_txtcntnr.html \
test_events_caretmove.html \ test_events_caretmove.html \
@ -101,6 +103,7 @@ _TEST_FILES =\
test_events_focus.html \ test_events_focus.html \
test_events_focus.xul \ test_events_focus.xul \
test_events_mutation.html \ test_events_mutation.html \
test_events_scroll.xul \
test_events_tree.xul \ test_events_tree.xul \
test_events_valuechange.html \ test_events_valuechange.html \
test_groupattrs.xul \ test_groupattrs.xul \

View File

@ -0,0 +1,123 @@
<html>
<head>
<title>nsIAccessible actions testing for anchors</title>
</head>
<body>
<p>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
</p>
<a name="link1">link1</a>
<p style="color: blue">
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
text text text text text text text text text text text text text text <br>
</p>
</body>
<html>

View File

@ -21,7 +21,10 @@
isBusy: false, isBusy: false,
setOverLink: function (link, b) { setOverLink: function (link, b) {
} }
} };
var gFindBar = {
hidden: true
};
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Invoker implementation. // Invoker implementation.
@ -74,7 +77,7 @@
const Ci = Components.interfaces; const Ci = Components.interfaces;
function onload() function doTest()
{ {
var tabBrowser = document.getElementById("content"); var tabBrowser = document.getElementById("content");
tabBrowser.loadURI("about:"); tabBrowser.loadURI("about:");
@ -85,6 +88,8 @@
gQueue.onFinish = function() { window.close(); } gQueue.onFinish = function() { window.close(); }
gQueue.invoke(); gQueue.invoke();
} }
gOpenerWnd.addA11yLoadEvent(doTest);
]]> ]]>
</script> </script>

View File

@ -39,14 +39,6 @@
function doTest() function doTest()
{ {
if (!WIN) {
ok(true,
"Nothing to test because scolling events are fired on Windows only");
SimpleTest.finish();
return;
}
var actionsArray = [ var actionsArray = [
{ {
ID: "anchor1", ID: "anchor1",
@ -63,7 +55,7 @@
actionIndex: 0, actionIndex: 0,
events: CLICK_EVENTS, events: CLICK_EVENTS,
eventSeq: [ eventSeq: [
new scrollingChecker(getAccessible("bottom2").firstChild) new scrollingChecker(getAccessible("bottom2"))
] ]
} }
]; ];
@ -82,7 +74,18 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389" href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389"
title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART"> title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART">
Mozilla Bug 506389 Mozilla Bug 506389
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607"
title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump">
Mozilla Bug 437607
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303"
title="Same page links to targets with content fires scrolling start accessible event on leaf text node">
Mozilla Bug 519303
</a> </a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"></div> <div id="content" style="display: none"></div>
<pre id="test"> <pre id="test">

View File

@ -35,6 +35,9 @@
// attribute. // attribute.
testDescr("img3", "description"); testDescr("img3", "description");
// Description from content of h2.
testDescr("p", "heading");
SimpleTest.finish(); SimpleTest.finish();
} }
@ -61,5 +64,7 @@
<img id="img2" title="title" /> <img id="img2" title="title" />
<img id="img3" alt="name" title="description" /> <img id="img3" alt="name" title="description" />
<h2 id="heading">heading</h2>
<p id="p" aria-describedby="heading" role="button">click me</p>
</body> </body>
</html> </html>

View File

@ -0,0 +1,129 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML select control tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function doTest()
{
var accTree = {
role: ROLE_LISTBOX,
children: [
{
role: ROLE_HEADING
},
{
role: ROLE_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
},
{
role: ROLE_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
},
{
role: ROLE_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
}
]
};
testAccessibleTree("listbox", accTree);
accTree = {
role: ROLE_COMBOBOX,
children: [
{
role: ROLE_COMBOBOX_LIST,
children: [
{
role: ROLE_HEADING
},
{
role: ROLE_COMBOBOX_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
},
{
role: ROLE_COMBOBOX_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
},
{
role: ROLE_COMBOBOX_OPTION,
children: [
{
role: ROLE_TEXT_LEAF
}
]
}
]
}
]
};
testAccessibleTree("combobox", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="remove all the code in #ifdef COMBO_BOX_WITH_THREE_CHILDREN"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506616">
Mozilla Bug 506616
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<select id="listbox" size="4">
<optgroup label="Colors">
<option>Red</option>
<option>Blue</option>
</optgroup>
<option>Animal</option>
</select>
<select id="combobox">
<optgroup label="Colors">
<option>Red</option>
<option>Blue</option>
</optgroup>
<option>Animal</option>
</select>
</body>
</html>

View File

@ -0,0 +1,101 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Hack to make xul:tabbrowser work
const Ci = Components.interfaces;
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
////////////////////////////////////////////////////////////////////////////
// Tests
var gScrollHandler = {
handleEvent: function gScrollHandler_handleEvent(aEvent) {
if (aEvent.DOMNode.getAttribute("name") == "link1") {
unregisterA11yEventListener(EVENT_SCROLLING_START, this);
SimpleTest.finish();
}
}
};
function doTest()
{
registerA11yEventListener(EVENT_SCROLLING_START, gScrollHandler);
var url =
"chrome://mochikit/content/a11y/accessible/events_scroll.html#link1";
var tabBrowser = document.getElementById("tabBrowser");
tabBrowser.loadURI(url);
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607"
title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump">
Mozilla Bug 437607
</a><br/>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303"
title="Same page links to targets with content fires scrolling start accessible event on leaf text node">
Mozilla Bug 519303
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<!-- Hack to make xul:tabbrowser work -->
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<tabbrowser type="content-primary" flex="1" id="tabBrowser"/>
</vbox>
</hbox>
</window>

View File

@ -63,6 +63,7 @@ build/pgo/blueprint/Makefile
build/pgo/js-input/Makefile build/pgo/js-input/Makefile
build/unix/Makefile build/unix/Makefile
build/win32/Makefile build/win32/Makefile
build/win32/crashinjectdll/Makefile
config/Makefile config/Makefile
config/autoconf.mk config/autoconf.mk
config/mkdepend/Makefile config/mkdepend/Makefile

View File

@ -21,6 +21,14 @@
<emItem id="support@daemon-tools.cc"> <emItem id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5"/> <versionRange minVersion=" " maxVersion="1.0.0.5"/>
</emItem> </emItem>
<emItem id="{2224e955-00e9-4613-a844-ce69fccaae91}"/>
<emItem id="{3f963a5b-e555-4543-90e2-c3908898db71}">
<versionRange minVersion=" " maxVersion="8.0">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.1a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}"> <emItem id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2"> <versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@ -49,5 +57,10 @@
</targetApplication> </targetApplication>
</versionRange> </versionRange>
</pluginItem> </pluginItem>
<pluginItem>
<match name="filename" exp="NPFFAddOn.dll"/>
<versionRange>
</versionRange>
</pluginItem>
</pluginItems> </pluginItems>
</blocklist> </blocklist>

View File

@ -54,6 +54,8 @@
#include "nsStringGlue.h" #include "nsStringGlue.h"
#ifdef XP_WIN #ifdef XP_WIN
// we want to use the DLL blocklist if possible
#define XRE_WANT_DLL_BLOCKLIST
// we want a wmain entry point // we want a wmain entry point
#include "nsWindowsWMain.cpp" #include "nsWindowsWMain.cpp"
#endif #endif

View File

@ -262,8 +262,7 @@ pref("browser.download.useDownloadDir", true);
#ifdef WINCE #ifdef WINCE
pref("browser.download.folderList", 2); pref("browser.download.folderList", 2);
// Bug 499807: use Hard Disk filesystem because Desktop is short on space. pref("browser.download.dir", "\\Storage Card");
pref("browser.download.dir", "\\Hard Disk");
#else #else
pref("browser.download.folderList", 1); pref("browser.download.folderList", 1);
#endif #endif
@ -753,7 +752,11 @@ pref("browser.rights.3.shown", false);
pref("browser.rights.override", true); pref("browser.rights.override", true);
#endif #endif
#ifdef WINCE
pref("browser.sessionstore.resume_from_crash", false);
#else
pref("browser.sessionstore.resume_from_crash", true); pref("browser.sessionstore.resume_from_crash", true);
#endif
pref("browser.sessionstore.resume_session_once", false); pref("browser.sessionstore.resume_session_once", false);
// minimal interval between two save operations in milliseconds // minimal interval between two save operations in milliseconds

View File

@ -55,6 +55,7 @@ endif
EXTRA_JS_MODULES = \ EXTRA_JS_MODULES = \
content/openLocationLastURL.jsm \ content/openLocationLastURL.jsm \
content/NetworkPrioritizer.jsm \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,217 @@
/* ***** 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 Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul OShannessy <paul@oshannessy.com> (original author)
*
* 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 module adjusts network priority for tabs in a way that gives 'important'
* tabs a higher priority. There are 3 levels of priority. Each is listed below
* with the priority adjustment used.
*
* Highest (-10): Selected tab in the focused window.
* Medium (0): Background tabs in the focused window.
* Selected tab in background windows.
* Lowest (+10): Background tabs in background windows.
*/
let EXPORTED_SYMBOLS = ["trackBrowserWindow"];
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// Lazy getters
XPCOMUtils.defineLazyServiceGetter(this, "_focusManager",
"@mozilla.org/focus-manager;1",
"nsIFocusManager");
// Constants
const TAB_EVENTS = ["TabOpen", "TabSelect"];
const WINDOW_EVENTS = ["activate", "unload"];
// PRIORITY DELTA is -10 because lower priority value is actually a higher priority
const PRIORITY_DELTA = -10;
// Variables
let _lastFocusedWindow = null;
let _windows = [];
// Exported symbol
function trackBrowserWindow(aWindow) {
WindowHelper.addWindow(aWindow);
}
// Global methods
function _handleEvent(aEvent) {
switch (aEvent.type) {
case "TabOpen":
BrowserHelper.onOpen(aEvent.target.linkedBrowser);
break;
case "TabSelect":
BrowserHelper.onSelect(aEvent.target.linkedBrowser);
break;
case "activate":
WindowHelper.onActivate(aEvent.target);
break;
case "unload":
WindowHelper.removeWindow(aEvent.currentTarget);
break;
}
}
// Methods that impact a browser. Put into single object for organization.
let BrowserHelper = {
onOpen: function(aBrowser) {
// If the tab is in the focused window, leave priority as it is
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
this.decreasePriority(aBrowser);
},
onSelect: function(aBrowser) {
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
if (windowEntry.lastSelectedBrowser)
this.decreasePriority(windowEntry.lastSelectedBrowser);
this.increasePriority(aBrowser);
windowEntry.lastSelectedBrowser = aBrowser;
},
// Auxiliary methods
getLoadgroup: function(aBrowser) {
return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
},
increasePriority: function(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA);
},
decreasePriority: function(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1);
}
};
// Methods that impact a window. Put into single object for organization.
let WindowHelper = {
addWindow: function(aWindow) {
// Build internal data object
_windows.push({ window: aWindow, lastSelectedBrowser: null });
// Add event listeners
TAB_EVENTS.forEach(function(event) {
aWindow.gBrowser.tabContainer.addEventListener(event, _handleEvent, false);
});
WINDOW_EVENTS.forEach(function(event) {
aWindow.addEventListener(event, _handleEvent, false);
});
// This gets called AFTER activate event, so if this is the focused window
// we want to activate it. Otherwise, deprioritize it.
if (aWindow == _focusManager.activeWindow)
this.handleFocusedWindow(aWindow);
else
this.decreasePriority(aWindow);
// Select the selected tab
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
},
removeWindow: function(aWindow) {
if (aWindow == _lastFocusedWindow)
_lastFocusedWindow = null;
// Delete this window from our tracking
_windows.splice(this.getEntryIndex(aWindow), 1);
// Remove the event listeners
TAB_EVENTS.forEach(function(event) {
aWindow.gBrowser.tabContainer.removeEventListener(event, _handleEvent, false);
});
WINDOW_EVENTS.forEach(function(event) {
aWindow.removeEventListener(event, _handleEvent, false);
});
},
onActivate: function(aWindow, aHasFocus) {
// If this window was the last focused window, we don't need to do anything
if (aWindow == _lastFocusedWindow)
return;
// handleFocusedWindow will deprioritize the current window
this.handleFocusedWindow(aWindow);
// Lastly we should increase priority for this window
this.increasePriority(aWindow);
},
handleFocusedWindow: function(aWindow) {
// If we have a last focused window, we need to deprioritize it first
if (_lastFocusedWindow)
this.decreasePriority(_lastFocusedWindow);
// aWindow is now focused
_lastFocusedWindow = aWindow;
},
// Auxiliary methods
increasePriority: function(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.increasePriority(aBrowser);
});
},
decreasePriority: function(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.decreasePriority(aBrowser);
});
},
getEntry: function(aWindow) {
return _windows[this.getEntryIndex(aWindow)];
},
getEntryIndex: function(aWindow) {
// Assumes that every object has a unique window & it's in the array
for (let i = 0; i < _windows.length; i++)
if (_windows[i].window == aWindow)
return i;
}
};

View File

@ -76,7 +76,7 @@
aboutlabel="&aboutLink;" aboutlabel="&aboutLink;"
aboutaccesskey="&aboutLink.accesskey;"> aboutaccesskey="&aboutLink.accesskey;">
<script type="application/x-javascript" src="chrome://browser/content/aboutDialog.js"/> <script type="application/javascript" src="chrome://browser/content/aboutDialog.js"/>
<deck id="modes" flex="1"> <deck id="modes" flex="1">
<vbox flex="1" id="clientBox"> <vbox flex="1" id="clientBox">

View File

@ -67,7 +67,7 @@
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" /> <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
<link rel="icon" type="image/png" id="favicon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAACGFjVEwAAAASAAAAAJNtBPIAAAAaZmNUTAAAAAAAAAAQAAAAEAAAAAAAAAAALuAD6AABhIDeugAAALhJREFUOI2Nk8sNxCAMRDlGohauXFOMpfTiAlxICqAELltHLqlgctg1InzMRhpFAc%2BLGWTnmoeZYamt78zXdZmaQtQMADlnU0OIAlbmJUBEcO4bRKQY2rUXIPmAGnDuG%2FBx3%2FfvOPVaDUg%2BoAPUf1PArIMCSD5glMEsUGaG%2BkyAFWIBaCsKuA%2BHGCNijLgP133XgOEtaPFMy2vUolEGJoCIzBmoRUR9%2B7rxj16DZaW%2FmgtmxnJ8V3oAnApQwNS5zpcAAAAaZmNUTAAAAAEAAAAQAAAAEAAAAAAAAAAAAB4D6AIB52fclgAAACpmZEFUAAAAAjiNY2AYBVhBc3Pzf2LEcGreqcbwH1kDNjHauWAUjAJyAADymxf9WF%2Bu8QAAABpmY1RMAAAAAwAAABAAAAAQAAAAAAAAAAAAHgPoAgEK8Q9%2FAAAAFmZkQVQAAAAEOI1jYBgFo2AUjAIIAAAEEAAB0xIn4wAAABpmY1RMAAAABQAAABAAAAAQAAAAAAAAAAAAHgPoAgHnO30FAAAAQGZkQVQAAAAGOI1jYBieYKcaw39ixHCC%2F6cwFWMTw2rz%2F1MM%2F6Vu%2Ff%2F%2F%2FxTD%2F51qEIwuRjsXILuEGLFRMApgAADhNCsVfozYcAAAABpmY1RMAAAABwAAABAAAAAQAAAAAAAAAAAAHgPoAgEKra7sAAAAFmZkQVQAAAAIOI1jYBgFo2AUjAIIAAAEEAABM9s3hAAAABpmY1RMAAAACQAAABAAAAAQAAAAAAAAAAAAHgPoAgHn3p%2BwAAAAKmZkQVQAAAAKOI1jYBgFWEFzc%2FN%2FYsRwat6pxvAfWQM2Mdq5YBSMAnIAAPKbF%2F1BhPl6AAAAGmZjVEwAAAALAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAQpITFkAAAAWZmRBVAAAAAw4jWNgGAWjYBSMAggAAAQQAAHaszpmAAAAGmZjVEwAAAANAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAeeCPiMAAABAZmRBVAAAAA44jWNgGJ5gpxrDf2LEcIL%2FpzAVYxPDavP%2FUwz%2FpW79%2F%2F%2F%2FFMP%2FnWoQjC5GOxcgu4QYsVEwCmAAAOE0KxUmBL0KAAAAGmZjVEwAAAAPAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAQoU7coAAAAWZmRBVAAAABA4jWNgGAWjYBSMAggAAAQQAAEpOBELAAAAGmZjVEwAAAARAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAeYVWtoAAAAqZmRBVAAAABI4jWNgGAVYQXNz839ixHBq3qnG8B9ZAzYx2rlgFIwCcgAA8psX%2FWvpAecAAAAaZmNUTAAAABMAAAAQAAAAEAAAAAAAAAAAAB4D6AIBC4OJMwAAABZmZEFUAAAAFDiNY2AYBaNgFIwCCAAABBAAAcBQHOkAAAAaZmNUTAAAABUAAAAQAAAAEAAAAAAAAAAAAB4D6AIB5kn7SQAAAEBmZEFUAAAAFjiNY2AYnmCnGsN%2FYsRwgv%2BnMBVjE8Nq8%2F9TDP%2Blbv3%2F%2F%2F8Uw%2F%2BdahCMLkY7FyC7hBixUTAKYAAA4TQrFc%2BcEoQAAAAaZmNUTAAAABcAAAAQAAAAEAAAAAAAAAAAAB4D6AIBC98ooAAAABZmZEFUAAAAGDiNY2AYBaNgFIwCCAAABBAAASCZDI4AAAAaZmNUTAAAABkAAAAQAAAAEAAAAAAAAAAAAB4D6AIB5qwZ%2FAAAACpmZEFUAAAAGjiNY2AYBVhBc3Pzf2LEcGreqcbwH1kDNjHauWAUjAJyAADymxf9cjJWbAAAABpmY1RMAAAAGwAAABAAAAAQAAAAAAAAAAAAHgPoAgELOsoVAAAAFmZkQVQAAAAcOI1jYBgFo2AUjAIIAAAEEAAByfEBbAAAABpmY1RMAAAAHQAAABAAAAAQAAAAAAAAAAAAHgPoAgHm8LhvAAAAQGZkQVQAAAAeOI1jYBieYKcaw39ixHCC%2F6cwFWMTw2rz%2F1MM%2F6Vu%2Ff%2F%2F%2FxTD%2F51qEIwuRjsXILuEGLFRMApgAADhNCsVlxR3%2FgAAABpmY1RMAAAAHwAAABAAAAAQAAAAAAAAAAAAHgPoAgELZmuGAAAAFmZkQVQAAAAgOI1jYBgFo2AUjAIIAAAEEAABHP5cFQAAABpmY1RMAAAAIQAAABAAAAAQAAAAAAAAAAAAHgPoAgHlgtAOAAAAKmZkQVQAAAAiOI1jYBgFWEFzc%2FN%2FYsRwat6pxvAfWQM2Mdq5YBSMAnIAAPKbF%2F0%2FMvDdAAAAAElFTkSuQmCC"/> <link rel="icon" type="image/png" id="favicon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAACGFjVEwAAAASAAAAAJNtBPIAAAAaZmNUTAAAAAAAAAAQAAAAEAAAAAAAAAAALuAD6AABhIDeugAAALhJREFUOI2Nk8sNxCAMRDlGohauXFOMpfTiAlxICqAELltHLqlgctg1InzMRhpFAc%2BLGWTnmoeZYamt78zXdZmaQtQMADlnU0OIAlbmJUBEcO4bRKQY2rUXIPmAGnDuG%2FBx3%2FfvOPVaDUg%2BoAPUf1PArIMCSD5glMEsUGaG%2BkyAFWIBaCsKuA%2BHGCNijLgP133XgOEtaPFMy2vUolEGJoCIzBmoRUR9%2B7rxj16DZaW%2FmgtmxnJ8V3oAnApQwNS5zpcAAAAaZmNUTAAAAAEAAAAQAAAAEAAAAAAAAAAAAB4D6AIB52fclgAAACpmZEFUAAAAAjiNY2AYBVhBc3Pzf2LEcGreqcbwH1kDNjHauWAUjAJyAADymxf9WF%2Bu8QAAABpmY1RMAAAAAwAAABAAAAAQAAAAAAAAAAAAHgPoAgEK8Q9%2FAAAAFmZkQVQAAAAEOI1jYBgFo2AUjAIIAAAEEAAB0xIn4wAAABpmY1RMAAAABQAAABAAAAAQAAAAAAAAAAAAHgPoAgHnO30FAAAAQGZkQVQAAAAGOI1jYBieYKcaw39ixHCC%2F6cwFWMTw2rz%2F1MM%2F6Vu%2Ff%2F%2F%2FxTD%2F51qEIwuRjsXILuEGLFRMApgAADhNCsVfozYcAAAABpmY1RMAAAABwAAABAAAAAQAAAAAAAAAAAAHgPoAgEKra7sAAAAFmZkQVQAAAAIOI1jYBgFo2AUjAIIAAAEEAABM9s3hAAAABpmY1RMAAAACQAAABAAAAAQAAAAAAAAAAAAHgPoAgHn3p%2BwAAAAKmZkQVQAAAAKOI1jYBgFWEFzc%2FN%2FYsRwat6pxvAfWQM2Mdq5YBSMAnIAAPKbF%2F1BhPl6AAAAGmZjVEwAAAALAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAQpITFkAAAAWZmRBVAAAAAw4jWNgGAWjYBSMAggAAAQQAAHaszpmAAAAGmZjVEwAAAANAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAeeCPiMAAABAZmRBVAAAAA44jWNgGJ5gpxrDf2LEcIL%2FpzAVYxPDavP%2FUwz%2FpW79%2F%2F%2F%2FFMP%2FnWoQjC5GOxcgu4QYsVEwCmAAAOE0KxUmBL0KAAAAGmZjVEwAAAAPAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAQoU7coAAAAWZmRBVAAAABA4jWNgGAWjYBSMAggAAAQQAAEpOBELAAAAGmZjVEwAAAARAAAAEAAAABAAAAAAAAAAAAAeA%2BgCAeYVWtoAAAAqZmRBVAAAABI4jWNgGAVYQXNz839ixHBq3qnG8B9ZAzYx2rlgFIwCcgAA8psX%2FWvpAecAAAAaZmNUTAAAABMAAAAQAAAAEAAAAAAAAAAAAB4D6AIBC4OJMwAAABZmZEFUAAAAFDiNY2AYBaNgFIwCCAAABBAAAcBQHOkAAAAaZmNUTAAAABUAAAAQAAAAEAAAAAAAAAAAAB4D6AIB5kn7SQAAAEBmZEFUAAAAFjiNY2AYnmCnGsN%2FYsRwgv%2BnMBVjE8Nq8%2F9TDP%2Blbv3%2F%2F%2F8Uw%2F%2BdahCMLkY7FyC7hBixUTAKYAAA4TQrFc%2BcEoQAAAAaZmNUTAAAABcAAAAQAAAAEAAAAAAAAAAAAB4D6AIBC98ooAAAABZmZEFUAAAAGDiNY2AYBaNgFIwCCAAABBAAASCZDI4AAAAaZmNUTAAAABkAAAAQAAAAEAAAAAAAAAAAAB4D6AIB5qwZ%2FAAAACpmZEFUAAAAGjiNY2AYBVhBc3Pzf2LEcGreqcbwH1kDNjHauWAUjAJyAADymxf9cjJWbAAAABpmY1RMAAAAGwAAABAAAAAQAAAAAAAAAAAAHgPoAgELOsoVAAAAFmZkQVQAAAAcOI1jYBgFo2AUjAIIAAAEEAAByfEBbAAAABpmY1RMAAAAHQAAABAAAAAQAAAAAAAAAAAAHgPoAgHm8LhvAAAAQGZkQVQAAAAeOI1jYBieYKcaw39ixHCC%2F6cwFWMTw2rz%2F1MM%2F6Vu%2Ff%2F%2F%2FxTD%2F51qEIwuRjsXILuEGLFRMApgAADhNCsVlxR3%2FgAAABpmY1RMAAAAHwAAABAAAAAQAAAAAAAAAAAAHgPoAgELZmuGAAAAFmZkQVQAAAAgOI1jYBgFo2AUjAIIAAAEEAABHP5cFQAAABpmY1RMAAAAIQAAABAAAAAQAAAAAAAAAAAAHgPoAgHlgtAOAAAAKmZkQVQAAAAiOI1jYBgFWEFzc%2FN%2FYsRwat6pxvAfWQM2Mdq5YBSMAnIAAPKbF%2F0%2FMvDdAAAAAElFTkSuQmCC"/>
<script type="application/x-javascript"><![CDATA[ <script type="application/javascript"><![CDATA[
var buttonClicked = false; var buttonClicked = false;
function robotButton() function robotButton()
{ {

View File

@ -376,7 +376,7 @@ function generateTextForTextNode(node, indent, textFragmentAccumulator) {
// Trim the text node's text content and add proper indentation after // Trim the text node's text content and add proper indentation after
// any internal line breaks. // any internal line breaks.
let text = node.textContent.trim().replace("\n[ \t]*", "\n" + indent); let text = node.textContent.trim().replace("\n", "\n" + indent, "g");
textFragmentAccumulator.push(text); textFragmentAccumulator.push(text);
} }

View File

@ -48,7 +48,7 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
#ifdef XP_MACOSX #ifdef XP_MACOSX
<!-- nsMenuBarX hides these and uses them to build the Application menu. <!-- nsMenuBarX hides these and uses them to build the Application menu.

View File

@ -22,6 +22,12 @@ toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
background-position: top right; background-position: top right;
} }
%ifdef XP_MACOSX
#main-window[inFullscreen="true"] {
padding-top: 0; /* override drawintitlebar="true" */
}
%endif
#browser-bottombox[lwthemefooter="true"] { #browser-bottombox[lwthemefooter="true"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: bottom left; background-position: bottom left;

View File

@ -1287,6 +1287,10 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
Components.utils.reportError("Failed to init content pref service:\n" + ex); Components.utils.reportError("Failed to init content pref service:\n" + ex);
} }
let NP = {};
Cu.import("resource://gre/modules/NetworkPrioritizer.jsm", NP);
NP.trackBrowserWindow(window);
// initialize the session-restore service (in case it's not already running) // initialize the session-restore service (in case it's not already running)
if (document.documentElement.getAttribute("windowtype") == "navigator:browser") { if (document.documentElement.getAttribute("windowtype") == "navigator:browser") {
try { try {
@ -2088,11 +2092,25 @@ function BrowserViewSourceOfDocument(aDocument)
// imageElement - image to load in the Media Tab of the Page Info window; can be null/omitted // imageElement - image to load in the Media Tab of the Page Info window; can be null/omitted
function BrowserPageInfo(doc, initialTab, imageElement) { function BrowserPageInfo(doc, initialTab, imageElement) {
var args = {doc: doc, initialTab: initialTab, imageElement: imageElement}; var args = {doc: doc, initialTab: initialTab, imageElement: imageElement};
return toOpenDialogByTypeAndUrl("Browser:page-info", var windows = Cc['@mozilla.org/appshell/window-mediator;1']
doc ? doc.location : window.content.document.location, .getService(Ci.nsIWindowMediator)
"chrome://browser/content/pageinfo/pageInfo.xul", .getEnumerator("Browser:page-info");
"chrome,toolbar,dialog=no,resizable",
args); var documentURL = doc ? doc.location : window.content.document.location;
// Check for windows matching the url
while (windows.hasMoreElements()) {
var currentWindow = windows.getNext();
if (currentWindow.document.documentElement.getAttribute("relatedUrl") == documentURL) {
currentWindow.focus();
currentWindow.resetPageInfo(args);
return currentWindow;
}
}
// We didn't find a matching window, so open a new one.
return openDialog("chrome://browser/content/pageinfo/pageInfo.xul", "",
"chrome,toolbar,dialog=no,resizable", args);
} }
#ifdef DEBUG #ifdef DEBUG
@ -3249,28 +3267,6 @@ function toOpenWindowByType(inType, uri, features)
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"); window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
} }
function toOpenDialogByTypeAndUrl(inType, relatedUrl, windowUri, features, extraArgument)
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var windows = windowManagerInterface.getEnumerator(inType);
// Check for windows matching the url
while (windows.hasMoreElements()) {
var currentWindow = windows.getNext();
if (currentWindow.document.documentElement.getAttribute("relatedUrl") == relatedUrl) {
currentWindow.focus();
return;
}
}
// We didn't find a matching window, so open a new one.
if (features)
return window.openDialog(windowUri, "_blank", features, extraArgument);
return window.openDialog(windowUri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", extraArgument);
}
function OpenBrowserWindow() function OpenBrowserWindow()
{ {
var charsetArg = new String(); var charsetArg = new String();
@ -3770,10 +3766,13 @@ var FullScreen =
} }
} }
if (aShow) if (aShow) {
gNavToolbox.removeAttribute("inFullscreen"); gNavToolbox.removeAttribute("inFullscreen");
else document.documentElement.removeAttribute("inFullscreen");
} else {
gNavToolbox.setAttribute("inFullscreen", true); gNavToolbox.setAttribute("inFullscreen", true);
document.documentElement.setAttribute("inFullscreen", true);
}
var controls = document.getElementsByAttribute("fullscreencontrol", "true"); var controls = document.getElementsByAttribute("fullscreencontrol", "true");
for (var i = 0; i < controls.length; ++i) for (var i = 0; i < controls.length; ++i)
@ -5461,9 +5460,9 @@ var OfflineApps = {
{ {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]. var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService); getService(Components.interfaces.nsIApplicationCacheService);
if (!groups) { if (!groups)
groups = cacheService.getGroups({}); groups = cacheService.getGroups();
}
var ios = Components.classes["@mozilla.org/network/io-service;1"]. var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService); getService(Components.interfaces.nsIIOService);
@ -5938,6 +5937,7 @@ var gMissingPluginInstaller = {
} }
function showOutdatedPluginsInfo() { function showOutdatedPluginsInfo() {
gPrefService.setBoolPref("plugins.update.notifyUser", false);
var url = formatURL("plugins.update.url", true); var url = formatURL("plugins.update.url", true);
gBrowser.loadOneTab(url, {inBackground: false}); gBrowser.loadOneTab(url, {inBackground: false});
return true; return true;

View File

@ -92,12 +92,12 @@
# wishes to include *must* go into the global-scripts.inc file # wishes to include *must* go into the global-scripts.inc file
# so that they can be shared by macBrowserOverlay.xul. # so that they can be shared by macBrowserOverlay.xul.
#include global-scripts.inc #include global-scripts.inc
<script type="application/x-javascript" src="chrome://browser/content/nsContextMenu.js"/> <script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/>
#ifdef MOZ_SAFE_BROWSING #ifdef MOZ_SAFE_BROWSING
<script type="application/x-javascript" src="chrome://browser/content/safebrowsing/sb-loader.js"/> <script type="application/javascript" src="chrome://browser/content/safebrowsing/sb-loader.js"/>
#endif #endif
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/> <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/javascript" src="chrome://browser/content/places/editBookmarkOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/places/editBookmarkOverlay.js"/>

View File

@ -164,8 +164,8 @@
} }
</style> </style>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"></script> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"></script>
<script type="application/x-javascript"> <script type="application/javascript">
<![CDATA[ <![CDATA[
var gCreditsInterval = -1; var gCreditsInterval = -1;

View File

@ -37,8 +37,8 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
<script type="application/x-javascript" src="chrome://global/content/printUtils.js"/> <script type="application/javascript" src="chrome://global/content/printUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/> <script type="application/javascript" src="chrome://global/content/viewZoomOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/> <script type="application/javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/> <script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/x-javascript" src="chrome://global/content/viewSourceUtils.js"/> <script type="application/javascript" src="chrome://global/content/viewSourceUtils.js"/>

View File

@ -60,7 +60,7 @@
# so that they can be shared by this overlay. # so that they can be shared by this overlay.
#include global-scripts.inc #include global-scripts.inc
<script type="application/x-javascript"> <script type="application/javascript">
addEventListener("load", nonBrowserWindowStartup, false); addEventListener("load", nonBrowserWindowStartup, false);
addEventListener("unload", nonBrowserWindowShutdown, false); addEventListener("unload", nonBrowserWindowShutdown, false);
</script> </script>

View File

@ -144,18 +144,64 @@ nsContextMenu.prototype = {
(mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp)); (mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp));
} }
// time to do some bad things and see if we've highlighted a URL that isn't actually linked // Time to do some bad things and see if we've highlighted a URL that
// isn't actually linked.
var onPlainTextLink = false;
if (this.isTextSelected) { if (this.isTextSelected) {
// ok, we have some text, let's figure out if it looks like a URL // Ok, we have some text, let's figure out if it looks like a URL.
var someText = document.commandDispatcher.focusedWindow let selection = document.commandDispatcher.focusedWindow
.getSelection().toString(); .getSelection();
try { let linkText = selection.toString().trim();
var uri = makeURI(someText); let uri;
if (/^(?:https?|ftp):/i.test(linkText)) {
try {
uri = makeURI(linkText);
} catch (ex) {}
} }
catch (ex) { } // Check if this could be a valid url, just missing the protocol.
else if (/^(?:\w+\.)+\D\S*$/.test(linkText)) {
var onPlainTextLink = false; // Now let's see if this is an intentional link selection. Our guess is
if (uri && /^(https?|ftp)$/i.test(uri.scheme) && uri.host) { // based on whether the selection begins/ends with whitespace or is
// preceded/followed by a non-word character.
// selection.toString() trims trailing whitespace, so we look for
// that explicitly in the first and last ranges.
let beginRange = selection.getRangeAt(0);
let delimitedAtStart = /^\s/.test(beginRange);
if (!delimitedAtStart) {
let container = beginRange.startContainer;
let offset = beginRange.startOffset;
if (container.nodeType == Node.TEXT_NODE && offset > 0)
delimitedAtStart = /\W/.test(container.textContent[offset - 1]);
else
delimitedAtStart = true;
}
let delimitedAtEnd = false;
if (delimitedAtStart) {
let endRange = selection.getRangeAt(selection.rangeCount - 1);
delimitedAtEnd = /\s$/.test(endRange);
if (!delimitedAtEnd) {
let container = endRange.endContainer;
let offset = endRange.endOffset;
if (container.nodeType == Node.TEXT_NODE &&
offset < container.textContent.length)
delimitedAtEnd = /\W/.test(container.textContent[offset]);
else
delimitedAtEnd = true;
}
}
if (delimitedAtStart && delimitedAtEnd) {
let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"]
.getService(Ci.nsIURIFixup);
try {
uri = uriFixup.createFixupURI(linkText, uriFixup.FIXUP_FLAG_NONE);
} catch (ex) {}
}
}
if (uri && uri.host) {
this.linkURI = uri; this.linkURI = uri;
this.linkURL = this.linkURI.spec; this.linkURL = this.linkURI.spec;
onPlainTextLink = true; onPlainTextLink = true;

View File

@ -54,9 +54,9 @@
persist="screenX screenY" persist="screenX screenY"
screenX="24" screenY="24"> screenX="24" screenY="24">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/openLocation.js"/> <script type="application/javascript" src="chrome://browser/content/openLocation.js"/>
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<stringbundle id="openLocationBundle" src="chrome://browser/locale/openLocation.properties"/> <stringbundle id="openLocationBundle" src="chrome://browser/locale/openLocation.properties"/>

View File

@ -279,16 +279,12 @@ function onLoadPageInfo()
gStrings.mediaLink = gBundle.getString("mediaLink"); gStrings.mediaLink = gBundle.getString("mediaLink");
gStrings.mediaInput = gBundle.getString("mediaInput"); gStrings.mediaInput = gBundle.getString("mediaInput");
if ("arguments" in window && window.arguments.length >= 1 && var args = "arguments" in window &&
window.arguments[0] && window.arguments[0].doc) { window.arguments.length >= 1 &&
gDocument = window.arguments[0].doc; window.arguments[0];
gWindow = gDocument.defaultView;
} if (!args || !args.doc) {
else { gWindow = window.opener.content;
if ("gBrowser" in window.opener)
gWindow = window.opener.gBrowser.contentWindow;
else
gWindow = window.opener.frames[0];
gDocument = gWindow.document; gDocument = gWindow.document;
} }
@ -296,24 +292,8 @@ function onLoadPageInfo()
var imageTree = document.getElementById("imagetree"); var imageTree = document.getElementById("imagetree");
imageTree.view = gImageView; imageTree.view = gImageView;
// set gImageElement if present
if ("arguments" in window && window.arguments.length >= 1 &&
window.arguments[0].imageElement)
gImageElement = window.arguments[0].imageElement;
// build the content
loadPageInfo();
/* Select the requested tab, if the name is specified */ /* Select the requested tab, if the name is specified */
var initialTab = "generalTab"; loadTab(args);
if ("arguments" in window && window.arguments.length >= 1 &&
window.arguments[0] && window.arguments[0].initialTab)
initialTab = window.arguments[0].initialTab;
var radioGroup = document.getElementById("viewGroup");
initialTab = document.getElementById(initialTab) || document.getElementById("generalTab");
radioGroup.selectedItem = initialTab;
radioGroup.selectedItem.doCommand();
radioGroup.focus();
Components.classes["@mozilla.org/observer-service;1"] Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService) .getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "page-info-dialog-loaded", null); .notifyObservers(window, "page-info-dialog-loaded", null);
@ -340,7 +320,7 @@ function loadPageInfo()
onLoadRegistry.forEach(function(func) { func(); }); onLoadRegistry.forEach(function(func) { func(); });
} }
function resetPageInfo() function resetPageInfo(args)
{ {
/* Reset Meta tags part */ /* Reset Meta tags part */
gMetaView.clear(); gMetaView.clear();
@ -364,8 +344,8 @@ function resetPageInfo()
/* Call registered overlay reset functions */ /* Call registered overlay reset functions */
onResetRegistry.forEach(function(func) { func(); }); onResetRegistry.forEach(function(func) { func(); });
/* And let's rebuild the data */ /* Rebuild the data */
loadPageInfo(); loadTab(args);
} }
function onUnloadPageInfo() function onUnloadPageInfo()
@ -403,6 +383,26 @@ function showTab(id)
deck.selectedPanel = pagel; deck.selectedPanel = pagel;
} }
function loadTab(args)
{
if (args && args.doc) {
gDocument = args.doc;
gWindow = gDocument.defaultView;
}
gImageElement = args && args.imageElement;
/* Load the page info */
loadPageInfo();
var initialTab = (args && args.initialTab) || "generalTab";
var radioGroup = document.getElementById("viewGroup");
initialTab = document.getElementById(initialTab) || document.getElementById("generalTab");
radioGroup.selectedItem = initialTab;
radioGroup.selectedItem.doCommand();
radioGroup.focus();
}
function onClickMore() function onClickMore()
{ {
var radioGrp = document.getElementById("viewGroup"); var radioGrp = document.getElementById("viewGroup");
@ -1179,6 +1179,8 @@ function selectImage() {
for (var i = 0; i < tree.view.rowCount; i++) { for (var i = 0; i < tree.view.rowCount; i++) {
if (gImageElement == gImageView.data[i][COL_IMAGE_NODE]) { if (gImageElement == gImageView.data[i][COL_IMAGE_NODE]) {
tree.view.selection.select(i); tree.view.selection.select(i);
tree.treeBoxObject.ensureRowIsVisible(i);
tree.focus();
return; return;
} }
} }

View File

@ -64,13 +64,13 @@
width="&pageInfoWindow.width;" height="&pageInfoWindow.height;" width="&pageInfoWindow.width;" height="&pageInfoWindow.height;"
persist="screenX screenY width height sizemode"> persist="screenX screenY width height sizemode">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/> <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/pageInfo.js"/> <script type="application/javascript" src="chrome://browser/content/pageinfo/pageInfo.js"/>
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/feeds.js"/> <script type="application/javascript" src="chrome://browser/content/pageinfo/feeds.js"/>
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/permissions.js"/> <script type="application/javascript" src="chrome://browser/content/pageinfo/permissions.js"/>
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/security.js"/> <script type="application/javascript" src="chrome://browser/content/pageinfo/security.js"/>
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
<stringbundleset id="pageinfobundleset"> <stringbundleset id="pageinfobundleset">
<stringbundle id="pageinfobundle" src="chrome://browser/locale/pageInfo.properties"/> <stringbundle id="pageinfobundle" src="chrome://browser/locale/pageInfo.properties"/>

View File

@ -83,7 +83,7 @@ function disableAddons() {
var em = Components.classes["@mozilla.org/extensions/manager;1"] var em = Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager); .getService(Components.interfaces.nsIExtensionManager);
var type = nsIUpdateItem.TYPE_EXTENSION + nsIUpdateItem.TYPE_LOCALE; var type = nsIUpdateItem.TYPE_EXTENSION + nsIUpdateItem.TYPE_LOCALE;
var items = em.getItemList(type, { }); var items = em.getItemList(type);
for (var i = 0; i < items.length; ++i) for (var i = 0; i < items.length; ++i)
em.disableItem(items[i].id); em.disableItem(items[i].id);

View File

@ -67,7 +67,7 @@
onload="onLoad();" onload="onLoad();"
buttondisabledaccept="true"> buttondisabledaccept="true">
<script type="application/x-javascript" src="chrome://browser/content/safeMode.js"/> <script type="application/javascript" src="chrome://browser/content/safeMode.js"/>
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/> <stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>

View File

@ -872,10 +872,6 @@
this._lastRelatedTab = null; this._lastRelatedTab = null;
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
var focusedChromeElement = fm.getFocusedElementForWindow(window, false, {});
var oldBrowser = this.mCurrentBrowser; var oldBrowser = this.mCurrentBrowser;
if (oldBrowser) if (oldBrowser)
oldBrowser.setAttribute("type", "content-targetable"); oldBrowser.setAttribute("type", "content-targetable");
@ -970,13 +966,10 @@
event.initEvent("TabSelect", true, false); event.initEvent("TabSelect", true, false);
this.mCurrentTab.dispatchEvent(event); this.mCurrentTab.dispatchEvent(event);
// change focus to the new tab if nothing is focused, the old tab // Change focus to the new browser unless the findbar is focused.
// is focused or there is something in the new tab to focus. One if (gFindBar.hidden ||
// specific case where focus is not changed is when the new tab gFindBar.getElement("findbar-textbox").getAttribute("focused") != "true")
// has no focused element and a chrome element is focused. newBrowser.focus();
if ((!focusedChromeElement || focusedChromeElement == oldBrowser ||
fm.getFocusedElementForWindow(window.content, true, {})))
fm.setFocus(newBrowser, fm.FLAG_NOSCROLL);
} }
]]> ]]>
</body> </body>
@ -1521,9 +1514,9 @@
var l = this.mTabs.length - this._removingTabs.length; var l = this.mTabs.length - this._removingTabs.length;
var newTab = false; var newTab = false;
if (l == 1) { if (l == 1) {
closeWindow = aCloseWindowWithLastTab != null ? closeWindow = aCloseWindowWithLastTab != null ? aCloseWindowWithLastTab :
aCloseWindowWithLastTab : !window.toolbar.visible ||
this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab"); this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
// Closing the tab and replacing it with a blank one is notably slower // Closing the tab and replacing it with a blank one is notably slower
// than closing the window right away. If the caller opts in, take // than closing the window right away. If the caller opts in, take
@ -2930,7 +2923,7 @@
</xul:hbox> </xul:hbox>
</xul:stack> </xul:stack>
</content> </content>
<implementation implements="nsITimerCallback, nsIDOMEventListener"> <implementation implements="nsIDOMEventListener">
<constructor> <constructor>
<![CDATA[ <![CDATA[
var pb2 = var pb2 =
@ -2971,12 +2964,6 @@
Components.classes['@mozilla.org/preferences-service;1']. Components.classes['@mozilla.org/preferences-service;1'].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
pb2.removeObserver("browser.tabs.closeButtons", this._prefObserver); pb2.removeObserver("browser.tabs.closeButtons", this._prefObserver);
// Release timer to avoid reference cycles.
if (this._animateTimer) {
this._animateTimer.cancel();
this._animateTimer = null;
}
]]> ]]>
</destructor> </destructor>
@ -3106,33 +3093,6 @@
<field name="_animateElement"> <field name="_animateElement">
this.mTabstrip._scrollButtonDown; this.mTabstrip._scrollButtonDown;
</field> </field>
<field name="_animateTimer">null</field>
<field name="_animateBaseOpacity">null</field>
<field name="_animateBaseColor">null</field>
<field name="_animateStep">-1</field>
<field name="_animateDelay">25</field>
<field name="_animatePercents">
[1.00, 0.85, 0.80, 0.75, 0.71, 0.68, 0.65, 0.62, 0.59, 0.57,
0.54, 0.52, 0.50, 0.47, 0.45, 0.44, 0.42, 0.40, 0.38, 0.37,
0.35, 0.34, 0.32, 0.31, 0.30, 0.29, 0.28, 0.27, 0.26, 0.25,
0.24, 0.23, 0.23, 0.22, 0.22, 0.21, 0.21, 0.21, 0.20, 0.20,
0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.19, 0.19, 0.19, 0.18,
0.18, 0.17, 0.17, 0.16, 0.15, 0.14, 0.13, 0.11, 0.09, 0.06]
</field>
<method name="_stopAnimation">
<body><![CDATA[
if (this._animateStep != -1) {
if (this._animateTimer)
this._animateTimer.cancel();
this._animateStep = -1;
this._animateElement.style.outlineColor = "";
this._animateElement.style.outlineStyle = "";
}
]]></body>
</method>
<method name="_notifyBackgroundTab"> <method name="_notifyBackgroundTab">
<parameter name="aTab"/> <parameter name="aTab"/>
@ -3159,54 +3119,12 @@
selected.left - scrollRect.left); selected.left - scrollRect.left);
} }
this._stopAnimation(); if (!this._animateElement.hasAttribute("notifybgtab")) {
this._animateElement.setAttribute("notifybgtab", "true");
const DEFAULT_OPACITY = .7; setTimeout(function (ele) {
var self = this; ele.removeAttribute("notifybgtab");
this._animateBaseColor = }, 150, this._animateElement);
window.getComputedStyle(this._animateElement, null) }
.outlineColor
.replace(/^rgb\((.*)\)$/, "rgba($1, " + DEFAULT_OPACITY + ")")
.replace(/([^, ]*)\)/, function (m0, m1) {
self._animateBaseOpacity = parseFloat(m1);
return "$opacity)";
});
// start the flash timer
this._animateStep = 0;
var outlineWidth =
Math.ceil(Math.min(this._animateElement.clientHeight,
this._animateElement.clientWidth) * .6) + "px";
this._animateElement.style.outlineWidth = outlineWidth;
this._animateElement.style.outlineOffset = "-" + outlineWidth;
this._animateElement.style.outlineColor = "rgba(0,0,0,0)";
this._animateElement.style.outlineStyle = "solid";
if (!this._animateTimer)
this._animateTimer =
Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
this._animateTimer.initWithCallback(this, this._animateDelay,
this._animateTimer.TYPE_REPEATING_SLACK);
]]></body>
</method>
<method name="notify">
<parameter name="aTimer"/>
<body><![CDATA[
if (!document)
aTimer.cancel();
var opacity = this._animateBaseOpacity * this._animatePercents[this._animateStep];
this._animateElement.style.outlineColor =
this._animateBaseColor.replace("$opacity", opacity);
if (this._animateStep < (this._animatePercents.length - 1))
this._animateStep++;
else
this._stopAnimation();
]]></body> ]]></body>
</method> </method>
</implementation> </implementation>

View File

@ -97,8 +97,10 @@ _BROWSER_FILES = \
browser_bug455852.js \ browser_bug455852.js \
browser_bug462673.js \ browser_bug462673.js \
browser_bug481560.js \ browser_bug481560.js \
browser_bug484315.js \
browser_bug477014.js \ browser_bug477014.js \
browser_bug495058.js \ browser_bug495058.js \
browser_bug517902.js \
browser_bug521216.js \ browser_bug521216.js \
browser_discovery.js \ browser_discovery.js \
browser_tabfocus.js \ browser_tabfocus.js \
@ -139,7 +141,9 @@ _BROWSER_FILES = \
browser_bug304198.js \ browser_bug304198.js \
browser_drag.js \ browser_drag.js \
browser_relatedTabs.js \ browser_relatedTabs.js \
browser_plainTextLinks.js \
browser_contextSearchTabPosition.js \ browser_contextSearchTabPosition.js \
browser_NetworkPrioritizer.js \
$(NULL) $(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))

View File

@ -0,0 +1,187 @@
/* ***** 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 Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul OShannessy <paul@oshannessy.com> (original author)
*
* 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 ***** */
function test() {
/** Tests for NetworkPrioritizer.jsm (Bug 514490) **/
waitForExplicitFinish();
const PRIORITY_DELTA = -10; // same as in NetworkPrioritizer
// Test helper functions.
// getPriority and setPriority can take a Tab or a Browser
function getPriority(aBrowser) {
// Assume we were passed a tab if it's not a browser
if (!aBrowser.webNavigation)
aBrowser = aBrowser.linkedBrowser;
return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority).priority;
}
function setPriority(aBrowser, aPriority) {
if (!aBrowser.webNavigation)
aBrowser = aBrowser.linkedBrowser;
aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority).priority = aPriority;
}
function isWindowState(aWindow, aTabPriorities) {
let browsers = aWindow.gBrowser.browsers;
// Make sure we have the right number of tabs & priorities
is(browsers.length, aTabPriorities.length,
"Window has expected number of tabs");
// aState should be in format [ priority, priority, priority ]
for (let i = 0; i < browsers.length; i++) {
is(getPriority(browsers[i]), aTabPriorities[i],
"Tab had expected priority");
}
}
// This is the real test. It creates multiple tabs & windows, changes focus,
// closes windows/tabs to make sure we behave correctly.
// This test assumes that no priorities have been adjusted and the loadgroup
// priority starts at 0.
function test_behavior() {
// Call window "window_A" to make the test easier to follow
let window_A = window;
// Test 1 window, 1 tab case.
isWindowState(window_A, [-10]);
// Exising tab is tab_A1
let tab_A2 = window_A.gBrowser.addTab("http://example.com");
let tab_A3 = window_A.gBrowser.addTab("about:config");
tab_A3.linkedBrowser.addEventListener("load", function(aEvent) {
tab_A3.removeEventListener("load", arguments.callee, true);
// tab_A2 isn't focused yet
isWindowState(window_A, [-10, 0, 0]);
// focus tab_A2 & make sure priority got updated
window_A.gBrowser.selectedTab = tab_A2;
isWindowState(window_A, [0, -10, 0]);
window_A.gBrowser.removeTab(tab_A2);
// Next tab is auto selected
isWindowState(window_A, [0, -10]);
// Open another window then play with focus
let window_B = openDialog(location, "_blank", "chrome,all,dialog=no", "http://example.com");
window_B.addEventListener("load", function(aEvent) {
window_B.removeEventListener("load", arguments.callee, false);
window_B.gBrowser.addEventListener("load", function(aEvent) {
// waitForFocus can attach to the wrong "window" with about:blank loading first
// So just ensure that we're getting the load event for the right URI
if (window_B.gBrowser.currentURI.spec == "about:blank")
return;
window_B.gBrowser.removeEventListener("load", arguments.callee, true);
waitForFocus(function() {
isWindowState(window_A, [10, 0]);
isWindowState(window_B, [-10]);
waitForFocus(function() {
isWindowState(window_A, [0, -10]);
isWindowState(window_B, [0]);
waitForFocus(function() {
isWindowState(window_A, [10, 0]);
isWindowState(window_B, [-10]);
// And we're done. Cleanup & run the next test
window_B.close();
window_A.gBrowser.removeTab(tab_A3);
executeSoon(runNextTest);
}, window_B);
}, window_A);
}, window_B);
}, true);
}, false);
}, true);
}
// This is more a test of nsLoadGroup and how it handles priorities. But since
// we depend on its behavior, it's good to test it. This is testing that there
// are no errors if we adjust beyond nsISupportsPriority's bounds.
function test_extremePriorities() {
let tab_A1 = gBrowser.tabContainer.getItemAtIndex(0);
let oldPriority = getPriority(tab_A1);
// Set the priority of tab_A1 to the lowest possible. Selecting the other tab
// will try to lower it
setPriority(tab_A1, Ci.nsISupportsPriority.PRIORITY_LOWEST);
let tab_A2 = gBrowser.addTab("http://example.com");
tab_A2.linkedBrowser.addEventListener("load", function(aEvent) {
tab_A2.removeEventListener("load", arguments.callee, true);
gBrowser.selectedTab = tab_A2;
is(getPriority(tab_A1), Ci.nsISupportsPriority.PRIORITY_LOWEST - PRIORITY_DELTA,
"Can adjust priority beyond 'lowest'");
// Now set priority to "highest" and make sure that no errors occur.
setPriority(tab_A1, Ci.nsISupportsPriority.PRIORITY_HIGHEST);
gBrowser.selectedTab = tab_A1;
is(getPriority(tab_A1), Ci.nsISupportsPriority.PRIORITY_HIGHEST + PRIORITY_DELTA,
"Can adjust priority beyond 'highest'");
// Cleanup, run next test
gBrowser.removeTab(tab_A2);
executeSoon(function() {
setPriority(tab_A1, oldPriority);
runNextTest();
});
}, true);
}
let tests = [test_behavior, test_extremePriorities];
function runNextTest() {
if (tests.length) {
// Linux has problems if window isn't focused. Should help prevent [orange].
waitForFocus(tests.shift());
} else {
finish();
}
}
runNextTest();
}

View File

@ -1,15 +1,6 @@
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
// focus the url field so that it will can ensure the focus is there when
// the window is refocused after the dialog closes
gURLBar.focus();
window.addEventListener("focus", function () {
window.removeEventListener("focus", arguments.callee, false);
finish();
}, false);
var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no"); var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
win.addEventListener("load", function () { win.addEventListener("load", function () {
@ -18,13 +9,15 @@ function test() {
win.content.addEventListener("focus", function () { win.content.addEventListener("focus", function () {
win.content.removeEventListener("focus", arguments.callee, false); win.content.removeEventListener("focus", arguments.callee, false);
win.gBrowser.selectedTab.addEventListener("TabClose", function () {
ok(false, "shouldn't have gotten the TabClose event for the last tab");
}, false);
EventUtils.synthesizeKey("w", { accelKey: true }, win); EventUtils.synthesizeKey("w", { accelKey: true }, win);
ok(win.closed, "accel+w closed the window immediately"); ok(win.closed, "accel+w closed the window immediately");
}, false);
win.gBrowser.selectedTab.addEventListener("TabClose", function () { finish();
ok(false, "shouldn't have gotten the TabClose event for the last tab");
}, false); }, false);
}, false); }, false);
} }

View File

@ -0,0 +1,25 @@
function test() {
var contentWin = window.open("about:blank", "", "width=100,height=100");
var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
if (win.content == contentWin) {
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
win.gBrowser.removeCurrentTab();
ok(win.closed, "popup is closed");
// clean up
if (!win.closed)
win.close();
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
return;
}
}
throw "couldn't find the content window";
}

View File

@ -0,0 +1,37 @@
/* Make sure that "View Image Info" loads the correct image data */
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
var doc = gBrowser.contentDocument;
var testImg = doc.getElementById("test-image");
var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
pageInfo.addEventListener("load", function () {
pageInfo.onFinished.push(function () {
executeSoon(function () {
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
is(pageInfoImg.src, testImg.src, "selected image has the correct source");
is(pageInfoImg.width, testImg.width, "selected image has the correct width");
is(pageInfoImg.height, testImg.height, "selected image has the correct height");
pageInfo.close();
gBrowser.removeCurrentTab();
finish();
});
});
}, true);
}, true);
content.location =
"data:text/html," +
"<img src='about:logo?a' height=200 width=250>" +
"<img src='about:logo?b' height=200 width=250 alt=1>" +
"<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>";
}

View File

@ -0,0 +1,95 @@
let doc, range, selection;
function setSelection(el1, el2, index1, index2) {
selection.removeAllRanges();
range.setStart(el1, index1);
range.setEnd(el2, index2);
selection.addRange(range);
}
function initContextMenu() {
document.popupNode = doc.getElementsByTagName("DIV")[0];
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
return contextMenu;
}
function testExpected(expected, msg) {
initContextMenu();
let linkMenuItem = document.getElementById("context-openlinkincurrent");
is(linkMenuItem.hidden, expected, msg);
}
function testLinkExpected(expected, msg) {
let contextMenu = initContextMenu();
is(contextMenu.linkURL, expected, msg);
}
function runSelectionTests() {
let mainDiv = doc.createElement("div");
let div = doc.createElement("div");
let div2 = doc.createElement("div");
let span1 = doc.createElement("span");
let span2 = doc.createElement("span");
let span3 = doc.createElement("span");
let p1 = doc.createElement("p");
let p2 = doc.createElement("p");
span1.textContent = "http://index.";
span2.textContent = "example.com example.com";
span3.textContent = " - Test";
p1.textContent = "mailto:test.com ftp.example.com";
p2.textContent = "example.com -";
div.appendChild(span1);
div.appendChild(span2);
div.appendChild(span3);
div.appendChild(p1);
div.appendChild(p2);
let p3 = doc.createElement("p");
p3.textContent = "main.example.com";
div2.appendChild(p3);
mainDiv.appendChild(div);
mainDiv.appendChild(div2);
doc.body.appendChild(mainDiv);
setSelection(span1.firstChild, span2.firstChild, 0, 11);
testExpected(false, "The link context menu should show for http://www.example.com");
setSelection(span1.firstChild, span2.firstChild, 7, 11);
testExpected(false, "The link context menu should show for www.example.com");
setSelection(span1.firstChild, span2.firstChild, 8, 11);
testExpected(true, "The link context menu should not show for ww.example.com");
setSelection(span2.firstChild, span2.firstChild, 0, 11);
testExpected(false, "The link context menu should show for example.com");
testLinkExpected("http://example.com/", "url for example.com selection should not prepend www");
setSelection(span2.firstChild, span2.firstChild, 11, 23);
testExpected(false, "The link context menu should show for example.com");
setSelection(span2.firstChild, span2.firstChild, 0, 10);
testExpected(true, "Link options should not show for selection that's not at a word boundary");
setSelection(span2.firstChild, span3.firstChild, 12, 7);
testExpected(true, "Link options should not show for selection that has whitespace");
setSelection(span2.firstChild, span2.firstChild, 12, 19);
testExpected(true, "Link options should not show unless a url is selected");
setSelection(p1.firstChild, p1.firstChild, 0, 15);
testExpected(true, "Link options should not show for mailto: links");
setSelection(p1.firstChild, p1.firstChild, 16, 31);
testExpected(false, "Link options should show for ftp.example.com");
testLinkExpected("ftp://ftp.example.com/", "ftp.example.com should be preceeded with ftp://");
setSelection(p2.firstChild, p2.firstChild, 0, 14);
testExpected(false, "Link options should show for www.example.com ");
selection.selectAllChildren(div2);
testExpected(false, "Link options should show for triple-click selections");
gBrowser.removeCurrentTab();
finish();
}
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
doc = content.document;
range = doc.createRange();
selection = content.getSelection();
waitForFocus(runSelectionTests, content);
}, true);
content.location =
"data:text/html,Test For Non-Hyperlinked url selection";
}

View File

@ -6,13 +6,11 @@ let testPage1 = "data:text/html,<html id='tab1'><body><button id='button1'>Tab 1
let testPage2 = "data:text/html,<html id='tab2'><body><button id='button2'>Tab 2</button></body></html>"; let testPage2 = "data:text/html,<html id='tab2'><body><button id='button2'>Tab 2</button></body></html>";
let testPage3 = "data:text/html,<html id='tab3'><body><button id='button3'>Tab 3</button></body></html>"; let testPage3 = "data:text/html,<html id='tab3'><body><button id='button3'>Tab 3</button></body></html>";
var browser1;
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
var tab1 = gBrowser.addTab(); var tab1 = gBrowser.addTab();
browser1 = gBrowser.getBrowserForTab(tab1); var browser1 = gBrowser.getBrowserForTab(tab1);
var tab2 = gBrowser.addTab(); var tab2 = gBrowser.addTab();
var browser2 = gBrowser.getBrowserForTab(tab2); var browser2 = gBrowser.getBrowserForTab(tab2);
@ -34,25 +32,26 @@ function test() {
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true); window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true); window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
gBrowser.selectedTab = tab2;
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
is(fm.focusedWindow, window, "focusedWindow after tab load");
is(fm.focusedElement, gURLBar.inputField, "focusedElement after tab load");
// make sure that the focus initially starts out blank // make sure that the focus initially starts out blank
var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
var focusedWindow = {}; var focusedWindow = {};
is(fm.getFocusedElementForWindow(browser1.contentWindow, false, focusedWindow), null, "initial focus in tab 1"); is(fm.getFocusedElementForWindow(browser1.contentWindow, false, focusedWindow), null, "initial focus in tab 1");
is(focusedWindow.value, browser1.contentWindow, "initial frame focus in tab 1"); is(focusedWindow.value, browser1.contentWindow, "initial frame focus in tab 1");
is(fm.getFocusedElementForWindow(browser2.contentWindow, false, focusedWindow), null, "initial focus in tab 2"); is(fm.getFocusedElementForWindow(browser2.contentWindow, false, focusedWindow), null, "initial focus in tab 2");
is(focusedWindow.value, browser2.contentWindow, "initial frame focus in tab 2"); is(focusedWindow.value, browser2.contentWindow, "initial frame focus in tab 2");
expectFocusShift(function () gBrowser.selectedTab = tab2,
browser2.contentWindow, null, true,
"focusedElement after tab change, focus in new tab");
// switching tabs when the urlbar is focused and nothing in the new tab is focused // switching tabs when the urlbar is focused and nothing in the new tab is focused
// should keep focus in the urlbar // should focus the browser
expectFocusShift(function () gURLBar.focus(),
window, gURLBar.inputField, true,
"url field focused");
expectFocusShift(function () gBrowser.selectedTab = tab1, expectFocusShift(function () gBrowser.selectedTab = tab1,
window, gURLBar.inputField, false, browser1.contentWindow, null, true,
"focusedElement after tab change, focus in url field, no focus in new tab"); "focusedElement after tab change, focus in new tab");
// focusing a button in the current tab should focus it // focusing a button in the current tab should focus it
var button1 = browser1.contentDocument.getElementById("button1"); var button1 = browser1.contentDocument.getElementById("button1");
@ -223,8 +222,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
is(_browser_tabfocus_test_events, expectedEvents, testid + " events"); is(_browser_tabfocus_test_events, expectedEvents, testid + " events");
_browser_tabfocus_test_events = ""; _browser_tabfocus_test_events = "";
var fm = Components.classes["@mozilla.org/focus-manager;1"]. var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
getService(Components.interfaces.nsIFocusManager);
var focusedElement = fm.focusedElement; var focusedElement = fm.focusedElement;
is(focusedElement ? getId(focusedElement) : "none", is(focusedElement ? getId(focusedElement) : "none",

View File

@ -53,11 +53,11 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="load()" onunload="unload()"> onload="load()" onunload="unload()">
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/> <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/> <script type="application/javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/> <script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/x-javascript" src="chrome://browser/content/nsContextMenu.js"/> <script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/>
<script type="application/x-javascript" src="chrome://browser/content/web-panels.js"/> <script type="application/javascript" src="chrome://browser/content/web-panels.js"/>
<stringbundleset id="stringbundleset"> <stringbundleset id="stringbundleset">
<stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/> <stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>

View File

@ -36,6 +36,7 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../places/src \ -I$(srcdir)/../places/src \
-I$(srcdir)/../privatebrowsing/src \ -I$(srcdir)/../privatebrowsing/src \
-I$(srcdir)/../about \ -I$(srcdir)/../about \
-I$(srcdir)/../dirprovider \
$(NULL) $(NULL)
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)
@ -47,6 +48,7 @@ SHARED_LIBRARY_LIBS = \
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \ ../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
../privatebrowsing/src/$(LIB_PREFIX)privatebrowsing_s.$(LIB_SUFFIX) \ ../privatebrowsing/src/$(LIB_PREFIX)privatebrowsing_s.$(LIB_SUFFIX) \
../about/$(LIB_PREFIX)browserabout_s.$(LIB_SUFFIX) \ ../about/$(LIB_PREFIX)browserabout_s.$(LIB_SUFFIX) \
../dirprovider/$(LIB_PREFIX)browserdir_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
ifneq (,$(filter windows cocoa gtk2, $(MOZ_WIDGET_TOOLKIT))) ifneq (,$(filter windows cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))

View File

@ -106,3 +106,6 @@
#define NS_BROWSER_ABOUT_REDIRECTOR_CID \ #define NS_BROWSER_ABOUT_REDIRECTOR_CID \
{ 0x7e4bb6ad, 0x2fc4, 0x4dc6, { 0x89, 0xef, 0x23, 0xe8, 0xe5, 0xcc, 0xf9, 0x80 } } { 0x7e4bb6ad, 0x2fc4, 0x4dc6, { 0x89, 0xef, 0x23, 0xe8, 0xe5, 0xcc, 0xf9, 0x80 } }
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
#define NS_BROWSERDIRECTORYPROVIDER_CID \
{ 0x6deb193c, 0xf87d, 0x4078, { 0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 } }

View File

@ -39,6 +39,7 @@
#include "nsIGenericFactory.h" #include "nsIGenericFactory.h"
#include "nsBrowserCompsCID.h" #include "nsBrowserCompsCID.h"
#include "DirectoryProvider.h"
#include "nsPlacesImportExportService.h" #include "nsPlacesImportExportService.h"
#if defined(XP_WIN) #if defined(XP_WIN)
@ -84,6 +85,7 @@ using namespace mozilla::browser;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService)
#if defined(XP_WIN) #if defined(XP_WIN)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
@ -124,6 +126,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrivateBrowsingServiceWrapper, Init)
static const nsModuleComponentInfo components[] = static const nsModuleComponentInfo components[] =
{ {
{ "Browser Directory Provider",
NS_BROWSERDIRECTORYPROVIDER_CID,
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
DirectoryProviderConstructor,
DirectoryProvider::Register,
DirectoryProvider::Unregister
},
#if defined(XP_WIN) #if defined(XP_WIN)
{ "Browser Shell Service", { "Browser Shell Service",
NS_SHELLSERVICE_CID, NS_SHELLSERVICE_CID,

View File

@ -67,7 +67,7 @@
should be updated to ignore this one as well. --> should be updated to ignore this one as well. -->
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/> <link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/>
<script type="application/x-javascript"><![CDATA[ <script type="application/javascript"><![CDATA[
// Error url MUST be formatted like this: // Error url MUST be formatted like this:
// about:certerror?e=error&u=url&d=desc // about:certerror?e=error&u=url&d=desc
@ -273,7 +273,7 @@
- an onload handler. This is because error pages are loaded as - an onload handler. This is because error pages are loaded as
- LOAD_BACKGROUND, which means that onload handlers will not be executed. - LOAD_BACKGROUND, which means that onload handlers will not be executed.
--> -->
<script type="application/x-javascript">initPage();</script> <script type="application/javascript">initPage();</script>
</body> </body>
</html> </html>

View File

@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsIDirectoryService.h" #include "nsIDirectoryService.h"
#include "DirectoryProvider.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
@ -56,52 +57,15 @@
#include "nsStringAPI.h" #include "nsStringAPI.h"
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
class nsBrowserDirectoryProvider : namespace mozilla {
public nsIDirectoryServiceProvider2 namespace browser {
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr, NS_IMPL_ISUPPORTS2(DirectoryProvider,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
private:
nsresult RestoreBookmarksFromBackup(const nsACString& aLeafName,
nsIFile* aParentDir, nsIFile* aTarget);
void EnsureProfileFile(const nsACString& aLeafName,
nsIFile* aParentDir, nsIFile* aTarget);
class AppendingEnumerator : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator* aBase,
char const *const *aAppendList);
private:
nsCOMPtr<nsISimpleEnumerator> mBase;
char const *const *const mAppendList;
nsCOMPtr<nsIFile> mNext;
};
};
NS_IMPL_ISUPPORTS2(nsBrowserDirectoryProvider,
nsIDirectoryServiceProvider, nsIDirectoryServiceProvider,
nsIDirectoryServiceProvider2) nsIDirectoryServiceProvider2)
NS_IMETHODIMP NS_IMETHODIMP
nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, DirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, nsIFile* *aResult)
nsIFile* *aResult)
{ {
nsresult rv; nsresult rv;
@ -290,8 +254,7 @@ AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBrowserDirectoryProvider::GetFiles(const char *aKey, DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
nsISimpleEnumerator* *aResult)
{ {
nsresult rv; nsresult rv;
@ -331,17 +294,10 @@ nsBrowserDirectoryProvider::GetFiles(const char *aKey,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
static char const kContractID[] = "@mozilla.org/browser/directory-provider;1";
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
#define NS_BROWSERDIRECTORYPROVIDER_CID \
{ 0x6deb193c, 0xf87d, 0x4078, { 0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 } }
NS_METHOD NS_METHOD
nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr, DirectoryProvider::Register(nsIComponentManager* aCompMgr, nsIFile* aPath,
nsIFile* aPath, const char *aLoaderStr, const char *aLoaderStr, const char *aType,
const char *aType, const nsModuleComponentInfo *aInfo)
const nsModuleComponentInfo *aInfo)
{ {
nsresult rv; nsresult rv;
@ -352,15 +308,16 @@ nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr,
rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
"browser-directory-provider", "browser-directory-provider",
kContractID, PR_TRUE, PR_TRUE, nsnull); NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
PR_TRUE, PR_TRUE, nsnull);
return rv; return rv;
} }
NS_METHOD NS_METHOD
nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr, DirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr, nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo) const nsModuleComponentInfo *aInfo)
{ {
nsresult rv; nsresult rv;
@ -374,32 +331,17 @@ nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
return rv; return rv;
} }
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserDirectoryProvider) NS_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
static const nsModuleComponentInfo components[] = {
{
"nsBrowserDirectoryProvider",
NS_BROWSERDIRECTORYPROVIDER_CID,
kContractID,
nsBrowserDirectoryProviderConstructor,
nsBrowserDirectoryProvider::Register,
nsBrowserDirectoryProvider::Unregister
}
};
NS_IMPL_NSGETMODULE(BrowserDirProvider, components)
NS_IMPL_ISUPPORTS1(nsBrowserDirectoryProvider::AppendingEnumerator,
nsISimpleEnumerator)
NS_IMETHODIMP NS_IMETHODIMP
nsBrowserDirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult) DirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
{ {
*aResult = mNext ? PR_TRUE : PR_FALSE; *aResult = mNext ? PR_TRUE : PR_FALSE;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult) DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
{ {
if (aResult) if (aResult)
NS_ADDREF(*aResult = mNext); NS_ADDREF(*aResult = mNext);
@ -440,7 +382,7 @@ nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
return NS_OK; return NS_OK;
} }
nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator DirectoryProvider::AppendingEnumerator::AppendingEnumerator
(nsISimpleEnumerator* aBase, (nsISimpleEnumerator* aBase,
char const *const *aAppendList) : char const *const *aAppendList) :
mBase(aBase), mBase(aBase),
@ -449,3 +391,6 @@ nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator
// Initialize mNext to begin. // Initialize mNext to begin.
GetNext(nsnull); GetNext(nsnull);
} }
} // namespace browser
} // namespace mozilla

View File

@ -0,0 +1,89 @@
/* ***** 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 the Mozilla Firefox browser.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <benjamin@smedbergs.us>
*
* Portions created by the Initial Developer are Copyright (C) 2005
* 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 ***** */
#ifndef DirectoryProvider_h__
#define DirectoryProvider_h__
#include "nsIDirectoryService.h"
#include "nsComponentManagerUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIFile.h"
#include "nsIGenericFactory.h"
#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \
"@mozilla.org/browser/directory-provider;1"
namespace mozilla {
namespace browser {
class DirectoryProvider : public nsIDirectoryServiceProvider2
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
static NS_METHOD Register(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const char *aType,
const nsModuleComponentInfo *aInfo);
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
nsIFile* aPath, const char *aLoaderStr,
const nsModuleComponentInfo *aInfo);
private:
class AppendingEnumerator : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator* aBase,
char const *const *aAppendList);
private:
nsCOMPtr<nsISimpleEnumerator> mBase;
char const *const *const mAppendList;
nsCOMPtr<nsIFile> mNext;
};
};
} // namespace browser
} // namespace mozilla
#endif // DirectoryProvider_h__

View File

@ -42,12 +42,13 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
MODULE = browsercomps MODULE = browserdir
LIBRARY_NAME = browserdirprovider LIBRARY_NAME = browserdir_s
SHORT_LIBNAME = brwsrdir
IS_COMPONENT = 1 DIRS = tests
MODULE_NAME = BrowserDirProvider
FORCE_SHARED_LIB = 1 FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
# Because we are an application component, link against the CRT statically # Because we are an application component, link against the CRT statically
# (on Windows, but only if we're not building our own CRT for jemalloc) # (on Windows, but only if we're not building our own CRT for jemalloc)
@ -55,7 +56,12 @@ ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1 USE_STATIC_LIBS = 1
endif endif
CPPSRCS = nsBrowserDirectoryProvider.cpp EXPORTS_NAMESPACES = mozilla/browser
EXPORTS_mozilla/browser = DirectoryProvider.h
CPPSRCS = DirectoryProvider.cpp
LOCAL_INCLUDES = -I$(srcdir)/../build
EXTRA_DSO_LDOPTS = \ EXTRA_DSO_LDOPTS = \
$(XPCOM_GLUE_LDOPTS) \ $(XPCOM_GLUE_LDOPTS) \

View File

@ -1,4 +1,3 @@
#
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
# #
@ -14,12 +13,12 @@
# #
# The Original Code is mozilla.org code. # The Original Code is mozilla.org code.
# #
# The Initial Developer of the Original Code is # The Initial Developer of the Original Code is Mozilla Foundation.
# Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2009
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved. # the Initial Developer. All Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Ryan Flint <rflint@mozilla.com> (Original Author)
# #
# Alternatively, the contents of this file may be used under the terms of # 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 # either the GNU General Public License Version 2 or later (the "GPL"), or
@ -35,11 +34,16 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
DEPTH = ../../.. DEPTH = ../../../..
topsrcdir = @top_srcdir@ topsrcdir = @top_srcdir@
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
relativesrcdir = browser/components/dirprovider/tests
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
MODULE = test_browserdir
XPCSHELL_TESTS = unit
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

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) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ryan Flint <rflint@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 ***** */
const Cc = Components.classes;
const Ci = Components.interfaces;
var gProfD = do_get_profile();
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
var gPrefSvc = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
function writeTestFile(aParent, aName) {
let file = aParent.clone();
file.append(aName);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
return file;
}

View File

@ -0,0 +1,46 @@
/* ***** 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) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ryan Flint <rflint@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 ***** */
// We need to run this test separately since DirectoryProvider persists BMarks
function run_test() {
let dir = gProfD.clone();
let tfile = writeTestFile(dir, "bookmarkfile.test");
gPrefSvc.setCharPref("browser.bookmarks.file", tfile.path);
let bmarks = gDirSvc.get("BMarks", Ci.nsIFile);
do_check_true(tfile.equals(bmarks));
}

View File

@ -0,0 +1,91 @@
/* ***** 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) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ryan Flint <rflint@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 ***** */
function test_usr_micsum() {
let mdir = gProfD.clone();
mdir.append("microsummary-generators");
let tmdir = gDirSvc.get("UsrMicsumGens", Ci.nsIFile);
do_check_true(tmdir.equals(mdir));
if (!tmdir.exists())
tmdir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777);
do_check_true(tmdir.isWritable());
let tfile = writeTestFile(tmdir, "usrmicsum");
do_check_true(tfile.exists());
mdir.append(tfile.leafName);
do_check_true(mdir.exists());
}
function test_app_micsum() {
let mdir = gDirSvc.get("XCurProcD", Ci.nsIFile);
mdir.append("microsummary-generators");
let tmdir = gDirSvc.get("MicsumGens", Ci.nsIFile);
do_check_true(tmdir.equals(mdir));
}
function test_bookmarkhtml() {
let bmarks = gProfD.clone();
bmarks.append("bookmarks.html");
let tbmarks = gDirSvc.get("BMarks", Ci.nsIFile);
do_check_true(bmarks.equals(tbmarks));
}
function test_prefoverride() {
let dir = gDirSvc.get("DefRt", Ci.nsIFile);
dir.append("existing-profile-defaults.js");
let tdir = gDirSvc.get("ExistingPrefOverride", Ci.nsIFile);
do_check_true(dir.equals(tdir));
}
function run_test() {
[test_usr_micsum,
test_app_micsum,
test_bookmarkhtml,
test_prefoverride
].forEach(function(f) {
do_test_pending();
print("Running test: " + f.name);
f();
do_test_finished();
});
}

View File

@ -244,7 +244,7 @@ DistributionCustomizer.prototype = {
}, },
_bookmarksApplied: false, _bookmarksApplied: false,
applyBookmarks: function DIST_applyBookarks() { applyBookmarks: function DIST_applyBookmarks() {
this._bookmarksApplied = true; this._bookmarksApplied = true;
if (!this._iniFile) if (!this._iniFile)
return this._checkCustomizationComplete(); return this._checkCustomizationComplete();

View File

@ -24,7 +24,7 @@
href="chrome://browser/skin/feeds/subscribe.css" href="chrome://browser/skin/feeds/subscribe.css"
type="text/css" type="text/css"
media="all"/> media="all"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/feeds/subscribe.js"/> src="chrome://browser/content/feeds/subscribe.js"/>
</head> </head>
<body onload="SubscribeHandler.writeContent();" onunload="SubscribeHandler.uninit();"> <body onload="SubscribeHandler.writeContent();" onunload="SubscribeHandler.uninit();">
@ -60,7 +60,7 @@
></div> ></div>
</div> </div>
<script type="application/x-javascript"> <script type="application/javascript">
SubscribeHandler.init(); SubscribeHandler.init();
</script> </script>

View File

@ -552,7 +552,7 @@ MicrosummaryService.prototype = {
* *
*/ */
get _bookmarks() { get _bookmarks() {
var bookmarks = this._ans.getItemsWithAnnotation(ANNO_MICSUM_GEN_URI, {}); var bookmarks = this._ans.getItemsWithAnnotation(ANNO_MICSUM_GEN_URI);
this.__defineGetter__("_bookmarks", function() bookmarks); this.__defineGetter__("_bookmarks", function() bookmarks);
return this._bookmarks; return this._bookmarks;
}, },

View File

@ -49,7 +49,7 @@
buttons="accept,cancel" buttons="accept,cancel"
branded="true"> branded="true">
<script type="application/x-javascript" src="chrome://browser/content/migration/migration.js"/> <script type="application/javascript" src="chrome://browser/content/migration/migration.js"/>
<stringbundle id="bundle" src="chrome://browser/locale/migration/migration.properties"/> <stringbundle id="bundle" src="chrome://browser/locale/migration/migration.properties"/>
<stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/> <stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>

View File

@ -1002,7 +1002,7 @@ BrowserGlue.prototype = {
newInVersion: 1 }; newInVersion: 1 };
smartBookmarks.push(smart); smartBookmarks.push(smart);
var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {}); var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
// Set current itemId, parent and position if Smart Bookmark exists, // Set current itemId, parent and position if Smart Bookmark exists,
// we will use these informations to create the new version at the same // we will use these informations to create the new version at the same
// position. // position.

View File

@ -52,9 +52,9 @@
onload="init();" onload="init();"
onunload="SidebarUtils.clearURLFromStatusBar();"> onunload="SidebarUtils.clearURLFromStatusBar();">
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/bookmarks/sidebarUtils.js"/> src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/bookmarks/bookmarksPanel.js"/> src="chrome://browser/content/bookmarks/bookmarksPanel.js"/>
<commandset id="placesCommands"/> <commandset id="placesCommands"/>

View File

@ -248,7 +248,7 @@ PlacesController.prototype = {
case "placesCmd_deleteDataHost": case "placesCmd_deleteDataHost":
var host; var host;
if (PlacesUtils.nodeIsHost(this._view.selectedNode)) { if (PlacesUtils.nodeIsHost(this._view.selectedNode)) {
var queries = this._view.selectedNode.getQueries({}); var queries = this._view.selectedNode.getQueries();
host = queries[0].domain; host = queries[0].domain;
} }
else else
@ -509,7 +509,7 @@ PlacesController.prototype = {
// annotations // annotations
if (uri) { if (uri) {
var names = PlacesUtils.annotations.getPageAnnotationNames(uri, {}); var names = PlacesUtils.annotations.getPageAnnotationNames(uri);
for (var j = 0; j < names.length; ++j) for (var j = 0; j < names.length; ++j)
nodeData[names[j]] = true; nodeData[names[j]] = true;
} }
@ -517,7 +517,7 @@ PlacesController.prototype = {
// For items also include the item-specific annotations // For items also include the item-specific annotations
if (node.itemId != -1) { if (node.itemId != -1) {
names = PlacesUtils.annotations names = PlacesUtils.annotations
.getItemAnnotationNames(node.itemId, {}); .getItemAnnotationNames(node.itemId);
for (j = 0; j < names.length; ++j) for (j = 0; j < names.length; ++j)
nodeData[names[j]] = true; nodeData[names[j]] = true;
} }
@ -1058,7 +1058,7 @@ PlacesController.prototype = {
} }
else if (PlacesUtils.nodeIsDay(aContainerNode)) { else if (PlacesUtils.nodeIsDay(aContainerNode)) {
// Day container. // Day container.
var query = aContainerNode.getQueries({})[0]; var query = aContainerNode.getQueries()[0];
var beginTime = query.beginTime; var beginTime = query.beginTime;
var endTime = query.endTime; var endTime = query.endTime;
NS_ASSERT(query && beginTime && endTime, NS_ASSERT(query && beginTime && endTime,

View File

@ -204,7 +204,7 @@ var gEditItemOverlay = {
this._initTextField("locationField", this._uri.spec); this._initTextField("locationField", this._uri.spec);
if (!aItemIdList) { if (!aItemIdList) {
var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(", "); var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", ");
this._initTextField("tagsField", tags, false); this._initTextField("tagsField", tags, false);
} }
else { else {
@ -218,8 +218,8 @@ var gEditItemOverlay = {
this._itemIds[i] = -1; this._itemIds[i] = -1;
} }
else else
this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i], {}); this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]);
this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i], {}); this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]);
if (this._tags[i].length < this._tags[nodeToCheck].length) if (this._tags[i].length < this._tags[nodeToCheck].length)
nodeToCheck = i; nodeToCheck = i;
} }
@ -328,7 +328,7 @@ var gEditItemOverlay = {
} }
// List of recently used folders: // List of recently used folders:
var folderIds = annos.getItemsWithAnnotation(LAST_USED_ANNO, { }); var folderIds = annos.getItemsWithAnnotation(LAST_USED_ANNO);
/** /**
* The value of the LAST_USED_ANNO annotation is the time (in the form of * The value of the LAST_USED_ANNO annotation is the time (in the form of
@ -573,7 +573,7 @@ var gEditItemOverlay = {
}, },
_updateSingleTagForItem: function EIO__updateSingleTagForItem() { _updateSingleTagForItem: function EIO__updateSingleTagForItem() {
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri, { }); var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri);
var tags = this._getTagsArrayFromTagField(); var tags = this._getTagsArrayFromTagField();
if (tags.length > 0 || currentTags.length > 0) { if (tags.length > 0 || currentTags.length > 0) {
var tagsToRemove = []; var tagsToRemove = [];
@ -599,7 +599,7 @@ var gEditItemOverlay = {
PlacesUIUtils.ptm.doTransaction(aggregate); PlacesUIUtils.ptm.doTransaction(aggregate);
// Ensure the tagsField is in sync, clean it up from empty tags // Ensure the tagsField is in sync, clean it up from empty tags
var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(", "); var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", ");
this._initTextField("tagsField", tags, false); this._initTextField("tagsField", tags, false);
return true; return true;
} }
@ -666,7 +666,7 @@ var gEditItemOverlay = {
this._allTags = tags; this._allTags = tags;
this._tags = []; this._tags = [];
for (i = 0; i < this._uris.length; i++) for (i = 0; i < this._uris.length; i++)
this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i], {}); this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]);
// Ensure the tagsField is in sync, clean it up from empty tags // Ensure the tagsField is in sync, clean it up from empty tags
this._initTextField("tagsField", tags, false); this._initTextField("tagsField", tags, false);
@ -1112,7 +1112,7 @@ var gEditItemOverlay = {
this._initNamePicker(); // for microsummaries this._initNamePicker(); // for microsummaries
this._initTextField("tagsField", this._initTextField("tagsField",
PlacesUtils.tagging PlacesUtils.tagging
.getTagsForURI(this._uri, { }).join(", "), .getTagsForURI(this._uri).join(", "),
false); false);
this._rebuildTagsSelectorList(); this._rebuildTagsSelectorList();
} }

View File

@ -60,9 +60,9 @@
onload="HistorySidebarInit();" onload="HistorySidebarInit();"
onunload="SidebarUtils.clearURLFromStatusBar();"> onunload="SidebarUtils.clearURLFromStatusBar();">
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/bookmarks/sidebarUtils.js"/> src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/history-panel.js"/> src="chrome://browser/content/places/history-panel.js"/>
<commandset id="editMenuCommands"/> <commandset id="editMenuCommands"/>

View File

@ -57,7 +57,7 @@
screenY="24" screenY="24"
persist="screenX screenY width height"> persist="screenX screenY width height">
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/moveBookmarks.js"/> src="chrome://browser/content/places/moveBookmarks.js"/>
<hbox flex="1"> <hbox flex="1">

View File

@ -216,7 +216,7 @@ var PlacesOrganizer = {
return; return;
var node = this._places.selectedNode; var node = this._places.selectedNode;
var queries = asQuery(node).getQueries({}); var queries = asQuery(node).getQueries();
// Items are only excluded on the left pane. // Items are only excluded on the left pane.
var options = node.queryOptions.clone(); var options = node.queryOptions.clone();
@ -359,7 +359,7 @@ var PlacesOrganizer = {
* main places pane. * main places pane.
*/ */
getCurrentQueries: function PO_getCurrentQueries() { getCurrentQueries: function PO_getCurrentQueries() {
return asQuery(this._content.getResult().root).getQueries({}); return asQuery(this._content.getResult().root).getQueries();
}, },
/** /**

View File

@ -78,7 +78,7 @@
toggletoolbar="true" toggletoolbar="true"
persist="width height screenX screenY sizemode"> persist="width height screenX screenY sizemode">
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/places.js"/> src="chrome://browser/content/places/places.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://browser/content/utilityOverlay.js"/>

View File

@ -47,17 +47,17 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://global/content/globalOverlay.js"/> src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/utils.js"/> src="chrome://browser/content/places/utils.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/controller.js"/> src="chrome://browser/content/places/controller.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://browser/content/places/treeView.js"/> src="chrome://browser/content/places/treeView.js"/>
<script type="application/x-javascript" <script type="application/javascript"
src="chrome://global/content/nsDragAndDrop.js"/> src="chrome://global/content/nsDragAndDrop.js"/>
<!-- Bookmarks and history tooltip --> <!-- Bookmarks and history tooltip -->

View File

@ -335,23 +335,24 @@ PlacesTreeView.prototype = {
}, },
_convertPRTimeToString: function PTV__convertPRTimeToString(aTime) { _convertPRTimeToString: function PTV__convertPRTimeToString(aTime) {
var timeInMilliseconds = aTime / 1000; // PRTime is in microseconds const MS_PER_MINUTE = 60000;
const MS_PER_DAY = 86400000;
let timeMs = aTime / 1000; // PRTime is in microseconds
// Date is calculated starting from midnight, so the modulo with a day are // Date is calculated starting from midnight, so the modulo with a day are
// milliseconds from today's midnight. // milliseconds from today's midnight.
// getTimezoneOffset corrects that based on local time. // getTimezoneOffset corrects that based on local time, notice midnight
// 86400000 = 24 * 60 * 60 * 1000 = 1 day // can have a different offset during DST-change days.
// 60000 = 60 * 1000 = 1 minute let dateObj = new Date();
var dateObj = new Date(); let now = dateObj.getTime() - dateObj.getTimezoneOffset() * MS_PER_MINUTE;
var timeZoneOffsetInMs = dateObj.getTimezoneOffset() * 60000; let midnight = now - (now % MS_PER_DAY);
var now = dateObj.getTime() - timeZoneOffsetInMs; midnight += new Date(midnight).getTimezoneOffset() * MS_PER_MINUTE;
var midnight = now - (now % (86400000));
var dateFormat = timeInMilliseconds - timeZoneOffsetInMs >= midnight ? let dateFormat = timeMs >= midnight ?
Ci.nsIScriptableDateFormat.dateFormatNone : Ci.nsIScriptableDateFormat.dateFormatNone :
Ci.nsIScriptableDateFormat.dateFormatShort; Ci.nsIScriptableDateFormat.dateFormatShort;
var timeObj = new Date(timeInMilliseconds); let timeObj = new Date(timeMs);
return (this._dateService.FormatDateTime("", dateFormat, return (this._dateService.FormatDateTime("", dateFormat,
Ci.nsIScriptableDateFormat.timeFormatNoSeconds, Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
timeObj.getFullYear(), timeObj.getMonth() + 1, timeObj.getFullYear(), timeObj.getMonth() + 1,

View File

@ -231,7 +231,7 @@ var PlacesUIUtils = {
var tags = aData.tags.split(", "); var tags = aData.tags.split(", ");
// filter out tags already present, so that undo doesn't remove them // filter out tags already present, so that undo doesn't remove them
// from pre-existing bookmarks // from pre-existing bookmarks
var storedTags = PlacesUtils.tagging.getTagsForURI(itemURL, {}); var storedTags = PlacesUtils.tagging.getTagsForURI(itemURL);
tags = tags.filter(function (aTag) { tags = tags.filter(function (aTag) {
return (storedTags.indexOf(aTag) == -1); return (storedTags.indexOf(aTag) == -1);
}, this); }, this);
@ -1138,64 +1138,146 @@ var PlacesUIUtils = {
// Get the folder id for the organizer left-pane folder. // Get the folder id for the organizer left-pane folder.
get leftPaneFolderId() { get leftPaneFolderId() {
var leftPaneRoot = -1; let leftPaneRoot = -1;
var allBookmarksId; let allBookmarksId;
// Shortcuts to services. // Shortcuts to services.
var bs = PlacesUtils.bookmarks; let bs = PlacesUtils.bookmarks;
var as = PlacesUtils.annotations; let as = PlacesUtils.annotations;
// Get all items marked as being the left pane folder. We should only have // This is the list of the left pane queries.
// one of them. let queries = {
var items = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); "PlacesRoot": { title: "" },
"History": { title: this.getString("OrganizerQueryHistory") },
"Tags": { title: this.getString("OrganizerQueryTags") },
"AllBookmarks": { title: this.getString("OrganizerQueryAllBookmarks") },
"BookmarksToolbar":
{ title: null,
concreteTitle: PlacesUtils.getString("BookmarksToolbarFolderTitle"),
concreteId: PlacesUtils.toolbarFolderId },
"BookmarksMenu":
{ title: null,
concreteTitle: PlacesUtils.getString("BookmarksMenuFolderTitle"),
concreteId: PlacesUtils.bookmarksMenuFolderId },
"UnfiledBookmarks":
{ title: null,
concreteTitle: PlacesUtils.getString("UnsortedBookmarksFolderTitle"),
concreteId: PlacesUtils.unfiledBookmarksFolderId },
};
// All queries but PlacesRoot.
const EXPECTED_QUERY_COUNT = 6;
// Removes an item and associated annotations, ignoring eventual errors.
function safeRemoveItem(aItemId) {
try {
if (as.itemHasAnnotation(aItemId, ORGANIZER_QUERY_ANNO) &&
!(as.getItemAnnotation(aItemId, ORGANIZER_QUERY_ANNO) in queries)) {
// Some extension annotated their roots with our query annotation,
// so we should not delete them.
return;
}
// removeItemAnnotation does not check if item exists, nor the anno,
// so this is safe to do.
as.removeItemAnnotation(aItemId, ORGANIZER_FOLDER_ANNO);
as.removeItemAnnotation(aItemId, ORGANIZER_QUERY_ANNO);
// This will throw if the annotation is an orphan.
bs.removeItem(aItemId);
}
catch(e) { /* orphan anno */ }
}
// Returns true if item really exists, false otherwise.
function itemExists(aItemId) {
try {
bs.getItemIndex(aItemId);
return true;
}
catch(e) {
return false;
}
}
// Get all items marked as being the left pane folder.
let items = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
if (items.length > 1) { if (items.length > 1) {
// Something went wrong, we cannot have more than one left pane folder, // Something went wrong, we cannot have more than one left pane folder,
// remove all left pane folders and continue. We will create a new one. // remove all left pane folders and continue. We will create a new one.
items.forEach(bs.removeItem); items.forEach(safeRemoveItem);
} }
else if (items.length == 1 && items[0] != -1) { else if (items.length == 1 && items[0] != -1) {
leftPaneRoot = items[0]; leftPaneRoot = items[0];
// Check organizer left pane version.
var version = as.getItemAnnotation(leftPaneRoot, ORGANIZER_FOLDER_ANNO); // Check that organizer left pane root is valid.
if (version != ORGANIZER_LEFTPANE_VERSION) { let version = as.getItemAnnotation(leftPaneRoot, ORGANIZER_FOLDER_ANNO);
// If version is not valid we must rebuild the left pane. if (version != ORGANIZER_LEFTPANE_VERSION || !itemExists(leftPaneRoot)) {
bs.removeItem(leftPaneRoot); // Invalid root, we must rebuild the left pane.
safeRemoveItem(leftPaneRoot);
leftPaneRoot = -1; leftPaneRoot = -1;
} }
} }
var queriesTitles = {
"PlacesRoot": "",
"History": this.getString("OrganizerQueryHistory"),
// TODO: Bug 489681, Tags needs its own string in places.properties
"Tags": bs.getItemTitle(PlacesUtils.tagsFolderId),
"AllBookmarks": this.getString("OrganizerQueryAllBookmarks"),
"Downloads": this.getString("OrganizerQueryDownloads"),
"BookmarksToolbar": null,
"BookmarksMenu": null,
"UnfiledBookmarks": null
};
if (leftPaneRoot != -1) { if (leftPaneRoot != -1) {
// A valid left pane folder has been found. // A valid left pane folder has been found.
// Build the leftPaneQueries Map. This is used to quickly access them // Build the leftPaneQueries Map. This is used to quickly access them,
// associating a mnemonic name to the real item ids. // associating a mnemonic name to the real item ids.
delete this.leftPaneQueries; delete this.leftPaneQueries;
this.leftPaneQueries = {}; this.leftPaneQueries = {};
var items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
// While looping through queries we will also check for titles validity. let items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
for (var i = 0; i < items.length; i++) { // While looping through queries we will also check for their validity.
var queryName = as.getItemAnnotation(items[i], ORGANIZER_QUERY_ANNO); let queriesCount = 0;
this.leftPaneQueries[queryName] = items[i]; for(let i = 0; i < items.length; i++) {
let queryName = as.getItemAnnotation(items[i], ORGANIZER_QUERY_ANNO);
// Some extension did use our annotation to decorate their items
// with icons, so we should check only our elements, to avoid dataloss.
if (!(queryName in queries))
continue;
let query = queries[queryName];
query.itemId = items[i];
if (!itemExists(query.itemId)) {
// Orphan annotation, bail out and create a new left pane root.
break;
}
// Check that all queries have valid parents.
let parentId = bs.getFolderIdForItem(query.itemId);
if (items.indexOf(parentId) == -1 && parentId != leftPaneRoot) {
// The parent is not part of the left pane, bail out and create a new
// left pane root.
break;
}
// Titles could have been corrupted or the user could have changed his // Titles could have been corrupted or the user could have changed his
// locale. Check title is correctly set and eventually fix it. // locale. Check title and eventually fix it.
if (bs.getItemTitle(items[i]) != queriesTitles[queryName]) if (bs.getItemTitle(query.itemId) != query.title)
bs.setItemTitle(items[i], queriesTitles[queryName]); bs.setItemTitle(query.itemId, query.title);
if ("concreteId" in query) {
if (bs.getItemTitle(query.concreteId) != query.concreteTitle)
bs.setItemTitle(query.concreteId, query.concreteTitle);
}
// Add the query to our cache.
this.leftPaneQueries[queryName] = query.itemId;
queriesCount++;
}
if (queriesCount != EXPECTED_QUERY_COUNT) {
// Queries number is wrong, so the left pane must be corrupt.
// Note: we can't just remove the leftPaneRoot, because some query could
// have a bad parent, so we have to remove all items one by one.
items.forEach(safeRemoveItem);
safeRemoveItem(leftPaneRoot);
}
else {
// Everything is fine, return the current left pane folder.
delete this.leftPaneFolderId;
return this.leftPaneFolderId = leftPaneRoot;
} }
delete this.leftPaneFolderId;
return this.leftPaneFolderId = leftPaneRoot;
} }
// Create a new left pane folder.
var self = this; var self = this;
var callback = { var callback = {
// Helper to create an organizer special query. // Helper to create an organizer special query.
@ -1203,7 +1285,7 @@ var PlacesUIUtils = {
let itemId = bs.insertBookmark(aParentId, let itemId = bs.insertBookmark(aParentId,
PlacesUtils._uri(aQueryUrl), PlacesUtils._uri(aQueryUrl),
bs.DEFAULT_INDEX, bs.DEFAULT_INDEX,
queriesTitles[aQueryName]); queries[aQueryName].title);
// Mark as special organizer query. // Mark as special organizer query.
as.setItemAnnotation(itemId, ORGANIZER_QUERY_ANNO, aQueryName, as.setItemAnnotation(itemId, ORGANIZER_QUERY_ANNO, aQueryName,
0, as.EXPIRE_NEVER); 0, as.EXPIRE_NEVER);
@ -1219,7 +1301,7 @@ var PlacesUIUtils = {
create_folder: function CB_create_folder(aFolderName, aParentId, aIsRoot) { create_folder: function CB_create_folder(aFolderName, aParentId, aIsRoot) {
// Left Pane Root Folder. // Left Pane Root Folder.
let folderId = bs.createFolder(aParentId, let folderId = bs.createFolder(aParentId,
queriesTitles[aFolderName], queries[aFolderName].title,
bs.DEFAULT_INDEX); bs.DEFAULT_INDEX);
// We should never backup this, since it changes between profiles. // We should never backup this, since it changes between profiles.
as.setItemAnnotation(folderId, EXCLUDE_FROM_BACKUP_ANNO, 1, as.setItemAnnotation(folderId, EXCLUDE_FROM_BACKUP_ANNO, 1,

View File

@ -691,7 +691,7 @@ placesRemoveItemTransaction.prototype = {
// children, see getMostRecentBookmarkForURI) for the bookmark's url, // children, see getMostRecentBookmarkForURI) for the bookmark's url,
// remove the url from tag containers as well. // remove the url from tag containers as well.
if (PlacesUtils.getMostRecentBookmarkForURI(this._uri) == -1) { if (PlacesUtils.getMostRecentBookmarkForURI(this._uri) == -1) {
this._tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}); this._tags = PlacesUtils.tagging.getTagsForURI(this._uri);
PlacesUtils.tagging.untagURI(this._uri, this._tags); PlacesUtils.tagging.untagURI(this._uri, this._tags);
} }
} }
@ -776,7 +776,7 @@ placesEditBookmarkURITransactions.prototype = {
this._oldURI = PlacesUtils.bookmarks.getBookmarkURI(this._id); this._oldURI = PlacesUtils.bookmarks.getBookmarkURI(this._id);
PlacesUtils.bookmarks.changeBookmarkURI(this._id, this._newURI); PlacesUtils.bookmarks.changeBookmarkURI(this._id, this._newURI);
// move tags from old URI to new URI // move tags from old URI to new URI
this._tags = PlacesUtils.tagging.getTagsForURI(this._oldURI, {}); this._tags = PlacesUtils.tagging.getTagsForURI(this._oldURI);
if (this._tags.length != 0) { if (this._tags.length != 0) {
// only untag the old URI if this is the only bookmark // only untag the old URI if this is the only bookmark
if (PlacesUtils.getBookmarksForURI(this._oldURI, {}).length == 0) if (PlacesUtils.getBookmarksForURI(this._oldURI, {}).length == 0)
@ -1157,7 +1157,7 @@ function placesUntagURITransaction(aURI, aTags) {
} }
} }
else else
this._tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}); this._tags = PlacesUtils.tagging.getTagsForURI(this._uri);
this.redoTransaction = this.doTransaction; this.redoTransaction = this.doTransaction;
} }

View File

@ -60,7 +60,7 @@ var windowObserver = {
"Left pane folder correctly created"); "Left pane folder correctly created");
var leftPaneItems = var leftPaneItems =
PlacesUtils.annotations PlacesUtils.annotations
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); .getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
is(leftPaneItems.length, 1, is(leftPaneItems.length, 1,
"We correctly have only 1 left pane folder"); "We correctly have only 1 left pane folder");
var leftPaneRoot = leftPaneItems[0]; var leftPaneRoot = leftPaneItems[0];
@ -99,7 +99,7 @@ function test() {
// Check if we have any left pane folder already set, remove it eventually. // Check if we have any left pane folder already set, remove it eventually.
var leftPaneItems = PlacesUtils.annotations var leftPaneItems = PlacesUtils.annotations
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); .getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
if (leftPaneItems.length > 0) { if (leftPaneItems.length > 0) {
// The left pane has already been created, touching it now would cause // The left pane has already been created, touching it now would cause
// next tests to rely on wrong values (and possibly crash) // next tests to rely on wrong values (and possibly crash)
@ -125,7 +125,7 @@ function test() {
// Check fake left pane root has been correctly created. // Check fake left pane root has been correctly created.
var leftPaneItems = var leftPaneItems =
PlacesUtils.annotations.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); PlacesUtils.annotations.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder"); is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
is(leftPaneItems[0], fakeLeftPaneRoot, "left pane root itemId is correct"); is(leftPaneItems[0], fakeLeftPaneRoot, "left pane root itemId is correct");

View File

@ -101,7 +101,7 @@ function test() {
var bmId = add_bookmark(PlacesUtils._uri(TEST_URL)); var bmId = add_bookmark(PlacesUtils._uri(TEST_URL));
ok(bmId > 0, "A bookmark was added"); ok(bmId > 0, "A bookmark was added");
ts.tagURI(PlacesUtils._uri(TEST_URL), ["foo"]); ts.tagURI(PlacesUtils._uri(TEST_URL), ["foo"]);
var tags = ts.getTagsForURI(PU._uri(TEST_URL), {}); var tags = ts.getTagsForURI(PU._uri(TEST_URL));
is(tags[0], 'foo', "tag is foo"); is(tags[0], 'foo', "tag is foo");
}, },
@ -168,13 +168,13 @@ function test() {
var histNode = PO._content.view.nodeForTreeIndex(0); var histNode = PO._content.view.nodeForTreeIndex(0);
ok(histNode, "histNode exists: " + histNode.title); ok(histNode, "histNode exists: " + histNode.title);
// check to see if the history node is tagged! // check to see if the history node is tagged!
var tags = PU.tagging.getTagsForURI(PU._uri(MOZURISPEC), {}); var tags = PU.tagging.getTagsForURI(PU._uri(MOZURISPEC));
ok(tags.length == 1, "history node is tagged: " + tags.length); ok(tags.length == 1, "history node is tagged: " + tags.length);
// check if a bookmark was created // check if a bookmark was created
var isBookmarked = PU.bookmarks.isBookmarked(PU._uri(MOZURISPEC)); var isBookmarked = PU.bookmarks.isBookmarked(PU._uri(MOZURISPEC));
is(isBookmarked, true, MOZURISPEC + " is bookmarked"); is(isBookmarked, true, MOZURISPEC + " is bookmarked");
var bookmarkIds = PU.bookmarks.getBookmarkIdsForURI( var bookmarkIds = PU.bookmarks.getBookmarkIdsForURI(
PU._uri(histNode.uri), {}); PU._uri(histNode.uri));
ok(bookmarkIds.length > 0, "bookmark exists for the tagged history item: " + bookmarkIds); ok(bookmarkIds.length > 0, "bookmark exists for the tagged history item: " + bookmarkIds);
}, },
@ -194,7 +194,7 @@ function test() {
ts.untagURI(PU._uri(MOZURISPEC), ["foo"]); ts.untagURI(PU._uri(MOZURISPEC), ["foo"]);
ts.untagURI(PU._uri(TEST_URL), ["foo"]); ts.untagURI(PU._uri(TEST_URL), ["foo"]);
hs.removeAllPages(); hs.removeAllPages();
var tags = ts.getTagsForURI(PU._uri(TEST_URL), {}); var tags = ts.getTagsForURI(PU._uri(TEST_URL));
is(tags.length, 0, "tags are gone"); is(tags.length, 0, "tags are gone");
bs.removeFolderChildren(bs.unfiledBookmarksFolder); bs.removeFolderChildren(bs.unfiledBookmarksFolder);
} }

View File

@ -208,7 +208,7 @@ gTests.push({
// Add a tag to this bookmark. // Add a tag to this bookmark.
PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL), PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
["testTag"]); ["testTag"]);
var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL), {}); var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
is(tags[0], "testTag", "Correctly added a tag"); is(tags[0], "testTag", "Correctly added a tag");
}, },
@ -282,7 +282,7 @@ gTests.push({
cleanup: function() { cleanup: function() {
// Check tags have not changed. // Check tags have not changed.
var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL), {}); var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
is(tags[0], "testTag", "Tag on node has not changed"); is(tags[0], "testTag", "Tag on node has not changed");
// Cleanup. // Cleanup.
@ -366,7 +366,7 @@ gTests.push({
// Add a tag to this bookmark. // Add a tag to this bookmark.
PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL), PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
["testTag"]); ["testTag"]);
var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL), {}); var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
is(tags[0], "testTag", "Correctly added a tag"); is(tags[0], "testTag", "Correctly added a tag");
}, },
@ -440,7 +440,7 @@ gTests.push({
cleanup: function() { cleanup: function() {
// Check tags have not changed. // Check tags have not changed.
var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL), {}); var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
is(tags[0], "testTag", "Tag on node has not changed"); is(tags[0], "testTag", "Tag on node has not changed");
// Cleanup. // Cleanup.

View File

@ -62,6 +62,10 @@ var windowObserver = {
var query = leftPaneQueries[i]; var query = leftPaneQueries[i];
is(PlacesUtils.bookmarks.getItemTitle(query.itemId), is(PlacesUtils.bookmarks.getItemTitle(query.itemId),
query.correctTitle, "Title is correct for query " + query.name); query.correctTitle, "Title is correct for query " + query.name);
if ("concreteId" in query) {
is(PlacesUtils.bookmarks.getItemTitle(query.concreteId),
query.concreteTitle, "Concrete title is correct for query " + query.name);
}
} }
// Close Library window. // Close Library window.
@ -87,7 +91,7 @@ function test() {
// Get the left pane folder. // Get the left pane folder.
var leftPaneItems = PlacesUtils.annotations var leftPaneItems = PlacesUtils.annotations
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); .getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder"); is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
// Check version. // Check version.
@ -98,19 +102,35 @@ function test() {
// Get all left pane queries. // Get all left pane queries.
var items = PlacesUtils.annotations var items = PlacesUtils.annotations
.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {}); .getItemsWithAnnotation(ORGANIZER_QUERY_ANNO);
// Get current queries names. // Get current queries names.
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
var itemId = items[i]; var itemId = items[i];
var queryName = PlacesUtils.annotations var queryName = PlacesUtils.annotations
.getItemAnnotation(items[i], .getItemAnnotation(items[i],
ORGANIZER_QUERY_ANNO); ORGANIZER_QUERY_ANNO);
leftPaneQueries.push({ name: queryName, var query = { name: queryName,
itemId: itemId, itemId: itemId,
correctTitle: PlacesUtils.bookmarks correctTitle: PlacesUtils.bookmarks.getItemTitle(itemId) }
.getItemTitle(itemId) }); switch (queryName) {
case "BookmarksToolbar":
query.concreteId = PlacesUtils.toolbarFolderId;
query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
break;
case "BookmarksMenu":
query.concreteId = PlacesUtils.bookmarksMenuFolderId;
query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
break;
case "UnfiledBookmarks":
query.concreteId = PlacesUtils.unfiledBookmarksFolderId;
query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
break;
}
leftPaneQueries.push(query);
// Rename to a bad title. // Rename to a bad title.
PlacesUtils.bookmarks.setItemTitle(itemId, "badName"); PlacesUtils.bookmarks.setItemTitle(query.itemId, "badName");
if ("concreteId" in query)
PlacesUtils.bookmarks.setItemTitle(query.concreteId, "badName");
} }
// Open Library, this will kick-off left pane code. // Open Library, this will kick-off left pane code.

View File

@ -205,7 +205,7 @@ function search(aFolderId, aSearchStr, aExpectedScopeButtonId) {
// contentTree.place should be equal to contentTree.getResult().root.uri, // contentTree.place should be equal to contentTree.getResult().root.uri,
// but it's not until bug 476952 is fixed. // but it's not until bug 476952 is fixed.
var query = queryStringToQuery(contentTree.getResult().root.uri); var query = queryStringToQuery(contentTree.getResult().root.uri);
is(query.getFolders({}, {})[0], aFolderId, is(query.getFolders()[0], aFolderId,
"Content tree's folder should be what was selected in the left pane"); "Content tree's folder should be what was selected in the left pane");
} }
} }

View File

@ -104,14 +104,14 @@
gEditItemOverlay.onTagsFieldBlur(); gEditItemOverlay.onTagsFieldBlur();
// test that the tag has been added in the backend // test that the tag has been added in the backend
is(ts.getTagsForURI(testURI, {})[0], testTag, "tags match"); is(ts.getTagsForURI(testURI)[0], testTag, "tags match");
// change the tag // change the tag
document.getElementById("editBMPanel_tagsField").value = testTagUpper; document.getElementById("editBMPanel_tagsField").value = testTagUpper;
gEditItemOverlay.onTagsFieldBlur(); gEditItemOverlay.onTagsFieldBlur();
// test that the tag has been added in the backend // test that the tag has been added in the backend
is(ts.getTagsForURI(testURI, {})[0], testTagUpper, "tags match"); is(ts.getTagsForURI(testURI)[0], testTagUpper, "tags match");
// Cleanup. // Cleanup.
ts.untagURI(testURI, [testTag]); ts.untagURI(testURI, [testTag]);

View File

@ -81,7 +81,7 @@
// We need 2 left pane folders to simulate a corrupt profile. // We need 2 left pane folders to simulate a corrupt profile.
do { do {
let leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); let leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
// Create a fake left pane folder. // Create a fake left pane folder.
let fakeLeftPaneRoot = bs.createFolder(PlacesUtils.placesRootId, "", let fakeLeftPaneRoot = bs.createFolder(PlacesUtils.placesRootId, "",
bs.DEFAULT_INDEX); bs.DEFAULT_INDEX);
@ -97,7 +97,7 @@
// Check left pane. // Check left pane.
ok(PlacesUIUtils.leftPaneFolderId > 0, ok(PlacesUIUtils.leftPaneFolderId > 0,
"Left pane folder correctly created"); "Left pane folder correctly created");
var leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {}); var leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
is(leftPaneItems.length, 1, is(leftPaneItems.length, 1,
"We correctly have only 1 left pane folder"); "We correctly have only 1 left pane folder");

View File

@ -307,7 +307,7 @@ function testTags() {
for each(let {uri: u, tags: t} in tagData) { for each(let {uri: u, tags: t} in tagData) {
var i = 0; var i = 0;
dump("test tags for " + u.spec + ": " + t + "\n"); dump("test tags for " + u.spec + ": " + t + "\n");
var tt = PlacesUtils.tagging.getTagsForURI(u, {}); var tt = PlacesUtils.tagging.getTagsForURI(u);
dump("true tags for " + u.spec + ": " + tt + "\n"); dump("true tags for " + u.spec + ": " + tt + "\n");
do_check_true(t.every(function(el) { do_check_true(t.every(function(el) {
i++; i++;

View File

@ -170,7 +170,7 @@ function run_test() {
do_check_eq(bm1lm, bm2lm); do_check_eq(bm1lm, bm2lm);
var ids = bmsvc.getBookmarkIdsForURI(testURI, {}); var ids = bmsvc.getBookmarkIdsForURI(testURI);
do_check_eq(ids[0], bm2); do_check_eq(ids[0], bm2);
do_check_eq(ids[1], bm1); do_check_eq(ids[1], bm1);

View File

@ -76,7 +76,7 @@ function run_test() {
// TEST 1: smart bookmarks disabled // TEST 1: smart bookmarks disabled
pref.setIntPref("browser.places.smartBookmarksVersion", -1); pref.setIntPref("browser.places.smartBookmarksVersion", -1);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {}); var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, 0); do_check_eq(smartBookmarkItemIds.length, 0);
// check that pref has not been bumped up // check that pref has not been bumped up
do_check_eq(pref.getIntPref("browser.places.smartBookmarksVersion"), -1); do_check_eq(pref.getIntPref("browser.places.smartBookmarksVersion"), -1);
@ -84,7 +84,7 @@ function run_test() {
// TEST 2: create smart bookmarks // TEST 2: create smart bookmarks
pref.setIntPref("browser.places.smartBookmarksVersion", 0); pref.setIntPref("browser.places.smartBookmarksVersion", 0);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {}); smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_neq(smartBookmarkItemIds.length, 0); do_check_neq(smartBookmarkItemIds.length, 0);
// check that pref has been bumped up // check that pref has been bumped up
do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0); do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
@ -96,7 +96,7 @@ function run_test() {
bmsvc.removeItem(smartBookmarkItemIds[0]); bmsvc.removeItem(smartBookmarkItemIds[0]);
pref.setIntPref("browser.places.smartBookmarksVersion", 0); pref.setIntPref("browser.places.smartBookmarksVersion", 0);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {}); smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount); do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
// check that pref has been bumped up // check that pref has been bumped up
do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0); do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
@ -113,7 +113,7 @@ function run_test() {
// restore // restore
pref.setIntPref("browser.places.smartBookmarksVersion", 0); pref.setIntPref("browser.places.smartBookmarksVersion", 0);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {}); smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount); do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
do_check_eq(bmsvc.getFolderIdForItem(smartBookmarkItemIds[0]), newParent); do_check_eq(bmsvc.getFolderIdForItem(smartBookmarkItemIds[0]), newParent);
do_check_eq(bmsvc.getItemTitle(smartBookmarkItemIds[0]), oldTitle); do_check_eq(bmsvc.getItemTitle(smartBookmarkItemIds[0]), oldTitle);

View File

@ -47,7 +47,6 @@ const PREF_BMPROCESSED = "distribution.516444.bookmarksProcessed";
const PREF_DISTRIBUTION_ID = "distribution.id"; const PREF_DISTRIBUTION_ID = "distribution.id";
const TOPIC_FINAL_UI_STARTUP = "final-ui-startup"; const TOPIC_FINAL_UI_STARTUP = "final-ui-startup";
const TOPIC_PLACES_INIT_COMPLETE = "places-init-complete";
const TOPIC_CUSTOMIZATION_COMPLETE = "distribution-customization-complete"; const TOPIC_CUSTOMIZATION_COMPLETE = "distribution-customization-complete";
let os = Cc["@mozilla.org/observer-service;1"]. let os = Cc["@mozilla.org/observer-service;1"].
@ -95,10 +94,9 @@ function run_test() {
// Initialize nsBrowserGlue. // Initialize nsBrowserGlue.
Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue); Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
// Places initialization has already happened, so we need to simulate a new
// one. This will force browserGlue::_initPlaces().
os.notifyObservers(null, TOPIC_FINAL_UI_STARTUP, null); os.notifyObservers(null, TOPIC_FINAL_UI_STARTUP, null);
os.notifyObservers(null, TOPIC_PLACES_INIT_COMPLETE, null); // places-init-complete is an enqueued notification so it will be notified
// when exiting from this scope.
do_test_pending(); do_test_pending();
// Test will continue on customization complete notification. // Test will continue on customization complete notification.

View File

@ -0,0 +1,224 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** 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 Places Unit Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net>
*
* 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 ***** */
/**
* Tests that we build a working leftpane in various corruption situations.
*/
// Used to store the original leftPaneFolderId getter.
let gLeftPaneFolderIdGetter;
let gAllBookmarksFolderIdGetter;
// Used to store the original left Pane status as a JSON string.
let gReferenceJSON;
let gLeftPaneFolderId;
// Third party annotated folder.
let gFolderId;
// Corruption cases.
let gTests = [
function test1() {
print("1. Do nothing, checks test calibration.");
},
function test2() {
print("2. Delete the left pane folder.");
PlacesUtils.bookmarks.removeItem(gLeftPaneFolderId);
},
function test3() {
print("3. Delete a child of the left pane folder.");
let id = PlacesUtils.bookmarks.getIdForItemAt(gLeftPaneFolderId, 0);
PlacesUtils.bookmarks.removeItem(id);
},
function test4() {
print("4. Delete AllBookmarks.");
PlacesUtils.bookmarks.removeItem(PlacesUIUtils.allBookmarksFolderId);
},
function test5() {
print("5. Create a duplicated left pane folder.");
let id = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
"PlacesRoot",
PlacesUtils.bookmarks.DEFAULT_INDEX);
PlacesUtils.annotations.setItemAnnotation(id, ORGANIZER_FOLDER_ANNO,
"PlacesRoot", 0,
PlacesUtils.annotations.EXPIRE_NEVER);
},
function test6() {
print("6. Create a duplicated left pane query.");
let id = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
"AllBookmarks",
PlacesUtils.bookmarks.DEFAULT_INDEX);
PlacesUtils.annotations.setItemAnnotation(id, ORGANIZER_QUERY_ANNO,
"AllBookmarks", 0,
PlacesUtils.annotations.EXPIRE_NEVER);
},
function test7() {
print("7. Remove the left pane folder annotation.");
PlacesUtils.annotations.removeItemAnnotation(gLeftPaneFolderId,
ORGANIZER_FOLDER_ANNO);
},
function test8() {
print("8. Remove a left pane query annotation.");
PlacesUtils.annotations.removeItemAnnotation(PlacesUIUtils.allBookmarksFolderId,
ORGANIZER_QUERY_ANNO);
},
function test9() {
print("9. Remove a child of AllBookmarks.");
let id = PlacesUtils.bookmarks.getIdForItemAt(PlacesUIUtils.allBookmarksFolderId, 0);
PlacesUtils.bookmarks.removeItem(id);
},
];
function run_test() {
// We want empty roots.
remove_all_bookmarks();
// Import PlacesUIUtils.
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://browser/content/places/utils.js", this);
do_check_true(!!PlacesUIUtils);
// Check getters.
gLeftPaneFolderIdGetter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
do_check_eq(typeof(gLeftPaneFolderIdGetter), "function");
gAllBookmarksFolderIdGetter = PlacesUIUtils.__lookupGetter__("allBookmarksFolderId");
do_check_eq(typeof(gAllBookmarksFolderIdGetter), "function");
// Add a third party bogus annotated item. Should not be removed.
gFolderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
"test",
PlacesUtils.bookmarks.DEFAULT_INDEX);
PlacesUtils.annotations.setItemAnnotation(gFolderId, ORGANIZER_QUERY_ANNO,
"test", 0,
PlacesUtils.annotations.EXPIRE_NEVER);
// Create the left pane, and store its current status, it will be used
// as reference value.
gLeftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
gReferenceJSON = folderToJSON(gLeftPaneFolderId);
// Kick-off tests.
do_test_pending();
do_timeout(0, "run_next_test();");
}
function run_next_test() {
if (gTests.length) {
// Create corruption.
let test = gTests.shift();
test();
// Regenerate getters.
PlacesUIUtils.__defineGetter__("leftPaneFolderId", gLeftPaneFolderIdGetter);
gLeftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
PlacesUIUtils.__defineGetter__("allBookmarksFolderId", gAllBookmarksFolderIdGetter);
// Check the new left pane folder.
let leftPaneJSON = folderToJSON(gLeftPaneFolderId);
do_check_true(compareJSON(gReferenceJSON, leftPaneJSON));
do_check_eq(PlacesUtils.bookmarks.getItemTitle(gFolderId), "test");
// Go to next test.
do_timeout(0, "run_next_test();");
}
else {
// All tests finished.
remove_all_bookmarks();
do_test_finished();
}
}
/**
* Convert a folder item id to a JSON representation of it and its contents.
*/
function folderToJSON(aItemId) {
let query = PlacesUtils.history.getNewQuery();
query.setFolders([aItemId], 1);
let options = PlacesUtils.history.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
let root = PlacesUtils.history.executeQuery(query, options).root;
let writer = {
value: "",
write: function PU_wrapNode__write(aStr, aLen) {
this.value += aStr;
}
};
PlacesUtils.serializeNodeAsJSONToOutputStream(root, writer, false, false);
do_check_true(writer.value.length > 0);
return writer.value;
}
/**
* Compare the JSON representation of 2 nodes, skipping everchanging properties
* like dates.
*/
function compareJSON(aNodeJSON_1, aNodeJSON_2) {
let JSON = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
node1 = JSON.decode(aNodeJSON_1);
node2 = JSON.decode(aNodeJSON_2);
// List of properties we should not compare (expected to be different).
const SKIP_PROPS = ["dateAdded", "lastModified", "id"];
function compareObjects(obj1, obj2) {
do_check_eq(obj1.__count__, obj2.__count__);
for (let prop in obj1) {
// Skip everchanging values.
if (SKIP_PROPS.indexOf(prop) != -1)
continue;
// Skip undefined objects, otherwise we hang on them.
if (!obj1[prop])
continue;
if (typeof(obj1[prop]) == "object")
return compareObjects(obj1[prop], obj2[prop]);
if (obj1[prop] !== obj2[prop]) {
print(prop + ": " + obj1[prop] + "!=" + obj2[prop]);
return false;
}
}
return true;
}
return compareObjects(node1, node2);
}

View File

@ -184,7 +184,7 @@ function run_test() {
// Create to Root // Create to Root
var txn2 = ptSvc.createItem(uri("http://www.example.com"), root, bmStartIndex, "Testing1"); var txn2 = ptSvc.createItem(uri("http://www.example.com"), root, bmStartIndex, "Testing1");
ptSvc.doTransaction(txn2); // Also testing doTransaction ptSvc.doTransaction(txn2); // Also testing doTransaction
var b = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0]; var b = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com")))[0];
do_check_eq(observer._itemAddedId, b); do_check_eq(observer._itemAddedId, b);
do_check_eq(observer._itemAddedIndex, bmStartIndex); do_check_eq(observer._itemAddedIndex, bmStartIndex);
do_check_true(bmsvc.isBookmarked(uri("http://www.example.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.example.com")));
@ -194,7 +194,7 @@ function run_test() {
do_check_false(bmsvc.isBookmarked(uri("http://www.example.com"))); do_check_false(bmsvc.isBookmarked(uri("http://www.example.com")));
txn2.redoTransaction(); txn2.redoTransaction();
do_check_true(bmsvc.isBookmarked(uri("http://www.example.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.example.com")));
var newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0]; var newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com")))[0];
do_check_eq(observer._itemAddedIndex, bmStartIndex); do_check_eq(observer._itemAddedIndex, bmStartIndex);
do_check_eq(observer._itemAddedParent, root); do_check_eq(observer._itemAddedParent, root);
do_check_eq(observer._itemAddedId, newId); do_check_eq(observer._itemAddedId, newId);
@ -211,7 +211,7 @@ function run_test() {
var txn2b = ptSvc.createItem(uri("http://www.example2.com"), fldrId, bmStartIndex, "Testing1b"); var txn2b = ptSvc.createItem(uri("http://www.example2.com"), fldrId, bmStartIndex, "Testing1b");
ptSvc.doTransaction(txn2b); ptSvc.doTransaction(txn2b);
var b2 = (bmsvc.getBookmarkIdsForURI(uri("http://www.example2.com"), {}))[0]; var b2 = (bmsvc.getBookmarkIdsForURI(uri("http://www.example2.com")))[0];
do_check_eq(observer._itemAddedId, b2); do_check_eq(observer._itemAddedId, b2);
do_check_eq(observer._itemAddedIndex, bmStartIndex); do_check_eq(observer._itemAddedIndex, bmStartIndex);
do_check_true(bmsvc.isBookmarked(uri("http://www.example2.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.example2.com")));
@ -219,7 +219,7 @@ function run_test() {
do_check_eq(observer._itemRemovedId, b2); do_check_eq(observer._itemRemovedId, b2);
do_check_eq(observer._itemRemovedIndex, bmStartIndex); do_check_eq(observer._itemRemovedIndex, bmStartIndex);
txn2b.redoTransaction(); txn2b.redoTransaction();
newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example2.com"), {}))[0]; newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example2.com")))[0];
do_check_eq(observer._itemAddedIndex, bmStartIndex); do_check_eq(observer._itemAddedIndex, bmStartIndex);
do_check_eq(observer._itemAddedParent, fldrId); do_check_eq(observer._itemAddedParent, fldrId);
do_check_eq(observer._itemAddedId, newId); do_check_eq(observer._itemAddedId, newId);
@ -232,7 +232,7 @@ function run_test() {
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), root, -1, "Testing2")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), root, -1, "Testing2"));
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), root, -1, "Testing3")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), root, -1, "Testing3"));
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), fldrId, -1, "Testing4")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.example3.com"), fldrId, -1, "Testing4"));
var bkmkIds = bmsvc.getBookmarkIdsForURI(uri("http://www.example3.com"), {}); var bkmkIds = bmsvc.getBookmarkIdsForURI(uri("http://www.example3.com"));
bkmkIds.sort(); bkmkIds.sort();
var bkmk1Id = bkmkIds[0]; var bkmk1Id = bkmkIds[0];
var bkmk2Id = bkmkIds[1]; var bkmk2Id = bkmkIds[1];
@ -563,7 +563,7 @@ function run_test() {
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "c")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "c"));
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "b")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "b"));
ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "a")); ptSvc.doTransaction(ptSvc.createItem(uri("http://www.sortingtest.com"), srtFldId, -1, "a"));
var b = bmsvc.getBookmarkIdsForURI(uri("http://www.sortingtest.com"), {}); var b = bmsvc.getBookmarkIdsForURI(uri("http://www.sortingtest.com"));
b.sort(); b.sort();
var b1 = b[0]; var b1 = b[0];
var b2 = b[1]; var b2 = b[1];
@ -595,7 +595,7 @@ function run_test() {
ptSvc.doTransaction( ptSvc.doTransaction(
ptSvc.createItem(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"), ptSvc.createItem(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),
root, -1, "micro test", null, null, null)); root, -1, "micro test", null, null, null));
var bId = (bmsvc.getBookmarkIdsForURI(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),{}))[0]; var bId = (bmsvc.getBookmarkIdsForURI(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php")))[0];
do_check_true(!mss.hasMicrosummary(bId)); do_check_true(!mss.hasMicrosummary(bId));
var txn18 = ptSvc.editBookmarkMicrosummary(bId, tmpMs); var txn18 = ptSvc.editBookmarkMicrosummary(bId, tmpMs);
txn18.doTransaction(); txn18.doTransaction();
@ -611,7 +611,7 @@ function run_test() {
var postDataURI = uri("http://foo.com"); var postDataURI = uri("http://foo.com");
ptSvc.doTransaction( ptSvc.doTransaction(
ptSvc.createItem(postDataURI, root, -1, "postdata test", null, null, null)); ptSvc.createItem(postDataURI, root, -1, "postdata test", null, null, null));
var postDataId = (bmsvc.getBookmarkIdsForURI(postDataURI,{}))[0]; var postDataId = (bmsvc.getBookmarkIdsForURI(postDataURI))[0];
var postDataTxn = ptSvc.editBookmarkPostData(postDataId, postData); var postDataTxn = ptSvc.editBookmarkPostData(postDataId, postData);
postDataTxn.doTransaction(); postDataTxn.doTransaction();
do_check_true(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO)) do_check_true(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
@ -641,18 +641,18 @@ function run_test() {
var tagURI = uri("http://foo.tld"); var tagURI = uri("http://foo.tld");
var tagTxn = ptSvc.tagURI(tagURI, ["foo", "bar"]); var tagTxn = ptSvc.tagURI(tagURI, ["foo", "bar"]);
tagTxn.doTransaction(); tagTxn.doTransaction();
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["bar","foo"])); do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["bar","foo"]));
tagTxn.undoTransaction(); tagTxn.undoTransaction();
do_check_true(tagssvc.getTagsForURI(tagURI, { }).length == 0); do_check_eq(tagssvc.getTagsForURI(tagURI).length, 0);
tagTxn.redoTransaction(); tagTxn.redoTransaction();
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["bar","foo"])); do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["bar","foo"]));
var untagTxn = ptSvc.untagURI(tagURI, ["bar"]); var untagTxn = ptSvc.untagURI(tagURI, ["bar"]);
untagTxn.doTransaction(); untagTxn.doTransaction();
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["foo"])); do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["foo"]));
untagTxn.undoTransaction(); untagTxn.undoTransaction();
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["bar","foo"])); do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["bar","foo"]));
untagTxn.redoTransaction(); untagTxn.redoTransaction();
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["foo"])); do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["foo"]));
// Test aggregate removeItem transaction // Test aggregate removeItem transaction
var bkmk1Id = bmsvc.insertBookmark(root, uri("http://www.mozilla.org/"), 0, "Mozilla"); var bkmk1Id = bmsvc.insertBookmark(root, uri("http://www.mozilla.org/"), 0, "Mozilla");
@ -751,7 +751,7 @@ function run_test() {
childTxns); childTxns);
try { try {
ptSvc.doTransaction(itemWChildTxn); // Also testing doTransaction ptSvc.doTransaction(itemWChildTxn); // Also testing doTransaction
var itemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0]; var itemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com")))[0];
do_check_eq(observer._itemAddedId, itemId); do_check_eq(observer._itemAddedId, itemId);
do_check_eq(newDateAdded, bmsvc.getItemDateAdded(itemId)); do_check_eq(newDateAdded, bmsvc.getItemDateAdded(itemId));
do_check_eq(observer._itemChangedProperty, "testAnno/testInt"); do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
@ -763,7 +763,7 @@ function run_test() {
do_check_eq(observer._itemRemovedId, itemId); do_check_eq(observer._itemRemovedId, itemId);
itemWChildTxn.redoTransaction(); itemWChildTxn.redoTransaction();
do_check_true(bmsvc.isBookmarked(uri("http://www.example.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.example.com")));
var newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0]; var newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com")))[0];
do_check_eq(newDateAdded, bmsvc.getItemDateAdded(newId)); do_check_eq(newDateAdded, bmsvc.getItemDateAdded(newId));
do_check_eq(observer._itemAddedId, newId); do_check_eq(observer._itemAddedId, newId);
do_check_eq(observer._itemChangedProperty, "testAnno/testInt"); do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
@ -782,14 +782,14 @@ function run_test() {
var folderWChildItemTxn = ptSvc.createFolder("Folder", root, bmStartIndex, null, [childItemTxn]); var folderWChildItemTxn = ptSvc.createFolder("Folder", root, bmStartIndex, null, [childItemTxn]);
try { try {
ptSvc.doTransaction(folderWChildItemTxn); ptSvc.doTransaction(folderWChildItemTxn);
var childItemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.childItem.com"), {}))[0]; var childItemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.childItem.com")))[0];
do_check_eq(observer._itemAddedId, childItemId); do_check_eq(observer._itemAddedId, childItemId);
do_check_eq(observer._itemAddedIndex, 0); do_check_eq(observer._itemAddedIndex, 0);
do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com")));
folderWChildItemTxn.undoTransaction(); folderWChildItemTxn.undoTransaction();
do_check_false(bmsvc.isBookmarked(uri("http://www.childItem.com"))); do_check_false(bmsvc.isBookmarked(uri("http://www.childItem.com")));
folderWChildItemTxn.redoTransaction(); folderWChildItemTxn.redoTransaction();
var newchildItemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.childItem.com"), {}))[0]; var newchildItemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.childItem.com")))[0];
do_check_eq(observer._itemAddedIndex, 0); do_check_eq(observer._itemAddedIndex, 0);
do_check_eq(observer._itemAddedId, newchildItemId); do_check_eq(observer._itemAddedId, newchildItemId);
do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com"))); do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com")));

View File

@ -63,7 +63,7 @@
name="dom.disable_window_status_change" type="bool"/> name="dom.disable_window_status_change" type="bool"/>
</preferences> </preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/advanced-scripts.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/advanced-scripts.js"/>
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/> <stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>

View File

@ -219,9 +219,9 @@ var gAdvancedPane = {
{ {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]. var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService); getService(Components.interfaces.nsIApplicationCacheService);
if (!groups) { if (!groups)
groups = cacheService.getGroups({}); groups = cacheService.getGroups();
}
var ios = Components.classes["@mozilla.org/network/io-service;1"]. var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService); getService(Components.interfaces.nsIIOService);
@ -256,7 +256,7 @@ var gAdvancedPane = {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]. var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService); getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups({}); var groups = cacheService.getGroups();
var bundle = document.getElementById("bundlePreferences"); var bundle = document.getElementById("bundlePreferences");
@ -316,7 +316,7 @@ var gAdvancedPane = {
getService(Components.interfaces.nsIApplicationCacheService); getService(Components.interfaces.nsIApplicationCacheService);
var ios = Components.classes["@mozilla.org/network/io-service;1"]. var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService); getService(Components.interfaces.nsIIOService);
var groups = cacheService.getGroups({}); var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) { for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null); var uri = ios.newURI(groups[i], null, null);
if (uri.asciiHost == host) { if (uri.asciiHost == host) {

View File

@ -127,7 +127,7 @@
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/> <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif #endif
<script type="application/x-javascript" src="chrome://browser/content/preferences/advanced.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/advanced.js"/>
<tabbox id="advancedPrefs" flex="1" <tabbox id="advancedPrefs" flex="1"
onselect="gAdvancedPane.tabSelectionChanged();"> onselect="gAdvancedPane.tabSelectionChanged();">

View File

@ -103,7 +103,7 @@
type="bool"/> type="bool"/>
</preferences> </preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/applications.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/applications.js"/>
<keyset> <keyset>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/> <key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>

View File

@ -93,7 +93,7 @@
<preference id="network.proxy.backup.gopher_port" name="network.proxy.backup.gopher_port" type="int"/> <preference id="network.proxy.backup.gopher_port" name="network.proxy.backup.gopher_port" type="int"/>
</preferences> </preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/connection.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/connection.js"/>
<stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/> <stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>

View File

@ -75,8 +75,8 @@
onchange="gContentPane._rebuildFonts();"/> onchange="gContentPane._rebuildFonts();"/>
</preferences> </preferences>
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/> <script type="application/javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<script type="application/x-javascript" src="chrome://browser/content/preferences/content.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/content.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/> <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>

View File

@ -77,8 +77,8 @@
</preferences> </preferences>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/> <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<script type="application/x-javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/> <script type="application/javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<script type="application/x-javascript" src="chrome://browser/content/preferences/fonts.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/fonts.js"/>
<!-- Fonts for: [ Language ] --> <!-- Fonts for: [ Language ] -->
<groupbox> <groupbox>

View File

@ -72,7 +72,7 @@
type="bool"/> type="bool"/>
</preferences> </preferences>
<script type="application/x-javascript" src="chrome://browser/content/preferences/languages.js"/> <script type="application/javascript" src="chrome://browser/content/preferences/languages.js"/>
<stringbundleset id="languageSet"> <stringbundleset id="languageSet">
<stringbundle id="bundleRegions" src="chrome://global/locale/regionNames.properties"/> <stringbundle id="bundleRegions" src="chrome://global/locale/regionNames.properties"/>

Some files were not shown because too many files have changed in this diff Show More