From a78e9d35e92d99a95f9b199462771d9432047b1b Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Tue, 14 Jun 2011 16:14:56 +0200 Subject: [PATCH 01/24] Bug 662261 - Fix open dialog on MacOS X when mSelectedTypeIndex is out-of-range. r=joshmoz This is done in two steps: 1. Remove "filepicker.lastTypeIndex" preference which was actually the cause of the described bug. 2. Don't fail if the value is out-of-range but fallback to a default value. --- widget/src/cocoa/nsFilePicker.mm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/widget/src/cocoa/nsFilePicker.mm b/widget/src/cocoa/nsFilePicker.mm index 4132c8c48341..e8ee1dfb3f23 100644 --- a/widget/src/cocoa/nsFilePicker.mm +++ b/widget/src/cocoa/nsFilePicker.mm @@ -61,7 +61,6 @@ using namespace mozilla; const float kAccessoryViewPadding = 5; const int kSaveTypeControlTag = 1; -const char kLastTypeIndexPref[] = "filepicker.lastTypeIndex"; static PRBool gCallSecretHiddenFileAPI = PR_FALSE; const char kShowHiddenFilesPref[] = "filepicker.showHiddenFiles"; @@ -143,10 +142,6 @@ nsFilePicker::InitNative(nsIWidget *aParent, const nsAString& aTitle, { mTitle = aTitle; mMode = aMode; - - // read in initial type index from prefs - mSelectedTypeIndex = - Preferences::GetInt(kLastTypeIndexPref, mSelectedTypeIndex); } NSView* nsFilePicker::GetAccessoryView() @@ -511,8 +506,6 @@ nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultNam NSPopUpButton* popupButton = [accessoryView viewWithTag:kSaveTypeControlTag]; if (popupButton) { mSelectedTypeIndex = [popupButton indexOfSelectedItem]; - // save out to prefs for initializing other file picker instances - Preferences::SetInt(kLastTypeIndexPref, mSelectedTypeIndex); } NSURL* fileURL = [thePanel URL]; @@ -542,10 +535,15 @@ nsFilePicker::GetFilterList() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - if (mFilters.Length() <= (PRUint32)mSelectedTypeIndex) { + if (!mFilters.Length()) { return nil; } + if (mFilters.Length() <= (PRUint32)mSelectedTypeIndex) { + NS_WARNING("An out of range index has been selected. Using the first index instead."); + mSelectedTypeIndex = 0; + } + const nsString& filterWide = mFilters[mSelectedTypeIndex]; if (!filterWide.Length()) { return nil; From 92c362a46668c09ef528a655cff10d8625ccbcd7 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Tue, 14 Jun 2011 10:53:57 -0400 Subject: [PATCH 02/24] Bug 661132 - Fix test for bug 642338 so it doesn't rely on firefox.js prefs. r=smaug --- dom/tests/mochitest/bugs/test_window_bar.html | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/dom/tests/mochitest/bugs/test_window_bar.html b/dom/tests/mochitest/bugs/test_window_bar.html index 484c7eaad133..358e032988fe 100644 --- a/dom/tests/mochitest/bugs/test_window_bar.html +++ b/dom/tests/mochitest/bugs/test_window_bar.html @@ -34,19 +34,33 @@ var numWindows = 0; /* Called when our popup loads. */ function testWindow(w) { - // w.location.search == '?true' if we expect the bars to be on, and - // '?false' otherwise. - var e = w.location.search == '?true'; - - is(w.menubar.visible, e, "menubar"); - is(w.toolbar.visible, e, "toolbar"); - is(w.personalbar.visible, e, "personalbar"); - is(w.scrollbars.visible, e, "scrollbars"); + // If dom.disable_window_open_feature.X is true, then we can't disable + // feature X when we call window.open from content. So to check that our popup + // has the right bars shown, we need to check that it obeys first the pref + // and then the arguments to window.open, if applicable. - // You can't turn these off even if you try, so check that they're true. - is(w.locationbar.visible, true, "locationbar"); - is(w.statusbar.visible, true, "statusbar"); + function checkFeature(feature, prefname) { + if (prefname === undefined) + prefname = feature; + + if (SpecialPowers.getBoolPref('dom.disable_window_open_feature.' + prefname)) { + is(w[feature].visible, true, feature + ' should always be true.'); + } + else { + // w.location.search == '?true' if we expect the bars to be on, and + // '?false' otherwise. + var enabled = w.location.search == '?true'; + is(w[feature].visible, enabled, feature + ' should follow window.open settings.'); + } + } + + checkFeature('menubar'); + checkFeature('toolbar'); + checkFeature('personalbar'); + checkFeature('scrollbars'); + checkFeature('statusbar', 'status'); + checkFeature('locationbar', 'location'); w.close(); From 216145aab8fe23cc9d2aee4741ce1b8e4627fbb2 Mon Sep 17 00:00:00 2001 From: Jason Duell Date: Tue, 14 Jun 2011 09:12:03 -0700 Subject: [PATCH 03/24] Bug 664163. Fix implementation of Implement Get(Local|Remote)(Address|Port) in HttpChannelChild. r=jdm --- netwerk/protocol/http/HttpChannelChild.cpp | 35 ++------------------- netwerk/protocol/http/HttpChannelChild.h | 4 --- netwerk/test/unit/test_traceable_channel.js | 6 ++-- 3 files changed, 5 insertions(+), 40 deletions(-) diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 43a599b25b05..784f503f9abe 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -260,6 +260,8 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead, mCacheEntryAvailable = cacheEntryAvailable; mCacheExpirationTime = cacheExpirationTime; mCachedCharset = cachedCharset; + mSelfAddr = selfAddr; + mPeerAddr = peerAddr; AutoEventEnqueuer ensureSerialDispatch(mEventQ); @@ -286,9 +288,6 @@ HttpChannelChild::OnStartRequest(const nsHttpResponseHead& responseHead, rv = ApplyContentConversions(); if (NS_FAILED(rv)) Cancel(rv); - - mSelfAddr = selfAddr; - mPeerAddr = peerAddr; } class TransportAndDataEvent : public ChannelEvent @@ -1085,36 +1084,6 @@ HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey) DROP_DEAD(); } -// The next four _should_ be implemented, but we need to figure out how -// to transfer the data from the chrome process first. - -NS_IMETHODIMP -HttpChannelChild::GetRemoteAddress(nsACString & _result) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -HttpChannelChild::GetRemotePort(PRInt32 * _result) -{ - NS_ENSURE_ARG_POINTER(_result); - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -HttpChannelChild::GetLocalAddress(nsACString & _result) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -HttpChannelChild::GetLocalPort(PRInt32 * _result) -{ - NS_ENSURE_ARG_POINTER(_result); - return NS_ERROR_NOT_AVAILABLE; -} - - //----------------------------------------------------------------------------- // HttpChannelChild::nsICacheInfoChannel //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index e5937aa5c797..800416313210 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -106,10 +106,6 @@ public: PRBool aMerge); // nsIHttpChannelInternal NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey); - NS_IMETHOD GetLocalAddress(nsACString& addr); - NS_IMETHOD GetLocalPort(PRInt32* port); - NS_IMETHOD GetRemoteAddress(nsACString& addr); - NS_IMETHOD GetRemotePort(PRInt32* port); // nsISupportsPriority NS_IMETHOD SetPriority(PRInt32 value); // nsIResumableChannel diff --git a/netwerk/test/unit/test_traceable_channel.js b/netwerk/test/unit/test_traceable_channel.js index a62b8a2c92b3..0e614aa7b340 100644 --- a/netwerk/test/unit/test_traceable_channel.js +++ b/netwerk/test/unit/test_traceable_channel.js @@ -22,14 +22,14 @@ TracingListener.prototype = { request.QueryInterface(Components.interfaces.nsIHttpChannelInternal); -// local/remote addresses broken in e10s: disable for now -/* do_check_eq(request.localAddress, "127.0.0.1"); do_check_eq(request.localPort > 0, true); do_check_neq(request.localPort, 4444); do_check_eq(request.remoteAddress, "127.0.0.1"); do_check_eq(request.remotePort, 4444); -*/ + + request.QueryInterface(Components.interfaces.nsISupportsPriority); + request.priority = Ci.nsISupportsPriority.PRIORITY_LOW; // Make sure listener can't be replaced after OnStartRequest was called. request.QueryInterface(Components.interfaces.nsITraceableChannel); From dc300876aa68c1c0c57be56af885b6f05083bb79 Mon Sep 17 00:00:00 2001 From: Benjamin Stover Date: Mon, 11 Apr 2011 17:27:00 -0700 Subject: [PATCH 04/24] Bug 647192 IPC view rendering bug using positioned elements and overflow:scroll r=cjones --- layout/reftests/reftest-sanity/647192-1-ref.html | 12 ++++++++++++ layout/reftests/reftest-sanity/647192-1.html | 16 ++++++++++++++++ layout/reftests/reftest-sanity/reftest.list | 1 + 3 files changed, 29 insertions(+) create mode 100644 layout/reftests/reftest-sanity/647192-1-ref.html create mode 100644 layout/reftests/reftest-sanity/647192-1.html diff --git a/layout/reftests/reftest-sanity/647192-1-ref.html b/layout/reftests/reftest-sanity/647192-1-ref.html new file mode 100644 index 000000000000..d1a673c62dcd --- /dev/null +++ b/layout/reftests/reftest-sanity/647192-1-ref.html @@ -0,0 +1,12 @@ + + + + +You should see no red, only green
+
+ + diff --git a/layout/reftests/reftest-sanity/647192-1.html b/layout/reftests/reftest-sanity/647192-1.html new file mode 100644 index 000000000000..365f7652fe88 --- /dev/null +++ b/layout/reftests/reftest-sanity/647192-1.html @@ -0,0 +1,16 @@ + + + + +You should see no red, only green
+
+
+
+
+
+
+ diff --git a/layout/reftests/reftest-sanity/reftest.list b/layout/reftests/reftest-sanity/reftest.list index d99610fc8de5..9c62a5a30569 100644 --- a/layout/reftests/reftest-sanity/reftest.list +++ b/layout/reftests/reftest-sanity/reftest.list @@ -89,6 +89,7 @@ needs-focus == data:text/plain, about:blank # Sanity check of viewport+displayport overrides fails-if(!browserIsRemote) == test-displayport.html test-displayport-ref.html # bug 593168 skip-if(!browserIsRemote) != test-displayport-2.html test-displayport-ref.html # bug 593168 +skip-if(!browserIsRemote) == 647192-1.html 647192-1-ref.html # IPC Position-fixed frames/layers test # Fixed layers are temporarily disabled (bug 656167). From 68d2f40014022f6a995f01272f5b4be8acbd5dc8 Mon Sep 17 00:00:00 2001 From: Benjamin Stover Date: Tue, 14 Jun 2011 09:20:29 -0700 Subject: [PATCH 05/24] Bug 656041 Some parts of page scroll at different rates in Fennec r=roc --- layout/generic/nsGfxScrollFrame.cpp | 2 +- .../reftests/reftest-sanity/656041-1-ref.html | 33 +++++++++++++++++++ layout/reftests/reftest-sanity/656041-1.html | 33 +++++++++++++++++++ layout/reftests/reftest-sanity/reftest.list | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/reftest-sanity/656041-1-ref.html create mode 100644 layout/reftests/reftest-sanity/656041-1.html diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 78c03853a1dd..26b0ed61e3d5 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2026,7 +2026,7 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder, // metadata about this scroll box to the compositor process. nsDisplayScrollInfoLayer* layerItem = new (aBuilder) nsDisplayScrollInfoLayer( aBuilder, mScrolledFrame, mOuter); - set.Content()->AppendNewToBottom(layerItem); + set.BorderBackground()->AppendNewToBottom(layerItem); } nsRect clip; diff --git a/layout/reftests/reftest-sanity/656041-1-ref.html b/layout/reftests/reftest-sanity/656041-1-ref.html new file mode 100644 index 000000000000..a92943594f24 --- /dev/null +++ b/layout/reftests/reftest-sanity/656041-1-ref.html @@ -0,0 +1,33 @@ + + + + + + Reftest + + + +
    +
  • + +
  • +
+ + diff --git a/layout/reftests/reftest-sanity/656041-1.html b/layout/reftests/reftest-sanity/656041-1.html new file mode 100644 index 000000000000..d888fbe4006c --- /dev/null +++ b/layout/reftests/reftest-sanity/656041-1.html @@ -0,0 +1,33 @@ + + + + + + Reftest + + + +
    +
  • + +
  • +
+ + diff --git a/layout/reftests/reftest-sanity/reftest.list b/layout/reftests/reftest-sanity/reftest.list index 9c62a5a30569..c438657985e3 100644 --- a/layout/reftests/reftest-sanity/reftest.list +++ b/layout/reftests/reftest-sanity/reftest.list @@ -90,6 +90,7 @@ needs-focus == data:text/plain, about:blank fails-if(!browserIsRemote) == test-displayport.html test-displayport-ref.html # bug 593168 skip-if(!browserIsRemote) != test-displayport-2.html test-displayport-ref.html # bug 593168 skip-if(!browserIsRemote) == 647192-1.html 647192-1-ref.html +skip-if(!browserIsRemote) == 656041-1.html 656041-1-ref.html # IPC Position-fixed frames/layers test # Fixed layers are temporarily disabled (bug 656167). From 857b726b395e2444dfacfc3e5f418054a59f437c Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Tue, 14 Jun 2011 17:01:21 -0400 Subject: [PATCH 06/24] Bug 573583 - Enable decode-on-draw; r=jrmuizel --- modules/libpref/src/init/all.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index d482a1f43e85..2bbf2d11551b 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -3151,9 +3151,9 @@ pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5"); // compressed data. pref("image.mem.discardable", true); -// Prevents images from automatically being decoded on load, instead allowing -// them to be decoded on demand when they are drawn. -pref("image.mem.decodeondraw", false); +// Prevents images from automatically being decoded when loaded in background +// tabs, instead allowing them to be decoded on demand when they are drawn. +pref("image.mem.decodeondraw", true); // Minimum timeout for image discarding (in milliseconds). The actual time in // which an image must inactive for it to be discarded will vary between this From 71b62855ac3ca0961999b0cfb85d84baf52b4dfa Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Tue, 14 Jun 2011 14:43:36 -0700 Subject: [PATCH 07/24] Bug 664285 - Fallback to default locale if we can't find a matching one. r=mfinkle --- mobile/chrome/content/localePicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/chrome/content/localePicker.js b/mobile/chrome/content/localePicker.js index d69f2ec012ed..c10cdeabe296 100644 --- a/mobile/chrome/content/localePicker.js +++ b/mobile/chrome/content/localePicker.js @@ -346,7 +346,7 @@ function start() { } } - if (matchingLocale != chrome.getSelectedLocale("browser")) + if (matchingLocale && matchingLocale != chrome.getSelectedLocale("browser")) LocaleUI.language = matchingLocale; else { LocaleUI._language = chrome.getSelectedLocale("browser"); From e9899ab3ece7d7e59a5df463f74998196dfa8ebc Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Tue, 14 Jun 2011 14:43:38 -0700 Subject: [PATCH 08/24] Bug 649983 - Make sync dialog fit size on Gingerbread. r=mfinkle --- mobile/themes/core/gingerbread/browser.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/themes/core/gingerbread/browser.css b/mobile/themes/core/gingerbread/browser.css index e76aacaec3f7..732c96d46bd8 100644 --- a/mobile/themes/core/gingerbread/browser.css +++ b/mobile/themes/core/gingerbread/browser.css @@ -1438,6 +1438,10 @@ setting { -moz-margin-start: @margin_xnormal@; } +#sync-message { + padding-bottom: 2em; +} + /* content scrollbars */ .scroller { opacity: 0; From 5438f68677ff9eb1898e887bddd236cf34cbe693 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 15 Jun 2011 09:16:57 +0900 Subject: [PATCH 09/24] Bug 650732 - Move interval change notifications into the timed element, r=dholbert --- content/smil/nsSMILInstanceTime.cpp | 9 +++-- content/smil/nsSMILInterval.cpp | 34 +++++------------- content/smil/nsSMILInterval.h | 21 ++--------- content/smil/nsSMILTimedElement.cpp | 56 ++++++++++++++++++++--------- content/smil/nsSMILTimedElement.h | 15 ++++++-- 5 files changed, 71 insertions(+), 64 deletions(-) diff --git a/content/smil/nsSMILInstanceTime.cpp b/content/smil/nsSMILInstanceTime.cpp index d108bf53acd7..c9f870b9438a 100644 --- a/content/smil/nsSMILInstanceTime.cpp +++ b/content/smil/nsSMILInstanceTime.cpp @@ -128,8 +128,13 @@ nsSMILInstanceTime::HandleChangedInterval( PRBool aBeginObjectChanged, PRBool aEndObjectChanged) { - NS_ABORT_IF_FALSE(mBaseInterval, - "Got call to HandleChangedInterval on an independent instance time."); + // It's possible a sequence of notifications might cause our base interval to + // be updated and then deleted. Furthermore, the delete might happen whilst + // we're still in the queue to be notified of the change. In any case, if we + // don't have a base interval, just ignore the change. + if (!mBaseInterval) + return; + NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not."); if (mVisited) { diff --git a/content/smil/nsSMILInterval.cpp b/content/smil/nsSMILInterval.cpp index a07c45c98fb2..8a2c7b104482 100644 --- a/content/smil/nsSMILInterval.cpp +++ b/content/smil/nsSMILInterval.cpp @@ -40,9 +40,7 @@ nsSMILInterval::nsSMILInterval() : mBeginFixed(PR_FALSE), - mEndFixed(PR_FALSE), - mBeginObjectChanged(PR_FALSE), - mEndObjectChanged(PR_FALSE) + mEndFixed(PR_FALSE) { } @@ -51,9 +49,7 @@ nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther) mBegin(aOther.mBegin), mEnd(aOther.mEnd), mBeginFixed(PR_FALSE), - mEndFixed(PR_FALSE), - mBeginObjectChanged(PR_FALSE), - mEndObjectChanged(PR_FALSE) + mEndFixed(PR_FALSE) { NS_ABORT_IF_FALSE(aOther.mDependentTimes.IsEmpty(), "Attempting to copy-construct an interval with dependent times, " @@ -74,18 +70,6 @@ nsSMILInterval::~nsSMILInterval() "Unlink was not called"); } -void -nsSMILInterval::NotifyChanged(const nsSMILTimeContainer* aContainer) -{ - for (PRInt32 i = mDependentTimes.Length() - 1; i >= 0; --i) { - mDependentTimes[i]->HandleChangedInterval(aContainer, - mBeginObjectChanged, - mEndObjectChanged); - } - mBeginObjectChanged = PR_FALSE; - mEndObjectChanged = PR_FALSE; -} - void nsSMILInterval::Unlink(PRBool aFiltered) { @@ -131,11 +115,7 @@ nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin) NS_ABORT_IF_FALSE(!mBeginFixed, "Attempting to set begin time but the begin point is fixed"); - if (mBegin == &aBegin) - return; - mBegin = &aBegin; - mBeginObjectChanged = PR_TRUE; } void @@ -144,11 +124,7 @@ nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd) NS_ABORT_IF_FALSE(!mEndFixed, "Attempting to set end time but the end point is fixed"); - if (mEnd == &aEnd) - return; - mEnd = &aEnd; - mEndObjectChanged = PR_TRUE; } void @@ -193,6 +169,12 @@ nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete."); } +void +nsSMILInterval::GetDependentTimes(InstanceTimeList& aTimes) +{ + aTimes = mDependentTimes; +} + PRBool nsSMILInterval::IsDependencyChainLink() const { diff --git a/content/smil/nsSMILInterval.h b/content/smil/nsSMILInterval.h index 83a99519d36a..997ca63a4814 100644 --- a/content/smil/nsSMILInterval.h +++ b/content/smil/nsSMILInterval.h @@ -56,7 +56,6 @@ public: nsSMILInterval(); nsSMILInterval(const nsSMILInterval& aOther); ~nsSMILInterval(); - void NotifyChanged(const nsSMILTimeContainer* aContainer); void Unlink(PRBool aFiltered = PR_FALSE); const nsSMILInstanceTime* Begin() const @@ -86,8 +85,11 @@ public: void FixBegin(); void FixEnd(); + typedef nsTArray > InstanceTimeList; + void AddDependentTime(nsSMILInstanceTime& aTime); void RemoveDependentTime(const nsSMILInstanceTime& aTime); + void GetDependentTimes(InstanceTimeList& aTimes); // Cue for assessing if this interval can be filtered PRBool IsDependencyChainLink() const; @@ -96,8 +98,6 @@ private: nsRefPtr mBegin; nsRefPtr mEnd; - typedef nsTArray > InstanceTimeList; - // nsSMILInstanceTimes to notify when this interval is changed or deleted. InstanceTimeList mDependentTimes; @@ -112,21 +112,6 @@ private: // OBJECT returned for that end point and its TIME value will not change. PRPackedBool mBeginFixed; PRPackedBool mEndFixed; - - // When change notifications are passed around the timing model we try to - // filter out all changes where there is no observable difference to an - // instance time. Changes that may produce an observable difference are: - // - // * Changes to the time of an interval endpoint - // * Changes in the relative times of different time containers - // * Changes to the dependency chain (which may affect the animation sandwich) - // - // The nsSMILTimeValueSpec can detect the first two changes by recalculating - // the time but in order to help detect the third change we simply set a flag - // whenever the mBegin or mEnd pointers are changed. These flags are reset - // when the next change notification is sent. - PRPackedBool mBeginObjectChanged; - PRPackedBool mEndObjectChanged; }; #endif // NS_SMILINTERVAL_H_ diff --git a/content/smil/nsSMILTimedElement.cpp b/content/smil/nsSMILTimedElement.cpp index 40ae1748ff2f..c8cb3921281c 100644 --- a/content/smil/nsSMILTimedElement.cpp +++ b/content/smil/nsSMILTimedElement.cpp @@ -551,7 +551,10 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, PRBool aEndOnly) case STATE_ACTIVE: { - ApplyEarlyEnd(sampleTime); + // Ending early will change the interval but we don't notify dependents + // of the change until we have closed off the current interval (since we + // don't want dependencies to un-end our early end). + PRBool didApplyEarlyEnd = ApplyEarlyEnd(sampleTime); if (mCurrentInterval->End()->Time() <= sampleTime) { nsSMILInterval newInterval; @@ -567,15 +570,23 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, PRBool aEndOnly) } mCurrentRepeatIteration = 0; mOldIntervals.AppendElement(mCurrentInterval.forget()); - // We must update mOldIntervals before calling SampleFillValue SampleFillValue(); if (mElementState == STATE_WAITING) { mCurrentInterval = new nsSMILInterval(newInterval); + } + // We are now in a consistent state to dispatch notifications + if (didApplyEarlyEnd) { + NotifyChangedInterval( + mOldIntervals[mOldIntervals.Length() - 1], PR_FALSE, PR_TRUE); + } + if (mElementState == STATE_WAITING) { NotifyNewInterval(); } FilterHistory(); stateChanged = PR_TRUE; } else { + NS_ABORT_IF_FALSE(!didApplyEarlyEnd, + "We got an early end, but didn't end"); nsSMILTime beginTime = mCurrentInterval->Begin()->Time().GetMillis(); NS_ASSERTION(aContainerTime >= beginTime, "Sample time should not precede current interval"); @@ -626,7 +637,7 @@ nsSMILTimedElement::HandleContainerTimeChange() // the nsSMILTimeValueSpec we'll check if anything has changed and if not, we // won't go any further. if (mElementState == STATE_WAITING || mElementState == STATE_ACTIVE) { - NotifyChangedInterval(); + NotifyChangedInterval(mCurrentInterval, PR_FALSE, PR_FALSE); } } @@ -1237,13 +1248,15 @@ nsSMILTimedElement::ClearIntervalProgress() mOldIntervals.Clear(); } -void +PRBool nsSMILTimedElement::ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime) { // This should only be called within DoSampleAt as a helper function NS_ABORT_IF_FALSE(mElementState == STATE_ACTIVE, "Unexpected state to try to apply an early end"); + PRBool updated = PR_FALSE; + // Only apply an early end if we're not already ending. if (mCurrentInterval->End()->Time() > aSampleTime) { nsSMILInstanceTime* earlyEnd = CheckForEarlyEnd(aSampleTime); @@ -1258,9 +1271,10 @@ nsSMILTimedElement::ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime) } else { mCurrentInterval->SetEnd(*earlyEnd); } - NotifyChangedInterval(); + updated = PR_TRUE; } } + return updated; } namespace @@ -1815,22 +1829,23 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice) } else { - PRBool changed = PR_FALSE; + PRBool beginChanged = PR_FALSE; + PRBool endChanged = PR_FALSE; if (mElementState != STATE_ACTIVE && !updatedInterval.Begin()->SameTimeAndBase( *mCurrentInterval->Begin())) { mCurrentInterval->SetBegin(*updatedInterval.Begin()); - changed = PR_TRUE; + beginChanged = PR_TRUE; } if (!updatedInterval.End()->SameTimeAndBase(*mCurrentInterval->End())) { mCurrentInterval->SetEnd(*updatedInterval.End()); - changed = PR_TRUE; + endChanged = PR_TRUE; } - if (changed || aForceChangeNotice) { - NotifyChangedInterval(); + if (beginChanged || endChanged || aForceChangeNotice) { + NotifyChangedInterval(mCurrentInterval, beginChanged, endChanged); } } @@ -1844,7 +1859,7 @@ nsSMILTimedElement::UpdateCurrentInterval(PRBool aForceChangeNotice) if (!mCurrentInterval->End()->SameTimeAndBase(*mCurrentInterval->Begin())) { mCurrentInterval->SetEnd(*mCurrentInterval->Begin()); - NotifyChangedInterval(); + NotifyChangedInterval(mCurrentInterval, PR_FALSE, PR_TRUE); } // The transition to the postactive state will take place on the next // sample (along with firing end events, clearing intervals etc.) @@ -2023,18 +2038,27 @@ nsSMILTimedElement::NotifyNewInterval() } void -nsSMILTimedElement::NotifyChangedInterval() +nsSMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval, + PRBool aBeginObjectChanged, + PRBool aEndObjectChanged) { - NS_ABORT_IF_FALSE(mCurrentInterval, - "Attempting to notify dependents of a changed interval but the interval " - "is not set--perhaps we should be deleting the interval instead?"); + NS_ABORT_IF_FALSE(aInterval, "Null interval for change notification"); nsSMILTimeContainer* container = GetTimeContainer(); if (container) { container->SyncPauseTime(); } - mCurrentInterval->NotifyChanged(container); + // Copy the instance times list since notifying the instance times can result + // in a chain reaction whereby our own interval gets deleted along with its + // instance times. + InstanceTimeList times; + aInterval->GetDependentTimes(times); + + for (PRUint32 i = 0; i < times.Length(); ++i) { + times[i]->HandleChangedInterval(container, aBeginObjectChanged, + aEndObjectChanged); + } } void diff --git a/content/smil/nsSMILTimedElement.h b/content/smil/nsSMILTimedElement.h index 64d6de66d985..25774e3d3e99 100644 --- a/content/smil/nsSMILTimedElement.h +++ b/content/smil/nsSMILTimedElement.h @@ -423,8 +423,10 @@ protected: * applied at the last possible moment (i.e. if they are at * or before the current sample time) and only if the * current interval is not already ending. + * @return PR_TRUE if the end time of the current interval was updated, + * PR_FALSE otherwise. */ - void ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime); + PRBool ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime); /** * Clears certain state in response to the element restarting. @@ -504,8 +506,17 @@ protected: void RegisterMilestone(); PRBool GetNextMilestone(nsSMILMilestone& aNextMilestone) const; + // Notification methods. Note that these notifications can result in nested + // calls to this same object. Therefore, + // (i) we should not perform notification until this object is in + // a consistent state to receive callbacks, and + // (ii) after calling these methods we must assume that the state of the + // element may have changed. void NotifyNewInterval(); - void NotifyChangedInterval(); + void NotifyChangedInterval(nsSMILInterval* aInterval, + PRBool aBeginObjectChanged, + PRBool aEndObjectChanged); + void FireTimeEventAsync(PRUint32 aMsg, PRInt32 aDetail); const nsSMILInstanceTime* GetEffectiveBeginInstance() const; const nsSMILInterval* GetPreviousInterval() const; From 872b6164ba71a43ec8b0b91b6958ace7fcae6c5d Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Wed, 15 Jun 2011 00:53:03 -0400 Subject: [PATCH 10/24] Bug 662867 - redirect about: does not go to a 'The URL is not valid and cannot be loaded.' dialog [r=mbrubeck] --- mobile/chrome/content/browser.js | 19 ++++++++++++------- mobile/chrome/content/content.js | 2 +- mobile/chrome/content/exceptions.js | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 990566b9d12f..288e8781ce01 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -2734,13 +2734,18 @@ Tab.prototype = { if ("delayLoad" in aParams && aParams.delayLoad) return; - try { - let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE; - let postData = aParams.postData ? aParams.postData.value : null; - browser.loadURIWithFlags(aURI, flags, aParams.referrerURI, aParams.charset, postData); - } catch(e) { - dump("Error: " + e + "\n"); - } + // Give the browser binding a chance to attach completely before trying to + // load. Trying to load an invalid about: page from a remote browser causes + // a crash when trying to display the warning dialog. + setTimeout(function() { + try { + let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE; + let postData = aParams.postData ? aParams.postData.value : null; + browser.loadURIWithFlags(aURI, flags, aParams.referrerURI, aParams.charset, postData); + } catch(e) { + dump("Error: " + e + "\n"); + } + }, 0); }, destroy: function destroy() { diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index 3de83d204086..7b4d4c723e69 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -1021,7 +1021,7 @@ var FormSubmitObserver = { addMessageListener("Browser:TabClose", this); }, - receiveMessage: function findHandlerReceiveMessage(aMessage) { + receiveMessage: function receiveMessage(aMessage) { let json = aMessage.json; switch (aMessage.name) { case "Browser:TabOpen": diff --git a/mobile/chrome/content/exceptions.js b/mobile/chrome/content/exceptions.js index 3c7040c4e7ce..1164da899085 100644 --- a/mobile/chrome/content/exceptions.js +++ b/mobile/chrome/content/exceptions.js @@ -96,7 +96,7 @@ SSLExceptions.prototype = { var req = new XMLHttpRequest(); try { - if(aURI) { + if (aURI) { req.open("GET", aURI.prePath, false); req.channel.notificationCallbacks = this; req.send(null); From eed5ff5c25302374d2b8f66e3ab3d5e8a63806c6 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Wed, 15 Jun 2011 00:53:05 -0400 Subject: [PATCH 11/24] Bug 664114 - Context Menu doesn't resize properly when switching the window orientation [r=wjohnston] --- mobile/chrome/content/MenuListHelperUI.js | 5 +++-- mobile/chrome/content/browser.xul | 2 +- mobile/chrome/content/common-ui.js | 5 +++-- mobile/themes/core/browser.css | 8 ++++++++ mobile/themes/core/defines.inc | 2 ++ mobile/themes/core/gingerbread/browser.css | 13 +++++++++++++ mobile/themes/core/gingerbread/defines.inc | 2 ++ mobile/themes/core/gingerbread/platform.css | 8 ++++---- mobile/themes/core/platform.css | 2 +- 9 files changed, 37 insertions(+), 10 deletions(-) diff --git a/mobile/chrome/content/MenuListHelperUI.js b/mobile/chrome/content/MenuListHelperUI.js index 892660088f8f..d384c2fca84c 100644 --- a/mobile/chrome/content/MenuListHelperUI.js +++ b/mobile/chrome/content/MenuListHelperUI.js @@ -59,8 +59,8 @@ var MenuListHelperUI = { } window.addEventListener("resize", this, true); - container.hidden = false; this.sizeToContent(); + container.hidden = false; BrowserUI.pushPopup(this, [this._popup]); }, @@ -86,7 +86,8 @@ var MenuListHelperUI = { }, sizeToContent: function sizeToContent() { - this._popup.width = window.innerWidth * 0.8; + let style = document.defaultView.getComputedStyle(this._container, null); + this._popup.width = window.innerWidth - (parseInt(style.paddingLeft) + parseInt(style.paddingRight)); }, handleEvent: function handleEvent(aEvent) { diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index 8bf3d4923ba9..a784a645b36e 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -597,7 +597,7 @@ -