Merge from CVS trunk to mozilla-central.

--HG--
rename : js/src/jsarray.c => js/src/jsarray.cpp
rename : js/src/jsdbgapi.c => js/src/jsdbgapi.cpp
rename : js/src/jsemit.c => js/src/jsemit.cpp
rename : js/src/jsfun.c => js/src/jsfun.cpp
rename : js/src/jsgc.c => js/src/jsgc.cpp
rename : js/src/jsinterp.c => js/src/jsinterp.cpp
rename : js/src/jsiter.c => js/src/jsiter.cpp
rename : js/src/jsobj.c => js/src/jsobj.cpp
rename : js/src/jsopcode.c => js/src/jsopcode.cpp
rename : js/src/jsstr.c => js/src/jsstr.cpp
This commit is contained in:
jorendorff@mozilla.com 2007-09-17 10:17:44 -04:00
commit ff133bf9c3
184 changed files with 7881 additions and 2423 deletions

View File

@ -154,7 +154,7 @@ var PlacesCommandHook = {
* a <browser> element.
* @param [optional] aParent
* The folder in which to create a new bookmark if the page loaded in
* aBrowser isn't bookmarked yet, defaults to the places root.
* aBrowser isn't bookmarked yet, defaults to the unfiled root.
* @param [optional] aShowEditUI
* whether or not to show the edit-bookmark UI for the bookmark item
* @param [optional] aAnchorElement
@ -183,7 +183,7 @@ var PlacesCommandHook = {
}
catch (e) { }
var parent = aParent != undefined ? aParent : PlacesUtils.placesRootId;
var parent = aParent != undefined ? aParent : PlacesUtils.unfiledRootId;
var descAnno = { name: DESCRIPTION_ANNO, value: description };
var txn = PlacesUtils.ptm.createItem(uri, parent, -1,
title, null, [descAnno]);

View File

@ -816,20 +816,13 @@ function BrowserStartup()
else {
// Create a narrower window for large or wide-aspect displays, to suggest
// side-by-side page view.
if ((screen.availWidth / 2) >= 800)
if (screen.availWidth >= 1600)
defaultWidth = (screen.availWidth / 2) - 20;
defaultHeight = screen.availHeight - 10;
#ifdef MOZ_WIDGET_GTK2
#define USE_HEIGHT_ADJUST
#endif
#ifdef USE_HEIGHT_ADJUST
// On X, we're not currently able to account for the size of the window
// border. Use 28px as a guess (titlebar + bottom window border)
defaultHeight -= 28;
#endif
#ifdef XP_MACOSX
// account for the Mac OS X title bar
defaultHeight -= 22;
#endif
}
document.documentElement.setAttribute("width", defaultWidth);
@ -3689,8 +3682,9 @@ nsBrowserStatusHandler.prototype =
var securityUI = gBrowser.securityUI;
this.securityButton.setAttribute("tooltiptext", securityUI.tooltipText);
getIdentityHandler().checkIdentity(aWebProgress, aRequest, aState);
var lockIcon = document.getElementById("lock-icon");
if (lockIcon)
lockIcon.setAttribute("tooltiptext", securityUI.tooltipText);
},
// simulate all change notifications after switching tabs
@ -5573,201 +5567,3 @@ function showToolbars() {
return false; // Dismiss the notification message
}
/**
* Utility class to handle manipulations of the identity indicators in the UI
*/
function IdentityHandler() {}
IdentityHandler.prototype = {
// Mode strings used to control CSS display
IDENTITY_MODE_IDENTIFIED : "verifiedIdentity", // High-quality identity information
IDENTITY_MODE_DOMAIN_VERIFIED : "verifiedDomain", // Minimal SSL CA-signed domain verification
IDENTITY_MODE_UNKNOWN : "unknownIdentity", // No trusted identity information
// Cache the most recently seen SSLStatus and URI to prevent unnecessary updates
_lastStatus : null,
_lastURI : null,
/**
* Handler for mouseclicks on the "Tell me more about this website" link text
* in the "identity-popup" panel.
*/
handleMoreInfoClick : function(event) {
if (event.button == 0) {
displaySecurityInfo();
event.stopPropagation();
}
},
/**
* Determine the identity of the page being displayed by examining its SSL cert
* (if available) and, if necessary, update the UI to reflect this. Intended to
* be called by an nsIWebProgressListener.
*
* @param nsIWebProgress webProgress
* @param nsIRequest request
* @param PRUint32 state
*/
checkIdentity : function(webProgress, request, state) {
var currentStatus = gBrowser.securityUI
.QueryInterface(Components.interfaces.nsISSLStatusProvider)
.SSLStatus;
var currentURI = gBrowser.currentURI;
if (currentStatus == this._lastStatus && currentURI == this._lastURI) {
// No need to update, this is a no-op check
return;
}
this._lastStatus = currentStatus;
this._lastURI = currentURI;
if (state & Components.interfaces.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
this.setMode(this.IDENTITY_MODE_IDENTIFIED);
else if (state & Components.interfaces.nsIWebProgressListener.STATE_SECURE_HIGH)
this.setMode(this.IDENTITY_MODE_DOMAIN_VERIFIED);
else
this.setMode(this.IDENTITY_MODE_UNKNOWN);
},
/**
* Update the UI to reflect the specified mode, which should be one of the
* IDENTITY_MODE_* constants.
*/
setMode : function(newMode) {
document.getElementById("identity-popup").className = newMode;
document.getElementById("identity-box").className = newMode;
document.getElementById("identity-popup-content-box").className = newMode;
this.setMessages(newMode);
},
/**
* Set up the title and content messages for the identity message bubble, and
* primary UI based on the specified mode, and the details of the SSL cert, where
* applicable
*
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
*/
setMessages : function(newMode) {
var stringBundle = document.getElementById("bundle_browser");
// Initialize the optional strings to empty values
var supplemental = "";
var verifier = "";
if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
var title = stringBundle.getString("identity.domainverified.title");
var encryption_label = stringBundle.getString("identity.encrypted");
var status = this._lastStatus.QueryInterface(Components.interfaces.nsISSLStatus);
var cert = status.serverCert;
// It would be sort of nice to use the CN= field in the cert, since that's
// typically what we want here, but thanks to x509 certs being extensible,
// it's not the only place you have to check, there can be more than one domain,
// et cetera, ad nauseum. We know the cert is valid for location.host, so
// let's just use that, it's what the status bar does too.
var body = this._lastURI.host;
var caOrg = cert.issuerOrganization || cert.issuerCommonName;
verifier = stringBundle.getFormattedString("identity.identified.verifier",
[caOrg]);
supplemental = stringBundle.getString("identity.domainverified.supplemental");
var icon_label = body;
var tooltip = verifier;
}
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
title = stringBundle.getString("identity.identified.title");
encryption_label = stringBundle.getString("identity.encrypted");
// If it's identified, then we can populate the dialog with credentials
status = this._lastStatus.QueryInterface(Components.interfaces.nsISSLStatus);
cert = status.serverCert;
// Pull the basics out with fallback options in case common
// (optional) fields are left blank
body = cert.organization || cert.commonName;
caOrg = cert.issuerOrganization || cert.issuerCommonName;
verifier = tooltip = stringBundle.getFormattedString("identity.identified.verifier",
[caOrg]);
// Now try to extract out supplemental location fields and append
// them, where available. subjectName is a comma-delimited list of
// key=value pairs.
if (cert.subjectName) {
var subjectNameFields = {};
cert.subjectName.split(",").forEach(function(v) {
var field = v.split("=");
this[field[0]] = field[1];
}, subjectNameFields);
if (subjectNameFields.L) // City
supplemental += subjectNameFields.L + "\n";
if (subjectNameFields.ST && subjectNameFields.C) // State and Country
supplemental += stringBundle.getFormattedString("identity.identified.state_and_country",
[subjectNameFields.ST,
subjectNameFields.C]);
else if (subjectNameFields.ST) // State only
supplemental += subjectNameFields.ST;
else if (subjectNameFields.C) // Country only
supplemental += subjectNameFields.C;
// Include country code in top-level label, if we have one
if (subjectNameFields.C)
icon_label = stringBundle.getFormattedString("identity.identified.title_with_country",
[body, subjectNameFields.C]);
else
icon_label = body;
}
}
else {
encryption_label = stringBundle.getString("identity.unencrypted");
title = stringBundle.getString("identity.unknown.title");
body = stringBundle.getString("identity.unknown.body");
icon_label = "";
tooltip = body;
}
// Push the appropriate strings out to the UI
document.getElementById("identity-popup-title").value = title;
document.getElementById("identity-popup-content").textContent = body;
document.getElementById("identity-popup-content-supplemental")
.textContent = supplemental;
document.getElementById("identity-popup-content-verifier")
.textContent = verifier;
document.getElementById("identity-popup-encryption-label")
.textContent = encryption_label;
document.getElementById("identity-box").tooltipText = tooltip;
document.getElementById("identity-icon-label").value = icon_label;
},
/**
* Click handler for the identity-box element in primary chrome.
*/
handleMouseUp : function(event) {
if (event.button != 0)
return; // We only want left-clicks
// Make sure that the display:none style we set in xul is removed now that
// the popup is actually needed
var popup = document.getElementById('identity-popup');
popup.hidden = false;
// Now open the popup, anchored off the primary chrome element
popup.openPopup(document.getElementById('identity-box'), 'after_start');
}
};
var gIdentityHandler;
/**
* Returns the singleton instance of the identity handler class. Should always be
* used instead of referencing the global variable directly or creating new instances
*/
function getIdentityHandler() {
if (!gIdentityHandler)
gIdentityHandler = new IdentityHandler();
return gIdentityHandler;
}

View File

@ -28,7 +28,6 @@
# Joe Hewitt <hewitt@netscape.com>
# Pierre Chanial <chanial@noos.fr>
# Dean Tessman <dean_tessman@hotmail.com>
# Johnathan Nightingale <johnath@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -137,34 +136,6 @@
<popup id="placesContext"/>
<!-- Popup for site identity information -->
<panel id="identity-popup" position="after_start" hidden="true">
<hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box">
<!-- Title Bar -->
<label id="identity-popup-title"/>
<!-- Content area -->
<description id="identity-popup-content"/>
<description id="identity-popup-content-supplemental"/>
<description id="identity-popup-content-verifier"/>
<hbox id="identity-popup-encryption" flex="1">
<vbox>
<image id="identity-popup-encryption-icon"/>
<spacer flex="1"/>
</vbox>
<description id="identity-popup-encryption-label" flex="1"/>
</hbox>
<spacer flex="1"/>
<!-- Footer link to page info -->
<label id="identity-popup-more-info-link"
class="text-link plain"
value="&identity.moreInfoLinkText;"
onclick="getIdentityHandler().handleMoreInfoClick(event);"/>
</vbox>
</hbox>
</panel>
<tooltip id="urlTooltip">
<label crop="center" flex="1"/>
</tooltip>
@ -245,90 +216,66 @@
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
title="&locationItem.title;" class="chromeclass-location">
<hbox id="urlbar-button-box" flex="1">
<textbox id="urlbar" flex="1"
chromedir="&locale.dir;"
type="autocomplete"
autocompletesearch="history"
autocompletepopup="PopupAutoComplete"
completeselectedindex="true"
tabscrolling="true"
showcommentcolumn="true"
showimagecolumn="true"
enablehistory="true"
maxrows="10"
newlines="stripsurroundingwhitespace"
oninput="gBrowser.userTypedValue = this.value"
ontextentered="return handleURLBarCommand(param);"
ontextreverted="return handleURLBarRevert();">
<!-- Use onmouseup instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events -->
<box id="identity-box" align="center"
onmouseup="getIdentityHandler().handleMouseUp(event);">
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
<image id="page-proxy-button"
ondraggesture="PageProxyDragGesture(event);"
tooltiptext="&proxyIcon.tooltip;"/>
<image id="page-proxy-favicon" validate="never"
ondraggesture="PageProxyDragGesture(event);"
onload="this.parentNode.selectedIndex = 1;
event.stopPropagation();"
onerror="gBrowser.addToMissedIconCache(this.src);
this.removeAttribute('src');
this.parentNode.selectedIndex = 0;"
tooltiptext="&proxyIcon.tooltip;"/>
</deck>
<label id="identity-icon-label"/>
</box>
<hbox id="urlbar-icons">
<button type="menu"
style="-moz-user-focus: none"
class="plain"
id="feed-button"
chromedir="&locale.dir;"
onclick="return FeedHandler.onFeedButtonClick(event);">
<menupopup position="after_end"
onpopupshowing="return FeedHandler.buildFeedList(this);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
</button>
<textbox id="urlbar" flex="1"
chromedir="&locale.dir;"
type="autocomplete"
autocompletesearch="history"
autocompletepopup="PopupAutoComplete"
completeselectedindex="true"
tabscrolling="true"
showcommentcolumn="true"
showimagecolumn="true"
enablehistory="true"
maxrows="10"
newlines="stripsurroundingwhitespace"
oninput="gBrowser.userTypedValue = this.value"
ontextentered="return handleURLBarCommand(param);"
ontextreverted="return handleURLBarRevert();">
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
<image id="page-proxy-button"
ondraggesture="PageProxyDragGesture(event);"
tooltiptext="&proxyIcon.tooltip;"/>
<image id="page-proxy-favicon" validate="never"
ondraggesture="PageProxyDragGesture(event);"
onload="this.parentNode.selectedIndex = 1;
event.stopPropagation();"
onerror="gBrowser.addToMissedIconCache(this.src);
this.removeAttribute('src');
this.parentNode.selectedIndex = 0;"
tooltiptext="&proxyIcon.tooltip;"/>
</deck>
<hbox id="urlbar-icons">
<button type="menu"
style="-moz-user-focus: none"
class="plain"
id="feed-button"
chromedir="&locale.dir;"
onclick="return FeedHandler.onFeedButtonClick(event);">
<menupopup position="after_end"
onpopupshowing="return FeedHandler.buildFeedList(this);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
</button>
<image id="lock-icon" onclick="if (event.button == 0) displaySecurityInfo(); event.stopPropagation();"/>
#ifdef MOZ_SAFE_BROWSING
<image id="safebrowsing-urlbar-icon" tooltiptext="&safeb.urlbaricon.tooltip;"
level="safe"
onclick="goDoCommand('safebrowsing-show-warning')" />
<image id="safebrowsing-urlbar-icon" tooltiptext="&safeb.urlbaricon.tooltip;"
level="safe"
onclick="goDoCommand('safebrowsing-show-warning')"/>
#endif
</hbox>
</textbox>
<stack id="go-button-stack">
<vbox>
<!-- These image segments allow the button to stretch nicely
in larger urlbars. -->
<image id="go-button-top"
class="go-button-background"
chromedir="&locale.dir;" />
<image flex="1"
id="go-button-mid-top"
class="go-button-background"
chromedir="&locale.dir;" />
<image flex="1"
id="go-button-mid-bottom"
class="go-button-background"
chromedir="&locale.dir;" />
<image id="go-button-bottom"
class="go-button-background"
chromedir="&locale.dir;" />
</vbox>
<hbox>
<toolbarbutton id="star-button" onclick="if (event.button == 0) PlacesStarButton.onClick(event);"/>
<toolbarbutton id="go-button"
chromedir="&locale.dir;"
label="&goEndCap.label;"
onclick="handleURLBarCommand(event);"
ondragover="nsDragAndDrop.dragOver(event, goButtonObserver);"
ondragdrop="nsDragAndDrop.drop(event, goButtonObserver);"
ondragexit="nsDragAndDrop.dragExit(event, goButtonObserver);"
tooltiptext="&goEndCap.tooltip;"/>
</hbox>
</hbox>
</textbox>
<stack id="go-button-stack" class="endcap">
<box class="endcap-box" chromedir="&locale.dir;"/>
<hbox>
<toolbarbutton id="star-button" onclick="if (event.button == 0) PlacesStarButton.onClick(event);"/>
<toolbarbutton id="go-button" chromedir="&locale.dir;"
label="&goEndCap.label;"
onclick="handleURLBarCommand(event);"
ondragover="nsDragAndDrop.dragOver(event, goButtonObserver);"
ondragdrop="nsDragAndDrop.drop(event, goButtonObserver);"
ondragexit="nsDragAndDrop.dragExit(event, goButtonObserver);"
tooltiptext="&goEndCap.tooltip;"/>
</hbox>
</stack>
</hbox>
</toolbaritem>

View File

@ -2585,26 +2585,38 @@
<binding id="tabbrowser-tabs"
extends="chrome://global/content/bindings/tabbox.xml#tabs">
<content>
<xul:arrowscrollbox anonid="arrowscrollbox" class="tabbrowser-arrowscrollbox" flex="1"
xbl:inherits="smoothscroll" orient="horizontal" style="min-width: 1px;">
<children includes="tab"/>
</xul:arrowscrollbox>
<xul:stack align="center" pack="end" class="tabs-alltabs-stack">
<xul:hbox flex="1" class="tabs-alltabs-box" anonid="alltabs-box"/>
<xul:hbox flex="1" class="tabs-alltabs-box-animate"
anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" type="menu"
anonid="alltabs-button"
tooltipstring="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup"
anonid="alltabs-popup"
position="after_end"/>
</xul:toolbarbutton>
<xul:stack flex="1" class="tabs-stack">
<xul:vbox>
<xul:spacer flex="1"/>
<xul:hbox class="tabs-bottom" align="center"/>
</xul:vbox>
<xul:vbox>
<xul:hbox>
<xul:stack>
<xul:spacer class="tabs-left"/>
</xul:stack>
<xul:arrowscrollbox anonid="arrowscrollbox" orient="horizontal" flex="1"
style="min-width: 1px;" chromedir="&locale.dir;"
class="tabbrowser-arrowscrollbox">
<children/>
</xul:arrowscrollbox>
<xul:stack align="center" pack="end" chromedir="&locale.dir;">
<xul:hbox flex="1" class="tabs-alltabs-box" anonid="alltabs-box"/>
<xul:hbox flex="1" class="tabs-alltabs-box-animate" anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" type="menu" anonid="alltabs-button"
tooltipstring="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup" anonid="alltabs-popup"
position="after_end"/>
</xul:toolbarbutton>
</xul:stack>
<xul:hbox anonid="tabstrip-closebutton" class="tabs-closebutton-box"
align="center" pack="end" chromedir="&locale.dir;">
<xul:toolbarbutton class="close-button tabs-closebutton"/>
</xul:hbox>
</xul:hbox>
<xul:spacer class="tabs-bottom-spacer"/>
</xul:vbox>
</xul:stack>
<xul:hbox anonid="tabstrip-closebutton" class="tabs-closebutton-box"
align="center" pack="end" chromedir="&locale.dir;">
<xul:toolbarbutton class="close-button tabs-closebutton"/>
</xul:hbox>
</content>
<implementation implements="nsITimerCallback, nsIDOMEventListener">
<constructor>
@ -3168,11 +3180,16 @@
extends="chrome://global/content/bindings/tabbox.xml#tab">
<content chromedir="&locale.dir;"
closetabtext="&closeTab.label;">
<xul:hbox class="tab-middle box-inherit" xbl:inherits="align,dir,pack,orient,selected" flex="1">
<xul:image class="tab-icon" xbl:inherits="validate,src=image"/>
<xul:label class="tab-text" xbl:inherits="value=label,accesskey,crop,disabled" flex="1"/>
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox flex="1" class="tab-image-middle" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
</xul:stack>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:hbox>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button"/>
<xul:hbox class="tab-image-right" xbl:inherits="selected"/>
</content>
<implementation>

View File

@ -46,7 +46,7 @@
<binding id="urlbar" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
<content sizetopopup="pref">
<xul:hbox class="autocomplete-textbox-container" flex="1">
<children includes="image|deck|stack|box">
<children includes="image|deck|stack">
<xul:image class="autocomplete-icon" allowevents="true"/>
</children>

