Merge mozilla-central into Electrolysis.

This commit is contained in:
Benjamin Smedberg 2009-11-24 10:06:03 -05:00
Родитель 221a1d753c 1ccefba1bf
Коммит e53a7195d5
150 изменённых файлов: 2174 добавлений и 1549 удалений

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

@ -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);
}
@ -6861,7 +6860,7 @@ let gPrivateBrowsingUI = {
getService(Ci.nsIPrivateBrowsingService);
if (this.privateBrowsingEnabled)
this.onEnterPrivateBrowsing();
this.onEnterPrivateBrowsing(true);
},
uninit: function PBUI_unint() {
@ -6956,7 +6955,7 @@ let gPrivateBrowsingUI = {
return result;
},
onEnterPrivateBrowsing: function PBUI_onEnterPrivateBrowsing() {
onEnterPrivateBrowsing: function PBUI_onEnterPrivateBrowsing(aOnWindowOpen) {
if (BrowserSearch.searchBar)
this._searchBarValue = BrowserSearch.searchBar.textbox.value;
@ -6993,7 +6992,7 @@ let gPrivateBrowsingUI = {
DownloadMonitorPanel.updateStatus();
}, 0);
if (this._disableUIOnToggle)
if (!aOnWindowOpen && this._disableUIOnToggle)
document.getElementById("Tools:PrivateBrowsing")
.setAttribute("disabled", "true");
},

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

@ -159,7 +159,7 @@ var gSanitizePromptDialog = {
// which does not include date and time. See bug 480169 comment 48.
var warningStringID;
if (this.hasCustomizedItemSelection()) {
if (this.hasNonSelectedItems()) {
warningStringID = "sanitizeSelectedWarning";
if (!aDontShowItemList)
this.showItemList();
@ -231,11 +231,11 @@ var gSanitizePromptDialog = {
/**
* Check if all of the history items have been selected like the default status.
*/
hasCustomizedItemSelection: function () {
hasNonSelectedItems: function () {
let checkboxes = document.querySelectorAll("#itemList > [preference]");
for (let i = 0; i < checkboxes.length; ++i) {
let pref = document.getElementById(checkboxes[i].getAttribute("preference"));
if (pref.value != pref.defaultValue)
if (!pref.value)
return true;
}
return false;

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

@ -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)

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

@ -303,8 +303,8 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Reset the check boxes and select "Everything"
this.resetCheckboxes();
// Check all items and select "Everything"
this.checkAllCheckboxes();
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
// Hide details
@ -317,11 +317,10 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should remain closed because the items selection is the same
// as the default state.
// Details should remain closed because all items are checked.
this.checkDetails(false);
// Modify the default items state
// Uncheck history.
this.checkPrefCheckbox("history", false);
this.acceptDialog();
};
@ -330,8 +329,20 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because the items selection is not the same
// as the default state.
// Details should be open because not all items are checked.
this.checkDetails(true);
// Modify the Site Preferences item state (bug 527820)
this.checkAllCheckboxes();
this.checkPrefCheckbox("siteSettings", false);
this.acceptDialog();
};
wh.open();
},
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because not all items are checked.
this.checkDetails(true);
// Hide details
@ -344,8 +355,7 @@ var gAllTests = [
function () {
let wh = new WindowHelper();
wh.onload = function () {
// Details should be open because the items selection is not the same
// as the default state.
// Details should be open because not all items are checked.
this.checkDetails(true);
// Select another duration
@ -469,14 +479,14 @@ WindowHelper.prototype = {
},
/**
* Resets the checkboxes to their default state.
* Makes sure all the checkboxes are checked.
*/
resetCheckboxes: function () {
checkAllCheckboxes: function () {
var cb = this.win.document.querySelectorAll("#itemList > [preference]");
ok(cb.length > 1, "found checkboxes for preferences");
for (var i = 0; i < cb.length; ++i) {
var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
if (pref.value != pref.defaultValue)
if (!pref.value)
cb[i].click();
}
},

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

@ -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;

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

@ -403,12 +403,12 @@ var gAdvancedPane = {
{
var aus =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
getService(Components.interfaces.nsIApplicationUpdateService2);
var enabledPref = document.getElementById("app.update.enabled");
var enableAppUpdate = document.getElementById("enableAppUpdate");
enableAppUpdate.disabled = !aus.canUpdate || enabledPref.locked;
enableAppUpdate.disabled = !aus.canCheckForUpdates || enabledPref.locked;
},
/**

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

@ -56,6 +56,7 @@ _BROWSER_TEST_FILES = \
browser_privatebrowsing_geoprompt.js \
browser_privatebrowsing_geoprompt_page.html \
browser_privatebrowsing_import.js \
browser_privatebrowsing_newwindow_stopcmd.js \
browser_privatebrowsing_opendir.js \
browser_privatebrowsing_openlocation.js \
browser_privatebrowsing_pageinfo.js \

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

@ -0,0 +1,63 @@
/* ***** 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 Private Browsing Tests.
*
* 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):
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 test makes sure that the stop private browsing command is enabled in
// new windows opened from the private browsing mode (bug 529667).
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
waitForExplicitFinish();
pb.privateBrowsingEnabled = true;
let win = OpenBrowserWindow();
win.addEventListener("load", function() {
executeSoon(function() {
executeSoon(function() {
let cmd = win.document.getElementById("Tools:PrivateBrowsing");
ok(!cmd.hasAttribute("disabled"),
"The Private Browsing command in a new window should be enabled");
win.close();
pb.privateBrowsingEnabled = false;
finish();
});
});
}, false);
}

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

@ -78,7 +78,7 @@ function test() {
}
// open a window and add the above closed tab list
let newWin = open(location, "", "chrome,all");
let newWin = openDialog(location, "", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);

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

@ -86,7 +86,7 @@ function test() {
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
// open a window and add the above closed tab list
let newWin = open(location, "", "chrome,all");
let newWin = openDialog(location, "", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);

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

@ -55,17 +55,21 @@ function test() {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
function waitForBrowserState(aState, aSetStateCallback) {
let observer = {
observe: function(aSubject, aTopic, aData) {
os.removeObserver(this, "sessionstore-browser-state-restored");
executeSoon(aSetStateCallback);
}
};
os.addObserver(observer, "sessionstore-browser-state-restored", false);
var locationChanges = 0;
gBrowser.addTabsProgressListener({
onLocationChange: function (aBrowser) {
if (++locationChanges == aState.windows[0].tabs.length) {
gBrowser.removeTabsProgressListener(this);
executeSoon(aSetStateCallback);
}
},
onProgressChange: function () {},
onSecurityChange: function () {},
onStateChange: function () {},
onStatusChange: function () {}
});
ss.setBrowserState(JSON.stringify(aState));
}
@ -300,11 +304,9 @@ function test() {
test_getBrowserState_lotsOfTabsOpening,
test_getBrowserState_userTypedValue, test_userTypedClearLoadURI];
let originalState = ss.getBrowserState();
info(JSON.parse(originalState).windows.length);
info(originalState);
function runNextTest() {
if (tests.length) {
tests.shift().call();
tests.shift()();
} else {
ss.setBrowserState(originalState);
executeSoon(function () {

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

@ -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");

Двоичные данные
browser/themes/winstripe/browser/Toolbar-aero.png Executable file → Normal file

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

До

Ширина:  |  Высота:  |  Размер: 60 KiB

После

Ширина:  |  Высота:  |  Размер: 49 KiB

Двоичные данные
browser/themes/winstripe/browser/Toolbar-small-aero.png Executable file → Normal file

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

До

Ширина:  |  Высота:  |  Размер: 24 KiB

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
browser/themes/winstripe/browser/Toolbar-small.png Executable file → Normal file

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

До

Ширина:  |  Высота:  |  Размер: 33 KiB

После

Ширина:  |  Высота:  |  Размер: 26 KiB

Двоичные данные
browser/themes/winstripe/browser/Toolbar.png Executable file → Normal file

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

До

Ширина:  |  Высота:  |  Размер: 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 ::::: */

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

До

Ширина:  |  Высота:  |  Размер: 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)

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

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

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

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

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

До

Ширина:  |  Высота:  |  Размер: 786 B

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

До

Ширина:  |  Высота:  |  Размер: 757 B

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

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

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

До

Ширина:  |  Высота:  |  Размер: 335 B

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

До

Ширина:  |  Высота:  |  Размер: 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 */

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

До

Ширина:  |  Высота:  |  Размер: 193 B

Двоичные данные
browser/themes/winstripe/browser/places/view.png

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

До

Ширина:  |  Высота:  |  Размер: 181 B

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

@ -362,6 +362,9 @@ endif # WINNT
ifeq ($(SOLARIS_SUNPRO_CXX),1)
CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
ifeq (86,$(findstring 86,$(OS_TEST)))
OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
endif # x86
endif # Solaris Sun Studio C++
ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))

1
config/solaris_ia32.map Normal file
Просмотреть файл

@ -0,0 +1 @@
hwcap_1 = OVERRIDE;

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

@ -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))

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

@ -39,11 +39,13 @@
interface nsIObjectFrame;
interface nsIPluginInstance;
interface nsIDOMElement;
interface nsIDOMClientRect;
/**
* This interface represents a content node that loads objects.
*/
[scriptable, uuid(90ab443e-3e99-405e-88c9-9c42adaa3217)]
[scriptable, uuid(8afe3b08-293c-48bd-a997-321745478611)]
interface nsIObjectLoadingContent : nsISupports
{
const unsigned long TYPE_LOADING = 0;
@ -105,4 +107,12 @@ interface nsIObjectLoadingContent : nsISupports
* because nsIObjectFrame is unscriptable.
*/
[noscript] void hasNewFrame(in nsIObjectFrame aFrame);
/**
* Tells the object to paint directly in this location ignoring any
* positioning information that may have been provided otherwise
*/
void setAbsoluteScreenPosition(in nsIDOMElement element,
in nsIDOMClientRect position,
in nsIDOMClientRect clip);
};

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

@ -152,13 +152,12 @@ nsDOMFileReader::Notify(const char *aCharset, nsDetectionConfident aConf)
//nsDOMFileReader constructors/initializers
nsDOMFileReader::nsDOMFileReader()
: mFileData(nsnull), mReadCount(0),
: mFileData(nsnull),
mDataLen(0), mDataFormat(0),
mReadyState(nsIDOMFileReader::EMPTY),
mProgressEventWasDelayed(PR_FALSE),
mTimerIsActive(PR_FALSE),
mReadTotal(0), mReadTransferred(0),
mReadComplete(PR_TRUE)
mReadTotal(0), mReadTransferred(0)
{
nsLayoutStatics::AddRef();
}
@ -168,6 +167,8 @@ nsDOMFileReader::~nsDOMFileReader()
if (mListenerManager)
mListenerManager->Disconnect();
FreeFileData();
nsLayoutStatics::Release();
}
@ -295,8 +296,6 @@ nsDOMFileReader::Abort()
if (mProgressNotifier) {
mProgressNotifier->Cancel();
}
mReadCount = 0;
mDataLen = 0;
//Revert status, result and readystate attributes
SetDOMStringToNull(mResult);
@ -312,8 +311,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 +358,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 +387,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,6 +449,7 @@ nsDOMFileReader::OnStopRequest(nsIRequest *aRequest,
//Set the status field as appropriate
if (NS_FAILED(aStatus)) {
FreeFileData();
DispatchError(aStatus);
return NS_OK;
}
@ -448,6 +468,8 @@ nsDOMFileReader::OnStopRequest(nsIRequest *aRequest,
return NS_ERROR_FAILURE;
}
FreeFileData();
//Dispatch load event to signify end of a successful load
DispatchProgressEvent(NS_LITERAL_STRING(LOAD_STR));
DispatchProgressEvent(NS_LITERAL_STRING(LOADEND_STR));
@ -466,9 +488,15 @@ nsDOMFileReader::ReadFileContent(nsIDOMFile* aFile,
//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 +513,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 +569,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"
@ -119,10 +120,15 @@ 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;
@ -137,9 +143,8 @@ protected:
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<nsIChannel> mChannel;
PRUint64 mReadTotal;
PRInt64 mReadTotal;
PRUint64 mReadTransferred;
PRPackedBool mReadComplete;
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadEndListener;
};

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

@ -600,6 +600,8 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
nsLoadFlags aLoadFlags)
{
if (!mLoadingEnabled) {
// XXX Why fire an error here? seems like the callers to SetLoadingEnabled
// don't want/need it.
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}

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

@ -890,7 +890,6 @@ nsObjectLoadingContent::GetInterface(const nsIID & aIID, void **aResult)
NS_ADDREF(sink);
return NS_OK;
}
return NS_NOINTERFACE;
}
@ -1872,3 +1871,17 @@ nsObjectLoadingContent::GetPluginDisabledState(const nsCString& aContentType)
return ePluginBlocklisted;
return ePluginUnsupported;
}
NS_IMETHODIMP
nsObjectLoadingContent::SetAbsoluteScreenPosition(nsIDOMElement* element,
nsIDOMClientRect* position,
nsIDOMClientRect* clip)
{
nsIObjectFrame* frame = GetExistingFrame(eFlushLayout);
if (!frame)
return NS_ERROR_NOT_AVAILABLE;
return frame->SetAbsoluteScreenPosition(element, position, clip);
}

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

