This commit is contained in:
Wan-Teh Chang 2009-08-07 08:57:53 -07:00
Родитель 75412c2aad cded76b45a
Коммит 61e4a016df
490 изменённых файлов: 19988 добавлений и 25653 удалений

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

@ -217,7 +217,6 @@ ifeq ($(OS_ARCH),OS2)
RESFILE=splashos2.res
RCFLAGS += -DMOZ_PHOENIX
ifdef BUILD_STATIC_LIBS
EXE_DEF_FILE = browser.def
RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include/widget
endif
ifdef DEBUG
@ -262,20 +261,6 @@ endif
$(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
ifeq ($(OS_ARCH),OS2)
ifdef BUILD_STATIC_LIBS
$(EXE_DEF_FILE):
rm -f $@
@echo NAME mozilla >$(EXE_DEF_FILE)
@echo IMPORTS >>$(EXE_DEF_FILE)
@echo WinQueryProperty = PMMERGE.5450 >>$(EXE_DEF_FILE)
@echo WinRemoveProperty = PMMERGE.5451 >>$(EXE_DEF_FILE)
@echo WinSetProperty = PMMERGE.5452 >>$(EXE_DEF_FILE)
LDFLAGS += -Zlinker /NOE
endif
endif
ifneq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)

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

@ -222,11 +222,6 @@ pref("browser.urlbar.filter.javascript", true);
// the maximum number of results to show in autocomplete when doing richResults
pref("browser.urlbar.maxRichResults", 12);
// Size of "chunks" affects the number of places to process between each search
// timeout (ms). Too big and the UI will be unresponsive; too small and we'll
// be waiting on the timeout too often without many results.
pref("browser.urlbar.search.chunkSize", 1000);
pref("browser.urlbar.search.timeout", 100);
// The amount of time (ms) to wait after the user has stopped typing
// before starting to perform autocomplete. 50 is the default set in
// autocomplete.xml.
@ -858,10 +853,7 @@ pref("geo.wifi.uri", "https://www.google.com/loc/json");
#ifdef WINCE
// tweak awesomebar -- increase the delay until a search happens, and reduce
// the amount of time spent waiting for a search result
pref("browser.urlbar.search.chunkSize", 100);
pref("browser.urlbar.search.timeout", 500);
// tweak awesomebar -- increase the delay until a search happens.
pref("browser.urlbar.delay", 1000);
// disable safe browsing, due to perf hit
@ -885,6 +877,9 @@ pref("content.sink.interactive_time", 750000); /* default 750000 */
pref("content.sink.initial_perf_time", 500000); /* default 2000000 */
pref("content.sink.enable_perf_mode", 0); /* default 0; 0 == switch, 1 == stay interactive, 2 == stay perf */
// Write sessionstore.js less often
pref("browser.sessionstore.interval", 60000);
#endif /* WINCE */
// Whether to use a panel that looks like an OS X sheet for customization

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

