From 6408e439017528b2a4084e90fcb9c440c1d52526 Mon Sep 17 00:00:00 2001 From: Rich Walsh Date: Wed, 2 Feb 2011 13:51:22 -0500 Subject: [PATCH 001/229] Bug 611934 - OS/2 - implement fallocate() and fix build break; r=taras a=bsmedberg --HG-- extra : rebase_source : fa550cc278888ae6b6cb0a36875b1287ebdd6bc3 --- xpcom/glue/FileUtils.cpp | 6 ++++++ xpcom/glue/FileUtils.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp index 85d0980fa63..670a5d2c745 100644 --- a/xpcom/glue/FileUtils.cpp +++ b/xpcom/glue/FileUtils.cpp @@ -42,6 +42,9 @@ #include #elif defined(XP_WIN) #include +#elif defined(XP_OS2) +#define INCL_DOSFILEMGR +#include #endif #include "nscore.h" @@ -67,6 +70,9 @@ mozilla::fallocate(PRFileDesc *aFD, PRInt64 aLength) PR_Seek64(aFD, oldpos, PR_SEEK_SET); return retval; +#elif defined(XP_OS2) + return aLength <= PR_UINT32_MAX + && 0 == DosSetFileSize(PR_FileDesc2NativeHandle(aFD), (PRUint32)aLength); #elif defined(XP_MACOSX) int fd = PR_FileDesc2NativeHandle(aFD); fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength}; diff --git a/xpcom/glue/FileUtils.h b/xpcom/glue/FileUtils.h index a64ed91fd82..d3413d8c4c0 100644 --- a/xpcom/glue/FileUtils.h +++ b/xpcom/glue/FileUtils.h @@ -40,7 +40,7 @@ #ifndef mozilla_FileUtils_h #define mozilla_FileUtils_h -#if defined(XP_UNIX) +#if defined(XP_UNIX) || defined(XP_OS2) # include #elif defined(XP_WIN) # include From 0089c7b2bffbaffe413f2c9ba6d4d83678a82cee Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 26 Dec 2010 14:27:50 -0500 Subject: [PATCH 002/229] Bug 621386 - Clean up all ContentParent observers and listeners on actor destruction and xpcom-shutdown. r,a=bsmedberg --HG-- extra : rebase_source : 49f50817a9b8dcada7adb9bd770464b722dd39ae --- dom/ipc/ContentParent.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 43e6099b5a0..34cdd2380b4 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -165,8 +165,23 @@ ContentParent::ActorDestroy(ActorDestroyReason why) kungFuDeathGrip(static_cast(this)); nsCOMPtr obs(do_GetService("@mozilla.org/observer-service;1")); - if (obs) + if (obs) { obs->RemoveObserver(static_cast(this), "xpcom-shutdown"); + obs->RemoveObserver(static_cast(this), "memory-pressure"); + obs->RemoveObserver(static_cast(this), + NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC); + } + + // remove the global remote preferences observers + nsCOMPtr prefs + (do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + prefs->RemoveObserver("", this); + } + + RecvRemoveGeolocationListener(); + RecvRemoveAccelerometerListener(); + nsCOMPtr threadInt(do_QueryInterface(NS_GetCurrentThread())); if (threadInt) @@ -347,17 +362,6 @@ ContentParent::Observe(nsISupports* aSubject, const PRUnichar* aData) { if (!strcmp(aTopic, "xpcom-shutdown") && mSubprocess) { - // remove the global remote preferences observers - nsCOMPtr prefs - (do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefs) { - if (gSingleton) { - prefs->RemoveObserver("", this); - } - } - - RecvRemoveGeolocationListener(); - Close(); NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess"); } From 76276f10a9f2dab7188274b2b40bd39a3dd6cd99 Mon Sep 17 00:00:00 2001 From: Kevin Gadd Date: Mon, 31 Jan 2011 18:41:58 -0800 Subject: [PATCH 003/229] bug 629838 - After incrementing mozPaintCount during an empty transaction, also dispatch MozAfterPaint; r=roc a=blocking-final+ --HG-- extra : rebase_source : 91e6eb9b0d12b5c82363d4c4ce6914fef9bcf007 --- layout/base/nsPresShell.cpp | 1 + layout/base/tests/Makefile.in | 1 + layout/base/tests/test_bug629838.html | 91 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 layout/base/tests/test_bug629838.html diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 8bd1381c920..3b041bfa11e 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -6146,6 +6146,7 @@ PresShell::Paint(nsIView* aDisplayRoot, if (!(frame->GetStateBits() & NS_FRAME_UPDATE_LAYER_TREE)) { if (layerManager->EndEmptyTransaction()) { frame->UpdatePaintCountForPaintedPresShells(); + presContext->NotifyDidPaintForSubtree(); return NS_OK; } diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 2ff1a4b5b9c..e7f3e50a006 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -143,6 +143,7 @@ _TEST_FILES = \ test_scroll_selection_into_view.html \ test_bug582771.html \ test_bug603550.html \ + test_bug629838.html \ $(NULL) # Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208 diff --git a/layout/base/tests/test_bug629838.html b/layout/base/tests/test_bug629838.html new file mode 100644 index 00000000000..0bc96d1da26 --- /dev/null +++ b/layout/base/tests/test_bug629838.html @@ -0,0 +1,91 @@ + + + + Tests for MozAfterPaint + + + + + +

