Merge m-c to mozilla-inbound

This commit is contained in:
Wes Kocher 2013-12-16 21:34:34 -08:00
commit 673ea4ce05
14 changed files with 174 additions and 44 deletions

View File

@ -133,15 +133,21 @@ function appUpdater()
return;
}
// If app.update.enabled is false, we don't pop up an update dialog
// automatically, but opening the About dialog is considered manually
// checking for updates, so we always check.
// If app.update.auto is false, we ask before downloading though,
// in onCheckComplete.
this.selectPanel("checkingForUpdates");
this.isChecking = true;
this.checker.checkForUpdates(this.updateCheckListener, true);
// after checking, onCheckComplete() is called
// Honor the "Never check for updates" option by not only disabling background
// update checks, but also in the About dialog, by presenting a
// "Check for updates" button.
// If updates are found, the user is then asked if he wants to "Update to <version>".
if (!this.updateEnabled) {
this.selectPanel("checkForUpdates");
return;
}
// That leaves the options
// "Check for updates, but let me choose whether to install them", and
// "Automatically install updates".
// In both cases, we check for updates without asking.
// In the "let me choose" case, we ask before downloading though, in onCheckComplete.
this.checkForUpdates();
}
appUpdater.prototype =
@ -234,6 +240,16 @@ appUpdater.prototype =
}
},
/**
* Check for updates
*/
checkForUpdates: function() {
this.selectPanel("checkingForUpdates");
this.isChecking = true;
this.checker.checkForUpdates(this.updateCheckListener, true);
// after checking, onCheckComplete() is called
},
/**
* Check for addon compat, or start the download right away
*/

View File

@ -50,6 +50,13 @@
<vbox id="updateBox">
#ifdef MOZ_UPDATER
<deck id="updateDeck" orient="vertical">
<hbox id="checkForUpdates" align="center">
<button id="checkForUpdatesButton" align="start"
label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
<spacer flex="1"/>
</hbox>
<hbox id="downloadAndInstall" align="center">
<button id="downloadAndInstallButton" align="start"
oncommand="gAppUpdater.doUpdate();"/>

View File

@ -435,7 +435,28 @@ StyleEditorUI.prototype = {
editor.getSourceEditor().then(() => {
editor.sourceEditor.setCursor({line: line, ch: col});
});
this._view.activeSummary = editor.summary;
this.getEditorSummary(editor).then((summary) => {
this._view.activeSummary = summary;
})
},
getEditorSummary: function(editor) {
if (editor.summary) {
return promise.resolve(editor.summary);
}
let deferred = promise.defer();
let self = this;
this.on("editor-added", function onAdd(e, selected) {
if (selected == editor) {
self.off("editor-added", onAdd);
deferred.resolve(editor.summary);
}
});
return deferred.promise;
},
/**

View File

@ -49,10 +49,11 @@ function RuleViewTool(aInspector, aWindow, aIFrame)
// Chrome stylesheets are not listed in the style editor, so show
// these sheets in the view source window instead.
if (!sheet || !rule.href || sheet.isSystem) {
if (!sheet || sheet.isSystem) {
let contentDoc = this.inspector.selection.document;
let viewSourceUtils = this.inspector.viewSourceUtils;
viewSourceUtils.viewSource(rule.href, null, contentDoc, rule.line || 0);
let href = rule.nodeHref || rule.href;
viewSourceUtils.viewSource(href, null, contentDoc, rule.line || 0);
return;
}

View File

@ -3,11 +3,13 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY aboutDialog.title "About &brandFullName;">
<!-- LOCALIZATION NOTE update.applyButton.*, update.upgradeButton.*):
<!-- LOCALIZATION NOTE (update.checkForUpdatesButton.*, update.updateButton.*, update.applyButtonBillboard.*):
# Only one button is present at a time.
# The button when displayed is located directly under the Firefox version in
# the about dialog (see bug 596813 for screenshots).
-->
<!ENTITY update.checkForUpdatesButton.label "Check for updates">
<!ENTITY update.checkForUpdatesButton.accesskey "C">
<!ENTITY update.updateButton.label "Restart to Update">
<!ENTITY update.updateButton.accesskey "R">
<!ENTITY update.applyButtonBillboard.label "Apply Update…">

View File

@ -73,7 +73,7 @@ public class FennecNativeActions implements Actions {
public void handleMessage(final String event, final JSONObject message) {
FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
"handleMessage called for: " + event + "; expecting: " + mGeckoEvent);
mAsserter.is(event, mGeckoEvent, "Given message occurred for registered event");
mAsserter.is(event, mGeckoEvent, "Given message occurred for registered event: " + message);
expecter.notifyOfEvent(message);
}

View File

@ -153,17 +153,18 @@ YCbCrImageDataSerializer::ComputeMinBufferSize(uint32_t aSize)
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
YCbCrImageDataSerializer::InitializeBufferInfo(uint32_t aYOffset,
uint32_t aCbOffset,
uint32_t aCrOffset,
const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode)
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
info->mYOffset = MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
info->mCbOffset = info->mYOffset
+ MOZ_ALIGN_WORD(aYSize.width * aYSize.height);
info->mCrOffset = info->mCbOffset
+ MOZ_ALIGN_WORD(aCbCrSize.width * aCbCrSize.height);
uint32_t info_size = MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
info->mYOffset = info_size + aYOffset;
info->mCbOffset = info_size + aCbOffset;
info->mCrOffset = info_size + aCrOffset;
info->mYWidth = aYSize.width;
info->mYHeight = aYSize.height;
info->mCbCrWidth = aCbCrSize.width;
@ -171,6 +172,17 @@ YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
info->mStereoMode = aStereoMode;
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode)
{
uint32_t yOffset = 0;
uint32_t cbOffset = yOffset + MOZ_ALIGN_WORD(aYSize.width * aYSize.height);
uint32_t crOffset = cbOffset + MOZ_ALIGN_WORD(aCbCrSize.width * aCbCrSize.height);
return InitializeBufferInfo(yOffset, cbOffset, crOffset, aYSize, aCbCrSize, aStereoMode);
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfxIntSize& aYSize,
const gfxIntSize& aCbCrSize,

View File

@ -114,6 +114,12 @@ public:
* The provided pointer should point to the beginning of the (chunk of)
* buffer on which we want to store the image.
*/
void InitializeBufferInfo(uint32_t aYOffset,
uint32_t aCbOffset,
uint32_t aCrOffset,
const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode);
void InitializeBufferInfo(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode);