@ -509,15 +509,6 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
!aElement->GetScriptAsync();
mPreloads.RemoveElementAt(i);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Grabbing existing speculative load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = CheckContentPolicy(mDocument, aElement, request->mURI, type);
if (NS_FAILED(rv)) {
// Note, we're dropping our last ref to request here.
@ -567,14 +558,6 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mIsInline = PR_FALSE;
request->mLoading = PR_TRUE;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting normal load for %s (%p). async:%d defer:%d\n",
spec.get(), request.get(), aElement->GetScriptAsync(),
request->mDefer);
}
rv = StartLoad(request, type);
if (NS_FAILED(rv)) {
return rv;
@ -587,10 +570,6 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mLineNo = aElement->GetScriptLineNumber();
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Creating inline request (%p).\n", request.get());
}
// If we've got existing pending requests, add ourselves
// to this list.
if (!hadPendingRequests && ReadyToExecuteScripts() &&
@ -630,10 +609,6 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
nsAFlatString* script;
nsAutoString textData;
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
printf("Running request (%p).\n", aRequest);
}
// If there's no script text, we try to get it from the element
if (aRequest->mIsInline) {
// XXX This is inefficient - GetText makes multiple
@ -984,13 +959,6 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
NS_ASSERTION(request, "null request in stream complete handler");
NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Finished loading %s (%p). status:%d\n", spec.get(), request,
aStatus);
}
nsresult rv = PrepareLoadedRequest(request, aLoader, aStatus, aStringLen,
aString);
if (NS_FAILED(rv)) {
@ -1144,14 +1112,6 @@ nsScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
request->mLoading = PR_TRUE;
request->mDefer = PR_FALSE; // This is computed later when we go to execute the
// script.
if (nsContentUtils::GetBoolPref("content.scriptloader.logloads")) {
nsCString spec;
request->mURI->GetSpec(spec);
printf("Starting speculative load for %s (%p).\n", spec.get(),
request.get());
}
nsresult rv = StartLoad(request, aType);
if (NS_FAILED(rv)) {
return;

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

@ -4,19 +4,10 @@
<!-- Async script that isn't preloaded -->
<script async src="file_bug503481.sjs?blockOn=R&body=runFirst();"></script>
<script>
function enableLogs(b) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("content.scriptloader.logloads", b);
}
enableLogs(true);
firstRan = false;
secondRan = false;
thirdRan = false;
forthRan = false;
fifthRan = false;
sixthRan = false;
function runFirst() {
firstRan = true;
}
@ -28,23 +19,12 @@ function runThird() {
function runForth() {
forthRan = true;
}
function runFifth() {
parent.is(sixthRan, false, "sixth should be not run before non-async fifth");
fifthRan = true;
}
function runSixth() {
parent.is(fifthRan, true, "fifth should run before async sixth");
sixthRan = true;
}
function done() {
parent.is(firstRan, true, "first should have run by onload");
parent.is(secondRan, true, "second should have run by onload");
parent.is(thirdRan, true, "third should have run by onload");
parent.is(forthRan, true, "forth should have run by onload");
parent.is(fifthRan, true, "fifth should have run by onload");
parent.is(sixthRan, true, "sixth should have run by onload");
enableLogs(false);
parent.SimpleTest.finish();
}
@ -65,7 +45,7 @@ unblock("R");
<script async>
secondRan = true;
</script>
<script async>
<script>
parent.is(secondRan, true, "Second script shouldn't be async");
</script>
@ -77,17 +57,6 @@ unblock("S");
</script>
<script src="file_bug503481.sjs?blockOn=T&body=runForth();"></script>
<!-- test that preloading an async script works -->
<script>
setTimeout(function () { unblock("U"); }, 1000);
</script>
<script src="file_bug503481.sjs?blockOn=U&body=runFifth();"></script>
<script async src="file_bug503481.sjs?blockOn=V&body=runSixth();"></script>
<script>
parent.is(fifthRan, true, "fifth should have run by now");
parent.is(sixthRan, false, "sixth should not have run yet");
unblock("V");
</script>
</head>
<body onload="done()">

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

@ -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>

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

@ -2026,10 +2026,20 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
NS_ASSERTION(list->Length() > 1,
"List should have been converted back to a single element");
// Fast-path appends; this check is ok even if the child is
// already in the list, since if it tests true the child would
// have come at the end of the list, and the PositionIsBefore
// will test false.
if(nsContentUtils::PositionIsBefore(list->GetNodeAt(list->Length() - 1), aChild)) {
list->AppendElement(aChild);
return NS_OK;
list->AppendElement(aChild);
return NS_OK;
}
// If a control has a name equal to its id, it could be in the
// list already.
if (list->IndexOf(aChild) != -1) {
return NS_OK;
}
// first is the first possible insertion index, last is the last possible
@ -2038,15 +2048,15 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
PRUint32 last = list->Length() - 1;
PRUint32 mid;
//Stop when there is only one index in our range
// Stop when there is only one index in our range
while (last != first) {
mid = (first + last) / 2;
mid = (first + last) / 2;
if (nsContentUtils::PositionIsBefore(aChild, list->GetNodeAt(mid)))
last = mid;
else
first = mid + 1;
}
if (nsContentUtils::PositionIsBefore(aChild, list->GetNodeAt(mid)))
last = mid;
else
first = mid + 1;
}
list->InsertElementAt(aChild, first);
}

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

