Merge last PGO-green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2012-02-23 13:58:27 +00:00
Родитель e00d9297aa d772174f12
Коммит 46e8048646
153 изменённых файлов: 1186 добавлений и 2120 удалений

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

@ -838,9 +838,9 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
nsPresContext *presContext = frame->PresContext();
nsIntRect screenRect = frame->GetScreenRectExternal();
nsPoint offset(presContext->DevPixelsToAppUnits(aX - screenRect.x),
presContext->DevPixelsToAppUnits(aY - screenRect.y));
nsRect screenRect = frame->GetScreenRectInAppUnits();
nsPoint offset(presContext->DevPixelsToAppUnits(aX) - screenRect.x,
presContext->DevPixelsToAppUnits(aY) - screenRect.y);
nsCOMPtr<nsIPresShell> presShell = presContext->PresShell();
nsIFrame *foundFrame = presShell->GetFrameForPoint(frame, offset);

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

@ -20,19 +20,14 @@
<script type="application/javascript">
function doTest()
{
var p1 = currentTabDocument().body.firstElementChild;
var p2 = currentTabDocument().body.lastElementChild;
var tabDocument = currentTabDocument();
var p1 = tabDocument.body.firstElementChild;
var p2 = tabDocument.body.lastElementChild;
testBounds(p1);
testBounds(p2);
var docShell = currentTabWindow().
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIDocShell);
var docViewer = docShell.contentViewer.
QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
docViewer.fullZoom = 2.0;
zoomDocument(tabDocument, 2.0);
testBounds(p1);
testBounds(p2);

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

@ -98,6 +98,21 @@ function reloadButton()
return browserWindow().document.getElementById("urlbar-reload-button");
}
/**
* Zoom the given document.
*/
function zoomDocument(aDocument, aZoom)
{
var docShell = aDocument.defaultView.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIDocShell);
var docViewer = docShell.contentViewer.
QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
docViewer.fullZoom = aZoom;
}
////////////////////////////////////////////////////////////////////////////////
// private section

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

@ -46,9 +46,10 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_browser.html \
test_general.html \
test_general.xul \
test_browser.html \
test_zoom.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>childAtPoint when page is zoomed</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../layout.js"></script>
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript">
function doTest()
{
var tabDocument = currentTabDocument();
var p1 = tabDocument.body.firstElementChild;
var p2 = tabDocument.body.lastElementChild;
hitTest(tabDocument, p1, p1.firstChild);
hitTest(tabDocument, p2, p2.firstChild);
zoomDocument(tabDocument, 2.0);
hitTest(tabDocument, p1, p1.firstChild);
hitTest(tabDocument, p2, p2.firstChild);
closeBrowserWindow();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
openBrowserWindow(doTest,
"data:text/html,<html><body><p>para 1</p><p>para 2</p></body></html>",
{ left: 100, top: 100 });
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
title="childAtPoint may return incorrect accessibles when page zoomed">
Mozilla Bug 727942
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>

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

@ -22,6 +22,29 @@ function testChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild,
is(childAcc, actualChildAcc, msg);
}
/**
* Test if getChildAtPoint returns the given child and grand child accessibles
* at coordinates of child accessible (direct and deep hit test).
*/
function hitTest(aContainerID, aChildID, aGrandChildID)
{
var container = getAccessible(aContainerID);
var child = getAccessible(aChildID);
var grandChild = getAccessible(aGrandChildID);
var [x, y] = getBoundsForDOMElm(child);
var actualChild = container.getChildAtPoint(x + 1, y + 1);
is(actualChild, child,
"Wrong child, expected: " + prettyName(child) +
", got: " + prettyName(actualChild));
var actualGrandChild = container.getDeepestChildAtPoint(x + 1, y + 1);
is(actualGrandChild, grandChild,
"Wrong deepest child, expected: " + prettyName(grandChild) +
", got: " + prettyName(actualGrandChild));
}
/**
* Return child accessible at the given point.
*

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

@ -107,6 +107,6 @@ xul|thumb {
-moz-border-right-colors: none !important;
-moz-border-left-colors: none !important;
border: 1px solid rgba(255, 255, 255, 0.4) !important;
-moz-border-radius: 3px;
border-radius: 3px;
}

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

@ -181,7 +181,7 @@ image.study-result {
color: white;
font-weight: bold;
padding: 2px;
-moz-border-radius: 100%;
border-radius: 100%;
margin-right: 25px;
margin-bottom: 13px;
}

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

@ -102,9 +102,8 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
font-size: 16px;
padding: 8px 12px;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-box-shadow:
border-radius: 0.5em;
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
inset rgba(255, 255, 255, 0.3) 0 16px 0px,
@ -122,9 +121,8 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 12px;
width: 240px;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-box-shadow:
border-radius: 0.5em;
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
inset rgba(255, 255, 255, 0.3) 0 16px 0px,
@ -143,10 +141,9 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 24px;
margin: 24px auto;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center;
-moz-box-shadow:
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 12px,
inset rgba(185, 221, 234, 1) 0 0px 1px,
inset rgba(255, 255, 255, 0.2) 0 10px 12px;
@ -161,10 +158,9 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 8px 24px;
margin: 8px auto;
color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/callout.png') no-repeat top center;
-moz-box-shadow:
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 12px,
inset rgba(185, 221, 234, 1) 0 0px 1px,
inset rgba(255, 255, 255, 0.2) 0 10px 12px;
@ -197,8 +193,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
padding: 4px 40px;
width: 800px;
text-align: left;
-moz-border-radius: 0.25em;
-webkit-border-radius: 0.25em;
border-radius: 0.25em;
border-top: 1px solid #adb6ba;
border-left: 1px solid #adb6ba;
border-right: 1px solid #adb6ba;
@ -223,7 +218,7 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
font-size: 14px;
text-shadow: 1px 1px 1px rgba(173, 182, 186, 1);
background-color: rgba(173, 182, 186, 0.3);
-moz-box-shadow:
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 -10px 12px;
padding: 9px 8px 8px 8px;
}
@ -255,4 +250,4 @@ src: url('chrome://testpilot/skin/fonts/DroidSans-Bold.ttf') format('truetype');
p.embiggened {
font-size: 14px;
}
}

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

@ -53,7 +53,6 @@ body {
font-size: 16px;
padding: 6px 20px 20px 20px;
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center;
/* display: inline; */
}
@ -114,7 +113,6 @@ body {
padding: 8px 12px;
color: rgba(0, 0, 0, 0.8);
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
@ -133,7 +131,6 @@ body {
width: 240px;
color: rgba(0, 0, 0, 0.8);
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
box-shadow:
inset rgba(0, 0, 0, 0.2) 0 1px 1px,
inset rgba(255, 255, 255, 1) 0 3px 1px,
@ -152,7 +149,6 @@ body {
margin: 24px auto;
color: rgba(0, 0, 0, 0.8);
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center;
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 8.5px,
@ -174,7 +170,6 @@ body {
margin: 8px auto;
color: rgba(0, 0, 0, 0.8);
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout.png') no-repeat top center;
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 8.5px,
@ -191,7 +186,6 @@ body {
margin: 8px auto;
color: rgba(0, 0, 0, 0.8);
border-radius: 0.5em;
-webkit-border-radius: 0.5em;
background: rgba(220, 240, 247, 0.8) url('chrome://testpilot/skin/images/callout_continue.png') no-repeat top center;
box-shadow:
inset rgba(185, 221, 234, 0.2) 0 -10px 8.5px,
@ -238,7 +232,6 @@ body {
width: 800px;
text-align: left;
border-radius: 0.25em;
-webkit-border-radius: 0.25em;
border-top: 1px solid #adb6ba;
border-left: 1px solid #adb6ba;
border-right: 1px solid #adb6ba;

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

@ -4043,7 +4043,9 @@ var FullScreen = {
gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
// Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
window.addEventListener("deactivate", this.exitDomFullScreen, true);
if (gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
window.addEventListener("deactivate", this.exitDomFullScreen, true);
}
// Cancel any "hide the toolbar" animation which is in progress, and make
// the toolbar hide immediately.

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

@ -26,10 +26,8 @@ function test() {
// Now trigger the invalid URI test
executeSoon(function () {
info("Dialog closed? " + domwindow.closed + "\n");
let consoleListener = {
observe: function (m) {
info("m: " + m + "\n");
info("m.message: " + m.message + "\n");
if (m.message.indexOf("NS_ERROR_DOM_BAD_URI") > -1) {
ok(true, "drop was blocked");
@ -42,18 +40,27 @@ function test() {
Services.console.unregisterListener(consoleListener);
});
// The drop handler throws an exception when dragging URIs that inherit
// principal, e.g. javascript:
expectUncaughtException();
let originalHandler = homeButtonObserver.onDrop;
homeButtonObserver.onDrop = function (aEvent) {
info("homeButtonObserver.onDrop called");
originalHandler(aEvent);
};
registerCleanupFunction(function () {
homeButtonObserver.onDrop = originalHandler;
executeSoon(function () {
info("Attempting second drop, of a javascript: URI");
// The drop handler throws an exception when dragging URIs that inherit
// principal, e.g. javascript:
expectUncaughtException();
let originalHandler = homeButtonObserver.onDrop;
homeButtonObserver.onDrop = function (aEvent) {
info("homeButtonObserver.onDrop called");
try {
originalHandler(aEvent);
} catch (ex) {
info("originalHandler threw an exception: " + ex);
throw ex;
}
};
registerCleanupFunction(function () {
homeButtonObserver.onDrop = originalHandler;
});
chromeUtils.synthesizeDrop(homeButton, homeButton, [[{type: "text/plain", data: "javascript:8888"}]], "copy", window, EventUtils);
info("Triggered the second drop of a javascript: URI");
});
chromeUtils.synthesizeDrop(homeButton, homeButton, [[{type: "text/plain", data: "javascript:8888"}]], "copy", window, EventUtils);
})
});

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

@ -336,7 +336,6 @@ nsWindowsShellService::ShortcutMaintenance()
bool
nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser)
{
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
IApplicationAssociationRegistration* pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
@ -355,7 +354,6 @@ nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser)
pAAR->Release();
return true;
}
#endif
return false;
}

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

@ -282,5 +282,5 @@
.styleinspector-propertyeditor {
border: 1px solid #CCC;
padding: 0;
-moz-box-shadow: 2px 2px 2px #CCC;
box-shadow: 2px 2px 2px #CCC;
}

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

@ -284,5 +284,5 @@
.styleinspector-propertyeditor {
border: 1px solid #CCC;
padding: 0;
-moz-box-shadow: 2px 2px 2px #CCC;
box-shadow: 2px 2px 2px #CCC;
}

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

@ -282,5 +282,5 @@
.styleinspector-propertyeditor {
border: 1px solid #CCC;
padding: 0;
-moz-box-shadow: 2px 2px 2px #CCC;
box-shadow: 2px 2px 2px #CCC;
}

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

@ -979,8 +979,6 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
;;
esac

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

@ -30,13 +30,13 @@ var constants = [
"INVALID_ACCESS_ERR",
"VALIDATION_ERR",
"TYPE_MISMATCH_ERR",
null,
null,
null,
null,
null,
null,
null,
"SECURITY_ERR",
"NETWORK_ERR",
"ABORT_ERR",
"URL_MISMATCH_ERR",
"QUOTA_EXCEEDED_ERR",
"TIMEOUT_ERR",
"INVALID_NODE_TYPE_ERR",
"DATA_CLONE_ERR"
];
for (var i = 0; i < constants.length; ++i) {

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

@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=685518
SimpleTest.waitForExplicitFinish();
const SECURITY_ERR = 0x805303e8;
const SECURITY_ERR = 0x80530012;
const BAD_URI_ERR = 0x805303f4;
const OK = 0;

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

@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=682299
/** Test for Bug 682299 **/
const MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
const SECURITY_ERR = 0x805303e8;
const SECURITY_ERR = 0x80530012;
function createCanvas(width, height) {
var c = document.createElement("canvas");

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

@ -11,7 +11,7 @@
SimpleTest.waitForExplicitFinish();
const SECURITY_ERR = 0x805303e8;
const SECURITY_ERR = 0x80530012;
const OK = 0;
var gl;

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

@ -19702,7 +19702,7 @@ function test_bug397524() {
try {
$("canvas2").toDataURL("image/png");
gotData = true;
} catch (ex if (ex.code == 1000 && ex.name == "NS_ERROR_DOM_SECURITY_ERR")) {
} catch (ex if (ex.code == 18 && ex.name == "SecurityError")) {
}
is(gotData, false, "Shouldn't be able to read images cross-site!");
@ -19711,7 +19711,7 @@ function test_bug397524() {
try {
$("canvas3").toDataURL("image/png");
gotData = true;
} catch (ex if (ex.code == 1000 && ex.name == "NS_ERROR_DOM_SECURITY_ERR")) {
} catch (ex if (ex.code == 18 && ex.name == "SecurityError")) {
}
is(gotData, false, "Shouldn't be able to read images redirected cross-site!");

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

@ -78,7 +78,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
browser.loadURI(chromeDir + "bug415498-doc1.html");
yield;
ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),
ok(verifyErrorReceived("HierarchyRequestError"),
"Error message not reported in event listener callback!");
gMessages = [];
@ -87,7 +87,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
browser.loadURI(chromeDir + "bug415498-doc2.html");
yield;
ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),
ok(verifyErrorReceived("HierarchyRequestError"),
"Error message not reported in window.onload!");
}

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

@ -38,17 +38,17 @@ function afterDragTests()
checkTypes(gDataTransfer, [], 0, "after dragstart event");
expectError(function() gDataTransfer.setData("text/plain", "Some Text"),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "setData when read only");
"NoModificationAllowedError", "setData when read only");
expectError(function() gDataTransfer.clearData("text/plain"),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "clearData when read only");
"NoModificationAllowedError", "clearData when read only");
expectError(function() gDataTransfer.mozSetDataAt("text/plain", "Some Text", 0),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "setDataAt when read only");
"NoModificationAllowedError", "setDataAt when read only");
expectError(function() gDataTransfer.mozClearDataAt("text/plain", 0),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "clearDataAt when read only");
"NoModificationAllowedError", "clearDataAt when read only");
expectError(function() gDataTransfer.setDragImage(draggable, 10, 10),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "setDragImage when read only");
"NoModificationAllowedError", "setDragImage when read only");
expectError(function() gDataTransfer.addElement(draggable),
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR", "addElement when read only");
"NoModificationAllowedError", "addElement when read only");
var evt = document.createEvent("dragevent");
ok(evt instanceof DragEvent, "synthetic dragevent class")
@ -154,7 +154,7 @@ function test_DataTransfer(dt)
// calling setDataAt requires an index that is 0 <= index <= dt.itemCount
expectError(function() dt.mozSetDataAt("text/plain", "Some Text", 1),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "setDataAt index too high");
"IndexSizeError", "setDataAt index too high");
is(dt.mozUserCancelled, false, "userCancelled");
@ -172,9 +172,9 @@ function test_DataTransfer(dt)
// similar with clearDataAt and getDataAt
expectError(function() dt.mozGetDataAt("text/plain", 1),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "getDataAt index too high");
"IndexSizeError", "getDataAt index too high");
expectError(function() dt.mozClearDataAt("text/plain", 1),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "clearDataAt index too high");
"IndexSizeError", "clearDataAt index too high");
dt.setData("text/plain", "Sample Text");
is(dt.mozItemCount, 1, "added plaintext itemCount");
@ -285,7 +285,7 @@ function test_DataTransfer(dt)
dt.mozSetDataAt("text/plain", "First Item", 0);
dt.mozSetDataAt("text/plain", "Second Item", 1);
expectError(function() dt.mozSetDataAt("text/plain", "Some Text", 3),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "setDataAt index too high with two items");
"IndexSizeError", "setDataAt index too high with two items");
is(dt.mozItemCount, 2, "setDataAt item itemCount");
checkOneDataItem(dt, ["text/plain"], ["First Item"], 0, "setDataAt item at index 0");
checkOneDataItem(dt, ["text/plain"], ["Second Item"], 1, "setDataAt item at index 1");
@ -329,7 +329,7 @@ function test_DataTransfer(dt)
["First Item", "Changed with setData"], 0, "clearDataAt last type at index 0");
checkOneDataItem(dt, ["application/-moz-node"], [draggable], 1, "clearDataAt last type item at index 2");
expectError(function() dt.mozGetDataAt("text/plain", 2),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "getDataAt after item removed index too high");
"IndexSizeError", "getDataAt after item removed index too high");
dt.mozSetDataAt("text/unknown", "Unknown type", 2);
dt.mozSetDataAt("text/unknown", "Unknown type", 1);
@ -356,7 +356,7 @@ function test_DataTransfer(dt)
["Unknown type"], 1, "clearData type that does not exist item at index 1");
expectError(function() dt.mozClearDataAt("text/plain", 3),
"NS_ERROR_DOM_INDEX_SIZE_ERR", "clearData index too high with two items");
"IndexSizeError", "clearData index too high with two items");
// ensure that clearData() removes all data associated with the first item
dt.clearData();

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

