diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/AccessibleWrap.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/AccessibleWrap.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/AccessibleWrap.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/AccessibleWrap.cpp 2015-05-25 20:42:33.000000000 +0000 @@ -1128,7 +1128,12 @@ switch (type) { case nsIAccessibleEvent::EVENT_STATE_CHANGE: - return FireAtkStateChangeEvent(aEvent, atkObj); + { + AccStateChangeEvent* event = downcast_accEvent(aEvent); + MAI_ATK_OBJECT(atkObj)->FireStateChangeEvent(event->GetState(), + event->IsStateEnabled()); + break; + } case nsIAccessibleEvent::EVENT_TEXT_REMOVED: case nsIAccessibleEvent::EVENT_TEXT_INSERTED: @@ -1353,21 +1358,52 @@ a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType) { AtkObject* wrapper = GetWrapperFor(aTarget); - if (aEventType == nsIAccessibleEvent::EVENT_FOCUS) { + + switch (aEventType) { + case nsIAccessibleEvent::EVENT_FOCUS: atk_focus_tracker_notify(wrapper); atk_object_notify_state_change(wrapper, ATK_STATE_FOCUSED, true); + break; + case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE: + g_signal_emit_by_name(wrapper, "load_complete"); + break; + case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD: + g_signal_emit_by_name(wrapper, "reload"); + break; + case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED: + g_signal_emit_by_name(wrapper, "load_stopped"); + break; + case nsIAccessibleEvent::EVENT_MENUPOPUP_START: + atk_focus_tracker_notify(wrapper); // fire extra focus event + atk_object_notify_state_change(wrapper, ATK_STATE_VISIBLE, true); + atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, true); + break; + case nsIAccessibleEvent::EVENT_MENUPOPUP_END: + atk_object_notify_state_change(wrapper, ATK_STATE_VISIBLE, false); + atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, false); + break; } } -nsresult -AccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent, - AtkObject* aObject) +void +a11y::ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState, + bool aEnabled) { - AccStateChangeEvent* event = downcast_accEvent(aEvent); - NS_ENSURE_TRUE(event, NS_ERROR_FAILURE); + MaiAtkObject* atkObj = MAI_ATK_OBJECT(GetWrapperFor(aTarget)); + atkObj->FireStateChangeEvent(aState, aEnabled); +} - bool isEnabled = event->IsStateEnabled(); - int32_t stateIndex = AtkStateMap::GetStateIndexFor(event->GetState()); +void +a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) +{ + AtkObject* wrapper = GetWrapperFor(aTarget); + g_signal_emit_by_name(wrapper, "text_caret_moved", aOffset); +} + +void +MaiAtkObject::FireStateChangeEvent(uint64_t aState, bool aEnabled) +{ + int32_t stateIndex = AtkStateMap::GetStateIndexFor(aState); if (stateIndex >= 0) { NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState, "No such state"); @@ -1377,16 +1413,14 @@ "State changes should not fired for this state"); if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite) - isEnabled = !isEnabled; + aEnabled = !aEnabled; // Fire state change for first state if there is one to map - atk_object_notify_state_change(aObject, + atk_object_notify_state_change(&parent, gAtkStateMap[stateIndex].atkState, - isEnabled); + aEnabled); } } - - return NS_OK; } nsresult diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/nsMai.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/nsMai.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/nsMai.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/nsMai.h 2015-05-25 20:42:33.000000000 +0000 @@ -76,6 +76,11 @@ * Shutdown this AtkObject. */ void Shutdown(); + + /* + * Notify atk of a state change on this AtkObject. + */ + void FireStateChangeEvent(uint64_t aState, bool aEnabled); }; #endif /* __NS_MAI_H__ */ diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/Platform.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/Platform.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/atk/Platform.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/atk/Platform.cpp 2015-05-25 20:42:33.000000000 +0000 @@ -361,13 +361,12 @@ #endif //check gconf-2 setting -static const char sGconfAccessibilityKey[] = - "/desktop/gnome/interface/accessibility"; +#define GCONF_A11Y_KEY "/desktop/gnome/interface/accessibility" nsresult rv = NS_OK; nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv) && gconf) - gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey), &sShouldEnable); + gconf->GetBool(NS_LITERAL_CSTRING(GCONF_A11Y_KEY), &sShouldEnable); return sShouldEnable; } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/EventQueue.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/EventQueue.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/EventQueue.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/EventQueue.cpp 2015-05-25 20:42:33.000000000 +0000 @@ -502,6 +502,17 @@ if (!aEvent->GetAccessible()->IsApplication()) ipcDoc->SendEvent(id, aEvent->GetEventType()); break; + case nsIAccessibleEvent::EVENT_STATE_CHANGE: { + AccStateChangeEvent* event = downcast_accEvent(aEvent); + ipcDoc->SendStateChangeEvent(id, event->GetState(), + event->IsStateEnabled()); + break; + } + case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: { + AccCaretMoveEvent* event = downcast_accEvent(aEvent); + ipcDoc->SendEvent(id, event->GetCaretOffset()); + break; + } default: ipcDoc->SendEvent(id, aEvent->GetEventType()); } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/MarkupMap.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/MarkupMap.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/MarkupMap.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/MarkupMap.h 2015-05-25 20:42:33.000000000 +0000 @@ -103,6 +103,10 @@ New_HTMLListitem, 0) +MARKUPMAP(map, + nullptr, + roles::TEXT_CONTAINER) + MARKUPMAP(math, New_HyperText, roles::MATHML_MATH) @@ -304,6 +308,10 @@ roles::SECTION, Attr(live, polite)) +MARKUPMAP(p, + nullptr, + roles::PARAGRAPH) + MARKUPMAP(progress, New_HTMLProgress, 0) diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/Platform.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/Platform.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/Platform.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/Platform.h 2015-05-25 20:42:33.000000000 +0000 @@ -67,6 +67,9 @@ * Callied when an event is fired on a proxied accessible. */ void ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType); +void ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState, + bool aEnabled); +void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset); } // namespace a11y } // namespace mozilla diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/Role.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/Role.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/Role.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/Role.h 2015-05-25 20:42:33.000000000 +0000 @@ -981,7 +981,13 @@ */ RADIO_GROUP = 168, - LAST_ROLE = RADIO_GROUP + /** + * A text container exposing brief amount of information. See related + * TEXT_CONTAINER role. + */ + TEXT = 169, + + LAST_ROLE = TEXT }; } // namespace role diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/RoleMap.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/RoleMap.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/RoleMap.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/RoleMap.h 2015-05-25 20:42:33.000000000 +0000 @@ -754,7 +754,7 @@ ROLE(TEXT_CONTAINER, "text container", - ATK_ROLE_TEXT, + ATK_ROLE_SECTION, NSAccessibilityGroupRole, USE_ROLE_STRING, IA2_ROLE_TEXT_FRAME, @@ -1367,3 +1367,12 @@ ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING, eNoNameRule) + +ROLE(TEXT, + "text", + ATK_ROLE_STATIC, + NSAccessibilityGroupRole, + USE_ROLE_STRING, + IA2_ROLE_TEXT_FRAME, + eNameFromSubtreeIfReqRule) + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/TextAttrs.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/TextAttrs.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/base/TextAttrs.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/base/TextAttrs.cpp 2015-05-25 20:42:33.000000000 +0000 @@ -18,6 +18,10 @@ #include "mozilla/AppUnits.h" #include "mozilla/gfx/2D.h" +#if defined(MOZ_WIDGET_GTK) +#include "gfxPlatformGtk.h" // xxx - for UseFcFontList +#endif + using namespace mozilla; using namespace mozilla::a11y; @@ -628,21 +632,30 @@ if (font->IsSyntheticBold()) return 700; -#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT) - // On Linux, font->GetStyle()->weight will give the absolute weight requested - // of the font face. The Linux code uses the gfxFontEntry constructor which - // doesn't initialize the weight field. - return font->GetStyle()->weight; -#else - // On Windows, font->GetStyle()->weight will give the same weight as - // fontEntry->Weight(), the weight of the first font in the font group, which - // may not be the weight of the font face used to render the characters. - // On Mac, font->GetStyle()->weight will just give the same number as - // getComputedStyle(). fontEntry->Weight() will give the weight of the font - // face used. - gfxFontEntry *fontEntry = font->GetFontEntry(); - return fontEntry->Weight(); + bool useFontEntryWeight = true; + + // Under Linux, when gfxPangoFontGroup code is used, + // font->GetStyle()->weight will give the absolute weight requested of the + // font face. The gfxPangoFontGroup code uses the gfxFontEntry constructor + // which doesn't initialize the weight field. +#if defined(MOZ_WIDGET_QT) + useFontEntryWeight = false; +#elif defined(MOZ_WIDGET_GTK) + useFontEntryWeight = gfxPlatformGtk::UseFcFontList(); #endif + + if (useFontEntryWeight) { + // On Windows, font->GetStyle()->weight will give the same weight as + // fontEntry->Weight(), the weight of the first font in the font group, + // which may not be the weight of the font face used to render the + // characters. On Mac, font->GetStyle()->weight will just give the same + // number as getComputedStyle(). fontEntry->Weight() will give the weight + // of the font face used. + gfxFontEntry *fontEntry = font->GetFontEntry(); + return fontEntry->Weight(); + } else { + return font->GetStyle()->weight; + } } //////////////////////////////////////////////////////////////////////////////// diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/generic/HyperTextAccessible.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/generic/HyperTextAccessible.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/generic/HyperTextAccessible.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/generic/HyperTextAccessible.cpp 2015-05-25 20:42:33.000000000 +0000 @@ -63,12 +63,11 @@ if (r != roles::NOTHING) return r; - // Treat block frames as paragraphs - nsIFrame *frame = GetFrame(); - if (frame && frame->GetType() == nsGkAtoms::blockFrame) - return roles::PARAGRAPH; + nsIFrame* frame = GetFrame(); + if (frame && frame->GetType() == nsGkAtoms::inlineFrame) + return roles::TEXT; - return roles::TEXT_CONTAINER; // In ATK this works + return roles::TEXT_CONTAINER; } uint64_t diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/interfaces/nsIAccessibleRole.idl firefox-trunk-41.0~a1~hg20150524r245419/accessible/interfaces/nsIAccessibleRole.idl --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/interfaces/nsIAccessibleRole.idl 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/interfaces/nsIAccessibleRole.idl 2015-05-25 20:42:34.000000000 +0000 @@ -8,7 +8,7 @@ /** * Defines cross platform (Gecko) roles. */ -[scriptable, uuid(00f9e831-3198-40b7-9186-5251474d4d7a)] +[scriptable, uuid(94add87a-190c-443e-9549-d11131affb2a)] interface nsIAccessibleRole : nsISupports { /** @@ -974,4 +974,10 @@ * A group containing radio buttons */ const unsigned long ROLE_RADIO_GROUP = 168; + + /** + * A text container exposing brief amount of information. See related + * TEXT_CONTAINER role. + */ + const unsigned long ROLE_TEXT = 169; }; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/DocAccessibleParent.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/DocAccessibleParent.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/DocAccessibleParent.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/DocAccessibleParent.cpp 2015-05-25 20:42:34.000000000 +0000 @@ -23,14 +23,7 @@ return false; } - ProxyAccessible* parent = nullptr; - if (aData.ID()) { - ProxyEntry* e = mAccessibles.GetEntry(aData.ID()); - if (e) - parent = e->mProxy; - } else { - parent = this; - } + ProxyAccessible* parent = GetAccessible(aData.ID()); // XXX This should really never happen, but sometimes we fail to fire the // required show events. @@ -123,18 +116,37 @@ bool DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType) { - if (!aID) { - ProxyEvent(this, aEventType); - return true; - } - - ProxyEntry* e = mAccessibles.GetEntry(aID); - if (!e) { + ProxyAccessible* proxy = GetAccessible(aID); + if (!proxy) { NS_ERROR("no proxy for event!"); return true; } - ProxyEvent(e->mProxy, aEventType); + ProxyEvent(proxy, aEventType); + return true; +} + +bool +DocAccessibleParent::RecvStateChangeEvent(const uint64_t& aID, + const uint64_t& aState, + const bool& aEnabled) +{ + ProxyAccessible* target = GetAccessible(aID); + if (!target) + return false; + + ProxyStateChangeEvent(target, aState, aEnabled); + return true; +} + +bool +DocAccessibleParent::RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOffset) +{ + ProxyAccessible* proxy = GetAccessible(aID); + if (!proxy) + return false; + + ProxyCaretMoveEvent(proxy, aOffset); return true; } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/DocAccessibleParent.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/DocAccessibleParent.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/DocAccessibleParent.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/DocAccessibleParent.h 2015-05-25 20:42:34.000000000 +0000 @@ -44,6 +44,12 @@ virtual bool RecvShowEvent(const ShowEventData& aData) override; virtual bool RecvHideEvent(const uint64_t& aRootID) override; + virtual bool RecvStateChangeEvent(const uint64_t& aID, + const uint64_t& aState, + const bool& aEnabled) override final; + + virtual bool RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOffset) + override final; virtual bool RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID) override; void Unbind() @@ -94,12 +100,18 @@ /** * Return the accessible for given id. */ - ProxyAccessible* GetAccessible(uintptr_t aID) const + ProxyAccessible* GetAccessible(uintptr_t aID) { + if (!aID) + return this; + ProxyEntry* e = mAccessibles.GetEntry(aID); return e ? e->mProxy : nullptr; } + const ProxyAccessible* GetAccessible(uintptr_t aID) const + { return const_cast(this)->GetAccessible(aID); } + private: class ProxyEntry : public PLDHashEntryHdr diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/PDocAccessible.ipdl firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/PDocAccessible.ipdl --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/ipc/PDocAccessible.ipdl 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/ipc/PDocAccessible.ipdl 2015-05-25 20:42:34.000000000 +0000 @@ -56,6 +56,8 @@ Event(uint64_t aID, uint32_t type); ShowEvent(ShowEventData data); HideEvent(uint64_t aRootID); + StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled); + CaretMoveEvent(uint64_t aID, int32_t aOffset); /* * Tell the parent document to bind the existing document as a new child diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozAccessible.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozAccessible.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozAccessible.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozAccessible.h 2015-05-25 20:42:34.000000000 +0000 @@ -31,12 +31,15 @@ return native; } +// This is OR'd with the Accessible owner to indicate the wrap-ee is a proxy. +static const uintptr_t IS_PROXY = 1; + @interface mozAccessible : NSObject { /** * Weak reference; it owns us. */ - mozilla::a11y::AccessibleWrap* mGeckoAccessible; + uintptr_t mGeckoAccessible; /** * Strong ref to array of children @@ -54,6 +57,9 @@ mozilla::a11y::role mRole; } +// return the Accessible for this mozAccessible. +- (mozilla::a11y::AccessibleWrap*) getGeckoAccessible; + // inits with the gecko owner. - (id)initWithAccessible:(mozilla::a11y::AccessibleWrap*)geckoParent; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozAccessible.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozAccessible.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozAccessible.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozAccessible.mm 2015-05-25 20:42:34.000000000 +0000 @@ -65,7 +65,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; if ((self = [super init])) { - mGeckoAccessible = geckoAccessible; + mGeckoAccessible = reinterpret_cast(geckoAccessible); mRole = geckoAccessible->Role(); } @@ -83,6 +83,15 @@ NS_OBJC_END_TRY_ABORT_BLOCK; } + +- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible +{ + // Check if mGeckoAccessible points at a proxy + if (mGeckoAccessible & IS_PROXY) + return nil; + + return reinterpret_cast(mGeckoAccessible); +} #pragma mark - @@ -92,8 +101,10 @@ // unknown (either unimplemented, or irrelevant) elements are marked as ignored // as well as expired elements. - return !mGeckoAccessible || ([[self role] isEqualToString:NSAccessibilityUnknownRole] && - !(mGeckoAccessible->InteractiveState() & states::FOCUSABLE)); + + AccessibleWrap* accWrap = [self getGeckoAccessible]; + return !accWrap || ([[self role] isEqualToString:NSAccessibilityUnknownRole] && + !(accWrap->InteractiveState() & states::FOCUSABLE)); NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO); } @@ -103,7 +114,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; // if we're expired, we don't support any attributes. - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return [NSArray array]; static NSArray *generalAttributes = nil; @@ -141,7 +152,7 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return nil; #if DEBUG @@ -183,7 +194,8 @@ if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) return [self title]; if ([attribute isEqualToString:NSAccessibilityTitleUIElementAttribute]) { - Relation rel = mGeckoAccessible->RelationByType(RelationType::LABELLED_BY); + Relation rel = + [self getGeckoAccessible]->RelationByType(RelationType::LABELLED_BY); Accessible* tempAcc = rel.Next(); return tempAcc ? GetNativeFromGeckoAccessible(tempAcc) : nil; } @@ -227,7 +239,8 @@ - (id)accessibilityHitTest:(NSPoint)point { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; // Convert the given screen-global point in the cocoa coordinate system (with @@ -239,8 +252,9 @@ nsIntPoint geckoPoint = nsCocoaUtils:: CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView)); - Accessible* child = mGeckoAccessible->ChildAtPoint(geckoPoint.x, geckoPoint.y, - Accessible::eDeepestChild); + Accessible* child = + accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y, + Accessible::eDeepestChild); if (child) { mozAccessible* nativeChild = GetNativeFromGeckoAccessible(child); @@ -270,10 +284,11 @@ - (id)accessibilityFocusedUIElement { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; - Accessible* focusedGeckoChild = mGeckoAccessible->FocusedChild(); + Accessible* focusedGeckoChild = accWrap->FocusedChild(); if (focusedGeckoChild) { mozAccessible *focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild); if (focusedChild) @@ -290,7 +305,8 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - Accessible* accessibleParent = mGeckoAccessible->GetUnignoredParent(); + AccessibleWrap* accWrap = [self getGeckoAccessible]; + Accessible* accessibleParent = accWrap->GetUnignoredParent(); if (accessibleParent) { id nativeParent = GetNativeFromGeckoAccessible(accessibleParent); if (nativeParent) @@ -303,7 +319,7 @@ // // get the native root accessible, and tell it to return its first parent unignored accessible. id nativeParent = - GetNativeFromGeckoAccessible(mGeckoAccessible->RootAccessible()); + GetNativeFromGeckoAccessible(accWrap->RootAccessible()); NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self); return GetClosestInterestingAccessible(nativeParent); @@ -332,14 +348,15 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (mChildren || !mGeckoAccessible->AreChildrenCached()) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (mChildren || !accWrap->AreChildrenCached()) return mChildren; mChildren = [[NSMutableArray alloc] init]; // get the array of children. nsAutoTArray childrenArray; - mGeckoAccessible->GetUnignoredChildren(&childrenArray); + accWrap->GetUnignoredChildren(&childrenArray); // now iterate through the children array, and get each native accessible. uint32_t totalCount = childrenArray.Length(); @@ -370,10 +387,11 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; - nsIntRect rect = mGeckoAccessible->Bounds(); + nsIntRect rect = accWrap->Bounds(); NSScreen* mainView = [[NSScreen screens] objectAtIndex:0]; CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView); @@ -389,10 +407,11 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; - nsIntRect rect = mGeckoAccessible->Bounds(); + nsIntRect rect = accWrap->Bounds(); CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor([[NSScreen screens] objectAtIndex:0]); return [NSValue valueWithSize:NSMakeSize(static_cast(rect.width) / scaleFactor, @@ -403,11 +422,12 @@ - (NSString*)role { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; #ifdef DEBUG_A11Y - NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(mGeckoAccessible), + NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap), "Does not support Text when it should"); #endif @@ -427,10 +447,11 @@ - (NSString*)subrole { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; - nsIAtom* landmark = mGeckoAccessible->LandmarkRole(); + nsIAtom* landmark = accWrap->LandmarkRole(); if (landmark) { if (landmark == nsGkAtoms::application) return @"AXLandmarkApplication"; @@ -457,7 +478,7 @@ return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole; case roles::ENTRY: - if (mGeckoAccessible->IsSearchbox()) + if (accWrap->IsSearchbox()) return @"AXSearchField"; break; @@ -528,7 +549,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; nsAutoString title; - mGeckoAccessible->Name(title); + [self getGeckoAccessible]->Name(title); return nsCocoaUtils::ToNSString(title); NS_OBJC_END_TRY_ABORT_BLOCK_NIL; @@ -539,7 +560,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; nsAutoString value; - mGeckoAccessible->Value(value); + [self getGeckoAccessible]->Value(value); return nsCocoaUtils::ToNSString(value); NS_OBJC_END_TRY_ABORT_BLOCK_NIL; @@ -567,11 +588,12 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (mGeckoAccessible->IsDefunct()) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (accWrap->IsDefunct()) return nil; nsAutoString desc; - mGeckoAccessible->Description(desc); + accWrap->Description(desc); return nsCocoaUtils::ToNSString(desc); @@ -583,7 +605,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; nsAutoString helpText; - mGeckoAccessible->Help(helpText); + [self getGeckoAccessible]->Help(helpText); return nsCocoaUtils::ToNSString(helpText); NS_OBJC_END_TRY_ABORT_BLOCK_NIL; @@ -601,26 +623,29 @@ - (BOOL)isFocused { - return FocusMgr()->IsFocused(mGeckoAccessible); + return FocusMgr()->IsFocused([self getGeckoAccessible]); } - (BOOL)canBeFocused { - return mGeckoAccessible && (mGeckoAccessible->InteractiveState() & states::FOCUSABLE); + AccessibleWrap* accWrap = [self getGeckoAccessible]; + return accWrap && (accWrap->InteractiveState() & states::FOCUSABLE); } - (BOOL)focus { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return NO; - mGeckoAccessible->TakeFocus(); + accWrap->TakeFocus(); return YES; } - (BOOL)isEnabled { - return mGeckoAccessible && ((mGeckoAccessible->InteractiveState() & states::UNAVAILABLE) == 0); + AccessibleWrap* accWrap = [self getGeckoAccessible]; + return accWrap && ((accWrap->InteractiveState() & states::UNAVAILABLE) == 0); } // The root accessible calls this when the focused node was @@ -643,7 +668,7 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - AccessibleWrap* accWrap = static_cast(mGeckoAccessible); + AccessibleWrap* accWrap = [self getGeckoAccessible]; // Get a pointer to the native window (NSWindow) we reside in. NSWindow *nativeWindow = nil; @@ -685,14 +710,14 @@ [self invalidateChildren]; - mGeckoAccessible = nullptr; + mGeckoAccessible = 0; NS_OBJC_END_TRY_ABORT_BLOCK; } - (BOOL)isExpired { - return !mGeckoAccessible; + return ![self getGeckoAccessible]; } #pragma mark - diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozActionElements.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozActionElements.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozActionElements.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozActionElements.mm 2015-05-25 20:42:34.000000000 +0000 @@ -73,7 +73,7 @@ - (BOOL)accessibilityIsIgnored { - return !mGeckoAccessible; + return ![self getGeckoAccessible]; } - (NSArray*)accessibilityActionNames @@ -118,12 +118,13 @@ { // both buttons and checkboxes have only one action. we should really stop using arbitrary // arrays with actions, and define constants for these actions. - mGeckoAccessible->DoAction(0); + [self getGeckoAccessible]->DoAction(0); } - (BOOL)isTab { - return (mGeckoAccessible && (mGeckoAccessible->Role() == roles::PAGETAB)); + AccessibleWrap* accWrap = [self getGeckoAccessible]; + return (accWrap && (accWrap->Role() == roles::PAGETAB)); } @end @@ -148,7 +149,7 @@ - (int)isChecked { - uint64_t state = mGeckoAccessible->NativeState(); + uint64_t state = [self getGeckoAccessible]->NativeState(); // check if we're checked or in a mixed state if (state & states::CHECKED) { @@ -292,10 +293,10 @@ */ - (id)value { - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return nil; - Accessible* accessible = mGeckoAccessible->GetSelectedItem(0); + Accessible* accessible = [self getGeckoAccessible]->GetSelectedItem(0); if (!accessible) return nil; @@ -339,29 +340,29 @@ - (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute { - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return 0; // By default this calls -[[mozAccessible children] count]. // Since we don't cache mChildren. This is faster. if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) - return mGeckoAccessible->ChildCount() ? 1 : 0; + return [self getGeckoAccessible]->ChildCount() ? 1 : 0; return [super accessibilityArrayAttributeCount:attribute]; } - (NSArray*)children { - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return nil; - nsDeckFrame* deckFrame = do_QueryFrame(mGeckoAccessible->GetFrame()); + nsDeckFrame* deckFrame = do_QueryFrame([self getGeckoAccessible]->GetFrame()); nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr; Accessible* selectedAcc = nullptr; if (selectedFrame) { nsINode* node = selectedFrame->GetContent(); - selectedAcc = mGeckoAccessible->Document()->GetAccessible(node); + selectedAcc = [self getGeckoAccessible]->Document()->GetAccessible(node); } if (selectedAcc) { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozDocAccessible.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozDocAccessible.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozDocAccessible.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozDocAccessible.mm 2015-05-25 20:42:34.000000000 +0000 @@ -33,7 +33,7 @@ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; // if we're expired, we don't support any attributes. - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return [NSArray array]; // standard attributes that are shared and supported by root accessible (AXMain) elements. @@ -95,7 +95,7 @@ if (mParallelView) return (id)mParallelView; - mParallelView = getNativeViewFromRootAccessible (mGeckoAccessible); + mParallelView = getNativeViewFromRootAccessible ([self getGeckoAccessible]); NSAssert(mParallelView, @"can't return root accessible's native parallel view."); return mParallelView; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozHTMLAccessible.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozHTMLAccessible.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozHTMLAccessible.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozHTMLAccessible.mm 2015-05-25 20:42:34.000000000 +0000 @@ -20,17 +20,19 @@ mozilla::ErrorResult rv; // XXX use the flattening API when there are available // see bug 768298 - mGeckoAccessible->GetContent()->GetTextContent(title, rv); + [self getGeckoAccessible]->GetContent()->GetTextContent(title, rv); return nsCocoaUtils::ToNSString(title); } - (id)value { - if (!mGeckoAccessible || !mGeckoAccessible->IsHyperText()) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + + if (!accWrap || !accWrap->IsHyperText()) return nil; - uint32_t level = mGeckoAccessible->AsHyperText()->GetLevelInternal(); + uint32_t level = accWrap->AsHyperText()->GetLevelInternal(); return [NSNumber numberWithInt:level]; } @@ -45,7 +47,7 @@ - (NSArray*)accessibilityAttributeNames { // if we're expired, we don't support any attributes. - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return [NSArray array]; static NSMutableArray* attributes = nil; @@ -69,7 +71,7 @@ - (NSArray*)accessibilityActionNames { // if we're expired, we don't support any attributes. - if (!mGeckoAccessible) + if (![self getGeckoAccessible]) return [NSArray array]; static NSArray* actionNames = nil; @@ -84,11 +86,13 @@ - (void)accessibilityPerformAction:(NSString*)action { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + + if (!accWrap) return; if ([action isEqualToString:NSAccessibilityPressAction]) - mGeckoAccessible->DoAction(0); + accWrap->DoAction(0); else [super accessibilityPerformAction:action]; } @@ -105,11 +109,11 @@ - (NSURL*)url { - if (!mGeckoAccessible || mGeckoAccessible->IsDefunct()) + if (![self getGeckoAccessible] || [self getGeckoAccessible]->IsDefunct()) return nil; nsAutoString value; - mGeckoAccessible->Value(value); + [self getGeckoAccessible]->Value(value); NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value); if (!urlString) diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozTextAccessible.h firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozTextAccessible.h --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozTextAccessible.h 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozTextAccessible.h 2015-05-25 20:42:34.000000000 +0000 @@ -8,9 +8,6 @@ @interface mozTextAccessible : mozAccessible { - // both of these are the same old mGeckoAccessible, but already - // QI'd for us, to the right type, for convenience. - mozilla::a11y::HyperTextAccessible* mGeckoTextAccessible; // strong } @end diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozTextAccessible.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozTextAccessible.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/mozTextAccessible.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/mozTextAccessible.mm 2015-05-25 20:42:34.000000000 +0000 @@ -53,21 +53,9 @@ @implementation mozTextAccessible -- (id)initWithAccessible:(AccessibleWrap*)accessible -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - - if ((self = [super initWithAccessible:accessible])) { - mGeckoTextAccessible = accessible->AsHyperText(); - } - return self; - - NS_OBJC_END_TRY_ABORT_BLOCK_NIL; -} - - (BOOL)accessibilityIsIgnored { - return !mGeckoAccessible; + return ![self getGeckoAccessible]; } - (NSArray*)accessibilityAttributeNames @@ -126,11 +114,13 @@ return [self text]; } + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if ([attribute isEqualToString:@"AXRequired"]) - return [NSNumber numberWithBool:!!(mGeckoAccessible->State() & states::REQUIRED)]; + return [NSNumber numberWithBool:!!(accWrap->State() & states::REQUIRED)]; if ([attribute isEqualToString:@"AXInvalid"]) - return [NSNumber numberWithBool:!!(mGeckoAccessible->State() & states::INVALID)]; + return [NSNumber numberWithBool:!!(accWrap->State() & states::INVALID)]; if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) return [self visibleCharacterRange]; @@ -166,7 +156,9 @@ - (id)accessibilityAttributeValue:(NSString*)attribute forParameter:(id)parameter { - if (!mGeckoTextAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (!textAcc) return nil; if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) { @@ -214,7 +206,7 @@ int32_t start = range.location; int32_t end = start + range.length; - nsIntRect bounds = mGeckoTextAccessible->TextBounds(start, end); + nsIntRect bounds = textAcc->TextBounds(start, end); return [NSValue valueWithRect:nsCocoaUtils::GeckoRectToCocoaRect(bounds)]; } @@ -247,7 +239,9 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - if (!mGeckoTextAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (!textAcc) return; if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { @@ -262,12 +256,12 @@ return; int32_t start = 0, end = 0; - mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end); - mGeckoTextAccessible->DeleteText(start, end - start); + textAcc->SelectionBoundsAt(0, &start, &end); + textAcc->DeleteText(start, end - start); nsString text; nsCocoaUtils::GetStringForNSString(stringValue, text); - mGeckoTextAccessible->InsertText(text, start); + textAcc->InsertText(text, start); } if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { @@ -275,8 +269,8 @@ if (!ToNSRange(value, &range)) return; - mGeckoTextAccessible->SetSelectionBoundsAt(0, range.location, - range.location + range.length); + textAcc->SetSelectionBoundsAt(0, range.location, + range.location + range.length); return; } @@ -285,8 +279,8 @@ if (!ToNSRange(value, &range)) return; - mGeckoTextAccessible->ScrollSubstringTo(range.location, range.location + range.length, - nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE); + textAcc->ScrollSubstringTo(range.location, range.location + range.length, + nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE); return; } @@ -303,16 +297,6 @@ return nil; } -- (void)expire -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - - mGeckoTextAccessible = nullptr; - [super expire]; - - NS_OBJC_END_TRY_ABORT_BLOCK; -} - #pragma mark - - (BOOL)isReadOnly @@ -322,8 +306,10 @@ if ([[self role] isEqualToString:NSAccessibilityStaticTextRole]) return YES; - if (mGeckoTextAccessible) - return (mGeckoAccessible->State() & states::READONLY) == 0; + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (textAcc) + return (accWrap->State() & states::READONLY) == 0; return NO; @@ -332,8 +318,10 @@ - (NSNumber*)caretLineNumber { - int32_t lineNumber = mGeckoTextAccessible ? - mGeckoTextAccessible->CaretLineNumber() - 1 : -1; + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + int32_t lineNumber = textAcc ? + textAcc->CaretLineNumber() - 1 : -1; return (lineNumber >= 0) ? [NSNumber numberWithInt:lineNumber] : nil; } @@ -342,10 +330,12 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - if (mGeckoTextAccessible) { + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (textAcc) { nsString text; nsCocoaUtils::GetStringForNSString(aNewString, text); - mGeckoTextAccessible->ReplaceText(text); + textAcc->ReplaceText(text); } NS_OBJC_END_TRY_ABORT_BLOCK; @@ -353,7 +343,9 @@ - (NSString*)text { - if (!mGeckoAccessible || !mGeckoTextAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (!accWrap || !textAcc) return nil; // A password text field returns an empty value @@ -361,9 +353,7 @@ return @""; nsAutoString text; - mGeckoTextAccessible->TextSubstring(0, - nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, - text); + textAcc->TextSubstring(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text); return nsCocoaUtils::ToNSString(text); } @@ -371,10 +361,12 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - if (!mGeckoAccessible || !mGeckoTextAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (!accWrap || !textAcc) return 0; - return mGeckoTextAccessible ? mGeckoTextAccessible->CharacterCount() : 0; + return textAcc ? textAcc->CharacterCount() : 0; NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0); } @@ -383,9 +375,11 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - if (mGeckoTextAccessible) { + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (textAcc) { int32_t start = 0, end = 0; - mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end); + textAcc->SelectionBoundsAt(0, &start, &end); return (end - start); } return 0; @@ -397,12 +391,14 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (mGeckoTextAccessible) { + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (textAcc) { int32_t start = 0, end = 0; - mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end); + textAcc->SelectionBoundsAt(0, &start, &end); if (start != end) { nsAutoString selText; - mGeckoTextAccessible->TextSubstring(start, end, selText); + textAcc->TextSubstring(start, end, selText); return nsCocoaUtils::ToNSString(selText); } } @@ -415,17 +411,19 @@ { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (mGeckoTextAccessible) { + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (textAcc) { int32_t start = 0; int32_t end = 0; - int32_t count = mGeckoTextAccessible->SelectionCount(); + int32_t count = textAcc->SelectionCount(); if (count) { - mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end); + textAcc->SelectionBoundsAt(0, &start, &end); return [NSValue valueWithRange:NSMakeRange(start, end - start)]; } - start = mGeckoTextAccessible->CaretOffset(); + start = textAcc->CaretOffset(); return [NSValue valueWithRange:NSMakeRange(start != -1 ? start : 0, 0)]; } return [NSValue valueWithRange:NSMakeRange(0, 0)]; @@ -437,9 +435,11 @@ { // XXX this won't work with Textarea and such as we actually don't give // the visible character range. + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; return [NSValue valueWithRange: - NSMakeRange(0, mGeckoTextAccessible ? - mGeckoTextAccessible->CharacterCount() : 0)]; + NSMakeRange(0, textAcc ? + textAcc->CharacterCount() : 0)]; } - (void)valueDidChange @@ -460,11 +460,16 @@ - (NSString*)stringFromRange:(NSRange*)range { - NS_PRECONDITION(mGeckoTextAccessible && range, "no Gecko text accessible or range"); + NS_PRECONDITION(range, "no range"); + + AccessibleWrap* accWrap = [self getGeckoAccessible]; + HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr; + if (!textAcc) + return nil; nsAutoString text; - mGeckoTextAccessible->TextSubstring(range->location, - range->location + range->length, text); + textAcc->TextSubstring(range->location, + range->location + range->length, text); return nsCocoaUtils::ToNSString(text); } @@ -496,18 +501,20 @@ - (NSString*)text { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return nil; - return nsCocoaUtils::ToNSString(mGeckoAccessible->AsTextLeaf()->Text()); + return nsCocoaUtils::ToNSString(accWrap->AsTextLeaf()->Text()); } - (long)textLength { - if (!mGeckoAccessible) + AccessibleWrap* accWrap = [self getGeckoAccessible]; + if (!accWrap) return 0; - return mGeckoAccessible->AsTextLeaf()->Text().Length(); + return accWrap->AsTextLeaf()->Text().Length(); } @end diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/Platform.mm firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/Platform.mm --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/mac/Platform.mm 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/mac/Platform.mm 2015-05-25 20:42:34.000000000 +0000 @@ -47,6 +47,16 @@ ProxyEvent(ProxyAccessible*, uint32_t) { } + +void +ProxyStateChangeEvent(ProxyAccessible*, uint64_t, bool) +{ +} + +void +ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) +{ +} } } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/other/Platform.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/other/Platform.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/other/Platform.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/other/Platform.cpp 2015-05-25 20:42:34.000000000 +0000 @@ -33,3 +33,13 @@ a11y::ProxyEvent(ProxyAccessible*, uint32_t) { } + +void +a11y::ProxyStateChangeEvent(ProxyAccessible*, uint64_t, bool) +{ +} + +void +a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) +{ +} diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/elm/test_HTMLSpec.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/elm/test_HTMLSpec.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/elm/test_HTMLSpec.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/elm/test_HTMLSpec.html 2015-05-25 20:42:34.000000000 +0000 @@ -70,7 +70,7 @@ interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ], children: [ { - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, children: [ { role: ROLE_TEXT_LEAF } ] } ] @@ -81,7 +81,7 @@ // HTML:address obj = { - todo_role: ROLE_PARAGRAPH, + role: ROLE_TEXT_CONTAINER, interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ], }; testElm("address", obj); @@ -188,7 +188,7 @@ testElm("blockquote", obj); ////////////////////////////////////////////////////////////////////////// - // HTML:br + // HTML:br contained by paragraph obj = { role: ROLE_PARAGRAPH, @@ -1062,7 +1062,7 @@ // HTML:pre obj = { - role: ROLE_PARAGRAPH, + role: ROLE_TEXT_CONTAINER, interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ] }; testElm("pre", obj); @@ -1087,7 +1087,7 @@ // HTML:q obj = { - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ], children: [ { role: ROLE_STATICTEXT }, // left quote @@ -1233,7 +1233,7 @@ // HTML:time obj = { - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, attributes: { "xml-roles": "time", "datetime": "2001-05-15 19:00" }, interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ] }; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role/test_aria.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role/test_aria.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role/test_aria.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role/test_aria.html 2015-05-25 20:42:35.000000000 +0000 @@ -39,7 +39,7 @@ testRole("aria_list", ROLE_LIST); testRole("aria_listbox", ROLE_LISTBOX); testRole("aria_listitem", ROLE_LISTITEM); - testRole("aria_log", ROLE_TEXT_CONTAINER); // weak role + testRole("aria_log", ROLE_TEXT); // weak role testRole("aria_marquee", ROLE_ANIMATION); testRole("aria_math", ROLE_FLAT_EQUATION); testRole("aria_menu", ROLE_MENUPOPUP); @@ -48,7 +48,7 @@ testRole("aria_menuitemcheckbox", ROLE_CHECK_MENU_ITEM); testRole("aria_menuitemradio", ROLE_RADIO_MENU_ITEM); testRole("aria_note", ROLE_NOTE); - testRole("aria_presentation", ROLE_TEXT_CONTAINER); // weak role + testRole("aria_presentation", ROLE_TEXT); // weak role testRole("aria_progressbar", ROLE_PROGRESSBAR); testRole("aria_radio", ROLE_RADIOBUTTON); testRole("aria_radiogroup", ROLE_RADIO_GROUP); @@ -66,7 +66,7 @@ testRole("aria_tablist", ROLE_PAGETABLIST); testRole("aria_tabpanel", ROLE_PROPERTYPAGE); testRole("aria_textbox", ROLE_ENTRY); - testRole("aria_timer", ROLE_TEXT_CONTAINER); // weak role + testRole("aria_timer", ROLE_TEXT); // weak role testRole("aria_toolbar", ROLE_TOOLBAR); testRole("aria_tooltip", ROLE_TOOLTIP); testRole("aria_tree", ROLE_OUTLINE); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role/test_general.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role/test_general.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role/test_general.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role/test_general.html 2015-05-25 20:42:35.000000000 +0000 @@ -67,9 +67,9 @@ testRole("definitiondescription", ROLE_DEFINITION); // Has click, mousedown or mouseup listeners. - testRole("span1", ROLE_TEXT_CONTAINER); - testRole("span2", ROLE_TEXT_CONTAINER); - testRole("span3", ROLE_TEXT_CONTAINER); + testRole("span1", ROLE_TEXT); + testRole("span2", ROLE_TEXT); + testRole("span3", ROLE_TEXT); // Test role of listbox inside combobox testRole("listbox1", ROLE_COMBOBOX_LIST); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role.js firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role.js --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/role.js 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/role.js 2015-05-25 20:42:35.000000000 +0000 @@ -111,6 +111,7 @@ const ROLE_SWITCH = nsIAccessibleRole.ROLE_SWITCH; const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE; const ROLE_TERM = nsIAccessibleRole.ROLE_TERM; +const ROLE_TEXT = nsIAccessibleRole.ROLE_TEXT; const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER; const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF; const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_aria_list.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_aria_list.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_aria_list.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_aria_list.html 2015-05-25 20:42:35.000000000 +0000 @@ -35,7 +35,7 @@ role: ROLE_LIST, children: [ { // li - role: ROLE_PARAGRAPH, + role: ROLE_TEXT_CONTAINER, children: [ { // li text leaf role: ROLE_TEXT_LEAF, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_aria_presentation.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_aria_presentation.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_aria_presentation.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_aria_presentation.html 2015-05-25 20:42:35.000000000 +0000 @@ -73,10 +73,10 @@ // Presentation list, expose generic accesisble for list items. tree = { SECTION: [ // container - { PARAGRAPH: [ // li generic accessible inside 'presentation' role + { TEXT_CONTAINER: [ // li generic accessible inside 'presentation' role { TEXT_LEAF: [ ] } // li text ] }, - { PARAGRAPH: [ // li generic accessible inside 'none' role + { TEXT_CONTAINER: [ // li generic accessible inside 'none' role { TEXT_LEAF: [ ] } // li text ] } ] }; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_dockids.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_dockids.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_dockids.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_dockids.html 2015-05-25 20:42:35.000000000 +0000 @@ -20,15 +20,15 @@ { var tree = { DOCUMENT: [ - { PARAGRAPH: [ // head - { PARAGRAPH: [ // link + { TEXT_CONTAINER: [ // head + { TEXT_CONTAINER: [ // link { STATICTEXT: [] }, // generated content { STATICTEXT: [] } // generated content ] } ] }, { TEXT_LEAF: [ ] }, // body text { ENTRY: [ ] }, // input under document element - { PARAGRAPH: [ // link under document element + { TEXT_CONTAINER: [ // link under document element { TEXT_LEAF: [ ] }, // link content { STATICTEXT: [ ] }, // generated content { STATICTEXT: [ ] } // generated content diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_invalid_img.xhtml firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_invalid_img.xhtml --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_invalid_img.xhtml 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_invalid_img.xhtml 2015-05-25 20:42:35.000000000 +0000 @@ -20,7 +20,7 @@ document.getElementsByTagName("img")[0].firstChild.data = "2"; var accTree = { - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, children: [ { role: ROLE_TEXT_LEAF } ] }; testAccessibleTree("the_img", accTree); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_txtcntr.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_txtcntr.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/tree/test_txtcntr.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/tree/test_txtcntr.html 2015-05-25 20:42:35.000000000 +0000 @@ -120,7 +120,7 @@ children: [] }, { // abbr tag - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, name: "accessibility", children: [ { // text leaf with actual text @@ -150,7 +150,7 @@ children: [] }, { // acronym tag - role: ROLE_TEXT_CONTAINER, + role: ROLE_TEXT, name: "personal computer", children: [ { // text leaf with actual text diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/treeupdate/test_textleaf.html firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/treeupdate/test_textleaf.html --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/tests/mochitest/treeupdate/test_textleaf.html 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/tests/mochitest/treeupdate/test_textleaf.html 2015-05-25 20:42:35.000000000 +0000 @@ -84,7 +84,7 @@ } } - function removeTextData(aID) + function removeTextData(aID, aRole) { this.containerNode = getNode(aID); this.textNode = this.containerNode.firstChild; @@ -96,7 +96,7 @@ this.invoke = function removeTextData_invoke() { var tree = { - role: ROLE_PARAGRAPH, + role: aRole, children: [ { role: ROLE_TEXT_LEAF, @@ -112,7 +112,7 @@ this.finalCheck = function removeTextData_finalCheck() { var tree = { - role: ROLE_PARAGRAPH, + role: aRole, children: [] }; testAccessibleTree(this.containerNode, tree); @@ -147,8 +147,8 @@ gQueue.push(new setOnClickNRoleAttrs("span")); // text data removal of text node should remove its text accessible - gQueue.push(new removeTextData("p")); - gQueue.push(new removeTextData("pre")); + gQueue.push(new removeTextData("p", ROLE_PARAGRAPH)); + gQueue.push(new removeTextData("pre", ROLE_TEXT_CONTAINER)); gQueue.invoke(); // SimpleTest.finish() will be called in the end } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/msaa/nsWinUtils.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/msaa/nsWinUtils.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/msaa/nsWinUtils.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/msaa/nsWinUtils.cpp 2015-05-25 20:42:35.000000000 +0000 @@ -149,7 +149,10 @@ switch (msg) { case WM_GETOBJECT: { - if (lParam == OBJID_CLIENT) { + // Do explicit casting to make it working on 64bit systems (see bug 649236 + // for details). + int32_t objId = static_cast(lParam); + if (objId == OBJID_CLIENT) { DocAccessible* document = nsWinUtils::sHWNDCache->GetWeak(static_cast(hWnd)); if (document) { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/msaa/Platform.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/msaa/Platform.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/msaa/Platform.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/msaa/Platform.cpp 2015-05-25 20:42:35.000000000 +0000 @@ -58,3 +58,13 @@ a11y::ProxyEvent(ProxyAccessible*, uint32_t) { } + +void +a11y::ProxyStateChangeEvent(ProxyAccessible*, uint64_t, bool) +{ +} + +void +a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) +{ +} diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/sdn/sdnAccessible.cpp firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/sdn/sdnAccessible.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/accessible/windows/sdn/sdnAccessible.cpp 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/accessible/windows/sdn/sdnAccessible.cpp 2015-05-25 20:42:35.000000000 +0000 @@ -106,8 +106,11 @@ // focus events, to correlate back to data nodes in their internal object // model. Accessible* accessible = GetAccessible(); - *aUniqueID = - NS_PTR_TO_INT32(accessible ? accessible->UniqueID() : - static_cast(this)); + if (accessible) { + *aUniqueID = AccessibleWrap::GetChildIDFor(accessible); + } else { + *aUniqueID = - NS_PTR_TO_INT32(static_cast(this)); + } *aNumChildren = mNode->GetChildCount(); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/sdk/net/url.js firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/sdk/net/url.js --- firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/sdk/net/url.js 2015-05-13 18:05:56.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/sdk/net/url.js 2015-05-25 20:42:36.000000000 +0000 @@ -35,19 +35,14 @@ options = options || {}; let charset = options.charset || 'UTF-8'; - let channel = NetUtil.newChannel2(uri, - charset, - null, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + let channel = NetUtil.newChannel({ + uri: NetUtil.newURI(uri, charset), + loadUsingSystemPrincipal: true}); let { promise, resolve, reject } = defer(); try { - NetUtil.asyncFetch2(channel, function (stream, result) { + NetUtil.asyncFetch(channel, function (stream, result) { if (components.isSuccessCode(result)) { let count = stream.available(); let data = NetUtil.readInputStreamToString(stream, count, { charset : charset }); @@ -83,14 +78,9 @@ function readURISync(uri, charset) { charset = typeof charset === "string" ? charset : "UTF-8"; - let channel = NetUtil.newChannel2(uri, - charset, - null, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + let channel = NetUtil.newChannel({ + uri: NetUtil.newURI(uri, charset), + loadUsingSystemPrincipal: true}); let stream = channel.open(); let count = stream.available(); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/sdk/url.js firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/sdk/url.js --- firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/sdk/url.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/sdk/url.js 2015-05-25 20:42:37.000000000 +0000 @@ -152,20 +152,28 @@ Object.defineProperties(this, { toString: { - value() new String(uri.spec).toString(), + value() { + return new String(uri.spec).toString(); + }, enumerable: false }, valueOf: { - value() new String(uri.spec).valueOf(), + value() { + return new String(uri.spec).valueOf(); + }, enumerable: false }, toSource: { - value() new String(uri.spec).toSource(), + value() { + return new String(uri.spec).toSource(); + }, enumerable: false }, // makes more sense to flatten to string, easier to travel across JSON toJSON: { - value() new String(uri.spec).toString(), + value() { + return new String(uri.spec).toString(); + }, enumerable: false } }); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/toolkit/loader.js firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/toolkit/loader.js --- firefox-trunk-41.0~a1~hg20150513r243603/addon-sdk/source/lib/toolkit/loader.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/addon-sdk/source/lib/toolkit/loader.js 2015-05-25 20:42:37.000000000 +0000 @@ -178,14 +178,10 @@ uri = proto.resolveURI(nsURI); } - let stream = NetUtil.newChannel2(uri, - 'UTF-8', - null, - null, // aLoadingNode - systemPrincipal, - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER).open(); + let stream = NetUtil.newChannel({ + uri: NetUtil.newURI(uri, 'UTF-8'), + loadUsingSystemPrincipal: true} + ).open(); let count = stream.available(); let data = NetUtil.readInputStreamToString(stream, count, { charset: 'UTF-8' diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/app/b2g.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/app/b2g.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/app/b2g.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/app/b2g.js 2015-05-25 20:42:39.000000000 +0000 @@ -88,7 +88,6 @@ pref("network.cookie.cookieBehavior", 0); // spdy -pref("network.http.spdy.enabled.http2draft", true); pref("network.http.spdy.push-allowance", 32768); // See bug 545869 for details on why these are set the way they are @@ -740,13 +739,9 @@ pref("hal.processPriorityManager.gonk.FOREGROUND_KEYBOARD.cgroup", "apps"); pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.OomScoreAdjust", 400); -pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.KillUnderKB", 7168); +pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.KillUnderKB", 8192); pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.cgroup", "apps/bg_perceivable"); -pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.OomScoreAdjust", 534); -pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.KillUnderKB", 8192); -pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.cgroup", "apps/bg_non_interactive"); - pref("hal.processPriorityManager.gonk.BACKGROUND.OomScoreAdjust", 667); pref("hal.processPriorityManager.gonk.BACKGROUND.KillUnderKB", 20480); pref("hal.processPriorityManager.gonk.BACKGROUND.cgroup", "apps/bg_non_interactive"); @@ -804,13 +799,11 @@ // blocked on a poll(), and this pref has no effect.) pref("gonk.systemMemoryPressureRecoveryPollMS", 5000); -#ifndef DEBUG // Enable pre-launching content processes for improved startup time // (hiding latency). pref("dom.ipc.processPrelaunch.enabled", true); // Wait this long before pre-launching a new subprocess. pref("dom.ipc.processPrelaunch.delayMs", 5000); -#endif pref("dom.ipc.reuse_parent_app", false); @@ -991,7 +984,7 @@ pref("gfx.gralloc.fence-with-readpixels", true); // The url of the page used to display network error details. -pref("b2g.neterror.url", "app://system.gaiamobile.org/net_error.html"); +pref("b2g.neterror.url", "net_error.html"); // The origin used for the shared themes uri space. pref("b2g.theme.origin", "app://theme.gaiamobile.org"); @@ -1140,3 +1133,6 @@ // mulet apparently loads firefox.js as well as b2g.js, so we have to explicitly // disable serviceworkers here to get them disabled in mulet. pref("dom.serviceWorkers.enabled", false); + +// Retain at most 10 processes' layers buffers +pref("layers.compositor-lru-size", 10); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/app/B2GLoader.cpp firefox-trunk-41.0~a1~hg20150524r245419/b2g/app/B2GLoader.cpp --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/app/B2GLoader.cpp 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/app/B2GLoader.cpp 2015-05-25 20:42:39.000000000 +0000 @@ -219,6 +219,13 @@ aReservedFds); } + // Reap zombie child process. + struct sigaction sa; + sa.sa_handler = SIG_IGN; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sigaction(SIGCHLD, &sa, nullptr); + // The b2g process int childPid = pid; XRE_ProcLoaderClientInit(childPid, parentSock, aReservedFds); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/chrome/content/shell.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/chrome/content/shell.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/chrome/content/shell.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/chrome/content/shell.js 2015-05-25 20:42:39.000000000 +0000 @@ -636,7 +636,27 @@ } delete shell.pendingChromeEvents; }); - } + + shell.handleCmdLine(); + }, + + handleCmdLine: function shell_handleCmdLine() { +#ifndef MOZ_WIDGET_GONK + let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"] + .getService(Ci.nsISupports); + let args = b2gcmds.wrappedJSObject.cmdLine; + try { + // Returns null if -url is not present + let url = args.handleFlagWithParam("url", false); + if (url) { + this.sendChromeEvent({type: "mozbrowseropenwindow", url}); + args.preventDefault = true; + } + } catch(e) { + // Throws if -url is present with no params + } +#endif + }, }; Services.obs.addObserver(function onFullscreenOriginChange(subject, topic, data) { @@ -1086,7 +1106,12 @@ // We must set the size in KB, and keep a bit of free space. let size = Math.floor(stats.totalBytes / 1024) - 1024; - Services.prefs.setIntPref("browser.cache.disk.capacity", size); + + // keep the default value if it is smaller than the physical partition size. + let oldSize = Services.prefs.getIntPref("browser.cache.disk.capacity"); + if (size < oldSize) { + Services.prefs.setIntPref("browser.cache.disk.capacity", size); + } })(); #endif diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/AboutServiceWorkers.jsm firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/AboutServiceWorkers.jsm --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/AboutServiceWorkers.jsm 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/AboutServiceWorkers.jsm 2015-05-25 20:42:39.000000000 +0000 @@ -4,7 +4,7 @@ "use strict" -this.EXPORTED_SYMBOLS = []; +this.EXPORTED_SYMBOLS = ["AboutServiceWorkers"]; const { interfaces: Ci, utils: Cu } = Components; @@ -47,19 +47,6 @@ return result; } -function sendResult(aId, aResult) { - SystemAppProxy._sendCustomEvent("mozAboutServiceWorkersChromeEvent", { - id: aId, - result: aResult - }); -} - -function sendError(aId, aError) { - SystemAppProxy._sendCustomEvent("mozAboutServiceWorkersChromeEvent", { - id: aId, - error: aError - }); -} this.AboutServiceWorkers = { get enabled() { @@ -75,7 +62,21 @@ init: function() { SystemAppProxy.addEventListener("mozAboutServiceWorkersContentEvent", - AboutServiceWorkers); + AboutServiceWorkers); + }, + + sendResult: function(aId, aResult) { + SystemAppProxy._sendCustomEvent("mozAboutServiceWorkersChromeEvent", { + id: aId, + result: aResult + }); + }, + + sendError: function(aId, aError) { + SystemAppProxy._sendCustomEvent("mozAboutServiceWorkersChromeEvent", { + id: aId, + error: aError + }); }, handleEvent: function(aEvent) { @@ -88,10 +89,12 @@ return; } + let self = AboutServiceWorkers; + switch(message.name) { case "init": - if (!this.enabled) { - sendResult({ + if (!self.enabled) { + self.sendResult(message.id, { enabled: false, registrations: [] }); @@ -100,7 +103,7 @@ let data = gServiceWorkerManager.getAllRegistrations(); if (!data) { - sendError(message.id, "NoServiceWorkersRegistrations"); + self.sendError(message.id, "NoServiceWorkersRegistrations"); return; } @@ -116,26 +119,26 @@ registrations.push(serializeServiceWorkerInfo(info)); } - sendResult(message.id, { - enabled: this.enabled, + self.sendResult(message.id, { + enabled: self.enabled, registrations: registrations }); break; case "update": if (!message.scope) { - sendError(message.id, "MissingScope"); + self.sendError(message.id, "MissingScope"); return; } - gServiceWorkerManager.update(message.scope); - sendResult(message.id, true); + gServiceWorkerManager.softUpdate(message.scope); + self.sendResult(message.id, true); break; case "unregister": if (!message.principal || !message.principal.origin || !message.principal.appId) { - sendError("MissingPrincipal"); + self.sendError("MissingPrincipal"); return; } @@ -146,17 +149,17 @@ ); if (!message.scope) { - sendError("MissingScope"); + self.sendError("MissingScope"); return; } let serviceWorkerUnregisterCallback = { unregisterSucceeded: function() { - sendResult(message.id, true); + self.sendResult(message.id, true); }, unregisterFailed: function() { - sendError(message.id, "UnregisterError"); + self.sendError(message.id, "UnregisterError"); }, QueryInterface: XPCOMUtils.generateQI([ diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/AlertsHelper.jsm firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/AlertsHelper.jsm --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/AlertsHelper.jsm 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/AlertsHelper.jsm 2015-05-25 20:42:39.000000000 +0000 @@ -232,7 +232,7 @@ }, showNotification: function(imageURL, title, text, textClickable, cookie, - uid, bidi, lang, dataObj, manifestURL, timestamp, + uid, dir, lang, dataObj, manifestURL, timestamp, behavior) { function send(appName, appIcon) { SystemAppProxy._sendCustomEvent(kMozChromeNotificationEvent, { @@ -241,7 +241,7 @@ icon: imageURL, title: title, text: text, - bidi: bidi, + dir: dir, lang: lang, appName: appName, appIcon: appIcon, @@ -276,7 +276,7 @@ let dataObj = this.deserializeStructuredClone(data.dataStr); this.registerListener(data.name, data.cookie, data.alertListener); this.showNotification(data.imageURL, data.title, data.text, - data.textClickable, data.cookie, data.name, data.bidi, + data.textClickable, data.cookie, data.name, data.dir, data.lang, dataObj, null, data.inPrivateBrowsing); }, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/B2GAboutRedirector.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/B2GAboutRedirector.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/B2GAboutRedirector.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/B2GAboutRedirector.js 2015-05-25 20:42:39.000000000 +0000 @@ -12,11 +12,11 @@ } function netErrorURL() { - let uri = "app://system.gaiamobile.org/net_error.html"; - try { - uri = Services.prefs.getCharPref("b2g.neterror.url"); - } catch(e) {} - return uri; + let systemManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url"); + systemManifestURL = Services.io.newURI(systemManifestURL, null, null); + let netErrorURL = Services.prefs.getCharPref("b2g.neterror.url"); + netErrorURL = Services.io.newURI(netErrorURL, null, systemManifestURL); + return netErrorURL.spec; } let modules = { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/CommandLine.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/CommandLine.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/CommandLine.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/CommandLine.js 2015-05-25 20:42:39.000000000 +0000 @@ -15,6 +15,10 @@ CommandlineHandler.prototype = { handle: function(cmdLine) { this.cmdLine = cmdLine; + let win = Services.wm.getMostRecentWindow("navigator:browser"); + if (win && win.shell) { + win.shell.handleCmdLine(); + } }, helpInfo: "", diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/mochitest/screenshot_helper.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/mochitest/screenshot_helper.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/mochitest/screenshot_helper.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/mochitest/screenshot_helper.js 2015-05-25 20:42:40.000000000 +0000 @@ -1,6 +1,8 @@ const Cu = Components.utils; const Ci = Components.interfaces; +Cu.importGlobalProperties(['File']); + const { Services } = Cu.import("resource://gre/modules/Services.jsm"); // Load a duplicated copy of the jsm to prevent messing with the currently running one @@ -25,7 +27,7 @@ let steps = [ function getScreenshot() { let screenshot = Screenshot.get(); - assert.ok(screenshot instanceof Ci.nsIDOMFile, + assert.ok(screenshot instanceof File, "Screenshot.get() returns a File"); next(); }, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/test_aboutserviceworkers.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/test_aboutserviceworkers.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/test_aboutserviceworkers.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/test_aboutserviceworkers.js 2015-05-25 20:42:40.000000000 +0000 @@ -0,0 +1,139 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const {utils: Cu} = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "AboutServiceWorkers", + "resource://gre/modules/AboutServiceWorkers.jsm"); + +XPCOMUtils.defineLazyServiceGetter(this, "gServiceWorkerManager", + "@mozilla.org/serviceworkers/manager;1", + "nsIServiceWorkerManager"); + +const CHROME_MSG = "mozAboutServiceWorkersChromeEvent"; + +const ORIGINAL_SENDRESULT = AboutServiceWorkers.sendResult; +const ORIGINAL_SENDERROR = AboutServiceWorkers.sendError; + +do_get_profile(); + +let mockSendResult = (aId, aResult) => { + let msg = { + id: aId, + result: aResult + }; + Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null); +}; + +let mockSendError = (aId, aError) => { + let msg = { + id: aId, + result: aError + }; + Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null); +}; + +function attachMocks() { + AboutServiceWorkers.sendResult = mockSendResult; + AboutServiceWorkers.sendError = mockSendError; +} + +function restoreMocks() { + AboutServiceWorkers.sendResult = ORIGINAL_SENDRESULT; + AboutServiceWorkers.sendError = ORIGINAL_SENDERROR; +} + +do_register_cleanup(restoreMocks); + +function run_test() { + run_next_test(); +} + +/** + * "init" tests + */ +[ +// Pref disabled, no registrations +{ + prefEnabled: false, + expectedMessage: { + id: Date.now(), + result: { + enabled: false, + registrations: [] + } + } +}, +// Pref enabled, no registrations +{ + prefEnabled: true, + expectedMessage: { + id: Date.now(), + result: { + enabled: true, + registrations: [] + } + } +}].forEach(test => { + add_test(function() { + Services.prefs.setBoolPref("dom.serviceWorkers.enabled", test.prefEnabled); + + let id = test.expectedMessage.id; + + function onMessage(subject, topic, data) { + let message = subject.wrappedJSObject; + let expected = test.expectedMessage; + + do_check_true(message.id, "Message should have id"); + do_check_eq(message.id, test.expectedMessage.id, + "Id should be the expected one"); + do_check_eq(message.result.enabled, expected.result.enabled, + "Pref should be disabled"); + do_check_true(message.result.registrations, "Registrations should exist"); + do_check_eq(message.result.registrations.length, + expected.result.registrations.length, + "Registrations length should be the expected one"); + + Services.obs.removeObserver(onMessage, CHROME_MSG); + + run_next_test(); + } + + Services.obs.addObserver(onMessage, CHROME_MSG, false); + + attachMocks(); + + AboutServiceWorkers.handleEvent({ detail: { + id: id, + name: "init" + }}); + }); +}); + +/** + * ServiceWorkerManager tests. + */ + +// We cannot register a sw via ServiceWorkerManager cause chrome +// registrations are not allowed. +// All we can do for now is to test the interface of the swm. +add_test(function test_swm() { + do_check_true(gServiceWorkerManager, "SWM exists"); + do_check_true(gServiceWorkerManager.getAllRegistrations, + "SWM.getAllRegistrations exists"); + do_check_true(typeof gServiceWorkerManager.getAllRegistrations == "function", + "SWM.getAllRegistrations is a function"); + do_check_true(gServiceWorkerManager.softUpdate, "SWM.softUpdate exists"); + do_check_true(typeof gServiceWorkerManager.softUpdate == "function", + "SWM.softUpdate is a function"); + do_check_true(gServiceWorkerManager.unregister, "SWM.unregister exists"); + do_check_true(typeof gServiceWorkerManager.unregister == "function", + "SWM.unregister exists"); + + run_next_test(); +}); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/test_logshake_gonk.js firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/test_logshake_gonk.js --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/test_logshake_gonk.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/test_logshake_gonk.js 2015-05-25 20:42:40.000000000 +0000 @@ -52,8 +52,6 @@ let vol = volumeService.getVolumeByName(volName); ok(vol, "volume shouldn't be null"); equal(volName, vol.name, "name"); - - volumeService.SetFakeVolumeState(volName, Ci.nsIVolume.STATE_MOUNTED); equal(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state"); run_next_test(); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/xpcshell.ini firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/xpcshell.ini --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/components/test/unit/xpcshell.ini 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/components/test/unit/xpcshell.ini 2015-05-25 20:42:40.000000000 +0000 @@ -28,3 +28,5 @@ [test_logshake_gonk.js] # only run on b2g builds due to requiring b2g-specific log files to exist skip-if = (toolkit != "gonk") + +[test_aboutserviceworkers.js] diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/config.json firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/config.json --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/config.json 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/config.json 2015-05-25 20:42:40.000000000 +0000 @@ -0,0 +1,47 @@ +{ + "config_version": 2, + "tooltool_manifest": "releng-aries.tt", + "mock_target": "mozilla-centos6-x86_64", + "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2", "dosfstools"], + "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "build_targets": [], + "upload_files": [ + "{objdir}/dist/b2g-*.crashreporter-symbols.zip", + "{objdir}/dist/b2g-*.tar.gz", + "{workdir}/sources.xml" + ], + "public_upload_files": [ + "{objdir}/dist/b2g-*.crashreporter-symbols.zip", + "{objdir}/dist/b2g-*.tar.gz", + "{workdir}/sources.xml", + "{objdir}/dist/b2g-update/*.mar" + ], + "zip_files": [ + ["{workdir}/out/target/product/aries/*.img", "out/target/product/aries/"], + "{workdir}/flash.sh", + "{workdir}/load-config.sh", + "{workdir}/.config", + "{workdir}/sources.xml", + "{workdir}/profile.sh", + ["{workdir}/gecko/tools/profiler/merge-profiles.py", "gecko/tools/profiler/"], + ["{workdir}/scripts/profile-symbolicate.py", "scripts/"], + ["{workdir}/gecko/tools/rb/fix_stack_using_bpsyms.py", "gecko/tools/rb/"] + ], + "env": { + "VARIANT": "user", + "MOZILLA_OFFICIAL": "1", + "MOZ_TELEMETRY_REPORTING": "1", + "B2G_UPDATE_CHANNEL": "nightly", + "GAIA_KEYBOARD_LAYOUTS": "en,pt-BR,es,de,fr,pl,zh-Hans-Pinyin,zh-Hant-Zhuyin,en-Dvorak" + }, + "b2g_manifest": "aries.xml", + "b2g_manifest_intree": true, + "additional_source_tarballs": ["backup-aries.tar.xz"], + "gecko_l10n_root": "https://hg.mozilla.org/l10n-central", + "gaia": { + "l10n": { + "vcs": "hgtool", + "root": "https://hg.mozilla.org/gaia-l10n" + } + } +} diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/releng-aries.tt firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/releng-aries.tt --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/releng-aries.tt 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/releng-aries.tt 2015-05-25 20:42:40.000000000 +0000 @@ -0,0 +1,16 @@ +[ +{ +"size": 135359412, +"digest": "45e677c9606cc4eec44ef4761df47ff431df1ffad17a5c6d21ce700a1c47f79e87a4aa9f30ae47ff060bd64f5b775d995780d88211f9a759ffa0d076beb4816b", +"algorithm": "sha512", +"filename": "backup-aries.tar.xz", +"comment": "v18D" +}, +{ +"size": 80458572, +"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad", +"algorithm": "sha512", +"filename": "gcc.tar.xz", +"unpack": "True" +} +] diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/aries/sources.xml 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/aries/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/dolphin/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/dolphin/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/dolphin/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/dolphin/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -12,18 +12,18 @@ - + - + - + - + - + @@ -43,7 +43,7 @@ - + @@ -106,7 +106,7 @@ - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator/config.json firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator/config.json --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator/config.json 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator/config.json 2015-05-25 20:42:40.000000000 +0000 @@ -10,6 +10,7 @@ "{workdir}/out/target/product/generic/tests/*.zip", "{workdir}/out/emulator.tar.gz", "{objdir}/dist/b2g-*.crashreporter-symbols.zip", + "{objdir}/dist/test_packages.json", "{workdir}/sources.xml" ], "public_upload_files": [ diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -19,12 +19,12 @@ - - + + - - - + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-ics/config.json firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-ics/config.json --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-ics/config.json 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-ics/config.json 2015-05-25 20:42:40.000000000 +0000 @@ -10,6 +10,7 @@ "{workdir}/out/target/product/generic/tests/*.zip", "{workdir}/out/emulator.tar.gz", "{objdir}/dist/b2g-*.crashreporter-symbols.zip", + "{objdir}/dist/test_packages.json", "{workdir}/sources.xml" ], "upload_platform": "emulator-ics", diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-ics/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-ics/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-ics/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-ics/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -19,12 +19,12 @@ - - + + - - - + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-jb/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-jb/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-jb/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-jb/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -17,10 +17,10 @@ - - - - + + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-kk/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-kk/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-kk/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-kk/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -12,18 +12,18 @@ - + - + - + - + - + @@ -128,11 +128,11 @@ - + - - + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-l/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-l/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-l/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-l/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -15,15 +15,15 @@ - + - + - + - + @@ -144,7 +144,7 @@ - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-x86-kk/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-x86-kk/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-x86-kk/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-x86-kk/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -12,18 +12,18 @@ - + - + - + - + - + @@ -128,11 +128,11 @@ - + - - + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-x86-l/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-x86-l/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/emulator-x86-l/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/emulator-x86-l/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -15,15 +15,15 @@ - + - + - + - + @@ -144,7 +144,7 @@ - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/flame/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/flame/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/flame/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/flame/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -17,9 +17,9 @@ - + - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/flame-kk/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/flame-kk/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/flame-kk/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/flame-kk/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -12,18 +12,18 @@ - + - + - + - + - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/gaia.json firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/gaia.json --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/gaia.json 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/gaia.json 2015-05-25 20:42:40.000000000 +0000 @@ -1,9 +1,9 @@ { "git": { - "git_revision": "0d6c04f13fd385bda045f4e539b2a67cb5d84b1d", + "git_revision": "5bcc08a732163087999251b523e3643db397412c", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "4f0c2bfc450d56679bd44c53b4492cb850549f78", + "revision": "66ad152ea50938f799bf7edd4bc2088f47b85c00", "repo_path": "integration/gaia-central" } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/nexus-4/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/nexus-4/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/nexus-4/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/nexus-4/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -17,10 +17,10 @@ - - - - + + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/nexus-5-l/sources.xml firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/nexus-5-l/sources.xml --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/config/nexus-5-l/sources.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/config/nexus-5-l/sources.xml 2015-05-25 20:42:40.000000000 +0000 @@ -15,15 +15,15 @@ - + - + - + - + @@ -141,7 +141,7 @@ - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/b2g/installer/package-manifest.in firefox-trunk-41.0~a1~hg20150524r245419/b2g/installer/package-manifest.in --- firefox-trunk-41.0~a1~hg20150513r243603/b2g/installer/package-manifest.in 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/b2g/installer/package-manifest.in 2015-05-25 20:42:40.000000000 +0000 @@ -439,6 +439,10 @@ @RESPATH@/components/TCPPresentationServer.js #ifdef MOZ_SECUREELEMENT +@RESPATH@/components/ACEService.js +@RESPATH@/components/ACEService.manifest +@RESPATH@/components/GPAccessRulesManager.js +@RESPATH@/components/GPAccessRulesManager.manifest @RESPATH@/components/SecureElement.js @RESPATH@/components/SecureElement.manifest @RESPATH@/components/UiccConnector.js @@ -491,6 +495,8 @@ #if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL) @RESPATH@/components/CellBroadcastService.js @RESPATH@/components/CellBroadcastService.manifest +@RESPATH@/components/DataCallManager.js +@RESPATH@/components/DataCallManager.manifest @BINPATH@/components/IccService.js @BINPATH@/components/IccService.manifest @RESPATH@/components/MmsService.js @@ -498,6 +504,8 @@ @RESPATH@/components/MobileMessageDatabaseService.js @RESPATH@/components/MobileMessageDatabaseService.manifest #ifndef DISABLE_MOZ_RIL_GEOLOC +@RESPATH@/components/DataCallInterfaceService.js +@RESPATH@/components/DataCallInterfaceService.manifest @RESPATH@/components/MobileConnectionService.js @RESPATH@/components/MobileConnectionService.manifest @RESPATH@/components/RadioInterfaceLayer.js @@ -511,6 +519,8 @@ @RESPATH@/components/RILSystemMessengerHelper.manifest @RESPATH@/components/TelephonyAudioService.js @RESPATH@/components/TelephonyAudioService.manifest +@RESPATH@/components/USSDReceivedWrapper.js +@RESPATH@/components/USSDReceivedWrapper.manifest #ifndef DISABLE_MOZ_RIL_GEOLOC @RESPATH@/components/TelephonyService.js @RESPATH@/components/TelephonyService.manifest diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/app/blocklist.xml firefox-trunk-41.0~a1~hg20150524r245419/browser/app/blocklist.xml --- firefox-trunk-41.0~a1~hg20150513r243603/browser/app/blocklist.xml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/app/blocklist.xml 2015-05-25 20:42:40.000000000 +0000 @@ -1,5 +1,5 @@ - + @@ -2970,6 +2970,30 @@ https://get.adobe.com/flashplayer/ + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/app/profile/firefox.js firefox-trunk-41.0~a1~hg20150524r245419/browser/app/profile/firefox.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/app/profile/firefox.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/app/profile/firefox.js 2015-05-25 20:42:40.000000000 +0000 @@ -198,7 +198,7 @@ pref("app.update.idletime", 60); // Whether or not we show a dialog box informing the user that the update was -// successfully applied. This is off in Firefox by default since we show a +// successfully applied. This is off in Firefox by default since we show a // upgrade start page instead! Other apps may wish to show this UI, and supply // a whatsNewURL field in their brand.properties that contains a link to a page // which tells users what's new in this new update. @@ -225,10 +225,10 @@ pref("extensions.update.enabled", true); pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); -pref("extensions.update.interval", 86400); // Check for updates to Extensions and +pref("extensions.update.interval", 86400); // Check for updates to Extensions and // Themes every day // Non-symmetric (not shared by extensions) extension-specific [update] preferences -pref("extensions.dss.enabled", false); // Dynamic Skin Switching +pref("extensions.dss.enabled", false); // Dynamic Skin Switching pref("extensions.dss.switchPending", false); // Non-dynamic switch pending after next // restart. @@ -359,7 +359,7 @@ pref("browser.download.debug", false); // Number of milliseconds to wait for the http headers (and thus -// the Content-Disposition filename) before giving up and falling back to +// the Content-Disposition filename) before giving up and falling back to // picking a filename without that info in hand so that the user sees some // feedback from their action. pref("browser.download.saveLinkAsFilenameTimeout", 4000); @@ -383,10 +383,14 @@ // search engines URL pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/"); +// Tell the search service to load search plugins from the locale JAR +pref("browser.search.loadFromJars", true); +pref("browser.search.jarURIs", "chrome://browser/locale/searchplugins/"); + // pointer to the default engine name pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties"); -// Ordering of Search Engines in the Engine list. +// Ordering of Search Engines in the Engine list. pref("browser.search.order.1", "chrome://browser-region/locale/region.properties"); pref("browser.search.order.2", "chrome://browser-region/locale/region.properties"); pref("browser.search.order.3", "chrome://browser-region/locale/region.properties"); @@ -458,7 +462,7 @@ pref("browser.tabs.drawInTitlebar", true); #endif -// When tabs opened by links in other tabs via a combination of +// When tabs opened by links in other tabs via a combination of // browser.link.open_newwindow being set to 3 and target="_blank" etc are // closed: // true return to the tab that opened this tab (its owner) @@ -472,7 +476,7 @@ // be exported as HTML to the bookmarks.html file. pref("browser.bookmarks.autoExportHTML", false); -// The maximum number of daily bookmark backups to +// The maximum number of daily bookmark backups to // keep in {PROFILEDIR}/bookmarkbackups. Special values: // -1: unlimited // 0: no backups created (and deletes all existing backups) @@ -485,7 +489,7 @@ pref("general.warnOnAboutConfig", false); #endif -// This is the pref to control the location bar, change this to true to +// This is the pref to control the location bar, change this to true to // force this - this makes the origin of popup windows more obvious to avoid // spoofing. We would rather not do it by default because it affects UE for web // applications, but without it there isn't a really good way to prevent chrome @@ -913,7 +917,7 @@ // At startup, if the handler service notices that the version number in the // region.properties file is newer than the version number in the handler // service datastore, it will add any new handlers it finds in the prefs (as -// seeded by this file) to its datastore. +// seeded by this file) to its datastore. pref("gecko.handlerService.defaultHandlersVersion", "chrome://browser-region/locale/region.properties"); // The default set of web-based protocol handlers shown in the application @@ -1210,6 +1214,9 @@ pref("security.sandbox.content.level", 0); #endif +// ID (a UUID when set by gecko) that is used as a per profile suffix to a low +// integrity temp directory. +pref("security.sandbox.content.tempDirSuffix", ""); #if defined(MOZ_STACKWALKING) // This controls the depth of stack trace that is logged when Windows sandbox @@ -1332,6 +1339,8 @@ #ifdef MOZ_DEV_EDITION sticky_pref("lightweightThemes.selectedThemeID", "firefox-devedition@mozilla.org"); sticky_pref("browser.devedition.theme.enabled", true); +#else +sticky_pref("lightweightThemes.selectedThemeID", ""); #endif // Developer edition promo preferences @@ -1373,7 +1382,7 @@ // Toolbox Button preferences pref("devtools.command-button-pick.enabled", true); -pref("devtools.command-button-frames.enabled", false); +pref("devtools.command-button-frames.enabled", true); pref("devtools.command-button-splitconsole.enabled", true); pref("devtools.command-button-paintflashing.enabled", false); pref("devtools.command-button-tilt.enabled", false); @@ -1401,6 +1410,8 @@ pref("devtools.inspector.showAllAnonymousContent", false); // Enable the MDN docs tooltip pref("devtools.inspector.mdnDocsTooltip.enabled", true); +// Show the new animation inspector UI +pref("devtools.inspector.animationInspectorV3", false); // DevTools default color unit pref("devtools.defaultColorUnit", "hex"); @@ -1435,7 +1446,9 @@ // The default Performance UI settings pref("devtools.performance.memory.sample-probability", "0.05"); -pref("devtools.performance.memory.max-log-length", 2147483647); // Math.pow(2,31) - 1 +// Can't go higher than this without causing internal allocation overflows while +// serializing the allocations data over the RDP. +pref("devtools.performance.memory.max-log-length", 125000); pref("devtools.performance.timeline.hidden-markers", "[]"); pref("devtools.performance.profiler.buffer-size", 10000000); pref("devtools.performance.profiler.sample-frequency-khz", 1); @@ -1447,13 +1460,12 @@ pref("devtools.performance.ui.enable-memory", false); pref("devtools.performance.ui.enable-framerate", true); pref("devtools.performance.ui.show-jit-optimizations", false); -// If in aurora/dev edition (40.0, will revert for 40.1), set default -// to retro mode. -// TODO bug 1160313 -#ifdef MOZ_DEV_EDITION - pref("devtools.performance.ui.retro-mode", true); + +// Enable experimental options in the UI only in Nightly +#if defined(NIGHTLY_BUILD) +pref("devtools.performance.ui.experimental", true); #else - pref("devtools.performance.ui.retro-mode", false); +pref("devtools.performance.ui.experimental", false); #endif // The default cache UI setting @@ -1632,6 +1644,9 @@ // Remembers if the about:newtab intro has been shown pref("browser.newtabpage.introShown", false); +// Remembers if the about:newtab update intro has been shown +pref("browser.newtabpage.updateIntroShown", false); + // Toggles the content of 'about:newtab'. Shows the grid when enabled. pref("browser.newtabpage.enabled", true); @@ -1689,6 +1704,7 @@ pref("image.mem.max_decoded_image_kb", 256000); pref("loop.enabled", true); +pref("loop.textChat.enabled", false); pref("loop.server", "https://loop.services.mozilla.com/v0"); pref("loop.seenToS", "unseen"); pref("loop.showPartnerLogo", true); @@ -1764,19 +1780,11 @@ #endif #ifdef XP_MACOSX -#ifdef RELEASE_BUILD pref("geo.provider.use_corelocation", false); -#else -pref("geo.provider.use_corelocation", true); -#endif #endif #ifdef XP_WIN -#ifdef RELEASE_BUILD pref("geo.provider.ms-windows-location", false); -#else -pref("geo.provider.ms-windows-location", true); -#endif #endif // Necko IPC security checks only needed for app isolation for cookies/cache/etc: @@ -1907,14 +1915,11 @@ // Don't limit how many nodes we care about on desktop: pref("reader.parse-node-limit", 0); -// Enable Service workers for desktop on non-release builds -#ifdef NIGHTLY_BUILD -pref("dom.serviceWorkers.enabled", true); -#endif - pref("browser.pocket.enabled", true); pref("browser.pocket.api", "api.getpocket.com"); pref("browser.pocket.site", "getpocket.com"); pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4"); pref("browser.pocket.useLocaleList", true); -pref("browser.pocket.enabledLocales", "en-US de es-ES ja ru"); +pref("browser.pocket.enabledLocales", "en-US de es-ES ja ja-JP-mac ru"); + +pref("view_source.tab", true); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/abouthome/aboutHome.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/abouthome/aboutHome.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/abouthome/aboutHome.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/abouthome/aboutHome.js 2015-05-25 20:42:40.000000000 +0000 @@ -307,11 +307,19 @@ if (engineName && searchTerms.length > 0) { // Send an event that will perform a search and Firefox Health Report will // record that a search from about:home has occurred. - let useNewTab = aEvent && aEvent.button == 1; let eventData = { engineName: engineName, searchTerms: searchTerms, - useNewTab: useNewTab, + originalEvent: { + target: { + ownerDocument: null + }, + shiftKey: aEvent.shiftKey, + ctrlKey: aEvent.ctrlKey, + metaKey: aEvent.metaKey, + altKey: aEvent.altKey, + button: aEvent.button, + }, }; if (searchText.hasAttribute("selection-index")) { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/aboutSocialError.xhtml firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/aboutSocialError.xhtml --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/aboutSocialError.xhtml 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/aboutSocialError.xhtml 2015-05-25 20:42:40.000000000 +0000 @@ -46,13 +46,14 @@ } function parseQueryString() { - let searchParams = new URLSearchParams(location.href.split("?")[1]); + let searchParams = new URLSearchParams(document.documentURI.split("?")[1]); let mode = searchParams.get("mode"); - config.directory = searchParams.get("directory"); config.origin = searchParams.get("origin"); let encodedURL = searchParams.get("url"); let url = decodeURIComponent(encodedURL); - if (config.directory) { + // directory does not have origin set, in that case use the url origin for + // the error message. + if (!config.origin) { let URI = Services.io.newURI(url, null, null); config.origin = Services.scriptSecurityManager.getNoAppCodebasePrincipal(URI).origin; } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/baseMenuOverlay.xul firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/baseMenuOverlay.xul --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/baseMenuOverlay.xul 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/baseMenuOverlay.xul 2015-05-25 20:42:40.000000000 +0000 @@ -114,6 +114,5 @@ - diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-addons.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-addons.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-addons.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-addons.js 2015-05-25 20:42:40.000000000 +0000 @@ -49,11 +49,27 @@ }; try { - options.originHost = installInfo.originatingURI.host; + options.displayOrigin = installInfo.originatingURI.host; } catch (e) { // originatingURI might be missing or 'host' might throw for non-nsStandardURL nsIURIs. } + let cancelInstallation = () => { + if (installInfo) { + for (let install of installInfo.installs) + install.cancel(); + } + + if (aTopic == "addon-install-confirmation") + this.acceptInstallation = null; + + let tab = gBrowser.getTabForBrowser(browser); + if (tab) + tab.removeEventListener("TabClose", cancelInstallation); + + window.removeEventListener("unload", cancelInstallation); + }; + switch (aTopic) { case "addon-install-disabled": { notificationID = "xpinstall-disabled"; @@ -78,11 +94,6 @@ action, null, options); break; } case "addon-install-blocked": { - if (!options.originHost) { - // Need to deal with missing originatingURI and with about:/data: URIs more gracefully, - // see bug 1063418 - but for now, bail: - return; - } messageString = gNavigatorBundle.getFormattedString("xpinstallPromptMessage", [brandShortName]); @@ -138,25 +149,25 @@ case "addon-install-failed": { // TODO This isn't terribly ideal for the multiple failure case for (let install of installInfo.installs) { - let host = options.originHost; + let host = options.displayOrigin; if (!host) host = (install.sourceURI instanceof Ci.nsIStandardURL) && install.sourceURI.host; - let error = (host || install.error == 0) ? "addonError" : "addonLocalError"; - if (install.error != 0) + let error = (host || install.error == 0) ? "addonInstallError" : "addonLocalInstallError"; + let args; + if (install.error < 0) { error += install.error; - else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) + args = [brandShortName, install.name]; + } else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) { error += "Blocklisted"; - else + args = [install.name]; + } else { error += "Incompatible"; + args = [brandShortName, Services.appinfo.version, install.name]; + } - messageString = gNavigatorBundle.getString(error); - messageString = messageString.replace("#1", install.name); - if (host) - messageString = messageString.replace("#2", host); - messageString = messageString.replace("#3", brandShortName); - messageString = messageString.replace("#4", Services.appinfo.version); + messageString = gNavigatorBundle.getFormattedString(error, args); PopupNotifications.show(browser, notificationID, messageString, anchorID, action, null, options); @@ -170,11 +181,7 @@ options.eventCallback = (aEvent) => { switch (aEvent) { case "removed": - if (installInfo) { - for (let install of installInfo.installs) - install.cancel(); - } - this.acceptInstallation = null; + cancelInstallation(); break; case "shown": let addonList = document.getElementById("addon-install-confirmation-content"); @@ -215,18 +222,22 @@ options.learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "find-and-install-add-ons"; + let notification = document.getElementById("addon-install-confirmation-notification"); if (unsigned.length == installInfo.installs.length) { // None of the add-ons are verified messageString = gNavigatorBundle.getString("addonConfirmInstallUnsigned.message"); + notification.setAttribute("warning", "true"); } else if (unsigned.length == 0) { // All add-ons are verified or don't need to be verified messageString = gNavigatorBundle.getString("addonConfirmInstall.message"); + notification.removeAttribute("warning"); } else { // Some of the add-ons are unverified, the list of names will indicate // which messageString = gNavigatorBundle.getString("addonConfirmInstallSomeUnsigned.message"); + notification.setAttribute("warning", "true"); } messageString = PluralForm.get(installInfo.installs.length, messageString); @@ -243,8 +254,12 @@ let showNotification = () => { let tab = gBrowser.getTabForBrowser(browser); - if (tab) + if (tab) { gBrowser.selectedTab = tab; + tab.addEventListener("TabClose", cancelInstallation); + } + + window.addEventListener("unload", cancelInstallation); if (PopupNotifications.isPanelOpen) { let rect = document.getElementById("addon-progress-notification").getBoundingClientRect(); @@ -283,6 +298,7 @@ }); if (needsRestart) { + notificationID = "addon-install-restart"; messageString = gNavigatorBundle.getString("addonsInstalledNeedsRestart"); action = { label: gNavigatorBundle.getString("addonInstallRestartButton"), diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-context.inc firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-context.inc --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-context.inc 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-context.inc 2015-05-25 20:42:40.000000000 +0000 @@ -79,6 +79,10 @@ label="&saveLinkCmd.label;" accesskey="&saveLinkCmd.accesskey;" oncommand="gContextMenu.saveLink();"/> + @@ -269,7 +273,7 @@ + oncommand="gContextMenu.savePageToPocket();"/> diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.css firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.css --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.css 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.css 2015-05-25 20:42:41.000000000 +0000 @@ -773,8 +773,8 @@ -moz-binding: url("chrome://browser/content/urlbarBindings.xml#click-to-play-plugins-notification"); } -#password-fill-notification { - -moz-binding: url("chrome://browser/content/urlbarBindings.xml#password-fill-notification"); +#login-fill-notification { + -moz-binding: url("chrome://browser/content/urlbarBindings.xml#login-fill-notification"); } .login-fill-item { @@ -1033,6 +1033,9 @@ /* Combobox dropdown renderer */ #ContentSelectDropdown > menupopup { max-height: 350px; + /* The menupopup itself should always be rendered LTR to ensure the scrollbar aligns with + * the dropdown arrow on the dropdown widget. If a menuitem is RTL, its style will be set accordingly */ + direction: ltr; } .contentSelectDropdown-optgroup { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-fullScreen.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-fullScreen.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-fullScreen.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-fullScreen.js 2015-05-25 20:42:41.000000000 +0000 @@ -6,19 +6,27 @@ var FullScreen = { _XULNS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", + _MESSAGES: [ + "DOMFullscreen:Entered", + "DOMFullscreen:NewOrigin", + "DOMFullscreen:Exited" + ], + init: function() { // called when we go into full screen, even if initiated by a web page script window.addEventListener("fullscreen", this, true); - window.messageManager.addMessageListener("MozEnteredDomFullscreen", this); - window.messageManager.addMessageListener("MozExitedDomFullscreen", this); + for (let type of this._MESSAGES) { + window.messageManager.addMessageListener(type, this); + } if (window.fullScreen) this.toggle(); }, uninit: function() { - window.messageManager.removeMessageListener("MozEnteredDomFullscreen", this); - window.messageManager.removeMessageListener("MozExitedDomFullscreen", this); + for (let type of this._MESSAGES) { + window.messageManager.removeMessageListener(type, this); + } this.cleanup(); }, @@ -50,21 +58,6 @@ this._fullScrToggler.addEventListener("dragenter", this._expandCallback, false); } - // On OS X Lion we don't want to hide toolbars when entering fullscreen, unless - // we're entering DOM fullscreen, in which case we should hide the toolbars. - // If we're leaving fullscreen, then we'll go through the exit code below to - // make sure toolbars are made visible in the case of DOM fullscreen. - if (enterFS && this.useLionFullScreen) { - if (document.mozFullScreen) { - this.showXULChrome("toolbar", false); - } - else { - gNavToolbox.setAttribute("inFullscreen", true); - document.documentElement.setAttribute("inFullscreen", true); - } - return; - } - // show/hide menubars, toolbars (except the full screen toolbar) this.showXULChrome("toolbar", !enterFS); @@ -108,34 +101,45 @@ }, receiveMessage: function(aMessage) { - if (aMessage.name == "MozEnteredDomFullscreen") { - // If we're a multiprocess browser, then the request to enter fullscreen - // did not bubble up to the root browser document - it stopped at the root - // of the content document. That means we have to kick off the switch to - // fullscreen here at the operating system level in the parent process - // ourselves. - let data = aMessage.data; - let browser = aMessage.target; - if (gMultiProcessBrowser && browser.getAttribute("remote") == "true") { - let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - windowUtils.remoteFrameFullscreenChanged(browser, data.origin); + let browser = aMessage.target; + switch (aMessage.name) { + case "DOMFullscreen:Entered": { + // If we're a multiprocess browser, then the request to enter + // fullscreen did not bubble up to the root browser document - + // it stopped at the root of the content document. That means + // we have to kick off the switch to fullscreen here at the + // operating system level in the parent process ourselves. + if (this._isRemoteBrowser(browser)) { + this._windowUtils.remoteFrameFullscreenChanged(browser); + } + this.enterDomFullscreen(browser); + break; } - this.enterDomFullscreen(browser, data.origin); - } else if (aMessage.name == "MozExitedDomFullscreen") { - document.documentElement.removeAttribute("inDOMFullscreen"); - this.cleanupDomFullscreen(); - this.showNavToolbox(); - // If we are still in fullscreen mode, re-hide - // the toolbox with animation. - if (window.fullScreen) { - this._shouldAnimate = true; - this.hideNavToolbox(); + case "DOMFullscreen:NewOrigin": { + this.showWarning(aMessage.data.origin); + break; + } + case "DOMFullscreen:Exited": { + // Like entering DOM fullscreen, we also need to exit fullscreen + // at the operating system level in the parent process here. + if (this._isRemoteBrowser(browser)) { + this._windowUtils.remoteFrameFullscreenReverted(); + } + document.documentElement.removeAttribute("inDOMFullscreen"); + this.cleanupDomFullscreen(); + this.showNavToolbox(); + // If we are still in fullscreen mode, re-hide + // the toolbox with animation. + if (window.fullScreen) { + this._shouldAnimate = true; + this.hideNavToolbox(); + } + break; } } }, - enterDomFullscreen : function(aBrowser, aOrigin) { + enterDomFullscreen : function(aBrowser) { if (!document.mozFullScreen) return; @@ -161,8 +165,6 @@ if (gFindBarInitialized) gFindBar.close(); - this.showWarning(aOrigin); - // Exit DOM full-screen mode upon open, close, or change tab. gBrowser.tabContainer.addEventListener("TabOpen", this.exitDomFullScreen); gBrowser.tabContainer.addEventListener("TabClose", this.exitDomFullScreen); @@ -201,7 +203,16 @@ window.removeEventListener("activate", this); window.messageManager - .broadcastAsyncMessage("DOMFullscreen:Cleanup"); + .broadcastAsyncMessage("DOMFullscreen:CleanUp"); + }, + + _isRemoteBrowser: function (aBrowser) { + return gMultiProcessBrowser && aBrowser.getAttribute("remote") == "true"; + }, + + get _windowUtils() { + return window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); }, getMouseTargetRect: function() @@ -238,9 +249,14 @@ if (!gPrefService.getBoolPref("browser.fullscreen.autohide")) return false; - // a popup menu is open in chrome: don't collapse chrome - if (!forceHide && this._isPopupOpen) - return false; + if (!forceHide) { + // a popup menu is open in chrome: don't collapse chrome + if (this._isPopupOpen) + return false; + // On OS X Lion we don't want to hide toolbars. + if (this.useLionFullScreen) + return false; + } // a textbox in chrome is focused (location bar anyone?): don't collapse chrome if (document.commandDispatcher.focusedElement && @@ -448,7 +464,7 @@ // Track whether mouse is near the toolbox this._isChromeCollapsed = false; - if (trackMouse) { + if (trackMouse && !this.useLionFullScreen) { let rect = gBrowser.mPanelContainer.getBoundingClientRect(); this._mouseTargetRect = { top: rect.top + 50, @@ -547,6 +563,16 @@ document.documentElement.setAttribute("inFullscreen", true); } + ToolbarIconColor.inferFromText(); + + // For Lion fullscreen, all fullscreen controls are hidden, don't + // bother to touch them. If we don't stop here, the following code + // could cause the native fullscreen button be shown unexpectedly. + // See bug 1165570. + if (this.useLionFullScreen) { + return; + } + var fullscreenctls = document.getElementById("window-controls"); var navbar = document.getElementById("nav-bar"); var ctlsOnTabbar = window.toolbar.visible; @@ -559,8 +585,6 @@ navbar.appendChild(fullscreenctls); } fullscreenctls.hidden = aShow; - - ToolbarIconColor.inferFromText(); } }; XPCOMUtils.defineLazyGetter(FullScreen, "useLionFullScreen", function() { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.js 2015-05-25 20:42:41.000000000 +0000 @@ -55,6 +55,35 @@ XPCOMUtils.defineLazyModuleGetter(this, "Pocket", "resource:///modules/Pocket.jsm"); +// Can't use XPCOMUtils for these because the scripts try to define the variables +// on window, and so the defineProperty inside defineLazyGetter fails. +Object.defineProperty(window, "pktApi", { + get: function() { + // Avoid this getter running again: + delete window.pktApi; + Services.scriptloader.loadSubScript("chrome://browser/content/pocket/pktApi.js", window); + return window.pktApi; + }, + configurable: true, + enumerable: true +}); + +function pktUIGetter(prop) { + return { + get: function() { + // Avoid either of these getters running again: + delete window.pktUI; + delete window.pktUIMessaging; + Services.scriptloader.loadSubScript("chrome://browser/content/pocket/main.js", window); + return window[prop]; + }, + configurable: true, + enumerable: true + }; +} +Object.defineProperty(window, "pktUI", pktUIGetter("pktUI")); +Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging")); + const nsIWebNavigation = Ci.nsIWebNavigation; var gLastBrowserCharset = null; @@ -957,6 +986,7 @@ mm.loadFrameScript("chrome://browser/content/content.js", true); mm.loadFrameScript("chrome://browser/content/content-UITour.js", true); mm.loadFrameScript("chrome://global/content/manifestMessages.js", true); + mm.loadFrameScript("chrome://global/content/viewSource-content.js", true); window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad); @@ -2293,11 +2323,11 @@ * If aArgsOrDocument is an object, that object can take the * following properties: * - * browser: - * The browser containing the document that we would like to view the - * source of. - * URL: + * URL (required): * A string URL for the page we'd like to view the source of. + * browser (optional): + * The browser containing the document that we would like to view the + * source of. This is required if outerWindowID is passed. * outerWindowID (optional): * The outerWindowID of the content window containing the document that * we want to view the source of. You only need to provide this if you @@ -2330,7 +2360,18 @@ args = aArgsOrDocument; } - top.gViewSourceUtils.viewSource(args); + let inTab = Services.prefs.getBoolPref("view_source.tab"); + if (inTab) { + let viewSourceURL = `view-source:${args.URL}`; + let tab = gBrowser.loadOneTab(viewSourceURL, { + relatedToCurrent: true, + inBackground: false + }); + args.viewSourceBrowser = gBrowser.getBrowserForTab(tab); + top.gViewSourceUtils.viewSourceInBrowser(args); + } else { + top.gViewSourceUtils.viewSource(args); + } } /** @@ -2389,9 +2430,8 @@ // Replace initial page URIs with an empty string // only if there's no opener (bug 370555). - // Bug 863515 - Make content.opener checks work in electrolysis. if (gInitialPages.indexOf(uri.spec) != -1) - value = !gMultiProcessBrowser && content.opener ? uri.spec : ""; + value = gBrowser.selectedBrowser.hasContentOpener ? uri.spec : ""; else value = losslessDecodeURI(uri); @@ -4158,7 +4198,7 @@ // Do not update urlbar if there was a subframe navigation if (aWebProgress.isTopLevel) { - if ((location == "about:blank" && (gMultiProcessBrowser || !content.opener)) || + if ((location == "about:blank" && !gBrowser.selectedBrowser.hasContentOpener) || location == "") { // Second condition is for new tabs, otherwise // reload function is enabled until tab is refreshed. this.reloadCommand.setAttribute("disabled", "true"); @@ -4172,7 +4212,6 @@ BookmarkingUI.onLocationChange(); SocialUI.updateState(location); UITour.onLocationChange(location); - Pocket.onLocationChange(browser, aLocationURI); } // Utility functions for disabling find @@ -4531,7 +4570,7 @@ if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) { // Reader mode actually cares about these: let mm = gBrowser.selectedBrowser.messageManager; - mm.sendAsyncMessage("Reader:PushState"); + mm.sendAsyncMessage("Reader:PushState", {isArticle: gBrowser.selectedBrowser.isArticle}); return; } @@ -5533,7 +5572,7 @@ clipboard = stripUnsafeProtocolOnPaste(clipboard); - // if it's not the current tab, we don't need to do anything because the + // if it's not the current tab, we don't need to do anything because the // browser doesn't exist. let where = whereToOpenLink(event, true, false); let lastLocationChange; @@ -6251,10 +6290,10 @@ otherPBWindowExists = true; if (win.toolbar.visible) nonPopupPresent = true; - // If the current window is not in private browsing mode we don't need to - // look for other pb windows, we can leave the loop when finding the - // first non-popup window. If however the current window is in private - // browsing mode then we need at least one other pb and one non-popup + // If the current window is not in private browsing mode we don't need to + // look for other pb windows, we can leave the loop when finding the + // first non-popup window. If however the current window is in private + // browsing mode then we need at least one other pb and one non-popup // window to break out early. if ((!isPBWindow || otherPBWindowExists) && nonPopupPresent) break; @@ -6533,8 +6572,7 @@ if (!isBlankPageURL(browser.currentURI.spec)) return false; - // Bug 863515 - Make content.opener checks work in electrolysis. - if (!gMultiProcessBrowser && browser.contentWindow.opener) + if (browser.hasContentOpener) return false; if (browser.canGoForward || browser.canGoBack) @@ -7073,7 +7111,7 @@ dt.setData("text/html", htmlString); dt.setDragImage(gProxyFavIcon, 16, 16); }, - + handleEvent: function (event) { switch (event.type) { case "blur": diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-loop.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-loop.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-loop.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-loop.js 2015-05-25 20:42:41.000000000 +0000 @@ -218,7 +218,15 @@ // Add observer notifications before the service is initialized Services.obs.addObserver(this, "loop-status-changed", false); - this.MozLoopService.initialize(); + // This is a promise for test purposes, but we don't want to be logging + // expected errors to the console, so we catch them here. + this.MozLoopService.initialize().catch(ex => { + if (!ex.message || + (!ex.message.contains("not enabled") && + !ex.message.contains("not needed"))) { + console.error(ex); + } + }); this.updateToolbarState(); }, @@ -504,6 +512,49 @@ this._maybeShowBrowserSharingInfoBar(); } }, + + /** + * Fetch the favicon of the currently selected tab in the format of a data-uri. + * + * @param {Function} callback Function to be invoked with an error object as + * its first argument when an error occurred or + * a string as second argument when the favicon + * has been fetched. + */ + getFavicon: function(callback) { + let favicon = gBrowser.getIcon(gBrowser.selectedTab); + // If the tab image's url starts with http(s), fetch icon from favicon + // service via the moz-anno protocol. + if (/^https?:/.test(favicon)) { + let faviconURI = makeURI(favicon); + favicon = this.favIconService.getFaviconLinkForIcon(faviconURI).spec; + } + if (!favicon) { + callback(new Error("No favicon found")); + return; + } + favicon = this.PlacesUtils.getImageURLForResolution(window, favicon); + + // We XHR the favicon to get a File object, which we can pass to the FileReader + // object. The FileReader turns the File object into a data-uri. + let xhr = new XMLHttpRequest(); + xhr.open("get", favicon, true); + xhr.responseType = "blob"; + xhr.overrideMimeType("image/x-icon"); + xhr.onload = () => { + if (xhr.status != 200) { + callback(new Error("Invalid status code received for favicon XHR: " + xhr.status)); + return; + } + + let reader = new FileReader(); + reader.onload = () => callback(null, reader.result); + reader.onerror = callback; + reader.readAsDataURL(xhr.response); + }; + xhr.onerror = callback; + xhr.send(); + } }; })(); @@ -511,3 +562,6 @@ XPCOMUtils.defineLazyModuleGetter(LoopUI, "LoopRooms", "resource:///modules/loop/LoopRooms.jsm"); XPCOMUtils.defineLazyModuleGetter(LoopUI, "MozLoopService", "resource:///modules/loop/MozLoopService.jsm"); XPCOMUtils.defineLazyModuleGetter(LoopUI, "PanelFrame", "resource:///modules/PanelFrame.jsm"); +XPCOMUtils.defineLazyModuleGetter(LoopUI, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); +XPCOMUtils.defineLazyServiceGetter(LoopUI, "favIconService", + "@mozilla.org/browser/favicon-service;1", "nsIFaviconService"); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-menubar.inc firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-menubar.inc --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-menubar.inc 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-menubar.inc 2015-05-25 20:42:41.000000000 +0000 @@ -397,6 +397,9 @@ key="manBookmarkKb"/> + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-en-US.properties firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-en-US.properties --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-en-US.properties 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-en-US.properties 2015-05-25 20:42:41.000000000 +0000 @@ -0,0 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# This is a temporary file, later versions of Firefox will use +# browser.properties in the usual L10N location. + +pocket-button.label = Pocket +pocket-button.tooltiptext = Save to Pocket diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-es-ES.properties firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-es-ES.properties --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-es-ES.properties 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-es-ES.properties 2015-05-25 20:42:41.000000000 +0000 @@ -11,4 +11,6 @@ # From browser-pocket.dtd saveToPocketCmd.label = Guardar página en Pocket saveToPocketCmd.accesskey = k +saveLinkToPocketCmd.label = Guardar enlace en Pocket +saveLinkToPocketCmd.accesskey = k pocketMenuitem.label = Ver lista de Pocket diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-ja.properties firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-ja.properties --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-ja.properties 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-ja.properties 2015-05-25 20:42:41.000000000 +0000 @@ -11,4 +11,6 @@ # From browser-pocket.dtd saveToPocketCmd.label = Pocket にページを保存 saveToPocketCmd.accesskey = k +saveLinkToPocketCmd.label = Pocket にリンクを保存 +saveLinkToPocketCmd.accesskey = o pocketMenuitem.label = Pocket のマイリストを表示 diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket.properties firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket.properties --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket.properties 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket.properties 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# This is a temporary file, later versions of Firefox will use -# browser.properties in the usual L10N location. - -pocket-button.label = Pocket -pocket-button.tooltiptext = Save to Pocket diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-ru.properties firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-ru.properties --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-pocket-ru.properties 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-pocket-ru.properties 2015-05-25 20:42:41.000000000 +0000 @@ -11,4 +11,6 @@ # From browser-pocket.dtd saveToPocketCmd.label = Сохранить страницу в Pocket saveToPocketCmd.accesskey = х +saveLinkToPocketCmd.label = Сохранить ссылку в Pocket +saveLinkToPocketCmd.accesskey = а pocketMenuitem.label = Показать список Pocket diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-social.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-social.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser-social.js 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser-social.js 2015-05-25 20:42:41.000000000 +0000 @@ -60,6 +60,9 @@ if (this._initialized) { return; } + let mm = window.getGroupMessageManager("social"); + mm.loadFrameScript("chrome://browser/content/content.js", true); + mm.loadFrameScript("chrome://browser/content/social-content.js", true); Services.obs.addObserver(this, "social:ambient-notification-changed", false); Services.obs.addObserver(this, "social:profile-changed", false); @@ -154,7 +157,7 @@ break; case "social:frameworker-error": if (this.enabled && SocialSidebar.provider && SocialSidebar.provider.origin == data) { - SocialSidebar.setSidebarErrorMessage(); + SocialSidebar.loadFrameworkerFailure(); } break; case "nsPref:changed": @@ -351,21 +354,21 @@ if (!SocialUI.enabled || panel.firstChild) return; // create and initialize the panel for this window - let iframe = document.createElement("iframe"); + let iframe = document.createElement("browser"); iframe.setAttribute("type", "content"); iframe.setAttribute("class", "social-panel-frame"); iframe.setAttribute("flex", "1"); + iframe.setAttribute("message", "true"); + iframe.setAttribute("messagemanagergroup", "social"); iframe.setAttribute("tooltip", "aHTMLTooltip"); + iframe.setAttribute("context", "contentAreaContextMenu"); iframe.setAttribute("origin", SocialSidebar.provider.origin); panel.appendChild(iframe); - }, - - setFlyoutErrorMessage: function SF_setFlyoutErrorMessage() { - this.iframe.removeAttribute("src"); - this.iframe.webNavigation.loadURI("about:socialerror?mode=compactInfo&origin=" + - encodeURIComponent(this.iframe.getAttribute("origin")), - null, null, null, null); - sizeSocialPanelToContent(this.panel, this.iframe); + // the xbl bindings for the iframe probably don't exist yet, so we can't + // access iframe.messageManager directly - but can get at it with this dance. + let mm = iframe.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager; + mm.sendAsyncMessage("Social:SetErrorURL", null, + { template: "about:socialerror?mode=compactInfo&origin=%{origin}" }); }, unload: function() { @@ -374,8 +377,6 @@ if (!panel.firstChild) return let iframe = panel.firstChild; - if (iframe.socialErrorListener) - iframe.socialErrorListener.remove(); panel.removeChild(iframe); }, @@ -383,8 +384,7 @@ let panel = this.panel; let iframe = this.iframe; this._dynamicResizer = new DynamicResizeWatcher(); - iframe.docShell.isActive = true; - iframe.docShell.isAppTab = true; + iframe.docShellIsActive = true; if (iframe.contentDocument.readyState == "complete") { this._dynamicResizer.start(panel, iframe); this.dispatchPanelEvent("socialFrameShow"); @@ -405,7 +405,7 @@ onHidden: function(aEvent) { this._dynamicResizer.stop(); this._dynamicResizer = null; - this.iframe.docShell.isActive = false; + this.iframe.docShellIsActive = false; this.dispatchPanelEvent("socialFrameHide"); }, @@ -423,7 +423,6 @@ iframe.removeEventListener("load", documentLoaded, true); cb(); }, true); - Social.setErrorListener(iframe, SocialFlyout.setFlyoutErrorMessage.bind(SocialFlyout)) iframe.setAttribute("src", aURL); } else { // we still need to set the src to trigger the contents hashchange event @@ -503,11 +502,13 @@ iframe.setAttribute("tooltip", "aHTMLTooltip"); iframe.setAttribute("disableglobalhistory", "true"); iframe.setAttribute("flex", "1"); + iframe.setAttribute("message", "true"); + iframe.setAttribute("messagemanagergroup", "social"); panel.lastChild.appendChild(iframe); - iframe.addEventListener("load", function _firstload() { - iframe.removeEventListener("load", _firstload, true); - iframe.messageManager.loadFrameScript("chrome://browser/content/content.js", true); - }, true); + let mm = iframe.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager; + mm.sendAsyncMessage("Social:SetErrorURL", null, + { template: "about:socialerror?mode=compactInfo&origin=%{origin}&url=%{url}" }); + this.populateProviderMenu(); }, @@ -596,23 +597,6 @@ } }, - setErrorMessage: function() { - let iframe = this.iframe; - if (!iframe) - return; - - let url; - let origin = iframe.getAttribute("origin"); - if (!origin) { - // directory site is down - url = "about:socialerror?mode=tryAgainOnly&directory=1&url=" + encodeURIComponent(iframe.getAttribute("src")); - } else { - url = "about:socialerror?mode=compactInfo&origin=" + encodeURIComponent(origin); - } - iframe.webNavigation.loadURI(url, null, null, null, null); - sizeSocialPanelToContent(this.panel, iframe); - }, - sharePage: function(providerOrigin, graphData, target) { // if providerOrigin is undefined, we use the last-used provider, or the // current/default provider. The provider selection in the share panel @@ -694,8 +678,7 @@ let endpointMatch = shareEndpoint == iframe.getAttribute("src"); if (endpointMatch) { this._dynamicResizer.start(iframe.parentNode, iframe, size); - iframe.docShell.isActive = true; - iframe.docShell.isAppTab = true; + iframe.docShellIsActive = true; let evt = iframe.contentDocument.createEvent("CustomEvent"); evt.initCustomEvent("OpenGraphData", true, true, JSON.stringify(pageData)); iframe.contentDocument.documentElement.dispatchEvent(evt); @@ -704,8 +687,7 @@ // first time load, wait for load and dispatch after load iframe.addEventListener("load", function panelBrowserOnload(e) { iframe.removeEventListener("load", panelBrowserOnload, true); - iframe.docShell.isActive = true; - iframe.docShell.isAppTab = true; + iframe.docShellIsActive = true; iframe.parentNode.removeAttribute("loading"); // to support standard share endpoints mimick window.open by setting // window.opener, some share endpoints rely on w.opener to know they @@ -764,7 +746,6 @@ _openPanel: function() { let anchor = document.getAnonymousElementByAttribute(this.anchor, "class", "toolbarbutton-icon"); this.panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false); - Social.setErrorListener(this.iframe, this.setErrorMessage.bind(this)); Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(0); } }; @@ -918,19 +899,12 @@ } } else { sbrowser.setAttribute("origin", this.provider.origin); - if (this.provider.errorState == "frameworker-error") { - SocialSidebar.setSidebarErrorMessage(); - return; - } // Make sure the right sidebar URL is loaded if (sbrowser.getAttribute("src") != this.provider.sidebarURL) { // we check readyState right after setting src, we need a new content // viewer to ensure we are checking against the correct document. sbrowser.docShell.createAboutBlankContentViewer(null); - Social.setErrorListener(sbrowser, this.setSidebarErrorMessage.bind(this)); - // setting isAppTab causes clicks on untargeted links to open new tabs - sbrowser.docShell.isAppTab = true; sbrowser.setAttribute("src", this.provider.sidebarURL); PopupNotifications.locationChange(sbrowser); } @@ -976,18 +950,13 @@ _unloadTimeoutId: 0, - setSidebarErrorMessage: function() { - let sbrowser = document.getElementById("social-sidebar-browser"); - // a frameworker error "trumps" a sidebar error. - let origin = sbrowser.getAttribute("origin"); - if (origin) { - origin = "&origin=" + encodeURIComponent(origin); - } - if (this.provider.errorState == "frameworker-error") { - sbrowser.setAttribute("src", "about:socialerror?mode=workerFailure" + origin); - } else { - let url = encodeURIComponent(this.provider.sidebarURL); - sbrowser.loadURI("about:socialerror?mode=tryAgain&url=" + url + origin, null, null); + loadFrameworkerFailure: function() { + if (this.provider && this.provider.errorState == "frameworker-error") { + // we have to explicitly load this error page since it is not being + // handled via the normal error page paths. + let sbrowser = document.getElementById("social-sidebar-browser"); + sbrowser.setAttribute("src", "about:socialerror?mode=workerFailure&origin=" + + encodeURIComponent(this.provider.origin)); } }, @@ -1298,8 +1267,6 @@ _onclose: function(frame) { frame.removeEventListener("close", this._onclose, true); frame.removeEventListener("click", this._onclick, true); - if (frame.socialErrorListener) - frame.socialErrorListener.remove(); }, _onclick: function() { @@ -1316,28 +1283,27 @@ (frame) => { frame.addEventListener("close", () => { SocialStatus._onclose(frame) }, true); frame.addEventListener("click", this._onclick, true); - Social.setErrorListener(frame, this.setPanelErrorMessage.bind(this)); }); Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(1); - }, + } +}; - setPanelErrorMessage: function(aNotificationFrame) { - if (!aNotificationFrame) - return; - let src = aNotificationFrame.getAttribute("src"); - aNotificationFrame.removeAttribute("src"); - let origin = aNotificationFrame.getAttribute("origin"); - aNotificationFrame.webNavigation.loadURI("about:socialerror?mode=tryAgainOnly&url=" + - encodeURIComponent(src) + "&origin=" + - encodeURIComponent(origin), - null, null, null, null); - let panel = aNotificationFrame.parentNode; - sizeSocialPanelToContent(panel, aNotificationFrame); +let SocialMarksWidgetListener = { + onWidgetAdded: function(aWidgetId, aArea, aPosition) { + let node = document.getElementById(aWidgetId); + if (!node || !node.classList.contains("social-mark-button")) + return; + node._receiveMessage = node.receiveMessage.bind(node); + messageManager.addMessageListener("Social:ErrorPageNotify", node._receiveMessage); }, - -}; - + onWidgetBeforeDOMChange: function(aNode, aNextNode, aContainer, isRemoval) { + if (!isRemoval || !aNode || !aNode.classList.contains("social-mark-button")) + return; + messageManager.removeMessageListener("Social:ErrorPageNotify", aNode._receiveMessage); + delete aNode._receiveMessage; + } +} /** * SocialMarks @@ -1442,7 +1408,9 @@ get _toolbarHelper() { delete this._toolbarHelper; - this._toolbarHelper = new ToolbarHelper("social-mark-button", CreateSocialMarkWidget); + this._toolbarHelper = new ToolbarHelper("social-mark-button", + CreateSocialMarkWidget, + SocialMarksWidgetListener); return this._toolbarHelper; }, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.xul firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.xul --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/browser.xul 2015-05-13 18:05:57.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/browser.xul 2015-05-25 20:42:41.000000000 +0000 @@ -783,6 +783,7 @@ + @@ -1222,6 +1223,8 @@ - + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/general/close_beforeunload_opens_second_tab.html firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/general/close_beforeunload_opens_second_tab.html --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/general/close_beforeunload_opens_second_tab.html 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/general/close_beforeunload_opens_second_tab.html 2015-05-25 20:42:42.000000000 +0000 @@ -0,0 +1,3 @@ + + Open second tab + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/general/title_test.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/general/title_test.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/general/title_test.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/general/title_test.svg 2015-05-25 20:42:43.000000000 +0000 @@ -1,4 +1,4 @@ - + This is a root SVG element's title diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser.ini firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser.ini --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser.ini 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser.ini 2015-05-25 20:42:43.000000000 +0000 @@ -46,3 +46,4 @@ [browser_newtab_undo.js] [browser_newtab_unpin.js] [browser_newtab_update.js] +[browser_newtab_bug1145428.js] diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_bug1145428.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_bug1145428.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_bug1145428.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_bug1145428.js 2015-05-25 20:42:43.000000000 +0000 @@ -0,0 +1,88 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* + * These tests make sure that pinning suggested tile results in: + * - making suggested tile a history tile and replacing enhancedImageURI with imageURI + * - upond end of campaign, replaces landing url with baseDomain and switches + * background image to thumbnail + */ + +gDirectorySource = "data:application/json," + JSON.stringify({ + "suggested": [{ + url: "http://example.com/landing/page.html", + imageURI: "data:image/png;base64,helloWORLD3", + enhancedImageURI: "data:image/png;base64,helloWORLD2", + title: "title", + type: "affiliate", + frecent_sites: ["example0.com"], + }] +}); + +function runTests() { + let origGetFrecentSitesName = DirectoryLinksProvider.getFrecentSitesName; + DirectoryLinksProvider.getFrecentSitesName = () => ""; + + function getData(cellNum) { + let cell = getCell(cellNum); + if (!cell.site) + return null; + let siteNode = cell.site.node; + return { + type: siteNode.getAttribute("type"), + thumbnail: siteNode.querySelector(".newtab-thumbnail").style.backgroundImage, + enhanced: siteNode.querySelector(".enhanced-content").style.backgroundImage, + title: siteNode.querySelector(".newtab-title").textContent, + suggested: siteNode.getAttribute("suggested"), + url: siteNode.querySelector(".newtab-link").getAttribute("href"), + }; + } + + yield setLinks("0,1,2,3,4,5,6,7,8,9"); + setPinnedLinks(""); + + yield addNewTabPageTab(); + // load another newtab since the first may not get suggested tile + yield addNewTabPageTab(); + checkGrid("http://example.com/landing/page.html,0,1,2,3,4,5,6,7,8,9"); + // evaluate suggested tile + let tileData = getData(0); + is(tileData.type, "affiliate", "unpinned type"); + is(tileData.thumbnail, "url(\"data:image/png;base64,helloWORLD3\")", "unpinned thumbnail"); + is(tileData.enhanced, "url(\"data:image/png;base64,helloWORLD2\")", "unpinned enhanced"); + is(tileData.suggested, "true", "has suggested set", "unpinned suggested exists"); + is(tileData.url, "http://example.com/landing/page.html", "unpinned landing page"); + + // suggested tile should not be pinned + is(NewTabUtils.pinnedLinks.isPinned({url: "http://example.com/landing/page.html"}), false, "suggested tile is not pinned"); + + // pin suggested tile + whenPagesUpdated(); + let siteNode = getCell(0).node.querySelector(".newtab-site"); + let pinButton = siteNode.querySelector(".newtab-control-pin"); + EventUtils.synthesizeMouseAtCenter(pinButton, {}, getContentWindow()); + // wait for whenPagesUpdated + yield null; + + // tile should be pinned and turned into history tile + is(NewTabUtils.pinnedLinks.isPinned({url: "http://example.com/landing/page.html"}), true, "suggested tile is pinned"); + tileData = getData(0); + is(tileData.type, "history", "pinned type"); + is(tileData.suggested, null, "no suggested attribute"); + is(tileData.url, "http://example.com/landing/page.html", "original landing page"); + + // set pinned tile endTime into past and reload the page + NewTabUtils.pinnedLinks._links[0].endTime = Date.now() - 1000; + yield addNewTabPageTab(); + + // check that url is reset to base domain and thumbnail points to moz-page-thumb service + is(NewTabUtils.pinnedLinks.isPinned({url: "http://example.com/"}), true, "baseDomain url is pinned"); + tileData = getData(0); + is(tileData.type, "history", "type is history"); + is(tileData.title, "example.com", "title changed to baseDomain"); + is(tileData.thumbnail.indexOf("moz-page-thumb") != -1, true, "thumbnail contains moz-page-thumb"); + is(tileData.enhanced, "", "no enhanced image"); + is(tileData.url, "http://example.com/", "url points to baseDomian"); + + DirectoryLinksProvider.getFrecentSitesName = origGetFrecentSitesName; +} diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_enhanced.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_enhanced.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_enhanced.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_enhanced.js 2015-05-25 20:42:43.000000000 +0000 @@ -3,6 +3,14 @@ const PRELOAD_PREF = "browser.newtab.preload"; +let suggestedLink = { + url: "http://example1.com/2", + imageURI: "data:image/png;base64,helloWORLD3", + title: "title2", + type: "affiliate", + frecent_sites: ["classroom.google.com", "codecademy.com", "elearning.ut.ac.id", "khanacademy.org", "learn.jquery.com", "teamtreehouse.com", "tutorialspoint.com", "udacity.com", "w3cschool.cc", "w3schools.com"] +}; + gDirectorySource = "data:application/json," + JSON.stringify({ "enhanced": [{ url: "http://example.com/", @@ -16,21 +24,12 @@ title: "title1", type: "organic" }], - "suggested": [{ - url: "http://example1.com/2", - imageURI: "data:image/png;base64,helloWORLD3", - title: "title2", - type: "affiliate", - frecent_sites: ["test.com"] - }] + "suggested": [suggestedLink] }); function runTests() { - let origGetFrecentSitesName = DirectoryLinksProvider.getFrecentSitesName; - DirectoryLinksProvider.getFrecentSitesName = () => ""; let origEnhanced = NewTabUtils.allPages.enhanced; registerCleanupFunction(() => { - DirectoryLinksProvider.getFrecentSitesName = origGetFrecentSitesName; Services.prefs.clearUserPref(PRELOAD_PREF); NewTabUtils.allPages.enhanced = origEnhanced; }); @@ -46,6 +45,7 @@ type: siteNode.getAttribute("type"), enhanced: siteNode.querySelector(".enhanced-content").style.backgroundImage, title: siteNode.querySelector(".newtab-title").textContent, + suggested: siteNode.querySelector(".newtab-suggested").innerHTML }; } @@ -56,50 +56,56 @@ yield addNewTabPageTab(); yield customizeNewTabPage("classic"); yield customizeNewTabPage("enhanced"); // Toggle enhanced off - let {type, enhanced, title} = getData(0); + let {type, enhanced, title, suggested} = getData(0); isnot(type, "enhanced", "history link is not enhanced"); is(enhanced, "", "history link has no enhanced image"); is(title, "example.com"); + is(suggested, "", "There is no suggested explanation"); is(getData(1), null, "there is only one link and it's a history link"); // Test with enhanced = true yield addNewTabPageTab(); yield customizeNewTabPage("enhanced"); // Toggle enhanced on - ({type, enhanced, title} = getData(0)); + ({type, enhanced, title, suggested} = getData(0)); is(type, "organic", "directory link is organic"); isnot(enhanced, "", "directory link has enhanced image"); is(title, "title1"); + is(suggested, "", "There is no suggested explanation"); - ({type, enhanced, title} = getData(1)); + ({type, enhanced, title, suggested} = getData(1)); is(type, "enhanced", "history link is enhanced"); isnot(enhanced, "", "history link has enhanced image"); is(title, "title"); + is(suggested, "", "There is no suggested explanation"); is(getData(2), null, "there are only 2 links, directory and enhanced history"); // Test with a pinned link setPinnedLinks("-1"); yield addNewTabPageTab(); - ({type, enhanced, title} = getData(0)); + ({type, enhanced, title, suggested} = getData(0)); is(type, "enhanced", "pinned history link is enhanced"); isnot(enhanced, "", "pinned history link has enhanced image"); is(title, "title"); + is(suggested, "", "There is no suggested explanation"); - ({type, enhanced, title} = getData(1)); + ({type, enhanced, title, suggested} = getData(1)); is(type, "organic", "directory link is organic"); isnot(enhanced, "", "directory link has enhanced image"); is(title, "title1"); + is(suggested, "", "There is no suggested explanation"); is(getData(2), null, "directory link pushed out by pinned history link"); // Test pinned link with enhanced = false yield addNewTabPageTab(); yield customizeNewTabPage("enhanced"); // Toggle enhanced off - ({type, enhanced, title} = getData(0)); + ({type, enhanced, title, suggested} = getData(0)); isnot(type, "enhanced", "history link is not enhanced"); is(enhanced, "", "history link has no enhanced image"); is(title, "example.com"); + is(suggested, "", "There is no suggested explanation"); is(getData(1), null, "directory link still pushed out by pinned history link"); @@ -117,10 +123,11 @@ // Test with enhanced = false yield addNewTabPageTab(); - ({type, enhanced, title} = getData(0)); + ({type, enhanced, title, suggested} = getData(0)); isnot(type, "enhanced", "history link is not enhanced"); is(enhanced, "", "history link has no enhanced image"); is(title, "example.com"); + is(suggested, "", "There is no suggested explanation"); isnot(getData(7), null, "there are 8 history links"); is(getData(8), null, "there are 8 history links"); @@ -131,16 +138,55 @@ yield customizeNewTabPage("enhanced"); // Suggested link was not enhanced by directory link with same domain - ({type, enhanced, title} = getData(0)); + ({type, enhanced, title, suggested} = getData(0)); is(type, "affiliate", "suggested link is affiliate"); is(enhanced, "", "suggested link has no enhanced image"); is(title, "title2"); + ok(suggested.indexOf("Suggested for Web Education visitors") > -1, "Suggested for 'Web Education'"); // Enhanced history link shows up second - ({type, enhanced, title} = getData(1)); + ({type, enhanced, title, suggested} = getData(1)); is(type, "enhanced", "pinned history link is enhanced"); isnot(enhanced, "", "pinned history link has enhanced image"); is(title, "title"); + is(suggested, "", "There is no suggested explanation"); is(getData(9), null, "there is a suggested link followed by an enhanced history link and the remaining history links"); + + + + // Test override category/adgroup name. + suggestedLink.adgroup_name = "Technology"; + Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, + "data:application/json," + JSON.stringify({"suggested": [suggestedLink]})); + yield watchLinksChangeOnce().then(TestRunner.next); + + yield addNewTabPageTab(); + ({type, enhanced, title, suggested} = getData(0)); + Cu.reportError("SUGGEST " + suggested); + ok(suggested.indexOf("Suggested for Technology visitors") > -1, "Suggested for 'Technology'"); + + + // Test server provided explanation string. + suggestedLink.explanation = "Suggested for %1$S enthusiasts who visit sites like %2$S"; + Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, + "data:application/json," + encodeURIComponent(JSON.stringify({"suggested": [suggestedLink]}))); + yield watchLinksChangeOnce().then(TestRunner.next); + + yield addNewTabPageTab(); + ({type, enhanced, title, suggested} = getData(0)); + Cu.reportError("SUGGEST " + suggested); + ok(suggested.indexOf("Suggested for Technology enthusiasts who visit sites like classroom.google.com ") > -1, "Suggested for 'Technology' enthusiasts"); + + + // Test server provided explanation string without category override. + delete suggestedLink.adgroup_name; + Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, + "data:application/json," + encodeURIComponent(JSON.stringify({"suggested": [suggestedLink]}))); + yield watchLinksChangeOnce().then(TestRunner.next); + + yield addNewTabPageTab(); + ({type, enhanced, title, suggested} = getData(0)); + Cu.reportError("SUGGEST " + suggested); + ok(suggested.indexOf("Suggested for Web Education enthusiasts who visit sites like classroom.google.com ") > -1, "Suggested for 'Web Education' enthusiasts"); } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_intro.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_intro.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_intro.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_intro.js 2015-05-25 20:42:43.000000000 +0000 @@ -2,50 +2,118 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ const INTRO_PREF = "browser.newtabpage.introShown"; +const UPDATE_INTRO_PREF = "browser.newtabpage.updateIntroShown"; const PRELOAD_PREF = "browser.newtab.preload"; function runTests() { let origIntro = Services.prefs.getBoolPref(INTRO_PREF); + let origUpdateIntro = Services.prefs.getBoolPref(UPDATE_INTRO_PREF); let origPreload = Services.prefs.getBoolPref(PRELOAD_PREF); registerCleanupFunction(_ => { Services.prefs.setBoolPref(INTRO_PREF, origIntro); + Services.prefs.setBoolPref(INTRO_PREF, origUpdateIntro); Services.prefs.setBoolPref(PRELOAD_PREF, origPreload); }); // Test with preload false Services.prefs.setBoolPref(INTRO_PREF, false); + Services.prefs.setBoolPref(UPDATE_INTRO_PREF, false); Services.prefs.setBoolPref(PRELOAD_PREF, false); - let panel; - function maybeWaitForPanel() { - // If already open, no need to wait - if (panel.state == "open") { - executeSoon(TestRunner.next); - return; - } - - // We're expecting the panel to open, so wait for it - panel.addEventListener("popupshown", TestRunner.next); - isnot(panel.state, "open", "intro panel can be slow to show"); - } + let intro; + let brand = Services.strings.createBundle("chrome://branding/locale/brand.properties"); + let brandShortName = brand.GetStringFromName("brandShortName"); yield addNewTabPageTab(); - panel = getContentDocument().getElementById("newtab-intro-panel"); - yield maybeWaitForPanel(); - is(panel.state, "open", "intro automatically shown on first opening"); + intro = getContentDocument().getElementById("newtab-intro-mask"); + is(intro.style.opacity, 1, "intro automatically shown on first opening"); + is(getContentDocument().getElementById("newtab-intro-header").innerHTML, + 'Welcome to New Tab on ' + brandShortName + '!', "we show the first-run intro."); is(Services.prefs.getBoolPref(INTRO_PREF), true, "newtab remembers that the intro was shown"); + is(Services.prefs.getBoolPref(UPDATE_INTRO_PREF), true, "newtab avoids showing update if intro was shown"); yield addNewTabPageTab(); - panel = getContentDocument().getElementById("newtab-intro-panel"); - is(panel.state, "closed", "intro not shown on second opening"); + intro = getContentDocument().getElementById("newtab-intro-mask"); + is(intro.style.opacity, 0, "intro not shown on second opening"); // Test with preload true Services.prefs.setBoolPref(INTRO_PREF, false); Services.prefs.setBoolPref(PRELOAD_PREF, true); yield addNewTabPageTab(); - panel = getContentDocument().getElementById("newtab-intro-panel"); - yield maybeWaitForPanel(); - is(panel.state, "open", "intro automatically shown on preloaded opening"); + intro = getContentDocument().getElementById("newtab-intro-mask"); + is(intro.style.opacity, 1, "intro automatically shown on preloaded opening"); + is(getContentDocument().getElementById("newtab-intro-header").innerHTML, + 'Welcome to New Tab on ' + brandShortName + '!', "we show the first-run intro."); is(Services.prefs.getBoolPref(INTRO_PREF), true, "newtab remembers that the intro was shown"); + is(Services.prefs.getBoolPref(UPDATE_INTRO_PREF), true, "newtab avoids showing update if intro was shown"); + + // Test with first run true but update false + Services.prefs.setBoolPref(UPDATE_INTRO_PREF, false); + + yield addNewTabPageTab(); + intro = getContentDocument().getElementById("newtab-intro-mask"); + is(intro.style.opacity, 1, "intro automatically shown on preloaded opening"); + is(getContentDocument().getElementById("newtab-intro-header").innerHTML, + "New Tab got an update!", "we show the update intro."); + is(Services.prefs.getBoolPref(INTRO_PREF), true, "INTRO_PREF stays true"); + is(Services.prefs.getBoolPref(UPDATE_INTRO_PREF), true, "newtab remembers that the update intro was show"); + + // Test clicking the 'next' and 'back' buttons. + let buttons = getContentDocument().getElementById("newtab-intro-buttons").getElementsByTagName("input"); + let progress = getContentDocument().getElementById("newtab-intro-numerical-progress"); + let back = buttons[0]; + let next = buttons[1]; + + is(progress.getAttribute("page"), 0, "we are on the first page"); + is(intro.style.opacity, 1, "intro visible"); + + + let createMutationObserver = function(fcn) { + return new Promise(resolve => { + let observer = new MutationObserver(function(mutations) { + fcn(); + observer.disconnect(); + resolve(); + }); + let config = { attributes: true, attributeFilter: ["style"], childList: true }; + observer.observe(progress, config); + }); + } + + let p = createMutationObserver(function() { + is(progress.getAttribute("page"), 1, "we get to the 2nd page"); + is(intro.style.opacity, 1, "intro visible"); + }); + next.click(); + yield p.then(TestRunner.next); + + p = createMutationObserver(function() { + is(progress.getAttribute("page"), 2, "we get to the 3rd page"); + is(intro.style.opacity, 1, "intro visible"); + }); + next.click(); + yield p.then(TestRunner.next); + + p = createMutationObserver(function() { + is(progress.getAttribute("page"), 1, "go back to 2nd page"); + is(intro.style.opacity, 1, "intro visible"); + }); + back.click(); + yield p.then(TestRunner.next); + + p = createMutationObserver(function() { + is(progress.getAttribute("page"), 0, "go back to 1st page"); + is(intro.style.opacity, 1, "intro visible"); + }); + back.click(); + yield p.then(TestRunner.next); + + + p = createMutationObserver(function() { + is(progress.getAttribute("page"), 0, "another back will 'skip tutorial'"); + is(intro.style.opacity, 0, "intro exited"); + }); + back.click(); + p.then(TestRunner.next); } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_reportLinkAction.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_reportLinkAction.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/newtab/browser_newtab_reportLinkAction.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/newtab/browser_newtab_reportLinkAction.js 2015-05-25 20:42:43.000000000 +0000 @@ -41,20 +41,27 @@ yield null; yield null; + whenPagesUpdated(); // Click the pin button on the link in the 1th tile spot let siteNode = getCell(1).node.querySelector(".newtab-site"); let pinButton = siteNode.querySelector(".newtab-control-pin"); expected.action = "pin"; + // tiles become "history" when pinned + expected.type = "history"; expected.pinned = true; EventUtils.synthesizeMouseAtCenter(pinButton, {}, getContentWindow()); - // Wait for reportSitesAction + // Wait for whenPagesUpdated and reportSitesAction + yield null; yield null; // Unpin that link expected.action = "unpin"; expected.pinned = false; whenPagesUpdated(); + // need to reget siteNode for it could have been re-rendered after pin + siteNode = getCell(1).node.querySelector(".newtab-site"); + pinButton = siteNode.querySelector(".newtab-control-pin"); EventUtils.synthesizeMouseAtCenter(pinButton, {}, getContentWindow()); // Wait for whenPagesUpdated and reportSitesAction @@ -75,7 +82,7 @@ yield null; // Click the 1th link now in the 0th tile spot - expected.type = "sponsored"; + expected.type = "history"; expected.action = "click"; EventUtils.synthesizeMouseAtCenter(siteNode, {}, getContentWindow()); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/plugins/browser.ini firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/plugins/browser.ini --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/plugins/browser.ini 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/plugins/browser.ini 2015-05-25 20:42:43.000000000 +0000 @@ -55,7 +55,6 @@ skip-if = !crashreporter [browser_CTP_data_urls.js] [browser_CTP_drag_drop.js] -skip-if = e10s # misc. issues, bug 1156871 [browser_CTP_hide_overlay.js] [browser_CTP_iframe.js] skip-if = os == 'linux' || os == 'mac' # Bug 984821 diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/referrer/head.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/referrer/head.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/referrer/head.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/referrer/head.js 2015-05-25 20:42:43.000000000 +0000 @@ -49,19 +49,19 @@ rel: "noreferrer", result: "" // rel=noreferrer trumps meta-referrer }, - // 3. Origin-when-crossorigin policy - this depends on the triggering + // 3. Origin-when-cross-origin policy - this depends on the triggering // principal. We expect full referrer for same-origin requests, // and origin referrer for cross-origin requests. { fromScheme: "https://", toScheme: "https://", - policy: "origin-when-crossorigin", + policy: "origin-when-cross-origin", result: "https://test1.example.com/browser" // same origin }, { fromScheme: "http://", toScheme: "https://", - policy: "origin-when-crossorigin", + policy: "origin-when-cross-origin", result: "http://test1.example.com" // cross origin }, ]; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_aboutHome_activation.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_aboutHome_activation.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_aboutHome_activation.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_aboutHome_activation.js 2015-05-25 20:42:43.000000000 +0000 @@ -17,7 +17,7 @@ ' "name": "Demo Social Service",' + ' "origin": "https://example.com",' + ' "iconURL": "chrome://branding/content/icon16.png",' + -' "icon32URL": "chrome://branding/content/favicon32.png",' + +' "icon32URL": "chrome://branding/content/icon32.png",' + ' "icon64URL": "chrome://branding/content/icon64.png",' + ' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",' + ' "postActivationURL": "https://example.com/browser/browser/base/content/test/social/social_postActivation.html",' + @@ -29,7 +29,7 @@ ' }' + ' ' + '
' + -' ' + +' ' + '
'; // enable one-click activation @@ -39,7 +39,7 @@ ' "name": "Demo Social Service",' + ' "origin": "https://example.com",' + ' "iconURL": "chrome://branding/content/icon16.png",' + -' "icon32URL": "chrome://branding/content/favicon32.png",' + +' "icon32URL": "chrome://branding/content/icon32.png",' + ' "icon64URL": "chrome://branding/content/icon64.png",' + ' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",' + ' "postActivationURL": "https://example.com/browser/browser/base/content/test/social/social_postActivation.html",' + @@ -52,18 +52,14 @@ ' }' + ' ' + '
' + -' ' + +' ' + '
'; let gTests = [ { desc: "Test activation with enable panel", - setup: function (aSnippetsMap) - { - // This must be some incorrect xhtml code. - aSnippetsMap.set("snippets", snippet); - }, + snippet: snippet, run: function (aSnippetsMap) { let deferred = Promise.defer(); @@ -81,7 +77,6 @@ gBrowser.removeTab(gBrowser.selectedTab); SocialService.uninstallProvider(SocialSidebar.provider.origin, function () { info("provider uninstalled"); - aSnippetsMap.delete("snippets"); deferred.resolve(true); }); }); @@ -91,11 +86,7 @@ { desc: "Test activation bypassing enable panel", - setup: function (aSnippetsMap) - { - // This must be some incorrect xhtml code. - aSnippetsMap.set("snippets", snippet2); - }, + snippet: snippet2, run: function (aSnippetsMap) { let deferred = Promise.defer(); @@ -113,7 +104,6 @@ gBrowser.removeTab(gBrowser.selectedTab); SocialService.uninstallProvider(SocialSidebar.provider.origin, function () { info("provider uninstalled"); - aSnippetsMap.delete("snippets"); deferred.resolve(true); }); }); @@ -136,7 +126,7 @@ let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank"); // Add an event handler to modify the snippets map once it's ready. - let snippetsPromise = promiseSetupSnippetsMap(tab, test.setup); + let snippetsPromise = promiseSetupSnippetsMap(tab, test.snippet); // Start loading about:home and wait for it to complete. yield promiseTabLoadEvent(tab, "about:home", "AboutHomeLoadSnippetsCompleted"); @@ -196,32 +186,45 @@ * The setup function to be run. * @return {Promise} resolved when the snippets are ready. Gets the snippets map. */ -function promiseSetupSnippetsMap(aTab, aSetupFn) +function promiseSetupSnippetsMap(aTab, aSnippet) { - let deferred = Promise.defer(); info("Waiting for snippets map"); - aTab.linkedBrowser.addEventListener("AboutHomeLoadSnippets", function load(event) { - aTab.linkedBrowser.removeEventListener("AboutHomeLoadSnippets", load, true); - let cw = aTab.linkedBrowser.contentWindow.wrappedJSObject; - // The snippets should already be ready by this point. Here we're - // just obtaining a reference to the snippets map. - cw.ensureSnippetsMapThen(function (aSnippetsMap) { - aSnippetsMap = Cu.waiveXrays(aSnippetsMap); - info("Got snippets map: " + - "{ last-update: " + aSnippetsMap.get("snippets-last-update") + - ", cached-version: " + aSnippetsMap.get("snippets-cached-version") + - " }"); - // Don't try to update. - aSnippetsMap.set("snippets-last-update", Date.now()); - aSnippetsMap.set("snippets-cached-version", AboutHomeUtils.snippetsVersion); - // Clear snippets. - aSnippetsMap.delete("snippets"); - aSetupFn(aSnippetsMap); - deferred.resolve(aSnippetsMap); - }); - }, true, true); - return deferred.promise; + return ContentTask.spawn(aTab.linkedBrowser, + {snippetsVersion: AboutHomeUtils.snippetsVersion, + snippet: aSnippet}, + function*(arg) { + + let obj = {}; + Cu.import("resource://gre/modules/Promise.jsm", obj); + let deferred = obj.Promise.defer(); + + addEventListener("AboutHomeLoadSnippets", function load(event) { + removeEventListener("AboutHomeLoadSnippets", load, true); + + let cw = content.window.wrappedJSObject; + + // The snippets should already be ready by this point. Here we're + // just obtaining a reference to the snippets map. + cw.ensureSnippetsMapThen(function (aSnippetsMap) { + aSnippetsMap = Cu.waiveXrays(aSnippetsMap); + console.log("Got snippets map: " + + "{ last-update: " + aSnippetsMap.get("snippets-last-update") + + ", cached-version: " + aSnippetsMap.get("snippets-cached-version") + + " }"); + // Don't try to update. + aSnippetsMap.set("snippets-last-update", Date.now()); + aSnippetsMap.set("snippets-cached-version", arg.snippetsVersion); + // Clear snippets. + aSnippetsMap.delete("snippets"); + aSnippetsMap.set("snippets", arg.snippet); + deferred.resolve(); + }); + }, true, true); + + return deferred.promise; + + }); } @@ -233,7 +236,7 @@ if (doc.defaultView.frames[0]) doc = doc.defaultView.frames[0].document; let button = doc.getElementById("activationSnippet"); - EventUtils.synthesizeMouseAtCenter(button, {}, doc.defaultView); + BrowserTestUtils.synthesizeMouseAtCenter(button, {}, tab.linkedBrowser); executeSoon(callback); } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser.ini firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser.ini --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser.ini 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser.ini 2015-05-25 20:42:43.000000000 +0000 @@ -27,7 +27,6 @@ unchecked.jpg [browser_aboutHome_activation.js] -skip-if = e10s # Bug 1053965 "cw.ensureSnippetsMapThen is not a function", also see general/browser.ini about:home comments [browser_addons.js] skip-if = e10s && debug # Leaking docshells (bug 1150147) [browser_blocklist.js] @@ -35,7 +34,7 @@ [browser_share.js] skip-if = true # bug 1115131 [browser_social_activation.js] -skip-if = e10s # Bug 933103 synthesizeMouseAtCenter not e10s friendly +skip-if = e10s && debug # e10s/Linux/Debug Leaking docshells (bug 1150147) [browser_social_chatwindow.js] [browser_social_chatwindow_resize.js] [browser_social_chatwindowfocus.js] diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_activation.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_activation.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_activation.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_activation.js 2015-05-25 20:42:43.000000000 +0000 @@ -62,12 +62,7 @@ function sendActivationEvent(tab, callback, nullManifest) { // hack Social.lastEventReceived so we don't hit the "too many events" check. Social.lastEventReceived = 0; - let doc = tab.linkedBrowser.contentDocument; - // if our test has a frame, use it - if (doc.defaultView.frames[0]) - doc = doc.defaultView.frames[0].document; - let button = doc.getElementById(nullManifest ? "activation-old" : "activation"); - EventUtils.synthesizeMouseAtCenter(button, {}, doc.defaultView); + BrowserTestUtils.synthesizeMouseAtCenter("#activation", {}, tab.linkedBrowser); executeSoon(callback); } @@ -117,24 +112,22 @@ AddonManager.getAddonsByTypes(["service"], function(aAddons) { let addon = aAddons[0]; - let doc = tab.linkedBrowser.contentDocument; + let doc = tab.linkedBrowser.contentDocument;; let list = doc.getElementById("addon-list"); let item = getAddonItemInList(addon.id, list); - isnot(item, null, "Should have found the add-on in the list"); - - var button = doc.getAnonymousElementByAttribute(item, "anonid", "remove-btn"); + let button = item._removeBtn; isnot(button, null, "Should have a remove button"); ok(!button.disabled, "Button should not be disabled"); - EventUtils.synthesizeMouseAtCenter(button, { }, doc.defaultView); - - // Force XBL to apply - item.clientTop; - - is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling"); + // uninstall happens after about:addons tab is closed, so we wait on + // disabled + promiseObserverNotified("social:provider-disabled").then(() => { + is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling"); + executeSoon(function() { aCallback(addon); }); + }); - executeSoon(function() { aCallback(addon); }); + BrowserTestUtils.synthesizeMouseAtCenter(button, {}, tab.linkedBrowser); }); } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_errorPage.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_errorPage.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_errorPage.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_errorPage.js 2015-05-25 20:42:43.000000000 +0000 @@ -62,17 +62,17 @@ testSidebar: function(next) { let sbrowser = document.getElementById("social-sidebar-browser"); onSidebarLoad(function() { - ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?")==0, "sidebar is on social error page"); + ok(sbrowser.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0, "sidebar is on social error page"); gc(); // Add a new load listener, then find and click the "try again" button. onSidebarLoad(function() { // should still be on the error page. - ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?")==0, "sidebar is still on social error page"); + ok(sbrowser.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0, "sidebar is still on social error page"); // go online and try again - this should work. goOnline().then(function () { onSidebarLoad(function() { // should now be on the correct page. - is(sbrowser.contentDocument.location.href, manifest.sidebarURL, "sidebar is now on social sidebar page"); + is(sbrowser.contentDocument.documentURI, manifest.sidebarURL, "sidebar is now on social sidebar page"); next(); }); sbrowser.contentDocument.getElementById("btnTryAgain").click(); @@ -97,8 +97,8 @@ }, function() { // the "load" callback. todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads."); - let href = panel.firstChild.contentDocument.location.href; - ok(href.indexOf("about:socialerror?")==0, "flyout is on social error page"); + let href = panel.firstChild.contentDocument.documentURI; + ok(href.indexOf("about:socialerror?mode=compactInfo")==0, "flyout is on social error page"); // Bug 832943 - the listeners previously stopped working after a GC, so // force a GC now and try again. gc(); @@ -109,8 +109,8 @@ }, function() { // the "load" callback. todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads."); - let href = panel.firstChild.contentDocument.location.href; - ok(href.indexOf("about:socialerror?")==0, "flyout is on social error page"); + let href = panel.firstChild.contentDocument.documentURI; + ok(href.indexOf("about:socialerror?mode=compactInfo")==0, "flyout is on social error page"); gc(); SocialFlyout.unload(); next(); @@ -134,7 +134,7 @@ function() { // the "load" callback. todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads."); let chat = getChatBar().selectedChat; - waitForCondition(function() chat.content != null && chat.contentDocument.location.href.indexOf("about:socialerror?")==0, + waitForCondition(function() chat.content != null && chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0, function() { chat.close(); next(); @@ -157,7 +157,7 @@ null, function() { // the "load" callback. let chat = getChatBar().selectedChat; - is(chat.contentDocument.location.href, url, "correct url loaded"); + is(chat.contentDocument.documentURI, url, "correct url loaded"); // toggle to a detached window. chat.swapWindows().then( chat => { @@ -169,7 +169,7 @@ ok(!!chat.content, "we have chat content 2"); chat.contentDocument.location.reload(); info("chat reload called"); - waitForCondition(function() chat.contentDocument.location.href.indexOf("about:socialerror?")==0, + waitForCondition(function() chat.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly")==0, function() { chat.close(); next(); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_marks.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_marks.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_marks.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_marks.js 2015-05-25 20:42:43.000000000 +0000 @@ -238,7 +238,7 @@ ensureEventFired(btn.panel, "popupshown").then(() => { info("marks panel is open"); ensureFrameLoaded(btn.content).then(() => { - is(btn.contentDocument.location.href.indexOf("about:socialerror?"), 0, "social error page is showing"); + is(btn.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly"), 0, "social error page is showing "+btn.contentDocument.documentURI); // cleanup after the page has been unmarked ensureBrowserTabClosed(tab).then(() => { ok(btn.disabled, "button is disabled"); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_status.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_status.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_status.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_status.js 2015-05-25 20:42:43.000000000 +0000 @@ -183,7 +183,7 @@ let panel = document.getElementById("social-notification-panel"); ensureEventFired(panel, "popupshown").then(() => { ensureFrameLoaded(frame).then(() => { - is(frame.contentDocument.location.href.indexOf("about:socialerror?"), 0, "social error page is showing "+frame.contentDocument.location.href); + is(frame.contentDocument.documentURI.indexOf("about:socialerror?mode=tryAgainOnly"), 0, "social error page is showing "+frame.contentDocument.documentURI); panel.hidePopup(); goOnline().then(next); }); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_workercrash.js firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_workercrash.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/test/social/browser_social_workercrash.js 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/test/social/browser_social_workercrash.js 2015-05-25 20:42:43.000000000 +0000 @@ -63,7 +63,7 @@ Services.obs.removeObserver(observer, 'ipc:content-shutdown'); // Add another sidebar load listener - it should be the error page. onSidebarLoad(function() { - ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?")==0, "is on social error page"); + ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?mode=workerFailure")==0, "is on social error page"); // after reloading, the sidebar should reload onSidebarLoad(function() { // now ping both workers - they should both be alive. diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/urlbarBindings.xml firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/urlbarBindings.xml --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/content/urlbarBindings.xml 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/content/urlbarBindings.xml 2015-05-25 20:42:43.000000000 +0000 @@ -596,7 +596,7 @@ Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper) - .copyString(val, document); + .copyString(val); }, supportsCommand: function(aCommand) { switch (aCommand) { @@ -866,6 +866,23 @@ ]]> + + + + @@ -952,7 +969,7 @@ Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper) - .copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard, document); + .copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard); ]]> @@ -2781,7 +2798,7 @@ which is empty because the actual panel is not implemented inside an XBL binding, but made of elements added to the notification panel. This allows accessing the full structure while the panel is hidden. --> - + @@ -3000,7 +3017,7 @@ return "passwords"; if (type == "editBookmarkPanel") return "bookmarks"; - if (type == "addon-install-complete") { + if (type == "addon-install-complete" || type == "addon-install-restart") { if (!Services.prefs.prefHasUserValue("services.sync.username")) return "addons"; if (!Services.prefs.getBoolPref("services.sync.engine.addons")) diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/base/jar.mn firefox-trunk-41.0~a1~hg20150524r245419/browser/base/jar.mn --- firefox-trunk-41.0~a1~hg20150513r243603/browser/base/jar.mn 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/base/jar.mn 2015-05-25 20:42:43.000000000 +0000 @@ -75,7 +75,7 @@ * content/browser/browser.css (content/browser.css) * content/browser/browser.js (content/browser.js) * content/browser/browser.xul (content/browser.xul) - content/browser/browser-pocket.properties (content/browser-pocket.properties) + content/browser/browser-pocket-en-US.properties (content/browser-pocket-en-US.properties) content/browser/browser-pocket.dtd (content/browser-pocket.dtd) content/browser/browser-pocket-de.properties (content/browser-pocket-de.properties) content/browser/browser-pocket-es-ES.properties (content/browser-pocket-es-ES.properties) @@ -85,6 +85,7 @@ * content/browser/chatWindow.xul (content/chatWindow.xul) content/browser/tab-content.js (content/tab-content.js) content/browser/content.js (content/content.js) + content/browser/social-content.js (content/social-content.js) content/browser/defaultthemes/1.footer.jpg (content/defaultthemes/1.footer.jpg) content/browser/defaultthemes/1.header.jpg (content/defaultthemes/1.header.jpg) content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg) @@ -107,9 +108,13 @@ content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg) content/browser/defaultthemes/devedition.header.png (content/defaultthemes/devedition.header.png) content/browser/defaultthemes/devedition.icon.png (content/defaultthemes/devedition.icon.png) + content/browser/gcli_sec_bad.svg (content/gcli_sec_bad.svg) + content/browser/gcli_sec_good.svg (content/gcli_sec_good.svg) + content/browser/gcli_sec_moderate.svg (content/gcli_sec_moderate.svg) content/browser/newtab/newTab.xul (content/newtab/newTab.xul) * content/browser/newtab/newTab.js (content/newtab/newTab.js) content/browser/newtab/newTab.css (content/newtab/newTab.css) + content/browser/newtab/newTab.inadjacent.json (content/newtab/newTab.inadjacent.json) * content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul) content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js) content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css) Binary files /tmp/eW8igynxG9/firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/appname.bmp and /tmp/Cl2MQoCVg4/firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/appname.bmp differ diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/branding.nsi firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/branding.nsi --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/branding.nsi 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/branding.nsi 2015-05-25 20:42:43.000000000 +0000 @@ -26,8 +26,8 @@ # settings. # The dialog units for the bitmap's dimensions should match exactly with the # bitmap's width and height in pixels. -!define APPNAME_BMP_WIDTH_DU 123u -!define APPNAME_BMP_HEIGHT_DU 56u +!define APPNAME_BMP_WIDTH_DU 108u +!define APPNAME_BMP_HEIGHT_DU 48u !define INTRO_BLURB_WIDTH_DU "232u" !define INTRO_BLURB_EDGE_DU "196u" !define INTRO_BLURB_LTR_TOP_DU "16u" diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/content/about-wordmark.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/content/about-wordmark.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/content/about-wordmark.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/content/about-wordmark.svg 2015-05-25 20:42:44.000000000 +0000 @@ -1,60 +1,61 @@ - - - - + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/content/silhouette-40.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/content/silhouette-40.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/aurora/content/silhouette-40.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/aurora/content/silhouette-40.svg 2015-05-25 20:42:44.000000000 +0000 @@ -1,25 +1,26 @@ - - - + + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/nightly/content/about-wordmark.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/nightly/content/about-wordmark.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/nightly/content/about-wordmark.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/nightly/content/about-wordmark.svg 2015-05-25 20:42:44.000000000 +0000 @@ -1,36 +1,36 @@ - - - + + - + C73.2,0.3,70,2.8,70,8c0,2.3,0.2,3.7,0.2,3.7h-2.5v3.8H70V37h5.4V15.6h5.1l1.4-3.8H75.5z M92.3,11.2c-6.7,0-11,5.2-11,13.3 + c0,8.1,4.3,13.2,11.1,13.2c6.8,0,11.2-5,11.2-13.2C103.6,16.5,99.5,11.2,92.3,11.2z M92.5,33.6c-3.3,0-5.1-2.1-5.1-9.5 + c0-6.1,1.5-8.8,5-8.8c3.2,0,5.2,2.1,5.2,9.3C97.6,30.9,95.8,33.6,92.5,33.6z M43.7,11.1c-2.5,0-4.4,1.3-6.4,4c0-1.4-0.3-2.8-0.9-4 + l-5,1.3c0.6,1.6,0.9,3.6,0.9,6.8V37h5.5V19.9c0.5-2,2.4-3.7,4.7-3.7c0.6,0,1,0.1,1.6,0.4l1.7-5.1C45,11.2,44.5,11.1,43.7,11.1z + M0,37h5.7V21.2h9.6v-4.6H5.7V7.2h11.8l0.7-4.7H0V37z M21.4,37h5.5V11.2l-5.5,1V37z M24.2,0.7c-2,0-3.6,1.6-3.6,3.7 + c0,2,1.5,3.6,3.5,3.6c2,0,3.7-1.6,3.7-3.6C27.8,2.3,26.2,0.7,24.2,0.7z M125.2,11.8h-6.4c-0.7,1.1-3.3,6.1-4,7.7 + c-1.2-2.3-3.4-6.3-4.6-8.2l-5.9,1.2l7.3,10.8L102.2,37h6.9c0.9-1.4,4.5-7.5,5.5-9.4c0.5,0.9,4.6,8,5.5,9.4h6.9l-9.2-13.8L125.2,11.8 + z M62.7,13.8c-2.1-1.9-4.4-2.6-6.9-2.6c-3.2,0-5.7,1-7.7,3.4C45.9,17.1,45,20,45,24.5c0,8.1,4.5,13.2,11.6,13.2 + c3.4,0,6.4-1.1,9.1-3.3L63.4,31c-1.9,1.6-3.9,2.5-6.3,2.5c-4.9,0-6.2-3.7-6.2-7.2v-0.4H66v-1.2C66,18.9,64.9,15.8,62.7,13.8z + M51,21.8c0-4.1,1.7-6.5,4.8-6.5c2.8,0,4.5,2.4,4.5,6.5H51z M198.5,14.3l-2.4-2.4c-1.2,0.8-2.2,1.1-3.5,1.1c-3,0-3.8-1.4-7.6-1.4 + c-5.4,0-9.2,3.4-9.2,8.4c0,3.3,2.2,6.1,5.6,7.2c-3.4,1-4.5,2.2-4.5,4.3c0,2.2,1.8,3.6,4.7,3.6h3.8c2.5,0,3.9,0.2,4.9,0.9 + c0.9,0.6,1.4,1.6,1.4,3c0,3.1-2.2,4.4-6,4.4c-2,0-3.8-0.5-5.1-1.2c-0.9-0.6-1.5-1.6-1.5-2.9c0-0.8,0.3-1.7,0.7-2.2l-4.1,0.4 + c-0.3,1-0.5,1.7-0.5,2.6c0,3.5,3,6.4,10.8,6.4c6.1,0,9.9-2.5,9.9-7.9c0-2.1-0.8-3.9-2.7-5.3c-1.5-1.1-3.1-1.4-6-1.4h-4 + c-1.3,0-2-0.5-2-1.2c0-0.8,1.1-1.7,4.5-2.9c1.8,0,3.4-0.3,4.7-1.1c2.3-1.4,3.7-4.1,3.7-6.8c0-1.6-0.5-3-1.5-4.3 + c0.4,0.2,1.1,0.3,1.7,0.3C195.8,15.8,196.9,15.4,198.5,14.3z M185,24.8c-3.1,0-4.8-1.7-4.8-4.8c0-3.5,1.6-5.1,4.7-5.1 + c3.3,0,4.6,1.5,4.6,4.9C189.5,23.1,188,24.8,185,24.8z M168.6,1.3c-1.7,0-3,1.4-3,3.1c0,1.7,1.4,3,3,3c1.7,0,3.1-1.3,3.1-3 + C171.6,2.7,170.3,1.3,168.6,1.3z M245.7,34.5c-1.1,0-1.4-0.6-1.4-2.5V6.5c0-3.8-0.6-5.9-0.6-5.9l-3.9,0.8c0,0,0.6,1.9,0.6,5.1v26.4 + c0,1.8,0.4,2.8,1.2,3.5c0.7,0.7,1.7,1,2.9,1c1,0,1.5-0.1,2.5-0.5l-0.8-2.5C246.2,34.4,245.8,34.5,245.7,34.5z M212.7,11.6 + c-3.2,0-6.1,1.8-8.3,3.9c0,0,0.2-1.8,0.2-3.4V6.3c0-3.8-0.7-5.9-0.7-5.9L200,1.1c0,0,0.7,1.9,0.7,5.1V37h3.9V19.3 + c2.1-2.7,4.9-4.2,7.2-4.2c1.3,0,2.3,0.4,2.9,1c0.7,0.7,0.9,1.8,0.9,3.7V37h3.8V19.1c0-1.8-0.1-2.6-0.4-3.6 + C218.4,13.2,215.7,11.6,212.7,11.6z M265.4,12.1l-4.9,16.4c-0.6,2-1.6,5.2-1.6,5.2s-0.7-3.9-1.5-6.2l-5.1-16.2l-3.9,1.3l5.4,15.6 + c0.8,2.5,2.2,7.4,2.5,9l1.6-0.3c-1.3,5.1-2.5,6.7-5.7,7.6l1.2,2.7c4.4-1,6.4-4.3,8-9.3l8.6-25.8H265.4z M234.9,15l1.2-2.9h-6.2 + c0-3.3,0.5-7.2,0.5-7.2l-4.1,0.9c0,0-0.4,3.9-0.4,6.3h-3.2V15h3.2v17.1c0,2.5,0.7,4.1,2.4,5c0.9,0.4,1.9,0.7,3.3,0.7 + c1.8,0,3.1-0.4,4.4-1l-0.6-2.5c-0.7,0.3-1.3,0.5-2.4,0.5c-2.4,0-3.2-0.9-3.2-3.7V15H234.9z M166.5,37h4.1V11.5l-4.1,0.6V37z + M156.8,21.3c0,5,0.4,10.5,0.4,10.5s-1.4-3.8-3.2-7.2L142.7,2.7h-4.8V37h4.2l-0.2-19.9c0-4.5-0.4-9.3-0.4-9.3s1.7,4.1,3.9,8.2l11,21 + h4.3V2.7h-4L156.8,21.3z M128.3,12.9c-0.3-0.1-0.7-0.1-1-0.1v2.3h0.3v-1c0.3,0,0.7,1,0.7,1s0.2,0,0.4,0c-0.2-0.3-0.3-0.7-0.6-1 + C128.8,14.1,128.9,13.1,128.3,12.9z M127.6,13.8v-0.7c0,0,0.7,0,0.7,0.3C128.3,13.9,127.8,13.9,127.6,13.8z M128,12 + c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S129.1,12,128,12z M128,15.5c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5s1.5,0.7,1.5,1.5 + S128.8,15.5,128,15.5z"/> diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/nightly/content/silhouette-40.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/nightly/content/silhouette-40.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/nightly/content/silhouette-40.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/nightly/content/silhouette-40.svg 2015-05-25 20:42:44.000000000 +0000 @@ -1,8 +1,9 @@ - - + - - - - - + + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/official/content/silhouette-40.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/official/content/silhouette-40.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/official/content/silhouette-40.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/official/content/silhouette-40.svg 2015-05-25 20:42:44.000000000 +0000 @@ -1,8 +1,9 @@ - - + - - - + + - + c0,3.3,2.2,6.1,5.6,7.2c-3.4,1-4.5,2.2-4.5,4.3c0,2.2,1.8,3.6,4.7,3.6h3.8c2.5,0,3.9,0.2,4.9,0.9c0.9,0.6,1.4,1.6,1.4,3 + c0,3.1-2.2,4.4-6,4.4c-2,0-3.8-0.5-5.1-1.2c-0.9-0.6-1.5-1.6-1.5-2.9c0-0.8,0.3-1.7,0.7-2.2l-4.1,0.4c-0.3,1-0.5,1.7-0.5,2.6 + c0,3.5,3,6.4,10.8,6.4c6.1,0,9.9-2.5,9.9-7.9c0-2.1-0.8-3.9-2.7-5.3c-1.5-1.1-3.1-1.4-6-1.4h-4c-1.3,0-2-0.5-2-1.2 + c0-0.8,1.1-1.7,4.5-2.9c1.8,0,3.4-0.3,4.7-1.1c2.3-1.4,3.7-4.1,3.7-6.8c0-1.6-0.5-3-1.5-4.3c0.4,0.2,1.1,0.3,1.7,0.3 + C57.9,15.8,59,15.4,60.6,14.3z M47.1,24.8c-3.1,0-4.8-1.7-4.8-4.8c0-3.5,1.6-5.1,4.7-5.1c3.3,0,4.6,1.5,4.6,4.9 + C51.6,23.1,50.1,24.8,47.1,24.8z M30.7,1.3c-1.7,0-3,1.4-3,3.1s1.4,3,3,3c1.7,0,3.1-1.3,3.1-3C33.7,2.7,32.4,1.3,30.7,1.3z + M107.7,34.5c-1.1,0-1.4-0.6-1.4-2.5V6.5c0-3.8-0.6-5.9-0.6-5.9l-3.9,0.8c0,0,0.6,1.9,0.6,5.1v26.4c0,1.8,0.4,2.8,1.2,3.5 + c0.7,0.7,1.7,1,2.9,1c1,0,1.5-0.1,2.5-0.5l-0.8-2.5C108.2,34.4,107.8,34.5,107.7,34.5z M74.7,11.6c-3.2,0-6.1,1.8-8.3,3.9 + c0,0,0.2-1.8,0.2-3.4V6.3c0-3.8-0.7-5.9-0.7-5.9l-3.9,0.7c0,0,0.7,1.9,0.7,5.1V37h3.9V19.3c2.1-2.7,4.9-4.2,7.2-4.2 + c1.3,0,2.3,0.4,2.9,1c0.7,0.7,0.9,1.8,0.9,3.7V37h3.8V19.1c0-1.8-0.1-2.6-0.4-3.6C80.4,13.2,77.7,11.6,74.7,11.6z M127.4,12.1 + l-4.9,16.4c-0.6,2-1.6,5.2-1.6,5.2s-0.7-3.9-1.5-6.2l-5.1-16.2l-3.9,1.3l5.4,15.6c0.8,2.5,2.2,7.4,2.5,9l1.6-0.3 + c-1.3,5.1-2.5,6.7-5.7,7.6l1.2,2.7c4.4-1,6.4-4.3,8-9.3l8.6-25.8H127.4z M96.9,15l1.2-2.9h-6.2c0-3.3,0.5-7.2,0.5-7.2l-4.1,0.9 + c0,0-0.4,3.9-0.4,6.3h-3.2V15h3.2v17.1c0,2.5,0.7,4.1,2.4,5c0.9,0.4,1.9,0.7,3.3,0.7c1.8,0,3.1-0.4,4.4-1l-0.6-2.5 + c-0.7,0.3-1.3,0.5-2.4,0.5c-2.4,0-3.2-0.9-3.2-3.7V15H96.9z M28.6,37h4.1V11.5l-4.1,0.6V37z M18.9,21.3c0,5,0.4,10.5,0.4,10.5 + s-1.4-3.8-3.2-7.2L4.8,2.7H0V37h4.2L4,17.1c0-4.5-0.4-9.3-0.4-9.3s1.7,4.1,3.9,8.2l11,21h4.3V2.7h-4L18.9,21.3z"/> diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/unofficial/content/silhouette-40.svg firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/unofficial/content/silhouette-40.svg --- firefox-trunk-41.0~a1~hg20150513r243603/browser/branding/unofficial/content/silhouette-40.svg 2015-05-13 18:05:58.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/branding/unofficial/content/silhouette-40.svg 2015-05-25 20:42:45.000000000 +0000 @@ -1,8 +1,9 @@ - - + + + - - - diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/content/panelUI.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/content/panelUI.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/content/panelUI.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/content/panelUI.js 2015-05-25 20:42:45.000000000 +0000 @@ -6,8 +6,6 @@ "resource:///modules/CustomizableUI.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ScrollbarSampler", "resource:///modules/ScrollbarSampler.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Pocket", - "resource:///modules/Pocket.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils", @@ -515,19 +513,11 @@ * @return the selected locale or "en-US" if none is selected */ function getLocale() { - const PREF_SELECTED_LOCALE = "general.useragent.locale"; try { - let locale = Services.prefs.getComplexValue(PREF_SELECTED_LOCALE, - Ci.nsIPrefLocalizedString); - if (locale) - return locale; + let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"] + .getService(Ci.nsIXULChromeRegistry); + return chromeRegistry.getSelectedLocale("browser"); + } catch (ex) { + return "en-US"; } - catch (e) { } - - try { - return Services.prefs.getCharPref(PREF_SELECTED_LOCALE); - } - catch (e) { } - - return "en-US"; } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/CustomizableUI.jsm firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/CustomizableUI.jsm --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/CustomizableUI.jsm 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/CustomizableUI.jsm 2015-05-25 20:42:45.000000000 +0000 @@ -300,6 +300,13 @@ // We should still enter even if gSavedState.currentVersion >= kVersion // because the per-widget pref facility is independent of versioning. if (!gSavedState) { + // Flip all the prefs so we don't try to re-introduce later: + for (let [id, widget] of gPalette) { + if (widget.defaultArea && widget._introducedInVersion === "pref") { + let prefId = "browser.toolbarbuttons.introduced." + widget.id; + Services.prefs.setBoolPref(prefId, true); + } + } return; } @@ -376,6 +383,7 @@ // Before you ask, yes, deleting things inside a let x of y loop where y is a Set is // safe, and we won't skip any items. futurePlacedWidgets.delete(widget.id); + gDirty = true; break; } // Otherwise, if we're somewhere other than the beginning, check if the previous @@ -386,6 +394,7 @@ if (previousWidgetIndex != -1) { savedPlacements.splice(previousWidgetIndex + 1, 0, widget.id); futurePlacedWidgets.delete(widget.id); + gDirty = true; break; } } @@ -394,6 +403,7 @@ // with doing nothing else now; if the item remains in gFuturePlacements, we'll // add it at the end in restoreStateForArea. } + this.saveState(); }, wrapWidget: function(aWidgetId) { @@ -2173,9 +2183,9 @@ // current placement settings. // This allows a widget to be both built-in by default but also able to be - // destroyed based on criteria that may not be available when the widget is - // created -- for example, because some other feature in the browser - // supersedes the widget. + // destroyed and removed from the area based on criteria that may not be + // available when the widget is created -- for example, because some other + // feature in the browser supersedes the widget. let conditionalDestroyPromise = aData.conditionalDestroyPromise || null; delete aData.conditionalDestroyPromise; @@ -2192,6 +2202,7 @@ conditionalDestroyPromise.then(shouldDestroy => { if (shouldDestroy) { this.destroyWidget(widget.id); + this.removeWidgetFromArea(widget.id); } }, err => { Cu.reportError(err); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/CustomizableWidgets.jsm firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/CustomizableWidgets.jsm --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/CustomizableWidgets.jsm 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/CustomizableWidgets.jsm 2015-05-25 20:42:45.000000000 +0000 @@ -1080,6 +1080,8 @@ } if (isEnabledForLocale) { + if (browserLocale == "ja-JP-mac") + browserLocale = "ja"; let url = "chrome://browser/content/browser-pocket-" + browserLocale + ".properties"; let strings = Services.strings.createBundle(url); let label; @@ -1090,7 +1092,7 @@ } catch (err) { // GetStringFromName throws when the bundle doesn't exist. In that case, // fall back to the en-US browser-pocket.properties. - url = "chrome://browser/content/browser-pocket.properties"; + url = "chrome://browser/content/browser-pocket-en-US.properties"; strings = Services.strings.createBundle(url); label = strings.GetStringFromName("pocket-button.label"); tooltiptext = strings.GetStringFromName("pocket-button.tooltiptext"); @@ -1104,8 +1106,13 @@ viewId: "PanelUI-pocketView", label: label, tooltiptext: tooltiptext, - onViewShowing: Pocket.onPanelViewShowing, - onViewHiding: Pocket.onPanelViewHiding, + // Use forwarding functions here to avoid loading Pocket.jsm on startup: + onViewShowing: function() { + return Pocket.onPanelViewShowing.apply(this, arguments); + }, + onViewHiding: function() { + return Pocket.onPanelViewHiding.apply(this, arguments); + }, // If the user has the "classic" Pocket add-on installed, use that instead // and destroy the widget. diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_1003588_no_specials_in_panel.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_1003588_no_specials_in_panel.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_1003588_no_specials_in_panel.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_1003588_no_specials_in_panel.js 2015-05-25 20:42:45.000000000 +0000 @@ -3,6 +3,21 @@ "use strict"; +function simulateItemDragAndEnd(aToDrag, aTarget) { + var ds = Components.classes["@mozilla.org/widget/dragservice;1"]. + getService(Components.interfaces.nsIDragService); + + ds.startDragSession(); + try { + var [result, dataTransfer] = ChromeUtils.synthesizeDragOver(aToDrag.parentNode, aTarget); + ChromeUtils.synthesizeDropAfterDragOver(result, dataTransfer, aTarget); + // Send dragend to move dragging item back to initial place. + EventUtils.sendDragEvent({ type: "dragend", dataTransfer: dataTransfer }, + aToDrag.parentNode); + } finally { + ds.endDragSession(true); + } +} add_task(function* checkNoAddingToPanel() { let area = CustomizableUI.AREA_PANEL; @@ -66,7 +81,7 @@ yield startCustomizing(); for (let id of elementsToMove) { - simulateItemDrag(document.getElementById(id), PanelUI.contents); + simulateItemDragAndEnd(document.getElementById(id), PanelUI.contents); } assertAreaPlacements(startArea, placementsWithSpecials); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js 2015-05-25 20:42:45.000000000 +0000 @@ -51,7 +51,7 @@ let defaultTheme = header.nextSibling; defaultTheme.doCommand(); - is(Services.prefs.prefHasUserValue("lightweightThemes.selectedThemeID"), false, "No lwtheme should be selected"); + is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected"); }); add_task(function asyncCleanup() { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_962069_drag_to_overflow_chevron.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_962069_drag_to_overflow_chevron.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_962069_drag_to_overflow_chevron.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_962069_drag_to_overflow_chevron.js 2015-05-25 20:42:45.000000000 +0000 @@ -26,8 +26,20 @@ // async-ness of the 'shown' yield... let panelHiddenPromise = promisePanelElementHidden(window, widgetOverflowPanel); - ChromeUtils.synthesizeDrop(identityBox, overflowChevron, [], null); - yield panelShownPromise; + var ds = Components.classes["@mozilla.org/widget/dragservice;1"]. + getService(Components.interfaces.nsIDragService); + + ds.startDragSession(); + try { + var [result, dataTransfer] = ChromeUtils.synthesizeDragOver(identityBox, overflowChevron); + + // Wait for showing panel before ending drag session. + yield panelShownPromise; + + ChromeUtils.synthesizeDropAfterDragOver(result, dataTransfer, overflowChevron); + } finally { + ds.endDragSession(true); + } info("Overflow panel is shown."); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js 2015-05-25 20:42:45.000000000 +0000 @@ -21,6 +21,7 @@ simulateItemDrag(draggedItem, gCustomizeMode.visiblePalette); is(document.documentElement.hasAttribute("customizing-movingItem"), false, "Make sure customizing-movingItem is removed after dragging to the palette"); + yield endCustomizing(); }); // Drop on a customization target itself @@ -36,6 +37,7 @@ simulateItemDrag(draggedItem, dest.customizationTarget); is(document.documentElement.hasAttribute("customizing-movingItem"), false, "Make sure customizing-movingItem is removed"); + yield endCustomizing(); }); add_task(function asyncCleanup() { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/browser_995164_registerArea_during_customize_mode.js 2015-05-25 20:42:45.000000000 +0000 @@ -18,6 +18,7 @@ ok(!CustomizableUI.getPlacementOfWidget("sync-button"), "Button moved to the palette"); ok(gNavToolbox.palette.querySelector("#sync-button"), "Sync button really is in palette."); + syncButton.scrollIntoView(); simulateItemDrag(syncButton, toolbar); ok(CustomizableUI.getPlacementOfWidget("sync-button"), "Button moved out of palette"); is(CustomizableUI.getPlacementOfWidget("sync-button").area, TOOLBARID, "Button's back on toolbar"); @@ -49,6 +50,7 @@ ok(!CustomizableUI.inDefaultState, "Now that the toolbar is registered again, should no longer be in default state."); ok(gCustomizeMode.areas.has(toolbar), "Toolbar should be known to customize mode again."); + syncButton.scrollIntoView(); simulateItemDrag(syncButton, toolbar); ok(CustomizableUI.getPlacementOfWidget("sync-button"), "Button moved out of palette"); is(CustomizableUI.getPlacementOfWidget("sync-button").area, TOOLBARID, "Button's back on toolbar"); @@ -78,6 +80,7 @@ ok(gNavToolbox.palette.querySelector("#sync-button"), "Sync button really is in palette."); ok(!otherTB.querySelector("#sync-button"), "Sync button is in palette in other window, too."); + syncButton.scrollIntoView(); simulateItemDrag(syncButton, toolbar); ok(CustomizableUI.getPlacementOfWidget("sync-button"), "Button moved out of palette"); is(CustomizableUI.getPlacementOfWidget("sync-button").area, TOOLBARID, "Button's back on toolbar"); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/head.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/head.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/customizableui/test/head.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/customizableui/test/head.js 2015-05-25 20:42:45.000000000 +0000 @@ -173,12 +173,8 @@ return CustomizableUI.getWidgetIdsInArea(areaId); } -function simulateItemDrag(toDrag, target) { - let docId = toDrag.ownerDocument.documentElement.id; - let dragData = [[{type: 'text/toolbarwrapper-id/' + docId, - data: toDrag.id}]]; - synthesizeDragStart(toDrag.parentNode, dragData); - synthesizeDrop(target, target, dragData); +function simulateItemDrag(aToDrag, aTarget) { + synthesizeDrop(aToDrag.parentNode, aTarget); } function endCustomizing(aWindow=window) { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/downloads/content/allDownloadsViewOverlay.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/downloads/content/allDownloadsViewOverlay.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/downloads/content/allDownloadsViewOverlay.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/downloads/content/allDownloadsViewOverlay.js 2015-05-25 20:42:46.000000000 +0000 @@ -1208,7 +1208,7 @@ Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper) - .copyString(urls.join("\n"), document); + .copyString(urls.join("\n")); }, _getURLFromClipboardData() { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/downloads/content/downloads.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/downloads/content/downloads.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/downloads/content/downloads.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/downloads/content/downloads.js 2015-05-25 20:42:46.000000000 +0000 @@ -1262,7 +1262,7 @@ downloadsCmd_copyLocation() { let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper); - clipboard.copyString(this.download.source.url, document); + clipboard.copyString(this.download.source.url); }, downloadsCmd_doDefault() { diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/conversation.html firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/conversation.html --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/conversation.html 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/conversation.html 2015-05-25 20:42:46.000000000 +0000 @@ -40,6 +40,8 @@ + + diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/css/panel.css firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/css/panel.css --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/css/panel.css 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/css/panel.css 2015-05-25 20:42:46.000000000 +0000 @@ -229,30 +229,59 @@ -moz-margin-start: 0; } -.new-room-view > .context > .context-preview { - float: right; - width: 100px; - max-height: 200px; - -moz-margin-start: 10px; - margin-bottom: 10px; +.new-room-view > .context > .checkbox-wrapper { + margin-bottom: .5em; } -body[dir=rtl] .new-room-view > .context > .context-preview { +.new-room-view > .context > .checkbox-wrapper > .checkbox { + border-color: #0096dd; + background-color: #fff; +} + +.new-room-view > .context > .checkbox-wrapper > .checkbox.checked { + background-image: url("../shared/img/check.svg#check-blue"); +} + +.new-room-view > .context > .checkbox-wrapper > label { + color: #3c3c3c; + font-weight: 700; +} + +.new-room-view > .context > .context-content { + border: 1px solid #0096dd; + border-radius: 3px; + background: #fff; + padding: .8em; + display: flex; + flex-flow: row nowrap; + line-height: 1.1em; +} + +.new-room-view > .context > .context-content > .context-preview { + float: left; + width: 16px; + max-height: 16px; + -moz-margin-end: .8em; + flex: 0 1 auto; +} + +body[dir=rtl] .new-room-view > .context > .context-content > .context-preview { float: left; } -.new-room-view > .context > .context-preview[src=""] { +.new-room-view > .context > .context-content > .context-preview[src=""] { display: none; } -.new-room-view > .context > .context-description { +.new-room-view > .context > .context-content > .context-description { + flex: 0 1 auto; display: block; - color: #707070; } -.new-room-view > .context > .context-url { +.new-room-view > .context > .context-content > .context-description > .context-url { display: block; color: #59A1D7; + font-weight: 700; clear: both; } diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/client.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/client.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/client.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/client.js 2015-05-25 20:42:46.000000000 +0000 @@ -2,9 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* jshint esnext:true */ -/* global loop:true, hawk, deriveHawkCredentials */ - var loop = loop || {}; loop.Client = (function($) { "use strict"; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/contacts.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/contacts.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/contacts.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/contacts.js 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*jshint newcap:false*/ -/*global loop:true, React */ - var loop = loop || {}; loop.contacts = (function(_, mozL10n) { "use strict"; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/contacts.jsx firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/contacts.jsx --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/contacts.jsx 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/contacts.jsx 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*jshint newcap:false*/ -/*global loop:true, React */ - var loop = loop || {}; loop.contacts = (function(_, mozL10n) { "use strict"; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationAppStore.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationAppStore.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationAppStore.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationAppStore.js 2015-05-25 20:42:46.000000000 +0000 @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* global loop:true */ - var loop = loop || {}; loop.store = loop.store || {}; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversation.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversation.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversation.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversation.js 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* jshint newcap:false, esnext:true */ -/* global loop:true, React */ - var loop = loop || {}; loop.conversation = (function(mozL10n) { "use strict"; @@ -91,10 +86,14 @@ } }); + // We want data channels only if the text chat preference is enabled. + var useDataChannels = loop.shared.utils.getBoolPreference("textChat.enabled"); + var dispatcher = new loop.Dispatcher(); var client = new loop.Client(); var sdkDriver = new loop.OTSdkDriver({ isDesktop: true, + useDataChannels: useDataChannels, dispatcher: dispatcher, sdk: OT, mozLoop: navigator.mozLoop @@ -135,11 +134,15 @@ var feedbackStore = new loop.store.FeedbackStore(dispatcher, { feedbackClient: feedbackClient }); + var textChatStore = new loop.store.TextChatStore(dispatcher, { + sdkDriver: sdkDriver + }); loop.store.StoreMixin.register({ conversationAppStore: conversationAppStore, conversationStore: conversationStore, - feedbackStore: feedbackStore + feedbackStore: feedbackStore, + textChatStore: textChatStore }); // Obtain the windowId and pass it through @@ -158,8 +161,7 @@ React.render(React.createElement(AppControllerView, { roomStore: roomStore, dispatcher: dispatcher, - mozLoop: navigator.mozLoop} - ), document.querySelector('#main')); + mozLoop: navigator.mozLoop}), document.querySelector("#main")); document.body.setAttribute("dir", mozL10n.getDirection()); document.body.setAttribute("platform", loop.shared.utils.getPlatform()); @@ -183,4 +185,4 @@ }; })(document.mozL10n); -document.addEventListener('DOMContentLoaded', loop.conversation.init); +document.addEventListener("DOMContentLoaded", loop.conversation.init); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversation.jsx firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversation.jsx --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversation.jsx 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversation.jsx 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* jshint newcap:false, esnext:true */ -/* global loop:true, React */ - var loop = loop || {}; loop.conversation = (function(mozL10n) { "use strict"; @@ -91,10 +86,14 @@ } }); + // We want data channels only if the text chat preference is enabled. + var useDataChannels = loop.shared.utils.getBoolPreference("textChat.enabled"); + var dispatcher = new loop.Dispatcher(); var client = new loop.Client(); var sdkDriver = new loop.OTSdkDriver({ isDesktop: true, + useDataChannels: useDataChannels, dispatcher: dispatcher, sdk: OT, mozLoop: navigator.mozLoop @@ -135,11 +134,15 @@ var feedbackStore = new loop.store.FeedbackStore(dispatcher, { feedbackClient: feedbackClient }); + var textChatStore = new loop.store.TextChatStore(dispatcher, { + sdkDriver: sdkDriver + }); loop.store.StoreMixin.register({ conversationAppStore: conversationAppStore, conversationStore: conversationStore, - feedbackStore: feedbackStore + feedbackStore: feedbackStore, + textChatStore: textChatStore }); // Obtain the windowId and pass it through @@ -158,8 +161,7 @@ React.render(, document.querySelector('#main')); + mozLoop={navigator.mozLoop} />, document.querySelector("#main")); document.body.setAttribute("dir", mozL10n.getDirection()); document.body.setAttribute("platform", loop.shared.utils.getPlatform()); @@ -183,4 +185,4 @@ }; })(document.mozL10n); -document.addEventListener('DOMContentLoaded', loop.conversation.init); +document.addEventListener("DOMContentLoaded", loop.conversation.init); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationViews.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationViews.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationViews.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationViews.js 2015-05-25 20:42:46.000000000 +0000 @@ -1,11 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* global loop:true, React */ - var loop = loop || {}; loop.conversationViews = (function(mozL10n) { @@ -167,7 +163,7 @@ clickHandler: function(e) { var target = e.target; - if (!target.classList.contains('btn-chevron')) { + if (!target.classList.contains("btn-chevron")) { this._hideDeclineMenu(); } }, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationViews.jsx firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationViews.jsx --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/conversationViews.jsx 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/conversationViews.jsx 2015-05-25 20:42:46.000000000 +0000 @@ -1,11 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* global loop:true, React */ - var loop = loop || {}; loop.conversationViews = (function(mozL10n) { @@ -167,7 +163,7 @@ clickHandler: function(e) { var target = e.target; - if (!target.classList.contains('btn-chevron')) { + if (!target.classList.contains("btn-chevron")) { this._hideDeclineMenu(); } }, diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/otconfig.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/otconfig.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/otconfig.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/otconfig.js 2015-05-25 20:42:46.000000000 +0000 @@ -3,8 +3,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ window.OTProperties = { - cdnURL: 'loop/' + cdnURL: "loop/" }; -window.OTProperties.assetURL = window.OTProperties.cdnURL + 'sdk-content/'; -window.OTProperties.configURL = window.OTProperties.assetURL + 'js/dynamic_config.min.js'; -window.OTProperties.cssURL = window.OTProperties.assetURL + 'css/ot.css'; +window.OTProperties.assetURL = window.OTProperties.cdnURL + "sdk-content/"; +window.OTProperties.configURL = window.OTProperties.assetURL + "js/dynamic_config.min.js"; +window.OTProperties.cssURL = window.OTProperties.assetURL + "css/ot.css"; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/panel.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/panel.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/panel.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/panel.js 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*jshint newcap:false*/ -/*global loop:true, React */ - var loop = loop || {}; loop.panel = (function(_, mozL10n) { "use strict"; @@ -18,6 +13,7 @@ var sharedUtils = loop.shared.utils; var Button = sharedViews.Button; var ButtonGroup = sharedViews.ButtonGroup; + var Checkbox = sharedViews.Checkbox; var ContactsList = loop.contacts.ContactsList; var ContactDetailsForm = loop.contacts.ContactDetailsForm; @@ -132,11 +128,11 @@ return function(event) { // Note: side effect! switch (newAvailabilty) { - case 'available': + case "available": this.setState({doNotDisturb: false}); navigator.mozLoop.doNotDisturb = false; break; - case 'do-not-disturb': + case "do-not-disturb": this.setState({doNotDisturb: true}); navigator.mozLoop.doNotDisturb = true; break; @@ -149,13 +145,13 @@ // XXX https://github.com/facebook/react/issues/310 for === htmlFor var cx = React.addons.classSet; var availabilityStatus = cx({ - 'status': true, - 'status-dnd': this.state.doNotDisturb, - 'status-available': !this.state.doNotDisturb + "status": true, + "status-dnd": this.state.doNotDisturb, + "status-available": !this.state.doNotDisturb }); var availabilityDropdown = cx({ - 'dropdown-menu': true, - 'hide': !this.state.showMenu + "dropdown-menu": true, + "hide": !this.state.showMenu }); var availabilityText = this.state.doNotDisturb ? mozL10n.get("display_name_dnd_status") : @@ -293,7 +289,7 @@ } var locale = mozL10n.getLanguage(); - navigator.mozLoop.setLoopPref('showPartnerLogo', false); + navigator.mozLoop.setLoopPref("showPartnerLogo", false); return ( React.createElement("p", {id: "powered-by", className: "powered-by"}, mozL10n.get("powered_by_beforeLogo"), @@ -305,8 +301,8 @@ render: function() { if (!this.state.gettingStartedSeen || this.state.seenToS == "unseen") { - var terms_of_use_url = navigator.mozLoop.getLoopPref('legal.ToS_url'); - var privacy_notice_url = navigator.mozLoop.getLoopPref('legal.privacy_url'); + var terms_of_use_url = navigator.mozLoop.getLoopPref("legal.ToS_url"); + var privacy_notice_url = navigator.mozLoop.getLoopPref("legal.privacy_url"); var tosHTML = mozL10n.get("legal_text_and_links3", { "clientShortname": mozL10n.get("clientShortname2"), "terms_of_use": React.renderToStaticMarkup( @@ -704,7 +700,10 @@ userDisplayName: React.PropTypes.string.isRequired }, - mixins: [sharedMixins.DocumentVisibilityMixin], + mixins: [ + sharedMixins.DocumentVisibilityMixin, + React.addons.PureRenderMixin + ], getInitialState: function() { return { @@ -716,24 +715,25 @@ }, onDocumentVisible: function() { + // We would use onDocumentHidden to null out the data ready for the next + // opening. However, this seems to cause an awkward glitch in the display + // when opening the panel, and it seems cleaner just to update the data + // even if there's a small delay. + this.props.mozLoop.getSelectedTabMetadata(function callback(metadata) { - var previewImage = metadata.previews.length ? metadata.previews[0] : ""; - var description = metadata.description || metadata.title; + var previewImage = metadata.favicon || ""; + var description = metadata.title || metadata.description; var url = metadata.url; - this.setState({previewImage: previewImage, - description: description, - url: url}); + this.setState({ + previewImage: previewImage, + description: description, + url: url + }); }.bind(this)); }, - onDocumentHidden: function() { - this.setState({previewImage: "", - description: "", - url: ""}); - }, - - onCheckboxChange: function(event) { - this.setState({checked: event.target.checked}); + onCheckboxChange: function(newState) { + this.setState({checked: newState.checked}); }, handleCreateButtonClick: function() { @@ -770,14 +770,15 @@ return ( React.createElement("div", {className: "new-room-view"}, React.createElement("div", {className: contextClasses}, - React.createElement("label", {className: "context-enabled"}, - React.createElement("input", {className: "context-checkbox", - type: "checkbox", onChange: this.onCheckboxChange}), - mozL10n.get("context_offer_label") - ), - React.createElement("img", {className: "context-preview", src: this.state.previewImage}), - React.createElement("span", {className: "context-description"}, this.state.description), - React.createElement("span", {className: "context-url"}, hostname) + React.createElement(Checkbox, {label: mozL10n.get("context_inroom_label"), + onChange: this.onCheckboxChange}), + React.createElement("div", {className: "context-content"}, + React.createElement("img", {className: "context-preview", src: this.state.previewImage}), + React.createElement("span", {className: "context-description"}, + this.state.description, + React.createElement("span", {className: "context-url"}, hostname) + ) + ) ), React.createElement("button", {className: "btn btn-info new-room-button", onClick: this.handleCreateButtonClick, @@ -1005,8 +1006,8 @@ document.body.setAttribute("platform", loop.shared.utils.getPlatform()); // Notify the window that we've finished initalization and initial layout - var evtObject = document.createEvent('Event'); - evtObject.initEvent('loopPanelInitialized', true, false); + var evtObject = document.createEvent("Event"); + evtObject.initEvent("loopPanelInitialized", true, false); window.dispatchEvent(evtObject); } @@ -1026,4 +1027,4 @@ }; })(_, document.mozL10n); -document.addEventListener('DOMContentLoaded', loop.panel.init); +document.addEventListener("DOMContentLoaded", loop.panel.init); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/panel.jsx firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/panel.jsx --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/loop/content/js/panel.jsx 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/loop/content/js/panel.jsx 2015-05-25 20:42:46.000000000 +0000 @@ -1,12 +1,7 @@ -/** @jsx React.DOM */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*jshint newcap:false*/ -/*global loop:true, React */ - var loop = loop || {}; loop.panel = (function(_, mozL10n) { "use strict"; @@ -18,6 +13,7 @@ var sharedUtils = loop.shared.utils; var Button = sharedViews.Button; var ButtonGroup = sharedViews.ButtonGroup; + var Checkbox = sharedViews.Checkbox; var ContactsList = loop.contacts.ContactsList; var ContactDetailsForm = loop.contacts.ContactDetailsForm; @@ -132,11 +128,11 @@ return function(event) { // Note: side effect! switch (newAvailabilty) { - case 'available': + case "available": this.setState({doNotDisturb: false}); navigator.mozLoop.doNotDisturb = false; break; - case 'do-not-disturb': + case "do-not-disturb": this.setState({doNotDisturb: true}); navigator.mozLoop.doNotDisturb = true; break; @@ -149,13 +145,13 @@ // XXX https://github.com/facebook/react/issues/310 for === htmlFor var cx = React.addons.classSet; var availabilityStatus = cx({ - 'status': true, - 'status-dnd': this.state.doNotDisturb, - 'status-available': !this.state.doNotDisturb + "status": true, + "status-dnd": this.state.doNotDisturb, + "status-available": !this.state.doNotDisturb }); var availabilityDropdown = cx({ - 'dropdown-menu': true, - 'hide': !this.state.showMenu + "dropdown-menu": true, + "hide": !this.state.showMenu }); var availabilityText = this.state.doNotDisturb ? mozL10n.get("display_name_dnd_status") : @@ -293,7 +289,7 @@ } var locale = mozL10n.getLanguage(); - navigator.mozLoop.setLoopPref('showPartnerLogo', false); + navigator.mozLoop.setLoopPref("showPartnerLogo", false); return (

{mozL10n.get("powered_by_beforeLogo")} @@ -305,8 +301,8 @@ render: function() { if (!this.state.gettingStartedSeen || this.state.seenToS == "unseen") { - var terms_of_use_url = navigator.mozLoop.getLoopPref('legal.ToS_url'); - var privacy_notice_url = navigator.mozLoop.getLoopPref('legal.privacy_url'); + var terms_of_use_url = navigator.mozLoop.getLoopPref("legal.ToS_url"); + var privacy_notice_url = navigator.mozLoop.getLoopPref("legal.privacy_url"); var tosHTML = mozL10n.get("legal_text_and_links3", { "clientShortname": mozL10n.get("clientShortname2"), "terms_of_use": React.renderToStaticMarkup( @@ -704,7 +700,10 @@ userDisplayName: React.PropTypes.string.isRequired }, - mixins: [sharedMixins.DocumentVisibilityMixin], + mixins: [ + sharedMixins.DocumentVisibilityMixin, + React.addons.PureRenderMixin + ], getInitialState: function() { return { @@ -716,24 +715,25 @@ }, onDocumentVisible: function() { + // We would use onDocumentHidden to null out the data ready for the next + // opening. However, this seems to cause an awkward glitch in the display + // when opening the panel, and it seems cleaner just to update the data + // even if there's a small delay. + this.props.mozLoop.getSelectedTabMetadata(function callback(metadata) { - var previewImage = metadata.previews.length ? metadata.previews[0] : ""; - var description = metadata.description || metadata.title; + var previewImage = metadata.favicon || ""; + var description = metadata.title || metadata.description; var url = metadata.url; - this.setState({previewImage: previewImage, - description: description, - url: url}); + this.setState({ + previewImage: previewImage, + description: description, + url: url + }); }.bind(this)); }, - onDocumentHidden: function() { - this.setState({previewImage: "", - description: "", - url: ""}); - }, - - onCheckboxChange: function(event) { - this.setState({checked: event.target.checked}); + onCheckboxChange: function(newState) { + this.setState({checked: newState.checked}); }, handleCreateButtonClick: function() { @@ -770,14 +770,15 @@ return (

- - - {this.state.description} - {hostname} + +
+ + + {this.state.description} + {hostname} + +
\n
\n

" + + "

\n"; + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data}); + if (stack1 != null) { buffer += stack1; } + buffer += "

\n
\n \n\n
\n

" + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper))) + "

\n"; - stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data}); + stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data}); if (stack1 != null) { buffer += stack1; } return buffer + "

" + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper))) - + " " + + "\" target=\"_blank\">" + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper))) + ".

\n
"; },"useData":true}); diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/panels/tmpl/signup_shell.handlebars firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/panels/tmpl/signup_shell.handlebars --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/panels/tmpl/signup_shell.handlebars 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/panels/tmpl/signup_shell.handlebars 2015-05-25 20:42:48.000000000 +0000 @@ -1,16 +1,20 @@

{{tagline}}

-

{{learnmore}}

+ {{#if showlearnmore}} +

{{learnmore}}

+ {{else}} +

{{learnmore}}

+ {{/if}}

{{signuptosave}}

{{#if fxasignedin}} -

+

{{else}} -

-

+

+

{{/if}} -

{{alreadyhaveacct}} {{loginnow}}.

+

{{alreadyhaveacct}} {{loginnow}}.

\ No newline at end of file diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars 2015-05-25 20:42:48.000000000 +0000 @@ -9,7 +9,11 @@

{{taglinestory_two}}

-

{{learnmore}}

+ {{#if showlearnmore}} +

{{learnmore}}

+ {{else}} +

{{learnmore}}

+ {{/if}}
@@ -17,10 +21,10 @@

{{signuptosave}}

{{#if fxasignedin}} -

+

{{else}} -

-

+

+

{{/if}} -

{{alreadyhaveacct}} {{loginnow}}.

+

{{alreadyhaveacct}} {{loginnow}}.

\ No newline at end of file diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/pktApi.js firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/pktApi.js --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/pktApi.js 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/pktApi.js 2015-05-25 20:42:48.000000000 +0000 @@ -49,11 +49,8 @@ */ // Base url for all api calls - // TODO: This is a dev server and will be changed before launch - var pocketAPIhost = Services.prefs.getCharPref("browser.pocket.api"); - var pocketSiteHost = Services.prefs.getCharPref("browser.pocket.site"); - - // Base url for all api calls + var pocketAPIhost = Services.prefs.getCharPref("browser.pocket.api"); // api.getpocket.com + var pocketSiteHost = Services.prefs.getCharPref("browser.pocket.site"); // getpocket.com var baseAPIUrl = "https://" + pocketAPIhost + "/v3"; @@ -86,6 +83,23 @@ return out; } + var parseJSON = function(jsonString){ + try { + var o = JSON.parse(jsonString); + + // Handle non-exception-throwing cases: + // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking, + // but... JSON.parse(null) returns 'null', and typeof null === "object", + // so we must check for that, too. + if (o && typeof o === "object" && o !== null) { + return o; + } + } + catch (e) { } + + return undefined; + }; + /** * Settings */ @@ -174,6 +188,29 @@ } /** + * Get the current premium status of the user + * @return {number | undefined} Premium status of user + */ + function getPremiumStatus() { + var premiumStatus = getSetting("premium_status"); + if (typeof premiumStatus === "undefined") { + // Premium status is not in settings try get it from cookie + var pocketCookies = getCookiesFromPocket(); + premiumStatus = pocketCookies['ps']; + } + return premiumStatus; + } + + /** + * Helper method to check if a user is premium or not + * @return {Boolean} Boolean if user is premium or not + */ + function isPremiumUser() { + return getPremiumStatus() == 1; + } + + + /** * Returns users logged in status * @return {Boolean} Users logged in status */ @@ -210,7 +247,9 @@ var url = baseAPIUrl + options.path; var data = options.data || {}; - data.locale_lang = window.navigator.language; + data.locale_lang = Cc["@mozilla.org/chrome/chrome-registry;1"]. + getService(Ci.nsIXULChromeRegistry). + getSelectedLocale("browser"); data.consumer_key = oAuthConsumerKey; var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest); @@ -218,11 +257,16 @@ request.onreadystatechange = function(e){ if (request.readyState == 4) { if (request.status === 200) { - if (options.success) { - options.success(JSON.parse(request.response), request); + // There could still be an error if the response is no valid json + // or does not have status = 1 + var response = parseJSON(request.response); + if (options.success && response && response.status == 1) { + options.success(response, request); + return; } - return; } + + // Handle error case if (options.error) { // In case the user did revoke the access token or it's not // valid anymore clear the user data @@ -231,7 +275,11 @@ } // Handle error message - var errorMessage = request.getResponseHeader("X-Error") || request.statusText; + var errorMessage; + if (request.status !== 200) { + errorMessage = request.getResponseHeader("X-Error") || request.statusText; + errorMessage = JSON.parse('"' + errorMessage + '"'); + } var error = {message: errorMessage}; options.error(error, request); } @@ -510,13 +558,6 @@ } /** - * Helper method to check if a user is premium or not - */ - function isPremiumUser() { - return getSetting('premium_status') == 1; - } - - /** * Fetch suggested tags for a given item id * @param {string} itemId Item id of * @param {Object | undefined} options Can provide an actionInfo object @@ -563,20 +604,21 @@ * Helper function to get current signup AB group the user is in */ function getSignupAB() { - if (!getSetting('signupAB')) + var setting = getSetting('signupAB'); + if (!setting || setting.contains('hero')) { - var rand = (Math.floor(Math.random()*2+1)); - if (rand == 2) + var rand = (Math.floor(Math.random()*100+1)); + if (rand > 90) { - setSetting('signupAB','storyboard'); + setting = 'storyboard_nlm'; } else { - setSetting('signupAB','hero'); + setting = 'storyboard_lm'; } - + setSetting('signupAB',setting); } - return getSetting('signupAB'); + return setting; } /** diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/Pocket.jsm firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/Pocket.jsm --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/pocket/Pocket.jsm 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/pocket/Pocket.jsm 2015-05-25 20:42:48.000000000 +0000 @@ -17,7 +17,7 @@ let Pocket = { get site() Services.prefs.getCharPref("browser.pocket.site"), - get listURL() { return "https://" + Pocket.site; }, + get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; }, /** * Functions related to the Pocket panel UI. @@ -25,16 +25,23 @@ onPanelViewShowing(event) { let document = event.target.ownerDocument; let window = document.defaultView; - let iframe = document.getElementById('pocket-panel-iframe'); + let iframe = window.pktUI.getPanelFrame(); + let urlToSave = Pocket._urlToSave; + let titleToSave = Pocket._titleToSave; + Pocket._urlToSave = null; + Pocket._titleToSave = null; // ViewShowing fires immediately before it creates the contents, // in lieu of an AfterViewShowing event, just spin the event loop. window.setTimeout(function() { - window.pktUI.pocketButtonOnCommand(); + if (urlToSave) { + window.pktUI.tryToSaveUrl(urlToSave, titleToSave); + } else { + window.pktUI.pocketButtonOnCommand(); + } if (iframe.contentDocument && - iframe.contentDocument.readyState == "complete") - { + iframe.contentDocument.readyState == "complete") { window.pktUI.pocketPanelDidShow(); } else { // iframe didn't load yet. This seems to always be the case when in @@ -48,9 +55,9 @@ onFrameLoaded(event) { let document = event.currentTarget.ownerDocument; let window = document.defaultView; - let iframe = document.getElementById('pocket-panel-iframe'); + let iframe = window.pktUI.getPanelFrame(); - iframe.removeEventListener("load", Pocket.onPanelLoaded, true); + iframe.removeEventListener("load", Pocket.onFrameLoaded, true); window.pktUI.pocketPanelDidShow(); }, @@ -59,27 +66,25 @@ window.pktUI.pocketPanelDidHide(event); }, - // Called on tab/urlbar/location changes and after customization. Update - // anything that is tab specific. - onLocationChange(browser, locationURI) { - if (!locationURI) { + _urlToSave: null, + _titleToSave: null, + savePage(browser, url, title) { + let document = browser.ownerDocument; + let pocketWidget = document.getElementById("pocket-button"); + let placement = CustomizableUI.getPlacementOfWidget("pocket-button"); + if (!placement) return; - } - let widget = CustomizableUI.getWidget("pocket-button"); - for (let instance of widget.instances) { - let node = instance.node; - if (!node || - node.ownerDocument != browser.ownerDocument) { - continue; - } - if (node) { - let win = browser.ownerDocument.defaultView; - node.disabled = win.pktApi.isUserLoggedIn() && - !locationURI.schemeIs("http") && - !locationURI.schemeIs("https") && - !(locationURI.schemeIs("about") && - locationURI.spec.toLowerCase().startsWith("about:reader?url=")); - } + + this._urlToSave = url; + this._titleToSave = title; + if (placement.area == CustomizableUI.AREA_PANEL) { + let win = document.defaultView; + win.PanelUI.show().then(function() { + pocketWidget = document.getElementById("pocket-button"); + pocketWidget.doCommand(); + }); + } else { + pocketWidget.doCommand(); } }, }; diff -Nru firefox-trunk-41.0~a1~hg20150513r243603/browser/components/preferences/aboutPermissions.xul firefox-trunk-41.0~a1~hg20150524r245419/browser/components/preferences/aboutPermissions.xul --- firefox-trunk-41.0~a1~hg20150513r243603/browser/components/preferences/aboutPermissions.xul 2015-05-13 18:05:59.000000000 +0000 +++ firefox-trunk-41.0~a1~hg20150524r245419/browser/components/preferences/aboutPermissions.xul 2015-05-25 20:42:48.000000000 +0000 @@ -38,7 +38,7 @@ onselect="AboutPermissions.onSitesListSelect(event);"> + value="&sites.allSites;"/> @@ -63,217 +63,220 @@ - - - - -