From 75a3b0921d089b2588f4e30ac1fd4f294ec9e0e4 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 2 Jan 2014 09:15:56 -0800 Subject: [PATCH 1/5] Bug 952846 - Ship PDF.js code in Metro Firefox for Nightly builds only [r=jimm] --- browser/extensions/Makefile.in | 2 +- browser/installer/package-manifest.in | 2 +- browser/metro/base/content/browser-scripts.js | 2 ++ browser/metro/base/content/browser-ui.js | 2 ++ browser/metro/profile/metro.js | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/browser/extensions/Makefile.in b/browser/extensions/Makefile.in index 54fe5e97e3d..2e8d0166b85 100644 --- a/browser/extensions/Makefile.in +++ b/browser/extensions/Makefile.in @@ -39,6 +39,7 @@ libs:: $(FINAL_TARGET)/chrome/shumway.manifest endif ifdef MOZ_METRO +ifdef NIGHTLY_BUILD $(DIST)/bin/metro/chrome/pdfjs.manifest: $(GLOBAL_DEPS) printf 'manifest pdfjs/chrome.manifest' > $@ @@ -49,7 +50,6 @@ libs:: $(DIST)/bin/metro/chrome/pdfjs.manifest $(DIST)/bin/metro/chrome $(call py_action,buildlist,$(DIST)/bin/metro/chrome.manifest 'manifest chrome/pdfjs.manifest') -ifdef NIGHTLY_BUILD $(DIST)/bin/metro/chrome/shumway.manifest: $(GLOBAL_DEPS) printf 'manifest shumway/chrome.manifest' > $@ diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 302bddecb0a..d38a7839c72 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -609,9 +609,9 @@ @BINPATH@/browser/chrome.manifest @BINPATH@/browser/chrome/browser@JAREXT@ @BINPATH@/browser/chrome/browser.manifest +#ifdef NIGHTLY_BUILD @BINPATH@/browser/chrome/pdfjs.manifest @BINPATH@/browser/chrome/pdfjs/* -#ifdef NIGHTLY_BUILD @BINPATH@/browser/chrome/shumway.manifest @BINPATH@/browser/chrome/shumway/* #endif diff --git a/browser/metro/base/content/browser-scripts.js b/browser/metro/base/content/browser-scripts.js index cc5b902f653..bbbdc3f42c9 100644 --- a/browser/metro/base/content/browser-scripts.js +++ b/browser/metro/base/content/browser-scripts.js @@ -40,11 +40,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils", XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/commonjs/sdk/core/promise.js"); +#ifdef NIGHTLY_BUILD XPCOMUtils.defineLazyModuleGetter(this, "ShumwayUtils", "resource://shumway/ShumwayUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PdfJs", "resource://pdf.js/PdfJs.jsm"); +#endif XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index d471eae8c3a..db987bfd698 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -154,7 +154,9 @@ var BrowserUI = { DialogUI.init(); FormHelperUI.init(); FindHelperUI.init(); +#ifdef NIGHTLY_BUILD PdfJs.init(); +#endif } catch(ex) { Util.dumpLn("Exception in delay load module:", ex.message); } diff --git a/browser/metro/profile/metro.js b/browser/metro/profile/metro.js index de3b653c135..7e6d26f3ebf 100644 --- a/browser/metro/profile/metro.js +++ b/browser/metro/profile/metro.js @@ -540,6 +540,7 @@ pref("ui.dragThresholdY", 50); // prevent tooltips from showing up pref("browser.chrome.toolbar_tips", false); +#ifdef NIGHTLY_BUILD // Completely disable pdf.js as an option to preview pdfs within firefox. // Note: if this is not disabled it does not necessarily mean pdf.js is the pdf // handler just that it is an option. @@ -551,6 +552,7 @@ pref("pdfjs.firstRun", true); // became the default. pref("pdfjs.previousHandler.preferredAction", 0); pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false); +#endif #ifdef NIGHTLY_BUILD pref("shumway.disabled", true); From e6b5066beb2ba2fac8f8d45e7308bf44bf445afc Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 2 Jan 2014 13:05:33 -0600 Subject: [PATCH 2/5] Bug 943071 - Regression fix from bug 950832: call the right browser translational helper for the y coord. r=mbrubeck --- browser/metro/base/content/helperui/SelectionHelperUI.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/metro/base/content/helperui/SelectionHelperUI.js b/browser/metro/base/content/helperui/SelectionHelperUI.js index 7b87dbdf800..3ff8779c0d4 100644 --- a/browser/metro/base/content/helperui/SelectionHelperUI.js +++ b/browser/metro/base/content/helperui/SelectionHelperUI.js @@ -969,19 +969,19 @@ var SelectionHelperUI = { if (json.updateStart) { let x = this._msgTarget.btocx(json.start.xPos, true); - let y = this._msgTarget.btocx(json.start.yPos, true); + let y = this._msgTarget.btocy(json.start.yPos, true); this.startMark.position(x, y); } if (json.updateEnd) { let x = this._msgTarget.btocx(json.end.xPos, true); - let y = this._msgTarget.btocx(json.end.yPos, true); + let y = this._msgTarget.btocy(json.end.yPos, true); this.endMark.position(x, y); } if (json.updateCaret) { let x = this._msgTarget.btocx(json.caret.xPos, true); - let y = this._msgTarget.btocx(json.caret.yPos, true); + let y = this._msgTarget.btocy(json.caret.yPos, true); // If selectionRangeFound is set SelectionHelper found a range we can // attach to. If not, there's no text in the control, and hence no caret // position information we can use. From a3b69e39701997769034c051a9bbdde68501f846 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 2 Jan 2014 13:05:33 -0600 Subject: [PATCH 3/5] Bug 943071 - When caretPositionFromPoint fails fall back on selectAtPoint apis for selecting text. r=mbrubeck --- .../content/library/SelectionPrototype.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/browser/metro/base/content/library/SelectionPrototype.js b/browser/metro/base/content/library/SelectionPrototype.js index 2f13edde865..9ba512c95b9 100644 --- a/browser/metro/base/content/library/SelectionPrototype.js +++ b/browser/metro/base/content/library/SelectionPrototype.js @@ -154,9 +154,11 @@ SelectionPrototype.prototype = { let containedCoords = this._restrictCoordinateToEditBounds(aX, aY); let cp = this._contentWindow.document.caretPositionFromPoint(containedCoords.xPos, containedCoords.yPos); - let input = cp.offsetNode; - let offset = cp.offset; - input.selectionStart = input.selectionEnd = offset; + if (cp) { + let input = cp.offsetNode; + let offset = cp.offset; + input.selectionStart = input.selectionEnd = offset; + } }, /* @@ -300,20 +302,19 @@ SelectionPrototype.prototype = { let constrainedPoint = this._constrainPointWithinControl(aAdjustedClientPoint); - // For textareas we fall back on the selectAtPoint logic due to various - // issues with caretPositionFromPoint (bug 882149). - if (Util.isMultilineInput(this._targetElement)) { - this._adjustSelectionAtPoint(aMarker, constrainedPoint, aEndOfSelection); - return; - } - // Add or subtract selection let cp = this._contentWindow.document.caretPositionFromPoint(constrainedPoint.xPos, constrainedPoint.yPos); - if (!cp || !this._offsetNodeIsValid(cp.offsetNode)) { + + // For textareas or if cpfp fails we fall back on the selectAtPoint + // logic (bugs 882149, 943071). + if (Util.isMultilineInput(this._targetElement) || !cp || + !this._offsetNodeIsValid(cp.offsetNode)) { + this._adjustSelectionAtPoint(aMarker, constrainedPoint, aEndOfSelection); return; } + if (aMarker == "start") { this._targetElement.selectionStart = cp.offset; } else { From dd3dff1aa93e0c7db90f8de304d2371aa62c934c Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Thu, 2 Jan 2014 14:36:03 -0500 Subject: [PATCH 4/5] Bug 955870 - Do some quick checks before calling CheckURIVisited r=blassey --- mobile/android/components/build/nsAndroidHistory.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mobile/android/components/build/nsAndroidHistory.cpp b/mobile/android/components/build/nsAndroidHistory.cpp index a9eaf2a3954..a8c11e0f4c3 100644 --- a/mobile/android/components/build/nsAndroidHistory.cpp +++ b/mobile/android/components/build/nsAndroidHistory.cpp @@ -42,8 +42,16 @@ nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent) if (!aContent || !aURI) return NS_OK; + // Silently return if URI is something we would never add to DB. + bool canAdd; + nsresult rv = CanAddURI(aURI, &canAdd); + NS_ENSURE_SUCCESS(rv, rv); + if (!canAdd) { + return NS_OK; + } + nsAutoCString uri; - nsresult rv = aURI->GetSpec(uri); + rv = aURI->GetSpec(uri); if (NS_FAILED(rv)) return rv; NS_ConvertUTF8toUTF16 uriString(uri); From 282a52f3452543cc41e56532a62b02d394ba5724 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Thu, 2 Jan 2014 14:36:06 -0500 Subject: [PATCH 5/5] Bug 955870 - Cache the array length in IsRecentlyVisitedURI r=blassey --- mobile/android/base/toolbar/BrowserToolbar.java | 10 +++++----- mobile/android/components/build/nsAndroidHistory.cpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index 3783b46b3fc..67520af7824 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -128,7 +128,7 @@ public class BrowserToolbar extends GeckoRelativeLayout private ImageButton mSiteSecurity; private PageActionLayout mPageActionLayout; - private Animation mProgressSpinner; + //private Animation mProgressSpinner; private TabCounter mTabsCounter; private GeckoImageButton mMenu; private GeckoImageView mMenuIcon; @@ -303,7 +303,7 @@ public class BrowserToolbar extends GeckoRelativeLayout mSiteIdentityPopup = new SiteIdentityPopup(mActivity); mSiteIdentityPopup.setAnchor(mSiteSecurity); - mProgressSpinner = AnimationUtils.loadAnimation(mActivity, R.anim.progress_spinner); + //mProgressSpinner = AnimationUtils.loadAnimation(mActivity, R.anim.progress_spinner); mStop = (ImageButton) findViewById(R.id.stop); mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout); @@ -785,8 +785,8 @@ public class BrowserToolbar extends GeckoRelativeLayout // To stop the glitch caused by multiple start() calls. if (!mSpinnerVisible) { setPageActionVisibility(true); - mFavicon.setAnimation(mProgressSpinner); - mProgressSpinner.start(); + //mFavicon.setAnimation(mProgressSpinner); + //mProgressSpinner.start(); mSpinnerVisible = true; } Log.i(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - Throbber start"); @@ -799,7 +799,7 @@ public class BrowserToolbar extends GeckoRelativeLayout if (mSpinnerVisible) { setPageActionVisibility(false); mFavicon.setAnimation(null); - mProgressSpinner.cancel(); + //mProgressSpinner.cancel(); mSpinnerVisible = false; } Log.i(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - Throbber stop"); diff --git a/mobile/android/components/build/nsAndroidHistory.cpp b/mobile/android/components/build/nsAndroidHistory.cpp index a8c11e0f4c3..4ba66595a70 100644 --- a/mobile/android/components/build/nsAndroidHistory.cpp +++ b/mobile/android/components/build/nsAndroidHistory.cpp @@ -107,7 +107,8 @@ inline bool nsAndroidHistory::IsRecentlyVisitedURI(nsIURI* aURI) { bool equals = false; RecentlyVisitedArray::index_type i; - for (i = 0; i < mRecentlyVisitedURIs.Length() && !equals; ++i) { + RecentlyVisitedArray::size_type length = mRecentlyVisitedURIs.Length(); + for (i = 0; i < length && !equals; ++i) { aURI->Equals(mRecentlyVisitedURIs.ElementAt(i), &equals); } return equals;