@ -553,9 +553,14 @@ nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
ClearBrokenState();
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLImageElement>(this,
&nsHTMLImageElement::MaybeLoadImage));
// If loading is temporarily disabled, don't even launch MaybeLoadImage.
// Otherwise MaybeLoadImage may run later when someone has reenabled
// loading.
if (LoadingEnabled()) {
nsContentUtils::AddScriptRunner(
new nsRunnableMethod<nsHTMLImageElement>(this,
&nsHTMLImageElement::MaybeLoadImage));
}
}
return rv;

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

@ -2711,6 +2711,15 @@ nsHTMLInputElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission,
}
}
if (files.Count() == 0) {
// If no file was selected, pretend we had an empty file with an
// empty filename.
aFormSubmission->AddNameFilePair(this, name, EmptyString(), nsnull,
NS_LITERAL_CSTRING("application/octet-stream"),
PR_FALSE);
}
return NS_OK;
}

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

@ -141,6 +141,8 @@ _TEST_FILES = test_bug589.html \
test_bug519987.html \
test_bug523771.html \
form_submit_server.sjs \
test_bug529819.html \
test_bug529859.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=529819
-->
<head>
<title>Test for Bug 529819</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529819">Mozilla Bug 529819</a>
<p id="display"></p>
<div id="content" style="display: none">
<form id="form">
<input name="foo" id="foo">
<input name="bar" type="radio">
<input name="bar" id="bar" type="radio">
</form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 529819 **/
is($("form").elements["foo"] instanceof HTMLInputElement, true, "Should have an element here");
is($("form").elements["bar"] instanceof HTMLInputElement, false, "Should have a list here");
is($("form").elements["bar"].length, 2, "Should have a list with two elements here");
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=529859
-->
<head>
<title>Test for Bug 529859</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529859">Mozilla Bug 529859</a>
<div id="content">
<iframe name="target_iframe" id="target_iframe"></iframe>
<form action="form_submit_server.sjs" target="target_iframe" id="form"
method="POST" enctype="multipart/form-data">
<input id="emptyFileInput" name="emptyFileInput" type="file">
</form>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 529859 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
$("target_iframe").onload = function() {
var response = JSON.parse(this.contentDocument.documentElement.textContent);
is(response.length, 1, "Unexpected number of inputs");
is(response[0].headers["Content-Disposition"],
"form-data; name=\"emptyFileInput\"; filename=\"\"",
"Incorrect content-disposition");
is(response[0].headers["Content-Type"], "application/octet-stream",
"Unexpected content-type");
SimpleTest.finish();
}
$("form").submit();
});
</script>
</pre>
</body>
</html>

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