View File

@ -157,7 +157,7 @@ var gEditItemOverlay = {
var container = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId);
// only show "All Bookmarks" if the url isn't bookmarked somewhere else
this._element("placesRootItem").hidden = container != PlacesUtils.placesRootId;
this._element("unfiledRootItem").hidden = container != PlacesUtils.unfiledRootId;
// List of recently used folders:
var annos = PlacesUtils.annotations;
@ -479,8 +479,8 @@ var gEditItemOverlay = {
function EIO__getFolderIdFromMenuList() {
var selectedItem = this._folderMenuList.selectedItem
switch (selectedItem.id) {
case "editBMPanel_placesRootItem":
return PlacesUtils.placesRootId;
case "editBMPanel_unfiledRootItem":
return PlacesUtils.unfiledRootId;
case "editBMPanel_bmRootItem":
return PlacesUtils.bookmarksRootId;
case "editBMPanel_toolbarFolderItem":
@ -515,8 +515,8 @@ var gEditItemOverlay = {
}
if (aCheckStaticFolderItems) {
if (aFolderId == PlacesUtils.placesRootId)
return this._element("placesRootItem");
if (aFolderId == PlacesUtils.unfiledRootId)
return this._element("unfiledRootItem");
if (aFolderId == PlacesUtils.bookmarksRootId)
return this._element("bmRootItem");
if (aFolderId == PlacesUtils.toolbarFolderId)
@ -540,7 +540,7 @@ var gEditItemOverlay = {
// Mark the containing folder as recently-used if it isn't the
// "All Bookmarks" root
if (container != PlacesUtils.placesRootId)
if (container != PlacesUtils.unfiledRootId)
this._markFolderAsRecentlyUsed(container);
}

View File

@ -90,7 +90,7 @@
oncommand="gEditItemOverlay.onFolderMenuListCommand();">
<menupopup>
<!-- Static item for special folders -->
<menuitem id="editBMPanel_placesRootItem"
<menuitem id="editBMPanel_unfiledRootItem"
label="&editBookmarkOverlay.allBookmarksFolderItem.label;"
class="menuitem-iconic folder-icon"/>
<menuitem id="editBMPanel_bmRootItem"

View File

@ -36,7 +36,7 @@
# 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 *****
# ***** END LICENSE BLOCK *****
<bindings id="placesMenuBindings"
xmlns="http://www.mozilla.org/xbl"
@ -44,12 +44,12 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="places-menupopup"
<binding id="places-menupopup"
extends="chrome://global/content/bindings/popup.xml#popup">
<implementation>
<constructor><![CDATA[
#if 0
// Support an asyncinit attribute that causes the view to populate
// Support an asyncinit attribute that causes the view to populate
// itself only after the window has been shown. This is to ensure we
// do not regress browser window show time (Ts/Txul)
if (this.hasAttribute("asyncinit")) {
@ -60,7 +60,7 @@
#endif
this._init();
]]></constructor>
<destructor><![CDATA[
this._resultNode = null;
if (this._result) {
@ -77,7 +77,7 @@
// This function should only be called for top-level menus like the bookmarks menu.
// Submenus get their _result and _resultNode from their parents.
if (this.hasAttribute("place")) {
// Do the initial build.
// Do the initial build.
this.place = this.place;
}
]]></body>
@ -103,9 +103,9 @@
this.popupShowingCallback();
]]></body>
</method>
<field name="_selection">null</field>
<method name="setResultAndNode">
<parameter name="result"/>
<parameter name="resultNode"/>
@ -141,7 +141,7 @@
_startMarker and _endMarker are -1. -->
<field name="_startMarker">-1</field>
<field name="_endMarker">-1</field>
<method name="_cleanMenu">
<body><![CDATA[
// Find static menuitems that should go at the start
@ -164,7 +164,7 @@
if ((this._startMarker != -1) && (this._endMarker == -1))
items.push(item);
}
// If static items at the beginning were found, remove all items between
// them and the static content at the end.
for (var i = 0; i < items.length; ++i) {
@ -172,7 +172,7 @@
if (this._endMarker > 0)
--this._endMarker;
}
// If no static items were found at the beginning, remove all items before
// the static items at the end.
if (this._startMarker == -1) {
@ -279,6 +279,23 @@
<field name="_needsBindingAttachment">false</field>
#endif
<field name="_emptyMenuItem">null</field>
<method name="_showEmptyMenuItem">
<body><![CDATA[
if (this._emptyMenuItem) {
this._emptyMenuItem.hidden = false;
return;
}
var label = PlacesUtils.getString("bookmarksMenuEmptyFolder");
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
this._emptyMenuItem = document.createElementNS(XULNS, "menuitem");
this._emptyMenuItem.setAttribute("label", label);
this._emptyMenuItem.setAttribute("disabled", true);
this.appendChild(this._emptyMenuItem);
]]></body>
</method>
<method name="_rebuild">
<body><![CDATA[
// Make sure not to hold onto any references to menu nodes when we
@ -289,7 +306,7 @@
this._DNDObserver._clearOverFolder();
this._cleanMenu();
NS_ASSERT(PlacesUtils.nodeIsContainer(this._resultNode),
"Result-node of a places popup has to be a container node");
@ -310,6 +327,9 @@
var cc = this._resultNode.childCount;
if (cc > 0) {
if (this._emptyMenuItem)
this._emptyMenuItem.hidden = true;
for (var i = 0; i < cc; ++i) {
var child = this._resultNode.getChild(i);
this.insertNewItem(child, null);
@ -318,14 +338,8 @@
else {
// This menu is empty. If there is no static content, add
// an element to show it is empty.
if (this._startMarker == -1 && this._endMarker == -1) {
var label = PlacesUtils.getString("bookmarksMenuEmptyFolder");
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var element = document.createElementNS(XULNS, "menuitem");
element.setAttribute("label", label);
element.setAttribute("disabled", true);
this.appendChild(element);
}
if (this._startMarker == -1 && this._endMarker == -1)
this._showEmptyMenuItem();
}
this._built = true;
]]></body>
@ -355,6 +369,8 @@
var index = this._self._startMarker + 1 + aIndex;
var before = this._self.childNodes[index] || null;
this._self.insertNewItem(aNode, before);
if (this._self._emptyMenuItem)
this._self._emptyMenuItem.hidden = true;
}
else
this._forwardToChildView(aParentNode, "itemInserted", arguments);
@ -366,11 +382,15 @@
if (aParentNode == this._self.getResultNode()) {
var children = this._self.childNodes;
for (var i = 0; i < children.length; i++) {
if (children[i].node == aNode) {
this._self.removeItem(children[i]);
return;
if (!this._self.hasChildNodes() ||
(this._self.childNodes.length == 1 &&
this._self.firstChild == this._self._emptyMenuItem)) {
this._self._showEmptyMenuItem();
}
}
}
}
@ -411,7 +431,7 @@
if (PlacesUtils.nodeIsSeparator(aNode)) {
// nothing to do when a separator changes
return;
}
}
else if (PlacesUtils.nodeIsContainer(aNode)) {
if (PlacesUtils.nodeIsLivemarkContainer(aNode)) {
var folder = aNode.itemId;
@ -481,13 +501,13 @@
var viewerToRebuild = null;
for (var i=0; i < this._self._containerNodesMap.length; i++) {
var node = this._self._containerNodesMap[i].resultNode;
if (node == aContainer)
viewerToRebuild = this._self._containerNodesMap[i].domNode._viewer;
if (isChildOf(node, aContainer))
this._self._containerNodesMap.splice(i,1);
}
if (aContainer.containerOpen) {
if (viewerToRebuild)
viewerToRebuild._built = false;
@ -534,9 +554,9 @@
this.setAttribute("place", val);
var queries = { }, options = { };
PlacesUtils.history.queryStringToQueries(val, queries, { }, options);
if (!queries.value.length)
if (!queries.value.length)
queries.value = [PlacesUtils.history.getNewQuery()];
this._result =
this._result =
PlacesUtils.history.executeQueries(queries.value,
queries.value.length,
options.value);
@ -548,14 +568,14 @@
<!-- nsIPlacesView -->
<property name="hasSelection">
<getter><![CDATA[
<getter><![CDATA[
return this._selection != null;
]]></getter>
</property>
<!-- nsIPlacesView -->
<property name="hasSingleSelection">
<getter><![CDATA[
<getter><![CDATA[
return this.hasSelection;
]]></getter>
</property>
@ -569,7 +589,7 @@
<!-- nsIPlacesView -->
<method name="getRemovableSelectionRanges">
<body><![CDATA[
<body><![CDATA[
return [this.getSelectionNodes()];
]]></body>
</method>
@ -592,7 +612,7 @@
<!-- nsIPlacesView -->
<property name="selectedNode">
<getter><![CDATA[
<getter><![CDATA[
return this.hasSelection ? this._selection : null;
]]></getter>
</property>
@ -607,8 +627,8 @@
<!-- nsIPlacesView -->
<property name="insertionPoint">
<getter><![CDATA[
// By default, the insertion point is at the top level, at the end.
<getter><![CDATA[
// By default, the insertion point is at the top level, at the end.
var index = -1;
var folderId = 0;
if (PlacesUtils.nodeIsFolder(this._resultNode))
@ -637,7 +657,7 @@
<!-- nsIPlacesView -->
<method name="selectAll">
<body><![CDATA[
<body><![CDATA[
// Nothing
]]></body>
</method>
@ -653,7 +673,7 @@
</method>
<field name="_DNDObserver"><![CDATA[({
// Inside the _DNDObserver object's functions, this points to
// Inside the _DNDObserver object's functions, this points to
// the _DNDObserver object. _self points to the menu xbl object.
_self: this,
// Subfolders should be opened when the mouse drags over them, and closed
@ -685,7 +705,7 @@
if (timer == this._overFolder.closeTimer) {
// Only close the submenu if the mouse isn't being dragged over any
// of its child menus.
var draggingOverChild =
var draggingOverChild =
PlacesControllerDragHelper.draggingOverChildNode(this._overFolder.node);
if (draggingOverChild)
this._overFolder.node = null;

View File

@ -1454,6 +1454,13 @@ var PlacesUtils = {
return this._tagRootId;
},
get unfiledRootId() {
if (!("_unfiledRootId" in this))
this._unfiledRootId = this.bookmarks.unfiledRoot;
return this._unfiledRootId;
},
/**
* Set the POST data associated with a URI, if any.
* Used by POST keywords.
@ -1504,8 +1511,9 @@ var PlacesUtils = {
for each (var bk in bmkIds) {
// Find the first folder which isn't a tag container
var parent = this.bookmarks.getFolderIdForItem(bk);
if (parent == this.placesRootId)
if (parent == this.unfiledRootId)
return bk;
var grandparent = this.bookmarks.getFolderIdForItem(parent);
if (grandparent != this.tagRootId &&
!this.annotations.itemHasAnnotation(parent, LMANNO_FEEDURI))

View File

@ -202,7 +202,7 @@ interface nsIPlacesTransactionsService : nsISupports
nsITransaction editItemTitle(in long long id, in AString newTitle);
/**
* Transaction for editting a bookmark's uri.
* Transaction for editing a bookmark's uri.
*
* @param aBookmarkId
* id of the bookmark to edit
@ -225,7 +225,7 @@ interface nsIPlacesTransactionsService : nsISupports
in boolean aLoadInSidebar);
/**
* Transaction for editting a the description of a bookmark or a folder
* Transaction for editing a the description of a bookmark or a folder
*
* @param aItemId
* id of the item to edit
@ -237,7 +237,7 @@ interface nsIPlacesTransactionsService : nsISupports
in AString aDescription);
/**
* Transaction for editting a bookmark's keyword.
* Transaction for editing a bookmark's keyword.
*
* @param id
* id of the bookmark to edit
@ -249,7 +249,7 @@ interface nsIPlacesTransactionsService : nsISupports
in AString newKeyword);
/**
* Transaction for editting the post data associated with a URI
* Transaction for editing the post data associated with a URI
*
* @param aURI
* uri to edit
@ -261,7 +261,7 @@ interface nsIPlacesTransactionsService : nsISupports
in AString aPostData);
/**
* Transaction for editting a live bookmark's site URI.
* Transaction for editing a live bookmark's site URI.
*
* @param aFolderId
* id of the livemark
@ -283,7 +283,7 @@ interface nsIPlacesTransactionsService : nsISupports
nsITransaction editLivemarkFeedURI(in long long folderId, in nsIURI uri);
/**
* Transaction for editting a bookmark's microsummary.
* Transaction for editing a bookmark's microsummary.
*
* @param aItemId
* id of the bookmark to edit

View File

@ -208,6 +208,7 @@ PROT_PhishMsgDisplayerBase.prototype.browserSelected = function() {
this.messageShouldShow_ = true;
}
this.hideLockIcon_(); // Comes back when we are unselected or unloaded
this.addWarningInUrlbar_(); // Goes away when we are unselected or unloaded
// messageShouldShow might be false if the user dismissed the warning,
@ -233,6 +234,7 @@ PROT_PhishMsgDisplayerBase.prototype.explicitShow = function() {
*/
PROT_PhishMsgDisplayerBase.prototype.browserUnselected = function() {
this.removeWarningInUrlbar_();
this.unhideLockIcon_();
if (this.messageShowing_)
this.hideMessage_();
}
@ -288,6 +290,7 @@ PROT_PhishMsgDisplayerBase.prototype.done = function() {
// If we were started, we must be the current problem, so these things
// must be showing
this.removeWarningInUrlbar_();
this.unhideLockIcon_();
// Could be though that they've closed the warning dialog
if (this.messageShowing_)
@ -324,6 +327,28 @@ PROT_PhishMsgDisplayerBase.prototype.removeIfExists_ = function(orig,
return orig;
}
/**
* We don't want to confuse users if they land on a phishy page that uses
* SSL, so ensure that the lock icon never shows when we're showing our
* warning.
*/
PROT_PhishMsgDisplayerBase.prototype.hideLockIcon_ = function() {
var lockIcon = this.doc_.getElementById("lock-icon");
if (!lockIcon)
return;
lockIcon.hidden = true;
}
/**
* Ensure they can see it after our warning is finished.
*/
PROT_PhishMsgDisplayerBase.prototype.unhideLockIcon_ = function() {
var lockIcon = this.doc_.getElementById("lock-icon");
if (!lockIcon)
return;
lockIcon.hidden = false;
}
/**
* This method makes our warning icon visible in the location bar. It will
* be removed only when the problematic document is navigated awy from

View File

@ -102,21 +102,8 @@
</xul:textbox>
</xul:hbox>
<xul:stack class="search-go-button-stack">
<xul:vbox>
<!-- These image segments allow the button's gradient to stretch
nicely in larger urlbars. -->
<xul:image class="search-go-button-top search-go-button-bkgnd"
chromedir="&locale.dir;"/>
<xul:image flex="1"
class="search-go-button-mid-top search-go-button-bkgnd"
chromedir="&locale.dir;"/>
<xul:image flex="1"
class="search-go-button-mid-bottom search-go-button-bkgnd"
chromedir="&locale.dir;"/>
<xul:image class="search-go-button-bottom search-go-button-bkgnd"
chromedir="&locale.dir;"/>
</xul:vbox>
<xul:stack class="search-go-button-stack endcap">
<xul:box class="endcap-box" chromedir="&locale.dir;"/>
<xul:toolbarbutton class="search-go-button"
anonid="search-go-button"
chromedir="&locale.dir;"

View File

@ -350,5 +350,3 @@
<!ENTITY editBookmark.done.label "Done">
<!ENTITY editBookmark.delete.label "Delete">
<!ENTITY identity.moreInfoLinkText "Tell me more about this web site...">

View File

@ -97,20 +97,3 @@ chromelessWindow.warningMessage=The web site at %S has hidden your toolbars.
chromelessWindow.warningNoLocation=This web site has hidden your toolbars.
chromelessWindow.showToolbarsButton=Show Toolbars
chromelessWindow.accessKey=S
# Identity information
identity.domainverified.title=Location Verified
identity.domainverified.body=You are currently visiting:
identity.domainverified.supplemental=Information identifying the owner of this site may not have been validated.
identity.identified.title=Identity Verified
identity.identified.body=This website is owned by:
identity.identified.verifier=Verified by: %S
identity.identified.state_and_country=%S, %S
identity.identified.title_with_country=%S (%S)
identity.unknown.title=Identity Unknown
identity.unknown.body=This web site does not supply identity information.
identity.encrypted=Your connection to this web site is encrypted to prevent eavesdropping.
identity.unencrypted=Your connection to this web site is not encrypted.

View File

@ -827,7 +827,7 @@ toolbar[iconsize="small"] #paste-button:hover:active {
#urlbar {
margin-top: 5px;
margin-bottom: 5px;
-moz-margin-start: 0px;
-moz-margin-start: 4px;
-moz-margin-end: 0px;
width: 7em;
min-width: 7em;
@ -879,6 +879,46 @@ toolbar[iconsize="small"] #paste-button:hover:active {
background: url("chrome://browser/skin/Secure-background.gif") #FFFED8 repeat-x;
}
#urlbar #lock-icon {
height: 18px;
margin: -1px;
}
#urlbar[level="high"] #lock-icon {
list-style-image: url("chrome://browser/skin/Secure.png");
-moz-image-region: rect(0px, 18px, 18px, 0px);
}
#urlbar[level="high"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
}
#urlbar[level="high"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
}
#urlbar[level="low"] #lock-icon {
list-style-image: url("chrome://browser/skin/Secure.png");
-moz-image-region: rect(0px, 18px, 18px, 0px);
}
#urlbar[level="low"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
}
#urlbar[level="low"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
}
#urlbar[level="broken"] #lock-icon {
list-style-image: url("chrome://browser/skin/Security-broken.png");
-moz-image-region: rect(0px, 18px, 18px, 0px);
}
#urlbar[level="broken"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
}
#urlbar[level="broken"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
}
#urlbar-container {
-moz-padding-end: 5px;
}
@ -1227,7 +1267,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
.tabbrowser-tab {
-moz-binding: url("chrome://browser/skin/tabbrowser/tabbrowserBindings.xml#tabbrowser-tab") !important;
-moz-appearance: none;
color: #383838;
-moz-box-pack: center;
@ -1336,7 +1375,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
.tabbrowser-tabs {
-moz-binding: url("chrome://browser/skin/tabbrowser/tabbrowserBindings.xml#tabbrowser-tabs");
border: none;
padding: 0;
margin: 0;
@ -1662,116 +1700,3 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight !important;
}
/* ::::: Identity Indicator Styling ::::: */
/* Location bar visuals*/
#identity-box {
/* Extend our margins out so that our highlight/separator bar covers the
location bar properly */
margin: -1px 0 -2px;
padding: 1px 2px 2px 0;
border-right: 1px solid #888;
background-color: white;
opacity: 0.9;
}
#identity-box:hover {
opacity: 1.0;
}
#identity-box.verifiedIdentity {
background-color: #BFA;
}
#urlbar[level="high"] > #identity-box,
#urlbar[level="low"] > #identity-box {
/* urlbar adds padding when security level is set, which we need to
counteract here so that we still fill the background. */
margin: -2px;
padding: 1px 2px;
}
#identity-icon-label {
padding: 1px 2px 2px;
margin: 0;
color: black;
vertical-align: middle;
}
.unknownIdentity > #identity-icon-label {
display: none;
}
/* Popup Icons */
#identity-popup-icon {
height: 64px;
width: 64px;
padding: 0;
margin: 10px 0 0;
list-style-image: url("chrome://browser/skin/identity.png");
-moz-image-region: rect(0px, 64px, 64px, 0px);
}
.verifiedDomain > #identity-popup-container > #identity-popup-icon {
-moz-image-region: rect(64px, 64px, 128px, 0px);
}
.verifiedIdentity > #identity-popup-container > #identity-popup-icon {
-moz-image-region: rect(128px, 64px, 192px, 0px);
}
/* Popup Title */
#identity-popup-title {
font-size: 120%;
font-weight: bold;
}
.verifiedIdentity > #identity-popup-title {
color: #6A6;
}
.unknownIdentity > #identity-popup-title {
color: #999;
}
.verifiedDomain > #identity-popup-title {
color: black;
}
/* Popup Body Text */
#identity-popup-content-box > description,
#identity-popup-encryption-label {
white-space: -moz-pre-wrap;
color: black;
padding-left: 10px;
}
#identity-popup-content {
padding-top: 5px;
margin-bottom: 0;
max-width: 200px;
}
.verifiedIdentity > #identity-popup-content,
.verifiedDomain > #identity-popup-content {
font-size: 140%;
font-weight: bold;
max-width: 300px;
}
#identity-popup-encryption {
margin: 10px 0;
}
.verifiedIdentity > #identity-popup-encryption > * > #identity-popup-encryption-icon,
.verifiedDomain > #identity-popup-encryption > * >#identity-popup-encryption-icon {
list-style-image: url("chrome://browser/skin/Secure.png");
-moz-image-region: rect(0px, 18px, 18px, 0px);
}
/* Popup Bounding Box */
#identity-popup-container {
background-image: none;
background-color: white;
min-width: 280px;
padding: 10px;
}

View File

@ -10,7 +10,6 @@ classic.jar:
skin/classic/browser/find.png
skin/classic/browser/find-bar-background.png
skin/classic/browser/Go.png
skin/classic/browser/identity.png
skin/classic/browser/Info.png
skin/classic/browser/page-livemarks.png
skin/classic/browser/livemark-item.png
@ -74,7 +73,6 @@ classic.jar:
skin/classic/browser/tabbrowser/tab-arrow-end.png (tabbrowser/tab-arrow-end.png)
skin/classic/browser/tabbrowser/tab-arrow-end-bkgnd.png (tabbrowser/tab-arrow-end-bkgnd.png)
skin/classic/browser/tabbrowser/tab-arrow-end-bkgnd-animate.png (tabbrowser/tab-arrow-end-bkgnd-animate.png)
skin/classic/browser/tabbrowser/tabbrowserBindings.xml (tabbrowser/tabbrowserBindings.xml)
skin/classic/browser/tabbrowser/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
skin/classic/browser/tabbrowser/tab-left.png (tabbrowser/tab-left.png)

View File

@ -1,69 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % tabBrowserDTD SYSTEM "chrome://browser/locale/tabbrowser.dtd" >
%tabBrowserDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<bindings id="globalBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="tabbrowser-tab" extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content chromedir="&locale.dir;"
closetabtext="&closeTab.label;">
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox flex="1" class="tab-image-middle" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
</xul:stack>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:hbox>
<xul:toolbarbutton anonid="close-button" class="tab-close-button" tabindex="-1"/>
<xul:hbox class="tab-image-right" xbl:inherits="selected"/>
</content>
</binding>
<binding id="tabbrowser-tabs"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tabs">
<content>
<xul:stack flex="1" class="tabs-stack">
<xul:vbox>
<xul:spacer flex="1"/>
<xul:hbox class="tabs-bottom" align="center"/>
</xul:vbox>
<xul:vbox>
<xul:hbox>
<xul:stack>
<xul:spacer class="tabs-left"/>
</xul:stack>
<xul:arrowscrollbox anonid="arrowscrollbox" orient="horizontal" flex="1" style="min-width: 1px;" class="tabbrowser-arrowscrollbox">
<children/>
</xul:arrowscrollbox>
<xul:stack align="center" pack="end">
<xul:hbox flex="1" class="tabs-alltabs-box"
anonid="alltabs-box"/>
<xul:hbox flex="1" class="tabs-alltabs-box-animate"
anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button"
type="menu"
anonid="alltabs-button"
tooltipstring="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup"
anonid="alltabs-popup" position="after_end"/>
</xul:toolbarbutton>
</xul:stack>
<xul:hbox class="tabs-closebutton-box" align="center" pack="end" anonid="tabstrip-closebutton">
<xul:toolbarbutton class="close-button tabs-closebutton"/>
</xul:hbox>
</xul:hbox>
<xul:spacer class="tabs-bottom-spacer"/>
</xul:vbox>
</xul:stack>
</content>
</binding>
</bindings>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -850,7 +850,7 @@ toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active {
margin-bottom: 2px;
margin-top: 2px;
-moz-margin-end: 0px;
-moz-margin-start: 0px;
-moz-margin-start: 3px;
width: 7em;
min-width: 7em;
@ -1001,6 +1001,40 @@ statusbarpanel#statusbar-display {
border-top: 1px solid GrayText;
}
/* ::::: endcaps ::::: */
.endcap {
padding: 2px 0px 2px 0px;
}
.endcap-box {
-moz-border-top-colors: #96969D;
-moz-border-right-colors: #96969D;
-moz-border-bottom-colors: #96969D;
-moz-border-radius: 0 4px 4px 0;
border: 1px solid;
border-left: none;
background-image: url("chrome://browser/skin/endcap-bkgnd.png");
background-repeat: repeat-x;
background-position: 50% 50%;
}
toolbar:not([mode="text"]) .endcap:hover > .endcap-box {
background-image: url("chrome://browser/skin/endcap-bkgnd-hover.png");
}
.endcap-box[chromedir="rtl"] {
-moz-border-radius: 4px 0 0 4px;
-moz-border-left-colors: #96969D;
border-left: 1px solid;
border-right: none;
}
toolbar[mode="text"] .endcap-box {
border: none;
background-image: none;
}
/* ::::: go button ::::: */
/* In text icon mode, the Go button scales independently of the location bar,
@ -1014,31 +1048,49 @@ toolbar[mode="text"] #urlbar-button-box {
-moz-box-align: center;
}
toolbar[mode="text"] #go-button {
-moz-margin-start: 5px;
#go-button {
-moz-appearance: none;
list-style-image: url("chrome://browser/skin/Go-arrow.png");
-moz-image-region: rect(0px 25px 22px 0px);
border: none;
padding: 0;
}
toolbar[mode="text"] #go-button,
toolbar[mode="text"] #go-button-stack .go-button-background {
list-style-image: none;
background-image: none;
#go-button[chromedir="rtl"] {
list-style-image: url("chrome://browser/skin/Go-arrow-rtl.png");
}
toolbar[mode="text"] #go-button {
-moz-appearance: toolbarbutton;
-moz-margin-start: 5px;
padding: 3px;
}
toolbar[mode="text"] #go-button-stack {
padding: 0;
}
#go-button-stack {
padding: 2px 0px 2px 0px;
#go-button > .toolbarbutton-icon {
margin: 0;
}
#go-button:hover {
-moz-image-region: rect(0px 50px 22px 25px);
}
#go-button:hover:active {
-moz-image-region: rect(0px 100px 22px 75px);
}
#go-button[disabled="true"] {
-moz-image-region: rect(0px 75px 22px 50px);
}
toolbar:not([mode="text"]) #go-button,
#palette-box #go-button {
-moz-appearance: none;
list-style-image: url("chrome://browser/skin/Go-arrow.png");
-moz-image-region: rect(0px 25px 22px 0px);
border: none;
padding: 0;
toolbar:not([mode="text"]) .search-go-button,
toolbarpaletteitem:not([place="toolbar"]) #go-button,
toolbarpaletteitem:not([place="toolbar"]) .search-go-button {
-moz-binding: url(chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image);
}
/* star button */
@ -1055,129 +1107,12 @@ toolbar:not([mode="text"]) #star-button[starred="true"],
list-style-image: url("chrome://browser/skin/places/pageStarred.png");
}
#go-button[chromedir="rtl"] {
list-style-image: url("chrome://browser/skin/Go-arrow-rtl.png");
}
#go-button-top {
list-style-image: url("chrome://browser/skin/Go-bkgnd.png");
-moz-image-region: rect(0px, 25px, 10px, 0px);
height: 10px;
}
/* GTK does not stretch image regions properly, so use background
images instead. See bugs 351764 and 254659. */
#go-button-mid-top {
background-image: url("chrome://browser/skin/Go-mid-top.png");
}
#go-button-mid-bottom {
background-image: url("chrome://browser/skin/Go-mid-bottom.png");
}
#go-button-bottom {
list-style-image: url("chrome://browser/skin/Go-bkgnd.png");
-moz-image-region: rect(12px, 25px, 22px, 0px);
height: 10px;
}
#go-button-top[chromedir="rtl"],
#go-button-bottom[chromedir="rtl"] {
list-style-image: url("chrome://browser/skin/Go-bkgnd-rtl.png");
}
#go-button-mid-top[chromedir="rtl"] {
background-image: url("chrome://browser/skin/Go-mid-top-rtl.png");
}
#go-button-mid-bottom[chromedir="rtl"] {
background-image: url("chrome://browser/skin/Go-mid-bottom-rtl.png");
}
#go-button-stack:hover #go-button-top {
-moz-image-region: rect(0px, 50px, 10px, 25px);
}
#go-button-stack:hover #go-button-mid-top,
#go-button-stack:hover #go-button-mid-bottom {
background-position: -25px 0px;
}
#go-button-stack:hover #go-button-bottom {
-moz-image-region: rect(12px, 50px, 22px, 25px);
}
/* Disabled images are not used. */
#go-button-stack[disabled="true"] #go-button-top {
-moz-image-region: rect(0px, 75px, 10px, 50px) !important;
}
#go-button-stack[disabled="true"] #go-button-mid-top,
#go-button-stack[disabled="true"] #go-button-mid-bottom {
background-position: -50px 0px;
}
#go-button-stack[disabled="true"] #go-button-bottom {
-moz-image-region: rect(12px, 75px, 22px, 50px) !important;
}
#go-button-stack:hover:active #go-button-top {
-moz-image-region: rect(0px, 100px, 10px, 75px);
}
#go-button-stack:hover:active #go-button-mid-top,
#go-button-stack:hover:active #go-button-mid-bottom {
background-position: -75px;
}
#go-button-stack:hover:active #go-button-bottom {
-moz-image-region: rect(12px, 100px, 22px, 75px);
}
toolbar[mode="text"] #go-button-top,
toolbar[mode="text"] #go-button-mid-top,
toolbar[mode="text"] #go-button-mid-bottom,
toolbar[mode="text"] #go-button-bottom {
display: none;
}
toolbar[mode="text"] #go-button > .toolbarbutton-text {
display: -moz-box !important;
-moz-margin-start: 4px !important;
}
/* Not used. */
#go-button:not([disabled="true"]):hover {
-moz-image-region: rect(0px 50px 22px 25px);
}
#go-button[disabled="true"] {
-moz-image-region: rect(0px 75px 22px 50px);
}
#go-button:not([disabled="true"]):hover:active {
-moz-image-region: rect(0px 100px 22px 75px);
}
#go-button > .toolbarbutton-icon {
margin: 0;
}
toolbar:not([mode="text"]) #go-button,
toolbar:not([mode="text"]) .search-go-button,
toolbarpaletteitem:not([place="toolbar"]) #go-button,
toolbarpaletteitem:not([place="toolbar"]) .search-go-button {
-moz-binding: url(chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-image);
}
/* ::::: content area ::::: */
#sidebar {
background-color: Window;
}
/* ::::: content area ::::: */
#status-bar {
border-top: none;
}
@ -1263,7 +1198,6 @@ toolbar[mode="text"] #navigator-throbber[busy="true"] {
*/
.tabbrowser-tabs {
-moz-binding: url("chrome://browser/skin/tabbrowser/tabbrowserBindings.xml#tabbrowser-tabs") !important;
padding-top: 0px;
background: -moz-dialog url("chrome://browser/skin/tabbrowser/tabbrowser-tabs-bkgnd.png") !important;
-moz-padding-start: 0px;
@ -1279,7 +1213,6 @@ toolbar[mode="text"] #navigator-throbber[busy="true"] {
.tabbrowser-tab {
-moz-appearance: none !important;
-moz-binding: url("chrome://browser/skin/tabbrowser/tabbrowserBindings.xml#tabbrowser-tab") !important;
background: transparent !important;
margin: 0px 0px 1px !important;
padding: 0px !important;
@ -1809,6 +1742,43 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
color: #000000;
}
#urlbar[level="high"] #lock-icon {
-moz-image-region: rect(0px, 18px, 18px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="high"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="high"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="low"] #lock-icon {
-moz-image-region: rect(0px, 18px, 18px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="low"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="low"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
list-style-image: url("chrome://browser/skin/Secure.png");
}
#urlbar[level="broken"] #lock-icon {
-moz-image-region: rect(0px, 18px, 18px, 0px);
list-style-image: url("chrome://browser/skin/Security-broken.png");
}
#urlbar[level="broken"] #lock-icon:hover {
-moz-image-region: rect(18px, 18px, 36px, 0px);
list-style-image: url("chrome://browser/skin/Security-broken.png");
}
#urlbar[level="broken"] #lock-icon:active {
-moz-image-region: rect(36px, 18px, 54px, 0px);
list-style-image: url("chrome://browser/skin/Security-broken.png");
}
%ifdef MOZ_WIDGET_GTK2
#urlbar > .autocomplete-textbox-container {
-moz-binding: url(chrome://browser/skin/browser.xml#autocomplete-security-wrapper);
@ -1921,105 +1891,3 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
.bookmark-item[dragover-bottom="true"] {
-moz-border-bottom-colors: #000000;
}
/* ::::: Identity Indicator Styling ::::: */
/* Location bar visuals*/
#identity-box {
border-right: 1px solid #888;
background-color: white;
opacity: 0.9;
}
#identity-box:hover {
opacity: 1.0;
}
#identity-box.verifiedIdentity {
background-color: #BFA;
}
#identity-icon-label {
padding: 1px 2px 2px;
margin: 0;
color: black;
vertical-align: middle;
}
.unknownIdentity > #identity-icon-label {
display: none;
}
/* Popup Icons */
#identity-popup-icon {
height: 64px;
width: 64px;
padding: 0;
margin: 10px 0 0;
list-style-image: url("chrome://browser/skin/identity.png");
-moz-image-region: rect(0px, 64px, 64px, 0px);
}
.verifiedDomain > #identity-popup-container > #identity-popup-icon {
-moz-image-region: rect(64px, 64px, 128px, 0px);
}
.verifiedIdentity > #identity-popup-container > #identity-popup-icon {
-moz-image-region: rect(128px, 64px, 192px, 0px);
}
/* Popup Title */
#identity-popup-title {
font-size: 120%;
font-weight: bold;
}
.verifiedIdentity > #identity-popup-title {
color: #6A6;
}
.unknownIdentity > #identity-popup-title {
color: #999;
}
.verifiedDomain > #identity-popup-title {
color: black;
}
/* Popup Body Text */
#identity-popup-content-box > description,
#identity-popup-encryption-label {
white-space: -moz-pre-wrap;
color: black;
padding-left: 10px;
}
#identity-popup-content {
padding-top: 5px;
margin-bottom: 0;
max-width: 200px;
}
.verifiedIdentity > #identity-popup-content,
.verifiedDomain > #identity-popup-content {
font-size: 140%;
font-weight: bold;
max-width: 300px;
}
#identity-popup-encryption {
margin: 10px 0;
}
.verifiedIdentity > #identity-popup-encryption > * > #identity-popup-encryption-icon,
.verifiedDomain > #identity-popup-encryption > * >#identity-popup-encryption-icon {
list-style-image: url("chrome://browser/skin/Secure.png");
-moz-image-region: rect(0px, 18px, 18px, 0px);
}
/* Popup Bounding Box */
#identity-popup-container {
background-image: none;
background-color: white;
min-width: 280px;
padding: 10px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -2,9 +2,10 @@ classic.jar:
% skin browser classic/1.0 %skin/classic/browser/
* skin/classic/browser/browser.css (browser.css)
skin/classic/browser/browser.xml
skin/classic/browser/endcap-bkgnd.png
skin/classic/browser/endcap-bkgnd-hover.png
* skin/classic/browser/engineManager.css (engineManager.css)
skin/classic/browser/Info.png
skin/classic/browser/identity.png
skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/page-livemarks.png
@ -21,21 +22,9 @@ classic.jar:
skin/classic/browser/Toolbar-small.png
skin/classic/browser/Go-arrow.png
skin/classic/browser/Go-arrow-rtl.png
skin/classic/browser/Go-bkgnd.png
skin/classic/browser/Go-bkgnd-rtl.png
skin/classic/browser/Go-mid-top.png
skin/classic/browser/Go-mid-top-rtl.png
skin/classic/browser/Go-mid-bottom.png
skin/classic/browser/Go-mid-bottom-rtl.png
* skin/classic/browser/searchbar.css (searchbar.css)
skin/classic/browser/Search-glass.png
skin/classic/browser/Search-glass-rtl.png
skin/classic/browser/Search-bkgnd.png
skin/classic/browser/Search-bkgnd-rtl.png
skin/classic/browser/Search-mid-top.png
skin/classic/browser/Search-mid-top-rtl.png
skin/classic/browser/Search-mid-bottom.png
skin/classic/browser/Search-mid-bottom-rtl.png
skin/classic/browser/Search-provider-bkgnd.png
skin/classic/browser/Search-provider-mid-top.png
skin/classic/browser/Search-provider-mid-bottom.png
@ -86,7 +75,6 @@ classic.jar:
skin/classic/browser/tabbrowser/tab-arrow-start-bkgnd-disabled.png (tabbrowser/tab-arrow-start-bkgnd-disabled.png)
skin/classic/browser/tabbrowser/tab-arrow-start-bkgnd-enabled.png (tabbrowser/tab-arrow-start-bkgnd-enabled.png)
skin/classic/browser/tabbrowser/tab-arrow-start-bkgnd-hover.png (tabbrowser/tab-arrow-start-bkgnd-hover.png)
skin/classic/browser/tabbrowser/tabbrowserBindings.xml (tabbrowser/tabbrowserBindings.xml)
skin/classic/browser/tabbrowser/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
skin/classic/browser/tabbrowser/tab-left.png (tabbrowser/tab-left.png)