@ -648,6 +648,7 @@ var HistoryMenu = {
var strings = gNavigatorBundle;
undoPopup.appendChild(document.createElement("menuseparator"));
m = undoPopup.appendChild(document.createElement("menuitem"));
m.id = "menu_restoreAllTabs";
m.setAttribute("label", strings.getString("menuOpenAllInTabs.label"));
m.setAttribute("accesskey", strings.getString("menuOpenAllInTabs.accesskey"));
m.addEventListener("command", function() {
@ -718,6 +719,7 @@ var HistoryMenu = {
// "Open All in Windows"
undoPopup.appendChild(document.createElement("menuseparator"));
let m = undoPopup.appendChild(document.createElement("menuitem"));
m.id = "menu_restoreAllWindows";
m.setAttribute("label", gNavigatorBundle.getString("menuRestoreAllWindows.label"));
m.setAttribute("accesskey", gNavigatorBundle.getString("menuRestoreAllWindows.accesskey"));
m.setAttribute("oncommand",
@ -879,6 +881,7 @@ var BookmarksEventHandler = {
if (!target._endOptSeparator) {
// create a separator before options
target._endOptSeparator = document.createElement("menuseparator");
target._endOptSeparator.className = "bookmarks-actions-menuseparator";
target._endMarker = target.childNodes.length;
target.appendChild(target._endOptSeparator);
}
@ -886,6 +889,7 @@ var BookmarksEventHandler = {
if (siteURIString && !target._endOptOpenSiteURI) {
// Add "Open (Feed Name)" menuitem if it's a livemark with a siteURI
target._endOptOpenSiteURI = document.createElement("menuitem");
target._endOptOpenSiteURI.className = "openlivemarksite-menuitem";
target._endOptOpenSiteURI.setAttribute("siteURI", siteURIString);
target._endOptOpenSiteURI.setAttribute("oncommand",
"openUILink(this.getAttribute('siteURI'), event);");
@ -905,6 +909,7 @@ var BookmarksEventHandler = {
// Add the "Open All in Tabs" menuitem if there are
// at least two menuitems with places result nodes.
target._endOptOpenAllInTabs = document.createElement("menuitem");
target._endOptOpenAllInTabs.className = "openintabs-menuitem";
target._endOptOpenAllInTabs.setAttribute("oncommand",
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);");
target._endOptOpenAllInTabs.setAttribute("onclick",

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

@ -126,7 +126,7 @@
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window || null);"/>
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>

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

@ -266,8 +266,19 @@ var FullZoom = {
// location change observer
onLocationChange: function FullZoom_onLocationChange(aURI, aBrowser) {
if (!aURI)
/**
* Called when the location of a tab changes.
* When that happens, we need to update the current zoom level if appropriate.
*
* @param aURI
* A URI object representing the new location.
* @param aIsTabSwitch
* Whether this location change has happened because of a tab switch.
* @param aBrowser
* (optional) browser object displaying the document
*/
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
if (!aURI || (aIsTabSwitch && !this.siteSpecific))
return;
this._applyPrefToSetting(this._cps.getPref(aURI, this.name), aBrowser);
},
@ -302,11 +313,6 @@ var FullZoom = {
this._removePref();
},
setSettingValue: function FullZoom_setSettingValue() {
var value = this._cps.getPref(gBrowser.currentURI, this.name);
this._applyPrefToSetting(value);
},
/**
* Set the zoom level for the current tab.
*
@ -329,12 +335,13 @@ var FullZoom = {
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) {
var browser = aBrowser || gBrowser.selectedBrowser;
if (!this.siteSpecific || gInPrintPreviewMode ||
browser.contentDocument instanceof Ci.nsIImageDocument)
return;
var resetZoom = (!this.siteSpecific || gInPrintPreviewMode ||
browser.contentDocument instanceof Ci.nsIImageDocument);
try {
if (typeof aValue != "undefined")
if (resetZoom)
ZoomManager.setZoomForBrowser(browser, 1);
else if (typeof aValue != "undefined")
ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
else if (typeof this.globalValue != "undefined")
ZoomManager.setZoomForBrowser(browser, this.globalValue);

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

@ -1840,6 +1840,35 @@ function delayedOpenTab(aUrl, aReferrer, aCharset, aPostData, aAllowThirdPartyFi
gBrowser.loadOneTab(aUrl, aReferrer, aCharset, aPostData, false, aAllowThirdPartyFixup);
}
var gLastOpenDirectory = {
_lastDir: null,
get path() {
if (!this._lastDir || !this._lastDir.exists()) {
try {
this._lastDir = gPrefService.getComplexValue("browser.open.lastDir",
Ci.nsILocalFile);
if (!this._lastDir.exists())
this._lastDir = null;
}
catch(e) {}
}
return this._lastDir;
},
set path(val) {
if (!val || !val.exists() || !val.isDirectory())
return;
this._lastDir = val.clone();
// Don't save the last open directory pref inside the Private Browsing mode
if (!gPrivateBrowsingUI.privateBrowsingEnabled)
gPrefService.setComplexValue("browser.open.lastDir", Ci.nsILocalFile,
this._lastDir);
},
reset: function() {
this._lastDir = null;
}
};
function BrowserOpenFileWindow()
{
// Get filepicker component.
@ -1849,9 +1878,13 @@ function BrowserOpenFileWindow()
fp.init(window, gNavigatorBundle.getString("openFile"), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | nsIFilePicker.filterImages |
nsIFilePicker.filterXML | nsIFilePicker.filterHTML);
fp.displayDirectory = gLastOpenDirectory.path;
if (fp.show() == nsIFilePicker.returnOK)
if (fp.show() == nsIFilePicker.returnOK) {
if (fp.file && fp.file.exists())
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
openTopWin(fp.fileURL.spec);
}
} catch (ex) {
}
}
@ -2558,7 +2591,6 @@ function onExitPrintPreview()
{
// restore chrome to original state
gInPrintPreviewMode = false;
FullZoom.setSettingValue();
toggleAffectedChrome(false);
}
@ -4229,7 +4261,7 @@ var XULBrowserWindow = {
// simulate all change notifications after switching tabs
onUpdateCurrentBrowser: function (aStateFlags, aStatus, aMessage, aTotalProgress) {
if (FullZoom.updateBackgroundTabs)
FullZoom.onLocationChange(gBrowser.currentURI);
FullZoom.onLocationChange(gBrowser.currentURI, true);
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
var loadingDone = aStateFlags & nsIWebProgressListener.STATE_STOP;
// use a pseudo-object instead of a (potentially non-existing) channel for getting
@ -4296,7 +4328,7 @@ var TabsProgressListener = {
onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI) {
// Filter out any sub-frame loads
if (aBrowser.contentWindow == aWebProgress.DOMWindow)
FullZoom.onLocationChange(aLocationURI, aBrowser);
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
},
onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
@ -6722,10 +6754,17 @@ let DownloadMonitorPanel = {
gDownloadMgr.removeListener(this);
},
inited: function DMP_inited() {
return this._panel != null;
},
/**
* Update status based on the number of active and paused downloads
*/
updateStatus: function DMP_updateStatus() {
if (!this.inited())
return;
let numActive = gDownloadMgr.activeDownloadCount;
// Hide the panel and reset the "last time" if there's no downloads
@ -6933,6 +6972,10 @@ let gPrivateBrowsingUI = {
docElement.getAttribute("titlemodifier_privatebrowsing"));
docElement.setAttribute("browsingmode", "private");
}
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
},
onExitPrivateBrowsing: function PBUI_onExitPrivateBrowsing() {
@ -6967,6 +7010,12 @@ let gPrivateBrowsingUI = {
.removeAttribute("disabled");
this._privateBrowsingAutoStarted = false;
gLastOpenDirectory.reset();
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
},
_setPBMenuTitle: function PBUI__setPBMenuTitle(aMode) {

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

@ -83,6 +83,7 @@
windowtype="navigator:browser"
screenX="4" screenY="4"
browsingmode="normal"
toggletoolbar="true"
persist="screenX screenY width height sizemode">
# All JS files which are not content (only) dependent that browser.xul
@ -378,7 +379,6 @@
showimagecolumn="true"
enablehistory="true"
maxrows="6"
timeout="75"
newlines="stripsurroundingwhitespace"
oninput="gBrowser.userTypedValue = this.value;"
ontextentered="this.handleCommand(param);"

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

@ -234,7 +234,6 @@
<li>Mitchell Baker</li>
<li>Rhian Baker</li>
<li>Jeff Balogh</li>
<li>Honza Bambas</li>
<li>Jan Bambas</li>
<li>Rey Bango</li>
<li>Mark Banner</li>

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

@ -460,13 +460,10 @@ Sanitizer.showUI = function(aParentWindow)
/**
* Deletes privacy sensitive data in a batch, optionally showing the
* sanitize UI, according to user preferences
*
* @returns null (displayed UI, which should handle errors)
*/
Sanitizer.sanitize = function(aParentWindow)
{
Sanitizer.showUI(aParentWindow);
return null;
};
Sanitizer.onStartup = function()

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

@ -173,7 +173,8 @@
accesskey="&detailsProgressiveDisclosure.accesskey;"
control="detailsExpander"/>
</hbox>
<listbox id="itemList" rows="6" collapsed="true" persist="collapsed">
<listbox id="itemList" rows="6" collapsed="true" persist="collapsed"
flex="1">
<listitem label="&itemHistoryAndDownloads.label;"
type="checkbox"
accesskey="&itemHistoryAndDownloads.accesskey;"

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

@ -2,6 +2,8 @@ var gTestPage = "http://example.org/browser/browser/base/content/test/dummy_page
var gTestImage = "http://example.org/browser/browser/base/content/test/moz.png";
var gTab1, gTab2, gTab3;
var gLevel;
const kBack = 0;
const kForward = 1;
function test() {
waitForExplicitFinish();
@ -53,10 +55,74 @@ function imageLoaded() {
gBrowser.selectedTab = gTab1;
zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
finishTest();
executeSoon(imageZoomSwitch);
}
function imageZoomSwitch() {
navigate(kBack, function() {
navigate(kForward, function() {
zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
gBrowser.selectedTab = gTab2;
zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
// Mac OS X does not support print preview, so skip those tests
let isOSX = ("nsILocalFileMac" in Components.interfaces);
if (isOSX)
finishTest();
else
runPrintPreviewTests();
});
});
}
function runPrintPreviewTests() {
// test print preview on image document
testPrintPreview(gTab1, function() {
// test print preview on HTML document
testPrintPreview(gTab2, function() {
// test print preview on image document with siteSpecific set to false
gPrefService.setBoolPref("browser.zoom.siteSpecific", false);
testPrintPreview(gTab1, function() {
// test print preview of HTML document with siteSpecific set to false
testPrintPreview(gTab2, function() {
gPrefService.clearUserPref("browser.zoom.siteSpecific");
finishTest();
});
});
});
});
}
function testPrintPreview(aTab, aCallback) {
gBrowser.selectedTab = aTab;
FullZoom.enlarge();
let level = ZoomManager.zoom;
function onEnterPP() {
toggleAffectedChromeOrig.apply(null, arguments);
function onExitPP() {
toggleAffectedChromeOrig.apply(null, arguments);
toggleAffectedChrome = toggleAffectedChromeOrig;
zoomTest(aTab, level, "Toggling print preview mode should not affect zoom level");
FullZoom.reset();
aCallback();
}
toggleAffectedChrome = onExitPP;
PrintUtils.exitPrintPreview();
}
let toggleAffectedChromeOrig = toggleAffectedChrome;
toggleAffectedChrome = onEnterPP;
let printPreview = new Function(document.getElementById("cmd_printPreview")
.getAttribute("oncommand"));
executeSoon(printPreview);
}
function finishTest() {
gBrowser.selectedTab = gTab1;
FullZoom.reset();
gBrowser.removeTab(gTab1);
FullZoom.reset();
@ -77,3 +143,14 @@ function load(tab, url, cb) {
}, true);
tab.linkedBrowser.loadURI(url);
}
function navigate(direction, cb) {
gBrowser.addEventListener("pageshow", function(event) {
gBrowser.removeEventListener("pageshow", arguments.callee, true);
setTimeout(cb, 0);
}, true);
if (direction == kBack)
gBrowser.goBack();
else if (direction == kForward)
gBrowser.goForward();
}

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

@ -28,28 +28,8 @@ function openContextMenuFor(element) {
// Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed");
// XXX this doesn't work:
// var eventDetails = { type : "contextmenu", button : 2 }
// synthesizeMouse(element, 50, 90, eventDetails);
//
// It triggers the popup, but then we fail in nsContextMenu when
// initializing: ine 565: this.target.ownerDocument is null
// |this.target| was assigned there from |document.popupNode|, but it's a
// HTMLDocument instead of the node we supposedly fired the event at.
// I think the event's |target| is never being set, and we're hitting the
// fallback case in nsXULPopupListener::PreLaunchPopup.
//
// Also interesting is that just firing a mousedown+mouseup doesn't seem
// to do anything. Not clear why we'd specifically have to fire a
// contextmenu event instead of just a right-click.
// This seems to work, as long as we explicitly set the popupNode first.
// For frames, the popupNode needs to be set to inside the frame.
if (element.localName == "iframe")
chromeWin.document.popupNode = element.contentDocument.body;
else
chromeWin.document.popupNode = element;
contextMenu.openPopup(element, "overlap", 5, 5, true, false);
var eventDetails = { type : "contextmenu", button : 2 }
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
}
function closeContextMenu() {

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

@ -2,5 +2,6 @@
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
locale/branding/brand.dtd (%brand.dtd)
* locale/branding/brand.properties (%brand.properties)
# Nightly branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
* locale/branding/brand.properties (en-US/brand.properties)

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

@ -40,7 +40,7 @@
# BrandFullNameInternal is used for some registry and file system values
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Shiretoko"
!define BrandFullNameInternal "Namoroka"
!define CompanyName "mozilla.org"
!define URLInfoAbout "http://www.mozilla.org"
!define URLUpdateInfo "http://www.mozilla.org/projects/firefox"

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

@ -1 +1 @@
MOZ_APP_DISPLAYNAME="Shiretoko"
MOZ_APP_DISPLAYNAME="Namoroka"

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

@ -1,3 +1,3 @@
# Do NOT localize or otherwise change these values
browser.startup.homepage=http://www.mozilla.org/projects/shiretoko/
browser.startup.homepage=http://www.mozilla.org/projects/namoroka/

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

@ -1,7 +1,7 @@
<!ENTITY brandShortName "Shiretoko">
<!ENTITY brandFullName "Shiretoko">
<!ENTITY brandShortName "Namoroka">
<!ENTITY brandFullName "Namoroka">
<!ENTITY vendorShortName "mozilla.org">
<!ENTITY logoCopyright " ">
<!-- LOCALIZATION NOTE (releaseBaseURL): The about: page appends __MOZ_APP_VERSION__.html, e.g. 2.0.html -->
<!ENTITY releaseBaseURL "http://www.mozilla.org/projects/shiretoko/releases/">
<!ENTITY releaseBaseURL "http://www.mozilla.org/projects/namoroka/releases/">

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

@ -1,3 +1,3 @@
brandShortName=Shiretoko
brandFullName=Shiretoko
brandShortName=Namoroka
brandFullName=Namoroka
vendorShortName=mozilla.org

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

@ -2,5 +2,6 @@
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
locale/branding/brand.dtd (%brand.dtd)
* locale/branding/brand.properties (%brand.properties)
# Unofficial branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
* locale/branding/brand.properties (en-US/brand.properties)

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

@ -1117,8 +1117,9 @@ GeolocationPrompt.prototype = {
var buttons = [{
label: browserBundle.GetStringFromName("geolocation.shareLocation"),
accessKey: browserBundle.GetStringFromName("geolocation.shareLocation.accesskey"),
callback: function(notification) {
if (notification.getElementsByClassName("rememberChoice")[0].checked)
callback: function(notification) {
var elements = notification.getElementsByClassName("rememberChoice");
if (elements.length && elements[0].checked)
setPagePermission(request.requestingURI, true);
request.allow();
},
@ -1127,7 +1128,8 @@ GeolocationPrompt.prototype = {
label: browserBundle.GetStringFromName("geolocation.dontShareLocation"),
accessKey: browserBundle.GetStringFromName("geolocation.dontShareLocation.accesskey"),
callback: function(notification) {
if (notification.getElementsByClassName("rememberChoice")[0].checked)
var elements = notification.getElementsByClassName("rememberChoice");
if (elements.length && elements[0].checked)
setPagePermission(request.requestingURI, false);
request.cancel();
},
@ -1148,11 +1150,17 @@ GeolocationPrompt.prototype = {
// bar.
function geolocation_hacks_to_notification () {
var checkbox = newBar.ownerDocument.createElementNS(XULNS, "checkbox");
checkbox.className = "rememberChoice";
checkbox.setAttribute("label", browserBundle.GetStringFromName("geolocation.remember"));
checkbox.setAttribute("accesskey", browserBundle.GetStringFromName("geolocation.remember.accesskey"));
newBar.appendChild(checkbox);
// Never show a remember checkbox inside the private browsing mode
var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService).
privateBrowsingEnabled;
if (!inPrivateBrowsing) {
var checkbox = newBar.ownerDocument.createElementNS(XULNS, "checkbox");
checkbox.className = "rememberChoice";
checkbox.setAttribute("label", browserBundle.GetStringFromName("geolocation.remember"));
checkbox.setAttribute("accesskey", browserBundle.GetStringFromName("geolocation.remember.accesskey"));
newBar.appendChild(checkbox);
}
var link = newBar.ownerDocument.createElementNS(XULNS, "label");
link.className = "text-link";

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

@ -553,11 +553,7 @@ var PlacesOrganizer = {
var backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
fp.displayDirectory = backupsDir;
// Use YYYY-MM-DD (ISO 8601) as it doesn't contain illegal characters
// and makes the alphabetical order of multiple backup files more useful.
var date = (new Date).toLocaleFormat("%Y-%m-%d");
fp.defaultString = PlacesUIUtils.getFormattedString("bookmarksBackupFilenameJSON",
[date]);
fp.defaultString = PlacesUtils.getBackupFilename();
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
PlacesUtils.backupBookmarksToFile(fp.file);
@ -566,9 +562,7 @@ var PlacesOrganizer = {
var latestBackup = PlacesUtils.getMostRecentBackup();
if (!latestBackup || latestBackup != fp.file) {
latestBackup.remove(false);
var date = new Date().toLocaleFormat("%Y-%m-%d");
var name = PlacesUtils.getFormattedString("bookmarksArchiveFilename",
[date]);
var name = PlacesUtils.getBackupFilename();
fp.file.copyTo(this.bookmarksBackupDir, name);
}
}

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

@ -75,6 +75,7 @@
onunload="PlacesOrganizer.destroy();"
width="&places.library.width;" height="&places.library.height;"
screenX="10" screenY="10"
toggletoolbar="true"
persist="width height screenX screenY sizemode">
<script type="application/x-javascript"

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

@ -56,6 +56,7 @@ let windowObserver = {
win.addEventListener("load", function onLoad(event) {
win.removeEventListener("load", onLoad, false);
executeSoon(function () {
ok(true, "Library has been correctly opened");
win.close();
finish();
});

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

@ -54,26 +54,14 @@ function LOG(aMsg) {
print(aMsg);
}
var gProfD = do_get_profile();
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
// Remove '/unit/*.js'.
var gTestRoot = __LOCATION__.parent.parent;
gTestRoot.normalize();
// Need to create and register a profile folder.
var gProfD = gTestRoot.clone();
gProfD.append("profile");
if (gProfD.exists())
gProfD.remove(true);
gProfD.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
var dirProvider = {
getFile: function(prop, persistent) {
persistent.value = true;
if (prop == NS_APP_USER_PROFILE_50_DIR ||
prop == NS_APP_PROFILE_DIR_STARTUP)
return gProfD.clone();
else if (prop == NS_APP_BOOKMARKS_50_FILE) {
if (prop == NS_APP_BOOKMARKS_50_FILE) {
var bmarks = gProfD.clone();
bmarks.append("bookmarks.html");
return bmarks;

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

@ -548,7 +548,7 @@ var gPrivacyPane = {
const Cc = Components.classes, Ci = Components.interfaces;
var glue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIBrowserGlue);
glue.sanitize(window || null);
glue.sanitize(window);
// reset the timeSpan pref
if (aClearEverything)

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

@ -75,7 +75,7 @@
function openSanitizeDialog() {
let browserGlue = Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIBrowserGlue);
browserGlue.sanitize(mainWindow || null);
browserGlue.sanitize(mainWindow);
}
function setFavIcon(url) {

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

@ -123,6 +123,9 @@ PrivateBrowsingService.prototype = {
// Whether the private browsing mode has been started automatically
_autoStarted: false,
// List of view source window URIs for restoring later
_viewSrcURLs: [],
// XPCOM registration
classDescription: "PrivateBrowsing Service",
contractID: "@mozilla.org/privatebrowsing;1",
@ -177,6 +180,22 @@ PrivateBrowsingService.prototype = {
this._closePageInfoWindows();
// save view-source windows URIs and close them
let viewSrcWindowsEnum = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator).
getEnumerator("navigator:view-source");
while (viewSrcWindowsEnum.hasMoreElements()) {
let win = viewSrcWindowsEnum.getNext();
if (this._inPrivateBrowsing) {
let plainURL = win.getBrowser().currentURI.spec;
if (plainURL.indexOf("view-source:") == 0) {
plainURL = plainURL.substr(12);
this._viewSrcURLs.push(plainURL);
}
}
win.close();
}
if (!this._quitting && this._saveSession) {
let browserWindow = this._getBrowserWindow();
@ -215,6 +234,28 @@ PrivateBrowsingService.prototype = {
this._savedBrowserState = null;
this._closePageInfoWindows();
// re-open all view-source windows
let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
this._viewSrcURLs.forEach(function(uri) {
let args = Cc["@mozilla.org/supports-array;1"].
createInstance(Ci.nsISupportsArray);
let str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
str.data = uri;
args.AppendElement(str);
args.AppendElement(null); // charset
args.AppendElement(null); // page descriptor
args.AppendElement(null); // line number
let forcedCharset = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
forcedCharset.data = false;
args.AppendElement(forcedCharset);
windowWatcher.openWindow(null, "chrome://global/content/viewSource.xul",
"_blank", "all,dialog=no", args);
});
this._viewSrcURLs = [];
}
else {
// otherwise, if we have transitioned into private browsing mode, load

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

@ -45,22 +45,30 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
browser_privatebrowsing_ui.js \
browser_console_clear.js \
browser_privatebrowsing_theming.js \
browser_privatebrowsing_searchbar.js \
browser_privatebrowsing_findbar.js \
browser_privatebrowsing_zoom.js \
browser_privatebrowsing_transition.js \
browser_privatebrowsing_import.js \
browser_privatebrowsing_certexceptionsui.js \
browser_privatebrowsing_crh.js \
browser_privatebrowsing_downloadmonitor.js \
browser_privatebrowsing_findbar.js \
browser_privatebrowsing_forgetthissite.js \
browser_privatebrowsing_geoprompt.js \
browser_privatebrowsing_geoprompt_page.html \
browser_privatebrowsing_import.js \
browser_privatebrowsing_opendir.js \
browser_privatebrowsing_pageinfo.js \
browser_privatebrowsing_popupmode.js \
browser_privatebrowsing_searchbar.js \
browser_privatebrowsing_sslsite_transition.js \
browser_privatebrowsing_theming.js \
browser_privatebrowsing_transition.js \
browser_privatebrowsing_ui.js \
browser_privatebrowsing_urlbarfocus.js \
browser_privatebrowsing_viewsource.js \
browser_privatebrowsing_windowtitle.js \
browser_privatebrowsing_windowtitle_page.html \
browser_privatebrowsing_urlbarfocus.js \
browser_privatebrowsing_forgetthissite.js \
browser_privatebrowsing_pageinfo.js \
browser_privatebrowsing_sslsite_transition.js \
browser_privatebrowsing_popupmode.js \
browser_privatebrowsing_zoom.js \
browser_privatebrowsing_zoomrestore.js \
staller.sjs \
$(NULL)
libs:: $(_BROWSER_TEST_FILES)

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

@ -0,0 +1,137 @@
/* ***** 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
* Ehsan Akhgari.
* 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 certificate exceptions UI behaves correctly
// inside the private browsing mode, based on whether it's opened from the prefs
// window or from the SSL error page (see bug 461627).
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
const EXCEPTIONS_DLG_URL = 'chrome://pippki/content/exceptionDialog.xul';
const EXCEPTIONS_DLG_FEATURES = 'chrome,centerscreen,modal';
const INVALID_CERT_LOCATION = 'https://nocert.example.com/';
waitForExplicitFinish();
// enter private browsing mode
pb.privateBrowsingEnabled = true;
let testCheckbox;
let obs = {
observe: function(aSubject, aTopic, aData) {
// unregister ourself
ww.unregisterNotification(this);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
testCheckbox(win.document.defaultView);
}, false);
}
};
step1();
// Test the certificate exceptions dialog as it is invoked from about:certerror
function step1() {
ww.registerNotification(obs);
let params = {
exceptionAdded : false,
location: INVALID_CERT_LOCATION,
handlePrivateBrowsing : true,
prefetchCert: true,
};
testCheckbox = function(win) {
let obsSvc = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
obsSvc.addObserver({
observe: function(aSubject, aTopic, aData) {
obsSvc.removeObserver(this, "cert-exception-ui-ready", false);
ok(win.gCert, "The certificate information should be available now");
let checkbox = win.document.getElementById("permanent");
ok(checkbox.hasAttribute("disabled"),
"the permanent checkbox should be disabled when handling the private browsing mode");
ok(!checkbox.hasAttribute("checked"),
"the permanent checkbox should not be checked when handling the private browsing mode");
win.close();
step2();
}
}, "cert-exception-ui-ready", false);
};
window.openDialog(EXCEPTIONS_DLG_URL, '', EXCEPTIONS_DLG_FEATURES, params);
}
// Test the certificate excetions dialog as it is invoked from the Preferences dialog
function step2() {
ww.registerNotification(obs);
let params = {
exceptionAdded : false,
location: INVALID_CERT_LOCATION,
prefetchCert: true,
};
testCheckbox = function(win) {
let obsSvc = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
obsSvc.addObserver({
observe: function(aSubject, aTopic, aData) {
obsSvc.removeObserver(this, "cert-exception-ui-ready", false);
ok(win.gCert, "The certificate information should be available now");
let checkbox = win.document.getElementById("permanent");
ok(!checkbox.hasAttribute("disabled"),
"the permanent checkbox should not be disabled when not handling the private browsing mode");
ok(checkbox.hasAttribute("checked"),
"the permanent checkbox should be checked when not handling the private browsing mode");
win.close();
cleanup();
}
}, "cert-exception-ui-ready", false);
};
window.openDialog(EXCEPTIONS_DLG_URL, '', EXCEPTIONS_DLG_FEATURES, params);
}
function cleanup() {
// leave the private browsing mode
pb.privateBrowsingEnabled = false;
finish();
}
}

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

@ -0,0 +1,168 @@
/* ***** 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
* Ehsan Akhgari.
* Portions created by the Initial Developer are Copyright (C) 2008
* 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 download monitor status bar panel is correctly
// cleared when switching the private browsing mode on or off.
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
if (!gDownloadMgr)
gDownloadMgr = dm;
let iosvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
let panel = document.getElementById("download-monitor");
waitForExplicitFinish();
// Add a new download
addDownload(dm, {
resultFileName: "pbtest-1",
downloadName: "PB Test 1"
});
// Make sure that the download is being displayed in the monitor panel
if (!DownloadMonitorPanel.inited())
DownloadMonitorPanel.init();
else
DownloadMonitorPanel.updateStatus();
ok(!panel.hidden, "The download panel should be successfully added initially");
// Enter the private browsing mode
pb.privateBrowsingEnabled = true;
setTimeout(function () {
ok(panel.hidden, "The download panel should be hidden when entering the private browsing mode");
// Add a new download
let file = addDownload(dm, {
resultFileName: "pbtest-2",
downloadName: "PB Test 2"
}).targetFile;
// Update the panel
DownloadMonitorPanel.updateStatus();
// Make sure that the panel is visible
ok(!panel.hidden, "The download panel should show up when a new download is added");
// Exit the private browsing mode
pb.privateBrowsingEnabled = false;
setTimeout(function () {
ok(panel.hidden, "The download panel should be hidden when leaving the private browsing mode");
// cleanup
let dls = dm.activeDownloads;
while (dls.hasMoreElements()) {
let dl = dls.getNext().QueryInterface(Ci.nsIDownload);
dm.removeDownload(dl.id);
let file = dl.targetFile;
if (file.exists())
file.remove(false);
}
if (file.exists())
file.remove(false);
finish();
}, 0);
}, 0);
}
/**
* Adds a download to the DM, and starts it.
* (Copied from toolkit/componentns/downloads/test/unit/head_download_manager.js)
* @param aParams (optional): an optional object which contains the function
* parameters:
* resultFileName: leaf node for the target file
* targetFile: nsIFile for the target (overrides resultFileName)
* sourceURI: the download source URI
* downloadName: the display name of the download
* runBeforeStart: a function to run before starting the download
*/
function addDownload(dm, aParams)
{
if (!aParams)
aParams = {};
if (!("resultFileName" in aParams))
aParams.resultFileName = "download.result";
if (!("targetFile" in aParams)) {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
aParams.targetFile = dirSvc.get("ProfD", Ci.nsIFile);
aParams.targetFile.append(aParams.resultFileName);
}
if (!("sourceURI" in aParams))
aParams.sourceURI = "http://localhost:8888/browser/browser/components/privatebrowsing/test/browser/staller.sjs";
if (!("downloadName" in aParams))
aParams.downloadName = null;
if (!("runBeforeStart" in aParams))
aParams.runBeforeStart = function () {};
const nsIWBP = Ci.nsIWebBrowserPersist;
let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
.createInstance(Ci.nsIWebBrowserPersist);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
let dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI(aParams.sourceURI),
createURI(aParams.targetFile), aParams.downloadName, null,
Math.round(Date.now() * 1000), null, persist);
// This will throw if it isn't found, and that would mean test failure, so no
// try catch block
let test = dm.getDownload(dl.id);
aParams.runBeforeStart.call(undefined, dl);
persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, null, null, dl.targetFile);
return dl;
}
function createURI(aObj)
{
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj, null, null);
}

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

@ -50,8 +50,14 @@ function test() {
const kTestSearchString = "privatebrowsing";
let findBox = gFindBar.getElement("findbar-textbox");
gFindBar.startFind(gFindBar.FIND_NORMAL);
for (let i = 0; i < kTestSearchString.length; ++ i)
EventUtils.synthesizeKey(kTestSearchString[i], {});
// sanity checks
is(findBox.editor.transactionManager.numberOfUndoItems, 0,
"No items in the undo list of the findbar control");
is(findBox.value, "",
"findbar text is empty");
findBox.value = kTestSearchString;
// enter private browsing mode
pb.privateBrowsingEnabled = true;

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

@ -0,0 +1,96 @@
/* ***** 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
* Ehsan Akhgari.
* 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 geolocation prompt does not show a remember
// control inside the private browsing mode.
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
const testPageURL = "http://localhost:8888/browser/" +
"browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
waitForExplicitFinish();
let pageTab = gBrowser.addTab();
gBrowser.selectedTab = pageTab;
let pageBrowser = gBrowser.getBrowserForTab(pageTab);
pageBrowser.addEventListener("load", function () {
pageBrowser.removeEventListener("load", arguments.callee, true);
setTimeout(function() {
// Make sure the notification is correctly displayed with a remember control
let notificationBox = gBrowser.getNotificationBox(pageBrowser);
let notification = notificationBox.getNotificationWithValue("geolocation");
ok(notification, "Notification box should be displaying outside of private browsing mode");
is(notification.getElementsByClassName("rememberChoice").length, 1,
"The remember control must be displayed outside of private browsing mode");
notificationBox.currentNotification.close();
gBrowser.removeTab(pageTab);
// enter the private browsing mode
pb.privateBrowsingEnabled = true;
pageTab = gBrowser.addTab();
gBrowser.selectedTab = pageTab;
pageBrowser = gBrowser.getBrowserForTab(pageTab);
pageBrowser.addEventListener("load", function () {
pageBrowser.removeEventListener("load", arguments.callee, true);
setTimeout(function() {
// Make sure the notification is correctly displayed without a remember control
let notificationBox = gBrowser.getNotificationBox(pageBrowser);
let notification = notificationBox.getNotificationWithValue("geolocation");
ok(notification, "Notification box should be displaying outside of private browsing mode");
is(notification.getElementsByClassName("rememberChoice").length, 0,
"The remember control must not be displayed inside of private browsing mode");
notificationBox.currentNotification.close();
gBrowser.removeTab(pageTab);
// cleanup
pb.privateBrowsingEnabled = false;
finish();
}, 100); // remember control is added in a setTimeout(0) call
}, true);
pageBrowser.contentWindow.location = testPageURL;
}, 100); // remember control is added in a setTimeout(0) call
}, true);
pageBrowser.contentWindow.location = testPageURL;
}

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

@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Geolocation invoker</title>
</head>
<body>
<script type="text/javascript">
navigator.geolocation.getCurrentPosition(function (pos) {
// ignore
});
</script>
</body>
</html>

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

@ -0,0 +1,142 @@
/* ***** 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
* Ehsan Akhgari.
* 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 last open directory used inside the private
// browsing mode is not remembered after leaving that mode.
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let ds = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
let dir1 = ds.get("ProfD", Ci.nsIFile);
let dir2 = ds.get("TmpD", Ci.nsIFile);
let file = dir2.clone();
file.append("pbtest.file");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
const kPrefName = "browser.open.lastDir";
function setupCleanSlate() {
gLastOpenDirectory.reset();
gPrefService.clearUserPref(kPrefName);
}
setupCleanSlate();
// Test 1: general workflow test
// initial checks
ok(!gLastOpenDirectory.path,
"Last open directory path should be initially empty");
gLastOpenDirectory.path = dir2;
is(gLastOpenDirectory.path.path, dir2.path,
"The path should be successfully set");
gLastOpenDirectory.path = null;
is(gLastOpenDirectory.path.path, dir2.path,
"The path should be not change when assigning it to null");
gLastOpenDirectory.path = dir1;
is(gLastOpenDirectory.path.path, dir1.path,
"The path should be successfully outside of the private browsing mode");
// enter private browsing mode
pb.privateBrowsingEnabled = true;
is(gLastOpenDirectory.path.path, dir1.path,
"The path should not change when entering the private browsing mode");
gLastOpenDirectory.path = dir2;
is(gLastOpenDirectory.path.path, dir2.path,
"The path should successfully change inside the private browsing mode");
// leave private browsing mode
pb.privateBrowsingEnabled = false;
is(gLastOpenDirectory.path.path, dir1.path,
"The path should be reset to the same path as before entering the private browsing mode");
setupCleanSlate();
// Test 2: the user first tries to open a file inside the private browsing mode
pb.privateBrowsingEnabled = true;
ok(!gLastOpenDirectory.path,
"No original path should exist inside the private browsing mode");
gLastOpenDirectory.path = dir1;
is(gLastOpenDirectory.path.path, dir1.path,
"The path should be successfully set inside the private browsing mode");
pb.privateBrowsingEnabled = false;
ok(!gLastOpenDirectory.path,
"The path set inside the private browsing mode should not leak when leaving that mode");
setupCleanSlate();
// Test 3: the last open directory is set from a previous session, it should be used
// in normal mode
gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
is(gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect outside the private browsing mode");
setupCleanSlate();
// Test 4: the last open directory is set from a previous session, it should be used
// in private browsing mode mode
gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
pb.privateBrowsingEnabled = true;
is(gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect inside the private browsing mode");
pb.privateBrowsingEnabled = false;
is(gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should remain in effect after leaving the private browsing mode");
setupCleanSlate();
// Test 5: setting the path to a file shouldn't work
gLastOpenDirectory.path = file;
ok(!gLastOpenDirectory.path,
"Setting the path to a file shouldn't work when it's originally null");
gLastOpenDirectory.path = dir1;
gLastOpenDirectory.path = file;
is(gLastOpenDirectory.path.path, dir1.path,
"Setting the path to a file shouldn't work when it's not originally null");
// cleanup
file.remove(false);
}

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

@ -0,0 +1,197 @@
/* ***** 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
* Ehsan Akhgari.
* 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 entering the private browsing mode closes
// all view source windows, and leaving it restores them
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
waitForExplicitFinish();
let tabAbout = gBrowser.addTab();
gBrowser.selectedTab = tabAbout;
let aboutBrowser = gBrowser.getBrowserForTab(tabAbout);
aboutBrowser.addEventListener("load", function () {
aboutBrowser.removeEventListener("load", arguments.callee, true);
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
ww.unregisterNotification(this);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
let browser = win.document.defaultView.getBrowser();
browser.addEventListener("load", function() {
browser.removeEventListener("load", arguments.callee, true);
// view source window is loaded, proceed with the rest of the test
step1();
}, true);
}, false);
}
}
};
ww.registerNotification(observer);
openViewSource();
function openViewSource() {
// invoke the View Source command
let event = document.createEvent("Events");
event.initEvent("command", true, true);
document.getElementById("View:PageSource").dispatchEvent(event);
}
function step1() {
observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed") {
ok(true, "Entering the private browsing mode should close the view source window");
ww.unregisterNotification(observer);
step2();
}
else if (aTopic == "domwindowopened")
ok(false, "Entering the private browsing mode should not open any view source window");
}
};
ww.registerNotification(observer);
gBrowser.addTabsProgressListener({
onLocationChange: function() {},
onProgressChange: function() {},
onSecurityChange: function() {},
onStatusChange: function() {},
onRefreshAttempted: function() {},
onLinkIconAvailable: function() {},
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aStateFlags & (Ci.nsIWebProgressListener.STATE_STOP |
Ci.nsIWebProgressListener.STATE_IS_WINDOW)) {
gBrowser.removeTabsProgressListener(this);
step3();
}
}
});
// enter private browsing mode
pb.privateBrowsingEnabled = true;
}
let events = 0, step2, step3;
step2 = step3 = function() {
if (++events == 2)
step4();
}
function step4() {
observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
ww.unregisterNotification(this);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
let browser = win.document.defaultView.getBrowser();
browser.addEventListener("load", function() {
browser.removeEventListener("load", arguments.callee, true);
// view source window inside private browsing mode opened
step5();
}, true);
}, false);
}
}
};
ww.registerNotification(observer);
openViewSource();
}
function step5() {
let events = 0;
observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed") {
ok(true, "Leaving the private browsing mode should close the existing view source window");
if (++events == 2)
ww.unregisterNotification(observer);
}
else if (aTopic == "domwindowopened") {
ok(true, "Leaving the private browsing mode should restore the previous view source window");
if (++events == 2)
ww.unregisterNotification(observer);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
let browser = win.document.defaultView.getBrowser();
browser.addEventListener("load", function() {
browser.removeEventListener("load", arguments.callee, true);
is(browser.currentURI.spec, "view-source:about:",
"The correct view source window should be restored");
// cleanup
win.close();
gBrowser.removeTab(gBrowser.selectedTab);
finish();
}, true);
}, false);
}
}
};
ww.registerNotification(observer);
// exit private browsing mode
pb.privateBrowsingEnabled = false;
}
}, true);
aboutBrowser.loadURI("about:");
}

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

@ -0,0 +1,137 @@
/* ***** 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
* Ehsan Akhgari.
* 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 about:privatebrowsing does not appear zoomed in
// if there is already a zoom site pref for about:blank (bug 487656).
function test() {
// initialization
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let cps = Cc["@mozilla.org/content-pref/service;1"].
getService(Ci.nsIContentPrefService);
waitForExplicitFinish();
let tabBlank = gBrowser.selectedTab;
gBrowser.removeAllTabsBut(tabBlank);
let blankBrowser = gBrowser.getBrowserForTab(tabBlank);
blankBrowser.addEventListener("load", function() {
blankBrowser.removeEventListener("load", arguments.callee, true);
// change the zoom on the blank page
FullZoom.enlarge();
isnot(ZoomManager.zoom, 1, "Zoom level for about:blank should be changed");
// enter private browsing mode
pb.privateBrowsingEnabled = true;
let tabAboutPB = gBrowser.selectedTab;
let browserAboutPB = gBrowser.getBrowserForTab(tabAboutPB);
browserAboutPB.addEventListener("load", function() {
browserAboutPB.removeEventListener("load", arguments.callee, true);
setTimeout(function() {
// make sure the zoom level is set to 1
is(ZoomManager.zoom, 1, "Zoom level for about:privatebrowsing should be reset");
// Mac OS X does not support print preview, so skip those tests
let isOSX = ("nsILocalFileMac" in Components.interfaces);
if (isOSX) {
finishTest();
return;
}
// test print preview on HTML document
testPrintPreview(browserAboutPB, function() {
browserAboutPB.addEventListener("load", function() {
browserAboutPB.removeEventListener("load", arguments.callee, true);
// test print preview on image document
testPrintPreview(browserAboutPB, finishTest);
}, true);
browserAboutPB.loadURI("about:logo");
});
}, 0);
}, true);
}, true);
blankBrowser.loadURI("about:blank");
}
function finishTest() {
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
// leave private browsing mode
pb.privateBrowsingEnabled = false;
let tabBlank = gBrowser.selectedTab;
let blankBrowser = gBrowser.getBrowserForTab(tabBlank);
blankBrowser.addEventListener("load", function() {
blankBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
// cleanup
FullZoom.reset();
finish();
});
}, true);
}
function testPrintPreview(aBrowser, aCallback) {
FullZoom.enlarge();
let level = ZoomManager.getZoomForBrowser(aBrowser);
function onEnterPP(aHide) {
toggleAffectedChromeOrig(aHide);
function onExitPP(aHide) {
toggleAffectedChromeOrig(aHide);
toggleAffectedChrome = toggleAffectedChromeOrig;
is(ZoomManager.getZoomForBrowser(aBrowser), level,
"Toggling print preview mode should not affect zoom level");
FullZoom.reset();
aCallback();
}
toggleAffectedChrome = onExitPP;
PrintUtils.exitPrintPreview();
}
let toggleAffectedChromeOrig = toggleAffectedChrome;
toggleAffectedChrome = onEnterPP;
let printPreview = new Function(document.getElementById("cmd_printPreview")
.getAttribute("oncommand"));
executeSoon(printPreview);
}

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

@ -0,0 +1,55 @@
/* ***** 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
* Ehsan Akhgari.
* 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 provides the tests with a download URL which never finishes.
function handleRequest(request, response) {
response.setStatusLine(request.httpVersion, 200, "OK");
response.processAsync();
function stall() {
response.write("stalling...\n");
}
response.setHeader("Content-Type", "text/plain", false);
stall();
const nsITimer = Components.interfaces.nsITimer;
var timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(nsITimer);
timer.initWithCallback(stall, 500, nsITimer.TYPE_REPEATING_SLACK);
}

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

@ -1594,9 +1594,6 @@ SessionStoreService.prototype = {
aHash[aHost] = {};
if (!aHash[aHost][aPath])
aHash[aHost][aPath] = {};
if (!aHash[aHost][aPath][aName])
aHash[aHost][aPath][aName] = {};
aHash[aHost][aPath][aName] = aCookie;
}

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

@ -77,7 +77,9 @@
<menupopup>
<menuitem label="&center.label;" value="CENTER"/>
<menuitem label="&tile.label;" value="TILE"/>
#ifndef WINCE
<menuitem label="&stretch.label;" value="STRETCH"/>
#endif
</menupopup>
</menulist>
<spacer flex="1"/>

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

@ -26,6 +26,7 @@
* Robert Strong <robert.bugzilla@gmail.com>
* Asaf Romano <mano@mozilla.com>
* Ryan Jones <sciguyryan@gmail.com>
* Paul O'Shannessy <paul@oshannessy.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
@ -215,9 +216,11 @@ typedef struct {
#define APP_REG_NAME L"Firefox"
#define CLS_HTML "FirefoxHTML"
#define CLS_URL "FirefoxURL"
#define CPL_DESKTOP L"\\Control Panel\\Desktop"
#define VAL_OPEN "\"%APPPATH%\" -requestPending -osint -url \"%1\""
#define VAL_FILE_ICON "%APPPATH%,1"
#else
#define CPL_DESKTOP L"\\ControlPanel\\Desktop"
#define VAL_OPEN "\"%APPPATH%\" -osint -url \"%1\""
#define VAL_FILE_ICON "%APPPATH%,-2"
#endif
@ -656,12 +659,12 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
PRBool result = PR_FALSE;
DWORD dwDisp = 0;
HKEY key;
// Try to create/open a subkey under HKLM.
DWORD res = ::RegCreateKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Desktop",
// Try to create/open a subkey under HKCU.
DWORD res = ::RegCreateKeyExW(HKEY_CURRENT_USER, CPL_DESKTOP,
0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &key, &dwDisp);
if (REG_SUCCEEDED(res)) {
#ifndef WINCE
PRUnichar tile[2], style[2];
switch (aPosition) {
case BACKGROUND_TILE:
@ -688,8 +691,25 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
0, REG_SZ, (const BYTE *)style, size);
::SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, (PVOID)path.get(),
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
#else
DWORD tile = (aPosition == BACKGROUND_TILE);
::RegSetValueExW(key, L"Tile",
0, REG_DWORD, (const BYTE *)&tile, sizeof(DWORD));
// On WinCE SPI_SETDESKWALLPAPER isn't available, so set the registry
// entry ourselves and then broadcast UI change
PRInt32 size = (path.Length() + 1) * sizeof(PRUnichar);
::RegSetValueExW(key, L"Wallpaper",
0, REG_SZ, (const BYTE *)path.get(), size);
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, NULL, 0);
#endif
// Close the key we opened.
::RegCloseKey(key);
#ifdef WINCE
// Ensure that the writes are flushed in case of hard reboot
::RegFlushKey(HKEY_CURRENT_USER);
#endif
}
}
return rv;
@ -815,10 +835,13 @@ nsWindowsShellService::SetDesktopBackgroundColor(PRUint32 aColor)
::SetSysColors(sizeof(aParameters) / sizeof(int), aParameters, colors);
// SetSysColors is persisting across sessions on Windows CE, so no need to
// write to registry
#ifndef WINCE
PRBool result = PR_FALSE;
DWORD dwDisp = 0;
HKEY key;
// Try to create/open a subkey under HKLM.
// Try to create/open a subkey under HKCU.
DWORD rv = ::RegCreateKeyExW(HKEY_CURRENT_USER,
L"Control Panel\\Colors", 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
@ -836,6 +859,7 @@ nsWindowsShellService::SetDesktopBackgroundColor(PRUint32 aColor)
// Close the key we opened.
::RegCloseKey(key);
#endif
return NS_OK;
}

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

@ -655,7 +655,7 @@ toolbar[iconsize="small"] #back-button[disabled="true"] {
toolbar[iconsize="small"] #back-button:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=menu");
}
menupopup:-moz-locale-dir(rtl) > .unified-nav-back[_moz-menuactive] {
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=menu") !important;
}
toolbar[iconsize="small"] #back-button[disabled="true"]:-moz-locale-dir(rtl) {
@ -675,7 +675,7 @@ toolbar[iconsize="small"] #forward-button[disabled="true"] {
toolbar[iconsize="small"] #forward-button:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu");
}
menupopup:-moz-locale-dir(rtl) > .unified-nav-forward[_moz-menuactive] {
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=menu") !important;
}
toolbar[iconsize="small"] #forward-button[disabled="true"]:-moz-locale-dir(rtl) {
@ -940,13 +940,13 @@ toolbar[iconsize="small"] #fullscreen-button {
#identity-popup-content-box > description,
#identity-popup-encryption-label {
white-space: pre-wrap;
padding-left: 15px;
-moz-padding-start: 15px;
margin: 2px 0 4px;
}
#identity-popup-content-box > label {
white-space: pre-wrap;
padding-left: 15px;
-moz-padding-start: 15px;
margin: 0;
}
@ -972,7 +972,7 @@ toolbar[iconsize="small"] #fullscreen-button {
#identity-popup-content-box.verifiedIdentity > #identity-popup-encryption ,
#identity-popup-content-box.verifiedDomain > #identity-popup-encryption {
margin-top: 10px;
margin-left: -18px;
-moz-margin-start: -18px;
}
#identity-popup-content-box.verifiedIdentity > #identity-popup-encryption > vbox > #identity-popup-encryption-icon ,

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

@ -472,13 +472,13 @@ toolbar[mode="icons"] #back-forward-dropmarker > dropmarker {
-moz-image-region: rect(66px, 514px, 99px, 504px);
}
.unified-nav-back[_moz-menuactive],
menupopup:-moz-locale-dir(rtl) > .unified-nav-forward[_moz-menuactive] {
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(ltr),
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/menu-back.png") !important;
}
.unified-nav-forward[_moz-menuactive],
menupopup:-moz-locale-dir(rtl) > .unified-nav-back[_moz-menuactive] {
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(ltr),
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/menu-forward.png") !important;
}

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

@ -617,9 +617,6 @@ toolbar[iconsize="small"][mode="icons"] #back-forward-dropmarker:-moz-locale-dir
/* toolbar new tab button */
toolbar:not([iconsize="small"]) #new-tab-button > .toolbarbutton-icon {
padding-left: 1px;
}
#new-tab-button {
-moz-image-region: rect(0px 240px 24px 216px);
}
@ -635,9 +632,6 @@ toolbar:not([iconsize="small"]) #new-tab-button > .toolbarbutton-icon {
/* new window button */
toolbar:not([iconsize="small"]) #new-window-button > .toolbarbutton-icon {
padding-left: 1px;
}
#new-window-button {
-moz-image-region: rect(0px 264px 24px 240px);
}
@ -752,8 +746,8 @@ toolbar[iconsize="small"] #back-button:-moz-locale-dir(rtl)[disabled="true"] {
toolbar[iconsize="small"] #back-button:-moz-locale-dir(rtl):not([disabled="true"]):hover:active {
-moz-image-region: rect(64px 32px 80px 16px);
}
.unified-nav-back[_moz-menuactive],
menupopup:-moz-locale-dir(rtl) > .unified-nav-forward[_moz-menuactive] {
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(ltr),
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/menu-back.png") !important;
}
@ -789,16 +783,13 @@ toolbar[iconsize="small"] #forward-button:-moz-locale-dir(rtl)[disabled="true"]
toolbar[iconsize="small"] #forward-button:-moz-locale-dir(rtl):not([disabled="true"]):hover:active {
-moz-image-region: rect(64px 16px 80px 0px);
}
.unified-nav-forward[_moz-menuactive],
menupopup:-moz-locale-dir(rtl) > .unified-nav-back[_moz-menuactive] {
.unified-nav-forward[_moz-menuactive]:-moz-locale-dir(ltr),
.unified-nav-back[_moz-menuactive]:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/menu-forward.png") !important;
}
/* stop button */
toolbar[iconsize="small"] #stop-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #stop-button {
-moz-image-region: rect(0px 48px 16px 32px);
}
@ -814,9 +805,6 @@ toolbar[iconsize="small"] #stop-button:not([disabled="true"]):hover:active {
/* reload button */
toolbar[iconsize="small"] #reload-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #reload-button {
-moz-image-region: rect(0px 64px 16px 48px);
}
@ -832,9 +820,6 @@ toolbar[iconsize="small"] #reload-button:not([disabled="true"]):hover:active {
/* home button */
toolbar[iconsize="small"] #home-button.toolbarbutton-1 > .toolbarbutton-icon {
padding-left: 1px;
}
#home-button.bookmark-item {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
}
@ -857,9 +842,6 @@ toolbar[iconsize="small"] #home-button:not([disabled="true"]):hover:active ,
/* download manager button */
toolbar[iconsize="small"] #downloads-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #downloads-button {
-moz-image-region: rect(0px 96px 16px 80px);
}
@ -875,9 +857,6 @@ toolbar[iconsize="small"] #downloads-button:not([disabled="true"]):hover:active
/* history sidebar button */
toolbar[iconsize="small"] #history-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #history-button {
-moz-image-region: rect(0px 112px 16px 96px);
}
@ -896,9 +875,6 @@ toolbar[iconsize="small"] #history-button:not([disabled="true"]):not([checked="t
/* bookmark sidebar button */
toolbar[iconsize="small"] #bookmarks-button > .toolbarbutton-icon {
padding-left: 2px;
}
toolbar[iconsize="small"] #bookmarks-button {
-moz-image-region: rect(0px 128px 16px 112px);
}
@ -917,9 +893,6 @@ toolbar[iconsize="small"] #bookmarks-button:not([disabled="true"]):not([checked=
/* print button */
toolbar[iconsize="small"] #print-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #print-button {
-moz-image-region: rect(0px 144px 16px 128px);
}
@ -935,9 +908,6 @@ toolbar[iconsize="small"] #print-button:not([disabled="true"]):hover:active {
/* toolbar new tab button */
toolbar[iconsize="small"] #new-tab-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #new-tab-button {
-moz-image-region: rect(0px 160px 16px 144px);
}
@ -986,9 +956,6 @@ toolbar[iconsize="small"] #cut-button:not([disabled="true"]):hover:active {
/* copy button */
toolbar[iconsize="small"] #copy-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #copy-button {
-moz-image-region: rect(0px 208px 16px 192px);
}
@ -1004,9 +971,6 @@ toolbar[iconsize="small"] #copy-button:not([disabled="true"]):hover:active {
/* paste button */
toolbar[iconsize="small"] #paste-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #paste-button {
-moz-image-region: rect(0px 224px 16px 208px);
}
@ -1022,9 +986,6 @@ toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active {
/* fullscreen button */
toolbar[iconsize="small"] #fullscreen-button > .toolbarbutton-icon {
padding-left: 1px;
}
toolbar[iconsize="small"] #fullscreen-button {
-moz-image-region: rect(0px 240px 16px 224px);
}
@ -1120,7 +1081,7 @@ toolbar[iconsize="small"] #fullscreen-button:hover:active {
/* Keep the URL bar LTR */
#urlbar .autocomplete-textbox-container {
#urlbar > .autocomplete-textbox-container {
direction: ltr;
}
@ -1529,23 +1490,21 @@ tabpanels {
-moz-image-region: rect(0, 45px, 17px, 30px);
}
.tabbrowser-arrowscrollbox > .scrollbutton-up {
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(ltr) {
border-left-style: none;
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
-moz-border-radius-topright: 2px;
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(rtl) {
border-left-style: solid;
border-right-style: none;
-moz-border-radius-topleft: 2px;
-moz-border-radius-topright: 0px;
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-right.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.tabs-container > .tabs-newtab-button,
.tabs-alltabs-button {
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-locale-dir(ltr),
.tabs-container > .tabs-newtab-button:-moz-locale-dir(ltr),
.tabs-alltabs-button:-moz-locale-dir(ltr) {
border-right-style: none;
-moz-border-radius-topleft: 2px;
}
@ -1556,10 +1515,8 @@ tabpanels {
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-locale-dir(rtl),
.tabs-container > .tabs-newtab-button:-moz-locale-dir(rtl),
.tabs-container > stack:-moz-locale-dir(rtl) > .tabs-alltabs-button {
.tabs-alltabs-button:-moz-locale-dir(rtl) {
border-left-style: none;
border-right-style: solid;
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 2px;
}
@ -1619,7 +1576,7 @@ tabpanels {
opacity: 0.0;
}
stack:-moz-locale-dir(rtl) > hbox > .tabs-alltabs-box-animate {
.tabs-alltabs-box-animate:-moz-locale-dir(rtl) {
background-image: url("chrome://browser/skin/tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png");
}
@ -1845,7 +1802,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-box-shadow: 1px 1px 0 rgba(255,255,255,.3) inset,
0 -1px 0 rgba(255,255,255,.2) inset;
}
#identity-box:-moz-locale-dir(ltr) {
#identity-box:-moz-locale-dir(rtl) {
-moz-border-start-style: solid;
}
#identity-box:-moz-locale-dir(ltr):-moz-system-metric(windows-default-theme) {
@ -1986,7 +1943,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
#identity-popup-content-box.verifiedIdentity > #identity-popup-encryption ,
#identity-popup-content-box.verifiedDomain > #identity-popup-encryption {
margin-top: 10px;
margin-left: -24px;
-moz-margin-start: -24px;
}
#identity-popup-content-box.verifiedIdentity > #identity-popup-encryption > vbox > #identity-popup-encryption-icon ,

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

@ -55,11 +55,6 @@ if [ ! -f configure.in ]; then
exit 1
fi
if [ -f mailnews/makefiles ]; then
MOZ_MAIL_NEWS=1
export MOZ_MAIL_NEWS
fi
. allmakefiles.sh
rm -fr $MAKEFILES \

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

@ -402,7 +402,7 @@ def fillCertificateDB(profileDir, certPath, utilityPath, xrePath):
os.unlink(pwfilePath)
return 0
def environment(env = None, xrePath = DIST_BIN):
def environment(env = None, xrePath = DIST_BIN, crashreporter = True):
if env == None:
env = dict(os.environ)
@ -417,8 +417,9 @@ def environment(env = None, xrePath = DIST_BIN):
elif IS_WIN32:
env["PATH"] = env["PATH"] + ";" + ldLibraryPath
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
if crashreporter:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
return env
@ -585,8 +586,11 @@ def runApp(testURL, env, app, profileDir, extraArgs,
else:
outputPipe = subprocess.PIPE
proc = Process([cmd] + args, env = environment(env, xrePath = xrePath),
stdout = outputPipe, stderr = subprocess.STDOUT)
proc = Process([cmd] + args,
env = environment(env, xrePath = xrePath,
crashreporter = not debuggerInfo),
stdout = outputPipe,
stderr = subprocess.STDOUT)
log.info("INFO | automation.py | Application pid: %d", proc.pid)
if outputPipe is None:

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

@ -198,43 +198,53 @@ SetEnvironmentVariableW(const unsigned short* name,
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned short* lpDst,
unsigned int nSize)
unsigned short* lpDst,
unsigned int nSize)
{
if ( NULL == lpDst )
return 0;
unsigned int size = 0;
unsigned int index = 0;
unsigned int origLen = wcslen(lpSrc);
const unsigned short *pIn = lpSrc;
unsigned short *pOut = lpDst;
while ( index < origLen ) {
if (*pIn != L'%') { // Regular char, copy over
if ( size < nSize ) *pOut = *pIn, pOut++;
index++, size++, pIn++;
if ( size++ < nSize ) *pOut = *pIn, pOut++;
index++, pIn++;
continue;
}
// Have a starting '%' - look for matching '%'
int envlen = 0;
const unsigned short *pTmp = ++pIn; // Move past original '%'
while ( L'%' != *pTmp ) {
const unsigned short *pTmp = pIn + 1;
while ( *pTmp != L'%' && *pTmp != L' ' ) {
envlen++, pTmp++;
if ( origLen < index + envlen ) { // Ran past end of original
SetLastError(ERROR_INVALID_PARAMETER); // buffer without matching '%'
return -1;
while ( envlen-- ) {
if ( size++ < nSize ) *pOut = *pIn, pOut++;
index++, pIn++;
}
break;
}
}
if ( *pTmp == L' ' ) { // Need to append through space
while ( envlen-- ) {
if ( size++ < nSize ) *pOut = *pIn, pOut++;
index++, pIn++;
}
continue;
}
pIn++; // Move past original %
if ( 0 == envlen ) { // Encountered a "%%" - mapping to "%"
size++;
if ( size < nSize ) *pOut = *pIn, pOut++;
pIn++;
index += 2;
if ( size++ < nSize ) *pOut = *pIn, pOut++;
index += 2, pIn++;
} else {
// Encountered a "%something%" - mapping "something"
char key[256];
@ -252,7 +262,7 @@ unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
pIn = ++pTmp;
}
}
if ( size < nSize ) lpDst[size] = 0;
return size;
}

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

@ -537,22 +537,32 @@ private:
* has set the "security.xpconnect.plugin.unrestricted" pref to allow
* anybody to script plugin objects from anywhere.
*
* @param cx The context we're running on.
* NB: If null, "sameOrigin" does not have any effect.
* @param aObj The nsISupports representation of the object in question
* object, possibly null.
* @param aJSObject The JSObject representation of the object in question.
* Only used if |aObjectSecurityLevel| is "sameOrigin".
* @param aJSObject The JSObject representation of the object in question
* if |cx| is non-null and |aObjectSecurityLevel| is
* "sameOrigin". If null will be calculated from aObj (if
* non-null) if and only if aObj is an XPCWrappedJS. The
* rationale behind this is that if we're creating a JS
* wrapper for an XPCWrappedJS, this object definitely
* expects to be exposed to JS.
* @param aSubjectPrincipal The nominal subject principal used when
* aObjectSecurityLevel is "sameOrigin".
* aObjectSecurityLevel is "sameOrigin". If null,
* this is calculated if it's needed.
* @param aObjectSecurityLevel Can be one of three values:
* - allAccess: Allow access no matter what.
* - noAccess: Deny access no matter what.
* - sameOrigin: If both a subject principal and JS
* object have been passed in, returns
* true if the subject subsumes the object,
* otherwise, behaves like noAccess.
* - sameOrigin: If |cx| is null, behave like noAccess.
* Otherwise, possibly compute a subject
* and object principal and return true if
* and only if the subject has greater than
* or equal privileges to the object.
*/
nsresult
CheckXPCPermissions(nsISupports* aObj, JSObject* aJSObject,
CheckXPCPermissions(JSContext* cx,
nsISupports* aObj, JSObject* aJSObject,
nsIPrincipal* aSubjectPrincipal,
const char* aObjectSecurityLevel);

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

@ -812,7 +812,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
}
}
}
rv = CheckXPCPermissions(aObj, aJSObject, subjectPrincipal,
rv = CheckXPCPermissions(cx, aObj, aJSObject, subjectPrincipal,
objectSecurityLevel);
#ifdef DEBUG_CAPS_CheckPropertyAccessImpl
if(NS_SUCCEEDED(rv))
@ -2937,7 +2937,7 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
if (checkedComponent)
checkedComponent->CanCreateWrapper((nsIID *)&aIID, getter_Copies(objectSecurityLevel));
nsresult rv = CheckXPCPermissions(aObj, nsnull, nsnull, objectSecurityLevel);
nsresult rv = CheckXPCPermissions(cx, aObj, nsnull, nsnull, objectSecurityLevel);
if (NS_FAILED(rv))
{
//-- Access denied, report an error
@ -3048,7 +3048,7 @@ nsScriptSecurityManager::CanCreateInstance(JSContext *cx,
NS_Free(cidStr);
#endif
nsresult rv = CheckXPCPermissions(nsnull, nsnull, nsnull, nsnull);
nsresult rv = CheckXPCPermissions(nsnull, nsnull, nsnull, nsnull, nsnull);
if (NS_FAILED(rv))
#ifdef XPC_IDISPATCH_SUPPORT
{
@ -3085,7 +3085,7 @@ nsScriptSecurityManager::CanGetService(JSContext *cx,
NS_Free(cidStr);
#endif
nsresult rv = CheckXPCPermissions(nsnull, nsnull, nsnull, nsnull);
nsresult rv = CheckXPCPermissions(nsnull, nsnull, nsnull, nsnull, nsnull);
if (NS_FAILED(rv))
{
//-- Access denied, report an error
@ -3124,7 +3124,8 @@ nsScriptSecurityManager::CanAccess(PRUint32 aAction,
}
nsresult
nsScriptSecurityManager::CheckXPCPermissions(nsISupports* aObj, JSObject* aJSObject,
nsScriptSecurityManager::CheckXPCPermissions(JSContext* cx,
nsISupports* aObj, JSObject* aJSObject,
nsIPrincipal* aSubjectPrincipal,
const char* aObjectSecurityLevel)
{
@ -3138,20 +3139,40 @@ nsScriptSecurityManager::CheckXPCPermissions(nsISupports* aObj, JSObject* aJSObj
{
if (PL_strcasecmp(aObjectSecurityLevel, "allAccess") == 0)
return NS_OK;
if (aSubjectPrincipal && aJSObject &&
PL_strcasecmp(aObjectSecurityLevel, "sameOrigin") == 0)
if (cx && PL_strcasecmp(aObjectSecurityLevel, "sameOrigin") == 0)
{
nsIPrincipal* objectPrincipal = doGetObjectPrincipal(aJSObject);
// Only do anything if we have both a subject and object
// principal.
if (objectPrincipal)
nsresult rv;
if (!aJSObject)
{
PRBool subsumes;
nsresult rv = aSubjectPrincipal->Subsumes(objectPrincipal, &subsumes);
nsCOMPtr<nsIXPConnectWrappedJS> xpcwrappedjs =
do_QueryInterface(aObj);
if (xpcwrappedjs)
{
rv = xpcwrappedjs->GetJSObject(&aJSObject);
NS_ENSURE_SUCCESS(rv, rv);
}
}
if (!aSubjectPrincipal)
{
// No subject principal passed in. Compute it.
aSubjectPrincipal = GetSubjectPrincipal(cx, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (subsumes)
return NS_OK;
}
if (aSubjectPrincipal && aJSObject)
{
nsIPrincipal* objectPrincipal = doGetObjectPrincipal(aJSObject);
// Only do anything if we have both a subject and object
// principal.
if (objectPrincipal)
{
PRBool subsumes;
rv = aSubjectPrincipal->Subsumes(objectPrincipal, &subsumes);
NS_ENSURE_SUCCESS(rv, rv);
if (subsumes)
return NS_OK;
}
}
}
else if (PL_strcasecmp(aObjectSecurityLevel, "noAccess") != 0)

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

@ -112,6 +112,7 @@ MOZ_JPROF = @MOZ_JPROF@
MOZ_SHARK = @MOZ_SHARK@
MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
MOZ_TRACEVIS = @MOZ_TRACEVIS@
DEHYDRA_PATH = @DEHYDRA_PATH@
MOZ_XPCTOOLS = @MOZ_XPCTOOLS@

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

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="nsinstall"
type="win32"
/>
<description>nsinstall</description>
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false"></ms_asmv3:requestedExecutionLevel>
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
</assembly>

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

@ -1017,7 +1017,11 @@ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
ifdef MSMANIFEST_TOOL
@if test -f $@.manifest; then \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
if test -f "$(srcdir)/$@.manifest"; then \
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
else \
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
fi; \
rm -f $@.manifest; \
fi
endif # MSVC with manifest tool
@ -1487,7 +1491,7 @@ else
# on it, then merge with the rest of the path.
root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1)))
normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
endif
else
normalizepath = $(1)

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

@ -5,7 +5,6 @@ DEHYDRA_SCRIPT = $(topsrcdir)/config/static-checking.js
DEHYDRA_MODULES = \
$(topsrcdir)/xpcom/analysis/final.js \
$(topsrcdir)/layout/generic/frame-verify.js \
$(NULL)
TREEHYDRA_MODULES = \
@ -13,6 +12,7 @@ TREEHYDRA_MODULES = \
$(topsrcdir)/xpcom/analysis/stack.js \
$(topsrcdir)/xpcom/analysis/flow.js \
$(topsrcdir)/js/src/jsstack.js \
$(topsrcdir)/layout/generic/frame-verify.js \
$(NULL)
DEHYDRA_ARGS = \

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

@ -130,7 +130,7 @@ GCONF_VERSION=1.2.1
LIBGNOME_VERSION=2.0
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
SQLITE_VERSION=3.6.14.2
SQLITE_VERSION=3.6.16
LIBNOTIFY_VERSION=0.4
MSMANIFEST_TOOL=
@ -1385,6 +1385,12 @@ sun4u | sparc*)
x86_64 | ia64)
CPU_ARCH="$OS_TEST"
;;
arm)
if test "$OS_TARGET" == "WINCE"; then
CPU_ARCH="$OS_TEST"
fi
;;
esac
if test -z "$OS_TARGET"; then
@ -2008,7 +2014,7 @@ case "$target" in
;;
*-wince*)
TARGET_COMPILER_ABI=msvc
MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
AR_LIST="$AR -list"
AR_EXTRACT="$AR -extract"
@ -6697,6 +6703,17 @@ MOZ_ARG_WITH_STRING(wrap-malloc,
[ --with-wrap-malloc=DIR Location of malloc wrapper library],
WRAP_MALLOC_LIB=$withval)
dnl ========================================================
dnl = Use TraceVis
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(tracevis,
[ --enable-tracevis Enable TraceVis tracing tool (default=no)],
MOZ_TRACEVIS=1,
MOZ_TRACEVIS= )
if test -n "$MOZ_TRACEVIS"; then
AC_DEFINE(MOZ_TRACEVIS)
fi
dnl ========================================================
dnl = Use Valgrind
dnl ========================================================

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

@ -62,6 +62,8 @@ public:
// whenever the size of the element changes.
NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height) = 0;
NS_IMETHOD InitializeWithSurface(nsIDocShell *docShell, gfxASurface *surface, PRInt32 width, PRInt32 height) = 0;
// Render the canvas at the origin of the given gfxContext
NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) = 0;

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

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Rob Arnold <tellrob@gmail.com>
* Eric Butler <zantifon@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
@ -316,6 +317,7 @@ public:
// nsICanvasRenderingContextInternal
NS_IMETHOD SetCanvasElement(nsICanvasElement* aParentCanvas);
NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height);
NS_IMETHOD InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, PRInt32 width, PRInt32 height);
NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter);
NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions,
@ -361,6 +363,9 @@ protected:
// so these are not nsCOMPtrs
nsICanvasElement* mCanvasElement;
// If mCanvasElement is not provided, then a docshell is
nsCOMPtr<nsIDocShell> mDocShell;
// our CSS parser, for colors and whatnot
nsCOMPtr<nsICSSParser> mCSSParser;
@ -479,6 +484,20 @@ protected:
*/
nsresult DrawRect(const gfxRect& rect, Style style);
/**
* Gets the pres shell from either the canvas element or the doc shell
*/
nsIPresShell *GetPresShell() {
nsIPresShell *presShell = nsnull;
nsCOMPtr<nsIContent> content = do_QueryInterface(mCanvasElement);
if (content) {
presShell = content->GetOwnerDoc()->GetPrimaryShell();
} else if (mDocShell) {
mDocShell->GetPresShell(&presShell);
}
return presShell;
}
// text
enum TextAlign {
TEXT_ALIGN_START,
@ -613,17 +632,14 @@ protected:
PRUint32 devPixel = 60;
PRUint32 cssPixel = 60;
nsCOMPtr<nsINode> elem = do_QueryInterface(mCanvasElement);
if (elem) {
nsIDocument *doc = elem->GetOwnerDoc();
if (!doc) goto FINISH;
nsIPresShell *ps = doc->GetPrimaryShell();
if (!ps) goto FINISH;
nsPresContext *pc = ps->GetPresContext();
if (!pc) goto FINISH;
devPixel = pc->AppUnitsPerDevPixel();
cssPixel = pc->AppUnitsPerCSSPixel();
}
nsIPresShell *ps = GetPresShell();
nsPresContext *pc;
if (!ps) goto FINISH;
pc = ps->GetPresContext();
if (!pc) goto FINISH;
devPixel = pc->AppUnitsPerDevPixel();
cssPixel = pc->AppUnitsPerCSSPixel();
FINISH:
if (perDevPixel)
@ -795,12 +811,10 @@ nsCanvasRenderingContext2D::ApplyStyle(Style aWhichStyle,
nsCanvasPattern* pattern = CurrentState().patternStyles[aWhichStyle];
if (pattern) {
if (!mCanvasElement)
return;
CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
pattern->Principal(),
pattern->GetForceWriteOnly());
if (mCanvasElement)
CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
pattern->Principal(),
pattern->GetForceWriteOnly());
gfxPattern* gpat = pattern->GetPattern();
@ -859,8 +873,7 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
{
Destroy();
mWidth = width;
mHeight = height;
nsRefPtr<gfxASurface> surface;
// Check that the dimensions are sane
if (gfxASurface::CheckSurfaceSize(gfxIntSize(width, height), 0xffff)) {
@ -868,13 +881,28 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
if (mOpaque)
format = gfxASurface::ImageFormatRGB24;
mSurface = gfxPlatform::GetPlatform()->CreateOffscreenSurface
surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface
(gfxIntSize(width, height), format);
if (mSurface->CairoStatus() == 0) {
mThebes = new gfxContext(mSurface);
if (surface->CairoStatus() != 0) {
surface = NULL;
}
}
return InitializeWithSurface(NULL, surface, width, height);
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASurface *surface, PRInt32 width, PRInt32 height) {
Destroy();
NS_ASSERTION(!docShell ^ !mCanvasElement, "Cannot set both docshell and canvas element");
mDocShell = docShell;
mWidth = width;
mHeight = height;
mSurface = surface;
mThebes = new gfxContext(mSurface);
/* Create dummy surfaces here */
if (mSurface == nsnull || mSurface->CairoStatus() != 0 ||
@ -886,6 +914,11 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
mValid = PR_TRUE;
}
// set up our css parser, if necessary
if (!mCSSParser) {
mCSSParser = do_CreateInstance("@mozilla.org/content/css-parser;1");
}
// set up the initial canvas defaults
mStyleStack.Clear();
mSaveCount = 0;
@ -1032,11 +1065,6 @@ nsCanvasRenderingContext2D::SetCanvasElement(nsICanvasElement* aCanvasElement)
// don't hold a ref to this!
mCanvasElement = aCanvasElement;
// set up our css parser, if necessary
if (!mCSSParser) {
mCSSParser = do_CreateInstance("@mozilla.org/content/css-parser;1");
}
return NS_OK;
}
@ -1870,16 +1898,15 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
*/
nsCOMPtr<nsIContent> content = do_QueryInterface(mCanvasElement);
if (!content) {
NS_WARNING("Canvas element must be an nsIContent and non-null");
if (!content && !mDocShell) {
NS_WARNING("Canvas element must be an nsIContent and non-null or a docshell must be provided");
return NS_ERROR_FAILURE;
}
nsIDocument* document = content->GetOwnerDoc();
nsIPresShell* presShell = document->GetPrimaryShell();
nsIPresShell* presShell = GetPresShell();
if (!presShell)
return NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
nsIDocument* document = presShell->GetDocument();
nsCString langGroup;
presShell->GetPresContext()->GetLangGroup()->ToUTF8String(langGroup);
@ -1887,7 +1914,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
nsCOMArray<nsIStyleRule> rules;
nsCOMPtr<nsICSSStyleRule> rule;
rv = CreateFontStyleRule(font, mCSSParser.get(), content.get(), getter_AddRefs(rule));
rv = CreateFontStyleRule(font, mCSSParser.get(), document, getter_AddRefs(rule));
if (NS_FAILED(rv))
return rv;
@ -1899,7 +1926,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
// values (2em, bolder, etc.)
nsRefPtr<nsStyleContext> parentContext;
if (content->IsInDoc()) {
if (content && content->IsInDoc()) {
// inherit from the canvas element
parentContext = nsInspectorCSSUtils::GetStyleContextForContent(
content,
@ -1910,7 +1937,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
nsCOMPtr<nsICSSStyleRule> parentRule;
rv = CreateFontStyleRule(NS_LITERAL_STRING("10px sans-serif"),
mCSSParser.get(),
content.get(),
document,
getter_AddRefs(parentRule));
if (NS_FAILED(rv))
return rv;
@ -2219,17 +2246,17 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIContent> content = do_QueryInterface(mCanvasElement);
if (!content) {
NS_WARNING("Canvas element must be an nsIContent and non-null");
if (!content && !mDocShell) {
NS_WARNING("Canvas element must be an nsIContent and non-null or a docshell must be provided");
return NS_ERROR_FAILURE;
}
nsIDocument* document = content->GetOwnerDoc();
nsIPresShell* presShell = document->GetPrimaryShell();
nsIPresShell* presShell = GetPresShell();
if (!presShell)
return NS_ERROR_FAILURE;
nsIDocument* document = presShell->GetDocument();
nsBidiPresUtils* bidiUtils = presShell->GetPresContext()->GetBidiUtils();
if (!bidiUtils)
return NS_ERROR_FAILURE;
@ -2241,7 +2268,7 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
// for now, default to ltr if not in doc
PRBool isRTL = PR_FALSE;
if (content->IsInDoc()) {
if (content && content->IsInDoc()) {
// try to find the closest context
nsRefPtr<nsStyleContext> canvasStyle =
nsInspectorCSSUtils::GetStyleContextForContent(content,
@ -2251,6 +2278,8 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
return NS_ERROR_FAILURE;
isRTL = canvasStyle->GetStyleVisibility()->mDirection ==
NS_STYLE_DIRECTION_RTL;
} else {
isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) == IBMBIDI_TEXTDIRECTION_RTL;
}
// don't need to take care of these with stroke since Stroke() does that
@ -2896,11 +2925,6 @@ nsCanvasRenderingContext2D::DrawImage()
nsresult rv;
gfxRect dirty;
// we can't do a security check without a canvas element, so
// just skip this entirely
if (!mCanvasElement)
return NS_ERROR_FAILURE;
nsAXPCNativeCallContext *ncc = nsnull;
rv = nsContentUtils::XPConnect()->
GetCurrentNativeCallContext(&ncc);
@ -2959,7 +2983,8 @@ nsCanvasRenderingContext2D::DrawImage()
gfxIntSize imgSize = res.mSize;
PRBool forceWriteOnly = res.mIsWriteOnly;
CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement, principal, forceWriteOnly);
if (mCanvasElement)
CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement, principal, forceWriteOnly);
gfxContextPathAutoSaveRestore pathSR(mThebes, PR_FALSE);
@ -3369,10 +3394,10 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
NS_IMETHODIMP
nsCanvasRenderingContext2D::GetImageData()
{
if (!mValid || !mCanvasElement)
if (!mValid)
return NS_ERROR_FAILURE;
if (mCanvasElement->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
if (mCanvasElement && mCanvasElement->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -3727,7 +3752,7 @@ nsCanvasRenderingContext2D::GetThebesSurface(gfxASurface **surface)
NS_IMETHODIMP
nsCanvasRenderingContext2D::CreateImageData()
{
if (!mValid || !mCanvasElement)
if (!mValid)
return NS_ERROR_FAILURE;
nsAXPCNativeCallContext *ncc = nsnull;

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

@ -59,13 +59,11 @@
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "nsIDOMHTMLCanvasElement.h"
#include "nsICanvasElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIImageLoadingContent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIImage.h"
#include "nsDOMError.h"
#include "nsIJSRuntimeService.h"

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

@ -65,13 +65,11 @@
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "nsIDOMHTMLCanvasElement.h"
#include "nsICanvasElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIImageLoadingContent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIImage.h"
#include "nsDOMError.h"
#include "nsIJSRuntimeService.h"

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

@ -63,7 +63,6 @@
#include "nsWeakReference.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIImage.h"
#include "nsDOMError.h"
#include "nsIJSRuntimeService.h"

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

@ -151,6 +151,8 @@
#ifdef MOZ_XUL
#include "nsTreeBodyFrame.h"
#endif
#include "nsIFocusController.h"
#include "nsIController.h"
#ifdef XP_MACOSX
#include <Carbon/Carbon.h>
@ -1195,6 +1197,16 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
handler.OnSelectionEvent((nsSelectionEvent*)aEvent);
}
break;
case NS_CONTENT_COMMAND_CUT:
case NS_CONTENT_COMMAND_COPY:
case NS_CONTENT_COMMAND_PASTE:
case NS_CONTENT_COMMAND_DELETE:
case NS_CONTENT_COMMAND_UNDO:
case NS_CONTENT_COMMAND_REDO:
{
DoContentCommandEvent(static_cast<nsContentCommandEvent*>(aEvent));
}
break;
}
return NS_OK;
}
@ -4205,3 +4217,56 @@ nsEventStateManager::IsShellVisible(nsIDocShell* aShell)
return isVisible;
}
nsresult
nsEventStateManager::DoContentCommandEvent(nsContentCommandEvent* aEvent)
{
EnsureDocument(mPresContext);
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mDocument->GetWindow()));
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIFocusController* fc = window->GetRootFocusController();
NS_ENSURE_TRUE(fc, NS_ERROR_FAILURE);
const char* cmd;
switch (aEvent->message) {
case NS_CONTENT_COMMAND_CUT:
cmd = "cmd_cut";
break;
case NS_CONTENT_COMMAND_COPY:
cmd = "cmd_copy";
break;
case NS_CONTENT_COMMAND_PASTE:
cmd = "cmd_paste";
break;
case NS_CONTENT_COMMAND_DELETE:
cmd = "cmd_delete";
break;
case NS_CONTENT_COMMAND_UNDO:
cmd = "cmd_undo";
break;
case NS_CONTENT_COMMAND_REDO:
cmd = "cmd_redo";
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
nsCOMPtr<nsIController> controller;
nsresult rv = fc->GetControllerForCommand(cmd, getter_AddRefs(controller));
NS_ENSURE_SUCCESS(rv, rv);
if (!controller) {
// When GetControllerForCommand succeeded but there is no controller, the
// command isn't supported.
aEvent->mIsEnabled = PR_FALSE;
} else {
PRBool canDoIt;
rv = controller->IsCommandEnabled(cmd, &canDoIt);
NS_ENSURE_SUCCESS(rv, rv);
aEvent->mIsEnabled = canDoIt;
if (canDoIt && !aEvent->mOnlyEnabledCheck) {
rv = controller->DoCommand(cmd);
NS_ENSURE_SUCCESS(rv, rv);
}
}
aEvent->mSucceeded = PR_TRUE;
return NS_OK;
}

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

@ -326,6 +326,8 @@ protected:
*/
void FillInEventFromGestureDown(nsMouseEvent* aEvent);
nsresult DoContentCommandEvent(nsContentCommandEvent* aEvent);
PRInt32 mLockCursor;
nsWeakFrame mCurrentTarget;

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

@ -269,12 +269,13 @@ void nsMediaDecoder::Paint(gfxContext* aContext,
// outside the bounds of the video image.
gfxPattern::GraphicsExtend extend = gfxPattern::EXTEND_PAD;
// PAD is too slow with X11 surfaces, so prefer speed over correctness and
// use NONE.
// PAD is slow with X11 and Quartz surfaces, so prefer speed over correctness
// and use NONE.
nsRefPtr<gfxASurface> target = aContext->CurrentSurface();
gfxASurface::gfxSurfaceType type = target->GetType();
if (type == gfxASurface::SurfaceTypeXlib ||
type == gfxASurface::SurfaceTypeXcb) {
type == gfxASurface::SurfaceTypeXcb ||
type == gfxASurface::SurfaceTypeQuartz) {
extend = gfxPattern::EXTEND_NONE;
}

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

@ -910,22 +910,16 @@ void nsOggDecodeStateMachine::PlayFrame() {
}
double time;
double prevTime = -1.0;
PRUint32 hasAudio = frame->mAudioData.Length();
for (;;) {
// Even if the frame has had its audio data written we call
// PlayAudio to ensure that any data we have buffered in the
// nsAudioStream is written to the hardware.
PlayAudio(frame);
double hwtime = mAudioStream ? mAudioStream->GetPosition() : -1.0;
double hwtime = mAudioStream && hasAudio ? mAudioStream->GetPosition() : -1.0;
time = hwtime < 0.0 ?
(TimeStamp::Now() - mPlayStartTime - mPauseDuration).ToSeconds() :
hwtime;
// Break out of the loop if we've not played any audio. This can
// happen when the frame has no audio, and there's no audio pending
// in the nsAudioStream.
if (time == prevTime)
break;
prevTime = time;
// Is it time for the next frame? Using an integer here avoids f.p.
// rounding errors that can cause multiple 0ms waits (Bug 495352)
PRInt64 wait = PRInt64((frame->mTime - time)*1000);

Двоичные данные
content/media/test/448636.ogv Normal file

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

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

@ -113,8 +113,19 @@ _TEST_FILES += \
320x240.ogv \
320x240.allow-origin.ogv \
320x240.allow-origin.ogv^headers^ \
448636.ogv \
bug495129.ogv \
bug461281.ogg \
bug482461.ogv \
bug498855-1.ogv \
bug498855-2.ogv \
bug498855-3.ogv \
bug499519.ogv \
bug500311.ogv \
bug500311.ogv^headers^ \
bug501279.ogg \
bug504644.ogv \
bug506094.ogv \
seek.ogv \
small-shot.ogg \
sound.ogg \

Двоичные данные
content/media/test/bug495129.ogv Normal file

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

Двоичные данные
content/media/test/bug498855-1.ogv Normal file

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

Двоичные данные
content/media/test/bug498855-2.ogv Normal file

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

Двоичные данные
content/media/test/bug498855-3.ogv Normal file

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

Двоичные данные
content/media/test/bug499519.ogv Normal file

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

Двоичные данные
content/media/test/bug500311.ogv Normal file

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

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

@ -0,0 +1,2 @@
X-Content-Duration: 1.96

Двоичные данные
content/media/test/bug501279.ogg Normal file

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

Двоичные данные
content/media/test/bug504644.ogv Normal file

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

Двоичные данные
content/media/test/bug506094.ogv Normal file

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

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

@ -6,6 +6,8 @@
var gSmallTests = [
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240 },
{ name: "bug499519.ogv", type:"video/ogg", duration:0.24 },
{ name: "bug506094.ogv", type:"video/ogg", duration:0 },
{ name:"bogus.duh", type:"bogus/duh" }
];
@ -26,6 +28,11 @@ var gPlayTests = [
{ name:"bug461281.ogg", type:"application/ogg" },
// oggz-chop stream
{ name:"bug482461.ogv", type:"video/ogg", duration:4.24 },
// With first frame a "duplicate" (empty) frame.
{ name:"bug500311.ogv", type:"video/ogg", duration:1.96 },
// Small audio file
{ name:"small-shot.ogg", type:"video/ogg" },
{ name:"bogus.duh", type:"bogus/duh" }
];
@ -34,8 +41,15 @@ var gPlayTests = [
// Put files of the same type together in this list so if something crashes
// we have some idea of which backend is responsible.
var gErrorTests = [
{ name: "bug495129.ogv", type:"video/ogg", duration:2.52 },
{ name: "bug498855-1.ogv", type:"video/ogg", duration:0.2 },
{ name: "bug498855-2.ogv", type:"video/ogg", duration:0.2 },
{ name: "bug498855-3.ogv", type:"video/ogg", duration:0.2 },
{ name: "bug501279.ogg", type:"audio/ogg", duration:0 },
{ name: "bug504644.ogv", type:"video/ogg", duration:1.56 },
{ name:"bogus.wav", type:"audio/x-wav" },
{ name:"bogus.ogv", type:"video/ogg" },
{ name:"448636.ogv", type:"video/ogg" },
{ name:"bogus.duh", type:"bogus/duh" }
];

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

@ -234,11 +234,8 @@ nsSMILTimedElement::SampleAt(nsSMILTime aDocumentTime)
{
case STATE_STARTUP:
{
nsSMILTimeValue beginAfter;
beginAfter.SetMillis(LL_MININT);
mElementState =
(NS_SUCCEEDED(GetNextInterval(beginAfter, PR_TRUE, mCurrentInterval)))
(NS_SUCCEEDED(GetNextInterval(nsnull, mCurrentInterval)))
? STATE_WAITING
: STATE_POSTACTIVE;
stateChanged = PR_TRUE;
@ -263,9 +260,7 @@ nsSMILTimedElement::SampleAt(nsSMILTime aDocumentTime)
if (mCurrentInterval.mEnd.CompareTo(docTime) <= 0) {
nsSMILInterval newInterval;
mElementState =
(NS_SUCCEEDED(GetNextInterval(mCurrentInterval.mEnd,
PR_FALSE,
newInterval)))
(NS_SUCCEEDED(GetNextInterval(&mCurrentInterval, newInterval)))
? STATE_WAITING
: STATE_POSTACTIVE;
if (mClient) {
@ -706,30 +701,28 @@ nsSMILTimedElement::SetBeginOrEndSpec(const nsAString& aSpec,
// http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-LC-Start
//
nsresult
nsSMILTimedElement::GetNextInterval(const nsSMILTimeValue& aBeginAfter,
PRBool aFirstInterval,
nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval,
nsSMILInterval& aResult)
{
static nsSMILTimeValue zeroTime;
zeroTime.SetMillis(0L);
nsSMILTimeValue beginAfter = aBeginAfter;
if (mRestartMode == RESTART_NEVER && aPrevInterval)
return NS_ERROR_FAILURE;
// Calc starting point
nsSMILTimeValue beginAfter;
PRBool prevIntervalWasZeroDur = PR_FALSE;
if (aPrevInterval) {
beginAfter = aPrevInterval->mEnd;
prevIntervalWasZeroDur
= (aPrevInterval->mEnd.CompareTo(aPrevInterval->mBegin) == 0);
} else {
beginAfter.SetMillis(LL_MININT);
}
nsSMILTimeValue tempBegin;
nsSMILTimeValue tempEnd;
PRInt32 beginPos = 0;
PRInt32 endPos = 0;
//
// This is to handle the special case when a we are calculating the first
// interval and we have a non-0-duration interval immediately after
// a 0-duration in which case but we have to be careful not to re-use an end
// that has already been used in another interval. See the pseudocode in
// SMILANIM 3.6.8 for getFirstInterval.
//
PRInt32 endMaxPos = 0;
if (mRestartMode == RESTART_NEVER && !aFirstInterval)
return NS_ERROR_FAILURE;
nsSMILInstanceTime::Comparator comparator;
mBeginInstances.Sort(comparator);
@ -739,6 +732,7 @@ nsSMILTimedElement::GetNextInterval(const nsSMILTimeValue& aBeginAfter,
if (!mBeginSpecSet && beginAfter.CompareTo(zeroTime) <= 0) {
tempBegin.SetMillis(0);
} else {
PRInt32 beginPos = 0;
PRBool beginFound = GetNextGreaterOrEqual(mBeginInstances, beginAfter,
beginPos, tempBegin);
if (!beginFound)
@ -751,23 +745,16 @@ nsSMILTimedElement::GetNextInterval(const nsSMILTimeValue& aBeginAfter,
tempEnd = CalcActiveEnd(tempBegin, indefiniteEnd);
} else {
//
// Start searching from the beginning again.
//
endPos = 0;
PRInt32 endPos = 0;
PRBool endFound = GetNextGreaterOrEqual(mEndInstances, tempBegin,
endPos, tempEnd);
if ((!aFirstInterval && tempEnd.CompareTo(aBeginAfter) == 0) ||
(aFirstInterval && tempEnd.CompareTo(tempBegin) == 0 &&
endPos <= endMaxPos)) {
endFound =
GetNextGreaterOrEqual(mEndInstances, tempBegin, endPos, tempEnd);
// If the last interval ended at the same point and was zero-duration and
// this one is too, look for another end to use instead
if (tempEnd.CompareTo(tempBegin) == 0 && prevIntervalWasZeroDur) {
endFound = GetNextGreater(mEndInstances, tempBegin, endPos, tempEnd);
}
endMaxPos = endPos;
if (!endFound) {
if (mEndHasEventConditions || mEndInstances.Length() == 0) {
tempEnd.SetUnresolved();
@ -785,11 +772,25 @@ nsSMILTimedElement::GetNextInterval(const nsSMILTimeValue& aBeginAfter,
tempEnd = CalcActiveEnd(tempBegin, tempEnd);
}
if (tempEnd.CompareTo(zeroTime) > 0) {
// If we get two zero-length intervals in a row we will potentially have an
// infinite loop so we break it here by searching for the next begin time
// greater than tempEnd on the next time around.
if (tempEnd.IsResolved() && tempBegin.CompareTo(tempEnd) == 0) {
if (prevIntervalWasZeroDur) {
beginAfter.SetMillis(tempEnd.GetMillis()+1);
prevIntervalWasZeroDur = PR_FALSE;
continue;
}
prevIntervalWasZeroDur = PR_TRUE;
}
if (tempEnd.CompareTo(zeroTime) > 0 ||
(tempBegin.CompareTo(zeroTime) == 0 && tempEnd.CompareTo(zeroTime) == 0)) {
aResult.mBegin = tempBegin;
aResult.mEnd = tempEnd;
return NS_OK;
} else if (mRestartMode == RESTART_NEVER) {
// tempEnd <= 0 so we're going to loop which effectively means restarting
return NS_ERROR_FAILURE;
} else {
beginAfter = tempEnd;
@ -800,6 +801,19 @@ nsSMILTimedElement::GetNextInterval(const nsSMILTimeValue& aBeginAfter,
return NS_ERROR_FAILURE;
}
PRBool
nsSMILTimedElement::GetNextGreater(
const nsTArray<nsSMILInstanceTime>& aList,
const nsSMILTimeValue& aBase,
PRInt32 &aPosition,
nsSMILTimeValue& aResult)
{
PRBool found;
while ((found = GetNextGreaterOrEqual(aList, aBase, aPosition, aResult))
&& aResult.CompareTo(aBase) == 0);
return found;
}
PRBool
nsSMILTimedElement::GetNextGreaterOrEqual(
const nsTArray<nsSMILInstanceTime>& aList,
@ -957,9 +971,7 @@ nsSMILTimedElement::CheckForEarlyEnd(const nsSMILTimeValue& aDocumentTime)
nsSMILTimeValue nextBegin;
PRInt32 position = 0;
while (GetNextGreaterOrEqual(mBeginInstances, mCurrentInterval.mBegin,
position, nextBegin)
&& nextBegin.CompareTo(mCurrentInterval.mBegin) == 0);
GetNextGreater(mBeginInstances, mCurrentInterval.mBegin, position, nextBegin);
if (nextBegin.IsResolved() &&
nextBegin.CompareTo(mCurrentInterval.mBegin) > 0 &&
@ -973,16 +985,10 @@ void
nsSMILTimedElement::UpdateCurrentInterval()
{
nsSMILInterval updatedInterval;
PRBool isFirstInterval = mOldIntervals.IsEmpty();
nsSMILTimeValue beginAfter;
if (!isFirstInterval) {
beginAfter = mOldIntervals[mOldIntervals.Length() - 1].mEnd;
} else {
beginAfter.SetMillis(LL_MININT);
}
nsresult rv = GetNextInterval(beginAfter, isFirstInterval, updatedInterval);
nsSMILInterval* prevInterval = mOldIntervals.IsEmpty()
? nsnull
: &mOldIntervals[mOldIntervals.Length() - 1];
nsresult rv = GetNextInterval(prevInterval, updatedInterval);
if (NS_SUCCEEDED(rv)) {
@ -1049,7 +1055,7 @@ nsSMILTimedElement::SampleFillValue()
nsSMILTime simpleTime =
ActiveTimeToSimpleTime(activeTime, repeatIteration);
if (simpleTime == 0L) {
if (simpleTime == 0L && repeatIteration) {
mClient->SampleLastValue(--repeatIteration);
} else {
mClient->SampleAt(simpleTime, mSimpleDur, repeatIteration);

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

@ -251,9 +251,12 @@ protected:
*
* @see SMILANIM 3.6.8
*/
nsresult GetNextInterval(const nsSMILTimeValue& aBeginAfter,
PRBool aFirstInstance,
nsresult GetNextInterval(const nsSMILInterval* aPrevInterval,
nsSMILInterval& aResult);
PRBool GetNextGreater(const nsTArray<nsSMILInstanceTime>& aList,
const nsSMILTimeValue& aBase,
PRInt32& aPosition,
nsSMILTimeValue& aResult);
PRBool GetNextGreaterOrEqual(
const nsTArray<nsSMILInstanceTime>& aList,
const nsSMILTimeValue& aBase,

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

@ -20,6 +20,7 @@
#
# Contributor(s):
# Daniel Holbert <dholbert@mozilla.com>
# Brian Birtles <bbirtles@gmail.com>
#
# 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"),
@ -49,6 +50,8 @@ _TEST_FILES = test_smilRestart.xhtml \
test_smilSetCurrentTime.xhtml \
test_smilSync.xhtml \
test_smilSyncTransform.xhtml \
test_smilTiming.xhtml \
test_smilTimingZeroIntervals.xhtml \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,111 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test for SMIL timing</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for SMIL timing **/
/* Global Variables */
const svgns="http://www.w3.org/2000/svg";
var svg = document.getElementById("svg");
var circle = document.getElementById('circle');
SimpleTest.waitForExplicitFinish();
function createAnim() {
var anim = document.createElementNS(svgns,'animate');
anim.setAttribute('attributeName','cx');
anim.setAttribute('from','0');
anim.setAttribute('to','100');
anim.setAttribute('dur','10s');
anim.setAttribute('begin','indefinite');
return circle.appendChild(anim);
}
function removeAnim(anim) {
anim.parentNode.removeChild(anim);
}
function main() {
svg.pauseAnimations();
var tests =
[ testOffsetStartup,
testMultipleBegins,
testNegativeBegins,
testSorting
];
for (var i = 0; i < tests.length; i++) {
var anim = createAnim();
svg.setCurrentTime(0);
tests[i](anim);
removeAnim(anim);
}
SimpleTest.finish();
}
function checkSample(time, expectedValue) {
svg.setCurrentTime(time);
is(circle.cx.animVal.value, expectedValue);
}
function testOffsetStartup(anim) {
anim.setAttribute('begin', '3s');
checkSample(0,-100);
checkSample(4,10);
}
function testMultipleBegins(anim) {
anim.setAttribute('begin', '2s; 6s');
anim.setAttribute('dur', ' 2s');
checkSample(0,-100);
checkSample(3,50);
checkSample(4,-100);
checkSample(7,50);
checkSample(8,-100);
}
function testNegativeBegins(anim) {
anim.setAttribute('begin', '-3s; 1s ; 4s');
anim.setAttribute('dur', '2s ');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(0.5,-100);
checkSample(1,0);
checkSample(2,50);
checkSample(3,100);
checkSample(5,50);
}
function testSorting(anim) {
anim.setAttribute('begin', '-3s; 110s; 1s; 4s; -5s; -10s');
anim.setAttribute('end', '111s; -5s; -15s; 6s; -5s; 1.2s');
anim.setAttribute('dur', '2s ');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(1,0);
checkSample(2,10);
checkSample(4,0);
checkSample(5,50);
checkSample(109,100);
checkSample(110,0);
checkSample(112,50);
}
window.addEventListener("load", main, false);
]]>
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,271 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test for SMIL timing with zero-duration intervals</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
/** Test for SMIL timing with zero-duration intervals **/
/* Global Variables */
const svgns="http://www.w3.org/2000/svg";
var svg = document.getElementById("svg");
var circle = document.getElementById('circle');
SimpleTest.waitForExplicitFinish();
function createAnim() {
var anim = document.createElementNS(svgns,'animate');
anim.setAttribute('attributeName','cx');
anim.setAttribute('from','0');
anim.setAttribute('to','100');
anim.setAttribute('dur','10s');
anim.setAttribute('begin','indefinite');
return circle.appendChild(anim);
}
function removeAnim(anim) {
anim.parentNode.removeChild(anim);
}
function main() {
svg.pauseAnimations();
var tests =
[ testZeroDurationIntervalsA,
testZeroDurationIntervalsB,
testZeroDurationIntervalsC,
testZeroDurationIntervalsD,
testZeroDurationIntervalsE,
testZeroDurationIntervalsF,
testZeroDurationIntervalsG,
testZeroDurationIntervalsH,
testZeroDurationIntervalsI,
testZeroDurationIntervalsJ,
testZeroDurationIntervalsK,
testZeroDurationIntervalsL,
testZeroDurationIntervalsM,
testZeroDurationIntervalsN,
testZeroDurationIntervalsO
];
for (var i = 0; i < tests.length; i++) {
var anim = createAnim();
svg.setCurrentTime(0);
tests[i](anim);
removeAnim(anim);
}
SimpleTest.finish();
}
function checkSample(time, expectedValue) {
svg.setCurrentTime(time);
is(circle.cx.animVal.value, expectedValue);
}
function testZeroDurationIntervalsA(anim) {
// The zero-duration interval should play, followed by a second interval
// starting at the same point. There is no end for the interval
// at 4s so it should not play.
anim.setAttribute('begin', '1s ;4s');
anim.setAttribute('end', '1s; 2s');
anim.setAttribute('dur', '2s ');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(1,0);
checkSample(1.1,5);
checkSample(2,50);
checkSample(3,50);
checkSample(4,50);
checkSample(5,50);
checkSample(6,50);
}
function testZeroDurationIntervalsB(anim) {
// This interval should however actually restart as there is a valid end-point
anim.setAttribute('begin', '1s ;4s');
anim.setAttribute('end', '1.1s; indefinite');
anim.setAttribute('dur', '2s ');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(1,0);
checkSample(1.1,5);
checkSample(2,5);
checkSample(4,0);
checkSample(5,50);
}
function testZeroDurationIntervalsC(anim) {
// -0.5s has already been used as the endpoint of one interval so don't use it
// a second time
anim.setAttribute('begin', '-2s; -0.5s');
anim.setAttribute('end', '-0.5s; 1s');
anim.setAttribute('dur', '2s');
anim.setAttribute('fill', 'freeze');
checkSample(0,25);
checkSample(1.5,75);
}
function testZeroDurationIntervalsD(anim) {
// Two end points that could make a zero-length interval
anim.setAttribute('begin', '-2s; -0.5s');
anim.setAttribute('end', '-0.5s; -0.5s; 1s');
anim.setAttribute('dur', '2s');
anim.setAttribute('fill', 'freeze');
checkSample(0,25);
checkSample(1.5,75);
}
function testZeroDurationIntervalsE(anim) {
// Should give us 1s-1s, 1s-5s
anim.setAttribute('begin', '1s');
anim.setAttribute('end', '1s; 5s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),1);
checkSample(0,-100);
checkSample(1,0);
checkSample(6,40);
}
function testZeroDurationIntervalsF(anim) {
// Should give us 1s-1s
anim.setAttribute('begin', '1s');
anim.setAttribute('end', '1s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),1);
checkSample(0,-100);
checkSample(1,0);
checkSample(2,0);
is(anim.getStartTime(),1);
}
function testZeroDurationIntervalsG(anim) {
// Test a non-zero interval after a zero interval
// Should give us 1-2s, 3-3s, 3-4s
anim.setAttribute('begin', '1s; 3s');
anim.setAttribute('end', '3s; 5s');
anim.setAttribute('dur', '1s');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(1,0);
checkSample(2,100);
checkSample(3,0);
checkSample(5,100);
}
function testZeroDurationIntervalsH(anim) {
// Test multiple non-adjacent zero-intervals
// Should give us 1-1s, 1-2s, 3-3s, 3-4s
anim.setAttribute('begin', '1s; 3s');
anim.setAttribute('end', '1s; 3s; 5s');
anim.setAttribute('dur', '1s');
anim.setAttribute('fill', 'freeze');
checkSample(0,-100);
checkSample(1,0);
checkSample(2,100);
checkSample(3,0);
checkSample(5,100);
}
function testZeroDurationIntervalsI(anim) {
// Test skipping values that are the same
// Should give us 1-1s, 1-2s
anim.setAttribute('begin', '1s; 1s');
anim.setAttribute('end', '1s; 1s; 2s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),1);
checkSample(0,-100);
checkSample(1,0);
checkSample(2,10);
checkSample(3,10);
}
function testZeroDurationIntervalsJ(anim) {
// Should give us 0-0.5s, 1-1s, 1-3s
anim.setAttribute('begin', '0s; 1s; 1s');
anim.setAttribute('end', '1s; 3s');
anim.setAttribute('dur', '0.5s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),0);
checkSample(0,0);
checkSample(0.6,100);
checkSample(1,0);
checkSample(2,100);
}
function testZeroDurationIntervalsK(anim) {
// Should give us -0.5-1s
anim.setAttribute('begin', '-0.5s');
anim.setAttribute('end', '-0.5s; 1s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),-0.5);
checkSample(0,5);
checkSample(1,15);
checkSample(2,15);
}
function testZeroDurationIntervalsL(anim) {
// Test that multiple end values are ignored
// Should give us 1-1s, 1-3s
anim.setAttribute('begin', '1s');
anim.setAttribute('end', '1s; 1s; 1s; 3s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),1);
checkSample(0,-100);
checkSample(1,0);
checkSample(2,10);
checkSample(4,20);
}
function testZeroDurationIntervalsM(anim) {
// Test 0-duration interval at start
anim.setAttribute('begin', '0s');
anim.setAttribute('end', '0s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),0);
checkSample(0,0);
checkSample(1,0);
}
function testZeroDurationIntervalsN(anim) {
// Test 0-active-duration interval at start (different code path to above)
anim.setAttribute('begin', '0s');
anim.setAttribute('repeatDur', '0s');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),0);
checkSample(0,0);
checkSample(1,0);
}
function testZeroDurationIntervalsO(anim) {
// Make a zero-duration interval by constraining the active duration
// We should not loop infinitely but should look for the next begin time after
// that (in this case that is 2s, which would otherwise have been skipped
// because restart=whenNotActive)
// Should give us 1-1s, 2-2s
anim.setAttribute('begin', '1s; 2s');
anim.setAttribute('repeatDur', '0s');
anim.setAttribute('restart', 'whenNotActive');
anim.setAttribute('fill', 'freeze');
is(anim.getStartTime(),1);
checkSample(0,-100);
checkSample(1,0);
checkSample(1.5,0);
checkSample(3,0);
is(anim.getStartTime(),2);
}
window.addEventListener("load", main, false);
]]>
</script>
</pre>
</body>
</html>

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

@ -55,6 +55,8 @@
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_moveBottom"/>
@ -122,6 +124,8 @@
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_wordPrevious" />
<handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_wordNext" />

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

@ -1586,7 +1586,9 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
(aVisitor.mEvent->message == NS_MOUSE_CLICK ||
aVisitor.mEvent->message == NS_MOUSE_DOUBLECLICK ||
aVisitor.mEvent->message == NS_XUL_COMMAND ||
aVisitor.mEvent->message == NS_CONTEXTMENU)) {
aVisitor.mEvent->message == NS_CONTEXTMENU ||
aVisitor.mEvent->message == NS_DRAGDROP_START ||
aVisitor.mEvent->message == NS_DRAGDROP_GESTURE)) {
// Don't propagate these events from native anonymous scrollbar.
aVisitor.mCanHandle = PR_TRUE;
aVisitor.mParentTarget = nsnull;

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

@ -1669,8 +1669,14 @@ nsXULTemplateBuilder::GetTemplateRoot(nsIContent** aResult)
nsCOMPtr<nsIDOMElement> domElement;
domDoc->GetElementById(templateID, getter_AddRefs(domElement));
if (domElement)
return CallQueryInterface(domElement, aResult);
if (domElement) {
nsCOMPtr<nsIContent> content = do_QueryInterface(domElement);
NS_ENSURE_STATE(content &&
!nsContentUtils::ContentIsDescendantOf(mRoot,
content));
content.forget(aResult);
return NS_OK;
}
}
#if 1 // XXX hack to workaround bug with XBL insertion/removal?

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

@ -1,6 +1,6 @@
This is sqlite 3.6.14.2
This is sqlite 3.6.16
-- Shawn Wilsher <me@shawnwilsher.com>, 5/2009
-- Shawn Wilsher <me@shawnwilsher.com>, 8/2009
See http://www.sqlite.org/ for more info.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -30,7 +30,7 @@
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite.h.in,v 1.447 2009/04/30 15:59:56 drh Exp $
** @(#) $Id: sqlite.h.in,v 1.458 2009/06/19 22:50:31 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@ -99,8 +99,8 @@ extern "C" {
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION "3.6.14.2"
#define SQLITE_VERSION_NUMBER 3006014
#define SQLITE_VERSION "3.6.16"
#define SQLITE_VERSION_NUMBER 3006016
/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
@ -392,20 +392,20 @@ int sqlite3_exec(
** in the 4th parameter to the xOpen method of the
** [sqlite3_vfs] object.
*/
#define SQLITE_OPEN_READONLY 0x00000001
#define SQLITE_OPEN_READWRITE 0x00000002
#define SQLITE_OPEN_CREATE 0x00000004
#define SQLITE_OPEN_DELETEONCLOSE 0x00000008
#define SQLITE_OPEN_EXCLUSIVE 0x00000010
#define SQLITE_OPEN_MAIN_DB 0x00000100
#define SQLITE_OPEN_TEMP_DB 0x00000200
#define SQLITE_OPEN_TRANSIENT_DB 0x00000400
#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800
#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000
#define SQLITE_OPEN_SUBJOURNAL 0x00002000
#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000
#define SQLITE_OPEN_NOMUTEX 0x00008000
#define SQLITE_OPEN_FULLMUTEX 0x00010000
#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */
#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
/*
** CAPI3REF: Device Characteristics {H10240} <H11120>
@ -494,6 +494,12 @@ struct sqlite3_file {
** This object defines the methods used to perform various operations
** against the open file represented by the [sqlite3_file] object.
**
** If the xOpen method sets the sqlite3_file.pMethods element
** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
** may be invoked even if the xOpen reported that it failed. The
** only way to prevent a call to xClose following a failed xOpen
** is for the xOpen to set the sqlite3_file.pMethods element to NULL.
**
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
@ -654,11 +660,11 @@ typedef struct sqlite3_mutex sqlite3_mutex;
** is either a NULL pointer or string obtained
** from xFullPathname(). SQLite further guarantees that
** the string will be valid and unchanged until xClose() is
** called. Because of the previous sentense,
** called. Because of the previous sentence,
** the [sqlite3_file] can safely store a pointer to the
** filename if it needs to remember the filename for some reason.
** If the zFilename parameter is xOpen is a NULL pointer then xOpen
** must invite its own temporary name for the file. Whenever the
** must invent its own temporary name for the file. Whenever the
** xFilename parameter is NULL it will also be the case that the
** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
**
@ -702,14 +708,24 @@ typedef struct sqlite3_mutex sqlite3_mutex;
** deleted when it is closed. The [SQLITE_OPEN_DELETEONCLOSE]
** will be set for TEMP databases, journals and for subjournals.
**
** The [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened
** for exclusive access. This flag is set for all files except
** for the main database file.
** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
** with the [SQLITE_OPEN_CREATE] flag, which are both directly
** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
** SQLITE_OPEN_CREATE, is used to indicate that file should always
** be created, and that it is an error if it already exists.
** It is <i>not</i> used to indicate the file should be opened
** for exclusive access.
**
** At least szOsFile bytes of memory are allocated by SQLite
** to hold the [sqlite3_file] structure passed as the third
** argument to xOpen. The xOpen method does not have to
** allocate the structure; it should just fill it in.
** allocate the structure; it should just fill it in. Note that
** the xOpen method must set the sqlite3_file.pMethods to either
** a valid [sqlite3_io_methods] object or to NULL. xOpen must do
** this even if the open fails. SQLite expects that the sqlite3_file.pMethods
** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.
**
** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
@ -1031,12 +1047,14 @@ struct sqlite3_mem_methods {
**
** <dt>SQLITE_CONFIG_SCRATCH</dt>
** <dd>This option specifies a static memory buffer that SQLite can use for
** scratch memory. There are three arguments: A pointer to the memory, the
** size of each scratch buffer (sz), and the number of buffers (N). The sz
** scratch memory. There are three arguments: A pointer an 8-byte
** aligned memory buffer from which the scrach allocations will be
** drawn, the size of each scratch allocation (sz),
** and the maximum number of scratch allocations (N). The sz
** argument must be a multiple of 16. The sz parameter should be a few bytes
** larger than the actual scratch space required due internal overhead.
** The first
** argument should point to an allocation of at least sz*N bytes of memory.
** larger than the actual scratch space required due to internal overhead.
** The first argument should pointer to an 8-byte aligned buffer
** of at least sz*N bytes of memory.
** SQLite will use no more than one scratch buffer at once per thread, so
** N should be set to the expected maximum number of threads. The sz
** parameter should be 6 times the size of the largest database page size.
@ -1050,29 +1068,37 @@ struct sqlite3_mem_methods {
** the database page cache with the default page cache implemenation.
** This configuration should not be used if an application-define page
** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
** There are three arguments to this option: A pointer to the
** There are three arguments to this option: A pointer to 8-byte aligned
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument must be a power of two between 512 and 32768. The first
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 32768) plus a little extra for each
** page header. The page header size is 20 to 40 bytes depending on
** the host architecture. It is harmless, apart from the wasted memory,
** to make sz a little too large. The first
** argument should point to an allocation of at least sz*N bytes of memory.
** SQLite will use the memory provided by the first argument to satisfy its
** memory needs for the first N pages that it adds to cache. If additional
** page cache memory is needed beyond what is provided by this option, then
** SQLite goes to [sqlite3_malloc()] for the additional storage space.
** The implementation might use one or more of the N buffers to hold
** memory accounting information. </dd>
** memory accounting information. The pointer in the first argument must
** be aligned to an 8-byte boundary or subsequent behavior of SQLite
** will be undefined.</dd>
**
** <dt>SQLITE_CONFIG_HEAP</dt>
** <dd>This option specifies a static memory buffer that SQLite will use
** for all of its dynamic memory allocation needs beyond those provided
** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
** There are three arguments: A pointer to the memory, the number of
** bytes in the memory buffer, and the minimum allocation size. If
** the first pointer (the memory pointer) is NULL, then SQLite reverts
** There are three arguments: An 8-byte aligned pointer to the memory,
** the number of bytes in the memory buffer, and the minimum allocation size.
** If the first pointer (the memory pointer) is NULL, then SQLite reverts
** to using its default memory allocator (the system malloc() implementation),
** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. If the
** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
** allocator is engaged to handle all of SQLites memory allocation needs.</dd>
** allocator is engaged to handle all of SQLites memory allocation needs.
** The first pointer (the memory pointer) must be aligned to an 8-byte
** boundary or subsequent behavior of SQLite will be undefined.</dd>
**
** <dt>SQLITE_CONFIG_MUTEX</dt>
** <dd>This option takes a single argument which is a pointer to an
@ -1143,9 +1169,9 @@ struct sqlite3_mem_methods {
** <dd>This option takes three additional arguments that determine the
** [lookaside memory allocator] configuration for the [database connection].
** The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to a memory buffer to use for lookaside memory. The first
** argument may be NULL in which case SQLite will allocate the lookaside
** buffer itself using [sqlite3_malloc()]. The second argument is the
** pointer to an 8-byte aligned memory buffer to use for lookaside memory.
** The first argument may be NULL in which case SQLite will allocate the
** lookaside buffer itself using [sqlite3_malloc()]. The second argument is the
** size of each lookaside buffer slot and the third argument is the number of
** slots. The size of the buffer in the first argument must be greater than
** or equal to the product of the second and third arguments.</dd>
@ -1277,9 +1303,9 @@ int sqlite3_changes(sqlite3*);
** [CREATE TRIGGER | trigger] contexts. However,
** the count does not include changes used to implement [REPLACE] constraints,
** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
** count does not rows of views that fire an [INSTEAD OF trigger], though if
** the INSTEAD OF trigger makes changes of its own, those changes are
** counted.
** count does not include rows of views that fire an [INSTEAD OF trigger],
** though if the INSTEAD OF trigger makes changes of its own, those changes
** are counted.
** The changes are counted as soon as the statement that makes them is
** completed (when the statement handle is passed to [sqlite3_reset()] or
** [sqlite3_finalize()]).
@ -3069,8 +3095,11 @@ int sqlite3_reset(sqlite3_stmt *pStmt);
**
** The third parameter (nArg)
** is the number of arguments that the SQL function or
** aggregate takes. If this parameter is negative, then the SQL function or
** aggregate may take any number of arguments.
** aggregate takes. If this parameter is -1, then the SQL function or
** aggregate may take any number of arguments between 0 and the limit
** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
** parameter is less than -1 or greater than 127 then the behavior is
** undefined.
**
** The fourth parameter, eTextRep, specifies what
** [SQLITE_UTF8 | text encoding] this SQL function prefers for
@ -3121,7 +3150,7 @@ int sqlite3_reset(sqlite3_stmt *pStmt);
** statement in which the function is running.
**
** Requirements:
** [H16103] [H16106] [H16109] [H16112] [H16118] [H16121] [H16124] [H16127]
** [H16103] [H16106] [H16109] [H16112] [H16118] [H16121] [H16127]
** [H16130] [H16133] [H16136] [H16139] [H16142]
*/
int sqlite3_create_function(
@ -3736,11 +3765,11 @@ sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
** CAPI3REF: Commit And Rollback Notification Callbacks {H12950} <S60400>
**
** The sqlite3_commit_hook() interface registers a callback
** function to be invoked whenever a transaction is committed.
** function to be invoked whenever a transaction is [COMMIT | committed].
** Any callback set by a previous call to sqlite3_commit_hook()
** for the same database connection is overridden.
** The sqlite3_rollback_hook() interface registers a callback
** function to be invoked whenever a transaction is committed.
** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
** Any callback set by a previous call to sqlite3_commit_hook()
** for the same database connection is overridden.
** The pArg argument is passed through to the callback.
@ -3760,6 +3789,12 @@ sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
**
** Registering a NULL function disables the callback.
**
** When the commit hook callback routine returns zero, the [COMMIT]
** operation is allowed to continue normally. If the commit hook
** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
** The rollback hook is invoked on a rollback that results from a commit
** hook returning non-zero, just as it would be with any other rollback.
**
** For the purposes of this API, a transaction is said to have been
** rolled back if an explicit "ROLLBACK" statement is executed, or
** an error or constraint causes an implicit rollback to occur.
@ -3769,6 +3804,8 @@ sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
** rolled back because a commit callback returned non-zero.
** <todo> Check on this </todo>
**
** See also the [sqlite3_update_hook()] interface.
**
** Requirements:
** [H12951] [H12952] [H12953] [H12954] [H12955]
** [H12961] [H12962] [H12963] [H12964]
@ -3800,6 +3837,13 @@ void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
** The update hook is not invoked when internal system tables are
** modified (i.e. sqlite_master and sqlite_sequence).
**
** In the current implementation, the update hook
** is not invoked when duplication rows are deleted because of an
** [ON CONFLICT | ON CONFLICT REPLACE] clause. Nor is the update hook
** invoked when rows are deleted using the [truncate optimization].
** The exceptions defined in this paragraph might change in a future
** release of SQLite.
**
** The update hook implementation must not do anything that will modify
** the database connection that invoked the update hook. Any actions
** to modify the database connection must be deferred until after the
@ -3810,6 +3854,9 @@ void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
** If another function was previously registered, its pArg value
** is returned. Otherwise NULL is returned.
**
** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
** interfaces.
**
** Requirements:
** [H12971] [H12973] [H12975] [H12977] [H12979] [H12981] [H12983] [H12986]
*/
@ -4379,7 +4426,7 @@ typedef struct sqlite3_blob sqlite3_blob;
** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
** </pre> {END}
**
** If the flags parameter is non-zero, the the BLOB is opened for read
** If the flags parameter is non-zero, then the BLOB is opened for read
** and write access. If it is zero, the BLOB is opened for read access.
**
** Note that the database name is not the filename that contains
@ -4389,10 +4436,13 @@ typedef struct sqlite3_blob sqlite3_blob;
** For TEMP tables, the database name is "temp".
**
** On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
** to *ppBlob. Otherwise an [error code] is returned and any value written
** to *ppBlob should not be used by the caller.
** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
** to be a null pointer.
** This function sets the [database connection] error code and message
** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()].
** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
** functions. Note that the *ppBlob variable is always initialized in a
** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
** regardless of the success or failure of this routine.
**
** If the row that a BLOB handle points to is modified by an
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
@ -4405,6 +4455,19 @@ typedef struct sqlite3_blob sqlite3_blob;
** rollback by the expiration of the BLOB. Such changes will eventually
** commit if the transaction continues to completion.
**
** Use the [sqlite3_blob_bytes()] interface to determine the size of
** the opened blob. The size of a blob may not be changed by this
** underface. Use the [UPDATE] SQL command to change the size of a
** blob.
**
** The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
** and the built-in [zeroblob] SQL function can be used, if desired,
** to create an empty, zero-filled blob in which to read or write using
** this interface.
**
** To avoid a resource leak, every open [BLOB handle] should eventually
** be released by a call to [sqlite3_blob_close()].
**
** Requirements:
** [H17813] [H17814] [H17816] [H17819] [H17821] [H17824]
*/
@ -4427,16 +4490,19 @@ int sqlite3_blob_open(
** if there are no other BLOBs, no pending prepared statements, and the
** database connection is in [autocommit mode].
** If any writes were made to the BLOB, they might be held in cache
** until the close operation if they will fit. {END}
** until the close operation if they will fit.
**
** Closing the BLOB often forces the changes
** out to disk and so if any I/O errors occur, they will likely occur
** at the time when the BLOB is closed. {H17833} Any errors that occur during
** at the time when the BLOB is closed. Any errors that occur during
** closing are reported as a non-zero return value.
**
** The BLOB is closed unconditionally. Even if this routine returns
** an error code, the BLOB is still closed.
**
** Calling this routine with a null pointer (which as would be returned
** by failed call to [sqlite3_blob_open()]) is a harmless no-op.
**
** Requirements:
** [H17833] [H17836] [H17839]
*/
@ -4445,8 +4511,15 @@ int sqlite3_blob_close(sqlite3_blob *);
/*
** CAPI3REF: Return The Size Of An Open BLOB {H17840} <S30230>
**
** Returns the size in bytes of the BLOB accessible via the open
** []BLOB handle] in its only argument.
** Returns the size in bytes of the BLOB accessible via the
** successfully opened [BLOB handle] in its only argument. The
** incremental blob I/O routines can only read or overwriting existing
** blob content; they cannot change the size of a blob.
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
**
** Requirements:
** [H17843]
@ -4463,6 +4536,8 @@ int sqlite3_blob_bytes(sqlite3_blob *);
** If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is read. If N or iOffset is
** less than zero, [SQLITE_ERROR] is returned and no data is read.
** The size of the blob (and hence the maximum value of N+iOffset)
** can be determined using the [sqlite3_blob_bytes()] interface.
**
** An attempt to read from an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT].
@ -4470,6 +4545,13 @@ int sqlite3_blob_bytes(sqlite3_blob *);
** On success, SQLITE_OK is returned.
** Otherwise, an [error code] or an [extended error code] is returned.
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
**
** See also: [sqlite3_blob_write()].
**
** Requirements:
** [H17853] [H17856] [H17859] [H17862] [H17863] [H17865] [H17868]
*/
@ -4491,6 +4573,8 @@ int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
** If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is written. If N is
** less than zero [SQLITE_ERROR] is returned and no data is written.
** The size of the BLOB (and hence the maximum value of N+iOffset)
** can be determined using the [sqlite3_blob_bytes()] interface.
**
** An attempt to write to an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT]. Writes to the BLOB that occurred
@ -4502,6 +4586,13 @@ int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
** On success, SQLITE_OK is returned.
** Otherwise, an [error code] or an [extended error code] is returned.
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
**
** See also: [sqlite3_blob_read()].
**
** Requirements:
** [H17873] [H17874] [H17875] [H17876] [H17877] [H17879] [H17882] [H17885]
** [H17888]
@ -4852,6 +4943,8 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
#define SQLITE_TESTCTRL_PENDING_BYTE 11
#define SQLITE_TESTCTRL_ASSERT 12
#define SQLITE_TESTCTRL_ALWAYS 13
/*
** CAPI3REF: SQLite Runtime Status {H17200} <S60200>

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

@ -65,11 +65,7 @@
// Search for some text that's on the second page (but not on
// the first page), and verify that it can be found.
var findFocused = false;
gFindBar = document.getElementById("FindToolbar");
gFindBar._findField.inputField.onfocus = function () {
findFocused = true;
};
document.getElementById("cmd_find").doCommand();
ok(!gFindBar.hidden, "failed to open findbar");
gFindBar._findField.value = "A generic page";
@ -91,8 +87,6 @@
}, nextTest, 20);
yield;
ok(findFocused,
"find input field doesn't have the focus, find operation will fail!");
is(gFindBar._findField.inputField.value, "A generic page",
"expected text not present in find input field");
is(TestWindow.getWindow().getSelection().toString().toLowerCase(),

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

@ -798,3 +798,18 @@ nsDOMWindowUtils::GetIMEStatus(PRUint32 *aState)
return widget->GetIMEEnabled(aState);
}
NS_IMETHODIMP
nsDOMWindowUtils::GetScreenPixelsPerCSSPixel(float* aScreenPixels)
{
*aScreenPixels = 1;
if (!nsContentUtils::IsCallerTrustedForRead())
return NS_ERROR_DOM_SECURITY_ERR;
nsPresContext* presContext = GetPresContext();
if (!presContext)
return NS_OK;
*aScreenPixels = float(nsPresContext::AppUnitsPerCSSPixel())/
presContext->AppUnitsPerDevPixel();
return NS_OK;
}

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

@ -2445,8 +2445,13 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
// it. Also, if the next content node is the root content, then
// return it. This latter case would happen only if someone made a
// popup focusable.
else if (currentContent != aStartContent ||
currentContent == aRootContent) {
// Also, when going backwards, check to ensure that the focus
// wouldn't be redirected. Otherwise, for example, when an input in
// 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 &&
(aForward || !GetRedirectedFocus(currentContent)))) {
NS_ADDREF(*aResultContent = currentContent);
return NS_OK;
}

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

@ -3390,29 +3390,6 @@ nsGlobalWindow::GetMozInnerScreenY(float* aScreenY)
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetMozScreenPixelsPerCSSPixel(float* aScreenPixels)
{
FORWARD_TO_OUTER(GetMozScreenPixelsPerCSSPixel,
(aScreenPixels), NS_ERROR_NOT_INITIALIZED);
*aScreenPixels = 1;
if (!nsContentUtils::IsCallerTrustedForRead())
return NS_ERROR_DOM_SECURITY_ERR;
if (!mDocShell)
return NS_OK;
nsCOMPtr<nsPresContext> presContext;
mDocShell->GetPresContext(getter_AddRefs(presContext));
if (!presContext)
return NS_OK;
*aScreenPixels = float(nsPresContext::AppUnitsPerCSSPixel())/
presContext->AppUnitsPerDevPixel();
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::SetScreenX(PRInt32 aScreenX)
{

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

@ -3269,6 +3269,14 @@ static JSFunctionSpec VtuneFunctions[] = {
};
#endif
#ifdef MOZ_TRACEVIS
static JSFunctionSpec EthogramFunctions[] = {
{"initEthogram", js_InitEthogram, 0, 0, 0},
{"shutdownEthogram", js_ShutdownEthogram, 0, 0, 0},
{nsnull, nsnull, 0, 0, 0}
};
#endif
nsresult
nsJSContext::InitClasses(void *aGlobalObj)
{
@ -3316,6 +3324,11 @@ nsJSContext::InitClasses(void *aGlobalObj)
::JS_DefineFunctions(mContext, globalObj, VtuneFunctions);
#endif
#ifdef MOZ_TRACEVIS
// Attempt to initialize Ethogram functions
::JS_DefineFunctions(mContext, globalObj, EthogramFunctions);
#endif
JSOptionChangedCallback(js_options_dot_str, this);
return rv;

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

@ -44,7 +44,7 @@ interface nsIControllers;
interface nsIDOMLocation;
interface nsIVariant;
[scriptable, uuid(62579239-b619-4bf2-8d39-0b73e8663a85)]
[scriptable, uuid(c2f4433a-8b4c-4676-ab30-3bffd26fb29e)]
interface nsIDOMWindowInternal : nsIDOMWindow2
{
readonly attribute nsIDOMWindowInternal window;
@ -106,7 +106,6 @@ interface nsIDOMWindowInternal : nsIDOMWindow2
attribute long screenY;
readonly attribute float mozInnerScreenX;
readonly attribute float mozInnerScreenY;
readonly attribute float mozScreenPixelsPerCSSPixel;
/* The offset in pixels by which the window is scrolled */
readonly attribute long pageXOffset;

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

@ -48,7 +48,7 @@
interface nsIDOMElement;
interface nsIDOMHTMLCanvasElement;
[scriptable, uuid(a5e155c8-ef18-4e70-881b-d2fe8aa13fec)]
[scriptable, uuid(99d904c0-3b9e-44b7-b1e0-372766d18308)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -373,4 +373,9 @@ interface nsIDOMWindowUtils : nsISupports {
* Get IME status, see above IME_STATUS_* definitions.
*/
readonly attribute unsigned long IMEStatus;
/**
* Get the number of screen pixels per CSS pixel.
*/
readonly attribute float screenPixelsPerCSSPixel;
};

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

@ -77,7 +77,8 @@ test("stop()", function() {
});
test("stop() - several in queue", function() {
expect(4);
// Merge from jquery test 1.3.2
expect(3);
stop();
var $foo = $("#nothiddendiv");
@ -95,7 +96,8 @@ test("stop() - several in queue", function() {
nw = $foo.width();
ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px");
equals( $foo.queue().length, 2, "The next animation continued" );
// Merged from 1.3.2, commented out for being flaky in 1.3.2 test suite
//equals( $foo.queue().length, 2, "The next animation continued" );
$foo.stop(true);
start();
}, 100);
@ -129,7 +131,8 @@ test("stop(clearQueue)", function() {
});
test("stop(clearQueue, gotoEnd)", function() {
expect(3);
// Merge from 1.3.2 - this test marked as being flaky
expect(1);
stop();
var $foo = $("#nothiddendiv");
@ -146,10 +149,12 @@ test("stop(clearQueue, gotoEnd)", function() {
$foo.stop(false, true);
nw = $foo.width();
equals( nw, 200, "Stop() reset the animation" );
// Merge from 1.3.2 - marked as flaky in that release
//equals( nw, 200, "Stop() reset the animation" );
setTimeout(function(){
equals( $foo.queue().length, 3, "The next animation continued" );
// Merge from 1.3.2 - marked as flaky in that release
//equals( $foo.queue().length, 3, "The next animation continued" );
$foo.stop(true);
start();
}, 100);

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

@ -677,7 +677,7 @@ function startTest()
if (!gPartialTabbing)
doCommandDispatcherTests();
doRemoveTests()
doRemoveTests();
testMoveFocus();
@ -729,7 +729,31 @@ function startTest()
getById("inpopup1").focus();
is(fm.focusedElement, getById("t9"), "focus in closed popup");
gEvents = "";
// ---- tests to check if tabbing out of a textbox works
setFocusTo("t1", window);
var textbox1 = document.createElement("textbox");
$("innerbox").appendChild(textbox1);
textbox1.inputField.id = "innerinput1";
var textbox2 = document.createElement("textbox");
$("innerbox").appendChild(textbox2);
textbox2.inputField.id = "innerinput2";
expectFocusShift(function () textbox2.focus(),
null, "innerinput2", true, "focus on textbox");
expectFocusShift(function () synthesizeKey("VK_TAB", { shiftKey: true }),
null, "innerinput1", true, "shift+tab on textbox");
textbox1.tabIndex = 2;
textbox2.tabIndex = 2;
expectFocusShift(function () textbox2.focus(),
null, "innerinput2", true, "focus on textbox with tabindex set");
expectFocusShift(function () synthesizeKey("VK_TAB", { shiftKey: true }),
null, "innerinput1", true, "shift+tab on textbox with tabindex set");
setFocusTo("t9", window);
window.openDialog("focus_window2.xul", "_blank", "chrome", otherWindowFocused, null);
}
@ -1399,7 +1423,7 @@ SimpleTest.waitForExplicitFinish();
even numbered ids - focusable but not part of the tab order
-->
<vbox id="buttonbox">
<hbox>
<hbox id="innerbox">
<button id="t4" accesskey="h" label="no tabindex"/>
<button id="o1" accesskey="i" label="tabindex = -1" tabindex="-1"/>
<listbox id="t5" label="tabindex = 0" tabindex="0" rows="1">

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

@ -45,15 +45,16 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_innerScreen.xul \
test_offsets.html \
test_offsets.xul \
test_offsets.js \
497633.html \
test_497898.html \
test_bug504220.html \
test_domWindowUtils.html \
test_domWindowUtils_scrollXY.html \
test_497898.html \
497633.html \
test_bug504220.html \
test_innerScreen.xul \
test_offsets.html \
test_offsets.js \
test_offsets.xul \
test_windowProperties.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -37,11 +37,12 @@ function doTests()
ok(!readable, "window pixels per css pixel shouldn't be readable to content");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var devPxPerCSSPx = window.mozScreenPixelsPerCSSPixel;
var domWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
var windowBO = document.documentElement.boxObject;
// isRounded(window.mozInnerScreenX*devPxPerCSSPx, windowBO.screenX,
// "window screen X");
isRounded(window.mozInnerScreenX*devPxPerCSSPx, windowBO.screenX,
"window screen X");
isRounded(window.mozInnerScreenY*devPxPerCSSPx, windowBO.screenY,
"window screen Y");
@ -60,7 +61,9 @@ function doTests()
"frame screen Y");
fmudv.fullZoom *= 2;
is(f.contentWindow.mozScreenPixelsPerCSSPixel, 2*devPxPerCSSPx,
var frameDomWindowUtils = f.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
is(frameDomWindowUtils.screenPixelsPerCSSPixel, 2*devPxPerCSSPx,
"frame screen pixels per CSS pixel");
isRounded(f.contentWindow.mozInnerScreenX*2,

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

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test that all window properties are accessible to nonprivileged code</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
</head>
<body id="body">
<script type="application/javascript">
var lastProp;
try {
var propVals = [];
for (var prop in window) {
lastProp = prop;
propVals.push(window[prop]);
}
ok(true, "Read all " + propVals.length + " window properties");
} catch (ex) {
ok(false, "Exception occurred reading window." + lastProp);
}
</script>
<p id="display"></p>
</body>
</html>

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

@ -79,7 +79,6 @@ class DeleteTextTxn;
class SplitElementTxn;
class JoinElementTxn;
class EditAggregateTxn;
class nsILocale;
class IMETextTxn;
class AddStyleSheetTxn;
class RemoveStyleSheetTxn;

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

@ -683,7 +683,7 @@ nsPlaintextEditor::ExtendSelectionForDelete(nsISelection *aSelection,
break;
case eNext:
result = selCont->CharacterExtendForDelete();
*aAction = eNone;
// Don't set aAction to eNone (see Bug 502259)
break;
case ePrevious:
/* FIXME: extend selection over UTF-16 surrogates for Bug #332636

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