Merge mozilla-central

This commit is contained in:
Ben Turner 2009-07-30 11:28:07 -07:00
commit cd1d42ffe0
1496 changed files with 66604 additions and 68524 deletions

View File

@ -119,7 +119,7 @@ interface nsIAccessibleRelation : nsISupports
/**
* This object is a transient component related to the target object. When
* this object is activated the target object doesn't loose focus.
* this object is activated the target object doesn't lose focus.
*/
const unsigned long RELATION_POPUP_FOR = 0x0c;

View File

@ -40,7 +40,7 @@
#include "nsIAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsHashtable.h"
#include "nsIAccessibilityService.h"
#include "nsAccessibilityService.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
@ -82,27 +82,19 @@ nsIStringBundle *nsAccessNode::gStringBundle = 0;
nsIStringBundle *nsAccessNode::gKeyStringBundle = 0;
nsITimer *nsAccessNode::gDoCommandTimer = 0;
nsIDOMNode *nsAccessNode::gLastFocusedNode = 0;
#ifdef DEBUG
PRBool nsAccessNode::gIsAccessibilityActive = PR_FALSE;
PRBool nsAccessNode::gIsShuttingDownApp = PR_FALSE;
#endif
PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
nsAccessNodeHashtable nsAccessNode::gGlobalDocAccessibleCache;
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
nsIAccessibilityService *nsAccessNode::sAccService = nsnull;
nsIAccessibilityService *nsAccessNode::GetAccService()
nsIAccessibilityService*
nsAccessNode::GetAccService()
{
if (!gIsAccessibilityActive)
return nsnull;
if (!sAccService) {
nsresult rv = CallGetService("@mozilla.org/accessibilityService;1",
&sAccService);
NS_ASSERTION(NS_SUCCEEDED(rv), "No accessibility service");
}
return sAccService;
return nsAccessibilityService::GetAccessibilityService();
}
/*
@ -245,9 +237,7 @@ NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
already_AddRefed<nsApplicationAccessibleWrap>
nsAccessNode::GetApplicationAccessible()
{
if (!gIsAccessibilityActive) {
return nsnull;
}
NS_ASSERTION(gIsAccessibilityActive, "Accessibility wasn't initialized!");
if (!gApplicationAccessible) {
nsApplicationAccessibleWrap::PreCreate();
@ -273,9 +263,8 @@ nsAccessNode::GetApplicationAccessible()
void nsAccessNode::InitXPAccessibility()
{
if (gIsAccessibilityActive) {
return;
}
NS_ASSERTION(!gIsAccessibilityActive,
"Accessibility was initialized already!");
nsCOMPtr<nsIStringBundleService> stringBundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
@ -297,11 +286,13 @@ void nsAccessNode::InitXPAccessibility()
prefBranch->GetBoolPref("browser.formfill.enable", &gIsFormFillEnabled);
}
#ifdef DEBUG
gIsAccessibilityActive = PR_TRUE;
NotifyA11yInitOrShutdown();
#endif
NotifyA11yInitOrShutdown(PR_TRUE);
}
void nsAccessNode::NotifyA11yInitOrShutdown()
void nsAccessNode::NotifyA11yInitOrShutdown(PRBool aIsInit)
{
nsCOMPtr<nsIObserverService> obsService =
do_GetService("@mozilla.org/observer-service;1");
@ -310,7 +301,7 @@ void nsAccessNode::NotifyA11yInitOrShutdown()
static const PRUnichar kInitIndicator[] = { '1', 0 };
static const PRUnichar kShutdownIndicator[] = { '0', 0 };
obsService->NotifyObservers(nsnull, "a11y-init-or-shutdown",
gIsAccessibilityActive ? kInitIndicator : kShutdownIndicator);
aIsInit ? kInitIndicator : kShutdownIndicator);
}
}
@ -320,16 +311,12 @@ void nsAccessNode::ShutdownXPAccessibility()
// which happens when xpcom is shutting down
// at exit of program
if (!gIsAccessibilityActive) {
return;
}
gIsShuttingDownApp = PR_TRUE;
NS_ASSERTION(gIsAccessibilityActive, "Accessibility was shutdown already!");
NS_IF_RELEASE(gStringBundle);
NS_IF_RELEASE(gKeyStringBundle);
NS_IF_RELEASE(gDoCommandTimer);
NS_IF_RELEASE(gLastFocusedNode);
NS_IF_RELEASE(sAccService);
nsApplicationAccessibleWrap::Unload();
ClearCache(gGlobalDocAccessibleCache);
@ -339,8 +326,10 @@ void nsAccessNode::ShutdownXPAccessibility()
NS_IF_RELEASE(gApplicationAccessible);
gApplicationAccessible = nsnull;
#ifdef DEBUG
gIsAccessibilityActive = PR_FALSE;
NotifyA11yInitOrShutdown();
#endif
NotifyA11yInitOrShutdown(PR_FALSE);
}
PRBool

View File

@ -174,21 +174,21 @@ protected:
/**
* Notify global nsIObserver's that a11y is getting init'd or shutdown
*/
static void NotifyA11yInitOrShutdown();
static void NotifyA11yInitOrShutdown(PRBool aIsInit);
// Static data, we do our own refcounting for our static data
static nsIStringBundle *gStringBundle;
static nsIStringBundle *gKeyStringBundle;
static nsITimer *gDoCommandTimer;
#ifdef DEBUG
static PRBool gIsAccessibilityActive;
static PRBool gIsShuttingDownApp;
#endif
static PRBool gIsCacheDisabled;
static PRBool gIsFormFillEnabled;
static nsAccessNodeHashtable gGlobalDocAccessibleCache;
private:
static nsIAccessibilityService *sAccService;
static nsApplicationAccessibleWrap *gApplicationAccessible;
};

View File

