From 89896b0b7bad85666df3c7805fab1910493d53f3 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 14 Aug 2013 23:18:56 +0100 Subject: [PATCH 01/98] Bug 905139 - Fix alpha setter for pre-HC AnimatorProxy (r=sriram) --- mobile/android/base/animation/AnimatorProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/animation/AnimatorProxy.java b/mobile/android/base/animation/AnimatorProxy.java index 357036af49c..02ce4aa29f4 100644 --- a/mobile/android/base/animation/AnimatorProxy.java +++ b/mobile/android/base/animation/AnimatorProxy.java @@ -236,7 +236,7 @@ class AnimatorProxy { @Override public void setAlpha(float alpha) { - if (alpha == alpha) + if (mAlpha == alpha) return; mAlpha = alpha; From 14fd53082f57f308a6c9646a1d71e04a8942f885 Mon Sep 17 00:00:00 2001 From: Sam Foster Date: Wed, 14 Aug 2013 15:43:29 -0700 Subject: [PATCH 02/98] Bug 895457 - Override single-row notification layout in snapped-view. r=mbrubeck --- browser/metro/theme/platform.css | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/browser/metro/theme/platform.css b/browser/metro/theme/platform.css index 7342197d36c..3819fb428df 100644 --- a/browser/metro/theme/platform.css +++ b/browser/metro/theme/platform.css @@ -498,6 +498,55 @@ notification { -moz-box-flex: 9999; } +/* ensure the notification children pick up snapped-view box property overrides */ +.notification-button.box-inherit { + -moz-margin-start: inherit; + -moz-margin-end: inherit; + width: inherit; + display: inherit; + overflow: inherit; +} + +@media (max-width: 330px) { + /* notifications need layout tweaks in narrow viewport + */ + .notification-button { + display: block; + width: calc(100% - 40px); + overflow: visible; + -moz-margin-start: 40px; + -moz-margin-end: 0; + } + + .notification-inner { + display: block; + padding: @metro_spacing_xnormal@; + } + .notification-inner > [anonid="details"] { + display: inline-block; + width: calc(100% - 48px); + } + + .notification-inner > .messageCloseButton { + display: inline-block; + vertical-align: top; + -moz-margin-start: 8px; + -moz-margin-end: 0; + } + .notification-inner > [anonid="details"] > .messageImage { + display: inline; + vertical-align: top; + -moz-margin-start: 0; + -moz-margin-end: 8px; + } + .notification-inner > [anonid="details"] > .messageText { + display: inline-block; + width: calc(100% - 40px); + overflow: visible; + } + +} + /* Prompts ----------------------------------------------------------------- */ .mainContainer { From 473c0c85bf79fe249d2fbad9d5995c5f0cafe93b Mon Sep 17 00:00:00 2001 From: Sam Foster Date: Wed, 14 Aug 2013 15:54:18 -0700 Subject: [PATCH 03/98] Bug 903653 - Raise ColorAnalyzers MAXIMUM_PIXELS to 144x144. r=ttaubert --- toolkit/components/places/ColorAnalyzer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/places/ColorAnalyzer.js b/toolkit/components/places/ColorAnalyzer.js index 86d8f36d1d7..861ce710751 100644 --- a/toolkit/components/places/ColorAnalyzer.js +++ b/toolkit/components/places/ColorAnalyzer.js @@ -11,7 +11,7 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); const XHTML_NS = "http://www.w3.org/1999/xhtml"; -const MAXIMUM_PIXELS = Math.pow(128, 2); +const MAXIMUM_PIXELS = Math.pow(144, 2); function ColorAnalyzer() { // a queue of callbacks for each job we give to the worker From df75d1bef2c9d7709beea493138cfc3833606ba2 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 14 Aug 2013 17:47:16 -0700 Subject: [PATCH 04/98] Backed out changeset 88e21b727815 (bug 903653) --- toolkit/components/places/ColorAnalyzer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/places/ColorAnalyzer.js b/toolkit/components/places/ColorAnalyzer.js index 861ce710751..86d8f36d1d7 100644 --- a/toolkit/components/places/ColorAnalyzer.js +++ b/toolkit/components/places/ColorAnalyzer.js @@ -11,7 +11,7 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); const XHTML_NS = "http://www.w3.org/1999/xhtml"; -const MAXIMUM_PIXELS = Math.pow(144, 2); +const MAXIMUM_PIXELS = Math.pow(128, 2); function ColorAnalyzer() { // a queue of callbacks for each job we give to the worker From 4f2383e3f31012ce8925e5a40060f0c9c6e214d9 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Mon, 8 Nov 2010 13:23:39 +0100 Subject: [PATCH 05/98] Bug 610346 - Remove nsIFormSubmitObserver interface from FormTracker. r=rnewman --- services/sync/modules/engines/forms.js | 87 -------------------------- 1 file changed, 87 deletions(-) diff --git a/services/sync/modules/engines/forms.js b/services/sync/modules/engines/forms.js index df0e31f6be2..6135740f4bc 100644 --- a/services/sync/modules/engines/forms.js +++ b/services/sync/modules/engines/forms.js @@ -209,7 +209,6 @@ FormTracker.prototype = { __proto__: Tracker.prototype, QueryInterface: XPCOMUtils.generateQI([ - Ci.nsIFormSubmitObserver, Ci.nsIObserver, Ci.nsISupportsWeakReference]), @@ -218,24 +217,13 @@ FormTracker.prototype = { switch (topic) { case "weave:engine:start-tracking": if (!this._enabled) { - Svc.Obs.add("form-notifier", this); Svc.Obs.add("satchel-storage-changed", this); - // HTMLFormElement doesn't use the normal observer/observe - // pattern and looks up nsIFormSubmitObservers to .notify() - // them so add manually to observers - Cc["@mozilla.org/observer-service;1"] - .getService(Ci.nsIObserverService) - .addObserver(this, "earlyformsubmit", true); this._enabled = true; } break; case "weave:engine:stop-tracking": if (this._enabled) { - Svc.Obs.remove("form-notifier", this); Svc.Obs.remove("satchel-storage-changed", this); - Cc["@mozilla.org/observer-service;1"] - .getService(Ci.nsIObserverService) - .removeObserver(this, "earlyformsubmit"); this._enabled = false; } break; @@ -252,79 +240,4 @@ FormTracker.prototype = { this.addChangedID(guid); this.score += SCORE_INCREMENT_MEDIUM; }, - - notify: function (formElement, aWindow, actionURI) { - if (this.ignoreAll) { - return; - } - - this._log.trace("Form submission notification for " + actionURI.spec); - - // XXX Bug 487541 Copy the logic from nsFormHistory::Notify to avoid - // divergent logic, which can lead to security issues, until there's a - // better way to get satchel's results like with a notification. - - // Determine if a dom node has the autocomplete attribute set to "off" - let completeOff = function(domNode) { - let autocomplete = domNode.getAttribute("autocomplete"); - return autocomplete && autocomplete.search(/^off$/i) == 0; - } - - if (completeOff(formElement)) { - this._log.trace("Form autocomplete set to off"); - return; - } - - /* Get number of elements in form, add points and changedIDs */ - let len = formElement.length; - let elements = formElement.elements; - for (let i = 0; i < len; i++) { - let el = elements.item(i); - - // Grab the name for debugging, but check if empty when satchel would - let name = el.name; - if (name === "") { - name = el.id; - } - - if (!(el instanceof Ci.nsIDOMHTMLInputElement)) { - this._log.trace(name + " is not a DOMHTMLInputElement: " + el); - continue; - } - - if (el.type.search(/^text$/i) != 0) { - this._log.trace(name + "'s type is not 'text': " + el.type); - continue; - } - - if (completeOff(el)) { - this._log.trace(name + "'s autocomplete set to off"); - continue; - } - - if (el.value === "") { - this._log.trace(name + "'s value is empty"); - continue; - } - - if (el.value == el.defaultValue) { - this._log.trace(name + "'s value is the default"); - continue; - } - - if (name === "") { - this._log.trace("Text input element has no name or id"); - continue; - } - - // Get the GUID on a delay so that it can be added to the DB first... - Utils.nextTick(function() { - this._log.trace("Logging form element: " + [name, el.value]); - let guid = FormWrapper.getGUID(name, el.value); - if (guid) { - this.trackEntry(guid); - } - }, this); - } - } }; From 3edee517acef829b9db6c0774db73aadef5c762a Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 22 Jul 2013 10:12:32 +0100 Subject: [PATCH 06/98] Bug 894840, part 1 - Refactor and move the mode storage to nsBaseFilePicker. r=mounir --- widget/cocoa/nsFilePicker.h | 3 +-- widget/cocoa/nsFilePicker.mm | 7 ++----- widget/gtk2/nsFilePicker.cpp | 7 ++----- widget/gtk2/nsFilePicker.h | 3 +-- widget/os2/nsFilePicker.cpp | 4 +--- widget/os2/nsFilePicker.h | 4 +--- widget/qt/nsFilePicker.cpp | 4 +--- widget/qt/nsFilePicker.h | 3 +-- widget/windows/nsFilePicker.cpp | 4 +--- widget/windows/nsFilePicker.h | 4 +--- widget/windows/winrt/nsMetroFilePicker.h | 3 +-- widget/xpwidgets/nsBaseFilePicker.cpp | 8 +++++--- widget/xpwidgets/nsBaseFilePicker.h | 4 ++-- widget/xpwidgets/nsFilePickerProxy.cpp | 3 +-- widget/xpwidgets/nsFilePickerProxy.h | 3 +-- 15 files changed, 22 insertions(+), 42 deletions(-) diff --git a/widget/cocoa/nsFilePicker.h b/widget/cocoa/nsFilePicker.h index d2bb3134b67..463ae17bb1c 100644 --- a/widget/cocoa/nsFilePicker.h +++ b/widget/cocoa/nsFilePicker.h @@ -47,7 +47,7 @@ public: protected: - virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, int16_t aMode); + virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle); // actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel // aFile is an existing but unspecified file. These functions must specify it. @@ -62,7 +62,6 @@ protected: NSView* GetAccessoryView(); nsString mTitle; - int16_t mMode; nsCOMArray mFiles; nsString mDefault; diff --git a/widget/cocoa/nsFilePicker.mm b/widget/cocoa/nsFilePicker.mm index cb36df8798e..fd42f9732ca 100644 --- a/widget/cocoa/nsFilePicker.mm +++ b/widget/cocoa/nsFilePicker.mm @@ -92,8 +92,7 @@ static void SetShowHiddenFileState(NSSavePanel* panel) } nsFilePicker::nsFilePicker() -: mMode(0) -, mSelectedTypeIndex(0) +: mSelectedTypeIndex(0) { } @@ -102,11 +101,9 @@ nsFilePicker::~nsFilePicker() } void -nsFilePicker::InitNative(nsIWidget *aParent, const nsAString& aTitle, - int16_t aMode) +nsFilePicker::InitNative(nsIWidget *aParent, const nsAString& aTitle) { mTitle = aTitle; - mMode = aMode; } NSView* nsFilePicker::GetAccessoryView() diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp index 3c1e348166f..17b7eb09a07 100644 --- a/widget/gtk2/nsFilePicker.cpp +++ b/widget/gtk2/nsFilePicker.cpp @@ -154,8 +154,7 @@ MakeCaseInsensitiveShellGlob(const char* aPattern) { NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker) nsFilePicker::nsFilePicker() - : mMode(nsIFilePicker::modeOpen), - mSelectedType(0), + : mSelectedType(0), mRunning(false), mAllowURLs(false) { @@ -217,12 +216,10 @@ nsFilePicker::ReadValuesFromFileChooser(GtkWidget *file_chooser) void nsFilePicker::InitNative(nsIWidget *aParent, - const nsAString& aTitle, - int16_t aMode) + const nsAString& aTitle) { mParentWidget = aParent; mTitle.Assign(aTitle); - mMode = aMode; } NS_IMETHODIMP diff --git a/widget/gtk2/nsFilePicker.h b/widget/gtk2/nsFilePicker.h index be9d8ef721a..ca78bc53e7d 100644 --- a/widget/gtk2/nsFilePicker.h +++ b/widget/gtk2/nsFilePicker.h @@ -40,7 +40,7 @@ public: NS_IMETHODIMP Show(int16_t *aReturn); // nsBaseFilePicker - virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, int16_t aMode); + virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle); static void Shutdown(); @@ -57,7 +57,6 @@ protected: nsCOMPtr mCallback; nsCOMArray mFiles; - int16_t mMode; int16_t mSelectedType; int16_t mResult; bool mRunning; diff --git a/widget/os2/nsFilePicker.cpp b/widget/os2/nsFilePicker.cpp index 07349e95ffb..8c8628ce45f 100644 --- a/widget/os2/nsFilePicker.cpp +++ b/widget/os2/nsFilePicker.cpp @@ -467,12 +467,10 @@ NS_IMETHODIMP nsFilePicker::SetFilterIndex(int32_t aFilterIndex) //------------------------------------------------------------------------- void nsFilePicker::InitNative(nsIWidget *aParent, - const nsAString& aTitle, - int16_t aMode) + const nsAString& aTitle) { mWnd = (HWND) ((aParent) ? aParent->GetNativeData(NS_NATIVE_WINDOW) : 0); mTitle.Assign(aTitle); - mMode = aMode; } diff --git a/widget/os2/nsFilePicker.h b/widget/os2/nsFilePicker.h index 13a101a4990..bf9ee4501b1 100644 --- a/widget/os2/nsFilePicker.h +++ b/widget/os2/nsFilePicker.h @@ -49,8 +49,7 @@ public: protected: /* method from nsBaseFilePicker */ - virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, - int16_t aMode); + virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle); void GetFilterListArray(nsString& aFilterList); @@ -60,7 +59,6 @@ protected: HWND mWnd; nsString mTitle; - int16_t mMode; nsCString mFile; nsString mDefault; nsString mDefaultExtension; diff --git a/widget/qt/nsFilePicker.cpp b/widget/qt/nsFilePicker.cpp index 10967a610d8..89068105c01 100644 --- a/widget/qt/nsFilePicker.cpp +++ b/widget/qt/nsFilePicker.cpp @@ -36,7 +36,6 @@ static PRLogModuleInfo* sFilePickerLog = nullptr; NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker) nsFilePicker::nsFilePicker() - : mMode(nsIFilePicker::modeOpen) { #ifdef PR_LOGGING if (!sFilePickerLog) @@ -289,11 +288,10 @@ nsFilePicker::Show(int16_t* aReturn) return NS_OK; } -void nsFilePicker::InitNative(nsIWidget *aParent, const nsAString &aTitle, int16_t mode) +void nsFilePicker::InitNative(nsIWidget *aParent, const nsAString &aTitle) { PR_LOG(sFilePickerLog, PR_LOG_DEBUG, ("nsFilePicker::InitNative")); nsAutoString str(aTitle); mCaption = QString::fromUtf16(str.get()); mParent = aParent; - mMode = mode; } diff --git a/widget/qt/nsFilePicker.h b/widget/qt/nsFilePicker.h index 134009a6ec7..fbd7ce9145a 100644 --- a/widget/qt/nsFilePicker.h +++ b/widget/qt/nsFilePicker.h @@ -37,13 +37,12 @@ public: private: ~nsFilePicker(); - void InitNative(nsIWidget*, const nsAString&, short int); + void InitNative(nsIWidget*, const nsAString&); protected: QPointer mDialog; nsCOMArray mFiles; - int16_t mMode; int16_t mSelectedType; nsCString mFile; nsString mTitle; diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index 814488f8ad2..ff626f7bafa 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -1202,12 +1202,10 @@ nsFilePicker::SetFilterIndex(int32_t aFilterIndex) void nsFilePicker::InitNative(nsIWidget *aParent, - const nsAString& aTitle, - int16_t aMode) + const nsAString& aTitle) { mParentWidget = aParent; mTitle.Assign(aTitle); - mMode = aMode; } void diff --git a/widget/windows/nsFilePicker.h b/widget/windows/nsFilePicker.h index d2213da422c..42fa000b07c 100644 --- a/widget/windows/nsFilePicker.h +++ b/widget/windows/nsFilePicker.h @@ -95,8 +95,7 @@ protected: /* method from nsBaseFilePicker */ virtual void InitNative(nsIWidget *aParent, - const nsAString& aTitle, - int16_t aMode); + const nsAString& aTitle); static void GetQualifiedPath(const PRUnichar *aInPath, nsString &aOutPath); void GetFilterListArray(nsString& aFilterList); bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType); @@ -118,7 +117,6 @@ protected: nsCOMPtr mLoadContext; nsCOMPtr mParentWidget; nsString mTitle; - int16_t mMode; nsCString mFile; nsString mFilterList; int16_t mSelectedType; diff --git a/widget/windows/winrt/nsMetroFilePicker.h b/widget/windows/winrt/nsMetroFilePicker.h index e9aa6f27488..0117111dddb 100644 --- a/widget/windows/winrt/nsMetroFilePicker.h +++ b/widget/windows/winrt/nsMetroFilePicker.h @@ -54,11 +54,10 @@ public: HRESULT OnPickMultipleFiles(ABI::Windows::Foundation::IAsyncOperation*>* aFileList, AsyncStatus aStatus); private: - void InitNative(nsIWidget*, const nsAString&, int16_t) {}; + void InitNative(nsIWidget*, const nsAString&) {}; nsresult ParseFiltersIntoVector(Microsoft::WRL::ComPtr>& aVector, const nsAString& aFilter, bool aAllowAll); - int16_t mMode; nsCOMArray mFiles; Microsoft::WRL::ComPtr mFileOpenPicker; Microsoft::WRL::ComPtr mFileSavePicker; diff --git a/widget/xpwidgets/nsBaseFilePicker.cpp b/widget/xpwidgets/nsBaseFilePicker.cpp index 531e5a0470b..684bf7b8f34 100644 --- a/widget/xpwidgets/nsBaseFilePicker.cpp +++ b/widget/xpwidgets/nsBaseFilePicker.cpp @@ -113,8 +113,9 @@ private: NS_IMPL_ISUPPORTS1(nsBaseFilePickerEnumerator, nsISimpleEnumerator) -nsBaseFilePicker::nsBaseFilePicker() : - mAddToRecentDocs(true) +nsBaseFilePicker::nsBaseFilePicker() + : mAddToRecentDocs(true) + , mMode(nsIFilePicker::modeOpen) { } @@ -133,7 +134,8 @@ NS_IMETHODIMP nsBaseFilePicker::Init(nsIDOMWindow *aParent, nsCOMPtr widget = WidgetUtils::DOMWindowToWidget(aParent); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); - InitNative(widget, aTitle, aMode); + mMode = aMode; + InitNative(widget, aTitle); return NS_OK; } diff --git a/widget/xpwidgets/nsBaseFilePicker.h b/widget/xpwidgets/nsBaseFilePicker.h index 57f6890ef7c..e5e270d25ae 100644 --- a/widget/xpwidgets/nsBaseFilePicker.h +++ b/widget/xpwidgets/nsBaseFilePicker.h @@ -40,11 +40,11 @@ public: protected: - virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, - int16_t aMode) = 0; + virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle) = 0; bool mAddToRecentDocs; nsCOMPtr mDisplayDirectory; + int16_t mMode; }; #endif // nsBaseFilePicker_h__ diff --git a/widget/xpwidgets/nsFilePickerProxy.cpp b/widget/xpwidgets/nsFilePickerProxy.cpp index f82cc8875ee..d6fd94e619b 100644 --- a/widget/xpwidgets/nsFilePickerProxy.cpp +++ b/widget/xpwidgets/nsFilePickerProxy.cpp @@ -29,8 +29,7 @@ nsFilePickerProxy::Init(nsIDOMWindow* /*aParent*/, const nsAString& aTitle, return NS_OK; } -void nsFilePickerProxy::InitNative(nsIWidget* aParent, const nsAString& aTitle, - int16_t aMode) +void nsFilePickerProxy::InitNative(nsIWidget* aParent, const nsAString& aTitle) { } diff --git a/widget/xpwidgets/nsFilePickerProxy.h b/widget/xpwidgets/nsFilePickerProxy.h index 8abc4b535dd..8be1057b4c5 100644 --- a/widget/xpwidgets/nsFilePickerProxy.h +++ b/widget/xpwidgets/nsFilePickerProxy.h @@ -44,11 +44,10 @@ public: private: ~nsFilePickerProxy(); - void InitNative(nsIWidget*, const nsAString&, short int); + void InitNative(nsIWidget*, const nsAString&); nsCOMArray mFiles; - int16_t mMode; int16_t mSelectedType; nsString mFile; nsString mTitle; From 68ef94c02a07f1eae2700fd03594d6d00d303ab4 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 22 Jul 2013 13:46:27 +0100 Subject: [PATCH 07/98] Bug 894840, part 2 - Get rid of the nsFilePickerShownCallback ctor's aMulti argument by exposing nsIFilePicker.mode. r=mounir --- b2g/components/FilePicker.js | 5 +++++ content/html/content/src/HTMLInputElement.cpp | 11 +++++++---- content/html/content/src/HTMLInputElement.h | 4 +--- mobile/android/components/FilePicker.js | 5 +++++ toolkit/components/filepicker/nsFilePicker.js | 3 +++ widget/nsIFilePicker.idl | 7 ++++++- widget/xpwidgets/nsBaseFilePicker.cpp | 7 +++++++ widget/xpwidgets/nsBaseFilePicker.h | 1 + 8 files changed, 35 insertions(+), 8 deletions(-) diff --git a/b2g/components/FilePicker.js b/b2g/components/FilePicker.js index 4d27d01f51c..980c72fcea5 100644 --- a/b2g/components/FilePicker.js +++ b/b2g/components/FilePicker.js @@ -55,6 +55,7 @@ FilePicker.prototype = { init: function(parent, title, mode) { this.mParent = parent; + this.mMode = mode; if (mode != Ci.nsIFilePicker.modeOpen && mode != Ci.nsIFilePicker.modeOpenMultiple) { @@ -74,6 +75,10 @@ FilePicker.prototype = { return this.mFilesEnumerator ? this.mFilesEnumerator.mFiles[0] : null; }, + get mode() { + return this.mMode; + }, + appendFilters: function(filterMask) { // Ci.nsIFilePicker.filterHTML is not supported // Ci.nsIFilePicker.filterText is not supported diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp index 91340235ddb..e70ad0d7718 100644 --- a/content/html/content/src/HTMLInputElement.cpp +++ b/content/html/content/src/HTMLInputElement.cpp @@ -263,10 +263,9 @@ NS_IMPL_ISUPPORTS1(HTMLInputElementState, HTMLInputElementState) NS_DEFINE_STATIC_IID_ACCESSOR(HTMLInputElementState, NS_INPUT_ELEMENT_STATE_IID) HTMLInputElement::nsFilePickerShownCallback::nsFilePickerShownCallback( - HTMLInputElement* aInput, nsIFilePicker* aFilePicker, bool aMulti) + HTMLInputElement* aInput, nsIFilePicker* aFilePicker) : mFilePicker(aFilePicker) , mInput(aInput) - , mMulti(aMulti) { } @@ -319,9 +318,13 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) return NS_OK; } + int16_t mode; + mFilePicker->GetMode(&mode); + bool multi = mode == static_cast(nsIFilePicker::modeOpenMultiple); + // Collect new selected filenames nsCOMArray newFiles; - if (mMulti) { + if (multi) { nsCOMPtr iter; nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter)); NS_ENSURE_SUCCESS(rv, rv); @@ -581,7 +584,7 @@ HTMLInputElement::InitFilePicker() const nsCOMArray& oldFiles = GetFilesInternal(); nsCOMPtr callback = - new HTMLInputElement::nsFilePickerShownCallback(this, filePicker, multi); + new HTMLInputElement::nsFilePickerShownCallback(this, filePicker); if (oldFiles.Count()) { nsString path; diff --git a/content/html/content/src/HTMLInputElement.h b/content/html/content/src/HTMLInputElement.h index 7468ac12593..aaa8ade7286 100644 --- a/content/html/content/src/HTMLInputElement.h +++ b/content/html/content/src/HTMLInputElement.h @@ -1242,8 +1242,7 @@ private: { public: nsFilePickerShownCallback(HTMLInputElement* aInput, - nsIFilePicker* aFilePicker, - bool aMulti); + nsIFilePicker* aFilePicker); virtual ~nsFilePickerShownCallback() { } @@ -1254,7 +1253,6 @@ private: private: nsCOMPtr mFilePicker; nsRefPtr mInput; - bool mMulti; }; }; diff --git a/mobile/android/components/FilePicker.js b/mobile/android/components/FilePicker.js index 6bb533ffaf7..42b56db4933 100644 --- a/mobile/android/components/FilePicker.js +++ b/mobile/android/components/FilePicker.js @@ -26,6 +26,7 @@ FilePicker.prototype = { init: function(aParent, aTitle, aMode) { this._domWin = aParent; + this._mode = aMode; Services.obs.addObserver(this, "FilePicker:Result", false); let idService = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); @@ -156,6 +157,10 @@ FilePicker.prototype = { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get mode() { + return this._mode; + }, + show: function() { if (this._domWin) { PromptUtils.fireDialogEvent(this._domWin, "DOMWillOpenModalDialog"); diff --git a/toolkit/components/filepicker/nsFilePicker.js b/toolkit/components/filepicker/nsFilePicker.js index 0044f362c2c..5a0f94038dc 100644 --- a/toolkit/components/filepicker/nsFilePicker.js +++ b/toolkit/components/filepicker/nsFilePicker.js @@ -166,6 +166,9 @@ nsFilePicker.prototype = { set addToRecentDocs(a) {}, get addToRecentDocs() { return false; }, + /* readonly attribute short mode; */ + get mode() { return mMode; }, + /* members */ mFilesEnumerator: undefined, mDOMFilesEnumerator: undefined, diff --git a/widget/nsIFilePicker.idl b/widget/nsIFilePicker.idl index 6814f10c32d..fbb4e8af198 100644 --- a/widget/nsIFilePicker.idl +++ b/widget/nsIFilePicker.idl @@ -24,7 +24,7 @@ interface nsIFilePickerShownCallback : nsISupports void done(in short aResult); }; -[scriptable, uuid(a6a24df3-d20a-4b6a-96d4-4736b10a51b7)] +[scriptable, uuid(f93509a0-0434-11e3-8ffd-0800200c9a66)] interface nsIFilePicker : nsISupports { const short modeOpen = 0; // Load a file or directory @@ -180,4 +180,9 @@ interface nsIFilePicker : nsISupports */ void open(in nsIFilePickerShownCallback aFilePickerShownCallback); + /** + * The picker's mode, as set by the 'mode' argument passed to init() + * (one of the modeOpen et. al. constants specified above). + */ + readonly attribute short mode; }; diff --git a/widget/xpwidgets/nsBaseFilePicker.cpp b/widget/xpwidgets/nsBaseFilePicker.cpp index 684bf7b8f34..6611e0e0613 100644 --- a/widget/xpwidgets/nsBaseFilePicker.cpp +++ b/widget/xpwidgets/nsBaseFilePicker.cpp @@ -291,6 +291,13 @@ nsBaseFilePicker::SetAddToRecentDocs(bool aFlag) return NS_OK; } +NS_IMETHODIMP +nsBaseFilePicker::GetMode(int16_t* aMode) +{ + *aMode = mMode; + return NS_OK; +} + NS_IMETHODIMP nsBaseFilePicker::GetDomfile(nsIDOMFile** aDomfile) { diff --git a/widget/xpwidgets/nsBaseFilePicker.h b/widget/xpwidgets/nsBaseFilePicker.h index e5e270d25ae..92fc4916331 100644 --- a/widget/xpwidgets/nsBaseFilePicker.h +++ b/widget/xpwidgets/nsBaseFilePicker.h @@ -34,6 +34,7 @@ public: NS_IMETHOD SetDisplayDirectory(nsIFile * aDisplayDirectory); NS_IMETHOD GetAddToRecentDocs(bool *aFlag); NS_IMETHOD SetAddToRecentDocs(bool aFlag); + NS_IMETHOD GetMode(int16_t *aMode); NS_IMETHOD GetDomfile(nsIDOMFile** aDomfile); NS_IMETHOD GetDomfiles(nsISimpleEnumerator** aDomfiles); From 898fb634c206c1cf3e02e543af8ac12632dc8510 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Wed, 7 Aug 2013 00:11:54 +0100 Subject: [PATCH 08/98] Bug 902234 - Cap the number of files that we include in the tooltip for . r=enndeakin --- .../en-US/chrome/layout/HtmlForm.properties | 7 +++- toolkit/content/widgets/popup.xml | 37 +++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/dom/locales/en-US/chrome/layout/HtmlForm.properties b/dom/locales/en-US/chrome/layout/HtmlForm.properties index 1a9910ebe2e..e9a5c19248f 100644 --- a/dom/locales/en-US/chrome/layout/HtmlForm.properties +++ b/dom/locales/en-US/chrome/layout/HtmlForm.properties @@ -27,4 +27,9 @@ NoFilesSelected=No files selected. # when there are more than one selected file. # %S will be a number greater or equal to 2. XFilesSelected=%S files selected. -ColorPicker=Choose a color \ No newline at end of file +ColorPicker=Choose a color +# LOCALIZATION NOTE (AndXMoreFiles): this string is shown at the end of the +# tooltip text for when there are more than 21 +# files selected (when we will only list the first 20, plus an "and X more" +# line). %S will be the number of files minus 20. +AndXMoreFiles=and %S more diff --git a/toolkit/content/widgets/popup.xml b/toolkit/content/widgets/popup.xml index b2c1eb70b9e..37b546b8aaf 100644 --- a/toolkit/content/widgets/popup.xml +++ b/toolkit/content/widgets/popup.xml @@ -567,23 +567,38 @@ !tipElement.hasAttribute('title')) { let files = tipElement.files; - if (files.length == 0) { - try { - var bundle = Components.classes['@mozilla.org/intl/stringbundle;1'] - .getService(Components.interfaces.nsIStringBundleService) - .createBundle("chrome://global/locale/layout/HtmlForm.properties"); + try { + var bundle = Components.classes['@mozilla.org/intl/stringbundle;1'] + .getService(Components.interfaces.nsIStringBundleService) + .createBundle("chrome://global/locale/layout/HtmlForm.properties"); + if (files.length == 0) { if (tipElement.multiple) { titleText = bundle.GetStringFromName("NoFilesSelected"); } else { titleText = bundle.GetStringFromName("NoFileSelected"); } - } catch(e) {} - } else { - titleText = files[0].name; - for (let i=1; i TRUNCATED_FILE_COUNT + 1) { + let xmoreStr = bundle.GetStringFromName("AndXMoreFiles"); + let xmoreNum = files.length - TRUNCATED_FILE_COUNT; + let tmp = {}; + Components.utils.import("resource://gre/modules/PluralForm.jsm", tmp); + let andXMoreStr = tmp.PluralForm.get(xmoreNum, xmoreStr).replace("%S", xmoreNum); + titleText += "\n" + andXMoreStr; + } } - } + } catch(e) {} } while ((titleText == null) && (XLinkTitleText == null) && From 401124f339ac9cc74ca14cf2ff0252bcede0945d Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Wed, 14 Aug 2013 10:51:00 +0100 Subject: [PATCH 09/98] Bug 901955 - Get 'opacity' property changes on SVG working again. r=roc --- .../svg/dynamic-opacity-property-01.svg | 25 +++++++++++++++++++ layout/reftests/svg/reftest.list | 1 + layout/svg/nsSVGPathGeometryFrame.cpp | 17 +++++++++++++ layout/svg/nsSVGPathGeometryFrame.h | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 layout/reftests/svg/dynamic-opacity-property-01.svg diff --git a/layout/reftests/svg/dynamic-opacity-property-01.svg b/layout/reftests/svg/dynamic-opacity-property-01.svg new file mode 100644 index 00000000000..d35f8c82e67 --- /dev/null +++ b/layout/reftests/svg/dynamic-opacity-property-01.svg @@ -0,0 +1,25 @@ + + + + Test repainting for opacity property changes + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index ce2b1e16891..84206c319e5 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -89,6 +89,7 @@ skip-if(B2G) == dynamic-marker-02.svg dynamic-marker-02-ref.svg skip-if(B2G) == dynamic-marker-03.svg pass.svg == dynamic-mask-01.svg pass.svg skip-if(B2G) == dynamic-mask-contents-01.svg pass.svg +== dynamic-opacity-property-01.svg pass.svg skip-if(B2G) == dynamic-pattern-01.svg pass.svg skip-if(B2G) == dynamic-pattern-02.svg pass.svg skip-if(B2G) == dynamic-pattern-contents-01.svg pass.svg diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index d81f33976ef..b8f0114f7a2 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -120,6 +120,23 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID, return NS_OK; } +/* virtual */ void +nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) +{ + nsSVGPathGeometryFrameBase::DidSetStyleContext(aOldStyleContext); + + if (aOldStyleContext) { + float oldOpacity = aOldStyleContext->PeekStyleDisplay()->mOpacity; + float newOpacity = StyleDisplay()->mOpacity; + if (newOpacity != oldOpacity && + nsSVGUtils::CanOptimizeOpacity(this)) { + // nsIFrame::BuildDisplayListForStackingContext() is not going to create an + // nsDisplayOpacity display list item, so DLBI won't invalidate for us. + InvalidateFrame(); + } + } +} + nsIAtom * nsSVGPathGeometryFrame::GetType() const { diff --git a/layout/svg/nsSVGPathGeometryFrame.h b/layout/svg/nsSVGPathGeometryFrame.h index ad710a665a7..ed0dc6ccb5b 100644 --- a/layout/svg/nsSVGPathGeometryFrame.h +++ b/layout/svg/nsSVGPathGeometryFrame.h @@ -56,6 +56,8 @@ public: nsIAtom* aAttribute, int32_t aModType) MOZ_OVERRIDE; + virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext); + /** * Get the "type" of the frame * From ad27de97e4eb62a88e3f6eb4bdcf7b141a6a1f3f Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Wed, 14 Aug 2013 11:08:25 +0100 Subject: [PATCH 10/98] Bug 903456 - GC: StoreBuffer::CellPtrEdge::mark() assumes edge is an object pointer r=billm --- js/src/gc/Barrier-inl.h | 4 ++-- js/src/gc/StoreBuffer.cpp | 1 + js/src/gc/StoreBuffer.h | 28 ++++++++++++++++++++-------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/js/src/gc/Barrier-inl.h b/js/src/gc/Barrier-inl.h index 98c4e565d80..8fee866ae51 100644 --- a/js/src/gc/Barrier-inl.h +++ b/js/src/gc/Barrier-inl.h @@ -263,8 +263,8 @@ RelocatableValue::operator=(const Value &v) post(); } else if (value.isMarkable()) { JSRuntime *rt = runtimeFromMainThread(value); - value = v; relocate(rt); + value = v; } else { value = v; } @@ -281,8 +281,8 @@ RelocatableValue::operator=(const RelocatableValue &v) post(); } else if (value.isMarkable()) { JSRuntime *rt = runtimeFromMainThread(value); - value = v.value; relocate(rt); + value = v.value; } else { value = v.value; } diff --git a/js/src/gc/StoreBuffer.cpp b/js/src/gc/StoreBuffer.cpp index ee6373bd459..2c9db6dca20 100644 --- a/js/src/gc/StoreBuffer.cpp +++ b/js/src/gc/StoreBuffer.cpp @@ -210,6 +210,7 @@ StoreBuffer::GenericBuffer::mark(JSTracer *trc) void StoreBuffer::CellPtrEdge::mark(JSTracer *trc) { + JS_ASSERT(GetGCThingTraceKind(*edge) == JSTRACE_OBJECT); MarkObjectRoot(trc, reinterpret_cast(edge), "store buffer edge"); } diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index b32be8d0a72..f42181602cf 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -407,17 +407,29 @@ class StoreBuffer } /* Insert or update a single edge in the Relocatable buffer. */ - void putRelocatableValue(Value *v) { - bufferRelocVal.put(ValueEdge(v)); + void putRelocatableValue(Value *valuep) { + ValueEdge edge(valuep); + if (!edge.inRememberedSet(nursery_)) + return; + bufferRelocVal.put(edge); } - void putRelocatableCell(Cell **c) { - bufferRelocCell.put(CellPtrEdge(c)); + void putRelocatableCell(Cell **cellp) { + CellPtrEdge edge(cellp); + if (!edge.inRememberedSet(nursery_)) + return; + bufferRelocCell.put(edge); } - void removeRelocatableValue(Value *v) { - bufferRelocVal.unput(ValueEdge(v)); + void removeRelocatableValue(Value *valuep) { + ValueEdge edge(valuep); + if (!edge.inRememberedSet(nursery_)) + return; + bufferRelocVal.unput(edge); } - void removeRelocatableCell(Cell **c) { - bufferRelocCell.unput(CellPtrEdge(c)); + void removeRelocatableCell(Cell **cellp) { + CellPtrEdge edge(cellp); + if (!edge.inRememberedSet(nursery_)) + return; + bufferRelocCell.unput(edge); } /* Insert an entry into the generic buffer. */ From e145ee0f9383178b53fc6e8712096a31d9d4c8c4 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Wed, 14 Aug 2013 11:08:26 +0100 Subject: [PATCH 11/98] Bug 904674 - GC: Don't trace additional roots from the embedding on minor GC r=billm --- js/src/gc/RootMarking.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index f8eee3ec338..a3491fae5e3 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -751,24 +751,30 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) if (!rt->isHeapMinorCollecting()) { /* - * All JSCompartment::mark does is mark the globals for compartements + * All JSCompartment::mark does is mark the globals for compartments * which have been entered. Globals aren't nursery allocated so there's * no need to do this for minor GCs. */ for (CompartmentsIter c(rt); !c.done(); c.next()) c->mark(trc); - } - /* The embedding can register additional roots here. */ - for (size_t i = 0; i < rt->gcBlackRootTracers.length(); i++) { - const JSRuntime::ExtraTracer &e = rt->gcBlackRootTracers[i]; - (*e.op)(trc, e.data); - } + /* + * The embedding can register additional roots here. + * + * We don't need to trace these in a minor GC because all pointers into + * the nursery should be in the store buffer, and we want to avoid the + * time taken to trace all these roots. + */ + for (size_t i = 0; i < rt->gcBlackRootTracers.length(); i++) { + const JSRuntime::ExtraTracer &e = rt->gcBlackRootTracers[i]; + (*e.op)(trc, e.data); + } - /* During GC, we don't mark gray roots at this stage. */ - if (JSTraceDataOp op = rt->gcGrayRootTracer.op) { - if (!IS_GC_MARKING_TRACER(trc) && !trc->runtime->isHeapMinorCollecting()) - (*op)(trc, rt->gcGrayRootTracer.data); + /* During GC, we don't mark gray roots at this stage. */ + if (JSTraceDataOp op = rt->gcGrayRootTracer.op) { + if (!IS_GC_MARKING_TRACER(trc)) + (*op)(trc, rt->gcGrayRootTracer.data); + } } } From 2ad9f88ac660b9f8648987807ec42d2a9c740486 Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 14 Aug 2013 13:03:36 +0200 Subject: [PATCH 12/98] Bug 899722 Part 0: Extract patches for bugs 724533 & 853701 into separate patches and make update-icu.sh apply them. r=glandium --- intl/icu-patches/bug-724533 | 443 ++++++++++++++++++++++++++++++++++++ intl/icu-patches/bug-853706 | 33 +++ intl/update-icu.sh | 23 +- 3 files changed, 479 insertions(+), 20 deletions(-) create mode 100644 intl/icu-patches/bug-724533 create mode 100644 intl/icu-patches/bug-853706 diff --git a/intl/icu-patches/bug-724533 b/intl/icu-patches/bug-724533 new file mode 100644 index 00000000000..e654c7710e7 --- /dev/null +++ b/intl/icu-patches/bug-724533 @@ -0,0 +1,443 @@ +# HG changeset patch +# Parent f0198ba6d08bc0bfc3f67f16ccb54c6f6681ee0c +# User Norbert Lindenberg +Bug 724533 - Make ICU build with Mozilla build for Windows. r=gps + +diff --git a/intl/icu/source/aclocal.m4 b/intl/icu/source/aclocal.m4 +--- a/intl/icu/source/aclocal.m4 ++++ b/intl/icu/source/aclocal.m4 +@@ -33,17 +33,20 @@ powerpc*-*-linux*) + *-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;; + *-*-cygwin|*-*-mingw32) + if test "$GCC" = yes; then + AC_TRY_COMPILE([ + #ifndef __MINGW32__ + #error This is not MinGW + #endif], [], icu_cv_host_frag=mh-mingw, icu_cv_host_frag=mh-cygwin) + else +- icu_cv_host_frag=mh-cygwin-msvc ++ case "${host}" in ++ *-*-mingw32) icu_cv_host_frag=mh-msys-msvc ;; ++ *-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;; ++ esac + fi ;; + *-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;; + *-*-aix*) + if test "$GCC" = yes; then + icu_cv_host_frag=mh-aix-gcc + else + icu_cv_host_frag=mh-aix-va + fi ;; +@@ -456,27 +459,31 @@ AC_DEFUN(AC_CHECK_STRICT_COMPILE, + # We use -std=c99 to disable the gnu99 defaults and its associated warnings + CFLAGS="$CFLAGS -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" + else + case "${host}" in + *-*-cygwin) + if test "`$CC /help 2>&1 | head -c9`" = "Microsoft" + then + CFLAGS="$CFLAGS /W4" +- fi ++ fi ;; ++ *-*-mingw32) ++ CFLAGS="$CFLAGS -W4" ;; + esac + fi + if test "$GXX" = yes + then + CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" + else + case "${host}" in + *-*-cygwin) + if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft" + then + CXXFLAGS="$CXXFLAGS /W4" +- fi ++ fi ;; ++ *-*-mingw32) ++ CXXFLAGS="$CXXFLAGS -W4" ;; + esac + fi + fi + ]) + + +diff --git a/intl/icu/source/config/mh-cygwin-msvc b/intl/icu/source/config/mh-msys-msvc +copy from intl/icu/source/config/mh-cygwin-msvc +copy to intl/icu/source/config/mh-msys-msvc +--- a/intl/icu/source/config/mh-cygwin-msvc ++++ b/intl/icu/source/config/mh-msys-msvc +@@ -1,22 +1,22 @@ +-## Cygwin with Microsoft Visual C++ compiler specific setup ++## MSYS with Microsoft Visual C++ compiler specific setup + ## Copyright (c) 2001-2012, International Business Machines Corporation and + ## others. All Rights Reserved. + + # We install sbin tools into the same bin directory because + # pkgdata needs some of the tools in sbin, and we can't always depend on + # icu-config working on Windows. + sbindir=$(bindir) + + ## Commands to generate dependency files + GEN_DEPS.c= : + GEN_DEPS.cc= : +-#GEN_DEPS.c= $(COMPILE.c) /E +-#GEN_DEPS.cc= $(COMPILE.cc) /E ++#GEN_DEPS.c= $(COMPILE.c) -E ++#GEN_DEPS.cc= $(COMPILE.cc) -E + + ## Flags to create/use a static library + ifneq ($(ENABLE_SHARED),YES) + ## Make sure that the static libraries can be built and used + CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M# + else + ## Make sure that the static libraries can be built + STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION +@@ -36,63 +36,63 @@ CPPFLAGS+=-DU_RELEASE=1#M# + endif + + ifeq ($(ENABLE_DEBUG),1) + # Pass debugging flag through + CPPFLAGS+=-D_DEBUG=1#M# + ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M# + endif + +-# /GF pools strings and places them into read-only memory +-# /EHsc enables exception handling +-# /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. ++# -GF pools strings and places them into read-only memory ++# -EHsc enables exception handling ++# -Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. + # -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions. +-CFLAGS+=/GF /nologo +-CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t ++CFLAGS+=-GF -nologo ++CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t + CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE + DEFS+=-DWIN32 -DCYGWINMSVC +-LDFLAGS+=/nologo ++LDFLAGS+=-nologo + + # Commands to compile +-COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c +-COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c ++COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c ++COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c + + # Commands to link +-LINK.c= LINK.EXE /subsystem:console $(LDFLAGS) +-LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS) ++LINK.c= LINK.EXE -subsystem:console $(LDFLAGS) ++LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS) + + ## Commands to make a shared library +-SHLIB.c= LINK.EXE /DLL $(LDFLAGS) +-SHLIB.cc= LINK.EXE /DLL $(LDFLAGS) ++SHLIB.c= LINK.EXE -DLL $(LDFLAGS) ++SHLIB.cc= LINK.EXE -DLL $(LDFLAGS) + + ## Compiler switch to embed a runtime search path + LD_RPATH= + LD_RPATH_PRE= + + ## Compiler switch to embed a library name +-LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib) ++LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib) + + ## Shared object suffix + SO = dll + ## Non-shared intermediate object suffix + STATIC_O = ao + # OUTOPT is for creating a specific output name +-OUTOPT = /out: ++OUTOPT = -out: + + # Static library prefix and file extension + LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX) + A = lib + + # Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead. + AR = LIB.EXE#M# +-ARFLAGS := /nologo $(ARFLAGS:r=)#M# ++ARFLAGS := -nologo $(ARFLAGS:r=)#M# + RANLIB = ls -s#M# +-AR_OUTOPT = /OUT:#M# ++AR_OUTOPT = -OUT:#M# + +-## An import library is needed for z/OS, MSVC and Cygwin ++## An import library is needed for z-OS, MSVC and Cygwin + IMPORT_LIB_EXT = .lib + + LIBPREFIX= + DEFAULT_LIBS = advapi32.lib + + # Change the stubnames so that poorly working FAT disks and installation programs can work. + # This is also for backwards compatibility. + DATA_STUBNAME = dt +@@ -109,47 +109,35 @@ LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_ST + LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib + LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib + LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib + LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib + LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib + LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib + + ## These are the library specific LDFLAGS +-LDFLAGSICUDT+= /base:"0x4ad00000" /NOENTRY# The NOENTRY option is required for creating a resource-only DLL. +-LDFLAGSICUUC= /base:"0x4a800000"# in-uc = 1MB +-LDFLAGSICUI18N= /base:"0x4a900000"# io-in = 2MB +-LDFLAGSICUIO= /base:"0x4ab00000"# le-io = 1MB +-LDFLAGSICULE= /base:"0x4ac00000"# lx-le = 512KB +-LDFLAGSICULX= /base:"0x4ac80000" ++LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL. ++LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB ++LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB ++LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB ++LDFLAGSICULE= -base:"0x4ac00000"# lx-le = 512KB ++LDFLAGSICULX= -base:"0x4ac80000" + LDFLAGSCTESTFW=# Unused for now. +-LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. +- +-# The #M# is used to delete lines for icu-config +-# Current full path directory. +-CURR_FULL_DIR=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98 +-# Current full path directory for use in source code in a -D compiler option. +-CURR_SRCCODE_FULL_DIR=$(subst \,\\,$(shell cygpath -da .))#M# +- +-ifeq ($(srcdir),.) +-SOURCE_FILE=$< +-else +-SOURCE_FILE=$(shell cygpath -dma $<)#M# +-endif ++LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. + + ## Compilation rules + %.$(STATIC_O): $(srcdir)/%.c +- $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE) ++ $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $< + %.o: $(srcdir)/%.c +- $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE) ++ $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $< + + %.$(STATIC_O): $(srcdir)/%.cpp +- $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE) ++ $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $< + %.o: $(srcdir)/%.cpp +- $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE) ++ $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $< + + + ## Dependency rules + ## This is a start to how depdendencies could work + # The commented out rules may not properly delete the file when ^C is pressed + # or the compiler fails. + # make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency. + # So system headers are ignored by ignoring \\ +@@ -170,34 +158,34 @@ endif + # @echo -n "$@ $(basename $<).o : " > $@ + # @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ + # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ + # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ + # || (rm -f $@ && echo $@ && false)' + + ## Compile a Windows resource file + %.res : $(srcdir)/%.rc +- rc.exe /fo$@ $(CPPFLAGS) $(SOURCE_FILE) ++ rc.exe -fo$@ $(CPPFLAGS) $< + + ## Versioned target for a shared library. + FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) + MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) + + ## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature. + POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \ + ( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \ + || true + POST_BUILD_STEP = @([ -e $@.manifest ] && \ + ( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \ + || true + + ## Special pkgdata information that is needed + PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) +-ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M# +-ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; cygpath -dma $(DESTDIR)$(libdir))#M# ++ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; echo $(DESTDIR)$(ICUPKGDATA_DIR))#M# ++ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; echo $(DESTDIR)$(libdir))#M# + + ## Versioned import library names. The library names are versioned, + ## but the import libraries do not need versioning. + IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M# + MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M# + FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M# + + # The following is for Makefile.inc's use. +@@ -220,10 +208,10 @@ INSTALL-L=$(INSTALL_PROGRAM) + LDLIBRARYPATH_ENVVAR = PATH + + # These are needed to allow the pkgdata nmake files to work + PKGDATA_INVOKE_OPTS = MAKEFLAGS= + + # Include the version information in the shared library + ENABLE_SO_VERSION_DATA=1 + +-## End Cygwin-specific setup ++## End MSYS-specific setup + +diff --git a/intl/icu/source/configure b/intl/icu/source/configure +--- a/intl/icu/source/configure ++++ b/intl/icu/source/configure +@@ -4068,29 +4068,33 @@ fi + # We use -std=c99 to disable the gnu99 defaults and its associated warnings + CFLAGS="$CFLAGS -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" + else + case "${host}" in + *-*-cygwin) + if test "`$CC /help 2>&1 | head -c9`" = "Microsoft" + then + CFLAGS="$CFLAGS /W4" +- fi ++ fi ;; ++ *-*-mingw32) ++ CFLAGS="$CFLAGS -W4" ;; + esac + fi + if test "$GXX" = yes + then + CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" + else + case "${host}" in + *-*-cygwin) + if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft" + then + CXXFLAGS="$CXXFLAGS /W4" +- fi ++ fi ;; ++ *-*-mingw32) ++ CXXFLAGS="$CXXFLAGS -W4" ;; + esac + fi + fi + + + # Check if we can build and use 64-bit libraries + + +@@ -4864,17 +4868,20 @@ main () + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + icu_cv_host_frag=mh-mingw + else + icu_cv_host_frag=mh-cygwin + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else +- icu_cv_host_frag=mh-cygwin-msvc ++ case "${host}" in ++ *-*-mingw32) icu_cv_host_frag=mh-msys-msvc ;; ++ *-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;; ++ esac + fi ;; + *-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;; + *-*-aix*) + if test "$GCC" = yes; then + icu_cv_host_frag=mh-aix-gcc + else + icu_cv_host_frag=mh-aix-va + fi ;; +@@ -5106,17 +5113,17 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enabled" >&5 + $as_echo "$enabled" >&6; } + + + # MSVC floating-point option + MSVC_RELEASE_FLAG="" + if test $enabled = yes + then +- if test $icu_cv_host_frag = mh-cygwin-msvc ++ if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc + then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + + #if defined _MSC_VER && _MSC_VER >= 1400 + #else + Microsoft Visual C++ < 2005 + #endif +diff --git a/intl/icu/source/configure.in b/intl/icu/source/configure.in +--- a/intl/icu/source/configure.in ++++ b/intl/icu/source/configure.in +@@ -313,18 +313,18 @@ AC_ARG_ENABLE(auto-cleanup, + esac], + ) + AC_MSG_RESULT($enabled) + AC_SUBST(UCLN_NO_AUTO_CLEANUP) + + # MSVC floating-point option + MSVC_RELEASE_FLAG="" + if test $enabled = yes +-then +- if test $icu_cv_host_frag = mh-cygwin-msvc ++then ++ if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc + then + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #if defined _MSC_VER && _MSC_VER >= 1400 + #else + Microsoft Visual C++ < 2005 + #endif + ]], [[]])],[MSVC_RELEASE_FLAG="/fp:precise"],[MSVC_RELEASE_FLAG="/Op"]) + +diff --git a/intl/icu/source/data/Makefile.in b/intl/icu/source/data/Makefile.in +--- a/intl/icu/source/data/Makefile.in ++++ b/intl/icu/source/data/Makefile.in +@@ -345,17 +345,18 @@ GENRBOPTS=-k + -include $(MISCSRCDIR)/misclocal.mk + MSC_SOURCE= $(MISC_SOURCE) $(MISC_SOURCE_LOCAL) + MSC_SRC_FILES=$(MSC_SOURCE:%=$(MISCSRCDIR)/%) + + ifeq ($(ENABLE_SO_VERSION_DATA),1) + ifeq ($(PKGDATA_MODE),dll) + SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res + $(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc +- rc.exe /i$(srcdir)/../common /i$(top_builddir)/common /fo$@ $(CPPFLAGS) $(SOURCE_FILE) ++ # fixme: need to tell whether to use - or /, $(SOURCEFILE) or $< ++ rc.exe -i$(srcdir)/../common -i$(top_builddir)/common -fo$@ $(CPPFLAGS) $< + endif + endif + + INDEX_NAME=res_index + INDEX_FILE=$(OUTTMPDIR)/$(INDEX_NAME).txt + + ALL_RES_SRC= $(RES_SRC) $(TRNS_SOURCE) $(MSC_SOURCE) + RES_FILES = $(ALL_RES_SRC:%.txt=$(BUILDDIR)/%.res) $(BUILDDIR)/$(INDEX_NAME).res $(BUILDDIR)/pool.res +diff --git a/intl/icu/source/runConfigureICU b/intl/icu/source/runConfigureICU +--- a/intl/icu/source/runConfigureICU ++++ b/intl/icu/source/runConfigureICU +@@ -279,16 +279,27 @@ case $platform in + DEBUG_CXXFLAGS='-g -O0' + ;; + MinGW) + THE_OS="MinGW" + THE_COMP="the GNU C++" + RELEASE_CFLAGS='-O3' + RELEASE_CXXFLAGS='-O3' + ;; ++ MSYS/MSVC) ++ THE_OS="MSYS" ++ THE_COMP="Microsoft Visual C++" ++ CC=cl; export CC ++ CXX=cl; export CXX ++ RELEASE_CFLAGS='-Gy -MD' ++ RELEASE_CXXFLAGS='-Gy -MD' ++ DEBUG_CFLAGS='-Zi -MDd' ++ DEBUG_CXXFLAGS='-Zi -MDd' ++ DEBUG_LDFLAGS='-DEBUG' ++ ;; + *BSD) + THE_OS="BSD" + THE_COMP="the GNU C++" + CC=gcc; export CC + CXX=g++; export CXX + DEBUG_CFLAGS='-g -O0' + DEBUG_CXFLAGS='-g -O0' + ;; diff --git a/intl/icu-patches/bug-853706 b/intl/icu-patches/bug-853706 new file mode 100644 index 00000000000..ecbecd6aec4 --- /dev/null +++ b/intl/icu-patches/bug-853706 @@ -0,0 +1,33 @@ +# HG changeset patch +# Parent 7965d384123c42ca0e4e4b18bc3ad73b26369f16 +# User Norbert Lindenberg +Bug 853706 - Backported fix for formatting 0 with significant digits from ICU. + +diff --git a/intl/icu/source/i18n/decimfmt.cpp b/intl/icu/source/i18n/decimfmt.cpp +--- a/intl/icu/source/i18n/decimfmt.cpp ++++ b/intl/icu/source/i18n/decimfmt.cpp +@@ -1709,16 +1709,24 @@ DecimalFormat::subformat(UnicodeString& + } + + // Output grouping separator if necessary. + if (isGroupingPosition(i)) { + currentLength = appendTo.length(); + appendTo.append(*grouping); + handler.addAttribute(kGroupingSeparatorField, currentLength, appendTo.length()); + } ++ } ++ ++ // This handles the special case of formatting 0. For zero only, we count the ++ // zero to the left of the decimal point as one signficant digit. Ordinarily we ++ // do not count any leading 0's as significant. If the number we are formatting ++ // is not zero, then either sigCount or digits.getCount() will be non-zero. ++ if (sigCount == 0 && digits.getCount() == 0) { ++ sigCount = 1; + } + + // TODO(dlf): this looks like it was a bug, we marked the int field as ending + // before the zero was generated. + // Record field information for caller. + // if (fieldPosition.getField() == NumberFormat::kIntegerField) + // fieldPosition.setEndIndex(appendTo.length()); + diff --git a/intl/update-icu.sh b/intl/update-icu.sh index 152a4172ae3..4fad0c630e2 100755 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -3,26 +3,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/. -# Warning -# ======= -# As of ICU 51.1, ICU as obtained from the ICU repository does not -# build with the Mozilla build tools for Windows. Check -# http://bugs.icu-project.org/trac/ticket/9985 -# whether this has been addressed in the version you're updating to. -# If not, obtain the patch "Make ICU build with Mozilla build for Windows" from -# https://bugzilla.mozilla.org/show_bug.cgi?id=724533 -# and reapply it after running update-icu.sh (additional updates may be needed). -# If the bug has been addressed, please delete this warning. - -# Warning -# ======= -# The fix for ICU bug 10045 has been individually backported into this tree. -# If you update ICU to a version that does not have this fix yet, obtain the -# patch "Backported fix for formatting 0 with significant digits from ICU" from -# https://bugzilla.mozilla.org/show_bug.cgi?id=853706 -# and reapply it after running update-icu.sh. -# If you update ICU to a version that has the fix, please delete this warning. - # Usage: update-icu.sh # E.g., for ICU 50.1.1: update-icu.sh http://source.icu-project.org/repos/icu/icu/tags/release-50-1-1/ @@ -58,4 +38,7 @@ rm ${icu_dir}/source/data/translit/* # Record `svn info` svn info $1 > ${icu_dir}/SVN-INFO +patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-724533 +patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-853706 + hg addremove ${icu_dir} From 02558cdb8a65038bdc71e9a0f42ce32e165e7cca Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 14 Aug 2013 13:03:40 +0200 Subject: [PATCH 13/98] Bug 899722 Part 1: Fix ECMAScript intl on BSD by stripping the extra 's' added to the library name, as done on linux. r=norbert --- intl/icu-patches/bug-899722 | 29 +++++++++++++++++++++++++++++ intl/icu/source/config/mh-bsd-gcc | 14 +++++++++++++- intl/update-icu.sh | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 intl/icu-patches/bug-899722 diff --git a/intl/icu-patches/bug-899722 b/intl/icu-patches/bug-899722 new file mode 100644 index 00000000000..c89d2a43891 --- /dev/null +++ b/intl/icu-patches/bug-899722 @@ -0,0 +1,29 @@ +Bug 899722 Part 1: Fix ECMAScript intl on BSD by stripping the extra 's' added to the library name, as done on linux. r=norbert + +diff --git a/intl/icu/source/config/mh-bsd-gcc b/intl/icu/source/config/mh-bsd-gcc +--- a/intl/icu/source/config/mh-bsd-gcc ++++ b/intl/icu/source/config/mh-bsd-gcc +@@ -58,10 +58,22 @@ STATIC_O = ao + + ## Versioned libraries rules + + %.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) + $(RM) $@ && ln -s ${ ${icu_dir}/SVN-INFO patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-724533 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-853706 +patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722 hg addremove ${icu_dir} From 819bc8d03192dd7f6d60e10998c35500205c20bd Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 14 Aug 2013 13:04:41 +0200 Subject: [PATCH 14/98] Bug 899722 Part 2: Backport upstream r32937 to fix symbol collision w/ truncate on BSD r=norbert r=waldo See http://bugs.icu-project.org/trac/ticket/10290 --- intl/icu-patches/bug-899722-2 | 110 +++++++++++++++++++++++++++++ intl/icu/source/tools/genrb/derb.c | 12 ++-- intl/update-icu.sh | 1 + 3 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 intl/icu-patches/bug-899722-2 diff --git a/intl/icu-patches/bug-899722-2 b/intl/icu-patches/bug-899722-2 new file mode 100644 index 00000000000..73f25ba8054 --- /dev/null +++ b/intl/icu-patches/bug-899722-2 @@ -0,0 +1,110 @@ +Bug 899722 Part 2 - Backport upstream r32937 to fix symbol collision w/ truncate on BSD r=norbert + +http://bugs.icu-project.org/trac/ticket/10290 +diff --git a/intl/icu/source/tools/genrb/derb.c b/intl/icu/source/tools/genrb/derb.c +--- a/intl/icu/source/tools/genrb/derb.c ++++ b/intl/icu/source/tools/genrb/derb.c +@@ -49,17 +49,17 @@ + #define DERB_VERSION "1.0" + + #define DERB_DEFAULT_TRUNC 80 + + static UConverter *defaultConverter = 0; + + static const int32_t indentsize = 4; + static int32_t truncsize = DERB_DEFAULT_TRUNC; +-static UBool truncate = FALSE; ++static UBool opt_truncate = FALSE; + + static const char *getEncodingName(const char *encoding); + static void reportError(const char *pname, UErrorCode *status, const char *when); + static UChar *quotedString(const UChar *string); + static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *resource, int32_t indent, const char *pname, UErrorCode *status); + static void printString(FILE *out, UConverter *converter, const UChar *str, int32_t len); + static void printCString(FILE *out, UConverter *converter, const char *str, int32_t len); + static void printIndent(FILE *out, UConverter *converter, int32_t indent); +@@ -147,24 +147,24 @@ main(int argc, char* argv[]) { + encoding = options[2].value; + } + + if (options[3].doesOccur) { + tostdout = 1; + } + + if(options[4].doesOccur) { +- truncate = TRUE; ++ opt_truncate = TRUE; + if(options[4].value != NULL) { + truncsize = atoi(options[4].value); /* user defined printable size */ + } else { + truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */ + } + } else { +- truncate = FALSE; ++ opt_truncate = FALSE; + } + + if(options[5].doesOccur) { + verbose = TRUE; + } + + if (options[6].doesOccur) { + outputDir = options[6].value; +@@ -468,17 +468,17 @@ static void printHex(FILE *out, UConvert + printString(out, converter, hex, (int32_t)(sizeof(hex)/sizeof(*hex))); + } + + static void printOutAlias(FILE *out, UConverter *converter, UResourceBundle *parent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCode *status) { + static const UChar cr[] = { '\n' }; + int32_t len = 0; + const UChar* thestr = res_getAlias(&(parent->fResData), r, &len); + UChar *string = quotedString(thestr); +- if(truncate && len > truncsize) { ++ if(opt_truncate && len > truncsize) { + char msg[128]; + printIndent(out, converter, indent); + sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", + (long)len, (long)truncsize/2); + printCString(out, converter, msg, -1); + len = truncsize; + } + if(U_SUCCESS(*status)) { +@@ -512,17 +512,17 @@ static void printOutBundle(FILE *out, UC + switch(ures_getType(resource)) { + case URES_STRING : + { + int32_t len=0; + const UChar* thestr = ures_getString(resource, &len, status); + UChar *string = quotedString(thestr); + + /* TODO: String truncation */ +- if(truncate && len > truncsize) { ++ if(opt_truncate && len > truncsize) { + char msg[128]; + printIndent(out, converter, indent); + sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", + (long)len, (long)(truncsize/2)); + printCString(out, converter, msg, -1); + len = truncsize/2; + } + printIndent(out, converter, indent); +@@ -571,17 +571,17 @@ static void printOutBundle(FILE *out, UC + } + printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr))); + break; + } + case URES_BINARY : + { + int32_t len = 0; + const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status); +- if(truncate && len > truncsize) { ++ if(opt_truncate && len > truncsize) { + char msg[128]; + printIndent(out, converter, indent); + sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", + (long)len, (long)(truncsize/2)); + printCString(out, converter, msg, -1); + len = truncsize; + } + if(U_SUCCESS(*status)) { + diff --git a/intl/icu/source/tools/genrb/derb.c b/intl/icu/source/tools/genrb/derb.c index 2a48d98f542..4aff26e0bda 100644 --- a/intl/icu/source/tools/genrb/derb.c +++ b/intl/icu/source/tools/genrb/derb.c @@ -54,7 +54,7 @@ static UConverter *defaultConverter = 0; static const int32_t indentsize = 4; static int32_t truncsize = DERB_DEFAULT_TRUNC; -static UBool truncate = FALSE; +static UBool opt_truncate = FALSE; static const char *getEncodingName(const char *encoding); static void reportError(const char *pname, UErrorCode *status, const char *when); @@ -152,14 +152,14 @@ main(int argc, char* argv[]) { } if(options[4].doesOccur) { - truncate = TRUE; + opt_truncate = TRUE; if(options[4].value != NULL) { truncsize = atoi(options[4].value); /* user defined printable size */ } else { truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */ } } else { - truncate = FALSE; + opt_truncate = FALSE; } if(options[5].doesOccur) { @@ -473,7 +473,7 @@ static void printOutAlias(FILE *out, UConverter *converter, UResourceBundle *pa int32_t len = 0; const UChar* thestr = res_getAlias(&(parent->fResData), r, &len); UChar *string = quotedString(thestr); - if(truncate && len > truncsize) { + if(opt_truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", @@ -517,7 +517,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re UChar *string = quotedString(thestr); /* TODO: String truncation */ - if(truncate && len > truncsize) { + if(opt_truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", @@ -576,7 +576,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re { int32_t len = 0; const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status); - if(truncate && len > truncsize) { + if(opt_truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", diff --git a/intl/update-icu.sh b/intl/update-icu.sh index dbd38acd063..209c006753a 100755 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -41,5 +41,6 @@ svn info $1 > ${icu_dir}/SVN-INFO patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-724533 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-853706 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722 +patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722-2 hg addremove ${icu_dir} From 3bb7ed9858d0ea21ba21d7ca541388af3e7af156 Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 14 Aug 2013 13:05:06 +0200 Subject: [PATCH 15/98] Bug 899722 Part 3: Fix build on BSD after bug 853301 by properly enabling the ECMAScript intl API. r=glandium --- js/src/configure.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/configure.in b/js/src/configure.in index e3bae3cf45e..639ac3ad433 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4290,7 +4290,7 @@ if test -n "$ENABLE_INTL_API"; then WINNT) ICU_LIB_NAMES="icuin icuuc icudt" ;; - Darwin|Linux) + Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD) ICU_LIB_NAMES="icui18n icuuc icudata" ;; *) @@ -4337,6 +4337,9 @@ if test -n "$ENABLE_INTL_API" ; then WINNT) ICU_TARGET=MSYS/MSVC ;; + DragonFly|FreeBSD|NetBSD|OpenBSD) + ICU_TARGET=BSD + ;; esac # To reduce library size, use static linking From 85fbfe6f480622d82033951da76b4252bbd59230 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:17:47 +0200 Subject: [PATCH 16/98] Bug 904535 - Don't #include shared-libraries.h in Telemetry.h. r=vdjeric --- toolkit/components/telemetry/Telemetry.cpp | 3 +++ toolkit/components/telemetry/Telemetry.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 5d89949a43c..bcdd09ccf34 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -49,6 +49,9 @@ #include "mozilla/FileUtils.h" #include "mozilla/Preferences.h" #include "mozilla/mozPoisonWrite.h" +#if defined(MOZ_ENABLE_PROFILER_SPS) +#include "shared-libraries.h" +#endif namespace { diff --git a/toolkit/components/telemetry/Telemetry.h b/toolkit/components/telemetry/Telemetry.h index 35a2c7b620e..6da04892a69 100644 --- a/toolkit/components/telemetry/Telemetry.h +++ b/toolkit/components/telemetry/Telemetry.h @@ -11,9 +11,6 @@ #include "mozilla/StartupTimeline.h" #include "nsTArray.h" #include "nsStringGlue.h" -#if defined(MOZ_ENABLE_PROFILER_SPS) -#include "shared-libraries.h" -#endif namespace base { class Histogram; From 75c769f7a63cc4d3182e7d249bdbf12d7953b1dc Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:19:08 +0200 Subject: [PATCH 17/98] Bug 904536 - Remove nsNativeWidget.h. r=roc --- widget/moz.build | 1 - widget/nsIWidget.h | 6 +++++- widget/nsNativeWidget.h | 14 -------------- 3 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 widget/nsNativeWidget.h diff --git a/widget/moz.build b/widget/moz.build index e0fd3545bd3..7c5b22362f6 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -107,7 +107,6 @@ EXPORTS += [ 'nsIRollupListener.h', 'nsIWidget.h', 'nsIWidgetListener.h', - 'nsNativeWidget.h', 'nsWidgetInitData.h', 'nsWidgetsCID.h', ] diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 59ab1542444..f9520b21fbb 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -14,7 +14,6 @@ #include "nsEvent.h" #include "nsCOMPtr.h" #include "nsITheme.h" -#include "nsNativeWidget.h" #include "nsWidgetInitData.h" #include "nsTArray.h" #include "nsXULAppAPI.h" @@ -62,6 +61,11 @@ class DrawTarget; */ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event); +// Hide the native window system's real window type so as to avoid +// including native window system types and APIs. This is necessary +// to ensure cross-platform code. +typedef void* nsNativeWidget; + /** * Flags for the getNativeData function. * See getNativeData() diff --git a/widget/nsNativeWidget.h b/widget/nsNativeWidget.h deleted file mode 100644 index 0003e3ab8e0..00000000000 --- a/widget/nsNativeWidget.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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/. */ - -#ifndef nsNativeWidget_h__ -#define nsNativeWidget_h__ - -// Hide the native window systems real window type so as to avoid -// including native window system types and APIs. This is necessary -// to ensure cross-platform code. -typedef void* nsNativeWidget; - -#endif // nsNativeWidget_h__ From 97605b2c55bf9b47a55f439eba70f064b6991399 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:19:55 +0200 Subject: [PATCH 18/98] Bug 904538 - Don't #include nsITheme.h in nsIWidget.h. r=roc --- gfx/src/nsITheme.h | 7 ------- layout/generic/nsIFrame.h | 1 + widget/nsIWidget.h | 12 +++++++++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index 618f2f04427..834ba6c1315 100644 --- a/gfx/src/nsITheme.h +++ b/gfx/src/nsITheme.h @@ -34,13 +34,6 @@ class nsIWidget; #define NS_THEMERENDERER_CID \ { 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } } -enum nsTransparencyMode { - eTransparencyOpaque = 0, // Fully opaque - eTransparencyTransparent, // Parts of the window may be transparent - eTransparencyGlass, // Transparent parts of the window have Vista AeroGlass effect applied - eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass -}; - /** * nsITheme is a service that provides platform-specific native * rendering for widgets. In other words, it provides the necessary diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index ebe31271c53..1f77799856d 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -35,6 +35,7 @@ #include "mozilla/TypedEnum.h" #include "nsDirection.h" #include +#include "nsITheme.h" #ifdef ACCESSIBILITY #include "mozilla/a11y/AccTypes.h" diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index f9520b21fbb..8ddced50b5a 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -13,7 +13,6 @@ #include "nsEvent.h" #include "nsCOMPtr.h" -#include "nsITheme.h" #include "nsWidgetInitData.h" #include "nsTArray.h" #include "nsXULAppAPI.h" @@ -111,6 +110,17 @@ typedef void* nsNativeWidget; #define NS_STYLE_WINDOW_SHADOW_TOOLTIP 3 #define NS_STYLE_WINDOW_SHADOW_SHEET 4 +/** + * Transparency modes + */ + +enum nsTransparencyMode { + eTransparencyOpaque = 0, // Fully opaque + eTransparencyTransparent, // Parts of the window may be transparent + eTransparencyGlass, // Transparent parts of the window have Vista AeroGlass effect applied + eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass +}; + /** * Cursor types. */ From a8a66130d6a886d7bc558f5c9ac66e628dfe9161 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:29:11 +0200 Subject: [PATCH 19/98] Bug 904539 - Don't #include ImageLoader.h in nsIFrame.h. r=roc --- layout/generic/nsFrame.cpp | 15 +++++++++++++++ layout/generic/nsIFrame.h | 15 +-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index a5550603803..199678c1d7a 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3537,6 +3537,21 @@ nsIFrame::ContentOffsets nsFrame::CalcContentOffsetsFromFramePoint(nsPoint aPoin return OffsetsForSingleFrame(this, aPoint); } +void +nsIFrame::AssociateImage(const nsStyleImage& aImage, nsPresContext* aPresContext) +{ + if (aImage.GetType() != eStyleImageType_Image) { + return; + } + + imgIRequest *req = aImage.GetImageData(); + mozilla::css::ImageLoader* loader = + aPresContext->Document()->StyleImageLoader(); + + // If this fails there's not much we can do ... + loader->AssociateRequestToFrame(req, this); +} + NS_IMETHODIMP nsFrame::GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 1f77799856d..1ef13e5e0b0 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -30,7 +30,6 @@ #include "nsIContent.h" #include "nsAlgorithm.h" #include "mozilla/layout/FrameChildList.h" -#include "mozilla/css/ImageLoader.h" #include "FramePropertyTable.h" #include "mozilla/TypedEnum.h" #include "nsDirection.h" @@ -1366,19 +1365,7 @@ public: * Ensure that aImage gets notifed when the underlying image request loads * or animates. */ - void AssociateImage(const nsStyleImage& aImage, nsPresContext* aPresContext) - { - if (aImage.GetType() != eStyleImageType_Image) { - return; - } - - imgIRequest *req = aImage.GetImageData(); - mozilla::css::ImageLoader* loader = - aPresContext->Document()->StyleImageLoader(); - - // If this fails there's not much we can do ... - loader->AssociateRequestToFrame(req, this); - } + void AssociateImage(const nsStyleImage& aImage, nsPresContext* aPresContext); /** * This structure holds information about a cursor. mContainer represents a From de5b68c553c1d60a31e1c822afc8c03fedfa41cf Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:29:51 +0200 Subject: [PATCH 20/98] Bug 904540 - Don't #include nsRefreshDriver.h in nsPresContext.h. r=roc --- layout/base/nsPresContext.cpp | 25 +++++++++++++++++++++++++ layout/base/nsPresContext.h | 18 +++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 79b258b5851..93ec5adb68c 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -69,6 +69,7 @@ #include "mozilla/dom/PBrowserChild.h" #include "mozilla/dom/TabChild.h" #include "RestyleManager.h" +#include "nsRefreshDriver.h" #ifdef IBMBIDI #include "nsBidiPresUtils.h" @@ -1509,6 +1510,30 @@ nsPresContext::GetContainerExternal() const return GetContainerInternal(); } +bool +nsPresContext::ThrottledStyleIsUpToDate() const +{ + return mLastUpdateThrottledStyle == mRefreshDriver->MostRecentRefresh(); +} + +void +nsPresContext::TickLastUpdateThrottledStyle() +{ + mLastUpdateThrottledStyle = mRefreshDriver->MostRecentRefresh(); +} + +bool +nsPresContext::StyleUpdateForAllAnimationsIsUpToDate() +{ + return mLastStyleUpdateForAllAnimations == mRefreshDriver->MostRecentRefresh(); +} + +void +nsPresContext::TickLastStyleUpdateForAllAnimations() +{ + mLastStyleUpdateForAllAnimations = mRefreshDriver->MostRecentRefresh(); +} + #ifdef IBMBIDI bool nsPresContext::BidiEnabledExternal() const diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 634b61d795a..5f0174f7b7c 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -35,7 +35,6 @@ #include "mozilla/TimeStamp.h" #include "prclist.h" #include "Layers.h" -#include "nsRefreshDriver.h" #ifdef IBMBIDI class nsBidiPresUtils; @@ -71,6 +70,7 @@ class nsTransitionManager; class nsAnimationManager; class imgIContainer; class nsIDOMMediaQueryList; +class nsRefreshDriver; #ifdef MOZ_REFLOW_PERF class nsRenderingContext; @@ -690,18 +690,10 @@ public: /** * Getter and setter for OMTA time counters */ - bool ThrottledStyleIsUpToDate() const { - return mLastUpdateThrottledStyle == mRefreshDriver->MostRecentRefresh(); - } - void TickLastUpdateThrottledStyle() { - mLastUpdateThrottledStyle = mRefreshDriver->MostRecentRefresh(); - } - bool StyleUpdateForAllAnimationsIsUpToDate() const { - return mLastStyleUpdateForAllAnimations == mRefreshDriver->MostRecentRefresh(); - } - void TickLastStyleUpdateForAllAnimations() { - mLastStyleUpdateForAllAnimations = mRefreshDriver->MostRecentRefresh(); - } + bool ThrottledStyleIsUpToDate() const; + void TickLastUpdateThrottledStyle(); + bool StyleUpdateForAllAnimationsIsUpToDate(); + void TickLastStyleUpdateForAllAnimations(); #ifdef IBMBIDI /** From ed4042636b4d59597f74b2cd108cbfa1063ceab3 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 14 Aug 2013 13:33:03 +0200 Subject: [PATCH 21/98] Bug 904541 - Don't #include Layers.h in nsPresContext.h. r=roc --- layout/base/FrameLayerBuilder.cpp | 2 +- layout/base/nsDisplayList.cpp | 6 ++---- layout/base/nsLayoutUtils.h | 1 + layout/base/nsPresContext.cpp | 25 +++++++++++++++++++++++++ layout/base/nsPresContext.h | 20 +++++++------------- layout/base/nsRefreshDriver.cpp | 1 + layout/generic/nsIFrame.h | 2 ++ layout/style/nsComputedDOMStyle.h | 1 + 8 files changed, 40 insertions(+), 18 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 3563960d24b..9f73a753514 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2962,7 +2962,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, containerLayer->SetContentFlags(flags); mContainerLayerGeneration = oldGeneration; - containerLayer->SetUserData(&gNotifySubDocInvalidationData, nullptr); + nsPresContext::ClearNotifySubDocInvalidationData(containerLayer); return containerLayer.forget(); } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 1b63d16a72e..324141dc62c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3032,14 +3032,12 @@ already_AddRefed nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerParameters& aContainerParameters) { - nsRefPtr layer = aManager->GetLayerBuilder()-> + nsRefPtr layer = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList, aContainerParameters, nullptr); if (mFlags & GENERATE_SUBDOC_INVALIDATIONS) { - ContainerLayerPresContext* pres = new ContainerLayerPresContext; - pres->mPresContext = mFrame->PresContext(); - layer->SetUserData(&gNotifySubDocInvalidationData, pres); + mFrame->PresContext()->SetNotifySubDocInvalidationData(layer); } return layer.forget(); } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 7da8306f94a..00b40b6c194 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -35,6 +35,7 @@ class nsIImageLoadingContent; #include "nsHTMLReflowState.h" #include "nsIFrameLoader.h" #include "FrameMetrics.h" +#include "gfx3DMatrix.h" #include #include diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 93ec5adb68c..2d313abea6c 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -70,6 +70,7 @@ #include "mozilla/dom/TabChild.h" #include "RestyleManager.h" #include "nsRefreshDriver.h" +#include "Layers.h" #ifdef IBMBIDI #include "nsBidiPresUtils.h" @@ -95,6 +96,16 @@ using namespace mozilla::layers; uint8_t gNotifySubDocInvalidationData; +/** + * Layer UserData for ContainerLayers that want to be notified + * of local invalidations of them and their descendant layers. + * Pass a callback to ComputeDifferences to have these called. + */ +class ContainerLayerPresContext : public LayerUserData { +public: + nsPresContext* mPresContext; +}; + namespace { class CharSetChangingRunnable : public nsRunnable @@ -2352,6 +2363,20 @@ nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer, } } +void +nsPresContext::SetNotifySubDocInvalidationData(ContainerLayer* aContainer) +{ + ContainerLayerPresContext* pres = new ContainerLayerPresContext; + pres->mPresContext = this; + aContainer->SetUserData(&gNotifySubDocInvalidationData, pres); +} + +/* static */ void +nsPresContext::ClearNotifySubDocInvalidationData(ContainerLayer* aContainer) +{ + aContainer->SetUserData(&gNotifySubDocInvalidationData, nullptr); +} + struct NotifyDidPaintSubdocumentCallbackClosure { uint32_t mFlags; bool mNeedsAnotherDidPaintNotification; diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 5f0174f7b7c..8ec9b9f88cd 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -34,7 +34,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/TimeStamp.h" #include "prclist.h" -#include "Layers.h" +#include "nsThreadUtils.h" #ifdef IBMBIDI class nsBidiPresUtils; @@ -77,7 +77,10 @@ class nsRenderingContext; #endif namespace mozilla { - class RestyleManager; +class RestyleManager; +namespace layers { +class ContainerLayer; +} } // supported values for cached bool types @@ -125,17 +128,6 @@ public: nsTArray mRequests; }; -/** - * Layer UserData for ContainerLayers that want to be notified - * of local invalidations of them and their descendant layers. - * Pass a callback to ComputeDifferences to have these called. - */ -class ContainerLayerPresContext : public mozilla::layers::LayerUserData { -public: - nsPresContext* mPresContext; -}; -extern uint8_t gNotifySubDocInvalidationData; - /* Used by nsPresContext::HasAuthorSpecifiedRules */ #define NS_AUTHOR_SPECIFIED_BACKGROUND (1 << 0) #define NS_AUTHOR_SPECIFIED_BORDER (1 << 1) @@ -897,6 +889,8 @@ public: // Passed to LayerProperties::ComputeDifference static void NotifySubDocInvalidation(mozilla::layers::ContainerLayer* aContainer, const nsIntRegion& aRegion); + void SetNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer); + static void ClearNotifySubDocInvalidationData(mozilla::layers::ContainerLayer* aContainer); bool IsDOMPaintEventPending(); void ClearMozAfterPaintEvents() { mInvalidateRequestsSinceLastPaint.mRequests.Clear(); diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 2c0555381c8..c5215d19800 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -49,6 +49,7 @@ typedef HRESULT (WINAPI*DwmGetCompositionTimingInfoProc)(HWND hWnd, DWM_TIMING_I #include "nsPerformance.h" #include "mozilla/dom/WindowBinding.h" #include "RestyleManager.h" +#include "Layers.h" using mozilla::TimeStamp; using mozilla::TimeDuration; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 1ef13e5e0b0..06241eda886 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -35,6 +35,8 @@ #include "nsDirection.h" #include #include "nsITheme.h" +#include "gfx3DMatrix.h" +#include "gfxASurface.h" #ifdef ACCESSIBILITY #include "mozilla/a11y/AccTypes.h" diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index dc77197daef..6610af2f279 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -30,6 +30,7 @@ class nsIPresShell; class nsDOMCSSValueList; class nsROCSSPrimitiveValue; class nsStyleContext; +class gfx3DMatrix; class nsComputedDOMStyle MOZ_FINAL : public nsDOMCSSDeclaration { From b477343b253d4589eb1075100caedce4d0e240ba Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 12 Aug 2013 23:55:28 +0200 Subject: [PATCH 22/98] Bug 900201 - Implement GfxInfo on gonk - r=ehsan --- widget/gonk/GfxInfo.cpp | 159 ++++++++++++++++++++++++++++++++ widget/gonk/GfxInfo.h | 57 ++++++++++++ widget/gonk/moz.build | 1 + widget/gonk/nsWidgetFactory.cpp | 13 +++ 4 files changed, 230 insertions(+) create mode 100644 widget/gonk/GfxInfo.cpp create mode 100644 widget/gonk/GfxInfo.h diff --git a/widget/gonk/GfxInfo.cpp b/widget/gonk/GfxInfo.cpp new file mode 100644 index 00000000000..3d1c3234028 --- /dev/null +++ b/widget/gonk/GfxInfo.cpp @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#include "GfxInfo.h" + +using namespace mozilla::widget; + +/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization + * has occurred because they depend on it for information. (See bug 591561) */ +nsresult +GfxInfo::GetD2DEnabled(bool *aEnabled) +{ + return NS_ERROR_FAILURE; +} + +nsresult +GfxInfo::GetDWriteEnabled(bool *aEnabled) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString DWriteVersion; */ +NS_IMETHODIMP +GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString cleartypeParameters; */ +NS_IMETHODIMP +GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterDescription; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription) +{ + aAdapterDescription.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterDescription2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterRAM; */ +NS_IMETHODIMP +GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM) +{ + aAdapterRAM.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterRAM2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterDriver; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver) +{ + aAdapterDriver.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterDriver2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterDriverVersion; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion) +{ + aAdapterDriverVersion.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterDriverVersion2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterDriverDate; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate) +{ + aAdapterDriverDate.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterDriverDate2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterVendorID; */ +NS_IMETHODIMP +GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID) +{ + aAdapterVendorID.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterVendorID2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute DOMString adapterDeviceID; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID) +{ + aAdapterDeviceID.AssignLiteral(""); + return NS_OK; +} + +/* readonly attribute DOMString adapterDeviceID2; */ +NS_IMETHODIMP +GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) +{ + return NS_ERROR_FAILURE; +} + +/* readonly attribute boolean isGPU2Active; */ +NS_IMETHODIMP +GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) +{ + return NS_ERROR_FAILURE; +} + +const nsTArray& +GfxInfo::GetGfxDriverInfo() +{ + return *mDriverInfo; +} + +uint32_t GfxInfo::OperatingSystemVersion() const +{ + return 0; +} diff --git a/widget/gonk/GfxInfo.h b/widget/gonk/GfxInfo.h new file mode 100644 index 00000000000..75c8f98797c --- /dev/null +++ b/widget/gonk/GfxInfo.h @@ -0,0 +1,57 @@ +/* vim: se cin sw=2 ts=2 et : */ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * 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/. */ + +#ifndef __mozilla_widget_GfxInfo_h__ +#define __mozilla_widget_GfxInfo_h__ + +#include "GfxInfoBase.h" +#include "GfxDriverInfo.h" + +#include "nsString.h" + +namespace mozilla { +namespace widget { + +class GfxInfo : public GfxInfoBase +{ +public: + // We only declare the subset of nsIGfxInfo that we actually implement. The + // rest is brought forward from GfxInfoBase. + NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled); + NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled); + NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion); + NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams); + NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription); + NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); + NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); + NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); + NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); + NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); + NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription); + NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); + NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); + NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); + NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); + NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); + NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); + NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active); + using GfxInfoBase::GetFeatureStatus; + using GfxInfoBase::GetFeatureSuggestedDriverVersion; + using GfxInfoBase::GetWebGLParameter; + + virtual uint32_t OperatingSystemVersion() const; + +protected: + + virtual const nsTArray& GetGfxDriverInfo(); +}; + +} // namespace widget +} // namespace mozilla + +#endif /* __mozilla_widget_GfxInfo_h__ */ diff --git a/widget/gonk/moz.build b/widget/gonk/moz.build index bf37f187277..8bd0de5ba5d 100644 --- a/widget/gonk/moz.build +++ b/widget/gonk/moz.build @@ -53,6 +53,7 @@ CPP_SOURCES += [ 'nsLookAndFeel.cpp', 'nsWidgetFactory.cpp', 'nsWindow.cpp', + 'GfxInfo.cpp', ] if CONFIG['ANDROID_VERSION'] == '15': diff --git a/widget/gonk/nsWidgetFactory.cpp b/widget/gonk/nsWidgetFactory.cpp index 934828af8c8..78c6bae7e95 100644 --- a/widget/gonk/nsWidgetFactory.cpp +++ b/widget/gonk/nsWidgetFactory.cpp @@ -36,6 +36,16 @@ using namespace mozilla::widget; +// taken from android/nsWidgetFactory.cpp. GfxInfo is a legacy kludge, unfortunately +// for the time being we still have to implement it on all platforms. +#include "GfxInfo.h" +namespace mozilla { +namespace widget { +// This constructor should really be shared with all platforms. +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) +} +} + NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk) NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetScreenManager) @@ -50,6 +60,7 @@ NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); +NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); static nsresult ScreenManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) @@ -67,6 +78,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor }, { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor }, + { &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor }, { NULL } }; @@ -78,6 +90,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, + { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, { NULL } }; From 7e5943c8be3cc7311f01ba543e3e9a65b4138d53 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 26 Jul 2013 16:48:35 +0100 Subject: [PATCH 23/98] bug 879963 - reftests for regressions caused when multiple rules refer to the same proxy. r=jdaggett --- .../dynamic-duplicate-rule-1-ref.html | 35 ++++++++ .../font-face/dynamic-duplicate-rule-1a.html | 65 ++++++++++++++ .../font-face/dynamic-duplicate-rule-1b.html | 59 +++++++++++++ .../font-face/dynamic-duplicate-rule-1c.html | 85 +++++++++++++++++++ layout/reftests/font-face/reftest.list | 5 ++ 5 files changed, 249 insertions(+) create mode 100644 layout/reftests/font-face/dynamic-duplicate-rule-1-ref.html create mode 100644 layout/reftests/font-face/dynamic-duplicate-rule-1a.html create mode 100644 layout/reftests/font-face/dynamic-duplicate-rule-1b.html create mode 100644 layout/reftests/font-face/dynamic-duplicate-rule-1c.html diff --git a/layout/reftests/font-face/dynamic-duplicate-rule-1-ref.html b/layout/reftests/font-face/dynamic-duplicate-rule-1-ref.html new file mode 100644 index 00000000000..ce1b30b3ef4 --- /dev/null +++ b/layout/reftests/font-face/dynamic-duplicate-rule-1-ref.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + +
+foo bar baz +
+ + + diff --git a/layout/reftests/font-face/dynamic-duplicate-rule-1a.html b/layout/reftests/font-face/dynamic-duplicate-rule-1a.html new file mode 100644 index 00000000000..215f09f3510 --- /dev/null +++ b/layout/reftests/font-face/dynamic-duplicate-rule-1a.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + +
+foo bar baz +
+ + + diff --git a/layout/reftests/font-face/dynamic-duplicate-rule-1b.html b/layout/reftests/font-face/dynamic-duplicate-rule-1b.html new file mode 100644 index 00000000000..647bf53d910 --- /dev/null +++ b/layout/reftests/font-face/dynamic-duplicate-rule-1b.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + +
+foo bar baz +
+ + + diff --git a/layout/reftests/font-face/dynamic-duplicate-rule-1c.html b/layout/reftests/font-face/dynamic-duplicate-rule-1c.html new file mode 100644 index 00000000000..16fcb3437e8 --- /dev/null +++ b/layout/reftests/font-face/dynamic-duplicate-rule-1c.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + +
+foo bar baz +
+ + + diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 3bbe27d6813..25d00cdfaea 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -153,3 +153,8 @@ HTTP(..) != font-error-404-1.html font-error-404-2.html # sanity-check that the # Font load redirection HTTP(..) == font-redirect.html order-1-ref.html + +# Tests for potential regressions from bug 879963 +== dynamic-duplicate-rule-1a.html dynamic-duplicate-rule-1-ref.html +== dynamic-duplicate-rule-1b.html dynamic-duplicate-rule-1-ref.html +== dynamic-duplicate-rule-1c.html dynamic-duplicate-rule-1-ref.html From 5ef7fb8ecef0dfc0c08fb0552eac8f355e7a8aec Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 14 Aug 2013 13:27:20 +0100 Subject: [PATCH 24/98] bug 904555 - clean up use of nsRect APIs in layout. r=roc --- layout/generic/nsBlockFrame.cpp | 4 ++-- layout/generic/nsFrame.cpp | 2 +- layout/generic/nsIFrame.h | 4 ++-- layout/tables/nsTableRowFrame.cpp | 7 +++---- layout/tables/nsTableRowGroupFrame.cpp | 2 +- layout/xul/base/src/nsBox.cpp | 2 +- layout/xul/base/src/nsImageBoxFrame.cpp | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 9ca88b983b5..7c9964c0934 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -3039,7 +3039,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // construct the html reflow state for the block. ReflowBlock // will initialize it nsHTMLReflowState blockHtmlRS(aState.mPresContext, aState.mReflowState, frame, - nsSize(availSpace.width, availSpace.height)); + availSpace.Size()); blockHtmlRS.mFlags.mHasClearance = aLine->HasClearance(); nsFloatManager::SavedState floatManagerState; @@ -5730,7 +5730,7 @@ nsBlockFrame::ComputeFloatWidth(nsBlockReflowState& aState, aFloat); nsHTMLReflowState floatRS(aState.mPresContext, aState.mReflowState, aFloat, - nsSize(availSpace.width, availSpace.height)); + availSpace.Size()); return floatRS.ComputedWidth() + floatRS.mComputedBorderPadding.LeftRight() + floatRS.mComputedMargin.LeftRight(); } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 199678c1d7a..4b0c016d679 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -7715,7 +7715,7 @@ nsFrame::DoLayout(nsBoxLayoutState& aState) // ensure our size is what we think is should be. Someone could have // reset the frame to be smaller or something dumb like that. - SetSize(nsSize(ourRect.width, ourRect.height)); + SetSize(ourRect.Size()); } } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 06241eda886..494424d0b51 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -830,8 +830,8 @@ public: * position. */ nsRect GetRect() const { return mRect; } - nsPoint GetPosition() const { return nsPoint(mRect.x, mRect.y); } - nsSize GetSize() const { return nsSize(mRect.width, mRect.height); } + nsPoint GetPosition() const { return mRect.TopLeft(); } + nsSize GetSize() const { return mRect.Size(); } /** * When we change the size of the frame's border-box rect, we may need to diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index c1e6dba25c7..f95da67a702 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -1260,8 +1260,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset, // collapse the cell! nsRect cellBounds(0, 0, cRect.width, cRect.height); nsOverflowAreas cellOverflow(cellBounds, cellBounds); - cellFrame->FinishAndStoreOverflow(cellOverflow, - nsSize(cRect.width, cRect.height)); + cellFrame->FinishAndStoreOverflow(cellOverflow, cRect.Size()); nsTableFrame::RePositionViews(cellFrame); ConsiderChildOverflow(overflow, cellFrame); @@ -1276,8 +1275,8 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset, } SetRect(rowRect); - overflow.UnionAllWith(nsRect(0,0,rowRect.width, rowRect.height)); - FinishAndStoreOverflow(overflow, nsSize(rowRect.width, rowRect.height)); + overflow.UnionAllWith(nsRect(0, 0, rowRect.width, rowRect.height)); + FinishAndStoreOverflow(overflow, rowRect.Size()); nsTableFrame::RePositionViews(this); nsTableFrame::InvalidateTableFrame(this, oldRect, oldVisualOverflow, false); diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index c984782e34a..11156858489 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -837,7 +837,7 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset, SetRect(groupRect); overflow.UnionAllWith(nsRect(0, 0, groupRect.width, groupRect.height)); - FinishAndStoreOverflow(overflow, nsSize(groupRect.width, groupRect.height)); + FinishAndStoreOverflow(overflow, groupRect.Size()); nsTableFrame::RePositionViews(this); nsTableFrame::InvalidateTableFrame(this, oldGroupRect, oldGroupVisualOverflow, false); diff --git a/layout/xul/base/src/nsBox.cpp b/layout/xul/base/src/nsBox.cpp index 84e03f8f54f..ada6abe677d 100644 --- a/layout/xul/base/src/nsBox.cpp +++ b/layout/xul/base/src/nsBox.cpp @@ -245,7 +245,7 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, bool aRemoveOver flags |= stateFlags; if ((flags & NS_FRAME_NO_MOVE_FRAME) == NS_FRAME_NO_MOVE_FRAME) - SetSize(nsSize(aRect.width, aRect.height)); + SetSize(aRect.Size()); else SetRect(aRect); diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index e0147855e73..ac4e82f3306 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -496,7 +496,7 @@ nsImageBoxFrame::GetPrefSize(nsBoxLayoutState& aState) GetImageSize(); if (!mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0)) - size = nsSize(mSubRect.width, mSubRect.height); + size = mSubRect.Size(); else size = mImageSize; From f628f6553148bb394a1bf19dcdb7011b56efc8ce Mon Sep 17 00:00:00 2001 From: Christian Holler Date: Wed, 14 Aug 2013 15:54:02 +0200 Subject: [PATCH 25/98] Bug 902132 - Disable WebGL gl-max-texture-dimensions test on Mesa. r=bjacob --HG-- extra : rebase_source : 612e6de1a09be531e9ec05c57b696c7e6345f038 --- content/canvas/test/webgl/skipped_tests_linux_mesa.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/content/canvas/test/webgl/skipped_tests_linux_mesa.txt b/content/canvas/test/webgl/skipped_tests_linux_mesa.txt index 194c3176a72..66a503cdd33 100644 --- a/content/canvas/test/webgl/skipped_tests_linux_mesa.txt +++ b/content/canvas/test/webgl/skipped_tests_linux_mesa.txt @@ -1,3 +1,4 @@ +conformance/limits/gl-max-texture-dimensions.html conformance/misc/type-conversion-test.html conformance/reading/read-pixels-test.html conformance/textures/texture-mips.html From 1f509d1e9bfea3fa66feac0135c7f5a7ed4ea439 Mon Sep 17 00:00:00 2001 From: Guillaume Abadie Date: Wed, 14 Aug 2013 10:07:08 -0400 Subject: [PATCH 26/98] bug 899855 - GLContext parse GL_VERSION - r=jgilbert --- gfx/gl/GLContext.cpp | 126 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 4 deletions(-) diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 7b1217c8938..589be4d58f7 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -131,10 +131,116 @@ NS_MEMORY_REPORTER_IMPLEMENT(TextureMemoryUsage, GetTextureMemoryUsage, "Memory used for storing GL textures.") -/* - * XXX - we should really know the ARB/EXT variants of these - * instead of only handling the symbol if it's exposed directly. - */ +static bool +ParseGLVersion(GLContext* gl, unsigned int* version) +{ + GLenum error = gl->fGetError(); + if (error != LOCAL_GL_NO_ERROR) { + MOZ_ASSERT(false, "An OpenGL error has been triggered before."); + return false; + } + + { // Anon scope to allow identifier reuse + /** + * OpenGL 3.1 and OpenGL ES 3.0 both introduce GL_{MAJOR,MINOR}_VERSION + * with GetIntegerv. So we first try those constantes even we might not + * have an OpenGL, to prevent error in parsing GL_VERSION. + */ + GLint majorVersion = 0; + GLint minorVersion = 0; + + gl->fGetIntegerv(LOCAL_GL_MAJOR_VERSION, &majorVersion); + gl->fGetIntegerv(LOCAL_GL_MINOR_VERSION, &minorVersion); + + // If it's not an OpenGL (ES) 3.0, we will have an error + error = gl->fGetError(); + if (error == LOCAL_GL_NO_ERROR && + majorVersion > 0 && + minorVersion >= 0) + { + *version = majorVersion * 100 + minorVersion * 10; + return true; + } + } + + /** + * We were not able to use GL_{MAJOR,MINOR}_VERSION, so we parse + * GL_VERSION. + * + * + * OpenGL 2.x, 3.x, 4.x specifications: + * The VERSION and SHADING_LANGUAGE_VERSION strings are laid out as follows: + * + * + * + * The version number is either of the form major_number.minor_number or + * major_number.minor_number.release_number, where the numbers all have + * one or more digits. + * + * + * OpenGL ES 2.0, 3.0 specifications: + * The VERSION string is laid out as follows: + * + * "OpenGL ES N.M vendor-specific information" + * + * The version number is either of the form major_number.minor_number or + * major_number.minor_number.release_number, where the numbers all have + * one or more digits. + * + * + * Note: + * We don't care about release_number. + */ + const char* versionString = (const char*)gl->fGetString(LOCAL_GL_VERSION); + + error = gl->fGetError(); + if (error != LOCAL_GL_NO_ERROR) { + MOZ_ASSERT(false, "glGetString(GL_VERSION) has generated an error"); + return false; + } else if (!versionString) { + MOZ_ASSERT(false, "glGetString(GL_VERSION) has returned 0"); + return false; + } + + const char kGLESVersionPrefix[] = "OpenGL ES "; + if (strncmp(versionString, kGLESVersionPrefix, strlen(kGLESVersionPrefix)) == 0) { + versionString += strlen(kGLESVersionPrefix); + } + + const char* itr = versionString; + char* end = nullptr; + int majorVersion = (int)strtol(itr, &end, 10); + + if (!end) { + MOZ_ASSERT(false, "Failed to parse the GL major version number."); + return false; + } else if (*end != '.') { + MOZ_ASSERT(false, "Failed to parse GL's major-minor version number separator."); + return false; + } + + // we skip the '.' between the major and the minor version + itr = end + 1; + + end = nullptr; + + int minorVersion = (int)strtol(itr, &end, 10); + if (!end) { + MOZ_ASSERT(false, "Failed to parse GL's minor version number."); + return false; + } + + if (majorVersion <= 0 || majorVersion >= 100) { + MOZ_ASSERT(false, "Invalid major version."); + return false; + } else if (minorVersion < 0 || minorVersion >= 10) { + MOZ_ASSERT(false, "Invalid minor version."); + return false; + } + + *version = (unsigned int)(majorVersion * 100 + minorVersion * 10); + return true; +} bool GLContext::InitWithPrefix(const char *prefix, bool trygl) @@ -295,6 +401,18 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) mInitialized = LoadSymbols(&symbols[0], trygl, prefix); + if (mInitialized) { + unsigned int version = 0; + + bool parseSuccess = ParseGLVersion(this, &version); + + if (version >= mVersion) { + mVersion = version; + } else if (parseSuccess) { + MOZ_ASSERT(false, "Parsed version less than expected."); + } + } + // Load OpenGL ES 2.0 symbols, or desktop if we aren't using ES 2. if (mInitialized) { if (IsGLES2()) { From 1b339f3d88efac97f3a0439a397dbaa83c4666a0 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 14 Aug 2013 15:39:46 +0100 Subject: [PATCH 27/98] Backed out changeset e0eeacb439f2 (bug 900201) for B2G emulator build failures --- widget/gonk/GfxInfo.cpp | 159 -------------------------------- widget/gonk/GfxInfo.h | 57 ------------ widget/gonk/moz.build | 1 - widget/gonk/nsWidgetFactory.cpp | 13 --- 4 files changed, 230 deletions(-) delete mode 100644 widget/gonk/GfxInfo.cpp delete mode 100644 widget/gonk/GfxInfo.h diff --git a/widget/gonk/GfxInfo.cpp b/widget/gonk/GfxInfo.cpp deleted file mode 100644 index 3d1c3234028..00000000000 --- a/widget/gonk/GfxInfo.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "GfxInfo.h" - -using namespace mozilla::widget; - -/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization - * has occurred because they depend on it for information. (See bug 591561) */ -nsresult -GfxInfo::GetD2DEnabled(bool *aEnabled) -{ - return NS_ERROR_FAILURE; -} - -nsresult -GfxInfo::GetDWriteEnabled(bool *aEnabled) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString DWriteVersion; */ -NS_IMETHODIMP -GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString cleartypeParameters; */ -NS_IMETHODIMP -GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterDescription; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription) -{ - aAdapterDescription.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterDescription2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterRAM; */ -NS_IMETHODIMP -GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM) -{ - aAdapterRAM.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterRAM2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterDriver; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver) -{ - aAdapterDriver.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterDriver2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterDriverVersion; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion) -{ - aAdapterDriverVersion.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterDriverVersion2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterDriverDate; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate) -{ - aAdapterDriverDate.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterDriverDate2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterVendorID; */ -NS_IMETHODIMP -GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID) -{ - aAdapterVendorID.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterVendorID2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute DOMString adapterDeviceID; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID) -{ - aAdapterDeviceID.AssignLiteral(""); - return NS_OK; -} - -/* readonly attribute DOMString adapterDeviceID2; */ -NS_IMETHODIMP -GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID) -{ - return NS_ERROR_FAILURE; -} - -/* readonly attribute boolean isGPU2Active; */ -NS_IMETHODIMP -GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) -{ - return NS_ERROR_FAILURE; -} - -const nsTArray& -GfxInfo::GetGfxDriverInfo() -{ - return *mDriverInfo; -} - -uint32_t GfxInfo::OperatingSystemVersion() const -{ - return 0; -} diff --git a/widget/gonk/GfxInfo.h b/widget/gonk/GfxInfo.h deleted file mode 100644 index 75c8f98797c..00000000000 --- a/widget/gonk/GfxInfo.h +++ /dev/null @@ -1,57 +0,0 @@ -/* vim: se cin sw=2 ts=2 et : */ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * 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/. */ - -#ifndef __mozilla_widget_GfxInfo_h__ -#define __mozilla_widget_GfxInfo_h__ - -#include "GfxInfoBase.h" -#include "GfxDriverInfo.h" - -#include "nsString.h" - -namespace mozilla { -namespace widget { - -class GfxInfo : public GfxInfoBase -{ -public: - // We only declare the subset of nsIGfxInfo that we actually implement. The - // rest is brought forward from GfxInfoBase. - NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled); - NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled); - NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion); - NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams); - NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription); - NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver); - NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID); - NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID); - NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM); - NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion); - NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate); - NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription); - NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver); - NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID); - NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID); - NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM); - NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion); - NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate); - NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active); - using GfxInfoBase::GetFeatureStatus; - using GfxInfoBase::GetFeatureSuggestedDriverVersion; - using GfxInfoBase::GetWebGLParameter; - - virtual uint32_t OperatingSystemVersion() const; - -protected: - - virtual const nsTArray& GetGfxDriverInfo(); -}; - -} // namespace widget -} // namespace mozilla - -#endif /* __mozilla_widget_GfxInfo_h__ */ diff --git a/widget/gonk/moz.build b/widget/gonk/moz.build index 8bd0de5ba5d..bf37f187277 100644 --- a/widget/gonk/moz.build +++ b/widget/gonk/moz.build @@ -53,7 +53,6 @@ CPP_SOURCES += [ 'nsLookAndFeel.cpp', 'nsWidgetFactory.cpp', 'nsWindow.cpp', - 'GfxInfo.cpp', ] if CONFIG['ANDROID_VERSION'] == '15': diff --git a/widget/gonk/nsWidgetFactory.cpp b/widget/gonk/nsWidgetFactory.cpp index 78c6bae7e95..934828af8c8 100644 --- a/widget/gonk/nsWidgetFactory.cpp +++ b/widget/gonk/nsWidgetFactory.cpp @@ -36,16 +36,6 @@ using namespace mozilla::widget; -// taken from android/nsWidgetFactory.cpp. GfxInfo is a legacy kludge, unfortunately -// for the time being we still have to implement it on all platforms. -#include "GfxInfo.h" -namespace mozilla { -namespace widget { -// This constructor should really be shared with all platforms. -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) -} -} - NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk) NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetScreenManager) @@ -60,7 +50,6 @@ NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); -NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); static nsresult ScreenManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) @@ -78,7 +67,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = { { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor }, { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGonkConstructor }, { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor }, - { &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor }, { NULL } }; @@ -90,7 +78,6 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID }, { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID }, { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID }, - { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID }, { NULL } }; From 76be3e5ae785b58029c7cf3421c70095e331917b Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Wed, 14 Aug 2013 15:39:27 +0100 Subject: [PATCH 28/98] Bug 622284 - Write tests for input context menus. r=bbondy --- browser/base/content/test/Makefile.in | 4 +- .../base/content/test/contextmenu_common.js | 186 ++++++++++ .../base/content/test/subtst_contextmenu.html | 1 - .../base/content/test/test_contextmenu.html | 286 ++------------- .../content/test/test_contextmenu_input.html | 338 ++++++++++++++++++ 5 files changed, 555 insertions(+), 260 deletions(-) create mode 100644 browser/base/content/test/contextmenu_common.js create mode 100644 browser/base/content/test/test_contextmenu_input.html diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 745e3e921c0..07974075470 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -38,13 +38,15 @@ MOCHITEST_FILES = \ video.ogg \ $(NULL) -# test_contextmenu.html is disabled on Linux due to bug 513558 +# test_contextmenu.html and test_contextmenu_input are disabled on Linux due to bug 513558 ifndef MOZ_WIDGET_GTK MOCHITEST_FILES += \ audio.ogg \ privateBrowsingMode.js \ subtst_contextmenu.html \ + contextmenu_common.js \ test_contextmenu.html \ + test_contextmenu_input.html \ $(NULL) endif diff --git a/browser/base/content/test/contextmenu_common.js b/browser/base/content/test/contextmenu_common.js new file mode 100644 index 00000000000..1c32111c29d --- /dev/null +++ b/browser/base/content/test/contextmenu_common.js @@ -0,0 +1,186 @@ +var lastElement; + +function openContextMenuFor(element, shiftkey, waitForSpellCheck) { + // Context menu should be closed before we open it again. + is(SpecialPowers.wrap(contextMenu).state, "closed", "checking if popup is closed"); + + if (lastElement) + lastElement.blur(); + element.focus(); + + // Some elements need time to focus and spellcheck before any tests are + // run on them. + function actuallyOpenContextMenuFor() { + lastElement = element; + var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; + synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); + } + + if (waitForSpellCheck) + onSpellCheck(element, actuallyOpenContextMenuFor); + else + actuallyOpenContextMenuFor(); +} + +function closeContextMenu() { + contextMenu.hidePopup(); +} + +function getVisibleMenuItems(aMenu, aData) { + var items = []; + var accessKeys = {}; + for (var i = 0; i < aMenu.childNodes.length; i++) { + var item = aMenu.childNodes[i]; + if (item.hidden) + continue; + + var key = item.accessKey; + if (key) + key = key.toLowerCase(); + + var isGenerated = item.hasAttribute("generateditemid"); + + if (item.nodeName == "menuitem") { + var isSpellSuggestion = item.className == "spell-suggestion"; + if (isSpellSuggestion) { + is(item.id, "", "child menuitem #" + i + " is a spelling suggestion"); + } else if (isGenerated) { + is(item.id, "", "child menuitem #" + i + " is a generated item"); + } else { + ok(item.id, "child menuitem #" + i + " has an ID"); + } + var label = item.getAttribute("label"); + ok(label.length, "menuitem " + item.id + " has a label"); + if (isSpellSuggestion) { + is(key, "", "Spell suggestions shouldn't have an access key"); + items.push("*" + label); + } else if (isGenerated) { + items.push("+" + label); + } else if (item.id.indexOf("spell-check-dictionary-") != 0 && + item.id != "spell-no-suggestions") { + ok(key, "menuitem " + item.id + " has an access key"); + if (accessKeys[key]) + ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]); + else + accessKeys[key] = item.id; + } + if (!isSpellSuggestion && !isGenerated) { + items.push(item.id); + } + if (isGenerated) { + var p = {}; + p.type = item.getAttribute("type"); + p.icon = item.getAttribute("image"); + p.checked = item.hasAttribute("checked"); + p.disabled = item.hasAttribute("disabled"); + items.push(p); + } else { + items.push(!item.disabled); + } + } else if (item.nodeName == "menuseparator") { + ok(true, "--- seperator id is " + item.id); + items.push("---"); + items.push(null); + } else if (item.nodeName == "menu") { + if (isGenerated) { + item.id = "generated-submenu-" + aData.generatedSubmenuId++; + } + ok(item.id, "child menu #" + i + " has an ID"); + if (!isGenerated) { + ok(key, "menu has an access key"); + if (accessKeys[key]) + ok(false, "menu " + item.id + " has same accesskey as " + accessKeys[key]); + else + accessKeys[key] = item.id; + } + items.push(item.id); + items.push(!item.disabled); + // Add a dummy item to that the indexes in checkMenu are the same + // for expectedItems and actualItems. + items.push([]); + items.push(null); + } else { + ok(false, "child #" + i + " of menu ID " + aMenu.id + + " has an unknown type (" + item.nodeName + ")"); + } + } + return items; +} + +function checkContextMenu(expectedItems) { + is(contextMenu.state, "open", "checking if popup is open"); + var data = { generatedSubmenuId: 1 }; + checkMenu(contextMenu, expectedItems, data); +} + +/* + * checkMenu - checks to see if the specified contains the + * expected items and state. + * expectedItems is a array of (1) item IDs and (2) a boolean specifying if + * the item is enabled or not (or null to ignore it). Submenus can be checked + * by providing a nested array entry after the expected ID. + * For example: ["blah", true, // item enabled + * "submenu", null, // submenu + * ["sub1", true, // submenu contents + * "sub2", false], null, // submenu contents + * "lol", false] // item disabled + * + */ +function checkMenu(menu, expectedItems, data) { + var actualItems = getVisibleMenuItems(menu, data); + //ok(false, "Items are: " + actualItems); + for (var i = 0; i < expectedItems.length; i+=2) { + var actualItem = actualItems[i]; + var actualEnabled = actualItems[i + 1]; + var expectedItem = expectedItems[i]; + var expectedEnabled = expectedItems[i + 1]; + if (expectedItem instanceof Array) { + ok(true, "Checking submenu..."); + var menuID = expectedItems[i - 2]; // The last item was the menu ID. + var submenu = menu.getElementsByAttribute("id", menuID)[0]; + ok(submenu, "got a submenu element of id='" + menuID + "'"); + if (submenu) { + is(submenu.nodeName, "menu", "submenu element of id='" + menuID + + "' has expected nodeName"); + checkMenu(submenu.menupopup, expectedItem, data); + } + } else { + is(actualItem, expectedItem, + "checking item #" + i/2 + " (" + expectedItem + ") name"); + + if (typeof expectedEnabled == "object" && expectedEnabled != null || + typeof actualEnabled == "object" && actualEnabled != null) { + + ok(!(actualEnabled == null), "actualEnabled is not null"); + ok(!(expectedEnabled == null), "expectedEnabled is not null"); + is(typeof actualEnabled, typeof expectedEnabled, "checking types"); + + if (typeof actualEnabled != typeof expectedEnabled || + actualEnabled == null || expectedEnabled == null) + continue; + + is(actualEnabled.type, expectedEnabled.type, + "checking item #" + i/2 + " (" + expectedItem + ") type attr value"); + var icon = actualEnabled.icon; + if (icon) { + var tmp = ""; + var j = icon.length - 1; + while (j && icon[j] != "/") { + tmp = icon[j--] + tmp; + } + icon = tmp; + } + is(icon, expectedEnabled.icon, + "checking item #" + i/2 + " (" + expectedItem + ") icon attr value"); + is(actualEnabled.checked, expectedEnabled.checked, + "checking item #" + i/2 + " (" + expectedItem + ") has checked attr"); + is(actualEnabled.disabled, expectedEnabled.disabled, + "checking item #" + i/2 + " (" + expectedItem + ") has disabled attr"); + } else if (expectedEnabled != null) + is(actualEnabled, expectedEnabled, + "checking item #" + i/2 + " (" + expectedItem + ") enabled state"); + } + } + // Could find unexpected extra items at the end... + is(actualItems.length, expectedItems.length, "checking expected number of menu entries"); +} diff --git a/browser/base/content/test/subtst_contextmenu.html b/browser/base/content/test/subtst_contextmenu.html index 5f8a15ddae3..0a2c3fe7504 100644 --- a/browser/base/content/test/subtst_contextmenu.html +++ b/browser/base/content/test/subtst_contextmenu.html @@ -23,7 +23,6 @@ Browser context menu subtest.
chssseefsbbbie
-
DOM full screen FTW

I've got a context menu!

diff --git a/browser/base/content/test/test_contextmenu.html b/browser/base/content/test/test_contextmenu.html index 7c7697a3e7d..696c02c30be 100644 --- a/browser/base/content/test/test_contextmenu.html +++ b/browser/base/content/test/test_contextmenu.html @@ -16,41 +16,14 @@ Browser context menu tests.
 
 
+
 
+  
+  
+  
+
+
+Browser context menu tests for input.
+

+ +
+
+ +
+
+
+
+ + From b2b21d09fa4e8633f9631423df34d90e9c49cc0c Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Wed, 14 Aug 2013 12:12:01 +0100 Subject: [PATCH 29/98] Bug 673553 - Move all button attributes reflection tests to test_button_attributes_reflection.html. r=Ms2ger --- content/html/content/test/Makefile.in | 1 - .../test_button_attributes_reflection.html | 38 ++++++++++++ content/html/content/test/test_bug546995.html | 2 - content/html/content/test/test_bug566064.html | 59 ------------------- 4 files changed, 38 insertions(+), 62 deletions(-) delete mode 100644 content/html/content/test/test_bug566064.html diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 8d712b52b5c..487f32fe95a 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -148,7 +148,6 @@ MOCHITEST_FILES = \ test_bug569955.html \ test_bug573969.html \ test_bug561640.html \ - test_bug566064.html \ test_bug582412-1.html \ test_bug582412-2.html \ test_bug558788-1.html \ diff --git a/content/html/content/test/forms/test_button_attributes_reflection.html b/content/html/content/test/forms/test_button_attributes_reflection.html index aa2f3ba0db6..4a3fe04fc6e 100644 --- a/content/html/content/test/forms/test_button_attributes_reflection.html +++ b/content/html/content/test/forms/test_button_attributes_reflection.html @@ -69,12 +69,14 @@ reflectBoolean({ reflectString({ element: document.createElement("button"), attribute: "formTarget", + otherValues: [ "_blank", "_self", "_parent", "_top" ], }); // .name reflectString({ element: document.createElement("button"), attribute: "name", + otherValues: [ "isindex", "_charset_" ] }); // .type @@ -93,6 +95,42 @@ reflectString({ attribute: "value", }); +// .willValidate +ok("willValidate" in document.createElement("button"), + "willValidate should be an IDL attribute of the button element"); +is(typeof(document.createElement("button").willValidate), "boolean", + "button.willValidate should be a boolean"); + +// .validity +ok("validity" in document.createElement("button"), + "validity should be an IDL attribute of the button element"); +is(typeof(document.createElement("button").validity), "object", + "button.validity should be an object"); +ok(document.createElement("button").validity instanceof ValidityState, + "button.validity sohuld be an instance of ValidityState"); + +// .validationMessage +ok("validationMessage" in document.createElement("button"), + "validationMessage should be an IDL attribute of the button element"); +is(typeof(document.createElement("button").validationMessage), "string", + "button.validationMessage should be a string"); + +// .checkValidity() +ok("checkValidity" in document.createElement("button"), + "checkValidity() should be a method of the button element"); +is(typeof(document.createElement("button").checkValidity), "function", + "button.checkValidity should be a function"); + +// .setCustomValidity() +ok("setCustomValidity" in document.createElement("button"), + "setCustomValidity() should be a method of the button element"); +is(typeof(document.createElement("button").setCustomValidity), "function", + "button.setCustomValidity should be a function"); + +// .labels +todo("labels" in document.createElement("button"), + "button.labels isn't implemented yet"); +
diff --git a/content/html/content/test/test_bug546995.html b/content/html/content/test/test_bug546995.html index 078079d88c5..0135da60107 100644 --- a/content/html/content/test/test_bug546995.html +++ b/content/html/content/test/test_bug546995.html @@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995

 
 
diff --git a/content/html/content/test/test_bug566064.html b/content/html/content/test/test_bug566064.html deleted file mode 100644 index 8e09083f75e..00000000000 --- a/content/html/content/test/test_bug566064.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Test for Bug 566064 - - - - -Mozilla Bug 566064 -

-
-
-
- - From e83bbcc4cd16d2e775b9f6d60c63a9db09e324f8 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Wed, 14 Aug 2013 17:17:00 +0200 Subject: [PATCH 30/98] Bug 892488 - Get rid of the offline application cache prompt, r=ehsan+jonas --- browser/base/content/test/Makefile.in | 1 + .../test/browser_offlineQuotaNotification.js | 2 + browser/base/content/test/offlineByDefault.js | 17 +++++ .../test/test_offlineNotification.html | 3 + .../base/content/test/test_offline_gzip.html | 2 + content/base/public/nsContentUtils.h | 6 ++ content/base/src/nsContentSink.cpp | 7 +- content/base/src/nsContentUtils.cpp | 32 +++++++++ dom/src/offline/nsDOMOfflineResourceList.cpp | 48 ++++++++++---- dom/src/offline/nsDOMOfflineResourceList.h | 1 - .../offline/460353_iframe_samemanifest.html | 4 ++ .../mochitest/ajax/offline/foreign2.html | 38 +++++------ .../mochitest/ajax/offline/offlineChild.html | 2 +- .../mochitest/ajax/offline/offlineTests.js | 51 ++++++++++++-- .../ajax/offline/test_bug460353.html | 15 ++++- .../ajax/offline/test_bug474696.html | 3 +- .../ajax/offline/test_bug744719-cancel.html | 66 +++++++++---------- .../ajax/offline/test_bug744719.html | 9 ++- .../ajax/offline/test_cancelOfflineCache.html | 1 + .../mochitest/ajax/offline/test_foreign.html | 14 +++- .../ajax/offline/test_lowDeviceStorage.html | 1 - .../ajax/offline/test_updatingManifest.html | 16 +++-- .../android/base/tests/testDoorHanger.java.in | 61 +++++++++++++++++ modules/libpref/src/init/all.js | 2 + .../prefetch/nsOfflineCacheUpdateService.cpp | 14 +--- 25 files changed, 309 insertions(+), 107 deletions(-) create mode 100644 browser/base/content/test/offlineByDefault.js diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 07974075470..deee2218ade 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -35,6 +35,7 @@ MOCHITEST_FILES = \ test_feed_discovery.html \ test_offline_gzip.html \ test_offlineNotification.html \ + offlineByDefault.js \ video.ogg \ $(NULL) diff --git a/browser/base/content/test/browser_offlineQuotaNotification.js b/browser/base/content/test/browser_offlineQuotaNotification.js index a8aba6b9730..507600d3049 100644 --- a/browser/base/content/test/browser_offlineQuotaNotification.js +++ b/browser/base/content/test/browser_offlineQuotaNotification.js @@ -14,6 +14,7 @@ registerCleanupFunction(function() { var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri); Services.perms.removeFromPrincipal(principal, "offline-app"); Services.prefs.clearUserPref("offline-apps.quota.warn"); + Services.prefs.clearUserPref("offline-apps.allow_by_default"); }); // Check that the "preferences" UI is opened and showing which websites have @@ -70,5 +71,6 @@ function test() { PopupNotifications.panel.firstElementChild.button.click(); }, true); + Services.prefs.setBoolPref("offline-apps.allow_by_default", false); gBrowser.contentWindow.location = URL; } diff --git a/browser/base/content/test/offlineByDefault.js b/browser/base/content/test/offlineByDefault.js new file mode 100644 index 00000000000..72f7e52a01b --- /dev/null +++ b/browser/base/content/test/offlineByDefault.js @@ -0,0 +1,17 @@ +var offlineByDefault = { + defaultValue: false, + prefBranch: SpecialPowers.Cc["@mozilla.org/preferences-service;1"].getService(SpecialPowers.Ci.nsIPrefBranch), + set: function(allow) { + try { + this.defaultValue = this.prefBranch.getBoolPref("offline-apps.allow_by_default"); + } catch (e) { + this.defaultValue = false + } + this.prefBranch.setBoolPref("offline-apps.allow_by_default", allow); + }, + reset: function() { + this.prefBranch.setBoolPref("offline-apps.allow_by_default", this.defaultValue); + } +} + +offlineByDefault.set(false); diff --git a/browser/base/content/test/test_offlineNotification.html b/browser/base/content/test/test_offlineNotification.html index 8c603f15061..ad015a8623e 100644 --- a/browser/base/content/test/test_offlineNotification.html +++ b/browser/base/content/test/test_offlineNotification.html @@ -6,6 +6,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856 Test offline app notification + @@ -52,6 +53,8 @@ window.addEventListener("message", function(event) { pm.removeFromPrincipal(principal1, "offline-app"); pm.removeFromPrincipal(principal2, "offline-app"); + offlineByDefault.reset(); + SimpleTest.finish(); } }, false); diff --git a/browser/base/content/test/test_offline_gzip.html b/browser/base/content/test/test_offline_gzip.html index 09713da92ed..1b4a6129961 100644 --- a/browser/base/content/test/test_offline_gzip.html +++ b/browser/base/content/test/test_offline_gzip.html @@ -13,6 +13,7 @@ cache, it can be fetched from the cache successfully. src="/MochiKit/MochiKit.js"> + @@ -46,6 +47,7 @@ function finishTest() { window.removeEventListener("message", handleMessageEvents, false); + offlineByDefault.reset(); SimpleTest.finish(); } diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 3044829a7f8..383c1fdb84c 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1503,6 +1503,12 @@ public: */ static bool OfflineAppAllowed(nsIPrincipal *aPrincipal); + /** + * If offline-apps.allow_by_default is true, we set offline-app permission + * for the principal and return true. Otherwise false. + */ + static bool MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal); + /** * Increases the count of blockers preventing scripts from running. * NOTE: You might want to use nsAutoScriptBlocker rather than calling diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index af7deb997d2..ad4c1c843e0 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -1061,8 +1061,11 @@ nsContentSink::ProcessOfflineManifest(const nsAString& aManifestSpec) action = CACHE_SELECTION_RESELECT_WITHOUT_MANIFEST; } else { - // Only continue if the document has permission to use offline APIs. - if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) { + // Only continue if the document has permission to use offline APIs or + // when preferences indicate to permit it automatically. + if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal()) && + !nsContentUtils::MaybeAllowOfflineAppByDefault(mDocument->NodePrincipal()) && + !nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) { return; } diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index c39ef5b8b6d..9f40892233f 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1405,6 +1405,38 @@ nsContentUtils::OfflineAppAllowed(nsIPrincipal *aPrincipal) return NS_SUCCEEDED(rv) && allowed; } +bool +nsContentUtils::MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal) +{ + if (!Preferences::GetRootBranch()) + return false; + + nsresult rv; + + bool allowedByDefault; + rv = Preferences::GetRootBranch()->GetBoolPref( + "offline-apps.allow_by_default", &allowedByDefault); + if (NS_FAILED(rv)) + return false; + + if (!allowedByDefault) + return false; + + nsCOMPtr permissionManager = + do_GetService(NS_PERMISSIONMANAGER_CONTRACTID); + if (!permissionManager) + return false; + + rv = permissionManager->AddFromPrincipal( + aPrincipal, "offline-app", nsIPermissionManager::ALLOW_ACTION, + nsIPermissionManager::EXPIRE_NEVER, 0); + if (NS_FAILED(rv)) + return false; + + // We have added the permission + return true; +} + // static void nsContentUtils::Shutdown() diff --git a/dom/src/offline/nsDOMOfflineResourceList.cpp b/dom/src/offline/nsDOMOfflineResourceList.cpp index fa4811db5b5..e6de4f4babc 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.cpp +++ b/dom/src/offline/nsDOMOfflineResourceList.cpp @@ -84,7 +84,6 @@ nsDOMOfflineResourceList::nsDOMOfflineResourceList(nsIURI *aManifestURI, , mManifestURI(aManifestURI) , mDocumentURI(aDocumentURI) , mExposeCacheUpdateStatus(true) - , mDontSetDocumentCache(false) , mStatus(nsIDOMOfflineResourceList::IDLE) , mCachedKeys(nullptr) , mCachedKeysCount(0) @@ -429,6 +428,11 @@ nsDOMOfflineResourceList::GetStatus(uint16_t *aStatus) } } + if (mAvailableApplicationCache) { + *aStatus = nsIDOMOfflineResourceList::UPDATEREADY; + return NS_OK; + } + *aStatus = mStatus; return NS_OK; } @@ -455,10 +459,6 @@ nsDOMOfflineResourceList::Update() window, getter_AddRefs(update)); NS_ENSURE_SUCCESS(rv, rv); - // Since we are invoking the cache update, cache on the document must not - // be updated until swapCache() method is called on applicationCache object. - mDontSetDocumentCache = true; - return NS_OK; } @@ -488,6 +488,8 @@ nsDOMOfflineResourceList::SwapCache() mAvailableApplicationCache->GetClientID(availClientId); if (availClientId == currClientId) return NS_ERROR_DOM_INVALID_STATE_ERR; + } else if (mStatus != OBSOLETE) { + return NS_ERROR_DOM_INVALID_STATE_ERR; } ClearCachedKeys(); @@ -629,16 +631,36 @@ nsDOMOfflineResourceList::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate, NS_IMETHODIMP nsDOMOfflineResourceList::ApplicationCacheAvailable(nsIApplicationCache *aApplicationCache) { - mAvailableApplicationCache = aApplicationCache; + nsCOMPtr currentAppCache = GetDocumentAppCache(); + if (currentAppCache) { + // Document already has a cache, we cannot override it. swapCache is + // here to do it on demand. - if (!mDontSetDocumentCache) { - nsCOMPtr appCacheContainer = - GetDocumentAppCacheContainer(); + // If the newly available cache is identical to the current cache, then + // just ignore this event. + if (aApplicationCache == currentAppCache) { + return NS_OK; + } - if (appCacheContainer) - appCacheContainer->SetApplicationCache(aApplicationCache); + nsCString currClientId, availClientId; + currentAppCache->GetClientID(currClientId); + aApplicationCache->GetClientID(availClientId); + if (availClientId == currClientId) { + return NS_OK; + } + + mAvailableApplicationCache = aApplicationCache; + return NS_OK; } + nsCOMPtr appCacheContainer = + GetDocumentAppCacheContainer(); + + if (appCacheContainer) { + appCacheContainer->SetApplicationCache(aApplicationCache); + } + + mAvailableApplicationCache = nullptr; return NS_OK; } @@ -737,14 +759,12 @@ nsDOMOfflineResourceList::UpdateCompleted(nsIOfflineCacheUpdate *aUpdate) mCacheUpdate->RemoveObserver(this); mCacheUpdate = nullptr; - mDontSetDocumentCache = false; if (NS_SUCCEEDED(rv) && succeeded && !partial) { + mStatus = nsIDOMOfflineResourceList::IDLE; if (isUpgrade) { - mStatus = nsIDOMOfflineResourceList::UPDATEREADY; SendEvent(NS_LITERAL_STRING(UPDATEREADY_STR)); } else { - mStatus = nsIDOMOfflineResourceList::IDLE; SendEvent(NS_LITERAL_STRING(CACHED_STR)); } } diff --git a/dom/src/offline/nsDOMOfflineResourceList.h b/dom/src/offline/nsDOMOfflineResourceList.h index eeb63d2c3a0..40858869cf7 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.h +++ b/dom/src/offline/nsDOMOfflineResourceList.h @@ -157,7 +157,6 @@ private: nsCOMPtr mAvailableApplicationCache; nsCOMPtr mCacheUpdate; bool mExposeCacheUpdateStatus; - bool mDontSetDocumentCache; uint16_t mStatus; // The set of dynamic keys for this application cache object. diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html index 556789792be..de357827b6a 100644 --- a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html +++ b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html @@ -12,6 +12,10 @@ applicationCache.oncached = function() { parent.frameOnUpdate("same", true, applicationCache.status); } +applicationCache.onnoupdate = function() { + parent.frameOnUpdate("same", true, applicationCache.status); +} + diff --git a/dom/tests/mochitest/ajax/offline/foreign2.html b/dom/tests/mochitest/ajax/offline/foreign2.html index 133c1748e10..e330c9f5a04 100644 --- a/dom/tests/mochitest/ajax/offline/foreign2.html +++ b/dom/tests/mochitest/ajax/offline/foreign2.html @@ -10,59 +10,57 @@ function manifestUpdated() { +dump(">>>>>>>>>>>>>> MANIFESTUPDATED\n"); var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"] .getService(SpecialPowers.Ci.nsIApplicationCacheService); var foreign2cache = appCacheService.chooseApplicationCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContext()); - OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html"); - OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest") + window.opener.OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html"); + window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest") var foreign1cache = OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); - OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); + window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); foreign1cache.discard(); - OfflineTest.teardown(); - OfflineTest.finish(); + window.opener.onDone(); } function onLoaded() { +dump(">>>>>>>>>>>>>> ONLOADED\n"); var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"] .getService(SpecialPowers.Ci.nsIApplicationCacheService); - var foreign1cache = OfflineTest.getActiveCache( + var foreign1cache = window.opener.OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); - OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); + window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); - var foreign2cache = OfflineTest.getActiveCache( + var foreign2cache = window.opener.OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest"); - OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present"); + window.opener.OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present"); foreign1cache = appCacheService.chooseApplicationCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContext()); - OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache"); + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContext()); + window.opener.OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache"); try { - OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED, + window.opener.OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED, "there is no associated application cache"); } catch (ex) { - OfflineTest.ok(false, "applicationCache.status must not throw an exception"); + window.opener.OfflineTest.ok(false, "applicationCache.status must not throw an exception"); } } -if (OfflineTest.setup()) -{ - applicationCache.onerror = OfflineTest.failEvent; - applicationCache.onupdateready = OfflineTest.failEvent; - applicationCache.onnoupdate = OfflineTest.failEvent; - applicationCache.oncached = OfflineTest.priv(manifestUpdated); -} +applicationCache.onerror = window.opener.OfflineTest.failEvent; +applicationCache.onupdateready = window.opener.OfflineTest.failEvent; +applicationCache.onnoupdate = window.opener.OfflineTest.failEvent; +applicationCache.oncached = window.opener.OfflineTest.priv(manifestUpdated); diff --git a/dom/tests/mochitest/ajax/offline/offlineChild.html b/dom/tests/mochitest/ajax/offline/offlineChild.html index 38b6fae9ac0..d70a060a164 100644 --- a/dom/tests/mochitest/ajax/offline/offlineChild.html +++ b/dom/tests/mochitest/ajax/offline/offlineChild.html @@ -12,7 +12,7 @@ // (since we don't get those events) function doneLoading() { - window.top.childFinished(); + window.parent.childFinished(); } if (OfflineTest.setupChild()) { diff --git a/dom/tests/mochitest/ajax/offline/offlineTests.js b/dom/tests/mochitest/ajax/offline/offlineTests.js index a39de0a77f7..a5410298b97 100644 --- a/dom/tests/mochitest/ajax/offline/offlineTests.js +++ b/dom/tests/mochitest/ajax/offline/offlineTests.js @@ -58,6 +58,8 @@ fetch: function(callback) var OfflineTest = { +_allowedByDefault: false, + _hasSlave: false, // The window where test results should be sent. @@ -71,6 +73,11 @@ _SJSsStated: [], setupChild: function() { + if (this._allowedByDefault) { + this._masterWindow = window; + return true; + } + if (window.parent.OfflineTest._hasSlave) { return false; } @@ -91,6 +98,17 @@ setup: function() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); + try { + this._allowedByDefault = prefBranch.getBoolPref("offline-apps.allow_by_default"); + } catch (e) {} + + if (this._allowedByDefault) { + this._masterWindow = window; + + return true; + } + if (!window.opener || !window.opener.OfflineTest || !window.opener.OfflineTest._hasSlave) { // Offline applications must be toplevel windows and have the @@ -154,7 +172,9 @@ teardown: function() finish: function() { - if (this._masterWindow) { + if (this._allowedByDefault) { + SimpleTest.executeSoon(SimpleTest.finish); + } else if (this._masterWindow) { // Slave window: pass control back to master window, close itself. this._masterWindow.SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish); window.close(); @@ -237,12 +257,25 @@ waitForAdd: function(url, onFinished) { manifestURL: function(overload) { - var manifestURLspec = overload || window.top.document.documentElement.getAttribute("manifest"); + var manifestURLspec; + if (overload) { + manifestURLspec = overload; + } else { + var win = window; + while (win && !win.document.documentElement.getAttribute("manifest")) { + if (win == win.parent) + break; + win = win.parent; + } + if (win) + manifestURLspec = win.document.documentElement.getAttribute("manifest"); + } var ios = Cc["@mozilla.org/network/io-service;1"] .getService(Ci.nsIIOService) var baseURI = ios.newURI(window.location.href, null, null); + dump("manifestURLspec=" + manifestURLspec + "\n"); return ios.newURI(manifestURLspec, null, baseURI); }, @@ -261,14 +294,17 @@ getActiveCache: function(overload) var serv = Cc["@mozilla.org/network/application-cache-service;1"] .getService(Ci.nsIApplicationCacheService); var groupID = serv.buildGroupID(this.manifestURL(overload), this.loadContext()); + dump("Getting active cache for " + groupID + " (o=" + overload + ")\n"); return serv.getActiveCache(groupID); }, getActiveSession: function() { var cache = this.getActiveCache(); - if (!cache) + if (!cache) { + dump("No active cache\n"); return null; + } var cacheService = Cc["@mozilla.org/network/cache-service;1"] .getService(Ci.nsICacheService); @@ -302,6 +338,7 @@ checkCacheEntries: function(entries, callback) checkCache: function(url, expectEntry, callback) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var cacheSession = this.getActiveSession(); this._checkCache(cacheSession, url, expectEntry, callback); }, @@ -310,11 +347,11 @@ _checkCache: function(cacheSession, url, expectEntry, callback) { if (!cacheSession) { if (expectEntry) { - this.ok(false, url + " should exist in the offline cache"); + this.ok(false, url + " should exist in the offline cache (no session)"); } else { - this.ok(true, url + " should not exist in the offline cache"); + this.ok(true, url + " should not exist in the offline cache (no session)"); } - setTimeout(this.priv(callback), 0); + if (callback) setTimeout(this.priv(callback), 0); return; } @@ -346,7 +383,7 @@ _checkCache: function(cacheSession, url, expectEntry, callback) OfflineTest.ok(false, "got invalid error for " + url); } } - setTimeout(OfflineTest.priv(callback), 0); + if (callback) setTimeout(OfflineTest.priv(callback), 0); } }; diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html index c0ba51aa967..84cb0370443 100644 --- a/dom/tests/mochitest/ajax/offline/test_bug460353.html +++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html @@ -16,10 +16,16 @@ - @@ -53,8 +52,6 @@ window.addEventListener("message", function(event) { pm.removeFromPrincipal(principal1, "offline-app"); pm.removeFromPrincipal(principal2, "offline-app"); - offlineByDefault.reset(); - SimpleTest.finish(); } }, false); diff --git a/browser/base/content/test/test_offline_gzip.html b/browser/base/content/test/test_offline_gzip.html index 1b4a6129961..09713da92ed 100644 --- a/browser/base/content/test/test_offline_gzip.html +++ b/browser/base/content/test/test_offline_gzip.html @@ -13,7 +13,6 @@ cache, it can be fetched from the cache successfully. src="/MochiKit/MochiKit.js"> - @@ -47,7 +46,6 @@ function finishTest() { window.removeEventListener("message", handleMessageEvents, false); - offlineByDefault.reset(); SimpleTest.finish(); } diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 383c1fdb84c..3044829a7f8 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1503,12 +1503,6 @@ public: */ static bool OfflineAppAllowed(nsIPrincipal *aPrincipal); - /** - * If offline-apps.allow_by_default is true, we set offline-app permission - * for the principal and return true. Otherwise false. - */ - static bool MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal); - /** * Increases the count of blockers preventing scripts from running. * NOTE: You might want to use nsAutoScriptBlocker rather than calling diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index ad4c1c843e0..af7deb997d2 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -1061,11 +1061,8 @@ nsContentSink::ProcessOfflineManifest(const nsAString& aManifestSpec) action = CACHE_SELECTION_RESELECT_WITHOUT_MANIFEST; } else { - // Only continue if the document has permission to use offline APIs or - // when preferences indicate to permit it automatically. - if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal()) && - !nsContentUtils::MaybeAllowOfflineAppByDefault(mDocument->NodePrincipal()) && - !nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) { + // Only continue if the document has permission to use offline APIs. + if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) { return; } diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 9f40892233f..c39ef5b8b6d 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1405,38 +1405,6 @@ nsContentUtils::OfflineAppAllowed(nsIPrincipal *aPrincipal) return NS_SUCCEEDED(rv) && allowed; } -bool -nsContentUtils::MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal) -{ - if (!Preferences::GetRootBranch()) - return false; - - nsresult rv; - - bool allowedByDefault; - rv = Preferences::GetRootBranch()->GetBoolPref( - "offline-apps.allow_by_default", &allowedByDefault); - if (NS_FAILED(rv)) - return false; - - if (!allowedByDefault) - return false; - - nsCOMPtr permissionManager = - do_GetService(NS_PERMISSIONMANAGER_CONTRACTID); - if (!permissionManager) - return false; - - rv = permissionManager->AddFromPrincipal( - aPrincipal, "offline-app", nsIPermissionManager::ALLOW_ACTION, - nsIPermissionManager::EXPIRE_NEVER, 0); - if (NS_FAILED(rv)) - return false; - - // We have added the permission - return true; -} - // static void nsContentUtils::Shutdown() diff --git a/dom/src/offline/nsDOMOfflineResourceList.cpp b/dom/src/offline/nsDOMOfflineResourceList.cpp index e6de4f4babc..fa4811db5b5 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.cpp +++ b/dom/src/offline/nsDOMOfflineResourceList.cpp @@ -84,6 +84,7 @@ nsDOMOfflineResourceList::nsDOMOfflineResourceList(nsIURI *aManifestURI, , mManifestURI(aManifestURI) , mDocumentURI(aDocumentURI) , mExposeCacheUpdateStatus(true) + , mDontSetDocumentCache(false) , mStatus(nsIDOMOfflineResourceList::IDLE) , mCachedKeys(nullptr) , mCachedKeysCount(0) @@ -428,11 +429,6 @@ nsDOMOfflineResourceList::GetStatus(uint16_t *aStatus) } } - if (mAvailableApplicationCache) { - *aStatus = nsIDOMOfflineResourceList::UPDATEREADY; - return NS_OK; - } - *aStatus = mStatus; return NS_OK; } @@ -459,6 +455,10 @@ nsDOMOfflineResourceList::Update() window, getter_AddRefs(update)); NS_ENSURE_SUCCESS(rv, rv); + // Since we are invoking the cache update, cache on the document must not + // be updated until swapCache() method is called on applicationCache object. + mDontSetDocumentCache = true; + return NS_OK; } @@ -488,8 +488,6 @@ nsDOMOfflineResourceList::SwapCache() mAvailableApplicationCache->GetClientID(availClientId); if (availClientId == currClientId) return NS_ERROR_DOM_INVALID_STATE_ERR; - } else if (mStatus != OBSOLETE) { - return NS_ERROR_DOM_INVALID_STATE_ERR; } ClearCachedKeys(); @@ -631,36 +629,16 @@ nsDOMOfflineResourceList::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate, NS_IMETHODIMP nsDOMOfflineResourceList::ApplicationCacheAvailable(nsIApplicationCache *aApplicationCache) { - nsCOMPtr currentAppCache = GetDocumentAppCache(); - if (currentAppCache) { - // Document already has a cache, we cannot override it. swapCache is - // here to do it on demand. + mAvailableApplicationCache = aApplicationCache; - // If the newly available cache is identical to the current cache, then - // just ignore this event. - if (aApplicationCache == currentAppCache) { - return NS_OK; - } + if (!mDontSetDocumentCache) { + nsCOMPtr appCacheContainer = + GetDocumentAppCacheContainer(); - nsCString currClientId, availClientId; - currentAppCache->GetClientID(currClientId); - aApplicationCache->GetClientID(availClientId); - if (availClientId == currClientId) { - return NS_OK; - } - - mAvailableApplicationCache = aApplicationCache; - return NS_OK; + if (appCacheContainer) + appCacheContainer->SetApplicationCache(aApplicationCache); } - nsCOMPtr appCacheContainer = - GetDocumentAppCacheContainer(); - - if (appCacheContainer) { - appCacheContainer->SetApplicationCache(aApplicationCache); - } - - mAvailableApplicationCache = nullptr; return NS_OK; } @@ -759,12 +737,14 @@ nsDOMOfflineResourceList::UpdateCompleted(nsIOfflineCacheUpdate *aUpdate) mCacheUpdate->RemoveObserver(this); mCacheUpdate = nullptr; + mDontSetDocumentCache = false; if (NS_SUCCEEDED(rv) && succeeded && !partial) { - mStatus = nsIDOMOfflineResourceList::IDLE; if (isUpgrade) { + mStatus = nsIDOMOfflineResourceList::UPDATEREADY; SendEvent(NS_LITERAL_STRING(UPDATEREADY_STR)); } else { + mStatus = nsIDOMOfflineResourceList::IDLE; SendEvent(NS_LITERAL_STRING(CACHED_STR)); } } diff --git a/dom/src/offline/nsDOMOfflineResourceList.h b/dom/src/offline/nsDOMOfflineResourceList.h index 40858869cf7..eeb63d2c3a0 100644 --- a/dom/src/offline/nsDOMOfflineResourceList.h +++ b/dom/src/offline/nsDOMOfflineResourceList.h @@ -157,6 +157,7 @@ private: nsCOMPtr mAvailableApplicationCache; nsCOMPtr mCacheUpdate; bool mExposeCacheUpdateStatus; + bool mDontSetDocumentCache; uint16_t mStatus; // The set of dynamic keys for this application cache object. diff --git a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html index de357827b6a..556789792be 100644 --- a/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html +++ b/dom/tests/mochitest/ajax/offline/460353_iframe_samemanifest.html @@ -12,10 +12,6 @@ applicationCache.oncached = function() { parent.frameOnUpdate("same", true, applicationCache.status); } -applicationCache.onnoupdate = function() { - parent.frameOnUpdate("same", true, applicationCache.status); -} - diff --git a/dom/tests/mochitest/ajax/offline/foreign2.html b/dom/tests/mochitest/ajax/offline/foreign2.html index e330c9f5a04..133c1748e10 100644 --- a/dom/tests/mochitest/ajax/offline/foreign2.html +++ b/dom/tests/mochitest/ajax/offline/foreign2.html @@ -10,57 +10,59 @@ function manifestUpdated() { -dump(">>>>>>>>>>>>>> MANIFESTUPDATED\n"); var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"] .getService(SpecialPowers.Ci.nsIApplicationCacheService); var foreign2cache = appCacheService.chooseApplicationCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContext()); - window.opener.OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html"); - window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest") + OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html"); + OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest") var foreign1cache = OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); - window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); + OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); foreign1cache.discard(); - window.opener.onDone(); + OfflineTest.teardown(); + OfflineTest.finish(); } function onLoaded() { -dump(">>>>>>>>>>>>>> ONLOADED\n"); var appCacheService = SpecialPowers.Components.classes["@mozilla.org/network/application-cache-service;1"] .getService(SpecialPowers.Ci.nsIApplicationCacheService); - var foreign1cache = window.opener.OfflineTest.getActiveCache( + var foreign1cache = OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); - window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); + OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); - var foreign2cache = window.opener.OfflineTest.getActiveCache( + var foreign2cache = OfflineTest.getActiveCache( "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest"); - window.opener.OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present"); + OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present"); foreign1cache = appCacheService.chooseApplicationCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContext()); - window.opener.OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache"); + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContext()); + OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache"); try { - window.opener.OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED, + OfflineTest.ok(applicationCache.status == SpecialPowers.Ci.nsIDOMOfflineResourceList.UNCACHED, "there is no associated application cache"); } catch (ex) { - window.opener.OfflineTest.ok(false, "applicationCache.status must not throw an exception"); + OfflineTest.ok(false, "applicationCache.status must not throw an exception"); } } -applicationCache.onerror = window.opener.OfflineTest.failEvent; -applicationCache.onupdateready = window.opener.OfflineTest.failEvent; -applicationCache.onnoupdate = window.opener.OfflineTest.failEvent; -applicationCache.oncached = window.opener.OfflineTest.priv(manifestUpdated); +if (OfflineTest.setup()) +{ + applicationCache.onerror = OfflineTest.failEvent; + applicationCache.onupdateready = OfflineTest.failEvent; + applicationCache.onnoupdate = OfflineTest.failEvent; + applicationCache.oncached = OfflineTest.priv(manifestUpdated); +} diff --git a/dom/tests/mochitest/ajax/offline/offlineChild.html b/dom/tests/mochitest/ajax/offline/offlineChild.html index d70a060a164..38b6fae9ac0 100644 --- a/dom/tests/mochitest/ajax/offline/offlineChild.html +++ b/dom/tests/mochitest/ajax/offline/offlineChild.html @@ -12,7 +12,7 @@ // (since we don't get those events) function doneLoading() { - window.parent.childFinished(); + window.top.childFinished(); } if (OfflineTest.setupChild()) { diff --git a/dom/tests/mochitest/ajax/offline/offlineTests.js b/dom/tests/mochitest/ajax/offline/offlineTests.js index a5410298b97..a39de0a77f7 100644 --- a/dom/tests/mochitest/ajax/offline/offlineTests.js +++ b/dom/tests/mochitest/ajax/offline/offlineTests.js @@ -58,8 +58,6 @@ fetch: function(callback) var OfflineTest = { -_allowedByDefault: false, - _hasSlave: false, // The window where test results should be sent. @@ -73,11 +71,6 @@ _SJSsStated: [], setupChild: function() { - if (this._allowedByDefault) { - this._masterWindow = window; - return true; - } - if (window.parent.OfflineTest._hasSlave) { return false; } @@ -98,17 +91,6 @@ setup: function() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - try { - this._allowedByDefault = prefBranch.getBoolPref("offline-apps.allow_by_default"); - } catch (e) {} - - if (this._allowedByDefault) { - this._masterWindow = window; - - return true; - } - if (!window.opener || !window.opener.OfflineTest || !window.opener.OfflineTest._hasSlave) { // Offline applications must be toplevel windows and have the @@ -172,9 +154,7 @@ teardown: function() finish: function() { - if (this._allowedByDefault) { - SimpleTest.executeSoon(SimpleTest.finish); - } else if (this._masterWindow) { + if (this._masterWindow) { // Slave window: pass control back to master window, close itself. this._masterWindow.SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish); window.close(); @@ -257,25 +237,12 @@ waitForAdd: function(url, onFinished) { manifestURL: function(overload) { - var manifestURLspec; - if (overload) { - manifestURLspec = overload; - } else { - var win = window; - while (win && !win.document.documentElement.getAttribute("manifest")) { - if (win == win.parent) - break; - win = win.parent; - } - if (win) - manifestURLspec = win.document.documentElement.getAttribute("manifest"); - } + var manifestURLspec = overload || window.top.document.documentElement.getAttribute("manifest"); var ios = Cc["@mozilla.org/network/io-service;1"] .getService(Ci.nsIIOService) var baseURI = ios.newURI(window.location.href, null, null); - dump("manifestURLspec=" + manifestURLspec + "\n"); return ios.newURI(manifestURLspec, null, baseURI); }, @@ -294,17 +261,14 @@ getActiveCache: function(overload) var serv = Cc["@mozilla.org/network/application-cache-service;1"] .getService(Ci.nsIApplicationCacheService); var groupID = serv.buildGroupID(this.manifestURL(overload), this.loadContext()); - dump("Getting active cache for " + groupID + " (o=" + overload + ")\n"); return serv.getActiveCache(groupID); }, getActiveSession: function() { var cache = this.getActiveCache(); - if (!cache) { - dump("No active cache\n"); + if (!cache) return null; - } var cacheService = Cc["@mozilla.org/network/cache-service;1"] .getService(Ci.nsICacheService); @@ -338,7 +302,6 @@ checkCacheEntries: function(entries, callback) checkCache: function(url, expectEntry, callback) { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var cacheSession = this.getActiveSession(); this._checkCache(cacheSession, url, expectEntry, callback); }, @@ -347,11 +310,11 @@ _checkCache: function(cacheSession, url, expectEntry, callback) { if (!cacheSession) { if (expectEntry) { - this.ok(false, url + " should exist in the offline cache (no session)"); + this.ok(false, url + " should exist in the offline cache"); } else { - this.ok(true, url + " should not exist in the offline cache (no session)"); + this.ok(true, url + " should not exist in the offline cache"); } - if (callback) setTimeout(this.priv(callback), 0); + setTimeout(this.priv(callback), 0); return; } @@ -383,7 +346,7 @@ _checkCache: function(cacheSession, url, expectEntry, callback) OfflineTest.ok(false, "got invalid error for " + url); } } - if (callback) setTimeout(OfflineTest.priv(callback), 0); + setTimeout(OfflineTest.priv(callback), 0); } }; diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html index 84cb0370443..c0ba51aa967 100644 --- a/dom/tests/mochitest/ajax/offline/test_bug460353.html +++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html @@ -16,16 +16,10 @@