@ -73,6 +73,7 @@
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDocShellTreeItem.h"
#include "nsThreadUtils.h"
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
#define CLICK_IMAGE_RESIZING_PREF "browser.enable_click_image_resizing"
@ -127,6 +128,9 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsImageDocument, nsMediaDocument)
friend class ImageListener;
void DefaultCheckOverflowing() { CheckOverflowing(mResizeImageByDefault); }
protected:
virtual nsresult CreateSyntheticDocument();
@ -572,7 +576,9 @@ nsImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
{
aImage->GetWidth(&mImageWidth);
aImage->GetHeight(&mImageHeight);
CheckOverflowing(mResizeImageByDefault);
nsCOMPtr<nsIRunnable> runnable =
NS_NEW_RUNNABLE_METHOD(nsImageDocument, this, DefaultCheckOverflowing);
nsContentUtils::AddScriptRunner(runnable);
UpdateTitleAndCharset();
return NS_OK;

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

@ -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();

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

@ -580,8 +580,10 @@ nsXULElement::IsFocusable(PRInt32 *aTabIndex)
}
else {
// otherwise, if there is no tabindex attribute, just use the value of
// *aTabIndex to indicate focusability
// *aTabIndex to indicate focusability. Reset any supplied tabindex to 0.
shouldFocus = *aTabIndex >= 0;
if (shouldFocus)
*aTabIndex = 0;
}
if (shouldFocus && sTabFocusModelAppliesToXUL &&

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

@ -17,25 +17,24 @@ var w = null;
var phase = 0;
var gotWrongPageOnTryAgainClick = false;
function pollForPage(expected_title, f, w)
function pollForPage(f, w)
{
// Start with polling after a delay, we might mistakenly take the current page
// as an expected one.
window.setTimeout(function() {
var iterationsLeft = 20;
var iterationsLeft = 200;
var int = window.setInterval(function() {
iterationsLeft--;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var haveErrorPage = false;
try {
var title = w.document.title;
}
catch (ex) {
alert(ex);
return;
haveErrorPage = true;
}
if (iterationsLeft == 0 || title.match(expected_title)) {
if (iterationsLeft == 0 || haveErrorPage) {
window.clearInterval(int);
f(iterationsLeft > 0);
}
@ -56,7 +55,7 @@ function windowLoaded()
phase = 1;
pollForPage("Problem loading page", function(succeeded) {
pollForPage(function(succeeded) {
ok(succeeded, "Waiting for error page succeeded");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -64,7 +63,7 @@ function windowLoaded()
click the "Try Again" button */
w.location.reload();
pollForPage("Problem loading page", function(succeeded) {
pollForPage(function(succeeded) {
ok(succeeded, "Waiting for error page succeeded");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

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

@ -16,25 +16,24 @@ var faultyURL = "http://some-non-existent-domain-27489274c892748217cn2384.com/";
var w = null;
var phase = 0;
function pollForPage(expected_title, f, w)
function pollForPage(expectErrorPage, f, w)
{
// Start with polling after a delay, we might mistakenly take the current page
// as an expected one.
window.setTimeout(function() {
var iterationsLeft = 20;
var iterationsLeft = 200;
var int = window.setInterval(function() {
iterationsLeft--;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var haveErrorPage = false;
try {
var title = w.document.title;
}
catch (ex) {
alert(ex);
return;
haveErrorPage = true;
}
if (iterationsLeft == 0 || title.match(expected_title)) {
if (iterationsLeft == 0 || expectErrorPage == haveErrorPage) {
window.clearInterval(int);
f(iterationsLeft > 0);
}
@ -52,7 +51,7 @@ function windowLoaded()
w.location.href = faultyURL;
}, 0);
pollForPage("Problem loading page", function(succeeded) {
pollForPage(true, function(succeeded) {
ok(succeeded, "Waiting for error page succeeded");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -64,7 +63,7 @@ function windowLoaded()
ok(false, "w.back() threw " + ex);
}
pollForPage("Test bug 529119, sub-window", function(succeeded) {
pollForPage(false, function(succeeded) {
ok(succeeded, "Waiting for original page succeeded");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

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

@ -80,6 +80,8 @@
#include "nsFrameSelection.h"
#include "nsXULPopupManager.h"
#include "nsImageMapUtils.h"
#include "nsTreeWalker.h"
#include "nsIDOMNodeFilter.h"
#ifdef MOZ_XUL
#include "nsIDOMXULTextboxElement.h"
@ -2115,6 +2117,8 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
startContent->IsFocusable(&tabIndex);
else if (frame)
frame->IsFocusable(&tabIndex, 0);
else
startContent->IsFocusable(&tabIndex);
// if the current element isn't tabbable, ignore the tabindex and just
// look for the next element. The root content won't have a tabindex
@ -2185,7 +2189,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
endSelectionContent, aNextContent);
return NS_OK;
}
// when starting from a selection, we always want to find the next or
// previous element in the document. So the tabindex on elements
// should be ignored.
@ -2356,7 +2360,8 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
{
*aResultContent = nsnull;
if (!aStartContent)
nsCOMPtr<nsIContent> startContent = aStartContent;
if (!startContent)
return NS_OK;
#ifdef DEBUG_FOCUS_NAVIGATION
@ -2366,19 +2371,38 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
nsPresContext* presContext = aPresShell->GetPresContext();
PRBool getNextFrame = PR_TRUE;
nsCOMPtr<nsIContent> iterStartContent = aStartContent;
while (1) {
nsIFrame* aStartFrame = aPresShell->GetPrimaryFrameFor(aStartContent);
if (!aStartFrame) {
// if there is no frame, just get the root frame
aStartFrame = aPresShell->GetPrimaryFrameFor(aRootContent);
if (!aStartFrame)
nsIFrame* startFrame = aPresShell->GetPrimaryFrameFor(iterStartContent);
// if there is no frame, look for another content node that has a frame
if (!startFrame) {
// if the root content doesn't have a frame, just return
if (iterStartContent == aRootContent)
return NS_OK;
aStartContent = aRootContent;
// look for the next or previous content node in tree order
nsTreeWalker walker(aRootContent, nsIDOMNodeFilter::SHOW_ALL, nsnull, PR_TRUE);
nsCOMPtr<nsIDOMNode> nextNode = do_QueryInterface(iterStartContent);
walker.SetCurrentNode(nextNode);
if (NS_SUCCEEDED(aForward ? walker.NextNode(getter_AddRefs(nextNode)) :
walker.PreviousNode(getter_AddRefs(nextNode)))) {
iterStartContent = do_QueryInterface(nextNode);
// we've already skipped over the initial focused content, so we
// don't want to traverse frames.
getNextFrame = PR_FALSE;
if (iterStartContent)
continue;
}
// otherwise, as a last attempt, just look at the root content
iterStartContent = aRootContent;
continue;
}
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
nsresult rv = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),
presContext, aStartFrame,
presContext, startFrame,
ePreOrder,
PR_FALSE, // aVisual
PR_FALSE, // aLockInScrollView
@ -2386,12 +2410,13 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
);
NS_ENSURE_SUCCESS(rv, rv);
if (aStartContent == aRootContent) {
if (iterStartContent == aRootContent) {
if (!aForward)
frameTraversal->Last();
}
else if (!aStartContent || aStartContent->Tag() != nsGkAtoms::area ||
!aStartContent->IsHTML()) {
else if (getNextFrame &&
(!iterStartContent || iterStartContent->Tag() != nsGkAtoms::area ||
!iterStartContent->IsHTML())) {
// Need to do special check in case we're in an imagemap which has multiple
// content nodes per frame, so don't skip over the starting frame.
if (aForward)
@ -2430,7 +2455,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
// nsIFrameTraversal so look for the next or previous area element.
nsIContent *areaContent =
GetNextTabbableMapArea(aForward, aCurrentTabIndex,
currentContent, aStartContent);
currentContent, iterStartContent);
if (areaContent) {
NS_ADDREF(*aResultContent = areaContent);
return NS_OK;
@ -2487,7 +2512,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
// a textbox is focused, the enclosing textbox would be found and
// the same inner input would be returned again.
else if (currentContent == aRootContent ||
(currentContent != aStartContent &&
(currentContent != startContent &&
(aForward || !GetRedirectedFocus(currentContent)))) {
NS_ADDREF(*aResultContent = currentContent);
return NS_OK;
@ -2535,7 +2560,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
// continue looking for next highest priority tabindex
aCurrentTabIndex = GetNextTabIndex(aRootContent, aCurrentTabIndex, aForward);
aStartContent = aRootContent;
startContent = iterStartContent = aRootContent;
}
return NS_OK;

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

@ -316,6 +316,9 @@ protected:
* node, in the case of recursive or looping calls.
*
* aStartContent is the starting point for this call of this method.
* If aStartContent doesn't have visual representation, the next content
* object, which does have a primary frame, will be used as a start.
* If that content object is focusable, the method may return it.
*
* aForward should be true for forward navigation or false for backward
* navigation.

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

@ -930,6 +930,55 @@ nsGlobalWindow::ClearControllers()
}
}
class ClearScopeEvent : public nsRunnable
{
public:
ClearScopeEvent(nsGlobalWindow *innerWindow)
: mInnerWindow(innerWindow) {
}
NS_IMETHOD Run()
{
mInnerWindow->ReallyClearScope(this);
return NS_OK;
}
private:
nsRefPtr<nsGlobalWindow> mInnerWindow;
};
void
nsGlobalWindow::ReallyClearScope(nsRunnable *aRunnable)
{
NS_ASSERTION(IsInnerWindow(), "Must be an inner window");
nsIScriptContext *jsscx = GetContextInternal();
if (jsscx && jsscx->GetExecutingScript()) {
if (!aRunnable) {
aRunnable = new ClearScopeEvent(this);
if (!aRunnable) {
// The only reason that we clear scope here is to try to prevent
// leaks. Failing to clear scope might mean that we'll leak more
// but if we don't have enough memory to allocate a ClearScopeEvent
// we probably don't have to worry about this anyway.
return;
}
}
NS_DispatchToMainThread(aRunnable);
return;
}
PRUint32 lang_id;
NS_STID_FOR_ID(lang_id) {
// Note that scx comes from the outer window. If this is an inner
// window, it may not be the current inner for its outer.
nsIScriptContext *scx = GetScriptContextInternal(lang_id);
if (scx)
scx->ClearScope(mScriptGlobals[NS_STID_INDEX(lang_id)], PR_TRUE);
}
}
void
nsGlobalWindow::FreeInnerObjects(PRBool aClearScope)
{
@ -983,14 +1032,9 @@ nsGlobalWindow::FreeInnerObjects(PRBool aClearScope)
}
if (aClearScope) {
PRUint32 lang_id;
NS_STID_FOR_ID(lang_id) {
// Note that scx comes from the outer window. If this is an inner
// window, it may not be the current inner for its outer.
nsIScriptContext *scx = GetScriptContextInternal(lang_id);
if (scx)
scx->ClearScope(mScriptGlobals[NS_STID_INDEX(lang_id)], PR_TRUE);
}
// NB: This might not clear our scope, but fire an event to do so
// instead.
ReallyClearScope(nsnull);
}
if (mDummyJavaPluginOwner) {

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

@ -122,6 +122,7 @@ class nsGlobalWindowObserver;
class nsGlobalWindow;
class nsDummyJavaPluginOwner;
class PostMessageEvent;
class nsRunnable;
class nsDOMOfflineResourceList;
class nsGeolocation;
@ -238,6 +239,7 @@ public:
nsPIDOMWindow* GetPrivateParent();
// callback for close event
void ReallyCloseWindow();
void ReallyClearScope(nsRunnable *aRunnable);
// nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

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

@ -56,10 +56,10 @@ class nsScriptObjectHolder;
typedef void (*nsScriptTerminationFunc)(nsISupports* aRef);
// 87482b5e-e019-4df5-9bc2-b2a51b1f2d28
// A4FE2B52-62B5-40C3-BF9C-5E0A27B10F90
#define NS_ISCRIPTCONTEXT_IID \
{ 0x87482b5e, 0xe019, 0x4df5, \
{ 0x9b, 0xc2, 0xb2, 0xa5, 0x1b, 0x1f, 0x2d, 0x28 } }
{ 0xA4FE2B52, 0x62B5, 0x40C3, \
{ 0xBF, 0x9C, 0x5E, 0x0A, 0x27, 0xB1, 0x0F, 0x90 } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -402,6 +402,11 @@ public:
virtual PRBool GetProcessingScriptTag() = 0;
virtual void SetProcessingScriptTag(PRBool aResult) = 0;
/**
* Called to find out if this script context might be executing script.
*/
virtual PRBool GetExecutingScript() = 0;
/**
* Tell the context whether or not to GC when destroyed. An optimization
* used when the window is a [i]frame, so GC will happen anyway.

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

@ -1312,7 +1312,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
return 0;
}
nsJSContext::nsJSContext(JSRuntime *aRuntime) : mGCOnDestruction(PR_TRUE)
nsJSContext::nsJSContext(JSRuntime *aRuntime)
: mGCOnDestruction(PR_TRUE),
mExecuteDepth(0)
{
++sContextCount;
@ -1522,6 +1524,8 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
JSAutoRequest ar(mContext);
nsJSVersionSetter setVersion(mContext, aVersion);
++mExecuteDepth;
ok = ::JS_EvaluateUCScriptForPrincipals(mContext,
(JSObject *)aScopeObject,
jsprin,
@ -1531,6 +1535,8 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
aLineNo,
&val);
--mExecuteDepth;
if (!ok) {
// Tell XPConnect about any pending exceptions. This is needed
// to avoid dropping JS exceptions in case we got here through
@ -1688,6 +1694,8 @@ nsJSContext::EvaluateString(const nsAString& aScript,
nsJSContext::TerminationFuncHolder holder(this);
++mExecuteDepth;
// SecurityManager said "ok", but don't compile if aVersion is unknown.
// Since the caller is responsible for parsing the version strings, we just
// check it isn't JSVERSION_UNKNOWN.
@ -1731,6 +1739,8 @@ nsJSContext::EvaluateString(const nsAString& aScript,
}
}
--mExecuteDepth;
// Pop here, after JS_ValueToString and any other possible evaluation.
if (NS_FAILED(stack->Pop(nsnull)))
rv = NS_ERROR_FAILURE;
@ -1849,6 +1859,7 @@ nsJSContext::ExecuteScript(void *aScriptObject,
nsJSContext::TerminationFuncHolder holder(this);
JSAutoRequest ar(mContext);
++mExecuteDepth;
ok = ::JS_ExecuteScript(mContext,
(JSObject *)aScopeObject,
(JSScript*)::JS_GetPrivate(mContext,
@ -1868,6 +1879,8 @@ nsJSContext::ExecuteScript(void *aScriptObject,
}
}
--mExecuteDepth;
// Pop here, after JS_ValueToString and any other possible evaluation.
if (NS_FAILED(stack->Pop(nsnull)))
rv = NS_ERROR_FAILURE;
@ -2111,8 +2124,10 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
jsval funval = OBJECT_TO_JSVAL(static_cast<JSObject *>(aHandler));
JSAutoRequest ar(mContext);
++mExecuteDepth;
PRBool ok = ::JS_CallFunctionValue(mContext, target,
funval, argc, argv, &rval);
--mExecuteDepth;
if (!ok) {
// Tell XPConnect about any pending exceptions. This is needed
@ -3498,6 +3513,12 @@ nsJSContext::SetProcessingScriptTag(PRBool aFlag)
mProcessingScriptTag = aFlag;
}
PRBool
nsJSContext::GetExecutingScript()
{
return JS_IsRunning(mContext) || mExecuteDepth > 0;
}
void
nsJSContext::SetGCOnDestruction(PRBool aGCOnDestruction)
{

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

@ -149,6 +149,8 @@ public:
virtual PRBool GetProcessingScriptTag();
virtual void SetProcessingScriptTag(PRBool aResult);
virtual PRBool GetExecutingScript();
virtual void SetGCOnDestruction(PRBool aGCOnDestruction);
virtual nsresult InitClasses(void *aGlobalObj);
@ -292,6 +294,7 @@ private:
PRPackedBool mGCOnDestruction;
PRPackedBool mProcessingScriptTag;
PRUint32 mExecuteDepth;
PRUint32 mDefaultJSOptions;
PRTime mOperationCallbackTime;

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

@ -24,6 +24,7 @@
<a id="t24" tabindex="0" href="#">2</a>
<a id="t25" href="#">Link 3</a>
<br>
<span id="hiddenspan" style="display: none;"></span>
<input id="t26" tabindex="0" type="checkbox" accesskey="a">
<input id="o11" tabindex="-1" type="checkbox">
<div style="display: none;"><input/></div>

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

@ -940,6 +940,33 @@ function testMoveFocus()
prefs.setBoolPref("accessibility.browsewithcaret", false);
// cases where focus in on a content node with no frame
if (!gPartialTabbing) {
getById("t24").blur();
gEvents = "";
gLastFocus = null;
gLastFocusWindow = gChildWindow;
gLastFocusMethod = fm.FLAG_BYKEY;
selection.selectAllChildren(getById("hiddenspan"));
expectFocusShift(function () synthesizeKey("VK_TAB", { }),
gChildWindow, getById("t26"), true, "tab with selection on hidden content");
setFocusTo($("o15"), window);
$("o15").hidden = true;
document.documentElement.getBoundingClientRect(); // flush after hiding
expectFocusShift(function () synthesizeKey("VK_TAB", { }),
window, $("o17"), true, "tab with focus on hidden content");
$("o17").hidden = true;
document.documentElement.getBoundingClientRect();
expectFocusShift(function () synthesizeKey("VK_TAB", { shiftKey: true }),
window, $("o13"), true, "shift+tab with focus on hidden content");
}
// cases with selection in an <input>
var t19 = getById("t19");
t19.setSelectionRange(0, 0);
setFocusTo("t18", gChildWindow);

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

@ -20,6 +20,7 @@
*
* Contributor(s):
* Darin Fisher <darin@meer.net>
* Jim Mathies <jmathies@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -228,12 +229,8 @@ nsAuthSSPI::Init(const char *serviceName,
{
LOG((" nsAuthSSPI::Init\n"));
// we don't expect to be passed any user credentials
NS_ASSERTION(!domain && !username && !password, "unexpected credentials");
// if we're configured for SPNEGO (Negotiate) or Kerberos, then it's critical
// that the caller supply a service name to be used.
// For NTLM, the service principal name can no longer be null. (Bug 487872)
// The caller must supply a service name to be used. (For why we now require
// a service name for NTLM, see bug 487872.)
NS_ENSURE_TRUE(serviceName && *serviceName, NS_ERROR_INVALID_ARG);
nsresult rv;
@ -266,18 +263,41 @@ nsAuthSSPI::Init(const char *serviceName,
TimeStamp useBefore;
SEC_WINNT_AUTH_IDENTITY_W ai;
SEC_WINNT_AUTH_IDENTITY_W *pai = nsnull;
// domain, username, and password will be null if nsHttpNTLMAuth's ChallengeReceived
// returns false for identityInvalid. Use default credentials in this case by passing
// null for pai.
if (username && password) {
if (domain) {
ai.Domain = const_cast<unsigned short*>(domain);
ai.DomainLength = wcslen(domain);
}
else {
ai.Domain = NULL;
ai.DomainLength = 0;
}
ai.User = const_cast<unsigned short*>(username);
ai.UserLength = wcslen(username);
ai.Password = const_cast<unsigned short*>(password);
ai.PasswordLength = wcslen(password);
ai.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
pai = &ai;
}
rc = (sspi->AcquireCredentialsHandleW)(NULL,
package,
SECPKG_CRED_OUTBOUND,
NULL,
NULL,
pai,
NULL,
NULL,
&mCred,
&useBefore);
if (rc != SEC_E_OK)
return NS_ERROR_UNEXPECTED;
LOG(("AcquireCredentialsHandle() succeeded.\n"));
return NS_OK;
}
@ -351,6 +371,14 @@ nsAuthSSPI::GetNextToken(const void *inToken,
&ctxAttr,
&ignored);
if (rc == SEC_I_CONTINUE_NEEDED || rc == SEC_E_OK) {
#ifdef PR_LOGGING
if (rc == SEC_E_OK)
LOG(("InitializeSecurityContext: succeeded.\n"));
else
LOG(("InitializeSecurityContext: continue.\n"));
#endif
if (!ob.cbBuffer) {
nsMemory::Free(ob.pvBuffer);
ob.pvBuffer = NULL;

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

@ -257,15 +257,15 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpChannel *httpChannel,
challenge++;
len = strlen(challenge);
// strip off any padding (see bug 230351)
while (challenge[len - 1] == '=')
len--;
inTokenLen = (len * 3)/4;
inToken = malloc(inTokenLen);
if (!inToken)
return (NS_ERROR_OUT_OF_MEMORY);
// strip off any padding (see bug 230351)
while (challenge[len - 1] == '=')
len--;
//
// Decode the response that followed the "Negotiate" token
//

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

@ -5231,11 +5231,13 @@ struct cs_info * get_current_cs(const char * es) {
return nsnull;
rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
if (encoder && NS_SUCCEEDED(rv))
encoder->SetOutputErrorBehavior(encoder->kOnError_Replace, nsnull, '?');
if (NS_FAILED(rv))
return nsnull;
encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nsnull, '?');
rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
if (NS_FAILED(rv))
return nsnull;
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
caseConv = do_GetService(kUnicharUtilCID, &rv);
if (NS_FAILED(rv))
@ -5243,49 +5245,60 @@ struct cs_info * get_current_cs(const char * es) {
ccs = (struct cs_info *) malloc(256 * sizeof(cs_info));
PRInt32 charLength = 256;
PRInt32 uniLength = 512;
char *source = (char *)malloc(charLength * sizeof(char));
PRUnichar *uni = (PRUnichar *)malloc(uniLength * sizeof(PRUnichar));
char *lower = (char *)malloc(charLength * sizeof(char));
char *upper = (char *)malloc(charLength * sizeof(char));
for (unsigned int i = 0; i <= 0xff; ++i) {
PRBool success = PR_FALSE;
// We want to find the upper/lowercase equivalents of each byte
// in this 1-byte character encoding. Call our encoding/decoding
// APIs separately for each byte since they may reject some of the
// bytes, and we want to handle errors separately for each byte.
char lower, upper;
do {
if (i == 0)
break;
const char source = char(i);
PRUnichar uni, uniCased;
PRInt32 charLength = 1, uniLength = 1;
// Create a long string of all chars.
unsigned int i;
for (i = 0x00; i <= 0xff ; ++i) {
source[i] = i;
}
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
// Explicitly check NS_OK because we don't want to allow
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
if (rv != NS_OK || charLength != 1 || uniLength != 1)
break;
rv = caseConv->ToLower(uni, &uniCased);
if (NS_FAILED(rv))
break;
rv = encoder->Convert(&uniCased, &uniLength, &lower, &charLength);
// Explicitly check NS_OK because we don't want to allow
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
if (rv != NS_OK || charLength != 1 || uniLength != 1)
break;
// Convert this long string to unicode
rv = decoder->Convert(source, &charLength, uni, &uniLength);
rv = caseConv->ToUpper(uni, &uniCased);
if (NS_FAILED(rv))
break;
rv = encoder->Convert(&uniCased, &uniLength, &upper, &charLength);
// Explicitly check NS_OK because we don't want to allow
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
if (rv != NS_OK || charLength != 1 || uniLength != 1)
break;
// Do case conversion stuff, and convert back.
caseConv->ToUpper(uni, uni, uniLength);
encoder->Convert(uni, &uniLength, upper, &charLength);
success = PR_TRUE;
} while (0);
uniLength = 512;
charLength = 256;
rv = decoder->Convert(source, &charLength, uni, &uniLength);
caseConv->ToLower(uni, uni, uniLength);
encoder->Convert(uni, &uniLength, lower, &charLength);
if (success) {
ccs[i].cupper = upper;
ccs[i].clower = lower;
} else {
ccs[i].cupper = i;
ccs[i].clower = i;
}
// Store
for (i = 0x00; i <= 0xff ; ++i) {
ccs[i].cupper = upper[i];
ccs[i].clower = lower[i];
if (ccs[i].clower != (unsigned char)i)
ccs[i].ccase = true;
else
ccs[i].ccase = false;
}
free(source);
free(uni);
free(lower);
free(upper);
return ccs;
}
#endif

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

@ -20,11 +20,16 @@ ifeq (86,$(findstring 86,$(OS_TEST)))
ifdef GNU_CC
SSE1_FLAGS=-msse
SSE2_FLAGS=-msse2
else
ifeq ($(SOLARIS_SUNPRO_CC),1)
SSE1_FLAGS=-xarch=sse
SSE2_FLAGS=-xarch=sse2
else
SSE1_FLAGS=
SSE2_FLAGS=
endif
endif
endif
FORCE_STATIC_LIB = 1
# This library is used by other shared libs

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

@ -25,10 +25,10 @@
#include <assert.h>
#include "qcmsint.h"
/* for MSVC, GCC, and Intel compilers */
#if defined(_M_IX86) || defined(__i386__) || defined(_M_AMD64) || defined(__x86_64__)
/* for MSVC, GCC, Intel, and Sun compilers */
#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64)
#define X86
#endif /* _M_IX86 || __i386__ || _M_AMD64 || __x86_64__ */
#endif /* _M_IX86 || __i386__ || __i386 || _M_AMD64 || __x86_64__ || __x86_64 */
//XXX: could use a bettername
typedef uint16_t uint16_fract_t;
@ -1062,7 +1062,7 @@ static void cpuid(uint32_t fxn, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t
*c = c_;
*d = d_;
}
#elif defined(__GNUC__) && defined(__i386__)
#elif (defined(__GNUC__) || defined(__SUNPRO_C)) && (defined(__i386__) || defined(__i386))
#define HAS_CPUID
/* Get us a CPUID function. We can't use ebx because it's the PIC register on
some platforms, so we use ESI instead and save ebx to avoid clobbering it. */
@ -1088,7 +1088,7 @@ static void cpuid(uint32_t fxn, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t
static int sse_version_available(void)
{
#if defined(__x86_64__) || defined(_M_AMD64)
#if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64)
/* we know at build time that 64-bit CPUs always have SSE2
* this tells the compiler that non-SSE2 branches will never be
* taken (i.e. OK to optimze away the SSE1 and non-SIMD code */

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

@ -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

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

@ -472,13 +472,6 @@ endif
endif
ifdef SOLARIS_SUNPRO_CXX
# Sun Studio x86 has an optimization bug with LIR.cpp, use -xO2 instead.
ifeq (86,$(findstring 86,$(OS_TEST)))
LIR.o: LIR.cpp Makefile.in
$(REPORT_BUILD)
@$(MAKE_DEPS_AUTO_CXX)
$(CXX) -o $@ -c $(patsubst -xO%,-xO2,$(COMPILE_CFLAGS)) $<
else
# Sun Studio SPARC doesn't work well with gcc inline asm, use lock_SunOS_sparc*.il
jslock.o: jslock.cpp Makefile.in lock_sparcv8plus.il lock_sparcv9.il
$(REPORT_BUILD)
@ -488,7 +481,6 @@ ifeq (sparcv9,$(findstring sparcv9,$(OS_TEST)))
else
$(CXX) -o $@ -c $(COMPILE_CFLAGS) $(srcdir)/lock_sparcv8plus.il $<
endif # sparcv9
endif # x86
endif # SOLARIS_SUNPRO_CXX
# Allow building jsinterp.c with special optimization flags

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

@ -362,6 +362,9 @@ endif # WINNT
ifeq ($(SOLARIS_SUNPRO_CXX),1)
CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
ifeq (86,$(findstring 86,$(OS_TEST)))
OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
endif # x86
endif # Solaris Sun Studio C++
ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))

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

@ -0,0 +1 @@
hwcap_1 = OVERRIDE;

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

@ -1,119 +0,0 @@
!
! ***** BEGIN LICENSE BLOCK *****
! Version: MPL 1.1/GPL 2.0/LGPL 2.1
!
! The contents of this file are subject to the Mozilla Public License Version
! 1.1 (the "License"); you may not use this file except in compliance with
! the License. You may obtain a copy of the License at
! http://www.mozilla.org/MPL/
!
! Software distributed under the License is distributed on an "AS IS" basis,
! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
! for the specific language governing rights and limitations under the
! License.
!
! The Original Code is Mozilla Communicator client code, released
! March 31, 1998.
!
! The Initial Developer of the Original Code is
! Netscape Communications Corporation.
! Portions created by the Initial Developer are Copyright (C) 1998-1999
! the Initial Developer. All Rights Reserved.
!
! Contributor(s):
!
! 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 *****
!
! atomic compare-and-swap routines for V8 sparc
! and for V8+ (ultrasparc)
!
!
! standard asm linkage macros; this module must be compiled
! with the -P option (use C preprocessor)
#include <sys/asm_linkage.h>
! ======================================================================
!
! Perform the sequence *a = b atomically with respect to previous value
! of a (a0). If *a==a0 then assign *a to b, all in one atomic operation.
! Returns 1 if assignment happened, and 0 otherwise.
!
! usage : old_val = compare_and_swap(address, oldval, newval)
!
! -----------------------
! Note on REGISTER USAGE:
! as this is a LEAF procedure, a new stack frame is not created;
! we use the caller stack frame so what would normally be %i (input)
! registers are actually %o (output registers). Also, we must not
! overwrite the contents of %l (local) registers as they are not
! assumed to be volatile during calls.
!
! So, the registers used are:
! %o0 [input] - the address of the value to increment
! %o1 [input] - the old value to compare with
! %o2 [input] - the new value to set for [%o0]
! %o3 [local] - work register
! -----------------------
#ifndef ULTRA_SPARC
! v8
ENTRY(compare_and_swap) ! standard assembler/ELF prologue
stbar
mov -1,%o3 ! busy flag
swap [%o0],%o3 ! get current value
l1: cmp %o3,-1 ! busy?
be,a l1 ! if so, spin
swap [%o0],%o3 ! using branch-delay to swap back value
cmp %o1,%o3 ! compare old with current
be,a l2 ! if equal then swap in new value
swap [%o0],%o2 ! done.
swap [%o0],%o3 ! otherwise, swap back current value
retl
mov 0,%o0 ! return false
l2: retl
mov 1,%o0 ! return true
SET_SIZE(compare_and_swap) ! standard assembler/ELF epilogue
!
! end
!
#else /* ULTRA_SPARC */
! ======================================================================
!
! v9
ENTRY(compare_and_swap) ! standard assembler/ELF prologue
stbar
cas [%o0],%o1,%o2 ! compare *w with old value and set to new if equal
cmp %o1,%o2 ! did we succeed?
be,a m1 ! yes
mov 1,%o0 ! return true (annulled when no jump)
mov 0,%o0 ! return false
m1: retl
nop
SET_SIZE(compare_and_swap) ! standard assembler/ELF epilogue
!
! end
!
! ======================================================================
!
#endif

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

@ -595,7 +595,7 @@ function jit(on)
if (on)
{
jitoptions.setBoolPref('content', true);
jitoptions.setBoolPref('chrome', false);
jitoptions.setBoolPref('chrome', true);
}
else
{
@ -604,8 +604,6 @@ function jit(on)
}
}
var gVersion = 150;
function jsTestDriverBrowserInit()
{
@ -657,12 +655,14 @@ function jsTestDriverBrowserInit()
if (!properties.version && navigator.userAgent.indexOf('Gecko/') != -1)
{
// If the version is not specified, and the browser is Gecko,
// adjust the version to match the suite version.
if (properties.test.match(/^js1_6/))
{
properties.version = '1.6';
}
else if (properties.test.match(/^js1_7/))
// use the default version corresponding to the shell's version(0).
// See https://bugzilla.mozilla.org/show_bug.cgi?id=522760#c11
// Otherwise adjust the version to match the suite version for 1.7,
// and later due to the use of let, yield, etc.
//
// Note that js1_8, js1_8_1, and js1_8_5 are treated identically in
// the browser.
if (properties.test.match(/^js1_7/))
{
properties.version = '1.7';
}
@ -670,14 +670,6 @@ function jsTestDriverBrowserInit()
{
properties.version = '1.8';
}
else if (properties.test.match(/^js1_8_1/))
{
properties.version = '1.8';
}
else
{
properties.version = '1.5';
}
}
// default to language=type;text/javascript. required for
@ -690,8 +682,6 @@ function jsTestDriverBrowserInit()
gTestPath = properties.test;
gVersion = 10*parseInt(properties.version.replace(/\./g, ''));
if (properties.gczeal)
{
gczeal(Number(properties.gczeal));

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

@ -41,12 +41,6 @@
gTestsuite = 'e4x';
if (typeof version != 'undefined') {
// At least in Rhino, if version is set to 150 (which is what is used
// in top level shell.js), the implementation assumes E4X is not available.
version(160);
}
/*
* Report a failure in the 'accepted' manner
*/

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

@ -56,9 +56,6 @@ var TITLE = "Logical NOT operator (!)";
writeHeaderToLog( SECTION + " "+ TITLE);
// version("130")
new TestCase( SECTION, "!(null)", true, !(null) );
new TestCase( SECTION, "!(var x)", true, !(eval("var x")) );
new TestCase( SECTION, "!(void 0)", true, !(void 0) );

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

@ -38,10 +38,3 @@
* ***** END LICENSE BLOCK ***** */
gTestsuite = 'ecma_3_1';
// explicitly turn on js18
if (typeof version != 'undefined')
{
version(180);
}

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

@ -61,7 +61,7 @@ script regress-340199.js
script regress-341956-01.js
script regress-341956-02.js
script regress-341956-03.js
random-if(xulRuntime.OS=="WINNT"&&!isDebugBuild) skip-if(xulRuntime.OS=="Linux") script regress-342960.js # slow
skip-if(!xulRuntime.shell&&(xulRuntime.OS=="WINNT"||xulRuntime.OS=="Linux")) script regress-342960.js # bug 528464
skip script regress-345967.js # slow
script regress-346494-01.js
script regress-346494.js
@ -144,7 +144,7 @@ script regress-369404.js
script regress-369696-01.js
script regress-369696-02.js
script regress-369696-03.js
random-if(xulRuntime.OS=="WINNT"&&isDebugBuild) script regress-371636.js # bug 528284
random-if(xulRuntime.OS=="WINNT") script regress-371636.js # bug 528284
script regress-372309.js
script regress-374589.js
script regress-375183.js

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

@ -38,10 +38,3 @@
* ***** END LICENSE BLOCK ***** */
gTestsuite = 'js1_6';
// explicitly turn on js16
if (typeof version != 'undefined')
{
version(160);
}

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

@ -40,8 +40,9 @@
gTestsuite = 'js1_8_1';
// explicitly turn on js181
// XXX: The browser currently only supports up to version 1.8
if (typeof version != 'undefined')
{
version(180);
version(181);
}

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

@ -20,4 +20,4 @@ script regress-462459-12.js
script regress-469927.js
script regress-470739.js
script regress-471635.js
fails-if(!xulRuntime.shell) script trace-test.js # uncaught exception: [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)
script trace-test.js

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

@ -4275,18 +4275,28 @@ function testInterpreterReentry2() {
var b = {};
var c = false;
var d = {};
this.__defineGetter__('e', function(){});
for (let f in this) print(f);
[1 for each (g in this) for each (h in [])]
try {
this.__defineGetter__('e', function(){});
for (let f in this) print(f);
[1 for each (g in this) for each (h in [])]
}
catch(ex) {
print('testInterpreterReentry2: ' + ex);
}
return 1;
}
testInterpreterReentry2.expected = 1;
test(testInterpreterReentry2);
function testInterpreterReentry3() {
for (let i=0;i<5;++i) this["y" + i] = function(){};
this.__defineGetter__('e', function (x2) { yield; });
[1 for each (a in this) for (b in {})];
try {
for (let i=0;i<5;++i) this["y" + i] = function(){};
this.__defineGetter__('e', function (x2) { yield; });
[1 for each (a in this) for (b in {})];
}
catch(ex) {
print('testInterpreterReentry3: ' + ex);
}
return 1;
}
testInterpreterReentry3.expected = 1;

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

@ -0,0 +1,4 @@
JavaScript 1.8.5
Use this suite for tests which require EcmaScript 5 along with features such as
|let|, |yield|

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

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

@ -0,0 +1,15 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
gTestsuite = 'js1_8_5';
// explicitly turn on js185
// XXX: The browser currently only supports up to version 1.8
if (typeof version != 'undefined')
{
version(185);
}

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

@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
* Contributor:
*/
var gTestfile = 'template.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 99999;
var summary = '';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

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

@ -39,12 +39,11 @@
*
* ***** END LICENSE BLOCK ***** */
// Spidermonkey shell now defaults to 1.8, so set the basic version to
// 1.5 for backwards compatibility.
// Explicitly set the default version.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=522760#c11
if (typeof version != 'undefined')
{
version(150);
version(0);
}
var STATUS = "STATUS: ";
@ -109,38 +108,6 @@ function startTest() {
if ( BUGNUMBER ) {
print ("BUGNUMBER: " + BUGNUMBER );
}
if ( typeof version != 'function') {
return;
}
// JavaScript 1.3 is supposed to be compliant ecma version 1.0
if ( VERSION == "ECMA_1" ) {
version ( "130" );
}
else if ( VERSION == "JS_1.8" || gTestsuite == 'js1_8') {
version ( "180" );
}
else if ( VERSION == "JS_1.7" || gTestsuite == 'js1_7') {
version ( "170" );
}
else if ( VERSION == "JS_1.6" || gTestsuite == 'js1_6') {
version ( "160" );
}
else if ( VERSION == "JS_1.5" || gTestsuite == 'js1_5') {
version ( "150" );
}
else if ( VERSION == "JS_1.4" || gTestsuite == 'js1_4') {
version ( "140" );
}
else if ( VERSION == "JS_1.3" || gTestsuite == 'js1_3') {
version ( "130" );
}
else if ( VERSION == "JS_1.2" || gTestsuite == 'js1_2') {
version ( "120" );
}
else if ( VERSION == "JS_1.1" || gTestsuite == 'js1_1') {
version ( "110" );
}
}
function TestCase(n, d, e, a)

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

@ -839,6 +839,11 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
PRBool aInPrintPreview,
PRBool aNeedMakeCX /*= PR_TRUE*/)
{
// We don't want any scripts to run here. That can cause flushing,
// which can cause reentry into initialization of this document viewer,
// which would be disastrous.
nsAutoScriptBlocker blockScripts;
mParentWidget = aParentWidget; // not ref counted
mBounds = aBounds;

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