View File

@ -1,11 +1,13 @@
/* *** winstripe *** */
%ifdef MOZ_WIDGET_GTK2
#searchbar {
-moz-margin-start: 3px;
}
%endif
.searchbar-box {
-moz-padding-end: 5px;
}
.searchbar-textbox {
min-height: 22px;
width: 4em;
@ -133,7 +135,8 @@ toolbar[mode="text"] .searchbar-box {
.search-go-button {
list-style-image: url("chrome://browser/skin/Search-glass.png");
border: 0px !important;
-moz-image-region: rect(0px 25px 22px 0px);
border: 0px;
padding: 0px;
-moz-appearance: none;
}
@ -142,110 +145,6 @@ toolbar[mode="text"] .searchbar-box {
list-style-image: url("chrome://browser/skin/Search-glass-rtl.png");
}
.search-go-button-stack {
padding: 2px 0px 2px 0px;
-moz-padding-end: 5px;
}
toolbar[mode="text"] .search-go-button {
-moz-margin-start: 5px;
padding: 3px;
-moz-appearance: toolbarbutton;
}
toolbar[mode="text"] .search-go-button-stack {
padding: 0px;
}
toolbar[mode="text"] .search-go-button,
toolbar[mode="text"] .search-go-button-stack .search-go-button-bkgnd {
background-image: none;
list-style-image: none;
width: auto;
}
.search-go-button-top {
list-style-image: url("chrome://browser/skin/Search-bkgnd.png");
-moz-image-region: rect(0px, 25px, 10px, 0px);
height: 10px;
}
/* GTK does not stretch image regions properly, so use background
images instead. See bugs 351764 and 254659. */
.search-go-button-mid-top {
background-image: url("chrome://browser/skin/Search-mid-top.png");
}
.search-go-button-mid-bottom {
background-image: url("chrome://browser/skin/Search-mid-bottom.png");
}
.search-go-button-bottom {
list-style-image: url("chrome://browser/skin/Search-bkgnd.png");
-moz-image-region: rect(12px, 25px, 22px, 0px);
height: 10px;
}
.search-go-button-top[chromedir="rtl"],
.search-go-button-bottom[chromedir="rtl"] {
list-style-image: url("chrome://browser/skin/Search-bkgnd-rtl.png");
}
.search-go-button-mid-top[chromedir="rtl"] {
background-image: url("chrome://browser/skin/Search-mid-top-rtl.png");
}
.search-go-button-mid-bottom[chromedir="rtl"] {
background-image: url("chrome://browser/skin/Search-mid-bottom-rtl.png");
}
.search-go-button-stack:hover .search-go-button-top {
-moz-image-region: rect(0px, 50px, 10px, 25px);
}
.search-go-button-stack:hover .search-go-button-mid-top,
.search-go-button-stack:hover .search-go-button-mid-bottom {
background-position: -25px 0px;
}
.search-go-button-stack:hover .search-go-button-bottom {
-moz-image-region: rect(12px, 50px, 22px, 25px);
}
/* Disabled images are not used. */
.search-go-button-stack[disabled="true"] .search-go-button-top {
-moz-image-region: rect(0px, 75px, 10px, 50px);
}
.search-go-button-stack[disabled="true"] .search-go-button-mid-top,
.search-go-button-stack[disabled="true"] .search-go-button-mid-bottom {
background-position: -50px 0px;
}
.search-go-button-stack[disabled="true"] .search-go-button-bottom {
-moz-image-region: rect(12px, 75px, 22px, 50px);
}
.search-go-button-stack:hover:active .search-go-button-top {
-moz-image-region: rect(0px, 100px, 10px, 75px);
}
.search-go-button-stack:hover:active .search-go-button-mid-top,
.search-go-button-stack:hover:active .search-go-button-mid-bottom {
background-position: -75px 0px;
}
.search-go-button-stack:hover:active .search-go-button-bottom {
-moz-image-region: rect(12px, 100px, 22px, 75px);
}
.search-go-button {
-moz-image-region: rect(0px 25px 22px 0px);
}
.search-go-button:hover {
-moz-image-region: rect(0px 50px 22px 25px);
}
@ -258,8 +157,24 @@ toolbar[mode="text"] .search-go-button-stack .search-go-button-bkgnd {
-moz-image-region: rect(0px, 100px, 22px, 75px);
}
toolbar[mode="text"] .search-go-button {
-moz-margin-start: 5px;
padding: 3px;
-moz-appearance: toolbarbutton;
}
toolbar[mode="text"] .search-go-button-stack {
padding: 0px;
}
toolbar[mode="text"] .search-go-button {
background-image: none;
list-style-image: none;
width: auto;
}
.search-go-button > .toolbarbutton-icon {
margin: 0px !important;
margin: 0px;
}
.searchbar-engine-menuitem[selected="true"] > .menu-iconic-text {

View File

@ -1,75 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % tabBrowserDTD SYSTEM "chrome://browser/locale/tabbrowser.dtd" >
%tabBrowserDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<bindings id="globalBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="tabbrowser-tab" extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content chromedir="&locale.dir;"
closetabtext="&closeTab.label;">
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox flex="1" class="tab-image-middle" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
</xul:stack>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:hbox>
<xul:toolbarbutton anonid="close-button" class="tab-close-button" tabindex="-1"/>
<xul:hbox class="tab-image-right" xbl:inherits="selected"/>
</content>
</binding>
<binding id="tabbrowser-tabs"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tabs">
<content>
<xul:stack flex="1" class="tabs-stack">
<xul:vbox>
<xul:spacer flex="1"/>
<xul:hbox class="tabs-bottom" align="center"/>
</xul:vbox>
<xul:vbox>
<xul:hbox>
<xul:stack>
<xul:spacer class="tabs-left"/>
</xul:stack>
<xul:arrowscrollbox anonid="arrowscrollbox"
orient="horizontal"
flex="1"
style="min-width: 1px;"
chromedir="&locale.dir;"
class="tabbrowser-arrowscrollbox">
<children/>
</xul:arrowscrollbox>
<xul:stack align="center" pack="end" chromedir="&locale.dir;">
<xul:hbox flex="1"
class="tabs-alltabs-box"
anonid="alltabs-box"/>
<xul:hbox flex="1" class="tabs-alltabs-box-animate"
anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" type="menu"
anonid="alltabs-button"
tooltipstring="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup"
anonid="alltabs-popup" position="after_end"/>
</xul:toolbarbutton>
</xul:stack>
<xul:hbox anonid="tabstrip-closebutton" class="tabs-closebutton-box"
align="center" pack="end" chromedir="&locale.dir;">
<xul:toolbarbutton class="close-button tabs-closebutton"/>
</xul:hbox>
</xul:hbox>
<xul:spacer class="tabs-bottom-spacer"/>
</xul:vbox>
</xul:stack>
</content>
</binding>
</bindings>

View File

@ -148,6 +148,7 @@ MOZ_PLACES_BOOKMARKS = @MOZ_PLACES_BOOKMARKS@
MOZ_STORAGE = @MOZ_STORAGE@
MOZ_SAFE_BROWSING = @MOZ_SAFE_BROWSING@
MOZ_URL_CLASSIFIER = @MOZ_URL_CLASSIFIER@
MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
MOZ_MORK = @MOZ_MORK@
MOZ_MORKREADER = @MOZ_MORKREADER@
MOZ_NO_XPCOM_OBSOLETE = @MOZ_NO_XPCOM_OBSOLETE@

View File

@ -4162,6 +4162,7 @@ MOZ_XSLT_STANDALONE=
MOZ_XTF=1
MOZ_XUL=1
MOZ_XUL_APP=1
MOZ_ZIPWRITER=1
NS_PRINTING=1
NECKO_COOKIES=1
NECKO_DISK_CACHE=1
@ -4279,6 +4280,7 @@ basic)
MOZ_XPFE_COMPONENTS=
MOZ_XPINSTALL=
MOZ_XTF=
MOZ_ZIPWRITER=
NECKO_DISK_CACHE=
NECKO_PROTOCOLS_DEFAULT="about data http file res"
NECKO_SMALL_BUFFERS=1
@ -4329,6 +4331,7 @@ minimal)
MOZ_XPINSTALL=
MOZ_XTF=
MOZ_XUL=
MOZ_ZIPWRITER=
MOZ_RDF=
NECKO_DISK_CACHE=
NECKO_PROTOCOLS_DEFAULT="about data http file res"
@ -5875,6 +5878,15 @@ if test -n "$MOZ_URL_CLASSIFIER"; then
fi
AC_SUBST(MOZ_URL_CLASSIFIER)
dnl ========================================================
dnl = Disable zipwriter
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(zipwriter,
[ --disable-zipwriter Disable zipwriter component],
MOZ_ZIPWRITER=,
MOZ_ZIPWRITER=1 )
AC_SUBST(MOZ_ZIPWRITER)
dnl ========================================================
dnl = Enable Ultrasparc specific optimizations for JS
dnl ========================================================

View File

@ -401,13 +401,54 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
ObjectType newType = GetTypeOfContent(mContentType);
LOG(("OBJLC [%p]: OnStartRequest: Content Type=<%s> Old type=%u New Type=%u\n",
this, mContentType.get(), mType, newType));
// Now do a content policy check
// XXXbz this duplicates some code in nsContentBlocker::ShouldLoad
PRInt32 contentPolicyType;
switch (newType) {
case eType_Image:
contentPolicyType = nsIContentPolicy::TYPE_IMAGE;
break;
case eType_Document:
contentPolicyType = nsIContentPolicy::TYPE_SUBDOCUMENT;
break;
default:
contentPolicyType = nsIContentPolicy::TYPE_OBJECT;
break;
}
nsCOMPtr<nsIURI> uri;
chan->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
if (!doc) {
Fallback(PR_FALSE);
return NS_BINDING_ABORTED;
}
PRInt16 shouldProcess = nsIContentPolicy::ACCEPT;
rv =
NS_CheckContentProcessPolicy(contentPolicyType,
uri,
doc->NodePrincipal(),
static_cast<nsIImageLoadingContent*>(this),
mContentType,
nsnull, //extra
&shouldProcess,
nsContentUtils::GetContentPolicy(),
nsContentUtils::GetSecurityManager());
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldProcess)) {
HandleBeingBlockedByContentPolicy(rv, shouldProcess);
rv = NS_OK; // otherwise, the AutoFallback will make us fall back
return NS_BINDING_ABORTED;
}
if (mType != newType) {
UnloadContent();
}
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
switch (newType) {
case eType_Image:
rv = LoadImageWithChannel(chan, getter_AddRefs(mFinalListener));
@ -434,8 +475,6 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
}
}
nsCOMPtr<nsIURI> uri;
chan->GetURI(getter_AddRefs(uri));
rv = mFrameLoader->CheckForRecursiveLoad(uri);
if (NS_FAILED(rv)) {
Fallback(PR_FALSE);
@ -918,19 +957,9 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
nsnull, //extra
&shouldLoad,
nsContentUtils::GetContentPolicy(),
nsContentUtils::GetSecurityManager());
secMan);
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) {
// Must call UnloadContent first, as it overwrites
// mSuppressed/mUserDisabled. It also takes care of setting the type to
// eType_Null.
UnloadContent();
if (NS_SUCCEEDED(rv)) {
if (shouldLoad == nsIContentPolicy::REJECT_TYPE) {
mUserDisabled = PR_TRUE;
} else if (shouldLoad == nsIContentPolicy::REJECT_SERVER) {
mSuppressed = PR_TRUE;
}
}
HandleBeingBlockedByContentPolicy(rv, shouldLoad);
return NS_OK;
}
}
@ -1457,6 +1486,23 @@ nsObjectLoadingContent::GetFrame(PRBool aFlushLayout)
return objFrame;
}
void
nsObjectLoadingContent::HandleBeingBlockedByContentPolicy(nsresult aStatus,
PRInt16 aRetval)
{
// Must call UnloadContent first, as it overwrites
// mSuppressed/mUserDisabled. It also takes care of setting the type to
// eType_Null.
UnloadContent();
if (NS_SUCCEEDED(aStatus)) {
if (aRetval == nsIContentPolicy::REJECT_TYPE) {
mUserDisabled = PR_TRUE;
} else if (aRetval == nsIContentPolicy::REJECT_SERVER) {
mSuppressed = PR_TRUE;
}
}
}
nsresult
nsObjectLoadingContent::TryInstantiate(const nsACString& aMIMEType,
nsIURI* aURI)