@ -16,7 +16,7 @@ function test(element, value, shouldThrow) {
var threw = false;
try {
element.volume = value;
} catch (err if err.name == "NS_ERROR_DOM_INDEX_SIZE_ERR") {
} catch (err if err.name == "IndexSizeError") {
threw = true;
}
is(shouldThrow, threw, "Case: " +element.id+ " setVolume=" + value);

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

@ -43,7 +43,7 @@ const INVALID_STATE_ERR = 0x8053000b; // NS_ERROR_DOM_INVALID_STATE_ERR
const INDEX_SIZE_ERR = 0x80530001; // NS_ERROR_DOM_INDEX_SIZE_ERR
const INVALID_NODE_TYPE_ERR = 0x805c0002; // NS_ERROR_DOM_INVALID_NODE_TYPE_ERR
const NOT_OBJECT_ERR = 0x805303eb; // NS_ERROR_DOM_NOT_OBJECT_ERR
const SECURITY_ERR = 0x805303e8; // NS_ERROR_DOM_SECURITY_ERR
const SECURITY_ERR = 0x80530012; // NS_ERROR_DOM_SECURITY_ERR
/**
* Determine if the data node has only ignorable white-space.

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

@ -8327,15 +8327,14 @@ nsDocShell::InternalLoad(nsIURI * aURI,
NS_SUCCEEDED(splitRv2) &&
curBeforeHash.Equals(newBeforeHash);
// XXX rename
bool sameDocument = false;
bool historyNavBetweenSameDoc = false;
if (mOSHE && aSHEntry) {
// We're doing a history load.
mOSHE->SharesDocumentWith(aSHEntry, &sameDocument);
mOSHE->SharesDocumentWith(aSHEntry, &historyNavBetweenSameDoc);
#ifdef DEBUG
if (sameDocument) {
if (historyNavBetweenSameDoc) {
nsCOMPtr<nsIInputStream> currentPostData;
mOSHE->GetPostData(getter_AddRefs(currentPostData));
NS_ASSERTION(currentPostData == aPostData,
@ -8348,8 +8347,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// for the same document. We do a short-circuited load under two
// circumstances. Either
//
// a) we're navigating between two different SHEntries which have the
// same document identifiers, or
// a) we're navigating between two different SHEntries which share a
// document, or
//
// b) we're navigating to a new shentry whose URI differs from the
// current URI only in its hash, the new hash is non-empty, and
@ -8358,15 +8357,10 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// The restriction tha the SHEntries in (a) must be different ensures
// that history.go(0) and the like trigger full refreshes, rather than
// short-circuited loads.
bool doShortCircuitedLoad = (sameDocument && mOSHE != aSHEntry) ||
(!aSHEntry && aPostData == nsnull &&
sameExceptHashes && !newHash.IsEmpty());
// Fire a hashchange event if we're doing a short-circuited load and the
// URIs differ only in their hashes.
bool doHashchange = doShortCircuitedLoad &&
sameExceptHashes &&
!curHash.Equals(newHash);
bool doShortCircuitedLoad =
(historyNavBetweenSameDoc && mOSHE != aSHEntry) ||
(!aSHEntry && aPostData == nsnull &&
sameExceptHashes && !newHash.IsEmpty());
if (doShortCircuitedLoad) {
// Save the current URI; we need it if we fire a hashchange later.
@ -8496,27 +8490,21 @@ nsDocShell::InternalLoad(nsIURI * aURI,
}
}
if (sameDocument) {
// Set the doc's URI according to the new history entry's URI
nsCOMPtr<nsIURI> newURI;
mOSHE->GetURI(getter_AddRefs(newURI));
NS_ENSURE_TRUE(newURI, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc =
do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->SetDocumentURI(newURI);
}
// Set the doc's URI according to the new history entry's URI.
nsCOMPtr<nsIDocument> doc =
do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
doc->SetDocumentURI(aURI);
SetDocCurrentStateObj(mOSHE);
// Dispatch the popstate and hashchange events, as appropriate.
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mScriptGlobal);
if (window) {
// Need the doHashchange check here since sameDocument is
// false if we're navigating to a new shentry (i.e. a aSHEntry
// is null), such as when clicking a <a href="#foo">.
if (sameDocument || doHashchange) {
// Fire a hashchange event URIs differ, and only in their hashes.
bool doHashchange = sameExceptHashes && !curHash.Equals(newHash);
if (historyNavBetweenSameDoc || doHashchange) {
window->DispatchSyncPopState();
}

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

@ -126,6 +126,8 @@ _TEST_FILES = \
bug691547_frame.html \
test_bug694612.html \
test_bug713825.html \
test_bug728939.html \
file_bug728939.html \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)

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

@ -0,0 +1,3 @@
<html>
<body onload="opener.popupLoaded()">file_bug728939</body>
</html>

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

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=728939
-->
<head>
<title>Test for Bug 728939</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=728939">Mozilla Bug 728939</a>
<script type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
// Called when the popup finishes loading.
function popupLoaded() {
popup.location.hash = '#foo';
is(popup.document.URL, popup.location.href, 'After hashchange.');
popup.history.pushState('', '', 'bar');
is(popup.document.URL, popup.location.href, 'After pushState.');
popup.history.replaceState('', '', 'baz');
is(popup.document.URL, popup.location.href, 'After replaceState.');
popup.close();
SimpleTest.finish();
}
var popup = window.open('file_bug728939.html');
</script>
</body>
</html>

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

@ -38,37 +38,39 @@
/* Error Message definitions. */
/* DOM error codes from http://www.w3.org/TR/REC-DOM-Level-1/ */
/* DOM error codes from http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception */
DOM_MSG_DEF(NS_ERROR_DOM_INDEX_SIZE_ERR, "Index or size is negative or greater than the allowed amount")
DOM_MSG_DEF(NS_ERROR_DOM_DOMSTRING_SIZE_ERR, "The specified range of text does not fit in a DOM string")
DOM_MSG_DEF(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR, "Node cannot be inserted at the specified point in the hierarchy")
DOM_MSG_DEF(NS_ERROR_DOM_WRONG_DOCUMENT_ERR, "Node cannot be used in a document other than the one in which it was created")
DOM_MSG_DEF(NS_ERROR_DOM_INVALID_CHARACTER_ERR, "String contains an invalid character")
DOM_MSG_DEF(NS_ERROR_DOM_NO_DATA_ALLOWED_ERR, "Node does not contain data")
DOM_MSG_DEF(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR, "Modifications are not allowed for this document")
DOM_MSG_DEF(NS_ERROR_DOM_NOT_FOUND_ERR, "Node was not found")
DOM_MSG_DEF(NS_ERROR_DOM_NOT_SUPPORTED_ERR, "Operation is not supported")
DOM_MSG_DEF(NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR, "Attribute already in use")
/* DOM error codes from http://www.w3.org/TR/DOM-Level-2/ */
DOM_MSG_DEF(NS_ERROR_DOM_INVALID_ACCESS_ERR, "A parameter or an operation is not supported by the underlying object")
DOM_MSG_DEF(NS_ERROR_DOM_INVALID_MODIFICATION_ERR, "An attempt was made to modify the type of the underlying objec")
DOM_MSG_DEF(NS_ERROR_DOM_INVALID_STATE_ERR, "An attempt was made to use an object that is not, or is no longer, usable")
DOM_MSG_DEF(NS_ERROR_DOM_NAMESPACE_ERR, "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces")
DOM_MSG_DEF(NS_ERROR_DOM_SYNTAX_ERR, "An invalid or illegal string was specified")
DOM_MSG_DEF_(INDEX_SIZE_ERR, "IndexSizeError", "Index or size is negative or greater than the allowed amount")
DOM_MSG_DEF_(DOMSTRING_SIZE_ERR, "DOMStringSizeError", "The specified range of text does not fit in a DOM string")
DOM_MSG_DEF_(HIERARCHY_REQUEST_ERR, "HierarchyRequestError", "Node cannot be inserted at the specified point in the hierarchy")
DOM_MSG_DEF_(WRONG_DOCUMENT_ERR, "WrongDocumentError", "Node cannot be used in a document other than the one in which it was created")
DOM_MSG_DEF_(INVALID_CHARACTER_ERR, "InvalidCharacterError", "String contains an invalid character")
DOM_MSG_DEF_(NO_DATA_ALLOWED_ERR, "NoDataAllowedError", "Node does not contain data")
DOM_MSG_DEF_(NO_MODIFICATION_ALLOWED_ERR, "NoModificationAllowedError", "Modifications are not allowed for this document")
DOM_MSG_DEF_(NOT_FOUND_ERR, "NotFoundError", "Node was not found")
DOM_MSG_DEF_(NOT_SUPPORTED_ERR, "NotSupportedError", "Operation is not supported")
DOM_MSG_DEF_(INUSE_ATTRIBUTE_ERR, "InUseAttributeError", "Attribute already in use")
DOM_MSG_DEF_(INVALID_STATE_ERR, "InvalidStateError", "An attempt was made to use an object that is not, or is no longer, usable")
DOM_MSG_DEF_(SYNTAX_ERR, "SyntaxError", "An invalid or illegal string was specified")
DOM_MSG_DEF_(INVALID_MODIFICATION_ERR, "InvalidModificationError", "An attempt was made to modify the type of the underlying objec")
DOM_MSG_DEF_(NAMESPACE_ERR, "NamespaceError", "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces")
DOM_MSG_DEF_(INVALID_ACCESS_ERR, "InvalidAccessError", "A parameter or an operation is not supported by the underlying object")
DOM_MSG_DEF_(VALIDATION_ERR, "ValidationError", "A call to a method would make the Node invalid with respect to \"partial validity\", so the operation was not done")
DOM_MSG_DEF_(TYPE_MISMATCH_ERR, "TypeMismatchError", "The type of an object is incompatible with the expected type of the parameter associated to the object")
DOM_MSG_DEF_(SECURITY_ERR, "SecurityError", "The operation is insecure.")
DOM_MSG_DEF_(NETWORK_ERR, "NetworkError", "A network error occurred.")
DOM_MSG_DEF_(ABORT_ERR, "AbortError", "The operation was aborted. ")
DOM_MSG_DEF_(URL_MISMATCH_ERR, "URLMismatchError", "The given URL does not match another URL.")
DOM_MSG_DEF_(QUOTA_EXCEEDED_ERR, "QuotaExceededError", "The quota has been exceeded.")
DOM_MSG_DEF_(TIMEOUT_ERR, "TimeoutError", "The operation timed out.")
DOM_MSG_DEF_(INVALID_NODE_TYPE_ERR, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation.")
DOM_MSG_DEF_(DATA_CLONE_ERR, "DataCloneError", "The object could not be cloned.")
/* DOM error codes from http://www.w3.org/TR/DOM-Level-2/range.html */
DOM_MSG_DEF(NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR, "The boundary-points of a range does not meet specific requirements.")
DOM_MSG_DEF(NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR, "The container of an boundary-point of a range is being set to either a node of an invalid type or a node with an ancestor of an invalid type.")
/* DOM error codes from http://www.w3.org/TR/DOM-Level-3/ */
DOM_MSG_DEF(NS_ERROR_DOM_VALIDATION_ERR, "A call to a method would make the Node invalid with respect to \"partial validity\", so the operation was not done")
DOM_MSG_DEF(NS_ERROR_DOM_TYPE_MISMATCH_ERR, "The type of an object is incompatible with the expected type of the parameter associated to the object")
/* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */
DOM_MSG_DEF(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR, "Unknown or invalid type")
@ -80,10 +82,6 @@ DOM_MSG_DEF(NS_ERROR_DOM_SVG_MATRIX_NOT_INVERTABLE, "The matrix could not be com
DOM_MSG_DEF(NS_ERROR_DOM_INVALID_EXPRESSION_ERR, "The expression is not a legal expression.")
DOM_MSG_DEF(NS_ERROR_DOM_TYPE_ERR, "The expression cannot be converted to return the specified type.")
/* HTML5 error codes http://dev.w3.org/html5/spec/Overview.html */
DOM_MSG_DEF(NS_ERROR_DOM_DATA_CLONE_ERR, "The object could not be cloned.")
/* IndexedDB error codes http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html */
DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR, "The operation failed for reasons unrelated to the database itself and not covered by any other error code.")
@ -105,7 +103,6 @@ DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_DEADLOCK_ERR, "The current transaction was au
/* DOM error codes defined by us */
/* XXX string should be specified by norris */
DOM_MSG_DEF(NS_ERROR_DOM_SECURITY_ERR, "Security error")
DOM_MSG_DEF(NS_ERROR_DOM_SECMAN_ERR, "Unable to obtain security manager")
DOM_MSG_DEF(NS_ERROR_DOM_WRONG_TYPE_ERR, "Object is of wrong type")
DOM_MSG_DEF(NS_ERROR_DOM_NOT_OBJECT_ERR, "Parameter is not an object")

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

@ -62,15 +62,14 @@
#define NS_ERROR_DOM_INVALID_ACCESS_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,15)
#define NS_ERROR_DOM_VALIDATION_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,16)
#define NS_ERROR_DOM_TYPE_MISMATCH_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,17)
/* 18: SECURITY_ERR */
/* 19: NETWORK_ERR */
/* 20: ABORT_ERR */
/* 21: URL_MISMATCH_ERR */
/* 22: QUOTA_EXCEEDED_ERR */
/* 23: TIMEOUT_ERR */
/* 24: NOT_READABLE_ERR */
#define NS_ERROR_DOM_SECURITY_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,18)
#define NS_ERROR_DOM_NETWORK_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,19)
#define NS_ERROR_DOM_ABORT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,20)
#define NS_ERROR_DOM_URL_MISMATCH_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,21)
#define NS_ERROR_DOM_QUOTA_EXCEEDED_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,22)
#define NS_ERROR_DOM_TIMEOUT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,23)
#define NS_ERROR_DOM_INVALID_NODE_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,24)
#define NS_ERROR_DOM_DATA_CLONE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,25)
/* 26: ENCODING_ERR */
/* DOM error codes from http://www.w3.org/TR/DOM-Level-2/range.html */
@ -109,7 +108,6 @@
/* DOM error codes defined by us */
#define NS_ERROR_DOM_SECURITY_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1000)
#define NS_ERROR_DOM_SECMAN_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1001)
#define NS_ERROR_DOM_WRONG_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1002)
#define NS_ERROR_DOM_NOT_OBJECT_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,1003)

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

@ -51,6 +51,7 @@
#include "prprf.h"
#define DOM_MSG_DEF(val, message) {(val), #val, message},
#define DOM_MSG_DEF_(val, name, message) {(NS_ERROR_DOM_##val), name, message},
#define IMPL_INTERNAL_DOM_EXCEPTION_HEAD(classname, ifname) \
class classname : public nsBaseDOMException, \
@ -108,6 +109,7 @@ static struct ResultStruct
};
#undef DOM_MSG_DEF
#undef DOM_MSG_DEF_
static void
NSResultToNameAndMessage(nsresult aNSResult,
@ -157,7 +159,7 @@ IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsDOMException, nsIDOMDOMException,
NSResultToNameAndMessage)
NS_IMETHODIMP
nsDOMException::GetCode(PRUint32* aCode)
nsDOMException::GetCode(PRUint16* aCode)
{
NS_ENSURE_ARG_POINTER(aCode);
nsresult result;

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

@ -1308,14 +1308,6 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
// tricky...
}
else {
// If there is an outer script running, propagate the error upwards.
// Otherwise we may lose, e.g., the fact that an inner script evaluation
// was killed for taking too long and allow the outer script evaluation to
// continue.
if (mExecuteDepth > 0 || JS_IsRunning(mContext)) {
rv = NS_ERROR_FAILURE;
}
if (aIsUndefined) {
*aIsUndefined = true;
}
@ -1535,14 +1527,6 @@ nsJSContext::EvaluateString(const nsAString& aScript,
rv = JSValueToAString(mContext, val, aRetValue, aIsUndefined);
}
else {
// If there is an outer script running, propagate the error upwards.
// Otherwise we may lose, e.g., the fact that an inner script evaluation
// was killed for taking too long and allow the outer script evaluation to
// continue.
if (mExecuteDepth > 1 || JS_IsRunning(mContext)) {
rv = NS_ERROR_FAILURE;
}
if (aIsUndefined) {
*aIsUndefined = true;
}
@ -1681,14 +1665,6 @@ nsJSContext::ExecuteScript(JSScript* aScriptObject,
} else {
ReportPendingException();
// If there is an outer script running, propagate the error upwards.
// Otherwise we may lose, e.g., the fact that an inner script evaluation
// was killed for taking too long and allow the outer script evaluation to
// continue.
if (mExecuteDepth > 1 || JS_IsRunning(mContext)) {
rv = NS_ERROR_FAILURE;
}
if (aIsUndefined) {
*aIsUndefined = true;
}
@ -3157,10 +3133,7 @@ nsJSContext::ScriptEvaluated(bool aTerminated)
JS_MaybeGC(mContext);
// Be careful to not reset the operation callback if some outer script is
// still running. This would allow a script to bypass the slow script check
// simply by invoking nested scripts (e.g., through a plugin).
if (aTerminated && mExecuteDepth == 0 && !JS_IsRunning(mContext)) {
if (aTerminated) {
mOperationCallbackTime = 0;
mModalStateTime = 0;
}

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

@ -244,7 +244,7 @@ enum CanvasMultiGetterType {
* transparent/translucent. It is given as a CSS color string
* (e.g., rgb() or rgba()).
*
* @param flags Uused to better control the drawWindow call.
* @param flags Used to better control the drawWindow call.
* Flags can be ORed together.
*
* Of course, the rendering obeys the current scale, transform and

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

@ -48,38 +48,38 @@
* implementation has become unstable)
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-3-Core/
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#domexception
*/
[scriptable, uuid(a6cf910a-15b3-11d2-932e-00805f8add32)]
[scriptable, uuid(5bd766d3-57a9-4833-995d-dbe21da29595)]
interface nsIDOMDOMException : nsISupports
{
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
const unsigned short NO_DATA_ALLOWED_ERR = 6;
const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
const unsigned short INUSE_ATTRIBUTE_ERR = 10;
// Introduced in DOM Level 2:
const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
const unsigned short INVALID_STATE_ERR = 11;
// Introduced in DOM Level 2:
const unsigned short SYNTAX_ERR = 12;
// Introduced in DOM Level 2:
const unsigned short INVALID_MODIFICATION_ERR = 13;
// Introduced in DOM Level 2:
const unsigned short NAMESPACE_ERR = 14;
// Introduced in DOM Level 2:
const unsigned short INVALID_ACCESS_ERR = 15;
// Introduced in DOM Level 3:
const unsigned short VALIDATION_ERR = 16;
// Introduced in DOM Level 3:
const unsigned short VALIDATION_ERR = 16; // historical
const unsigned short TYPE_MISMATCH_ERR = 17;
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
const unsigned short ABORT_ERR = 20;
const unsigned short URL_MISMATCH_ERR = 21;
const unsigned short QUOTA_EXCEEDED_ERR = 22;
const unsigned short TIMEOUT_ERR = 23;
const unsigned short INVALID_NODE_TYPE_ERR = 24;
const unsigned short DATA_CLONE_ERR = 25;
readonly attribute unsigned long code;
readonly attribute unsigned short code;
};

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

@ -41,7 +41,7 @@ interface nsIDOMGeoPositionOptions;
interface nsIDOMGeoPositionCallback;
interface nsIDOMGeoPositionErrorCallback;
[scriptable, function, uuid(37687DAF-B85F-4E4D-8881-85A0AD24CF78)]
[scriptable, uuid(37687DAF-B85F-4E4D-8881-85A0AD24CF78)]
interface nsIDOMGeoGeolocation : nsISupports
{
void getCurrentPosition(in nsIDOMGeoPositionCallback successCallback,

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

@ -625,7 +625,7 @@ PluginModuleChild::AnswerNP_Shutdown(NPError *rv)
{
AssertPluginThread();
#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#if defined XP_WIN
mozilla::widget::StopAudioSession();
#endif
@ -689,7 +689,7 @@ PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
const nsString& aDisplayName,
const nsString& aIconPath)
{
#if !defined XP_WIN || MOZ_WINSDK_TARGETVER < MOZ_NTDDI_LONGHORN
#if !defined XP_WIN
NS_RUNTIMEABORT("Not Reached!");
return false;
#else

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

@ -776,7 +776,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
if (!CallNP_Initialize(error))
return NS_ERROR_FAILURE;
#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#if defined XP_WIN
// Send the info needed to join the chrome process's audio session to the
// plugin process
nsID id;

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

@ -73,7 +73,7 @@ function handleCmd(evt) {
} else {
win.childWin.document.write('<script>window.parent.opener.postMessage(window.parent.testNum + " - " + window.x, "http://mochi.test:8888/"); window.parent.close();<' + '/script>');
}
} catch (e if (e.name == "NS_ERROR_DOM_SECURITY_ERR" && e.code == 1000)) {
} catch (e if (e.name == "SecurityError" && e.code == 18)) {
// Security error on cross-site write() is fine
if (win.childWin.opener == win) {
win.childWin.close();

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

@ -18,7 +18,7 @@ try {
ok(false, "Setting localStorageItem should throw a security exception");
}
catch(ex) {
is(ex.name, "NS_ERROR_DOM_SECURITY_ERR");
is(ex.name, "SecurityError");
}
try {
@ -34,7 +34,7 @@ try {
ok(false, "Setting localStorageItem should throw a security exception");
}
catch(ex) {
is(ex.name, "NS_ERROR_DOM_SECURITY_ERR");
is(ex.name, "SecurityError");
}
try {

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

@ -40,7 +40,7 @@ function startTest()
is(window.localStorage, null, "Storage is null");
checkException(function() {storage.setItem("test", "value");}, "NS_ERROR_DOM_SECURITY_ERR");
checkException(function() {storage.setItem("test", "value");}, "SecurityError");
setDOMStorageEnabled(true);

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

@ -71,8 +71,7 @@ PathBuilderCG::BezierTo(const Point &aCP1,
if (CGPathIsEmpty(mCGPath))
MoveTo(aCP1);
else
CGPathAddCurveToPoint(mCGPath, NULL,
CGPathAddCurveToPoint(mCGPath, NULL,
aCP1.x, aCP1.y,
aCP2.x, aCP2.y,
aCP3.x, aCP3.y);
@ -85,8 +84,7 @@ PathBuilderCG::QuadraticBezierTo(const Point &aCP1,
{
if (CGPathIsEmpty(mCGPath))
MoveTo(aCP1);
else
CGPathAddQuadCurveToPoint(mCGPath, NULL,
CGPathAddQuadCurveToPoint(mCGPath, NULL,
aCP1.x, aCP1.y,
aCP2.x, aCP2.y);
}

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

@ -109,15 +109,15 @@ _hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs,
* (as recommended by http://forum.fontlab.com/archive-old-microsoft-volt-group/vista-and-diacritic-ordering-t6751.0.html)
*/
static const int permuted_hebrew_classes[25 - 10 + 1] = {
/* 10 sheva */ 15,
/* 11 hataf segol */ 16,
/* 12 hataf patah */ 17,
/* 13 hataf qamats */ 18,
/* 14 hiriq */ 19,
/* 15 tsere */ 20,
/* 16 segol */ 21,
/* 17 patah */ 22,
/* 18 qamats */ 23,
/* 10 sheva */ 22,
/* 11 hataf segol */ 15,
/* 12 hataf patah */ 16,
/* 13 hataf qamats */ 17,
/* 14 hiriq */ 23,
/* 15 tsere */ 18,
/* 16 segol */ 19,
/* 17 patah */ 20,
/* 18 qamats */ 21,
/* 19 holam */ 14,
/* 20 qubuts */ 24,
/* 21 dagesh */ 12,

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

@ -323,6 +323,21 @@ bool GetLight(LightType light, hal::LightConfiguration* aConfig)
RETURN_PROXY_IF_SANDBOXED(GetLight(light, aConfig));
}
void
AdjustSystemClock(int32_t aDeltaMilliseconds)
{
AssertMainThread();
PROXY_IF_SANDBOXED(AdjustSystemClock(aDeltaMilliseconds));
}
void
SetTimezone(const nsCString& aTimezoneSpec)
{
AssertMainThread();
PROXY_IF_SANDBOXED(SetTimezone(aTimezoneSpec));
}
void
EnableSensorNotifications(SensorType aSensor) {
AssertMainThread();

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

@ -217,6 +217,19 @@ void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
*/
void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
/**
* Adjusting system clock.
* @param aDeltaMilliseconds The difference compared with current system clock.
*/
void AdjustSystemClock(int32_t aDeltaMilliseconds);
/**
* Set timezone
* @param aTimezoneSpec The definition can be found in
* http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
*/
void SetTimezone(const nsCString& aTimezoneSpec);
/**
* Reboot the device.
*/

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

@ -105,7 +105,7 @@ CPPSRCS += \
endif
ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) #{
CPPSRCS += FallbackLights.cpp
CPPSRCS += FallbackLights.cpp FallbackTime.cpp
endif #}
include $(topsrcdir)/config/config.mk

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

@ -0,0 +1,22 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Hal.h"
namespace mozilla {
namespace hal_impl {
void
AdjustSystemClock(int32_t aDeltaMilliseconds)
{}
void
SetTimezone(const nsCString& aTimezoneSpec)
{}
} // namespace hal_impl
} // namespace mozilla

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

@ -26,7 +26,16 @@
#include <math.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/syscall.h>
#include <cutils/properties.h>
#include "mozilla/dom/network/Constants.h"
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define NsecPerMsec 1000000
#define NsecPerSec 1000000000
using mozilla::hal::WindowIdentifier;
@ -510,6 +519,52 @@ GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
return true;
}
/**
* clock_settime() is not exposed through bionic.
* we define the new function to set system time.
* The result is the same as using clock_settime() system call.
*/
static int
sys_clock_settime(clockid_t clk_id, const struct timespec *tp)
{
return syscall(__NR_clock_settime, clk_id, tp);
}
void
AdjustSystemClock(int32_t aDeltaMilliseconds)
{
struct timespec now;
// Preventing context switch before setting system clock
sched_yield();
clock_gettime(CLOCK_REALTIME, &now);
now.tv_sec += aDeltaMilliseconds/1000;
now.tv_nsec += (aDeltaMilliseconds%1000)*NsecPerMsec;
if (now.tv_nsec >= NsecPerSec)
{
now.tv_sec += 1;
now.tv_nsec -= NsecPerSec;
}
if (now.tv_nsec < 0)
{
now.tv_nsec += NsecPerSec;
now.tv_sec -= 1;
}
// we need to have root privilege.
sys_clock_settime(CLOCK_REALTIME, &now);
}
void
SetTimezone(const nsCString& aTimezoneSpec)
{
property_set("persist.sys.timezone", aTimezoneSpec.get());
// this function is automatically called by the other time conversion
// functions that depend on the timezone. To be safe, we call it manually.
tzset();
}
void
EnableNetworkNotifications()
{}

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

@ -109,6 +109,9 @@ parent:
sync GetScreenBrightness() returns (double brightness);
SetScreenBrightness(double brightness);
AdjustSystemClock(int32 aDeltaMilliseconds);
SetTimezone(nsCString aTimezoneSpec);
sync SetLight(LightType light, LightConfiguration aConfig)
returns (bool status);

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

@ -135,6 +135,18 @@ GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
return status;
}
void
AdjustSystemClock(int32_t aDeltaMilliseconds)
{
Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
}
void
SetTimezone(const nsCString& aTimezoneSpec)
{
Hal()->SendSetTimezone(nsCString(aTimezoneSpec));
}
void
Reboot()
{
@ -288,6 +300,20 @@ public:
return true;
}
NS_OVERRIDE virtual bool
RecvAdjustSystemClock(const int32_t &aDeltaMilliseconds)
{
hal::AdjustSystemClock(aDeltaMilliseconds);
return true;
}
NS_OVERRIDE virtual bool
RecvSetTimezone(const nsCString& aTimezoneSpec)
{
hal::SetTimezone(aTimezoneSpec);
return true;
}
NS_OVERRIDE virtual bool
RecvReboot()
{

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

@ -50,7 +50,6 @@ namespace hal_impl {
static nsCOMPtr<nsITimer> sUpdateTimer;
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
/* Power Event API is Vista or later */
typedef HPOWERNOTIFY (WINAPI *REGISTERPOWERSETTINGNOTIFICATION) (HANDLE, LPCGUID, DWORD);
typedef BOOL (WINAPI *UNREGISTERPOWERSETTINGNOTIFICATION) (HPOWERNOTIFY);
@ -59,8 +58,6 @@ static UNREGISTERPOWERSETTINGNOTIFICATION sUnregisterPowerSettingNotification =
static HPOWERNOTIFY sPowerHandle = nsnull;
static HPOWERNOTIFY sCapacityHandle = nsnull;
static HWND sHWnd = nsnull;
#endif
static bool
IsVistaOrLater()
@ -91,7 +88,6 @@ UpdateHandler(nsITimer* aTimer, void* aClosure) {
}
}
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
static
LRESULT CALLBACK
BatteryWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
@ -107,12 +103,10 @@ BatteryWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
hal::NotifyBatteryChange(currentInfo);
return TRUE;
}
#endif
void
EnableBatteryNotifications()
{
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (IsVistaOrLater()) {
// RegisterPowerSettingNotification is from Vista or later.
// Use this API if available.
@ -163,7 +157,6 @@ EnableBatteryNotifications()
&GUID_BATTERY_PERCENTAGE_REMAINING,
DEVICE_NOTIFY_WINDOW_HANDLE);
} else
#endif
{
// for Windows 2000 and Windwos XP. If we remove Windows XP support,
// we should remove timer-based power notification
@ -181,7 +174,6 @@ EnableBatteryNotifications()
void
DisableBatteryNotifications()
{
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (IsVistaOrLater()) {
if (sPowerHandle) {
sUnregisterPowerSettingNotification(sPowerHandle);
@ -198,7 +190,6 @@ DisableBatteryNotifications()
sHWnd = nsnull;
}
} else
#endif
{
if (sUpdateTimer) {
sUpdateTimer->Cancel();

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

@ -60,12 +60,10 @@
#include "nsCExternalHandlerService.h"
#include "nsDirectoryServiceDefs.h"
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0600
#endif
// we need windows.h to read out registry information...
#include <windows.h>
@ -93,7 +91,6 @@ struct ICONENTRY {
PRUint32 ieFileOffset;
};
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
typedef HRESULT (WINAPI*SHGetStockIconInfoPtr) (SHSTOCKICONID siid, UINT uFlags, SHSTOCKICONINFO *psii);
// Match stock icons with names
@ -105,7 +102,6 @@ static SHSTOCKICONID GetStockIconIDForName(const nsACString &aStockName)
return SIID_INVALID;
}
#endif
// nsIconChannel methods
nsIconChannel::nsIconChannel()
@ -383,7 +379,6 @@ nsresult nsIconChannel::GetHIconFromFile(HICON *hIcon)
return rv;
}
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon)
{
nsresult rv = NS_OK;
@ -426,7 +421,6 @@ nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon)
return rv;
}
#endif
// Given a BITMAPINFOHEADER, returns the size of the color table.
static int GetColorTableSize(BITMAPINFOHEADER* aHeader)
@ -500,7 +494,6 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki
// GetDIBits does not exist on windows mobile.
HICON hIcon = NULL;
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
nsCOMPtr<nsIMozIconURI> iconURI(do_QueryInterface(mUrl, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -509,7 +502,6 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki
if (!stockIcon.IsEmpty())
rv = GetStockHIcon(iconURI, &hIcon);
else
#endif
rv = GetHIconFromFile(&hIcon);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -87,10 +87,8 @@ protected:
nsresult MakeInputStream(nsIInputStream** _retval, bool nonBlocking);
// Functions specific to Vista and above
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
protected:
nsresult GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon);
#endif
};
#endif /* nsIconChannel_h___ */

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

@ -935,8 +935,6 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
;;
esac

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

@ -0,0 +1,23 @@
function TestCase(n, d, e, a) {}
var lfcode = new Array();
lfcode.push("");
lfcode.push("\
var summary = 'foo';\
test();\
function test() {\
test(\"TEST-UNEXPECTED-FAIL | TestPerf | \" + summary);\
}\
");
lfcode.push("gczeal(2);");
lfcode.push("\
new TestCase(TestFunction_3( \"P\", \"A\", \"S\", \"S\" ) +\"\");\
new TestCase(TestFunction_4( \"F\", \"A\", (\"length\"), \"L\" ) +\"\");\
function TestFunction_3( a, b, c, d, e ) {\
TestFunction_3(arguments);\
}\
");
while (true) {
var file = lfcode.shift(); if (file == undefined) { break; }
try { evaluate(file); } catch (lfVare) {}
}

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

@ -197,6 +197,8 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
bool heavyweight = script->function() && script->function()->isHeavyweight();
isCompileable = true;
isInlineable = true;
if (script->nClosedArgs || script->nClosedVars || heavyweight ||
script->usesEval || script->usesArguments || cx->compartment->debugMode()) {
@ -330,13 +332,14 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
isInlineable = false;
break;
case JSOP_QNAMEPART:
case JSOP_QNAMECONST:
isCompileable = false;
case JSOP_NAME:
case JSOP_CALLNAME:
case JSOP_BINDNAME:
case JSOP_SETNAME:
case JSOP_DELNAME:
case JSOP_QNAMEPART:
case JSOP_QNAMECONST:
checkAliasedName(cx, pc);
usesScopeChain_ = true;
isInlineable = false;
@ -358,7 +361,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
case JSOP_ENTERWITH:
addsScopeObjects_ = true;
isInlineable = canTrackVars = false;
isCompileable = isInlineable = canTrackVars = false;
break;
case JSOP_ENTERLET0:
@ -483,7 +486,8 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
case JSOP_DECLOCAL:
case JSOP_LOCALINC:
case JSOP_LOCALDEC:
case JSOP_SETLOCAL: {
case JSOP_SETLOCAL:
case JSOP_SETLOCALPOP: {
uint32_t local = GET_SLOTNO(pc);
if (local >= script->nfixed) {
localsAliasStack_ = true;
@ -517,7 +521,105 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
isInlineable = false;
break;
/* Additional opcodes which can be both compiled both normally and inline. */
case JSOP_NOP:
case JSOP_UNDEFINED:
case JSOP_GOTO:
case JSOP_DEFAULT:
case JSOP_IFEQ:
case JSOP_IFNE:
case JSOP_ITERNEXT:
case JSOP_DUP:
case JSOP_DUP2:
case JSOP_SWAP:
case JSOP_PICK:
case JSOP_BITOR:
case JSOP_BITXOR:
case JSOP_BITAND:
case JSOP_LT:
case JSOP_LE:
case JSOP_GT:
case JSOP_GE:
case JSOP_EQ:
case JSOP_NE:
case JSOP_LSH:
case JSOP_RSH:
case JSOP_URSH:
case JSOP_ADD:
case JSOP_SUB:
case JSOP_MUL:
case JSOP_DIV:
case JSOP_MOD:
case JSOP_NOT:
case JSOP_BITNOT:
case JSOP_NEG:
case JSOP_POS:
case JSOP_DELPROP:
case JSOP_DELELEM:
case JSOP_TYPEOF:
case JSOP_TYPEOFEXPR:
case JSOP_VOID:
case JSOP_GETPROP:
case JSOP_CALLPROP:
case JSOP_LENGTH:
case JSOP_GETELEM:
case JSOP_CALLELEM:
case JSOP_TOID:
case JSOP_SETELEM:
case JSOP_IMPLICITTHIS:
case JSOP_DOUBLE:
case JSOP_STRING:
case JSOP_ZERO:
case JSOP_ONE:
case JSOP_NULL:
case JSOP_FALSE:
case JSOP_TRUE:
case JSOP_OR:
case JSOP_AND:
case JSOP_CASE:
case JSOP_STRICTEQ:
case JSOP_STRICTNE:
case JSOP_ITER:
case JSOP_MOREITER:
case JSOP_ENDITER:
case JSOP_POP:
case JSOP_GETARG:
case JSOP_CALLARG:
case JSOP_BINDGNAME:
case JSOP_UINT16:
case JSOP_NEWINIT:
case JSOP_NEWARRAY:
case JSOP_NEWOBJECT:
case JSOP_ENDINIT:
case JSOP_INITMETHOD:
case JSOP_INITPROP:
case JSOP_INITELEM:
case JSOP_SETPROP:
case JSOP_SETMETHOD:
case JSOP_IN:
case JSOP_INSTANCEOF:
case JSOP_LINENO:
case JSOP_ENUMELEM:
case JSOP_CONDSWITCH:
case JSOP_LABEL:
case JSOP_RETRVAL:
case JSOP_GETGNAME:
case JSOP_CALLGNAME:
case JSOP_SETGNAME:
case JSOP_REGEXP:
case JSOP_OBJECT:
case JSOP_UINT24:
case JSOP_GETXPROP:
case JSOP_INT8:
case JSOP_INT32:
case JSOP_HOLE:
case JSOP_LOOPHEAD:
case JSOP_LOOPENTRY:
break;
default:
if (!(js_CodeSpec[op].format & JOF_DECOMPOSE))
isCompileable = isInlineable = false;
break;
}

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

@ -871,6 +871,7 @@ class ScriptAnalysis
bool addsScopeObjects_:1;
bool localsAliasStack_:1;
bool isInlineable:1;
bool isCompileable:1;
bool canTrackVars:1;
uint32_t numReturnSites_;
@ -905,6 +906,7 @@ class ScriptAnalysis
bool OOM() { return outOfMemory; }
bool failed() { return hadFailure; }
bool inlineable(uint32_t argc) { return isInlineable && argc == script->function()->nargs; }
bool compileable() { return isCompileable; }
/* Whether there are POPV/SETRVAL bytecodes which can write to the frame's rval. */
bool usesReturnValue() const { return usesReturnValue_; }

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

@ -3324,6 +3324,9 @@ ScriptAnalysis::resolveNameAccess(JSContext *cx, jsid id, bool addDependency)
return access;
}
if (!script->isOuterFunction)
return access;
access.script = script;
access.nesting = script->nesting();
access.slot = (kind == ARGUMENT) ? ArgSlot(index) : LocalSlot(script, index);

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

@ -81,14 +81,6 @@ using namespace js::analyze;
return retval; \
JS_END_MACRO
#if defined(JS_METHODJIT_SPEW)
static const char *OpcodeNames[] = {
# define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) #name,
# include "jsopcode.tbl"
# undef OPDEF
};
#endif
/*
* Number of times a script must be called or had a backedge before we try to
* inline its calls.
@ -177,13 +169,14 @@ mjit::Compiler::checkAnalysis(JSScript *script)
return Compile_Abort;
}
if (JSOp(*script->code) == JSOP_GENERATOR) {
JaegerSpew(JSpew_Abort, "script is a generator\n");
if (!script->ensureRanAnalysis(cx, NULL))
return Compile_Error;
if (!script->analysis()->compileable()) {
JaegerSpew(JSpew_Abort, "script has uncompileable opcodes\n");
return Compile_Abort;
}
if (!script->ensureRanAnalysis(cx, NULL))
return Compile_Error;
if (cx->typeInferenceEnabled() && !script->ensureRanInference(cx))
return Compile_Error;
@ -3258,12 +3251,7 @@ mjit::Compiler::generateMethod()
END_CASE(JSOP_DEBUGGER)
default:
/* Sorry, this opcode isn't implemented yet. */
#ifdef JS_METHODJIT_SPEW
JaegerSpew(JSpew_Abort, "opcode %s not handled yet (%s line %d)\n", OpcodeNames[op],
script->filename, js_PCToLineNumber(cx, script, PC));
#endif
return Compile_Abort;
JS_NOT_REACHED("Opcode not implemented");
}
/**********************

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

@ -1363,9 +1363,10 @@ stubs::FlatLambda(VMFrame &f, JSFunction *fun)
void JS_FASTCALL
stubs::Arguments(VMFrame &f)
{
f.regs.sp++;
if (!js_GetArgsValue(f.cx, f.fp(), &f.regs.sp[-1]))
Value argsobj;
if (!js_GetArgsValue(f.cx, f.fp(), &argsobj))
THROW();
f.regs.sp[0] = argsobj;
}
JSBool JS_FASTCALL

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

@ -77,7 +77,6 @@ PARALLEL_DIRS += \
$(NULL)
TOOL_DIRS += tools/reftest reftests/fonts reftests/fonts/mplus
DIRS += tools/pageloader
ifdef MOZ_DEBUG
DIRS += tools/layout-debug

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

@ -429,7 +429,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
nsSize scrollPortSize = nsSize(NS_MAX(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
NS_MAX(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
if (!aForce) {
nsRect scrolledRect =
mInner.GetScrolledRectInternal(aState->mContentsOverflowAreas.ScrollableOverflow(),
@ -442,8 +442,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
aState->mStyles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
scrolledRect.XMost() >= scrollPortSize.width + oneDevPixel ||
scrolledRect.x <= -oneDevPixel;
if (aState->mInsideBorderSize.height < hScrollbarMinSize.height ||
scrollPortSize.width < hScrollbarMinSize.width)
if (scrollPortSize.width < hScrollbarMinSize.width)
wantHScrollbar = false;
if (wantHScrollbar != aAssumeHScroll)
return false;
@ -455,8 +454,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
aState->mStyles.mVertical == NS_STYLE_OVERFLOW_SCROLL ||
scrolledRect.YMost() >= scrollPortSize.height + oneDevPixel ||
scrolledRect.y <= -oneDevPixel;
if (aState->mInsideBorderSize.width < vScrollbarMinSize.width ||
scrollPortSize.height < vScrollbarMinSize.height)
if (scrollPortSize.height < vScrollbarMinSize.height)
wantVScrollbar = false;
if (wantVScrollbar != aAssumeVScroll)
return false;

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

@ -12,7 +12,7 @@ height:100px;
border:none;
background:#00ff00;
-moz-appearance: none;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
div {
position:absolute;

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

@ -12,7 +12,7 @@ border:none;
text-align: left;
font: 12px serif;
-moz-appearance: none;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
button span {
display:block;

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

@ -1,6 +1,6 @@
<html>
<body>
<div style="background: blue; height: 100px; border-radius: 0 0 0 0; -moz-border-radius: 0 0 0 0;">
<div style="background: blue; height: 100px; border-radius: 0 0 0 0; border-radius: 0 0 0 0;">
<div style="background: purple; height: 50px;"></div>
</div>
</body>

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

@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Bugs with -moz-transform: rotate() and -moz-box-shadow</title>
<title>Bugs with -moz-transform: rotate() and box-shadow</title>
<style>
body {
@ -17,7 +17,7 @@
margin: 0;
height:16px;
width: 300px;
-moz-box-shadow: 0 0 .7em black;
box-shadow: 0 0 .7em black;
border: 1px black solid;
}
.vlabel {
@ -27,7 +27,7 @@
margin: 0;
width: 16px;
height: 300px;
-moz-box-shadow: 0 0 .7em black;
box-shadow: 0 0 .7em black;
border: 1px black solid;
}
</style>
@ -36,10 +36,10 @@
<body>
<p class="label"></p>
<p class="label" style="top: 400px; -moz-box-shadow:none; outline: 3px dashed blue;"></p>
<p class="vlabel" style="-moz-box-shadow:none; outline: 3px dashed blue;"></p>
<p class="label" style="top: 400px; box-shadow:none; outline: 3px dashed blue;"></p>
<p class="vlabel" style="box-shadow:none; outline: 3px dashed blue;"></p>
<p class="vlabel" style="left:102px; "></p>
<p class="vlabel" style="top:454px; -moz-box-shadow:none; outline: 3px dashed blue; "></p>
<p class="vlabel" style="top:454px; box-shadow:none; outline: 3px dashed blue; "></p>
<p class="vlabel" style="top:454px; left:102px;"></p>
<!-- cover a few shadow corners which are a bit different -->

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

@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Bugs with -moz-transform: rotate() and -moz-box-shadow</title>
<title>Bugs with -moz-transform: rotate() and box-shadow</title>
<style>
body {
@ -18,7 +18,7 @@
height: 16px;
width: 300px;
-moz-transform: translate(96px);
-moz-box-shadow: 0 0 .7em black;
box-shadow: 0 0 .7em black;
border: 1px black solid;
}
.vlabel {
@ -28,7 +28,7 @@
margin: 0;
width: 16px;
height: 300px;
-moz-box-shadow: 0 0 .7em black;
box-shadow: 0 0 .7em black;
border: 1px black solid;
}
</style>
@ -37,10 +37,10 @@
<body>
<p class="label"></p>
<p class="label" style="top: 400px; -moz-box-shadow:none; outline: 3px dashed blue;"></p>
<p class="label" style="left:-100px; top: 200px; -moz-box-shadow:none; outline: 3px dashed blue; -moz-transform: rotate(90deg);"></p>
<p class="label" style="top: 400px; box-shadow:none; outline: 3px dashed blue;"></p>
<p class="label" style="left:-100px; top: 200px; box-shadow:none; outline: 3px dashed blue; -moz-transform: rotate(90deg);"></p>
<p class="label" style="left:-40px; top: 200px; -moz-transform: rotate(90deg);"></p>
<p class="label" style="left:-100px; top: 200px; -moz-box-shadow:none; outline: 3px dashed blue; -moz-transform: translate(0,396px) rotate(90deg);"></p>
<p class="label" style="left:-100px; top: 200px; box-shadow:none; outline: 3px dashed blue; -moz-transform: translate(0,396px) rotate(90deg);"></p>
<p class="label" style="left:-40px; top: 200px; -moz-transform: translate(0,396px) rotate(90deg);"></p>
<!-- cover a few shadow corners which are a bit different -->

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html><head>
<title>Testcase for bug 726258</title>
<style>
html,body{ overflow:hidden; margin:0; padding:0; }
p { overflow: auto; white-space: nowrap; font-size: 13px; padding-top:100px; margin-top:-100px; }
</style>
</head>
<p>
1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890
</p>

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html><head>
<title>Testcase for bug 726258</title>
<style>
html,body{ overflow:hidden; margin:0; padding:0; }
p { overflow: auto; white-space: nowrap; font-size: 13px; margin-top:0; }
</style>
</head>
<p>
1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890
</p>

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

@ -12,3 +12,4 @@ HTTP == transformed-1.html transformed-1.html?ref
HTTP == transformed-1.html?up transformed-1.html?ref
== uncovering-1.html uncovering-1-ref.html
== uncovering-2.html uncovering-2-ref.html
== less-than-scrollbar-height.html less-than-scrollbar-height-ref.html

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

@ -122,7 +122,7 @@ fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296
== anim-polyline-points-01.svg anim-polyline-points-01-ref.svg
# animate path data:
== anim-path-d-01.svg anim-path-d-01-ref.svg
fuzzy-if(/^Windows\x20NT\x205\.1/.test(http.oscpu),2,1) == anim-path-d-01.svg anim-path-d-01-ref.svg # Bug 726400
# animate some enumeration attributes:
== anim-feComposite-operator-01.svg lime.svg

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

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body style="-moz-transition-duration: 1ms"></body>
<script>
var body = document.body;
/* flush */ getComputedStyle(body, "").background;
body.style.background = 'url(none.png), repeat';
/* flush */ getComputedStyle(body, "").background;
</script>
</html>

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

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body style="background-size: cover; -moz-transition-duration: 1ms"></body>
<script>
var body = document.body;
/* flush */ getComputedStyle(body, "").backgroundSize;
body.style.backgroundSize = 'contain';
/* flush */ getComputedStyle(body, "").backgroundSize;
</script>
</html>

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

@ -75,3 +75,5 @@ asserts(2) load 671799-2.html
load 690990-1.html
load 696188-1.html
load 700116.html
load 729126-1.html
load 729126-2.html

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

@ -317,21 +317,17 @@ nsCSSProps::ReleaseTable(void)
}
}
#if 0 /* aliases code */
struct CSSPropertyAlias {
char name[sizeof("-moz-border-radius-bottomright")];
char name[sizeof("-moz-...")];
nsCSSProperty id;
};
static const CSSPropertyAlias gAliases[] = {
{ "-moz-border-radius", eCSSProperty_border_radius },
{ "-moz-border-radius-bottomleft", eCSSProperty_border_bottom_left_radius },
{ "-moz-border-radius-bottomright", eCSSProperty_border_bottom_right_radius },
{ "-moz-border-radius-topleft", eCSSProperty_border_top_left_radius },
{ "-moz-border-radius-topright", eCSSProperty_border_top_right_radius },
{ "-moz-box-shadow", eCSSProperty_box_shadow },
// Don't forget to update the sizeof in CSSPropertyAlias above with the
// longest string when you add stuff here.
};
#endif
nsCSSProperty
nsCSSProps::LookupProperty(const nsACString& aProperty)
@ -339,6 +335,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty)
NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref");
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
#if 0 /* aliases code */
if (res == eCSSProperty_UNKNOWN) {
for (const CSSPropertyAlias *alias = gAliases,
*alias_end = ArrayEnd(gAliases);
@ -349,6 +346,7 @@ nsCSSProps::LookupProperty(const nsACString& aProperty)
}
}
}
#endif
return res;
}
@ -360,6 +358,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty)
// converting and avoid a PromiseFlatCString() call.
NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref");
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
#if 0 /* aliases code */
if (res == eCSSProperty_UNKNOWN) {
for (const CSSPropertyAlias *alias = gAliases,
*alias_end = ArrayEnd(gAliases);
@ -370,6 +369,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty)
}
}
}
#endif
return res;
}

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

@ -880,12 +880,6 @@ AddCSSValuePixelPercentCalc(const PRUint32 aValueRestrictions,
aResult);
break;
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(32,
"unexpected unit %d, from %d and %d",
aCommonUnit,
aValue1.GetUnit(),
aValue2.GetUnit()).get());
return false;
}
@ -1822,6 +1816,7 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
aCoeff1, pair1->*member,
aCoeff2, pair2->*member,
result->*member) ) {
NS_ABORT_IF_FALSE(false, "unexpected unit");
return false;
}
}
@ -1864,6 +1859,7 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
aCoeff1, &triplet1->*member,
aCoeff2, &triplet2->*member,
result->*member) ) {
NS_ABORT_IF_FALSE(false, "unexpected unit");
return false;
}
}

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