View File

@ -1213,21 +1213,6 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
scrollOffset.y = scrollableRect.y;
}
// FIXME/bug 936500: Make sure the displayport contains the composition
// bounds. This is to work around a layout bug that means if a display item's
// corresponding displayport doesn't contain its frame's bounds, it may get
// optimised out and the layer won't get created.
if (displayPort.x + displayPort.width < compositionBounds.width) {
displayPort.x = -(displayPort.width - compositionBounds.width);
} else if (displayPort.x > 0) {
displayPort.x = 0;
}
if (displayPort.y + displayPort.height < compositionBounds.height) {
displayPort.y = -(displayPort.height - compositionBounds.height);
} else if (displayPort.y > 0) {
displayPort.y = 0;
}
CSSRect shiftedDisplayPort = displayPort + scrollOffset;
return scrollableRect.ClampRect(shiftedDisplayPort) - scrollOffset;
}

View File

@ -143,8 +143,21 @@ SharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData)
{
mData = aData;
mSize = aData.mPicSize;
/* SetDataNoCopy is used to update YUV plane offsets without (re)allocating
* memory previously allocated with AllocateAndGetNewBuffer().
* serializer.GetData() returns the address of the memory previously allocated
* with AllocateAndGetNewBuffer(), that we subtract from the Y, Cb, Cr
* channels to compute 0-based offsets to pass to InitializeBufferInfo.
*/
YCbCrImageDataSerializer serializer(mTextureClient->GetBuffer());
serializer.InitializeBufferInfo(aData.mYSize,
uint8_t *base = serializer.GetData();
uint32_t yOffset = aData.mYChannel - base;
uint32_t cbOffset = aData.mCbChannel - base;
uint32_t crOffset = aData.mCrChannel - base;
serializer.InitializeBufferInfo(yOffset,
cbOffset,
crOffset,
aData.mYSize,
aData.mCbCrSize,
aData.mStereoMode);
}

View File

@ -7,6 +7,10 @@
#include "AndroidBridge.h"
#include "Link.h"
#include "nsIURI.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#define NS_LINK_VISITED_EVENT_TOPIC "link-visited"
using namespace mozilla;
using mozilla::dom::Link;
@ -78,6 +82,29 @@ nsAndroidHistory::UnregisterVisitedCallback(nsIURI *aURI, Link *aContent)
return NS_OK;
}
void
nsAndroidHistory::AppendToRecentlyVisitedURIs(nsIURI* aURI) {
if (mRecentlyVisitedURIs.Length() < RECENTLY_VISITED_URI_SIZE) {
// Append a new element while the array is not full.
mRecentlyVisitedURIs.AppendElement(aURI);
} else {
// Otherwise, replace the oldest member.
mRecentlyVisitedURIsNextIndex %= RECENTLY_VISITED_URI_SIZE;
mRecentlyVisitedURIs.ElementAt(mRecentlyVisitedURIsNextIndex) = aURI;
mRecentlyVisitedURIsNextIndex++;
}
}
inline bool
nsAndroidHistory::IsRecentlyVisitedURI(nsIURI* aURI) {
bool equals = false;
RecentlyVisitedArray::index_type i;
for (i = 0; i < mRecentlyVisitedURIs.Length() && !equals; ++i) {
aURI->Equals(mRecentlyVisitedURIs.ElementAt(i), &equals);
}
return equals;
}
NS_IMETHODIMP
nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlags)
{
@ -92,6 +119,16 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
return NS_OK;
}
if (aLastVisitedURI) {
bool same;
rv = aURI->Equals(aLastVisitedURI, &same);
NS_ENSURE_SUCCESS(rv, rv);
if (same && IsRecentlyVisitedURI(aURI)) {
// Do not save refresh visits if we have visited this URI recently.
return NS_OK;
}
}
if (!(aFlags & VisitFlags::TOP_LEVEL))
return NS_OK;
@ -106,6 +143,16 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUTF16 uriString(uri);
GeckoAppShell::MarkURIVisited(uriString);
AppendToRecentlyVisitedURIs(aURI);
// Finally, notify that we've been visited.
nsCOMPtr<nsIObserverService> obsService =
mozilla::services::GetObserverService();
if (obsService) {
obsService->NotifyObservers(aURI, NS_LINK_VISITED_EVENT_TOPIC, nullptr);
}
return NS_OK;
}

