This commit is contained in:
David Anderson 2012-06-27 11:00:48 -07:00
Родитель 1e0b810311 8a67ba9232
Коммит 3fe736b4c3
114 изменённых файлов: 2673 добавлений и 1174 удалений

Просмотреть файл

@ -257,6 +257,7 @@ pref("dom.indexedDB.warningQuota", 5);
// prevent video elements from preloading too much data
pref("media.preload.default", 1); // default to preload none
pref("media.preload.auto", 2); // preload metadata if preload=auto
pref("media.cache_size", 4096); // 4MB media cache
// 0: don't show fullscreen keyboard
// 1: always show fullscreen keyboard

Просмотреть файл

@ -13,6 +13,7 @@ let Cc = Components.classes;
let Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyServiceGetter(Services, "fm",
"@mozilla.org/focus-manager;1",
"nsIFocusManager");
@ -26,11 +27,9 @@ let HTMLOptionElement = Ci.nsIDOMHTMLOptionElement;
let FormAssistant = {
init: function fa_init() {
addEventListener("focus", this, true, false);
addEventListener("keypress", this, true, false);
addEventListener("mousedown", this, true, false);
addEventListener("resize", this, true, false);
addEventListener("click", this, true, false);
addEventListener("blur", this, true, false);
addEventListener("keypress", this, true, false);
addEventListener("resize", this, true, false);
addMessageListener("Forms:Select:Choice", this);
addMessageListener("Forms:Input:Value", this);
Services.obs.addObserver(this, "ime-enabled-state-changed", false);
@ -45,48 +44,49 @@ let FormAssistant = {
switch (evt.type) {
case "focus":
this.previousTarget = Services.fm.focusedElement;
break;
case "blur":
if (!target)
return;
this.previousTarget = null;
if (target instanceof HTMLSelectElement ||
(target instanceof HTMLOptionElement && target.parentNode instanceof HTMLSelectElement)) {
sendAsyncMessage("Forms:Input", { "type": "blur" });
}
break;
case 'resize':
if (!this.isKeyboardOpened)
return;
Services.fm.focusedElement.scrollIntoView(false);
break;
case "mousedown":
if (evt.target != target || this.isKeyboardOpened)
if (this.isKeyboardOpened)
return;
let ignore = {
button: true,
checkbox: true,
file: true,
checkbox: true,
radio: true,
reset: true,
submit: true
};
if ((target instanceof HTMLInputElement && ignore[target.type]) ||
!(target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement)) {
return;
if (evt.target instanceof HTMLSelectElement) {
content.setTimeout(function showIMEForSelect() {
sendAsyncMessage("Forms:Input", getJSON(evt.target));
});
} else if (evt.target instanceof HTMLOptionElement &&
evt.target.parentNode instanceof HTMLSelectElement) {
content.setTimeout(function showIMEForSelect() {
sendAsyncMessage("Forms:Input", getJSON(evt.target.parentNode));
});
} else if ((target instanceof HTMLInputElement && !ignore[target.type]) ||
target instanceof HTMLTextAreaElement) {
this.isKeyboardOpened = this.tryShowIme(evt.target);
this.previousTarget = evt.target;
}
break;
this.isKeyboardOpened = this.tryShowIme(evt.target);
case "blur":
if (this.previousTarget) {
sendAsyncMessage("Forms:Input", { "type": "blur" });
this.previousTarget = null;
}
break;
case "resize":
if (!this.isKeyboardOpened)
return;
let focusedElement = this.previousTarget;
if (focusedElement) {
focusedElement.scrollIntoView(false);
}
break;
case "keypress":
@ -99,24 +99,14 @@ let FormAssistant = {
evt.preventDefault();
evt.stopPropagation();
break;
case "click":
content.setTimeout(function showIMEForSelect() {
if (evt.target instanceof HTMLSelectElement) {
sendAsyncMessage("Forms:Input", getJSON(evt.target));
} else if (evt.target instanceof HTMLOptionElement &&
evt.target.parentNode instanceof HTMLSelectElement) {
sendAsyncMessage("Forms:Input", getJSON(evt.target.parentNode));
}
});
break;
}
},
receiveMessage: function fa_receiveMessage(msg) {
let target = Services.fm.focusedElement;
if (!target)
let target = this.previousTarget;
if (!target) {
return;
}
let json = msg.json;
switch (msg.name) {
@ -169,8 +159,9 @@ let FormAssistant = {
// FIXME/bug 729623: work around apparent bug in the IME manager
// in gecko.
let readonly = element.getAttribute("readonly");
if (readonly)
if (readonly) {
return false;
}
sendAsyncMessage("Forms:Input", getJSON(element));
return true;
@ -181,7 +172,8 @@ FormAssistant.init();
function getJSON(element) {
let type = element.type;
let type = element.type || "";
// FIXME/bug 344616 is input type="number"
// Until then, let's return 'number' even if the platform returns 'text'
let attributeType = element.getAttribute("type") || "";

Просмотреть файл

@ -111,6 +111,12 @@ var shell = {
browserFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
document.getElementById('shell').appendChild(browserFrame);
browserFrame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
.createInstance(Ci.nsISHistory);
['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) {
window.addEventListener(type, this, false, true);
window.addEventListener(type, this, true, true);

Просмотреть файл

@ -13,10 +13,6 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/Geometry.jsm');
XPCOMUtils.defineLazyServiceGetter(Services, 'fm',
'@mozilla.org/focus-manager;1',
'nsIFocusManager');
const ContentPanning = {
init: function cp_init() {
['mousedown', 'mouseup', 'mousemove'].forEach(function(type) {

Просмотреть файл

@ -7,6 +7,7 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const kFormsFrameScript = "chrome://browser/content/forms.js";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -37,10 +38,12 @@ MozKeyboard.prototype = {
}),
init: function mozKeyboardInit(win) {
messageManager.loadFrameScript("chrome://browser/content/forms.js", true);
messageManager.loadFrameScript(kFormsFrameScript, true);
messageManager.addMessageListener("Forms:Input", this);
Services.obs.addObserver(this, "inner-window-destroyed", false);
Services.obs.addObserver(this, 'in-process-browser-frame-shown', false);
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
this._window = win;
this._utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
@ -105,11 +108,26 @@ MozKeyboard.prototype = {
},
observe: function mozKeyboardObserve(subject, topic, data) {
if (topic == "inner-window-destroyed") {
switch (topic) {
case "inner-window-destroyed": {
let wId = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
if (wId == this.innerWindowID) {
this.uninit();
}
break;
}
case 'remote-browser-frame-shown':
case 'in-process-browser-frame-shown': {
let frameLoader = subject.QueryInterface(Ci.nsIFrameLoader);
let mm = frameLoader.messageManager;
mm.addMessageListener("Forms:Input", this);
try {
mm.loadFrameScript(kFormsFrameScript, true);
} catch (e) {
dump('Error loading ' + kFormsFrameScript + ' as frame script: ' + e + '\n');
}
break;
}
}
}
};

Просмотреть файл

@ -662,13 +662,6 @@
popup.setAttribute("width", width > 100 ? width : 100);
var yOffset = outerRect.bottom - innerRect.bottom;
// setConsumeRollupEvent() before we call openPopup(),
// see bug #404438 for more details
popup.popupBoxObject.setConsumeRollupEvent(
this.consumeRollupEvent ?
Ci.nsIPopupBoxObject.ROLLUP_CONSUME :
Ci.nsIPopupBoxObject.ROLLUP_NO_CONSUME);
popup.openPopup(this.inputField, "after_start", 0, yOffset, false, false);
}
]]></body>

Просмотреть файл

@ -1,6 +1,6 @@
# Use Clang r155417
export CC="/tools/clang-3.0/bin/clang -fgnu89-inline"
export CXX="/tools/clang-3.0/bin/clang++"
# Use Clang as specified in manifest
export CC="$topsrcdir/clang/bin/clang -fgnu89-inline"
export CXX="$topsrcdir/clang/bin/clang++"
# Mandatory flags for ASan
export ASANFLAGS="-faddress-sanitizer -Dxmalloc=myxmalloc -fPIC"

Просмотреть файл

@ -52,27 +52,27 @@ var gPrefObserver = {
};
function CSPWarning(aMsg, aSource, aScriptSample, aLineNum) {
function CSPWarning(aMsg, aWindowID, aSource, aScriptSample, aLineNum) {
var textMessage = 'CSP WARN: ' + aMsg + "\n";
var consoleMsg = Components.classes["@mozilla.org/scripterror;1"]
.createInstance(Components.interfaces.nsIScriptError);
consoleMsg.init(textMessage, aSource, aScriptSample, aLineNum, 0,
consoleMsg.initWithWindowID(textMessage, aSource, aScriptSample, aLineNum, 0,
Components.interfaces.nsIScriptError.warningFlag,
"Content Security Policy");
"Content Security Policy", aWindowID);
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.logMessage(consoleMsg);
}
function CSPError(aMsg) {
function CSPError(aMsg, aWindowID) {
var textMessage = 'CSP ERROR: ' + aMsg + "\n";
var consoleMsg = Components.classes["@mozilla.org/scripterror;1"]
.createInstance(Components.interfaces.nsIScriptError);
consoleMsg.init(textMessage, null, null, 0, 0,
consoleMsg.initWithWindowID(textMessage, null, null, 0, 0,
Components.interfaces.nsIScriptError.errorFlag,
"Content Security Policy");
"Content Security Policy", aWindowID);
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.logMessage(consoleMsg);

Просмотреть файл

@ -103,6 +103,34 @@ ContentSecurityPolicy.prototype = {
return this._reportOnlyMode || this._policy.allowsEvalInScripts;
},
get innerWindowID() {
let win = null;
let loadContext = null;
try {
loadContext = this._docRequest
.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch (ex) {
try {
loadContext = this._docRequest.loadGroup
.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch (ex) {
}
}
if (loadContext) {
win = loadContext.associatedWindow;
}
if (win) {
try {
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
return winUtils.currentInnerWindowID;
} catch (ex) {
}
}
return null;
},
/**
* Log policy violation on the Error Console and send a report if a report-uri
* is present in the policy
@ -258,6 +286,7 @@ ContentSecurityPolicy.prototype = {
CSPWarning("Directive \"" + violatedDirective + "\" violated"
+ (blockedUri['asciiSpec'] ? " by " + blockedUri.asciiSpec : ""),
this.innerWindowID,
(aSourceFile) ? aSourceFile : null,
(aScriptSample) ? decodeURIComponent(aScriptSample) : null,
(aLineNum) ? aLineNum : null);
@ -318,8 +347,8 @@ ContentSecurityPolicy.prototype = {
} catch(e) {
// it's possible that the URI was invalid, just log a
// warning and skip over that.
CSPWarning("Tried to send report to invalid URI: \"" + uris[i] + "\"");
CSPWarning("error was: \"" + e + "\"");
CSPWarning("Tried to send report to invalid URI: \"" + uris[i] + "\"", this.innerWindowID);
CSPWarning("error was: \"" + e + "\"", this.innerWindowID);
}
}
}
@ -522,7 +551,7 @@ CSPReportRedirectSink.prototype = {
asyncOnChannelRedirect: function channel_redirect(oldChannel, newChannel,
flags, callback) {
CSPWarning("Post of violation report to " + oldChannel.URI.asciiSpec +
" failed, as a redirect occurred");
" failed, as a redirect occurred", this.innerWindowID);
// cancel the old channel so XHR failure callback happens
oldChannel.cancel(Cr.NS_ERROR_ABORT);

Просмотреть файл

@ -101,8 +101,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsContentSink)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mParser)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNodeInfoManager,
nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

Просмотреть файл

@ -1684,6 +1684,7 @@ GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(deckFrame, "DeckFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(flexContainerFrame, "FlexContainerFrame")
GK_ATOM(formControlFrame, "FormControlFrame") // radio or checkbox
GK_ATOM(frameSetFrame, "FrameSetFrame")
GK_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")

Просмотреть файл

@ -177,8 +177,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsNodeInfo)
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsNodeInfo, tmp->mRefCnt.get())
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mOwnerManager,
nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mOwnerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeInfo)

Просмотреть файл

@ -130,11 +130,9 @@ nsNodeInfoManager::~nsNodeInfoManager()
}
NS_IMPL_CYCLE_COLLECTION_NATIVE_CLASS(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsNodeInfoManager, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsNodeInfoManager, Release)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NATIVE_0(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeInfoManager)
if (tmp->mDocument &&
nsCCUncollectableMarker::InGeneration(cb,
tmp->mDocument->GetMarkedCCGeneration())) {
@ -146,6 +144,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mBindingManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeInfoManager)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeInfoManager)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
nsresult
nsNodeInfoManager::Init(nsIDocument *aDocument)
{

Просмотреть файл

@ -28,15 +28,14 @@ class nsIDOMNamedNodeMap;
class nsXULPrototypeDocument;
class nsBindingManager;
class nsNodeInfoManager
class nsNodeInfoManager : public nsISupports
{
public:
nsNodeInfoManager();
~nsNodeInfoManager();
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsNodeInfoManager)
NS_INLINE_DECL_REFCOUNTING(nsNodeInfoManager)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsNodeInfoManager)
/**
* Initialize the nodeinfo manager with a document.

Просмотреть файл

@ -780,7 +780,9 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
// we've previously encountered before, we'll either backoff again if we
// haven't found an end time yet, or return the last end time found.
const int step = 5000;
const int maxOggPageSize = 65306;
PRInt64 readStartOffset = aEndOffset;
PRInt64 readLimitOffset = aEndOffset;
PRInt64 readHead = aEndOffset;
PRInt64 endTime = -1;
PRUint32 checksumAfterSeek = 0;
@ -802,6 +804,12 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
checksumAfterSeek = 0;
ogg_sync_reset(&sync.mState);
readStartOffset = NS_MAX(static_cast<PRInt64>(0), readStartOffset - step);
// There's no point reading more than the maximum size of
// an Ogg page into data we've previously scanned. Any data
// between readLimitOffset and aEndOffset must be garbage
// and we can ignore it thereafter.
readLimitOffset = NS_MIN(readLimitOffset,
readStartOffset + maxOggPageSize);
readHead = NS_MAX(aStartOffset, readStartOffset);
}
@ -827,6 +835,9 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
NS_ENSURE_SUCCESS(res, -1);
}
readHead += bytesRead;
if (readHead > readLimitOffset) {
mustBackOff = true;
}
// Update the synchronisation layer with the number
// of bytes written to the buffer

Просмотреть файл

@ -170,8 +170,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXULPrototypeDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRoot)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mGlobalObject");
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObject*>(tmp->mGlobalObject));
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNodeInfoManager,
nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfoManager)
for (PRUint32 i = 0; i < tmp->mPrototypeWaiters.Length(); ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mPrototypeWaiters[i]");
cb.NoteXPCOMChild(static_cast<nsINode*>(tmp->mPrototypeWaiters[i].get()));

Просмотреть файл

@ -9859,17 +9859,6 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
} // end of same-origin check
nsCOMPtr<nsISHistory> sessionHistory = mSessionHistory;
if (!sessionHistory) {
// Get the handle to SH from the root docshell
GetRootSessionHistory(getter_AddRefs(sessionHistory));
}
NS_ENSURE_TRUE(sessionHistory, NS_ERROR_FAILURE);
nsCOMPtr<nsISHistoryInternal> shInternal =
do_QueryInterface(sessionHistory, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// Step 3: Create a new entry in the session history. This will erase
// all SHEntries after the new entry and make this entry the current
// one. This operation may modify mOSHE, which we need later, so we

Просмотреть файл

@ -7,6 +7,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=511449
<title>Test for Bug 511449</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/NativeKeyCodes.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
@ -40,7 +41,7 @@ function runNextTest() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendNativeKeyEvent(0, 13 /* w */, 0x4000 /* cmd */, "w", "w");
utils.sendNativeKeyEvent(0, MAC_VK_ANSI_W, 0x4000 /* cmd */, "w", "w");
setTimeout(function () {
ok(didClose, "Cmd+W should have closed the tab");

Просмотреть файл

@ -5926,11 +5926,18 @@ static const IDBConstant sIDBConstants[] = {
static JSBool
IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval* vp)
{
MOZ_ASSERT(JSID_IS_INT(id));
int8_t index = JSID_TO_INT(id);
MOZ_ASSERT((uint8_t)index < mozilla::ArrayLength(sIDBConstants));
JSString *idstr = JSID_TO_STRING(id);
unsigned index;
for (index = 0; index < mozilla::ArrayLength(sIDBConstants); index++) {
JSBool match;
if (!JS_StringEqualsAscii(cx, idstr, sIDBConstants[index].name, &match)) {
return JS_FALSE;
}
if (match) {
break;
}
}
MOZ_ASSERT(index < mozilla::ArrayLength(sIDBConstants));
const IDBConstant& c = sIDBConstants[index];
@ -6015,9 +6022,9 @@ DefineIDBInterfaceConstants(JSContext *cx, JSObject *obj, const nsIID *aIID)
continue;
}
if (!::JS_DefinePropertyWithTinyId(cx, obj, c.name, i, JSVAL_VOID,
IDBConstantGetter, nsnull,
JSPROP_ENUMERATE)) {
if (!JS_DefineProperty(cx, obj, c.name, JSVAL_VOID,
IDBConstantGetter, nsnull,
JSPROP_ENUMERATE)) {
return NS_ERROR_UNEXPECTED;
}
}

Просмотреть файл

@ -184,9 +184,15 @@ IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
getter_AddRefs(connection));
NS_ENSURE_SUCCESS(rv, nsnull);
// Turn on foreign key constraints!
// Turn on foreign key constraints and recursive triggers.
// The "INSERT OR REPLACE" statement doesn't fire the update trigger,
// instead it fires only the insert trigger. This confuses the update
// refcount function. This behavior changes with enabled recursive triggers,
// so the statement fires the delete trigger first and then the insert
// trigger.
rv = connection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"PRAGMA foreign_keys = ON;"
"PRAGMA foreign_keys = ON; "
"PRAGMA recursive_triggers = ON;"
));
NS_ENSURE_SUCCESS(rv, nsnull);

Просмотреть файл

@ -51,6 +51,7 @@ TEST_FILES = \
test_file_os_delete.html \
test_file_put_get_object.html \
test_file_put_get_values.html \
test_file_replace.html \
test_file_resurrection_delete.html \
test_file_resurrection_transaction_abort.html \
test_file_sharing.html \

Просмотреть файл

@ -0,0 +1,67 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Property Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript;version=1.7">
function testSteps()
{
const name = window.location.pathname;
const description = "My Test Database";
const objectStoreName = "Blobs";
const blobData = { key: 42, blobs: [] };
for (let i = 0; i < 100; i++) {
blobData.blobs[i] = getRandomBlob(i);
}
let request = mozIndexedDB.open(name, 1, description);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = grabEventAndContinueHandler;
let event = yield;
is(event.type, "upgradeneeded", "Got correct event type");
let db = event.target.result;
db.onerror = errorHandler;
let objectStore = db.createObjectStore(objectStoreName, { });
for (let i = 0; i < blobData.blobs.length; i++) {
objectStore.put(blobData.blobs[i], blobData.key);
}
event = yield;
is(event.type, "success", "Got correct event type");
for (let id = 1; id <= 100; id++) {
let refs = {};
let dbRefs = {};
let hasFileInfo = utils.getFileReferences(name, id, refs, dbRefs);
ok(hasFileInfo, "Has file info");
is(refs.value, 1, "Correct ref count");
is(dbRefs.value, id / 100 >> 0, "Correct db ref count");
}
finishTest();
yield;
}
</script>
<script type="text/javascript;version=1.7" src="file.js"></script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
</head>
<body onload="runTest();"></body>
</html>

Просмотреть файл

@ -347,6 +347,8 @@ interface nsIDOMWindowUtils : nsISupports {
* Cannot be accessed from unprivileged context (not content-accessible)
* Will throw a DOM security error if called without UniversalXPConnect
* privileges.
*
* When you use this for tests, use the constants defined in NativeKeyCodes.js
*/
void sendNativeKeyEvent(in long aNativeKeyboardLayout,
in long aNativeKeyCode,

Просмотреть файл

@ -347,9 +347,11 @@ SmsDatabaseService.prototype = {
*/
saveReceivedMessage: function saveReceivedMessage(sender, body, date) {
let receiver = this.mRIL.rilContext.icc ? this.mRIL.rilContext.icc.msisdn : null;
let message = {delivery: DELIVERY_RECEIVED,
sender: sender,
receiver: this.mRIL.rilContext.icc.msisdn,
receiver: receiver,
body: body,
timestamp: date,
read: FILTER_READ_UNREAD};
@ -357,8 +359,10 @@ SmsDatabaseService.prototype = {
},
saveSentMessage: function saveSentMessage(receiver, body, date) {
let sender = this.mRIL.rilContext.icc ? this.mRIL.rilContext.icc.msisdn : null;
let message = {delivery: DELIVERY_SENT,
sender: this.mRIL.rilContext.icc.msisdn,
sender: sender,
receiver: receiver,
body: body,
timestamp: date,

Просмотреть файл

@ -997,7 +997,14 @@ let RIL = {
},
getIMSI: function getIMSI() {
Buf.simpleRequest(REQUEST_GET_IMSI);
if (RILQUIRKS_V5_LEGACY) {
Buf.simpleRequest(REQUEST_GET_IMSI);
return;
}
let token = Buf.newParcel(REQUEST_GET_IMSI);
Buf.writeUint32(1);
Buf.writeString(null);
Buf.sendParcel();
},
/**

Просмотреть файл

@ -500,10 +500,22 @@ var WifiManager = (function() {
}
function notifyStateChange(fields) {
// If we're already in the COMPLETED state, we might receive events from
// the supplicant that tell us that we're re-authenticating or reminding
// us that we're associated to a network. In those cases, we don't need to
// do anything, so just ignore them.
if (manager.state === "COMPLETED" &&
fields.state !== "DISCONNECTED" &&
fields.state !== "INTERFACE_DISABLED" &&
fields.state !== "INACTIVE" &&
fields.state !== "SCANNING") {
return false;
}
fields.prevState = manager.state;
manager.state = fields.state;
notify("statechange", fields);
return true;
}
function parseStatus(status, reconnected) {
@ -744,8 +756,11 @@ var WifiManager = (function() {
// Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]
var bssid = eventData.split(" ")[4];
var id = eventData.substr(eventData.indexOf("id=")).split(" ")[0];
notifyStateChange({ state: "CONNECTED", BSSID: bssid, id: id });
onconnected(false);
// Don't call onconnected if we ignored this state change (since we were
// already connected).
if (notifyStateChange({ state: "CONNECTED", BSSID: bssid, id: id }))
onconnected(false);
return true;
}
if (eventData.indexOf("CTRL-EVENT-SCAN-RESULTS") === 0) {

Просмотреть файл

@ -467,8 +467,10 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT
/* We can't (easily) forward our transform to children with a non-empty clip
* rect since it would need to be adjusted for the transform. See
* the calculations performed by CalculateScissorRect above.
* Nor for a child with a mask layer.
*/
if (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) {
if ((clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) ||
child->GetMaskLayer()) {
useIntermediateSurface = true;
break;
}

Просмотреть файл

@ -0,0 +1,4 @@
<!DOCTYPE html>
<html style="-moz-perspective: 7000px; overflow: hidden;">
<body style="overflow: hidden; -moz-transform: rotateX(30deg); border-radius: 1px; -moz-columns: 2 10px; visibility: collapse;">X</body>
</html>

Просмотреть файл

@ -86,4 +86,4 @@ load 633453-1.html
load 633322-1.html
load 686190-1.html
load 693143-1.html
load 768079-1.html

Просмотреть файл

@ -5819,13 +5819,13 @@ EmitDefaults(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
size_t tableSize = (size_t)(JUMP_OFFSET_LEN * (3 + ndefaults));
if (EmitN(cx, bce, JSOP_TABLESWITCH, tableSize) < 0)
return false;
jsbytecode *pc = bce->code(top + JUMP_OFFSET_LEN);
ptrdiff_t jumpoff = top + JUMP_OFFSET_LEN;
JS_ASSERT(nformal >= ndefaults);
uint16_t defstart = nformal - ndefaults;
SET_JUMP_OFFSET(pc, defstart);
pc += JUMP_OFFSET_LEN;
SET_JUMP_OFFSET(pc, nformal - 1);
pc += JUMP_OFFSET_LEN;
SET_JUMP_OFFSET(bce->code(jumpoff), defstart);
jumpoff += JUMP_OFFSET_LEN;
SET_JUMP_OFFSET(bce->code(jumpoff), nformal - 1);
jumpoff += JUMP_OFFSET_LEN;
// Fill body of switch, which sets defaults where needed.
unsigned i;
@ -5833,8 +5833,8 @@ EmitDefaults(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
for (arg = pn->pn_head, i = 0; arg != pnlast; arg = arg->pn_next, i++) {
if (!(arg->pn_dflags & PND_DEFAULT))
continue;
SET_JUMP_OFFSET(pc, bce->offset() - top);
pc += JUMP_OFFSET_LEN;
SET_JUMP_OFFSET(bce->code(jumpoff), bce->offset() - top);
jumpoff += JUMP_OFFSET_LEN;
ParseNode *expr;
if (arg->isKind(PNK_NAME)) {
expr = arg->expr();
@ -5873,7 +5873,7 @@ EmitDefaults(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (Emit1(cx, bce, JSOP_POP) < 0)
return false;
}
JS_ASSERT(pc == bce->code(top + tableSize));
JS_ASSERT(jumpoff == top + ptrdiff_t(tableSize));
SET_JUMP_OFFSET(bce->code(top), bce->offset() - top);
return true;
}

Просмотреть файл

@ -593,7 +593,8 @@ SizeOfJSContext();
D(DOM_WORKER) \
D(INTER_SLICE_GC) \
D(REFRESH_FRAME) \
D(FULL_GC_TIMER)
D(FULL_GC_TIMER) \
D(SHUTDOWN_CC)
namespace gcreason {

Просмотреть файл

@ -891,6 +891,8 @@ MarkExactStackRoots(JSTracer *trc)
MarkStringRoot(trc, (JSString **)addr, "exact stackroot string");
} else if (i == THING_ROOT_ID) {
MarkIdRoot(trc, (jsid *)addr, "exact stackroot id");
} else if (i == THING_ROOT_PROPERTY_ID) {
MarkIdRoot(trc, ((PropertyId *)addr)->asId(), "exact stackroot property id");
} else if (i == THING_ROOT_VALUE) {
MarkValueRoot(trc, (Value *)addr, "exact stackroot value");
} else if (i == THING_ROOT_SHAPE) {
@ -3222,7 +3224,6 @@ EndMarkPhase(JSRuntime *rt)
* cycle collector from collecting some dead objects.
*/
if (foundBlackGray) {
JS_ASSERT(false);
for (CompartmentsIter c(rt); !c.done(); c.next()) {
if (!c->isCollecting())
c->arenas.unmarkAll();
@ -3862,13 +3863,15 @@ static bool
ShouldCleanUpEverything(JSRuntime *rt, gcreason::Reason reason)
{
// During shutdown, we must clean everything up, for the sake of leak
// detection. When a runtime has no contexts, or we're doing a forced GC,
// those are strong indications that we're shutting down.
// detection. When a runtime has no contexts, or we're doing a GC before a
// shutdown CC, those are strong indications that we're shutting down.
//
// DEBUG_MODE_GC indicates we're discarding code because the debug mode
// has changed; debug mode affects the results of bytecode analysis, so
// we need to clear everything away.
return !rt->hasContexts() || reason == gcreason::CC_FORCED || reason == gcreason::DEBUG_MODE_GC;
return !rt->hasContexts() ||
reason == gcreason::SHUTDOWN_CC ||
reason == gcreason::DEBUG_MODE_GC;
}
static void
@ -3887,7 +3890,7 @@ Collect(JSRuntime *rt, bool incremental, int64_t budget,
#ifdef JS_GC_ZEAL
bool restartVerify = rt->gcVerifyData &&
rt->gcZeal() == ZealVerifierValue &&
reason != gcreason::CC_FORCED &&
reason != gcreason::SHUTDOWN_CC &&
rt->hasContexts();
struct AutoVerifyBarriers {

Просмотреть файл

@ -231,6 +231,7 @@ enum ThingRootKind
THING_ROOT_SCRIPT,
THING_ROOT_XML,
THING_ROOT_ID,
THING_ROOT_PROPERTY_ID,
THING_ROOT_VALUE,
THING_ROOT_LIMIT
};

Просмотреть файл

@ -1266,6 +1266,7 @@ class ObjectImpl : public gc::Cell
}
/* GC support. */
static inline ThingRootKind rootKind() { return THING_ROOT_OBJECT; }
static inline void readBarrier(ObjectImpl *obj);
static inline void writeBarrierPre(ObjectImpl *obj);
static inline void writeBarrierPost(ObjectImpl *obj, void *addr);
@ -1359,4 +1360,13 @@ HasElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index, unsigned reso
} /* namespace js */
namespace JS {
template <> struct RootMethods<js::PropertyId>
{
static js::PropertyId initial() { return js::PropertyId(); }
static ThingRootKind kind() { return THING_ROOT_PROPERTY_ID; }
static bool poisoned(js::PropertyId propid) { return IsPoisonedId(propid.asId()); }
};
}
#endif /* ObjectImpl_h__ */

Просмотреть файл

@ -3630,10 +3630,11 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative *wrappe
return rv;
}
class ContextHolder : public nsISupports
class ContextHolder : public nsIScriptObjectPrincipal
, public nsIScriptContextPrincipal
{
public:
ContextHolder(JSContext *aOuterCx, JSObject *aSandbox, bool isChrome);
ContextHolder(JSContext *aOuterCx, JSObject *aSandbox, nsIPrincipal *aPrincipal);
virtual ~ContextHolder();
JSContext * GetJSContext()
@ -3641,6 +3642,9 @@ public:
return mJSContext;
}
nsIScriptObjectPrincipal * GetObjectPrincipal() { return this; }
nsIPrincipal * GetPrincipal() { return mPrincipal; }
NS_DECL_ISUPPORTS
private:
@ -3648,17 +3652,23 @@ private:
JSContext* mJSContext;
JSContext* mOrigCx;
nsCOMPtr<nsIPrincipal> mPrincipal;
};
NS_IMPL_ISUPPORTS0(ContextHolder)
NS_IMPL_ISUPPORTS2(ContextHolder, nsIScriptObjectPrincipal, nsIScriptContextPrincipal)
ContextHolder::ContextHolder(JSContext *aOuterCx,
JSObject *aSandbox,
bool isChrome)
nsIPrincipal *aPrincipal)
: mJSContext(JS_NewContext(JS_GetRuntime(aOuterCx), 1024)),
mOrigCx(aOuterCx)
mOrigCx(aOuterCx),
mPrincipal(aPrincipal)
{
if (mJSContext) {
bool isChrome;
DebugOnly<nsresult> rv = XPCWrapper::GetSecurityManager()->
IsSystemPrincipal(mPrincipal, &isChrome);
MOZ_ASSERT(NS_SUCCEEDED(rv));
bool allowXML = Preferences::GetBool(isChrome ?
"javascript.options.xml.chrome" :
"javascript.options.xml.content");
@ -3816,10 +3826,7 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
}
}
bool isChrome;
nsresult rv = XPCWrapper::GetSecurityManager()->IsSystemPrincipal(prin, &isChrome);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<ContextHolder> sandcx = new ContextHolder(cx, sandbox, isChrome);
nsRefPtr<ContextHolder> sandcx = new ContextHolder(cx, sandbox, prin);
if (!sandcx || !sandcx->GetJSContext()) {
JS_ReportError(cx, "Can't prepare context for evalInSandbox");
return NS_ERROR_OUT_OF_MEMORY;
@ -3835,7 +3842,7 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
return NS_ERROR_FAILURE;
}
rv = NS_OK;
nsresult rv = NS_OK;
{
JSAutoRequest req(sandcx->GetJSContext());

Просмотреть файл

@ -95,6 +95,9 @@
#include "nsIDOMXULDocument.h"
#include "nsIXULDocument.h"
#endif
#ifdef MOZ_FLEXBOX
#include "nsFlexContainerFrame.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@ -329,6 +332,16 @@ static PRInt32 FFWC_recursions=0;
static PRInt32 FFWC_nextInFlows=0;
#endif
#ifdef MOZ_FLEXBOX
// Returns true if aFrame is an anonymous flex item
static inline bool
IsAnonymousFlexItem(const nsIFrame* aFrame)
{
const nsIAtom* pseudoType = aFrame->GetStyleContext()->GetPseudo();
return pseudoType == nsCSSAnonBoxes::anonymousFlexItem;
}
#endif // MOZ_FLEXBOX
static inline nsIFrame*
GetFieldSetBlockFrame(nsIFrame* aFieldsetFrame)
{
@ -365,6 +378,20 @@ IsInlineFrame(const nsIFrame* aFrame)
return aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
}
/**
* Returns true iff aFrame explicitly prevents its descendants from floating
* (at least, down to the level of descendants which themselves are
* float-containing blocks -- those will manage the floating status of any
* lower-level descendents inside them, of course).
*/
static bool
ShouldSuppressFloatingOfDescendants(nsIFrame* aFrame)
{
return aFrame->IsFrameOfType(nsIFrame::eMathML) ||
aFrame->IsBoxFrame() ||
aFrame->GetType() == nsGkAtoms::flexContainerFrame;
}
/**
* If any children require a block parent, return the first such child.
* Otherwise return null.
@ -3684,6 +3711,14 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
}
if (bits & FCDATA_USE_CHILD_ITEMS) {
NS_ASSERTION(!ShouldSuppressFloatingOfDescendants(newFrame),
"uh oh -- this frame is supposed to _suppress_ floats, but "
"we're about to push it as a float containing block...");
nsFrameConstructorSaveState floatSaveState;
if (newFrame->IsFloatContainingBlock()) {
aState.PushFloatContainingBlock(newFrame, floatSaveState);
}
rv = ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
childItems);
} else {
@ -4331,6 +4366,12 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
{ NS_STYLE_DISPLAY_INLINE,
FULL_CTOR_FCDATA(FCDATA_IS_INLINE | FCDATA_IS_LINE_PARTICIPANT,
&nsCSSFrameConstructor::ConstructInline) },
#ifdef MOZ_FLEXBOX
{ NS_STYLE_DISPLAY_FLEX,
FCDATA_DECL(0, NS_NewFlexContainerFrame) },
{ NS_STYLE_DISPLAY_INLINE_FLEX,
FCDATA_DECL(0, NS_NewFlexContainerFrame) },
#endif // MOZ_FLEXBOX
{ NS_STYLE_DISPLAY_TABLE,
FULL_CTOR_FCDATA(0, &nsCSSFrameConstructor::ConstructTable) },
{ NS_STYLE_DISPLAY_INLINE_TABLE,
@ -5510,8 +5551,8 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIFrame* aFrame)
// frames, because they don't seem to be able to deal.
// The logic here needs to match the logic in ProcessChildren()
for (nsIFrame* containingBlock = aFrame;
containingBlock && !containingBlock->IsFrameOfType(nsIFrame::eMathML) &&
!containingBlock->IsBoxFrame();
containingBlock &&
!ShouldSuppressFloatingOfDescendants(containingBlock);
containingBlock = containingBlock->GetParent()) {
if (containingBlock->IsFloatContainingBlock()) {
return containingBlock;
@ -8945,6 +8986,55 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
return true;
}
#ifdef MOZ_FLEXBOX
// Might need to reconstruct things if the removed frame's nextSibling is an
// anonymous flex item. The removed frame might've been what divided two
// runs of inline content into two anonymous flex items, which would now
// need to be merged.
// NOTE: It's fine that we've advanced nextSibling past whitespace (up above);
// we're only interested in anonymous flex items here, and those can never
// be adjacent to whitespace, since they absorb contiguous runs of inline
// non-replaced content (including whitespace).
if (nextSibling && IsAnonymousFlexItem(nextSibling)) {
NS_ABORT_IF_FALSE(parent->GetType() == nsGkAtoms::flexContainerFrame,
"anonymous flex items should only exist as children "
"of flex container frames");
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval: "
"frame=");
nsFrame::ListTag(stdout, aFrame);
printf(" has an anonymous flex item as its next sibling\n");
}
#endif // DEBUG
// Recreate frames for the flex container (the removed frame's parent)
*aResult = RecreateFramesForContent(parent->GetContent(), true);
return true;
}
// Might need to reconstruct things if the removed frame's nextSibling is
// null and its parent is an anonymous flex item. (This might be the last
// remaining child of that anonymous flex item, which can then go away.)
if (!nextSibling && IsAnonymousFlexItem(parent)) {
NS_ABORT_IF_FALSE(parent->GetParent() &&
parent->GetParent()->GetType() == nsGkAtoms::flexContainerFrame,
"anonymous flex items should only exist as children "
"of flex container frames");
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval: "
"frame=");
nsFrame::ListTag(stdout, aFrame);
printf(" has an anonymous flex item as its parent\n");
}
#endif // DEBUG
// Recreate frames for the flex container (the removed frame's grandparent)
*aResult = RecreateFramesForContent(parent->GetParent()->GetContent(),
true);
return true;
}
#endif // MOZ_FLEXBOX
#ifdef MOZ_XUL
if (aFrame->GetType() == nsGkAtoms::popupSetFrame) {
nsIRootBox* rootBox = nsIRootBox::GetRootBox(mPresShell);
@ -9217,6 +9307,116 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
}
};
#ifdef MOZ_FLEXBOX
void
nsCSSFrameConstructor::CreateNeededAnonFlexItems(
nsFrameConstructorState& aState,
FrameConstructionItemList& aItems,
nsIFrame* aParentFrame)
{
NS_ABORT_IF_FALSE(aParentFrame->GetType() == nsGkAtoms::flexContainerFrame,
"Should only be called for items in a flex container frame");
if (aItems.IsEmpty()) {
return;
}
FCItemIterator iter(aItems);
do {
// Advance iter past children that don't want to be wrapped
if (iter.SkipItemsThatDontNeedAnonFlexItem(aState)) {
// Hit the end of the items without finding any remaining children that
// need to be wrapped. We're finished!
return;
}
// If our next potentially-wrappable child is whitespace, then see if
// there's anything wrappable immediately after it. If not, we just drop
// the whitespace and move on. (We're not supposed to create any anonymous
// flex items that _only_ contain whitespace).
if (iter.item().IsWhitespace(aState)) {
FCItemIterator afterWhitespaceIter(iter);
bool hitEnd = afterWhitespaceIter.SkipWhitespace(aState);
bool nextChildNeedsAnonFlexItem =
!hitEnd && afterWhitespaceIter.item().NeedsAnonFlexItem(aState);
if (!nextChildNeedsAnonFlexItem) {
// There's nothing after the whitespace that we need to wrap, so we
// just drop this run of whitespace.
iter.DeleteItemsTo(afterWhitespaceIter);
if (hitEnd) {
// Nothing left to do -- we're finished!
return;
}
// else, we have a next child and it does not want to be wrapped. So,
// we jump back to the beginning of the loop to skip over that child
// (and anything else non-wrappable after it)
NS_ABORT_IF_FALSE(!iter.IsDone() &&
!iter.item().NeedsAnonFlexItem(aState),
"hitEnd and/or nextChildNeedsAnonFlexItem lied");
continue;
}
}
// Now |iter| points to the first child that needs to be wrapped in an
// anonymous flex item. Now we see how many children after it also want
// to be wrapped in an anonymous flex item.
FCItemIterator endIter(iter); // iterator to find the end of the group
endIter.SkipItemsThatNeedAnonFlexItem(aState);
NS_ASSERTION(iter != endIter,
"Should've had at least one wrappable child to seek past");
// Now, we create the anonymous flex item to contain the children
// between |iter| and |endIter|.
nsIAtom* pseudoType = nsCSSAnonBoxes::anonymousFlexItem;
nsStyleContext* parentStyle = aParentFrame->GetStyleContext();
nsIContent* parentContent = aParentFrame->GetContent();
nsRefPtr<nsStyleContext> wrapperStyle =
mPresShell->StyleSet()->ResolveAnonymousBoxStyle(pseudoType, parentStyle);
static const FrameConstructionData sBlockFormattingContextFCData =
FCDATA_DECL(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS,
NS_NewBlockFormattingContext);
FrameConstructionItem* newItem =
new FrameConstructionItem(&sBlockFormattingContextFCData,
// Use the content of our parent frame
parentContent,
// Lie about the tag; it doesn't matter anyway
pseudoType,
iter.item().mNameSpaceID,
// no pending binding
nsnull,
wrapperStyle.forget(),
true);
newItem->mIsAllInline = newItem->mHasInlineEnds =
newItem->mStyleContext->GetStyleDisplay()->IsInlineOutside();
newItem->mIsBlock = !newItem->mIsAllInline;
NS_ABORT_IF_FALSE(!newItem->mIsAllInline && newItem->mIsBlock,
"expecting anonymous flex items to be block-level "
"(this will make a difference when we encounter "
"'flex-align: baseline')");
// Anonymous flex items induce line boundaries around their
// contents.
newItem->mChildItems.SetLineBoundaryAtStart(true);
newItem->mChildItems.SetLineBoundaryAtEnd(true);
// The parent of the items in aItems is also the parent of the items
// in mChildItems
newItem->mChildItems.SetParentHasNoXBLChildren(
aItems.ParentHasNoXBLChildren());
// Eat up all items between |iter| and |endIter| and put them in our
// wrapper. This advances |iter| to point to |endIter|.
iter.AppendItemsToList(endIter, newItem->mChildItems);
iter.InsertItem(newItem);
} while (!iter.IsDone());
}
#endif // MOZ_FLEXBOX
/*
* This function works as follows: we walk through the child list (aItems) and
* find items that cannot have aParentFrame as their parent. We wrap
@ -9437,6 +9637,12 @@ nsCSSFrameConstructor::ConstructFramesFromItemList(nsFrameConstructorState& aSta
CreateNeededTablePseudos(aState, aItems, aParentFrame);
#ifdef MOZ_FLEXBOX
if (aParentFrame->GetType() == nsGkAtoms::flexContainerFrame) {
CreateNeededAnonFlexItems(aState, aItems, aParentFrame);
}
#endif // MOZ_FLEXBOX
#ifdef DEBUG
for (FCItemIterator iter(aItems); !iter.IsDone(); iter.Next()) {
NS_ASSERTION(iter.item().DesiredParentType() == GetParentType(aParentFrame),
@ -9486,8 +9692,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
// The logic here needs to match the logic in GetFloatContainingBlock()
nsFrameConstructorSaveState floatSaveState;
if (aFrame->IsFrameOfType(nsIFrame::eMathML) ||
aFrame->IsBoxFrame()) {
if (ShouldSuppressFloatingOfDescendants(aFrame)) {
aState.PushFloatContainingBlock(nsnull, floatSaveState);
} else if (aFrame->IsFloatContainingBlock()) {
aState.PushFloatContainingBlock(aFrame, floatSaveState);
@ -10978,7 +11183,67 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
nsIFrame* nextSibling = ::GetInsertNextSibling(aFrame, aPrevSibling);
// Situation #2 is a case when table pseudo-frames don't work out right
#ifdef MOZ_FLEXBOX
// Situation #2 is a flex container frame into which we're inserting new
// inline non-replaced children, adjacent to an existing anonymous flex item.
if (aFrame->GetType() == nsGkAtoms::flexContainerFrame) {
FCItemIterator iter(aItems);
// Check if we're adding to-be-wrapped content right *after* an existing
// anonymous flex item (which would need to absorb this content).
if (aPrevSibling && IsAnonymousFlexItem(aPrevSibling) &&
iter.item().NeedsAnonFlexItem(aState)) {
RecreateFramesForContent(aFrame->GetContent(), true);
return true;
}
// Check if we're adding to-be-wrapped content right *before* an existing
// anonymous flex item (which would need to absorb this content).
if (nextSibling && IsAnonymousFlexItem(nextSibling)) {
// Jump to the last entry in the list
iter.SetToEnd();
iter.Prev();
if (iter.item().NeedsAnonFlexItem(aState)) {
RecreateFramesForContent(aFrame->GetContent(), true);
return true;
}
}
}
// Situation #3 is an anonymous flex item that's getting new children who
// don't want to be wrapped.
if (IsAnonymousFlexItem(aFrame)) {
nsIFrame* flexContainerFrame = aFrame->GetParent();
NS_ABORT_IF_FALSE(flexContainerFrame &&
flexContainerFrame->GetType() == nsGkAtoms::flexContainerFrame,
"anonymous flex items should only exist as children "
"of flex container frames");
// We need to push a null float containing block to be sure that
// "NeedsAnonFlexItem" will know we're not honoring floats for this
// inserted content. (In particular, this is necessary in order for
// NeedsAnonFlexItem's "GetGeometricParent" call to return the correct
// result.) We're not honoring floats on this content because it has the
// _flex container_ as its parent in the content tree.
nsFrameConstructorSaveState floatSaveState;
aState.PushFloatContainingBlock(nsnull, floatSaveState);
FCItemIterator iter(aItems);
// Skip over things that _do_ need an anonymous flex item, because
// they're perfectly happy to go here -- they won't cause a reframe.
if (!iter.SkipItemsThatNeedAnonFlexItem(aState)) {
// We hit something that _doesn't_ need an anonymous flex item!
// Rebuild the flex container to bust it out.
RecreateFramesForContent(flexContainerFrame->GetContent(), true);
return true;
}
// If we get here, then everything in |aItems| needs to be wrapped in
// an anonymous flex item. That's where it's already going - good!
}
#endif // MOZ_FLEXBOX
// Situation #4 is a case when table pseudo-frames don't work out right
ParentType parentType = GetParentType(aFrame);
// If all the kids want a parent of the type that aFrame is, then we're all
// set to go. Indeed, there won't be any table pseudo-frames created between
@ -11810,6 +12075,59 @@ Iterator::SkipItemsWantingParentType(ParentType aParentType)
return false;
}
#ifdef MOZ_FLEXBOX
bool
nsCSSFrameConstructor::FrameConstructionItem::
NeedsAnonFlexItem(const nsFrameConstructorState& aState)
{
if (mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) {
// This will be an inline non-replaced box.
return true;
}
if (!(mFCData->mBits & FCDATA_DISALLOW_OUT_OF_FLOW) &&
aState.GetGeometricParent(mStyleContext->GetStyleDisplay(), nsnull)) {
// We're abspos or fixedpos, which means we'll spawn a placeholder which
// we'll need to wrap in an anonymous flex item. So, we just treat
// _this_ frame as if _it_ needs to be wrapped in an anonymous flex item,
// and then when we spawn the placeholder, it'll end up in the right spot.
return true;
}
return false;
}
inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipItemsThatNeedAnonFlexItem(
const nsFrameConstructorState& aState)
{
NS_PRECONDITION(!IsDone(), "Shouldn't be done yet");
while (item().NeedsAnonFlexItem(aState)) {
Next();
if (IsDone()) {
return true;
}
}
return false;
}
inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipItemsThatDontNeedAnonFlexItem(
const nsFrameConstructorState& aState)
{
NS_PRECONDITION(!IsDone(), "Shouldn't be done yet");
while (!(item().NeedsAnonFlexItem(aState))) {
Next();
if (IsDone()) {
return true;
}
}
return false;
}
#endif // MOZ_FLEXBOX
inline bool
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::SkipWhitespace(nsFrameConstructorState& aState)

Просмотреть файл

@ -916,6 +916,20 @@ private:
// iterator must not be done when this is called.
inline bool SkipItemsWantingParentType(ParentType aParentType);
#ifdef MOZ_FLEXBOX
// Skip over non-replaced inline frames and positioned frames.
// Return whether the iterator is done after doing that.
// The iterator must not be done when this is called.
inline bool SkipItemsThatNeedAnonFlexItem(
const nsFrameConstructorState& aState);
// Skip to the first frame that is a non-replaced inline or is
// positioned. Return whether the iterator is done after doing that.
// The iterator must not be done when this is called.
inline bool SkipItemsThatDontNeedAnonFlexItem(
const nsFrameConstructorState& aState);
#endif // MOZ_FLEXBOX
// Skip over whitespace. Return whether the iterator is done after doing
// that. The iterator must not be done, and must be pointing to a
// whitespace item when this is called.
@ -1030,6 +1044,12 @@ private:
return FCDATA_DESIRED_PARENT_TYPE(mFCData->mBits);
}
// Indicates whether (when in a flexbox container) this item needs to be
// wrapped in an anonymous block.
#ifdef MOZ_FLEXBOX
bool NeedsAnonFlexItem(const nsFrameConstructorState& aState);
#endif // MOZ_FLEXBOX
// Don't call this unless the frametree really depends on the answer!
// Especially so for generated content, where we don't want to reframe
// things.
@ -1097,6 +1117,19 @@ private:
FrameConstructionItem(const FrameConstructionItem& aOther) MOZ_DELETE; /* not implemented */
};
/**
* Function to create the anonymous flex items that we need.
* aParentFrame _must_ be a nsFlexContainerFrame -- the caller is responsible
* for checking this.
* @param aItems the child frame construction items before pseudo creation
* @param aParentFrame the flex container frame
*/
#ifdef MOZ_FLEXBOX
void CreateNeededAnonFlexItems(nsFrameConstructorState& aState,
FrameConstructionItemList& aItems,
nsIFrame* aParentFrame);
#endif // MOZ_FLEXBOX
/**
* Function to create the table pseudo items we need.
* @param aItems the child frame construction items before pseudo creation

Просмотреть файл

@ -392,6 +392,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_DISPLAY_POPUP 27
#define NS_STYLE_DISPLAY_GROUPBOX 28
#endif
#ifdef MOZ_FLEXBOX
#define NS_STYLE_DISPLAY_FLEX 29
#define NS_STYLE_DISPLAY_INLINE_FLEX 30
#endif // MOZ_FLEXBOX
// See nsStyleDisplay
#define NS_STYLE_FLOAT_NONE 0

Просмотреть файл

@ -93,6 +93,12 @@ CPPSRCS = \
nsViewportFrame.cpp \
$(NULL)
ifdef MOZ_FLEXBOX
CPPSRCS += \
nsFlexContainerFrame.cpp \
$(NULL)
endif
ifdef MOZ_MEDIA
CPPSRCS += \
nsVideoFrame.cpp \

Просмотреть файл

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code is subject to the terms of the Mozilla Public License
* version 2.0 (the "License"). You can obtain a copy of the License at
* http://mozilla.org/MPL/2.0/. */
/* rendering object for CSS display: -moz-flex */
#include "nsFlexContainerFrame.h"
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "prlog.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* nsFlexContainerFrameLM = PR_NewLogModule("nsFlexContainerFrame");
#endif /* PR_LOGGING */
NS_IMPL_FRAMEARENA_HELPERS(nsFlexContainerFrame)
nsIFrame*
NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
{
return new (aPresShell) nsFlexContainerFrame(aContext);
}
//----------------------------------------------------------------------
/* virtual */
nsFlexContainerFrame::~nsFlexContainerFrame()
{
}
NS_QUERYFRAME_HEAD(nsFlexContainerFrame)
NS_QUERYFRAME_ENTRY(nsFlexContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFlexContainerFrameSuper)
void
nsFlexContainerFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
DestroyAbsoluteFrames(aDestructRoot);
nsFlexContainerFrameSuper::DestroyFrom(aDestructRoot);
}
nsIAtom*
nsFlexContainerFrame::GetType() const
{
return nsGkAtoms::flexContainerFrame;
}
#ifdef DEBUG
NS_IMETHODIMP
nsFlexContainerFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("FlexContainer"), aResult);
}
#endif // DEBUG

Просмотреть файл

@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code is subject to the terms of the Mozilla Public License
* version 2.0 (the "License"). You can obtain a copy of the License at
* http://mozilla.org/MPL/2.0/. */
/* rendering object for CSS display: -moz-flex */
#ifndef nsFlexContainerFrame_h___
#define nsFlexContainerFrame_h___
#include "nsContainerFrame.h"
#include "mozilla/Types.h"
nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
typedef nsContainerFrame nsFlexContainerFrameSuper;
class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame)
NS_DECL_QUERYFRAME
// Factory method:
friend nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// nsIFrame overrides
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
protected:
// Protected constructor & destructor
nsFlexContainerFrame(nsStyleContext* aContext) : nsFlexContainerFrameSuper(aContext) {}
virtual ~nsFlexContainerFrame();
// Protected nsIFrame overrides:
virtual void DestroyFrom(nsIFrame* aDestructRoot);
};
#endif /* nsFlexContainerFrame_h___ */

Просмотреть файл

@ -22,6 +22,9 @@ FRAME_ID(nsFieldSetFrame)
FRAME_ID(nsFileControlFrame)
FRAME_ID(nsFirstLetterFrame)
FRAME_ID(nsFirstLineFrame)
#ifdef MOZ_FLEXBOX
FRAME_ID(nsFlexContainerFrame)
#endif // MOZ_FLEXBOX
FRAME_ID(nsFormControlFrame)
FRAME_ID(nsFrame)
FRAME_ID(nsGfxButtonControlFrame)

Просмотреть файл

@ -339,14 +339,24 @@ nsMathMLmoFrame::ProcessOperatorData()
mFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the old form bits
mFlags |= form;
// lookup the operator dictionary
float lspace = 0.0f;
float rspace = 0.0f;
nsAutoString data;
mMathMLChar.GetData(data);
bool found = nsMathMLOperators::LookupOperator(data, form, &mFlags, &lspace, &rspace);
if (found && (lspace || rspace)) {
// cache the default values of lspace & rspace that we get from the dictionary.
// Use the default value suggested by the MathML REC.
// http://www.w3.org/TR/MathML/chapter3.html#presm.mo.attrs
// thickmathspace = 5/18em
float lspace = 5.0/18.0;
float rspace = 5.0/18.0;
if (NS_MATHML_OPERATOR_IS_INVISIBLE(mFlags)) {
// mMathMLChar has been reset in ProcessTextData so we can not find it
// in the operator dictionary. The operator dictionary always uses
// lspace = rspace = 0 for invisible operators.
lspace = rspace = 0.0;
} else {
// lookup the operator dictionary
nsAutoString data;
mMathMLChar.GetData(data);
nsMathMLOperators::LookupOperator(data, form, &mFlags, &lspace, &rspace);
}
if (lspace || rspace) {
// Cache the default values of lspace and rspace.
// since these values are relative to the 'em' unit, convert to twips now
nscoord em;
nsRefPtr<nsFontMetrics> fm;

Просмотреть файл

@ -0,0 +1,43 @@
<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: -->
<!DOCTYPE html>
<html>
<head>
<title>mo-lspace-rspace</title>
</head>
<body>
<p>
<!-- not in the operator dictionary -->
<math>
<mtext>_</mtext>
<mspace width="thickmathspace" height="0" depth="0"></mspace>
<mtext>MO</mtext>
<mspace width="thickmathspace" height="0" depth="0"></mspace>
<mtext>_</mtext>
</math>
</p>
<p>
<!-- operator.\u223F.infix = lspace:3 rspace:3 # sine wave -->
<math>
<mtext>_</mtext>
<mspace width="thinmathspace" height="0" depth="0"></mspace>
<mtext>&#x0223F;</mtext>
<mspace width="thinmathspace" height="0" depth="0"></mspace>
<mtext>_</mtext>
</math>
</p>
<p>
<!-- Invisible operator -->
<math>
<mtext>_</mtext>
<mtext>&#x02061;</mtext>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,39 @@
<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: -->
<!DOCTYPE html>
<html>
<head>
<title>mo-lspace-rspace</title>
</head>
<body>
<p>
<!-- not in the operator dictionary -->
<math>
<mtext>_</mtext>
<mo>MO</mo>
<mtext>_</mtext>
</math>
</p>
<p>
<!-- operator.\u223F.infix = lspace:3 rspace:3 # sine wave -->
<math>
<mtext>_</mtext>
<mo>&#x0223F;</mo>
<mtext>_</mtext>
</math>
</p>
<p>
<!-- Invisible operator -->
<math>
<mtext>_</mtext>
<mo>&#x02061;</mo>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

Просмотреть файл

@ -101,4 +101,5 @@ fails == mstyle-5.xhtml mstyle-5-ref.xhtml # See bug 569125#c29
== maction-dynamic-embellished-op.html maction-dynamic-embellished-op-ref.html
== maction-dynamic-1.html maction-dynamic-1-ref.html
== maction-dynamic-2.html maction-dynamic-2-ref.html
== mo-lspace-rspace.html mo-lspace-rspace-ref.html
== maction-dynamic-3.html maction-dynamic-3-ref.html

Просмотреть файл

@ -62,6 +62,10 @@ CSS_ANON_BOX(columnContent, ":-moz-column-content")
CSS_ANON_BOX(viewport, ":-moz-viewport")
CSS_ANON_BOX(viewportScroll, ":-moz-viewport-scroll")
// Inside a flex container, a contiguous run of non-replaced inline children
// gets wrapped in an anonymous block, which is then treated as a flex item.
CSS_ANON_BOX(anonymousFlexItem, ":-moz-anonymous-flex-item")
#ifdef MOZ_XUL
CSS_ANON_BOX(moztreecolumn, ":-moz-tree-column")
CSS_ANON_BOX(moztreerow, ":-moz-tree-row")

Просмотреть файл

@ -74,6 +74,9 @@ CSS_KEY(-moz-ethiopic-halehame-ti-et, _moz_ethiopic_halehame_ti_et)
CSS_KEY(-moz-field, _moz_field)
CSS_KEY(-moz-fieldtext, _moz_fieldtext)
CSS_KEY(-moz-fit-content, _moz_fit_content)
#ifdef MOZ_FLEXBOX
CSS_KEY(-moz-flex, _moz_flex)
#endif // MOZ_FLEXBOX
CSS_KEY(-moz-grabbing, _moz_grabbing)
CSS_KEY(-moz-grab, _moz_grab)
CSS_KEY(-moz-grid-group, _moz_grid_group)
@ -92,6 +95,9 @@ CSS_KEY(-moz-image-rect, _moz_image_rect)
CSS_KEY(-moz-info, _moz_info)
CSS_KEY(-moz-initial, _moz_initial)
CSS_KEY(-moz-inline-box, _moz_inline_box)
#ifdef MOZ_FLEXBOX
CSS_KEY(-moz-inline-flex, _moz_inline_flex)
#endif // MOZ_FLEXBOX
CSS_KEY(-moz-inline-grid, _moz_inline_grid)
CSS_KEY(-moz-inline-stack, _moz_inline_stack)
CSS_KEY(-moz-isolate, _moz_isolate)

Просмотреть файл

@ -888,6 +888,10 @@ const PRInt32 nsCSSProps::kDisplayKTable[] = {
eCSSKeyword__moz_popup, NS_STYLE_DISPLAY_POPUP,
eCSSKeyword__moz_groupbox, NS_STYLE_DISPLAY_GROUPBOX,
#endif
#ifdef MOZ_FLEXBOX
eCSSKeyword__moz_flex, NS_STYLE_DISPLAY_FLEX,
eCSSKeyword__moz_inline_flex, NS_STYLE_DISPLAY_INLINE_FLEX,
#endif // MOZ_FLEXBOX
eCSSKeyword_UNKNOWN,-1
};

Просмотреть файл

@ -125,6 +125,9 @@ static void EnsureBlockDisplay(PRUint8& display)
case NS_STYLE_DISPLAY_TABLE :
case NS_STYLE_DISPLAY_BLOCK :
case NS_STYLE_DISPLAY_LIST_ITEM :
#ifdef MOZ_FLEXBOX
case NS_STYLE_DISPLAY_FLEX :
#endif // MOZ_FLEXBOX
// do not muck with these at all - already blocks
// This is equivalent to nsStyleDisplay::IsBlockOutside. (XXX Maybe we
// should just call that?)
@ -137,6 +140,13 @@ static void EnsureBlockDisplay(PRUint8& display)
display = NS_STYLE_DISPLAY_TABLE;
break;
#ifdef MOZ_FLEXBOX
case NS_STYLE_DISPLAY_INLINE_FLEX:
// make inline flex containers into flex containers
display = NS_STYLE_DISPLAY_FLEX;
break;
#endif // MOZ_FLEXBOX
default :
// make it a block
display = NS_STYLE_DISPLAY_BLOCK;

Просмотреть файл

@ -1596,6 +1596,9 @@ struct nsStyleDisplay {
bool IsBlockOutside() const {
return NS_STYLE_DISPLAY_BLOCK == mDisplay ||
#ifdef MOZ_FLEXBOX
NS_STYLE_DISPLAY_FLEX == mDisplay ||
#endif // MOZ_FLEXBOX
NS_STYLE_DISPLAY_LIST_ITEM == mDisplay ||
NS_STYLE_DISPLAY_TABLE == mDisplay;
}
@ -1605,6 +1608,9 @@ struct nsStyleDisplay {
NS_STYLE_DISPLAY_INLINE_BLOCK == aDisplay ||
NS_STYLE_DISPLAY_INLINE_TABLE == aDisplay ||
NS_STYLE_DISPLAY_INLINE_BOX == aDisplay ||
#ifdef MOZ_FLEXBOX
NS_STYLE_DISPLAY_INLINE_FLEX == aDisplay ||
#endif // MOZ_FLEXBOX
NS_STYLE_DISPLAY_INLINE_GRID == aDisplay ||
NS_STYLE_DISPLAY_INLINE_STACK == aDisplay;
}

Просмотреть файл

@ -1964,7 +1964,27 @@ var gCSSProperties = {
initial_values: [ "inline" ],
/* XXX none will really mess with other properties */
prerequisites: { "float": "none", "position": "static" },
other_values: [ "block", "list-item", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none" ],
other_values: [
"block",
"list-item",
"inline-block",
"table",
"inline-table",
"table-row-group",
"table-header-group",
"table-footer-group",
"table-row",
"table-column-group",
"table-column",
"table-cell",
"table-caption",
/* XXXdholbert In builds with MOZ_FLEXBOX enabled, this should be uncommented.
(This would be #ifdef MOZ_FLEXBOX, if that worked in JS files.)
"-moz-flex",
"-moz-inline-flex",
*/
"none"
],
invalid_values: []
},
"empty-cells": {

Просмотреть файл

@ -165,6 +165,12 @@
height: 100%;
}
*|*::-moz-anonymous-flex-item {
/* Anonymous blocks that wrap contiguous runs of inline non-replaced
* content inside of a flex container. */
display: block;
}
*|*::-moz-page-sequence, *|*::-moz-scrolled-page-sequence {
/* Collection of pages in print/print preview. Visual styles may only appear
* in print preview. */

Просмотреть файл

@ -26,11 +26,8 @@ pref("toolkit.browser.contentViewExpire", 3000);
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
pref("browser.chromeURL", "chrome://browser/content/");
pref("browser.tabs.warnOnClose", true);
pref("browser.tabs.remote", false);
pref("toolkit.screen.lock", false);
// From libpref/src/init/all.js, extended to allow a slightly wider zoom range.
pref("zoom.minPercent", 20);
pref("zoom.maxPercent", 400);

Просмотреть файл

@ -47,24 +47,6 @@
<!-- App requires OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<!-- all large size screens -->
<screen android:screenSize="large" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="large" android:screenDensity="xhdpi" />
</compatible-screens>
<application android:label="@MOZ_APP_DISPLAYNAME@"
android:icon="@drawable/icon"
android:name="org.mozilla.gecko.GeckoApplication"

Просмотреть файл

@ -621,8 +621,7 @@ abstract public class BrowserApp extends GeckoApp
tab.getContentType().equals("application/vnd.mozilla.xul+xml")));
// Disable find in page for about:home, since it won't work on Java content
if (!tab.getURL().equals("about:home"))
findInPage.setEnabled(true);
findInPage.setEnabled(!tab.getURL().equals("about:home"));
charEncoding.setVisible(GeckoPreferences.getCharEncodingState());

Просмотреть файл

@ -39,7 +39,8 @@ public class DoorHangerPopup extends PopupWindow {
private void init() {
setBackgroundDrawable(new BitmapDrawable());
setOutsideTouchable(true);
setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
setWindowLayoutMode(GeckoApp.mAppContext.isTablet() ? ViewGroup.LayoutParams.WRAP_CONTENT : ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
LayoutInflater inflater = LayoutInflater.from(mContext);
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.doorhangerpopup, null);

Просмотреть файл

@ -509,6 +509,7 @@ abstract public class GeckoApp
R.id.find_in_page,
R.id.addons,
R.id.downloads,
R.id.apps,
R.id.site_settings
};
@ -692,6 +693,9 @@ abstract public class GeckoApp
case R.id.downloads:
loadUrlInTab("about:downloads");
return true;
case R.id.apps:
loadUrlInTab("about:apps");
return true;
case R.id.char_encoding:
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("CharEncoding:Get", null));
return true;
@ -1224,7 +1228,7 @@ abstract public class GeckoApp
String launchPath = message.getString("launchPath");
String iconURL = message.getString("iconURL");
String uniqueURI = message.getString("uniqueURI");
GeckoAppShell.createShortcut(name, launchPath, uniqueURI, iconURL, "webapp");
GeckoAppShell.installWebApp(name, launchPath, uniqueURI, iconURL);
} else if (event.equals("WebApps:Uninstall")) {
String uniqueURI = message.getString("uniqueURI");
GeckoAppShell.uninstallWebApp(uniqueURI);

Просмотреть файл

@ -845,6 +845,35 @@ public class GeckoAppShell
});
}
public static void installWebApp(String aTitle, String aURI, String aUniqueURI, String aIconURL) {
int index = WebAppAllocator.getInstance(GeckoApp.mAppContext).findAndAllocateIndex(aUniqueURI);
GeckoProfile profile = GeckoProfile.get(GeckoApp.mAppContext, "webapp" + index);
File prefs = profile.getFile("prefs.js");
InputStream in = null;
OutputStream out = null;
try {
in = GeckoApp.mAppContext.getResources().openRawResource(R.raw.webapp_prefs_js);
out = new FileOutputStream(prefs);
byte buf[]=new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
} catch(FileNotFoundException ex) {
} catch(IOException ex) {
} finally {
try {
if (out != null)
out.close();
if (in != null)
in.close();
} catch(IOException ex) {
}
}
createShortcut(aTitle, aURI, aUniqueURI, aIconURL, "webapp");
}
public static void uninstallWebApp(final String uniqueURI) {
// On uninstall, we need to do a couple of things:
// 1. nuke the running app process.

Просмотреть файл

@ -143,6 +143,14 @@ public final class GeckoProfile {
return mDir;
}
public File getFile(String aFile) {
File f = getDir();
if (f == null)
return null;
return new File(f, aFile);
}
public File getFilesDir() {
return mContext.getFilesDir();
}

Просмотреть файл

@ -291,6 +291,7 @@ RES_LAYOUT_LAND_V14 = \
RES_LAYOUT_XLARGE = \
res/layout-xlarge/browser_toolbar.xml \
res/layout-xlarge/doorhangerpopup.xml \
res/layout-xlarge/gecko_app.xml \
res/layout-xlarge/remote_tabs_child.xml \
res/layout-xlarge/remote_tabs_group.xml \
@ -300,6 +301,7 @@ RES_LAYOUT_XLARGE = \
RES_LAYOUT_SW600DP = \
res/layout-sw600dp/browser_toolbar.xml \
res/layout-sw600dp/doorhangerpopup.xml \
res/layout-sw600dp/gecko_app.xml \
res/layout-sw600dp/remote_tabs_child.xml \
res/layout-sw600dp/remote_tabs_group.xml \
@ -870,6 +872,10 @@ RES_MENU = \
res/menu/titlebar_contextmenu.xml \
$(NULL)
RES_RAW = \
res/raw/webapp_prefs_js \
$(NULL)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
ifdef MOZ_CRASHREPORTER
@ -926,7 +932,7 @@ MOZ_ANDROID_DRAWABLES += \
MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' '; fi)
RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LAND_V14) $(RES_LAYOUT_XLARGE) $(RES_LAYOUT_SW600DP) $(RES_VALUES) $(RES_VALUES_V11) $(RES_VALUES_XLARGE) $(RES_VALUES_SW600DP) $(RES_VALUES_LAND_V14) $(RES_VALUES_SW600DP_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_V14) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_XLARGE_MDPI) $(RES_DRAWABLE_XLARGE_HDPI) $(RES_DRAWABLE_XLARGE_XHDPI) $(RES_DRAWABLE_SW600DP_MDPI) $(RES_DRAWABLE_SW600DP_HDPI) $(RES_DRAWABLE_SW600DP_XHDPI) $(RES_COLOR) $(RES_MENU)
RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_LAND_V14) $(RES_LAYOUT_XLARGE) $(RES_LAYOUT_SW600DP) $(RES_VALUES) $(RES_VALUES_V11) $(RES_VALUES_XLARGE) $(RES_VALUES_SW600DP) $(RES_VALUES_LAND_V14) $(RES_VALUES_SW600DP_V14) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_V14) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_DRAWABLE_XLARGE_MDPI) $(RES_DRAWABLE_XLARGE_HDPI) $(RES_DRAWABLE_XLARGE_XHDPI) $(RES_DRAWABLE_SW600DP_MDPI) $(RES_DRAWABLE_SW600DP_HDPI) $(RES_DRAWABLE_SW600DP_XHDPI) $(RES_COLOR) $(RES_MENU) $(RES_RAW)
RES_DIRS= \
res/layout \

Просмотреть файл

@ -47,6 +47,10 @@
<!ENTITY reload "Reload">
<!ENTITY forward "Forward">
<!ENTITY menu "Menu">
<!ENTITY back "Back">
<!ENTITY stop "Stop">
<!ENTITY site_security "Site Security">
<!ENTITY close_tab "Close Tab">
<!ENTITY new_tab "New Tab">
@ -92,6 +96,7 @@
<!ENTITY addons "Add-ons">
<!ENTITY downloads "Downloads">
<!ENTITY apps "Apps">
<!ENTITY char_encoding "Character Encoding">
<!ENTITY share "Share">

Просмотреть файл

@ -41,6 +41,8 @@
<!ENTITY sync.button.tryagain.label 'Try again'>
<!ENTITY sync.button.manual.label 'Manual Setup'>
<!ENTITY sync.subtitle.nointernet.label 'No internet connection available.'>
<!ENTITY sync.subtitle.failaccount.label 'Account creation on your device failed.'>
<!ENTITY sync.subtitle.failmultiple.label 'Do you have more than one Firefox installed? Currently, &syncBrand.fullName.label; only supports one Firefox installation at a time. Please uninstall other instances to use &syncBrand.shortName.label;.'>
<!-- Setup Success -->
<!ENTITY sync.title.success.label 'Setup Complete'>

Просмотреть файл

@ -12,9 +12,11 @@
android:background="@drawable/address_bar_bg">
<ImageButton android:id="@+id/back"
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<LinearLayout android:id="@+id/menu_items"
@ -51,6 +53,7 @@
android:layout_toLeftOf="@id/spacer"
android:gravity="center_vertical"
android:src="@drawable/menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="10dip"
android:paddingRight="10dip"
@ -96,6 +99,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/reader"
android:contentDescription="@string/reader_mode"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
@ -103,6 +107,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
@ -110,6 +115,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>

Просмотреть файл

@ -35,6 +35,7 @@
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="14dip"
android:paddingRight="14dip"
@ -73,6 +74,7 @@
android:layout_alignLeft="@id/awesome_bar"
android:paddingLeft="22dp"
android:src="@drawable/ic_menu_forward"
android:contentDescription="@string/forward"
android:background="@drawable/address_bar_forward_button"/>
<ImageButton android:id="@+id/back"
@ -83,6 +85,7 @@
android:layout_marginLeft="-28dp"
android:layout_alignLeft="@id/awesome_bar"
android:src="@drawable/ic_menu_back"
android:contentDescription="@string/back"
android:background="@drawable/address_bar_back_button"/>
<ImageButton android:id="@+id/favicon"
@ -106,6 +109,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/reader"
android:contentDescription="@string/reader_mode"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
@ -113,6 +117,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
@ -120,6 +125,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>

Просмотреть файл

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dip"
android:layout_alignParentTop="true"
android:minWidth="200dip"
android:maxWidth="600dip"
android:background="@drawable/doorhanger_popup_bg">
<LinearLayout android:id="@+id/doorhanger_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>
<ImageView android:layout_width="44dip"
android:layout_height="16dip"
android:layout_marginLeft="4dip"
android:layout_marginTop="9dip"
android:layout_alignParentTop="true"
android:src="@drawable/doorhanger_arrow"
android:scaleType="fitXY"/>
</RelativeLayout>

Просмотреть файл

@ -35,6 +35,7 @@
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="14dip"
android:paddingRight="14dip"
@ -73,6 +74,7 @@
android:layout_alignLeft="@id/awesome_bar"
android:paddingLeft="22dp"
android:src="@drawable/ic_menu_forward"
android:contentDescription="@string/forward"
android:background="@drawable/address_bar_forward_button"/>
<ImageButton android:id="@+id/back"
@ -83,6 +85,7 @@
android:layout_marginLeft="-28dp"
android:layout_alignLeft="@id/awesome_bar"
android:src="@drawable/ic_menu_back"
android:contentDescription="@string/back"
android:background="@drawable/address_bar_back_button"/>
<ImageButton android:id="@+id/favicon"
@ -106,6 +109,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/reader"
android:contentDescription="@string/reader_mode"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
@ -113,6 +117,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
@ -120,6 +125,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>

Просмотреть файл

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dip"
android:layout_alignParentTop="true"
android:minWidth="200dip"
android:maxWidth="600dip"
android:background="@drawable/doorhanger_popup_bg">
<LinearLayout android:id="@+id/doorhanger_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>
<ImageView android:layout_width="44dip"
android:layout_height="16dip"
android:layout_marginLeft="4dip"
android:layout_marginTop="9dip"
android:layout_alignParentTop="true"
android:src="@drawable/doorhanger_arrow"
android:scaleType="fitXY"/>
</RelativeLayout>

Просмотреть файл

@ -12,9 +12,11 @@
android:background="@drawable/address_bar_bg">
<ImageButton android:id="@+id/back"
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton android:id="@+id/forward"
android:contentDescription="@string/forward"
style="@style/AddressBar.ImageButton.Unused"/>
<LinearLayout android:id="@+id/menu_items"
@ -51,6 +53,7 @@
android:layout_toLeftOf="@id/spacer"
android:gravity="center_vertical"
android:src="@drawable/menu"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="12dip"
android:paddingRight="12dip"
@ -96,6 +99,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/reader"
android:contentDescription="@string/reader_mode"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
@ -103,6 +107,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
@ -110,6 +115,7 @@
android:layout_width="24dip"
android:layout_height="24dip"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>

Просмотреть файл

@ -16,13 +16,22 @@
</LinearLayout>
<TextView
android:id="@+id/failure_subtitle1"
style="@style/SyncTextItem"
android:layout_below="@id/failure_top"
android:layout_above="@+id/failure_bottom"
android:padding="20dp"
android:text="@string/sync_subtitle_fail" />
<TextView
android:id="@+id/failure_subtitle2"
style="@style/SyncTextItem"
android:layout_below="@id/failure_subtitle1"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="@string/sync_subtitle_failmultiple" />
<LinearLayout
android:id="@id/failure_bottom"
android:id="@+id/failure_bottom"
style="@style/SyncBottom"
android:orientation="horizontal" >

Просмотреть файл

@ -50,6 +50,9 @@
<item gecko:id="@+id/downloads"
gecko:title="@string/downloads"/>
<item gecko:id="@+id/apps"
gecko:title="@string/apps"/>
<item gecko:id="@+id/char_encoding"
gecko:visible="false"
gecko:title="@string/char_encoding"/>

Просмотреть файл

@ -47,6 +47,9 @@
<item gecko:id="@+id/downloads"
gecko:title="@string/downloads"/>
<item gecko:id="@+id/apps"
gecko:title="@string/apps"/>
<item gecko:id="@+id/char_encoding"
gecko:visible="false"
gecko:title="@string/char_encoding"/>

Просмотреть файл

@ -50,6 +50,9 @@
<item gecko:id="@+id/downloads"
gecko:title="@string/downloads"/>
<item gecko:id="@+id/apps"
gecko:title="@string/apps"/>
<item gecko:id="@+id/char_encoding"
gecko:visible="false"
gecko:title="@string/char_encoding"/>

Просмотреть файл

@ -45,6 +45,9 @@
<item android:id="@+id/downloads"
android:title="@string/downloads"/>
<item android:id="@+id/apps"
android:title="@string/apps"/>
<item android:id="@+id/char_encoding"
android:visible="false"
android:title="@string/char_encoding"/>

Просмотреть файл

@ -0,0 +1,22 @@
/* 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/. */
pref("browser.download.folderList", 1);
// Disable all add-on locations other than the profile (which can't be disabled this way)
pref("extensions.enabledScopes", 1);
// Auto-disable any add-ons that are "dropped in" to the profile
pref("extensions.autoDisableScopes", 1);
// Disable add-on installation via the web-exposed APIs
pref("xpinstall.enabled", false);
// Blocklist preferences
pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
// Controls what level the blocklist switches from warning about items to forcibly
// blocking them.
pref("extensions.blocklist.level", 2);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/");
pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");

Просмотреть файл

@ -99,12 +99,17 @@
<string name="reload">&reload;</string>
<string name="forward">&forward;</string>
<string name="menu">&menu;</string>
<string name="back">&back;</string>
<string name="stop">&stop;</string>
<string name="site_security">&site_security;</string>
<string name="close_tab">&close_tab;</string>
<string name="new_tab">&new_tab;</string>
<string name="new_tab_opened">&new_tab_opened;</string>
<string name="num_tabs">&num_tabs;</string>
<string name="addons">&addons;</string>
<string name="downloads">&downloads;</string>
<string name="apps">&apps;</string>
<string name="char_encoding">&char_encoding;</string>
<!-- This string only appears in developer builds, which
is why it is not localizable. -->

Просмотреть файл

@ -37,8 +37,9 @@ public class Constants {
public static final String EXTRAS_KEY_STAGES_TO_SKIP = "skip";
// Constants for Activities.
public static final String INTENT_EXTRA_IS_SETUP = "isSetup";
public static final String INTENT_EXTRA_IS_PAIR = "isPair";
public static final String INTENT_EXTRA_IS_SETUP = "isSetup";
public static final String INTENT_EXTRA_IS_PAIR = "isPair";
public static final String INTENT_EXTRA_IS_ACCOUNTERROR = "isAccountError";
public static final int FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION =
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |

Просмотреть файл

@ -253,10 +253,7 @@ public class AccountActivity extends AccountAuthenticatorActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
// Use default error.
// TODO: Bug 766499: Show specific error message when Android fails on Account creation.
Logger.debug(LOG_TAG, "displayFailure()");
displayFailure(AuthenticationResult.FAILURE_OTHER);
displayFailure(AuthenticationResult.FAILURE_ACCOUNT);
}
});
return;
@ -294,6 +291,7 @@ public class AccountActivity extends AccountAuthenticatorActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
Intent intent;
switch (result) {
case FAILURE_USERNAME:
// No such username. Don't leak whether the username exists.
@ -305,11 +303,17 @@ public class AccountActivity extends AccountAuthenticatorActivity {
findViewById(R.id.server_error).setVisibility(View.VISIBLE);
serverInput.requestFocus();
break;
case FAILURE_ACCOUNT:
intent = new Intent(mContext, SetupFailureActivity.class);
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
intent.putExtra(Constants.INTENT_EXTRA_IS_ACCOUNTERROR, true);
startActivity(intent);
break;
case FAILURE_OTHER:
default:
// Display default error screen.
Logger.debug(LOG_TAG, "displaying default failure.");
Intent intent = new Intent(mContext, SetupFailureActivity.class);
intent = new Intent(mContext, SetupFailureActivity.class);
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
startActivity(intent);
}

Просмотреть файл

@ -5,12 +5,14 @@
package org.mozilla.gecko.sync.setup.activities;
import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.setup.Constants;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class SetupFailureActivity extends Activity {
private Context mContext;
@ -21,10 +23,26 @@ public class SetupFailureActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.sync_setup_failure);
mContext = this.getApplicationContext();
// Modify general error message if necessary.
Bundle extras = this.getIntent().getExtras();
if (extras != null) {
boolean isAccountError = extras.getBoolean(Constants.INTENT_EXTRA_IS_ACCOUNTERROR);
if (isAccountError) {
TextView subtitle1 = (TextView) findViewById(R.id.failure_subtitle1);
// Display error for multiple accounts.
// TODO: Remove when Bug 761206 is resolved (support for multiple versions).
TextView subtitle2 = (TextView) findViewById(R.id.failure_subtitle2);
subtitle1.setText(getString(R.string.sync_subtitle_failaccount));
subtitle2.setVisibility(View.VISIBLE);
subtitle2.setText(getString(R.string.sync_subtitle_failmultiple));
}
}
}
public void manualClickHandler(View target) {
Intent intent = new Intent(mContext, AccountActivity.class);
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
startActivity(intent);
overridePendingTransition(0, 0);
finish();

Просмотреть файл

@ -79,6 +79,13 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
mContext = getApplicationContext();
Logger.debug(LOG_TAG, "AccountManager.get(" + mContext + ")");
mAccountManager = AccountManager.get(mContext);
// Set "screen on" flag for this activity. Screen will not automatically dim as long as this
// activity is at the top of the stack.
// Attempting to set this flag more than once causes hanging, so we set it here, not in onResume().
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Logger.debug(LOG_TAG, "Successfully set screen-on flag.");
}
@Override
@ -105,11 +112,6 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
public void finishResume(Account[] accts) {
Logger.debug(LOG_TAG, "Finishing Resume after fetching accounts.");
// Set "screen on" flag.
Logger.debug(LOG_TAG, "Setting screen-on flag.");
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if (accts.length == 0) { // Start J-PAKE for pairing if no accounts present.
Logger.debug(LOG_TAG, "No accounts; starting J-PAKE receiver.");
displayReceiveNoPin();
@ -431,10 +433,10 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
}
});
}
/*
* Helper functions
*/
private void activateButton(Button button, boolean toActivate) {
button.setEnabled(toActivate);
button.setClickable(toActivate);
@ -450,19 +452,24 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
* Displays Sync account setup result to user.
*
* @param isSetup
* true is account was set up successfully, false otherwise.
* true if account was set up successfully, false otherwise.
*/
private void displayResult(boolean isSuccess) {
Intent intent = null;
if (isSuccess) {
intent = new Intent(mContext, SetupSuccessActivity.class);
} else {
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, !pairWithPin);
startActivity(intent);
finish();
} else {
intent = new Intent(mContext, SetupFailureActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_IS_ACCOUNTERROR, true);
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, !pairWithPin);
startActivity(intent);
// Do not finish, so user can retry setup by hitting "back."
}
intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION);
intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, !pairWithPin);
startActivity(intent);
finish();
}
/**

Просмотреть файл

@ -5,5 +5,5 @@
package org.mozilla.gecko.sync.setup.auth;
public enum AuthenticationResult {
SUCCESS, FAILURE_USERNAME, FAILURE_PASSWORD, FAILURE_SERVER, FAILURE_OTHER
SUCCESS, FAILURE_USERNAME, FAILURE_PASSWORD, FAILURE_SERVER, FAILURE_ACCOUNT, FAILURE_OTHER
}

Просмотреть файл

@ -1415,6 +1415,12 @@ var SelectionHandler = {
this.endSelection(data.x, data.y);
},
notifySelectionChanged: function sh_notifySelectionChanged(aDoc, aSel, aReason) {
// If the selection was removed, call endSelection() to clean up
if (aSel == "" && aReason == Ci.nsISelectionListener.NO_REASON)
this.endSelection();
},
// aX/aY are in top-level window browser coordinates
startSelection: function sh_startSelection(aElement, aX, aY) {
// Clear out any existing selection
@ -1460,10 +1466,12 @@ var SelectionHandler = {
return;
}
// Add a listener to end the selection if it's removed programatically
selection.QueryInterface(Ci.nsISelectionPrivate).addSelectionListener(this);
// Initialize the cache
this.cache = {};
this.updateCacheForSelection();
this.updateCacheOffset();
this.showHandles();
this._active = true;
@ -1471,11 +1479,10 @@ var SelectionHandler = {
// aX/aY are in top-level window browser coordinates
moveSelection: function sh_moveSelection(aIsStartHandle, aX, aY) {
let contentWindow = BrowserApp.selectedBrowser.contentWindow;
/* XXX bug 765367: Because the handles are in the document, the element
will always be the handle the user touched. These checks are disabled
until we can figure out a way to get the element under the handle.
let contentWindow = BrowserApp.selectedBrowser.contentWindow;
let element = ElementTouchHelper.elementFromPoint(contentWindow, aX, aY);
if (!element)
element = ElementTouchHelper.anyElementFromPoint(contentWindow, aX, aY);
@ -1491,15 +1498,14 @@ var SelectionHandler = {
// Update the handle position as it's dragged
if (aIsStartHandle) {
this._start.style.left = aX + this.cache.offset.x + "px";
this._start.style.top = aY + this.cache.offset.y + "px";
this._start.style.left = aX + this._view.scrollX + "px";
this._start.style.top = aY + this._view.scrollY + "px";
} else {
this._end.style.left = aX + this.cache.offset.x + "px";
this._end.style.top = aY + this.cache.offset.y + "px";
this._end.style.left = aX + this._view.scrollX + "px";
this._end.style.top = aY + this._view.scrollY + "px";
}
// Send mouse events to the top-level window
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let cwu = this._view.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
// The handles work the same on both LTR and RTL pages, but the underlying selection
// works differently, so we need to reverse how we send mouse events on RTL pages.
@ -1578,6 +1584,10 @@ var SelectionHandler = {
// aX/aY are in top-level window browser coordinates
endSelection: function sh_endSelection(aX, aY) {
if (!this._active)
return;
this._active = false;
this.hideHandles();
let selectedText = "";
@ -1586,6 +1596,7 @@ var SelectionHandler = {
if (selection) {
selectedText = selection.toString().trim();
selection.removeAllRanges();
selection.QueryInterface(Ci.nsISelectionPrivate).removeSelectionListener(this);
}
}
@ -1598,15 +1609,11 @@ var SelectionHandler = {
// Only try copying text if the tap happens in the same view
if (element.ownerDocument.defaultView == this._view) {
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
let scrollX = {}, scrollY = {};
cwu.getScrollXY(false, scrollX, scrollY);
// aX/aY already accounts for the top-level scroll, add that back from the cache.offset values
let pointInSelection = (aX - this.cache.offset.x + scrollX.value > this.cache.rect.left &&
aX - this.cache.offset.x + scrollX.value < this.cache.rect.right) &&
(aY - this.cache.offset.y + scrollY.value > this.cache.rect.top &&
aY - this.cache.offset.y + scrollY.value < this.cache.rect.bottom);
let offset = this._getViewOffset();
let pointInSelection = (aX - offset.x > this.cache.rect.left &&
aX - offset.x < this.cache.rect.right) &&
(aY - offset.y > this.cache.rect.top &&
aY - offset.y < this.cache.rect.bottom);
if (pointInSelection) {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
clipboard.copyString(selectedText);
@ -1618,7 +1625,22 @@ var SelectionHandler = {
this._isRTL = false;
this._view = null;
this.cache = null;
this._active = false;
},
_getViewOffset: function sh_getViewOffset() {
let offset = { x: 0, y: 0 };
let win = this._view;
// Recursively look through frames to compute the total position offset.
while (win.frameElement) {
let rect = win.frameElement.getBoundingClientRect();
offset.x += rect.left;
offset.y += rect.top;
win = win.parent;
}
return offset;
},
// Returns true if the selection has been reversed. Takes optional aIsStartHandle
@ -1644,38 +1666,14 @@ var SelectionHandler = {
return selectionReversed;
},
updateCacheOffset: function sh_updateCacheOffset() {
let offset = { x: 0, y: 0 };
let cwu = null, scrollX = {}, scrollY = {};
let win = this._view;
// Recursively look through frames to compute the total scroll offset. This is
// necessary for positioning the handles correctly.
while (win) {
cwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
cwu.getScrollXY(false, scrollX, scrollY);
offset.x += scrollX.value;
offset.y += scrollY.value;
// Break if there are no more frames to process
if (!win.frameElement)
break;
win = win.frameElement.contentWindow;
}
this.cache.offset = offset;
},
// Adjust start/end positions to account for scroll, and account for the dimensions of the
// handle elements to ensure the handles point exactly at the ends of the selection.
positionHandles: function sh_positionHandles() {
this._start.style.left = (this.cache.start.x + this.cache.offset.x - this.HANDLE_WIDTH - this.HANDLE_PADDING) + "px";
this._start.style.top = (this.cache.start.y + this.cache.offset.y - this.HANDLE_VERTICAL_OFFSET) + "px";
this._start.style.left = (this.cache.start.x + this._view.scrollX - this.HANDLE_WIDTH - this.HANDLE_PADDING) + "px";
this._start.style.top = (this.cache.start.y + this._view.scrollY - this.HANDLE_VERTICAL_OFFSET) + "px";
this._end.style.left = (this.cache.end.x + this.cache.offset.x - this.HANDLE_PADDING) + "px";
this._end.style.top = (this.cache.end.y + this.cache.offset.y - this.HANDLE_VERTICAL_OFFSET) + "px";
this._end.style.left = (this.cache.end.x + this._view.scrollX - this.HANDLE_PADDING) + "px";
this._end.style.top = (this.cache.end.y + this._view.scrollY - this.HANDLE_VERTICAL_OFFSET) + "px";
},
showHandles: function sh_showHandles() {
@ -1732,9 +1730,6 @@ var SelectionHandler = {
case "touchstart":
aEvent.preventDefault();
// Update the offset in case we scrolled between touches
this.updateCacheOffset();
let touch = aEvent.changedTouches[0];
this._touchId = touch.identifier;

Просмотреть файл

@ -35,6 +35,8 @@
<string name="sync_button_tryagain">&sync.button.tryagain.label;</string>
<string name="sync_button_manual">&sync.button.manual.label;</string>
<string name="sync_subtitle_nointernet">&sync.subtitle.nointernet.label;</string>
<string name="sync_subtitle_failaccount">&sync.subtitle.failaccount.label;</string>
<string name="sync_subtitle_failmultiple">&sync.subtitle.failmultiple.label;</string>
<!-- Setup Success -->
<string name="sync_title_success">&sync.title.success.label;</string>

Просмотреть файл

@ -758,6 +758,14 @@ nsHttpTransaction::Close(nsresult reason)
if (mCaps & NS_HTTP_STICKY_CONNECTION)
relConn = false;
}
// mTimings.responseEnd is normally recorded based on the end of a
// HTTP delimiter such as chunked-encodings or content-length. However,
// EOF or an error still require an end time be recorded.
if (TimingEnabled() &&
mTimings.responseEnd.IsNull() && !mTimings.responseStart.IsNull())
mTimings.responseEnd = mozilla::TimeStamp::Now();
if (relConn && mConnection)
NS_RELEASE(mConnection);

Просмотреть файл

@ -1877,7 +1877,7 @@ tools are selected during the Xcode/Developer Tools installation.])
# Determine compiler version
changequote(,)
_MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
_MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
changequote([,])
CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
_CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`

Просмотреть файл

@ -23,6 +23,7 @@ mochikit.jar:
content/tests/SimpleTest/TestRunner.js (tests/SimpleTest/TestRunner.js)
content/tests/SimpleTest/WindowSnapshot.js (tests/SimpleTest/WindowSnapshot.js)
content/tests/SimpleTest/MockObjects.js (tests/SimpleTest/MockObjects.js)
content/tests/SimpleTest/NativeKeyCodes.js (tests/SimpleTest/NativeKeyCodes.js)
content/tests/SimpleTest/docshell_helpers.js (../../docshell/test/chrome/docshell_helpers.js)
% resource mochikit %modules/

Просмотреть файл

@ -22,6 +22,7 @@ _SIMPLETEST_FILES = MozillaLogger.js \
specialpowersAPI.js \
SpecialPowersObserverAPI.js \
MockObjects.js \
NativeKeyCodes.js \
$(DEPTH)/docshell/test/chrome/docshell_helpers.js \
$(NULL)

Просмотреть файл

@ -0,0 +1,343 @@
/**
* This file defines all virtual keycodes for
* nsIDOMWindowUtils.sendNativeKeyEvent()
* These values are defined in each platform's SDK or documents.
*/
// Windows
const WIN_VK_LBUTTON = 0x01;
const WIN_VK_RBUTTON = 0x02;
const WIN_VK_CANCEL = 0x03;
const WIN_VK_MBUTTON = 0x04;
const WIN_VK_XBUTTON1 = 0x05;
const WIN_VK_XBUTTON2 = 0x06;
const WIN_VK_BACK = 0x08;
const WIN_VK_TAB = 0x09;
const WIN_VK_CLEAR = 0x0C;
const WIN_VK_RETURN = 0x0D;
const WIN_VK_SHIFT = 0x10;
const WIN_VK_CONTROL = 0x11;
const WIN_VK_MENU = 0x12;
const WIN_VK_PAUSE = 0x13;
const WIN_VK_CAPITAL = 0x14;
const WIN_VK_KANA = 0x15;
const WIN_VK_HANGUEL = 0x15;
const WIN_VK_HANGUL = 0x15;
const WIN_VK_JUNJA = 0x17;
const WIN_VK_FINAL = 0x18;
const WIN_VK_HANJA = 0x19;
const WIN_VK_KANJI = 0x19;
const WIN_VK_ESCAPE = 0x1B;
const WIN_VK_CONVERT = 0x1C;
const WIN_VK_NONCONVERT = 0x1D;
const WIN_VK_ACCEPT = 0x1E;
const WIN_VK_MODECHANGE = 0x1F;
const WIN_VK_SPACE = 0x20;
const WIN_VK_PRIOR = 0x21;
const WIN_VK_NEXT = 0x22;
const WIN_VK_END = 0x23;
const WIN_VK_HOME = 0x24;
const WIN_VK_LEFT = 0x25;
const WIN_VK_UP = 0x26;
const WIN_VK_RIGHT = 0x27;
const WIN_VK_DOWN = 0x28;
const WIN_VK_SELECT = 0x29;
const WIN_VK_PRINT = 0x2A;
const WIN_VK_EXECUTE = 0x2B;
const WIN_VK_SNAPSHOT = 0x2C;
const WIN_VK_INSERT = 0x2D;
const WIN_VK_DELETE = 0x2E;
const WIN_VK_HELP = 0x2F;
const WIN_VK_0 = 0x30;
const WIN_VK_1 = 0x31;
const WIN_VK_2 = 0x32;
const WIN_VK_3 = 0x33;
const WIN_VK_4 = 0x34;
const WIN_VK_5 = 0x35;
const WIN_VK_6 = 0x36;
const WIN_VK_7 = 0x37;
const WIN_VK_8 = 0x38;
const WIN_VK_9 = 0x39;
const WIN_VK_A = 0x41;
const WIN_VK_B = 0x42;
const WIN_VK_C = 0x43;
const WIN_VK_D = 0x44;
const WIN_VK_E = 0x45;
const WIN_VK_F = 0x46;
const WIN_VK_G = 0x47;
const WIN_VK_H = 0x48;
const WIN_VK_I = 0x49;
const WIN_VK_J = 0x4A;
const WIN_VK_K = 0x4B;
const WIN_VK_L = 0x4C;
const WIN_VK_M = 0x4D;
const WIN_VK_N = 0x4E;
const WIN_VK_O = 0x4F;
const WIN_VK_P = 0x50;
const WIN_VK_Q = 0x51;
const WIN_VK_R = 0x52;
const WIN_VK_S = 0x53;
const WIN_VK_T = 0x54;
const WIN_VK_U = 0x55;
const WIN_VK_V = 0x56;
const WIN_VK_W = 0x57;
const WIN_VK_X = 0x58;
const WIN_VK_Y = 0x59;
const WIN_VK_Z = 0x5A;
const WIN_VK_LWIN = 0x5B;
const WIN_VK_RWIN = 0x5C;
const WIN_VK_APPS = 0x5D;
const WIN_VK_SLEEP = 0x5F;
const WIN_VK_NUMPAD0 = 0x60;
const WIN_VK_NUMPAD1 = 0x61;
const WIN_VK_NUMPAD2 = 0x62;
const WIN_VK_NUMPAD3 = 0x63;
const WIN_VK_NUMPAD4 = 0x64;
const WIN_VK_NUMPAD5 = 0x65;
const WIN_VK_NUMPAD6 = 0x66;
const WIN_VK_NUMPAD7 = 0x67;
const WIN_VK_NUMPAD8 = 0x68;
const WIN_VK_NUMPAD9 = 0x69;
const WIN_VK_MULTIPLY = 0x6A;
const WIN_VK_ADD = 0x6B;
const WIN_VK_SEPARATOR = 0x6C;
const WIN_VK_OEM_NEC_SEPARATE = 0x6C;
const WIN_VK_SUBTRACT = 0x6D;
const WIN_VK_DECIMAL = 0x6E;
const WIN_VK_DIVIDE = 0x6F;
const WIN_VK_F1 = 0x70;
const WIN_VK_F2 = 0x71;
const WIN_VK_F3 = 0x72;
const WIN_VK_F4 = 0x73;
const WIN_VK_F5 = 0x74;
const WIN_VK_F6 = 0x75;
const WIN_VK_F7 = 0x76;
const WIN_VK_F8 = 0x77;
const WIN_VK_F9 = 0x78;
const WIN_VK_F10 = 0x79;
const WIN_VK_F11 = 0x7A;
const WIN_VK_F12 = 0x7B;
const WIN_VK_F13 = 0x7C;
const WIN_VK_F14 = 0x7D;
const WIN_VK_F15 = 0x7E;
const WIN_VK_F16 = 0x7F;
const WIN_VK_F17 = 0x80;
const WIN_VK_F18 = 0x81;
const WIN_VK_F19 = 0x82;
const WIN_VK_F20 = 0x83;
const WIN_VK_F21 = 0x84;
const WIN_VK_F22 = 0x85;
const WIN_VK_F23 = 0x86;
const WIN_VK_F24 = 0x87;
const WIN_VK_NUMLOCK = 0x90;
const WIN_VK_SCROLL = 0x91;
const WIN_VK_OEM_FJ_JISHO = 0x92;
const WIN_VK_OEM_NEC_EQUAL = 0x92;
const WIN_VK_OEM_FJ_MASSHOU = 0x93;
const WIN_VK_OEM_FJ_TOUROKU = 0x94;
const WIN_VK_OEM_FJ_LOYA = 0x95;
const WIN_VK_OEM_FJ_ROYA = 0x96;
const WIN_VK_LSHIFT = 0xA0;
const WIN_VK_RSHIFT = 0xA1;
const WIN_VK_LCONTROL = 0xA2;
const WIN_VK_RCONTROL = 0xA3;
const WIN_VK_LMENU = 0xA4;
const WIN_VK_RMENU = 0xA5;
const WIN_VK_BROWSER_BACK = 0xA6;
const WIN_VK_BROWSER_FORWARD = 0xA7;
const WIN_VK_BROWSER_REFRESH = 0xA8;
const WIN_VK_BROWSER_STOP = 0xA9;
const WIN_VK_BROWSER_SEARCH = 0xAA;
const WIN_VK_BROWSER_FAVORITES = 0xAB;
const WIN_VK_BROWSER_HOME = 0xAC;
const WIN_VK_VOLUME_MUTE = 0xAD;
const WIN_VK_VOLUME_DOWN = 0xAE;
const WIN_VK_VOLUME_UP = 0xAF;
const WIN_VK_MEDIA_NEXT_TRACK = 0xB0;
const WIN_VK_OEM_FJ_000 = 0xB0;
const WIN_VK_MEDIA_PREV_TRACK = 0xB1;
const WIN_VK_OEM_FJ_EUQAL = 0xB1;
const WIN_VK_MEDIA_STOP = 0xB2;
const WIN_VK_MEDIA_PLAY_PAUSE = 0xB3;
const WIN_VK_OEM_FJ_00 = 0xB3;
const WIN_VK_LAUNCH_MAIL = 0xB4;
const WIN_VK_LAUNCH_MEDIA_SELECT = 0xB5;
const WIN_VK_LAUNCH_APP1 = 0xB6;
const WIN_VK_LAUNCH_APP2 = 0xB7;
const WIN_VK_OEM_1 = 0xBA;
const WIN_VK_OEM_PLUS = 0xBB;
const WIN_VK_OEM_COMMA = 0xBC;
const WIN_VK_OEM_MINUS = 0xBD;
const WIN_VK_OEM_PERIOD = 0xBE;
const WIN_VK_OEM_2 = 0xBF;
const WIN_VK_OEM_3 = 0xC0;
const WIN_VK_OEM_4 = 0xDB;
const WIN_VK_OEM_5 = 0xDC;
const WIN_VK_OEM_6 = 0xDD;
const WIN_VK_OEM_7 = 0xDE;
const WIN_VK_OEM_8 = 0xDF;
const WIN_VK_OEM_NEC_DP1 = 0xE0;
const WIN_VK_OEM_AX = 0xE1;
const WIN_VK_OEM_NEC_DP2 = 0xE1;
const WIN_VK_OEM_102 = 0xE2;
const WIN_VK_OEM_NEC_DP3 = 0xE2;
const WIN_VK_ICO_HELP = 0xE3;
const WIN_VK_OEM_NEC_DP4 = 0xE3;
const WIN_VK_ICO_00 = 0xE4;
const WIN_VK_PROCESSKEY = 0xE5;
const WIN_VK_ICO_CLEAR = 0xE6;
const WIN_VK_PACKET = 0xE7;
const WIN_VK_ERICSSON_BASE = 0xE8;
const WIN_VK_OEM_RESET = 0xE9;
const WIN_VK_OEM_JUMP = 0xEA;
const WIN_VK_OEM_PA1 = 0xEB;
const WIN_VK_OEM_PA2 = 0xEC;
const WIN_VK_OEM_PA3 = 0xED;
const WIN_VK_OEM_WSCTRL = 0xEE;
const WIN_VK_OEM_CUSEL = 0xEF;
const WIN_VK_OEM_ATTN = 0xF0;
const WIN_VK_OEM_FINISH = 0xF1;
const WIN_VK_OEM_COPY = 0xF2;
const WIN_VK_OEM_AUTO = 0xF3;
const WIN_VK_OEM_ENLW = 0xF4;
const WIN_VK_OEM_BACKTAB = 0xF5;
const WIN_VK_ATTN = 0xF6;
const WIN_VK_CRSEL = 0xF7;
const WIN_VK_EXSEL = 0xF8;
const WIN_VK_EREOF = 0xF9;
const WIN_VK_PLAY = 0xFA;
const WIN_VK_ZOOM = 0xFB;
const WIN_VK_NONAME = 0xFC;
const WIN_VK_PA1 = 0xFD;
const WIN_VK_OEM_CLEAR = 0xFE;
// Mac
const MAC_VK_ANSI_A = 0x00;
const MAC_VK_ANSI_S = 0x01;
const MAC_VK_ANSI_D = 0x02;
const MAC_VK_ANSI_F = 0x03;
const MAC_VK_ANSI_H = 0x04;
const MAC_VK_ANSI_G = 0x05;
const MAC_VK_ANSI_Z = 0x06;
const MAC_VK_ANSI_X = 0x07;
const MAC_VK_ANSI_C = 0x08;
const MAC_VK_ANSI_V = 0x09;
const MAC_VK_ISO_Section = 0x0A;
const MAC_VK_ANSI_B = 0x0B;
const MAC_VK_ANSI_Q = 0x0C;
const MAC_VK_ANSI_W = 0x0D;
const MAC_VK_ANSI_E = 0x0E;
const MAC_VK_ANSI_R = 0x0F;
const MAC_VK_ANSI_Y = 0x10;
const MAC_VK_ANSI_T = 0x11;
const MAC_VK_ANSI_1 = 0x12;
const MAC_VK_ANSI_2 = 0x13;
const MAC_VK_ANSI_3 = 0x14;
const MAC_VK_ANSI_4 = 0x15;
const MAC_VK_ANSI_6 = 0x16;
const MAC_VK_ANSI_5 = 0x17;
const MAC_VK_ANSI_Equal = 0x18;
const MAC_VK_ANSI_9 = 0x19;
const MAC_VK_ANSI_7 = 0x1A;
const MAC_VK_ANSI_Minus = 0x1B;
const MAC_VK_ANSI_8 = 0x1C;
const MAC_VK_ANSI_0 = 0x1D;
const MAC_VK_ANSI_RightBracket = 0x1E;
const MAC_VK_ANSI_O = 0x1F;
const MAC_VK_ANSI_U = 0x20;
const MAC_VK_ANSI_LeftBracket = 0x21;
const MAC_VK_ANSI_I = 0x22;
const MAC_VK_ANSI_P = 0x23;
const MAC_VK_Return = 0x24;
const MAC_VK_ANSI_L = 0x25;
const MAC_VK_ANSI_J = 0x26;
const MAC_VK_ANSI_Quote = 0x27;
const MAC_VK_ANSI_K = 0x28;
const MAC_VK_ANSI_Semicolon = 0x29;
const MAC_VK_ANSI_Backslash = 0x2A;
const MAC_VK_ANSI_Comma = 0x2B;
const MAC_VK_ANSI_Slash = 0x2C;
const MAC_VK_ANSI_N = 0x2D;
const MAC_VK_ANSI_M = 0x2E;
const MAC_VK_ANSI_Period = 0x2F;
const MAC_VK_Tab = 0x30;
const MAC_VK_Space = 0x31;
const MAC_VK_ANSI_Grave = 0x32;
const MAC_VK_Delete = 0x33;
const MAC_VK_PC_Backspace = 0x33;
const MAC_VK_Powerbook_KeypadEnter = 0x34;
const MAC_VK_Escape = 0x35;
const MAC_VK_RightCommand = 0x36;
const MAC_VK_Command = 0x37;
const MAC_VK_Shift = 0x38;
const MAC_VK_CapsLock = 0x39;
const MAC_VK_Option = 0x3A;
const MAC_VK_Control = 0x3B;
const MAC_VK_RightShift = 0x3C;
const MAC_VK_RightOption = 0x3D;
const MAC_VK_RightControl = 0x3E;
const MAC_VK_Function = 0x3F;
const MAC_VK_F17 = 0x40;
const MAC_VK_ANSI_KeypadDecimal = 0x41;
const MAC_VK_ANSI_KeypadMultiply = 0x43;
const MAC_VK_ANSI_KeypadPlus = 0x45;
const MAC_VK_ANSI_KeypadClear = 0x47;
const MAC_VK_VolumeUp = 0x48;
const MAC_VK_VolumeDown = 0x49;
const MAC_VK_Mute = 0x4A;
const MAC_VK_ANSI_KeypadDivide = 0x4B;
const MAC_VK_ANSI_KeypadEnter = 0x4C;
const MAC_VK_ANSI_KeypadMinus = 0x4E;
const MAC_VK_F18 = 0x4F;
const MAC_VK_F19 = 0x50;
const MAC_VK_ANSI_KeypadEquals = 0x51;
const MAC_VK_ANSI_Keypad0 = 0x52;
const MAC_VK_ANSI_Keypad1 = 0x53;
const MAC_VK_ANSI_Keypad2 = 0x54;
const MAC_VK_ANSI_Keypad3 = 0x55;
const MAC_VK_ANSI_Keypad4 = 0x56;
const MAC_VK_ANSI_Keypad5 = 0x57;
const MAC_VK_ANSI_Keypad6 = 0x58;
const MAC_VK_ANSI_Keypad7 = 0x59;
const MAC_VK_F20 = 0x5A;
const MAC_VK_ANSI_Keypad8 = 0x5B;
const MAC_VK_ANSI_Keypad9 = 0x5C;
const MAC_VK_JIS_Yen = 0x5D;
const MAC_VK_JIS_Underscore = 0x5E;
const MAC_VK_JIS_KeypadComma = 0x5F;
const MAC_VK_F5 = 0x60;
const MAC_VK_F6 = 0x61;
const MAC_VK_F7 = 0x62;
const MAC_VK_F3 = 0x63;
const MAC_VK_F8 = 0x64;
const MAC_VK_F9 = 0x65;
const MAC_VK_JIS_Eisu = 0x66;
const MAC_VK_F11 = 0x67;
const MAC_VK_JIS_Kana = 0x68;
const MAC_VK_F13 = 0x69;
const MAC_VK_PC_PrintScreen = 0x69;
const MAC_VK_F16 = 0x6A;
const MAC_VK_PC_ScrollLock = 0x6A;
const MAC_VK_F14 = 0x6B;
const MAC_VK_PC_Pause = 0x6B;
const MAC_VK_F10 = 0x6D;
const MAC_VK_F12 = 0x6F;
const MAC_VK_F15 = 0x71;
const MAC_VK_Help = 0x72;
const MAC_VK_PC_Insert = 0x72;
const MAC_VK_Home = 0x73;
const MAC_VK_PageUp = 0x74;
const MAC_VK_ForwardDelete = 0x75;
const MAC_VK_PC_Delete = 0x75;
const MAC_VK_F4 = 0x76;
const MAC_VK_End = 0x77;
const MAC_VK_F2 = 0x78;
const MAC_VK_PageDown = 0x79;
const MAC_VK_F1 = 0x7A;
const MAC_VK_LeftArrow = 0x7B;
const MAC_VK_RightArrow = 0x7C;
const MAC_VK_DownArrow = 0x7D;
const MAC_VK_UpArrow = 0x7E;

Просмотреть файл

@ -125,3 +125,5 @@ run-if.config = ipc
[include:modules/libmar/tests/unit/xpcshell.ini]
skip-if = os == "android"
[include:tools/profiler/tests/xpcshell.ini]

Просмотреть файл

@ -51,7 +51,6 @@
<field name="mSearchNames">null</field>
<field name="mIgnoreInput">false</field>
<field name="mEnterEvent">null</field>
<field name="mConsumeRollupEvent">false</field>
<field name="_searchBeginHandler">null</field>
<field name="_searchCompleteHandler">null</field>
@ -164,9 +163,6 @@
<property name="searchCount" readonly="true"
onget="this.initSearchNames(); return this.mSearchNames.length;"/>
<property name="consumeRollupEvent" readonly="true"
onget="return this.mConsumeRollupEvent;"/>
<!-- This is the maximum number of drop-down rows we get when we
hit the drop marker beside fields that have it (like the URLbar).-->
<field name="maxDropMarkerRows" readonly="true">14</field>
@ -365,7 +361,7 @@
<method name="closePopup">
<body><![CDATA[
this.mConsumeRollupEvent = false;
this.popup.setAttribute("consumeoutsideclicks", "false");
this.popup.closePopup();
]]></body>
</method>
@ -382,7 +378,7 @@
input.setAttribute("open", "true");
function onHide() {
input.removeAttribute("open");
input.mConsumeRollupEvent = false;
popup.setAttribute("consumeoutsideclicks", "false");
popup.removeEventListener("popuphiding", onHide, false);
}
popup.addEventListener("popuphiding", onHide, false);
@ -402,7 +398,7 @@
// Ensure that we have focus.
if (!this.focused)
this.focus();
this.mConsumeRollupEvent = true;
this.popup.setAttribute("consumeoutsideclicks", "true");
this.attachController();
this.mController.startSearch("");
]]></body>
@ -606,7 +602,7 @@
<stylesheet src="chrome://global/skin/autocomplete.css"/>
</resources>
<content ignorekeys="true" level="top">
<content ignorekeys="true" level="top" consumeoutsideclicks="false">
<xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1" seltype="single">
<xul:treecols anonid="treecols">
<xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1" overflow="true"/>
@ -757,12 +753,6 @@
var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction;
this.style.direction = popupDirection;
// setConsumeRollupEvent() before we call openPopup()
var nsIPopupBO = Components.interfaces.nsIPopupBoxObject;
this.popupBoxObject.setConsumeRollupEvent(
this.mInput.consumeRollupEvent ?
nsIPopupBO.ROLLUP_CONSUME :
nsIPopupBO.ROLLUP_NO_CONSUME);
this.openPopup(aElement, "after_start", 0, 0, false, false);
}
]]></body>
@ -945,7 +935,7 @@
<stylesheet src="chrome://global/skin/autocomplete.css"/>
</resources>
<content ignorekeys="true" level="top">
<content ignorekeys="true" level="top" consumeoutsideclicks="false">
<xul:richlistbox anonid="richlistbox" class="autocomplete-richlistbox" flex="1"/>
<xul:hbox>
<children/>
@ -1001,12 +991,6 @@
// invalidate() depends on the width attribute
this._invalidate();
// setConsumeRollupEvent() before we call openPopup()
var nsIPopupBO = Components.interfaces.nsIPopupBoxObject;
this.popupBoxObject.setConsumeRollupEvent(
this.mInput.consumeRollupEvent ?
nsIPopupBO.ROLLUP_CONSUME :
nsIPopupBO.ROLLUP_NO_CONSUME);
this.openPopup(aElement, "after_start", 0, 0, false, false);
}
]]>

