Merge mozilla-central to tracemonkey.
|
@ -4326,9 +4326,8 @@ var TabsProgressListener = {
|
|||
|
||||
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
if (!aRequest.URI)
|
||||
aRequest.QueryInterface(Ci.nsIChannel);
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
|
||||
if (aRequest instanceof Ci.nsIChannel &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {
|
||||
gCrashReporter.annotateCrashReport("URL", aRequest.URI.spec);
|
||||
}
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
waitForFocus(continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
|
||||
|
||||
charsToDelete = 5;
|
||||
|
|
|
@ -65,14 +65,11 @@ function testCustomize(aWindow, aCallback) {
|
|||
}
|
||||
|
||||
function closeToolbarCustomization(aWindow, aCTWindow) {
|
||||
var osString = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||
getService(Components.interfaces.nsIXULRuntime).OS;
|
||||
|
||||
// Force the cleanup code to be run now instead of onunload
|
||||
// This also hides the sheet on Mac
|
||||
// Force the cleanup code to be run now instead of onunload.
|
||||
// This also hides the sheet on Mac.
|
||||
aCTWindow.finishToolbarCustomization();
|
||||
|
||||
// On windows and linux, need to explicitly close the window
|
||||
if (osString != "Darwin")
|
||||
// On windows and linux, need to explicitly close the window.
|
||||
if (!gCustomizeSheet)
|
||||
aCTWindow.close();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
|
||||
window) {
|
||||
setTimeout(test, 0);
|
||||
window.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
|
||||
|
||||
gBrowser.addTab();
|
||||
|
@ -87,8 +78,6 @@ function test() {
|
|||
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
|
||||
gPrefService.clearUserPref("browser.ctrlTab.previews");
|
||||
|
||||
finish();
|
||||
|
||||
/* private utility functions */
|
||||
|
||||
function pressCtrlTab(aShiftKey)
|
||||
|
|
|
@ -215,35 +215,41 @@ CFPropertyListRef CopyPListFromFile(nsILocalFile* aPListFile)
|
|||
{
|
||||
PRBool exists;
|
||||
aPListFile->Exists(&exists);
|
||||
nsCAutoString filePath;
|
||||
aPListFile->GetNativePath(filePath);
|
||||
if (!exists)
|
||||
return nsnull;
|
||||
|
||||
nsCAutoString filePath;
|
||||
aPListFile->GetNativePath(filePath);
|
||||
|
||||
nsCOMPtr<nsILocalFileMac> macFile(do_QueryInterface(aPListFile));
|
||||
CFURLRef urlRef;
|
||||
macFile->GetCFURL(&urlRef);
|
||||
|
||||
CFDataRef resourceData;
|
||||
|
||||
// It is possible for CFURLCreateDataAndPropertiesFromResource to allocate resource
|
||||
// data and then return a failure so be careful to check both and clean up properly.
|
||||
SInt32 errorCode;
|
||||
Boolean status = ::CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,
|
||||
urlRef,
|
||||
&resourceData,
|
||||
NULL,
|
||||
NULL,
|
||||
&errorCode);
|
||||
if (!status)
|
||||
return nsnull;
|
||||
CFDataRef resourceData = NULL;
|
||||
Boolean dataSuccess = ::CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,
|
||||
urlRef,
|
||||
&resourceData,
|
||||
NULL,
|
||||
NULL,
|
||||
&errorCode);
|
||||
|
||||
CFPropertyListRef propertyList = NULL;
|
||||
if (resourceData) {
|
||||
if (dataSuccess) {
|
||||
propertyList = ::CFPropertyListCreateFromXMLData(kCFAllocatorDefault,
|
||||
resourceData,
|
||||
kCFPropertyListImmutable,
|
||||
NULL);
|
||||
}
|
||||
::CFRelease(resourceData);
|
||||
}
|
||||
|
||||
CFPropertyListRef result = ::CFPropertyListCreateFromXMLData(kCFAllocatorDefault,
|
||||
resourceData,
|
||||
kCFPropertyListImmutable,
|
||||
NULL);
|
||||
::CFRelease(resourceData);
|
||||
::CFRelease(urlRef);
|
||||
|
||||
return result;
|
||||
return propertyList;
|
||||
}
|
||||
|
||||
CFDictionaryRef CopySafariPrefs()
|
||||
|
@ -1254,12 +1260,14 @@ nsSafariProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
|
|||
|
||||
// Let's first check if there's a home page key in the com.apple.safari file...
|
||||
CFDictionaryRef safariPrefs = CopySafariPrefs();
|
||||
PRBool foundPref = GetDictionaryCStringValue(safariPrefs,
|
||||
CFSTR(SAFARI_HOME_PAGE_PREF),
|
||||
aResult, kCFStringEncodingUTF8);
|
||||
::CFRelease(safariPrefs);
|
||||
if (foundPref)
|
||||
return NS_OK;
|
||||
if (safariPrefs) {
|
||||
PRBool foundPref = GetDictionaryCStringValue(safariPrefs,
|
||||
CFSTR(SAFARI_HOME_PAGE_PREF),
|
||||
aResult, kCFStringEncodingUTF8);
|
||||
::CFRelease(safariPrefs);
|
||||
if (foundPref)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef __LP64__
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -76,7 +76,7 @@ function run_test() {
|
|||
// Restore could take some time, usually less than 1s.
|
||||
// We will poll later in continue_test to be sure restore has finished.
|
||||
do_test_pending();
|
||||
do_timeout(1000, "continue_test();");
|
||||
do_timeout(1000, continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
|
@ -85,7 +85,7 @@ function continue_test() {
|
|||
|
||||
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
||||
// Not enough time to complete restore, poll again later.
|
||||
do_timeout(1000, "continue_test();");
|
||||
do_timeout(1000, continue_test);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ let observer = {
|
|||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == TOPIC_CUSTOMIZATION_COMPLETE) {
|
||||
os.removeObserver(this, TOPIC_CUSTOMIZATION_COMPLETE);
|
||||
do_timeout(0, "continue_test();");
|
||||
do_timeout(0, continue_test);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ function run_test() {
|
|||
// Import could take some time, usually less than 1s, but to be sure we will
|
||||
// check after 3s.
|
||||
do_test_pending();
|
||||
do_timeout(3000, "continue_test();");
|
||||
do_timeout(3000, continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
|
|
|
@ -71,7 +71,7 @@ function run_test() {
|
|||
// Restore could take some time, usually less than 1s.
|
||||
// We will poll later in continue_test() to be sure restore has finished.
|
||||
do_test_pending();
|
||||
do_timeout(1000, "continue_test();");
|
||||
do_timeout(1000, continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
|
@ -80,7 +80,7 @@ function continue_test() {
|
|||
|
||||
if (bs.getIdForItemAt(bs.toolbarFolder, 0) == -1) {
|
||||
// Not enough time to complete restore, poll again later.
|
||||
do_timeout(1000, "continue_test();");
|
||||
do_timeout(1000, continue_test);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ function run_test() {
|
|||
|
||||
// Kick-off tests.
|
||||
do_test_pending();
|
||||
do_timeout(0, "run_next_test();");
|
||||
do_timeout(0, run_next_test);
|
||||
}
|
||||
|
||||
function run_next_test() {
|
||||
|
@ -160,7 +160,7 @@ function run_next_test() {
|
|||
do_check_true(compareJSON(gReferenceJSON, leftPaneJSON));
|
||||
do_check_eq(PlacesUtils.bookmarks.getItemTitle(gFolderId), "test");
|
||||
// Go to next test.
|
||||
do_timeout(0, "run_next_test();");
|
||||
do_timeout(0, run_next_test);
|
||||
}
|
||||
else {
|
||||
// All tests finished.
|
||||
|
|
|
@ -225,7 +225,7 @@ function (aDescriptionURL)
|
|||
// However, it is currently stubbed out due to security/privacy concerns
|
||||
// stemming from difficulties in determining what domain issued the request.
|
||||
// See bug 340604 and
|
||||
// http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/issearchproviderinstalled.asp .
|
||||
// http://msdn.microsoft.com/en-us/library/aa342526%28VS.85%29.aspx .
|
||||
// XXX Implement this!
|
||||
nsSidebar.prototype.IsSearchProviderInstalled =
|
||||
function (aSearchURL)
|
||||
|
|
|
@ -10,14 +10,7 @@ var gTabMoveCount = 0;
|
|||
var gPageLoadCount = 0;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
|
||||
window) {
|
||||
setTimeout(test, 0);
|
||||
window.focus();
|
||||
return;
|
||||
}
|
||||
waitForExplicitFinish();
|
||||
|
||||
var windows = Application.windows;
|
||||
ok(windows, "Check access to browser windows");
|
||||
|
|
До Ширина: | Высота: | Размер: 60 KiB После Ширина: | Высота: | Размер: 49 KiB |
Двоичные данные
browser/themes/winstripe/browser/Toolbar-small-aero.png
Executable file → Normal file
До Ширина: | Высота: | Размер: 24 KiB После Ширина: | Высота: | Размер: 20 KiB |
До Ширина: | Высота: | Размер: 33 KiB После Ширина: | Высота: | Размер: 26 KiB |
До Ширина: | Высота: | Размер: 60 KiB После Ширина: | Высота: | Размер: 48 KiB |
|
@ -230,7 +230,7 @@ toolbar[mode="icons"] #back-button {
|
|||
toolbar[iconsize="large"][mode="icons"] #back-button {
|
||||
-moz-image-region: rect(0px 396px 34px 360px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #back-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="large"][mode="icons"] #back-button:hover {
|
||||
-moz-image-region: rect(34px 396px 68px 360px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #back-button[disabled="true"] {
|
||||
|
@ -251,7 +251,7 @@ toolbar[mode="icons"] #forward-button {
|
|||
toolbar[iconsize="large"][mode="icons"] #forward-button {
|
||||
-moz-image-region: rect(3px 422px 31px 396px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #forward-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="large"][mode="icons"] #forward-button:hover {
|
||||
-moz-image-region: rect(37px 422px 65px 396px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #forward-button[disabled="true"] {
|
||||
|
@ -283,7 +283,7 @@ toolbar[iconsize="large"][mode="icons"] #back-forward-dropmarker {
|
|||
list-style-image: url("chrome://browser/skin/Toolbar.png");
|
||||
-moz-image-region: rect(3px 438px 31px 422px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #back-forward-dropmarker:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="large"][mode="icons"] #back-forward-dropmarker:hover {
|
||||
-moz-image-region: rect(37px 438px 65px 422px);
|
||||
}
|
||||
toolbar[iconsize="large"][mode="icons"] #back-forward-dropmarker[disabled="true"] {
|
||||
|
@ -305,7 +305,7 @@ toolbar[iconsize="small"][mode="icons"] #forward-button > .toolbarbutton-icon {
|
|||
toolbar[iconsize="small"][mode="icons"] #back-button {
|
||||
-moz-image-region: rect(0px 264px 24px 240px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #back-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"][mode="icons"] #back-button:hover {
|
||||
-moz-image-region: rect(24px 264px 48px 240px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #back-button[disabled="true"] {
|
||||
|
@ -320,7 +320,7 @@ toolbar[iconsize="small"][mode="icons"] #back-button:not([disabled="true"]):hove
|
|||
toolbar[iconsize="small"][mode="icons"] #forward-button {
|
||||
-moz-image-region: rect(0px 288px 24px 264px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #forward-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"][mode="icons"] #forward-button:hover {
|
||||
-moz-image-region: rect(24px 288px 48px 264px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #forward-button[disabled="true"] {
|
||||
|
@ -336,7 +336,7 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker {
|
|||
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
|
||||
-moz-image-region: rect(0px 301px 24px 288px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:hover {
|
||||
-moz-image-region: rect(24px 301px 48px 288px);
|
||||
}
|
||||
toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker[disabled="true"] {
|
||||
|
@ -353,62 +353,48 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#back-button {
|
||||
-moz-image-region: rect(0px 24px 24px 0px);
|
||||
}
|
||||
#back-button:not([disabled="true"]):hover,
|
||||
#back-button[buttonover="true"] {
|
||||
#back-button:hover {
|
||||
-moz-image-region: rect(24px 24px 48px 0px);
|
||||
}
|
||||
#back-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 24px 72px 0px);
|
||||
}
|
||||
#back-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 24px 120px 0px);
|
||||
}
|
||||
|
||||
/* forward button */
|
||||
|
||||
#forward-button {
|
||||
-moz-image-region: rect(0px 48px 24px 24px);
|
||||
}
|
||||
#forward-button:not([disabled="true"]):hover,
|
||||
#forward-button[buttonover="true"] {
|
||||
#forward-button:hover {
|
||||
-moz-image-region: rect(24px 48px 48px 24px);
|
||||
}
|
||||
#forward-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 48px 72px 24px);
|
||||
}
|
||||
#forward-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 48px 120px 24px);
|
||||
}
|
||||
|
||||
/* stop button */
|
||||
|
||||
#stop-button {
|
||||
-moz-image-region: rect(0px 72px 24px 48px);
|
||||
}
|
||||
#stop-button:not([disabled="true"]):hover {
|
||||
#stop-button:hover {
|
||||
-moz-image-region: rect(24px 72px 48px 48px);
|
||||
}
|
||||
#stop-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 72px 72px 48px);
|
||||
}
|
||||
#stop-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 72px 120px 48px);
|
||||
}
|
||||
|
||||
/* reload button */
|
||||
|
||||
#reload-button {
|
||||
-moz-image-region: rect(0px 96px 24px 72px);
|
||||
}
|
||||
#reload-button:not([disabled="true"]):hover {
|
||||
#reload-button:hover {
|
||||
-moz-image-region: rect(24px 96px 48px 72px);
|
||||
}
|
||||
#reload-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 96px 72px 72px);
|
||||
}
|
||||
#reload-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 96px 120px 72px);
|
||||
}
|
||||
|
||||
/* home button */
|
||||
|
||||
|
@ -418,9 +404,6 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#home-button:hover {
|
||||
-moz-image-region: rect(24px 120px 48px 96px);
|
||||
}
|
||||
#home-button:hover:active {
|
||||
-moz-image-region: rect(96px 120px 120px 96px);
|
||||
}
|
||||
|
||||
/* download manager button */
|
||||
|
||||
|
@ -430,23 +413,15 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#downloads-button:hover {
|
||||
-moz-image-region: rect(24px 144px 48px 120px);
|
||||
}
|
||||
#downloads-button:hover:active {
|
||||
-moz-image-region: rect(96px 144px 120px 120px);
|
||||
}
|
||||
|
||||
/* history sidebar button */
|
||||
|
||||
#history-button {
|
||||
-moz-image-region: rect(0px 168px 24px 144px);
|
||||
}
|
||||
#history-button:not([checked="true"]):hover {
|
||||
-moz-image-region: rect(24px 168px 48px 144px);
|
||||
}
|
||||
#history-button:hover,
|
||||
#history-button[checked="true"] {
|
||||
-moz-image-region: rect(72px 168px 96px 144px);
|
||||
}
|
||||
#history-button:not([checked="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 168px 120px 144px);
|
||||
-moz-image-region: rect(24px 168px 48px 144px);
|
||||
}
|
||||
|
||||
/* bookmark sidebar button */
|
||||
|
@ -454,14 +429,9 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#bookmarks-button {
|
||||
-moz-image-region: rect(0px 192px 24px 168px);
|
||||
}
|
||||
#bookmarks-button:not([checked="true"]):hover {
|
||||
-moz-image-region: rect(24px 192px 48px 168px);
|
||||
}
|
||||
#bookmarks-button:hover,
|
||||
#bookmarks-button[checked="true"] {
|
||||
-moz-image-region: rect(72px 192px 96px 168px);
|
||||
}
|
||||
#bookmarks-button:not([checked="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 192px 120px 168px);
|
||||
-moz-image-region: rect(24px 192px 48px 168px);
|
||||
}
|
||||
|
||||
/* print button */
|
||||
|
@ -469,15 +439,12 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#print-button {
|
||||
-moz-image-region: rect(0px 216px 24px 192px);
|
||||
}
|
||||
#print-button:not([disabled="true"]):hover {
|
||||
#print-button:hover {
|
||||
-moz-image-region: rect(24px 216px 48px 192px);
|
||||
}
|
||||
#print-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 216px 72px 192px);
|
||||
}
|
||||
#print-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 216px 120px 192px);
|
||||
}
|
||||
|
||||
/* toolbar new tab button */
|
||||
|
||||
|
@ -487,9 +454,6 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#new-tab-button:hover {
|
||||
-moz-image-region: rect(24px 240px 48px 216px);
|
||||
}
|
||||
#new-tab-button:hover:active {
|
||||
-moz-image-region: rect(96px 240px 120px 216px);
|
||||
}
|
||||
|
||||
/* new window button */
|
||||
|
||||
|
@ -499,66 +463,52 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:not([disabled="
|
|||
#new-window-button:hover {
|
||||
-moz-image-region: rect(24px 264px 48px 240px);
|
||||
}
|
||||
#new-window-button:hover:active {
|
||||
-moz-image-region: rect(96px 264px 120px 240px);
|
||||
}
|
||||
|
||||
/* cut button */
|
||||
|
||||
#cut-button {
|
||||
-moz-image-region: rect(0px 288px 24px 264px);
|
||||
}
|
||||
#cut-button:not([disabled="true"]):hover {
|
||||
#cut-button:hover {
|
||||
-moz-image-region: rect(24px 288px 48px 264px);
|
||||
}
|
||||
#cut-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 288px 72px 264px);
|
||||
}
|
||||
#cut-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 288px 120px 264px);
|
||||
}
|
||||
|
||||
/* copy button */
|
||||
|
||||
#copy-button {
|
||||
-moz-image-region: rect(0px 312px 24px 288px);
|
||||
}
|
||||
#copy-button:not([disabled="true"]):hover {
|
||||
#copy-button:hover {
|
||||
-moz-image-region: rect(24px 312px 48px 288px);
|
||||
}
|
||||
#copy-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 312px 72px 288px);
|
||||
}
|
||||
#copy-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 312px 120px 288px);
|
||||
}
|
||||
|
||||
/* paste button */
|
||||
|
||||
#paste-button {
|
||||
-moz-image-region: rect(0px 336px 24px 312px);
|
||||
}
|
||||
#paste-button:not([disabled="true"]):hover {
|
||||
#paste-button:hover {
|
||||
-moz-image-region: rect(24px 336px 48px 312px);
|
||||
}
|
||||
#paste-button[disabled="true"] {
|
||||
-moz-image-region: rect(48px 336px 72px 312px);
|
||||
}
|
||||
#paste-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(96px 336px 120px 312px);
|
||||
}
|
||||
|
||||
/* fullscreen button */
|
||||
|
||||
#fullscreen-button {
|
||||
-moz-image-region: rect(0px 360px 24px 336px);
|
||||
}
|
||||
#fullscreen-button:hover {
|
||||
#fullscreen-button:hover,
|
||||
#fullscreen-button[checked="true"] {
|
||||
-moz-image-region: rect(24px 360px 48px 336px);
|
||||
}
|
||||
#fullscreen-button:hover:active {
|
||||
-moz-image-region: rect(96px 360px 120px 336px);
|
||||
}
|
||||
|
||||
/* ::::: 16px primary toolbar buttons ::::: */
|
||||
|
||||
|
@ -580,16 +530,12 @@ toolbar[iconsize="small"] #back-button > .toolbarbutton-icon {
|
|||
toolbar[iconsize="small"] #back-button {
|
||||
-moz-image-region: rect(0px 16px 16px 0px);
|
||||
}
|
||||
toolbar[iconsize="small"] #back-button:not([disabled="true"]):hover,
|
||||
toolbar[iconsize="small"] #back-button[buttonover="true"] {
|
||||
toolbar[iconsize="small"] #back-button:hover {
|
||||
-moz-image-region: rect(16px 16px 32px 0px);
|
||||
}
|
||||
toolbar[iconsize="small"] #back-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 16px 48px 0px);
|
||||
}
|
||||
toolbar[iconsize="small"] #back-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 16px 80px 0px);
|
||||
}
|
||||
|
||||
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(ltr),
|
||||
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
|
||||
|
@ -604,16 +550,12 @@ toolbar[iconsize="small"] #forward-button > .toolbarbutton-icon {
|
|||
toolbar[iconsize="small"] #forward-button {
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
}
|
||||
toolbar[iconsize="small"] #forward-button:not([disabled="true"]):hover,
|
||||
toolbar[iconsize="small"] #forward-button[buttonover="true"] {
|
||||
toolbar[iconsize="small"] #forward-button:hover {
|
||||
-moz-image-region: rect(16px 32px 32px 16px);
|
||||
}
|
||||
toolbar[iconsize="small"] #forward-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 32px 48px 16px);
|
||||
}
|
||||
toolbar[iconsize="small"] #forward-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 32px 80px 16px);
|
||||
}
|
||||
|
||||
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(ltr),
|
||||
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(rtl) {
|
||||
|
@ -625,48 +567,38 @@ toolbar[iconsize="small"] #forward-button:not([disabled="true"]):hover:active {
|
|||
toolbar[iconsize="small"] #stop-button {
|
||||
-moz-image-region: rect(0px 48px 16px 32px);
|
||||
}
|
||||
toolbar[iconsize="small"] #stop-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #stop-button:hover {
|
||||
-moz-image-region: rect(16px 48px 32px 32px);
|
||||
}
|
||||
toolbar[iconsize="small"] #stop-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 48px 48px 32px);
|
||||
}
|
||||
toolbar[iconsize="small"] #stop-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 48px 80px 32px);
|
||||
}
|
||||
|
||||
/* reload button */
|
||||
|
||||
toolbar[iconsize="small"] #reload-button {
|
||||
-moz-image-region: rect(0px 64px 16px 48px);
|
||||
}
|
||||
toolbar[iconsize="small"] #reload-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #reload-button:hover {
|
||||
-moz-image-region: rect(16px 64px 32px 48px);
|
||||
}
|
||||
toolbar[iconsize="small"] #reload-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 64px 48px 48px);
|
||||
}
|
||||
toolbar[iconsize="small"] #reload-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 64px 80px 48px);
|
||||
}
|
||||
|
||||
/* home button */
|
||||
|
||||
#home-button.bookmark-item {
|
||||
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
|
||||
}
|
||||
toolbar[iconsize="small"] #home-button ,
|
||||
toolbar[iconsize="small"] #home-button,
|
||||
#home-button.bookmark-item {
|
||||
-moz-image-region: rect(0px 80px 16px 64px);
|
||||
}
|
||||
toolbar[iconsize="small"] #home-button:hover ,
|
||||
toolbar[iconsize="small"] #home-button:hover,
|
||||
#home-button.bookmark-item:hover {
|
||||
-moz-image-region: rect(16px 80px 32px 64px);
|
||||
}
|
||||
toolbar[iconsize="small"] #home-button:hover:active ,
|
||||
#home-button.bookmark-item:hover:active {
|
||||
-moz-image-region: rect(64px 80px 80px 64px);
|
||||
}
|
||||
|
||||
/* download manager button */
|
||||
|
||||
|
@ -676,23 +608,15 @@ toolbar[iconsize="small"] #downloads-button {
|
|||
toolbar[iconsize="small"] #downloads-button:hover {
|
||||
-moz-image-region: rect(16px 96px 32px 80px);
|
||||
}
|
||||
toolbar[iconsize="small"] #downloads-button:hover:active {
|
||||
-moz-image-region: rect(64px 96px 80px 80px);
|
||||
}
|
||||
|
||||
/* history sidebar button */
|
||||
|
||||
toolbar[iconsize="small"] #history-button {
|
||||
-moz-image-region: rect(0px 112px 16px 96px);
|
||||
}
|
||||
toolbar[iconsize="small"] #history-button:not([checked="true"]):hover {
|
||||
-moz-image-region: rect(16px 112px 32px 96px);
|
||||
}
|
||||
toolbar[iconsize="small"] #history-button:hover,
|
||||
toolbar[iconsize="small"] #history-button[checked="true"] {
|
||||
-moz-image-region: rect(48px 112px 64px 96px);
|
||||
}
|
||||
toolbar[iconsize="small"] #history-button:not([checked="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 112px 80px 96px);
|
||||
-moz-image-region: rect(16px 112px 32px 96px);
|
||||
}
|
||||
|
||||
/* bookmark sidebar button */
|
||||
|
@ -700,14 +624,9 @@ toolbar[iconsize="small"] #history-button:not([checked="true"]):hover:active {
|
|||
toolbar[iconsize="small"] #bookmarks-button {
|
||||
-moz-image-region: rect(0px 128px 16px 112px);
|
||||
}
|
||||
toolbar[iconsize="small"] #bookmarks-button:not([checked="true"]):hover {
|
||||
-moz-image-region: rect(16px 128px 32px 112px);
|
||||
}
|
||||
toolbar[iconsize="small"] #bookmarks-button:hover,
|
||||
toolbar[iconsize="small"] #bookmarks-button[checked="true"] {
|
||||
-moz-image-region: rect(48px 128px 64px 112px);
|
||||
}
|
||||
toolbar[iconsize="small"] #bookmarks-button:not([checked="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 128px 80px 112px);
|
||||
-moz-image-region: rect(16px 128px 32px 112px);
|
||||
}
|
||||
|
||||
/* print button */
|
||||
|
@ -715,15 +634,12 @@ toolbar[iconsize="small"] #bookmarks-button:not([checked="true"]):hover:active {
|
|||
toolbar[iconsize="small"] #print-button {
|
||||
-moz-image-region: rect(0px 144px 16px 128px);
|
||||
}
|
||||
toolbar[iconsize="small"] #print-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #print-button:hover {
|
||||
-moz-image-region: rect(16px 144px 32px 128px);
|
||||
}
|
||||
toolbar[iconsize="small"] #print-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 144px 48px 128px);
|
||||
}
|
||||
toolbar[iconsize="small"] #print-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 144px 80px 128px);
|
||||
}
|
||||
|
||||
/* toolbar new tab button */
|
||||
|
||||
|
@ -733,9 +649,6 @@ toolbar[iconsize="small"] #new-tab-button {
|
|||
toolbar[iconsize="small"] #new-tab-button:hover {
|
||||
-moz-image-region: rect(16px 160px 32px 144px);
|
||||
}
|
||||
toolbar[iconsize="small"] #new-tab-button:hover:active {
|
||||
-moz-image-region: rect(64px 160px 80px 144px);
|
||||
}
|
||||
|
||||
/* new window button */
|
||||
|
||||
|
@ -745,9 +658,6 @@ toolbar[iconsize="small"] #new-window-button {
|
|||
toolbar[iconsize="small"] #new-window-button:hover {
|
||||
-moz-image-region: rect(16px 176px 32px 160px);
|
||||
}
|
||||
toolbar[iconsize="small"] #new-window-button:hover:active {
|
||||
-moz-image-region: rect(64px 176px 80px 160px);
|
||||
}
|
||||
|
||||
/* cut button */
|
||||
|
||||
|
@ -757,57 +667,46 @@ toolbar[iconsize="small"] #cut-button > .toolbarbutton-icon {
|
|||
toolbar[iconsize="small"] #cut-button {
|
||||
-moz-image-region: rect(0px 192px 16px 176px);
|
||||
}
|
||||
toolbar[iconsize="small"] #cut-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #cut-button:hover {
|
||||
-moz-image-region: rect(16px 192px 32px 176px);
|
||||
}
|
||||
toolbar[iconsize="small"] #cut-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 192px 48px 176px);
|
||||
}
|
||||
toolbar[iconsize="small"] #cut-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 192px 80px 176px);
|
||||
}
|
||||
|
||||
/* copy button */
|
||||
|
||||
toolbar[iconsize="small"] #copy-button {
|
||||
-moz-image-region: rect(0px 208px 16px 192px);
|
||||
}
|
||||
toolbar[iconsize="small"] #copy-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #copy-button:hover {
|
||||
-moz-image-region: rect(16px 208px 32px 192px);
|
||||
}
|
||||
toolbar[iconsize="small"] #copy-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 208px 48px 192px);
|
||||
}
|
||||
toolbar[iconsize="small"] #copy-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 208px 80px 192px);
|
||||
}
|
||||
|
||||
/* paste button */
|
||||
|
||||
toolbar[iconsize="small"] #paste-button {
|
||||
-moz-image-region: rect(0px 224px 16px 208px);
|
||||
}
|
||||
toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover {
|
||||
toolbar[iconsize="small"] #paste-button:hover {
|
||||
-moz-image-region: rect(16px 224px 32px 208px);
|
||||
}
|
||||
toolbar[iconsize="small"] #paste-button[disabled="true"] {
|
||||
-moz-image-region: rect(32px 224px 48px 208px);
|
||||
}
|
||||
toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active {
|
||||
-moz-image-region: rect(64px 224px 80px 208px);
|
||||
}
|
||||
|
||||
/* fullscreen button */
|
||||
|
||||
toolbar[iconsize="small"] #fullscreen-button {
|
||||
-moz-image-region: rect(0px 240px 16px 224px);
|
||||
}
|
||||
toolbar[iconsize="small"] #fullscreen-button:hover {
|
||||
toolbar[iconsize="small"] #fullscreen-button:hover,
|
||||
toolbar[iconsize="small"] #fullscreen-button[checked="true"] {
|
||||
-moz-image-region: rect(16px 240px 32px 224px);
|
||||
}
|
||||
toolbar[iconsize="small"] #fullscreen-button:hover:active {
|
||||
-moz-image-region: rect(64px 240px 80px 224px);
|
||||
}
|
||||
|
||||
/* ::::: fullscreen window controls ::::: */
|
||||
|
||||
|
|
Двоичные данные
browser/themes/winstripe/browser/feeds/feed-icons-16.png
До Ширина: | Высота: | Размер: 2.1 KiB После Ширина: | Высота: | Размер: 2.1 KiB |
|
@ -67,9 +67,6 @@ browser.jar:
|
|||
skin/classic/browser/places/history.png (places/history.png)
|
||||
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
||||
skin/classic/browser/places/unsortedBookmarks.png (places/unsortedBookmarks.png)
|
||||
skin/classic/browser/places/importAndBackup.png (places/importAndBackup.png)
|
||||
skin/classic/browser/places/organize.png (places/organize.png)
|
||||
skin/classic/browser/places/view.png (places/view.png)
|
||||
skin/classic/browser/places/searching_16.png (places/searching_16.png)
|
||||
skin/classic/browser/preferences/alwaysAsk.png (preferences/alwaysAsk.png)
|
||||
skin/classic/browser/preferences/application.png (preferences/application.png)
|
||||
|
@ -159,10 +156,7 @@ browser.jar:
|
|||
skin/classic/aero/browser/places/history.png (places/history-aero.png)
|
||||
skin/classic/aero/browser/places/allBookmarks.png (places/allBookmarks-aero.png)
|
||||
skin/classic/aero/browser/places/unsortedBookmarks.png (places/unsortedBookmarks-aero.png)
|
||||
skin/classic/aero/browser/places/importAndBackup.png (places/importAndBackup-aero.png)
|
||||
skin/classic/aero/browser/places/view.png (places/view-aero.png)
|
||||
skin/classic/aero/browser/places/searching_16.png (places/searching_16-aero.png)
|
||||
skin/classic/aero/browser/places/organize.png (places/organize-aero.png)
|
||||
skin/classic/aero/browser/preferences/alwaysAsk.png (preferences/alwaysAsk-aero.png)
|
||||
skin/classic/aero/browser/preferences/application.png (preferences/application-aero.png)
|
||||
skin/classic/aero/browser/preferences/mail.png (preferences/mail-aero.png)
|
||||
|
|
Двоичные данные
browser/themes/winstripe/browser/places/bookmark.png
До Ширина: | Высота: | Размер: 1.5 KiB После Ширина: | Высота: | Размер: 1.7 KiB |
Двоичные данные
browser/themes/winstripe/browser/places/editBookmark.png
До Ширина: | Высота: | Размер: 2.0 KiB После Ширина: | Высота: | Размер: 1.9 KiB |
Двоичные данные
browser/themes/winstripe/browser/places/importAndBackup-aero.png
До Ширина: | Высота: | Размер: 786 B |
Двоичные данные
browser/themes/winstripe/browser/places/importAndBackup.png
До Ширина: | Высота: | Размер: 757 B |
Двоичные данные
browser/themes/winstripe/browser/places/libraryToolbar.png
До Ширина: | Высота: | Размер: 2.2 KiB После Ширина: | Высота: | Размер: 2.2 KiB |
Двоичные данные
browser/themes/winstripe/browser/places/organize-aero.png
До Ширина: | Высота: | Размер: 335 B |
Двоичные данные
browser/themes/winstripe/browser/places/organize.png
До Ширина: | Высота: | Размер: 387 B |
|
@ -98,19 +98,38 @@
|
|||
background-position: left center;
|
||||
}
|
||||
|
||||
/* organize, view and maintenance buttons icons */
|
||||
#organizeButton,
|
||||
#viewMenu,
|
||||
#maintenanceButton {
|
||||
list-style-image: url("chrome://browser/skin/places/libraryToolbar.png");
|
||||
}
|
||||
|
||||
/* organize button */
|
||||
#organizeButton {
|
||||
list-style-image: url("chrome://browser/skin/places/organize.png");
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
#organizeButton:hover,
|
||||
#organizeButton[open="true"] {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0px);
|
||||
}
|
||||
|
||||
/* view button */
|
||||
#viewMenu {
|
||||
list-style-image: url("chrome://browser/skin/places/view.png");
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
}
|
||||
#viewMenu:hover,
|
||||
#viewMenu[open="true"] {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
/* maintenance button */
|
||||
#maintenanceButton {
|
||||
list-style-image: url("chrome://browser/skin/places/importAndBackup.png");
|
||||
-moz-image-region: rect(0px, 48px, 16px, 32px);
|
||||
}
|
||||
#maintenanceButton:hover,
|
||||
#maintenanceButton[open="true"] {
|
||||
-moz-image-region: rect(16px, 48px, 32px, 32px);
|
||||
}
|
||||
|
||||
/* Root View */
|
||||
|
|
Двоичные данные
browser/themes/winstripe/browser/places/view-aero.png
До Ширина: | Высота: | Размер: 193 B |
Двоичные данные
browser/themes/winstripe/browser/places/view.png
До Ширина: | Высота: | Размер: 181 B |
|
@ -53,8 +53,19 @@ class LockFile(object):
|
|||
def __init__(self, lockfile):
|
||||
self.lockfile = lockfile
|
||||
def __del__(self):
|
||||
os.remove(self.lockfile)
|
||||
|
||||
while True:
|
||||
try:
|
||||
os.remove(self.lockfile)
|
||||
break
|
||||
except OSError, e:
|
||||
if e.errno == errno.EACCES:
|
||||
# another process probably has the file open, we'll retry.
|
||||
# just a short sleep since we want to drop the lock ASAP
|
||||
# (but we need to let some other process close the file first)
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
# re-raise unknown errors
|
||||
raise
|
||||
|
||||
def lockFile(lockfile, max_wait = 600):
|
||||
'''Create and hold a lockfile of the given name, with the given timeout.
|
||||
|
@ -67,7 +78,10 @@ def lockFile(lockfile, max_wait = 600):
|
|||
# we created the lockfile, so we're the owner
|
||||
break
|
||||
except OSError, e:
|
||||
if e.errno != errno.EEXIST:
|
||||
if e.errno == errno.EEXIST or \
|
||||
(sys.platform == "win32" and e.errno == errno.EACCES):
|
||||
pass
|
||||
else:
|
||||
# should not occur
|
||||
raise
|
||||
|
||||
|
@ -77,18 +91,19 @@ def lockFile(lockfile, max_wait = 600):
|
|||
f = open(lockfile, "r")
|
||||
s = os.stat(lockfile)
|
||||
except EnvironmentError, e:
|
||||
if e.errno != errno.ENOENT:
|
||||
sys.exit("%s exists but stat() failed: %s" %
|
||||
(lockfile, e.strerror))
|
||||
# we didn't create the lockfile, so it did exist, but it's
|
||||
# gone now. Just try again
|
||||
continue
|
||||
if e.errno == errno.ENOENT or \
|
||||
(sys.platform == "win32" and e.errno == errno.EACCES):
|
||||
# we didn't create the lockfile, so it did exist, but it's
|
||||
# gone now. Just try again
|
||||
continue
|
||||
sys.exit("%s exists but stat() failed: %s" %
|
||||
(lockfile, e.strerror))
|
||||
|
||||
# we didn't create the lockfile and it's still there, check
|
||||
# its age
|
||||
now = int(time.time())
|
||||
if now - s[stat.ST_MTIME] > max_wait:
|
||||
pid = f.readline()
|
||||
pid = f.readline().rstrip()
|
||||
sys.exit("%s has been locked for more than " \
|
||||
"%d seconds (PID %s)" % (lockfile, max_wait,
|
||||
pid))
|
||||
|
|
|
@ -44,7 +44,7 @@ interface nsIDOMFileError : nsISupports
|
|||
const unsigned short NOT_FOUND_ERR = 8;
|
||||
const unsigned short NOT_READABLE_ERR = 24;
|
||||
const unsigned short SECURITY_ERR = 18;
|
||||
const unsigned short ABORT_ERR = 25;
|
||||
const unsigned short ABORT_ERR = 20;
|
||||
const unsigned short ENCODING_ERR = 26;
|
||||
|
||||
readonly attribute unsigned short code;
|
||||
|
|
|
@ -123,10 +123,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
|
|||
NS_IMPL_ADDREF_INHERITED(nsDOMFileReader, nsXHREventTarget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMFileReader, nsXHREventTarget)
|
||||
|
||||
static const PRUint32 FILE_AS_BINARY = 1;
|
||||
static const PRUint32 FILE_AS_TEXT = 2;
|
||||
static const PRUint32 FILE_AS_DATAURL = 3;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileReader::GetOnloadend(nsIDOMEventListener** aOnloadend)
|
||||
{
|
||||
|
@ -152,13 +148,12 @@ nsDOMFileReader::Notify(const char *aCharset, nsDetectionConfident aConf)
|
|||
//nsDOMFileReader constructors/initializers
|
||||
|
||||
nsDOMFileReader::nsDOMFileReader()
|
||||
: mFileData(nsnull), mReadCount(0),
|
||||
mDataLen(0), mDataFormat(0),
|
||||
: mFileData(nsnull),
|
||||
mDataLen(0), mDataFormat(FILE_AS_BINARY),
|
||||
mReadyState(nsIDOMFileReader::EMPTY),
|
||||
mProgressEventWasDelayed(PR_FALSE),
|
||||
mTimerIsActive(PR_FALSE),
|
||||
mReadTotal(0), mReadTransferred(0),
|
||||
mReadComplete(PR_TRUE)
|
||||
mReadTotal(0), mReadTransferred(0)
|
||||
{
|
||||
nsLayoutStatics::AddRef();
|
||||
}
|
||||
|
@ -168,6 +163,8 @@ nsDOMFileReader::~nsDOMFileReader()
|
|||
if (mListenerManager)
|
||||
mListenerManager->Disconnect();
|
||||
|
||||
FreeFileData();
|
||||
|
||||
nsLayoutStatics::Release();
|
||||
}
|
||||
|
||||
|
@ -295,8 +292,6 @@ nsDOMFileReader::Abort()
|
|||
if (mProgressNotifier) {
|
||||
mProgressNotifier->Cancel();
|
||||
}
|
||||
mReadCount = 0;
|
||||
mDataLen = 0;
|
||||
|
||||
//Revert status, result and readystate attributes
|
||||
SetDOMStringToNull(mResult);
|
||||
|
@ -312,8 +307,7 @@ nsDOMFileReader::Abort()
|
|||
mFile = nsnull;
|
||||
|
||||
//Clean up memory buffer
|
||||
PR_Free(mFileData);
|
||||
mFileData = nsnull;
|
||||
FreeFileData();
|
||||
|
||||
//Dispatch the abort event
|
||||
DispatchProgressEvent(NS_LITERAL_STRING(ABORT_STR));
|
||||
|
@ -360,6 +354,28 @@ nsDOMFileReader::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
NS_METHOD
|
||||
ReadFuncBinaryString(nsIInputStream* in,
|
||||
void* closure,
|
||||
const char* fromRawSegment,
|
||||
PRUint32 toOffset,
|
||||
PRUint32 count,
|
||||
PRUint32 *writeCount)
|
||||
{
|
||||
PRUnichar* dest = static_cast<PRUnichar*>(closure) + toOffset;
|
||||
PRUnichar* end = dest + count;
|
||||
const unsigned char* source = (const unsigned char*)fromRawSegment;
|
||||
while (dest != end) {
|
||||
*dest = *source;
|
||||
++dest;
|
||||
++source;
|
||||
}
|
||||
*writeCount = count;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileReader::OnDataAvailable(nsIRequest *aRequest,
|
||||
nsISupports *aContext,
|
||||
|
@ -367,34 +383,33 @@ nsDOMFileReader::OnDataAvailable(nsIRequest *aRequest,
|
|||
PRUint32 aOffset,
|
||||
PRUint32 aCount)
|
||||
{
|
||||
//Update memory buffer to reflect the contents of the file
|
||||
mFileData = (char *)PR_Realloc(mFileData, aOffset + aCount);
|
||||
NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
aInputStream->Read(mFileData + aOffset, aCount, &mReadCount);
|
||||
mDataLen += aCount;
|
||||
mReadTransferred = mDataLen;
|
||||
|
||||
//Continuously update our binary string as data comes in
|
||||
if (mDataFormat == FILE_AS_BINARY) {
|
||||
//Continuously update our binary string as data comes in
|
||||
NS_ASSERTION(mResult.Length() == aOffset,
|
||||
"unexpected mResult length");
|
||||
PRUint32 oldLen = mResult.Length();
|
||||
PRUint32 newLen = oldLen + aCount;
|
||||
PRUnichar *buf;
|
||||
PRUnichar *buf = nsnull;
|
||||
mResult.GetMutableData(&buf, oldLen + aCount);
|
||||
NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (mResult.GetMutableData(&buf, newLen) != newLen) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRUnichar *bufEnd = buf + newLen;
|
||||
buf += oldLen;
|
||||
|
||||
char *source = mFileData + aOffset;
|
||||
while (buf < bufEnd) {
|
||||
*buf = *source;
|
||||
++buf;
|
||||
++source;
|
||||
}
|
||||
PRUint32 bytesRead = 0;
|
||||
aInputStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
|
||||
&bytesRead);
|
||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
||||
}
|
||||
else {
|
||||
//Update memory buffer to reflect the contents of the file
|
||||
mFileData = (char *)PR_Realloc(mFileData, aOffset + aCount);
|
||||
NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRUint32 bytesRead = 0;
|
||||
aInputStream->Read(mFileData + aOffset, aCount, &bytesRead);
|
||||
NS_ASSERTION(bytesRead == aCount, "failed to read data");
|
||||
|
||||
mDataLen += aCount;
|
||||
}
|
||||
|
||||
mReadTransferred += aCount;
|
||||
|
||||
//Notify the timer is the appropriate timeframe has passed
|
||||
if (mTimerIsActive) {
|
||||
|
@ -430,11 +445,12 @@ nsDOMFileReader::OnStopRequest(nsIRequest *aRequest,
|
|||
|
||||
//Set the status field as appropriate
|
||||
if (NS_FAILED(aStatus)) {
|
||||
FreeFileData();
|
||||
DispatchError(aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsresult rv = NS_OK;
|
||||
switch (mDataFormat) {
|
||||
case FILE_AS_BINARY:
|
||||
break; //Already accumulated mResult
|
||||
|
@ -444,15 +460,20 @@ nsDOMFileReader::OnStopRequest(nsIRequest *aRequest,
|
|||
case FILE_AS_DATAURL:
|
||||
rv = GetAsDataURL(mFile, mFileData, mDataLen, mResult);
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
FreeFileData();
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//Dispatch load event to signify end of a successful load
|
||||
DispatchProgressEvent(NS_LITERAL_STRING(LOAD_STR));
|
||||
DispatchProgressEvent(NS_LITERAL_STRING(LOADEND_STR));
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
@ -460,15 +481,21 @@ nsDOMFileReader::OnStopRequest(nsIRequest *aRequest,
|
|||
nsresult
|
||||
nsDOMFileReader::ReadFileContent(nsIDOMFile* aFile,
|
||||
const nsAString &aCharset,
|
||||
PRUint32 aDataFormat)
|
||||
{
|
||||
eDataFormat aDataFormat)
|
||||
{
|
||||
NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
|
||||
|
||||
//Implicit abort to clear any other activity going on
|
||||
Abort();
|
||||
mError = nsnull;
|
||||
SetDOMStringToNull(mResult);
|
||||
mReadTransferred = 0;
|
||||
mReadTotal = 0;
|
||||
mReadyState = nsIDOMFileReader::EMPTY;
|
||||
FreeFileData();
|
||||
|
||||
mDataFormat = aDataFormat;
|
||||
mCharset = aCharset;
|
||||
mError = nsnull;
|
||||
|
||||
//Obtain the nsDOMFile's underlying nsIFile
|
||||
nsresult rv;
|
||||
|
@ -485,7 +512,8 @@ nsDOMFileReader::ReadFileContent(nsIDOMFile* aFile,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//Obtain the total size of the file before reading
|
||||
aFile->GetSize(&mReadTotal);
|
||||
mReadTotal = -1;
|
||||
mFile->GetFileSize(&mReadTotal);
|
||||
|
||||
rv = mChannel->AsyncOpen(this, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -540,8 +568,8 @@ nsDOMFileReader::DispatchProgressEvent(const nsAString& aType)
|
|||
if (!progress)
|
||||
return;
|
||||
|
||||
progress->InitProgressEvent(aType, PR_FALSE, PR_FALSE, mReadComplete,
|
||||
mReadTransferred, (mReadTotal == LL_MAXUINT) ? 0 : mReadTotal);
|
||||
progress->InitProgressEvent(aType, PR_FALSE, PR_FALSE, mReadTotal >= 0,
|
||||
mReadTransferred, PR_MAX(mReadTotal, 0));
|
||||
|
||||
this->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIStreamLoader.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsXMLHttpRequest.h"
|
||||
|
||||
|
@ -110,7 +111,13 @@ public:
|
|||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsresult ReadFileContent(nsIDOMFile *aFile, const nsAString &aCharset, PRUint32 aDataFormat);
|
||||
enum eDataFormat {
|
||||
FILE_AS_BINARY,
|
||||
FILE_AS_TEXT,
|
||||
FILE_AS_DATAURL
|
||||
};
|
||||
|
||||
nsresult ReadFileContent(nsIDOMFile *aFile, const nsAString &aCharset, eDataFormat aDataFormat);
|
||||
nsresult GetAsText(const nsAString &aCharset,
|
||||
const char *aFileData, PRUint32 aDataLen, nsAString &aResult);
|
||||
nsresult GetAsDataURL(nsIFile *aFile, const char *aFileData, PRUint32 aDataLen, nsAString &aResult);
|
||||
|
@ -119,12 +126,18 @@ protected:
|
|||
void DispatchError(nsresult rv);
|
||||
void StartProgressEventTimer();
|
||||
|
||||
void FreeFileData() {
|
||||
PR_Free(mFileData);
|
||||
mFileData = nsnull;
|
||||
mDataLen = 0;
|
||||
}
|
||||
|
||||
char *mFileData;
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
nsString mCharset;
|
||||
PRUint32 mReadCount;
|
||||
PRUint32 mDataLen;
|
||||
PRUint32 mDataFormat;
|
||||
|
||||
eDataFormat mDataFormat;
|
||||
|
||||
nsString mResult;
|
||||
PRUint16 mReadyState;
|
||||
|
@ -137,9 +150,8 @@ protected:
|
|||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
|
||||
PRUint64 mReadTotal;
|
||||
PRInt64 mReadTotal;
|
||||
PRUint64 mReadTransferred;
|
||||
PRPackedBool mReadComplete;
|
||||
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadEndListener;
|
||||
};
|
||||
|
|
|
@ -20,272 +20,286 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=414796
|
|||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var testCounter = 0;
|
||||
const minFileSize = 20000;
|
||||
var fileNum = 1;
|
||||
var testRanCounter = 0;
|
||||
var expectedTestCount = 0;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Write a test file > 8192 characters
|
||||
|
||||
is(FileReader.EMPTY, 0, "correct EMPTY value");
|
||||
is(FileReader.LOADING, 1, "correct LOADING value");
|
||||
is(FileReader.DONE, 2, "correct DONE value");
|
||||
|
||||
var testData = "asdfblahqwer";
|
||||
for (var i = 0; i < 10; i++) {
|
||||
testData = testData + testData;
|
||||
// Create strings containing data we'll test with. We'll want long
|
||||
// strings to ensure they span multiple buffers while loading
|
||||
var testTextData = "asd b\tlah\u1234w\u00a0r";
|
||||
while (testTextData.length < minFileSize) {
|
||||
testTextData = testTextData + testTextData;
|
||||
}
|
||||
var testData2 = testData + "a";
|
||||
var testData3 = testData + "as";
|
||||
|
||||
//Ensure we have different sizes of data for thoroughly testing data URI retrieval
|
||||
is(testData.length % 3, 0, "Need to have data length % 3 == 0");
|
||||
is(testData2.length % 3, 1, "Need to have data length % 3 == 1");
|
||||
is(testData3.length % 3, 2, "Need to have data lenght % 3 == 2");
|
||||
|
||||
//Create UTF data that should be the same for UTF-16
|
||||
var utf16Data = "\0a\0s\0d\0f\0b\0l\0a\0h\0q\0w\0e\0r";
|
||||
for (var i = 0; i < 10; i++) {
|
||||
utf16Data = utf16Data + utf16Data;
|
||||
var testASCIIData = "abcdef 123456\n";
|
||||
while (testASCIIData.length < minFileSize) {
|
||||
testASCIIData = testASCIIData + testASCIIData;
|
||||
}
|
||||
var utf16File = createFileWithData(utf16Data, "01");
|
||||
|
||||
//Create UTF data that should be the same for UTF-32
|
||||
var utf32Data = "\0\0\0a\0\0\0s\0\0\0d\0\0\0f\0\0\0b\0\0\0l\0\0\0a\0\0\0h\0\0\0q\0\0\0w\0\0\0e\0\0\0r";
|
||||
for (var i = 0; i < 10; i++) {
|
||||
utf32Data = utf32Data + utf32Data;
|
||||
var testBinaryData = "";
|
||||
for (var i = 0; i < 256; i++) {
|
||||
testBinaryData += String.fromCharCode(i);
|
||||
}
|
||||
while (testBinaryData.length < minFileSize) {
|
||||
testBinaryData = testBinaryData + testBinaryData;
|
||||
}
|
||||
var utf32File = createFileWithData(utf32Data, "001");
|
||||
|
||||
//Obtain a variety of encodings so we can test async return values
|
||||
var file = createFileWithData(testData, "00");
|
||||
var domFileData = file.getAsDataURL();
|
||||
var domFileBinary = file.getAsBinary();
|
||||
|
||||
var domFileBinary2 = utf16File.getAsBinary();
|
||||
var domFileBinary3 = utf32File.getAsBinary();
|
||||
|
||||
var request1 = new FileReader();
|
||||
is(request1.readyState, FileReader.EMPTY, "correct initial readyState");
|
||||
request1.onload = handleTextISO1;
|
||||
request1.readAsText(file, "iso-8859-1");
|
||||
is(request1.readyState, FileReader.LOADING, "correct loading readyState");
|
||||
|
||||
var request2 = new FileReader();
|
||||
request2.onload = handleTextUTF8;
|
||||
request2.readAsText(file);
|
||||
|
||||
var request3 = new FileReader();
|
||||
request3.onload = handleTextUTF8;
|
||||
request3.readAsText(file, "");
|
||||
|
||||
var request4 = new FileReader();
|
||||
request4.onload = handleTextUTF8;
|
||||
request4.readAsText(file, "UTF-8");
|
||||
|
||||
//Test a variety of encodings, and make sure they work properly
|
||||
//Also, test a variety of the same calls with different numbers of arguments
|
||||
var request5 = new FileReader();
|
||||
request5.onload = handleTextUTF16;
|
||||
request5.readAsText(utf16File, "UTF-16");
|
||||
|
||||
var request6 = new FileReader();
|
||||
request6.onload = handleTextUTF32;
|
||||
request6.readAsText(utf32File, "UTF-32");
|
||||
|
||||
//Test binary data accessor
|
||||
var request7 = new FileReader();
|
||||
is(request7.readyState, FileReader.EMPTY, "correct initial readyState");
|
||||
request7.onload = handleDataBinary;
|
||||
request7.readAsBinaryString(file);
|
||||
is(request7.readyState, FileReader.LOADING, "correct loading readyState");
|
||||
|
||||
var request71 = new FileReader();
|
||||
request71.onload = handleDataBinary16;
|
||||
request71.readAsBinaryString(utf16File);
|
||||
|
||||
var request72 = new FileReader();
|
||||
request72.onload = handleDataBinary32;
|
||||
request72.readAsBinaryString(utf32File);
|
||||
|
||||
//Test data URI encoding on differing file sizes
|
||||
//Testing data URI when length % 3 == 0
|
||||
var request8 = new FileReader();
|
||||
request8.onload = handleDataURI;
|
||||
request8.readAsDataURL(file);
|
||||
|
||||
//Testing data URI when length % 3 == 1
|
||||
var file2 = createFileWithData(testData2, "02");
|
||||
var domFileData1 = file2.getAsDataURL();
|
||||
|
||||
var request9 = new FileReader();
|
||||
request9.onload = handleDataURI1;
|
||||
request9.readAsDataURL(file2);
|
||||
|
||||
//Testing data URI when length % 3 == 2
|
||||
var file3 = createFileWithData(testData3, "03");
|
||||
var domFileData2 = file3.getAsDataURL();
|
||||
|
||||
var request10 = new FileReader();
|
||||
request10.onload = handleDataURI2;
|
||||
request10.readAsDataURL(file3);
|
||||
|
||||
//Test asynchronous property of file access
|
||||
var globalVar = 0;
|
||||
var request105 = new FileReader();
|
||||
request105.onload = incGlobalVar;
|
||||
request105.readAsText(file, "");
|
||||
is(globalVar, 0, "testing to make sure getAsText doesn't block subsequent execution");
|
||||
|
||||
//Create second file for testing cancelReads()
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
|
||||
var testFile4 = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
testFile4.append("testfile04");
|
||||
var outStream4 = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
outStream4.init(testFile4, 0x02 | 0x08 | 0x20, 0666, 0);
|
||||
outStream4.write(testData, testData.length);
|
||||
outStream4.close();
|
||||
//Set up files for testing
|
||||
var asciiFile = createFileWithData(testASCIIData);
|
||||
var binaryFile = createFileWithData(testBinaryData);
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
fileList.value = testFile4.path;
|
||||
var file4 = fileList.files[0];
|
||||
fileList.value = "/none/existing/path/fileAPI/testing";
|
||||
var nonExistingFile = fileList.files[0];
|
||||
|
||||
var request11 = new FileReader();
|
||||
request11.onabort = handleCancel;
|
||||
request11.readAsText(file4);
|
||||
request11.abort();
|
||||
// Test that plain reading works and fires events as expected, both
|
||||
// for text and binary reading
|
||||
var onloadHasRunText = false;
|
||||
var onloadStartHasRunText = false;
|
||||
r = new FileReader();
|
||||
is(r.readyState, FileReader.EMPTY, "correct initial text readyState");
|
||||
r.onload = getLoadHandler(testASCIIData, testASCIIData.length, "plain reading");
|
||||
r.addEventListener("load", function() { onloadHasRunText = true }, false);
|
||||
r.addEventListener("loadstart", function() { onloadStartHasRunText = true }, false);
|
||||
r.readAsText(asciiFile);
|
||||
is(r.readyState, FileReader.LOADING, "correct loading text readyState");
|
||||
is(onloadHasRunText, false, "text loading must be async");
|
||||
is(onloadStartHasRunText, true, "text loadstart should fire sync");
|
||||
expectedTestCount++;
|
||||
|
||||
//Test error handling - Note: currently throws exceptions
|
||||
/*testFile4.permissions = 0;
|
||||
var request12 = new FileReader();
|
||||
request12.onerror = handleSecurityError;
|
||||
request12.readAsText(file4, "");
|
||||
var onloadHasRunBinary = false;
|
||||
var onloadStartHasRunBinary = false;
|
||||
r = new FileReader();
|
||||
is(r.readyState, FileReader.EMPTY, "correct initial binary readyState");
|
||||
r.addEventListener("load", function() { onloadHasRunBinary = true }, false);
|
||||
r.addEventListener("loadstart", function() { onloadStartHasRunBinary = true }, false);
|
||||
r.readAsBinaryString(binaryFile);
|
||||
r.onload = getLoadHandler(testBinaryData, testBinaryData.length, "binary reading");
|
||||
is(r.readyState, FileReader.LOADING, "correct loading binary readyState");
|
||||
is(onloadHasRunBinary, false, "binary loading must be async");
|
||||
is(onloadStartHasRunBinary, true, "binary loadstart should fire sync");
|
||||
expectedTestCount++;
|
||||
|
||||
testFile4.remove(false);
|
||||
var request13 = new FileReader();
|
||||
request13.onerror = handleNotFoundError;
|
||||
request13.readAsText(file4, "");*/
|
||||
|
||||
//Corresponding callback functions
|
||||
function incGlobalVar(fileAsText) {
|
||||
globalVar++;
|
||||
// Test a variety of encodings, and make sure they work properly
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testASCIIData, testASCIIData.length, "no encoding reading");
|
||||
r.readAsText(asciiFile, "");
|
||||
expectedTestCount++;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testASCIIData, testASCIIData.length, "iso8859 reading");
|
||||
r.readAsText(asciiFile, "iso-8859-1");
|
||||
expectedTestCount++;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testTextData,
|
||||
convertToUTF8(testTextData).length,
|
||||
"utf8 reading");
|
||||
r.readAsText(createFileWithData(convertToUTF8(testTextData)), "utf8");
|
||||
expectedTestCount++;
|
||||
|
||||
r = new FileReader();
|
||||
r.readAsText(createFileWithData(convertToUTF16(testTextData)), "utf-16");
|
||||
r.onload = getLoadHandler(testTextData,
|
||||
convertToUTF16(testTextData).length,
|
||||
"utf16 reading");
|
||||
expectedTestCount++;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testTextData,
|
||||
convertToUTF32(testTextData).length,
|
||||
"utf32 reading");
|
||||
r.readAsText(createFileWithData(convertToUTF32(testTextData)), "UTF-32");
|
||||
expectedTestCount++;
|
||||
|
||||
|
||||
// Test reusing a FileReader to read multiple times
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testASCIIData,
|
||||
testASCIIData.length,
|
||||
"to-be-reused reading text")
|
||||
var makeAnotherReadListener = function(event) {
|
||||
r = event.target;
|
||||
r.removeEventListener("load", makeAnotherReadListener, false);
|
||||
r.onload = getLoadHandler(testASCIIData,
|
||||
testASCIIData.length,
|
||||
"reused reading text");
|
||||
r.readAsText(asciiFile);
|
||||
};
|
||||
r.addEventListener("load", makeAnotherReadListener, false);
|
||||
r.readAsText(asciiFile);
|
||||
expectedTestCount += 2;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(testBinaryData,
|
||||
testBinaryData.length,
|
||||
"to-be-reused reading binary")
|
||||
var makeAnotherReadListener2 = function(event) {
|
||||
r = event.target;
|
||||
r.removeEventListener("load", makeAnotherReadListener2, false);
|
||||
r.onload = getLoadHandler(testBinaryData,
|
||||
testBinaryData.length,
|
||||
"reused reading binary");
|
||||
r.readAsBinaryString(binaryFile);
|
||||
};
|
||||
r.addEventListener("load", makeAnotherReadListener2, false);
|
||||
r.readAsBinaryString(binaryFile);
|
||||
expectedTestCount += 2;
|
||||
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(convertToDataURL(testBinaryData),
|
||||
testBinaryData.length,
|
||||
"to-be-reused reading data url")
|
||||
var makeAnotherReadListener3 = function(event) {
|
||||
r = event.target;
|
||||
r.removeEventListener("load", makeAnotherReadListener3, false);
|
||||
r.onload = getLoadHandler(convertToDataURL(testBinaryData),
|
||||
testBinaryData.length,
|
||||
"reused reading data url");
|
||||
r.readAsDataURL(binaryFile);
|
||||
};
|
||||
r.addEventListener("load", makeAnotherReadListener3, false);
|
||||
r.readAsDataURL(binaryFile);
|
||||
expectedTestCount += 2;
|
||||
|
||||
|
||||
//Test data-URI encoding on differing file sizes
|
||||
dataurldata = testBinaryData.substr(0, testBinaryData.length -
|
||||
testBinaryData.length % 3);
|
||||
is(dataurldata.length % 3, 0, "Want to test data with length % 3 == 0");
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(convertToDataURL(dataurldata),
|
||||
dataurldata.length,
|
||||
"dataurl reading, %3 = 0");
|
||||
r.readAsDataURL(createFileWithData(dataurldata));
|
||||
expectedTestCount++;
|
||||
|
||||
dataurldata = testBinaryData.substr(0, testBinaryData.length - 2 -
|
||||
testBinaryData.length % 3);
|
||||
is(dataurldata.length % 3, 1, "Want to test data with length % 3 == 1");
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(convertToDataURL(dataurldata),
|
||||
dataurldata.length,
|
||||
"dataurl reading, %3 = 1");
|
||||
r.readAsDataURL(createFileWithData(dataurldata));
|
||||
expectedTestCount++;
|
||||
|
||||
dataurldata = testBinaryData.substr(0, testBinaryData.length - 1 -
|
||||
testBinaryData.length % 3);
|
||||
is(dataurldata.length % 3, 2, "Want to test data with length % 3 == 2");
|
||||
r = new FileReader();
|
||||
r.onload = getLoadHandler(convertToDataURL(dataurldata),
|
||||
dataurldata.length,
|
||||
"dataurl reading, %3 = 2");
|
||||
r.readAsDataURL(createFileWithData(dataurldata));
|
||||
expectedTestCount++;
|
||||
|
||||
|
||||
// Test abort()
|
||||
var abortHasRun = false;
|
||||
var loadEndHasRun = false;
|
||||
r = new FileReader();
|
||||
r.onabort = function (event) {
|
||||
is(abortHasRun, false, "abort should only fire once");
|
||||
is(loadEndHasRun, false, "loadend shouldn't have fired yet");
|
||||
abortHasRun = true;
|
||||
is(event.target.readyState, FileReader.DONE, "should be DONE while firing onabort");
|
||||
is(event.target.error.code, FileError.ABORT_ERR, "error code set to ABORT for aborted reads");
|
||||
is(event.target.result, null, "file data should be null on aborted reads");
|
||||
}
|
||||
|
||||
function handleCancel(event) {
|
||||
var fileAsText = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error.code, FileError.ABORT_ERR, "error code set to CANCELED for canceled reads");
|
||||
is(fileAsText, null, "file data should be null on canceled reads");
|
||||
testHasRun();
|
||||
r.onloadend = function (event) {
|
||||
is(abortHasRun, true, "abort should fire before loadend");
|
||||
is(loadEndHasRun, false, "loadend should only fire once");
|
||||
loadEndHasRun = true;
|
||||
is(event.target.readyState, FileReader.DONE, "should be DONE while firing onabort");
|
||||
is(event.target.error.code, FileError.ABORT_ERR, "error code set to ABORT for aborted reads");
|
||||
is(event.target.result, null, "file data should be null on aborted reads");
|
||||
}
|
||||
r.onload = function() { ok(false, "load should not fire for aborted reads") };
|
||||
r.onerror = function() { ok(false, "error should not fire for aborted reads") };
|
||||
r.onprogress = function() { ok(false, "progress should not fire for aborted reads") };
|
||||
r.abort();
|
||||
is(abortHasRun, false, "abort() is a no-op unless loading");
|
||||
r.readAsText(asciiFile);
|
||||
r.abort();
|
||||
is(abortHasRun, true, "abort should fire sync");
|
||||
is(loadEndHasRun, true, "loadend should fire sync");
|
||||
|
||||
function handleTextISO1(event) {
|
||||
is(event.target.readyState, FileReader.DONE, "correct final readyState");
|
||||
var fileAsText = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error, null, "error code set to null for successful data accesses");
|
||||
is(testData.length, fileAsText.length, "iso-1 async length should match testdata");
|
||||
is(testData, fileAsText, "iso-1 async string result should match testdata");
|
||||
testHasRun();
|
||||
// Test calling readAsX to cause abort()
|
||||
var reuseAbortHasRun = false;
|
||||
r = new FileReader();
|
||||
r.onabort = function (event) {
|
||||
is(reuseAbortHasRun, false, "abort should only fire once");
|
||||
reuseAbortHasRun = true;
|
||||
is(event.target.readyState, FileReader.DONE, "should be DONE while firing onabort");
|
||||
is(event.target.error.code, FileError.ABORT_ERR, "error code set to ABORT for aborted reads");
|
||||
is(event.target.result, null, "file data should be null on aborted reads");
|
||||
}
|
||||
r.onload = function() { ok(false, "load should not fire for aborted reads") };
|
||||
r.abort();
|
||||
is(reuseAbortHasRun, false, "abort() is a no-op unless loading");
|
||||
r.readAsText(asciiFile);
|
||||
r.readAsText(asciiFile);
|
||||
is(reuseAbortHasRun, true, "abort should fire sync");
|
||||
r.onload = getLoadHandler(testASCIIData, testASCIIData.length, "reuse-as-abort reading");
|
||||
expectedTestCount++;
|
||||
|
||||
function handleTextUTF8(event) {
|
||||
var fileAsUTF8 = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error, null, "error code set to null for successful data accesses");
|
||||
is(testData.length, fileAsUTF8.length, "UTF-8 async length should match testdata");
|
||||
is(testData, fileAsUTF8, "UTF-8 async string result should match testdata");
|
||||
testHasRun();
|
||||
|
||||
// Test reading from non-existing files
|
||||
r = new FileReader();
|
||||
var didThrow = false;
|
||||
try {
|
||||
r.readAsDataURL(nonExistingFile);
|
||||
} catch(ex) {
|
||||
didThrow = true;
|
||||
}
|
||||
// Once this test passes, we shoud test that onerror gets called and
|
||||
// that the FileReader object is in the right state during that call.
|
||||
todo(!didThrow, "shouldn't throw when opening non-existing file, should fire error instead");
|
||||
|
||||
function handleTextUTF16(event) {
|
||||
var fileAsUTF16 = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error, null, "error code set to SUCCESS for successful data accesses");
|
||||
is(testData.length, fileAsUTF16.length, "UTF-16 async length should match testdata");
|
||||
is(testData, fileAsUTF16, "UTF-16 async string result should match testdata");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleTextUTF32(event) {
|
||||
var fileAsUTF32 = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error, null, "error code set to SUCCESS for successful data accesses");
|
||||
is(testData.length, fileAsUTF32.length, "UTF-32 async length should match testdata");
|
||||
is(testData, fileAsUTF32, "UTF-32 async string result should match testdata");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
//Tests dataURI.length % 3 == 0
|
||||
function handleDataURI(event) {
|
||||
var fileAsDataURI = event.target.result;
|
||||
is(domFileData.length, fileAsDataURI.length, "data URI async length should match dom file data");
|
||||
is(domFileData, fileAsDataURI, "data URI async string result should match dom file data");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
//Tests dataURI.length % 3 == 1
|
||||
function handleDataURI1(event) {
|
||||
var fileAsDataURI = event.target.result;
|
||||
is(domFileData1.length, fileAsDataURI.length, "data URI async length should match dom file data1");
|
||||
is(domFileData1, fileAsDataURI, "data URI async string result should match dom file data1");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
//Tests dataURI.length % 3 == 2
|
||||
function handleDataURI2(event) {
|
||||
var fileAsDataURI = event.target.result;
|
||||
is(domFileData2.length, fileAsDataURI.length, "data URI async length should match dom file data2");
|
||||
is(domFileData2, fileAsDataURI, "data URI async string result should match dom file data2");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleDataBinary(event) {
|
||||
is(event.target.readyState, FileReader.DONE, "correct final readyState");
|
||||
var fileAsBinary = event.target.result;
|
||||
is(domFileBinary.length, fileAsBinary.length, "binary data async length should match dom file binary");
|
||||
is(domFileBinary, fileAsBinary, "binary data async string result should match dom file binary");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleDataBinary16(event) {
|
||||
var fileAsBinary = event.target.result;
|
||||
is(domFileBinary2.length, fileAsBinary.length, "binary data async length should match dom file binary16");
|
||||
is(domFileBinary2, fileAsBinary, "binary data async string result should match dom file binary16");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleDataBinary32(event) {
|
||||
var fileAsBinary = event.target.result;
|
||||
is(domFileBinary3.length, fileAsBinary.length, "binary data async length should match dom file binary32");
|
||||
is(domFileBinary3, fileAsBinary, "binary data async string result should match dom file binary32");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleSecurityError(event) {
|
||||
var fileAsText = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error.code, FileError.SECURITY_ERR, "code for file security error should have value 18");
|
||||
is(fileAsText, null, "file content should be null when error is encountered");
|
||||
testHasRun();
|
||||
}
|
||||
|
||||
function handleNotFoundError(event) {
|
||||
var fileAsText = event.target.result;
|
||||
var error = event.target.error;
|
||||
is(error.code, FileError.NOT_FOUND_ERR, "code for file not found error should have value 8");
|
||||
is(fileAsText, null, "file content should be null when error is encountered");
|
||||
testHasRun();
|
||||
function getLoadHandler(expectedResult, expectedLength, testName) {
|
||||
return function (event) {
|
||||
is(event.target.readyState, FileReader.DONE,
|
||||
"readyState in test " + testName);
|
||||
is(event.target.error, null,
|
||||
"no error in test " + testName);
|
||||
is(event.target.result, expectedResult,
|
||||
"result in test " + testName);
|
||||
is(event.lengthComputable, true,
|
||||
"lengthComputable in test " + testName);
|
||||
is(event.loaded, expectedLength,
|
||||
"lengthComputable in test " + testName);
|
||||
is(event.total, expectedLength,
|
||||
"lengthComputable in test " + testName);
|
||||
testHasRun();
|
||||
}
|
||||
}
|
||||
|
||||
function testHasRun() {
|
||||
if (++testCounter == 13) SimpleTest.finish();
|
||||
//alert(testRanCounter);
|
||||
++testRanCounter;
|
||||
if (testRanCounter == expectedTestCount) {
|
||||
is(onloadHasRunText, true, "onload text should have fired by now");
|
||||
is(onloadHasRunBinary, true, "onload binary should have fired by now");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function createFileWithData(fileData, fileNum) {
|
||||
function createFileWithData(fileData) {
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
testFile.append("testfile" + fileNum);
|
||||
testFile.append("fileAPItestfile" + fileNum);
|
||||
fileNum++;
|
||||
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
|
@ -298,6 +312,32 @@ function createFileWithData(fileData, fileNum) {
|
|||
return fileList.files[0];
|
||||
}
|
||||
|
||||
function convertToUTF16(s) {
|
||||
res = "";
|
||||
for (var i = 0; i < s.length; ++i) {
|
||||
c = s.charCodeAt(i);
|
||||
res += String.fromCharCode(c >>> 8, c & 255);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function convertToUTF32(s) {
|
||||
res = "";
|
||||
for (var i = 0; i < s.length; ++i) {
|
||||
c = s.charCodeAt(i);
|
||||
res += "\0\0" + String.fromCharCode(c >>> 8, c & 255);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function convertToUTF8(s) {
|
||||
return unescape(encodeURIComponent(s));
|
||||
}
|
||||
|
||||
function convertToDataURL(s) {
|
||||
return "data:application/octet-stream;base64," + btoa(s);
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body> </html>
|
||||
|
|
|
@ -58,7 +58,7 @@ var asyncXHR = {
|
|||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
// network offline
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xml" href="#bug"?>
|
||||
<!DOCTYPE doc [
|
||||
<!ATTLIST xsl:transform
|
||||
id ID #REQUIRED>
|
||||
]>
|
||||
<doc>
|
||||
<xsl:transform
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="2.0"
|
||||
id="bug">
|
||||
<xsl:variable name="v0">
|
||||
<xsl:for-each select="$v0" />
|
||||
</xsl:variable>
|
||||
<xsl:template name="t2" match="/">
|
||||
<xsl:copy-of select="number($v0)" />
|
||||
</xsl:template>
|
||||
</xsl:transform>
|
||||
|
||||
<e1 />
|
||||
|
||||
</doc>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xml" href="#bug"?>
|
||||
<!DOCTYPE doc [
|
||||
<!ATTLIST xsl:transform
|
||||
id ID #REQUIRED>
|
||||
]>
|
||||
<doc>
|
||||
<xsl:transform
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:exslstrings="http://exslt.org/strings"
|
||||
version="2.0"
|
||||
id="bug">
|
||||
<xsl:variable name="v0" select="$v0" />
|
||||
<xsl:template name="t2" match="/">
|
||||
<xsl:param name="p0" select="exslstrings:tokenize('1234','foobar')" />
|
||||
<xsl:copy-of select="round($v0)" />
|
||||
</xsl:template>
|
||||
</xsl:transform>
|
||||
</doc>
|
|
@ -6,3 +6,5 @@ load 406106-1.html
|
|||
load 483444.xml
|
||||
load 485217.xml
|
||||
load 485286.xml
|
||||
load 528300.xml
|
||||
load 528488.xml
|
||||
|
|
|
@ -387,7 +387,9 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
rv = mParams[0]->evaluateToString(aContext, src);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
double start = evaluateToNumber(mParams[1], aContext);
|
||||
double start;
|
||||
rv = evaluateToNumber(mParams[1], aContext, &start);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// check for NaN or +/-Inf
|
||||
if (Double::isNaN(start) ||
|
||||
|
@ -402,8 +404,10 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
|
||||
double end;
|
||||
if (mParams.Length() == 3) {
|
||||
end = start + evaluateToNumber(mParams[2],
|
||||
aContext);
|
||||
rv = evaluateToNumber(mParams[2], aContext, &end);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
end += start;
|
||||
if (Double::isNaN(end) || end < 0) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
|
@ -531,7 +535,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
{
|
||||
double res;
|
||||
if (!mParams.IsEmpty()) {
|
||||
res = evaluateToNumber(mParams[0], aContext);
|
||||
rv = evaluateToNumber(mParams[0], aContext, &res);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
nsAutoString resultStr;
|
||||
|
@ -543,7 +548,10 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case ROUND:
|
||||
{
|
||||
double dbl = evaluateToNumber(mParams[0], aContext);
|
||||
double dbl;
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
|
||||
if (Double::isNeg(dbl) && dbl >= -0.5) {
|
||||
dbl *= 0;
|
||||
|
@ -557,7 +565,10 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case FLOOR:
|
||||
{
|
||||
double dbl = evaluateToNumber(mParams[0], aContext);
|
||||
double dbl;
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) &&
|
||||
!Double::isInfinite(dbl) &&
|
||||
!(dbl == 0 && Double::isNeg(dbl))) {
|
||||
|
@ -568,7 +579,10 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
}
|
||||
case CEILING:
|
||||
{
|
||||
double dbl = evaluateToNumber(mParams[0], aContext);
|
||||
double dbl;
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
|
||||
if (Double::isNeg(dbl) && dbl > -1) {
|
||||
dbl *= 0;
|
||||
|
|
|
@ -330,7 +330,8 @@ protected:
|
|||
/*
|
||||
* Evaluates the given Expression and converts its result to a number.
|
||||
*/
|
||||
static double evaluateToNumber(Expr* aExpr, txIEvalContext* aContext);
|
||||
static nsresult evaluateToNumber(Expr* aExpr, txIEvalContext* aContext,
|
||||
double* aResult);
|
||||
|
||||
/*
|
||||
* Evaluates the given Expression and converts its result to a NodeSet.
|
||||
|
|
|
@ -52,15 +52,19 @@
|
|||
/*
|
||||
* Evaluates the given Expression and converts its result to a number.
|
||||
*/
|
||||
double FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext)
|
||||
// static
|
||||
nsresult
|
||||
FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext,
|
||||
double* aResult)
|
||||
{
|
||||
NS_ASSERTION(aExpr, "missing expression");
|
||||
nsRefPtr<txAExprResult> exprResult;
|
||||
nsresult rv = aExpr->evaluate(aContext, getter_AddRefs(exprResult));
|
||||
if (NS_FAILED(rv))
|
||||
return Double::NaN;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return exprResult->numberValue();
|
||||
*aResult = exprResult->numberValue();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -479,7 +479,11 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
}
|
||||
case eNUMBER:
|
||||
{
|
||||
invokeParam.val.d = evaluateToNumber(expr, aContext);
|
||||
double dbl;
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
invokeParam.val.d = dbl;
|
||||
break;
|
||||
}
|
||||
case eSTRING:
|
||||
|
|
|
@ -99,10 +99,13 @@ txExecutionState::txExecutionState(txStylesheet* aStylesheet,
|
|||
mKeyHash(aStylesheet->getKeyMap()),
|
||||
mDisableLoads(aDisableLoads)
|
||||
{
|
||||
MOZ_COUNT_CTOR(txExecutionState);
|
||||
}
|
||||
|
||||
txExecutionState::~txExecutionState()
|
||||
{
|
||||
MOZ_COUNT_DTOR(txExecutionState);
|
||||
|
||||
delete mResultHandler;
|
||||
delete mLocalVariables;
|
||||
delete mEvalContext;
|
||||
|
@ -271,9 +274,9 @@ txExecutionState::getVariable(PRInt32 aNamespace, nsIAtom* aLName,
|
|||
txVariableMap* oldVars = mLocalVariables;
|
||||
mLocalVariables = nsnull;
|
||||
rv = var->mExpr->evaluate(getEvalContext(), &aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mLocalVariables = oldVars;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
nsAutoPtr<txRtfHandler> rtfHandler(new txRtfHandler);
|
||||
|
|
|
@ -84,10 +84,11 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
double value;
|
||||
txExpandedName formatName;
|
||||
|
||||
value = evaluateToNumber(mParams[0], aContext);
|
||||
nsresult rv = evaluateToNumber(mParams[0], aContext, &value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString formatStr;
|
||||
nsresult rv = mParams[1]->evaluateToString(aContext, formatStr);
|
||||
rv = mParams[1]->evaluateToString(aContext, formatStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mParams.Length() == 3) {
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
class txVariableMap {
|
||||
public:
|
||||
txVariableMap();
|
||||
~txVariableMap();
|
||||
|
||||
nsresult bindVariable(const txExpandedName& aName, txAExprResult* aValue);
|
||||
|
@ -59,9 +60,17 @@ private:
|
|||
};
|
||||
|
||||
|
||||
inline
|
||||
txVariableMap::txVariableMap()
|
||||
{
|
||||
MOZ_COUNT_CTOR(txVariableMap);
|
||||
}
|
||||
|
||||
inline
|
||||
txVariableMap::~txVariableMap()
|
||||
{
|
||||
MOZ_COUNT_DTOR(txVariableMap);
|
||||
|
||||
txExpandedNameMap<txAExprResult>::iterator iter(mMap);
|
||||
while (iter.next()) {
|
||||
txAExprResult* res = iter.value();
|
||||
|
|
|
@ -32,15 +32,15 @@ function run_test() {
|
|||
|
||||
// ... and the first one has
|
||||
do_test_pending();
|
||||
do_timeout(10, "verifyFirstExpiration();");
|
||||
do_timeout(10, verifyFirstExpiration);
|
||||
|
||||
// ... and that the short-term one will
|
||||
do_test_pending();
|
||||
do_timeout(200, "verifyExpiration();");
|
||||
do_timeout(200, verifyExpiration);
|
||||
|
||||
// clean up
|
||||
do_test_pending();
|
||||
do_timeout(300, "end_test();");
|
||||
do_timeout(300, end_test);
|
||||
}
|
||||
|
||||
function verifyFirstExpiration() {
|
||||
|
|
|
@ -114,7 +114,7 @@ function run_test() {
|
|||
do_test_pending(); // for 'cleared' notification
|
||||
pm.removeAll();
|
||||
|
||||
do_timeout(100, "cleanup();");
|
||||
do_timeout(100, cleanup);
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
|
|
|
@ -63,10 +63,6 @@
|
|||
#include "nsNativeUConvService.h"
|
||||
#endif
|
||||
|
||||
// Pattern of cached, commonly used, single byte decoder
|
||||
#define NS_1BYTE_CODER_PATTERN "ISO-8859"
|
||||
#define NS_1BYTE_CODER_PATTERN_LEN 8
|
||||
|
||||
// Class nsCharsetConverterManager [implementation]
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsCharsetConverterManager,
|
||||
|
@ -75,7 +71,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsCharsetConverterManager,
|
|||
nsCharsetConverterManager::nsCharsetConverterManager()
|
||||
: mDataBundle(NULL)
|
||||
, mTitleBundle(NULL)
|
||||
, mDecoderHashMutex("nsCharsetConverterManager mDecoderHashMutex")
|
||||
{
|
||||
#ifdef MOZ_USE_NATIVE_UCONV
|
||||
mNativeUC = do_GetService(NS_NATIVE_UCONV_SERVICE_CONTRACT_ID);
|
||||
|
@ -88,13 +83,6 @@ nsCharsetConverterManager::~nsCharsetConverterManager()
|
|||
NS_IF_RELEASE(mTitleBundle);
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::Init()
|
||||
{
|
||||
if (!mDecoderHash.Init())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCharsetConverterManager::RegisterConverterManagerData()
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -265,23 +253,8 @@ nsCharsetConverterManager::GetUnicodeDecoderRaw(const char * aSrc,
|
|||
NS_NAMED_LITERAL_CSTRING(contractbase, NS_UNICODEDECODER_CONTRACTID_BASE);
|
||||
nsDependentCString src(aSrc);
|
||||
|
||||
if (!strncmp(aSrc, NS_1BYTE_CODER_PATTERN, NS_1BYTE_CODER_PATTERN_LEN))
|
||||
{
|
||||
mozilla::MutexAutoLock autoLock(mDecoderHashMutex);
|
||||
// Single byte decoders don't hold state. Optimize by using a service, and
|
||||
// cache it in our hash to avoid repeated trips through the service manager.
|
||||
if (!mDecoderHash.Get(aSrc, getter_AddRefs(decoder))) {
|
||||
decoder = do_GetService(PromiseFlatCString(contractbase + src).get(),
|
||||
decoder = do_CreateInstance(PromiseFlatCString(contractbase + src).get(),
|
||||
&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDecoderHash.Put(aSrc, decoder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
decoder = do_CreateInstance(PromiseFlatCString(contractbase + src).get(),
|
||||
&rv);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_UCONV_NOCONV);
|
||||
|
||||
decoder.forget(aResult);
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
nsCharsetConverterManager();
|
||||
virtual ~nsCharsetConverterManager();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
private:
|
||||
|
||||
nsIStringBundle * mDataBundle;
|
||||
|
@ -68,9 +66,6 @@ private:
|
|||
nsCOMPtr<nsINativeUConvService> mNativeUC;
|
||||
#endif
|
||||
|
||||
nsInterfaceHashtable<nsCharPtrHashKey, nsIUnicodeDecoder> mDecoderHash;
|
||||
mozilla::Mutex mDecoderHashMutex;
|
||||
|
||||
nsresult LoadExtensibleBundle(const char * aRegistryKey,
|
||||
nsIStringBundle ** aResult);
|
||||
|
||||
|
|
|
@ -610,7 +610,7 @@ nsConverterManagerDataRegister(nsIComponentManager* aCompMgr,
|
|||
return nsCharsetConverterManager::RegisterConverterManagerData();
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCharsetConverterManager, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCharsetConverterManager)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextToSubURI)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF8ConverterService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCharsetAlias2)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
This is
|
||||
/home/db48x/moz/mozilla-central/js/ctypes/libffi/doc/libffi.info,
|
||||
produced by makeinfo version 4.13 from
|
||||
/home/db48x/moz/mozilla-central/js/ctypes/libffi/doc/libffi.texi.
|
||||
This is doc/libffi.info, produced by makeinfo version 4.12 from
|
||||
./doc/libffi.texi.
|
||||
|
||||
This manual is for Libffi, a portable foreign-function interface
|
||||
library.
|
||||
|
@ -518,18 +516,18 @@ Index
|
|||
|
||||
|
||||
Tag Table:
|
||||
Node: Top766
|
||||
Node: Introduction1502
|
||||
Node: Using libffi3138
|
||||
Node: The Basics3573
|
||||
Node: Simple Example6180
|
||||
Node: Types7207
|
||||
Node: Primitive Types7490
|
||||
Node: Structures9310
|
||||
Node: Type Example10170
|
||||
Node: Multiple ABIs11393
|
||||
Node: The Closure API11764
|
||||
Node: Missing Features14684
|
||||
Node: Index15177
|
||||
Node: Top670
|
||||
Node: Introduction1406
|
||||
Node: Using libffi3042
|
||||
Node: The Basics3477
|
||||
Node: Simple Example6084
|
||||
Node: Types7111
|
||||
Node: Primitive Types7394
|
||||
Node: Structures9214
|
||||
Node: Type Example10074
|
||||
Node: Multiple ABIs11297
|
||||
Node: The Closure API11668
|
||||
Node: Missing Features14588
|
||||
Node: Index15081
|
||||
|
||||
End Tag Table
|
||||
|
|
|
@ -2218,6 +2218,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
getter_AddRefs(parentContent),
|
||||
&contentOffset, &target);
|
||||
|
||||
nsWeakFrame weakThis = this;
|
||||
if (NS_SUCCEEDED(result) && parentContent) {
|
||||
frameselection->HandleTableSelection(parentContent, contentOffset, target, me);
|
||||
} else {
|
||||
|
@ -2225,6 +2226,12 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
frameselection->HandleDrag(this, pt);
|
||||
}
|
||||
|
||||
// The frameselection object notifies selection listeners synchronously above
|
||||
// which might have killed us.
|
||||
if (!weakThis.IsAlive()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// get the nearest scrollframe
|
||||
nsIFrame* checkFrame = this;
|
||||
nsIScrollableFrame *scrollFrame = nsnull;
|
||||
|
|
|
@ -517,27 +517,24 @@ private:
|
|||
// used to keep track of how big our buffer is.
|
||||
nsIntSize mPluginSize;
|
||||
|
||||
// the scale between the actual instance plugin window and what
|
||||
// we want to scale it to.
|
||||
float mPluginScale;
|
||||
|
||||
// the element that was passed into SetAbsoluteScreenPosition().
|
||||
// This will be the element we use to determine which Window we draw into.
|
||||
nsCOMPtr<nsIDOMElement> mBlitParentElement;
|
||||
|
||||
// The absolute position on the screen to draw to.
|
||||
nsIntRect mAbsolutePosition;
|
||||
gfxRect mAbsolutePosition;
|
||||
|
||||
// The clip region that we should draw into.
|
||||
nsIntRect mAbsolutePositionClip;
|
||||
gfxRect mAbsolutePositionClip;
|
||||
|
||||
GC mXlibSurfGC;
|
||||
Window mBlitWindow;
|
||||
XImage *mSharedXImage;
|
||||
XShmSegmentInfo mSharedSegmentInfo;
|
||||
|
||||
PRBool SetupXShm();
|
||||
void ReleaseXShm();
|
||||
nsresult NativeImageDraw();
|
||||
void NativeImageDraw(NPRect* invalidRect = nsnull);
|
||||
PRBool UpdateVisibility();
|
||||
|
||||
#endif
|
||||
|
@ -1228,7 +1225,8 @@ nsObjectFrame::SetAbsoluteScreenPosition(nsIDOMElement* element,
|
|||
nsIDOMClientRect* clip)
|
||||
{
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
NS_ASSERTION(mInstanceOwner, "failed to get mInstanceOwner");
|
||||
if (!mInstanceOwner)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
return mInstanceOwner->SetAbsoluteScreenPosition(element, position, clip);
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -2419,7 +2417,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
|||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
mPluginSize = nsIntSize(0,0);
|
||||
mPluginScale = 1.0;
|
||||
mXlibSurfGC = None;
|
||||
mSharedXImage = nsnull;
|
||||
mSharedSegmentInfo.shmaddr = nsnull;
|
||||
#endif
|
||||
|
@ -2704,14 +2702,19 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocument(nsIDocument* *aDocument)
|
|||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
if (mObjectFrame && mBlitWindow && NS_SUCCEEDED(NativeImageDraw()))
|
||||
return NS_OK;
|
||||
#endif
|
||||
|
||||
if (!mObjectFrame || !invalidRect || !mWidgetVisible)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
PRBool simpleImageRender = PR_FALSE;
|
||||
mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
|
||||
&simpleImageRender);
|
||||
if (simpleImageRender) {
|
||||
NativeImageDraw(invalidRect);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
// Windowed plugins should not be calling NPN_InvalidateRect, but
|
||||
// Silverlight does and expects it to "work"
|
||||
|
@ -4792,15 +4795,18 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
|||
return;
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
// through to be able to paint the context passed in. This allows
|
||||
// us to handle plugins that do not self invalidate (slowly, but
|
||||
// accurately), and it allows us to reduce flicker.
|
||||
PRBool simpleImageRender = PR_FALSE;
|
||||
mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
|
||||
&simpleImageRender);
|
||||
if (simpleImageRender) {
|
||||
if (simpleImageRender) {
|
||||
gfxMatrix matrix = aContext->CurrentMatrix();
|
||||
if (!matrix.HasNonAxisAlignedTransform() &&
|
||||
NS_SUCCEEDED(NativeImageDraw()))
|
||||
return;
|
||||
}
|
||||
if (!matrix.HasNonAxisAlignedTransform())
|
||||
NativeImageDraw();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// to provide crisper and faster drawing.
|
||||
|
@ -4908,7 +4914,12 @@ static GdkWindow* GetClosestWindow(nsIDOMElement *element)
|
|||
void
|
||||
nsPluginInstanceOwner::ReleaseXShm()
|
||||
{
|
||||
if (mSharedSegmentInfo.shmaddr) {
|
||||
if (mXlibSurfGC) {
|
||||
XFreeGC(gdk_x11_get_default_xdisplay(), mXlibSurfGC);
|
||||
mXlibSurfGC = None;
|
||||
}
|
||||
|
||||
if (mSharedSegmentInfo.shmaddr) {
|
||||
XShmDetach(gdk_x11_get_default_xdisplay(), &mSharedSegmentInfo);
|
||||
shmdt(mSharedSegmentInfo.shmaddr);
|
||||
mSharedSegmentInfo.shmaddr = nsnull;
|
||||
|
@ -4929,6 +4940,13 @@ nsPluginInstanceOwner::SetupXShm()
|
|||
|
||||
ReleaseXShm();
|
||||
|
||||
mXlibSurfGC = XCreateGC(gdk_x11_get_default_xdisplay(),
|
||||
mBlitWindow,
|
||||
0,
|
||||
0);
|
||||
if (!mXlibSurfGC)
|
||||
return PR_FALSE;
|
||||
|
||||
// we use 16 as the default depth because that is the value of the
|
||||
// screen, but not the default X default depth.
|
||||
XVisualInfo vinfo;
|
||||
|
@ -4952,11 +4970,24 @@ nsPluginInstanceOwner::SetupXShm()
|
|||
if (!mSharedXImage)
|
||||
return PR_FALSE;
|
||||
|
||||
NS_ASSERTION(mSharedXImage->height, "do not call shmget with zero");
|
||||
mSharedSegmentInfo.shmid = shmget(IPC_PRIVATE,
|
||||
mSharedXImage->bytes_per_line * mSharedXImage->height,
|
||||
IPC_CREAT | 0777);
|
||||
if (mSharedSegmentInfo.shmid == -1) {
|
||||
XDestroyImage(mSharedXImage);
|
||||
mSharedXImage = nsnull;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mSharedXImage->data = static_cast<char*>(shmat(mSharedSegmentInfo.shmid, 0, 0));
|
||||
if (mSharedXImage->data == (char*) -1) {
|
||||
shmctl(mSharedSegmentInfo.shmid, IPC_RMID, 0);
|
||||
XDestroyImage(mSharedXImage);
|
||||
mSharedXImage = nsnull;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mSharedSegmentInfo.shmaddr = mSharedXImage->data;
|
||||
mSharedSegmentInfo.readOnly = False;
|
||||
|
||||
|
@ -4994,26 +5025,35 @@ nsPluginInstanceOwner::SetupXShm()
|
|||
//
|
||||
// Hopefully this API can die off in favor of a more robust plugin API.
|
||||
|
||||
nsresult
|
||||
nsPluginInstanceOwner::NativeImageDraw()
|
||||
void
|
||||
nsPluginInstanceOwner::NativeImageDraw(NPRect* invalidRect)
|
||||
{
|
||||
// if we haven't been positioned yet, ignore
|
||||
if (!mBlitParentElement)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// if the clip rect is zero, we have nothing to do.
|
||||
if (mAbsolutePositionClip.width == 0 || mAbsolutePositionClip.height == 0)
|
||||
return NS_OK;
|
||||
if (NSToIntCeil(mAbsolutePositionClip.Width()) == 0 ||
|
||||
NSToIntCeil(mAbsolutePositionClip.Height()) == 0)
|
||||
return;
|
||||
|
||||
// The flash plugin on Maemo n900 requires the width/height to be
|
||||
// even.
|
||||
PRInt32 absPosWidth = NSToIntCeil(mAbsolutePosition.Width()) / 2 * 2;
|
||||
PRInt32 absPosHeight = NSToIntCeil(mAbsolutePosition.Height()) / 2 * 2;
|
||||
|
||||
// if the plugin is hidden, nothing to draw.
|
||||
if (absPosHeight == 0 || absPosWidth == 0)
|
||||
return;
|
||||
|
||||
// if we haven't been setup before, or if the size of the plugin increased.
|
||||
if (!mSharedXImage ||
|
||||
mPluginSize.width != mAbsolutePosition.width ||
|
||||
mPluginSize.height != mAbsolutePosition.height) {
|
||||
|
||||
mPluginSize = nsIntSize(mAbsolutePosition.width, mAbsolutePosition.height);
|
||||
mPluginSize.width != absPosWidth ||
|
||||
mPluginSize.height != absPosHeight) {
|
||||
|
||||
mPluginSize = nsIntSize(absPosWidth, absPosHeight);
|
||||
|
||||
if (NS_FAILED(SetupXShm()))
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
NPWindow* window;
|
||||
|
@ -5072,62 +5112,61 @@ nsPluginInstanceOwner::NativeImageDraw()
|
|||
imageExpose.translateX = 0;
|
||||
imageExpose.translateY = 0;
|
||||
|
||||
imageExpose.scaleX = mPluginScale;
|
||||
imageExpose.scaleY = mPluginScale;
|
||||
if (window->width == 0)
|
||||
return;
|
||||
|
||||
float scale = mAbsolutePosition.Width() / (float) window->width;
|
||||
|
||||
imageExpose.scaleX = scale;
|
||||
imageExpose.scaleY = scale;
|
||||
|
||||
imageExpose.stride = mPluginSize.width * 2;
|
||||
imageExpose.data = mSharedXImage->data;
|
||||
imageExpose.dataSize.width = mPluginSize.width;
|
||||
imageExpose.dataSize.height = mPluginSize.height;
|
||||
|
||||
if (invalidRect)
|
||||
memset(mSharedXImage->data, 0, mPluginSize.width * mPluginSize.height * 2);
|
||||
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
|
||||
if (!eventHandled) {
|
||||
// XXX we should set a flag that the plugin didn't handle this event,
|
||||
// and we should deallocate the SHM surface and just skip trying to
|
||||
// draw this way
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!eventHandled)
|
||||
return;
|
||||
|
||||
// Setup the clip rectangle
|
||||
XRectangle rect;
|
||||
rect.x = mAbsolutePositionClip.x;
|
||||
rect.y = mAbsolutePositionClip.y;
|
||||
rect.width = mAbsolutePositionClip.width;
|
||||
rect.height = mAbsolutePositionClip.height;
|
||||
|
||||
GC gc = XCreateGC(gdk_x11_get_default_xdisplay(),
|
||||
mBlitWindow,
|
||||
0,
|
||||
0);
|
||||
if (!gc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rect.x = NSToIntFloor(mAbsolutePositionClip.X());
|
||||
rect.y = NSToIntFloor(mAbsolutePositionClip.Y());
|
||||
rect.width = NSToIntCeil(mAbsolutePositionClip.Width());
|
||||
rect.height = NSToIntCeil(mAbsolutePositionClip.Height());
|
||||
|
||||
PRInt32 absPosX = NSToIntFloor(mAbsolutePosition.X());
|
||||
PRInt32 absPosY = NSToIntFloor(mAbsolutePosition.Y());
|
||||
|
||||
XSetClipRectangles(gdk_x11_get_default_xdisplay(),
|
||||
gc,
|
||||
mAbsolutePosition.x,
|
||||
mAbsolutePosition.y,
|
||||
mXlibSurfGC,
|
||||
absPosX,
|
||||
absPosY,
|
||||
&rect, 1,
|
||||
Unsorted);
|
||||
|
||||
XShmPutImage(gdk_x11_get_default_xdisplay(),
|
||||
mBlitWindow,
|
||||
gc,
|
||||
mXlibSurfGC,
|
||||
mSharedXImage,
|
||||
0,
|
||||
0,
|
||||
mAbsolutePosition.x,
|
||||
mAbsolutePosition.y,
|
||||
absPosX,
|
||||
absPosY,
|
||||
mPluginSize.width,
|
||||
mPluginSize.height,
|
||||
PR_FALSE);
|
||||
|
||||
XSetClipRectangles(gdk_x11_get_default_xdisplay(), gc, 0, 0, nsnull, 0, Unsorted);
|
||||
XSetClipRectangles(gdk_x11_get_default_xdisplay(), mXlibSurfGC, 0, 0, nsnull, 0, Unsorted);
|
||||
|
||||
XFreeGC(gdk_x11_get_default_xdisplay(), gc);
|
||||
XFlush(gdk_x11_get_default_xdisplay());
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5560,8 +5599,9 @@ void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost)
|
|||
#ifdef MOZ_PLATFORM_HILDON
|
||||
PRBool nsPluginInstanceOwner::UpdateVisibility()
|
||||
{
|
||||
NS_ASSERTION(mInstance, "mInstance should never be null");
|
||||
|
||||
if (!mInstance)
|
||||
return PR_TRUE;
|
||||
|
||||
PRBool handled;
|
||||
NPEvent pluginEvent;
|
||||
XVisibilityEvent& visibilityEvent = pluginEvent.xvisibility;
|
||||
|
@ -5723,38 +5763,33 @@ nsPluginInstanceOwner::SetAbsoluteScreenPosition(nsIDOMElement* element,
|
|||
!position || !clip)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// convert to a int rect.
|
||||
float left, top, width, height;
|
||||
position->GetLeft(&left);
|
||||
position->GetTop(&top);
|
||||
position->GetWidth(&width);
|
||||
position->GetHeight(&height);
|
||||
|
||||
mAbsolutePosition = gfxRect(left, top, width, height);
|
||||
|
||||
NPWindow *window;
|
||||
GetWindow(window);
|
||||
NS_ASSERTION(window, "Must have a window here");
|
||||
|
||||
mPluginScale = width / window->width;
|
||||
|
||||
// The flash plugin on Maemo n900 requires the width/height to be
|
||||
// even.
|
||||
mAbsolutePosition = nsIntRect(NSToIntFloor(left),
|
||||
NSToIntFloor(top),
|
||||
NSToIntCeil(width) / 2 * 2,
|
||||
NSToIntCeil(height) / 2 * 2);
|
||||
clip->GetLeft(&left);
|
||||
clip->GetTop(&top);
|
||||
clip->GetWidth(&width);
|
||||
clip->GetHeight(&height);
|
||||
|
||||
mAbsolutePositionClip = nsIntRect(NSToIntFloor(left),
|
||||
NSToIntFloor(top),
|
||||
NSToIntCeil(width),
|
||||
NSToIntCeil(height));
|
||||
|
||||
mAbsolutePositionClip = gfxRect(left,top, width, height);
|
||||
|
||||
mBlitParentElement = element;
|
||||
|
||||
// The hildon plugin needs to have it visibility poked
|
||||
UpdateVisibility();
|
||||
|
||||
if (!mInstance)
|
||||
return NS_OK;
|
||||
|
||||
PRBool simpleImageRender = PR_FALSE;
|
||||
mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
|
||||
&simpleImageRender);
|
||||
if (mInstance)
|
||||
NativeImageDraw();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -164,7 +164,8 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
|
|||
|
||||
nsRuleNode* ruleNode = nsnull;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
GetRuleNodeForContent(content, &ruleNode);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
GetRuleNodeForContent(content, getter_AddRefs(styleContext), &ruleNode);
|
||||
if (!ruleNode) {
|
||||
// This can fail for content nodes that are not in the document or
|
||||
// if the document they're in doesn't have a presshell. Bail out.
|
||||
|
@ -271,9 +272,12 @@ inDOMUtils::GetContentState(nsIDOMElement *aElement, PRInt32* aState)
|
|||
}
|
||||
|
||||
/* static */ nsresult
|
||||
inDOMUtils::GetRuleNodeForContent(nsIContent* aContent, nsRuleNode** aRuleNode)
|
||||
inDOMUtils::GetRuleNodeForContent(nsIContent* aContent,
|
||||
nsStyleContext** aStyleContext,
|
||||
nsRuleNode** aRuleNode)
|
||||
{
|
||||
*aRuleNode = nsnull;
|
||||
*aStyleContext = nsnull;
|
||||
|
||||
nsIDocument* doc = aContent->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
|
@ -284,5 +288,6 @@ inDOMUtils::GetRuleNodeForContent(nsIContent* aContent, nsRuleNode** aRuleNode)
|
|||
nsRefPtr<nsStyleContext> sContext =
|
||||
nsComputedDOMStyle::GetStyleContextForContent(aContent, nsnull, presShell);
|
||||
*aRuleNode = sContext->GetRuleNode();
|
||||
sContext.forget(aStyleContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsRuleNode;
|
||||
class nsStyleContext;
|
||||
|
||||
class inDOMUtils : public inIDOMUtils
|
||||
{
|
||||
|
@ -55,7 +56,9 @@ public:
|
|||
virtual ~inDOMUtils();
|
||||
|
||||
private:
|
||||
// aStyleContext must be released by the caller once he's done with aRuleNode.
|
||||
static nsresult GetRuleNodeForContent(nsIContent* aContent,
|
||||
nsStyleContext** aStyleContext,
|
||||
nsRuleNode** aRuleNode);
|
||||
};
|
||||
|
||||
|
|
|
@ -2432,9 +2432,9 @@ _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
|||
}
|
||||
|
||||
nsXPIDLCString cookieStr;
|
||||
if (NS_FAILED(cookieService->GetCookieString(uri, nsnull,
|
||||
getter_Copies(cookieStr))) ||
|
||||
!cookieStr) {
|
||||
nsresult cookieReturn = cookieService->GetCookieString(uri, nsnull,
|
||||
getter_Copies(cookieStr));
|
||||
if (NS_FAILED(cookieReturn) || !cookieStr) {
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -449,7 +449,12 @@ ScriptablePluginObject::Invoke(NPIdentifier name, const NPVariant *args,
|
|||
|
||||
NPN_ReleaseVariantValue(&docv);
|
||||
|
||||
STRINGZ_TO_NPVARIANT(strdup("foo return val"), *result);
|
||||
const char* outString = "foo return val";
|
||||
char* npOutString = (char *)NPN_MemAlloc(strlen(outString) + 1);
|
||||
if (!npOutString)
|
||||
return false;
|
||||
strcpy(npOutString, outString);
|
||||
STRINGZ_TO_NPVARIANT(npOutString, *result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -463,7 +468,12 @@ ScriptablePluginObject::InvokeDefault(const NPVariant *args, uint32_t argCount,
|
|||
{
|
||||
printf ("ScriptablePluginObject default method called!\n");
|
||||
|
||||
STRINGZ_TO_NPVARIANT(strdup("default method return val"), *result);
|
||||
const char* outString = "default method return val";
|
||||
char* npOutString = (char *)NPN_MemAlloc(strlen(outString) + 1);
|
||||
if (!npOutString)
|
||||
return false;
|
||||
strcpy(npOutString, outString);
|
||||
STRINGZ_TO_NPVARIANT(npOutString, *result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ function checkValueAndTrigger(request, data, ctx) {
|
|||
if (index < tests.length - 1) {
|
||||
var delay = tests[index++].delay;
|
||||
if (delay) {
|
||||
do_timeout(delay, "triggerNextTest()");
|
||||
do_timeout(delay, triggerNextTest);
|
||||
} else {
|
||||
triggerNextTest();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ TestListener.prototype.onStartRequest = function(request, context) {
|
|||
TestListener.prototype.onStopRequest = function(request, context, status) {
|
||||
change_content_type();
|
||||
|
||||
do_timeout(0, "after_channel_closed()");
|
||||
do_timeout(0, after_channel_closed);
|
||||
}
|
||||
|
||||
function after_channel_closed() {
|
||||
|
|
|
@ -59,7 +59,7 @@ var copyObserver =
|
|||
do_check_true(test_source_closed);
|
||||
}
|
||||
|
||||
do_timeout(0, "do_test();");
|
||||
do_timeout(0, do_test);
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID)
|
||||
|
@ -119,8 +119,9 @@ function do_test() {
|
|||
pipe1.outputStream.write(test_content, test_content.length);
|
||||
pipe1.outputStream.flush();
|
||||
do_timeout(20,
|
||||
"copier.cancel(test_result);" +
|
||||
"pipe1.outputStream.write(\"a\", 1);");
|
||||
function(){
|
||||
copier.cancel(test_result);
|
||||
pipe1.outputStream.write("a", 1);});
|
||||
break;
|
||||
case 5:
|
||||
case 6: // close sink
|
||||
|
@ -156,10 +157,12 @@ function do_test() {
|
|||
// we will close the sink
|
||||
test_sink_closed = true;
|
||||
do_timeout(20,
|
||||
"pipe2.outputStream" +
|
||||
" .QueryInterface(Ci.nsIAsyncOutputStream)" +
|
||||
" .closeWithStatus(test_result);" +
|
||||
"pipe1.outputStream.write(\"a\", 1);");
|
||||
function()
|
||||
{
|
||||
pipe2.outputStream
|
||||
.QueryInterface(Ci.nsIAsyncOutputStream)
|
||||
.closeWithStatus(test_result);
|
||||
pipe1.outputStream.write("a", 1);});
|
||||
break;
|
||||
case 13:
|
||||
do_test_finished();
|
||||
|
@ -169,6 +172,6 @@ function do_test() {
|
|||
|
||||
function run_test() {
|
||||
test_nr = 0;
|
||||
do_timeout(0, "do_test();");
|
||||
do_timeout(0, do_test);
|
||||
do_test_pending();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ var listener = {
|
|||
do_check_eq(buffer, "0123456789");
|
||||
do_check_eq(observers_called, results[test_nr]);
|
||||
test_nr++;
|
||||
do_timeout(0, "do_test();");
|
||||
do_timeout(0, do_test);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ function run_test() {
|
|||
obs.addObserver(observer, "http-on-examine-merged-response", false);
|
||||
obs.addObserver(observer, "http-on-examine-cached-response", false);
|
||||
|
||||
do_timeout(0, "do_test();");
|
||||
do_timeout(0, do_test);
|
||||
do_test_pending();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ function checkValueAndTrigger(request, data, ctx) {
|
|||
index++;
|
||||
// this call happens in onStopRequest from the channel, and opening a
|
||||
// new channel to the same url here is no good idea... post it instead
|
||||
do_timeout(1, "triggerNextTest();");
|
||||
do_timeout(1, triggerNextTest);
|
||||
} else {
|
||||
httpserver.stop(do_test_finished);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ Test.prototype = {
|
|||
do_check_eq(this._isFromCache, this.readFromCache);
|
||||
do_check_eq(gHitServer, this.hitServer);
|
||||
|
||||
do_timeout(0, "run_next_test();");
|
||||
do_timeout(0, run_next_test);
|
||||
},
|
||||
|
||||
run: function() {
|
||||
|
|
|
@ -77,7 +77,7 @@ var listener = {
|
|||
// Once onStopRequest is reached, the channel is marked as having been
|
||||
// opened
|
||||
check_async_open_throws(NS_ERROR_ALREADY_OPENED);
|
||||
do_timeout(0, "after_channel_closed()");
|
||||
do_timeout(0, after_channel_closed);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
/*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
||||
* ***** 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 Storage Test Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Shawn Wilsher <me@shawnwilsher.com> (Original Author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
* This file tests to make sure that SQLite was compiled with
|
||||
* SQLITE_SECURE_DELETE=1.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Helper Methods
|
||||
|
||||
/**
|
||||
* Reads the contents of a file and returns it as a string.
|
||||
*
|
||||
* @param aFile
|
||||
* The file to return from.
|
||||
* @return the contents of the file in the form of a string.
|
||||
*/
|
||||
function getFileContents(aFile)
|
||||
{
|
||||
let fstream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
fstream.init(aFile, -1, 0, 0);
|
||||
|
||||
let bstream = Cc["@mozilla.org/binaryinputstream;1"].
|
||||
createInstance(Ci.nsIBinaryInputStream);
|
||||
bstream.setInputStream(fstream);
|
||||
return bstream.readBytes(bstream.available());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Tests
|
||||
|
||||
function test_delete_removes_data()
|
||||
{
|
||||
const TEST_STRING = "SomeRandomStringToFind";
|
||||
|
||||
let file = getTestDB();
|
||||
let db = getService().openDatabase(file);
|
||||
|
||||
// Create the table and insert the data.
|
||||
db.createTable("test", "data TEXT");
|
||||
let stmt = db.createStatement("INSERT INTO test VALUES(:data)");
|
||||
stmt.params.data = TEST_STRING;
|
||||
try {
|
||||
stmt.execute();
|
||||
}
|
||||
finally {
|
||||
stmt.finalize();
|
||||
}
|
||||
|
||||
// Make sure this test is actually testing what it thinks by making sure the
|
||||
// string shows up in the database. Because the previous statement was
|
||||
// automatically wrapped in a transaction, the contents are already on disk.
|
||||
let contents = getFileContents(file);
|
||||
do_check_neq(-1, contents.indexOf(TEST_STRING));
|
||||
|
||||
// Delete the data, and then close the database.
|
||||
stmt = db.createStatement("DELETE FROM test WHERE data = :data");
|
||||
stmt.params.data = TEST_STRING;
|
||||
try {
|
||||
stmt.execute();
|
||||
}
|
||||
finally {
|
||||
stmt.finalize();
|
||||
}
|
||||
db.close();
|
||||
|
||||
// Check the file to see if the string can be found.
|
||||
contents = getFileContents(file);
|
||||
do_check_eq(-1, contents.indexOf(TEST_STRING));
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Test Runner
|
||||
|
||||
var tests =
|
||||
[
|
||||
test_delete_removes_data,
|
||||
];
|
||||
let index = 0;
|
||||
|
||||
function run_next_test()
|
||||
{
|
||||
if (index < tests.length) {
|
||||
do_test_pending();
|
||||
print("Running the next test: " + tests[index].name);
|
||||
tests[index++]();
|
||||
}
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
do_test_pending();
|
||||
run_next_test();
|
||||
}
|
|
@ -109,6 +109,21 @@ Tester.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
// Make sure the window is raised before each test.
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
if (fm.activeWindow != window) {
|
||||
this.dumper.dump("Waiting for window activation...\n");
|
||||
let self = this;
|
||||
window.addEventListener("activate", function () {
|
||||
window.removeEventListener("activate", arguments.callee, false);
|
||||
setTimeout(function () {
|
||||
self.execTest();
|
||||
}, 0);
|
||||
}, false);
|
||||
window.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Move to the next test (or first test).
|
||||
this.step();
|
||||
|
||||
|
|
|
@ -49,5 +49,5 @@ function run_test() {
|
|||
do_check_true(true);
|
||||
|
||||
do_test_pending();
|
||||
do_timeout(100, "do_test_finished();");
|
||||
do_timeout(100, do_test_finished);
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@ if ("@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
|
|||
|
||||
|
||||
function _TimerCallback(expr, timer) {
|
||||
this._expr = expr;
|
||||
this._func = typeof expr === "function"
|
||||
? expr
|
||||
: function() { eval(expr); };
|
||||
// Keep timer alive until it fires
|
||||
_pendingCallbacks.push(timer);
|
||||
}
|
||||
_TimerCallback.prototype = {
|
||||
_expr: "",
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.Equals(Components.interfaces.nsITimerCallback) ||
|
||||
iid.Equals(Components.interfaces.nsISupports))
|
||||
|
@ -92,7 +92,7 @@ _TimerCallback.prototype = {
|
|||
|
||||
notify: function(timer) {
|
||||
_pendingCallbacks.splice(_pendingCallbacks.indexOf(timer), 1);
|
||||
eval(this._expr);
|
||||
this._func.call(null);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ function checkResult() {
|
|||
|
||||
// Need to poll RecentDocs value because the SHAddToRecentDocs call
|
||||
// doesn't update the registry immediately.
|
||||
do_timeout(POLL_REGISTRY_TIMEOUT, "pollRecentDocs();");
|
||||
do_timeout(POLL_REGISTRY_TIMEOUT, pollRecentDocs);
|
||||
}
|
||||
|
||||
var gPollsCount = 0;
|
||||
|
@ -74,7 +74,7 @@ function pollRecentDocs() {
|
|||
do_test_finished();
|
||||
}
|
||||
else
|
||||
do_timeout(POLL_REGISTRY_TIMEOUT, "pollRecentDocs();");
|
||||
do_timeout(POLL_REGISTRY_TIMEOUT, pollRecentDocs);
|
||||
}
|
||||
|
||||
function checkRecentDocsFor(aFileName) {
|
||||
|
|
|
@ -63,7 +63,7 @@ function run_test() {
|
|||
do_test_pending();
|
||||
|
||||
gItemId1 = bmsvc.insertBookmark(gTestRoot, gURI, bmsvc.DEFAULT_INDEX, "");
|
||||
do_timeout(100, "phase2();");
|
||||
do_timeout(100, phase2);
|
||||
}
|
||||
|
||||
function phase2() {
|
||||
|
@ -71,7 +71,7 @@ function phase2() {
|
|||
var b = bmsvc.getBookmarkIdsForURI(gURI);
|
||||
do_check_eq(b[0], gItemId2);
|
||||
do_check_eq(b[1], gItemId1);
|
||||
do_timeout(100, "phase3();");
|
||||
do_timeout(100, phase3);
|
||||
}
|
||||
|
||||
function phase3() {
|
||||
|
|
|
@ -97,7 +97,7 @@ var observer = {
|
|||
|
||||
// The database connection will be closed after this sync, but we can't
|
||||
// know how much time it will take, so we use a polling strategy.
|
||||
do_timeout(POLLING_TIMEOUT_MS, "check_results();");
|
||||
do_timeout(POLLING_TIMEOUT_MS, check_results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ function check_results() {
|
|||
}
|
||||
|
||||
if (hs.QueryInterface(Ci.nsPIPlacesDatabase).DBConnection.connectionReady) {
|
||||
do_timeout(POLLING_TIMEOUT_MS, "check_results();");
|
||||
do_timeout(POLLING_TIMEOUT_MS, check_results);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ function run_test() {
|
|||
ghist.addURI(testURI, false, true, null);
|
||||
ghist.addURI(testURI, false, true, testURI);
|
||||
// lazy message timer is 3000, see LAZY_MESSAGE_TIMEOUT
|
||||
do_timeout(3500, "confirm_results();");
|
||||
do_timeout(3500, confirm_results);
|
||||
}
|
||||
|
||||
function confirm_results() {
|
||||
|
|
|
@ -124,7 +124,7 @@ function run_test() {
|
|||
|
||||
do_test_pending();
|
||||
// lazy timeout is 3s and favicons are lazy added
|
||||
do_timeout(3500, "end_test();");
|
||||
do_timeout(3500, end_test);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
|
|
@ -77,5 +77,5 @@ function run_test() {
|
|||
bs.DEFAULT_INDEX, "bookmark");
|
||||
|
||||
do_test_pending();
|
||||
do_timeout(1000, "verify();");
|
||||
do_timeout(1000, verify);
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ function startExpireNeither() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireNeither();");
|
||||
do_timeout(600, checkExpireNeither);
|
||||
}
|
||||
|
||||
function checkExpireNeither() {
|
||||
|
@ -588,7 +588,7 @@ function startExpireDaysOnly() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireDaysOnly();");
|
||||
do_timeout(600, checkExpireDaysOnly);
|
||||
}
|
||||
|
||||
function checkExpireDaysOnly() {
|
||||
|
@ -658,7 +658,7 @@ function startExpireBoth() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireBoth();"); // incremental expiration timer is 3500
|
||||
do_timeout(600, checkExpireBoth); // incremental expiration timer is 3500
|
||||
}
|
||||
|
||||
function checkExpireBoth() {
|
||||
|
@ -716,7 +716,7 @@ function startExpireNeitherOver() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireNeitherOver();");
|
||||
do_timeout(600, checkExpireNeitherOver);
|
||||
}
|
||||
|
||||
function checkExpireNeitherOver() {
|
||||
|
@ -765,7 +765,7 @@ function startExpireHistoryDisabled() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireHistoryDisabled();");
|
||||
do_timeout(600, checkExpireHistoryDisabled);
|
||||
}
|
||||
|
||||
function checkExpireHistoryDisabled() {
|
||||
|
@ -817,7 +817,7 @@ function startExpireBadPrefs() {
|
|||
// Changing expiration preferences triggers partial expiration.
|
||||
|
||||
// Check results.
|
||||
do_timeout(600, "checkExpireBadPrefs();");
|
||||
do_timeout(600, checkExpireBadPrefs);
|
||||
}
|
||||
|
||||
function checkExpireBadPrefs() {
|
||||
|
|
|
@ -77,5 +77,5 @@ function run_test() {
|
|||
hs.TRANSITION_TYPED, false, 0);
|
||||
|
||||
do_test_pending();
|
||||
do_timeout(1000, "verify();");
|
||||
do_timeout(1000, verify);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ function run_test()
|
|||
// test too soon the timestamp will be the same! So, we'll wait a short
|
||||
// period of time to make sure the timestamp will differ.
|
||||
do_test_pending();
|
||||
do_timeout(50, "delayed_test()");
|
||||
do_timeout(50, delayed_test);
|
||||
|
||||
} catch (e) {
|
||||
throw "FAILED in test #" + testnum + " -- " + e;
|
||||
|
|
|
@ -1219,7 +1219,10 @@ Engine.prototype = {
|
|||
var dialogMessage =
|
||||
stringBundle.formatStringFromName("addEngineConfirmation",
|
||||
[this._name, this._uri.host], 2);
|
||||
var checkboxMessage = stringBundle.GetStringFromName("addEngineUseNowText");
|
||||
var checkboxMessage = null;
|
||||
if (!getBoolPref(BROWSER_SEARCH_PREF + "noCurrentEngine", false))
|
||||
checkboxMessage = stringBundle.GetStringFromName("addEngineUseNowText");
|
||||
|
||||
var addButtonLabel =
|
||||
stringBundle.GetStringFromName("addEngineAddButtonLabel");
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ function LightweightThemeConsumer(aDocument) {
|
|||
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.addObserver(this, "lightweight-theme-changed", false);
|
||||
.addObserver(this, "lightweight-theme-styling-update", false);
|
||||
|
||||
var temp = {};
|
||||
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
|
||||
|
@ -51,7 +51,7 @@ function LightweightThemeConsumer(aDocument) {
|
|||
|
||||
LightweightThemeConsumer.prototype = {
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
if (aTopic != "lightweight-theme-changed")
|
||||
if (aTopic != "lightweight-theme-styling-update")
|
||||
return;
|
||||
|
||||
this._update(JSON.parse(aData));
|
||||
|
@ -60,7 +60,7 @@ LightweightThemeConsumer.prototype = {
|
|||
destroy: function () {
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
.removeObserver(this, "lightweight-theme-changed");
|
||||
.removeObserver(this, "lightweight-theme-styling-update");
|
||||
|
||||
this._doc = null;
|
||||
},
|
||||
|
|
|
@ -50,6 +50,7 @@ _TEST_FILES = test_bug360220.xul \
|
|||
test_bug382990.xul \
|
||||
test_bug457632.xul \
|
||||
test_bug460942.xul \
|
||||
test_bug509732.xul \
|
||||
test_button.xul \
|
||||
test_closemenu_attribute.xul \
|
||||
test_colorpicker_popup.xul \
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
XUL Widget Test for bug 509732
|
||||
-->
|
||||
<window title="Bug 509732" width="500" height="600"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<notificationbox id="nb" hidden="true"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
|
||||
onload="test()"/>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
var gNotificationBox;
|
||||
|
||||
// Tests that a notification that is added in an hidden box didn't throw the animation
|
||||
function test() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
gNotificationBox = document.getElementById("nb");
|
||||
|
||||
is(gNotificationBox.allNotifications.length, 0, "There should be no initial notifications");
|
||||
|
||||
gNotificationBox.appendNotification("Test notification",
|
||||
"notification1", null,
|
||||
gNotificationBox.PRIORITY_INFO_LOW,
|
||||
null);
|
||||
|
||||
is(gNotificationBox.allNotifications.length, 1, "Notification exists");
|
||||
is(gNotificationBox._timer, null, "Notification timer should be null");
|
||||
|
||||
test1();
|
||||
}
|
||||
|
||||
// Tests that a notification that is removed from an hidden box didn't throw the animation
|
||||
function test1() {
|
||||
let notification = gNotificationBox.getNotificationWithValue("notification1");
|
||||
gNotificationBox.removeNotification(notification);
|
||||
ok(!gNotificationBox.currentNotification, "Test 1 should show no current animation");
|
||||
is(gNotificationBox._timer, null, "Notification timer should be null");
|
||||
is(gNotificationBox.allNotifications.length, 0, "Test 1 should show no notifications present");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
|
@ -64,7 +64,7 @@
|
|||
<![CDATA[
|
||||
var notifications = this.allNotifications;
|
||||
for (var n = notifications.length - 1; n >= 0; n--) {
|
||||
if (aValue == notifications[n].value)
|
||||
if (aValue == notifications[n].getAttribute("value"))
|
||||
return notifications[n];
|
||||
}
|
||||
return null;
|
||||
|
@ -220,6 +220,7 @@
|
|||
}
|
||||
|
||||
var height = aNotification.boxObject.height;
|
||||
var skipAnimation = (height == 0);
|
||||
var change = height / this.slideSteps;
|
||||
var margin;
|
||||
if (aSlideIn) {
|
||||
|
@ -230,6 +231,12 @@
|
|||
this.currentNotification = aNotification;
|
||||
aNotification.style.removeProperty("position");
|
||||
aNotification.style.removeProperty("top");
|
||||
|
||||
if (skipAnimation) {
|
||||
this._setBlockingState(this.currentNotification);
|
||||
return;
|
||||
}
|
||||
|
||||
aNotification.style.marginTop = -height + "px";
|
||||
aNotification.style.opacity = 0;
|
||||
margin = -height;
|
||||
|
@ -239,10 +246,15 @@
|
|||
this._closedNotification = aNotification;
|
||||
var notifications = this.allNotifications;
|
||||
var idx = notifications.length - 1;
|
||||
if (idx >= 0)
|
||||
this.currentNotification = notifications[idx];
|
||||
else
|
||||
this.currentNotification = null;
|
||||
this.currentNotification = (idx >= 0) ? notifications[idx] : null;
|
||||
|
||||
if (skipAnimation) {
|
||||
this.removeChild(this._closedNotification);
|
||||
this._closedNotification = null;
|
||||
this._setBlockingState(this.currentNotification);
|
||||
return;
|
||||
}
|
||||
|
||||
var style = window.getComputedStyle(aNotification, null);
|
||||
margin = style.getPropertyCSSValue("margin-top").
|
||||
getFloatValue(CSSPrimitiveValue.CSS_PX);
|
||||
|
|
|
@ -34,6 +34,23 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* The behavior implemented by gDownloadLastDir is documented here.
|
||||
*
|
||||
* In normal browsing sessions, gDownloadLastDir uses the browser.download.lastDir
|
||||
* preference to store the last used download directory. The first time the user
|
||||
* switches into the private browsing mode, the last download directory is
|
||||
* preserved to the pref value, but if the user switches to another directory
|
||||
* during the private browsing mode, that directory is not stored in the pref,
|
||||
* and will be merely kept in memory. When leaving the private browsing mode,
|
||||
* this in-memory value will be discarded, and the last download directory
|
||||
* will be reverted to the pref value.
|
||||
*
|
||||
* Both the pref and the in-memory value will be cleared when clearing the
|
||||
* browsing history. This effectively changes the last download directory
|
||||
* to the default download directory on each platform.
|
||||
*/
|
||||
|
||||
const LAST_DIR_PREF = "browser.download.lastDir";
|
||||
const PBSVC_CID = "@mozilla.org/privatebrowsing;1";
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
|
|
|
@ -133,6 +133,7 @@ var LightweightThemeManager = {
|
|||
|
||||
_prefs.setBoolPref("isThemeSelected", aData != null);
|
||||
_notifyWindows(aData);
|
||||
_observerService.notifyObservers(null, "lightweight-theme-changed", null);
|
||||
|
||||
if (PERSIST_ENABLED && aData)
|
||||
_persistImages(aData);
|
||||
|
@ -282,7 +283,7 @@ function _updateUsedThemes(aList) {
|
|||
}
|
||||
|
||||
function _notifyWindows(aThemeData) {
|
||||
_observerService.notifyObservers(null, "lightweight-theme-changed",
|
||||
_observerService.notifyObservers(null, "lightweight-theme-styling-update",
|
||||
JSON.stringify(aThemeData));
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ function run_test() {
|
|||
do_test_pending();
|
||||
|
||||
// Give time for phone home to complete.
|
||||
do_timeout(DELAY, "run_test_pt2()");
|
||||
do_timeout(DELAY, run_test_pt2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -437,7 +437,7 @@ var WindowWatcher = {
|
|||
gNewBlocks.push(list[i].name + " " + list[i].version);
|
||||
|
||||
// Call the callback after the blocklist has finished up
|
||||
do_timeout(0, "gCallback()");
|
||||
do_timeout(0, gCallback);
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
|
|
|
@ -174,7 +174,7 @@ var WindowWatcher = {
|
|||
}
|
||||
|
||||
// Call the next test after the blocklist has finished up
|
||||
do_timeout(0, "gTestCheck()");
|
||||
do_timeout(0, gTestCheck);
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
|
|
|
@ -107,7 +107,7 @@ var WindowWatcher = {
|
|||
do_check_neq(item.name, "test_bug514327_outdated");
|
||||
|
||||
// Call the next test after the blocklist has finished up
|
||||
do_timeout(0, "gNextTestPart()");
|
||||
do_timeout(0, gNextTestPart);
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
|
|
|
@ -603,7 +603,7 @@ xhr.prototype = {
|
|||
responseXML: null,
|
||||
responseText: null,
|
||||
send: function(body) {
|
||||
do_timeout(0, "gXHRCallback()"); // Use a timeout so the XHR completes
|
||||
do_timeout(0, gXHRCallback); // Use a timeout so the XHR completes
|
||||
},
|
||||
_onprogress: null,
|
||||
set onprogress(val) { gXHR._onprogress = val; },
|
||||
|
@ -656,7 +656,7 @@ const updateCheckListener = {
|
|||
"update.statusText = " + request.statusText + ", " +
|
||||
"updateCount = " + updateCount + "\n");
|
||||
// Use a timeout to allow the XHR to complete
|
||||
do_timeout(0, "gCheckFunc()");
|
||||
do_timeout(0, gCheckFunc);
|
||||
},
|
||||
|
||||
onError: function(request, update) {
|
||||
|
@ -667,7 +667,7 @@ const updateCheckListener = {
|
|||
"request.status = " + gStatusCode + ", " +
|
||||
"update.statusText = " + gStatusText + "\n");
|
||||
// Use a timeout to allow the XHR to complete
|
||||
do_timeout(0, "gCheckFunc()");
|
||||
do_timeout(0, gCheckFunc);
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
|
|
|
@ -52,7 +52,7 @@ function run_test() {
|
|||
overrideXHR(callHandleEvent);
|
||||
startAUS();
|
||||
startUpdateChecker();
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
|
|
@ -52,7 +52,7 @@ function run_test() {
|
|||
startUpdateChecker();
|
||||
// The HTTP server is only used for the mar file downloads which is slow
|
||||
start_httpserver(DIR_DATA);
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
@ -218,7 +218,7 @@ const downloadListener = {
|
|||
onStopRequest: function(request, context, status) {
|
||||
gStatusResult = status;
|
||||
// Use a timeout to allow the request to complete
|
||||
do_timeout(0, "gCheckFunc()");
|
||||
do_timeout(0, gCheckFunc);
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
|
|
|
@ -57,7 +57,7 @@ function run_test() {
|
|||
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(AUS_Ci.nsIXULAppInfo).
|
||||
QueryInterface(AUS_Ci.nsIXULRuntime);
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
|
|
@ -56,7 +56,7 @@ function run_test() {
|
|||
getPrefBranch().setCharPref(PREF_APP_UPDATE_URL_OVERRIDE,
|
||||
URL_HOST + "update.xml");
|
||||
overrideXHR(callHandleEvent);
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
|
|
@ -72,7 +72,7 @@ function run_test() {
|
|||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1.0", "2.0");
|
||||
setDefaultPrefs();
|
||||
do_timeout(0, "run_test_pt1()");
|
||||
do_timeout(0, run_test_pt1);
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
|
@ -111,7 +111,7 @@ function run_test_pt1() {
|
|||
do_check_true(privBrowsing.autoStarted);
|
||||
|
||||
// Use a timeout to give private browsing time to reset necko.
|
||||
do_timeout(0, "run_test_pt2()");
|
||||
do_timeout(0, run_test_pt2);
|
||||
}
|
||||
function run_test_pt2() {
|
||||
dump("Testing: update count should equal 1\n");
|
||||
|
|
|
@ -161,7 +161,7 @@ function end_test() {
|
|||
}
|
||||
|
||||
function run_test1thru6() {
|
||||
gNextFunc = "check_test1thru6()";
|
||||
gNextFunc = check_test1thru6;
|
||||
// bogus default interval
|
||||
gCompReg.registerFactory(TESTS[0].classID, TESTS[0].desc,
|
||||
TESTS[0].contractID, gTest1Factory);
|
||||
|
@ -271,11 +271,11 @@ function check_test1thru6() {
|
|||
"registered\n");
|
||||
do_check_eq(count, 0);
|
||||
|
||||
do_timeout(0, "run_test7()");
|
||||
do_timeout(0, run_test7());
|
||||
}
|
||||
|
||||
function run_test7() {
|
||||
gNextFunc = "check_test7()";
|
||||
gNextFunc = check_test7;
|
||||
gPref.setIntPref(PREF_BRANCH_LAST_UPDATE_TIME + TESTS[6].timerID, 1);
|
||||
gCompReg.registerFactory(TESTS[6].classID, TESTS[6].desc,
|
||||
TESTS[6].contractID, gTest7Factory);
|
||||
|
@ -386,7 +386,7 @@ var gTest6Factory = {
|
|||
var gTest7TimerCallback = {
|
||||
notify: function T7CB_notify(aTimer) {
|
||||
TESTS[6].notified = true;
|
||||
do_timeout(0, "check_test7()");
|
||||
do_timeout(0, check_test7);
|
||||
},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
|
||||
};
|
||||
|
|
Двоичные данные
toolkit/themes/winstripe/global/icons/find.png
До Ширина: | Высота: | Размер: 2.1 KiB После Ширина: | Высота: | Размер: 2.5 KiB |
|
@ -112,6 +112,8 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
|||
|
||||
if check_for_forced_update "$requested_forced_updates" "$f"; then
|
||||
echo 1>&2 " FORCING UPDATE for file '$f'..."
|
||||
# The full workdir may not exist yet, so create it if necessary.
|
||||
mkdir -p `dirname "$workdir/$f"`
|
||||
$BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
|
||||
make_add_instruction "$f" >> $manifest
|
||||
archivefiles="$archivefiles \"$f\""
|
||||
|
|
|
@ -58,7 +58,7 @@ function checkFile() {
|
|||
}
|
||||
else {
|
||||
// Wait a bit longer then try again
|
||||
do_timeout(1000, "checkFile()");
|
||||
do_timeout(1000, checkFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,5 +155,5 @@ function run_test() {
|
|||
localHandler.launchWithURI(uri);
|
||||
|
||||
do_test_pending();
|
||||
do_timeout(1000, "checkFile()");
|
||||
do_timeout(1000, checkFile);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ endif
|
|||
ifeq ($(OS_ARCH),WINCE)
|
||||
ifeq ($(TARGET_CPU),arm)
|
||||
CPPSRCS = xptcinvokece.cpp xptcstubsce.cpp
|
||||
ASFILES = xptc_arm_ceppc.asm
|
||||
ASFILES = xptcstubs_asm_ce.asm xptcinvoke_asm_ce.asm
|
||||
ASFLAGS += -I ../../../public
|
||||
AS_DASH_C_FLAG =
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
AREA text,CODE,READONLY
|
||||
ALIGN 4
|
||||
|
||||
; ----
|
||||
|
||||
; extern "C" nsresult
|
||||
; asmXPTC_InvokeByIndex( nsISupports* that,
|
||||
; PRUint32 methodIndex,
|
||||
; PRUint32 paramCount,
|
||||
; nsXPTCVariant* params,
|
||||
; PRUint32 pfn_CopyToStack,
|
||||
; PRUint32 pfn_CountWords);
|
||||
|
||||
EXTERN writeArgs
|
||||
|
||||
GLOBAL asmXPTC_InvokeByIndex
|
||||
asmXPTC_InvokeByIndex
|
||||
mov r12, sp
|
||||
stmdb sp!, {r4 - r6, r12, lr} ; we're using registers 4, 5 and 6. Save them
|
||||
sub sp, sp, #16
|
||||
mov r6, r0 ; store 'that' (the target's this)
|
||||
mov r5, r1, lsl #2 ; a vtable index = methodIndex * 4
|
||||
mov r4, sp ; Back up the initial stack pointer.
|
||||
; Move the stack pointer to allow for `paramCount` 64-bit values. We'll get
|
||||
; any unused space back as writeArgs tells us where the SP should end up.
|
||||
sub sp, sp, r2, lsl #3 ; worst case estimate for stack space
|
||||
|
||||
; Put the arguments on the stack.
|
||||
ldr ip, =writeArgs
|
||||
mov r0, r4
|
||||
mov r1, r2
|
||||
mov r2, r3
|
||||
|
||||
blx ip ; call writeArgs
|
||||
|
||||
; Use the stack pointer returned by writeArgs, but skip the first three
|
||||
; words as these belong in registers (r1-r3).
|
||||
add sp, r0, #12
|
||||
|
||||
|
||||
mov r0, r6 ; Restore 'that'.
|
||||
ldr r1, [r0] ; get that->vtable offset
|
||||
ldr ip, [r1, r5] ; get method adress from vtable
|
||||
|
||||
; The stack pointer now points to a stack which includes all arguments to
|
||||
; be passed to the target method. The first three words should be passed in
|
||||
; r1-r3 (with 'this' in r0). If we have fewer than three argument words, we
|
||||
; will waste some cycles (and a couple of memory words) by loading them,
|
||||
; but I suspect that we'll achieve a net gain by avoiding a conditional
|
||||
; load here.
|
||||
ldr r1, [sp, #-12]
|
||||
ldr r2, [sp, #-8]
|
||||
ldr r3, [sp, #-4]
|
||||
blx ip ; call function
|
||||
|
||||
mov sp, r4 ; Restore the original stack pointer.
|
||||
|
||||
add sp, sp, #16
|
||||
ldmia sp!, {r4 - r6, sp, pc} ; Restore registers and return.
|
||||
|
||||
END
|