Merge mozilla-central into tracemonkey, specifically to pick up bug 467579.

This commit is contained in:
Benjamin Smedberg 2008-12-09 21:37:35 -05:00
commit e8ea9cf02d
449 changed files with 48338 additions and 35628 deletions

View File

@ -147,10 +147,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429659
testThis("linkedImageWithTitle", "Link to MoFo", "moz.png", 93, 42);
// Test simple image with empty alt attribute
testThis("nonLinkedImageEmptyAlt", "", "moz.png", 89, 38);
// testThis("nonLinkedImageEmptyAlt", "", "moz.png", 89, 38);
// Test linked image with empty alt attribute
testThis("linkedImageEmptyAlt", "", "moz.png", 93, 42);
// testThis("linkedImageEmptyAlt", "", "moz.png", 93, 42);
// Test simple image with empty alt attribute and title
testThis("nonLinkedImageEmptyAltAndTitle", "MozillaFoundation", "moz.png", 89, 38);

View File

@ -1,28 +0,0 @@
MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT
Version 3.0, May 2008
A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.
The accompanying executable code version of Mozilla Firefox and related documentation (the "Product") is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT"). BY CLICKING THE "ACCEPT" BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE "ACCEPT" BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.
DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS. THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.
1. LICENSE GRANT. The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product. This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.
2. TERMINATION. If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect. Upon termination, you must destroy all copies of the Product.
3. PROPRIETARY RIGHTS. Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, "Open Source Licenses") at http://www.mozilla.org/MPL. Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses. Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement. You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product. This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.
4. PRIVACY POLICY. You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/legal/privacy/, as that policy may be changed from time to time. When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link. It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.
5. WEBSITE INFORMATION SERVICES. Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information. However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.
6. DISCLAIMER OF WARRANTY. THE PRODUCT IS PROVIDED "AS IS" WITH ALL FAULTS. TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLA'S DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING. YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT. THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
7. LIMITATION OF LIABILITY. EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE "MOZILLA GROUP") WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED. THE MOZILLA GROUP'S COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY). SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
8. EXPORT CONTROLS. This license is subject to all applicable export restrictions. You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.
9. U.S. GOVERNMENT END-USERS. This Product is a "commercial item," as that term is defined in 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995). Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.
10. MISCELLANEOUS. (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla. (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods. (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect. (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English. (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition. (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.

View File

@ -156,6 +156,8 @@ MOZ_WINCONSOLE = 0
endif
endif
# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
NSDISTMODE = copy
include $(topsrcdir)/config/config.mk
@ -296,7 +298,7 @@ ICON_FILES = \
$(NULL)
libs:: $(ICON_FILES)
$(INSTALL) $^ $(DIST)/bin/icons
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/icons
install::
$(SYSINSTALL) $(IFLAGS1) $(ICON_FILES) $(DESTDIR)$(mozappdir)/icons
@ -304,9 +306,9 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
libs::
$(INSTALL) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
endif
export::
@ -346,10 +348,10 @@ libs::
touch $(DIST)/bin/.autoreg
libs:: $(srcdir)/profile/prefs.js
$(INSTALL) $^ $(DIST)/bin/defaults/profile
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
libs:: $(srcdir)/blocklist.xml
$(INSTALL) $^ $(DIST)/bin
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
@ -408,7 +410,7 @@ libs::
ifeq ($(OS_ARCH),WINNT)
$(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $(topsrcdir)/LICENSE > $(DIST)/bin/LICENSE
else
$(INSTALL) $(topsrcdir)/LICENSE $(DIST)/bin
$(INSTALL) $(IFLAGS1) $(topsrcdir)/LICENSE $(DIST)/bin
endif
ifdef LIBXUL_SDK

View File

@ -1,170 +0,0 @@
# -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Firefox Anti-Phishing Support.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jeff Walden <jwalden+code@mit.edu> (original author)
# Mike Connor <mconnor@mozilla.com> (modified for app-level EULA)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
var gEULADialog = {
/**
* The nsIWebProgress object associated with the privacy policy frame.
*/
_webProgress: null,
/**
* Initializes UI and starts the privacy policy loading.
*/
init: function ()
{
sizeToContent();
const Cc = Components.classes, Ci = Components.interfaces;
// add progress listener to enable OK, radios when page loads
var frame = document.getElementById("EULATextFrame");
var webProgress = frame.docShell
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
webProgress.addProgressListener(this._progressListener,
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
this._webProgress = webProgress; // for easy use later
var eulaURL = "chrome://browser/content/EULA.xhtml";
// start loading the privacyURL
const loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
frame.webNavigation.loadURI(eulaURL, loadFlags, null, null, null);
},
/**
* The nsIWebProgressListener used to watch the status of the load of the
* privacy policy; enables the OK button when the load completes.
*/
_progressListener:
{
/**
* True if we tried loading the first URL and encountered a failure.
*/
_loadFailed: false,
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus)
{
// enable the OK button when the request completes
const Ci = Components.interfaces, Cr = Components.results;
if ((aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)) {
// check for failure
if (!Components.isSuccessCode(aRequest.status)) {
if (!this._loadFailed) {
this._loadFailed = true;
// fire off a load of the fallback policy
const loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
const fallbackURL = "chrome://browser/content/preferences/fallbackEULA.xhtml";
var frame = document.getElementById("EULATextFrame");
frame.webNavigation.loadURI(fallbackURL, loadFlags, null, null, null);
// disable radios
document.getElementById("acceptOrDecline").disabled = true;
}
else {
throw "Fallback policy failed to load -- what the hay!?!";
}
}
}
},
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress,
aMaxSelfProgress, aCurTotalProgress,
aMaxTotalProgress)
{
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
},
QueryInterface : function(aIID)
{
const Ci = Components.interfaces;
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
}
},
/**
* Make sure we set the pref on acceptance so we don't show the EULA again
*/
accept: function ()
{
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var EULAVersion = prefService.getIntPref("browser.EULA.version");
prefService.setBoolPref("browser.EULA." + EULAVersion + ".accepted", true);
},
/**
* If the user did not accept the EULA, kill the app.
*/
cancel: function ()
{
const appStartup = Components.classes['@mozilla.org/toolkit/app-startup;1']
.getService(Components.interfaces.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit);
},
/**
* Clean up any XPCOM-JS cycles we may have created.
*/
uninit: function ()
{
// overly aggressive, but better safe than sorry
this._webProgress.removeProgressListener(this._progressListener);
this._progressListener = this._webProgress = null;
},
/**
* Called when the user changes the agree/disagree radio.
*/
onChangeRadio: function ()
{
var radio = document.getElementById("acceptOrDecline");
document.documentElement.getButton("accept").disabled = (radio.value == "false");
}
};

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" id="eula" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT</title>
</head>
<body>
<p>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT<br/>
Version 3.0, May 2008</p>
<p><b>A source code version of certain Firefox Browser functionality that you may use, modify and distribute is available to you free-of-charge from <a href="http://www.mozilla.org">www.mozilla.org</a> under the Mozilla Public License and other open source software licenses.</b></p>
<p>The accompanying executable code version of Mozilla Firefox and related documentation (the "Product") is made available to you under the terms of this <b>Mozilla Firefox End-User Software License Agreement (the "Agreement"). By clicking the "Accept" button, or by installing or using the Mozilla Firefox Browser, you are consenting to be bound by the Agreement. If you do not agree to the terms and conditions of this Agreement, do not click the "Accept" button, and do not install or use any part of the Mozilla Firefox Browser.</b></p>
<p><b>During the Mozilla Firefox installation process, and at later times, you may be given the option of installing additional components from third-party software providers. The installation and use of those third-party components may be governed by additional license agreements.</b></p>
<p>1. LICENSE GRANT. The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product. This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.</p>
<p>2. TERMINATION. If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect. Upon termination, you must destroy all copies of the Product.</p>
<p>3. PROPRIETARY RIGHTS. Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, "Open Source Licenses") at <a href="http://www.mozilla.org/MPL">http://www.mozilla.org/MPL</a>. Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses. Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement. You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product. This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.</p>
<p>4. PRIVACY POLICY. You agree to the Mozilla Firefox Privacy Policy, made available online at <a href="http://www.mozilla.com/legal/privacy/">http://www.mozilla.com/legal/privacy/</a>, as that policy may be changed from time to time. When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link. It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.</p>
<p>5. WEBSITE INFORMATION SERVICES. Mozilla and its contributors, licensors and partners work to provide the most accurate and up-to-date phishing and malware information. However, they cannot guarantee that this information is comprehensive and error-free: some risky sites may not be identified, and some safe sites may be identified in error.</p>
<p>6. DISCLAIMER OF WARRANTY. <b>The product is provided "as is" with all faults. To the extent permitted by law, Mozilla and Mozillas distributors, and licensors hereby disclaim all warranties, whether express or implied, including without limitation warranties that the product is free of defects, merchantable, fit for a particular purpose and non-infringing. You bear the entire risk as to selecting the product for your purposes and as to the quality and performance of the product. This limitation will apply notwithstanding the failure of essential purpose of any remedy. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.</b></p>
<p>7. LIMITATION OF LIABILITY. <b>Except as required by law, Mozilla and its distributors, directors, licensors, contributors and agents (collectively, the "Mozilla Group") will not be liable for any indirect, special, incidental, consequential or exemplary damages arising out of or in any way relating to this agreement or the use of or inability to use the product, including without limitation damages for loss of goodwill, work stoppage, lost profits, loss of data, and computer failure or malfunction, even if advised of the possibility of such damages and regardless of the theory (contract, tort or otherwise) upon which such claim is based. The Mozilla Group's collective liability under this agreement will not exceed the greater of $500 (five hundred dollars) and the fees paid by you under the license (if any). Some jurisdictions do not allow the exclusion or limitation of incidental, consequential or special damages, so this exclusion and limitation may not apply to you.</b></p>
<p>8. EXPORT CONTROLS. This license is subject to all applicable export restrictions. You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.</p>
<p>9. U.S. GOVERNMENT END-USERS. This Product is a "commercial item," as that term is defined in 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995). Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.</p>
<p>10. MISCELLANEOUS. (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla. (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods. (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect. (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English. (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition. (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.</p>
</body>
</html>

View File

@ -1,82 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Firefox Preferences System.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jeff Walden <jwalden+bmo@mit.edu> (original author)
# Mike Connor <mconnor@mozilla.com> (tweak to
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/"?>
<!DOCTYPE dialog [
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/update/updates.dtd">
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%updateDTD;
%brandDTD;
]>
<dialog id="eulaDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&license.titleText;"
onload="gEULADialog.init();"
ondialogaccept="gEULADialog.accept()"
ondialogcancel="gEULADialog.cancel()"
buttondisabledaccept="true">
<script type="application/javascript"
src="chrome://browser/content/EULA.js"/>
<description>&license.introText;</description>
<separator class="thin"/>
<description>&license.instructionText;</description>
<vbox id="EULAText" flex="1">
<iframe style="min-height: 18em; min-width: 95ex" id="EULATextFrame" type="content" flex="1" src=""/>
</vbox>
<separator class="thin"/>
<radiogroup id="acceptOrDecline"
oncommand="gEULADialog.onChangeRadio();">
<radio value="true" label="&license.accept;" accesskey="&license.accept.accesskey;"/>
<radio value="false" selected="true" label="&license.decline;" accesskey="&license.decline.accesskey;"/>
</radiogroup>
<separator class="thin"/>
</dialog>

View File

@ -287,7 +287,8 @@ var FullZoom = {
* one.
**/
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue) {
if (!this.siteSpecific || gInPrintPreviewMode)
if (!this.siteSpecific || gInPrintPreviewMode ||
content.document instanceof Ci.nsIImageDocument)
return;
try {
@ -302,7 +303,8 @@ var FullZoom = {
},
_applySettingToPref: function FullZoom__applySettingToPref() {
if (!this.siteSpecific || gInPrintPreviewMode)
if (!this.siteSpecific || gInPrintPreviewMode ||
content.document instanceof Ci.nsIImageDocument)
return;
var zoomLevel = ZoomManager.zoom;
@ -310,7 +312,8 @@ var FullZoom = {
},
_removePref: function FullZoom__removePref() {
this._cps.removePref(gBrowser.currentURI, this.name);
if (!(content.document instanceof Ci.nsIImageDocument))
this._cps.removePref(gBrowser.currentURI, this.name);
},

View File

@ -1345,6 +1345,11 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
DownloadMonitorPanel.init();
}, 10000);
// Delayed initialization of PlacesDBUtils.
// This component checks for database coherence once per day, on
// an idle timer, taking corrective actions where needed.
setTimeout(function() PlacesUtils.startPlacesDBUtils(), 15000);
#ifndef XP_MACOSX
updateEditUIVisibility();
let placesContext = document.getElementById("placesContext");
@ -6204,8 +6209,13 @@ HistoryMenu.populateUndoSubmenu = function PHM_populateUndoSubmenu() {
for (var i = 0; i < undoItems.length; i++) {
var m = document.createElement("menuitem");
m.setAttribute("label", undoItems[i].title);
if (undoItems[i].image)
m.setAttribute("image", undoItems[i].image);
if (undoItems[i].image) {
let iconURL = undoItems[i].image;
// don't initiate a connection just to fetch a favicon (see bug 467828)
if (/^https?:/.test(iconURL))
iconURL = "moz-anno:favicon:" + iconURL;
m.setAttribute("image", iconURL);
}
m.setAttribute("class", "menuitem-iconic bookmark-item");
m.setAttribute("value", i);
m.setAttribute("oncommand", "undoCloseTab(" + i + ");");
@ -6911,16 +6921,10 @@ let gPrivateBrowsingUI = {
if (!this._privateBrowsingAutoStarted) {
// Adjust the window's title
let docElement = document.documentElement;
#ifdef XP_MACOSX // see bug 411929 comment 38 for the reason behind this
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
docElement.setAttribute("titledefault", "");
#else
docElement.setAttribute("title",
docElement.getAttribute("title_privatebrowsing"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
#endif
docElement.setAttribute("browsingmode", "private");
}
else {
@ -6945,16 +6949,10 @@ let gPrivateBrowsingUI = {
if (!this._privateBrowsingAutoStarted) {
// Adjust the window's title
let docElement = document.documentElement;
#ifdef XP_MACOSX // see bug 411929 comment 38 for the reason behind this
docElement.setAttribute("titlemodifier", "");
docElement.setAttribute("titledefault",
docElement.getAttribute("titlemodifier_normal"));
#else
docElement.setAttribute("title",
docElement.getAttribute("title_normal"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_normal"));
#endif
docElement.setAttribute("browsingmode", "normal");
}
else

View File

@ -30,6 +30,7 @@
# Dean Tessman <dean_tessman@hotmail.com>
# Johnathan Nightingale <johnath@mozilla.com>
# Dão Gottwald <dao@mozilla.com>
# Ehsan Akhgari <ehsan.akhgari@gmail.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
@ -67,10 +68,18 @@
onload="BrowserStartup()" onunload="BrowserShutdown()" onclose="return WindowIsClosing();"
title="&mainWindow.title;"
title_normal="&mainWindow.title;"
title_privatebrowsing="&mainWindowPrivateBrowsing.titlemodifier;"
#ifdef XP_MACOSX
title_privatebrowsing="&mainWindow.title;&mainWindow.titlemodifiermenuseparator;&mainWindow.titlePrivateBrowsingSuffix;"
titledefault="&mainWindow.title;"
titlemodifier=""
titlemodifier_normal=""
titlemodifier_privatebrowsing="&mainWindow.titlePrivateBrowsingSuffix;"
#else
title_privatebrowsing="&mainWindow.titlemodifierPrivateBrowsing;"
titlemodifier="&mainWindow.titlemodifier;"
titlemodifier_normal="&mainWindow.titlemodifier;"
titlemodifier_privatebrowsing="&mainWindowPrivateBrowsing.titlemodifier;"
titlemodifier_privatebrowsing="&mainWindow.titlemodifierPrivateBrowsing;"
#endif
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
windowtype="navigator:browser"
screenX="4" screenY="4"

View File

@ -105,7 +105,7 @@
icon="add"/>
<button label="&restoreDefaultSet.label;"
oncommand="restoreDefaultSet();"
icon="refresh"/>
icon="revert"/>
</box>
<separator class="groove"/>

View File

@ -80,6 +80,8 @@ _BROWSER_FILES = browser_bug321000.js \
plugin_both2.html \
browser_alltabslistener.js \
alltabslistener.html \
zoom_test.html \
browser_bug416661.js \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

View File

@ -0,0 +1,46 @@
var tabElm, zoomLevel;
function start_test_prefNotSet() {
tabElm.linkedBrowser.removeEventListener("load", start_test_prefNotSet, true);
tabElm.linkedBrowser.addEventListener("load", continue_test_prefNotSet, true);
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
FullZoom.enlarge();
//capture the zoom level to test later
zoomLevel = ZoomManager.zoom;
isnot(zoomLevel, 1, "zoom level should have changed");
content.location =
"http://localhost:8888/browser/browser/base/content/test/moz.png";
}
function continue_test_prefNotSet () {
tabElm.linkedBrowser.removeEventListener("load", continue_test_prefNotSet, true);
tabElm.linkedBrowser.addEventListener("load", end_test_prefNotSet, true);
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
FullZoom.reset();
content.location =
"http://localhost:8888/browser/browser/base/content/test/zoom_test.html";
}
function end_test_prefNotSet() {
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
gBrowser.removeCurrentTab();
finish();
}
function test() {
waitForExplicitFinish();
tabElm = gBrowser.addTab();
gBrowser.selectedTab = tabElm;
tabElm.linkedBrowser.addEventListener("load", start_test_prefNotSet, true);
content.location =
"http://localhost:8888/browser/browser/base/content/test/zoom_test.html";
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=416661
-->
<head>
<title>Test for zoom setting</title>
</head>
<body>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=416661">Bug 416661</a>
<p>Site specific zoom settings should not apply to image documents.</p>
</body>
</html>

View File

@ -24,9 +24,6 @@ browser.jar:
* content/browser/browser.xul (content/browser.xul)
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
* content/browser/credits.xhtml (content/credits.xhtml)
* content/browser/EULA.js (content/EULA.js)
* content/browser/EULA.xhtml (content/EULA.xhtml)
* content/browser/EULA.xul (content/EULA.xul)
* content/browser/metaData.js (content/metaData.js)
* content/browser/metaData.xul (content/metaData.xul)
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)

View File

@ -119,6 +119,7 @@
replaceWithHost(intro);
if (getCSSClass() == "expertBadCert") {
toggle('technicalContent');
toggle('expertContent');
}
@ -206,7 +207,7 @@
// If we set a link, meaning there's something helpful for
// the user here, expand the section by default
if (link.href)
if (link.href && getCSSClass() != "expertBadCert")
toggle("technicalContent");
}
@ -249,13 +250,13 @@
</div>
</div>
<!-- The following sections can be unhidden by default by setting the
"browser.xul.error_pages.expert_bad_cert" pref to true -->
<div id="technicalContent" collapsed="true">
<h2 onclick="toggle('technicalContent');" id="technicalContentHeading">&certerror.technical.heading;</h2>
<p id="technicalContentText"/>
</div>
<!-- This section can be unhidden by default by setting the
"browser.xul.error_pages.expert_bad_cert" pref to true -->
<div id="expertContent" collapsed="true">
<h2 onclick="toggle('expertContent');" id="expertContentHeading">&certerror.expert.heading;</h2>
<div>

View File

@ -35,7 +35,9 @@ function testBrokenCert() {
function testExpertPref() {
var expertDiv = gBrowser.contentWindow.document.getElementById("expertContent");
var technicalDiv = gBrowser.contentWindow.document.getElementById("technicalContent");
ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
// Clean up
gBrowser.removeCurrentTab();

View File

@ -515,15 +515,26 @@ BrowserGlue.prototype = {
if (importBookmarks && !restoreDefaultBookmarks && !importBookmarksHTML) {
// get latest JSON backup
Cu.import("resource://gre/modules/utils.js");
var bookmarksFile = PlacesUtils.getMostRecentBackup();
if (bookmarksFile && bookmarksFile.leafName.match("\.json$")) {
var bookmarksBackupFile = PlacesUtils.getMostRecentBackup();
if (bookmarksBackupFile && bookmarksBackupFile.leafName.match("\.json$")) {
// restore from JSON backup
PlacesUtils.restoreBookmarksFromJSONFile(bookmarksFile);
PlacesUtils.restoreBookmarksFromJSONFile(bookmarksBackupFile);
importBookmarks = false;
}
else {
// No backup was available we will try to import from bookmarks.html
// We have created a new database but we don't have any backup available
importBookmarks = true;
var dirService = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
var bookmarksHTMLFile = dirService.get("BMarks", Ci.nsILocalFile);
if (bookmarksHTMLFile.exists()) {
// If bookmarks.html is available in current profile import it...
importBookmarksHTML = true;
}
else {
// ...otherwise we will restore defaults
restoreDefaultBookmarks = true;
}
}
}

View File

@ -63,7 +63,7 @@
<hbox align="center">
<label value="&search.label;" accesskey="&search.accesskey;" control="search-box"/>
<textbox id="search-box" flex="1" type="search"
<textbox id="search-box" flex="1" type="search" cocoa-size="small"
oncommand="searchBookmarks(this.value);"/>
</hbox>

View File

@ -990,8 +990,9 @@ PlacesController.prototype = {
if (URIs.length > REMOVE_PAGES_MAX_SINGLEREMOVES) {
// do removal in chunks to avoid passing a too big array to removePages
for (var i = 0; i < URIs.length; i += REMOVE_PAGES_CHUNKLEN) {
var URIslice = URIs.slice(i, Math.max(i + REMOVE_PAGES_CHUNKLEN, URIs.length));
// set DoBatchNotify only on the last chunk
var URIslice = URIs.slice(i, i + REMOVE_PAGES_CHUNKLEN);
// set DoBatchNotify (third param) only on the last chunk, so we update
// the treeView when we are done.
bhist.removePages(URIslice, URIslice.length,
(i + REMOVE_PAGES_CHUNKLEN) >= URIs.length);
}

View File

@ -86,7 +86,7 @@
<hbox align="center">
<label value="&find.label;" accesskey="&find.accesskey;"
control="search-box"/>
<textbox id="search-box" flex="1" type="search"
<textbox id="search-box" flex="1" type="search" cocoa-size="small"
oncommand="searchHistory(this.value);"/>
<button id="viewButton" style="min-width:0px !important;" type="menu"
label="&view.label;" accesskey="&view.accesskey;" selectedsort="day"

View File

@ -645,6 +645,10 @@ var PlacesOrganizer = {
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) {
var infoBox = document.getElementById("infoBox");
var detailsDeck = document.getElementById("detailsDeck");
// Make sure the infoBox UI is visible if we need to use it, we hide it
// below when we don't.
infoBox.hidden = false;
var aSelectedNode = aNodeList.length == 1 ? aNodeList[0] : null;
// If a textbox within a panel is focused, force-blur it so its contents
// are saved
@ -695,6 +699,7 @@ var PlacesOrganizer = {
itemsCountLabel.value =
PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
[aNodeList.length]);
infoBox.hidden = true;
return;
}
itemIds[i] = aNodeList[i].itemId != -1 ? aNodeList[i].itemId :
@ -712,6 +717,7 @@ var PlacesOrganizer = {
}
else {
detailsDeck.selectedIndex = 0;
infoBox.hidden = true;
var selectItemDesc = document.getElementById("selectItemDescription");
var itemsCountLabel = document.getElementById("itemsCountText");
var rowCount = this._content.treeBoxObject.view.rowCount;

View File

@ -115,6 +115,11 @@ placesTransactionsService.prototype = {
var uri = PlacesUtils.bookmarks.getBookmarkURI(id);
return this.untagURI(uri, [parent]);
}
// if the item is a livemark container we will not save its children and
// will use createLivemark to undo.
if (PlacesUtils.livemarks.isLivemark(id))
return new placesRemoveLivemarkTransaction(id);
return new placesRemoveItemTransaction(id);
},
@ -423,6 +428,7 @@ placesCreateSeparatorTransactions.prototype = {
function placesCreateLivemarkTransactions(aFeedURI, aSiteURI, aName,
aContainer, aIndex,
aAnnotations) {
this.redoTransaction = this.doTransaction;
this._feedURI = aFeedURI;
this._siteURI = aSiteURI;
this._name = aName;
@ -451,6 +457,48 @@ placesCreateLivemarkTransactions.prototype = {
}
};
function placesRemoveLivemarkTransaction(aFolderId) {
this.redoTransaction = this.doTransaction;
this._id = aFolderId;
this._title = PlacesUtils.bookmarks.getItemTitle(this._id);
this._container = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
var annos = PlacesUtils.getAnnotationsForItem(this._id);
// Exclude livemark service annotations, those will be recreated automatically
var annosToExclude = ["livemark/feedURI",
"livemark/siteURI",
"livemark/expiration",
"livemark/loadfailed",
"livemark/loading"];
this._annotations = annos.filter(function(aValue, aIndex, aArray) {
return annosToExclude.indexOf(aValue.name) == -1;
});
this._feedURI = PlacesUtils.livemarks.getFeedURI(this._id);
this._siteURI = PlacesUtils.livemarks.getSiteURI(this._id);
this._dateAdded = PlacesUtils.bookmarks.getItemDateAdded(this._id);
this._lastModified = PlacesUtils.bookmarks.getItemLastModified(this._id);
}
placesRemoveLivemarkTransaction.prototype = {
__proto__: placesBaseTransaction.prototype,
doTransaction: function PRLT_doTransaction() {
this._index = PlacesUtils.bookmarks.getItemIndex(this._id);
PlacesUtils.bookmarks.removeItem(this._id);
},
undoTransaction: function PRLT_undoTransaction() {
this._id = PlacesUtils.livemarks.createLivemark(this._container,
this._title,
this._siteURI,
this._feedURI,
this._index);
PlacesUtils.bookmarks.setItemDateAdded(this._id, this._dateAdded);
PlacesUtils.bookmarks.setItemLastModified(this._id, this._lastModified);
// Restore annotations
PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
}
};
function placesMoveItemTransactions(aItemId, aNewContainer, aNewIndex) {
this._id = aItemId;
this._oldContainer = PlacesUtils.bookmarks.getFolderIdForItem(this._id);

View File

@ -74,6 +74,14 @@ try {
do_throw("Could not get tagging service\n");
}
// Get annotations service
try {
var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].
getService(Ci.nsIAnnotationService);
} catch(ex) {
do_throw("Could not get annotations service\n");
}
// create and add bookmarks observer
var observer = {
onBeginUpdateBatch: function() {
@ -130,20 +138,18 @@ function run_test() {
const DESCRIPTION_ANNO = "bookmarkProperties/description";
var testDescription = "this is my test description";
var annotationService = Cc["@mozilla.org/browser/annotation-service;1"].
getService(Ci.nsIAnnotationService);
//Test creating a folder with a description
var annos = [{ name: DESCRIPTION_ANNO,
type: Ci.nsIAnnotationService.TYPE_STRING,
type: annosvc.TYPE_STRING,
flags: 0,
value: testDescription,
expires: Ci.nsIAnnotationService.EXPIRE_NEVER }];
expires: annosvc.EXPIRE_NEVER }];
var txn1 = ptSvc.createFolder("Testing folder", root, bmStartIndex, annos);
txn1.doTransaction();
var folderId = bmsvc.getChildFolder(root, "Testing folder");
do_check_eq(testDescription,
annotationService.getItemAnnotation(folderId, DESCRIPTION_ANNO));
annosvc.getItemAnnotation(folderId, DESCRIPTION_ANNO));
do_check_eq(observer._itemAddedIndex, bmStartIndex);
do_check_eq(observer._itemAddedParent, root);
do_check_eq(observer._itemAddedId, folderId);
@ -408,34 +414,83 @@ function run_test() {
do_check_eq(observer._itemChangedProperty, "keyword");
do_check_eq(observer._itemChangedValue, "");
var txn12 = ptSvc.createLivemark(uri("http://feeduri.com"), uri("http://siteuri.com"), "Livemark1", root);
// Testing create livemark
var txn12 = ptSvc.createLivemark(uri("http://feeduri.com"),
uri("http://siteuri.com"),
"Livemark1", root);
txn12.doTransaction();
do_check_true(lmsvc.isLivemark(observer._itemAddedId));
do_check_eq(lmsvc.getSiteURI(observer._itemAddedId).spec, "http://siteuri.com/");
do_check_eq(lmsvc.getFeedURI(observer._itemAddedId).spec, "http://feeduri.com/");
var lvmkId = observer._itemAddedId;
do_check_true(lmsvc.isLivemark(lvmkId));
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://siteuri.com/");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://feeduri.com/");
txn12.undoTransaction();
do_check_false(lmsvc.isLivemark(lvmkId));
txn12.redoTransaction();
lvmkId = observer._itemAddedId;
do_check_true(lmsvc.isLivemark(lvmkId));
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://siteuri.com/");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://feeduri.com/");
// editLivemarkSiteURI
var txn13 = ptSvc.editLivemarkSiteURI(lvmkId, uri("http://NEWsiteuri.com/"));
var txn13 = ptSvc.editLivemarkSiteURI(lvmkId, uri("http://new-siteuri.com/"));
txn13.doTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/siteURI");
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://new-siteuri.com/");
txn13.undoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/siteURI");
do_check_eq(observer._itemChangedValue, "");
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://siteuri.com/");
txn13.redoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/siteURI");
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://new-siteuri.com/");
txn13.undoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/siteURI");
do_check_eq(observer._itemChangedValue, "");
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://siteuri.com/");
// editLivemarkFeedURI
var txn14 = ptSvc.editLivemarkFeedURI(lvmkId, uri("http://NEWfeeduri.com/"));
var txn14 = ptSvc.editLivemarkFeedURI(lvmkId, uri("http://new-feeduri.com/"));
txn14.doTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/feedURI");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://new-feeduri.com/");
txn14.undoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/feedURI");
do_check_eq(observer._itemChangedValue, "");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://feeduri.com/");
txn14.redoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/feedURI");
do_check_eq(observer._itemChangedValue, "");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://new-feeduri.com/");
txn14.undoTransaction();
do_check_eq(observer._itemChangedId, lvmkId);
do_check_eq(observer._itemChangedProperty, "livemark/feedURI");
do_check_eq(observer._itemChangedValue, "");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://feeduri.com/");
// Testing remove livemark
// Set an annotation and check that we don't lose it on undo
annosvc.setItemAnnotation(lvmkId, "livemark/testAnno", "testAnno",
0, annosvc.EXPIRE_NEVER);
var txn15 = ptSvc.removeItem(lvmkId);
txn15.doTransaction();
do_check_false(lmsvc.isLivemark(lvmkId));
do_check_eq(observer._itemRemovedId, lvmkId);
txn15.undoTransaction();
lvmkId = observer._itemAddedId;
do_check_true(lmsvc.isLivemark(lvmkId));
do_check_eq(lmsvc.getSiteURI(lvmkId).spec, "http://siteuri.com/");
do_check_eq(lmsvc.getFeedURI(lvmkId).spec, "http://feeduri.com/");
do_check_eq(annosvc.getItemAnnotation(lvmkId, "livemark/testAnno"), "testAnno");
txn15.redoTransaction();
do_check_false(lmsvc.isLivemark(lvmkId));
do_check_eq(observer._itemRemovedId, lvmkId);
// Test setLoadInSidebar
var txn16 = ptSvc.setLoadInSidebar(bkmk1Id, true);
@ -505,10 +560,10 @@ function run_test() {
var postDataId = (bmsvc.getBookmarkIdsForURI(postDataURI,{}))[0];
var postDataTxn = ptSvc.editBookmarkPostData(postDataId, postData);
postDataTxn.doTransaction();
do_check_true(annotationService.itemHasAnnotation(postDataId, POST_DATA_ANNO))
do_check_eq(annotationService.getItemAnnotation(postDataId, POST_DATA_ANNO), postData);
do_check_true(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
do_check_eq(annosvc.getItemAnnotation(postDataId, POST_DATA_ANNO), postData);
postDataTxn.undoTransaction();
do_check_false(annotationService.itemHasAnnotation(postDataId, POST_DATA_ANNO))
do_check_false(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
// Test editing item date added
var oldAdded = bmsvc.getItemDateAdded(bkmk1Id);

View File

@ -49,7 +49,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
#ifdef XP_MACOSX
<title></title>
#else
<title>&privatebrowsingpage.tabtitle;</title>
#endif
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all"/>
<link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
<link rel="icon" type="image/png" href="chrome://browser/skin/Privacy-16.png"/>

View File

@ -45,16 +45,12 @@ 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 \
$(NULL)
ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
_BROWSER_TEST_FILES += browser_privatebrowsing_ui.js \
$(NULL)
endif
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)

View File

@ -56,12 +56,10 @@ function test() {
getService(Ci.nsIObserverService);
os.addObserver(observer, "private-browsing", false);
let pbMenuItem = document.getElementById("privateBrowsingItem");
// add a new blank tab to ensure the title
// add a new blank tab to ensure the title can be meaningfully compared later
let blankTab = gBrowser.addTab();
gBrowser.selectedTab = blankTab;
let originalTitle = document.title;
let privateBrowsingTitle = document.documentElement.getAttribute("titlemodifier_privatebrowsing");
waitForExplicitFinish();
// test the gPrivateBrowsingUI object
ok(gPrivateBrowsingUI, "The gPrivateBrowsingUI object exists");
@ -76,99 +74,23 @@ function test() {
is(observer.data, "exit", "Private Browsing mode was deactivated using the gPrivateBrowsingUI object");
ok(!pbMenuItem.hasAttribute("checked"), "The Private Browsing menu item was correctly unchecked");
// test the menu item
window.focus();
let timer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
timer.initWithCallback({
notify: function(timer) {
// get the access keys
let toolsKey = document.getElementById("tools-menu").getAttribute("accesskey");
let pbKey = pbMenuItem.getAttribute("accesskey");
// now, test using the <command> object
let cmd = document.getElementById("Tools:PrivateBrowsing");
isnot(cmd, null, "XUL command object for the private browsing service exists");
var func = new Function("", cmd.getAttribute("oncommand"));
func.call(cmd);
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the command object");
// check to see that the window title has been changed correctly
isnot(document.title, originalTitle, "Private browsing mode has correctly changed the title");
func.call(cmd);
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the command object");
// check to see that the window title has been restored correctly
is(document.title, originalTitle, "Private browsing mode has correctly restored the title");
// get the access key modifier
function accessKeyModifier () {
switch (gPrefService.getIntPref("ui.key.generalAccessKey")) {
case -1:
let chromeAccessKey = gPrefService.getIntPref("ui.key.chromeAccess");
if (chromeAccessKey == 0)
ok(false, "ui.key.chromeAccess was set to 0, so access keys for chrome are disabled");
else
return {
shiftKey: (chromeAccessKey & 1) != 0,
accelKey: (chromeAccessKey & 2) != 0,
altKey: (chromeAccessKey & 4) != 0,
metaKey: (chromeAccessKey & 8) != 0
};
break;
case Ci.nsIDOMKeyEvent.DOM_VK_SHIFT:
return { shiftKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_CONTROL:
return { accelKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_ALT:
return { altKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_META:
return { metaKey: true };
default:
ok(false, "Invalid value for the ui.key.generalAccessKey pref: " +
gPrefService.getIntPref("ui.key.generalAccessKey"));
}
}
let popup = document.getElementById("menu_ToolsPopup");
// activate the Private Browsing menu item
popup.addEventListener("popupshown", function () {
this.removeEventListener("popupshown", arguments.callee, false);
this.addEventListener("popuphidden", function () {
this.removeEventListener("popuphidden", arguments.callee, false);
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the menu");
// check to see that the window title has been changed correctly
is(document.title, privateBrowsingTitle, "Private browsing mode has correctly changed the title");
// toggle the Private Browsing menu item
this.addEventListener("popupshown", function () {
this.removeEventListener("popupshown", arguments.callee, false);
this.addEventListener("popuphidden", function () {
this.removeEventListener("popuphidden", arguments.callee, false);
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the menu");
// check to see that the window title has been restored correctly
is(document.title, originalTitle, "Private browsing mode has correctly restored the title");
// now, test using the <command> object
let cmd = document.getElementById("Tools:PrivateBrowsing");
isnot(cmd, null, "XUL command object for the private browsing service exists");
var func = new Function("", cmd.getAttribute("oncommand"));
func.call(cmd);
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the command object");
// check to see that the window title has been changed correctly
is(document.title, privateBrowsingTitle, "Private browsing mode has correctly changed the title");
func.call(cmd);
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the command object");
// check to see that the window title has been restored correctly
is(document.title, originalTitle, "Private browsing mode has correctly restored the title");
// cleanup
gBrowser.removeTab(blankTab);
os.removeObserver(observer, "private-browsing");
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
finish();
}, false);
EventUtils.synthesizeKey(pbKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(toolsKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(pbKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(toolsKey, accessKeyModifier());
}
}, 2000, Ci.nsITimer.TYPE_ONE_SHOT);
// cleanup
gBrowser.removeTab(blankTab);
os.removeObserver(observer, "private-browsing");
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
}

View File

@ -49,8 +49,10 @@ window.onload = function() {
if (!sessionData.value) {
var ss = Cc["@mozilla.org/browser/sessionstartup;1"].getService(Ci.nsISessionStartup);
sessionData.value = ss.state;
if (!sessionData.value)
if (!sessionData.value) {
document.getElementById("errorTryAgain").disabled = true;
return;
}
}
// make sure the data is tracked to be restored in case of a subsequent crash
var event = document.createEvent("UIEvents");
@ -79,10 +81,14 @@ function initTreeView() {
};
winState.tabs = aWinData.tabs.map(function(aTabData) {
var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
var iconURL = aTabData.attributes && aTabData.attributes.image || null;
// don't initiate a connection just to fetch a favicon (see bug 462863)
if (/^https?:/.test(iconURL))
iconURL = "moz-anno:favicon:" + iconURL;
return {
label: entry.title || entry.url,
checked: true,
src: aTabData.attributes.image || null,
src: iconURL,
parent: winState
};
});
@ -98,6 +104,8 @@ function initTreeView() {
// User actions
function restoreSession() {
document.getElementById("errorTryAgain").disabled = true;
// remove all unselected tabs from the state before restoring it
var ix = gStateObject.windows.length - 1;
for (var t = gTreeData.length - 1; t >= 0; t--) {

View File

@ -1772,8 +1772,12 @@ SessionStoreService.prototype = {
tabData.entries = [];
}
if (tabData.extData) {
tab.__SS_extdata = tabData.extData;
tab.__SS_extdata = {};
for (let key in tabData.extData)
tab.__SS_extdata[key] = tabData.extData[key];
}
else
delete tab.__SS_extdata;
for (var i = 0; i < tabData.entries.length; i++) {
history.addEntry(this._deserializeHistoryEntry(tabData.entries[i], aIdMap), true);

View File

@ -65,6 +65,7 @@ _BROWSER_TEST_FILES = \
browser_456342_sample.xhtml \
browser_463206.js \
browser_463206_sample.html \
browser_465215.js \
$(NULL)
libs:: $(_BROWSER_TEST_FILES)

View File

@ -0,0 +1,72 @@
/* ***** 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 sessionstore test code.
*
* The Initial Developer of the Original Code is
* Simon Bünzli <zeniko@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
/** Test for Bug 465215 **/
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
let uniqueName = "bug 465215";
let uniqueValue1 = "as good as unique: " + Date.now();
let uniqueValue2 = "as good as unique: " + Math.random();
// set a unique value on a new, blank tab
let tab1 = gBrowser.addTab();
tab1.linkedBrowser.addEventListener("load", function() {
tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
ss.setTabValue(tab1, uniqueName, uniqueValue1);
// duplicate the tab with that value
let tab2 = ss.duplicateTab(window, tab1);
is(ss.getTabValue(tab2, uniqueName), uniqueValue1, "tab value was duplicated");
ss.setTabValue(tab2, uniqueName, uniqueValue2);
isnot(ss.getTabValue(tab1, uniqueName), uniqueValue2, "tab values aren't sync'd");
// overwrite the tab with the value which should remove it
ss.setTabState(tab1, JSON.stringify({ entries: [] }));
tab1.linkedBrowser.addEventListener("load", function() {
tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
is(ss.getTabValue(tab1, uniqueName), "", "tab value was cleared");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab1);
finish();
}, true);
}, true);
}

View File

@ -307,7 +307,13 @@ endif
$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
cd $(DIST)/l10n-stage; \
$(MAKE_PACKAGE)
# packaging done, undo l10n stuff
ifdef MOZ_MAKE_COMPLETE_MAR
$(MAKE) -C $(DEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \
MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \
PACKAGE_BASE_DIR="$(_ABS_DIST)/l10n-stage" \
DIST="$(_ABS_DIST)"
endif
# packaging done, undo l10n stuff
ifneq (en,$(AB))
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/en.lproj
@ -334,10 +340,6 @@ langpack-%: libs-%
# This is a generic target that will make a langpack, repack ZIP (+tarball)
# builds, and repack an installer if applicable. It is called from the
# tinderbox scripts. Alter it with caution.
#
# Note: the last target called here should be repackage-zip-$* as the l10n build
# systems rely on dist/l10n-stage/<product> to be in place in order to package
# the complete MAR files.
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
@echo "repackaging done"

View File

@ -1,5 +1,5 @@
<!ENTITY restorepage.tabtitle "Restore Session">
<!ENTITY restorepage.pagetitle "Would You Like to Restore Your Session?">
<!ENTITY restorepage.pagetitle "Would you like to restore your session?">
<!-- LOCALIZATION NOTE: If "closed unexpectedly" sounds too awkward in the translation,
you may translate "crash" instead (even though it's IT-speak) -->
<!ENTITY restorepage.issueDesc "Your previous &brandShortName; session closed unexpectedly. We sincerely apologize for the inconvenience. You can restore the tabs and windows from your previous session, or start a new session if they are no longer needed.">

View File

@ -7,9 +7,11 @@
<!ENTITY mainWindow.titlemodifier "&brandFullName;">
<!-- LOCALIZATION NOTE (mainWindow.titlemodifiermenuseparator): DONT_TRANSLATE -->
<!ENTITY mainWindow.titlemodifiermenuseparator " - ">
<!-- LOCALIZATION NOTE (mainWindowPrivateBrowsing.titlemodifier): This will be appended to the window's title
inside the private browsing mode -->
<!ENTITY mainWindowPrivateBrowsing.titlemodifier "&mainWindow.titlemodifier; (Private Browsing)">
<!-- LOCALIZATION NOTE (mainWindow.titlePrivateBrowsingSuffix): This will be appended to the window's title
inside the private browsing mode -->
<!ENTITY mainWindow.titlePrivateBrowsingSuffix "(Private Browsing)">
<!-- LOCALIZATION NOTE (mainWindowPrivateBrowsing.titlemodifier): DONT_TRANSLATE -->
<!ENTITY mainWindow.titlemodifierPrivateBrowsing "&mainWindow.titlemodifier; &mainWindow.titlePrivateBrowsingSuffix;">
<!ENTITY tabCmd.label "New Tab">
<!ENTITY tabCmd.accesskey "T">

View File

@ -46,12 +46,15 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
#main-window[chromehidden~="toolbar"][chromehidden~="location"][chromehidden~="directories"] {
border-top: 1px solid rgba(0,0,0,0.65);
#main-window {
-moz-appearance: none;
background-color: #eeeeee;
}
#main-window[chromehidden~="toolbar"][chromehidden~="location"][chromehidden~="directories"] {
border-top: 1px solid rgba(0,0,0,0.65);
}
/* ----- INACTIVE WINDOW ----- */
#main-window:not([active="true"]) > #navigator-toolbox > #nav-bar {

View File

@ -67,8 +67,7 @@
}
#placesToolbar {
margin-top: -3px;
padding: 0 4px;
padding: 0 4px 3px;
}
#placesView {

View File

@ -138,63 +138,10 @@ moz_run_program()
moz_bail "Cannot execute $prog."
fi
##
## Use md5sum to crc a core file. If md5sum is not found on the system,
## then don't debug core files.
##
moz_test_binary /bin/type
if [ $? -eq 1 ]
then
crc_prog=`LC_MESSAGES=C type md5sum 2>/dev/null | awk '{print $3;}' 2>/dev/null | sed -e 's/\.$//'`
else
crc_prog=`which md5sum 2>/dev/null`
fi
if [ -x "$crc_prog" ]
then
DEBUG_CORE_FILES=1
fi
if [ "$DEBUG_CORE_FILES" ]
then
crc_old=
if [ -f core ]
then
crc_old=`$crc_prog core | awk '{print $1;}' `
fi
fi
##
## Run the program
##
"$prog" ${1+"$@"}
exitcode=$?
if [ "$DEBUG_CORE_FILES" ]
then
if [ -f core ]
then
crc_new=`$crc_prog core | awk '{print $1;}' `
fi
fi
if [ "$crc_old" != "$crc_new" ]
then
printf "\n\nOh no! %s just dumped a core file.\n\n" $prog
printf "Do you want to debug this ? "
printf "You need a lot of memory for this, so watch out ? [y/n] "
read ans
if [ "$ans" = "y" ]
then
debugger=`moz_get_debugger`
if [ -x "$debugger" ]
then
echo "$debugger $prog core"
# See http://www.mozilla.org/unix/debugging-faq.html
# For why LD_BIND_NOW is needed
LD_BIND_NOW=1; export LD_BIND_NOW
$debugger "$prog" core
else
echo "Could not find a debugger on your system."
fi
fi
fi
}
##########################################################################
moz_debug_program()

View File

@ -418,7 +418,7 @@ nsChromeProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_re
NS_IMETHODIMP
nsChromeProtocolHandler::GetProtocolFlags(PRUint32 *result)
{
*result = URI_STD | URI_IS_UI_RESOURCE;
*result = URI_STD | URI_IS_UI_RESOURCE | URI_IS_LOCAL_RESOURCE;
return NS_OK;
}
@ -465,7 +465,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
NS_ENSURE_ARG_POINTER(aURI);
NS_PRECONDITION(aResult, "Null out param");
#ifdef DEBUG
// Check that the uri we got is already canonified
nsresult debug_rv;
@ -554,38 +554,6 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
rv = ioServ->NewChannelFromURI(resolvedURI, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
// XXX Will be removed someday when we handle remote chrome.
nsCOMPtr<nsIFileChannel> fileChan
(do_QueryInterface(result));
if (fileChan) {
#ifdef DEBUG
nsCOMPtr<nsIFile> file;
fileChan->GetFile(getter_AddRefs(file));
PRBool exists = PR_FALSE;
file->Exists(&exists);
if (!exists) {
nsCAutoString path;
file->GetNativePath(path);
printf("Chrome file doesn't exist: %s\n", path.get());
}
#endif
}
else {
nsCOMPtr<nsIJARChannel> jarChan
(do_QueryInterface(result));
if (!jarChan) {
nsRefPtr<nsCachedChromeChannel> cachedChannel;
if (NS_FAILED(CallQueryInterface(result.get(),
static_cast<nsCachedChromeChannel**>(
getter_AddRefs(cachedChannel))))) {
NS_WARNING("Remote chrome not allowed! Only file:, resource:, jar:, and cached chrome channels are valid.\n");
result = nsnull;
return NS_ERROR_FAILURE;
}
}
}
// Make sure that the channel remembers where it was
// originally loaded from.
rv = result->SetOriginalURI(aURI);
@ -627,24 +595,15 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
if (objectOutput) {
nsCOMPtr<nsIFile> file;
if (fileChan) {
fileChan->GetFile(getter_AddRefs(file));
} else {
nsCOMPtr<nsIURI> uri;
result->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIURI> uri;
result->GetURI(getter_AddRefs(uri));
uri = NS_GetInnermostURI(uri);
// Loop, jar URIs can nest (e.g. jar:jar:A.jar!B.jar!C.xml).
// Often, however, we have jar:resource:/chrome/A.jar!C.xml.
nsCOMPtr<nsIJARURI> jarURI;
while ((jarURI = do_QueryInterface(uri)) != nsnull)
jarURI->GetJARFile(getter_AddRefs(uri));
// Here we have a URL of the form resource:/chrome/A.jar
// or file:/some/path/to/A.jar.
nsCOMPtr<nsIFileURL> fileURL(do_QueryInterface(uri));
if (fileURL)
fileURL->GetFile(getter_AddRefs(file));
}
// Here we have a URL of the form resource:/chrome/A.jar
// or file:/some/path/to/A.jar.
nsCOMPtr<nsIFileURL> fileURL(do_QueryInterface(uri));
if (fileURL)
fileURL->GetFile(getter_AddRefs(file));
if (file) {
rv = fastLoadServ->AddDependency(file);

View File

@ -252,6 +252,16 @@ LanguagesMatch(const nsACString& a, const nsACString& b)
return PR_FALSE;
}
static PRBool
CanLoadResource(nsIURI* aResourceURI)
{
PRBool isLocalResource = PR_FALSE;
(void)NS_URIChainHasFlags(aResourceURI,
nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
&isLocalResource);
return isLocalResource;
}
nsChromeRegistry::ProviderEntry*
nsChromeRegistry::nsProviderArray::GetProvider(const nsACString& aPreferred, MatchType aType)
{
@ -2334,6 +2344,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(resolved)) {
LogMessageWithContext(resolved, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as content.",
uri);
continue;
}
PackageEntry* entry =
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
@ -2409,6 +2426,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(resolved)) {
LogMessageWithContext(resolved, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as a locale.",
uri);
continue;
}
PackageEntry* entry =
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
@ -2464,6 +2488,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(resolved)) {
LogMessageWithContext(resolved, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as a skin.",
uri);
continue;
}
PackageEntry* entry =
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
@ -2525,6 +2556,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
continue;
}
if (!CanLoadResource(overlayuri)) {
LogMessageWithContext(overlayuri, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as an overlay.",
overlay);
continue;
}
mOverlayHash.Add(baseuri, overlayuri);
}
else if (!strcmp(token, "style")) {
@ -2572,6 +2610,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(overlayuri)) {
LogMessageWithContext(overlayuri, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as a style overlay.",
overlay);
continue;
}
mStyleHash.Add(baseuri, overlayuri);
}
else if (!strcmp(token, "override")) {
@ -2625,6 +2670,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(resolveduri)) {
LogMessageWithContext(resolveduri, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as an override.",
resolved);
continue;
}
mOverrideTable.Put(chromeuri, resolveduri);
}
else if (!strcmp(token, "resource")) {
@ -2690,6 +2742,13 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
if (NS_FAILED(rv))
continue;
if (!CanLoadResource(resolved)) {
LogMessageWithContext(resolved, line, nsIScriptError::warningFlag,
"Warning: cannot register non-local URI '%s' as a resource.",
uri);
continue;
}
rv = rph->SetSubstitution(host, resolved);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -4,9 +4,6 @@ resource test1 test1/
# Duplicates should be ignored
resource test1 foo/
# Mapping off file system should work
resource test2 http://www.mozilla.org/
# Mapping into jar files should work
resource test3 jar:test3.jar!/resources/

View File

@ -0,0 +1,5 @@
# package used only for valid override
content good-package bar/
# Local resource (should work)
override chrome://good-package/content/test.xul data:application/vnd.mozilla.xul+xml,

View File

@ -0,0 +1,32 @@
# package used only for valid overlaying and overrides
content good-package bar/
# UI Resource URIs (should not work)
content moz-protocol-ui-resource moz-protocol-ui-resource://foo/
locale moz-protocol-ui-resource en-us moz-protocol-ui-resource://foo/
skin moz-protocol-ui-resource skin1 moz-protocol-ui-resource://foo/
override chrome://good-package/content/override-moz-protocol-ui-resource.xul moz-protocol-ui-resource://foo/
resource moz-protocol-ui-resource moz-protocol-ui-resource://foo/
# Local file URIs (should not work)
content moz-protocol-local-file moz-protocol-local-file://foo/
locale moz-protocol-local-file en-us moz-protocol-local-file://foo/
skin moz-protocol-local-file skin1 moz-protocol-local-file://foo/
override chrome://good-package/content/override-moz-protocol-local-file.xul moz-protocol-local-file://foo/
resource moz-protocol-local-file moz-protocol-local-file://foo/
# Loadable by anyone URIs (should not work)
content moz-protocol-loadable-by-anyone moz-protocol-loadable-by-anyone://foo/
locale moz-protocol-loadable-by-anyone en-us moz-protocol-loadable-by-anyone://foo/
skin moz-protocol-loadable-by-anyone skin1 moz-protocol-loadable-by-anyone://foo/
override chrome://good-package/content/override-moz-protocol-loadable-by-anyone.xul moz-protocol-loadable-by-anyone://foo/
resource moz-protocol-loadable-by-anyone moz-protocol-loadable-by-anyone://foo/
# Working protocols should be after this point. Failing ones should be before.
# Local resource (should work)
content moz-protocol-local-resource moz-protocol-local-resource://foo/
locale moz-protocol-local-resource en-us moz-protocol-local-resource://foo/
skin moz-protocol-local-resource skin1 moz-protocol-local-resource://foo/
override chrome://good-package/content/override-moz-protocol-local-resource.xul moz-protocol-local-resource://foo/
resource moz-protocol-local-resource moz-protocol-local-resource://foo/

View File

@ -89,12 +89,12 @@ function test_succeeded_mapping(namespace, target)
{
try {
do_check_true(rph.hasSubstitution(namespace));
var thistarget = target + "/test.js";
var uri = gIOS.newURI("resource://" + namespace + "/test.js",
null, null);
do_check_eq(rph.resolveURI(uri), thistarget);
var uri = gIOS.newURI("resource://" + namespace, null, null);
dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
do_check_eq(rph.resolveURI(uri), target);
}
catch (ex) {
dump(ex + "\n");
do_throw(namespace);
}
}
@ -107,9 +107,8 @@ function test_failed_mapping(namespace)
function run_test()
{
var data = gIOS.newFileURI(do_get_file("chrome/test/unit/data")).spec;
test_succeeded_mapping("test1", data + "test1");
test_succeeded_mapping("test2", "http://www.mozilla.org");
test_succeeded_mapping("test3", "jar:" + data + "test3.jar!/resources");
test_succeeded_mapping("test1", data + "test1/");
test_succeeded_mapping("test3", "jar:" + data + "test3.jar!/resources/");
test_failed_mapping("test4");
test_succeeded_mapping("test5", data + "test5");
test_succeeded_mapping("test5", data + "test5/");
}

View File

@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 sts=2 tw=78 expandtab :
* ***** 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 Chrome Registration Test Code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
let manifests = [
do_get_file("chrome/test/unit/data/test_data_protocol_registration.manifest"),
];
registerManifests(manifests);
let XULAppInfoFactory = {
// These two are used when we register all our factories (and unregister)
CID: XULAPPINFO_CID,
scheme: "XULAppInfo",
contractID: XULAPPINFO_CONTRACTID,
createInstance: function (outer, iid) {
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return XULAppInfo.QueryInterface(iid);
}
};
function run_test()
{
// Add our XULAppInfo factory
let factories = [XULAppInfoFactory];
// Register our factories
for (let i = 0; i < factories.length; i++) {
let factory = factories[i];
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(factory.CID, "test-" + factory.scheme,
factory.contractID, factory);
}
// Check for new chrome
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
cr.checkForNewChrome();
// Check that our override worked
let expectedURI = "data:application/vnd.mozilla.xul+xml,";
let sourceURI = "chrome://good-package/content/test.xul";
try {
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
sourceURI = ios.newURI(sourceURI, null, null);
// this throws for packages that are not registered
let uri = cr.convertChromeURL(sourceURI).spec;
do_check_eq(expectedURI, uri);
}
catch (e) {
dump(e + "\n");
do_throw("Should have registered our URI!");
}
// Unregister our factories so we do not leak
for (let i = 0; i < factories.length; i++) {
let factory = factories[i];
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.unregisterFactory(factory.CID, factory);
}
}

View File

@ -0,0 +1,244 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 sts=2 tw=78 expandtab :
* ***** 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 Chrome Registration Test Code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
let manifests = [
do_get_file("chrome/test/unit/data/test_no_remote_registration.manifest"),
];
registerManifests(manifests);
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let XULAppInfo = {
vendor: "Mozilla",
name: "XPCShell",
ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
version: "5",
appBuildID: "2007010101",
platformVersion: "1.9",
platformBuildID: "2007010101",
inSafeMode: false,
logConsoleErrors: true,
OS: "XPCShell",
XPCOMABI: "noarch-spidermonkey",
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIXULAppInfo,
Ci.nsIXULRuntime,
])
};
let XULAppInfoFactory = {
// These two are used when we register all our factories (and unregister)
CID: XULAPPINFO_CID,
scheme: "XULAppInfo",
contractID: XULAPPINFO_CONTRACTID,
createInstance: function (outer, iid) {
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return XULAppInfo.QueryInterface(iid);
}
};
function ProtocolHandler(aScheme, aFlags)
{
this.scheme = aScheme;
this.protocolFlags = aFlags;
this.contractID = "@mozilla.org/network/protocol;1?name=" + aScheme;
}
ProtocolHandler.prototype =
{
defaultPort: -1,
allowPort: function() false,
newURI: function(aSpec, aCharset, aBaseURI)
{
let uri = Cc["@mozilla.org/network/standard-url;1"].
createInstance(Ci.nsIURI);
uri.spec = aSpec;
if (!uri.scheme) {
// We got a partial uri, so let's resolve it with the base one
uri.spec = aBaseURI.resolve(aSpec);
}
return uri;
},
newChannel: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIProtocolHandler
])
};
let testProtocols = [
// It doesn't matter if it has this flag - the only flag we accept is
// URI_IS_LOCAL_RESOURCE.
{scheme: "moz-protocol-ui-resource",
flags: Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE,
CID: Components.ID("{d6dedc93-558f-44fe-90f4-3b4bba8a0b14}"),
shouldRegister: false
},
// It doesn't matter if it has this flag - the only flag we accept is
// URI_IS_LOCAL_RESOURCE.
{scheme: "moz-protocol-local-file",
flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_FILE,
CID: Components.ID("{ee30d594-0a2d-4f47-89cc-d4cde320ab69}"),
shouldRegister: false
},
// This clearly is non-local
{scheme: "moz-protocol-loadable-by-anyone",
flags: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
CID: Components.ID("{c3735f23-3b0c-4a33-bfa0-79436dcd40b2}"),
shouldRegister: false
},
// This should always be last (unless we add more flags that are OK)
{scheme: "moz-protocol-local-resource",
flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE,
CID: Components.ID("{b79e977c-f840-469a-b413-0125cc1b62a5}"),
shouldRegister: true
},
];
function run_test()
{
// Create factories
let factories = [];
for (let i = 0; i < testProtocols.length; i++) {
factories[i] = {
scheme: testProtocols[i].scheme,
flags: testProtocols[i].flags,
CID: testProtocols[i].CID,
contractID: "@mozilla.org/network/protocol;1?name=" + testProtocols[i].scheme,
createInstance: function(aOuter, aIID)
{
if (aOuter != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
let handler = new ProtocolHandler(this.scheme, this.flags, this.CID);
return handler.QueryInterface(aIID);
}
};
}
// Add our XULAppInfo factory
factories.push(XULAppInfoFactory);
// Register our factories
for (let i = 0; i < factories.length; i++) {
let factory = factories[i];
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(factory.CID, "test-" + factory.scheme,
factory.contractID, factory);
}
// Check for new chrome
let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry);
cr.checkForNewChrome();
// See if our various things were able to register
let registrationTypes = [
"content",
"locale",
"skin",
"override",
"resource",
];
for (let i = 0; i < testProtocols.length; i++) {
let protocol = testProtocols[i];
for (let j = 0; j < registrationTypes.length; j++) {
let type = registrationTypes[j];
dump("Testing protocol '" + protocol.scheme + "' with type '" + type +
"'\n");
let expectedURI = protocol.scheme + "://foo/";
let sourceURI = "chrome://" + protocol.scheme + "/" + type + "/";
switch (type) {
case "content":
expectedURI += protocol.scheme + ".xul";
break;
case "locale":
expectedURI += protocol.scheme + ".dtd";
break;
case "skin":
expectedURI += protocol.scheme + ".css";
break;
case "override":
sourceURI = "chrome://good-package/content/override-" +
protocol.scheme + ".xul";
break;
case "resource":
sourceURI = "resource://" + protocol.scheme + "/";
break;
};
try {
let ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
sourceURI = ios.newURI(sourceURI, null, null);
let uri;
if (type == "resource") {
// resources go about a slightly different way than everything else
let rph = ios.getProtocolHandler("resource").
QueryInterface(Ci.nsIResProtocolHandler);
// this throws for packages that are not registered
uri = rph.resolveURI(sourceURI);
}
else {
// this throws for packages that are not registered
uri = cr.convertChromeURL(sourceURI).spec;
}
if (protocol.shouldRegister) {
do_check_eq(expectedURI, uri);
}
else {
// Overrides will not throw, so we'll get to here. We want to make
// sure that the two strings are not the same in this situation.
do_check_neq(expectedURI, uri);
}
}
catch (e) {
if (protocol.shouldRegister) {
dump(e + "\n");
do_throw("Should have registered our URI for protocol " +
protocol.scheme);
}
}
}
}
// Unregister our factories so we do not leak
for (let i = 0; i < factories.length; i++) {
let factory = factories[i];
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.unregisterFactory(factory.CID, factory);
}
}

View File

@ -55,10 +55,12 @@ include $(topsrcdir)/config/rules.mk
# libdir, and includedir, so that the 'make install' will put things
# mostly in the right places. The install-runtime-libs target takes
# care of getting the needed libraries into the 'bin' directory as
# well as the 'lib' directory.
# well as the 'lib' directory. Setting JS_MOZ_INSTALL= ensures that
# we get symlinks (the proper in-tree build behavior), not copies (the
# default GNU behavior).
export::
$(MAKE) -C $(JS_OBJDIR) install
$(MAKE) -C $(JS_OBJDIR) install-runtime-libs libdir=$(DIST)/bin
$(MAKE) -C $(JS_OBJDIR) JS_MOZ_INSTALL=t install
$(MAKE) -C $(JS_OBJDIR) JS_MOZ_INSTALL=t install-runtime-libs libdir=$(DIST)/bin
$(INSTALL) $(IFLAGS2) $(JS_CONFIG) $(SDK_BIN_DIR)
check::

View File

@ -4653,7 +4653,6 @@ MOZ_ARG_HEADER(Toolkit Options)
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
-o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
-o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
-o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
then
dnl nglayout only supports building with one toolkit,
@ -4740,14 +4739,10 @@ cairo-os2)
TK_LIBS='$(MOZ_CAIRO_LIBS)'
;;
cairo-mac|cairo-cocoa)
if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
MOZ_WIDGET_TOOLKIT=cocoa
AC_DEFINE(MOZ_WIDGET_COCOA)
MOZ_ENABLE_COCOA=1
else
MOZ_WIDGET_TOOLKIT=mac
fi
cairo-cocoa)
MOZ_WIDGET_TOOLKIT=cocoa
AC_DEFINE(MOZ_WIDGET_COCOA)
MOZ_ENABLE_COCOA=1
MOZ_GFX_TOOLKIT=cairo
MOZ_USER_DIR="Mozilla"
AC_DEFINE(XP_MACOSX)

View File

@ -523,7 +523,7 @@ public:
* @return boolean indicating whether a BOM was detected.
*/
static PRBool CheckForBOM(const unsigned char* aBuffer, PRUint32 aLength,
nsACString& aCharset);
nsACString& aCharset, PRBool *bigEndian = nsnull);
/**

View File

@ -3171,7 +3171,7 @@ nsContentUtils::ConvertStringFromCharset(const nsACString& aCharset,
/* static */
PRBool
nsContentUtils::CheckForBOM(const unsigned char* aBuffer, PRUint32 aLength,
nsACString& aCharset)
nsACString& aCharset, PRBool *bigEndian)
{
PRBool found = PR_TRUE;
aCharset.Truncate();
@ -3186,22 +3186,30 @@ nsContentUtils::CheckForBOM(const unsigned char* aBuffer, PRUint32 aLength,
aBuffer[1] == 0x00 &&
aBuffer[2] == 0xFE &&
aBuffer[3] == 0xFF) {
aCharset = "UTF-32BE";
aCharset = "UTF-32";
if (bigEndian)
*bigEndian = PR_TRUE;
}
else if (aLength >= 4 &&
aBuffer[0] == 0xFF &&
aBuffer[1] == 0xFE &&
aBuffer[2] == 0x00 &&
aBuffer[3] == 0x00) {
aCharset = "UTF-32LE";
aCharset = "UTF-32";
if (bigEndian)
*bigEndian = PR_FALSE;
}
else if (aLength >= 2 &&
aBuffer[0] == 0xFE && aBuffer[1] == 0xFF) {
aCharset = "UTF-16BE";
aCharset = "UTF-16";
if (bigEndian)
*bigEndian = PR_TRUE;
}
else if (aLength >= 2 &&
aBuffer[0] == 0xFF && aBuffer[1] == 0xFE) {
aCharset = "UTF-16LE";
aCharset = "UTF-16";
if (bigEndian)
*bigEndian = PR_FALSE;
} else {
found = PR_FALSE;
}

View File

@ -766,14 +766,14 @@ DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsCString& oChars
if (0xFF == aBytes[1]) {
// FE FF
// UTF-16, big-endian
oCharset.Assign("UTF-16BE");
oCharset.Assign("UTF-16");
}
break;
case 0xFF:
if (0xFE == aBytes[1]) {
// FF FE
// UTF-16, little-endian
oCharset.Assign("UTF-16LE");
oCharset.Assign("UTF-16");
}
break;
}

View File

@ -1468,7 +1468,7 @@ nsCanvasRenderingContext2D::ShadowInitialize(const gfxRect& extents, gfxAlphaBox
blurRadius.height, blurRadius.width);
drawExtents = drawExtents.Intersect(clipExtents - CurrentState().shadowOffset);
gfxContext* ctx = blur.Init(drawExtents, blurRadius);
gfxContext* ctx = blur.Init(drawExtents, blurRadius, nsnull);
if (!ctx)
return nsnull;

View File

@ -400,20 +400,25 @@ nsDOMEvent::StopPropagation()
return NS_OK;
}
static nsIDocument* GetDocumentForReport(nsEvent* aEvent)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);
if (node)
return node->GetOwnerDoc();
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aEvent->currentTarget);
if (!window)
return nsnull;
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
return doc;
}
static void
ReportUseOfDeprecatedMethod(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
const char* aWarning)
{
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);
if (node) {
doc = node->GetOwnerDoc();
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aEvent->currentTarget);
if (window) {
doc = do_QueryInterface(window->GetExtantDocument());
}
}
nsCOMPtr<nsIDocument> doc(GetDocumentForReport(aEvent));
nsAutoString type;
aDOMEvent->GetType(type);
@ -1535,6 +1540,25 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return nsnull;
}
nsresult
nsDOMEvent::ReportWrongPropertyAccessWarning(const char* aPropertyName)
{
nsCOMPtr<nsIDocument> doc(GetDocumentForReport(mEvent));
nsAutoString propertyName, type;
GetType(type);
propertyName.AssignASCII(aPropertyName);
const PRUnichar *strings[] = { propertyName.get(), type.get() };
return nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
"WrongEventPropertyAccessWarning",
strings, NS_ARRAY_LENGTH(strings),
doc ? doc->GetDocumentURI() : nsnull,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"DOM Events");
}
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsEvent *aEvent)

View File

@ -205,6 +205,7 @@ protected:
nsresult SetEventType(const nsAString& aEventTypeArg);
static const char* GetEventName(PRUint32 aEventType);
already_AddRefed<nsIDOMEventTarget> GetTargetFromFrame();
nsresult ReportWrongPropertyAccessWarning(const char* aPropertyName);
nsEvent* mEvent;
nsCOMPtr<nsPresContext> mPresContext;

View File

@ -40,7 +40,6 @@
#include "nsDOMKeyboardEvent.h"
#include "nsContentUtils.h"
nsDOMKeyboardEvent::nsDOMKeyboardEvent(nsPresContext* aPresContext,
nsKeyEvent* aEvent)
: nsDOMUIEvent(aPresContext, aEvent ? aEvent :
@ -113,13 +112,14 @@ nsDOMKeyboardEvent::GetCharCode(PRUint32* aCharCode)
switch (mEvent->message) {
case NS_KEY_UP:
case NS_KEY_DOWN:
NS_WARNING("GetCharCode used for wrong key event; should use onkeypress.");
ReportWrongPropertyAccessWarning("charCode");
*aCharCode = 0;
break;
case NS_KEY_PRESS:
*aCharCode = ((nsKeyEvent*)mEvent)->charCode;
break;
default:
ReportWrongPropertyAccessWarning("charCode");
break;
}
return NS_OK;
@ -137,6 +137,7 @@ nsDOMKeyboardEvent::GetKeyCode(PRUint32* aKeyCode)
*aKeyCode = ((nsKeyEvent*)mEvent)->keyCode;
break;
default:
ReportWrongPropertyAccessWarning("keyCode");
*aKeyCode = 0;
break;
}
@ -162,10 +163,11 @@ nsDOMKeyboardEvent::GetWhich(PRUint32* aWhich)
*aWhich = keyCode;
return NS_OK;
}
return GetCharCode(aWhich);
return GetCharCode(aWhich);
}
break;
default:
ReportWrongPropertyAccessWarning("which");
*aWhich = 0;
break;
}

View File

@ -22,10 +22,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=457672
var windowBlurCount = 0;
function setUserPref(reset) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const prefSvcContractID = "@mozilla.org/preferences-service;1";
const prefSvcIID = Components.interfaces.nsIPrefService;
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("browser.link.");
if (reset) {
try {
prefs.clearUserPref("open_newwindow");
} catch (ex) {}
} else {
prefs.setIntPref("open_newwindow", 3);
}
}
function listener(evt) {
if (evt.type == "focus") {
is(windowBlurCount, 1,
"Window should have got blur event when opening a new tab!")
"Window should have got blur event when opening a new tab!");
setUserPref(true);
document.getElementsByTagName("a")[0].focus();
SimpleTest.finish();
} else if (evt.type == "blur") {
++windowBlurCount;
@ -34,7 +51,8 @@ function listener(evt) {
}
function startTest() {
window.focus();
setUserPref(false);
document.getElementsByTagName("a")[0].focus();
// Note, focus/blur don't bubble
window.addEventListener("focus", listener, false);
window.addEventListener("blur", listener, false);

View File

@ -143,13 +143,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
return NS_OK;
}
/* readonly attribute unsigned long totalBytes; */
NS_IMETHODIMP nsHTMLMediaElement::GetTotalBytes(PRUint32 *aTotalBytes)
{
*aTotalBytes = mDecoder ? PRUint32(mDecoder->GetTotalBytes()) : 0;
return NS_OK;
}
/* void load (); */
NS_IMETHODIMP nsHTMLMediaElement::Load()
{

View File

@ -123,7 +123,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLObjectElement,
nsGenericHTMLElement)
nsGenericHTMLFormElement)
private:
/**

View File

@ -223,6 +223,18 @@ protected:
// Framerate of video being displayed in the element
// expressed in numbers of frames per second.
float mFramerate;
// True if the decoder is being shutdown. At this point all events that
// are currently queued need to return immediately to prevent javascript
// being run that operates on the element and decoder during shutdown.
// Read/Write from the main thread only.
PRPackedBool mShuttingDown;
// True if the decoder is currently in the Stop() method. This is used to
// prevent recursive calls into Stop while it is spinning the event loop
// waiting for the playback event loop to shutdown. Read/Write from the
// main thread only.
PRPackedBool mStopping;
};
#endif

View File

@ -508,11 +508,6 @@ private:
// when writing to the state, or when reading from a non-main thread.
// Any change to the state must call NotifyAll on the monitor.
PlayState mNextState;
// Flags if we've called Stop(). Prevents multiple events being
// sent to call Shutdown(). Accessed on the main thread
// only.
PRPackedBool mIsStopping;
};
#endif

View File

@ -63,7 +63,9 @@ nsMediaDecoder::nsMediaDecoder() :
mRGBHeight(-1),
mSizeChanged(PR_FALSE),
mVideoUpdateLock(nsnull),
mFramerate(0.0)
mFramerate(0.0),
mShuttingDown(PR_FALSE),
mStopping(PR_FALSE)
{
MOZ_COUNT_CTOR(nsMediaDecoder);
}

View File

@ -916,7 +916,7 @@ nsresult nsOggDecodeStateMachine::Run()
OggPlayErrorCode r = DecodeFrame();
mon.Enter();
if (mState == DECODER_STATE_SHUTDOWN)
if (mState != DECODER_STATE_DECODING)
continue;
// Get the decoded frame and store it in our queue of decoded frames
@ -1030,7 +1030,7 @@ nsresult nsOggDecodeStateMachine::Run()
case DECODER_STATE_COMPLETED:
{
while (mState != DECODER_STATE_SHUTDOWN &&
while (mState == DECODER_STATE_COMPLETED &&
!mDecodedFrames.IsEmpty()) {
PlayFrame();
if (mState != DECODER_STATE_SHUTDOWN) {
@ -1041,7 +1041,7 @@ nsresult nsOggDecodeStateMachine::Run()
}
}
if (mState == DECODER_STATE_SHUTDOWN)
if (mState != DECODER_STATE_COMPLETED)
continue;
nsCOMPtr<nsIRunnable> event =
@ -1176,8 +1176,7 @@ nsOggDecoder::nsOggDecoder() :
mReader(0),
mMonitor(0),
mPlayState(PLAY_STATE_PAUSED),
mNextState(PLAY_STATE_PAUSED),
mIsStopping(PR_FALSE)
mNextState(PLAY_STATE_PAUSED)
{
MOZ_COUNT_CTOR(nsOggDecoder);
}
@ -1216,6 +1215,8 @@ private:
void nsOggDecoder::Shutdown()
{
mShuttingDown = PR_TRUE;
ChangeState(PLAY_STATE_SHUTDOWN);
nsMediaDecoder::Shutdown();
@ -1234,7 +1235,7 @@ nsresult nsOggDecoder::Load(nsIURI* aURI, nsIChannel* aChannel,
{
// Reset Stop guard flag flag, else shutdown won't occur properly when
// reusing decoder.
mIsStopping = PR_FALSE;
mStopping = PR_FALSE;
if (aStreamListener) {
*aStreamListener = nsnull;
@ -1326,9 +1327,10 @@ void nsOggDecoder::Stop()
NS_ASSERTION(NS_IsMainThread(),
"nsOggDecoder::Stop called on non-main thread");
if (mIsStopping)
if (mStopping)
return;
mIsStopping = PR_TRUE;
mStopping = PR_TRUE;
ChangeState(PLAY_STATE_ENDED);
@ -1381,6 +1383,9 @@ nsIPrincipal* nsOggDecoder::GetCurrentPrincipal()
void nsOggDecoder::MetadataLoaded()
{
if (mShuttingDown)
return;
{
nsAutoMonitor mon(mMonitor);
mDuration = mDecodeStateMachine ? mDecodeStateMachine->GetDuration() : -1;
@ -1393,6 +1398,9 @@ void nsOggDecoder::MetadataLoaded()
void nsOggDecoder::FirstFrameLoaded()
{
if (mShuttingDown)
return;
if (mElement) {
mElement->FirstFrameLoaded();
}
@ -1414,6 +1422,9 @@ void nsOggDecoder::FirstFrameLoaded()
void nsOggDecoder::ResourceLoaded()
{
if (mShuttingDown)
return;
if (mElement) {
mElement->ResourceLoaded();
}
@ -1422,6 +1433,9 @@ void nsOggDecoder::ResourceLoaded()
void nsOggDecoder::NetworkError()
{
if (mShuttingDown)
return;
if (mElement)
mElement->NetworkError();
Stop();
@ -1434,6 +1448,9 @@ PRBool nsOggDecoder::IsSeeking() const
void nsOggDecoder::PlaybackEnded()
{
if (mShuttingDown)
return;
Stop();
if (mElement) {
mElement->PlaybackEnded();
@ -1477,6 +1494,9 @@ void nsOggDecoder::UpdateBytesDownloaded(PRUint64 aBytes)
void nsOggDecoder::BufferingStopped()
{
if (mShuttingDown)
return;
if (mElement) {
mElement->ChangeReadyState(nsIDOMHTMLMediaElement::CAN_SHOW_CURRENT_FRAME);
}
@ -1484,6 +1504,9 @@ void nsOggDecoder::BufferingStopped()
void nsOggDecoder::BufferingStarted()
{
if (mShuttingDown)
return;
if (mElement) {
mElement->ChangeReadyState(nsIDOMHTMLMediaElement::DATA_UNAVAILABLE);
}
@ -1491,10 +1514,11 @@ void nsOggDecoder::BufferingStarted()
void nsOggDecoder::SeekingStopped()
{
if (mShuttingDown)
return;
{
nsAutoMonitor mon(mMonitor);
if (mPlayState == PLAY_STATE_SHUTDOWN)
return;
// An additional seek was requested while the current seek was
// in operation.
@ -1511,11 +1535,8 @@ void nsOggDecoder::SeekingStopped()
void nsOggDecoder::SeekingStarted()
{
{
nsAutoMonitor mon(mMonitor);
if (mPlayState == PLAY_STATE_SHUTDOWN)
return;
}
if (mShuttingDown)
return;
if (mElement) {
mElement->SeekStarted();
@ -1610,6 +1631,9 @@ void nsOggDecoder::ChangeState(PlayState aState)
void nsOggDecoder::PlaybackPositionChanged()
{
if (mShuttingDown)
return;
float lastTime = mCurrentTime;
// Control the scope of the monitor so it is not
@ -1617,10 +1641,6 @@ void nsOggDecoder::PlaybackPositionChanged()
{
nsAutoMonitor mon(mMonitor);
// If we are shutting down, don't dispatch the event
if (mPlayState == PLAY_STATE_SHUTDOWN)
return;
if (mDecodeStateMachine) {
mCurrentTime = mDecodeStateMachine->GetCurrentTime();
mDecodeStateMachine->ClearPositionChangeFlag();

View File

@ -1021,6 +1021,12 @@ nsWaveDecoder::Play()
void
nsWaveDecoder::Stop()
{
if (mStopping) {
return;
}
mStopping = PR_TRUE;
StopProgress();
if (mPlaybackStateMachine) {
@ -1047,6 +1053,8 @@ nsWaveDecoder::Stop()
nsresult
nsWaveDecoder::Load(nsIURI* aURI, nsIChannel* aChannel, nsIStreamListener** aStreamListener)
{
mStopping = PR_FALSE;
if (aStreamListener) {
*aStreamListener = nsnull;
}
@ -1086,6 +1094,10 @@ nsWaveDecoder::Load(nsIURI* aURI, nsIChannel* aChannel, nsIStreamListener** aStr
void
nsWaveDecoder::MetadataLoaded()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->MetadataLoaded();
mElement->FirstFrameLoaded();
@ -1095,6 +1107,10 @@ nsWaveDecoder::MetadataLoaded()
void
nsWaveDecoder::PlaybackEnded()
{
if (mShuttingDown) {
return;
}
Stop();
if (mElement) {
mElement->PlaybackEnded();
@ -1104,6 +1120,9 @@ nsWaveDecoder::PlaybackEnded()
void
nsWaveDecoder::ResourceLoaded()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->ResourceLoaded();
}
@ -1116,6 +1135,9 @@ nsWaveDecoder::ResourceLoaded()
void
nsWaveDecoder::NetworkError()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->NetworkError();
}
@ -1185,6 +1207,8 @@ private:
void
nsWaveDecoder::Shutdown()
{
mShuttingDown = PR_TRUE;
nsMediaDecoder::Shutdown();
nsCOMPtr<nsIRunnable> event = new nsWaveDecoderShutdown(this);
@ -1203,6 +1227,10 @@ nsWaveDecoder::Observe(nsISupports* aSubject, const char* aTopic, const PRUnicha
void
nsWaveDecoder::BufferingStarted()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->ChangeReadyState(nsIDOMHTMLMediaElement::DATA_UNAVAILABLE);
}
@ -1211,6 +1239,10 @@ nsWaveDecoder::BufferingStarted()
void
nsWaveDecoder::BufferingStopped()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->ChangeReadyState(nsIDOMHTMLMediaElement::CAN_SHOW_CURRENT_FRAME);
}
@ -1219,6 +1251,10 @@ nsWaveDecoder::BufferingStopped()
void
nsWaveDecoder::SeekingStarted()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->SeekStarted();
}
@ -1227,6 +1263,10 @@ nsWaveDecoder::SeekingStarted()
void
nsWaveDecoder::SeekingStopped()
{
if (mShuttingDown) {
return;
}
if (mElement) {
mElement->SeekCompleted();
}
@ -1265,6 +1305,9 @@ nsWaveDecoder::UnregisterShutdownObserver()
void
nsWaveDecoder::MediaErrorDecode()
{
if (mShuttingDown) {
return;
}
#if 0
if (mElement) {
mElement->MediaErrorDecode();

View File

@ -153,5 +153,5 @@ nsSVGCircleElement::ConstructPath(gfxContext *aCtx)
GetAnimatedLengthValues(&x, &y, &r, nsnull);
if (r > 0.0f)
aCtx->Ellipse(gfxPoint(x, y), gfxSize(r*2, r*2));
aCtx->Arc(gfxPoint(x, y), r, 0, 2*M_PI);
}

View File

@ -7,3 +7,6 @@ fails == lreas_selflink_dtd_id.svg pass.svg
== lreas_selflink_empty_href.svg pass.svg
== lreas_selflink_relative_href.svg pass.svg
== xslt_relative_href.svg pass.svg
== xslt_selflink_dtd_id.xml pass.svg
== xslt_selflink_empty_href.xml pass.svg
== xslt_selflink_relative_href.xml pass.svg

View File

@ -0,0 +1,11 @@
<!DOCTYPE xslt:transform [<!ATTLIST xslt:transform id ID #IMPLIED>]>
<?xml-stylesheet type="application/xml" href="#transform"?>
<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/2000/svg"
id="transform" version="1.0">
<xslt:template match="/xslt:transform">
<svg>
<rect width="100%" height="100%" fill="lime"/>
</svg>
</xslt:template>
</xslt:transform>

View File

@ -0,0 +1,11 @@
<?xml-stylesheet type="application/xml"
href="xslt_selflink_relative_href.xml"?>
<xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/2000/svg"
version="1.0">
<xslt:template match="/xslt:transform">
<svg>
<rect width="100%" height="100%" fill="lime"/>
</svg>
</xslt:template>
</xslt:transform>

View File

@ -114,6 +114,7 @@ EXPORTS
sqlite3_mutex_leave
sqlite3_mutex_try
sqlite3_mprintf
sqlite3_next_stmt
sqlite3_open
sqlite3_open_v2
sqlite3_open16

View File

@ -9705,6 +9705,12 @@ nsClassifierCallback::Run()
NS_ENSURE_SUCCESS(rv, rv);
if (hasFlags) return NS_OK;
rv = NS_URIChainHasFlags(uri,
nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
&hasFlags);
NS_ENSURE_SUCCESS(rv, rv);
if (hasFlags) return NS_OK;
nsCOMPtr<nsIURIClassifier> uriClassifier =
do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;

View File

@ -80,10 +80,11 @@ iso-2022-kr.title = Korean (ISO-2022-KR)
utf-7.title = Unicode (UTF-7)
utf-8.title = Unicode (UTF-8)
utf-16.title = Unicode (UTF-16)
utf-16le.title = Unicode (UTF-16 Little Endian)
utf-16be.title = Unicode (UTF-16 Big Endian)
utf-32le.title = Unicode (UTF-32 Little Endian)
utf-32be.title = Unicode (UTF-32 Big Endian)
utf-16le.title = Unicode (UTF-16LE)
utf-16be.title = Unicode (UTF-16BE)
utf-32.title = Unicode (UTF-32)
utf-32le.title = Unicode (UTF-32LE)
utf-32be.title = Unicode (UTF-32BE)
iso-8859-5.title = Cyrillic (ISO-8859-5)
iso-ir-111.title = Cyrillic (ISO-IR-111)
windows-1251.title = Cyrillic (Windows-1251)

View File

@ -60,3 +60,5 @@ UnexpectedCanvasVariantStyle=canvas: an attempt to set strokeStyle or fillStyle
EmptyGetElementByIdParam=Empty string passed to getElementById().
LowMemoryTitle=Warning: Low memory
LowMemoryMessage=A script on this page has been stopped due to a low memory condition.
WrongEventPropertyAccessWarning=The '%S' property of a %S event should not be used. The value is meaningless.

View File

@ -49,7 +49,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(d95c02ac-92dc-4fff-ad52-41e125340fab)]
[scriptable, uuid(e3e2a8c1-4b56-4154-8ef2-fc4b2bb42e97)]
interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
{
// error state
@ -64,7 +64,6 @@ interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
const unsigned short LOADED_FIRST_FRAME = 3;
const unsigned short LOADED = 4;
readonly attribute unsigned short networkState;
readonly attribute unsigned long totalBytes;
void load();
// ready state

View File

@ -45,10 +45,10 @@
interface nsIDOMEventListener;
[scriptable, uuid(6c32d0c5-6bfa-438b-ad44-be0df80cd4a8)]
[scriptable, uuid(ab3725b8-3fca-40cc-a42c-92fb154ef01d)]
interface nsIWorkerMessagePort : nsISupports
{
void postMessage(in DOMString aMessage);
void postMessage(/* in JSObject aMessage */);
};
[scriptable, uuid(508f2d49-e9a0-4fe8-bd33-321820173b4a)]
@ -83,11 +83,10 @@ interface nsIWorkerGlobalScope : nsISupports
readonly attribute nsIWorkerNavigator navigator;
};
[scriptable, uuid(b10cfe72-91b9-45c6-ab13-33f89c2d0e56)]
[scriptable, uuid(d30a2f61-86e2-434e-837f-4f1985efa865)]
interface nsIWorkerScope : nsIWorkerGlobalScope
{
void postMessage(in DOMString aMessage,
[optional] in nsIWorkerMessagePort aMessagePort);
void postMessage(/* in JSObject aMessage */);
attribute nsIDOMEventListener onmessage;
};
@ -98,11 +97,10 @@ interface nsIAbstractWorker : nsIDOMEventTarget
attribute nsIDOMEventListener onerror;
};
[scriptable, uuid(3d2ca558-31f7-4893-aa6d-1db9a3cb5bb9)]
[scriptable, uuid(daf945c3-8d29-4724-8939-dd383f7d27a7)]
interface nsIWorker : nsIAbstractWorker
{
void postMessage(in DOMString aMessage,
[optional] in nsIWorkerMessagePort aMessagePort);
void postMessage(/* in JSObject aMessage */);
attribute nsIDOMEventListener onmessage;

View File

@ -245,7 +245,7 @@ nsGeolocationRequest::Allow()
DOMTimeStamp cachedPositionTime;
lastPosition->GetTimestamp(&cachedPositionTime);
if ( PR_Now() - (maximumAge * PR_MSEC_PER_SEC) >= cachedPositionTime )
if ( PR_Now() - maximumAge >= cachedPositionTime )
{
// okay, we can return a cached position
mAllowed = PR_TRUE;

View File

@ -61,6 +61,7 @@ REQUIRES = \
pref \
string \
thebes \
uconv \
widget \
xpcom \
xpconnect \
@ -82,6 +83,7 @@ CPPSRCS = \
LOCAL_INCLUDES = \
-I$(topsrcdir)/dom/src/base \
-I$(topsrcdir)/dom/src/json \
-I$(topsrcdir)/content/base/src \
-I$(topsrcdir)/content/events/src \
$(NULL)

View File

@ -47,9 +47,11 @@
#include "jsdbgapi.h"
#endif
#include "nsAutoLock.h"
#include "nsAXPCNativeCallContext.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsGlobalWindow.h"
#include "nsJSON.h"
#include "nsJSUtils.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
@ -413,6 +415,113 @@ JSFunctionSpec gDOMWorkerFunctions[] = {
{ nsnull, nsnull, 0, 0, 0 }
};
static JSBool
WriteCallback(const jschar* aBuffer,
uint32 aLength,
void* aData)
{
nsJSONWriter* writer = static_cast<nsJSONWriter*>(aData);
nsresult rv = writer->Write((const PRUnichar*)aBuffer, (PRUint32)aLength);
return NS_SUCCEEDED(rv) ? JS_TRUE : JS_FALSE;
}
static nsresult
GetStringForArgument(nsAString& aString,
PRBool* aIsJSON,
PRBool* aIsPrimitive)
{
NS_ASSERTION(aIsJSON && aIsPrimitive, "Null pointer!");
nsIXPConnect* xpc = nsContentUtils::XPConnect();
NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
nsAXPCNativeCallContext* cc;
nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
PRUint32 argc;
rv = cc->GetArgc(&argc);
NS_ENSURE_SUCCESS(rv, rv);
if (!argc) {
return NS_ERROR_XPC_NOT_ENOUGH_ARGS;
}
jsval* argv;
rv = cc->GetArgvPtr(&argv);
NS_ENSURE_SUCCESS(rv, rv);
JSContext* cx;
rv = cc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, rv);
JSAutoRequest ar(cx);
if (JSVAL_IS_STRING(argv[0])) {
aString.Assign(nsDependentJSString(JSVAL_TO_STRING(argv[0])));
*aIsJSON = *aIsPrimitive = PR_FALSE;
return NS_OK;
}
nsAutoJSValHolder jsonVal;
JSBool ok = jsonVal.Hold(cx);
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
if (JSVAL_IS_PRIMITIVE(argv[0])) {
// Only objects can be serialized through JSON, currently, so if we've been
// given a primitive we set it as a property on a dummy object before
// sending it to the serializer.
JSObject* obj = JS_NewObject(cx, NULL, NULL, NULL);
NS_ENSURE_TRUE(obj, NS_ERROR_OUT_OF_MEMORY);
jsonVal = obj;
ok = JS_DefineProperty(cx, obj, JSON_PRIMITIVE_PROPNAME, argv[0], NULL,
NULL, JSPROP_ENUMERATE);
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
*aIsPrimitive = PR_TRUE;
}
else {
jsonVal = argv[0];
*aIsPrimitive = PR_FALSE;
}
JSType type;
jsval* vp = jsonVal.ToJSValPtr();
// This may change vp if there is a 'toJSON' function on the object.
ok = JS_TryJSON(cx, vp);
if (!(ok && !JSVAL_IS_PRIMITIVE(*vp) &&
(type = JS_TypeOfValue(cx, *vp)) != JSTYPE_FUNCTION &&
type != JSTYPE_XML)) {
return NS_ERROR_INVALID_ARG;
}
// Make sure to hold the new vp in case it changed.
jsonVal = *vp;
nsJSONWriter writer;
ok = JS_Stringify(cx, jsonVal.ToJSValPtr(), NULL, &WriteCallback, &writer);
if (!ok) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
NS_ENSURE_TRUE(writer.DidWrite(), NS_ERROR_UNEXPECTED);
writer.FlushBuffer();
aString.Assign(writer.mOutputString);
*aIsJSON = PR_TRUE;
return NS_OK;
}
class nsDOMWorkerScope : public nsIWorkerScope,
public nsIDOMEventTarget,
public nsIXPCScriptable,
@ -509,8 +618,7 @@ nsDOMWorkerScope::GetNavigator(nsIWorkerNavigator** _retval)
}
NS_IMETHODIMP
nsDOMWorkerScope::PostMessage(const nsAString& aMessage,
nsIWorkerMessagePort* aMessagePort)
nsDOMWorkerScope::PostMessage(/* JSObject aMessage */)
{
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
@ -518,11 +626,13 @@ nsDOMWorkerScope::PostMessage(const nsAString& aMessage,
return NS_ERROR_ABORT;
}
if (aMessagePort) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsString message;
PRBool isJSON, isPrimitive;
return mWorker->PostMessageInternal(aMessage, PR_FALSE);
nsresult rv = GetStringForArgument(message, &isJSON, &isPrimitive);
NS_ENSURE_SUCCESS(rv, rv);
return mWorker->PostMessageInternal(message, isJSON, isPrimitive, PR_FALSE);
}
NS_IMETHODIMP
@ -1006,6 +1116,8 @@ nsDOMWorker::Resume()
nsresult
nsDOMWorker::PostMessageInternal(const nsAString& aMessage,
PRBool aIsJSON,
PRBool aIsPrimitive,
PRBool aToInner)
{
nsRefPtr<nsDOMWorkerMessageEvent> message = new nsDOMWorkerMessageEvent();
@ -1016,6 +1128,8 @@ nsDOMWorker::PostMessageInternal(const nsAString& aMessage,
EmptyString(), nsnull);
NS_ENSURE_SUCCESS(rv, rv);
message->SetJSONData(aIsJSON, aIsPrimitive);
nsRefPtr<nsDOMFireEventRunnable> runnable =
new nsDOMFireEventRunnable(this, message, aToInner);
NS_ENSURE_TRUE(runnable, NS_ERROR_OUT_OF_MEMORY);
@ -1083,11 +1197,13 @@ nsDOMWorker::CompileGlobalObject(JSContext* aCx)
nsIXPConnect* xpc = nsContentUtils::XPConnect();
const PRUint32 flags = nsIXPConnect::INIT_JS_STANDARD_CLASSES |
nsIXPConnect::OMIT_COMPONENTS_OBJECT;
nsCOMPtr<nsIXPConnectJSObjectHolder> globalWrapper;
nsresult rv =
xpc->InitClassesWithNewWrappedGlobal(aCx, scopeSupports,
NS_GET_IID(nsISupports),
nsIXPConnect::INIT_JS_STANDARD_CLASSES,
NS_GET_IID(nsISupports), flags,
getter_AddRefs(globalWrapper));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
@ -1097,12 +1213,18 @@ nsDOMWorker::CompileGlobalObject(JSContext* aCx)
NS_ASSERTION(JS_GetGlobalObject(aCx) == global, "Global object mismatch!");
// XXX Fix this!
PRBool success = JS_DeleteProperty(aCx, global, "Components");
NS_ENSURE_TRUE(success, PR_FALSE);
#ifdef DEBUG
{
jsval components;
if (JS_GetProperty(aCx, global, "Components", &components)) {
NS_ASSERTION(components == JSVAL_VOID,
"Components property still defined!");
}
}
#endif
// Set up worker thread functions
success = JS_DefineFunctions(aCx, global, gDOMWorkerFunctions);
PRBool success = JS_DefineFunctions(aCx, global, gDOMWorkerFunctions);
NS_ENSURE_TRUE(success, PR_FALSE);
// From here on out we have to remember to null mGlobal and mInnerScope if
@ -1324,18 +1446,19 @@ nsDOMWorker::GetParent()
* See nsIWorker
*/
NS_IMETHODIMP
nsDOMWorker::PostMessage(const nsAString& aMessage,
nsIWorkerMessagePort* aMessagePort)
nsDOMWorker::PostMessage(/* JSObject aMessage */)
{
if (mTerminated) {
return NS_OK;
}
if (aMessagePort) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsString message;
PRBool isJSON, isPrimitive;
return PostMessageInternal(aMessage, PR_TRUE);
nsresult rv = GetStringForArgument(message, &isJSON, &isPrimitive);
NS_ENSURE_SUCCESS(rv, rv);
return PostMessageInternal(message, isJSON, isPrimitive, PR_TRUE);
}
/**

View File

@ -148,12 +148,14 @@ private:
~nsDOMWorker();
nsresult PostMessageInternal(const nsAString& aMessage,
PRBool aIsJSON,
PRBool aIsPrimitive,
PRBool aToInner);
PRBool CompileGlobalObject(JSContext* aCx);
PRUint32 NextTimeoutId() {
return mNextTimeoutId++;
return ++mNextTimeoutId;
}
nsresult AddFeature(nsDOMWorkerFeature* aFeature,

View File

@ -39,7 +39,10 @@
#include "nsDOMWorkerEvents.h"
#include "nsIXMLHttpRequest.h"
#include "nsIXPConnect.h"
#include "nsAXPCNativeCallContext.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "nsDOMWorkerMessageHandler.h"
@ -240,8 +243,70 @@ NS_IMPL_THREADSAFE_DOM_CI_GETINTERFACES(nsDOMWorkerMessageEvent)
NS_IMETHODIMP
nsDOMWorkerMessageEvent::GetData(nsAString& aData)
{
aData.Assign(mData);
return NS_OK;
if (!mIsJSON) {
aData.Assign(mData);
return NS_OK;
}
nsIXPConnect* xpc = nsContentUtils::XPConnect();
NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
nsAXPCNativeCallContext* cc;
nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
jsval* retval;
rv = cc->GetRetValPtr(&retval);
NS_ENSURE_SUCCESS(rv, rv);
if (mCachedJSVal) {
*retval = mCachedJSVal;
return cc->SetReturnValueWasSet(PR_TRUE);
}
JSContext* cx;
rv = cc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, rv);
JSAutoRequest ar(cx);
JSBool ok = mCachedJSVal.Hold(cx);
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
JSONParser* parser = JS_BeginJSONParse(cx, mCachedJSVal.ToJSValPtr());
NS_ENSURE_TRUE(parser, NS_ERROR_UNEXPECTED);
// This is slightly sneaky, but now that JS_BeginJSONParse succeeded we always
// need call JS_FinishJSONParse even if JS_ConsumeJSONText fails. We'll report
// an error if either failed, though.
ok = JS_ConsumeJSONText(cx, parser, (jschar*)mData.get(),
(uint32)mData.Length());
// Note the '&& ok' after the call here!
ok = JS_FinishJSONParse(cx, parser) && ok;
if (!ok) {
mCachedJSVal = JSVAL_NULL;
return NS_ERROR_UNEXPECTED;
}
NS_ASSERTION(mCachedJSVal.ToJSObject(), "Bad JSON result!");
if (mIsPrimitive) {
jsval primitive;
ok = JS_GetProperty(cx, mCachedJSVal.ToJSObject(), JSON_PRIMITIVE_PROPNAME,
&primitive);
if (!ok) {
mCachedJSVal = JSVAL_NULL;
return NS_ERROR_UNEXPECTED;
}
mCachedJSVal = primitive;
}
*retval = mCachedJSVal;
return cc->SetReturnValueWasSet(PR_TRUE);
}
NS_IMETHODIMP

View File

@ -46,6 +46,8 @@
#include "nsIDOMWorkers.h"
#include "nsIRunnable.h"
#include "jsapi.h"
#include "nsAutoJSValHolder.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
@ -186,8 +188,20 @@ public:
NS_DECL_NSIWORKERMESSAGEEVENT
NS_DECL_NSICLASSINFO_GETINTERFACES
nsDOMWorkerMessageEvent()
: mIsJSON(PR_FALSE), mIsPrimitive(PR_FALSE) { }
void SetJSONData(PRBool aIsJSON, PRBool aIsPrimitive) {
mIsJSON = aIsJSON;
mIsPrimitive = aIsPrimitive;
}
protected:
nsString mData;
PRBool mIsJSON;
PRBool mIsPrimitive;
nsAutoJSValHolder mCachedJSVal;
nsString mOrigin;
nsCOMPtr<nsISupports> mSource;
};

View File

@ -129,4 +129,7 @@ NS_IMPL_THREADSAFE_DOM_CI_ALL_THE_REST(_class)
NS_IMETHOD_(nsrefcnt) AddRef(void) { return _to AddRef(); } \
NS_IMETHOD_(nsrefcnt) Release(void) { return _to Release(); }
#define JSON_PRIMITIVE_PROPNAME \
"primitive"
#endif /* __NSDOMWORKERMACROS_H__ */

View File

@ -126,7 +126,10 @@ nsDOMWorkerTimeout::FunctionCallback::Run(nsDOMWorkerTimeout* aTimeout,
JSObject* global = JS_GetGlobalObject(aCx);
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
nsTArray<jsval> argv(mCallbackArgsLength);
nsTArray<jsval> argv;
PRBool success = argv.SetCapacity(mCallbackArgsLength);
NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 index = 0; index < mCallbackArgsLength; index++) {
argv.AppendElement(mCallbackArgs[index]);
}

View File

@ -56,6 +56,8 @@ _TEST_FILES = \
importScripts_worker_imported2.js \
importScripts_worker_imported3.js \
importScripts_worker_imported4.js \
test_json.html \
json_worker.js \
test_longThread.html \
longThread_worker.js \
test_navigator.html \

View File

@ -0,0 +1,203 @@
var messages = [
{
type: "object",
array: false,
exception: false,
shouldCompare: false,
shouldEqual: false,
value: { foo: "bar" }
},
{
type: "object",
array: true,
exception: false,
shouldCompare: false,
shouldEqual: false,
value: [9, 8, 7]
},
{
type: "object",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: null
},
{
type: "undefined",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: undefined,
compareValue: undefined
},
{
type: "string",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: "Hello"
},
{
type: "string",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: JSON.stringify({ foo: "bar" })
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: 1
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: 0
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: -1
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: 238573459843702923492399923049
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: -238573459843702923492399923049
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: 0.25
},
{
type: "number",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: -0.25
},
{
type: "boolean",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: true
},
{
type: "boolean",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: false
},
/*
// Uncomment these once bug 465371 is fixed!
{
type: "function",
array: false,
exception: true,
shouldCompare: false,
shouldEqual: false,
value: function (foo) { return "Bad!"; }
},
{
type: "xml",
array: false,
exception: true,
shouldCompare: true,
shouldEqual: true,
value: <funtimes></funtimes>
},
*/
{
type: "object",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: NaN,
compareValue: null
},
{
type: "object",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: Infinity,
compareValue: null
},
{
type: "object",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: -Infinity,
compareValue: null
},
{
type: "string",
array: false,
exception: false,
shouldCompare: true,
shouldEqual: true,
value: "testFinished"
}
];
for (var index = 0; index < messages.length; index++) {
var message = messages[index];
if (message.hasOwnProperty("compareValue")) {
continue;
}
message.compareValue = message.value;
}
var onmessage = function(event) {
for (var index = 0; index < messages.length; index++) {
var exception = false;
try {
postMessage(messages[index].value);
}
catch (e) {
exception = true;
}
if (messages[index].exception != exception) {
throw "Exception inconsistency!";
}
}
}

View File

@ -2,6 +2,9 @@ function messageListener(event) {
switch (event.data) {
case "no-op":
break;
case "components":
postMessage(Components.toString());
break;
case "start":
for (var i = 0; i < 1000; i++) { }
postMessage("started");

View File

@ -0,0 +1,67 @@
<!DOCTYPE HTML>
<html>
<!--
Tests of DOM Worker JSON messages
-->
<head>
<title>Test for DOM Worker Navigator</title>
<script type="text/javascript" src="/MochiKit/MochiKit.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">
</div>
<pre id="test">
<script src="json_worker.js" language="javascript"></script>
<script class="testbody" language="javascript">
ok(messages.length, "No messages to test!");
var worker = new Worker("json_worker.js");
var index = 0;
worker.onmessage = function(event) {
var key = messages[index++];
// Loop for the ones we shouldn't receive.
while (key.exception) {
key = messages[index++];
}
is(typeof event.data, key.type,
"Bad type! " + messages.indexOf(key));
is(event.data instanceof Array, key.array,
"Array mismatch! " + messages.indexOf(key));
if (key.shouldCompare) {
ok(event.data == key.compareValue,
"Values don't compare! " + messages.indexOf(key));
}
if (key.shouldEqual) {
ok(event.data === key.compareValue,
"Values don't equal!" + messages.indexOf(key));
}
if (event.data == "testFinished") {
is(index, messages.length, "Didn't see the right number of messages!");
SimpleTest.finish();
}
};
worker.onerror = function(event) {
ok(false, "Worker had an error: " + event.data);
SimpleTest.finish();
}
worker.postMessage("start");
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View File

@ -26,7 +26,7 @@ Tests of DOM Worker Threads (Bug 437152)
case "no-op":
break;
case "started":
is(gotError, true);
is(gotErrors, true);
worker.postMessage("no-op");
worker.postMessage("stop");
break;
@ -40,20 +40,29 @@ Tests of DOM Worker Threads (Bug 437152)
}
}, false);
var gotError = false;
var gotErrors = false;
worker.onerror = function(event) {
is(event.target, worker);
is(event.data,
'[JavaScript Error: "uncaught exception: Bad message: asdf"]');
gotError = true;
worker.onerror = function(otherEvent) {
ok(false, "Worker had an error:" + otherEvent.data);
SimpleTest.finish();
}
is(otherEvent.target, worker);
is(otherEvent.data,
'[JavaScript Error: "Components is not defined" {file: ' +
'"http://localhost:8888/tests/dom/src/threads/test/' +
'simpleThread_worker.js" line: 6}]');
gotErrors = true;
worker.onerror = function(oneMoreEvent) {
ok(false, "Worker had an error:" + oneMoreEvent.data);
SimpleTest.finish();
};
};
};
worker.postMessage("asdf");
worker.postMessage("components");
worker.postMessage("start");
SimpleTest.waitForExplicitFinish();

View File

@ -24,7 +24,7 @@ Tests of DOM Worker Threads XHR(Bug 450452 )
var worker = new Worker("xhrAbort_worker.js");
worker.onmessage = function(event) {
is (data, event.data, "Got different results!");
is (data.toString(), event.data.toString(), "Got different results!");
SimpleTest.finish();
};

View File

@ -45,6 +45,7 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_bug366682.html \
test_bug432225.html \
test_bug456244.html \
$(NULL)

View File

@ -0,0 +1,86 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=366682
-->
<head>
<title>Test for Bug 366682</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=366682">Mozilla Bug 366682</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 366682 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
var gMisspeltWords;
function getEdit() {
return document.getElementById('edit');
}
function editDoc() {
return getEdit().contentDocument;
}
function getSpellCheckSelection() {
var Ci = Components.interfaces;
var win = editDoc().defaultView;
var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIEditingSession);
var editor = editingSession.getEditorForWindow(win);
var selcon = editor.selectionController;
return selcon.getSelection(selcon.SELECTION_SPELLCHECK);
}
function runTest() {
editDoc().body.innerHTML = "<div>errror and an other errror</div>";
gMisspeltWords = ["errror", "errror"];
editDoc().designMode = "on";
setTimeout(function() { evalTest(); }, 0);
}
function evalTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
is(isSpellingCheckOk(), true, "All misspellings accounted for.");
SimpleTest.finish();
}
function isSpellingCheckOk() {
var sel = getSpellCheckSelection();
var numWords = sel.rangeCount;
is(numWords, gMisspeltWords.length, "Correct number of misspellings and words.");
if (numWords != gMisspeltWords.length)
return false;
for (var i=0; i<numWords; i++) {
var word = sel.getRangeAt(i);
is (word, gMisspeltWords[i], "Misspelling is what we think it is.");
if (word != gMisspeltWords[i])
return false;
}
return true;
}
</script>
</pre>
<iframe id="edit" width="200" height="100" src="about:blank"></iframe>
</body>
</html>

View File

@ -190,14 +190,20 @@ FindNextTextNode(nsIDOMNode* aNode, PRInt32 aOffset, nsIDOMNode* aRoot)
if (child) {
checkNode = child;
} else {
// aOffset was beyond the end of the child list. Start checking at the next
// node after the last child, or aNode if there are no children.
aNode->GetLastChild(getter_AddRefs(child));
if (child) {
checkNode = FindNextNode(child, aRoot);
} else {
checkNode = FindNextNode(aNode, aRoot);
// aOffset was beyond the end of the child list.
// goto next node in a preorder DOM traversal.
nsCOMPtr<nsIDOMNode> next;
aNode->GetNextSibling(getter_AddRefs(next));
while (!next) {
// Go up
aNode->GetParentNode(getter_AddRefs(next));
if (next == aRoot || !next) {
return nsnull;
}
aNode = next;
aNode->GetNextSibling(getter_AddRefs(next));
}
checkNode = next;
}
while (checkNode && !IsTextNode(checkNode)) {

View File

@ -125,12 +125,12 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
mDetectedCharset = "X-ISO-10646-UCS-4-3412";
else if ('\xFF' == aBuf[1])
// FE FF UTF-16, big endian BOM
mDetectedCharset = "UTF-16BE";
mDetectedCharset = "UTF-16";
break;
case '\x00':
if (('\x00' == aBuf[1]) && ('\xFE' == aBuf[2]) && ('\xFF' == aBuf[3]))
// 00 00 FE FF UTF-32, big-endian BOM
mDetectedCharset = "UTF-32BE";
mDetectedCharset = "UTF-32";
else if (('\x00' == aBuf[1]) && ('\xFF' == aBuf[2]) && ('\xFE' == aBuf[3]))
// 00 00 FF FE UCS-4, unusual octet order BOM (2143)
mDetectedCharset = "X-ISO-10646-UCS-4-2143";
@ -138,10 +138,10 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
case '\xFF':
if (('\xFE' == aBuf[1]) && ('\x00' == aBuf[2]) && ('\x00' == aBuf[3]))
// FF FE 00 00 UTF-32, little-endian BOM
mDetectedCharset = "UTF-32LE";
mDetectedCharset = "UTF-32";
else if ('\xFE' == aBuf[1])
// FF FE UTF-16, little endian BOM
mDetectedCharset = "UTF-16LE";
mDetectedCharset = "UTF-16";
break;
} // switch

View File

@ -933,6 +933,9 @@ _cairo_win32_surface_composite_inner (cairo_win32_surface_t *src,
return CAIRO_STATUS_SUCCESS;
}
/* from pixman-private.h */
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
static cairo_int_status_t
_cairo_win32_surface_composite (cairo_operator_t op,
cairo_pattern_t *pattern,
@ -1214,8 +1217,8 @@ _cairo_win32_surface_composite (cairo_operator_t op,
uint32_t rendered_width = 0, rendered_height = 0;
uint32_t to_render_height, to_render_width;
int32_t piece_x, piece_y;
int32_t src_start_x = src_r.x % src_extents.width;
int32_t src_start_y = src_r.y % src_extents.height;
int32_t src_start_x = MOD(src_r.x, src_extents.width);
int32_t src_start_y = MOD(src_r.y, src_extents.height);
if (needs_scale)
goto UNSUPPORTED;

View File

@ -0,0 +1,44 @@
diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
--- a/gfx/cairo/cairo/src/cairo-win32-surface.c
+++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
@@ -928,16 +928,19 @@ _cairo_win32_surface_composite_inner (ca
return _composite_alpha_blend (dst, src, alpha,
src_r.x, src_r.y, src_r.width, src_r.height,
dst_r.x, dst_r.y, dst_r.width, dst_r.height);
}
return CAIRO_STATUS_SUCCESS;
}
+/* from pixman-private.h */
+#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
+
static cairo_int_status_t
_cairo_win32_surface_composite (cairo_operator_t op,
cairo_pattern_t *pattern,
cairo_pattern_t *mask_pattern,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
@@ -1209,18 +1212,18 @@ _cairo_win32_surface_composite (cairo_op
/* If we need to repeat, we turn the repeated blit into
* a bunch of piece-by-piece blits.
*/
if (needs_repeat) {
cairo_rectangle_int_t piece_src_r, piece_dst_r;
uint32_t rendered_width = 0, rendered_height = 0;
uint32_t to_render_height, to_render_width;
int32_t piece_x, piece_y;
- int32_t src_start_x = src_r.x % src_extents.width;
- int32_t src_start_y = src_r.y % src_extents.height;
+ int32_t src_start_x = MOD(src_r.x, src_extents.width);
+ int32_t src_start_y = MOD(src_r.y, src_extents.height);
if (needs_scale)
goto UNSUPPORTED;
/* If both the src and dest have an image, we may as well fall
* back, because it will be faster than our separate blits.
* Our blit code will be fastest when the src is a DDB and the
* destination is a DDB.

View File

@ -156,6 +156,9 @@
// A multiline text field
#define NS_THEME_TEXTFIELD_MULTILINE 97
// A searchfield
#define NS_THEME_SEARCHFIELD 98
// A dropdown list.
#define NS_THEME_DROPDOWN 101

View File

@ -66,9 +66,13 @@ public:
* @param aRect The coordinates of the surface to create in device units.
*
* @param aBlurRadius The blur radius in pixels
*
* @param aDirtyRect A pointer to a dirty rect, measured in device units, if available.
* This will be used for optimizing the blur operation. It is safe to pass NULL here.
*/
gfxContext* Init(const gfxRect& aRect,
const gfxIntSize& aBlurRadius);
const gfxIntSize& aBlurRadius,
const gfxRect* aDirtyRect);
/**
* Returns the context that should be drawn to supply the alpha mask to be
@ -116,6 +120,13 @@ protected:
* The temporary alpha surface.
*/
nsRefPtr<gfxImageSurface> mImageSurface;
/**
* A copy of the dirty rect passed to Init(). This will only be valid if
* mHasDirtyRect is TRUE.
*/
gfxRect mDirtyRect;
PRBool mHasDirtyRect;
};
#endif /* GFX_BLUR_H */

View File

@ -54,12 +54,12 @@ gfxAlphaBoxBlur::~gfxAlphaBoxBlur()
gfxContext*
gfxAlphaBoxBlur::Init(const gfxRect& aRect,
const gfxIntSize& aBlurRadius)
const gfxIntSize& aBlurRadius,
const gfxRect* aDirtyRect)
{
mBlurRadius = aBlurRadius;
gfxRect rect(aRect);
rect.Outset(aBlurRadius.height, aBlurRadius.width,
aBlurRadius.height, aBlurRadius.width);
rect.RoundOut();
@ -67,6 +67,19 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect,
if (rect.IsEmpty())
return nsnull;
if (aDirtyRect) {
// If we get passed a dirty rect from layout, we can minimize the
// shadow size and make painting faster.
mHasDirtyRect = PR_TRUE;
mDirtyRect = *aDirtyRect;
gfxRect requiredBlurArea = mDirtyRect.Intersect(rect);
requiredBlurArea.Outset(aBlurRadius.height, aBlurRadius.width,
aBlurRadius.height, aBlurRadius.width);
rect = requiredBlurArea.Intersect(rect);
} else {
mHasDirtyRect = PR_FALSE;
}
// Make an alpha-only surface to draw on. We will play with the data after
// everything is drawn to create a blur effect.
mImageSurface = new gfxImageSurface(gfxIntSize(static_cast<PRInt32>(rect.Width()), static_cast<PRInt32>(rect.Height())),
@ -173,6 +186,48 @@ BoxBlurVertical(unsigned char* aInput,
}
}
static void ComputeLobes(PRInt32 aRadius, PRInt32 aLobes[3][2])
{
PRInt32 major, minor, final;
/* See http://www.w3.org/TR/SVG/filters.html#feGaussianBlur for
* some notes about approximating the Gaussian blur with box-blurs.
* The comments below are in the terminology of that page.
*/
PRInt32 z = aRadius/3;
switch (aRadius % 3) {
case 0:
// aRadius = z*3; choose d = 2*z + 1
major = minor = final = z;
break;
case 1:
// aRadius = z*3 + 1
// This is a tricky case since there is no value of d which will
// yield a radius of exactly aRadius. If d is odd, i.e. d=2*k + 1
// for some integer k, then the radius will be 3*k. If d is even,
// i.e. d=2*k, then the radius will be 3*k - 1.
// So we have to choose values that don't match the standard
// algorithm.
major = z + 1;
minor = final = z;
break;
case 2:
// aRadius = z*3 + 2; choose d = 2*z + 2
major = final = z + 1;
minor = z;
break;
}
NS_ASSERTION(major + minor + final == aRadius,
"Lobes don't sum to the right length");
aLobes[0][0] = major;
aLobes[0][1] = minor;
aLobes[1][0] = minor;
aLobes[1][1] = major;
aLobes[2][0] = final;
aLobes[2][1] = final;
}
void
gfxAlphaBoxBlur::Paint(gfxContext* aDestinationCtx, const gfxPoint& offset)
{
@ -183,12 +238,6 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDestinationCtx, const gfxPoint& offset)
// no need to do all this if not blurring
if (mBlurRadius.width != 0 || mBlurRadius.height != 0) {
// A blur radius of 1 achieves nothing (1/2 = 0 in int terms),
// but we still want a blur!
// XXX this may not be appropriate... perhaps just use actuall Gaussian here?
mBlurRadius.width = PR_MAX(mBlurRadius.width, 2);
mBlurRadius.height = PR_MAX(mBlurRadius.height, 2);
nsTArray<unsigned char> tempAlphaDataBuf;
if (!tempAlphaDataBuf.SetLength(mImageSurface->GetDataSize()))
return; // OOM
@ -198,26 +247,38 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDestinationCtx, const gfxPoint& offset)
PRInt32 rows = mImageSurface->Height();
if (mBlurRadius.width > 0) {
PRInt32 longLobe = mBlurRadius.width / 2;
PRInt32 shortLobe = (mBlurRadius.width & 1) ? longLobe : longLobe - 1;
BoxBlurHorizontal(boxData, tmpData, longLobe, shortLobe, stride, rows);
BoxBlurHorizontal(tmpData, boxData, shortLobe, longLobe, stride, rows);
BoxBlurHorizontal(boxData, tmpData, longLobe, longLobe, stride, rows);
PRInt32 lobes[3][2];
ComputeLobes(mBlurRadius.width, lobes);
BoxBlurHorizontal(boxData, tmpData, lobes[0][0], lobes[0][1], stride, rows);
BoxBlurHorizontal(tmpData, boxData, lobes[1][0], lobes[1][1], stride, rows);
BoxBlurHorizontal(boxData, tmpData, lobes[2][0], lobes[2][1], stride, rows);
}
if (mBlurRadius.height > 0) {
PRInt32 longLobe = mBlurRadius.height / 2;
PRInt32 shortLobe = (mBlurRadius.height & 1) ? longLobe : longLobe - 1;
BoxBlurVertical(tmpData, boxData, longLobe, shortLobe, stride, rows);
BoxBlurVertical(boxData, tmpData, shortLobe, longLobe, stride, rows);
BoxBlurVertical(tmpData, boxData, longLobe, longLobe, stride, rows);
PRInt32 lobes[3][2];
ComputeLobes(mBlurRadius.height, lobes);
BoxBlurVertical(tmpData, boxData, lobes[0][0], lobes[0][1], stride, rows);
BoxBlurVertical(boxData, tmpData, lobes[1][0], lobes[1][1], stride, rows);
BoxBlurVertical(tmpData, boxData, lobes[2][0], lobes[2][1], stride, rows);
}
}
aDestinationCtx->Mask(mImageSurface, offset);
// Avoid a semi-expensive clip operation if we can, otherwise
// clip to the dirty rect
if (mHasDirtyRect) {
aDestinationCtx->Save();
aDestinationCtx->NewPath();
aDestinationCtx->Rectangle(mDirtyRect);
aDestinationCtx->Clip();
aDestinationCtx->Mask(mImageSurface, offset);
aDestinationCtx->Restore();
} else {
aDestinationCtx->Mask(mImageSurface, offset);
}
}
static const gfxFloat GAUSSIAN_SCALE_FACTOR = 3 * sqrt(2 * M_PI) / 4;
// Blur radius is approximately 3/2 times the box-blur size
static const gfxFloat GAUSSIAN_SCALE_FACTOR = (3 * sqrt(2 * M_PI) / 4) * (3/2);
gfxIntSize gfxAlphaBoxBlur::CalculateBlurRadius(const gfxPoint& aStd)
{

View File

@ -223,6 +223,16 @@ gfxPlatform::Init()
if (prefs)
prefs->AddObserver(CMForceSRGBPrefName, gPlatform->overrideObserver, PR_TRUE);
/* By default, LCMS calls exit() on error, which isn't what we want. If
cms is enabled, change the error functionality. */
if (GetCMSMode() != eCMSMode_Off) {
#ifdef DEBUG
cmsErrorAction(LCMS_ERROR_SHOW);
#else
cmsErrorAction(LCMS_ERROR_IGNORE);
#endif
}
return NS_OK;
}
@ -569,12 +579,6 @@ cmsHPROFILE
gfxPlatform::GetCMSOutputProfile()
{
if (!gCMSOutputProfile) {
/* Default lcms error action is to abort on error - change */
#ifdef DEBUG_tor
cmsErrorAction(LCMS_ERROR_SHOW);
#else
cmsErrorAction(LCMS_ERROR_IGNORE);
#endif
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs) {
@ -598,10 +602,6 @@ gfxPlatform::GetCMSOutputProfile()
getter_Copies(fname));
if (NS_SUCCEEDED(rv) && !fname.IsEmpty()) {
gCMSOutputProfile = cmsOpenProfileFromFile(fname, "r");
if (gCMSOutputProfile)
fprintf(stderr,
"ICM profile read from %s successfully\n",
fname.get());
}
}
}
@ -611,6 +611,15 @@ gfxPlatform::GetCMSOutputProfile()
gfxPlatform::GetPlatform()->GetPlatformCMSOutputProfile();
}
/* Determine if the profile looks bogus. If so, close the profile
* and use sRGB instead. See bug 460629, */
if (gCMSOutputProfile && cmsProfileIsBogus(gCMSOutputProfile)) {
NS_ASSERTION(gCMSOutputProfile != GetCMSsRGBProfile(),
"Builtin sRGB profile tagged as bogus!!!");
cmsCloseProfile(gCMSOutputProfile);
gCMSOutputProfile = nsnull;
}
if (!gCMSOutputProfile) {
gCMSOutputProfile = GetCMSsRGBProfile();
}
@ -633,7 +642,7 @@ gfxPlatform::GetCMSsRGBProfile()
/* Precache the Fixed-point Interpolations for sRGB as an input
profile. See bug 444661 for details. */
cmsPrecacheProfile(gCMSsRGBProfile, CMS_PRECACHE_LI16F_FORWARD);
cmsPrecacheProfile(gCMSsRGBProfile, CMS_PRECACHE_LI8F_FORWARD);
}
return gCMSsRGBProfile;
}

View File

@ -308,7 +308,7 @@ RunTest(struct TestContext *ctx, struct TestParams *params,
/* Precache. */
cmsPrecacheProfile(inProfile, CMS_PRECACHE_LI16W_FORWARD);
cmsPrecacheProfile(inProfile, CMS_PRECACHE_LI16F_FORWARD);
cmsPrecacheProfile(inProfile, CMS_PRECACHE_LI8F_FORWARD);
cmsPrecacheProfile(outProfile, CMS_PRECACHE_LI1616_REVERSE);
cmsPrecacheProfile(outProfile, CMS_PRECACHE_LI168_REVERSE);

View File

@ -296,6 +296,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
if (!preferred.EqualsLiteral("UTF-16") &&
!preferred.EqualsLiteral("UTF-16BE") &&
!preferred.EqualsLiteral("UTF-16LE") &&
!preferred.EqualsLiteral("UTF-32") &&
!preferred.EqualsLiteral("UTF-32BE") &&
!preferred.EqualsLiteral("UTF-32LE")) {
// Propagate the error message so that the parser can
@ -375,6 +376,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::GetCharsetFromCompatibilityTag(
!preferred.EqualsLiteral("UTF-16") &&
!preferred.EqualsLiteral("UTF-16BE") &&
!preferred.EqualsLiteral("UTF-16LE") &&
!preferred.EqualsLiteral("UTF-32") &&
!preferred.EqualsLiteral("UTF-32BE") &&
!preferred.EqualsLiteral("UTF-32LE"))
AppendASCIItoUTF16(preferred, aCharset);

View File

@ -85,6 +85,7 @@ iso-2022-kr=ISO-2022-KR
iso-2022-jp=ISO-2022-JP
utf-32be=UTF-32BE
utf-32le=UTF-32LE
utf-32=UTF-32
utf-16be=UTF-16BE
utf-16le=UTF-16LE
utf-16=UTF-16

View File

@ -344,6 +344,7 @@ NS_UCONV_REG_UNREG("x-imap4-modified-utf7", NS_MUTF7TOUNICODE_CID, NS_UNICODETOM
NS_UCONV_REG_UNREG("UTF-16", NS_UTF16TOUNICODE_CID, NS_UNICODETOUTF16_CID)
NS_UCONV_REG_UNREG("UTF-16BE", NS_UTF16BETOUNICODE_CID, NS_UNICODETOUTF16BE_CID)
NS_UCONV_REG_UNREG("UTF-16LE", NS_UTF16LETOUNICODE_CID, NS_UNICODETOUTF16LE_CID)
NS_UCONV_REG_UNREG("UTF-32", NS_UTF32TOUNICODE_CID, NS_UNICODETOUTF32_CID)
NS_UCONV_REG_UNREG("UTF-32BE", NS_UTF32BETOUNICODE_CID, NS_UNICODETOUTF32BE_CID)
NS_UCONV_REG_UNREG("UTF-32LE", NS_UTF32LETOUNICODE_CID, NS_UNICODETOUTF32LE_CID)
NS_UCONV_REG_UNREG("T.61-8bit", NS_T61TOUNICODE_CID, NS_UNICODETOT61_CID)
@ -418,6 +419,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMUTF7ToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF16ToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF16BEToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF16LEToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF32ToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF32BEToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF32LEToUnicode)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF7)
@ -427,6 +429,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF16LE)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF16)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF32BE)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF32LE)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF32)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTSCII)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTamilTTF)
@ -967,6 +970,11 @@ static const nsModuleComponentInfo components[] =
NS_UNICODEDECODER_CONTRACTID_BASE "UTF-16LE",
nsUTF16LEToUnicodeConstructor ,
},
{
DECODER_NAME_BASE "UTF-32" , NS_UTF32TOUNICODE_CID,
NS_UNICODEDECODER_CONTRACTID_BASE "UTF-32",
nsUTF32ToUnicodeConstructor ,
},
{
DECODER_NAME_BASE "UTF-32BE" , NS_UTF32BETOUNICODE_CID,
NS_UNICODEDECODER_CONTRACTID_BASE "UTF-32BE",
@ -1282,7 +1290,12 @@ static const nsModuleComponentInfo components[] =
NS_UNICODEENCODER_CONTRACTID_BASE "UTF-32LE",
nsUnicodeToUTF32LEConstructor,
},
{
{
ENCODER_NAME_BASE "UTF-32" , NS_UNICODETOUTF32_CID,
NS_UNICODEENCODER_CONTRACTID_BASE "UTF-32",
nsUnicodeToUTF32Constructor,
},
{
ENCODER_NAME_BASE "T.61-8bit" , NS_UNICODETOT61_CID,
NS_UNICODEENCODER_CONTRACTID_BASE "T.61-8bit",
nsUnicodeToT61Constructor,

Some files were not shown because too many files have changed in this diff Show More