View File

@ -279,6 +279,14 @@ class nsObjectLoadingContent : public nsImageLoadingContent
*/
nsIObjectFrame* GetFrame(PRBool aFlushLayout);
/**
* Handle being blocked by a content policy. aStatus is the nsresult
* return value of the Should* call, while aRetval is what it returned in
* its out parameter.
*/
void HandleBeingBlockedByContentPolicy(nsresult aStatus,
PRInt16 aRetval);
/**
* Checks if we have a frame that's ready for instantiation, and if so,
* calls Instantiate().

View File

@ -529,7 +529,9 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
// need to select the delimiter character and escape characters using
// character entity references, ignoring the value of aDoEscapeEntities.
// See http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2.2 for
// the standard on character entity references in values.
// the standard on character entity references in values. We also have to
// make sure to escape any '&' characters.
PRBool bIncludesSingle = PR_FALSE;
PRBool bIncludesDouble = PR_FALSE;
nsAString::const_iterator iCurr, iEnd;
@ -565,18 +567,16 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
(bIncludesDouble && !bIncludesSingle) ? PRUnichar('\'') : PRUnichar('"');
AppendToString(PRUnichar('='), aStr);
AppendToString(cDelimiter, aStr);
nsAutoString sValue(aValue);
sValue.ReplaceSubstring(NS_LITERAL_STRING("&"),
NS_LITERAL_STRING("&amp;"));
if (bIncludesDouble && bIncludesSingle) {
nsAutoString sValue(aValue);
sValue.ReplaceSubstring(NS_LITERAL_STRING("\"").get(), NS_LITERAL_STRING("&quot;").get());
mInAttribute = PR_TRUE;
AppendToString(sValue, aStr, PR_FALSE);
mInAttribute = PR_FALSE;
}
else {
mInAttribute = PR_TRUE;
AppendToString(aValue, aStr, PR_FALSE);
mInAttribute = PR_FALSE;
sValue.ReplaceSubstring(NS_LITERAL_STRING("\""),
NS_LITERAL_STRING("&quot;"));
}
mInAttribute = PR_TRUE;
AppendToString(sValue, aStr, PR_FALSE);
mInAttribute = PR_FALSE;
AppendToString(cDelimiter, aStr);
}
}

View File

@ -87,6 +87,7 @@ _TEST_FILES = test_bug5141.html \
test_bug375314.html \
test_bug382113.html \
test_bug390735.html \
test_bug392511.html \
bug382113_object.html \
test_CrossSiteXHR.html \
file_CrossSiteXHR_fail1.xml \

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=392511
-->
<head>
<title>Test for Bug 392511</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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392511">Mozilla Bug 392511</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="t1"><span onclick="&quot;&amp;"></span></div>
<div id="t2"><span foo="&quot;&amp;"></span></div>
<div id="t3"><span onclick='&apos;&amp;'></span></div>
<div id="t4"><span foo='&apos;&amp;'></span></div>
<div id="t5"><span onclick='"&apos;&amp;'></span></div>
<div id="t6"><span foo='"&apos;&amp;'></span></div>
<div id="t7"><span onclick="'&quot;&amp;"></span></div>
<div id="t8"><span foo="'&quot;&amp;"></span></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 392511 **/
var results = [
"'\"&amp;'",
"\"&quot;&amp;\"",
"\"'&amp;\"",
"\"'&amp;\"",
"\"&quot;'&amp;\"",
"\"&quot;'&amp;\"",
"\"'&quot;&amp;\"",
"\"'&quot;&amp;\""
];
for (var i = 1; i <= 8; ++i) {
var id = "t" + i;
var str = $(id).innerHTML;
var expect = "<span ";
expect += (i % 2) ? "onclick" : "foo";
expect += "=" + results[i-1] + "></span>";
is (str, expect, "Wrong string for test " + id);
}
</script>
</pre>
</body>
</html>

View File