+ +

+ +
+
+
+ +
+first
link
+second link +third
link
+
+ + + + From 2e7a11131d3015c89d922fba273867554e3e1a62 Mon Sep 17 00:00:00 2001 From: "timeless@mozdev.org" Date: Sun, 11 Jul 2010 15:42:47 +0300 Subject: [PATCH 004/229] Bug 577913 mark DEBUG only variables as ifdef DEBUG in xpconnect; r=mrbkap a=jst --HG-- extra : rebase_source : ce14e3eb2ea17a5350cbb85af355b89c5d002fce --- js/src/xpconnect/src/xpcwrappednativeinfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/src/xpconnect/src/xpcwrappednativeinfo.cpp b/js/src/xpconnect/src/xpcwrappednativeinfo.cpp index d06b34c1d10..a579db3045a 100644 --- a/js/src/xpconnect/src/xpcwrappednativeinfo.cpp +++ b/js/src/xpconnect/src/xpcwrappednativeinfo.cpp @@ -661,7 +661,11 @@ XPCNativeSet::GetNewOrUsed(XPCCallContext& ccx, nsIClassInfo* classInfo) if(set) { // scoped lock XPCAutoLock lock(rt->GetMapLock()); - XPCNativeSet* set2 = map->Add(classInfo, set); + +#ifdef DEBUG + XPCNativeSet* set2 = +#endif + map->Add(classInfo, set); NS_ASSERTION(set2, "failed to add our set!"); NS_ASSERTION(set2 == set, "hashtables inconsistent!"); } From efb9033112bf17912de7448c5694accba23e6a77 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Thu, 3 Feb 2011 20:13:18 -0800 Subject: [PATCH 005/229] Bug 629331 - Fix handling of class getters with slotful values. r=gal, r=brendan, a=blocker try: -b do -p linux,win32 -u all --- js/src/jsproxy.cpp | 38 ++++++++++++++----- js/src/xpconnect/tests/mochitest/Makefile.in | 3 ++ .../tests/mochitest/test1_bug629331.html | 19 ++++++++++ .../tests/mochitest/test2_bug629331.html | 18 +++++++++ .../tests/mochitest/test_bug629331.html | 38 +++++++++++++++++++ 5 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 js/src/xpconnect/tests/mochitest/test1_bug629331.html create mode 100644 js/src/xpconnect/tests/mochitest/test2_bug629331.html create mode 100644 js/src/xpconnect/tests/mochitest/test_bug629331.html diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 9ea6a34ec1d..102d8684678 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -148,27 +148,45 @@ JSProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, return false; /* The control-flow here differs from ::get() because of the fall-through case below. */ if (desc.obj) { - if (desc.setter && ((desc.attrs & JSPROP_SETTER) || desc.setter != PropertyStub)) - return CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, vp); if (desc.attrs & JSPROP_READONLY) return true; + if (desc.setter && ((desc.attrs & JSPROP_SETTER) || desc.setter != PropertyStub)) { + if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, vp)) + return false; + if (desc.attrs & JSPROP_SHARED) + return true; + } + if (!desc.getter) + desc.getter = PropertyStub; + if (!desc.setter) + desc.setter = PropertyStub; desc.value = *vp; return defineProperty(cx, receiver, id, &desc); } if (!getPropertyDescriptor(cx, proxy, id, true, &desc)) return false; if (desc.obj) { - if (desc.setter && ((desc.attrs & JSPROP_SETTER) || desc.setter != PropertyStub)) - return CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, vp); if (desc.attrs & JSPROP_READONLY) return true; + if (desc.setter && ((desc.attrs & JSPROP_SETTER) || desc.setter != PropertyStub)) { + if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, vp)) + return false; + if (desc.attrs & JSPROP_SHARED) + return true; + } + if (!desc.getter) + desc.getter = PropertyStub; + if (!desc.setter) + desc.setter = PropertyStub; /* fall through */ + } else { + /* Pick up the class getter/setter. */ + desc.getter = desc.setter = NULL; } + desc.obj = receiver; desc.value = *vp; desc.attrs = JSPROP_ENUMERATE; - desc.getter = NULL; - desc.setter = NULL; desc.shortid = 0; return defineProperty(cx, receiver, id, &desc); } @@ -497,8 +515,8 @@ JSScriptedProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy, js return GetFundamentalTrap(cx, handler, ATOM(getPropertyDescriptor), tvr.addr()) && Trap1(cx, handler, tvr.value(), id, tvr.addr()) && ((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) || - ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && - ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc)); + (ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && + ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc))); } bool @@ -510,8 +528,8 @@ JSScriptedProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyDescriptor), tvr.addr()) && Trap1(cx, handler, tvr.value(), id, tvr.addr()) && ((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) || - ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && - ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc)); + (ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && + ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc))); } bool diff --git a/js/src/xpconnect/tests/mochitest/Makefile.in b/js/src/xpconnect/tests/mochitest/Makefile.in index 9980a9b39ee..de99de66ad0 100644 --- a/js/src/xpconnect/tests/mochitest/Makefile.in +++ b/js/src/xpconnect/tests/mochitest/Makefile.in @@ -79,6 +79,9 @@ _TEST_FILES = bug500931_helper.html \ bug589028_helper.html \ test_bug605167.html \ test_bug601299.html \ + test_bug629331.html \ + test1_bug629331.html \ + test2_bug629331.html \ $(NULL) #test_bug484107.html \ diff --git a/js/src/xpconnect/tests/mochitest/test1_bug629331.html b/js/src/xpconnect/tests/mochitest/test1_bug629331.html new file mode 100644 index 00000000000..ec1d1a3b171 --- /dev/null +++ b/js/src/xpconnect/tests/mochitest/test1_bug629331.html @@ -0,0 +1,19 @@ + + + + + diff --git a/js/src/xpconnect/tests/mochitest/test2_bug629331.html b/js/src/xpconnect/tests/mochitest/test2_bug629331.html new file mode 100644 index 00000000000..1bcf0373988 --- /dev/null +++ b/js/src/xpconnect/tests/mochitest/test2_bug629331.html @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/js/src/xpconnect/tests/mochitest/test_bug629331.html b/js/src/xpconnect/tests/mochitest/test_bug629331.html new file mode 100644 index 00000000000..975200caf26 --- /dev/null +++ b/js/src/xpconnect/tests/mochitest/test_bug629331.html @@ -0,0 +1,38 @@ + + + + + Test for Bug 629331 + + + + + +Mozilla Bug 629331 +

+ +
+
+
+
+ + From 2ed880aa63f0d247defd7ed51f598687be12772c Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Wed, 2 Feb 2011 22:05:07 -0800 Subject: [PATCH 006/229] Bug 630716 - Use a better method of comparing URIs for determining whether two compartments are same origin. r=bzbarsky, r=gal, a=blocker --- js/src/xpconnect/wrappers/AccessCheck.cpp | 13 +++++++++++-- js/src/xpconnect/wrappers/AccessCheck.h | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/js/src/xpconnect/wrappers/AccessCheck.cpp b/js/src/xpconnect/wrappers/AccessCheck.cpp index 24075f93ea4..492097a4b46 100644 --- a/js/src/xpconnect/wrappers/AccessCheck.cpp +++ b/js/src/xpconnect/wrappers/AccessCheck.cpp @@ -71,8 +71,17 @@ AccessCheck::isSameOrigin(JSCompartment *a, JSCompartment *b) if (!aprin || !bprin) return true; - PRBool cond; - return NS_SUCCEEDED(aprin->Equals(bprin, &cond)) && cond; + nsCOMPtr auri; + aprin->GetURI(getter_AddRefs(auri)); + + nsCOMPtr buri; + bprin->GetURI(getter_AddRefs(buri)); + + if (!auri || !buri) + return aprin == bprin; + + nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager(); + return !ssm || NS_SUCCEEDED(ssm->CheckSameOriginURI(auri, buri, PR_FALSE)); } bool diff --git a/js/src/xpconnect/wrappers/AccessCheck.h b/js/src/xpconnect/wrappers/AccessCheck.h index 8074ee440f1..66bf647f5b5 100644 --- a/js/src/xpconnect/wrappers/AccessCheck.h +++ b/js/src/xpconnect/wrappers/AccessCheck.h @@ -121,7 +121,8 @@ struct SameOriginOrCrossOriginAccessiblePropertiesOnly : public Policy { static bool check(JSContext *cx, JSObject *wrapper, jsid id, JSWrapper::Action act, Permission &perm) { if (AccessCheck::isCrossOriginAccessPermitted(cx, wrapper, id, act) || - AccessCheck::isLocationObjectSameOrigin(cx, wrapper)) { + AccessCheck::isLocationObjectSameOrigin(cx, wrapper) || + AccessCheck::documentDomainMakesSameOrigin(cx, wrapper->unwrap())) { perm = PermitPropertyAccess; return true; } From 67c611e623c506c3ace4be858d4183aa02ac29ea Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 4 Feb 2011 09:00:06 +0100 Subject: [PATCH 007/229] Bug 607464 - Don't use smooth scrolling for pixel scrolling. r=roc, a=roc --- content/events/src/nsEventStateManager.cpp | 14 ++- content/events/test/Makefile.in | 1 + content/events/test/test_bug607464.html | 108 +++++++++++++++++++++ layout/generic/nsGfxScrollFrame.cpp | 3 +- layout/generic/nsIScrollableFrame.h | 13 +-- 5 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 content/events/test/test_bug607464.html diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index c8c2a7640ed..a3939281914 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2672,12 +2672,18 @@ nsEventStateManager::DoScrollText(nsIFrame* aTargetFrame, scrollY = 0; } - PRBool noDefer = aMouseEvent->scrollFlags & nsMouseScrollEvent::kNoDefer; + nsIScrollableFrame::ScrollMode mode; + if (aMouseEvent->scrollFlags & nsMouseScrollEvent::kNoDefer) { + mode = nsIScrollableFrame::INSTANT; + } else if (aScrollQuantity != nsIScrollableFrame::DEVICE_PIXELS) { + mode = nsIScrollableFrame::SMOOTH; + } else { + mode = nsIScrollableFrame::NORMAL; + } + nsIntPoint overflow; frameToScroll->ScrollBy(nsIntPoint(scrollX, scrollY), aScrollQuantity, - noDefer ? nsIScrollableFrame::INSTANT - : nsIScrollableFrame::SMOOTH, - &overflow); + mode, &overflow); aMouseEvent->scrollOverflow = isHorizontal ? overflow.x : overflow.y; return NS_OK; } diff --git a/content/events/test/Makefile.in b/content/events/test/Makefile.in index 9926b97b39e..aba62c8b031 100644 --- a/content/events/test/Makefile.in +++ b/content/events/test/Makefile.in @@ -97,6 +97,7 @@ _TEST_FILES = \ test_bug593959.html \ test_bug591815.html \ test_bug605242.html \ + test_bug607464.html \ test_bug624127.html \ $(NULL) diff --git a/content/events/test/test_bug607464.html b/content/events/test/test_bug607464.html new file mode 100644 index 00000000000..3f8ed074205 --- /dev/null +++ b/content/events/test/test_bug607464.html @@ -0,0 +1,108 @@ + + + + + Test for Bug 607464 + + + + + + +Mozilla Bug 607464 +

+ +
+
+
+ + + diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 141bffaf723..69c75b80007 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1478,7 +1478,8 @@ nsGfxScrollFrameInner::ScrollTo(nsPoint aScrollPosition, PRInt32 currentVelocityX = 0; PRInt32 currentVelocityY = 0; - PRBool isSmoothScroll = IsSmoothScrollingEnabled(); + PRBool isSmoothScroll = (aMode == nsIScrollableFrame::SMOOTH) && + IsSmoothScrollingEnabled(); if (mAsyncScroll) { if (mAsyncScroll->mIsSmoothScroll) { diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index fdbf6c6be9e..a6b2e5041e1 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -136,13 +136,14 @@ public: virtual nsSize GetPageScrollAmount() const = 0; /** - * When a scroll operation is requested, we ask for either instant - * scrolling or smooth scrolling. SMOOTH will only be smooth if - * smooth scrolling is actually enabled. If an INSTANT request - * happens while a smooth scroll is already in progress, the smooth - * scroll is interrupted and we instantly scroll to the destination. + * When a scroll operation is requested, we ask for instant, smooth or normal + * scrolling. SMOOTH will only be smooth if smooth scrolling is actually + * enabled. INSTANT is always synchronous, NORMAL can be asynchronous. + * If an INSTANT request happens while a smooth or async scroll is already in + * progress, the async scroll is interrupted and we instantly scroll to the + * destination. */ - enum ScrollMode { INSTANT, SMOOTH }; + enum ScrollMode { INSTANT, SMOOTH, NORMAL }; /** * Clamps aScrollPosition to GetScrollRange and sets the scroll position * to that value. From 79759ab43bb200c026541fec8b0e29e40082be9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 4 Feb 2011 09:07:45 +0100 Subject: [PATCH 008/229] Bug 631302 - Let the statuspanel move away when dragging over it. r=gavin --- browser/base/content/tabbrowser.xml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 16a9199722f..39c5c8c89f8 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -3720,15 +3720,20 @@ return this.getAttribute("label"); + + + + if (this.hasAttribute("mirror")) + this.removeAttribute("mirror"); + else + this.setAttribute("mirror", "true"); + + - - if (this.hasAttribute("mirror")) - this.removeAttribute("mirror"); - else - this.setAttribute("mirror", "true"); - + + From f37fa60c7bfab0138ead2104f2a9240dfa7c88e7 Mon Sep 17 00:00:00 2001 From: Paolo Amadini Date: Fri, 4 Feb 2011 09:09:04 +0100 Subject: [PATCH 009/229] Bug 626382 - Allow themes to set the iconsize on specific toolbars. r=dao a=b --- browser/base/content/browser.js | 43 +++++++++++++++++-- browser/base/content/browser.xul | 2 + browser/themes/pinstripe/browser/browser.css | 29 ++++++------- browser/themes/winstripe/browser/browser.css | 45 +++++++++++--------- toolkit/content/customizeToolbar.js | 6 ++- 5 files changed, 84 insertions(+), 41 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 1d0ca5ef16b..10f05861c39 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1327,6 +1327,8 @@ function BrowserStartup() { gPrivateBrowsingUI.init(); + retrieveToolbarIconsizesFromTheme(); + setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar); } @@ -3616,10 +3618,43 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) { window.content.focus(); } -function BrowserToolboxCustomizeChange() { - gHomeButton.updatePersonalToolbarStyle(); - BookmarksMenuButton.customizeChange(); - allTabs.readPref(); +function BrowserToolboxCustomizeChange(aType) { + switch (aType) { + case "iconsize": + case "mode": + retrieveToolbarIconsizesFromTheme(); + break; + default: + gHomeButton.updatePersonalToolbarStyle(); + BookmarksMenuButton.customizeChange(); + allTabs.readPref(); + } +} + +/** + * Allows themes to override the "iconsize" attribute on toolbars. + */ +function retrieveToolbarIconsizesFromTheme() { + function retrieveToolbarIconsize(aToolbar) { + if (aToolbar.localName != "toolbar") + return; + + // The theme indicates that it wants to override the "iconsize" attribute + // by specifying a special value for the "counter-reset" property on the + // toolbar. A custom property cannot be used because getComputedStyle can + // only return the values of standard CSS properties. + let counterReset = getComputedStyle(aToolbar).counterReset; + if (counterReset == "smallicons 0") { + aToolbar.setAttribute("iconsize", "small"); + document.persist(aToolbar.id, "iconsize"); + } else if (counterReset == "largeicons 0") { + aToolbar.setAttribute("iconsize", "large"); + document.persist(aToolbar.id, "iconsize"); + } + } + + Array.forEach(gNavToolbox.childNodes, retrieveToolbarIconsize); + gNavToolbox.externalToolbars.forEach(retrieveToolbarIconsize); } /** diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 77353ba93c0..f0b076afff2 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -467,6 +467,8 @@ defaultmode="icons" mode="icons" #ifdef WINCE defaulticonsize="small" iconsize="small" +#else + iconsize="large" #endif tabsontop="true" persist="tabsontop"> diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 870fa56ea41..617e530d9e0 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -449,6 +449,11 @@ toolbar[mode="icons"] .toolbarbutton-1 > menupopup { margin-top: 1px; } +#navigator-toolbox > toolbar { + /* force iconsize="small" on these toolbars */ + counter-reset: smallicons; +} + /* unified back/forward button */ #unified-back-forward-button { @@ -465,7 +470,7 @@ toolbar:not([mode="icons"]) #back-button:-moz-locale-dir(rtl) { -moz-image-region: rect(0, 60px, 20px, 40px); } -toolbar:not([iconsize="small"])[mode="icons"] #back-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { -moz-margin-end: -5px; position: relative; z-index: 1; @@ -485,27 +490,17 @@ toolbar[mode="icons"] #forward-button { -moz-margin-start: 0; } -toolbar[mode="icons"]:not([iconsize="small"]) #forward-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { /* 1px to the right */ padding-left: 4px; padding-right: 2px; } -toolbar[mode="icons"]:not([iconsize="small"]) #forward-button:-moz-lwtheme { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:-moz-lwtheme { mask: url(chrome://browser/content/browser.xul#pinstripe-keyhole-forward-mask); } -toolbar[iconsize="small"][mode="icons"] #back-button { - -moz-margin-end: 0; -} - -toolbar[iconsize="small"][mode="icons"] #back-button { - width: 26px; - border-right-width: 0; - padding-right: 2px; -} - -toolbar[iconsize="small"][mode="icons"] #forward-button { +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #forward-button { width: 27px; padding-left: 2px; } @@ -515,7 +510,11 @@ toolbar[mode="icons"] #forward-button { border-bottom-left-radius: 0; } -toolbar[iconsize="small"][mode="icons"] #back-button { +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar #back-button { + -moz-margin-end: 0; + width: 26px; + padding-right: 2px; + border-right-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; } diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 07c1430ab82..3ca2cece303 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -108,8 +108,8 @@ } %endif -#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar)[iconsize="small"], -#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar)[defaulticonsize="small"]:not([iconsize]) { +#navigator-toolbox[iconsize="small"] > #nav-bar, +#navigator-toolbox > toolbar:not(#nav-bar):not(#toolbar-menubar):not(#TabsToolbar)[iconsize="small"] { padding-top: 1px; padding-bottom: 1px; } @@ -572,6 +572,11 @@ menuitem.bookmark-item { opacity: .4; } +#nav-bar { + /* force iconsize="small" on this toolbar */ + counter-reset: smallicons; +} + #nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button, #nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, #nav-bar .toolbarbutton-1 { @@ -592,8 +597,8 @@ menuitem.bookmark-item { } #nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, -#nav-bar[iconsize="small"][mode="icons"] .toolbarbutton-1 > .toolbarbutton-menubutton-button, -#nav-bar[iconsize="small"][mode="icons"] .toolbarbutton-1 { +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar .toolbarbutton-1 > .toolbarbutton-menubutton-button, +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar .toolbarbutton-1 { padding-left: 3px; padding-right: 3px; } @@ -610,7 +615,7 @@ menuitem.bookmark-item { margin: 1px 3px; } -#nav-bar[iconsize="small"][mode="icons"] .toolbarbutton-1 { +#navigator-toolbox[iconsize="small"][mode="icons"] > #nav-bar .toolbarbutton-1 { margin-left: 2px; margin-right: 2px; } @@ -732,7 +737,7 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button { -moz-image-region: rect(0, 36px, 18px, 18px); } -toolbar:not([iconsize="small"])[mode="icons"] #back-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { -moz-image-region: rect(18px, 20px, 38px, 0); } @@ -743,12 +748,12 @@ toolbar:not([iconsize="small"])[mode="icons"] #back-button { } #nav-bar #back-button { - -moz-margin-end: 0; + -moz-margin-end: 0 !important; } #nav-bar #forward-button { - border-left: none; - -moz-margin-start: 0; + border-left-style: none; + -moz-margin-start: 0 !important; } #nav-bar #back-button:-moz-locale-dir(ltr) { @@ -762,7 +767,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #back-button { border-bottom-left-radius: 0; } -#nav-bar:not([iconsize="small"])[mode="icons"] #back-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button { border-radius: 10000px; padding: 0; width: 30px; @@ -782,7 +787,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #back-button { 1px 2px 1px rgba(0,0,0,.2); } -#nav-bar:not([iconsize="small"])[mode="icons"] #back-button:not([disabled="true"]):not([open="true"]):not(:active):hover { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):not([open="true"]):not(:active):hover { box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset, 0 0 0 2px rgba(255,255,255,.1) inset, 0 0 0 1px hsla(190,50%,40%,.3), @@ -792,34 +797,34 @@ toolbar:not([iconsize="small"])[mode="icons"] #back-button { 0 0 5px 1px hsl(190,90%,80%); } -#nav-bar:not([iconsize="small"])[mode="icons"] #back-button:not([disabled="true"]):hover:active, -#nav-bar:not([iconsize="small"])[mode="icons"] #back-button[open="true"] { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button:not([disabled="true"]):hover:active, +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #back-button[open="true"] { box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset, 0 0 2px rgba(0,0,0,.4) inset, 0 0 0 1px rgba(0,0,0,.65), 0 2px 0 rgba(255,255,255,.4); } -#nav-bar:not([iconsize="small"])[mode="icons"][currentset*="unified-back-forward-button"], -#nav-bar:not([iconsize="small"])[mode="icons"]:not([currentset]) { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar[currentset*="unified-back-forward-button"], +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar:not([currentset]) { padding-top: 3px; padding-bottom: 5px; } -#navigator-toolbox[tabsontop="true"] > #nav-bar:not([iconsize="small"])[mode="icons"][currentset*="unified-back-forward-button"], -#navigator-toolbox[tabsontop="true"] > #nav-bar:not([iconsize="small"])[mode="icons"]:not([currentset]) { +#navigator-toolbox[iconsize="large"][mode="icons"][tabsontop="true"] > #nav-bar[currentset*="unified-back-forward-button"], +#navigator-toolbox[iconsize="large"][mode="icons"][tabsontop="true"] > #nav-bar:not([currentset]) { padding-top: 5px; } -#nav-bar:not([iconsize="small"])[mode="icons"] #forward-button { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button { /*mask: url(keyhole-forward-mask.svg#mask); XXX: this regresses twinopen */ mask: url(chrome://browser/content/browser.xul#winstripe-keyhole-forward-mask); - -moz-margin-start: -6px; + -moz-margin-start: -6px !important; padding-left: 7px; padding-right: 3px; } -#nav-bar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="true"]):not(:active):hover { +#navigator-toolbox[iconsize="large"][mode="icons"] > #nav-bar #forward-button:not([disabled="true"]):not(:active):hover { /*mask: url(keyhole-forward-mask.svg#mask-hover);*/ mask: url(chrome://browser/content/browser.xul#winstripe-keyhole-forward-mask-hover); /* Don't animate the box shadow, as the blur and spread radii affect the mask. */ diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js index 9654f3c0788..ce0cf660c4e 100644 --- a/toolkit/content/customizeToolbar.js +++ b/toolkit/content/customizeToolbar.js @@ -167,11 +167,11 @@ function notifyParentComplete() dispatchCustomizationEvent("aftercustomization"); } -function toolboxChanged(aEvent) +function toolboxChanged(aType) { gToolboxChanged = true; if ("customizeChange" in gToolbox) - gToolbox.customizeChange(aEvent); + gToolbox.customizeChange(aType); dispatchCustomizationEvent("customizationchange"); } @@ -696,6 +696,8 @@ function updateToolboxProperty(aProp, aValue, aToolkitDefault) { gToolboxDocument.persist(toolbar.id, aProp); }); + toolboxChanged(aProp); + return aValue || toolboxDefault; } From 4c53a767abc782f69c76da7c1c6dc6bd04db68a7 Mon Sep 17 00:00:00 2001 From: Raymond Lee Date: Fri, 4 Feb 2011 10:16:23 +0100 Subject: [PATCH 010/229] Bug 626525 - Disable "move to group" and "next group" if Panorama hasn't been run. r=dao a=b --- browser/base/content/browser-tabview.js | 120 +++++++++---- browser/base/content/browser.js | 4 +- browser/base/content/browser.xul | 2 +- browser/base/content/test/tabview/Makefile.in | 1 + .../test/tabview/browser_tabview_bug626525.js | 160 ++++++++++++++++++ 5 files changed, 254 insertions(+), 33 deletions(-) create mode 100644 browser/base/content/test/tabview/browser_tabview_bug626525.js diff --git a/browser/base/content/browser-tabview.js b/browser/base/content/browser-tabview.js index c6fcd01a4f9..45e745977cd 100644 --- a/browser/base/content/browser-tabview.js +++ b/browser/base/content/browser-tabview.js @@ -39,7 +39,8 @@ let TabView = { _deck: null, _window: null, - _sessionstore: null, + _firstRunExperienced: false, + _browserKeyHandlerInitialized: false, VISIBILITY_IDENTIFIER: "tabview-visibility", // ---------- @@ -50,32 +51,67 @@ let TabView = { let title = gNavigatorBundle.getFormattedString("tabView2.title", [brandShortName]); return this.windowTitle = title; }, + + // ---------- + get firstRunExperienced() { + return this._firstRunExperienced; + }, // ---------- init: function TabView_init() { - // ___ keys - this._setBrowserKeyHandlers(); - - // ___ visibility - this._sessionstore = - Cc["@mozilla.org/browser/sessionstore;1"]. - getService(Ci.nsISessionStore); - - let data = this._sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER); - - if (data && data == "true") { - this.show(); + if (!Services.prefs.prefHasUserValue("browser.panorama.experienced_first_run") || + !Services.prefs.getBoolPref("browser.panorama.experienced_first_run")) { + Services.prefs.addObserver( + "browser.panorama.experienced_first_run", this, false); } else { - let self = this; - // if a tab is changed from hidden to unhidden and the iframe is not - // initialized, load the iframe and setup the tab. - this._tabShowEventListener = function (event) { - if (!self._window) - self._initFrame(function() { - self._window.UI.onTabSelect(gBrowser.selectedTab); - }); - }; - gBrowser.tabContainer.addEventListener( + this._firstRunExperienced = true; + + if ((gBrowser.tabs.length - gBrowser.visibleTabs.length) > 0) + this._setBrowserKeyHandlers(); + + // ___ visibility + let sessionstore = + Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); + let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER); + + if (data && data == "true") { + this.show(); + } else { + let self = this; + + // if a tab is changed from hidden to unhidden and the iframe is not + // initialized, load the iframe and setup the tab. + this._tabShowEventListener = function (event) { + if (!self._window) + self._initFrame(function() { + self._window.UI.onTabSelect(gBrowser.selectedTab); + }); + }; + gBrowser.tabContainer.addEventListener( + "TabShow", this._tabShowEventListener, true); + } + } + }, + + // ---------- + // Observes topic changes. + observe: function TabView_observe(subject, topic, data) { + if (topic == "nsPref:changed") { + Services.prefs.removeObserver( + "browser.panorama.experienced_first_run", this); + this._firstRunExperienced = true; + } + }, + + // ---------- + // Uninitializes TabView. + uninit: function TabView_uninit() { + if (!this._firstRunExperienced) { + Services.prefs.removeObserver( + "browser.panorama.experienced_first_run", this); + } + if (this._tabShowEventListener) { + gBrowser.tabContainer.removeEventListener( "TabShow", this._tabShowEventListener, true); } }, @@ -107,7 +143,10 @@ let TabView = { if (this._tabShowEventListener) { gBrowser.tabContainer.removeEventListener( "TabShow", this._tabShowEventListener, true); + this._tabShowEventListener = null; } + + this._setBrowserKeyHandlers(); } }, @@ -151,7 +190,7 @@ let TabView = { this.show(); }, - getActiveGroupName: function Tabview_getActiveGroupName() { + getActiveGroupName: function TabView_getActiveGroupName() { // We get the active group this way, instead of querying // GroupItems.getActiveGroupItem() because the tabSelect event // will not have happened by the time the browser tries to @@ -194,7 +233,7 @@ let TabView = { }, // ---------- - _createGroupMenuItem : function(groupItem) { + _createGroupMenuItem: function TabView__createGroupMenuItem(groupItem) { let menuItem = document.createElement("menuitem") menuItem.setAttribute("label", groupItem.getTitle()); menuItem.setAttribute( @@ -205,13 +244,19 @@ let TabView = { }, // ---------- - moveTabTo: function(tab, groupItemId) { - if (this._window) + moveTabTo: function TabView_moveTabTo(tab, groupItemId) { + if (this._window) { this._window.GroupItems.moveTabToGroupItem(tab, groupItemId); + } else { + let self = this; + this._initFrame(function() { + self._window.GroupItems.moveTabToGroupItem(tab, groupItemId); + }); + } }, // ---------- - enableSearch: function Tabview_enableSearch(event) { + enableSearch: function TabView_enableSearch(event) { if (this._window) this._window.UI.enableSearch(event); }, @@ -219,11 +264,16 @@ let TabView = { // ---------- // Adds new key commands to the browser, for invoking the Tab Candy UI // and for switching between groups of tabs when outside of the Tab Candy UI. - _setBrowserKeyHandlers : function() { - let self = this; + _setBrowserKeyHandlers: function TabView__setBrowserKeyHandlers() { + if (this._browserKeyHandlerInitialized) + return; + this._browserKeyHandlerInitialized = true; + + let self = this; window.addEventListener("keypress", function(event) { - if (self.isVisible()) + if (self.isVisible() || + (gBrowser.tabs.length - gBrowser.visibleTabs.length) == 0) return; let charCode = event.charCode; @@ -264,5 +314,13 @@ let TabView = { afterUndoCloseTab: function () { if (this._window) this._window.UI.restoredClosedTab = false; + }, + + // ---------- + // On move to group pop showing. + moveToGroupPopupShowing: function TabView_moveToGroupPopupShowing(event) { + // there are hidden tabs so initialize the iframe and update the context menu + if ((gBrowser.tabs.length - gBrowser.visibleTabs.length) > 0) + this.updateContextMenu(TabContextMenu.contextTab, event.target); } }; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 10f05861c39..8628b6ce2da 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1674,6 +1674,7 @@ function BrowserShutdown() gPrefService.removeObserver(allTabs.prefName, allTabs); ctrlTab.uninit(); allTabs.uninit(); + TabView.uninit(); CombinedStopReload.uninit(); @@ -8408,7 +8409,8 @@ var TabContextMenu = { PlacesCommandHook.updateBookmarkAllTabsCommand(); // Hide "Move to Group" if it's a pinned tab. - document.getElementById("context_tabViewMenu").hidden = this.contextTab.pinned; + document.getElementById("context_tabViewMenu").hidden = + (this.contextTab.pinned || !TabView.firstRunExperienced); } }; diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index f0b076afff2..37beb8805a5 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -125,7 +125,7 @@ + onpopupshowing="if (event.target == this) TabView.moveToGroupPopupShowing(event);">