@ -1,52 +0,0 @@
# vim: set shiftwidth=8 tabstop=8 autoindent noexpandtab copyindent:
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla's pageloader test
#
# The Initial Developer of the Original Code is the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Vladimir Vukicevic <vladimir@pobox.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout
EXTRA_COMPONENTS= \
tp-cmdline.js \
tp-cmdline.manifest \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,81 +0,0 @@
Pageload Test Component
=======================
Usage:
./firefox -tp file:///path/to/manifest.txt [-tpargs...]
See ./firefox -help for other arguments.
Manifest file format
====================
Comments in the manifest file start with a #. Each line may be:
* a URL (absolute or relative to the manifest)
This URL is added to the list of tests.
* one or more flags, followed by whitespace, followed by a URL
The only flag supported currently is '%', which indicates that
a test will do its own timing. (See Self-timing Tests below.)
* "include" followed by whitespace, followed by a URL
Parse the given manifest file.
Self-timing Tests
=================
Most timing tests are interested in timing how long it takes the page
to load; that is, from the start of page loading until the 'load'
event is dispatched. By default, this is what the pageloader will
time. However, if a test URL has the % flag, the test is expected to
report its own timing. For this purpose, the pageloader will provide
a function named "tpRecordTime" in the test's global object that it
should call once it has performed whatever timing it wants to do.
The given value will be used as the timing result for this test.
Output format
=============
The result is a dump to stdout via dump() --
browser.dom.window.dump.enabled must be set to true in the profile. A
number of output formats can be specified via the -tpformat command
line option, currently 'js', 'text', and 'tinderbox' are supported.
Sample 'js' format output:
([({page:"1280x1024-PNG/index.html", value:133, stddev:20.049937655763422}),({page:"bugzilla.mozilla.org/index.html", value:233, stddev:36.66606060105176}),({page:"espn.go.com/index.html", value:117.6, stddev:1.2}),({page:"home.netscape.com/index.html", value:97.8, stddev:47.41898354035017}),])
Sample 'text' format output:
============================================================
Page mean stdd min max raw
0 1280x1024-PNG/index.html 133 20 121 297 297,173,122,121,124,125
1 bugzilla.mozilla.org/index.html 233 37 192 395 395,273,223,192,198,279
2 espn.go.com/index.html 118 1 116 254 254,117,116,119,119,117
3 home.netscape.com/index.html 98 47 3 124 3,121,120,124,124,121
============================================================
Sample 'tinderbox' format output:
__start_tp_report
_x_x_mozilla_page_load,778.5,NaN,NaN
_x_x_mozilla_page_load_details,avgmedian|778.5|average|766.75|minimum|NaN|maximum|NaN|stddev|NaN|0;file:///c:/proj/mozilla-cvs/perf/tp2/base/www.cnn.com/index.html;778.5;766.75;722;1027;1027;788;777;722;780|...
__end_tp_report
Note that the minimum, maximum, stddev are not calculated; they're
always reported as NaN. (They were the minimum and maximum values of
any sampled value, and the standard deviation across all sampled
values -- not very useful.)
TODO
====
* Command line option to choose whether to run with or without browser chrome. Currently runs without.
* Tinderbox-dropping style output
* better yet would be to teach tinderbox about JSON

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