@ -113,6 +113,7 @@
#endif
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
PRBool nsAccessibilityService::gIsShutdown = PR_TRUE;
/**
* nsAccessibilityService
@ -120,6 +121,7 @@ nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
nsAccessibilityService::nsAccessibilityService()
{
// Add observers.
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (!observerService)
@ -132,13 +134,15 @@ nsAccessibilityService::nsAccessibilityService()
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION);
}
// Initialize accessibility.
nsAccessNodeWrap::InitAccessibility();
}
nsAccessibilityService::~nsAccessibilityService()
{
nsAccessibilityService::gAccessibilityService = nsnull;
nsAccessNodeWrap::ShutdownAccessibility();
NS_ASSERTION(gIsShutdown, "Accessibility wasn't shutdown!");
gAccessibilityService = nsnull;
}
NS_IMPL_THREADSAFE_ISUPPORTS5(nsAccessibilityService, nsIAccessibilityService, nsIAccessibleRetrieval,
@ -151,6 +155,8 @@ nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData)
{
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
// Remove observers.
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
@ -159,8 +165,8 @@ nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress)
progress->RemoveProgressListener(static_cast<nsIWebProgressListener*>(this));
nsAccessNodeWrap::ShutdownAccessibility();
// Cancel and release load timers
// Cancel and release load timers.
while (mLoadTimers.Count() > 0 ) {
nsCOMPtr<nsITimer> timer = mLoadTimers.ObjectAt(0);
void *closure = nsnull;
@ -172,7 +178,18 @@ nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
timer->Cancel();
mLoadTimers.RemoveObjectAt(0);
}
// Application is going to be closed, shutdown accessibility and mark
// accessibility service as shutdown to prevent calls of its methods.
// Don't null accessibility service static member at this point to be safe
// if someone will try to operate with it.
NS_ASSERTION(!gIsShutdown, "Accessibility was shutdown already");
gIsShutdown = PR_TRUE;
nsAccessNodeWrap::ShutdownAccessibility();
}
return NS_OK;
}
@ -182,7 +199,8 @@ NS_IMETHODIMP nsAccessibilityService::OnStateChange(nsIWebProgress *aWebProgress
{
NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded");
if (!aWebProgress || 0 == (aStateFlags & (STATE_START | STATE_STOP))) {
if (gIsShutdown || !aWebProgress ||
(aStateFlags & (STATE_START | STATE_STOP)) == 0) {
return NS_OK;
}
@ -260,23 +278,26 @@ nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
void nsAccessibilityService::StartLoadCallback(nsITimer *aTimer, void *aClosure)
{
nsIAccessibilityService *accService = nsAccessNode::GetAccService();
if (accService)
accService->ProcessDocLoadEvent(aTimer, aClosure, nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_START);
if (gAccessibilityService)
gAccessibilityService->
ProcessDocLoadEvent(aTimer, aClosure,
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_START);
}
void nsAccessibilityService::EndLoadCallback(nsITimer *aTimer, void *aClosure)
{
nsIAccessibilityService *accService = nsAccessNode::GetAccService();
if (accService)
accService->ProcessDocLoadEvent(aTimer, aClosure, nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE);
if (gAccessibilityService)
gAccessibilityService->
ProcessDocLoadEvent(aTimer, aClosure,
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE);
}
void nsAccessibilityService::FailedLoadCallback(nsITimer *aTimer, void *aClosure)
{
nsIAccessibilityService *accService = nsAccessNode::GetAccService();
if (accService)
accService->ProcessDocLoadEvent(aTimer, aClosure, nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED);
if (gAccessibilityService)
gAccessibilityService->
ProcessDocLoadEvent(aTimer, aClosure,
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED);
}
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
@ -1315,7 +1336,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
NS_ENSURE_ARG_POINTER(aAccessible);
NS_ENSURE_ARG_POINTER(aFrameHint);
*aAccessible = nsnull;
if (!aPresShell || !aWeakShell) {
if (!aPresShell || !aWeakShell || gIsShutdown) {
return NS_ERROR_FAILURE;
}
@ -2056,22 +2077,28 @@ NS_IMETHODIMP nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
nsresult
nsAccessibilityService::GetAccessibilityService(nsIAccessibilityService** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
*aResult = nsnull;
if (!nsAccessibilityService::gAccessibilityService) {
if (!gAccessibilityService) {
gAccessibilityService = new nsAccessibilityService();
if (!gAccessibilityService ) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ENSURE_TRUE(gAccessibilityService, NS_ERROR_OUT_OF_MEMORY);
gIsShutdown = PR_FALSE;
}
*aResult = nsAccessibilityService::gAccessibilityService;
NS_ADDREF(*aResult);
NS_ADDREF(*aResult = gAccessibilityService);
return NS_OK;
}
nsIAccessibilityService*
nsAccessibilityService::GetAccessibilityService()
{
NS_ASSERTION(!gIsShutdown,
"Going to deal with shutdown accessibility service!");
return gAccessibilityService;
}
nsresult
NS_GetAccessibilityService(nsIAccessibilityService** aResult)
{

View File

@ -84,6 +84,16 @@ public:
*/
static nsresult GetAccessibilityService(nsIAccessibilityService** aResult);
/**
* Return cached accessibility service.
*/
static nsIAccessibilityService* GetAccessibilityService();
/**
* Indicates whether accessibility service was shutdown.
*/
static PRBool gIsShutdown;
private:
/**
* Return presentation shell, DOM node for the given frame.

View File

@ -2495,16 +2495,18 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
return nsRelUtils::AddTarget(aRelationType, aRelation, accTarget);
}
// If accessible is in its own Window then we should provide NODE_CHILD_OF relation
// so that MSAA clients can easily get to true parent instead of getting to oleacc's
// ROLE_WINDOW accessible which will prevent us from going up further (because it is
// system generated and has no idea about the hierarchy above it).
// If accessible is in its own Window, or is the root of a document,
// then we should provide NODE_CHILD_OF relation so that MSAA clients
// can easily get to true parent instead of getting to oleacc's
// ROLE_WINDOW accessible which will prevent us from going up further
// (because it is system generated and has no idea about the hierarchy
// above it).
nsIFrame *frame = GetFrame();
if (frame) {
nsIView *view = frame->GetViewExternal();
if (view) {
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget()) {
if (scrollFrame || view->GetWidget() || !frame->GetParent()) {
nsCOMPtr<nsIAccessible> accTarget;
GetParent(getter_AddRefs(accTarget));
return nsRelUtils::AddTarget(aRelationType, aRelation, accTarget);

View File

@ -39,7 +39,7 @@
#include "nsRootAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessibleEventData.h"
#include "nsIAccessibilityService.h"
#include "nsAccessibilityService.h"
#include "nsIMutableArray.h"
#include "nsICommandManager.h"
#include "nsIDocShell.h"
@ -106,7 +106,7 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
nsIViewManager* vm = shell->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
vm->GetWidget(getter_AddRefs(widget));
vm->GetRootWidget(getter_AddRefs(widget));
if (widget) {
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
}
@ -617,7 +617,17 @@ nsDocAccessible::Init()
nsCOMPtr<nsIAccessible> parentAccessible; // Ensure outer doc mParent accessible
GetParent(getter_AddRefs(parentAccessible));
return nsHyperTextAccessibleWrap::Init();
nsresult rv = nsHyperTextAccessibleWrap::Init();
NS_ENSURE_SUCCESS(rv, rv);
// Fire reorder event to notify new accessible document has been created and
// attached to the tree.
nsCOMPtr<nsIAccessibleEvent> reorderEvent =
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDOMNode);
NS_ENSURE_TRUE(reorderEvent, NS_ERROR_OUT_OF_MEMORY);
FireDelayedAccessibleEvent(reorderEvent);
return NS_OK;
}
nsresult
@ -660,7 +670,7 @@ nsDocAccessible::Shutdown()
// Remove from the cache after other parts of Shutdown(), so that Shutdown() procedures
// can find the doc or root accessible in the cache if they need it.
// We don't do this during ShutdownAccessibility() because that is already clearing the cache
if (!gIsShuttingDownApp)
if (!nsAccessibilityService::gIsShutdown)
gGlobalDocAccessibleCache.Remove(static_cast<void*>(kungFuDeathGripDoc));
return NS_OK;

View File

@ -93,7 +93,8 @@ public:
// nsIScrollPositionListener
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView,
nscoord aX, nscoord aY);
virtual void ViewPositionDidChange(nsIScrollableView* aScrollable) {}
virtual void ViewPositionDidChange(nsIScrollableView* aScrollable,
nsTArray<nsIWidget::Configuration>* aConfigurations) {}
NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView,
nscoord aX, nscoord aY);

View File

@ -157,9 +157,12 @@ NS_IMETHODIMP nsRootAccessible::GetParent(nsIAccessible * *aParent)
NS_ENSURE_ARG_POINTER(aParent);
*aParent = nsnull;
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
NS_IF_ADDREF(*aParent = root);
if (!mParent) {
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
mParent = root;
}
NS_IF_ADDREF(*aParent = mParent);
return NS_OK;
}
@ -956,14 +959,12 @@ void nsRootAccessible::FireFocusCallback(nsITimer *aTimer, void *aClosure)
nsresult
nsRootAccessible::Init()
{
nsresult rv = nsDocAccessibleWrap::Init();
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
NS_ENSURE_STATE(root);
root->AddRootAccessible(this);
return NS_OK;
return nsDocAccessibleWrap::Init();
}
nsresult

View File

@ -336,21 +336,33 @@ nsTextEquivUtils::AppendFromValue(nsIAccessible *aAccessible,
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
}
nsCOMPtr<nsIAccessible> nextSibling;
aAccessible->GetNextSibling(getter_AddRefs(nextSibling));
if (nextSibling) {
nsCOMPtr<nsIAccessible> parent;
aAccessible->GetParent(getter_AddRefs(parent));
if (parent) {
nsCOMPtr<nsIAccessible> firstChild;
parent->GetFirstChild(getter_AddRefs(firstChild));
if (firstChild && firstChild != aAccessible) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ENSURE_STATE(node);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
NS_ENSURE_STATE(content);
nsCOMPtr<nsIContent> parent = content->GetParent();
PRInt32 indexOf = parent->IndexOf(content);
for (PRInt32 i = indexOf - 1; i >= 0; i--) {
// check for preceding text...
if (!parent->GetChildAt(i)->TextIsOnlyWhitespace()) {
PRUint32 childCount = parent->GetChildCount();
for (PRUint32 j = indexOf + 1; j < childCount; j++) {
// .. and subsequent text
if (!parent->GetChildAt(j)->TextIsOnlyWhitespace()) {
nsresult rv = aAccessible->GetValue(text);
NS_ENSURE_SUCCESS(rv, rv);
return AppendString(aString, text) ?
NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
break;
}
}
break;
}
}

View File

@ -115,9 +115,9 @@ nsHTMLImageAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
imageRequest->GetImage(getter_AddRefs(imgContainer));
if (imgContainer) {
PRUint32 numFrames;
imgContainer->GetNumFrames(&numFrames);
if (numFrames > 1)
PRBool animated;
imgContainer->GetAnimated(&animated);
if (animated)
*aState |= nsIAccessibleStates::STATE_ANIMATED;
}

View File

@ -1023,19 +1023,20 @@ void nsHTMLComboboxAccessible::CacheChildren()
if (!mListAccessible) {
mListAccessible =
new nsHTMLComboboxListAccessible(mParent, mDOMNode, mWeakShell);
if (!mListAccessible)
return;
mListAccessible->Init();
}
#ifdef COMBO_BOX_WITH_THREE_CHILDREN
buttonAccessible->SetNextSibling(mListAccessible);
#else
SetFirstChild(mListAccessible);
#endif
if (!mListAccessible) {
return;
}
mListAccessible->SetParent(this);
mListAccessible->SetNextSibling(nsnull);
mListAccessible->Init();
++ mAccChildCount; // List accessible child successfully added
}

View File

@ -593,9 +593,8 @@ __try {
void nsAccessNodeWrap::InitAccessibility()
{
if (gIsAccessibilityActive) {
return;
}
NS_ASSERTION(!gIsAccessibilityActive,
"Accessibility was initialized already!");
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefBranch) {
@ -623,9 +622,7 @@ void nsAccessNodeWrap::ShutdownAccessibility()
NS_IF_RELEASE(gTextEvent);
::DestroyCaret();
if (!gIsAccessibilityActive) {
return;
}
NS_ASSERTION(gIsAccessibilityActive, "Accessibility was shutdown already!");
nsAccessNode::ShutdownXPAccessibility();
}

View File

@ -519,15 +519,21 @@ __try {
nsAutoString roleString;
if (msaaRole != ROLE_SYSTEM_CLIENT &&
!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::role, roleString)) {
nsIDocument * document = content->GetCurrentDoc();
if (!document)
return E_FAIL;
nsINodeInfo *nodeInfo = content->NodeInfo();
nodeInfo->GetName(roleString);
nsAutoString nameSpaceURI;
nodeInfo->GetNamespaceURI(nameSpaceURI);
if (!nameSpaceURI.IsEmpty()) {
// Only append name space if different from that of current document
// Only append name space if different from that of current document.
if (!nodeInfo->NamespaceEquals(document->GetDefaultNamespaceID())) {
nsAutoString nameSpaceURI;
nodeInfo->GetNamespaceURI(nameSpaceURI);
roleString += NS_LITERAL_STRING(", ") + nameSpaceURI;
}
}
if (!roleString.IsEmpty()) {
pvarRole->vt = VT_BSTR;
pvarRole->bstrVal = ::SysAllocString(roleString.get());

View File

@ -93,66 +93,47 @@ STDMETHODIMP nsDocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
return S_OK;
}
void nsDocAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild, nsIAccessible **aXPAccessible)
void
nsDocAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild,
nsIAccessible **aXPAccessible)
{
*aXPAccessible = nsnull;
if (!mWeakShell)
return; // This document has been shut down
if (aVarChild.lVal < 0) {
// Get from hash table
void *uniqueID = (void*)(-aVarChild.lVal); // Convert child ID back to unique ID
nsCOMPtr<nsIAccessNode> accessNode;
GetCachedAccessNode(uniqueID, getter_AddRefs(accessNode));
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
NS_IF_ADDREF(*aXPAccessible = accessible);
if (IsDefunct())
return;
}
nsDocAccessible::GetXPAccessibleFor(aVarChild, aXPAccessible);
// If lVal negative then it is treated as child ID and we should look for
// accessible through whole accessible subtree including subdocuments.
// Otherwise we treat lVal as index in parent.
if (aVarChild.lVal < 0)
GetXPAccessibleForChildID(aVarChild, aXPAccessible);
else
nsDocAccessible::GetXPAccessibleFor(aVarChild, aXPAccessible);
}
STDMETHODIMP nsDocAccessibleWrap::get_accChild(
/* [in] */ VARIANT varChild,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
STDMETHODIMP
nsDocAccessibleWrap::get_accChild(VARIANT varChild,
IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
{
__try {
*ppdispChild = NULL;
if (varChild.vt == VT_I4 && varChild.lVal < 0) {
// AccessibleObjectFromEvent() being called
// that's why the lVal < 0
// IAccessible::accChild can be used to get an accessible by child ID.
// It is used by AccessibleObjectFromEvent() called by AT when AT handles
// our MSAA event.
nsCOMPtr<nsIAccessible> xpAccessible;
GetXPAccessibleFor(varChild, getter_AddRefs(xpAccessible));
if (xpAccessible) {
IAccessible *msaaAccessible;
xpAccessible->GetNativeInterface((void**)&msaaAccessible);
*ppdispChild = static_cast<IDispatch*>(msaaAccessible);
return S_OK;
}
else if (mDocument) {
// If child ID from event can't be found in this window, ask parent.
// This is especially relevant for times when a xul menu item
// has focus, but the system thinks the content window has focus.
nsIDocument* parentDoc = mDocument->GetParentDocument();
if (parentDoc) {
nsIPresShell *parentShell = parentDoc->GetPrimaryShell();
nsCOMPtr<nsIWeakReference> weakParentShell(do_GetWeakReference(parentShell));
if (weakParentShell) {
nsCOMPtr<nsIAccessibleDocument> parentDocAccessible =
nsAccessNode::GetDocAccessibleFor(weakParentShell);
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(parentDocAccessible));
IAccessible *msaaParentDoc;
if (accessible) {
accessible->GetNativeInterface((void**)&msaaParentDoc);
HRESULT rv = msaaParentDoc->get_accChild(varChild, ppdispChild);
msaaParentDoc->Release();
return rv;
}
}
}
}
return E_FAIL;
GetXPAccessibleForChildID(varChild, getter_AddRefs(xpAccessible));
if (!xpAccessible)
return E_FAIL;
IAccessible *msaaAccessible = NULL;
xpAccessible->GetNativeInterface((void**)&msaaAccessible);
*ppdispChild = static_cast<IDispatch*>(msaaAccessible);
return S_OK;
}
// Otherwise, the normal get_accChild() will do
@ -329,3 +310,53 @@ STDMETHODIMP nsDocAccessibleWrap::get_accValue(
return get_URL(pszValue);
}
struct nsSearchAccessibleInCacheArg
{
nsCOMPtr<nsIAccessNode> mAccessNode;
void *mUniqueID;
};
static PLDHashOperator
SearchAccessibleInCache(const void* aKey, nsIAccessNode* aAccessNode,
void* aUserArg)
{
nsCOMPtr<nsIAccessibleDocument> docAccessible(do_QueryInterface(aAccessNode));
NS_ASSERTION(docAccessible,
"No doc accessible for the object in doc accessible cache!");
if (docAccessible) {
nsSearchAccessibleInCacheArg* arg =
static_cast<nsSearchAccessibleInCacheArg*>(aUserArg);
nsCOMPtr<nsIAccessNode> accessNode;
docAccessible->GetCachedAccessNode(arg->mUniqueID,
getter_AddRefs(accessNode));
if (accessNode) {
arg->mAccessNode = accessNode;
return PL_DHASH_STOP;
}
}
return PL_DHASH_NEXT;
}
void
nsDocAccessibleWrap::GetXPAccessibleForChildID(const VARIANT& aVarChild,
nsIAccessible **aAccessible)
{
*aAccessible = nsnull;
NS_PRECONDITION(aVarChild.vt == VT_I4 && aVarChild.lVal < 0,
"Variant doesn't point to child ID!");
// Convert child ID to unique ID.
void *uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
nsSearchAccessibleInCacheArg arg;
arg.mUniqueID = uniqueID;
gGlobalDocAccessibleCache.EnumerateRead(SearchAccessibleInCache,
static_cast<void*>(&arg));
if (arg.mAccessNode)
CallQueryInterface(arg.mAccessNode, aAccessible);
}

View File

@ -93,6 +93,17 @@ public:
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
virtual void FireAnchorJumpEvent();
// nsDocAccessibleWrap
/**
* Find an accessible by the given child ID in cached documents.
*
* @param aVarChild [in] variant pointing to the child ID
* @param aAccessible [out] the found accessible
*/
static void GetXPAccessibleForChildID(const VARIANT& aVarChild,
nsIAccessible **aAccessible);
};
#endif

View File

@ -45,7 +45,7 @@
#include "nsIDOMXULSelectCntrlEl.h"
/*
* The basic implemetation of nsIAccessibleSelectable.
* The basic implementation of nsIAccessibleSelectable.
*/
class nsXULSelectableAccessible : public nsAccessibleWrap
{

View File

@ -88,6 +88,7 @@ _TEST_FILES =\
test_elm_table.html \
test_elm_txtcntnr.html \
test_events_caretmove.html \
test_events_doc.html \
test_events_focus.xul \
test_events_mutation.html \
test_events_tree.xul \

View File

@ -302,9 +302,50 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
is(children.length, aAccTree.children.length,
"Different amount of expected children of " + prettyName(acc) + ".");
if (aAccTree.children.length == children.length) {
if (aAccTree.children.length == children.length) {
var childCount = children.length;
// nsIAccessible::firstChild
var expectedFirstChild = childCount > 0 ?
children.queryElementAt(0, nsIAccessible) : null;
var firstChild = null;
try { firstChild = acc.firstChild; } catch (e) {}
is(firstChild, expectedFirstChild,
"Wrong first child of " + prettyName(acc));
// nsIAccessible::lastChild
var expectedLastChild = childCount > 0 ?
children.queryElementAt(childCount - 1, nsIAccessible) : null;
var lastChild = null;
try { lastChild = acc.lastChild; } catch (e) {}
is(lastChild, expectedLastChild,
"Wrong last child of " + prettyName(acc));
for (var i = 0; i < children.length; i++) {
var child = children.queryElementAt(i, nsIAccessible);
// nsIAccessible::parent
var parent = null;
try { parent = child.parent; } catch (e) {}
is(parent, acc, "Wrong parent of " + prettyName(child));
// nsIAccessible::nextSibling
var expectedNextSibling = (i < childCount - 1) ?
children.queryElementAt(i + 1, nsIAccessible) : null;
var nextSibling = null;
try { nextSibling = child.nextSibling; } catch (e) {}
is(nextSibling, expectedNextSibling,
"Wrong next sibling of " + prettyName(child));
// nsIAccessible::previousSibling
var expectedPrevSibling = (i > 0) ?
children.queryElementAt(i - 1, nsIAccessible) : null;
var prevSibling = null;
try { prevSibling = child.previousSibling; } catch (e) {}
is(prevSibling, expectedPrevSibling,
"Wrong previous sibling of " + prettyName(child));
// Go down through subtree
testAccessibleTree(child, aAccTree.children[i]);
}
}
@ -397,6 +438,9 @@ function getNodePrettyName(aNode)
if (aNode.nodeType == nsIDOMNode.ELEMENT_NODE && aNode.hasAttribute("id"))
return " '" + aNode.getAttribute("id") + "' ";
if (aNode.nodeType == nsIDOMNode.DOCUMENT_NODE)
return " 'document node' ";
return " '" + aNode.localName + " node' ";
} catch (e) {
return "no node info";

View File

@ -1,6 +1,8 @@
////////////////////////////////////////////////////////////////////////////////
// Constants
const EVENT_DOCUMENT_LOAD_COMPLETE =
nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE;
const EVENT_DOM_DESTROY = nsIAccessibleEvent.EVENT_DOM_DESTROY;
const EVENT_FOCUS = nsIAccessibleEvent.EVENT_FOCUS;
const EVENT_NAME_CHANGE = nsIAccessibleEvent.EVENT_NAME_CHANGE;
@ -86,6 +88,15 @@ function unregisterA11yEventListener(aEventType, aEventHandler)
*/
const INVOKER_ACTION_FAILED = 1;
/**
* Common invoker checker (see eventSeq of eventQueue).
*/
function invokerChecker(aEventType, aTarget)
{
this.type = aEventType;
this.target = aTarget;
}
/**
* Creates event queue for the given event type. The queue consists of invoker
* objects, each of them generates the event of the event type. When queue is
@ -319,7 +330,9 @@ function eventQueue(aEventType)
this.setEventHandler = function eventQueue_setEventHandler(aInvoker)
{
this.mEventSeq = ("eventSeq" in aInvoker) ?
aInvoker.eventSeq : [[this.mDefEventType, aInvoker.DOMNode]];
aInvoker.eventSeq :
[ new invokerChecker(this.mDefEventType, aInvoker.DOMNode) ];
this.mEventSeqIdx = -1;
if (this.mEventSeq) {
@ -352,20 +365,12 @@ function eventQueue(aEventType)
this.getEventType = function eventQueue_getEventType(aIdx)
{
var eventItem = this.mEventSeq[aIdx];
if ("type" in eventItem)
return eventItem.type;
return eventItem[0];
return this.mEventSeq[aIdx].type;
}
this.getEventTarget = function eventQueue_getEventTarget(aIdx)
{
var eventItem = this.mEventSeq[aIdx];
if ("target" in eventItem)
return eventItem.target;
return eventItem[1];
return this.mEventSeq[aIdx].target;
}
this.compareEvents = function eventQueue_compareEvents(aIdx, aEvent)

View File

@ -3,6 +3,7 @@
const ROLE_ALERT = nsIAccessibleRole.ROLE_ALERT;
const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW;
const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;

View File

@ -0,0 +1,133 @@
<html>
<head>
<title>Accessible events testing for document</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"
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
<script type="application/javascript">
////////////////////////////////////////////////////////////////////////////
// Invokers
function changeIframeSrc(aIdentifier, aURL)
{
this.DOMNode = getNode(aIdentifier);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, getAccessible(this.DOMNode))
];
this.invoke = function changeIframeSrc_invoke()
{
this.DOMNode.src = aURL;
}
this.getID = function changeIframeSrc_getID()
{
return "change iframe src on " + aURL;
}
}
function openDialogWnd(aURL)
{
// Get application root accessible.
var docAcc = getAccessible(document);
while (docAcc) {
this.mRootAcc = docAcc;
docAcc = docAcc.parent;
}
this.eventSeq = [
new invokerChecker(EVENT_REORDER, this.mRootAcc)
];
this.invoke = function openDialogWnd_invoke()
{
this.mDialog = window.openDialog(aURL);
}
this.check = function openDialogWnd_check()
{
var accTree = {
role: ROLE_APP_ROOT,
children: [
{
role: ROLE_CHROME_WINDOW
},
{
role: ROLE_CHROME_WINDOW
}
]
};
testAccessibleTree(this.mRootAcc, accTree);
this.mDialog.close();
}
this.getID = function openDialogWnd_getID()
{
return "open dialog '" + aURL + "'";
}
}
////////////////////////////////////////////////////////////////////////////
// Do tests
var gQueue = null;
// var gA11yEventDumpID = "eventdump"; // debug stuff
function doTests()
{
gQueue = new eventQueue();
gQueue.push(new changeIframeSrc("iframe", "about:"));
gQueue.push(new changeIframeSrc("iframe", "about:buildconfig"));
gQueue.push(new openDialogWnd("about:"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=420845"
title="Fire event_reorder on any embedded frames/iframes whos document has just loaded">
Mozilla Bug 420845
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506206"
title="Fire event_reorder application root accessible">
Mozilla Bug 506206
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="testContainer">
<iframe id="iframe"></iframe>
</div>
<div id="eventdump"></div>
</body>
</html>

View File

@ -60,8 +60,8 @@
{
var type = this.getA11yEventType(aEventType);
for (var idx = 0; idx < this.eventSeq.length; idx++) {
if (this.eventSeq[idx][0] == type) {
this.eventSeq[idx][1] = aTarget;
if (this.eventSeq[idx].type == type) {
this.eventSeq[idx].target = aTarget;
return idx;
}
}
@ -76,8 +76,10 @@
var targetIdx = this.setTarget(aEventType, aTargets[0]);
var type = this.getA11yEventType(aEventType);
for (var i = 1; i < aTargets.length; i++)
this.eventSeq.splice(++targetIdx, 0, [type, aTargets[i]]);
for (var i = 1; i < aTargets.length; i++) {
var checker = new invokerChecker(type, aTargets[i]);
this.eventSeq.splice(++targetIdx, 0, checker);
}
}
// Implementation
@ -103,15 +105,23 @@
this.mIsDOMChange = aIsDOMChange;
if (aEventTypes & kHideEvent)
this.eventSeq.push([this.getA11yEventType(kHideEvent), this.DOMNode]);
if (aEventTypes & kHideEvent) {
var checker = new invokerChecker(this.getA11yEventType(kHideEvent),
this.DOMNode);
this.eventSeq.push(checker);
}
if (aEventTypes & kShowEvent)
this.eventSeq.push([this.getA11yEventType(kShowEvent), this.DOMNode]);
if (aEventTypes & kShowEvent) {
var checker = new invokerChecker(this.getA11yEventType(kShowEvent),
this.DOMNode);
this.eventSeq.push(checker);
}
if (aEventTypes & kReorderEvent)
this.eventSeq.push([this.getA11yEventType(kReorderEvent),
this.DOMNode.parentNode]);
if (aEventTypes & kReorderEvent) {
var checker = new invokerChecker(this.getA11yEventType(kReorderEvent),
this.DOMNode.parentNode);
this.eventSeq.push(checker);
}
}
/**

View File

@ -122,7 +122,7 @@
this.getID = function setTreeView_getID() { return "TreeViewChanged"; }
this.eventSeq = [["TreeViewChanged", gTree]];
this.eventSeq = [ new invokerChecker("TreeViewChanged", gTree) ];
};
/**

View File

@ -139,13 +139,13 @@
// textarea's name should have the value, which initially is specified by
// a text child.
testName("textareawithchild", "Story: Foo");
testName("textareawithchild", "Story Foo is ended.");
// new textarea name should reflect the value change.
var elem = document.getElementById("textareawithchild");
elem.value = "Bar";
testName("textareawithchild", "Story: Bar");
testName("textareawithchild", "Story Bar is ended.");
/////////////////////////////////////////////////////////////////////////
// label with nested combobox (test for 'f' item of name computation guide)
@ -153,6 +153,9 @@
testName("comboinstart", "One day(s).");
testName("combo3", "day(s).");
testName("textboxinstart", "Two days.");
testName("textbox1", "days.");
testName("comboinmiddle", "Subscribe to ATOM feed.");
testName("combo4", "Subscribe to ATOM feed.");
@ -163,6 +166,9 @@
testName("comboinend", "This day was sunny");
testName("combo6", "This day was");
testName("textboxinend", "This day was sunny");
testName("textbox2", "This day was");
SimpleTest.finish();
}
@ -345,13 +351,15 @@
<!-- A textarea nested in a label with a text child (bug #453371). -->
<form>
<label>Story:
<label>Story
<textarea id="textareawithchild" name="name">Foo</textarea>
is ended.
</label>
</form>
<!-- a label with a nested control in the start, middle and end -->
<form>
<!-- at the start (without and with whitespaces) -->
<label id="comboinstart"><select id="combo3">
<option>One</option>
<option>Two</option>
@ -359,6 +367,12 @@
day(s).
</label>
<label id="textboxinstart">
<input id="textbox1" value="Two">
days.
</label>
<!-- in the middle -->
<label id="comboinmiddle">
Subscribe to
<select id="combo4" name="occupation">
@ -377,12 +391,18 @@
</label>
<input id="checkbox" type="checkbox" />
<!-- at the end (without and with whitespaces) -->
<label id="comboinend">
This day was
<select id="combo6" name="occupation">
<option>sunny</option>
<option>rainy</option>
</select></label>
<label id="textboxinend">
This day was
<input id="textbox2" value="sunny">
</label>
</form>
</body>

View File

@ -54,9 +54,6 @@ include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
ifdef MOZ_INSTALLER
ifdef MOZ_BRANDING_DIRECTORY
DEFINES += -DOFFICIAL_BRANDING=1
endif
# For Windows build the uninstaller during the application build since the
# uninstaller is included with the application for mar file generation.

View File

@ -51,9 +51,6 @@ PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \
$(srcdir)/profile/channel-prefs.js \
$(NULL)
ifndef MOZ_BRANDING_DIRECTORY
PREF_JS_EXPORTS += $(srcdir)/firefox-branding.js
endif
# hardcode en-US for the moment
AB_CD = en-US
@ -226,7 +223,7 @@ endif
ifdef DEBUG
RCFLAGS += -DDEBUG
endif
RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\"
RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\"
endif
include $(topsrcdir)/config/rules.mk
@ -299,58 +296,23 @@ endif
endif # LIBXUL_SDK
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
ICON_FILES = \
$(DIST)/branding/mozicon128.png \
$(DIST)/branding/document.png \
$(NULL)
libs:: $(ICON_FILES)
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/icons
install::
$(SYSINSTALL) $(IFLAGS1) $(ICON_FILES) $(DESTDIR)$(mozappdir)/icons
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
libs::
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(DIST)/bin/icons
$(INSTALL) $(IFLAGS1) $(DIST)/branding/document.png $(DIST)/bin/icons
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
endif
export::
ifndef MOZ_BRANDING_DIRECTORY
$(NSINSTALL) -D $(DIST)/branding
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
cp $(srcdir)/firefox.ico $(DIST)/branding/firefox.ico
cp $(srcdir)/firefox.ico $(DIST)/branding/app.ico
cp $(srcdir)/document.ico $(DIST)/branding/document.ico
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
cp $(srcdir)/macbuild/firefox.icns $(DIST)/branding/firefox.icns
cp $(srcdir)/macbuild/document.icns $(DIST)/branding/document.icns
cp $(srcdir)/macbuild/dsstore $(DIST)/branding/dsstore
cp $(srcdir)/macbuild/background.png $(DIST)/branding/background.png
cp $(srcdir)/macbuild/disk.icns $(DIST)/branding/disk.icns
endif
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
cp $(srcdir)/mozicon128.png $(DIST)/branding/mozicon128.png
cp $(srcdir)/document.png $(DIST)/branding/document.png
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
cp $(srcdir)/default16.png $(DIST)/branding/default16.png
cp $(srcdir)/default32.png $(DIST)/branding/default32.png
cp $(srcdir)/default48.png $(DIST)/branding/default48.png
endif
ifeq ($(OS_ARCH),OS2)
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/firefox.ico
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/app.ico
cp $(srcdir)/document-os2.ico $(DIST)/branding/document.ico
ifdef MOZ_SPLASHSCREEN
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
libs::
$(INSTALL) $(IFLAGS1) $(DIST)/branding/splash.bmp $(DIST)/bin
endif
endif
libs::
touch $(DIST)/bin/.autoreg

View File

@ -309,7 +309,6 @@ pref("browser.microsummary.updateGenerators", true);
// enable search suggestions by default
pref("browser.search.suggest.enabled", true);
pref("browser.history.grouping", "day");
pref("browser.history.showSessions", false);
pref("browser.sessionhistory.max_entries", 50);
pref("browser.history_expire_days", 180);
@ -358,7 +357,8 @@ pref("browser.tabs.closeButtons", 1);
// false return to the adjacent tab (old default)
pref("browser.tabs.selectOwnerOnClose", true);
pref("browser.ctrlTab.previews", true);
pref("browser.allTabs.previews", false);
pref("browser.ctrlTab.previews", false);
pref("browser.ctrlTab.recentlyUsedLimit", 7);
// Default bookmark sorting

View File

@ -64,10 +64,6 @@ DEFINES += \
-DPRE_RELEASE_SUFFIX="$(PRE_RELEASE_SUFFIX)" \
$(NULL)
ifndef MOZ_BRANDING_DIRECTORY
DEFINES += -DMOZ_USE_GENERIC_BRANDING
endif
ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DHAVE_SHELL_SERVICE=1
endif
@ -76,16 +72,6 @@ ifdef MOZ_UPDATER
DEFINES += -DMOZ_UPDATER=1
endif
ifndef MOZ_BRANDING_DIRECTORY
libs locale::
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/browserconfig.properties $(DIST)/bin
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/old-homepage-default.properties $(DIST)/bin
install::
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/browserconfig.properties $(DESTDIR)$(mozappdir)
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/content/old-homepage-default.properties $(DESTDIR)$(mozappdir)
endif
ifneq (,$(filter windows mac cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
ifneq ($(OS_ARCH),WINCE)
DEFINES += -DCONTEXT_COPY_IMAGE_CONTENTS=1

View File

@ -167,13 +167,11 @@
<menuitem id="context-back"
label="&backCmd.label;"
accesskey="&backCmd.accesskey;"
chromedir="&locale.dir;"
command="Browser:BackOrBackDuplicate"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="context-forward"
label="&forwardCmd.label;"
accesskey="&forwardCmd.accesskey;"
chromedir="&locale.dir;"
command="Browser:ForwardOrForwardDuplicate"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="context-reload"

View File

@ -3,8 +3,6 @@
%brandDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd" >
%browserDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % globalRegionDTD SYSTEM "chrome://global-region/locale/region.dtd">
%globalRegionDTD;
<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetOverlay.dtd" >

View File

@ -441,6 +441,12 @@
type="checkbox"
command="View:FullScreen"/>
#endif
<menuitem id="menu_showAllTabs"
hidden="true"
accesskey="&showAllTabsCmd.accesskey;"
label="&showAllTabsCmd.label;"
command="Browser:ShowAllTabs"
key="key_showAllTabs"/>
<menuseparator hidden="true" id="documentDirection-separator"/>
<menuitem id="documentDirection-swap"
hidden="true"
@ -468,7 +474,6 @@
#else
key="goBackKb"
#endif
chromedir="&locale.dir;"
command="Browser:BackOrBackDuplicate"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="historyMenuForward"
@ -478,7 +483,6 @@
#else
key="goForwardKb"
#endif
chromedir="&locale.dir;"
command="Browser:ForwardOrForwardDuplicate"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="historyMenuHome"

View File

@ -432,9 +432,7 @@ var PlacesCommandHook = {
if (starIcon && isElementVisible(starIcon)) {
// Make sure the bookmark properties dialog hangs toward the middle of
// the location bar in RTL builds
var position = "after_end";
if (gURLBar.getAttribute("chromedir") == "rtl")
position = "after_start";
var position = (getComputedStyle(gNavToolbox, "").direction == "rtl") ? 'after_start' : 'after_end';
if (aShowEditUI)
StarUI.showEditBookmarkPopup(itemId, starIcon, position);
#ifdef ADVANCED_STARRING_UI
@ -524,10 +522,7 @@ var PlacesCommandHook = {
* A short description of the feed. Optional.
*/
addLiveBookmark: function PCH_addLiveBookmark(url, feedTitle, feedSubtitle) {
var ios =
Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var feedURI = ios.newURI(url, null, null);
var feedURI = makeURI(url);
var doc = gBrowser.contentDocument;
var title = (arguments.length > 1) ? feedTitle : doc.title;

View File

@ -115,6 +115,7 @@
</command>
<command id="Browser:NextTab" oncommand="gBrowser.mTabContainer.advanceSelectedTab(1, true);"/>
<command id="Browser:PrevTab" oncommand="gBrowser.mTabContainer.advanceSelectedTab(-1, true);"/>
<command id="Browser:ShowAllTabs" oncommand="allTabs.open();"/>
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
@ -317,7 +318,9 @@
<key key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
<key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift"/>
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
<key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;" modifiers="accel,shift"/>

File diff suppressed because it is too large Load Diff

View File

@ -41,21 +41,49 @@
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="ctrlTab-thumbnail">
<content align="center">
<children/>
<xul:label xbl:inherits="value=label,crop"/>
<binding id="ctrlTab-preview" extends="chrome://global/content/bindings/button.xml#button-base">
<content pack="center">
<xul:stack>
<xul:vbox class="ctrlTab-preview-inner" align="center" pack="center"
xbl:inherits="width=canvaswidth">
<xul:hbox class="tabPreview-canvas" xbl:inherits="style=canvasstyle">
<children/>
</xul:hbox>
<xul:label xbl:inherits="value=label,crop" class="plain"/>
</xul:vbox>
<xul:hbox class="ctrlTab-favicon-container" xbl:inherits="hidden=noicon">
<xul:image class="ctrlTab-favicon" xbl:inherits="src=image"/>
</xul:hbox>
</xul:stack>
</content>
<handlers>
<handler event="click" button="0" action="ctrlTab.selectThumbnail(this);"/>
<handler event="click" button="1" action="gBrowser.removeTab(this._tab);"/>
<handler event="mouseover" action="ctrlTab._mouseOverFocus(this);"/>
<handler event="command" action="ctrlTab.pick(this);"/>
<handler event="click" button="1" action="ctrlTab.remove(this);"/>
#ifdef XP_MACOSX
# Control+click is a right click on OS X
<handler event="click" button="2"><![CDATA[
if (!ctrlTab.sticky)
ctrlTab.selectThumbnail(this);
]]></handler>
<handler event="click" button="2" action="ctrlTab.pick(this);"/>
#endif
</handlers>
</binding>
<binding id="allTabs-preview" extends="chrome://global/content/bindings/button.xml#button-base">
<content pack="center" align="center">
<xul:stack>
<xul:vbox class="allTabs-preview-inner" align="center" pack="center">
<xul:hbox class="tabPreview-canvas" xbl:inherits="style=canvasstyle">
<children/>
</xul:hbox>
<xul:label flex="1" xbl:inherits="value=label,crop" class="allTabs-preview-label plain"/>
</xul:vbox>
<xul:hbox class="allTabs-favicon-container">
<xul:image class="allTabs-favicon" xbl:inherits="src=image"/>
</xul:hbox>
</xul:stack>
</content>
<handlers>
<handler event="command" action="allTabs.pick(this);"/>
<handler event="click" button="1" action="gBrowser.removeTab(this._tab);"/>
</handlers>
</binding>
</bindings>

View File

@ -45,6 +45,10 @@ toolbarpaletteitem[place="palette"] > toolbaritem > hbox[type="places"] {
display: none;
}
#feed-menu:-moz-locale-dir(rtl) > menuitem {
direction: rtl;
}
#urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) ,
#urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button ,
#urlbar[isempty="true"] > #urlbar-icons > #go-button {
@ -123,24 +127,50 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
display: -moz-box;
}
/* Tab Previews */
#ctrlTab-panel {
-moz-user-focus: normal;
/* ::::: Keyboard UI Panel ::::: */
.KUI-panel-closebutton {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image");
}
.ctrlTab-thumbnail {
-moz-binding: url("chrome://browser/content/browser-tabPreviews.xml#ctrlTab-thumbnail");
.ctrlTab-preview > html|canvas,
.allTabs-preview > html|canvas {
min-width: inherit;
max-width: inherit;
min-height: inherit;
max-height: inherit;
}
.ctrlTab-thumbnail:not([valid]) {
visibility: hidden;
.ctrlTab-favicon-container,
.allTabs-favicon-container {
-moz-box-align: start;
%ifdef XP_MACOSX
-moz-box-pack: end;
%else
-moz-box-pack: start;
%endif
}
#ctrlTab-pages {
.ctrlTab-favicon,
.allTabs-favicon {
width: 16px;
height: 16px;
}
/* ::::: Ctrl-Tab Panel ::::: */
.ctrlTab-preview {
-moz-binding: url("chrome://browser/content/browser-tabPreviews.xml#ctrlTab-preview");
}
/* ::::: All Tabs Panel ::::: */
.allTabs-preview {
-moz-binding: url("chrome://browser/content/browser-tabPreviews.xml#allTabs-preview");
}
#allTabs-tab-close-button {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image");
margin: 0;
}
#allTabs-container {
display: block;
text-align: center;
}
.ctrlTab-pagePointer {
display: inline-block;
}

View File

@ -1058,6 +1058,8 @@ function BrowserStartup() {
gURLBar.setAttribute("enablehistory", "false");
}
allTabs.readPref();
setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
}
@ -1318,7 +1320,9 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
gBrowser.addEventListener("command", BrowserOnCommand, false);
tabPreviews.init();
ctrlTab.init();
ctrlTab.readPref();
gPrefService.addObserver(ctrlTab.prefName, ctrlTab, false);
gPrefService.addObserver(allTabs.prefName, allTabs, false);
// Initialize the microsummary service by retrieving it, prompting its factory
// to create its singleton, whose constructor initializes the service.
@ -1371,6 +1375,7 @@ function BrowserShutdown()
{
tabPreviews.uninit();
ctrlTab.uninit();
allTabs.uninit();
gGestureSupport.init(false);
@ -2655,10 +2660,9 @@ var browserDragAndDrop = {
var file = dt.mozGetDataAt("application/x-moz-file", 0);
if (file) {
var name = file instanceof Ci.nsIFile ? file.leafName : "";
var ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler);
var fileHandler = ContentAreaUtils.ioService
.getProtocolHandler("file")
.QueryInterface(Ci.nsIFileProtocolHandler);
return [fileHandler.getURLSpecFromFile(file), name];
}
@ -2884,9 +2888,7 @@ const DOMLinkHandler = {
break;
var targetDoc = link.ownerDocument;
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var uri = ios.newURI(link.href, targetDoc.characterSet, null);
var uri = makeURI(link.href, targetDoc.characterSet);
if (gBrowser.isFailedIcon(uri))
break;
@ -4417,10 +4419,7 @@ nsBrowserAccess.prototype =
if (aURI) {
if (aOpener) {
location = aOpener.location;
referrer =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(location, null, null);
referrer = makeURI(location);
}
newWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
@ -4437,10 +4436,7 @@ nsBrowserAccess.prototype =
newWindow = aOpener.top;
if (aURI) {
location = aOpener.location;
referrer =
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(location, null, null);
referrer = makeURI(location);
newWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(nsIWebNavigation)
@ -4970,20 +4966,20 @@ function middleMousePaste(event)
*/
var contentAreaDNDObserver = {
onDragOver: function (aEvent)
{
var types = aEvent.dataTransfer.types;
if (types.contains("application/x-moz-file") ||
types.contains("text/x-moz-url") ||
types.contains("text/uri-list") ||
types.contains("text/plain"))
aEvent.preventDefault();
},
onDrop: function (aEvent)
{
if (aEvent.getPreventDefault())
return;
var types = aEvent.dataTransfer.types;
if (!types.contains("application/x-moz-file") &&
!types.contains("text/x-moz-url") &&
!types.contains("text/uri-list") &&
!types.contains("text/plain")) {
aEvent.preventDefault();
return;
}
let [url, name] = browserDragAndDrop.getDragURLFromDataTransfer(aEvent.dataTransfer);
// valid urls don't contain spaces ' '; if we have a space it
@ -5413,11 +5409,8 @@ var OfflineApps = {
if (!attr) return null;
try {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var contentURI = ios.newURI(aWindow.location.href, null, null);
return ios.newURI(attr, aWindow.document.characterSet, contentURI);
var contentURI = makeURI(aWindow.location.href, null, null);
return makeURI(attr, aWindow.document.characterSet, contentURI);
} catch (e) {
return null;
}
@ -5618,11 +5611,8 @@ var OfflineApps = {
if (!manifest)
return;
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var manifestURI = ios.newURI(manifest, aDocument.characterSet,
aDocument.documentURIObject);
var manifestURI = makeURI(manifest, aDocument.characterSet,
aDocument.documentURIObject);
var updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"].
getService(Ci.nsIOfflineCacheUpdateService);
@ -5635,9 +5625,7 @@ var OfflineApps = {
{
if (aTopic == "dom-storage-warn-quota-exceeded") {
if (aSubject) {
var uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(aSubject.location.href, null, null);
var uri = makeURI(aSubject.location.href);
if (OfflineApps._checkUsage(uri)) {
var browserWindow =
@ -5698,9 +5686,7 @@ var MailIntegration = {
mailtoUrl += "&subject=" + encodeURIComponent(aSubject);
}
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(mailtoUrl, null, null);
var uri = makeURI(mailtoUrl);
// now pass this uri to the operating system
this._launchExternalUrl(uri);
@ -6642,9 +6628,7 @@ var gIdentityHandler = {
// Make sure the identity popup hangs toward the middle of the location bar
// in RTL builds
var position = 'after_start';
if (gURLBar.getAttribute("chromedir") == "rtl")
position = 'after_end';
var position = (getComputedStyle(gNavToolbox, "").direction == "rtl") ? 'after_end' : 'after_start';
// Add the "open" attribute to the identity box for styling
this._identityBox.setAttribute("open", "true");

View File

@ -104,17 +104,16 @@
<popupset id="mainPopupSet">
<menupopup id="backForwardMenu"
chromedir="&locale.dir;"
onpopupshowing="return FillHistoryMenu(event.target);"
oncommand="gotoHistoryIndex(event);"
onclick="checkForMiddleClick(this, event);"/>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
<!-- for search and content formfill/pw manager -->
<panel type="autocomplete" chromedir="&locale.dir;" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
<panel type="autocomplete" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox" chromedir="&locale.dir;" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
<panel type="autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
<panel id="editBookmarkPanel"
orient="vertical"
@ -205,8 +204,7 @@
<!-- Popup for site identity information -->
<panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
onpopupshown="document.getElementById('identity-popup-more-info-button').focus();"
level="top"
chromedir="&locale.dir;">
level="top">
<hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box">
@ -242,30 +240,44 @@
<label crop="center" flex="1" class="tooltip-label"/>
</tooltip>
<panel id="ctrlTab-panel" class="KUI-panel" hidden="true" norestorefocus="true" ignorekeys="true">
<panel id="ctrlTab-panel" class="KUI-panel" hidden="true" norestorefocus="true" level="top">
<hbox>
<button class="ctrlTab-preview" flex="1"/>
<button class="ctrlTab-preview" flex="1"/>
<button class="ctrlTab-preview" flex="1"/>
<button class="ctrlTab-preview" flex="1"/>
<button class="ctrlTab-preview" flex="1"/>
<button class="ctrlTab-preview" flex="1"/>
</hbox>
<hbox pack="center">
<textbox id="ctrlTab-search"
<button id="ctrlTab-showAll" class="ctrlTab-preview" noicon="true"/>
</hbox>
</panel>
<panel id="allTabs-panel" hidden="true" norestorefocus="true" ignorekeys="true"
# XXX: KUI style disabled, because the transparent background slows down
# interacting with the panel, esp. the search field.
# class="KUI-panel"
onmouseover="allTabs._updateTabCloseButton(event);">
<hbox id="allTabs-meta" align="center">
<spacer flex="1"/>
<textbox id="allTabs-filter"
tooltiptext="&allTabs.filter.emptyText;"
type="search"
emptytext="&ctrlTab.search.emptyText;"
oncommand="ctrlTab.search();"
onfocus="ctrlTab.sticky = true;"/>
oncommand="allTabs.filter();"/>
<spacer flex="1"/>
<toolbarbutton class="KUI-panel-closebutton"
oncommand="allTabs.close()"
tooltiptext="&closeCmd.label;"/>
</hbox>
<hbox class="ctrlTab-row">
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
<vbox class="ctrlTab-thumbnail"/>
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
</hbox>
<hbox class="ctrlTab-row">
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
<vbox class="ctrlTab-thumbnail"/>
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
</hbox>
<hbox class="ctrlTab-row">
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
<vbox class="ctrlTab-thumbnail"/>
<hbox flex="1" pack="center"><vbox class="ctrlTab-thumbnail"/></hbox>
</hbox>
<hbox id="ctrlTab-pages"/>
<stack id="allTabs-stack">
<box id="allTabs-container"/>
<toolbarbutton id="allTabs-tab-close-button"
class="tab-close-button"
oncommand="allTabs.closeTab(event);"
tooltiptext="&closeCmd.label;"
style="visibility:hidden"/>
</stack>
</panel>
</popupset>
@ -304,18 +316,16 @@
<toolbaritem id="unified-back-forward-button" class="chromeclass-toolbar-additional"
context="backForwardMenu">
<toolbarbutton id="back-button" class="toolbarbutton-1"
chromedir="&locale.dir;"
label="&backCmd.label;"
command="Browser:BackOrBackDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&backButton.tooltip;"/>
<toolbarbutton id="forward-button" class="toolbarbutton-1"
chromedir="&locale.dir;"
label="&forwardCmd.label;"
command="Browser:ForwardOrForwardDuplicate"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&forwardButton.tooltip;"/>
<toolbarbutton id="back-forward-dropmarker" type="menu" chromedir="&locale.dir;"
<toolbarbutton id="back-forward-dropmarker" type="menu"
disabled="true" tooltiptext="&backForwardMenu.tooltip;"
onbroadcast="if (this.disabled) this.disabled =
document.getElementById('Browser:Back').hasAttribute('disabled') &amp;&amp;
@ -323,7 +333,6 @@
<!-- bug 415444: event.stopPropagation is here for the cloned version of
this menupopup -->
<menupopup context=""
chromedir="&locale.dir;"
position="after_start"
onpopupshowing="return FillHistoryMenu(event.target);"
oncommand="gotoHistoryIndex(event); event.stopPropagation();"
@ -360,7 +369,6 @@
bookmarkemptytext="&urlbar.bookmark.emptyText;"
historyemptytext="&urlbar.history.emptyText;"
noneemptytext="&urlbar.none.emptyText;"
chromedir="&locale.dir;"
type="autocomplete"
autocompletesearch="history"
autocompletepopup="PopupAutoCompleteRichResult"
@ -370,6 +378,7 @@
showimagecolumn="true"
enablehistory="true"
maxrows="6"
timeout="75"
newlines="stripsurroundingwhitespace"
oninput="gBrowser.userTypedValue = this.value;"
ontextentered="this.handleCommand(param);"
@ -384,7 +393,6 @@
We only add the identity-box button to the tab order when the location bar
has focus, otherwise pressing F6 focuses it instead of the location bar -->
<box id="identity-box" role="button"
chromedir="&locale.dir;"
onclick="gIdentityHandler.handleIdentityButtonEvent(event);"
onkeypress="gIdentityHandler.handleIdentityButtonEvent(event);">
<hbox align="center">
@ -404,11 +412,11 @@
style="-moz-user-focus: none"
class="plain urlbar-icon"
id="feed-button"
chromedir="&locale.dir;"
collapsed="true"
tooltiptext="&feedButton.tooltip;"
onclick="return FeedHandler.onFeedButtonClick(event);">
<menupopup position="after_end"
id="feed-menu"
onpopupshowing="return FeedHandler.buildFeedList(this);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
@ -417,7 +425,6 @@
class="urlbar-icon"
onclick="PlacesStarButton.onClick(event);"/>
<image id="go-button"
chromedir="&locale.dir;"
class="urlbar-icon"
tooltiptext="&goEndCap.tooltip;"
onclick="gURLBar.handleCommand(event);"/>
@ -428,7 +435,7 @@
<toolbaritem id="search-container" title="&searchItem.title;"
align="center" class="chromeclass-toolbar-additional"
flex="100" persist="width">
<searchbar id="searchbar" flex="1" chromedir="&locale.dir;"/>
<searchbar id="searchbar" flex="1"/>
</toolbaritem>
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"

View File

@ -1182,10 +1182,8 @@ nsContextMenu.prototype = {
},
getLinkURI: function() {
var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
try {
return ioService.newURI(this.linkURL, null, null);
return makeURI(this.linkURL);
}
catch (ex) {
// e.g. empty URL string

View File

@ -1,2 +0,0 @@
# Do NOT localize or otherwise change these values
browser.startup.homepage=http://www.mozilla.org/projects/bonecho/

View File

@ -596,11 +596,14 @@ function addImage(url, type, alt, elem, isBg)
function grabAll(elem)
{
// check for background images, any node may have one
var ComputedStyle = elem.ownerDocument.defaultView.getComputedStyle(elem, "");
var url = ComputedStyle && ComputedStyle.getPropertyCSSValue("background-image");
if (url && url.primitiveType == CSSPrimitiveValue.CSS_URI)
addImage(url.getStringValue(), gStrings.mediaBGImg, gStrings.notSet, elem, true);
// check for background images, any node may have multiple
var computedStyle = elem.ownerDocument.defaultView.getComputedStyle(elem, "");
if (computedStyle) {
Array.forEach(computedStyle.getPropertyCSSValue("background-image"), function (url) {
if (url.primitiveType == CSSPrimitiveValue.CSS_URI)
addImage(url.getStringValue(), gStrings.mediaBGImg, gStrings.notSet, elem, true);
});
}
// one swi^H^H^Hif-else to rule them all
if (elem instanceof HTMLImageElement)

View File

@ -48,8 +48,6 @@
<!DOCTYPE window [
<!ENTITY % pageInfoDTD SYSTEM "chrome://browser/locale/pageInfo.dtd">
%pageInfoDTD;
<!ENTITY % global SYSTEM "chrome://global/locale/global.dtd">
%global;
]>
#ifdef XP_MACOSX
@ -117,8 +115,7 @@
</menupopup>
<windowdragbox id="topBar" class="viewGroupWrapper">
<radiogroup id="viewGroup" class="chromeclass-toolbar" orient="horizontal"
chromedir="&locale.dir;">
<radiogroup id="viewGroup" class="chromeclass-toolbar" orient="horizontal">
<radio id="generalTab" label="&generalTab;" accesskey="&generalTab.accesskey;"
oncommand="showTab('general');"/>
<radio id="mediaTab" label="&mediaTab;" accesskey="&mediaTab.accesskey;"

View File

@ -42,7 +42,6 @@
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/sanitizeDialog.css"?>
#ifdef CRH_DIALOG_TREE_VIEW
@ -88,11 +87,9 @@
<preferences id="sanitizePreferences">
<preference id="privacy.cpd.history" name="privacy.cpd.history" type="bool"/>
<preference id="privacy.cpd.formdata" name="privacy.cpd.formdata" type="bool"/>
<preference id="privacy.cpd.passwords" name="privacy.cpd.passwords" type="bool"/>
<preference id="privacy.cpd.downloads" name="privacy.cpd.downloads" type="bool" disabled="true"/>
<preference id="privacy.cpd.cookies" name="privacy.cpd.cookies" type="bool"/>
<preference id="privacy.cpd.cache" name="privacy.cpd.cache" type="bool"/>
<preference id="privacy.cpd.offlineApps" name="privacy.cpd.offlineApps" type="bool"/>
<preference id="privacy.cpd.sessions" name="privacy.cpd.sessions" type="bool"/>
<preference id="privacy.cpd.siteSettings" name="privacy.cpd.siteSettings" type="bool"/>
</preferences>

View File

@ -50,8 +50,6 @@
<!DOCTYPE bindings [
<!ENTITY % tabBrowserDTD SYSTEM "chrome://browser/locale/tabbrowser.dtd" >
%tabBrowserDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<bindings id="tabBrowserBindings"
@ -68,7 +66,7 @@
<xul:stringbundle anonid="tbstringbundle" src="chrome://browser/locale/tabbrowser.properties"/>
<xul:tabbox anonid="tabbox" flex="1" eventnode="document" xbl:inherits="handleCtrlPageUpDown"
onselect="if (!('updateCurrentBrowser' in this.parentNode) || event.target.localName != 'tabpanels') return; this.parentNode.updateCurrentBrowser();">
<xul:hbox class="tab-drop-indicator-bar" collapsed="true" chromedir="&locale.dir;"
<xul:hbox class="tab-drop-indicator-bar" collapsed="true"
ondragover="this.parentNode.parentNode._onDragOver(event);"
ondragleave="this.parentNode.parentNode._onDragLeave(event);"
ondrop="this.parentNode.parentNode._onDrop(event);">
@ -622,17 +620,13 @@
<body>
<![CDATA[
var browser = this.getBrowserForTab(aTab);
browser.mIconURL = aURI;
browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
if (aURI) {
if (!(aURI instanceof Components.interfaces.nsIURI)) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
aURI = ios.newURI(aURI, null, null);
}
if (this.mFaviconService)
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
aURI, false);
if (aURI && this.mFaviconService) {
if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
aURI, false);
}
this.updateIcon(aTab);
@ -706,7 +700,7 @@
req.image.height > sz)
return;
this.setIcon(aTab, browser.currentURI.spec);
this.setIcon(aTab, browser.currentURI);
} catch (e) { }
}
}
@ -725,14 +719,11 @@
<parameter name="aURI"/>
<body>
<![CDATA[
if (!(aURI instanceof Components.interfaces.nsIURI)) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
aURI = ios.newURI(aURI, null, null);
}
if (this.mFaviconService)
if (this.mFaviconService) {
if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
return this.mFaviconService.isFailedFavicon(aURI);
}
return null;
]]>
</body>
@ -2819,8 +2810,7 @@
onmousedown="_startScroll(-1);"
onmouseover="_continueScroll(-1);"
onmouseup="_stopScroll();"
onmouseout="_pauseScroll();"
chromedir="&locale.dir;"/>
onmouseout="_pauseScroll();"/>
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1" anonid="scrollbox">
<children/>
</xul:scrollbox>
@ -2836,8 +2826,7 @@
onmousedown="_startScroll(1);"
onmouseover="_continueScroll(1);"
onmouseup="_stopScroll();"
onmouseout="_pauseScroll();"
chromedir="&locale.dir;"/>
onmouseout="_pauseScroll();"/>
</xul:stack>
</content>
#endif
@ -2858,7 +2847,7 @@
</xul:stack>
#endif
<xul:arrowscrollbox anonid="arrowscrollbox" orient="horizontal" flex="1"
style="min-width: 1px;" chromedir="&locale.dir;"
style="min-width: 1px;"
#ifndef XP_MACOSX
clicktoscroll="true"
#endif
@ -2870,20 +2859,23 @@
# button, necessary due to the previous hack.
<children/>
<xul:toolbarbutton class="tabs-newtab-button"
command="cmd_newNavigatorTab" chromedir="&locale.dir;"
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"/>
</xul:arrowscrollbox>
<xul:toolbarbutton class="tabs-newtab-button" anonid="newtab-button"
command="cmd_newNavigatorTab" chromedir="&locale.dir;"
command="cmd_newNavigatorTab"
tooltiptext="&newTabButton.tooltip;"/>
<xul:stack align="center" pack="end" chromedir="&locale.dir;">
<xul:stack align="center" pack="end">
<xul:hbox flex="1" class="tabs-alltabs-box-animate" anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" anonid="alltabs-button"
tooltiptext="&listAllTabs.label;"
oncommand="ctrlTab.open(true);"/>
type="menu"
tooltiptext="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup" anonid="alltabs-popup"
position="after_end"/>
</xul:toolbarbutton>
</xul:stack>
<xul:toolbarbutton anonid="tabs-closebutton"
class="close-button tabs-closebutton" chromedir="&locale.dir;"/>
class="close-button tabs-closebutton"/>
</xul:hbox>
</xul:stack>
</content>
@ -3239,8 +3231,7 @@
<binding id="tabbrowser-tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab">
<content chromedir="&locale.dir;"
closetabtext="&closeTab.label;">
<content closetabtext="&closeTab.label;">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button"/>
@ -3293,25 +3284,6 @@
<binding id="tabbrowser-alltabs-popup"
extends="chrome://global/content/bindings/popup.xml#popup">
<implementation implements="nsIDOMEventListener">
<field name="_xulWindow">
null
</field>
<constructor><![CDATA[
// We cannot cache the XULBrowserWindow object itself since it might
// be set after this binding is constructed.
try {
this._xulWindow =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIXULWindow);
}
catch(ex) { }
]]></constructor>
<method name="_menuItemOnCommand">
<parameter name="aEvent"/>
@ -3471,9 +3443,6 @@
<handler event="DOMMenuItemActive">
<![CDATA[
if (!this._xulWindow || !this._xulWindow.XULBrowserWindow)
return;
var tab = event.target.tab;
if (tab) {
var statusText = tab.linkedBrowser.currentURI.spec;
@ -3484,16 +3453,13 @@
statusText = " ";
}
this._xulWindow.XULBrowserWindow.setOverLink(statusText, null);
XULBrowserWindow.setOverLink(statusText, null);
}
]]></handler>
<handler event="DOMMenuItemInactive">
<![CDATA[
if (!this._xulWindow || !this._xulWindow.XULBrowserWindow)
return;
this._xulWindow.XULBrowserWindow.setOverLink("", null);
XULBrowserWindow.setOverLink("", null);
]]></handler>
</handlers>

View File

@ -1,12 +1,8 @@
// Bug 356571 - loadOneOrMoreURIs gives up if one of the URLs has an unknown protocol
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cm = Components.manager;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// Set to true when docShell alerts for unknown protocol error
var didFail = false;

View File

@ -1,9 +1,6 @@
function test() {
var ioserv = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var exampleUri = ioserv.newURI("http://example.com/", null, null);
var secman = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
getService(Components.interfaces.nsIScriptSecurityManager);
var exampleUri = makeURI("http://example.com/");
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
var principal = secman.getCodebasePrincipal(exampleUri);
function testIsFeed(aTitle, aHref, aType, aKnown) {

View File

@ -30,16 +30,16 @@ function invokeUsingStarButton(phase) {
}
}
var testURL = "data:text/plain,Content";
// test bug 432599
function test() {
waitForExplicitFinish();
let testTab = gBrowser.addTab();
gBrowser.selectedTab = testTab;
let testBrowser = gBrowser.getBrowserForTab(testTab);
testBrowser.addEventListener("load", initTest, true);
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", initTest, true);
testBrowser.contentWindow.location = "data:text/plain,Content";
content.location = testURL;
}
let invokers = [invokeUsingStarButton, invokeUsingCtrlD];
@ -47,12 +47,7 @@ let currentInvoker = 0;
function initTest() {
// first, bookmark the page
let app = Components.classes["@mozilla.org/fuel/application;1"]
.getService(Components.interfaces.fuelIApplication);
let ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
app.bookmarks.toolbar.addBookmark("Bug 432599 Test",
ios.newURI("data:text/plain,Content", null, null));
Application.bookmarks.toolbar.addBookmark("Bug 432599 Test", makeURI(testURL));
checkBookmarksPanel(invokers[currentInvoker], 1);
}
@ -77,7 +72,7 @@ function checkBookmarksPanel(invoker, phase)
if (phase < 4) {
checkBookmarksPanel(invoker, phase + 1);
} else {
++ currentInvoker;
++currentInvoker;
if (currentInvoker < invokers.length) {
checkBookmarksPanel(invokers[currentInvoker], 1);
} else {

View File

@ -35,8 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
/*
* Test the fix for bug 441778 to ensure site-specific page zoom doesn't get
* modified by sub-document loads of content from a different domain.
@ -53,9 +51,8 @@ function test() {
let zoomLevel;
// Prepare the test tab
let testTab = gBrowser.addTab();
gBrowser.selectedTab = testTab;
let testBrowser = gBrowser.getBrowserForTab(testTab);
gBrowser.selectedTab = gBrowser.addTab();
let testBrowser = gBrowser.selectedBrowser;
let finishTest = function() {
testBrowser.removeProgressListener(progressListener);

View File

@ -1,6 +1,18 @@
function test() {
waitForExplicitFinish();
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
window) {
window.addEventListener("focus", function () {
window.removeEventListener("focus", arguments.callee, false);
test();
}, false);
window.focus();
return;
}
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
gBrowser.addTab();
gBrowser.addTab();
gBrowser.addTab();
@ -9,7 +21,7 @@ function test() {
ctrlTabTest([2] , 1, 0);
ctrlTabTest([2, 3, 1], 2, 2);
ctrlTabTest([] , 4, 2);
ctrlTabTest([] , 5, 2);
{
let selectedIndex = gBrowser.tabContainer.selectedIndex;
@ -27,9 +39,12 @@ function test() {
is(gBrowser.mTabs.length, tabs - 1, "Ctrl+Tab -> Ctrl+W removes one tab");
releaseCtrl();
}
assertTabs(3);
ctrlTabTest([2, 1, 0], 7, 1);
assertTabs(3);
ctrlTabTest([2, 1, 0], 9, 1);
gBrowser.addTab();
assertTabs(4);
{ // test for bug 445369
selectTabs([1, 2, 0]);
@ -49,12 +64,12 @@ function test() {
ok(gBrowser.selectedTab == selectedTab,
"Ctrl+Tab*2 -> Ctrl+W -> Ctrl+Shift+Tab*2 keeps the selected tab");
}
gBrowser.removeTab(gBrowser.tabContainer.lastChild);
assertTabs(2);
ctrlTabTest([1], 1, 0);
gBrowser.removeTab(gBrowser.tabContainer.lastChild);
assertTabs(1);
{ // test for bug 445768
@ -71,65 +86,10 @@ function test() {
"Ctrl+Tab doesn't change focus if one tab is open");
}
gBrowser.addTab();
gBrowser.addTab();
gBrowser.addTab();
assertTabs(4);
selectTabs([0, 1, 2, 3]);
pressCtrlTab();
ctrlTab.panel.addEventListener("popupshown", stickyTests, false);
function stickyTests() {
ctrlTab.panel.removeEventListener("popupshown", stickyTests, false);
EventUtils.synthesizeKey("f", { ctrlKey: true });
is(document.activeElement, ctrlTab.searchField.inputField,
"Ctrl+Tab -> Ctrl+F focuses the panel's search field");
releaseCtrl();
ok(isOpen(),
"panel is sticky after focusing the search field and releasing the Ctrl key");
EventUtils.synthesizeKey("f", {});
EventUtils.synthesizeKey("o", {});
EventUtils.synthesizeKey("o", {});
is(ctrlTab.searchField.value, "foo",
"text entered into search field");
EventUtils.synthesizeKey("VK_RETURN", {});
ok(isOpen(),
"Enter key kicks pending search off; the panel stays open as there's no match");
is(ctrlTab.searchField.value, "foo",
"search field value persists after Enter pressed");
EventUtils.synthesizeKey("VK_ESCAPE", {});
is(ctrlTab.searchField.value, "",
"ESC key clears the search field");
ok(isOpen(),
"Clearing the search field with ESC keeps the panel open");
// blur the search field
EventUtils.synthesizeKey("VK_TAB", {});
isnot(document.activeElement, ctrlTab.searchField.inputField,
"Tab key blurs the panel's search field");
// advance selection and close panel
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("VK_RETURN", {});
ok(!isOpen(),
"Enter key closes the panel");
is(gBrowser.tabContainer.selectedIndex, 1,
"Tab key advances the selection while the panel is sticky");
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
assertTabs(1);
finish();
}
// cleanup
gPrefService.clearUserPref("browser.ctrlTab.previews");
finish();
/* private utility functions */
@ -140,7 +100,7 @@ function test() {
EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" });
function isOpen()
ctrlTab.panel.state == "showing" || ctrlTab.panel.state == "open";
ctrlTab.isOpen;
function assertTabs(aTabs) {
var tabs = gBrowser.mTabs.length;

View File

@ -1,11 +1,7 @@
function url(spec) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ios.newURI(spec, null, null);
}
var gTestPage = null;
var gBrowserHandler;
var browser;
function doc() browser.contentDocument;
function setHandlerFunc(aResultFunc) {
DOMLinkHandler.handleEvent = function (event) {
@ -19,10 +15,14 @@ function test() {
ok(gBrowserHandler, "found browser handler");
waitForExplicitFinish();
var activeWin = Application.activeWindow;
gTestPage = activeWin.open(url("chrome://mochikit/content/browser/browser/base/content/test/discovery.html"));
gTestPage.focus();
setTimeout(iconDiscovery, 1000);
gBrowser.selectedTab = gBrowser.addTab();
browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function (event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
iconDiscovery();
}, true);
content.location = "chrome://mochikit/content/browser/browser/base/content/test/discovery.html";
}
var iconDiscoveryTests = [
@ -38,7 +38,7 @@ var iconDiscoveryTests = [
function runIconDiscoveryTest() {
var test = iconDiscoveryTests[0];
var head = gTestPage.document.getElementById("linkparent");
var head = doc().getElementById("linkparent");
var hasSrc = gProxyFavIcon.hasAttribute("src");
if (test.pass)
ok(hasSrc, test.text);
@ -56,8 +56,8 @@ function iconDiscovery() {
gProxyFavIcon.removeAttribute("src");
var test = iconDiscoveryTests[0];
var head = gTestPage.document.getElementById("linkparent");
var link = gTestPage.document.createElement("link");
var head = doc().getElementById("linkparent");
var link = doc().createElement("link");
var rel = test.rel || "icon";
var href = test.href || "chrome://mochikit/content/browser/browser/base/content/test/moz.png";
@ -91,7 +91,6 @@ var searchDiscoveryTests = [
];
function runSearchDiscoveryTest() {
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
var test = searchDiscoveryTests[0];
var title = test.title || searchDiscoveryTests.length;
if (browser.engines) {
@ -116,12 +115,11 @@ function runMultipleEnginesTestAndFinalize() {
ranOnce = true;
return;
}
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
ok(browser.engines, "has engines");
is(browser.engines.length, 1, "only one engine");
is(browser.engines[0].uri, "http://first.mozilla.com/search.xml", "first engine wins");
gTestPage.close();
gBrowser.removeCurrentTab();
// Reset the default link handler
DOMLinkHandler.handleEvent = gBrowserHandler;
@ -130,13 +128,12 @@ function runMultipleEnginesTestAndFinalize() {
}
function searchDiscovery() {
var head = gTestPage.document.getElementById("linkparent");
var browser = gBrowser.getBrowserForDocument(gTestPage.document);
var head = doc().getElementById("linkparent");
if (searchDiscoveryTests.length) {
setHandlerFunc(runSearchDiscoveryTest);
var test = searchDiscoveryTests[0];
var link = gTestPage.document.createElement("link");
var link = doc().createElement("link");
var rel = test.rel || "search";
var href = test.href || "http://so.not.here.mozilla.com/search.xml";
@ -153,7 +150,7 @@ function searchDiscovery() {
} else {
setHandlerFunc(runMultipleEnginesTestAndFinalize);
// Test multiple engines with the same title
var link = gTestPage.document.createElement("link");
var link = doc().createElement("link");
link.rel = "search";
link.href = "http://first.mozilla.com/search.xml";
link.type = "application/opensearchdescription+xml";

View File

@ -1,9 +1,3 @@
function makeURI(aURL, aOriginCharset, aBaseURI) {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ioService.newURI(aURL, aOriginCharset, aBaseURI);
}
function getPostDataString(aIS) {
if (!aIS)
return null;

View File

@ -1,13 +1,12 @@
// Bug 474792 - Clear "Never remember passwords for this site" when
// clearing site-specific settings in Clear Recent History dialog
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader)
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js");
function test() {
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
// Add a disabled host
pwmgr.setLoginSavingEnabled("http://example.com", false);
@ -20,9 +19,7 @@ function test() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch(s.prefDomain);
var itemPrefs = gPrefService.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);

View File

@ -1,14 +1,14 @@
// Bug 380852 - Delete permission manager entries in Clear Recent History
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader)
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js");
function test() {
// Add a permission entry
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
pm.add(uri("http://example.com"), "testing", Ci.nsIPermissionManager.ALLOW_ACTION);
var pm = Cc["@mozilla.org/permissionmanager;1"]
.getService(Ci.nsIPermissionManager);
pm.add(makeURI("http://example.com"), "testing", pm.ALLOW_ACTION);
// Sanity check
ok(pm.enumerator.hasMoreElements(), "Permission manager should have elements, since we just added one");
@ -17,9 +17,7 @@ function test() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch(s.prefDomain);
var itemPrefs = gPrefService.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);
@ -36,8 +34,3 @@ function test() {
// Make sure it's gone
ok(!pm.enumerator.hasMoreElements(), "Permission manager shouldn't have entries after Sanitizing");
}
function uri(spec) {
return Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
.newURI(spec, null, null);
}

View File

@ -3,10 +3,9 @@ var now_uSec = Date.now() * 1000;
const dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
const bhist = Cc["@mozilla.org/browser/global-history;2"].getService(Ci.nsIBrowserHistory);
const iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
const formhist = Cc["@mozilla.org/satchel/form-history;1"].getService(Ci.nsIFormHistory2);
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader)
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js");
function test() {
@ -24,9 +23,7 @@ function test() {
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
var itemPrefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch(s.prefDomain);
var itemPrefs = gPrefService.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", true);
itemPrefs.setBoolPref("downloads", true);
itemPrefs.setBoolPref("cache", false);
@ -42,17 +39,17 @@ function test() {
s.sanitize();
s.range = null;
ok(!bhist.isVisited(uri("http://10minutes.com")), "10minutes.com should now be deleted");
ok(bhist.isVisited(uri("http://1hour.com")), "Pretend visit to 1hour.com should still exist");
ok(bhist.isVisited(uri("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(uri("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://10minutes.com")), "10minutes.com should now be deleted");
ok(bhist.isVisited(makeURI("http://1hour.com")), "Pretend visit to 1hour.com should still exist");
ok(bhist.isVisited(makeURI("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(minutesSinceMidnight > 10)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("10minutes"), "10minutes form entry should be deleted");
ok(formhist.nameExists("1hour"), "1hour form entry should still exist");
@ -81,16 +78,16 @@ function test() {
Sanitizer.prefs.setIntPref("timeSpan", 1);
s.sanitize();
ok(!bhist.isVisited(uri("http://1hour.com")), "1hour.com should now be deleted");
ok(bhist.isVisited(uri("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(uri("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://1hour.com")), "1hour.com should now be deleted");
ok(bhist.isVisited(makeURI("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(hoursSinceMidnight > 1)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("1hour"), "1hour form entry should be deleted");
ok(formhist.nameExists("1hour10minutes"), "1hour10minutes form entry should still exist");
@ -118,14 +115,14 @@ function test() {
s.sanitize();
s.range = null;
ok(!bhist.isVisited(uri("http://1hour10minutes.com")), "Pretend visit to 1hour10minutes.com should now be deleted");
ok(bhist.isVisited(uri("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(uri("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://1hour10minutes.com")), "Pretend visit to 1hour10minutes.com should now be deleted");
ok(bhist.isVisited(makeURI("http://2hour.com")), "Pretend visit to 2hour.com should still exist");
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(minutesSinceMidnight > 70)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("1hour10minutes"), "1hour10minutes form entry should be deleted");
ok(formhist.nameExists("2hour"), "2hour form entry should still exist");
@ -149,13 +146,13 @@ function test() {
Sanitizer.prefs.setIntPref("timeSpan", 2);
s.sanitize();
ok(!bhist.isVisited(uri("http://2hour.com")), "Pretend visit to 2hour.com should now be deleted");
ok(bhist.isVisited(uri("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://2hour.com")), "Pretend visit to 2hour.com should now be deleted");
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(hoursSinceMidnight > 2)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("2hour"), "2hour form entry should be deleted");
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
@ -179,12 +176,12 @@ function test() {
s.sanitize();
s.range = null;
ok(!bhist.isVisited(uri("http://2hour10minutes.com")), "Pretend visit to 2hour10minutes.com should now be deleted");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://2hour10minutes.com")), "Pretend visit to 2hour10minutes.com should now be deleted");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(minutesSinceMidnight > 130)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should be deleted");
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
@ -204,11 +201,11 @@ function test() {
Sanitizer.prefs.setIntPref("timeSpan", 3);
s.sanitize();
ok(!bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should now be deleted");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
ok(!bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should now be deleted");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
if(hoursSinceMidnight > 4)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("4hour"), "4hour form entry should be deleted");
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
@ -227,10 +224,10 @@ function test() {
s.sanitize();
s.range = null;
ok(!bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should now be deleted");
ok(!bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should now be deleted");
if(minutesSinceMidnight > 250)
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should be deleted");
if(minutesSinceMidnight > 250)
@ -246,8 +243,8 @@ function test() {
Sanitizer.prefs.setIntPref("timeSpan", 4);
s.sanitize();
ok(!bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should now be deleted");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should now be deleted");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("today"), "today form entry should be deleted");
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
@ -259,7 +256,7 @@ function test() {
Sanitizer.prefs.setIntPref("timeSpan", 0);
s.sanitize();
ok(!bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should now be deleted");
ok(!bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should now be deleted");
ok(!formhist.nameExists("b4today"), "b4today form entry should be deleted");
@ -268,34 +265,34 @@ function test() {
}
function setupHistory() {
bhist.addPageWithDetails(uri("http://10minutes.com/"), "10 minutes ago", now_uSec - 10*60*1000000);
bhist.addPageWithDetails(uri("http://1hour.com/"), "Less than 1 hour ago", now_uSec - 45*60*1000000);
bhist.addPageWithDetails(uri("http://1hour10minutes.com/"), "1 hour 10 minutes ago", now_uSec - 70*60*1000000);
bhist.addPageWithDetails(uri("http://2hour.com/"), "Less than 2 hours ago", now_uSec - 90*60*1000000);
bhist.addPageWithDetails(uri("http://2hour10minutes.com/"), "2 hours 10 minutes ago", now_uSec - 130*60*1000000);
bhist.addPageWithDetails(uri("http://4hour.com/"), "Less than 4 hours ago", now_uSec - 180*60*1000000);
bhist.addPageWithDetails(uri("http://4hour10minutes.com/"), "4 hours 10 minutesago", now_uSec - 250*60*1000000);
bhist.addPageWithDetails(makeURI("http://10minutes.com/"), "10 minutes ago", now_uSec - 10*60*1000000);
bhist.addPageWithDetails(makeURI("http://1hour.com/"), "Less than 1 hour ago", now_uSec - 45*60*1000000);
bhist.addPageWithDetails(makeURI("http://1hour10minutes.com/"), "1 hour 10 minutes ago", now_uSec - 70*60*1000000);
bhist.addPageWithDetails(makeURI("http://2hour.com/"), "Less than 2 hours ago", now_uSec - 90*60*1000000);
bhist.addPageWithDetails(makeURI("http://2hour10minutes.com/"), "2 hours 10 minutes ago", now_uSec - 130*60*1000000);
bhist.addPageWithDetails(makeURI("http://4hour.com/"), "Less than 4 hours ago", now_uSec - 180*60*1000000);
bhist.addPageWithDetails(makeURI("http://4hour10minutes.com/"), "4 hours 10 minutesago", now_uSec - 250*60*1000000);
let today = new Date();
today.setHours(0);
today.setMinutes(0);
today.setSeconds(30);
bhist.addPageWithDetails(uri("http://today.com/"), "Today", today.valueOf() * 1000);
bhist.addPageWithDetails(makeURI("http://today.com/"), "Today", today.valueOf() * 1000);
let lastYear = new Date();
lastYear.setFullYear(lastYear.getFullYear() - 1);
bhist.addPageWithDetails(uri("http://before-today.com/"), "Before Today", lastYear.valueOf() * 1000);
bhist.addPageWithDetails(makeURI("http://before-today.com/"), "Before Today", lastYear.valueOf() * 1000);
// Confirm everything worked
ok(bhist.isVisited(uri("http://10minutes.com/")), "Pretend visit to 10minutes.com should exist");
ok(bhist.isVisited(uri("http://1hour.com")), "Pretend visit to 1hour.com should exist");
ok(bhist.isVisited(uri("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should exist");
ok(bhist.isVisited(uri("http://2hour.com")), "Pretend visit to 2hour.com should exist");
ok(bhist.isVisited(uri("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should exist");
ok(bhist.isVisited(uri("http://4hour.com")), "Pretend visit to 4hour.com should exist");
ok(bhist.isVisited(uri("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should exist");
ok(bhist.isVisited(uri("http://today.com")), "Pretend visit to today.com should exist");
ok(bhist.isVisited(uri("http://before-today.com")), "Pretend visit to before-today.com should exist");
ok(bhist.isVisited(makeURI("http://10minutes.com/")), "Pretend visit to 10minutes.com should exist");
ok(bhist.isVisited(makeURI("http://1hour.com")), "Pretend visit to 1hour.com should exist");
ok(bhist.isVisited(makeURI("http://1hour10minutes.com/")), "Pretend visit to 1hour10minutes.com should exist");
ok(bhist.isVisited(makeURI("http://2hour.com")), "Pretend visit to 2hour.com should exist");
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should exist");
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should exist");
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should exist");
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should exist");
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should exist");
}
function setupFormHistory() {
@ -598,7 +595,3 @@ function downloadExists(aID)
stmt.finalize();
return rows;
}
function uri(spec) {
return iosvc.newURI(spec, null, null);
}

View File

@ -63,8 +63,6 @@ const dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
const bhist = Cc["@mozilla.org/browser/global-history;2"].
getService(Ci.nsIBrowserHistory);
const iosvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
const formhist = Cc["@mozilla.org/satchel/form-history;1"].
getService(Ci.nsIFormHistory2);
@ -608,7 +606,7 @@ function addFormEntryWithMinutesAgo(aMinutesAgo) {
* The visit will be visited this many minutes ago
*/
function addHistoryWithMinutesAgo(aMinutesAgo) {
let pURI = uri("http://" + aMinutesAgo + "-minutes-ago.com/");
let pURI = makeURI("http://" + aMinutesAgo + "-minutes-ago.com/");
bhist.addPageWithDetails(pURI,
aMinutesAgo + " minutes ago",
now_uSec - (aMinutesAgo * 60 * 1000 * 1000));
@ -638,10 +636,7 @@ function blankSlate() {
* Passed to is()
*/
function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
let prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).
getBranch("privacy.");
is(prefs.getBoolPref(aPrefName), aExpectedVal, aMsg);
is(gPrefService.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
/**
@ -740,17 +735,7 @@ function ensureHistoryClearedState(aURIs, aShouldBeCleared) {
* Passed to is()
*/
function intPrefIs(aPrefName, aExpectedVal, aMsg) {
let prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).
getBranch("privacy.");
is(prefs.getIntPref(aPrefName), aExpectedVal, aMsg);
}
/**
* @return A new nsIURI from aSpec.
*/
function uri(aSpec) {
return iosvc.newURI(aSpec, null, null);
is(gPrefService.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -63,8 +63,6 @@ const dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
const bhist = Cc["@mozilla.org/browser/global-history;2"].
getService(Ci.nsIBrowserHistory);
const iosvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
const formhist = Cc["@mozilla.org/satchel/form-history;1"].
getService(Ci.nsIFormHistory2);
@ -509,7 +507,7 @@ function addFormEntryWithMinutesAgo(aMinutesAgo) {
* The visit will be visited this many minutes ago
*/
function addHistoryWithMinutesAgo(aMinutesAgo) {
let pURI = uri("http://" + aMinutesAgo + "-minutes-ago.com/");
let pURI = makeURI("http://" + aMinutesAgo + "-minutes-ago.com/");
bhist.addPageWithDetails(pURI,
aMinutesAgo + " minutes ago",
now_uSec - (aMinutesAgo * 60 * 1000 * 1000));
@ -652,13 +650,6 @@ function openWindow(aOnloadCallback) {
null);
}
/**
* @return A new nsIURI from aSpec.
*/
function uri(aSpec) {
return iosvc.newURI(aSpec, null, null);
}
///////////////////////////////////////////////////////////////////////////////
function test() {

View File

@ -4,13 +4,17 @@
let testPage1 = "data:text/html,<html id='tab1'><body><button id='button1'>Tab 1</button></body></html>";
let testPage2 = "data:text/html,<html id='tab2'><body><button id='button2'>Tab 2</button></body></html>";
let testPage3 = "data:text/html,<html id='tab3'><body><button id='button3'>Tab 3</button></body></html>";
var browser1;
function test() {
waitForExplicitFinish();
var tab1 = gBrowser.addTab();
browser1 = gBrowser.getBrowserForTab(tab1);
var tab2 = gBrowser.addTab();
var browser1 = gBrowser.getBrowserForTab(tab1);
var browser2 = gBrowser.getBrowserForTab(tab2);
gURLBar.focus();
@ -119,10 +123,15 @@ function test() {
expectFocusShift(function () gBrowser.selectedTab = tab1,
browser1.contentWindow, null, true,
"focusedWindow after tab switch from no focus to no focus");
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
finish();
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
// next, check whether navigating forward, focusing the urlbar and then
// navigating back maintains the focus in the urlbar.
browser1.addEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
button1.focus();
browser1.contentWindow.location = testPage3;
}
browser1.addEventListener("load", check, true);
@ -152,6 +161,24 @@ function _browser_tabfocus_test_eventOccured(event)
_browser_tabfocus_test_events += event.type + ": " + id;
}
function _browser_tabfocus_navigation_test_eventOccured(event)
{
if (event.target instanceof Document) {
var contentwin = event.target.defaultView;
if (contentwin.location.toString().indexOf("3") > 0) {
// just moved forward, so focus the urlbar and go back
gURLBar.focus();
setTimeout(function () contentwin.history.back(), 0);
}
else if (contentwin.location.toString().indexOf("2") > 0) {
is(window.document.activeElement, gURLBar.inputField, "urlbar still focused after navigating back");
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
finish();
}
}
}
function getId(element)
{
return (element.localName == "input") ? "urlbar" : element.id;

View File

@ -283,10 +283,8 @@
if (val == this.value &&
this.getAttribute("pageproxystate") == "valid") {
let uri;
let ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
try {
uri = ioService.newURI(val, null, null);
uri = makeURI(val);
} catch (e) {}
if (uri && !uri.schemeIs("javascript") && !uri.schemeIs("data")) {
@ -387,10 +385,7 @@
<setter>
<![CDATA[
try {
let uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(val, null, null);
val = losslessDecodeURI(uri);
val = losslessDecodeURI(makeURI(val));
} catch (ex) { }
this.value = val;

View File

@ -47,8 +47,6 @@
%browserDTD;
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd">
%textcontextDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<page id="webpanels-window"

View File

@ -60,14 +60,6 @@ browser.jar:
* content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul)
#endif
* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul)
#ifdef MOZ_USE_GENERIC_BRANDING
% content branding %content/branding/ xpcnativewrappers=yes
content/branding/about.png (branding/about.png)
content/branding/aboutCredits.png (branding/aboutCredits.png)
content/branding/aboutFooter.png (branding/aboutFooter.png)
content/branding/icon48.png (branding/icon48.png)
content/branding/icon64.png (branding/icon64.png)
#endif
# the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html

View File

@ -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, Inc.
# Portions created by the Initial Developer are Copyright (C) 2001
# 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):
# Justin Dolske <dolske@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,58 +34,68 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = mozEmbed
PROGRAM = mozEmbed$(BIN_SUFFIX)
RESFILE = $(MODULE).res
MOZILLA_INTERNAL_API = 1
DIRS = \
content \
locales \
$(NULL)
REQUIRES = xpcom \
string \
embed_base \
webbrwsr \
webshell \
windowwatcher \
profile \
necko \
docshell \
dom \
widget \
uriloader \
shistory \
webbrowserpersist \
gfx \
mozEmbed \
$(NULL)
CPPSRCS = nsQABrowserView.cpp \
nsQABrowserChrome.cpp \
nsQABrowserModule.cpp \
nsQAWindowCreator.cpp \
mozEmbed.cpp \
StdAfx.cpp \
$(NULL)
EXTRA_DSO_LIBS = embed_base_s gkgfx
LIBS = \
$(EXTRA_DSO_LIBS) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
OS_LIBS += \
ole32.lib \
comdlg32.lib \
shell32.lib \
version.lib \
$(NULL)
PREF_JS_EXPORTS = $(srcdir)/pref/firefox-branding.js
include $(topsrcdir)/config/rules.mk
WINDOWS_BRANDING_FILES = \
firefox.ico \
document.ico \
branding.nsi \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
$(NULL)
ifdef MOZ_SPLASHSCREEN
WINDOWS_BRANDING_FILES += splash.bmp
endif
OSX_BRANDING_FILES = \
background.png \
firefox.icns \
disk.icns \
document.icns \
dsstore \
$(NULL)
LINUX_BRANDING_FILES = \
default16.png \
default32.png \
default48.png \
document.png \
mozicon128.png \
$(NULL)
OS2_BRANDING_FILES = \
firefox-os2.ico \
document-os2.ico \
$(NULL)
export::
$(NSINSTALL) -D $(DIST)/branding
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
cp $(addprefix $(srcdir)/, $(WINDOWS_BRANDING_FILES)) $(DIST)/branding/
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
cp $(addprefix $(srcdir)/, $(OSX_BRANDING_FILES)) $(DIST)/branding/
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
cp $(addprefix $(srcdir)/, $(LINUX_BRANDING_FILES)) $(DIST)/branding/
$(NSINSTALL) -D $(DIST)/install
endif
ifeq ($(OS_ARCH),OS2)
cp $(addprefix $(srcdir)/, $(OS2_BRANDING_FILES)) $(DIST)/branding/
endif

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
browser/branding/nightly/configure.sh Executable file → Normal file
View File

View File

@ -0,0 +1,11 @@
# Branding Makefile
# - jars chrome artwork
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,7 @@
browser.jar:
% content branding %content/branding/ xpcnativewrappers=yes
content/branding/about.png (about.png)
content/branding/aboutCredits.png (aboutCredits.png)
content/branding/aboutFooter.png (aboutFooter.png)
content/branding/icon48.png (icon48.png)
content/branding/icon64.png (icon64.png)

View File

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 722 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -11,10 +11,10 @@
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla QA Tests.
# The Original Code is the Mozilla Browser code.
#
# The Initial Developer of the Original Code is
# Josh Soref.
# Benjamin Smedberg <benjamin@smedbergs.us>
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
@ -34,13 +34,22 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/branding/nightly/locales
include $(DEPTH)/config/autoconf.mk
DIRS=mozembed testembed/components testembed
DEFINES += -DAB_CD=$(AB_CD) -DMOZ_DISTRIBUTION_ID_UNQUOTED=$(MOZ_DISTRIBUTION_ID)
include $(topsrcdir)/config/rules.mk
libs::
@$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
$(srcdir)/browserconfig.properties > $(FINAL_TARGET)/browserconfig.properties
install::
@$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
$(srcdir)/browserconfig.properties > $(DESTDIR)$(mozappdir)/browserconfig.properties

View File

@ -0,0 +1,6 @@
#filter substitution
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
locale/branding/brand.dtd (%brand.dtd)
* locale/branding/brand.properties (%brand.properties)

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -1,7 +1,38 @@
# Branding Makefile
# - jars chrome artwork
# - copies artwork to appropriate places in objdir for bundling into app
# resources
# ***** 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):
# Justin Dolske <dolske@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
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
@ -19,40 +50,52 @@ PREF_JS_EXPORTS = $(srcdir)/pref/firefox-branding.js
include $(topsrcdir)/config/rules.mk
BROWSER_APP_FILES = \
WINDOWS_BRANDING_FILES = \
firefox.ico \
document.ico \
branding.nsi \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
$(NULL)
ifdef MOZ_SPLASHSCREEN
WINDOWS_BRANDING_FILES += splash.bmp
endif
OSX_BRANDING_FILES = \
background.png \
firefox.icns \
disk.icns \
document.icns \
dsstore \
$(NULL)
LINUX_BRANDING_FILES = \
default16.png \
default32.png \
default48.png \
document.png \
mozicon128.png \
firefox.ico \
document.ico \
$(NULL)
OS2_BRANDING_FILES = \
firefox-os2.ico \
document-os2.ico \
$(NULL)
export::
$(NSINSTALL) -D $(DIST)/branding
cp $(addprefix $(srcdir)/, $(BROWSER_APP_FILES)) $(DIST)/branding/
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
cp $(srcdir)/document.png $(DIST)/branding/document.png
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
cp $(addprefix $(srcdir)/, $(WINDOWS_BRANDING_FILES)) $(DIST)/branding/
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
cp $(addprefix $(srcdir)/, $(OSX_BRANDING_FILES)) $(DIST)/branding/
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
cp $(addprefix $(srcdir)/, $(LINUX_BRANDING_FILES)) $(DIST)/branding/
$(NSINSTALL) -D $(DIST)/install
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
cp $(srcdir)/firefox.icns $(DIST)/branding/firefox.icns
cp $(srcdir)/document.icns $(DIST)/branding/document.icns
cp $(srcdir)/dsstore $(DIST)/branding/dsstore
cp $(srcdir)/background.png $(DIST)/branding/background.png
cp $(srcdir)/disk.icns $(DIST)/branding/disk.icns
endif
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
cp $(srcdir)/firefox.ico $(DIST)/branding/app.ico
endif
ifeq ($(OS_ARCH),WINNT)
cp $(srcdir)/branding.nsi $(DIST)/branding/branding.nsi
cp $(srcdir)/wizHeader.bmp $(DIST)/branding/wizHeader.bmp
cp $(srcdir)/wizHeaderRTL.bmp $(DIST)/branding/wizHeaderRTL.bmp
cp $(srcdir)/wizWatermark.bmp $(DIST)/branding/wizWatermark.bmp
endif
ifeq ($(OS_ARCH),OS2)
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/firefox.ico
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/app.ico
cp $(srcdir)/document-os2.ico $(DIST)/branding/document.ico
cp $(addprefix $(srcdir)/, $(OS2_BRANDING_FILES)) $(DIST)/branding/
endif

0
browser/branding/unofficial/configure.sh Executable file → Normal file
View File

0
browser/branding/unofficial/dsstore Executable file → Normal file
View File

View File

@ -2,6 +2,5 @@
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
# Unofficial branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
* locale/branding/brand.properties (en-US/brand.properties)
locale/branding/brand.dtd (%brand.dtd)
* locale/branding/brand.properties (%brand.properties)

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

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