View File

@ -14,6 +14,9 @@
#define NS_ANDROIDHISTORY_CID \
{0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}
// Max size of History::mRecentlyVisitedURIs
#define RECENTLY_VISITED_URI_SIZE 8
class nsAndroidHistory : public mozilla::IHistory, public nsIRunnable
{
public:
@ -36,6 +39,18 @@ private:
nsTPriorityQueue<nsString> mPendingURIs;
nsresult CanAddURI(nsIURI* aURI, bool* canAdd);
/**
* mRecentlyVisitedURIs remembers URIs which are recently added to the DB,
* to avoid saving these locations repeatedly in a short period.
*/
typedef nsAutoTArray<nsCOMPtr<nsIURI>, RECENTLY_VISITED_URI_SIZE>
RecentlyVisitedArray;
RecentlyVisitedArray mRecentlyVisitedURIs;
RecentlyVisitedArray::index_type mRecentlyVisitedURIsNextIndex;
void AppendToRecentlyVisitedURIs(nsIURI* aURI);
bool IsRecentlyVisitedURI(nsIURI* aURI);
};
#endif

View File

@ -769,7 +769,12 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, {
return this._form.href;
}
let sheet = this.parentStyleSheet;
return sheet.href || sheet.nodeHref;
return sheet.href;
},
get nodeHref() {
let sheet = this.parentStyleSheet;
return sheet ? sheet.nodeHref : "";
},
get location()

View File

@ -606,8 +606,7 @@ BrowserTabActor.prototype = {
return;
}
if (this.attached) {
this._detach();
if (this._detach()) {
this.conn.send({ from: this.actorID,
type: "tabDetached" });
}
@ -675,10 +674,12 @@ BrowserTabActor.prototype = {
/**
* Does the actual work of detaching from a tab.
*
* @returns false if the tab wasn't attached or true of detahing succeeds.
*/
_detach: function BTA_detach() {
if (!this.attached) {
return;
return false;
}
if (this._progressListener) {
@ -699,6 +700,7 @@ BrowserTabActor.prototype = {
}
this._attached = false;
return true;
},
// Protocol Request Handlers
@ -714,12 +716,10 @@ BrowserTabActor.prototype = {
},
onDetach: function BTA_onDetach(aRequest) {
if (!this.attached) {
if (!this._detach()) {
return { error: "wrongState" };
}
this._detach();
return { type: "detached" };
},