mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Merge mozilla-central to tracemonkey.
This commit is contained in:
commit
e57049cd34
@ -197,12 +197,12 @@ ifdef MOZ_CRASHREPORTER
|
||||
$(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
|
||||
echo packing symbols
|
||||
cd $(DIST)/crashreporter-symbols && \
|
||||
zip -r9D ../"$(SYMBOL_ARCHIVE_BASENAME).zip" .
|
||||
zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
|
||||
endif # MOZ_CRASHREPORTER
|
||||
|
||||
uploadsymbols:
|
||||
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
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
|
@ -46,7 +46,7 @@ interface nsObjectFrame;
|
||||
interface nsIContent;
|
||||
interface nsITimer;
|
||||
|
||||
[uuid(6a58f7e8-587c-40dd-b684-dc3e54f1342a)]
|
||||
[uuid(29384ba1-f9ce-425d-afb5-54e2ee949d87)]
|
||||
interface nsIAccessibilityService : nsIAccessibleRetrieval
|
||||
{
|
||||
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
|
||||
@ -114,6 +114,12 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -127,8 +127,7 @@ nsAccessibilityService::nsAccessibilityService()
|
||||
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
|
||||
if (progress) {
|
||||
progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this),
|
||||
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
|
||||
nsIWebProgress::NOTIFY_LOCATION);
|
||||
nsIWebProgress::NOTIFY_STATE_DOCUMENT);
|
||||
}
|
||||
|
||||
// Initialize accessibility.
|
||||
@ -265,6 +264,35 @@ NS_IMETHODIMP nsAccessibilityService::ProcessDocLoadEvent(nsITimer *aTimer, void
|
||||
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
|
||||
nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
|
||||
nsIAccessible *aTarget)
|
||||
@ -309,28 +337,7 @@ NS_IMETHODIMP nsAccessibilityService::OnProgressChange(nsIWebProgress *aWebProgr
|
||||
NS_IMETHODIMP nsAccessibilityService::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
// If the document is already loaded, this will just check to see
|
||||
// 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();
|
||||
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3117,7 +3117,7 @@ nsAccessible::GetNameInternal(nsAString& aName)
|
||||
// nsAccessible private methods
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode, PRBool aRequireLeaf)
|
||||
nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode)
|
||||
{
|
||||
nsIAccessibilityService *accService = GetAccService();
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
@ -3126,11 +3126,9 @@ nsAccessible::GetFirstAvailableAccessible(nsIDOMNode *aStartNode, PRBool aRequir
|
||||
|
||||
while (currentNode) {
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, getter_AddRefs(accessible)); // AddRef'd
|
||||
if (accessible && (!aRequireLeaf || nsAccUtils::IsLeaf(accessible))) {
|
||||
nsIAccessible *retAccessible = accessible;
|
||||
NS_ADDREF(retAccessible);
|
||||
return retAccessible;
|
||||
}
|
||||
if (accessible)
|
||||
return accessible.forget();
|
||||
|
||||
if (!walker) {
|
||||
// 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
|
||||
|
@ -326,13 +326,15 @@ protected:
|
||||
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
|
||||
* accessible for the next DOM node which has one (based on forward depth first search)
|
||||
* @param aStartNode, the DOM node to start from
|
||||
* @param aRequireLeaf, only accept leaf accessible nodes
|
||||
* @return the resulting accessible
|
||||
* Return an accessible for the given DOM node, or if that node isn't
|
||||
* accessible, return the accessible for the next DOM node which has one
|
||||
* (based on forward depth first search).
|
||||
*
|
||||
* @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
|
||||
virtual nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset);
|
||||
|
@ -307,17 +307,17 @@ nsAccEvent::GetAccessibleByNode()
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire)
|
||||
nsAccEvent::ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire)
|
||||
{
|
||||
PRUint32 numQueuedEvents = aEventsToFire.Length();
|
||||
PRInt32 tail = numQueuedEvents - 1;
|
||||
|
||||
nsRefPtr<nsAccEvent> tailEvent = GetAccEventPtr(aEventsToFire[tail]);
|
||||
nsAccEvent* tailEvent = aEventsToFire[tail];
|
||||
switch(tailEvent->mEventRule) {
|
||||
case nsAccEvent::eCoalesceFromSameSubtree:
|
||||
{
|
||||
for (PRInt32 index = 0; index < tail; index ++) {
|
||||
nsRefPtr<nsAccEvent> thisEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* thisEvent = aEventsToFire[index];
|
||||
if (thisEvent->mEventType != tailEvent->mEventType)
|
||||
continue; // Different type
|
||||
|
||||
@ -381,7 +381,7 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
|
||||
{
|
||||
// Check for repeat events.
|
||||
for (PRInt32 index = 0; index < tail; index ++) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* accEvent = aEventsToFire[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule &&
|
||||
accEvent->mDOMNode == tailEvent->mDOMNode) {
|
||||
@ -397,13 +397,13 @@ nsAccEvent::ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFi
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsAccEvent::ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire,
|
||||
nsAccEvent::ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule)
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule)
|
||||
{
|
||||
for (PRUint32 index = aStart; index < aEnd; index ++) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]);
|
||||
nsAccEvent* accEvent = aEventsToFire[index];
|
||||
if (accEvent->mEventType == aEventType &&
|
||||
accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
|
||||
nsCoreUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) {
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
@ -126,11 +127,13 @@ public:
|
||||
return eventType;
|
||||
}
|
||||
static EEventRule EventRule(nsIAccessibleEvent *aAccEvent) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
|
||||
return accEvent->mEventRule;
|
||||
}
|
||||
static PRBool IsAsyncEvent(nsIAccessibleEvent *aAccEvent) {
|
||||
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
nsAccUtils::QueryObject<nsAccEvent>(aAccEvent);
|
||||
return accEvent->mIsAsync;
|
||||
}
|
||||
static PRBool IsFromUserInput(nsIAccessibleEvent *aAccEvent) {
|
||||
@ -169,15 +172,9 @@ public:
|
||||
* Event rule of filtered events will be set to eDoNotEmit.
|
||||
* Events with other event rule are good to emit.
|
||||
*/
|
||||
static void ApplyEventRules(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire);
|
||||
static void ApplyEventRules(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire);
|
||||
|
||||
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.
|
||||
* @param aEventsToFire array of pending events
|
||||
@ -188,7 +185,7 @@ private:
|
||||
* @param aEventRule the event rule to be applied
|
||||
* (should be eDoNotEmit or eAllowDupes)
|
||||
*/
|
||||
static void ApplyToSiblings(nsTArray<nsCOMPtr<nsIAccessibleEvent> > &aEventsToFire,
|
||||
static void ApplyToSiblings(nsTArray<nsRefPtr<nsAccEvent> > &aEventsToFire,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsIDOMNode* aDOMNode,
|
||||
EEventRule aEventRule);
|
||||
|
@ -860,41 +860,6 @@ nsresult nsDocAccessible::RemoveEventListeners()
|
||||
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
|
||||
nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
||||
{
|
||||
@ -948,7 +913,6 @@ nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
||||
nsCOMPtr<nsIAccessibleEvent> accEvent =
|
||||
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE);
|
||||
FireAccessibleEvent(accEvent);
|
||||
FireAnchorJumpEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1626,7 +1590,8 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
|
||||
mEventsToFire.AppendElement(aEvent);
|
||||
nsRefPtr<nsAccEvent> accEvent = nsAccUtils::QueryObject<nsAccEvent>(aEvent);
|
||||
mEventsToFire.AppendElement(accEvent);
|
||||
|
||||
// Filter events.
|
||||
nsAccEvent::ApplyEventRules(mEventsToFire);
|
||||
|
@ -56,11 +56,11 @@ class nsIScrollableView;
|
||||
const PRUint32 kDefaultCacheSize = 256;
|
||||
|
||||
#define NS_DOCACCESSIBLE_IMPL_CID \
|
||||
{ /* 9735bc5f-a4b6-4668-ab73-6f8434c8e750 */ \
|
||||
0x9735bc5f, \
|
||||
0xa4b6, \
|
||||
0x4668, \
|
||||
{ 0xab, 0x73, 0x6f, 0x84, 0x34, 0xc8, 0xe7, 0x50 } \
|
||||
{ /* 9e97d7af-b20a-4a5a-a8d9-bcae0de0b7a2 */ \
|
||||
0x9e97d7af, \
|
||||
0xb20a, \
|
||||
0x4a5a, \
|
||||
{ 0xa8, 0xd9, 0xbc, 0xae, 0x0d, 0xe0, 0xb7, 0xa2 } \
|
||||
}
|
||||
|
||||
class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
||||
@ -172,11 +172,6 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@ -298,12 +293,10 @@ protected:
|
||||
PRPackedBool mIsLoadCompleteFired;
|
||||
|
||||
protected:
|
||||
PRBool mIsAnchor;
|
||||
PRBool mIsAnchorJumped;
|
||||
|
||||
PRBool mInFlushPendingEvents;
|
||||
PRBool mFireEventTimerStarted;
|
||||
nsTArray<nsCOMPtr<nsIAccessibleEvent> > mEventsToFire;
|
||||
nsTArray<nsRefPtr<nsAccEvent> > mEventsToFire;
|
||||
|
||||
static PRUint32 gLastFocusedAccessiblesState;
|
||||
static nsIAtom *gLastFocusedFrameType;
|
||||
|
@ -563,7 +563,7 @@ PRUint32 nsTextEquivUtils::gRoleToNameRulesMap[] =
|
||||
eFromValue, // ROLE_ENTRY
|
||||
eNoRule, // ROLE_CAPTION
|
||||
eNoRule, // ROLE_DOCUMENT_FRAME
|
||||
eNoRule, // ROLE_HEADING
|
||||
eFromSubtreeIfRec, // ROLE_HEADING
|
||||
eNoRule, // ROLE_PAGE
|
||||
eFromSubtreeIfRec, // ROLE_SECTION
|
||||
eNoRule, // ROLE_REDUNDANT_OBJECT
|
||||
|
@ -61,14 +61,8 @@
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessible
|
||||
* - nsHTMLComboboxTextFieldAccessible (#ifdef COMBO_BOX_WITH_THREE_CHILDREN)
|
||||
* - nsHTMLComboboxButtonAccessible (#ifdef COMBO_BOX_WITH_THREE_CHILDREN)
|
||||
* - nsHTMLComboboxListAccessible [ inserted in accessible tree ]
|
||||
* - 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) {
|
||||
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();
|
||||
if (!frame) {
|
||||
@ -1029,11 +999,7 @@ void nsHTMLComboboxAccessible::CacheChildren()
|
||||
mListAccessible->Init();
|
||||
}
|
||||
|
||||
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
|
||||
buttonAccessible->SetNextSibling(mListAccessible);
|
||||
#else
|
||||
SetFirstChild(mListAccessible);
|
||||
#endif
|
||||
|
||||
mListAccessible->SetParent(this);
|
||||
mListAccessible->SetNextSibling(nsnull);
|
||||
@ -1188,222 +1154,9 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
|
||||
/** ----- 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::nsHTMLComboboxListAccessible(nsIAccessible *aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
|
@ -244,59 +244,6 @@ private:
|
||||
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
|
||||
* of the drop down button inside the Select. This is the window
|
||||
|
@ -142,41 +142,6 @@ __try {
|
||||
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)
|
||||
{
|
||||
__try {
|
||||
|
@ -92,8 +92,6 @@ public:
|
||||
/* [optional][in] */ VARIANT varChild,
|
||||
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
|
||||
|
||||
virtual void FireAnchorJumpEvent();
|
||||
|
||||
// nsDocAccessibleWrap
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,7 @@ _TEST_FILES =\
|
||||
attributes.js \
|
||||
common.js \
|
||||
events.js \
|
||||
events_scroll.html \
|
||||
grid.js \
|
||||
layout.js \
|
||||
name.css \
|
||||
@ -91,6 +92,7 @@ _TEST_FILES =\
|
||||
test_elm_listbox.xul \
|
||||
$(warning test_elm_media.html temporarily disabled) \
|
||||
test_elm_plugin.html \
|
||||
test_elm_select.html \
|
||||
test_elm_tree.xul \
|
||||
test_elm_txtcntnr.html \
|
||||
test_events_caretmove.html \
|
||||
@ -101,6 +103,7 @@ _TEST_FILES =\
|
||||
test_events_focus.html \
|
||||
test_events_focus.xul \
|
||||
test_events_mutation.html \
|
||||
test_events_scroll.xul \
|
||||
test_events_tree.xul \
|
||||
test_events_valuechange.html \
|
||||
test_groupattrs.xul \
|
||||
|
123
accessible/tests/mochitest/events_scroll.html
Normal file
123
accessible/tests/mochitest/events_scroll.html
Normal 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>
|
@ -21,7 +21,10 @@
|
||||
isBusy: false,
|
||||
setOverLink: function (link, b) {
|
||||
}
|
||||
}
|
||||
};
|
||||
var gFindBar = {
|
||||
hidden: true
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invoker implementation.
|
||||
@ -74,7 +77,7 @@
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
function onload()
|
||||
function doTest()
|
||||
{
|
||||
var tabBrowser = document.getElementById("content");
|
||||
tabBrowser.loadURI("about:");
|
||||
@ -85,6 +88,8 @@
|
||||
gQueue.onFinish = function() { window.close(); }
|
||||
gQueue.invoke();
|
||||
}
|
||||
|
||||
gOpenerWnd.addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -39,14 +39,6 @@
|
||||
|
||||
function doTest()
|
||||
{
|
||||
if (!WIN) {
|
||||
ok(true,
|
||||
"Nothing to test because scolling events are fired on Windows only");
|
||||
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var actionsArray = [
|
||||
{
|
||||
ID: "anchor1",
|
||||
@ -63,7 +55,7 @@
|
||||
actionIndex: 0,
|
||||
events: CLICK_EVENTS,
|
||||
eventSeq: [
|
||||
new scrollingChecker(getAccessible("bottom2").firstChild)
|
||||
new scrollingChecker(getAccessible("bottom2"))
|
||||
]
|
||||
}
|
||||
];
|
||||
@ -82,7 +74,18 @@
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389"
|
||||
title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART">
|
||||
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>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -35,6 +35,9 @@
|
||||
// attribute.
|
||||
testDescr("img3", "description");
|
||||
|
||||
// Description from content of h2.
|
||||
testDescr("p", "heading");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -61,5 +64,7 @@
|
||||
<img id="img2" title="title" />
|
||||
<img id="img3" alt="name" title="description" />
|
||||
|
||||
<h2 id="heading">heading</h2>
|
||||
<p id="p" aria-describedby="heading" role="button">click me</p>
|
||||
</body>
|
||||
</html>
|
||||
|
129
accessible/tests/mochitest/test_elm_select.html
Normal file
129
accessible/tests/mochitest/test_elm_select.html
Normal 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>
|
101
accessible/tests/mochitest/test_events_scroll.xul
Normal file
101
accessible/tests/mochitest/test_events_scroll.xul
Normal 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>
|
@ -63,6 +63,7 @@ build/pgo/blueprint/Makefile
|
||||
build/pgo/js-input/Makefile
|
||||
build/unix/Makefile
|
||||
build/win32/Makefile
|
||||
build/win32/crashinjectdll/Makefile
|
||||
config/Makefile
|
||||
config/autoconf.mk
|
||||
config/mkdepend/Makefile
|
||||
|
@ -21,6 +21,14 @@
|
||||
<emItem id="support@daemon-tools.cc">
|
||||
<versionRange minVersion=" " maxVersion="1.0.0.5"/>
|
||||
</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}">
|
||||
<versionRange minVersion="1.2" maxVersion="1.2">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
@ -49,5 +57,10 @@
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
<pluginItem>
|
||||
<match name="filename" exp="NPFFAddOn.dll"/>
|
||||
<versionRange>
|
||||
</versionRange>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
</blocklist>
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
// we want to use the DLL blocklist if possible
|
||||
#define XRE_WANT_DLL_BLOCKLIST
|
||||
// we want a wmain entry point
|
||||
#include "nsWindowsWMain.cpp"
|
||||
#endif
|
||||
|
@ -262,8 +262,7 @@ pref("browser.download.useDownloadDir", true);
|
||||
|
||||
#ifdef WINCE
|
||||
pref("browser.download.folderList", 2);
|
||||
// Bug 499807: use Hard Disk filesystem because Desktop is short on space.
|
||||
pref("browser.download.dir", "\\Hard Disk");
|
||||
pref("browser.download.dir", "\\Storage Card");
|
||||
#else
|
||||
pref("browser.download.folderList", 1);
|
||||
#endif
|
||||
@ -753,7 +752,11 @@ pref("browser.rights.3.shown", false);
|
||||
pref("browser.rights.override", true);
|
||||
#endif
|
||||
|
||||
#ifdef WINCE
|
||||
pref("browser.sessionstore.resume_from_crash", false);
|
||||
#else
|
||||
pref("browser.sessionstore.resume_from_crash", true);
|
||||
#endif
|
||||
pref("browser.sessionstore.resume_session_once", false);
|
||||
|
||||
// minimal interval between two save operations in milliseconds
|
||||
|
@ -55,6 +55,7 @@ endif
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
content/openLocationLastURL.jsm \
|
||||
content/NetworkPrioritizer.jsm \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
217
browser/base/content/NetworkPrioritizer.jsm
Normal file
217
browser/base/content/NetworkPrioritizer.jsm
Normal 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 O’Shannessy <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;
|
||||
}
|
||||
};
|
||||
|
@ -76,7 +76,7 @@
|
||||
aboutlabel="&aboutLink;"
|
||||
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">
|
||||
<vbox flex="1" id="clientBox">
|
||||
|
@ -67,7 +67,7 @@
|
||||
<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"/>
|
||||
|
||||
<script type="application/x-javascript"><![CDATA[
|
||||
<script type="application/javascript"><![CDATA[
|
||||
var buttonClicked = false;
|
||||
function robotButton()
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ function generateTextForTextNode(node, indent, textFragmentAccumulator) {
|
||||
|
||||
// Trim the text node's text content and add proper indentation after
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
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
|
||||
<!-- nsMenuBarX hides these and uses them to build the Application menu.
|
||||
|
@ -22,6 +22,12 @@ toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
|
||||
background-position: top right;
|
||||
}
|
||||
|
||||
%ifdef XP_MACOSX
|
||||
#main-window[inFullscreen="true"] {
|
||||
padding-top: 0; /* override drawintitlebar="true" */
|
||||
}
|
||||
%endif
|
||||
|
||||
#browser-bottombox[lwthemefooter="true"] {
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom left;
|
||||
|
@ -1287,6 +1287,10 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
||||
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)
|
||||
if (document.documentElement.getAttribute("windowtype") == "navigator:browser") {
|
||||
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
|
||||
function BrowserPageInfo(doc, initialTab, imageElement) {
|
||||
var args = {doc: doc, initialTab: initialTab, imageElement: imageElement};
|
||||
return toOpenDialogByTypeAndUrl("Browser:page-info",
|
||||
doc ? doc.location : window.content.document.location,
|
||||
"chrome://browser/content/pageinfo/pageInfo.xul",
|
||||
"chrome,toolbar,dialog=no,resizable",
|
||||
args);
|
||||
var windows = Cc['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Ci.nsIWindowMediator)
|
||||
.getEnumerator("Browser:page-info");
|
||||
|
||||
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
|
||||
@ -3249,28 +3267,6 @@ function toOpenWindowByType(inType, uri, features)
|
||||
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()
|
||||
{
|
||||
var charsetArg = new String();
|
||||
@ -3770,10 +3766,13 @@ var FullScreen =
|
||||
}
|
||||
}
|
||||
|
||||
if (aShow)
|
||||
if (aShow) {
|
||||
gNavToolbox.removeAttribute("inFullscreen");
|
||||
else
|
||||
document.documentElement.removeAttribute("inFullscreen");
|
||||
} else {
|
||||
gNavToolbox.setAttribute("inFullscreen", true);
|
||||
document.documentElement.setAttribute("inFullscreen", true);
|
||||
}
|
||||
|
||||
var controls = document.getElementsByAttribute("fullscreencontrol", "true");
|
||||
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"].
|
||||
getService(Components.interfaces.nsIApplicationCacheService);
|
||||
if (!groups) {
|
||||
groups = cacheService.getGroups({});
|
||||
}
|
||||
if (!groups)
|
||||
groups = cacheService.getGroups();
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
|
||||
@ -5938,6 +5937,7 @@ var gMissingPluginInstaller = {
|
||||
}
|
||||
|
||||
function showOutdatedPluginsInfo() {
|
||||
gPrefService.setBoolPref("plugins.update.notifyUser", false);
|
||||
var url = formatURL("plugins.update.url", true);
|
||||
gBrowser.loadOneTab(url, {inBackground: false});
|
||||
return true;
|
||||
|
@ -92,12 +92,12 @@
|
||||
# wishes to include *must* go into the global-scripts.inc file
|
||||
# so that they can be shared by macBrowserOverlay.xul.
|
||||
#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
|
||||
<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
|
||||
<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"/>
|
||||
|
||||
|
@ -164,8 +164,8 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"></script>
|
||||
<script type="application/x-javascript">
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"></script>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
var gCreditsInterval = -1;
|
||||
|
@ -37,8 +37,8 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/printUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/x-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/printUtils.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/viewZoomOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/viewSourceUtils.js"/>
|
||||
|
@ -60,7 +60,7 @@
|
||||
# so that they can be shared by this overlay.
|
||||
#include global-scripts.inc
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<script type="application/javascript">
|
||||
addEventListener("load", nonBrowserWindowStartup, false);
|
||||
addEventListener("unload", nonBrowserWindowShutdown, false);
|
||||
</script>
|
||||
|
@ -144,18 +144,64 @@ nsContextMenu.prototype = {
|
||||
(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) {
|
||||
// ok, we have some text, let's figure out if it looks like a URL
|
||||
var someText = document.commandDispatcher.focusedWindow
|
||||
.getSelection().toString();
|
||||
try {
|
||||
var uri = makeURI(someText);
|
||||
// Ok, we have some text, let's figure out if it looks like a URL.
|
||||
let selection = document.commandDispatcher.focusedWindow
|
||||
.getSelection();
|
||||
let linkText = selection.toString().trim();
|
||||
let uri;
|
||||
if (/^(?:https?|ftp):/i.test(linkText)) {
|
||||
try {
|
||||
uri = makeURI(linkText);
|
||||
} catch (ex) {}
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
var onPlainTextLink = false;
|
||||
if (uri && /^(https?|ftp)$/i.test(uri.scheme) && uri.host) {
|
||||
// Check if this could be a valid url, just missing the protocol.
|
||||
else if (/^(?:\w+\.)+\D\S*$/.test(linkText)) {
|
||||
// Now let's see if this is an intentional link selection. Our guess is
|
||||
// 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.linkURL = this.linkURI.spec;
|
||||
onPlainTextLink = true;
|
||||
|
@ -54,9 +54,9 @@
|
||||
persist="screenX screenY"
|
||||
screenX="24" screenY="24">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/openLocation.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/openLocation.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
|
||||
<stringbundle id="openLocationBundle" src="chrome://browser/locale/openLocation.properties"/>
|
||||
|
||||
|
@ -279,16 +279,12 @@ function onLoadPageInfo()
|
||||
gStrings.mediaLink = gBundle.getString("mediaLink");
|
||||
gStrings.mediaInput = gBundle.getString("mediaInput");
|
||||
|
||||
if ("arguments" in window && window.arguments.length >= 1 &&
|
||||
window.arguments[0] && window.arguments[0].doc) {
|
||||
gDocument = window.arguments[0].doc;
|
||||
gWindow = gDocument.defaultView;
|
||||
}
|
||||
else {
|
||||
if ("gBrowser" in window.opener)
|
||||
gWindow = window.opener.gBrowser.contentWindow;
|
||||
else
|
||||
gWindow = window.opener.frames[0];
|
||||
var args = "arguments" in window &&
|
||||
window.arguments.length >= 1 &&
|
||||
window.arguments[0];
|
||||
|
||||
if (!args || !args.doc) {
|
||||
gWindow = window.opener.content;
|
||||
gDocument = gWindow.document;
|
||||
}
|
||||
|
||||
@ -296,24 +292,8 @@ function onLoadPageInfo()
|
||||
var imageTree = document.getElementById("imagetree");
|
||||
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 */
|
||||
var initialTab = "generalTab";
|
||||
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();
|
||||
loadTab(args);
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.notifyObservers(window, "page-info-dialog-loaded", null);
|
||||
@ -340,7 +320,7 @@ function loadPageInfo()
|
||||
onLoadRegistry.forEach(function(func) { func(); });
|
||||
}
|
||||
|
||||
function resetPageInfo()
|
||||
function resetPageInfo(args)
|
||||
{
|
||||
/* Reset Meta tags part */
|
||||
gMetaView.clear();
|
||||
@ -364,8 +344,8 @@ function resetPageInfo()
|
||||
/* Call registered overlay reset functions */
|
||||
onResetRegistry.forEach(function(func) { func(); });
|
||||
|
||||
/* And let's rebuild the data */
|
||||
loadPageInfo();
|
||||
/* Rebuild the data */
|
||||
loadTab(args);
|
||||
}
|
||||
|
||||
function onUnloadPageInfo()
|
||||
@ -403,6 +383,26 @@ function showTab(id)
|
||||
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()
|
||||
{
|
||||
var radioGrp = document.getElementById("viewGroup");
|
||||
@ -1179,6 +1179,8 @@ function selectImage() {
|
||||
for (var i = 0; i < tree.view.rowCount; i++) {
|
||||
if (gImageElement == gImageView.data[i][COL_IMAGE_NODE]) {
|
||||
tree.view.selection.select(i);
|
||||
tree.treeBoxObject.ensureRowIsVisible(i);
|
||||
tree.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,13 @@
|
||||
width="&pageInfoWindow.width;" height="&pageInfoWindow.height;"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/pageInfo.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/feeds.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/pageinfo/permissions.js"/>
|
||||
<script type="application/x-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://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/pageinfo/pageInfo.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/pageinfo/feeds.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/pageinfo/permissions.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/pageinfo/security.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
|
||||
<stringbundleset id="pageinfobundleset">
|
||||
<stringbundle id="pageinfobundle" src="chrome://browser/locale/pageInfo.properties"/>
|
||||
|
@ -83,7 +83,7 @@ function disableAddons() {
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
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)
|
||||
em.disableItem(items[i].id);
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
||||
onload="onLoad();"
|
||||
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"/>
|
||||
|
||||
|
@ -872,10 +872,6 @@
|
||||
|
||||
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;
|
||||
if (oldBrowser)
|
||||
oldBrowser.setAttribute("type", "content-targetable");
|
||||
@ -970,13 +966,10 @@
|
||||
event.initEvent("TabSelect", true, false);
|
||||
this.mCurrentTab.dispatchEvent(event);
|
||||
|
||||
// change focus to the new tab if nothing is focused, the old tab
|
||||
// is focused or there is something in the new tab to focus. One
|
||||
// specific case where focus is not changed is when the new tab
|
||||
// has no focused element and a chrome element is focused.
|
||||
if ((!focusedChromeElement || focusedChromeElement == oldBrowser ||
|
||||
fm.getFocusedElementForWindow(window.content, true, {})))
|
||||
fm.setFocus(newBrowser, fm.FLAG_NOSCROLL);
|
||||
// Change focus to the new browser unless the findbar is focused.
|
||||
if (gFindBar.hidden ||
|
||||
gFindBar.getElement("findbar-textbox").getAttribute("focused") != "true")
|
||||
newBrowser.focus();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
@ -1521,9 +1514,9 @@
|
||||
var l = this.mTabs.length - this._removingTabs.length;
|
||||
var newTab = false;
|
||||
if (l == 1) {
|
||||
closeWindow = aCloseWindowWithLastTab != null ?
|
||||
aCloseWindowWithLastTab :
|
||||
this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
|
||||
closeWindow = aCloseWindowWithLastTab != null ? aCloseWindowWithLastTab :
|
||||
!window.toolbar.visible ||
|
||||
this.mPrefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
|
||||
|
||||
// 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
|
||||
@ -2930,7 +2923,7 @@
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
</content>
|
||||
<implementation implements="nsITimerCallback, nsIDOMEventListener">
|
||||
<implementation implements="nsIDOMEventListener">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var pb2 =
|
||||
@ -2971,12 +2964,6 @@
|
||||
Components.classes['@mozilla.org/preferences-service;1'].
|
||||
getService(Components.interfaces.nsIPrefBranch2);
|
||||
pb2.removeObserver("browser.tabs.closeButtons", this._prefObserver);
|
||||
|
||||
// Release timer to avoid reference cycles.
|
||||
if (this._animateTimer) {
|
||||
this._animateTimer.cancel();
|
||||
this._animateTimer = null;
|
||||
}
|
||||
]]>
|
||||
</destructor>
|
||||
|
||||
@ -3106,33 +3093,6 @@
|
||||
<field name="_animateElement">
|
||||
this.mTabstrip._scrollButtonDown;
|
||||
</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">
|
||||
<parameter name="aTab"/>
|
||||
@ -3159,54 +3119,12 @@
|
||||
selected.left - scrollRect.left);
|
||||
}
|
||||
|
||||
this._stopAnimation();
|
||||
|
||||
const DEFAULT_OPACITY = .7;
|
||||
var self = this;
|
||||
this._animateBaseColor =
|
||||
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();
|
||||
if (!this._animateElement.hasAttribute("notifybgtab")) {
|
||||
this._animateElement.setAttribute("notifybgtab", "true");
|
||||
setTimeout(function (ele) {
|
||||
ele.removeAttribute("notifybgtab");
|
||||
}, 150, this._animateElement);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
@ -97,8 +97,10 @@ _BROWSER_FILES = \
|
||||
browser_bug455852.js \
|
||||
browser_bug462673.js \
|
||||
browser_bug481560.js \
|
||||
browser_bug484315.js \
|
||||
browser_bug477014.js \
|
||||
browser_bug495058.js \
|
||||
browser_bug517902.js \
|
||||
browser_bug521216.js \
|
||||
browser_discovery.js \
|
||||
browser_tabfocus.js \
|
||||
@ -139,7 +141,9 @@ _BROWSER_FILES = \
|
||||
browser_bug304198.js \
|
||||
browser_drag.js \
|
||||
browser_relatedTabs.js \
|
||||
browser_plainTextLinks.js \
|
||||
browser_contextSearchTabPosition.js \
|
||||
browser_NetworkPrioritizer.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
187
browser/base/content/test/browser_NetworkPrioritizer.js
Normal file
187
browser/base/content/test/browser_NetworkPrioritizer.js
Normal 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 O’Shannessy <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();
|
||||
}
|
@ -1,15 +1,6 @@
|
||||
function test() {
|
||||
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");
|
||||
|
||||
win.addEventListener("load", function () {
|
||||
@ -18,13 +9,15 @@ function test() {
|
||||
win.content.addEventListener("focus", function () {
|
||||
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);
|
||||
|
||||
ok(win.closed, "accel+w closed the window immediately");
|
||||
}, false);
|
||||
|
||||
win.gBrowser.selectedTab.addEventListener("TabClose", function () {
|
||||
ok(false, "shouldn't have gotten the TabClose event for the last tab");
|
||||
finish();
|
||||
}, false);
|
||||
|
||||
}, false);
|
||||
}
|
||||
|
25
browser/base/content/test/browser_bug484315.js
Normal file
25
browser/base/content/test/browser_bug484315.js
Normal 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";
|
||||
}
|
37
browser/base/content/test/browser_bug517902.js
Normal file
37
browser/base/content/test/browser_bug517902.js
Normal 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'>";
|
||||
}
|
95
browser/base/content/test/browser_plainTextLinks.js
Normal file
95
browser/base/content/test/browser_plainTextLinks.js
Normal 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";
|
||||
}
|
@ -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 testPage3 = "data:text/html,<html id='tab3'><body><button id='button3'>Tab 3</button></body></html>";
|
||||
|
||||
var browser1;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
var tab1 = gBrowser.addTab();
|
||||
browser1 = gBrowser.getBrowserForTab(tab1);
|
||||
var browser1 = gBrowser.getBrowserForTab(tab1);
|
||||
|
||||
var tab2 = gBrowser.addTab();
|
||||
var browser2 = gBrowser.getBrowserForTab(tab2);
|
||||
@ -34,25 +32,26 @@ function test() {
|
||||
window.addEventListener("focus", _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
|
||||
var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
var focusedWindow = {};
|
||||
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(fm.getFocusedElementForWindow(browser2.contentWindow, false, focusedWindow), null, "initial 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
|
||||
// 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,
|
||||
window, gURLBar.inputField, false,
|
||||
"focusedElement after tab change, focus in url field, no focus in new tab");
|
||||
browser1.contentWindow, null, true,
|
||||
"focusedElement after tab change, focus in new tab");
|
||||
|
||||
// focusing a button in the current tab should focus it
|
||||
var button1 = browser1.contentDocument.getElementById("button1");
|
||||
@ -223,8 +222,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
|
||||
is(_browser_tabfocus_test_events, expectedEvents, testid + " events");
|
||||
_browser_tabfocus_test_events = "";
|
||||
|
||||
var fm = Components.classes["@mozilla.org/focus-manager;1"].
|
||||
getService(Components.interfaces.nsIFocusManager);
|
||||
var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
|
||||
var focusedElement = fm.focusedElement;
|
||||
is(focusedElement ? getId(focusedElement) : "none",
|
||||
|
@ -53,11 +53,11 @@
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="load()" onunload="unload()">
|
||||
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
|
||||
<script type="application/x-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://global/content/contentAreaUtils.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/web-panels.js"/>
|
||||
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
|
||||
|
@ -36,6 +36,7 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../places/src \
|
||||
-I$(srcdir)/../privatebrowsing/src \
|
||||
-I$(srcdir)/../about \
|
||||
-I$(srcdir)/../dirprovider \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
@ -47,6 +48,7 @@ SHARED_LIBRARY_LIBS = \
|
||||
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
|
||||
../privatebrowsing/src/$(LIB_PREFIX)privatebrowsing_s.$(LIB_SUFFIX) \
|
||||
../about/$(LIB_PREFIX)browserabout_s.$(LIB_SUFFIX) \
|
||||
../dirprovider/$(LIB_PREFIX)browserdir_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter windows cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
|
||||
|
@ -106,3 +106,6 @@
|
||||
#define NS_BROWSER_ABOUT_REDIRECTOR_CID \
|
||||
{ 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 } }
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsBrowserCompsCID.h"
|
||||
#include "DirectoryProvider.h"
|
||||
#include "nsPlacesImportExportService.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
@ -84,6 +85,7 @@ using namespace mozilla::browser;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService)
|
||||
#if defined(XP_WIN)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
|
||||
@ -124,6 +126,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrivateBrowsingServiceWrapper, Init)
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "Browser Directory Provider",
|
||||
NS_BROWSERDIRECTORYPROVIDER_CID,
|
||||
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
|
||||
DirectoryProviderConstructor,
|
||||
DirectoryProvider::Register,
|
||||
DirectoryProvider::Unregister
|
||||
},
|
||||
|
||||
#if defined(XP_WIN)
|
||||
{ "Browser Shell Service",
|
||||
NS_SHELLSERVICE_CID,
|
||||
|
@ -67,7 +67,7 @@
|
||||
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"/>
|
||||
|
||||
<script type="application/x-javascript"><![CDATA[
|
||||
<script type="application/javascript"><![CDATA[
|
||||
// Error url MUST be formatted like this:
|
||||
// about:certerror?e=error&u=url&d=desc
|
||||
|
||||
@ -273,7 +273,7 @@
|
||||
- an onload handler. This is because error pages are loaded as
|
||||
- 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>
|
||||
</html>
|
||||
|
@ -36,6 +36,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "DirectoryProvider.h"
|
||||
|
||||
#include "nsIFile.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
@ -56,52 +57,15 @@
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
class nsBrowserDirectoryProvider :
|
||||
public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
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:
|
||||
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,
|
||||
NS_IMPL_ISUPPORTS2(DirectoryProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||
nsIFile* *aResult)
|
||||
DirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, nsIFile* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -290,8 +254,7 @@ AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
||||
nsISimpleEnumerator* *aResult)
|
||||
DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -331,17 +294,10 @@ nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
||||
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
|
||||
nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
DirectoryProvider::Register(nsIComponentManager* aCompMgr, nsIFile* aPath,
|
||||
const char *aLoaderStr, const char *aType,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -352,15 +308,16 @@ nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr,
|
||||
|
||||
rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
|
||||
"browser-directory-provider",
|
||||
kContractID, PR_TRUE, PR_TRUE, nsnull);
|
||||
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
DirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -374,32 +331,17 @@ nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserDirectoryProvider)
|
||||
|
||||
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_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
|
||||
DirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
|
||||
{
|
||||
*aResult = mNext ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
{
|
||||
if (aResult)
|
||||
NS_ADDREF(*aResult = mNext);
|
||||
@ -440,7 +382,7 @@ nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
DirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
(nsISimpleEnumerator* aBase,
|
||||
char const *const *aAppendList) :
|
||||
mBase(aBase),
|
||||
@ -449,3 +391,6 @@ nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
// Initialize mNext to begin.
|
||||
GetNext(nsnull);
|
||||
}
|
||||
|
||||
} // namespace browser
|
||||
} // namespace mozilla
|
89
browser/components/dirprovider/DirectoryProvider.h
Normal file
89
browser/components/dirprovider/DirectoryProvider.h
Normal 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__
|
@ -42,12 +42,13 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = browsercomps
|
||||
LIBRARY_NAME = browserdirprovider
|
||||
SHORT_LIBNAME = brwsrdir
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = BrowserDirProvider
|
||||
FORCE_SHARED_LIB = 1
|
||||
MODULE = browserdir
|
||||
LIBRARY_NAME = browserdir_s
|
||||
|
||||
DIRS = tests
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
# 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)
|
||||
@ -55,7 +56,12 @@ ifndef MOZ_MEMORY
|
||||
USE_STATIC_LIBS = 1
|
||||
endif
|
||||
|
||||
CPPSRCS = nsBrowserDirectoryProvider.cpp
|
||||
EXPORTS_NAMESPACES = mozilla/browser
|
||||
EXPORTS_mozilla/browser = DirectoryProvider.h
|
||||
|
||||
CPPSRCS = DirectoryProvider.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../build
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(XPCOM_GLUE_LDOPTS) \
|
||||
|
@ -1,4 +1,3 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
@ -14,12 +13,12 @@
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# The Initial Developer 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> (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
|
||||
@ -35,11 +34,16 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/components/dirprovider/tests
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = test_browserdir
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
91
browser/components/dirprovider/tests/unit/test_keys.js
Normal file
91
browser/components/dirprovider/tests/unit/test_keys.js
Normal 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();
|
||||
});
|
||||
}
|
@ -244,7 +244,7 @@ DistributionCustomizer.prototype = {
|
||||
},
|
||||
|
||||
_bookmarksApplied: false,
|
||||
applyBookmarks: function DIST_applyBookarks() {
|
||||
applyBookmarks: function DIST_applyBookmarks() {
|
||||
this._bookmarksApplied = true;
|
||||
if (!this._iniFile)
|
||||
return this._checkCustomizationComplete();
|
||||
|
@ -24,7 +24,7 @@
|
||||
href="chrome://browser/skin/feeds/subscribe.css"
|
||||
type="text/css"
|
||||
media="all"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/feeds/subscribe.js"/>
|
||||
</head>
|
||||
<body onload="SubscribeHandler.writeContent();" onunload="SubscribeHandler.uninit();">
|
||||
@ -60,7 +60,7 @@
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<script type="application/javascript">
|
||||
SubscribeHandler.init();
|
||||
</script>
|
||||
|
||||
|
@ -552,7 +552,7 @@ MicrosummaryService.prototype = {
|
||||
*
|
||||
*/
|
||||
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);
|
||||
return this._bookmarks;
|
||||
},
|
||||
|
@ -49,7 +49,7 @@
|
||||
buttons="accept,cancel"
|
||||
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="brandBundle" src="chrome://branding/locale/brand.properties"/>
|
||||
|
@ -1002,7 +1002,7 @@ BrowserGlue.prototype = {
|
||||
newInVersion: 1 };
|
||||
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,
|
||||
// we will use these informations to create the new version at the same
|
||||
// position.
|
||||
|
@ -52,9 +52,9 @@
|
||||
onload="init();"
|
||||
onunload="SidebarUtils.clearURLFromStatusBar();">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/bookmarksPanel.js"/>
|
||||
|
||||
<commandset id="placesCommands"/>
|
||||
|
@ -248,7 +248,7 @@ PlacesController.prototype = {
|
||||
case "placesCmd_deleteDataHost":
|
||||
var host;
|
||||
if (PlacesUtils.nodeIsHost(this._view.selectedNode)) {
|
||||
var queries = this._view.selectedNode.getQueries({});
|
||||
var queries = this._view.selectedNode.getQueries();
|
||||
host = queries[0].domain;
|
||||
}
|
||||
else
|
||||
@ -509,7 +509,7 @@ PlacesController.prototype = {
|
||||
|
||||
// annotations
|
||||
if (uri) {
|
||||
var names = PlacesUtils.annotations.getPageAnnotationNames(uri, {});
|
||||
var names = PlacesUtils.annotations.getPageAnnotationNames(uri);
|
||||
for (var j = 0; j < names.length; ++j)
|
||||
nodeData[names[j]] = true;
|
||||
}
|
||||
@ -517,7 +517,7 @@ PlacesController.prototype = {
|
||||
// For items also include the item-specific annotations
|
||||
if (node.itemId != -1) {
|
||||
names = PlacesUtils.annotations
|
||||
.getItemAnnotationNames(node.itemId, {});
|
||||
.getItemAnnotationNames(node.itemId);
|
||||
for (j = 0; j < names.length; ++j)
|
||||
nodeData[names[j]] = true;
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ PlacesController.prototype = {
|
||||
}
|
||||
else if (PlacesUtils.nodeIsDay(aContainerNode)) {
|
||||
// Day container.
|
||||
var query = aContainerNode.getQueries({})[0];
|
||||
var query = aContainerNode.getQueries()[0];
|
||||
var beginTime = query.beginTime;
|
||||
var endTime = query.endTime;
|
||||
NS_ASSERT(query && beginTime && endTime,
|
||||
|
@ -204,7 +204,7 @@ var gEditItemOverlay = {
|
||||
|
||||
this._initTextField("locationField", this._uri.spec);
|
||||
if (!aItemIdList) {
|
||||
var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(", ");
|
||||
var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", ");
|
||||
this._initTextField("tagsField", tags, false);
|
||||
}
|
||||
else {
|
||||
@ -218,8 +218,8 @@ var gEditItemOverlay = {
|
||||
this._itemIds[i] = -1;
|
||||
}
|
||||
else
|
||||
this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i], {});
|
||||
this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i], {});
|
||||
this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]);
|
||||
this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]);
|
||||
if (this._tags[i].length < this._tags[nodeToCheck].length)
|
||||
nodeToCheck = i;
|
||||
}
|
||||
@ -328,7 +328,7 @@ var gEditItemOverlay = {
|
||||
}
|
||||
|
||||
// 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
|
||||
@ -573,7 +573,7 @@ var gEditItemOverlay = {
|
||||
},
|
||||
|
||||
_updateSingleTagForItem: function EIO__updateSingleTagForItem() {
|
||||
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri, { });
|
||||
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri);
|
||||
var tags = this._getTagsArrayFromTagField();
|
||||
if (tags.length > 0 || currentTags.length > 0) {
|
||||
var tagsToRemove = [];
|
||||
@ -599,7 +599,7 @@ var gEditItemOverlay = {
|
||||
PlacesUIUtils.ptm.doTransaction(aggregate);
|
||||
|
||||
// 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);
|
||||
return true;
|
||||
}
|
||||
@ -666,7 +666,7 @@ var gEditItemOverlay = {
|
||||
this._allTags = tags;
|
||||
this._tags = [];
|
||||
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
|
||||
this._initTextField("tagsField", tags, false);
|
||||
@ -1112,7 +1112,7 @@ var gEditItemOverlay = {
|
||||
this._initNamePicker(); // for microsummaries
|
||||
this._initTextField("tagsField",
|
||||
PlacesUtils.tagging
|
||||
.getTagsForURI(this._uri, { }).join(", "),
|
||||
.getTagsForURI(this._uri).join(", "),
|
||||
false);
|
||||
this._rebuildTagsSelectorList();
|
||||
}
|
||||
|
@ -60,9 +60,9 @@
|
||||
onload="HistorySidebarInit();"
|
||||
onunload="SidebarUtils.clearURLFromStatusBar();">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/history-panel.js"/>
|
||||
|
||||
<commandset id="editMenuCommands"/>
|
||||
|
@ -57,7 +57,7 @@
|
||||
screenY="24"
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/moveBookmarks.js"/>
|
||||
|
||||
<hbox flex="1">
|
||||
|
@ -216,7 +216,7 @@ var PlacesOrganizer = {
|
||||
return;
|
||||
|
||||
var node = this._places.selectedNode;
|
||||
var queries = asQuery(node).getQueries({});
|
||||
var queries = asQuery(node).getQueries();
|
||||
|
||||
// Items are only excluded on the left pane.
|
||||
var options = node.queryOptions.clone();
|
||||
@ -359,7 +359,7 @@ var PlacesOrganizer = {
|
||||
* main places pane.
|
||||
*/
|
||||
getCurrentQueries: function PO_getCurrentQueries() {
|
||||
return asQuery(this._content.getResult().root).getQueries({});
|
||||
return asQuery(this._content.getResult().root).getQueries();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@
|
||||
toggletoolbar="true"
|
||||
persist="width height screenX screenY sizemode">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/places.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
|
@ -47,17 +47,17 @@
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
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"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/utils.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/controller.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/treeView.js"/>
|
||||
<script type="application/x-javascript"
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
|
||||
<!-- Bookmarks and history tooltip -->
|
||||
|
@ -335,23 +335,24 @@ PlacesTreeView.prototype = {
|
||||
},
|
||||
|
||||
_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
|
||||
// milliseconds from today's midnight.
|
||||
// getTimezoneOffset corrects that based on local time.
|
||||
// 86400000 = 24 * 60 * 60 * 1000 = 1 day
|
||||
// 60000 = 60 * 1000 = 1 minute
|
||||
var dateObj = new Date();
|
||||
var timeZoneOffsetInMs = dateObj.getTimezoneOffset() * 60000;
|
||||
var now = dateObj.getTime() - timeZoneOffsetInMs;
|
||||
var midnight = now - (now % (86400000));
|
||||
// getTimezoneOffset corrects that based on local time, notice midnight
|
||||
// can have a different offset during DST-change days.
|
||||
let dateObj = new Date();
|
||||
let now = dateObj.getTime() - dateObj.getTimezoneOffset() * MS_PER_MINUTE;
|
||||
let midnight = now - (now % MS_PER_DAY);
|
||||
midnight += new Date(midnight).getTimezoneOffset() * MS_PER_MINUTE;
|
||||
|
||||
var dateFormat = timeInMilliseconds - timeZoneOffsetInMs >= midnight ?
|
||||
let dateFormat = timeMs >= midnight ?
|
||||
Ci.nsIScriptableDateFormat.dateFormatNone :
|
||||
Ci.nsIScriptableDateFormat.dateFormatShort;
|
||||
|
||||
var timeObj = new Date(timeInMilliseconds);
|
||||
let timeObj = new Date(timeMs);
|
||||
return (this._dateService.FormatDateTime("", dateFormat,
|
||||
Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||
timeObj.getFullYear(), timeObj.getMonth() + 1,
|
||||
|
@ -231,7 +231,7 @@ var PlacesUIUtils = {
|
||||
var tags = aData.tags.split(", ");
|
||||
// filter out tags already present, so that undo doesn't remove them
|
||||
// from pre-existing bookmarks
|
||||
var storedTags = PlacesUtils.tagging.getTagsForURI(itemURL, {});
|
||||
var storedTags = PlacesUtils.tagging.getTagsForURI(itemURL);
|
||||
tags = tags.filter(function (aTag) {
|
||||
return (storedTags.indexOf(aTag) == -1);
|
||||
}, this);
|
||||
@ -1138,64 +1138,146 @@ var PlacesUIUtils = {
|
||||
|
||||
// Get the folder id for the organizer left-pane folder.
|
||||
get leftPaneFolderId() {
|
||||
var leftPaneRoot = -1;
|
||||
var allBookmarksId;
|
||||
let leftPaneRoot = -1;
|
||||
let allBookmarksId;
|
||||
|
||||
// Shortcuts to services.
|
||||
var bs = PlacesUtils.bookmarks;
|
||||
var as = PlacesUtils.annotations;
|
||||
let bs = PlacesUtils.bookmarks;
|
||||
let as = PlacesUtils.annotations;
|
||||
|
||||
// Get all items marked as being the left pane folder. We should only have
|
||||
// one of them.
|
||||
var items = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
// This is the list of the left pane queries.
|
||||
let queries = {
|
||||
"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) {
|
||||
// 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.
|
||||
items.forEach(bs.removeItem);
|
||||
items.forEach(safeRemoveItem);
|
||||
}
|
||||
else if (items.length == 1 && items[0] != -1) {
|
||||
leftPaneRoot = items[0];
|
||||
// Check organizer left pane version.
|
||||
var version = as.getItemAnnotation(leftPaneRoot, ORGANIZER_FOLDER_ANNO);
|
||||
if (version != ORGANIZER_LEFTPANE_VERSION) {
|
||||
// If version is not valid we must rebuild the left pane.
|
||||
bs.removeItem(leftPaneRoot);
|
||||
|
||||
// Check that organizer left pane root is valid.
|
||||
let version = as.getItemAnnotation(leftPaneRoot, ORGANIZER_FOLDER_ANNO);
|
||||
if (version != ORGANIZER_LEFTPANE_VERSION || !itemExists(leftPaneRoot)) {
|
||||
// Invalid root, we must rebuild the left pane.
|
||||
safeRemoveItem(leftPaneRoot);
|
||||
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) {
|
||||
// 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.
|
||||
delete this.leftPaneQueries;
|
||||
this.leftPaneQueries = {};
|
||||
var items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
|
||||
// While looping through queries we will also check for titles validity.
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var queryName = as.getItemAnnotation(items[i], ORGANIZER_QUERY_ANNO);
|
||||
this.leftPaneQueries[queryName] = items[i];
|
||||
|
||||
let items = as.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
|
||||
// While looping through queries we will also check for their validity.
|
||||
let queriesCount = 0;
|
||||
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
|
||||
// locale. Check title is correctly set and eventually fix it.
|
||||
if (bs.getItemTitle(items[i]) != queriesTitles[queryName])
|
||||
bs.setItemTitle(items[i], queriesTitles[queryName]);
|
||||
// locale. Check title and eventually fix it.
|
||||
if (bs.getItemTitle(query.itemId) != query.title)
|
||||
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 callback = {
|
||||
// Helper to create an organizer special query.
|
||||
@ -1203,7 +1285,7 @@ var PlacesUIUtils = {
|
||||
let itemId = bs.insertBookmark(aParentId,
|
||||
PlacesUtils._uri(aQueryUrl),
|
||||
bs.DEFAULT_INDEX,
|
||||
queriesTitles[aQueryName]);
|
||||
queries[aQueryName].title);
|
||||
// Mark as special organizer query.
|
||||
as.setItemAnnotation(itemId, ORGANIZER_QUERY_ANNO, aQueryName,
|
||||
0, as.EXPIRE_NEVER);
|
||||
@ -1219,7 +1301,7 @@ var PlacesUIUtils = {
|
||||
create_folder: function CB_create_folder(aFolderName, aParentId, aIsRoot) {
|
||||
// Left Pane Root Folder.
|
||||
let folderId = bs.createFolder(aParentId,
|
||||
queriesTitles[aFolderName],
|
||||
queries[aFolderName].title,
|
||||
bs.DEFAULT_INDEX);
|
||||
// We should never backup this, since it changes between profiles.
|
||||
as.setItemAnnotation(folderId, EXCLUDE_FROM_BACKUP_ANNO, 1,
|
||||
|
@ -691,7 +691,7 @@ placesRemoveItemTransaction.prototype = {
|
||||
// children, see getMostRecentBookmarkForURI) for the bookmark's url,
|
||||
// remove the url from tag containers as well.
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -776,7 +776,7 @@ placesEditBookmarkURITransactions.prototype = {
|
||||
this._oldURI = PlacesUtils.bookmarks.getBookmarkURI(this._id);
|
||||
PlacesUtils.bookmarks.changeBookmarkURI(this._id, this._newURI);
|
||||
// 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) {
|
||||
// only untag the old URI if this is the only bookmark
|
||||
if (PlacesUtils.getBookmarksForURI(this._oldURI, {}).length == 0)
|
||||
@ -1157,7 +1157,7 @@ function placesUntagURITransaction(aURI, aTags) {
|
||||
}
|
||||
}
|
||||
else
|
||||
this._tags = PlacesUtils.tagging.getTagsForURI(this._uri, {});
|
||||
this._tags = PlacesUtils.tagging.getTagsForURI(this._uri);
|
||||
|
||||
this.redoTransaction = this.doTransaction;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ var windowObserver = {
|
||||
"Left pane folder correctly created");
|
||||
var leftPaneItems =
|
||||
PlacesUtils.annotations
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
|
||||
is(leftPaneItems.length, 1,
|
||||
"We correctly have only 1 left pane folder");
|
||||
var leftPaneRoot = leftPaneItems[0];
|
||||
@ -99,7 +99,7 @@ function test() {
|
||||
|
||||
// Check if we have any left pane folder already set, remove it eventually.
|
||||
var leftPaneItems = PlacesUtils.annotations
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
|
||||
if (leftPaneItems.length > 0) {
|
||||
// The left pane has already been created, touching it now would cause
|
||||
// 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.
|
||||
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[0], fakeLeftPaneRoot, "left pane root itemId is correct");
|
||||
|
||||
|
@ -101,7 +101,7 @@ function test() {
|
||||
var bmId = add_bookmark(PlacesUtils._uri(TEST_URL));
|
||||
ok(bmId > 0, "A bookmark was added");
|
||||
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");
|
||||
},
|
||||
|
||||
@ -168,13 +168,13 @@ function test() {
|
||||
var histNode = PO._content.view.nodeForTreeIndex(0);
|
||||
ok(histNode, "histNode exists: " + histNode.title);
|
||||
// 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);
|
||||
// check if a bookmark was created
|
||||
var isBookmarked = PU.bookmarks.isBookmarked(PU._uri(MOZURISPEC));
|
||||
is(isBookmarked, true, MOZURISPEC + " is bookmarked");
|
||||
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);
|
||||
},
|
||||
|
||||
@ -194,7 +194,7 @@ function test() {
|
||||
ts.untagURI(PU._uri(MOZURISPEC), ["foo"]);
|
||||
ts.untagURI(PU._uri(TEST_URL), ["foo"]);
|
||||
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");
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ gTests.push({
|
||||
// Add a tag to this bookmark.
|
||||
PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
|
||||
["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");
|
||||
},
|
||||
|
||||
@ -282,7 +282,7 @@ gTests.push({
|
||||
|
||||
cleanup: function() {
|
||||
// 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");
|
||||
|
||||
// Cleanup.
|
||||
@ -366,7 +366,7 @@ gTests.push({
|
||||
// Add a tag to this bookmark.
|
||||
PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
|
||||
["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");
|
||||
},
|
||||
|
||||
@ -440,7 +440,7 @@ gTests.push({
|
||||
|
||||
cleanup: function() {
|
||||
// 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");
|
||||
|
||||
// Cleanup.
|
||||
|
@ -62,6 +62,10 @@ var windowObserver = {
|
||||
var query = leftPaneQueries[i];
|
||||
is(PlacesUtils.bookmarks.getItemTitle(query.itemId),
|
||||
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.
|
||||
@ -87,7 +91,7 @@ function test() {
|
||||
|
||||
// Get the left pane folder.
|
||||
var leftPaneItems = PlacesUtils.annotations
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
|
||||
|
||||
is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
|
||||
// Check version.
|
||||
@ -98,19 +102,35 @@ function test() {
|
||||
|
||||
// Get all left pane queries.
|
||||
var items = PlacesUtils.annotations
|
||||
.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO, {});
|
||||
.getItemsWithAnnotation(ORGANIZER_QUERY_ANNO);
|
||||
// Get current queries names.
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var itemId = items[i];
|
||||
var queryName = PlacesUtils.annotations
|
||||
.getItemAnnotation(items[i],
|
||||
ORGANIZER_QUERY_ANNO);
|
||||
leftPaneQueries.push({ name: queryName,
|
||||
itemId: itemId,
|
||||
correctTitle: PlacesUtils.bookmarks
|
||||
.getItemTitle(itemId) });
|
||||
var query = { name: queryName,
|
||||
itemId: itemId,
|
||||
correctTitle: PlacesUtils.bookmarks.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.
|
||||
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.
|
||||
|
@ -205,7 +205,7 @@ function search(aFolderId, aSearchStr, aExpectedScopeButtonId) {
|
||||
// contentTree.place should be equal to contentTree.getResult().root.uri,
|
||||
// but it's not until bug 476952 is fixed.
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
@ -104,14 +104,14 @@
|
||||
gEditItemOverlay.onTagsFieldBlur();
|
||||
|
||||
// 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
|
||||
document.getElementById("editBMPanel_tagsField").value = testTagUpper;
|
||||
gEditItemOverlay.onTagsFieldBlur();
|
||||
|
||||
// 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.
|
||||
ts.untagURI(testURI, [testTag]);
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
// We need 2 left pane folders to simulate a corrupt profile.
|
||||
do {
|
||||
let leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
let leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
|
||||
// Create a fake left pane folder.
|
||||
let fakeLeftPaneRoot = bs.createFolder(PlacesUtils.placesRootId, "",
|
||||
bs.DEFAULT_INDEX);
|
||||
@ -97,7 +97,7 @@
|
||||
// Check left pane.
|
||||
ok(PlacesUIUtils.leftPaneFolderId > 0,
|
||||
"Left pane folder correctly created");
|
||||
var leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO, {});
|
||||
var leftPaneItems = as.getItemsWithAnnotation(ORGANIZER_FOLDER_ANNO);
|
||||
is(leftPaneItems.length, 1,
|
||||
"We correctly have only 1 left pane folder");
|
||||
|
||||
|
@ -307,7 +307,7 @@ function testTags() {
|
||||
for each(let {uri: u, tags: t} in tagData) {
|
||||
var i = 0;
|
||||
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");
|
||||
do_check_true(t.every(function(el) {
|
||||
i++;
|
||||
|
@ -170,7 +170,7 @@ function run_test() {
|
||||
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[1], bm1);
|
||||
|
||||
|
@ -76,7 +76,7 @@ function run_test() {
|
||||
// TEST 1: smart bookmarks disabled
|
||||
pref.setIntPref("browser.places.smartBookmarksVersion", -1);
|
||||
gluesvc.ensurePlacesDefaultQueriesInitialized();
|
||||
var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {});
|
||||
var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
||||
do_check_eq(smartBookmarkItemIds.length, 0);
|
||||
// check that pref has not been bumped up
|
||||
do_check_eq(pref.getIntPref("browser.places.smartBookmarksVersion"), -1);
|
||||
@ -84,7 +84,7 @@ function run_test() {
|
||||
// TEST 2: create smart bookmarks
|
||||
pref.setIntPref("browser.places.smartBookmarksVersion", 0);
|
||||
gluesvc.ensurePlacesDefaultQueriesInitialized();
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {});
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
||||
do_check_neq(smartBookmarkItemIds.length, 0);
|
||||
// check that pref has been bumped up
|
||||
do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
|
||||
@ -96,7 +96,7 @@ function run_test() {
|
||||
bmsvc.removeItem(smartBookmarkItemIds[0]);
|
||||
pref.setIntPref("browser.places.smartBookmarksVersion", 0);
|
||||
gluesvc.ensurePlacesDefaultQueriesInitialized();
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {});
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
||||
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
|
||||
// check that pref has been bumped up
|
||||
do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
|
||||
@ -113,7 +113,7 @@ function run_test() {
|
||||
// restore
|
||||
pref.setIntPref("browser.places.smartBookmarksVersion", 0);
|
||||
gluesvc.ensurePlacesDefaultQueriesInitialized();
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO, {});
|
||||
smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
|
||||
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
|
||||
do_check_eq(bmsvc.getFolderIdForItem(smartBookmarkItemIds[0]), newParent);
|
||||
do_check_eq(bmsvc.getItemTitle(smartBookmarkItemIds[0]), oldTitle);
|
||||
|
@ -47,7 +47,6 @@ const PREF_BMPROCESSED = "distribution.516444.bookmarksProcessed";
|
||||
const PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
|
||||
const TOPIC_FINAL_UI_STARTUP = "final-ui-startup";
|
||||
const TOPIC_PLACES_INIT_COMPLETE = "places-init-complete";
|
||||
const TOPIC_CUSTOMIZATION_COMPLETE = "distribution-customization-complete";
|
||||
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
@ -95,10 +94,9 @@ function run_test() {
|
||||
// Initialize nsBrowserGlue.
|
||||
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_PLACES_INIT_COMPLETE, null);
|
||||
// places-init-complete is an enqueued notification so it will be notified
|
||||
// when exiting from this scope.
|
||||
|
||||
do_test_pending();
|
||||
// Test will continue on customization complete notification.
|
||||
|
@ -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);
|
||||
}
|
@ -184,7 +184,7 @@ function run_test() {
|
||||
// Create to Root
|
||||
var txn2 = ptSvc.createItem(uri("http://www.example.com"), root, bmStartIndex, "Testing1");
|
||||
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._itemAddedIndex, bmStartIndex);
|
||||
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")));
|
||||
txn2.redoTransaction();
|
||||
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._itemAddedParent, root);
|
||||
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");
|
||||
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._itemAddedIndex, bmStartIndex);
|
||||
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._itemRemovedIndex, bmStartIndex);
|
||||
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._itemAddedParent, fldrId);
|
||||
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, "Testing3"));
|
||||
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();
|
||||
var bkmk1Id = bkmkIds[0];
|
||||
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, "b"));
|
||||
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();
|
||||
var b1 = b[0];
|
||||
var b2 = b[1];
|
||||
@ -595,7 +595,7 @@ function run_test() {
|
||||
ptSvc.doTransaction(
|
||||
ptSvc.createItem(uri("http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),
|
||||
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));
|
||||
var txn18 = ptSvc.editBookmarkMicrosummary(bId, tmpMs);
|
||||
txn18.doTransaction();
|
||||
@ -611,7 +611,7 @@ function run_test() {
|
||||
var postDataURI = uri("http://foo.com");
|
||||
ptSvc.doTransaction(
|
||||
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);
|
||||
postDataTxn.doTransaction();
|
||||
do_check_true(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
|
||||
@ -641,18 +641,18 @@ function run_test() {
|
||||
var tagURI = uri("http://foo.tld");
|
||||
var tagTxn = ptSvc.tagURI(tagURI, ["foo", "bar"]);
|
||||
tagTxn.doTransaction();
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["bar","foo"]));
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["bar","foo"]));
|
||||
tagTxn.undoTransaction();
|
||||
do_check_true(tagssvc.getTagsForURI(tagURI, { }).length == 0);
|
||||
do_check_eq(tagssvc.getTagsForURI(tagURI).length, 0);
|
||||
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"]);
|
||||
untagTxn.doTransaction();
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["foo"]));
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["foo"]));
|
||||
untagTxn.undoTransaction();
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["bar","foo"]));
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["bar","foo"]));
|
||||
untagTxn.redoTransaction();
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval(["foo"]));
|
||||
do_check_eq(uneval(tagssvc.getTagsForURI(tagURI)), uneval(["foo"]));
|
||||
|
||||
// Test aggregate removeItem transaction
|
||||
var bkmk1Id = bmsvc.insertBookmark(root, uri("http://www.mozilla.org/"), 0, "Mozilla");
|
||||
@ -751,7 +751,7 @@ function run_test() {
|
||||
childTxns);
|
||||
try {
|
||||
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(newDateAdded, bmsvc.getItemDateAdded(itemId));
|
||||
do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
|
||||
@ -763,7 +763,7 @@ function run_test() {
|
||||
do_check_eq(observer._itemRemovedId, itemId);
|
||||
itemWChildTxn.redoTransaction();
|
||||
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(observer._itemAddedId, newId);
|
||||
do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
|
||||
@ -782,14 +782,14 @@ function run_test() {
|
||||
var folderWChildItemTxn = ptSvc.createFolder("Folder", root, bmStartIndex, null, [childItemTxn]);
|
||||
try {
|
||||
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._itemAddedIndex, 0);
|
||||
do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com")));
|
||||
folderWChildItemTxn.undoTransaction();
|
||||
do_check_false(bmsvc.isBookmarked(uri("http://www.childItem.com")));
|
||||
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._itemAddedId, newchildItemId);
|
||||
do_check_true(bmsvc.isBookmarked(uri("http://www.childItem.com")));
|
||||
|
@ -63,7 +63,7 @@
|
||||
name="dom.disable_window_status_change" type="bool"/>
|
||||
</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"/>
|
||||
|
||||
|
@ -219,9 +219,9 @@ var gAdvancedPane = {
|
||||
{
|
||||
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
||||
getService(Components.interfaces.nsIApplicationCacheService);
|
||||
if (!groups) {
|
||||
groups = cacheService.getGroups({});
|
||||
}
|
||||
if (!groups)
|
||||
groups = cacheService.getGroups();
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
|
||||
@ -256,7 +256,7 @@ var gAdvancedPane = {
|
||||
|
||||
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
||||
getService(Components.interfaces.nsIApplicationCacheService);
|
||||
var groups = cacheService.getGroups({});
|
||||
var groups = cacheService.getGroups();
|
||||
|
||||
var bundle = document.getElementById("bundlePreferences");
|
||||
|
||||
@ -316,7 +316,7 @@ var gAdvancedPane = {
|
||||
getService(Components.interfaces.nsIApplicationCacheService);
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var groups = cacheService.getGroups({});
|
||||
var groups = cacheService.getGroups();
|
||||
for (var i = 0; i < groups.length; i++) {
|
||||
var uri = ios.newURI(groups[i], null, null);
|
||||
if (uri.asciiHost == host) {
|
||||
|
@ -127,7 +127,7 @@
|
||||
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
|
||||
#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"
|
||||
onselect="gAdvancedPane.tabSelectionChanged();">
|
||||
|
@ -103,7 +103,7 @@
|
||||
type="bool"/>
|
||||
</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>
|
||||
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
|
||||
|
@ -93,7 +93,7 @@
|
||||
<preference id="network.proxy.backup.gopher_port" name="network.proxy.backup.gopher_port" type="int"/>
|
||||
</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"/>
|
||||
|
||||
|
@ -75,8 +75,8 @@
|
||||
onchange="gContentPane._rebuildFonts();"/>
|
||||
</preferences>
|
||||
|
||||
<script type="application/x-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://mozapps/content/preferences/fontbuilder.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/content.js"/>
|
||||
|
||||
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
|
@ -77,8 +77,8 @@
|
||||
</preferences>
|
||||
|
||||
<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/x-javascript" src="chrome://browser/content/preferences/fonts.js"/>
|
||||
<script type="application/javascript" src="chrome://mozapps/content/preferences/fontbuilder.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/preferences/fonts.js"/>
|
||||
|
||||
<!-- Fonts for: [ Language ] -->
|
||||
<groupbox>
|
||||
|
@ -72,7 +72,7 @@
|
||||
type="bool"/>
|
||||
</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">
|
||||
<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
Loading…
Reference in New Issue
Block a user