@ -1,6 +0,0 @@
pageloader.jar:
% content pageloader %content/
* content/quit.js (quit.js)
* content/pageloader.js (pageloader.js)
content/pageloader.xul (pageloader.xul)
* content/report.js (report.js)

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

@ -1,441 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is tp.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Helmer <rhelmer@mozilla.com>
* Vladimir Vukicevic <vladimir@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cc = Components.classes;
const Ci = Components.interfaces;
var NUM_CYCLES = 5;
var pageFilterRegexp = null;
var reportFormat = "js";
var useBrowser = true;
var winWidth = 1024;
var winHeight = 768;
var doRenderTest = false;
var pages;
var pageIndex;
var start_time;
var cycle;
var report;
var renderReport;
var noisy = false;
var timeout = -1;
var timeoutEvent = -1;
var running = false;
var forceCC = true;
var content;
var TEST_DOES_OWN_TIMING = 1;
var browserWindow = null;
// the io service
var gIOS = null;
function plInit() {
if (running) {
return;
}
running = true;
cycle = 0;
try {
var args = window.arguments[0].wrappedJSObject;
var manifestURI = args.manifest;
var startIndex = 0;
var endIndex = -1;
if (args.startIndex) startIndex = parseInt(args.startIndex);
if (args.endIndex) endIndex = parseInt(args.endIndex);
if (args.numCycles) NUM_CYCLES = parseInt(args.numCycles);
if (args.format) reportFormat = args.format;
if (args.width) winWidth = parseInt(args.width);
if (args.height) winHeight = parseInt(args.height);
if (args.filter) pageFilterRegexp = new RegExp(args.filter);
if (args.noisy) noisy = true;
if (args.timeout) timeout = parseInt(args.timeout);
forceCC = !args.noForceCC;
doRenderTest = args.doRender;
if (forceCC &&
!window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect) {
forceCC = false;
}
gIOS = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
if (args.offline)
gIOS.offline = true;
var fileURI = gIOS.newURI(manifestURI, null, null);
pages = plLoadURLsFromURI(fileURI);
if (!pages) {
dumpLine('tp: could not load URLs, quitting');
plStop(true);
}
if (pages.length == 0) {
dumpLine('tp: no pages to test, quitting');
plStop(true);
}
if (startIndex < 0)
startIndex = 0;
if (endIndex == -1 || endIndex >= pages.length)
endIndex = pages.length-1;
if (startIndex > endIndex) {
dumpLine("tp: error: startIndex >= endIndex");
plStop(true);
}
pages = pages.slice(startIndex,endIndex+1);
var pageUrls = pages.map(function(p) { return p.url.spec.toString(); });
report = new Report(pageUrls);
if (doRenderTest)
renderReport = new Report(pageUrls);
pageIndex = 0;
if (args.useBrowserChrome) {
var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
var blank = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
blank.data = "about:blank";
browserWindow = wwatch.openWindow
(null, "chrome://browser/content/", "_blank",
"chrome,dialog=no,width=" + winWidth + ",height=" + winHeight, blank);
// get our window out of the way
window.resizeTo(10,10);
var browserLoadFunc = function (ev) {
browserWindow.removeEventListener('load', browserLoadFunc, true);
// do this half a second after load, because we need to be
// able to resize the window and not have it get clobbered
// by the persisted values
setTimeout(function () {
browserWindow.resizeTo(winWidth, winHeight);
browserWindow.moveTo(0, 0);
browserWindow.focus();
content = browserWindow.getBrowser();
setTimeout(plLoadPage, 100);
}, 500);
};
browserWindow.addEventListener('load', browserLoadFunc, true);
} else {
window.resizeTo(winWidth, winHeight);
content = document.getElementById('contentPageloader');
setTimeout(plLoadPage, 250);
}
} catch(e) {
dumpLine(e);
plStop(true);
}
}
function plPageFlags() {
return pages[pageIndex].flags;
}
// load the current page, start timing
var removeLastAddedListener = null;
function plLoadPage() {
var pageName = pages[pageIndex].url.spec;
if (removeLastAddedListener)
removeLastAddedListener();
if (plPageFlags() & TEST_DOES_OWN_TIMING) {
// if the page does its own timing, use a capturing handler
// to make sure that we can set up the function for content to call
content.addEventListener('load', plLoadHandlerCapturing, true);
removeLastAddedListener = function() {
content.removeEventListener('load', plLoadHandlerCapturing, true);
};
} else {
// if the page doesn't do its own timing, use a bubbling handler
// to make sure that we're called after the page's own onload() handling
// XXX we use a capturing event here too -- load events don't bubble up
// to the <browser> element. See bug 390263.
content.addEventListener('load', plLoadHandler, true);
removeLastAddedListener = function() {
content.removeEventListener('load', plLoadHandler, true);
};
}
if (timeout > 0) {
timeoutEvent = setTimeout('loadFail()', timeout);
}
start_time = Date.now();
content.loadURI(pageName);
}
function loadFail() {
var pageName = pages[pageIndex].url.spec;
dumpLine("__FAILTimeout exceeded on " + pageName + "__FAIL")
plStop(true);
}
function plNextPage() {
if (pageIndex < pages.length-1) {
pageIndex++;
if (forceCC) {
var tccstart = new Date();
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect();
var tccend = new Date();
report.recordCCTime(tccend - tccstart);
}
setTimeout(plLoadPage, 250);
} else {
plStop(false);
}
}
function plRecordTime(time) {
var pageName = pages[pageIndex].url.spec;
var i = pageIndex
if (i < pages.length-1) {
i++;
} else {
i = 0;
}
var nextName = pages[i].url.spec;
report.recordTime(pageIndex, time);
if (noisy) {
dumpLine("Cycle " + (cycle+1) + ": loaded " + pageName + " (next: " + nextName + ")");
}
}
function plLoadHandlerCapturing(evt) {
// make sure we pick up the right load event
if (evt.type != 'load' ||
evt.originalTarget.defaultView.frameElement)
return;
if (timeout > 0) {
clearTimeout(timeoutEvent);
}
if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
dumpLine("tp: Capturing onload handler used with page that doesn't do its own timing?");
plStop(true);
}
// set up the function for content to call
content.contentWindow.wrappedJSObject.tpRecordTime = function (time) {
plRecordTime(time);
setTimeout(plNextPage, 250);
};
}
// the onload handler
function plLoadHandler(evt) {
// make sure we pick up the right load event
if (evt.type != 'load' ||
evt.originalTarget.defaultView.frameElement)
return;
if (timeout > 0) {
clearTimeout(timeoutEvent);
}
var end_time = Date.now();
var time = (end_time - start_time);
// does this page want to do its own timing?
// if so, we shouldn't be here
if (plPageFlags() & TEST_DOES_OWN_TIMING) {
dumpLine("tp: Bubbling onload handler used with page that does its own timing?");
plStop(true);
}
plRecordTime(time);
if (doRenderTest)
runRenderTest();
plNextPage();
}
function runRenderTest() {
const redrawsPerSample = 500;
if (!Ci.nsIDOMWindowUtils)
return;
var win;
if (browserWindow)
win = content.contentWindow;
else
win = window;
var wu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
var start = Date.now();
for (var j = 0; j < redrawsPerSample; j++)
wu.redraw();
var end = Date.now();
renderReport.recordTime(pageIndex, end - start);
}
function plStop(force) {
try {
if (force == false) {
pageIndex = 0;
if (cycle < NUM_CYCLES-1) {
cycle++;
setTimeout(plLoadPage, 250);
return;
}
var formats = reportFormat.split(",");
if (!renderReport) {
for each (var fmt in formats)
dumpLine(report.getReport(fmt));
}
else {
dumpLine ("*************** Render report *******************");
for each (var fmt in formats)
dumpLine(renderReport.getReport(fmt));
}
}
} catch (e) {
dumpLine(e);
}
if (content)
content.removeEventListener('load', plLoadHandler, true);
goQuitApplication();
}
/* Returns array */
function plLoadURLsFromURI(manifestUri) {
var fstream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
var uriFile = manifestUri.QueryInterface(Ci.nsIFileURL);
fstream.init(uriFile.file, -1, 0, 0);
var lstream = fstream.QueryInterface(Ci.nsILineInputStream);
var d = [];
var lineNo = 0;
var line = {value:null};
var more;
do {
lineNo++;
more = lstream.readLine(line);
var s = line.value;
// strip comments
s = s.replace(/#.*/, '');
// strip leading and trailing whitespace
s = s.replace(/^\s*/, '').replace(/s\*$/, '');
if (!s)
continue;
var flags = 0;
var urlspec = s;
// split on whitespace, and figure out if we have any flags
var items = s.split(/\s+/);
if (items[0] == "include") {
if (items.length != 2) {
dumpLine("tp: Error on line " + lineNo + " in " + manifestUri.spec + ": include must be followed by the manifest to include!");
return null;
}
var subManifest = gIOS.newURI(items[1], null, manifestUri);
if (subManifest == null) {
dumpLine("tp: invalid URI on line " + manifestUri.spec + ":" + lineNo + " : '" + line.value + "'");
return null;
}
var subItems = plLoadURLsFromURI(subManifest);
if (subItems == null)
return null;
d = d.concat(subItems);
} else {
if (items.length == 2) {
if (items[0].indexOf("%") != -1)
flags |= TEST_DOES_OWN_TIMING;
urlspec = items[1];
} else if (items.length != 1) {
dumpLine("tp: Error on line " + lineNo + " in " + manifestUri.spec + ": whitespace must be %-escaped!");
return null;
}
var url = gIOS.newURI(urlspec, null, manifestUri);
if (pageFilterRegexp && !pageFilterRegexp.test(url.spec))
continue;
d.push({ url: url,
flags: flags });
}
} while (more);
return d;
}
function dumpLine(str) {
dump(str);
dump("\n");
}

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

@ -1,57 +0,0 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is tp.
-
- The Initial Developer of the Original Code is the Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2007
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Rob Helmer <rhelmer@mozilla.com>
- Vladimir Vukicevic <vladimir@mozilla.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="pageloader.css" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="pageloader"
screenX="0" screenY="0"
onload="plInit()">
<script type="application/javascript"
src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript" src="report.js"/>
<script type="application/javascript" src="pageloader.js"/>
<script type="application/javascript" src="quit.js"/>
<browser id="contentPageloader" src="about:blank"
type="content" flex="1"/>
</window>

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

@ -1,110 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is The Original Code is Mozilla Automated Testing Code
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Bob Clary <bob@bclary.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
From mozilla/toolkit/content
These files did not have a license
*/
function canQuitApplication()
{
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
if (!os)
{
return true;
}
try
{
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
.createInstance(Components.interfaces.nsISupportsPRBool);
os.notifyObservers(cancelQuit, "quit-application-requested", null);
// Something aborted the quit process.
if (cancelQuit.data)
{
return false;
}
}
catch (ex)
{
}
return true;
}
function goQuitApplication()
{
if (!canQuitApplication())
{
return false;
}
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
const kAppShell = '@mozilla.org/appshell/appShellService;1';
var appService;
var forceQuit;
if (kAppStartup in Components.classes)
{
appService = Components.classes[kAppStartup].
getService(Components.interfaces.nsIAppStartup);
forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
}
else if (kAppShell in Components.classes)
{
appService = Components.classes[kAppShell].
getService(Components.interfaces.nsIAppShellService);
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
}
else
{
throw 'goQuitApplication: no AppStartup/appShell';
}
try
{
appService.quit(forceQuit);
}
catch(ex)
{
throw('goQuitApplication: ' + ex);
}
return true;
}

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

@ -1,268 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is tp.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Darin Fisher <darin@meer.net>
* Rob Helmer <rhelmer@mozilla.com>
* Vladimir Vukicevic <vladimir@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Constructor
function Report(pages) {
this.pages = pages;
this.timeVals = new Array(pages.length); // matrix of times
for (var i = 0; i < this.timeVals.length; ++i) {
this.timeVals[i] = new Array();
}
this.totalCCTime = 0;
this.showTotalCCTime = false;
}
// given an array of strings, finds the longest common prefix
function findCommonPrefixLength(strs) {
if (strs.length < 2)
return 0;
var len = 0;
do {
var newlen = len + 1;
var newprefix = null;
var failed = false;
for (var i = 0; i < strs.length; i++) {
if (newlen > strs[i].length) {
failed = true;
break;
}
var s = strs[i].substr(0, newlen);
if (newprefix == null) {
newprefix = s;
} else if (newprefix != s) {
failed = true;
break;
}
}
if (failed)
break;
len++;
} while (true);
return len;
}
function compareNumbers(a, b) {
return a - b;
}
// returns an object with the following properties:
// min : min value of array elements
// max : max value of array elements
// mean : mean value of array elements
// vari : variance computation
// stdd : standard deviation, sqrt(vari)
// indexOfMax : index of max element (the element that is
// removed from the mean computation)
function getArrayStats(ary) {
var r = {};
r.min = ary[0];
r.max = ary[0];
r.indexOfMax = 0;
var sum = 0;
for (var i = 0; i < ary.length; ++i) {
if (ary[i] < r.min) {
r.min = ary[i];
} else if (ary[i] > r.max) {
r.max = ary[i];
r.indexOfMax = i;
}
sum = sum + ary[i];
}
// median
if (ary.length > 1) {
sorted_ary = ary.concat();
sorted_ary.sort(compareNumbers);
// remove longest run
sorted_ary.pop();
if (sorted_ary.length%2) {
r.median = sorted_ary[(sorted_ary.length-1)/2];
}else{
var n = Math.floor(sorted_ary.length / 2);
if (n >= sorted_ary.length)
r.median = sorted_ary[n];
else
r.median = (sorted_ary[n-1] + sorted_ary[n]) / 2;
}
}else{
r.median = ary[0];
}
// ignore max value when computing mean and stddev
if (ary.length > 1)
r.mean = (sum - r.max) / (ary.length - 1);
else
r.mean = ary[0];
r.vari = 0;
for (var i = 0; i < ary.length; ++i) {
if (i == r.indexOfMax)
continue;
var d = r.mean - ary[i];
r.vari = r.vari + d * d;
}
if (ary.length > 1) {
r.vari = r.vari / (ary.length - 1);
r.stdd = Math.sqrt(r.vari);
} else {
r.vari = 0.0;
r.stdd = 0.0;
}
return r;
}
function strPad(o, len, left) {
var str = o.toString();
if (!len)
len = 6;
if (left == null)
left = true;
if (str.length < len) {
len -= str.length;
while (--len) {
if (left)
str = " " + str;
else
str += " ";
}
}
str += " ";
return str;
}
function strPadFixed(n, len, left) {
return strPad(n.toFixed(0), len, left);
}
Report.prototype.getReport = function(format) {
// avg and avg median are cumulative for all the pages
var avgs = new Array();
var medians = new Array();
for (var i = 0; i < this.timeVals.length; ++i) {
avgs[i] = getArrayStats(this.timeVals[i]).mean;
medians[i] = getArrayStats(this.timeVals[i]).median;
}
var avg = getArrayStats(avgs).mean;
var avgmed = getArrayStats(medians).mean;
var report;
var prefixLen = findCommonPrefixLength(this.pages);
if (format == "js") {
// output "simple" js format;
// array of { page: "str", value: 123.4, stddev: 23.3 } objects
report = "([";
for (var i = 0; i < this.timeVals.length; i++) {
var stats = getArrayStats(this.timeVals[i]);
report += uneval({ page: this.pages[i].substr(prefixLen), value: stats.mean, stddev: stats.stdd});
report += ",";
}
report += "])";
} else if (format == "jsfull") {
// output "full" js format, with raw values
} else if (format == "text") {
// output text format suitable for dumping
report = "============================================================\n";
report += " " + strPad("Page", 40, false) + strPad("mean") + strPad("stdd") + strPad("min") + strPad("max") + "raw" + "\n";
for (var i = 0; i < this.timeVals.length; i++) {
var stats = getArrayStats(this.timeVals[i]);
report +=
strPad(i, 4, true) +
strPad(this.pages[i].substr(prefixLen), 40, false) +
strPadFixed(stats.mean) +
strPadFixed(stats.stdd) +
strPadFixed(stats.min) +
strPadFixed(stats.max) +
this.timeVals[i] +
"\n";
}
if (this.showTotalCCTime) {
report += "Cycle collection: " + this.totalCCTime + "\n"
}
report += "============================================================\n";
} else if (format == "tinderbox") {
report = "__start_tp_report\n";
report += "_x_x_mozilla_page_load,"+avgmed+",NaN,NaN\n"; // max and min are just 0, ignored
report += "_x_x_mozilla_page_load_details,avgmedian|"+avgmed+"|average|"+avg.toFixed(2)+"|minimum|NaN|maximum|NaN|stddev|NaN\n";
report += "|i|pagename|median|mean|min|max|runs|\n";
for (var i = 0; i < this.timeVals.length; i++) {
var r = getArrayStats(this.timeVals[i]);
report += '|'+
i + ';'+
this.pages[i].substr(prefixLen) + ';'+
r.median + ';'+
r.mean + ';'+
r.min + ';'+
r.max + ';'+
this.timeVals[i].join(";") +
"\n";
}
report += "__end_tp_report\n";
if (this.showTotalCCTime) {
report += "__start_cc_report\n";
report += "_x_x_mozilla_cycle_collect," + this.totalCCTime + "\n";
report += "__end_cc_report\n";
}
var now = (new Date()).getTime();
report += "__startTimestamp" + now + "__endTimestamp\n"; //timestamp for determning shutdown time, used by talos
} else {
report = "Unknown report format";
}
return report;
}
Report.prototype.recordTime = function(pageIndex, ms) {
this.timeVals[pageIndex].push(ms);
}
Report.prototype.recordCCTime = function(ms) {
this.totalCCTime += ms;
this.showTotalCCTime = true;
}

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

@ -1,119 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DOM Inspector.
*
* The Initial Developer of the Original Code is
* Christopher A. Aillon <christopher@aillon.com>.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Christopher A. Aillon <christopher@aillon.com>
* L. David Baron, Mozilla Corporation <dbaron@dbaron.org> (modified for reftest)
* Vladimir Vukicevic, Mozilla Corporation <dbaron@dbaron.org> (modified for tp)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// This only implements nsICommandLineHandler, since it needs
// to handle multiple arguments.
const nsISupports = Components.interfaces.nsISupports;
const nsICommandLine = Components.interfaces.nsICommandLine;
const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
const nsISupportsString = Components.interfaces.nsISupportsString;
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
function PageLoaderCmdLineHandler() {}
PageLoaderCmdLineHandler.prototype =
{
classID: Components.ID('{8AF052F5-8EFE-4359-8266-E16498A82E8B}'),
/* nsISupports */
QueryInterface : XPCOMUtils.generateQI([nsICommandLineHandler]),
/* nsICommandLineHandler */
handle : function handler_handle(cmdLine) {
var args = {};
try {
var uristr = cmdLine.handleFlagWithParam("tp", false);
if (uristr == null)
return;
try {
args.manifest = cmdLine.resolveURI(uristr).spec;
} catch (e) {
return;
}
args.numCycles = cmdLine.handleFlagWithParam("tpcycles", false);
args.startIndex = cmdLine.handleFlagWithParam("tpstart", false);
args.endIndex = cmdLine.handleFlagWithParam("tpend", false);
args.filter = cmdLine.handleFlagWithParam("tpfilter", false);
args.format = cmdLine.handleFlagWithParam("tpformat", false);
args.useBrowserChrome = cmdLine.handleFlag("tpchrome", false);
args.doRender = cmdLine.handleFlag("tprender", false);
args.width = cmdLine.handleFlagWithParam("tpwidth", false);
args.height = cmdLine.handleFlagWithParam("tpheight", false);
args.offline = cmdLine.handleFlag("tpoffline", false);
args.noisy = cmdLine.handleFlag("tpnoisy", false);
args.timeout = cmdLine.handleFlagWithParam("tptimeout", false);
args.noForceCC = cmdLine.handleFlag("tpnoforcecc", false);
}
catch (e) {
return;
}
// get our data through xpconnect
args.wrappedJSObject = args;
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher);
wwatch.openWindow(null, "chrome://pageloader/content/pageloader.xul", "_blank",
"chrome,dialog=no,all", args);
cmdLine.preventDefault = true;
},
helpInfo :
" -tp <file> Run pageload perf tests on given manifest\n" +
" -tpfilter str Only include pages from manifest that contain str (regexp)\n" +
" -tpcycles n Loop through pages n times\n" +
" -tpstart n Start at index n in the manifest\n" +
" -tpend n End with index n in the manifest\n" +
" -tpformat f1,f2,.. Report format(s) to use\n" +
" -tpchrome Test with normal browser chrome\n" +
" -tprender Run render-only benchmark for each page\n" +
" -tpwidth width Width of window\n" +
" -tpheight height Height of window\n" +
" -tpoffline Force offline mode\n" +
" -tpnoisy Dump the name of the last loaded page to console\n" +
" -tptimeout Max amount of time given for a page to load, quit if exceeded\n" +
" -tpnoforcecc Don't force cycle collection between each pageload\n"
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([PageLoaderCmdLineHandler]);

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

@ -1,3 +0,0 @@
component {8AF052F5-8EFE-4359-8266-E16498A82E8B} tp-cmdline.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=tp {8AF052F5-8EFE-4359-8266-E16498A82E8B}
category command-line-handler m-tp @mozilla.org/commandlinehandler/general-startup;1?type=tp

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

@ -103,6 +103,12 @@
</intent-filter>
</activity>
<!-- Masquerade as the Resolver so that we can be opened from the Marketplace. -->
<activity-alias
android:name="com.android.internal.app.ResolverActivity"
android:targetActivity=".App"
android:exported="true" />
<receiver android:name="NotificationHandler">
<intent-filter>
<action android:name="org.mozilla.gecko.ACTION_ALERT_CLICK" />

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

@ -89,6 +89,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
static final String CURRENT_URL_KEY = "currenturl";
static final String TYPE_KEY = "type";
static final String SEARCH_KEY = "search";
static final String USER_ENTERED_KEY = "user_entered";
static enum Type { ADD, EDIT };
private String mType;
@ -132,7 +133,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
mGoButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
openUrlAndFinish(mText.getText().toString());
openUserEnteredAndFinish(mText.getText().toString());
}
});
@ -166,7 +167,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
openUrlAndFinish(mText.getText().toString());
openUserEnteredAndFinish(mText.getText().toString());
return true;
}
@ -206,7 +207,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
if (event.getAction() != KeyEvent.ACTION_DOWN)
return true;
openUrlAndFinish(mText.getText().toString());
openUserEnteredAndFinish(mText.getText().toString());
return true;
} else {
return false;
@ -317,6 +318,13 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
}
private void openUrlAndFinish(String url) {
Intent resultIntent = new Intent();
resultIntent.putExtra(URL_KEY, url);
resultIntent.putExtra(TYPE_KEY, mType);
finishWithResult(resultIntent);
}
private void openUserEnteredAndFinish(String url) {
int index = url.indexOf(' ');
if (index != -1) {
String keywordUrl = BrowserDB.getUrlForKeyword(mResolver, url.substring(0, index));
@ -329,6 +337,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
Intent resultIntent = new Intent();
resultIntent.putExtra(URL_KEY, url);
resultIntent.putExtra(TYPE_KEY, mType);
resultIntent.putExtra(USER_ENTERED_KEY, true);
finishWithResult(resultIntent);
}

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

@ -2582,8 +2582,9 @@ abstract public class GeckoApp
String url = data.getStringExtra(AwesomeBar.URL_KEY);
AwesomeBar.Type type = AwesomeBar.Type.valueOf(data.getStringExtra(AwesomeBar.TYPE_KEY));
String searchEngine = data.getStringExtra(AwesomeBar.SEARCH_KEY);
boolean userEntered = data.getBooleanExtra(AwesomeBar.USER_ENTERED_KEY, false);
if (url != null && url.length() > 0)
loadRequest(url, type, searchEngine);
loadRequest(url, type, searchEngine, userEntered);
}
break;
case CAMERA_CAPTURE_REQUEST:
@ -2609,13 +2610,14 @@ abstract public class GeckoApp
// If searchEngine is provided, url will be used as the search query.
// Otherwise, the url is loaded.
private void loadRequest(String url, AwesomeBar.Type type, String searchEngine) {
private void loadRequest(String url, AwesomeBar.Type type, String searchEngine, boolean userEntered) {
mBrowserToolbar.setTitle(url);
Log.d(LOGTAG, type.name());
JSONObject args = new JSONObject();
try {
args.put("url", url);
args.put("engine", searchEngine);
args.put("userEntered", userEntered);
} catch (Exception e) {
Log.e(LOGTAG, "error building JSON arguments");
}
@ -2628,7 +2630,7 @@ abstract public class GeckoApp
}
public void loadUrl(String url, AwesomeBar.Type type) {
loadRequest(url, type, null);
loadRequest(url, type, null, false);
}
/**

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

@ -114,6 +114,9 @@ public class BrowserContract {
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks");
public static final Uri PARENTS_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, "parents");
// Hacky API for bulk-updating positions. Bug 728783.
public static final Uri POSITIONS_CONTENT_URI = Uri.withAppendedPath(CONTENT_URI, "positions");
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/bookmark";
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/bookmark";

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

@ -105,6 +105,7 @@ public class BrowserProvider extends ContentProvider {
static final int BOOKMARKS_ID = 101;
static final int BOOKMARKS_FOLDER_ID = 102;
static final int BOOKMARKS_PARENT = 103;
static final int BOOKMARKS_POSITIONS = 104;
// History matches
static final int HISTORY = 200;
@ -145,6 +146,7 @@ public class BrowserProvider extends ContentProvider {
URI_MATCHER.addURI(BrowserContract.AUTHORITY, "bookmarks", BOOKMARKS);
URI_MATCHER.addURI(BrowserContract.AUTHORITY, "bookmarks/#", BOOKMARKS_ID);
URI_MATCHER.addURI(BrowserContract.AUTHORITY, "bookmarks/parents", BOOKMARKS_PARENT);
URI_MATCHER.addURI(BrowserContract.AUTHORITY, "bookmarks/positions", BOOKMARKS_POSITIONS);
URI_MATCHER.addURI(BrowserContract.AUTHORITY, "bookmarks/folder/#", BOOKMARKS_FOLDER_ID);
map = BOOKMARKS_PROJECTION_MAP;
@ -1045,6 +1047,21 @@ public class BrowserProvider extends ContentProvider {
int updated = 0;
switch (match) {
// We provide a dedicated (hacky) API for callers to bulk-update the positions of
// folder children by passing an array of GUID strings as `selectionArgs`.
// Each child will have its position column set to its index in the provided array.
//
// This avoids callers having to issue a large number of UPDATE queries through
// the usual channels. See Bug 728783.
//
// Note that this is decidedly not a general-purpose API; use at your own risk.
// `values` and `selection` are ignored.
case BOOKMARKS_POSITIONS: {
debug("Update on BOOKMARKS_POSITIONS: " + uri);
updated = updateBookmarkPositions(uri, selectionArgs);
break;
}
case BOOKMARKS_PARENT: {
debug("Update on BOOKMARKS_PARENT: " + uri);
updated = updateBookmarkParents(uri, values, selection, selectionArgs);
@ -1258,6 +1275,50 @@ public class BrowserProvider extends ContentProvider {
return count;
}
/**
* Construct an update expression that will modify the positions of
* records in-place.
*
* The provided selectionArgs is expected to be an implicit mapping from
* GUID to new position.
*/
int updateBookmarkPositions(Uri uri, String[] guids) {
if (guids == null)
return 0;
int guidsCount = guids.length;
if (guidsCount == 0)
return 0;
// Each must appear twice: once in a CASE, and once in the IN clause.
String[] args = new String[guidsCount * 2];
System.arraycopy(guids, 0, args, 0, guidsCount);
System.arraycopy(guids, 0, args, guidsCount, guidsCount);
StringBuilder b = new StringBuilder("UPDATE " + TABLE_BOOKMARKS +
" SET " + Bookmarks.POSITION + " = CASE guid");
int i = 0;
for (; i < guids.length; ++i) {
if (guids[i] == null) {
// We don't want to issue the query if not every GUID is specified.
debug("updateBookmarkPositions called with null GUID at index " + i);
return 0;
}
b.append(" WHEN ? THEN " + i);
}
b.append(" END WHERE " + Bookmarks.GUID + " IN (");
i = 1;
while (i++ < guidsCount) {
b.append("?, ");
}
b.append("?)");
getWritableDatabase(uri).execSQL(b.toString(), args);
// We can't easily get a modified count without calling something like changes().
return guidsCount;
}
/**
* Construct an update expression that will modify the parents of any records
* that match.

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

@ -6,8 +6,10 @@ import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.content.Intent;
import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import java.util.HashMap;
abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
@ -131,4 +133,19 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
protected final String getAbsoluteUrl(String url) {
return mBaseUrl + "/" + url.replaceAll("(^/)", "");
}
protected final boolean waitForTest(BooleanTest t, int timeout) {
long end = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() < end) {
if (t.test())
return true;
mSolo.sleep(100);
}
return false;
}
protected interface BooleanTest {
public boolean test();
}
}

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

@ -1,5 +1,6 @@
[testAwesomebar]
[testBookmark]
[testBookmarklets]
[testLoad]
[testNewTab]
[testPanCorrectness]

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

@ -0,0 +1,80 @@
#filter substitution
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.app.Activity;
import android.content.ContentValues;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.Browser;
public class testBookmarklets extends BaseTest {
public void testBookmarklets() {
final String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
final String title = "alertBookmarklet";
final String js = "javascript:alert(12 + .34)";
boolean alerted;
setTestType("mochitest");
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
// load a standard page so bookmarklets work
loadUrl(url);
// verify that user-entered bookmarklets do *not* work
enterUrl(js);
mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
alerted = waitForTest(new BooleanTest() {
public boolean test() {
return mSolo.searchButton("OK", true) || mSolo.searchText("12.34", true);
}
}, 3000);
mAsserter.is(alerted, false, "Alert was not shown for user-entered bookmarklet");
// add the bookmarklet to the database. there's currently no way to
// add this using the UI, so we go through the content provider.
addOrUpdateBookmarklet(title, js);
// verify that bookmarklets clicked in awesomescreen work
Activity awesomeBarActivity = clickOnAwesomeBar();
mActions.sendSpecialKey(Actions.SpecialKey.RIGHT);
getInstrumentation().waitForIdleSync();
mSolo.clickOnText(title);
alerted = waitForTest(new BooleanTest() {
public boolean test() {
return mSolo.searchButton("OK", true) && mSolo.searchText("12.34", true);
}
}, 3000);
mAsserter.is(alerted, true, "Alert was shown for clicked bookmarklet");
}
private void addOrUpdateBookmarklet(String title, String url) {
ContentResolver resolver = getActivity().getContentResolver();
Uri bookmarksUri = Uri.parse("content://@ANDROID_PACKAGE_NAME@.db.browser/bookmarks");
bookmarksUri = bookmarksUri.buildUpon().appendQueryParameter("profile", "default").build();
long mobileFolderId = -1;
Cursor c = resolver.query(bookmarksUri,
new String[] { "_id" },
"guid = ?",
new String[] { "mobile" },
null);
if (c.moveToFirst())
mobileFolderId = c.getLong(c.getColumnIndexOrThrow("_id"));
c.close();
ContentValues values = new ContentValues();
values.put(Browser.BookmarkColumns.TITLE, title);
values.put("url", url);
values.put("parent", mobileFolderId);
values.put("modified", System.currentTimeMillis());
int updated = resolver.update(bookmarksUri,
values,
"url = ?",
new String[] { url });
if (updated == 0)
resolver.insert(bookmarksUri, values);
}
}

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

@ -914,11 +914,14 @@ var BrowserApp = {
// Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
// inheriting the currently loaded document's principal.
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (data.userEntered)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
let params = {
selected: true,
parentId: ("parentId" in data) ? data.parentId : -1,
flags: Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER
| Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP
flags: flags
};
let url = this.getSearchOrURI(data);

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

@ -6,10 +6,6 @@
android:taskAffinity="org.mozilla.gecko.sync.setup"
android:name="org.mozilla.gecko.sync.setup.activities.SetupSyncActivity" >
<!-- android:configChanges: SetupSyncActivity will handle orientation changes; no longer restarts activity (default) -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
@ -21,4 +17,4 @@
<activity
android:name="org.mozilla.gecko.sync.setup.activities.SetupFailureActivity" />
<activity
android:name="org.mozilla.gecko.sync.setup.activities.SetupSuccessActivity" />
android:name="org.mozilla.gecko.sync.setup.activities.SetupSuccessActivity" />

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

@ -12,7 +12,7 @@ body {
max-width: 50em;
margin: 1em auto;
border: 1px solid gray;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 3em;
-moz-padding-start: 30px;
background: white;

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

@ -46,7 +46,7 @@
-moz-border-bottom-colors: none !important;
-moz-border-right-colors: none !important;
-moz-border-left-colors: none !important;
-moz-border-radius: @border_radius_tiny@;
border-radius: @border_radius_tiny@;
border: @border_width_tiny@ solid rgba(255, 255, 255, 0.4) !important;
}

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

@ -129,7 +129,7 @@ xul|scrollbar xul|thumb {
-moz-border-right-colors: none !important;
-moz-border-left-colors: none !important;
border: 1px solid rgba(255, 255, 255, 0.4) !important;
-moz-border-radius: 3px;
border-radius: 3px;
}
select:not([size]):not([multiple]) > xul|scrollbar,
@ -148,7 +148,7 @@ button,
xul|button,
* > input:not([type="image"]) {
-moz-appearance: none !important; /* See bug 598421 for fixing the platform */
-moz-border-radius: 3px;
border-radius: 3px;
}
select[size],
@ -235,7 +235,7 @@ select > button {
border-width: 0px !important;
margin: 0px !important;
padding: 0px !important;
-moz-border-radius: 0;
border-radius: 0;
color: #414141;
background-size: auto auto, 100% 90%;

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

@ -46,7 +46,7 @@
-moz-border-bottom-colors: none !important;
-moz-border-right-colors: none !important;
-moz-border-left-colors: none !important;
-moz-border-radius: @border_radius_tiny@;
border-radius: @border_radius_tiny@;
border: @border_width_tiny@ solid rgba(255, 255, 255, 0.4) !important;
}

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