@ -65,7 +65,6 @@ protected:
nsSVGAngle(float value, PRUint16 unit);
nsSVGAngle();
virtual ~nsSVGAngle();
public:
// nsISupports interface:
@ -95,7 +94,6 @@ protected:
float mValueInSpecifiedUnits;
PRUint8 mSpecifiedUnitType;
PRPackedBool mIsAuto;
};
@ -133,8 +131,7 @@ NS_NewSVGAngle(nsIDOMSVGAngle** result,
nsSVGAngle::nsSVGAngle(float value,
PRUint16 unit)
: mValueInSpecifiedUnits(value),
mIsAuto(PR_FALSE)
: mValueInSpecifiedUnits(value)
{
NS_ASSERTION(unit == SVG_ANGLETYPE_UNKNOWN || IsValidUnitType(unit), "unknown unit");
mSpecifiedUnitType = unit;
@ -144,10 +141,6 @@ nsSVGAngle::nsSVGAngle()
{
}
nsSVGAngle::~nsSVGAngle()
{
}
//----------------------------------------------------------------------
// nsISupports methods:
@ -267,7 +260,6 @@ NS_IMETHODIMP
nsSVGAngle::SetValueInSpecifiedUnits(float aValueInSpecifiedUnits)
{
WillModify();
mIsAuto = PR_FALSE;
mValueInSpecifiedUnits = aValueInSpecifiedUnits;
DidModify();
return NS_OK;
@ -277,10 +269,6 @@ nsSVGAngle::SetValueInSpecifiedUnits(float aValueInSpecifiedUnits)
NS_IMETHODIMP
nsSVGAngle::GetValueAsString(nsAString & aValueAsString)
{
if (mIsAuto) {
aValueAsString.AssignLiteral("auto");
return NS_OK;
}
PRUnichar buf[24];
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("%g").get(),
@ -297,12 +285,6 @@ nsSVGAngle::GetValueAsString(nsAString & aValueAsString)
NS_IMETHODIMP
nsSVGAngle::SetValueAsString(const nsAString & aValueAsString)
{
if (aValueAsString.EqualsLiteral("auto")) {
WillModify();
mIsAuto = PR_TRUE;
DidModify();
return NS_OK;
}
nsresult rv = NS_OK;
char *str = ToNewCString(aValueAsString);
@ -336,7 +318,6 @@ nsSVGAngle::NewValueSpecifiedUnits(PRUint16 unitType, float valueInSpecifiedUnit
if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
WillModify();
mIsAuto = PR_FALSE;
mValueInSpecifiedUnits = valueInSpecifiedUnits;
mSpecifiedUnitType = unitType;
DidModify();

View File

@ -66,9 +66,9 @@ public:
nsSVGElement *aSVGElement,
PRBool aDoSetAttr);
PRUint16 GetBaseValue()
PRUint16 GetBaseValue() const
{ return mBaseVal; }
PRUint16 GetAnimValue()
PRUint16 GetAnimValue() const
{ return mAnimVal; }
nsresult ToDOMAnimatedEnum(nsIDOMSVGAnimatedEnumeration **aResult,

View File

@ -102,22 +102,22 @@ nsSVGMarkerElement::Init()
nsresult rv = nsSVGMarkerElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// non-attrib enum - pass in invalid enum (will never get used by nsSVGEnum)
mOrientType.Init(0xff, SVG_MARKER_ORIENT_AUTO);
// derived (non-attrib) DOM properties
// Create mapped properties:
// DOM property: orientType
mOrientType.Init(ORIENTTYPE, SVG_MARKER_ORIENT_ANGLE);
// DOM property: orient
// DOM property: orientAngle
{
nsCOMPtr<nsIDOMSVGAngle> angle;
rv = NS_NewSVGAngle(getter_AddRefs(angle), 0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedAngle(getter_AddRefs(mOrient), angle);
NS_ENSURE_SUCCESS(rv,rv);
rv = AddMappedSVGValue(nsGkAtoms::orient, mOrient);
rv = NS_NewSVGAnimatedAngle(getter_AddRefs(mOrientAngle), angle);
NS_ENSURE_SUCCESS(rv,rv);
}
// Create mapped properties:
// DOM property: viewBox
{
nsCOMPtr<nsIDOMSVGRect> viewbox;
@ -213,7 +213,7 @@ NS_IMETHODIMP nsSVGMarkerElement::GetOrientType(nsIDOMSVGAnimatedEnumeration * *
/* readonly attribute nsIDOMSVGAnimatedLength orientAngle; */
NS_IMETHODIMP nsSVGMarkerElement::GetOrientAngle(nsIDOMSVGAnimatedAngle * *aOrientAngle)
{
*aOrientAngle = mOrient;
*aOrientAngle = mOrientAngle;
NS_IF_ADDREF(*aOrientAngle);
return NS_OK;
}
@ -221,9 +221,7 @@ NS_IMETHODIMP nsSVGMarkerElement::GetOrientAngle(nsIDOMSVGAnimatedAngle * *aOrie
/* void setOrientToAuto (); */
NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAuto()
{
nsIDOMSVGAngle *a;
mOrient->GetBaseVal(&a);
a->SetValueAsString(NS_LITERAL_STRING("auto"));
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_TRUE);
return NS_OK;
}
@ -234,10 +232,13 @@ NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAngle(nsIDOMSVGAngle *angle)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsIDOMSVGAngle *a;
mOrient->GetBaseVal(&a);
mOrientAngle->GetBaseVal(&a);
float f;
angle->GetValue(&f);
a->SetValue(f);
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_TRUE);
return NS_OK;
}
@ -276,20 +277,43 @@ nsSVGMarkerElement::IsAttributeMapped(const nsIAtom* name) const
//----------------------------------------------------------------------
// nsSVGElement methods
nsresult
nsSVGMarkerElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify)
PRBool
nsSVGMarkerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString &aResult) const
{
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::orient) {
if (aValue->EqualsLiteral("auto")) {
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::orient) {
if (mOrientType.GetBaseValue() == SVG_MARKER_ORIENT_AUTO) {
aResult.AssignLiteral("auto");
} else {
nsCOMPtr<nsIDOMSVGAngle> a;
mOrientAngle->GetBaseVal(getter_AddRefs(a));
nsCOMPtr<nsISVGValue> value = do_QueryInterface(a);
value->GetValueString(aResult);
}
return PR_TRUE;
}
return nsSVGMarkerElementBase::GetAttr(aNameSpaceID, aName, aResult);
}
nsresult
nsSVGMarkerElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::orient) {
if (aValue.EqualsLiteral("auto")) {
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_FALSE);
} else {
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_FALSE);
nsCOMPtr<nsIDOMSVGAngle> a;
mOrientAngle->GetBaseVal(getter_AddRefs(a));
nsCOMPtr<nsISVGValue> value = do_QueryInterface(a);
value->SetValueString(aValue);
}
}
return nsSVGMarkerElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
return nsSVGMarkerElementBase::SetAttr(aNameSpaceID, aName,
aPrefix, aValue, aNotify);
}
nsresult
@ -305,9 +329,9 @@ nsSVGMarkerElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
vb->SetWidth(mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx));
vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
} else if (aName == nsGkAtoms::orient) {
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_FALSE);
mOrientType.SetBaseValue(SVG_MARKER_ORIENT_ANGLE, this, PR_FALSE);
nsIDOMSVGAngle *angle;
mOrient->GetBaseVal(&angle);
mOrientAngle->GetBaseVal(&angle);
angle->NewValueSpecifiedUnits(nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED,
0.0f);
}
@ -337,6 +361,31 @@ nsSVGMarkerElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr)
}
}
void
nsSVGMarkerElement::DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr)
{
if (!aDoSetAttr)
return;
if (aAttrEnum == ORIENTTYPE) {
if (mOrientType.GetBaseValue() == SVG_MARKER_ORIENT_AUTO) {
nsSVGMarkerElementBase::SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
NS_LITERAL_STRING("auto"), PR_TRUE);
} else {
nsAutoString value;
GetAttr(kNameSpaceID_None, nsGkAtoms::orient, value);
if (value.EqualsLiteral("auto")) {
// type is being set to non-auto - remove an "auto" valued
// attribute if it's set, otherwise leave the angle specified.
UnsetAttr(kNameSpaceID_None, nsGkAtoms::orient, PR_TRUE);
}
}
return;
}
nsSVGMarkerElementBase::DidChangeEnum(aAttrEnum, aDoSetAttr);
}
void
nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
{
@ -378,12 +427,11 @@ nsSVGMarkerElement::GetMarkerTransform(float aStrokeWidth,
SVG_MARKERUNITS_STROKEWIDTH)
scale = aStrokeWidth;
nsCOMPtr<nsIDOMSVGAngle> a;
mOrient->GetAnimVal(getter_AddRefs(a));
nsAutoString value;
a->GetValueAsString(value);
if (!value.EqualsLiteral("auto"))
a->GetValue(&aAngle);
if (mOrientType.GetBaseValue() != SVG_MARKER_ORIENT_AUTO) {
nsCOMPtr<nsIDOMSVGAngle> a;
mOrientAngle->GetAnimVal(getter_AddRefs(a));
a->GetValue(&aAngle);
}
nsCOMPtr<nsIDOMSVGMatrix> matrix;
NS_NewSVGMatrix(getter_AddRefs(matrix),

View File

@ -76,13 +76,17 @@ public:
// nsIContent interface
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify);
virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const;
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
// nsSVGElement specializations:
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
// public helpers
nsresult GetMarkerTransform(float aStrokeWidth,
@ -103,17 +107,16 @@ protected:
nsSVGLength2 mLengthAttributes[4];
static LengthInfo sLengthInfo[4];
enum { MARKERUNITS };
enum { MARKERUNITS, ORIENTTYPE = 0xFF };
nsSVGEnum mEnumAttributes[1];
static nsSVGEnumMapping sUnitsMap[];
static EnumInfo sEnumInfo[1];
// this needs to be handled seperately because its a derived enum
nsSVGEnum mOrientType;
// derived properties (from 'orient') handled separately
nsSVGEnum mOrientType;
nsCOMPtr<nsIDOMSVGAnimatedAngle> mOrientAngle;
nsSVGSVGElement *mCoordCtx;
nsCOMPtr<nsIDOMSVGAnimatedAngle> mOrient;
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
nsCOMPtr<nsIDOMSVGAnimatedPreserveAspectRatio> mPreserveAspectRatio;
nsCOMPtr<nsIDOMSVGMatrix> mViewBoxToViewportTransform;

View File

@ -15,7 +15,7 @@ To move to a new version:
Simply copy the sqlite3.h and sqlite3.c files from the amalgamation of sqlite.
They you need to update sqlite3file.h, which pulls out random bits of the
Then you need to update sqlite3file.h, which pulls out random bits of the
internal files that we need to export. If any of these internal structures
change, they need to be changed in sqlite3file.h as well. This may involve
downloading the whole souce (not the amalgamation) to check.

View File

@ -51,7 +51,6 @@ VISIBILITY_FLAGS =
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
ifndef GNU_CC
MAPFILE = $(LIBRARY_NAME).map
DEFFILE = $(win_srcdir)/sqlite.def
endif
endif

View File

@ -59,7 +59,7 @@
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@ -2750,7 +2750,7 @@ int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
**
** SQLite processes all times and dates as Julian Day numbers. The
** dates and times are stored as the number of days since noon
@ -2794,7 +2794,7 @@ int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@ -2814,7 +2814,7 @@ int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
**
** This file defines various limits of what SQLite can process.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -3017,7 +3017,7 @@ int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
** This is the header file for the generic hash-table implemenation
** used in SQLite.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _SQLITE_HASH_H_
#define _SQLITE_HASH_H_
@ -3449,7 +3449,7 @@ struct BusyHandler {
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@ -3765,7 +3765,7 @@ SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...);
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
@ -3919,7 +3919,7 @@ SQLITE_PRIVATE int sqlite3BtreePageDump(Btree*, int, int recursive);
** subsystem. The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _PAGER_H_
@ -7471,7 +7471,7 @@ struct sqlite3OsVtbl *sqlite3_os_switch(void){
** Memory allocation functions used throughout sqlite.
**
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -9194,7 +9194,7 @@ SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -9292,7 +9292,7 @@ SQLITE_PRIVATE void sqlite3Randomness(int N, void *pBuf){
** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
**
** Notes on UTF-8:
**
@ -10272,7 +10272,7 @@ SQLITE_PRIVATE void sqlite3UtfSelfTest(){
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -11001,7 +11001,7 @@ SQLITE_PRIVATE void sqlite3ReleaseThreadData(){
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/* Turn bulk memory into a hash table object by initializing the
@ -17882,7 +17882,7 @@ SQLITE_PRIVATE ThreadData *sqlite3WinThreadSpecificData(int allocateFlag){
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
@ -22340,7 +22340,7 @@ SQLITE_PRIVATE void sqlite3PagerRefdump(Pager *pPager){
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@ -22359,7 +22359,7 @@ SQLITE_PRIVATE void sqlite3PagerRefdump(Pager *pPager){
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -33566,7 +33566,7 @@ sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -38758,7 +38758,7 @@ abort_due_to_interrupt:
**
** This file contains code used to implement incremental BLOB I/O.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -39069,7 +39069,7 @@ int sqlite3_blob_bytes(sqlite3_blob *pBlob){
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -41651,7 +41651,7 @@ SQLITE_PRIVATE int sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -42260,7 +42260,7 @@ exit_begin_add_column:
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
@ -42672,7 +42672,7 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_ATTACH
@ -43193,7 +43193,7 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep(
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -43436,7 +43436,7 @@ SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){
** COMMIT
** ROLLBACK
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -46789,7 +46789,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3IndexKeyinfo(Parse *pParse, Index *pIdx){
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -47168,7 +47168,7 @@ SQLITE_PRIVATE Schema *sqlite3SchemaGet(Btree *pBt){
** separating it out, the code will be automatically omitted from
** static links that do not use it.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_COMPLETE
@ -47429,7 +47429,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql){
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -47902,7 +47902,7 @@ SQLITE_PRIVATE void sqlite3GenerateIndexKey(
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/* #include <math.h> */
@ -49388,7 +49388,7 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -50996,7 +50996,7 @@ static int xferOptimization(
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -51148,7 +51148,7 @@ exec_out:
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
**
** @(#) $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
@ -51865,7 +51865,7 @@ SQLITE_PRIVATE int sqlite3AutoLoadExtensions(sqlite3 *db){
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/* Ignore this whole file if pragmas are disabled
@ -53045,7 +53045,7 @@ pragma_out:
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -53741,7 +53741,7 @@ int sqlite3_prepare16_v2(
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
@ -58277,7 +58277,7 @@ SQLITE_PRIVATE int sqlite3CodeRowTrigger(
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -58908,7 +58908,7 @@ static void updateVirtualTable(
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
@ -59167,7 +59167,7 @@ end_of_vacuum:
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
@ -59955,7 +59955,7 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -65819,7 +65819,7 @@ SQLITE_PRIVATE void sqlite3Parser(
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*
@ -65872,7 +65872,7 @@ const unsigned char ebcdicToAscii[] = {
**
** The code in this file has been automatically generated by
**
** $Header: /cvsroot/mozilla/db/sqlite3/src/sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Header: /cvsroot/mozilla/db/sqlite3/src/sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
**
** The code in this file implements a function that determines whether
** or not a given identifier is really an SQL keyword. The same thing
@ -66448,7 +66448,7 @@ abort_parse:
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: sqlite3.c,v 1.6 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** $Id: sqlite3.c,v 1.8 2007/09/14 21:07:51 dmose%mozilla.org Exp $
*/
/*

View File

@ -30,7 +30,7 @@
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite3.h,v 1.11 2007/08/02 15:24:51 sspitzer%mozilla.org Exp $
** @(#) $Id: sqlite3.h,v 1.13 2007/09/14 21:07:52 dmose%mozilla.org Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_

View File

@ -2801,6 +2801,16 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
if (NS_FAILED(rv) || !uri)
return NS_ERROR_FAILURE;
PopupControlState popupState;
if (aLoadFlags & LOAD_FLAGS_ALLOW_POPUPS) {
popupState = openAllowed;
aLoadFlags &= ~LOAD_FLAGS_ALLOW_POPUPS;
} else {
popupState = openOverridden;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mScriptGlobal));
nsAutoPopupStatePusher statePusher(win, popupState);
// Don't pass certain flags that aren't needed and end up confusing
// ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that they are
// passed to LoadURI though, since it uses them.

View File

@ -191,6 +191,12 @@ interface nsIWebNavigation : nsISupports
*/
const unsigned long LOAD_FLAGS_FIRST_LOAD = 0x4000;
/**
* This flag specifies that the load should not be subject to popup
* blocking checks.
*/
const unsigned long LOAD_FLAGS_ALLOW_POPUPS = 0x8000;
/**
* Loads a given URI. This will give priority to loading the requested URI
* in the object implementing this interface. If it can't be loaded here

View File

@ -68,6 +68,8 @@ public:
virtual const PRUnichar *GetHandlerText() = 0;
// Get the location of the script.
// Note: The memory pointed to by aFileName is owned by the
// nsIScriptTimeoutHandler and should not be freed by the caller.
virtual void GetLocation(const char **aFileName, PRUint32 *aLineNo) = 0;
// If a script object, get the argv suitable for passing back to the

View File

@ -285,6 +285,12 @@ nsJSScriptTimeoutHandler::Init(nsIScriptContext *aContext, PRBool *aIsInterval,
}
mExpr = expr;
// Get the calling location.
const char *filename;
if (nsJSUtils::GetCallingLocation(cx, &filename, &mLineNo)) {
mFileName.Assign(filename);
}
} else if (funobj) {
if (!::JS_AddNamedRoot(cx, &mFunObj, "timeout.mFunObj")) {
return NS_ERROR_OUT_OF_MEMORY;
@ -301,10 +307,12 @@ nsJSScriptTimeoutHandler::Init(nsIScriptContext *aContext, PRBool *aIsInterval,
if (NS_FAILED(rv)) {
return NS_ERROR_OUT_OF_MEMORY;
}
PRUint32 dummy;
jsval *jsargv = nsnull;
nsCOMPtr<nsIJSArgArray> jsarray(do_QueryInterface(array));
jsarray->GetArgs(&dummy, reinterpret_cast<void **>(&jsargv));
// must have worked - we own the impl! :)
NS_ASSERTION(jsargv, "No argv!");
for (PRInt32 i = 2; (PRUint32)i < argc; ++i) {
@ -312,17 +320,6 @@ nsJSScriptTimeoutHandler::Init(nsIScriptContext *aContext, PRBool *aIsInterval,
}
// final arg slot remains null, array has rooted vals.
mArgv = array;
// Get the calling location.
const char *filename;
if (nsJSUtils::GetCallingLocation(cx, &filename, &mLineNo)) {
mFileName.Assign(filename);
if (mFileName.IsEmpty()) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
} else {
NS_WARNING("No func and no expr - why are we here?");
}

View File

@ -1214,11 +1214,11 @@ struct JSExtendedClass {
JSEqualityOp equality;
JSObjectOp outerObject;
JSObjectOp innerObject;
JSIteratorOp iteratorObject;
void (*reserved0)();
void (*reserved1)();
void (*reserved2)();
void (*reserved3)();
void (*reserved4)();
};
#define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */
@ -1287,7 +1287,7 @@ struct JSExtendedClass {
/* Initializer for unused members of statically initialized JSClass structs. */
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,0
#define JSCLASS_NO_RESERVED_MEMBERS 0,0,0,0,0
#define JSCLASS_NO_RESERVED_MEMBERS 0,0,0,0
/* For detailed comments on these function pointer types, see jspubtd.h. */
struct JSObjectOps {

View File

@ -2111,6 +2111,6 @@ js_NewArrayObject(JSContext *cx, jsuint length, jsval *vector)
JS_POP_TEMP_ROOT(cx, &tvr);
/* Set/clear newborn root, in case we lost it. */
cx->weakRoots.newborn[GCX_OBJECT] = (JSGCThing *) obj;
cx->weakRoots.newborn[GCX_OBJECT] = obj;
return obj;
}

View File

@ -171,6 +171,7 @@ struct JSRuntime {
JSContextCallback cxCallback;
/* Garbage collector state, used by jsgc.c. */
JSGCChunkInfo *gcChunkList;
JSGCArenaList gcArenaList[GC_NUM_FREELISTS];
JSDHashTable gcRootsHash;
JSDHashTable *gcLocksHash;
@ -202,9 +203,9 @@ struct JSRuntime {
JSGCThingCallback gcThingCallback;
void *gcThingCallbackClosure;
uint32 gcMallocBytes;
JSGCArena *gcUnscannedArenaStackTop;
JSGCArenaInfo *gcUntracedArenaStackTop;
#ifdef DEBUG
size_t gcUnscannedBagSize;
size_t gcTraceLaterCount;
#endif
/*

View File

@ -609,6 +609,13 @@ js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
? js_InternalCall(cx, obj, OBJECT_TO_JSVAL(wp->setter),
1, vp, vp)
: wp->setter(cx, OBJ_THIS_OBJECT(cx, obj), userid, vp));
/* Evil code can cause us to have an arguments object. */
if (frame.callobj)
ok &= js_PutCallObject(cx, &frame);
if (frame.argsobj)
ok &= js_PutArgsObject(cx, &frame);
cx->fp = frame.down;
if (argv != smallv)
JS_free(cx, argv);

View File

@ -4004,6 +4004,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
void *cg2mark;
JSCodeGenerator *cg2;
JSFunction *fun;
uintN slot;
#if JS_HAS_XML_SUPPORT
if (pn->pn_arity == PN_NULLARY) {
@ -4072,29 +4073,46 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
*/
CG_SWITCH_TO_PROLOG(cg);
if (cg->treeContext.flags & TCF_IN_FUNCTION) {
op = JSOP_DEFFUN;
#ifdef __GNUC__
slot = 0; /* quell GCC overwarning */
#endif
JS_ASSERT((cg->treeContext.flags & TCF_IN_FUNCTION) ||
!cg->treeContext.topStmt);
if ((cg->treeContext.flags & TCF_IN_FUNCTION) ||
((cx->fp->flags & JSFRAME_SPECIAL) && cx->fp->fun)) {
JSObject *obj, *pobj;
JSProperty *prop;
JSScopeProperty *sprop;
uintN slot;
obj = OBJ_GET_PARENT(cx, fun->object);
obj = (cg->treeContext.flags & TCF_IN_FUNCTION)
? OBJ_GET_PARENT(cx, fun->object)
: cx->fp->fun->object;
if (!js_LookupHiddenProperty(cx, obj, ATOM_TO_JSID(fun->atom),
&pobj, &prop)) {
return JS_FALSE;
}
JS_ASSERT(prop && pobj == obj);
sprop = (JSScopeProperty *) prop;
JS_ASSERT(sprop->getter == js_GetLocalVariable);
slot = sprop->shortid;
OBJ_DROP_PROPERTY(cx, pobj, prop);
if (prop) {
if (pobj == obj) {
sprop = (JSScopeProperty *) prop;
if (sprop->getter == js_GetLocalVariable) {
slot = sprop->shortid;
op = JSOP_DEFLOCALFUN;
}
}
OBJ_DROP_PROPERTY(cx, pobj, prop);
}
JS_ASSERT(op == JSOP_DEFLOCALFUN ||
!(cg->treeContext.flags & TCF_IN_FUNCTION));
/*
* If this local function is declared in a body block induced by
* let declarations, reparent fun->object to the compiler-created
* body block object so that JSOP_DEFLOCALFUN can clone that block
* into the runtime scope chain.
* If this local function is declared in a body block induced
* by let declarations, reparent fun->object to the compiler-
* created body block object, so that JSOP_DEFLOCALFUN clones
* that block into the runtime scope chain.
*/
stmt = cg->treeContext.topStmt;
if (stmt && stmt->type == STMT_BLOCK &&
@ -4104,12 +4122,13 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
JS_ASSERT(LOCKED_OBJ_GET_CLASS(obj) == &js_BlockClass);
OBJ_SET_PARENT(cx, fun->object, obj);
}
}
if (!EmitSlotIndexOp(cx, JSOP_DEFLOCALFUN, slot, index, cg))
if (op == JSOP_DEFLOCALFUN) {
if (!EmitSlotIndexOp(cx, op, slot, index, cg))
return JS_FALSE;
} else {
JS_ASSERT(!cg->treeContext.topStmt);
EMIT_INDEX_OP(JSOP_DEFFUN, index);
EMIT_INDEX_OP(op, index);
}
CG_SWITCH_TO_MAIN(cg);

View File

@ -1173,8 +1173,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
* root until then to protect pval in case it is figuratively
* up in the air, with no strong refs protecting it.
*/
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(pval);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(pval);
parentProto = JSVAL_TO_OBJECT(pval);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -254,10 +254,11 @@ typedef struct JSGCStats {
uint32 maxdepth; /* maximum mark tail recursion depth */
uint32 cdepth; /* mark recursion depth of C functions */
uint32 maxcdepth; /* maximum mark recursion depth of C functions */
uint32 unscanned; /* mark C stack overflows or number of times
GC things were put in unscanned bag */
uint32 untraced; /* number of times tracing of GC thing's children were
delayed due to a low C stack */
#ifdef DEBUG
uint32 maxunscanned; /* maximum size of unscanned bag */
uint32 maxuntraced;/* maximum number of things with children to trace
later */
#endif
uint32 maxlevel; /* maximum GC nesting (indirect recursion) level */
uint32 poke; /* number of potentially useful GC calls */
@ -276,8 +277,9 @@ js_DumpGCStats(JSRuntime *rt, FILE *fp);
#endif /* JS_GCMETER */
typedef struct JSGCArena JSGCArena;
typedef struct JSGCArenaInfo JSGCArenaInfo;
typedef struct JSGCArenaList JSGCArenaList;
typedef struct JSGCChunkInfo JSGCChunkInfo;
#ifdef JS_GCMETER
typedef struct JSGCArenaStats JSGCArenaStats;
@ -298,25 +300,26 @@ struct JSGCArenaStats {
#endif
struct JSGCArenaList {
JSGCArena *last; /* last allocated GC arena */
uint16 lastLimit; /* end offset of allocated so far things in
the last arena */
uint16 thingSize; /* size of things to allocate on this list */
JSGCThing *freeList; /* list of free GC things */
JSGCArenaInfo *last; /* last allocated GC arena */
uint16 lastCount; /* number of allocated things in the last
arena */
uint16 thingSize; /* size of things to allocate on this list
*/
JSGCThing *freeList; /* list of free GC things */
#ifdef JS_GCMETER
JSGCArenaStats stats;
JSGCArenaStats stats;
#endif
};
struct JSWeakRoots {
/* Most recently created things by type, members of the GC's root set. */
JSGCThing *newborn[GCX_NTYPES];
void *newborn[GCX_NTYPES];
/* Atom root for the last-looked-up atom on this context. */
jsval lastAtom;
jsval lastAtom;
/* Root for the result of the most recent js_InternalInvoke call. */
jsval lastInternalResult;
jsval lastInternalResult;
};
JS_STATIC_ASSERT(JSVAL_NULL == 0);

View File

@ -5291,8 +5291,7 @@ interrupt:
JS_ASSERT(sp - fp->spbase >= 1);
lval = FETCH_OPND(-1);
JS_ASSERT(JSVAL_IS_OBJECT(lval));
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(lval);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(lval);
END_CASE(JSOP_ENDINIT)
BEGIN_CASE(JSOP_INITPROP)

View File

@ -334,6 +334,8 @@ js_ValueToIterator(JSContext *cx, uintN flags, jsval *vp)
JSObject *obj;
JSTempValueRooter tvr;
JSAtom *atom;
JSClass *clasp;
JSExtendedClass *xclasp;
JSBool ok;
JSObject *iterobj;
jsval arg;
@ -370,47 +372,60 @@ js_ValueToIterator(JSContext *cx, uintN flags, jsval *vp)
JS_ASSERT(obj);
JS_PUSH_TEMP_ROOT_OBJECT(cx, obj, &tvr);
atom = cx->runtime->atomState.iteratorAtom;
#if JS_HAS_XML_SUPPORT
if (OBJECT_IS_XML(cx, obj)) {
if (!js_GetXMLFunction(cx, obj, ATOM_TO_JSID(atom), vp))
goto bad;
} else
#endif
{
if (!OBJ_GET_PROPERTY(cx, obj, ATOM_TO_JSID(atom), vp))
goto bad;
}
if (JSVAL_IS_VOID(*vp)) {
default_iter:
/*
* Fail over to the default enumerating native iterator.
*
* Create iterobj with a NULL parent to ensure that we use the correct
* scope chain to lookup the iterator's constructor. Since we use the
* parent slot to keep track of the iterable, we must fix it up after.
*/
iterobj = js_NewObject(cx, &js_IteratorClass, NULL, NULL);
clasp = OBJ_GET_CLASS(cx, obj);
if ((clasp->flags & JSCLASS_IS_EXTENDED) &&
(xclasp = (JSExtendedClass *) clasp)->iteratorObject) {
iterobj = xclasp->iteratorObject(cx, obj, !(flags & JSITER_FOREACH));
if (!iterobj)
goto bad;
/* Store iterobj in *vp to protect it from GC (callers must root vp). */
*vp = OBJECT_TO_JSVAL(iterobj);
if (!InitNativeIterator(cx, iterobj, obj, flags))
goto bad;
} else {
arg = BOOLEAN_TO_JSVAL((flags & JSITER_FOREACH) == 0);
if (!js_InternalInvoke(cx, obj, *vp, JSINVOKE_ITERATOR, 1, &arg, vp))
goto bad;
if (JSVAL_IS_PRIMITIVE(*vp)) {
const char *printable = js_AtomToPrintableString(cx, atom);
if (printable) {
js_ReportValueError2(cx, JSMSG_BAD_ITERATOR_RETURN,
JSDVG_SEARCH_STACK, *vp, NULL, printable);
atom = cx->runtime->atomState.iteratorAtom;
#if JS_HAS_XML_SUPPORT
if (OBJECT_IS_XML(cx, obj)) {
if (!js_GetXMLFunction(cx, obj, ATOM_TO_JSID(atom), vp))
goto bad;
} else
#endif
{
if (!OBJ_GET_PROPERTY(cx, obj, ATOM_TO_JSID(atom), vp))
goto bad;
}
if (JSVAL_IS_VOID(*vp)) {
default_iter:
/*
* Fail over to the default enumerating native iterator.
*
* Create iterobj with a NULL parent to ensure that we use the
* correct scope chain to lookup the iterator's constructor. Since
* we use the parent slot to keep track of the iterable, we must
* fix it up after.
*/
iterobj = js_NewObject(cx, &js_IteratorClass, NULL, NULL);
if (!iterobj)
goto bad;
/* Store in *vp to protect it from GC (callers must root vp). */
*vp = OBJECT_TO_JSVAL(iterobj);
if (!InitNativeIterator(cx, iterobj, obj, flags))
goto bad;
} else {
arg = BOOLEAN_TO_JSVAL((flags & JSITER_FOREACH) == 0);
if (!js_InternalInvoke(cx, obj, *vp, JSINVOKE_ITERATOR, 1, &arg,
vp)) {
goto bad;
}
if (JSVAL_IS_PRIMITIVE(*vp)) {
const char *printable = js_AtomToPrintableString(cx, atom);
if (printable) {
js_ReportValueError2(cx, JSMSG_BAD_ITERATOR_RETURN,
JSDVG_SEARCH_STACK, *vp, NULL,
printable);
}
goto bad;
}
goto bad;
}
}

View File

@ -2540,7 +2540,7 @@ js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent)
out:
JS_POP_TEMP_ROOT(cx, &tvr);
cx->weakRoots.newborn[GCX_OBJECT] = (JSGCThing *) obj;
cx->weakRoots.newborn[GCX_OBJECT] = obj;
return obj;
bad:
@ -4405,8 +4405,7 @@ js_GetClassPrototype(JSContext *cx, JSObject *scope, jsid id,
* instance that delegates to this object, or just query the
* prototype for its class.
*/
cx->weakRoots.newborn[GCX_OBJECT] =
(JSGCThing *)JSVAL_TO_GCTHING(v);
cx->weakRoots.newborn[GCX_OBJECT] = JSVAL_TO_GCTHING(v);
}
}
*protop = JSVAL_IS_OBJECT(v) ? JSVAL_TO_OBJECT(v) : NULL;

View File

@ -349,7 +349,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc,
case JOF_SLOTOBJECT:
fprintf(fp, " %u", GET_VARNO(pc));
index = js_GetIndexFromBytecode(script, pc, VARNO_LEN);
if (type == JOF_ATOM) {
if (type == JOF_SLOTATOM) {
JS_GET_SCRIPT_ATOM(script, index, atom);
v = ATOM_KEY(atom);
} else {

View File

@ -524,6 +524,14 @@ typedef JSBool
typedef JSObject *
(* JS_DLL_CALLBACK JSObjectOp)(JSContext *cx, JSObject *obj);
/*
* Hook that creates an iterator object for a given object. Returns the
* iterator object or null if an error or exception was thrown on cx.
*/
typedef JSObject *
(* JS_DLL_CALLBACK JSIteratorOp)(JSContext *cx, JSObject *obj,
JSBool keysonly);
/*
* A generic type for functions taking a context, object, and property, with
* no return value. Used by JSObjectOps.dropProperty currently (see above,

View File

@ -2365,14 +2365,13 @@ js_InitRuntimeStringState(JSContext *cx)
#define UNIT_STRING_SPACE_RT(rt) UNIT_STRING_SPACE((rt)->unitStrings)
#define IN_UNIT_STRING_SPACE(sp,cp) \
((cp) - UNIT_STRING_SPACE(sp) < 2 * UNIT_STRING_LIMIT)
((size_t)((cp) - UNIT_STRING_SPACE(sp)) < 2 * UNIT_STRING_LIMIT)
#define IN_UNIT_STRING_SPACE_RT(rt,cp) \
IN_UNIT_STRING_SPACE((rt)->unitStrings, cp)
JSString *
js_GetUnitString(JSContext *cx, jschar c)
{
#if 1
JSRuntime *rt;
JSString **sp, *str;
jschar *cp, i;
@ -2404,38 +2403,20 @@ js_GetUnitString(JSContext *cx, jschar c)
if (!rt->unitStrings[c]) {
cp = UNIT_STRING_SPACE_RT(rt);
str = js_NewString(cx, cp + 2 * c, 1);
if (!str || !js_LockGCThing(cx, str))
if (!str)
return NULL;
JS_LOCK_GC(rt);
if (!rt->unitStrings[c]) {
if (!rt->unitStrings[c])
rt->unitStrings[c] = str;
JS_UNLOCK_GC(rt);
} else {
JS_UNLOCK_GC(rt);
js_UnlockGCThingRT(rt, str);
}
JS_UNLOCK_GC(rt);
}
return rt->unitStrings[c];
#else
return js_NewStringCopyN(cx, &c, 1);
#endif
}
void
js_FinishRuntimeStringState(JSContext *cx)
{
JSRuntime *rt = cx->runtime;
rt->emptyString = NULL;
if (rt->unitStrings) {
jschar c;
for (c = 0; c < UNIT_STRING_LIMIT; c++) {
if (rt->unitStrings[c])
js_UnlockGCThingRT(rt, rt->unitStrings[c]);
}
}
cx->runtime->emptyString = NULL;
}
void
@ -2665,8 +2646,14 @@ js_FinalizeStringRT(JSRuntime *rt, JSString *str)
} else {
/* A stillborn string has null chars, so is not valid. */
valid = (str->u.chars != NULL);
if (valid && !IN_UNIT_STRING_SPACE_RT(rt, str->u.chars))
free(str->u.chars);
if (valid) {
if (IN_UNIT_STRING_SPACE_RT(rt, str->u.chars)) {
JS_ASSERT(rt->unitStrings[*str->u.chars] == str);
rt->unitStrings[*str->u.chars] = NULL;
} else {
free(str->u.chars);
}
}
}
if (valid)
js_PurgeDeflatedStringCache(rt, str);

View File

@ -358,7 +358,7 @@ js_InitRuntimeStringState(JSContext *cx);
* Maximum character code for which we will create a pinned unit string on
* demand -- see JSRuntime.unitStrings in jscntxt.h.
*/
#define UNIT_STRING_LIMIT 256
#define UNIT_STRING_LIMIT 256U
/*
* Get the independent string containing only character code c (backstopped

View File

@ -493,6 +493,7 @@ XPCVariant::VariantDataToJS(XPCCallContext& ccx,
(char**)&xpctvar.val.p)))
return JS_FALSE;
xpctvar.type = (uint8)(TD_PSTRING_SIZE_IS | XPT_TDP_POINTER);
xpctvar.SetValIsAllocated();
break;
case nsIDataType::VTYPE_WCHAR_STR:
if(NS_FAILED(variant->GetAsWString((PRUnichar**)&xpctvar.val.p)))
@ -505,6 +506,7 @@ XPCVariant::VariantDataToJS(XPCCallContext& ccx,
(PRUnichar**)&xpctvar.val.p)))
return JS_FALSE;
xpctvar.type = (uint8)(TD_PWSTRING_SIZE_IS | XPT_TDP_POINTER);
xpctvar.SetValIsAllocated();
break;
case nsIDataType::VTYPE_INTERFACE:
case nsIDataType::VTYPE_INTERFACE_IS:

View File

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; 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 JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Martin Honnen
*
* 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 gTestfile = '10.1.3-2.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 395907;
var summary = 'eval of function declaration should change existing variable';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = 'typeof x: number, typeof x: function, x(): true';
var x = "string";
function f () {
var x = 0;
actual += 'typeof x: ' + (typeof x) + ', ';
eval('function x() { return true; }');
actual += 'typeof x: ' + (typeof x) + ', ';
actual += 'x(): ' + x();
}
f();
reportCompare(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 2; 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 JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Seno Aiko
*
* 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 gTestfile = 'regress-396326.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 396326;
var summary = 'Do not assert trying to disassemble get(var|arg) prop';
var actual = 'No Crash';
var expect = 'No Crash';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof dis == 'undefined')
{
print('disassembly not supported. test skipped.');
reportCompare(expect, actual, summary);
}
else
{
function f1() { var v; return v.prop };
dis(f1);
reportCompare(expect, actual, summary +
': function f1() { var v; return v.prop };');
function f2(arg) { return arg.prop };
dis(f2);
reportCompare(expect, actual, summary +
': function f2(arg) { return arg.prop };');
function f3() { return this.prop };
dis(f3);
reportCompare(expect, actual, summary +
': function f3() { return this.prop };');
}
exitFunc ('test');
}

View File

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; 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 JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Seno Aiko
*
* 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 gTestfile = 'regress-396326.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 396326;
var summary = 'Do not assert trying to disassemble get(var|arg) prop';
var actual = 'No Crash';
var expect = 'No Crash';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof dis == 'undefined')
{
print('disassembly not supported. test skipped.');
reportCompare(expect, actual, summary);
}
else
{
function f4() { let local; return local.prop };
dis(f4);
reportCompare(expect, actual, summary +
': function f4() { let local; return local.prop };');
}
exitFunc ('test');
}

View File

@ -13020,11 +13020,6 @@ nsCSSFrameConstructor::ProcessPendingRestyles()
delete [] restylesToProcess;
// Run the XBL binding constructors for any new frames we've constructed.
// Note that the restyle event is holding a strong ref to us, so we're ok
// here.
mDocument->BindingManager()->ProcessAttachedQueue();
EndUpdate();
#ifdef DEBUG
@ -13071,7 +13066,7 @@ NS_IMETHODIMP nsCSSFrameConstructor::RestyleEvent::Run() {
if (!mConstructor)
return NS_OK; // event was revoked
nsIViewManager* viewManager =
nsCOMPtr<nsIViewManager> viewManager =
mConstructor->mPresShell->GetViewManager();
NS_ASSERTION(viewManager, "Must have view manager for update");
@ -13087,6 +13082,7 @@ NS_IMETHODIMP nsCSSFrameConstructor::RestyleEvent::Run() {
mConstructor->mRestyleEvent.Forget();
mConstructor->ProcessPendingRestyles();
mConstructor->mDocument->BindingManager()->ProcessAttachedQueue();
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
return NS_OK;

View File

@ -171,8 +171,9 @@ private:
public:
// Note: It's the caller's responsibility to make sure to wrap a
// ProcessPendingRestyles call in a view update batch.
// ProcessPendingRestyles will handle calling ProcessAttachedQueue() on the
// binding manager.
// This function does not call ProcessAttachedQueue() on the binding manager.
// If the caller wants that to happen synchronously, it needs to handle that
// itself.
void ProcessPendingRestyles();
void PostRestyleEvent(nsIContent* aContent, nsReStyleHint aRestyleHint,

View File

@ -4418,6 +4418,10 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
mFrameConstructor->ProcessPendingRestyles();
}
if (!mIsDestroying) {
mDocument->BindingManager()->ProcessAttachedQueue();
}
if (aType >= Flush_Layout && !mIsDestroying) {
mFrameConstructor->RecalcQuotesAndCounters();
ProcessReflowCommands(aInterruptibleReflow);

View File

@ -323,6 +323,17 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection*
mSelectionWasCollapsed = collapsed;
if (!mFrame) {
return NS_OK;
}
nsCOMPtr<nsIContent> focusedContent;
mFrame->PresContext()->EventStateManager()->
GetFocusedContent(getter_AddRefs(focusedContent));
if (focusedContent != mFrame->GetContent()) {
return NS_OK;
}
return UpdateTextInputCommands(NS_LITERAL_STRING("select"));
}

View File

@ -2032,6 +2032,8 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
if (NS_FAILED(rv))
return rv;
// Keep frameSelection alive.
nsRefPtr<nsFrameSelection> frameSelection = GetFrameSelection();
nsCOMPtr<nsISelection> selection;
if (NS_SUCCEEDED(selcon->GetSelection(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(selection)))){
@ -2045,7 +2047,7 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
//no release
// maintain selection
return GetFrameSelection()->MaintainSelection(aAmountBack);
return frameSelection->MaintainSelection(aAmountBack);
}
// Figure out which view we should point capturing at, given that drag started
@ -5184,7 +5186,7 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize)
"Computed overflow area must contain frame bounds");
const nsStyleDisplay *disp = GetStyleDisplay();
if (IsThemed(disp)) {
if (!IsBoxWrapped() && IsThemed(disp)) {
nsRect r;
nsPresContext *presContext = PresContext();
if (presContext->GetTheme()->

View File

@ -0,0 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<span id="test">constructor onload </span>
</body>
</html>

View File

@ -0,0 +1,39 @@
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="xbltest">
<implementation>
<constructor>
<![CDATA[
str += "constructor "
testFinished();
]]>
</constructor>
</implementation>
</binding>
</bindings>
</head>
<body>
<span id="test" style="-moz-binding: url(#xbltest)"></span>
<script class="testbody" type="text/javascript">
<![CDATA[
var testsToFinish = 2;
var str = "";
function testFinished() {
--testsToFinish;
if (!testsToFinish) {
document.getElementById("test").textContent = str;
document.documentElement.className = '';
}
}
window.onload = function() {
str += "onload ";
testFinished();
}
]]>
</script>
</body>
</html>

View File

@ -378,3 +378,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug
== 393671-3.html 393671-3-ref.html
== 394111-1.html about:blank # Really an assertion test rather than a rendering test
== 394534-1.html 394534-1-ref.html
== 394676-1.xhtml 394676-1-ref.xhtml

View File

@ -254,6 +254,28 @@ nsMenuPopupFrame::SetInitialChildList(nsIAtom* aListName,
return nsBoxFrame::SetInitialChildList(aListName, aChildList);
}
PRBool
nsMenuPopupFrame::IsLeaf() const
{
if (mGeneratedChildren)
return PR_FALSE;
if (mPopupType != ePopupTypeMenu) {
// any panel with a type attribute, such as the autocomplete popup,
// is always generated right away.
return !mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::type);
}
// menu popups generate their child frames lazily only when opened, so
// behave like a leaf frame. However, generate child frames normally if
// the parent menu has a sizetopopup attribute. In this case the size of
// the parent menu is dependant on the size of the popup, so the frames
// need to exist in order to calculate this size.
nsIContent* parentContent = mContent->GetParent();
return (parentContent &&
!parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup));
}
void
nsMenuPopupFrame::AdjustView()
{

View File

@ -183,22 +183,7 @@ public:
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
nsIFrame* aChildList);
virtual PRBool IsLeaf() const
{
if (!mGeneratedChildren && mPopupType == ePopupTypeMenu) {
// menu popups generate their child frames lazily only when opened, so
// behave like a leaf frame. However, generate child frames normally if
// the parent menu has a sizetopopup attribute. In this case the size of
// the parent menu is dependant on the size of the popup, so the frames
// need to exist in order to calculate this size.
nsIContent* parentContent = mContent->GetParent();
if (parentContent &&
!parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup))
return PR_TRUE;
}
return PR_FALSE;
}
virtual PRBool IsLeaf() const;
// AdjustView should be called by the parent frame after the popup has been
// laid out, so that the view can be shown.

View File

@ -44,9 +44,15 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(srcdir)/objs.mk
DIRS =
ifdef MOZ_ZIPWRITER
DIRS += zipwriter
endif
ifdef MOZ_INSTALLER
# Linux and Solaris installer needs standalone libjar
DIRS = standalone
DIRS += standalone
# Make this a true dynamic component even in static builds because
# this component is shared by installer

View File

@ -0,0 +1,53 @@
# ***** 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 Zip Writer Component.
#
# The Initial Developer of the Original Code is
# Dave Townsend <dtownsend@oxymoronical.com>.
#
# Portions created by the Initial Developer are Copyright (C) 2007
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = zipwriter
DIRS = public src
#ifdef ENABLE_TESTS
#DIRS += test
#endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,51 @@
# ***** 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 Zip Writer Component.
#
# The Initial Developer of the Original Code is
# Dave Townsend <dtownsend@oxymoronical.com>.
#
# Portions created by the Initial Developer are Copyright (C) 2007
# 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 *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = zipwriter
XPIDLSRCS = \
nsIZipWriter.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,242 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* 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 *****
*/
#include "nsISupports.idl"
interface nsIChannel;
interface nsIInputStream;
interface nsIRequestObserver;
interface nsIFile;
interface nsIZipEntry;
/**
* nsIZipWriter
*
* An interface for a zip archiver that can be used from script.
*
* The interface supports both a synchronous method of archiving data and a
* queueing system to allow operations to be prepared then run in sequence
* with notification after completion.
*
* Operations added to the queue do not get performed until performQueue is
* called at which point they will be performed in the order that they were
* added to the queue.
*
* Operations performed on the queue will throw any errors out to the
* observer.
*
* An attempt to perform a synchronous operation while the background queue
* is in progress will throw NS_ERROR_IN_PROGRESS.
*
* Entry names should use /'s as path separators and should not start with
* a /.
*
* It is not generally necessary to add directory entries in order to add file
* entries within them, however it is possible that some zip programs may
* experience problems what that.
*/
[scriptable, uuid(6d4ef074-206c-4649-9884-57bc355864d6)]
interface nsIZipWriter : nsISupports
{
/**
* Some predefined compression levels
*/
const PRUint32 COMPRESSION_NONE = 0;
const PRUint32 COMPRESSION_FASTEST = 1;
const PRUint32 COMPRESSION_DEFAULT = 6;
const PRUint32 COMPRESSION_BEST = 9;
/**
* Gets or sets the comment associated with the open zip file.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
*/
attribute ACString comment;
/**
* Indicates that operations on the background queue are being performed.
*/
readonly attribute boolean inQueue;
/**
* The file that the zipwriter is writing to.
*/
readonly attribute nsIFile file;
/**
* Opens a zip file.
*
* @param aFile the zip file to open
* @param aIoFlags the open flags for the zip file from prio.h
*
* @throws NS_ERROR_ALREADY_INITIALIZED if a zip file is already open
* @throws NS_ERROR_INVALID_ARG if aFile is null
* @throws NS_ERROR_FILE_NOT_FOUND if aFile does not exist and flags did
* not allow for creation
* @throws NS_ERROR_FILE_CORRUPTED if the file does not contain zip markers
* @throws <other-error> on failure to open zip file (most likely corrupt
* or unsupported form)
*/
void open(in nsIFile aFile, in PRInt32 aIoFlags);
/**
* Returns a nsIZipEntry describing a specified zip entry or null if there
* is no such entry in the zip file
*
* @param aZipEntry the path of the entry
*/
nsIZipEntry getEntry(in AUTF8String aZipEntry);
/**
* Checks whether the zipfile contains an entry specified by zipEntry.
*
* @param aZipEntry the path of the entry
*/
boolean hasEntry(in AUTF8String aZipEntry);
/**
* Adds a new directory entry to the zip file. If aZipEntry does not end with
* "/" then it will be added.
*
* @param aZipEntry the path of the directory entry
* @param aModTime the modification time of the entry in microseconds
* @param aQueue adds the operation to the background queue. Will be
* performed when processQueue is called.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the
* file
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
*/
void addEntryDirectory(in AUTF8String aZipEntry, in PRTime aModTime,
in boolean aQueue);
/**
* Adds a new file or directory to the zip file. If the specified file is
* a directory then this will be equivalent to a call to
* addEntryDirectory(aZipEntry, aFile.lastModifiedTime, aQueue)
*
* @param aZipEntry the path of the file entry
* @param aCompression the compression level, 0 is no compression, 9 is best
* @param aFile the file to get the data and modification time from
* @param aQueue adds the operation to the background queue. Will be
* performed when processQueue is called.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
* @throws NS_ERROR_FILE_NOT_FOUND if file does not exist
*/
void addEntryFile(in AUTF8String aZipEntry,
in PRInt32 aCompression, in nsIFile aFile,
in boolean aQueue);
/**
* Adds data from a channel to the zip file. If the operation is performed
* on the queue then the channel will be opened asynchronously, otherwise
* the channel must support being opened synchronously.
*
* @param aZipEntry the path of the file entry
* @param aModTime the modification time of the entry in microseconds
* @param aCompression the compression level, 0 is no compression, 9 is best
* @param aChannel the channel to get the data from
* @param aQueue adds the operation to the background queue. Will be
* performed when processQueue is called.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
*/
void addEntryChannel(in AUTF8String aZipEntry, in PRTime aModTime,
in PRInt32 aCompression, in nsIChannel aChannel,
in boolean aQueue);
/**
* Adds data from an input stream to the zip file.
*
* @param aZipEntry the path of the file entry
* @param aModTime the modification time of the entry in microseconds
* @param aCompression the compression level, 0 is no compression, 9 is best
* @param aStream the input stream to get the data from
* @param aQueue adds the operation to the background queue. Will be
* performed when processQueue is called.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
*/
void addEntryStream(in AUTF8String aZipEntry, in PRTime aModTime,
in PRInt32 aCompression, in nsIInputStream aStream,
in boolean aQueue);
/**
* Removes an existing entry from the zip file.
*
* @param aZipEntry the path of the entry to be removed
* @param aQueue adds the operation to the background queue. Will be
* performed when processQueue is called.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
* @throws NS_ERROR_FILE_NOT_FOUND if no entry with the given path exists
* @throws <other-error> on failure to update the zip file
*/
void removeEntry(in AUTF8String aZipEntry, in boolean aQueue);
/**
* Processes all queued items until complete or some error occurs. The
* observer will be notified when the first operation starts and when the
* last operation completes. Any failures will be passed to the observer.
* The zip writer will be busy until the queue is complete or some error
* halted processing of the queue early. In the event of an early failure,
* remaining items will stay in the queue and calling processQueue will
* continue.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_IN_PROGRESS if the queue is already in progress
*/
void processQueue(in nsIRequestObserver aObserver, in nsISupports aContext);
/**
* Closes the zip file.
*
* @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
* @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
* @throws <other-error> on failure to complete the zip file
*/
void close();
};

View File

@ -0,0 +1,74 @@
# ***** 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 Zip Writer Component.
#
# The Initial Developer of the Original Code is
# Dave Townsend <dtownsend@oxymoronical.com>.
#
# Portions created by the Initial Developer are Copyright (C) 2007
# 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 *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = zipwriter
LIBRARY_NAME = zipwriter
MODULE_NAME = ZipWriterModule
EXPORT_LIBRARY = 1
LIBXUL_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = \
xpcom \
string \
necko \
jar \
$(ZLIB_REQUIRES) \
$(NULL)
CPPSRCS = \
StreamFunctions.cpp \
nsDeflateConverter.cpp \
nsZipHeader.cpp \
nsZipDataStream.cpp \
nsZipWriter.cpp \
ZipWriterModule.cpp \
$(NULL)
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS += \
$(MOZ_COMPONENT_LIBS) \
$(ZLIB_LIBS) \
$(NULL)

View File

@ -0,0 +1,82 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mook <mook.moz+random.code@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
* 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 *****
*/
#include "nscore.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
/*
* Fully reads the required amount of data. Keeps reading until all the
* data is retrieved or an error is hit.
*/
NS_HIDDEN_(nsresult) ZW_ReadData(nsIInputStream *aStream, char *aBuffer, PRUint32 aCount)
{
while (aCount > 0) {
PRUint32 read;
nsresult rv = aStream->Read(aBuffer, aCount, &read);
NS_ENSURE_SUCCESS(rv, rv);
aCount -= read;
aBuffer += read;
// If we hit EOF before reading the data we need then throw.
if (read == 0 && aCount > 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
/*
* Fully writes the required amount of data. Keeps writing untill all the
* data is written or an error is hit.
*/
NS_HIDDEN_(nsresult) ZW_WriteData(nsIOutputStream *aStream, const char *aBuffer,
PRUint32 aCount)
{
while (aCount > 0) {
PRUint32 written;
nsresult rv = aStream->Write(aBuffer, aCount, &written);
NS_ENSURE_SUCCESS(rv, rv);
if (written <= 0)
return NS_ERROR_FAILURE;
aCount -= written;
aBuffer += written;
}
return NS_OK;
}

View File

@ -0,0 +1,98 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mook <mook.moz+random.code@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
* 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 *****
*/
#ifndef _nsStreamFunctions_h_
#define _nsStreamFunctions_h_
#include "nscore.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
/*
* ZIP file data is stored little-endian. These are helper functions to read and
* write little endian data to/from a char buffer.
* The off argument is incremented according to the number of bytes consumed
* from the buffer.
*/
inline NS_HIDDEN_(void) WRITE8(char* buf, PRUint32* off, PRUint8 val)
{
buf[(*off)++] = val & 0xff;
}
inline NS_HIDDEN_(void) WRITE16(char* buf, PRUint32* off, PRUint16 val)
{
buf[(*off)++] = val & 0xff;
buf[(*off)++] = (val >> 8) & 0xff;
}
inline NS_HIDDEN_(void) WRITE32(char* buf, PRUint32* off, PRUint32 val)
{
buf[(*off)++] = val & 0xff;
buf[(*off)++] = (val >> 8) & 0xff;
buf[(*off)++] = (val >> 16) & 0xff;
buf[(*off)++] = (val >> 24) & 0xff;
}
inline NS_HIDDEN_(PRUint8) READ8(char* buf, PRUint32* off)
{
return (PRUint8)buf[(*off)++];
}
inline NS_HIDDEN_(PRUint16) READ16(char* buf, PRUint32* off)
{
PRUint16 val = (PRUint16)buf[(*off)++] & 0xff;
val |= ((PRUint16)buf[(*off)++] & 0xff) << 8;
return val;
}
inline NS_HIDDEN_(PRUint32) READ32(char* buf, PRUint32* off)
{
PRUint32 val = (PRUint32)buf[(*off)++] & 0xff;
val |= ((PRUint32)buf[(*off)++] & 0xff) << 8;
val |= ((PRUint32)buf[(*off)++] & 0xff) << 16;
val |= ((PRUint32)buf[(*off)++] & 0xff) << 24;
return val;
}
NS_HIDDEN_(nsresult) ZW_ReadData(nsIInputStream *aStream, char *aBuffer, PRUint32 aCount);
NS_HIDDEN_(nsresult) ZW_WriteData(nsIOutputStream *aStream, const char *aBuffer,
PRUint32 aCount);
#endif

View File

@ -0,0 +1,62 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* 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 *****
*/
#include "nsIGenericFactory.h"
#include "nsDeflateConverter.h"
#include "nsZipWriter.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeflateConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipWriter)
static nsModuleComponentInfo components[] =
{
{
DEFLATECONVERTER_CLASSNAME,
DEFLATECONVERTER_CID,
DEFLATECONVERTER_CONTRACTID,
nsDeflateConverterConstructor,
},
{
ZIPWRITER_CLASSNAME,
ZIPWRITER_CID,
ZIPWRITER_CONTRACTID,
nsZipWriterConstructor,
}
};
NS_IMPL_NSGETMODULE(ZipWriterModule, components)

View File

@ -0,0 +1,198 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Lan Qiang <jameslan@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
* 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 *****
*/
#include "StreamFunctions.h"
#include "nsDeflateConverter.h"
#include "nsIStringStream.h"
#include "nsIInputStreamPump.h"
#include "nsComponentManagerUtils.h"
#include "nsMemory.h"
#include "nsAutoPtr.h"
/**
* nsDeflateConverter is a stream converter applies the deflate compression
* method to the data.
*/
NS_IMPL_ISUPPORTS3(nsDeflateConverter, nsIStreamConverter,
nsIStreamListener,
nsIRequestObserver)
nsresult nsDeflateConverter::Init()
{
int zerr;
mOffset = 0;
mZstream.zalloc = Z_NULL;
mZstream.zfree = Z_NULL;
mZstream.opaque = Z_NULL;
zerr = deflateInit2(&mZstream, mLevel, Z_DEFLATED, -MAX_WBITS, 8,
Z_DEFAULT_STRATEGY);
if (zerr != Z_OK) return NS_ERROR_OUT_OF_MEMORY;
mZstream.next_out = mWriteBuffer;
mZstream.avail_out = sizeof(mWriteBuffer);
return NS_OK;
}
/* nsIInputStream convert (in nsIInputStream aFromStream, in string aFromType
* in string aToType, in nsISupports aCtxt); */
NS_IMETHODIMP nsDeflateConverter::Convert(nsIInputStream *aFromStream,
const char *aFromType,
const char *aToType,
nsISupports *aCtxt,
nsIInputStream **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void asyncConvertData (in string aFromType, in string aToType,
* in nsIStreamListener aListener,
* in nsISupports aCtxt); */
NS_IMETHODIMP nsDeflateConverter::AsyncConvertData(const char *aFromType,
const char *aToType,
nsIStreamListener *aListener,
nsISupports *aCtxt)
{
if (mListener)
return NS_ERROR_ALREADY_INITIALIZED;
NS_ENSURE_ARG_POINTER(aListener);
nsresult rv = Init();
NS_ENSURE_SUCCESS(rv, rv);
mListener = aListener;
mContext = aCtxt;
return rv;
}
/* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext,
* in nsIInputStream aInputStream,
* in unsigned long aOffset, in unsigned long aCount); */
NS_IMETHODIMP nsDeflateConverter::OnDataAvailable(nsIRequest *aRequest,
nsISupports *aContext,
nsIInputStream *aInputStream,
PRUint32 aOffset,
PRUint32 aCount)
{
if (!mListener)
return NS_ERROR_NOT_INITIALIZED;
nsAutoArrayPtr<char> buffer(new char[aCount]);
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = ZW_ReadData(aInputStream, buffer.get(), aCount);
NS_ENSURE_SUCCESS(rv, rv);
// make sure we aren't reading too much
mZstream.avail_in = aCount;
mZstream.next_in = (unsigned char*)buffer.get();
int zerr = Z_OK;
// deflate loop
while (mZstream.avail_in > 0 && zerr == Z_OK) {
zerr = deflate(&mZstream, Z_NO_FLUSH);
while (mZstream.avail_out == 0) {
// buffer is full, push the data out to the listener
rv = PushAvailableData(aRequest, aContext);
NS_ENSURE_SUCCESS(rv, rv);
zerr = deflate(&mZstream, Z_NO_FLUSH);
}
}
return NS_OK;
}
/* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
NS_IMETHODIMP nsDeflateConverter::OnStartRequest(nsIRequest *aRequest,
nsISupports *aContext)
{
if (!mListener)
return NS_ERROR_NOT_INITIALIZED;
return mListener->OnStartRequest(aRequest, mContext);
}
/* void onStopRequest (in nsIRequest aRequest, in nsISupports aContext,
* in nsresult aStatusCode); */
NS_IMETHODIMP nsDeflateConverter::OnStopRequest(nsIRequest *aRequest,
nsISupports *aContext,
nsresult aStatusCode)
{
if (!mListener)
return NS_ERROR_NOT_INITIALIZED;
nsresult rv;
int zerr;
do {
zerr = deflate(&mZstream, Z_FINISH);
rv = PushAvailableData(aRequest, aContext);
NS_ENSURE_SUCCESS(rv, rv);
} while (zerr == Z_OK);
deflateEnd(&mZstream);
return mListener->OnStopRequest(aRequest, mContext, aStatusCode);
}
nsresult nsDeflateConverter::PushAvailableData(nsIRequest *aRequest,
nsISupports *aContext)
{
nsresult rv;
nsCOMPtr<nsIStringInputStream> stream =
do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 bytesToWrite = ZIP_BUFLEN - mZstream.avail_out;
stream->ShareData((char*)mWriteBuffer, bytesToWrite);
rv = mListener->OnDataAvailable(aRequest, mContext, stream, mOffset,
bytesToWrite);
// now set the state for 'deflate'
mZstream.next_out = mWriteBuffer;
mZstream.avail_out = sizeof(mWriteBuffer);
mOffset += bytesToWrite;
return rv;
}

View File

@ -0,0 +1,91 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Lan Qiang <jameslan@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
* 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 *****
*/
#ifndef _nsDeflateConverter_h_
#define _nsDeflateConverter_h_
#include "nsIStreamConverter.h"
#include "nsCOMPtr.h"
#include "nsIPipe.h"
#include "zlib.h"
#define DEFLATECONVERTER_CONTRACTID \
"@mozilla.org/streamconv;1?from=uncompressed&to=deflate"
#define DEFLATECONVERTER_CLASSNAME "Deflate converter"
#define DEFLATECONVERTER_CID { 0x461cd5dd, 0x73c6, 0x47a4, \
{ 0x8c, 0xc3, 0x60, 0x3b, 0x37, 0xd8, 0x4a, 0x61 } }
#define ZIP_BUFLEN (4 * 1024 - 1)
class nsDeflateConverter : public nsIStreamConverter
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSISTREAMCONVERTER
nsDeflateConverter()
{
mLevel = Z_DEFAULT_COMPRESSION;
}
nsDeflateConverter(PRInt32 level)
{
mLevel = level;
}
private:
~nsDeflateConverter()
{
}
PRUint32 mOffset;
PRInt32 mLevel;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsISupports> mContext;
z_stream mZstream;
unsigned char mWriteBuffer[ZIP_BUFLEN];
nsresult Init();
nsresult PushAvailableData(nsIRequest *aRequest, nsISupports *aContext);
};
#endif

View File

@ -0,0 +1,230 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mook <mook.moz+random.code@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
* 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 *****
*/
#include "StreamFunctions.h"
#include "nsZipDataStream.h"
#include "nsIStringStream.h"
#include "nsISeekableStream.h"
#include "nsDeflateConverter.h"
#include "nsNetUtil.h"
#include "nsComponentManagerUtils.h"
#include "nsMemory.h"
#define ZIP_METHOD_STORE 0
#define ZIP_METHOD_DEFLATE 8
/**
* nsZipDataStream handles the writing an entry's into the zip file.
* It is set up to wither write the data as is, or in the event that compression
* has been requested to pass it through a stream converter.
* Currently only the deflate compression method is supported.
* The CRC checksum for the entry's data is also generated here.
*/
NS_IMPL_THREADSAFE_ISUPPORTS2(nsZipDataStream, nsIStreamListener,
nsIRequestObserver)
nsresult nsZipDataStream::Init(nsZipWriter *aWriter,
nsIOutputStream *aStream,
nsZipHeader *aHeader,
PRInt32 aCompression)
{
mWriter = aWriter;
mHeader = aHeader;
mStream = aStream;
mHeader->mCRC = crc32(0L, Z_NULL, 0);
nsresult rv = NS_NewSimpleStreamListener(getter_AddRefs(mOutput), aStream,
nsnull);
NS_ENSURE_SUCCESS(rv, rv);
if (aCompression > 0) {
mHeader->mMethod = ZIP_METHOD_DEFLATE;
nsCOMPtr<nsIStreamConverter> converter =
new nsDeflateConverter(aCompression);
NS_ENSURE_TRUE(converter, NS_ERROR_OUT_OF_MEMORY);
rv = converter->AsyncConvertData("uncompressed", "deflate", mOutput,
nsnull);
NS_ENSURE_SUCCESS(rv, rv);
mOutput = do_QueryInterface(converter, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
else {
mHeader->mMethod = ZIP_METHOD_STORE;
}
return NS_OK;
}
/* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext,
* in nsIInputStream aInputStream,
* in unsigned long aOffset, in unsigned long aCount); */
NS_IMETHODIMP nsZipDataStream::OnDataAvailable(nsIRequest *aRequest,
nsISupports *aContext,
nsIInputStream *aInputStream,
PRUint32 aOffset,
PRUint32 aCount)
{
if (!mOutput)
return NS_ERROR_NOT_INITIALIZED;
nsAutoArrayPtr<char> buffer(new char[aCount]);
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = ZW_ReadData(aInputStream, buffer.get(), aCount);
NS_ENSURE_SUCCESS(rv, rv);
return ProcessData(aRequest, aContext, buffer.get(), aOffset, aCount);
}
/* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
NS_IMETHODIMP nsZipDataStream::OnStartRequest(nsIRequest *aRequest,
nsISupports *aContext)
{
if (!mOutput)
return NS_ERROR_NOT_INITIALIZED;
return mOutput->OnStartRequest(aRequest, aContext);
}
/* void onStopRequest (in nsIRequest aRequest, in nsISupports aContext,
* in nsresult aStatusCode); */
NS_IMETHODIMP nsZipDataStream::OnStopRequest(nsIRequest *aRequest,
nsISupports *aContext,
nsresult aStatusCode)
{
if (!mOutput)
return NS_ERROR_NOT_INITIALIZED;
nsresult rv = mOutput->OnStopRequest(aRequest, aContext, aStatusCode);
mOutput = nsnull;
if (NS_FAILED(rv)) {
mWriter->EntryCompleteCallback(mHeader, rv);
}
else {
rv = CompleteEntry();
rv = mWriter->EntryCompleteCallback(mHeader, rv);
}
mStream = nsnull;
mWriter = nsnull;
mHeader = nsnull;
return rv;
}
inline nsresult nsZipDataStream::CompleteEntry()
{
nsresult rv = mStream->Flush();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mStream, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 pos;
rv = seekable->Tell(&pos);
NS_ENSURE_SUCCESS(rv, rv);
mHeader->mCSize = pos - mHeader->mOffset - mHeader->GetFileHeaderLength();
// Go back and rewrite the file header
rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, mHeader->mOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = mHeader->WriteFileHeader(mStream);
NS_ENSURE_SUCCESS(rv, rv);
rv = mStream->Flush();
NS_ENSURE_SUCCESS(rv, rv);
rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, pos);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
nsresult nsZipDataStream::ProcessData(nsIRequest *aRequest,
nsISupports *aContext, char *aBuffer,
PRUint32 aOffset, PRUint32 aCount)
{
mHeader->mCRC = crc32(mHeader->mCRC,
reinterpret_cast<const unsigned char*>(aBuffer),
aCount);
nsresult rv;
nsCOMPtr<nsIStringInputStream> stream =
do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
stream->ShareData(aBuffer, aCount);
rv = mOutput->OnDataAvailable(aRequest, aContext, stream, aOffset, aCount);
mHeader->mUSize += aCount;
return rv;
}
nsresult nsZipDataStream::ReadStream(nsIInputStream *aStream)
{
if (!mOutput)
return NS_ERROR_NOT_INITIALIZED;
nsresult rv = OnStartRequest(nsnull, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoArrayPtr<char> buffer(new char[4096]);
NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
PRUint32 read = 0;
PRUint32 offset = 0;
do
{
rv = aStream->Read(buffer.get(), 4096, &read);
if (NS_FAILED(rv)) {
OnStopRequest(nsnull, nsnull, rv);
return rv;
}
if (read > 0) {
rv = ProcessData(nsnull, nsnull, buffer.get(), offset, read);
if (NS_FAILED(rv)) {
OnStopRequest(nsnull, nsnull, rv);
return rv;
}
offset += read;
}
} while (read > 0);
return OnStopRequest(nsnull, nsnull, NS_OK);
}

View File

@ -0,0 +1,76 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mook <mook.moz+random.code@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
* 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 *****
*/
#ifndef _nsZipDataStream_h_
#define _nsZipDataStream_h_
#include "nsZipWriter.h"
#include "nsIOutputStream.h"
#include "nsIStreamListener.h"
#include "nsAutoPtr.h"
class nsZipDataStream : public nsIStreamListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
nsZipDataStream()
{
}
nsresult Init(nsZipWriter *aWriter, nsIOutputStream *aStream,
nsZipHeader *aHeader, PRInt32 aCompression);
nsresult ReadStream(nsIInputStream *aStream);
private:
nsCOMPtr<nsIStreamListener> mOutput;
nsCOMPtr<nsIOutputStream> mStream;
nsRefPtr<nsZipWriter> mWriter;
nsRefPtr<nsZipHeader> mHeader;
nsresult CompleteEntry();
nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext,
char *aBuffer, PRUint32 aOffset, PRUint32 aCount);
};
#endif

View File

@ -0,0 +1,292 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* 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 *****
*/
#include "StreamFunctions.h"
#include "nsZipHeader.h"
#include "nsMemory.h"
#define ZIP_FILE_HEADER_SIGNATURE 0x04034b50
#define ZIP_FILE_HEADER_SIZE 30
#define ZIP_CDS_HEADER_SIGNATURE 0x02014b50
#define ZIP_CDS_HEADER_SIZE 46
#define FLAGS_IS_UTF8 0x800
/**
* nsZipHeader represents an entry from a zip file.
*/
NS_IMPL_ISUPPORTS1(nsZipHeader, nsIZipEntry)
/* readonly attribute unsigned short compression; */
NS_IMETHODIMP nsZipHeader::GetCompression(PRUint16 *aCompression)
{
NS_ASSERTION(mInited, "Not initalised");
*aCompression = mMethod;
return NS_OK;
}
/* readonly attribute unsigned long size; */
NS_IMETHODIMP nsZipHeader::GetSize(PRUint32 *aSize)
{
NS_ASSERTION(mInited, "Not initalised");
*aSize = mCSize;
return NS_OK;
}
/* readonly attribute unsigned long realSize; */
NS_IMETHODIMP nsZipHeader::GetRealSize(PRUint32 *aRealSize)
{
NS_ASSERTION(mInited, "Not initalised");
*aRealSize = mUSize;
return NS_OK;
}
/* readonly attribute unsigned long CRC32; */
NS_IMETHODIMP nsZipHeader::GetCRC32(PRUint32 *aCRC32)
{
NS_ASSERTION(mInited, "Not initalised");
*aCRC32 = mCRC;
return NS_OK;
}
/* readonly attribute boolean isDirectory; */
NS_IMETHODIMP nsZipHeader::GetIsDirectory(PRBool *aIsDirectory)
{
NS_ASSERTION(mInited, "Not initalised");
if (mName.Last() == '/')
*aIsDirectory = PR_TRUE;
else
*aIsDirectory = PR_FALSE;
return NS_OK;
}
/* readonly attribute PRTime lastModifiedTime; */
NS_IMETHODIMP nsZipHeader::GetLastModifiedTime(PRTime *aLastModifiedTime)
{
NS_ASSERTION(mInited, "Not initalised");
PRExplodedTime time;
time.tm_usec = 0;
time.tm_hour = mTime >> 11;
time.tm_min = (mTime >> 5) & 0x3F;
time.tm_sec = (mTime & 0x1F) * 2;
time.tm_year = (mDate >> 9) + 1980;
time.tm_month = ((mDate >> 5) & 0x0F) - 1;
time.tm_mday = mDate & 0x1F;
time.tm_params.tp_gmt_offset = 0;
time.tm_params.tp_dst_offset = 0;
PR_NormalizeTime(&time, PR_GMTParameters);
time.tm_params = PR_LocalTimeParameters(&time);
*aLastModifiedTime = PR_ImplodeTime(&time);
return NS_OK;
}
/* readonly attribute boolean isSynthetic; */
NS_IMETHODIMP nsZipHeader::GetIsSynthetic(PRBool *aIsSynthetic)
{
NS_ASSERTION(mInited, "Not initalised");
*aIsSynthetic = PR_FALSE;
return NS_OK;
}
void nsZipHeader::Init(const nsACString & aPath, PRTime aDate, PRUint32 aAttr,
PRUint32 aOffset)
{
NS_ASSERTION(!mInited, "Already initalised");
PRExplodedTime time;
PR_ExplodeTime(aDate, PR_LocalTimeParameters, &time);
mTime = time.tm_sec / 2 + (time.tm_min << 5) + (time.tm_hour << 11);
mDate = time.tm_mday + ((time.tm_month + 1) << 5) +
((time.tm_year - 1980) << 9);
mEAttr = aAttr;
mOffset = aOffset;
mName = aPath;
mComment = NS_LITERAL_CSTRING("");
// Claim a UTF-8 path in case it needs it.
mFlags |= FLAGS_IS_UTF8;
mInited = PR_TRUE;
}
PRUint32 nsZipHeader::GetFileHeaderLength()
{
return ZIP_FILE_HEADER_SIZE + mName.Length();
}
nsresult nsZipHeader::WriteFileHeader(nsIOutputStream *aStream)
{
NS_ASSERTION(mInited, "Not initalised");
char buf[ZIP_FILE_HEADER_SIZE];
PRUint32 pos = 0;
WRITE32(buf, &pos, ZIP_FILE_HEADER_SIGNATURE);
WRITE16(buf, &pos, mVersionNeeded);
WRITE16(buf, &pos, mFlags);
WRITE16(buf, &pos, mMethod);
WRITE16(buf, &pos, mTime);
WRITE16(buf, &pos, mDate);
WRITE32(buf, &pos, mCRC);
WRITE32(buf, &pos, mCSize);
WRITE32(buf, &pos, mUSize);
WRITE16(buf, &pos, mName.Length());
WRITE16(buf, &pos, 0);
nsresult rv = ZW_WriteData(aStream, buf, pos);
NS_ENSURE_SUCCESS(rv, rv);
return ZW_WriteData(aStream, mName.get(), mName.Length());
}
PRUint32 nsZipHeader::GetCDSHeaderLength()
{
return ZIP_CDS_HEADER_SIZE + mName.Length() + mComment.Length() +
mFieldLength;
}
nsresult nsZipHeader::WriteCDSHeader(nsIOutputStream *aStream)
{
NS_ASSERTION(mInited, "Not initalised");
char buf[ZIP_CDS_HEADER_SIZE];
PRUint32 pos = 0;
WRITE32(buf, &pos, ZIP_CDS_HEADER_SIGNATURE);
WRITE16(buf, &pos, mVersionMade);
WRITE16(buf, &pos, mVersionNeeded);
WRITE16(buf, &pos, mFlags);
WRITE16(buf, &pos, mMethod);
WRITE16(buf, &pos, mTime);
WRITE16(buf, &pos, mDate);
WRITE32(buf, &pos, mCRC);
WRITE32(buf, &pos, mCSize);
WRITE32(buf, &pos, mUSize);
WRITE16(buf, &pos, mName.Length());
WRITE16(buf, &pos, mFieldLength);
WRITE16(buf, &pos, mComment.Length());
WRITE16(buf, &pos, mDisk);
WRITE16(buf, &pos, mIAttr);
WRITE32(buf, &pos, mEAttr);
WRITE32(buf, &pos, mOffset);
nsresult rv = ZW_WriteData(aStream, buf, pos);
NS_ENSURE_SUCCESS(rv, rv);
rv = ZW_WriteData(aStream, mName.get(), mName.Length());
NS_ENSURE_SUCCESS(rv, rv);
if (mExtraField) {
rv = ZW_WriteData(aStream, mExtraField, sizeof(mExtraField));
NS_ENSURE_SUCCESS(rv, rv);
}
return ZW_WriteData(aStream, mComment.get(), mComment.Length());
}
nsresult nsZipHeader::ReadCDSHeader(nsIInputStream *stream)
{
NS_ASSERTION(!mInited, "Already initalised");
char buf[ZIP_CDS_HEADER_SIZE];
nsresult rv = ZW_ReadData(stream, buf, ZIP_CDS_HEADER_SIZE);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 pos = 0;
PRUint32 signature = READ32(buf, &pos);
if (signature != ZIP_CDS_HEADER_SIGNATURE)
return NS_ERROR_FILE_CORRUPTED;
mVersionMade = READ16(buf, &pos);
mVersionNeeded = READ16(buf, &pos);
mFlags = READ16(buf, &pos);
mMethod = READ16(buf, &pos);
mTime = READ16(buf, &pos);
mDate = READ16(buf, &pos);
mCRC = READ32(buf, &pos);
mCSize = READ32(buf, &pos);
mUSize = READ32(buf, &pos);
PRUint16 namelength = READ16(buf, &pos);
PRUint16 fieldlength = READ16(buf, &pos);
PRUint16 commentlength = READ16(buf, &pos);
mDisk = READ16(buf, &pos);
mIAttr = READ16(buf, &pos);
mEAttr = READ32(buf, &pos);
mOffset = READ32(buf, &pos);
if (namelength > 0) {
nsAutoArrayPtr<char> field(new char[namelength]);
NS_ENSURE_TRUE(field, NS_ERROR_OUT_OF_MEMORY);
rv = ZW_ReadData(stream, field.get(), namelength);
NS_ENSURE_SUCCESS(rv, rv);
mName.Assign(field, namelength);
}
else
mName = NS_LITERAL_CSTRING("");
if (fieldlength > 0) {
mExtraField = new char[fieldlength];
NS_ENSURE_TRUE(mExtraField, NS_ERROR_OUT_OF_MEMORY);
rv = ZW_ReadData(stream, mExtraField.get(), fieldlength);
NS_ENSURE_SUCCESS(rv, rv);
}
if (commentlength > 0) {
nsAutoArrayPtr<char> field(new char[commentlength]);
NS_ENSURE_TRUE(field, NS_ERROR_OUT_OF_MEMORY);
rv = ZW_ReadData(stream, field.get(), commentlength);
NS_ENSURE_SUCCESS(rv, rv);
mComment.Assign(field, commentlength);
}
else
mComment = NS_LITERAL_CSTRING("");
mInited = PR_TRUE;
return NS_OK;
}

View File

@ -0,0 +1,110 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* 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 *****
*/
#ifndef _nsZipHeader_h_
#define _nsZipHeader_h_
#include "nsString.h"
#include "nsIOutputStream.h"
#include "nsIInputStream.h"
#include "nsIZipReader.h"
#include "nsAutoPtr.h"
#define ZIP_ATTRS_FILE 0
#define ZIP_ATTRS_DIRECTORY 16
class nsZipHeader : public nsIZipEntry
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIZIPENTRY
nsZipHeader() :
mCRC(0),
mCSize(0),
mUSize(0),
mEAttr(0),
mOffset(0),
mFieldLength(0),
mVersionMade(20),
mVersionNeeded(20),
mFlags(0),
mMethod(0),
mTime(0),
mDate(0),
mDisk(0),
mIAttr(0),
mInited(PR_FALSE),
mExtraField(NULL)
{
}
~nsZipHeader()
{
mExtraField = NULL;
}
PRUint32 mCRC;
PRUint32 mCSize;
PRUint32 mUSize;
PRUint32 mEAttr;
PRUint32 mOffset;
PRUint32 mFieldLength;
PRUint16 mVersionMade;
PRUint16 mVersionNeeded;
PRUint16 mFlags;
PRUint16 mMethod;
PRUint16 mTime;
PRUint16 mDate;
PRUint16 mDisk;
PRUint16 mIAttr;
PRPackedBool mInited;
nsCString mName;
nsCString mComment;
nsAutoArrayPtr<char> mExtraField;
void Init(const nsACString & aPath, PRTime aDate, PRUint32 aAttr,
PRUint32 aOffset);
PRUint32 GetFileHeaderLength();
nsresult WriteFileHeader(nsIOutputStream *aStream);
PRUint32 GetCDSHeaderLength();
nsresult WriteCDSHeader(nsIOutputStream *aStream);
nsresult ReadCDSHeader(nsIInputStream *aStream);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
/* ***** 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 Zip Writer Component.
*
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mook <mook.moz+random.code@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
* 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 *****
*/
#ifndef _nsZipWriter_h_
#define _nsZipWriter_h_
#include "nsIZipWriter.h"
#include "nsIFileStreams.h"
#include "nsIBufferedStreams.h"
#include "nsIRequestObserver.h"
#include "nsZipHeader.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsTArray.h"
#include "nsDataHashtable.h"
#define ZIPWRITER_CONTRACTID "@mozilla.org/zipwriter;1"
#define ZIPWRITER_CLASSNAME "Zip Writer"
#define ZIPWRITER_CID { 0x430d416c, 0xa722, 0x4ad1, \
{ 0xbe, 0x98, 0xd9, 0xa4, 0x45, 0xf8, 0x5e, 0x3f } }
#define OPERATION_ADD 0
#define OPERATION_REMOVE 1
struct nsZipQueueItem
{
public:
PRUint32 mOperation;
nsCString mZipEntry;
nsCOMPtr<nsIFile> mFile;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIInputStream> mStream;
PRTime mModTime;
PRInt32 mCompression;
};
class nsZipWriter : public nsIZipWriter,
public nsIRequestObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIZIPWRITER
NS_DECL_NSIREQUESTOBSERVER
nsZipWriter();
nsresult EntryCompleteCallback(nsZipHeader *aHeader, nsresult aStatus);
private:
~nsZipWriter();
PRUint32 mCDSOffset;
PRPackedBool mCDSDirty;
PRPackedBool mInQueue;
nsCOMPtr<nsIFile> mFile;
nsCOMPtr<nsIRequestObserver> mProcessObserver;
nsCOMPtr<nsISupports> mProcessContext;
nsCOMPtr<nsIOutputStream> mStream;
nsCOMArray<nsZipHeader> mHeaders;
nsTArray<nsZipQueueItem> mQueue;
nsDataHashtable<nsCStringHashKey, PRInt32> mEntryHash;
nsCString mComment;
nsresult SeekCDS();
void Cleanup();
nsresult ReadFile(nsIFile *aFile);
nsresult InternalAddEntryDirectory(const nsACString & aZipEntry,
PRTime aModTime);
nsresult BeginProcessingAddition(nsZipQueueItem* aItem, PRBool* complete);
nsresult BeginProcessingRemoval(PRInt32 aPos);
void BeginProcessingNextItem();
void FinishQueue(nsresult aStatus);
};
#endif

View File

@ -0,0 +1,51 @@
# ***** 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 Zip Writer Component.
#
# The Initial Developer of the Original Code is
# Dave Townsend <dtownsend@oxymoronical.com>.
#
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = test_zipwriter
XPCSHELL_TESTS = \
unit \
$(NULL)
include $(topsrcdir)/config/rules.mk

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,5 @@
This is a test text file for the zipwriter component.
It will be made available in the unit test directory.
It will also be compressed into a testcase zip file
made by a 3rd party zip tool to test the opening of
existing zip files.

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