Просмотреть файл

@ -343,7 +343,7 @@
<children includes="observes|template|menupopup|panel|tooltip"/>
<xul:button class="box-inherit button-menubutton-button"
anonid="button" flex="1" allowevents="true"
xbl:inherits="disabled,crop,image,label,accessKey,command,
xbl:inherits="disabled,crop,image,label,accesskey,command,
buttonover,buttondown,align,dir,pack,orient">
<children/>
</xul:button>

Двоичные данные
toolkit/crashreporter/tools/win32/dump_syms_vc1700.exe Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -14,6 +14,8 @@
#define NS_tsnprintf _snwprintf
#define NS_T(str) L ## str
#define PATH_SEPARATOR_CHAR L'\\'
// On Windows, argv[0] can also have forward slashes instead
#define ALT_PATH_SEPARATOR_CHAR L'/'
#else
#include <unistd.h>
#define NS_main main
@ -96,6 +98,11 @@ int NS_main(int argc, NS_tchar **argv)
StringTable testStrings;
NS_tchar *slash = NS_tstrrchr(argv[0], PATH_SEPARATOR_CHAR);
#ifdef ALT_PATH_SEPARATOR_CHAR
NS_tchar *altslash = NS_tstrrchr(argv[0], ALT_PATH_SEPARATOR_CHAR);
slash = (slash > altslash) ? slash : altslash;
#endif // ALT_PATH_SEPARATOR_CHAR
if (!slash) {
fail("%s | unable to find platform specific path separator (check 1)", TEST_NAME);
return 20;

Просмотреть файл

@ -8,6 +8,9 @@ DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = $(srcdir)
relativesrcdir = tools/profiler
XPCSHELL_TESTS = tests
include $(DEPTH)/config/autoconf.mk

Просмотреть файл

@ -239,10 +239,9 @@ public:
JSObject *sample = NULL;
JSObject *frames = NULL;
int oldReadPos = mReadPos;
while (mReadPos != mLastFlushPos) {
ProfileEntry entry = mEntries[mReadPos];
mReadPos = (mReadPos + 1) % mEntrySize;
int readPos = mReadPos;
while (readPos != mLastFlushPos) {
ProfileEntry entry = mEntries[readPos];
switch (entry.mTagName) {
case 's':
sample = b.CreateObject();
@ -267,8 +266,8 @@ public:
}
}
}
readPos = (readPos + 1) % mEntrySize;
}
mReadPos = oldReadPos;
return profile;
}
@ -766,6 +765,9 @@ const char** mozilla_sampler_get_features()
void mozilla_sampler_start(int aProfileEntries, int aInterval,
const char** aFeatures, uint32_t aFeatureCount)
{
if (!stack_key_initialized)
mozilla_sampler_init();
ProfileStack *stack = tlsStack.get();
if (!stack) {
ASSERT(false);
@ -782,6 +784,9 @@ void mozilla_sampler_start(int aProfileEntries, int aInterval,
void mozilla_sampler_stop()
{
if (!stack_key_initialized)
mozilla_sampler_init();
TableTicker *t = tlsTicker.get();
if (!t) {
return;
@ -794,6 +799,9 @@ void mozilla_sampler_stop()
bool mozilla_sampler_is_active()
{
if (!stack_key_initialized)
mozilla_sampler_init();
TableTicker *t = tlsTicker.get();
if (!t) {
return false;

Просмотреть файл

@ -8,7 +8,7 @@
[scriptable, uuid(e388fded-1321-41af-a988-861a2bc5cfc3)]
interface nsIProfiler : nsISupports
{
void StartProfiler(in PRUint32 aInterval, in PRUint32 aEntries,
void StartProfiler(in PRUint32 aEntries, in PRUint32 aInterval,
[array, size_is(aFeatureCount)] in string aFeatures,
in PRUint32 aFeatureCount);
void StopProfiler();

Просмотреть файл

@ -26,10 +26,10 @@ nsProfiler::nsProfiler()
NS_IMETHODIMP
nsProfiler::StartProfiler(PRUint32 aInterval, PRUint32 aEntries,
nsProfiler::StartProfiler(PRUint32 aEntries, PRUint32 aInterval,
const char** aFeatures, PRUint32 aFeatureCount)
{
SAMPLER_START(aInterval, aEntries, aFeatures, aFeatureCount);
SAMPLER_START(aEntries, aInterval, aFeatures, aFeatureCount);
#ifdef MOZ_INSTRUMENT_EVENT_LOOP
mozilla::InitEventTracing();
#endif

Просмотреть файл

@ -0,0 +1,7 @@
/* 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/. */
const Cc = Components.classes;
const Ci = Components.interfaces;

Просмотреть файл

@ -0,0 +1,18 @@
/* 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/. */
function run_test() {
// If we can't get the profiler component then assume gecko was
// built without it and pass all the tests
var profilerCc = Cc["@mozilla.org/tools/profiler;1"];
if (!profilerCc)
return;
var profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
if (!profiler)
return;
var profilerFeatures = profiler.GetFeatures([]);
do_check_true(profilerFeatures != null);
}

Просмотреть файл

@ -0,0 +1,48 @@
/* 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/. */
function run_test() {
// If we can't get the profiler component then assume gecko was
// built without it and pass all the tests
var profilerCc = Cc["@mozilla.org/tools/profiler;1"];
if (!profilerCc)
return;
var profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
if (!profiler)
return;
do_check_true(!profiler.IsActive());
profiler.StartProfiler(1000, 10, [], 0);
do_check_true(profiler.IsActive());
do_test_pending();
do_timeout(1000, function wait() {
// Check responsiveness
var resp = profiler.GetResponsivenessTimes({});
do_check_true(resp.length > 10);
// Check text profile format
var profileStr = profiler.GetProfile();
do_check_true(profileStr.length > 10);
// check json profile format
var profileObj = profiler.getProfileData();
do_check_neq(profileObj, null);
do_check_neq(profileObj.threads, null);
do_check_true(profileObj.threads.length >= 1);
do_check_neq(profileObj.threads[0].samples, null);
// NOTE: The number of samples will be empty since we
// don't have any labels in the xpcshell code
profiler.StopProfiler();
do_check_true(!profiler.IsActive());
do_test_finished();
});
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше