mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-29 21:25:35 +00:00
Merge.
This commit is contained in:
commit
035cfa9657
@ -236,7 +236,7 @@ var StarUI = {
|
||||
if (!this._element("editBookmarkPanelContent").hidden) {
|
||||
var namePicker = this._element("editBMPanel_namePicker");
|
||||
namePicker.focus();
|
||||
namePicker.editor.selectAll();
|
||||
namePicker.select();
|
||||
}
|
||||
else
|
||||
this.panel.focus();
|
||||
@ -951,7 +951,11 @@ var PlacesMenuDNDController = {
|
||||
|
||||
var PlacesStarButton = {
|
||||
init: function PSB_init() {
|
||||
PlacesUtils.bookmarks.addObserver(this, false);
|
||||
try {
|
||||
PlacesUtils.bookmarks.addObserver(this, false);
|
||||
} catch(ex) {
|
||||
Components.utils.reportError("PlacesStarButton.init(): error adding bookmark observer: " + ex);
|
||||
}
|
||||
},
|
||||
|
||||
uninit: function PSB_uninit() {
|
||||
|
@ -1144,7 +1144,11 @@ function prepareForStartup() {
|
||||
gBrowser.browsers[0].removeAttribute("disablehistory");
|
||||
|
||||
// enable global history
|
||||
gBrowser.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
|
||||
try {
|
||||
gBrowser.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
|
||||
} catch(ex) {
|
||||
Components.utils.reportError("Places database may be locked: " + ex);
|
||||
}
|
||||
|
||||
// hook up UI through progress listener
|
||||
gBrowser.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
|
@ -628,8 +628,9 @@
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
aURI = ios.newURI(aURI, null, null);
|
||||
}
|
||||
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
|
||||
aURI, false);
|
||||
if (this.mFaviconService)
|
||||
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
|
||||
aURI, false);
|
||||
}
|
||||
|
||||
this.updateIcon(aTab);
|
||||
@ -728,7 +729,9 @@
|
||||
aURI = ios.newURI(aURI, null, null);
|
||||
}
|
||||
|
||||
return this.mFaviconService.isFailedFavicon(aURI);
|
||||
if (this.mFaviconService)
|
||||
return this.mFaviconService.isFailedFavicon(aURI);
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -23,6 +23,7 @@
|
||||
# Seth Spitzer <sspitzer@mozilla.com>
|
||||
# Asaf Romano <mano@mozilla.com>
|
||||
# Marco Bonardo <mak77@bonardo.net>
|
||||
# Dietrich Ayala <dietrich@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
|
||||
@ -70,18 +71,36 @@ const BrowserGlueServiceFactory = {
|
||||
// Constructor
|
||||
|
||||
function BrowserGlue() {
|
||||
|
||||
this.__defineGetter__("_prefs", function() {
|
||||
delete this._prefs;
|
||||
return this._prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
});
|
||||
|
||||
this.__defineGetter__("_bundleService", function() {
|
||||
delete this._bundleService;
|
||||
return this._bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService);
|
||||
});
|
||||
|
||||
this.__defineGetter__("_idleService", function() {
|
||||
delete this._idleService;
|
||||
return this._idleService = Cc["@mozilla.org/widget/idleservice;1"].
|
||||
getService(Ci.nsIIdleService);
|
||||
});
|
||||
|
||||
this.__defineGetter__("_observerService", function() {
|
||||
delete this._observerService;
|
||||
return this._observerService = Cc['@mozilla.org/observer-service;1'].
|
||||
getService(Ci.nsIObserverService);
|
||||
});
|
||||
|
||||
this._init();
|
||||
}
|
||||
|
||||
BrowserGlue.prototype = {
|
||||
__prefs: null,
|
||||
get _prefs() {
|
||||
if (!this.__prefs)
|
||||
this.__prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
return this.__prefs;
|
||||
},
|
||||
|
||||
|
||||
_saveSession: false,
|
||||
|
||||
_setPrefToSaveSession: function()
|
||||
@ -130,9 +149,18 @@ BrowserGlue.prototype = {
|
||||
break;
|
||||
case "places-init-complete":
|
||||
this._initPlaces();
|
||||
this._observerService.removeObserver(this, "places-init-complete");
|
||||
// no longer needed, since history was initialized completely.
|
||||
this._observerService.removeObserver(this, "places-database-locked");
|
||||
break;
|
||||
case "places-database-locked":
|
||||
this._isPlacesDatabaseLocked = true;
|
||||
// stop observing, so further attempts to load history service
|
||||
// do not show the prompt.
|
||||
this._observerService.removeObserver(this, "places-database-locked");
|
||||
break;
|
||||
case "idle":
|
||||
if (this.idleService.idleTime > BOOKMARKS_ARCHIVE_IDLE_TIME * 1000) {
|
||||
if (this._idleService.idleTime > BOOKMARKS_ARCHIVE_IDLE_TIME * 1000) {
|
||||
// Back up bookmarks.
|
||||
this._archiveBookmarks();
|
||||
}
|
||||
@ -144,8 +172,7 @@ BrowserGlue.prototype = {
|
||||
_init: function()
|
||||
{
|
||||
// observer registration
|
||||
const osvr = Cc['@mozilla.org/observer-service;1'].
|
||||
getService(Ci.nsIObserverService);
|
||||
const osvr = this._observerService;
|
||||
osvr.addObserver(this, "quit-application", false);
|
||||
osvr.addObserver(this, "xpcom-shutdown", false);
|
||||
osvr.addObserver(this, "prefservice:after-app-defaults", false);
|
||||
@ -156,14 +183,14 @@ BrowserGlue.prototype = {
|
||||
osvr.addObserver(this, "quit-application-granted", false);
|
||||
osvr.addObserver(this, "session-save", false);
|
||||
osvr.addObserver(this, "places-init-complete", false);
|
||||
osvr.addObserver(this, "places-database-locked", false);
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
_dispose: function()
|
||||
{
|
||||
// observer removal
|
||||
const osvr = Cc['@mozilla.org/observer-service;1'].
|
||||
getService(Ci.nsIObserverService);
|
||||
const osvr = this._observerService;
|
||||
osvr.removeObserver(this, "quit-application");
|
||||
osvr.removeObserver(this, "xpcom-shutdown");
|
||||
osvr.removeObserver(this, "prefservice:after-app-defaults");
|
||||
@ -173,7 +200,6 @@ BrowserGlue.prototype = {
|
||||
osvr.removeObserver(this, "quit-application-requested");
|
||||
osvr.removeObserver(this, "quit-application-granted");
|
||||
osvr.removeObserver(this, "session-save");
|
||||
osvr.removeObserver(this, "places-init-complete");
|
||||
},
|
||||
|
||||
_onAppDefaults: function()
|
||||
@ -206,16 +232,14 @@ BrowserGlue.prototype = {
|
||||
// handle any UI migration
|
||||
this._migrateUI();
|
||||
|
||||
const osvr = Cc['@mozilla.org/observer-service;1'].
|
||||
getService(Ci.nsIObserverService);
|
||||
osvr.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
this._observerService.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
},
|
||||
|
||||
// profile shutdown handler (contains profile cleanup routines)
|
||||
_onProfileShutdown: function()
|
||||
{
|
||||
this._shutdownPlaces();
|
||||
this.idleService.removeIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME);
|
||||
this._idleService.removeIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME);
|
||||
this.Sanitizer.onShutdown();
|
||||
},
|
||||
|
||||
@ -245,6 +269,15 @@ BrowserGlue.prototype = {
|
||||
ww.openWindow(null, EMURL, "_blank", EMFEATURES, args);
|
||||
this._prefs.clearUserPref(PREF_EM_NEW_ADDONS_LIST);
|
||||
}
|
||||
|
||||
// Load the "more info" page for a locked places.sqlite
|
||||
// This property is set earlier in the startup process:
|
||||
// nsPlacesDBFlush loads after profile-after-change and initializes
|
||||
// the history service, which sends out places-database-locked
|
||||
// which sets this property.
|
||||
if (this._isPlacesDatabaseLocked) {
|
||||
this._showPlacesLockedNotificationBox();
|
||||
}
|
||||
},
|
||||
|
||||
_onQuitRequest: function(aCancelQuit, aQuitType)
|
||||
@ -295,14 +328,12 @@ BrowserGlue.prototype = {
|
||||
return false;
|
||||
|
||||
var buttonChoice = 0;
|
||||
var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService);
|
||||
var quitBundle = bundleService.createBundle("chrome://browser/locale/quitDialog.properties");
|
||||
var brandBundle = bundleService.createBundle("chrome://branding/locale/brand.properties");
|
||||
var quitBundle = this._bundleService.createBundle("chrome://browser/locale/quitDialog.properties");
|
||||
var brandBundle = this._bundleService.createBundle("chrome://branding/locale/brand.properties");
|
||||
|
||||
var appName = brandBundle.GetStringFromName("brandShortName");
|
||||
var quitDialogTitle = quitBundle.formatStringFromName(aQuitType + "DialogTitle",
|
||||
[appName], 1);
|
||||
[appName], 1);
|
||||
|
||||
var message;
|
||||
if (aQuitType == "restart")
|
||||
@ -408,10 +439,8 @@ BrowserGlue.prototype = {
|
||||
var browser = win.gBrowser; // for closure in notification bar callback
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
|
||||
var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService);
|
||||
var brandBundle = bundleService.createBundle("chrome://branding/locale/brand.properties");
|
||||
var rightsBundle = bundleService.createBundle("chrome://browser/locale/aboutRights.properties");
|
||||
var brandBundle = this._bundleService.createBundle("chrome://branding/locale/brand.properties");
|
||||
var rightsBundle = this._bundleService.createBundle("chrome://browser/locale/aboutRights.properties");
|
||||
|
||||
var buttonLabel = rightsBundle.GetStringFromName("buttonLabel");
|
||||
var buttonAccessKey = rightsBundle.GetStringFromName("buttonAccessKey");
|
||||
@ -448,14 +477,6 @@ BrowserGlue.prototype = {
|
||||
return Sanitizer;
|
||||
},
|
||||
|
||||
_idleService: null,
|
||||
get idleService() {
|
||||
if (!this._idleService)
|
||||
this._idleService = Cc["@mozilla.org/widget/idleservice;1"].
|
||||
getService(Ci.nsIIdleService);
|
||||
return this._idleService;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize Places
|
||||
* - imports the bookmarks html file if bookmarks database is empty, try to
|
||||
@ -482,11 +503,12 @@ BrowserGlue.prototype = {
|
||||
// forced migration (due to a major schema change).
|
||||
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
var databaseStatus = histsvc.databaseStatus;
|
||||
|
||||
// If the database is corrupt or has been newly created we should
|
||||
// import bookmarks.
|
||||
var importBookmarks = databaseStatus != histsvc.DATABASE_STATUS_OK;
|
||||
var databaseStatus = histsvc.databaseStatus;
|
||||
var importBookmarks = databaseStatus == histsvc.DATABASE_STATUS_CREATE ||
|
||||
databaseStatus == histsvc.DATABASE_STATUS_CORRUPT;
|
||||
|
||||
// Check if user or an extension has required to import bookmarks.html
|
||||
var importBookmarksHTML = false;
|
||||
@ -584,7 +606,7 @@ BrowserGlue.prototype = {
|
||||
|
||||
// Initialize bookmark archiving on idle.
|
||||
// Once a day, either on idle or shutdown, bookmarks are backed up.
|
||||
this.idleService.addIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME);
|
||||
this._idleService.addIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -636,6 +658,44 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the notificationBox for a locked places database.
|
||||
*/
|
||||
_showPlacesLockedNotificationBox: function nsBrowserGlue__showPlacesLockedNotificationBox() {
|
||||
var brandBundle = this._bundleService.createBundle("chrome://branding/locale/brand.properties");
|
||||
var applicationName = brandBundle.GetStringFromName("brandShortName");
|
||||
var placesBundle = this._bundleService.createBundle("chrome://browser/locale/places/places.properties");
|
||||
var title = placesBundle.GetStringFromName("lockPrompt.title");
|
||||
var text = placesBundle.formatStringFromName("lockPrompt.text", [applicationName], 1);
|
||||
var buttonText = placesBundle.GetStringFromName("lockPromptInfoButton.label");
|
||||
var accessKey = placesBundle.GetStringFromName("lockPromptInfoButton.accessKey");
|
||||
|
||||
var helpTopic = "places-locked";
|
||||
var url = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Components.interfaces.nsIURLFormatter).
|
||||
formatURLPref("app.support.baseURL");
|
||||
url += helpTopic;
|
||||
|
||||
var browser = this.getMostRecentBrowserWindow().gBrowser;
|
||||
|
||||
var buttons = [
|
||||
{
|
||||
label: buttonText,
|
||||
accessKey: accessKey,
|
||||
popup: null,
|
||||
callback: function(aNotificationBar, aButton) {
|
||||
browser.selectedTab = browser.addTab(url);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var notifyBox = browser.getNotificationBox();
|
||||
var box = notifyBox.appendNotification(text, title, null,
|
||||
notifyBox.PRIORITY_CRITICAL_MEDIUM,
|
||||
buttons);
|
||||
box.persistence = -1; // Until user closes it
|
||||
},
|
||||
|
||||
_migrateUI: function bg__migrateUI() {
|
||||
var migration = 0;
|
||||
try {
|
||||
@ -746,10 +806,6 @@ BrowserGlue.prototype = {
|
||||
getService(Ci.nsIAnnotationService);
|
||||
|
||||
var callback = {
|
||||
_placesBundle: Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle("chrome://browser/locale/places/places.properties"),
|
||||
|
||||
_uri: function(aSpec) {
|
||||
return Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
@ -761,10 +817,14 @@ BrowserGlue.prototype = {
|
||||
var bookmarksMenuIndex = 0;
|
||||
var bookmarksToolbarIndex = 0;
|
||||
|
||||
var placesBundle = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle("chrome://browser/locale/places/places.properties");
|
||||
|
||||
// MOST VISITED
|
||||
var smart = {queryId: "MostVisited", // don't change this
|
||||
itemId: null,
|
||||
title: this._placesBundle.GetStringFromName("mostVisitedTitle"),
|
||||
title: placesBundle.GetStringFromName("mostVisitedTitle"),
|
||||
uri: this._uri("place:queryType=" +
|
||||
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY +
|
||||
"&sort=" +
|
||||
@ -777,7 +837,7 @@ BrowserGlue.prototype = {
|
||||
// RECENTLY BOOKMARKED
|
||||
smart = {queryId: "RecentlyBookmarked", // don't change this
|
||||
itemId: null,
|
||||
title: this._placesBundle.GetStringFromName("recentlyBookmarkedTitle"),
|
||||
title: placesBundle.GetStringFromName("recentlyBookmarkedTitle"),
|
||||
uri: this._uri("place:folder=BOOKMARKS_MENU" +
|
||||
"&folder=UNFILED_BOOKMARKS" +
|
||||
"&folder=TOOLBAR" +
|
||||
@ -795,7 +855,7 @@ BrowserGlue.prototype = {
|
||||
// RECENT TAGS
|
||||
smart = {queryId: "RecentTags", // don't change this
|
||||
itemId: null,
|
||||
title: this._placesBundle.GetStringFromName("recentTagsTitle"),
|
||||
title: placesBundle.GetStringFromName("recentTagsTitle"),
|
||||
uri: this._uri("place:"+
|
||||
"type=" +
|
||||
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY +
|
||||
|
@ -1169,7 +1169,7 @@
|
||||
<handler event="popuphidden"><![CDATA[
|
||||
var popup = event.originalTarget;
|
||||
|
||||
// Avoid handling popupshowing of inner views
|
||||
// Avoid handling popuphidden of inner views
|
||||
if (popup._resultNode && PlacesUIUtils.getViewForNode(popup) == this) {
|
||||
// UI performance: folder queries are cheap, keep the resultnode open
|
||||
// so we don't rebuild its contents whenever the popup is reopened.
|
||||
@ -1178,9 +1178,15 @@
|
||||
}
|
||||
|
||||
var parent = popup.parentNode;
|
||||
if (parent.localName == "toolbarbutton" &&
|
||||
!PlacesControllerDragHelper.getSession())
|
||||
this._openedMenuButton = null;
|
||||
if (parent.localName == "toolbarbutton") {
|
||||
if (!PlacesControllerDragHelper.getSession())
|
||||
this._openedMenuButton = null;
|
||||
// Clear the dragover attribute if present, if we are dragging into a
|
||||
// folder in the hierachy of current opened popup we don't clear
|
||||
// this attribute on clearOverFolder. See Notify for closeTimer.
|
||||
if (parent.hasAttribute("dragover"))
|
||||
parent.removeAttribute("dragover");
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="mousedown"><![CDATA[
|
||||
|
@ -118,3 +118,10 @@ tagResultLabel=Tag
|
||||
# for url bar autocomplete results of type "bookmark"
|
||||
# See createResultLabel() in urlbarBindings.xml
|
||||
bookmarkResultLabel=Bookmark
|
||||
|
||||
# LOCALIZATION NOTE (lockPrompt.text)
|
||||
# %S will be replaced with the application name.
|
||||
lockPrompt.title=Browser Startup Error
|
||||
lockPrompt.text=The bookmarks and history system will not be functional because one of %S's files is in use by another application. Some security software can cause this problem.
|
||||
lockPromptInfoButton.label=Learn More
|
||||
lockPromptInfoButton.accessKey=L
|
||||
|
@ -121,14 +121,11 @@ classic.jar:
|
||||
skin/classic/browser/preferences/panebutton-active.png (preferences/panebutton-active.png)
|
||||
skin/classic/browser/preferences/panebutton-inactive.png (preferences/panebutton-inactive.png)
|
||||
skin/classic/browser/preferences/applications.css (preferences/applications.css)
|
||||
skin/classic/browser/tabbrowser/alltabs-box-bkgnd.png (tabbrowser/alltabs-box-bkgnd.png)
|
||||
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon.png)
|
||||
skin/classic/browser/tabbrowser/alltabs-box-overflow-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-bkgnd-animate.png)
|
||||
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
|
||||
skin/classic/browser/tabbrowser/tab-arrow-start.png (tabbrowser/tab-arrow-start.png)
|
||||
skin/classic/browser/tabbrowser/tab-arrow-start-bkgnd.png (tabbrowser/tab-arrow-start-bkgnd.png)
|
||||
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/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)
|
||||
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
|
||||
skin/classic/browser/tabbrowser/tab-bkgnd.png (tabbrowser/tab-bkgnd.png)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 332 B |
Binary file not shown.
Before Width: | Height: | Size: 166 B |
Binary file not shown.
Before Width: | Height: | Size: 169 B |
@ -132,6 +132,7 @@ MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@
|
||||
MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
|
||||
XPCOM_USE_LEA = @XPCOM_USE_LEA@
|
||||
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
|
||||
JS_STATIC_BUILD = @JS_STATIC_BUILD@
|
||||
MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@
|
||||
MOZ_INSTALLER = @MOZ_INSTALLER@
|
||||
MOZ_UPDATER = @MOZ_UPDATER@
|
||||
|
@ -73,8 +73,6 @@ CHECK_VARS := \
|
||||
SHORT_LIBNAME \
|
||||
XPI_PKGNAME \
|
||||
INSTALL_EXTENSION_ID \
|
||||
SHARED_LIBRARY_NAME \
|
||||
STATIC_LIBRARY_NAME \
|
||||
$(NULL)
|
||||
|
||||
# checks for internal spaces or trailing spaces in the variable
|
||||
@ -361,18 +359,6 @@ DSO_PIC_CFLAGS=
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef SHARED_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef STATIC_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
# This comes from configure
|
||||
ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
@ -219,15 +219,15 @@ endif # ENABLE_TESTS
|
||||
#
|
||||
|
||||
ifndef LIBRARY
|
||||
ifdef STATIC_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||
ifdef SHORT_LIBNAME
|
||||
STATIC_LIBRARY_NAME := $(SHORT_LIBNAME)
|
||||
LIBRARY_NAME := $(SHORT_LIBNAME)
|
||||
endif
|
||||
endif
|
||||
LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
endif # STATIC_LIBRARY_NAME
|
||||
endif # LIBRARY
|
||||
|
||||
ifndef HOST_LIBRARY
|
||||
ifdef HOST_LIBRARY_NAME
|
||||
@ -244,9 +244,9 @@ MKSHLIB = $(MKCSHLIB)
|
||||
endif
|
||||
|
||||
ifdef MAKE_FRAMEWORK
|
||||
SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
|
||||
SHARED_LIBRARY := $(LIBRARY_NAME)
|
||||
else
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
@ -254,7 +254,7 @@ DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||
IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
|
||||
IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
@ -319,8 +319,8 @@ CODFILE=$(basename $(@F)).cod
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAPINFO
|
||||
ifdef SHARED_LIBRARY_NAME
|
||||
MAPFILE=$(SHARED_LIBRARY_NAME).map
|
||||
ifdef LIBRARY_NAME
|
||||
MAPFILE=$(LIBRARY_NAME).map
|
||||
else
|
||||
MAPFILE=$(basename $(@F)).map
|
||||
endif # LIBRARY_NAME
|
||||
@ -333,8 +333,15 @@ endif
|
||||
|
||||
ifdef MAPFILE
|
||||
OS_LDFLAGS += -MAP:$(MAPFILE)
|
||||
#CFLAGS += -Fm$(MAPFILE)
|
||||
#CXXFLAGS += -Fm$(MAPFILE)
|
||||
endif
|
||||
|
||||
#ifdef CODFILE
|
||||
#CFLAGS += -Fa$(CODFILE) -FAsc
|
||||
#CFLAGS += -Fa$(CODFILE) -FAsc
|
||||
#endif
|
||||
|
||||
endif # !GNU_CC
|
||||
|
||||
ifdef ENABLE_CXX_EXCEPTIONS
|
||||
@ -834,13 +841,13 @@ ifdef LIBRARY_NAME
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME)
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
|
||||
ifdef MODULE_NAME
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
|
||||
endif
|
||||
endif # BUILD_STATIC_LIBS
|
||||
else # !IS_COMPONENT
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
|
||||
endif
|
||||
else
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
|
||||
endif # IS_COMPONENT
|
||||
endif # EXPORT_LIBRARY
|
||||
endif # LIBRARY_NAME
|
||||
@ -1176,7 +1183,7 @@ endif
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
|
||||
rm -f $@
|
||||
echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
|
||||
echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
|
||||
echo PROTMODE >> $@
|
||||
echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
|
||||
|
22
configure.in
22
configure.in
@ -4379,6 +4379,7 @@ NECKO_COOKIES=1
|
||||
NECKO_DISK_CACHE=1
|
||||
NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
|
||||
NECKO_SMALL_BUFFERS=
|
||||
JS_STATIC_BUILD=
|
||||
XPC_IDISPATCH_SUPPORT=
|
||||
|
||||
|
||||
@ -4471,6 +4472,7 @@ basic)
|
||||
NECKO_SMALL_BUFFERS=1
|
||||
NS_DISABLE_LOGGING=1
|
||||
NS_PRINTING=
|
||||
JS_STATIC_BUILD=1
|
||||
;;
|
||||
|
||||
minimal)
|
||||
@ -4518,6 +4520,7 @@ minimal)
|
||||
NECKO_SMALL_BUFFERS=1
|
||||
NS_DISABLE_LOGGING=1
|
||||
NS_PRINTING=
|
||||
JS_STATIC_BUILD=1
|
||||
;;
|
||||
|
||||
*)
|
||||
@ -7184,6 +7187,25 @@ else
|
||||
XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Force JS to be a static lib
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(js-static-build,
|
||||
[ --enable-js-static-build Force js to be a static lib],
|
||||
JS_STATIC_BUILD=1,
|
||||
JS_STATIC_BUILD= )
|
||||
|
||||
AC_SUBST(JS_STATIC_BUILD)
|
||||
|
||||
if test -n "$JS_STATIC_BUILD"; then
|
||||
AC_DEFINE(EXPORT_JS_API)
|
||||
|
||||
if test -z "$BUILD_STATIC_LIBS"; then
|
||||
AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Standalone module options
|
||||
|
@ -97,8 +97,8 @@ class nsFrameLoader;
|
||||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x92b19d1c, 0x8f37, 0x4d4b, \
|
||||
{ 0xa3, 0x42, 0xb5, 0xc6, 0x8b, 0x54, 0xde, 0x6c } }
|
||||
{ 0x29f7a5d7, 0xb217, 0x4ea2, \
|
||||
{0x95, 0x40, 0x46, 0x41, 0xb9, 0xf5, 0x99, 0xd9 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -1097,7 +1097,14 @@ public:
|
||||
*/
|
||||
virtual void EnumerateExternalResources(nsSubDocEnumFunc aCallback,
|
||||
void* aData) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return whether the document is currently showing (in the sense of
|
||||
* OnPageShow() having been called already and OnPageHide() not having been
|
||||
* called yet.
|
||||
*/
|
||||
PRBool IsShowing() { return mIsShowing; }
|
||||
|
||||
protected:
|
||||
~nsIDocument()
|
||||
{
|
||||
@ -1171,6 +1178,9 @@ protected:
|
||||
// True iff we've ever fired a DOMTitleChanged event for this document
|
||||
PRPackedBool mHaveFiredTitleChange;
|
||||
|
||||
// True iff IsShowing() should be returning true
|
||||
PRPackedBool mIsShowing;
|
||||
|
||||
// The bidi options for this document. What this bitfield means is
|
||||
// defined in nsBidiUtils.h
|
||||
PRUint32 mBidiOptions;
|
||||
|
@ -42,6 +42,7 @@ interface nsIDOMDocument;
|
||||
interface nsIDOMEventListener;
|
||||
interface nsIPrincipal;
|
||||
interface nsIScriptContext;
|
||||
interface nsIURI;
|
||||
interface nsIVariant;
|
||||
interface nsPIDOMWindow;
|
||||
|
||||
@ -101,7 +102,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
|
||||
* you're aware of all the security implications. And then think twice about
|
||||
* it.
|
||||
*/
|
||||
[scriptable, uuid(48ce10a0-c585-4e8f-a5f5-1ac1e47cc501)]
|
||||
[scriptable, uuid(ad78bf21-2227-447e-8ed5-824a017c265f)]
|
||||
interface nsIXMLHttpRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -340,10 +341,13 @@ interface nsIXMLHttpRequest : nsISupports
|
||||
* @param scriptContext The script context to use for the request. May be
|
||||
* null.
|
||||
* @param ownerWindow The associated window for the request. May be null.
|
||||
* @param baseURI The base URI to use when resolving relative URIs. May be
|
||||
* null.
|
||||
*/
|
||||
[noscript] void init(in nsIPrincipal principal,
|
||||
in nsIScriptContext scriptContext,
|
||||
in nsPIDOMWindow ownerWindow);
|
||||
in nsPIDOMWindow ownerWindow,
|
||||
in nsIURI baseURI);
|
||||
|
||||
/**
|
||||
* Upload process can be tracked by adding event listener to |upload|.
|
||||
|
@ -1266,9 +1266,7 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
|
||||
PRBool didInitialReflow = PR_FALSE;
|
||||
shell->GetDidInitialReflow(&didInitialReflow);
|
||||
if (didInitialReflow) {
|
||||
if (shell->DidInitialReflow()) {
|
||||
// XXX: The assumption here is that if something already
|
||||
// called InitialReflow() on this shell, it also did some of
|
||||
// the setup below, so we do nothing and just move on to the
|
||||
|
@ -77,7 +77,10 @@ nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
|
||||
|
||||
nsDOMAttribute::~nsDOMAttribute()
|
||||
{
|
||||
NS_IF_RELEASE(mChild);
|
||||
if (mChild) {
|
||||
static_cast<nsTextNode*>(mChild)->UnbindFromAttribute();
|
||||
NS_RELEASE(mChild);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMAttribute)
|
||||
|
@ -7095,6 +7095,10 @@ nsDocument::OnPageShow(PRBool aPersisted)
|
||||
}
|
||||
}
|
||||
|
||||
// Set mIsShowing before firing events, in case those event handlers
|
||||
// move us around.
|
||||
mIsShowing = PR_TRUE;
|
||||
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_SHOW, aPersisted);
|
||||
DispatchEventToWindow(&event);
|
||||
}
|
||||
@ -7121,6 +7125,10 @@ nsDocument::OnPageHide(PRBool aPersisted)
|
||||
}
|
||||
}
|
||||
|
||||
// Set mIsShowing before firing events, in case those event handlers
|
||||
// move us around.
|
||||
mIsShowing = PR_FALSE;
|
||||
|
||||
// Now send out a PageHide event.
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_HIDE, aPersisted);
|
||||
DispatchEventToWindow(&event);
|
||||
|
@ -313,9 +313,14 @@ FirePageHideEvent(nsIDocShellTreeItem* aItem,
|
||||
}
|
||||
}
|
||||
|
||||
// The pageshow event is fired for a given document only if IsShowing() returns
|
||||
// the same thing as aFireIfShowing. This gives us a way to fire pageshow only
|
||||
// on documents that are still loading or only on documents that are already
|
||||
// loaded.
|
||||
static void
|
||||
FirePageShowEvent(nsIDocShellTreeItem* aItem,
|
||||
nsIDOMEventTarget* aChromeEventHandler)
|
||||
nsIDOMEventTarget* aChromeEventHandler,
|
||||
PRBool aFireIfShowing)
|
||||
{
|
||||
PRInt32 childCount = 0;
|
||||
aItem->GetChildCount(&childCount);
|
||||
@ -327,14 +332,18 @@ FirePageShowEvent(nsIDocShellTreeItem* aItem,
|
||||
|
||||
for (PRUint32 i = 0; i < kids.Length(); ++i) {
|
||||
if (kids[i]) {
|
||||
FirePageShowEvent(kids[i], aChromeEventHandler);
|
||||
FirePageShowEvent(kids[i], aChromeEventHandler, aFireIfShowing);
|
||||
}
|
||||
}
|
||||
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_SHOW, PR_TRUE);
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_GetInterface(aItem);
|
||||
event.target = do_QueryInterface(doc);
|
||||
nsEventDispatcher::Dispatch(aChromeEventHandler, nsnull, &event);
|
||||
nsCOMPtr<nsIDocument> internalDoc = do_QueryInterface(doc);
|
||||
NS_ASSERTION(internalDoc, "What happened here?");
|
||||
if (internalDoc->IsShowing() == aFireIfShowing) {
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_SHOW, PR_TRUE);
|
||||
event.target = do_QueryInterface(doc);
|
||||
nsEventDispatcher::Dispatch(aChromeEventHandler, nsnull, &event);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -609,8 +618,11 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
}
|
||||
mInSwap = aOther->mInSwap = PR_TRUE;
|
||||
|
||||
// Fire pagehide events. Note that we do NOT fire these in the normal way,
|
||||
// but just fire them on the chrome event handlers.
|
||||
// Fire pageshow events on still-loading pages, and then fire pagehide
|
||||
// events. Note that we do NOT fire these in the normal way, but just fire
|
||||
// them on the chrome event handlers.
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_FALSE);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_FALSE);
|
||||
FirePageHideEvent(ourTreeItem, ourChromeEventHandler);
|
||||
FirePageHideEvent(otherTreeItem, otherChromeEventHandler);
|
||||
|
||||
@ -618,8 +630,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
nsIFrame* otherFrame = otherShell->GetPrimaryFrameFor(otherContent);
|
||||
if (!ourFrame || !otherFrame) {
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler);
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_TRUE);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -627,8 +639,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
CallQueryInterface(ourFrame, &ourFrameFrame);
|
||||
if (!ourFrameFrame) {
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler);
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_TRUE);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -636,8 +648,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
rv = ourFrameFrame->BeginSwapDocShells(otherFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler);
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -690,8 +702,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
ourParentDocument->FlushPendingNotifications(Flush_Layout);
|
||||
otherParentDocument->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
FirePageShowEvent(ourTreeItem, otherChromeEventHandler);
|
||||
FirePageShowEvent(otherTreeItem, ourChromeEventHandler);
|
||||
FirePageShowEvent(ourTreeItem, otherChromeEventHandler, PR_TRUE);
|
||||
FirePageShowEvent(otherTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
@ -1482,7 +1482,6 @@ GK_ATOM(processingInstructionTagName, "#processing-instruction")
|
||||
GK_ATOM(textTagName, "#text")
|
||||
|
||||
// Frame types
|
||||
GK_ATOM(areaFrame, "AreaFrame")
|
||||
GK_ATOM(bcTableCellFrame, "BCTableCellFrame") // table cell in border collapsing model
|
||||
GK_ATOM(blockFrame, "BlockFrame")
|
||||
GK_ATOM(boxFrame, "BoxFrame")
|
||||
@ -1535,6 +1534,9 @@ GK_ATOM(tableRowFrame, "TableRowFrame")
|
||||
GK_ATOM(textInputFrame,"TextInputFrame")
|
||||
GK_ATOM(textFrame, "TextFrame")
|
||||
GK_ATOM(viewportFrame, "ViewportFrame")
|
||||
#ifdef MOZ_XUL
|
||||
GK_ATOM(XULLabelFrame, "XULLabelFrame")
|
||||
#endif
|
||||
#ifdef MOZ_SVG
|
||||
GK_ATOM(svgAFrame, "SVGAFrame")
|
||||
GK_ATOM(svgClipPathFrame, "SVGClipPathFrame")
|
||||
|
@ -1108,7 +1108,8 @@ nsXMLHttpRequest::Init()
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::Init(nsIPrincipal* aPrincipal,
|
||||
nsIScriptContext* aScriptContext,
|
||||
nsPIDOMWindow* aOwnerWindow)
|
||||
nsPIDOMWindow* aOwnerWindow,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrincipal);
|
||||
|
||||
@ -1124,6 +1125,7 @@ nsXMLHttpRequest::Init(nsIPrincipal* aPrincipal,
|
||||
else {
|
||||
mOwner = nsnull;
|
||||
}
|
||||
mBaseURI = aBaseURI;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1826,7 +1828,10 @@ nsXMLHttpRequest::OpenRequest(const nsACString& method,
|
||||
nsCOMPtr<nsIDocument> doc = GetDocumentFromScriptContext(mScriptContext);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
if (doc) {
|
||||
if (mBaseURI) {
|
||||
baseURI = mBaseURI;
|
||||
}
|
||||
else if (doc) {
|
||||
baseURI = doc->GetBaseURI();
|
||||
}
|
||||
|
||||
|
@ -478,6 +478,8 @@ protected:
|
||||
|
||||
nsIRequestObserver* mRequestObserver;
|
||||
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
|
||||
PRUint32 mState;
|
||||
|
||||
nsRefPtr<nsXMLHttpRequestUpload> mUpload;
|
||||
|
@ -89,7 +89,7 @@ nsresult TestNativeXMLHttpRequest()
|
||||
rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
|
||||
TEST_ENSURE_SUCCESS(rv, "Couldn't get system principal!");
|
||||
|
||||
rv = xhr->Init(systemPrincipal, nsnull, nsnull);
|
||||
rv = xhr->Init(systemPrincipal, nsnull, nsnull, nsnull);
|
||||
TEST_ENSURE_SUCCESS(rv, "Couldn't initialize the XHR!");
|
||||
|
||||
rv = xhr->OpenRequest(getString, testURL, PR_FALSE, empty, empty);
|
||||
|
@ -1,45 +1,43 @@
|
||||
function d(s) { dump(s + "\n"); }
|
||||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
var isPreflight = request.method == "OPTIONS";
|
||||
|
||||
// Send response
|
||||
|
||||
response.setHeader("Access-Control-Allow-Origin", query.allowOrigin);
|
||||
|
||||
if (isPreflight) {
|
||||
var secData = {};
|
||||
|
||||
if (request.hasHeader("Access-Control-Request-Headers")) {
|
||||
var magicHeader =
|
||||
request.getHeader("Access-Control-Request-Headers").split(",").
|
||||
filter(function(name) /^magic-/.test(name))[0];
|
||||
}
|
||||
|
||||
if (magicHeader) {
|
||||
secData = eval(unescape(magicHeader.substr(6)));
|
||||
secData.allowHeaders = (secData.allowHeaders || "") + "," + magicHeader;
|
||||
}
|
||||
|
||||
if (secData.allowHeaders)
|
||||
response.setHeader("Access-Control-Allow-Headers", secData.allowHeaders);
|
||||
|
||||
if (secData.allowMethods)
|
||||
response.setHeader("Access-Control-Allow-Methods", secData.allowMethods);
|
||||
|
||||
if (secData.cacheTime)
|
||||
response.setHeader("Access-Control-Max-Age", secData.cacheTime.toString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", "application/xml", false);
|
||||
response.write("<res>hello pass</res>\n");
|
||||
}
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
var isPreflight = request.method == "OPTIONS";
|
||||
|
||||
// Send response
|
||||
|
||||
response.setHeader("Access-Control-Allow-Origin", query.allowOrigin);
|
||||
|
||||
if (isPreflight) {
|
||||
var secData = {};
|
||||
|
||||
if (request.hasHeader("Access-Control-Request-Headers")) {
|
||||
var magicHeader =
|
||||
request.getHeader("Access-Control-Request-Headers").split(",").
|
||||
filter(function(name) /^magic-/.test(name))[0];
|
||||
}
|
||||
|
||||
if (magicHeader) {
|
||||
secData = eval(unescape(magicHeader.substr(6)));
|
||||
secData.allowHeaders = (secData.allowHeaders || "") + "," + magicHeader;
|
||||
}
|
||||
|
||||
if (secData.allowHeaders)
|
||||
response.setHeader("Access-Control-Allow-Headers", secData.allowHeaders);
|
||||
|
||||
if (secData.allowMethods)
|
||||
response.setHeader("Access-Control-Allow-Methods", secData.allowMethods);
|
||||
|
||||
if (secData.cacheTime)
|
||||
response.setHeader("Access-Control-Max-Age", secData.cacheTime.toString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", "application/xml", false);
|
||||
response.write("<res>hello pass</res>\n");
|
||||
}
|
||||
|
@ -1,87 +1,101 @@
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
try {
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
var isPreflight = request.method == "OPTIONS";
|
||||
|
||||
// Check that request was correct
|
||||
if (!isPreflight && "headers" in query) {
|
||||
headers = eval(query.headers);
|
||||
for(headerName in headers) {
|
||||
if (request.getHeader(headerName) != headers[headerName]) {
|
||||
throw "Header " + headerName + " had wrong value. Expected " +
|
||||
headers[headerName] + " got " + request.getHeader(headerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isPreflight && "requestHeaders" in query &&
|
||||
request.getHeader("Access-Control-Request-Headers") != query.requestHeaders) {
|
||||
throw "Access-Control-Request-Headers had wrong value. Expected " +
|
||||
query.requestHeaders + " got " +
|
||||
request.getHeader("Access-Control-Request-Headers");
|
||||
}
|
||||
if (isPreflight && "requestMethod" in query &&
|
||||
request.getHeader("Access-Control-Request-Method") != query.requestMethod) {
|
||||
throw "Access-Control-Request-Method had wrong value. Expected " +
|
||||
query.requestMethod + " got " +
|
||||
request.getHeader("Access-Control-Request-Method");
|
||||
}
|
||||
if ("origin" in query && request.getHeader("Origin") != query.origin) {
|
||||
throw "Origin had wrong value. Expected " + query.origin + " got " +
|
||||
request.getHeader("Origin");
|
||||
}
|
||||
if ("cookie" in query) {
|
||||
cookies = {};
|
||||
request.getHeader("Cookie").split(/ *; */).forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
cookies[name] = unescape(value);
|
||||
});
|
||||
|
||||
query.cookie.split(",").forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
if (cookies[name] != value) {
|
||||
throw "Cookie " + name + " had wrong value. Expected " + value +
|
||||
" got " + cookies[name];
|
||||
}
|
||||
});
|
||||
}
|
||||
if ("noCookie" in query && request.hasHeader("Cookie")) {
|
||||
throw "Got cookies when didn't expect to";
|
||||
}
|
||||
|
||||
|
||||
// Send response
|
||||
|
||||
if (query.allowOrigin && (!isPreflight || !query.noAllowPreflight))
|
||||
response.setHeader("Access-Control-Allow-Origin", query.allowOrigin);
|
||||
|
||||
if (query.allowCred)
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
|
||||
if (query.setCookie)
|
||||
response.setHeader("Set-Cookie", query.setCookie + "; path=/");
|
||||
|
||||
|
||||
if (isPreflight) {
|
||||
if (query.allowHeaders)
|
||||
response.setHeader("Access-Control-Allow-Headers", query.allowHeaders);
|
||||
|
||||
if (query.allowMethods)
|
||||
response.setHeader("Access-Control-Allow-Methods", query.allowMethods);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", "application/xml", false);
|
||||
response.write("<res>hello pass</res>\n");
|
||||
|
||||
} catch (e) {
|
||||
dump(e + "\n");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
var isPreflight = request.method == "OPTIONS";
|
||||
|
||||
// Check that request was correct
|
||||
|
||||
if (!isPreflight && "headers" in query) {
|
||||
headers = eval(query.headers);
|
||||
for(headerName in headers) {
|
||||
if (request.getHeader(headerName) != headers[headerName]) {
|
||||
sendHttp500(response,
|
||||
"Header " + headerName + " had wrong value. Expected " +
|
||||
headers[headerName] + " got " + request.getHeader(headerName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isPreflight && "requestHeaders" in query &&
|
||||
request.getHeader("Access-Control-Request-Headers") != query.requestHeaders) {
|
||||
sendHttp500(response,
|
||||
"Access-Control-Request-Headers had wrong value. Expected " +
|
||||
query.requestHeaders + " got " +
|
||||
request.getHeader("Access-Control-Request-Headers"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPreflight && "requestMethod" in query &&
|
||||
request.getHeader("Access-Control-Request-Method") != query.requestMethod) {
|
||||
sendHttp500(response,
|
||||
"Access-Control-Request-Method had wrong value. Expected " +
|
||||
query.requestMethod + " got " +
|
||||
request.getHeader("Access-Control-Request-Method"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ("origin" in query && request.getHeader("Origin") != query.origin) {
|
||||
sendHttp500(response,
|
||||
"Origin had wrong value. Expected " + query.origin + " got " +
|
||||
request.getHeader("Origin"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ("cookie" in query) {
|
||||
cookies = {};
|
||||
request.getHeader("Cookie").split(/ *; */).forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
cookies[name] = unescape(value);
|
||||
});
|
||||
|
||||
query.cookie.split(",").forEach(function (val) {
|
||||
[name, value] = val.split('=');
|
||||
if (cookies[name] != value) {
|
||||
sendHttp500(response,
|
||||
"Cookie " + name + " had wrong value. Expected " + value +
|
||||
" got " + cookies[name]);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ("noCookie" in query && request.hasHeader("Cookie")) {
|
||||
sendHttp500(response,
|
||||
"Got cookies when didn't expect to: " + request.getHeader("Cookie"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Send response
|
||||
|
||||
if (query.allowOrigin && (!isPreflight || !query.noAllowPreflight))
|
||||
response.setHeader("Access-Control-Allow-Origin", query.allowOrigin);
|
||||
|
||||
if (query.allowCred)
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
|
||||
if (query.setCookie)
|
||||
response.setHeader("Set-Cookie", query.setCookie + "; path=/");
|
||||
|
||||
if (isPreflight) {
|
||||
if (query.allowHeaders)
|
||||
response.setHeader("Access-Control-Allow-Headers", query.allowHeaders);
|
||||
|
||||
if (query.allowMethods)
|
||||
response.setHeader("Access-Control-Allow-Methods", query.allowMethods);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", "application/xml", false);
|
||||
response.write("<res>hello pass</res>\n");
|
||||
}
|
||||
|
||||
function sendHttp500(response, text) {
|
||||
response.setStatusLine(null, 500, text);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -87,7 +87,7 @@ NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext
|
||||
nsresult
|
||||
NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsKeyEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsPopupBlockedEvent* aEvent);
|
||||
nsresult
|
||||
|
@ -143,7 +143,7 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIDragSession.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
@ -1545,10 +1545,17 @@ GetAccessModifierMask(nsISupports* aDocShell)
|
||||
static PRBool
|
||||
IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
|
||||
{
|
||||
if (!aFrame)
|
||||
if (!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::accesskey, aKey,
|
||||
eIgnoreCase))
|
||||
return PR_FALSE;
|
||||
|
||||
if (!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::accesskey, aKey, eIgnoreCase))
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
||||
do_QueryInterface(aContent->GetOwnerDoc());
|
||||
if (!xulDoc && !aContent->IsNodeOfType(nsINode::eXUL))
|
||||
return PR_TRUE;
|
||||
|
||||
// For XUL we do visibility checks.
|
||||
if (!aFrame)
|
||||
return PR_FALSE;
|
||||
|
||||
if (aFrame->IsFocusable())
|
||||
@ -1560,6 +1567,7 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
|
||||
if (!aFrame->AreAncestorViewsVisible())
|
||||
return PR_FALSE;
|
||||
|
||||
// XUL controls can be activated.
|
||||
nsCOMPtr<nsIDOMXULControlElement> control(do_QueryInterface(aContent));
|
||||
if (control)
|
||||
return PR_TRUE;
|
||||
|
@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
|
||||
|
||||
var modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK |
|
||||
Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
var expectedFocus = "d,g,h,k,l,m";
|
||||
var expectedFocus = "d,g,h,k,l,m,n";
|
||||
// XXX the "map" test is causing trouble, see bug 433089
|
||||
// var expectedClick = "a,b,c,e,f,i,j";
|
||||
var expectedClick = "a,c,e,f,i,j";
|
||||
@ -115,9 +115,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
|
||||
function handleFocus(e) {
|
||||
ok("accessKey" in e, "(focus) accesskey property not found on element");
|
||||
var expected = focusArray.shift();
|
||||
// "k" is a special case because the element receiving the focus is not
|
||||
// the element which has the accesskey.
|
||||
if (expected == "k") {
|
||||
// "k" and "n" are a special cases because the element receiving the focus
|
||||
// is not the element which has the accesskey.
|
||||
if (expected == "k" || expected == "n") {
|
||||
ok(e.value == "test for label", "(focus) unexpected element: " + e.value +
|
||||
" expected: " + "test for label");
|
||||
// "l" is a special case because the element receiving the focus is not
|
||||
@ -312,7 +312,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
|
||||
</tr>
|
||||
<tr>
|
||||
<td>label (label invisible)</td><td><label for="txt1" accesskey="n" style="display:none">test label</label>
|
||||
<input type="text" id="txt1" value="test for label" onfocus="handleInvalid(event.target);"></td>
|
||||
<input type="text" id="txt1" value="test for label" onfocus="handleFocus(event.target);"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>label (control invisible)</td><td><label for="txt2" accesskey="o">test label</label>
|
||||
|
@ -279,9 +279,7 @@ nsMediaDocument::StartLayout()
|
||||
nsPresShellIterator iter(this);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
PRBool didInitialReflow = PR_FALSE;
|
||||
shell->GetDidInitialReflow(&didInitialReflow);
|
||||
if (didInitialReflow) {
|
||||
if (shell->DidInitialReflow()) {
|
||||
// Don't mess with this presshell: someone has already handled
|
||||
// its initial reflow.
|
||||
continue;
|
||||
|
@ -205,6 +205,9 @@ void nsMediaDecoder::Paint(gfxContext* aContext, const gfxRect& aRect)
|
||||
|
||||
// Make the source image fill the rectangle completely
|
||||
pat->SetMatrix(gfxMatrix().Scale(mRGBWidth/aRect.Width(), mRGBHeight/aRect.Height()));
|
||||
// Set PAD mode so that when the video is being scaled, we do not sample
|
||||
// outside the bounds of the video image.
|
||||
pat->SetExtend(gfxPattern::EXTEND_PAD);
|
||||
|
||||
/* Draw RGB surface onto frame */
|
||||
aContext->NewPath();
|
||||
|
@ -88,31 +88,37 @@ private:
|
||||
nsSVGAngle mVal;
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMBaseVal)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMBaseVal)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGAngle::DOMBaseVal, mSVGElement)
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMAnimVal)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMAnimVal)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGAngle::DOMAnimVal, mSVGElement)
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_IMPL_RELEASE(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGAngle::DOMAnimatedAngle, mSVGElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGAngle::DOMBaseVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGAngle::DOMBaseVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGAngle::DOMAnimVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGAngle::DOMAnimVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGAngle::DOMAnimatedAngle)
|
||||
|
||||
NS_IMPL_ADDREF(DOMSVGAngle)
|
||||
NS_IMPL_RELEASE(DOMSVGAngle)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGAngle::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAngle)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGAngle::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAngle)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGAngle::DOMAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedAngle)
|
||||
|
@ -93,7 +93,8 @@ private:
|
||||
|
||||
struct DOMBaseVal : public nsIDOMSVGAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
|
||||
|
||||
DOMBaseVal(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
@ -132,7 +133,8 @@ private:
|
||||
|
||||
struct DOMAnimVal : public nsIDOMSVGAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
|
||||
|
||||
DOMAnimVal(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
@ -168,7 +170,8 @@ private:
|
||||
|
||||
struct DOMAnimatedAngle : public nsIDOMSVGAnimatedAngle
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedAngle)
|
||||
|
||||
DOMAnimatedAngle(nsSVGAngle* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -187,7 +187,7 @@ nsSVGAnimatedTransformList::DidModifySVGObservable (nsISVGValue* observable,
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedTransformList(nsIDOMSVGAnimatedTransformList** result,
|
||||
nsIDOMSVGTransformList* baseVal)
|
||||
nsIDOMSVGTransformList* baseVal)
|
||||
{
|
||||
*result = nsnull;
|
||||
|
||||
|
@ -36,10 +36,12 @@
|
||||
|
||||
#include "nsSVGBoolean.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
NS_IMPL_RELEASE(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGBoolean::DOMAnimatedBoolean, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGBoolean::DOMAnimatedBoolean)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedBoolean)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedBoolean)
|
||||
@ -94,4 +96,3 @@ nsSVGBoolean::ToDOMAnimatedBoolean(nsIDOMSVGAnimatedBoolean **aResult,
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,8 @@ private:
|
||||
|
||||
struct DOMAnimatedBoolean : public nsIDOMSVGAnimatedBoolean
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedBoolean)
|
||||
|
||||
DOMAnimatedBoolean(nsSVGBoolean* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -320,9 +320,9 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRBool foundMatch = PR_FALSE;
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
nsresult rv;
|
||||
|
||||
// Check for nsSVGLength2 attribute
|
||||
LengthAttributesInfo lengthInfo = GetLengthInfo();
|
||||
@ -429,15 +429,6 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundMatch) {
|
||||
if (NS_FAILED(rv)) {
|
||||
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
|
||||
return PR_FALSE;
|
||||
}
|
||||
aResult.SetTo(aValue);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundMatch) {
|
||||
@ -453,6 +444,15 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
}
|
||||
}
|
||||
|
||||
if (foundMatch) {
|
||||
if (NS_FAILED(rv)) {
|
||||
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
|
||||
return PR_FALSE;
|
||||
}
|
||||
aResult.SetTo(aValue);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return nsSVGElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
@ -594,7 +594,9 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
nsCOMPtr<nsISVGValue> svg_value = GetMappedAttribute(aNamespaceID, aName);
|
||||
|
||||
if (svg_value) {
|
||||
mSuppressNotification = PR_TRUE;
|
||||
ResetOldStyleBaseType(svg_value);
|
||||
mSuppressNotification = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,4 +363,14 @@ NS_NewSVG##_elementName##Element(nsIContent **aResult, \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
// No unlinking, we'd need to null out the value pointer (the object it
|
||||
// points to is held by the element) and null-check it everywhere.
|
||||
#define NS_SVG_VAL_IMPL_CYCLE_COLLECTION(_val, _element) \
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(_val) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_val) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(_element, nsIContent) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(_val)
|
||||
|
||||
|
||||
#endif // __NS_SVGELEMENT_H__
|
||||
|
@ -38,10 +38,12 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsSVGElement.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGEnum::DOMAnimatedEnum)
|
||||
NS_IMPL_RELEASE(nsSVGEnum::DOMAnimatedEnum)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGEnum::DOMAnimatedEnum, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGEnum::DOMAnimatedEnum)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGEnum::DOMAnimatedEnum)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGEnum::DOMAnimatedEnum)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGEnum::DOMAnimatedEnum)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedEnumeration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedEnumeration)
|
||||
|
@ -83,7 +83,8 @@ private:
|
||||
|
||||
struct DOMAnimatedEnum : public nsIDOMSVGAnimatedEnumeration
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedEnum)
|
||||
|
||||
DOMAnimatedEnum(nsSVGEnum* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
@ -36,10 +36,13 @@
|
||||
|
||||
#include "nsSVGInteger.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGInteger::DOMAnimatedInteger)
|
||||
NS_IMPL_RELEASE(nsSVGInteger::DOMAnimatedInteger)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGInteger::DOMAnimatedInteger)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGInteger::DOMAnimatedInteger, mSVGElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGInteger::DOMAnimatedInteger)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGInteger::DOMAnimatedInteger)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGInteger::DOMAnimatedInteger)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedInteger)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedInteger)
|
||||
@ -96,4 +99,3 @@ nsSVGInteger::ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,8 @@ private:
|
||||
|
||||
struct DOMAnimatedInteger : public nsIDOMSVGAnimatedInteger
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedInteger)
|
||||
|
||||
DOMAnimatedInteger(nsSVGInteger* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -43,28 +43,34 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGLength2::DOMBaseVal)
|
||||
NS_IMPL_RELEASE(nsSVGLength2::DOMBaseVal)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMBaseVal, mSVGElement)
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGLength2::DOMAnimVal)
|
||||
NS_IMPL_RELEASE(nsSVGLength2::DOMAnimVal)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMAnimVal, mSVGElement)
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGLength2::DOMAnimatedLength)
|
||||
NS_IMPL_RELEASE(nsSVGLength2::DOMAnimatedLength)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMAnimatedLength, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGLength2::DOMBaseVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGLength2::DOMBaseVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGLength2::DOMBaseVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGLength2::DOMAnimVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGLength2::DOMAnimVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGLength2::DOMAnimatedLength)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGLength2::DOMAnimatedLength)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGLength2::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLength)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGLength2::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGLength2::DOMAnimVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLength)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGLength2::DOMAnimatedLength)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGLength2::DOMAnimatedLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedLength)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedLength)
|
||||
|
@ -123,7 +123,8 @@ private:
|
||||
|
||||
struct DOMBaseVal : public nsIDOMSVGLength
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
|
||||
|
||||
DOMBaseVal(nsSVGLength2* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
@ -162,7 +163,8 @@ private:
|
||||
|
||||
struct DOMAnimVal : public nsIDOMSVGLength
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
|
||||
|
||||
DOMAnimVal(nsSVGLength2* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
@ -198,7 +200,8 @@ private:
|
||||
|
||||
struct DOMAnimatedLength : public nsIDOMSVGAnimatedLength
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedLength)
|
||||
|
||||
DOMAnimatedLength(nsSVGLength2* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLineElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual PRBool IsMarkable() { return PR_TRUE; }
|
||||
|
@ -78,10 +78,12 @@ NS_IMPL_NS_NEW_SVG_ELEMENT(Marker)
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGOrientType::DOMAnimatedEnum)
|
||||
NS_IMPL_RELEASE(nsSVGOrientType::DOMAnimatedEnum)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGOrientType::DOMAnimatedEnum, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGOrientType::DOMAnimatedEnum)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGOrientType::DOMAnimatedEnum)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGOrientType::DOMAnimatedEnum)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGOrientType::DOMAnimatedEnum)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedEnumeration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedEnumeration)
|
||||
|
@ -71,7 +71,8 @@ private:
|
||||
|
||||
struct DOMAnimatedEnum : public nsIDOMSVGAnimatedEnumeration
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedEnum)
|
||||
|
||||
DOMAnimatedEnum(nsSVGOrientType* aVal,
|
||||
nsSVGElement *aSVGElement)
|
||||
@ -120,7 +121,7 @@ public:
|
||||
nsISVGValue::modificationType aModType);
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
|
@ -38,10 +38,12 @@
|
||||
#include "nsTextFormatter.h"
|
||||
#include "prdtoa.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGNumber2::DOMAnimatedNumber)
|
||||
NS_IMPL_RELEASE(nsSVGNumber2::DOMAnimatedNumber)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGNumber2::DOMAnimatedNumber, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGNumber2::DOMAnimatedNumber)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGNumber2::DOMAnimatedNumber)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGNumber2::DOMAnimatedNumber)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGNumber2::DOMAnimatedNumber)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedNumber)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedNumber)
|
||||
|
@ -73,7 +73,8 @@ private:
|
||||
|
||||
struct DOMAnimatedNumber : public nsIDOMSVGAnimatedNumber
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedNumber)
|
||||
|
||||
DOMAnimatedNumber(nsSVGNumber2* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
NS_DECL_NSIDOMSVGANIMATEDPOINTS
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual PRBool IsDependentAttribute(nsIAtom *aName);
|
||||
|
@ -36,10 +36,12 @@
|
||||
|
||||
#include "nsSVGString.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGString::DOMAnimatedString)
|
||||
NS_IMPL_RELEASE(nsSVGString::DOMAnimatedString)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGString::DOMAnimatedString, mSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGString::DOMAnimatedString)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGString::DOMAnimatedString)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGString::DOMAnimatedString)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGString::DOMAnimatedString)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedString)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedString)
|
||||
|
@ -70,7 +70,8 @@ private:
|
||||
|
||||
struct DOMAnimatedString : public nsIDOMSVGAnimatedString
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedString)
|
||||
|
||||
DOMAnimatedString(nsSVGString* aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
|
@ -52,10 +52,20 @@ NS_IMPL_NS_NEW_SVG_ELEMENT(Switch)
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsSVGSwitchElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsSVGSwitchElement,
|
||||
nsSVGSwitchElementBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mActiveChild)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsSVGSwitchElement,
|
||||
nsSVGSwitchElementBase)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mActiveChild)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGSwitchElement,nsSVGSwitchElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGSwitchElement,nsSVGSwitchElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGSwitchElement)
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsSVGSwitchElement)
|
||||
NS_NODE_INTERFACE_TABLE4(nsSVGSwitchElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGSwitchElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGSwitchElement)
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsSVGSwitchElement,
|
||||
nsSVGSwitchElementBase)
|
||||
NS_DECL_NSIDOMSVGSWITCHELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
|
@ -57,6 +57,7 @@ _TEST_FILES = \
|
||||
scientific-helper.svg \
|
||||
test_text.html \
|
||||
text-helper.svg \
|
||||
test_valueLeaks.xhtml \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
76
content/svg/content/test/test_valueLeaks.xhtml
Normal file
76
content/svg/content/test/test_valueLeaks.xhtml
Normal file
@ -0,0 +1,76 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=467671
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 467671</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=467671">Mozilla Bug 467671</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 467671 **/
|
||||
|
||||
function storeSVGPropertyAsExpando(localName, prop)
|
||||
{
|
||||
var elem = document.createElementNS("http://www.w3.org/2000/svg", localName);
|
||||
|
||||
elem.addEventListener("click", function(){}, false);
|
||||
|
||||
var propVal = elem[prop];
|
||||
Object.prototype.toSource[prop + "_expando"] = propVal;
|
||||
if (propVal instanceof SVGAnimatedAngle || propVal instanceof SVGAnimatedLength) {
|
||||
Object.prototype.toSource[prop + "_baseVal_expando"] = propVal.baseVal;
|
||||
Object.prototype.toSource[prop + "_animVal_expando"] = propVal.animVal;
|
||||
}
|
||||
}
|
||||
|
||||
// angle
|
||||
storeSVGPropertyAsExpando("marker", "orientAngle");
|
||||
|
||||
// boolean
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "preserveAlpha");
|
||||
|
||||
// enum
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "edgeMode");
|
||||
|
||||
// special marker enum
|
||||
storeSVGPropertyAsExpando("marker", "orientType");
|
||||
|
||||
// integer
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "orderX");
|
||||
|
||||
// length
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "x");
|
||||
|
||||
// number
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "divisor");
|
||||
|
||||
// string
|
||||
storeSVGPropertyAsExpando("feConvolveMatrix", "in1");
|
||||
|
||||
var elem1 = document.createElementNS("http://www.w3.org/2000/svg", "switch");
|
||||
var elem2 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
elem1.appendChild(elem2);
|
||||
document.getElementById("content").appendChild(elem1);
|
||||
|
||||
elem2.addEventListener("click", function(){}, false);
|
||||
|
||||
Object.prototype.toSource.expando = elem1;
|
||||
|
||||
ok(true, "SVG shouldn't leak.");
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1342,7 +1342,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
|
||||
}
|
||||
|
||||
// If the accesskey attribute is removed, unregister it here
|
||||
// Also see nsAreaFrame, nsBoxFrame and nsTextBoxFrame's AttributeChanged
|
||||
// Also see nsXULLabelFrame, nsBoxFrame and nsTextBoxFrame's AttributeChanged
|
||||
if (aName == nsGkAtoms::accesskey || aName == nsGkAtoms::control) {
|
||||
UnregisterAccessKey(oldValue);
|
||||
}
|
||||
|
@ -3888,10 +3888,8 @@ nsXULDocument::OverlayForwardReference::Resolve()
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIContent> target;
|
||||
|
||||
PRBool notify = PR_FALSE;
|
||||
nsIPresShell *shell = mDocument->GetPrimaryShell();
|
||||
if (shell)
|
||||
shell->GetDidInitialReflow(¬ify);
|
||||
PRBool notify = shell && shell->DidInitialReflow();
|
||||
|
||||
nsAutoString id;
|
||||
mOverlay->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
|
||||
|
@ -749,9 +749,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
||||
nsnull /* don't care */);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (isGenerationElement && !(mFlags & eDontRecurse)) {
|
||||
// if recursion is allowed, continue by building the next
|
||||
// level of children
|
||||
if (isGenerationElement) {
|
||||
// build the next level of children
|
||||
rv = CreateContainerContents(realKid, aChild, PR_FALSE,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@ -1022,16 +1021,9 @@ nsXULContentBuilder::CreateTemplateAndContainerContents(nsIContent* aElement,
|
||||
// are given ids) and only those elements, so get the reference point
|
||||
// from the corresponding match.
|
||||
nsTemplateMatch *match = nsnull;
|
||||
if (mContentSupportMap.Get(aElement, &match)) {
|
||||
// don't generate children if child processing isn't allowed
|
||||
PRBool mayProcessChildren;
|
||||
nsresult rv = match->mResult->GetMayProcessChildren(&mayProcessChildren);
|
||||
if (NS_FAILED(rv) || !mayProcessChildren)
|
||||
return rv;
|
||||
|
||||
if (mContentSupportMap.Get(aElement, &match))
|
||||
CreateContainerContents(aElement, match->mResult, aForceCreation,
|
||||
PR_FALSE, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS,
|
||||
@ -1050,6 +1042,17 @@ nsXULContentBuilder::CreateContainerContents(nsIContent* aElement,
|
||||
if (!aForceCreation && !IsOpen(aElement))
|
||||
return NS_OK;
|
||||
|
||||
// don't generate children if recursion or child processing isn't allowed
|
||||
if (aResult != mRootResult) {
|
||||
if (mFlags & eDontRecurse)
|
||||
return NS_OK;
|
||||
|
||||
PRBool mayProcessChildren;
|
||||
nsresult rv = aResult->GetMayProcessChildren(&mayProcessChildren);
|
||||
if (NS_FAILED(rv) || !mayProcessChildren)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> refResource;
|
||||
GetResultResource(aResult, getter_AddRefs(refResource));
|
||||
if (! refResource)
|
||||
|
@ -191,7 +191,7 @@ nsXULTemplateQueryProcessorXML::GetDatasource(nsIArray* aDataSources,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> owner = do_QueryInterface(scriptObject);
|
||||
req->Init(docPrincipal, context, owner);
|
||||
req->Init(docPrincipal, context, owner, nsnull);
|
||||
|
||||
rv = req->OpenRequest(NS_LITERAL_CSTRING("GET"), uriStr, PR_TRUE,
|
||||
EmptyString(), EmptyString());
|
||||
|
@ -69,6 +69,8 @@ _TEST_FILES = \
|
||||
test_bug396519.xul \
|
||||
bug396519_window.xul \
|
||||
test_bug428288.html \
|
||||
test_bug449778.xul \
|
||||
bug449778_window.xul \
|
||||
test_bug454235.xul \
|
||||
bug454235-subframe.xul \
|
||||
test_bug456980.xul \
|
||||
|
107
docshell/test/chrome/bug449778_window.xul
Normal file
107
docshell/test/chrome/bug449778_window.xul
Normal file
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<window title="Mozilla Bug 449778" onload="doTheTest()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<hbox id="parent">
|
||||
</hbox>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok", "snapshotWindow",
|
||||
"compareSnapshots", "onerror" ];
|
||||
for each (var import in imports) {
|
||||
window[import] = window.opener.wrappedJSObject[import];
|
||||
}
|
||||
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function addBrowser(parent, id, width, height) {
|
||||
var b =
|
||||
document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "browser");
|
||||
b.setAttribute("type", "content");
|
||||
b.setAttribute("id", id);
|
||||
b.setAttribute("width", width);
|
||||
b.setAttribute("height", height);
|
||||
$(parent).appendChild(b);
|
||||
}
|
||||
addBrowser("parent", "f1", 300, 200);
|
||||
addBrowser("parent", "f2", 300, 200);
|
||||
|
||||
/** Test for Bug 449778 **/
|
||||
var doc1 = "data:text/html,<html><body>This is a test</body></html>";
|
||||
var doc2 = "data:text/html,<html><body>This is a second test</body></html>";
|
||||
var doc3 = "data:text/html,<html><body>This is a <script>var evt = document.createEvent('Events'); evt.initEvent('testEvt', true, true); document.dispatchEvent(evt);</script>third test</body></html>";
|
||||
|
||||
|
||||
$("f1").setAttribute("src", doc1);
|
||||
$("f2").setAttribute("src", doc2);
|
||||
|
||||
function doTheTest() {
|
||||
var strs = { "f1": "", "f2" : "" };
|
||||
function attachListener(node, type) {
|
||||
var listener = function(e) {
|
||||
if (strs[node.id]) strs[node.id] += " ";
|
||||
strs[node.id] += node.id + ".page" + type;
|
||||
}
|
||||
node.addEventListener("page" + type, listener, false);
|
||||
|
||||
listener.detach = function() {
|
||||
node.removeEventListener("page" + type, listener, false);
|
||||
}
|
||||
return listener;
|
||||
}
|
||||
|
||||
var l1 = attachListener($("f1"), "show");
|
||||
var l2 = attachListener($("f1"), "hide");
|
||||
var l3 = attachListener($("f2"), "show");
|
||||
var l4 = attachListener($("f2"), "hide");
|
||||
|
||||
$("f1").swapDocShells($("f2"));
|
||||
|
||||
is(strs["f1"], "f1.pagehide f1.pageshow",
|
||||
"Expected hide then show on first loaded page");
|
||||
is(strs["f2"], "f2.pagehide f2.pageshow",
|
||||
"Expected hide then show on second loaded page");
|
||||
|
||||
function listener2() {
|
||||
$("f2").removeEventListener("testEvt", listener2, false);
|
||||
|
||||
strs = { "f1": "", "f2" : "" };
|
||||
|
||||
$("f1").swapDocShells($("f2"));
|
||||
is(strs["f1"], "f1.pagehide",
|
||||
"Expected hide on already-loaded page, then nothing");
|
||||
is(strs["f2"], "f2.pageshow f2.pagehide f2.pageshow",
|
||||
"Expected show on still-loading page, then hide on it, then show " +
|
||||
"on already-loaded page");
|
||||
|
||||
strs = { "f1": "", "f2" : "" };
|
||||
|
||||
$("f1").addEventListener("pageshow", listener3, false);
|
||||
}
|
||||
|
||||
function listener3() {
|
||||
$("f1").removeEventListener("pageshow", listener3, false);
|
||||
|
||||
is(strs["f1"], "f1.pageshow",
|
||||
"Expected show as our page finishes loading");
|
||||
is(strs["f2"], "", "Expected no more events here.");
|
||||
|
||||
l1.detach();
|
||||
l2.detach();
|
||||
l3.detach();
|
||||
l4.detach();
|
||||
|
||||
window.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
$("f2").addEventListener("testEvt", listener2, false, true);
|
||||
$("f2").setAttribute("src", doc3);
|
||||
}
|
||||
|
||||
]]></script>
|
||||
</window>
|
33
docshell/test/chrome/test_bug449778.xul
Normal file
33
docshell/test/chrome/test_bug449778.xul
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=449778
|
||||
-->
|
||||
<window title="Mozilla Bug 449778"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=449778"
|
||||
target="_blank">Mozilla Bug 396519</a>
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
window.open("bug449778_window.xul", "bug449778",
|
||||
"chrome,width=800,height=800");
|
||||
});
|
||||
|
||||
]]></script>
|
||||
</window>
|
@ -5238,18 +5238,22 @@ nsDOMConstructor::Create(const PRUnichar* aName,
|
||||
nsDOMConstructor** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
// Prevent creating a constructor if
|
||||
// - aOwner is inner window which doesn't have outer window or
|
||||
// - outer window doesn't have inner window or
|
||||
// - caller can't access outer window's inner window.
|
||||
// Prevent creating a constructor if aOwner is inner window which doesn't have
|
||||
// an outer window. If the outer window doesn't have an inner window or the
|
||||
// caller can't access the outer window's current inner window then try to use
|
||||
// the owner (so long as it is, in fact, an inner window). If that doesn't
|
||||
// work then prevent creation also.
|
||||
nsPIDOMWindow* outerWindow = aOwner->GetOuterWindow();
|
||||
nsPIDOMWindow* currentInner =
|
||||
outerWindow ? outerWindow->GetCurrentInnerWindow() : nsnull;
|
||||
if (!currentInner ||
|
||||
outerWindow ? outerWindow->GetCurrentInnerWindow() : aOwner;
|
||||
if (!outerWindow ||
|
||||
(aOwner != currentInner &&
|
||||
!nsContentUtils::CanCallerAccess(currentInner))) {
|
||||
!nsContentUtils::CanCallerAccess(currentInner) &&
|
||||
!(currentInner = aOwner)->IsInnerWindow())) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
NS_ASSERTION(nsContentUtils::CanCallerAccess(currentInner),
|
||||
"Must be able to access currentInner!");
|
||||
*aResult = new nsDOMConstructor(aName, aNameStruct, currentInner);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -1796,10 +1796,18 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
PRBool termFuncSet = PR_FALSE;
|
||||
|
||||
if (oldDoc == aDocument) {
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
// Suspend the current context's request before Pop() resumes the old
|
||||
// context's request.
|
||||
JSAutoSuspendRequest asr(cx);
|
||||
|
||||
// Pop our context here so that we get the correct one for the
|
||||
// termination function.
|
||||
cxPusher.Pop();
|
||||
|
||||
JSContext *oldCx = nsContentUtils::GetCurrentJSContext();
|
||||
|
||||
nsIScriptContext *callerScx;
|
||||
if (cx && (callerScx = GetScriptContextFromJSContext(cx))) {
|
||||
if (oldCx && (callerScx = GetScriptContextFromJSContext(oldCx))) {
|
||||
// We're called from document.open() (and document.open() is
|
||||
// called from JS), clear the scope etc in a termination
|
||||
// function on the calling context to prevent clearing the
|
||||
@ -1807,7 +1815,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
NS_ASSERTION(!currentInner->IsFrozen(),
|
||||
"How does this opened window get into session history");
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoRequest ar(oldCx);
|
||||
|
||||
callerScx->SetTerminationFunction(ClearWindowScope,
|
||||
static_cast<nsIDOMWindow *>
|
||||
@ -1815,6 +1823,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
|
||||
termFuncSet = PR_TRUE;
|
||||
}
|
||||
|
||||
// Re-push our context.
|
||||
cxPusher.Push(cx);
|
||||
}
|
||||
|
||||
// Don't clear scope on our current inner window if it's going to be
|
||||
|
@ -77,6 +77,7 @@ class nsDOMWorker : public nsIWorker,
|
||||
friend class nsDOMWorkerScriptLoader;
|
||||
friend class nsDOMWorkerTimeout;
|
||||
friend class nsDOMWorkerXHR;
|
||||
friend class nsDOMWorkerXHRProxy;
|
||||
friend class nsReportErrorRunnable;
|
||||
|
||||
friend JSBool DOMWorkerOperationCallback(JSContext* aCx);
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIThreadManager.h"
|
||||
@ -231,12 +230,3 @@ nsDOMWorkerPool::Resume()
|
||||
mon.NotifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
nsIScriptContext*
|
||||
nsDOMWorkerPool::ScriptContext()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(),
|
||||
"Don't touch the non-threadsafe script context off the main "
|
||||
"thread!");
|
||||
return mParentGlobal->GetContext();
|
||||
}
|
||||
|
@ -62,8 +62,6 @@ public:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
|
||||
nsIScriptContext* ScriptContext();
|
||||
|
||||
nsIScriptGlobalObject* ScriptGlobalObject() {
|
||||
return mParentGlobal;
|
||||
}
|
||||
|
@ -818,7 +818,8 @@ nsDOMWorkerXHR::SetMozBackgroundRequest(PRBool aMozBackgroundRequest)
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHR::Init(nsIPrincipal* aPrincipal,
|
||||
nsIScriptContext* aScriptContext,
|
||||
nsPIDOMWindow* aOwnerWindow)
|
||||
nsPIDOMWindow* aOwnerWindow,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
NS_NOTREACHED("No one should be calling this!");
|
||||
|
@ -404,13 +404,12 @@ nsDOMWorkerXHRProxy::InitInternal()
|
||||
}
|
||||
|
||||
nsIPrincipal* nodePrincipal = pool->ParentDocument()->NodePrincipal();
|
||||
nsIScriptContext* scriptContext = pool->ScriptContext();
|
||||
NS_ASSERTION(nodePrincipal && scriptContext, "Shouldn't be null!");
|
||||
|
||||
nsRefPtr<nsXMLHttpRequest> xhrConcrete = new nsXMLHttpRequest();
|
||||
NS_ENSURE_TRUE(xhrConcrete, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = xhrConcrete->Init(nodePrincipal, scriptContext, nsnull);
|
||||
nsresult rv = xhrConcrete->Init(nodePrincipal, nsnull, nsnull,
|
||||
worker->GetURI());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Call QI manually here to avoid keeping up with the cast madness of
|
||||
@ -737,6 +736,10 @@ nsDOMWorkerXHRProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This will be filled if the request has completed and we're running in
|
||||
// sync mode.
|
||||
nsRefPtr<nsDOMWorkerXHRFinishSyncXHRRunnable> syncFinishedRunnable;
|
||||
|
||||
PRBool requestDone;
|
||||
if (type == LISTENER_TYPE_ABORT || type == LISTENER_TYPE_ERROR ||
|
||||
type == LISTENER_TYPE_LOAD) {
|
||||
@ -760,8 +763,10 @@ nsDOMWorkerXHRProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy memory barrier.
|
||||
NS_ASSERTION(!syncFinishedRunnable, "This shouldn't be set!");
|
||||
|
||||
nsAutoLock lock(mWorkerXHR->Lock());
|
||||
mSyncFinishedRunnable.swap(syncFinishedRunnable);
|
||||
}
|
||||
else {
|
||||
requestDone = PR_FALSE;
|
||||
@ -818,7 +823,13 @@ nsDOMWorkerXHRProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
}
|
||||
|
||||
return HandleEventRunnable(runnable);
|
||||
rv = HandleEventRunnable(runnable);
|
||||
|
||||
if (syncFinishedRunnable) {
|
||||
syncFinishedRunnable->Dispatch();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1162,16 +1173,5 @@ nsDOMWorkerXHRProxy::OnStopRequest(nsIRequest* /* aRequest */,
|
||||
|
||||
FlipOwnership();
|
||||
|
||||
nsRefPtr<nsDOMWorkerXHRFinishSyncXHRRunnable> syncFinishedRunnable;
|
||||
{
|
||||
nsAutoLock lock(mWorkerXHR->Lock());
|
||||
mSyncFinishedRunnable.swap(syncFinishedRunnable);
|
||||
}
|
||||
|
||||
if (syncFinishedRunnable) {
|
||||
nsresult rv = syncFinishedRunnable->Dispatch();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,6 +1,13 @@
|
||||
const importSubURL = "relativeLoad_sub_import.js";
|
||||
|
||||
onmessage = function(event) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "testXHR.txt", false);
|
||||
xhr.send(null);
|
||||
if (xhr.status != 404) {
|
||||
throw "Loaded an xhr from the wrong location!";
|
||||
}
|
||||
|
||||
importScripts(importSubURL);
|
||||
var worker = new Worker("relativeLoad_sub_worker2.js");
|
||||
worker.onerror = function(event) {
|
||||
|
@ -1,6 +1,15 @@
|
||||
const importURL = "relativeLoad_import.js";
|
||||
|
||||
onmessage = function(event) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "testXHR.txt", false);
|
||||
xhr.send(null);
|
||||
dump("XXXben: " + xhr.responseText + "\n");
|
||||
if (xhr.status != 200 ||
|
||||
xhr.responseText != "A noisy noise annoys an oyster.") {
|
||||
throw "Couldn't get xhr text from where we wanted it!";
|
||||
}
|
||||
|
||||
importScripts(importURL);
|
||||
var worker = new Worker("relativeLoad_worker2.js");
|
||||
worker.onerror = function(event) {
|
||||
|
@ -1,55 +0,0 @@
|
||||
<html>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Daniel Howard
|
||||
-
|
||||
- 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 ***** -->
|
||||
<body>
|
||||
<h1>
|
||||
<span CLASS=LXRSHORTDESC>
|
||||
HTML (i.e. Composer) and plaintext editor<p>
|
||||
</span>
|
||||
</h1>
|
||||
<span CLASS=LXRLONGDESC>
|
||||
The editor directory contains C++ interfaces, C++ code, and XUL/Javascript
|
||||
for the embeddable editor component, which is used for the HTML Editor
|
||||
("Composer"), for plain and html mail compose, and for text fields and
|
||||
text areas throughout the product.
|
||||
<p>
|
||||
The editor is designed like a "browser window with editing features": it
|
||||
adds some special classes for editing text and managing transaction
|
||||
undo/redo, but reuses browser code for nearly everything else.
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
19
editor/libeditor/html/crashtests/467647-1.html
Normal file
19
editor/libeditor/html/crashtests/467647-1.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
|
||||
function boom()
|
||||
{
|
||||
document.getElementById("s").focus();
|
||||
try {
|
||||
document.execCommand("insertorderedlist", false, null);
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="boom();"><span id="s" contenteditable="true">One<div></div></span><marquee></marquee></body>
|
||||
|
||||
</html>
|
@ -4,3 +4,4 @@ load 407074-1.html
|
||||
load 407277-1.html
|
||||
load 420439.html
|
||||
load 428489-1.html
|
||||
load 467647-1.html
|
||||
|
@ -84,6 +84,7 @@
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsIDOM3Node.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
//const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
|
||||
//const static char* kMOZEditorBogusNodeValue="TRUE";
|
||||
@ -5758,39 +5759,42 @@ nsHTMLEditRules::GetNodesForOperation(nsCOMArray<nsIDOMRange>& inArrayOfRanges,
|
||||
|
||||
if (!aDontTouchContent)
|
||||
{
|
||||
nsVoidArray rangeItemArray;
|
||||
nsAutoTArray<nsRangeStore, 16> rangeItemArray;
|
||||
if (!rangeItemArray.AppendElements(rangeCount)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ASSERTION(rangeCount == rangeItemArray.Length(), "How did that happen?");
|
||||
|
||||
// first register ranges for special editor gravity
|
||||
// XXXbz doesn't this leak all the nsRangeStore structs on error
|
||||
// conditions??
|
||||
for (i = 0; i < (PRInt32)rangeCount; i++)
|
||||
{
|
||||
opRange = inArrayOfRanges[0];
|
||||
nsRangeStore *item = new nsRangeStore();
|
||||
if (!item) return NS_ERROR_NULL_POINTER;
|
||||
nsRangeStore *item = rangeItemArray.Elements() + i;
|
||||
item->StoreRange(opRange);
|
||||
mHTMLEditor->mRangeUpdater.RegisterRangeItem(item);
|
||||
rangeItemArray.AppendElement((void*)item);
|
||||
inArrayOfRanges.RemoveObjectAt(0);
|
||||
}
|
||||
// now bust up inlines
|
||||
for (i = rangeCount-1; i >= 0; i--)
|
||||
// now bust up inlines. Safe to start at rangeCount-1, since we
|
||||
// asserted we have enough items above.
|
||||
for (i = rangeCount-1; i >= 0 && NS_SUCCEEDED(res); i--)
|
||||
{
|
||||
nsRangeStore *item = (nsRangeStore*)rangeItemArray.ElementAt(i);
|
||||
res = BustUpInlinesAtRangeEndpoints(*item);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = BustUpInlinesAtRangeEndpoints(rangeItemArray[i]);
|
||||
}
|
||||
// then unregister the ranges
|
||||
for (i = 0; i < rangeCount; i++)
|
||||
{
|
||||
nsRangeStore *item = (nsRangeStore*)rangeItemArray.ElementAt(0);
|
||||
if (!item) return NS_ERROR_NULL_POINTER;
|
||||
rangeItemArray.RemoveElementAt(0);
|
||||
nsRangeStore *item = rangeItemArray.Elements() + i;
|
||||
mHTMLEditor->mRangeUpdater.DropRangeItem(item);
|
||||
res = item->GetRange(address_of(opRange));
|
||||
if (NS_FAILED(res)) return res;
|
||||
delete item;
|
||||
nsresult res2 = item->GetRange(address_of(opRange));
|
||||
if (NS_FAILED(res2) && NS_SUCCEEDED(res)) {
|
||||
// Remember the failure, but keep going so we make sure to unregister
|
||||
// all our range items.
|
||||
res = res2;
|
||||
}
|
||||
inArrayOfRanges.AppendObject(opRange);
|
||||
}
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// gather up a list of all the nodes
|
||||
for (i = 0; i < rangeCount; i++)
|
||||
|
@ -1042,13 +1042,12 @@ FindSelectionRoot(nsIEditor *aEditor, nsIContent *aContent)
|
||||
// We still want to allow selection in a readonly editor.
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
aEditor->GetRootElement(getter_AddRefs(rootElement));
|
||||
if (!rootElement) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
CallQueryInterface(rootElement, &root);
|
||||
|
||||
if (!root && document) {
|
||||
NS_IF_ADDREF(root = document->GetRootContent());
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,6 @@ extern SMModel EUCKRSMModel;
|
||||
extern SMModel EUCTWSMModel;
|
||||
extern SMModel GB18030SMModel;
|
||||
extern SMModel SJISSMModel;
|
||||
extern SMModel UCS2BESMModel;
|
||||
|
||||
|
||||
extern SMModel HZSMModel;
|
||||
|
@ -434,119 +434,6 @@ SMModel SJISSMModel = {
|
||||
};
|
||||
|
||||
|
||||
static PRUint32 UCS2BE_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,1,0,0,2,0,0), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
PCK4BITS(0,0,0,3,0,0,0,0), // 18 - 1f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27
|
||||
PCK4BITS(0,3,3,3,3,3,0,0), // 28 - 2f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // a0 - a7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // a8 - af
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // b0 - b7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // b8 - bf
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // c0 - c7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // c8 - cf
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // d0 - d7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // d8 - df
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // e0 - e7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // e8 - ef
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // f0 - f7
|
||||
PCK4BITS(0,0,0,0,0,0,4,5) // f8 - ff
|
||||
};
|
||||
|
||||
|
||||
static PRUint32 UCS2BE_st [ 7] = {
|
||||
PCK4BITS( 5, 7, 7,eError, 4, 3,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe, 6, 6, 6, 6,eError,eError),//10-17
|
||||
PCK4BITS( 6, 6, 6, 6, 6,eItsMe, 6, 6),//18-1f
|
||||
PCK4BITS( 6, 6, 6, 6, 5, 7, 7,eError),//20-27
|
||||
PCK4BITS( 5, 8, 6, 6,eError, 6, 6, 6),//28-2f
|
||||
PCK4BITS( 6, 6, 6, 6,eError,eError,eStart,eStart) //30-37
|
||||
};
|
||||
|
||||
static const PRUint32 UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2};
|
||||
|
||||
SMModel UCS2BESMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_st },
|
||||
UCS2BECharLenTable,
|
||||
"UTF-16BE",
|
||||
};
|
||||
|
||||
static PRUint32 UCS2LE_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 00 - 07
|
||||
PCK4BITS(0,0,1,0,0,2,0,0), // 08 - 0f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17
|
||||
PCK4BITS(0,0,0,3,0,0,0,0), // 18 - 1f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27
|
||||
PCK4BITS(0,3,3,3,3,3,0,0), // 28 - 2f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // a0 - a7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // a8 - af
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // b0 - b7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // b8 - bf
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // c0 - c7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // c8 - cf
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // d0 - d7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // d8 - df
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // e0 - e7
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // e8 - ef
|
||||
PCK4BITS(0,0,0,0,0,0,0,0), // f0 - f7
|
||||
PCK4BITS(0,0,0,0,0,0,4,5) // f8 - ff
|
||||
};
|
||||
|
||||
|
||||
static PRUint32 UCS2LE_st [ 7] = {
|
||||
PCK4BITS( 6, 6, 7, 6, 4, 3,eError,eError),//00-07
|
||||
PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f
|
||||
PCK4BITS(eItsMe,eItsMe, 5, 5, 5,eError,eItsMe,eError),//10-17
|
||||
PCK4BITS( 5, 5, 5,eError, 5,eError, 6, 6),//18-1f
|
||||
PCK4BITS( 7, 6, 8, 8, 5, 5, 5,eError),//20-27
|
||||
PCK4BITS( 5, 5, 5,eError,eError,eError, 5, 5),//28-2f
|
||||
PCK4BITS( 5, 5, 5,eError, 5,eError,eStart,eStart) //30-37
|
||||
};
|
||||
|
||||
static const PRUint32 UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2};
|
||||
|
||||
SMModel UCS2LESMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_cls },
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_st },
|
||||
UCS2LECharLenTable,
|
||||
"UTF-16LE",
|
||||
};
|
||||
|
||||
|
||||
static PRUint32 UTF8_cls [ 256 / 8 ] = {
|
||||
//PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07
|
||||
PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 //allow 0x00 as a legal value
|
||||
|
@ -44,8 +44,8 @@
|
||||
|
||||
class gfxASurface;
|
||||
class gfxPattern;
|
||||
class gfxMatrix;
|
||||
class gfxRect;
|
||||
struct gfxMatrix;
|
||||
struct gfxRect;
|
||||
class gfxContext;
|
||||
|
||||
class nsIDeviceContext;
|
||||
|
@ -1,101 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
use strict;
|
||||
require "genverifier.pm";
|
||||
use genverifier;
|
||||
|
||||
|
||||
my(@ucs2be_cls);
|
||||
my(@ucs2be_st);
|
||||
my($ucs2be_ver);
|
||||
|
||||
|
||||
# We look at the following UCS2 char
|
||||
# U+FEFF->ItsMe if it is the first Unicode
|
||||
# U+FFFF->Error
|
||||
# U+FFFE->Error
|
||||
# U+0d0d->Error
|
||||
# U+0a0d->Error
|
||||
# U+1bxx->Error
|
||||
# U+29xx->Error
|
||||
# U+2axx->Error
|
||||
# U+2bxx->Error
|
||||
# U+2cxx->Error
|
||||
# U+2dxx->Error
|
||||
#
|
||||
# In UCS2-Big Endian it will be
|
||||
#
|
||||
# Ev Od
|
||||
# FE FF->ItsMe for the first two bytes
|
||||
# FF FF->Error
|
||||
# FF FE->Error
|
||||
# 0d 0d->Error
|
||||
# 0a 0d->Error
|
||||
# 1b ->Error
|
||||
# 29 ->Error
|
||||
# 2a ->Error
|
||||
# 2b ->Error
|
||||
# 2c ->Error
|
||||
# 2d ->Error
|
||||
#
|
||||
# Now we classified the char
|
||||
# 0a:k1
|
||||
# 0d:k2
|
||||
# 1b:k3
|
||||
# 29-2d:k3
|
||||
# fe:k4
|
||||
# ff:k5
|
||||
# others:k0
|
||||
#
|
||||
@ucs2be_cls = (
|
||||
[ 0x0a, 0x0a, 1 ],
|
||||
[ 0x0d, 0x0d, 2 ],
|
||||
[ 0x1b, 0x1b, 3 ],
|
||||
[ 0x29, 0x2d, 3 ],
|
||||
[ 0xfe, 0xfe, 4 ],
|
||||
[ 0xff, 0xff, 5 ],
|
||||
[ 0x00, 0xff, 0 ]
|
||||
);
|
||||
|
||||
|
||||
# For Big Endian
|
||||
#
|
||||
# 0:k5->3
|
||||
# 0:k4->4
|
||||
# 0:k1,k2->7
|
||||
# 0:k3->1
|
||||
# 0:k0->5
|
||||
# 3:k4,k5->1
|
||||
# 3:*->6
|
||||
# 4:k5->2
|
||||
# 4:*->6
|
||||
# 5:*->6
|
||||
# 6:k1,k2->7
|
||||
# 6:k3->1
|
||||
# 6:k5->8
|
||||
# 6:*->5
|
||||
# 7:k2->1
|
||||
# 7:*->6
|
||||
# 8:k4,k5->1
|
||||
# 8:*->6
|
||||
|
||||
package genverifier;
|
||||
@ucs2be_st = (
|
||||
# 0 1 2 3 4 5
|
||||
5, 7, 7, 1, 4, 3, # state 0 - Start
|
||||
1, 1, 1, 1, 1, 1, # state 1 - Error
|
||||
2, 2, 2, 2, 2, 2, # state 2 - ItsMe
|
||||
6, 6, 6, 6, 1, 1, # state 3 1st byte got FF
|
||||
6, 6, 6, 6, 6, 2, # state 4 1st byte got FE
|
||||
6, 6, 6, 6, 6, 6, # state 5 Odd byte
|
||||
5, 7, 7, 1, 5, 8, # state 6 Even Byte
|
||||
6, 6, 1, 6, 6, 6, # state 7 Got 0A or 0D
|
||||
6, 6, 6, 6, 1, 1, # state 8 Got FF
|
||||
);
|
||||
|
||||
|
||||
$ucs2be_ver = genverifier::GenVerifier("UCS2BE", "UTF-16BE",
|
||||
\@ucs2be_cls, 6, \@ucs2be_st);
|
||||
print $ucs2be_ver;
|
||||
|
||||
|
||||
|
@ -1,103 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
use strict;
|
||||
require "genverifier.pm";
|
||||
use genverifier;
|
||||
|
||||
|
||||
my(@ucs2le_cls);
|
||||
my(@ucs2le_st);
|
||||
my($ucs2le_ver);
|
||||
|
||||
# We look at the following UCS2
|
||||
# U+FEFF->ItsMe if it is the first Unicode
|
||||
# U+FFFF->Error
|
||||
# U+FFFE->Error
|
||||
# U+0d0d->Error
|
||||
# U+0a0d->Error
|
||||
# U+1bxx->Error
|
||||
# U+29xx->Error
|
||||
# U+2axx->Error
|
||||
# U+2bxx->Error
|
||||
# U+2cxx->Error
|
||||
# U+2dxx->Error
|
||||
#
|
||||
# In UCS2-Little Endian it will be
|
||||
#
|
||||
# Ev Od
|
||||
# FF FE->ItsMe for the first two bytes
|
||||
# FF FF->Error
|
||||
# FE FF->Error
|
||||
# 0d 0d->Error
|
||||
# 0d 0a->Error
|
||||
# 1b->Error
|
||||
# 29->Error
|
||||
# 2a->Error
|
||||
# 2b->Error
|
||||
# 2c->Error
|
||||
# 2d->Error
|
||||
#
|
||||
# Now we classified the char
|
||||
# 0a:k1
|
||||
# 0d:k2
|
||||
# 1b:k3
|
||||
# 29-2d:k3
|
||||
# fe:k4
|
||||
# ff:k5
|
||||
# others:k0
|
||||
|
||||
@ucs2le_cls = (
|
||||
[ 0x0a, 0x0a, 1 ],
|
||||
[ 0x0d, 0x0d, 2 ],
|
||||
[ 0x1b, 0x1b, 3 ],
|
||||
[ 0x29, 0x2d, 3 ],
|
||||
[ 0xfe, 0xfe, 4 ],
|
||||
[ 0xff, 0xff, 5 ],
|
||||
[ 0x00, 0xff, 0 ]
|
||||
);
|
||||
|
||||
|
||||
# For Little Endian
|
||||
# 0:k5->3
|
||||
# 0:k4->4
|
||||
# 0:k2->7
|
||||
# 0:*->6
|
||||
# 3:k4->2
|
||||
# 3:k5->1
|
||||
# 3:k3->1
|
||||
# 3:*->5
|
||||
# 4:k3,k5->1
|
||||
# 4:*->5
|
||||
# 5:k4,k5->8
|
||||
# 5:k2->7
|
||||
# 5:*->6
|
||||
# 6:k3->1
|
||||
# 6:*->5
|
||||
# 7:k1,k2->1
|
||||
# 7:k3->1
|
||||
# 7:*->5
|
||||
# 8:k5->1
|
||||
# 8:k3->1
|
||||
# 8:*->5
|
||||
|
||||
|
||||
package genverifier;
|
||||
@ucs2le_st = (
|
||||
# 0 1 2 3 4 5
|
||||
6, 6, 7, 6, 4, 3, # state 0 - Start
|
||||
1, 1, 1, 1, 1, 1, # state 1 - Error
|
||||
2, 2, 2, 2, 2, 2, # state 2 - ItsMe
|
||||
5, 5, 5, 1, 2, 1, # state 3 1st byte Got FF
|
||||
5, 5, 5, 1, 5, 1, # state 4 1st byte Got FE
|
||||
6, 6, 7, 6, 8, 8, # state 5 Even Byte
|
||||
5, 5, 5, 1, 5, 5, # state 6 Odd Byte
|
||||
5, 1, 1, 1, 5, 5, # state 7 Got 0d
|
||||
5, 5, 5, 1, 5, 1, # state 8 Got FF
|
||||
);
|
||||
|
||||
|
||||
$ucs2le_ver = genverifier::GenVerifier("UCS2LE", "UTF-16LE", \@ucs2le_cls,
|
||||
6, \@ucs2le_st);
|
||||
print $ucs2le_ver;
|
||||
|
||||
|
||||
|
@ -56,18 +56,15 @@ ifndef JS_MOZ_INSTALL
|
||||
NSDISTMODE = copy
|
||||
endif
|
||||
|
||||
ifdef JS_NATIVE_EDITLINE
|
||||
DIRS += editline
|
||||
endif
|
||||
|
||||
# editline needs to get built before the shell
|
||||
DIRS += shell
|
||||
|
||||
MODULE = js
|
||||
LIBRARY_NAME = mozjs
|
||||
STATIC_LIBRARY_NAME = js_static
|
||||
GRE_MODULE = 1
|
||||
MODULE = js
|
||||
LIBRARY_NAME = mozjs
|
||||
GRE_MODULE = 1
|
||||
|
||||
PROGRAM = js$(BIN_SUFFIX)
|
||||
# The shell uses some 'HIDDEN' symbols to produce statistics, so we
|
||||
# link directly against the .o files, not against the JS shared
|
||||
# library.
|
||||
PROGOBJS = js.$(OBJ_SUFFIX) $(OBJS)
|
||||
LIBS = $(NSPR_LIBS)
|
||||
|
||||
ifdef GNU_CXX
|
||||
@ -107,12 +104,10 @@ endif
|
||||
# other modules which are always built shared. Failure to do so results in
|
||||
# the js code getting copied into xpinstall and jsd as well as mozilla-bin,
|
||||
# and then the static data cells used for locking no longer work.
|
||||
#
|
||||
# In fact, we now build both a static and a shared library, as the
|
||||
# JS shell would like to link to the static library.
|
||||
|
||||
ifndef JS_STATIC_BUILD
|
||||
FORCE_SHARED_LIB = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
endif
|
||||
|
||||
ifeq (86,$(findstring 86,$(OS_TEST)))
|
||||
ifeq (64,$(findstring 64,$(OS_TEST)))
|
||||
@ -624,22 +619,20 @@ install:: $(INSTALLED_HEADERS)
|
||||
install:: $(SCRIPTS) $(PROGRAM)
|
||||
$(INSTALL) $(IFLAGS2) $^ $(bindir)
|
||||
|
||||
install:: $(LIBRARY)
|
||||
ifneq (,$(LIBRARY))
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir)
|
||||
endif
|
||||
ifneq (,$(IMPORT_LIBRARY))
|
||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir)
|
||||
endif
|
||||
|
||||
# The Mozilla top-level makefiles use install-runtime-libs directly to
|
||||
# place an additional copy of the libraries in the 'dist/bin'
|
||||
# directory.
|
||||
install:: install-runtime-libs
|
||||
install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
|
||||
ifneq (,$(LIBRARY))
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir)
|
||||
endif
|
||||
ifneq (,$(SHARED_LIBRARY))
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir)
|
||||
endif
|
||||
ifneq (,$(IMPORT_LIBRARY))
|
||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir)
|
||||
endif
|
||||
|
||||
# Extra dependancies and rules for auto-generated headers
|
||||
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl
|
||||
|
@ -106,6 +106,7 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
|
||||
BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
|
||||
ENABLE_TESTS = @ENABLE_TESTS@
|
||||
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
|
||||
JS_STATIC_BUILD = @JS_STATIC_BUILD@
|
||||
|
||||
TAR=@TAR@
|
||||
|
||||
@ -268,9 +269,6 @@ NSPR_LIBS = @NSPR_LIBS@
|
||||
|
||||
USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
|
||||
|
||||
JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@
|
||||
EDITLINE_LIBS = @EDITLINE_LIBS@
|
||||
|
||||
# MKSHLIB_FORCE_ALL is used to force the linker to include all object
|
||||
# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker
|
||||
# to normal behavior. Makefile's that create shared libraries out of
|
||||
|
@ -73,8 +73,6 @@ CHECK_VARS := \
|
||||
SHORT_LIBNAME \
|
||||
XPI_PKGNAME \
|
||||
INSTALL_EXTENSION_ID \
|
||||
SHARED_LIBRARY_NAME \
|
||||
STATIC_LIBRARY_NAME \
|
||||
$(NULL)
|
||||
|
||||
# checks for internal spaces or trailing spaces in the variable
|
||||
@ -361,18 +359,6 @@ DSO_PIC_CFLAGS=
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef SHARED_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef STATIC_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
# This comes from configure
|
||||
ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
@ -219,15 +219,15 @@ endif # ENABLE_TESTS
|
||||
#
|
||||
|
||||
ifndef LIBRARY
|
||||
ifdef STATIC_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||
ifdef SHORT_LIBNAME
|
||||
STATIC_LIBRARY_NAME := $(SHORT_LIBNAME)
|
||||
LIBRARY_NAME := $(SHORT_LIBNAME)
|
||||
endif
|
||||
endif
|
||||
LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
endif # STATIC_LIBRARY_NAME
|
||||
endif # LIBRARY
|
||||
|
||||
ifndef HOST_LIBRARY
|
||||
ifdef HOST_LIBRARY_NAME
|
||||
@ -244,9 +244,9 @@ MKSHLIB = $(MKCSHLIB)
|
||||
endif
|
||||
|
||||
ifdef MAKE_FRAMEWORK
|
||||
SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
|
||||
SHARED_LIBRARY := $(LIBRARY_NAME)
|
||||
else
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
@ -254,7 +254,7 @@ DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
|
||||
IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
|
||||
IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
@ -319,8 +319,8 @@ CODFILE=$(basename $(@F)).cod
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAPINFO
|
||||
ifdef SHARED_LIBRARY_NAME
|
||||
MAPFILE=$(SHARED_LIBRARY_NAME).map
|
||||
ifdef LIBRARY_NAME
|
||||
MAPFILE=$(LIBRARY_NAME).map
|
||||
else
|
||||
MAPFILE=$(basename $(@F)).map
|
||||
endif # LIBRARY_NAME
|
||||
@ -333,8 +333,15 @@ endif
|
||||
|
||||
ifdef MAPFILE
|
||||
OS_LDFLAGS += -MAP:$(MAPFILE)
|
||||
#CFLAGS += -Fm$(MAPFILE)
|
||||
#CXXFLAGS += -Fm$(MAPFILE)
|
||||
endif
|
||||
|
||||
#ifdef CODFILE
|
||||
#CFLAGS += -Fa$(CODFILE) -FAsc
|
||||
#CFLAGS += -Fa$(CODFILE) -FAsc
|
||||
#endif
|
||||
|
||||
endif # !GNU_CC
|
||||
|
||||
ifdef ENABLE_CXX_EXCEPTIONS
|
||||
@ -834,13 +841,13 @@ ifdef LIBRARY_NAME
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME)
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
|
||||
ifdef MODULE_NAME
|
||||
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
|
||||
endif
|
||||
endif # BUILD_STATIC_LIBS
|
||||
else # !IS_COMPONENT
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
|
||||
endif
|
||||
else
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
|
||||
endif # IS_COMPONENT
|
||||
endif # EXPORT_LIBRARY
|
||||
endif # LIBRARY_NAME
|
||||
@ -1176,7 +1183,7 @@ endif
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
|
||||
rm -f $@
|
||||
echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
|
||||
echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
|
||||
echo PROTMODE >> $@
|
||||
echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
|
||||
|
@ -3808,6 +3808,7 @@ MOZ_ARG_HEADER(Application)
|
||||
BUILD_STATIC_LIBS=
|
||||
ENABLE_TESTS=1
|
||||
MOZ_DBGRINFO_MODULES=
|
||||
JS_STATIC_BUILD=
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
@ -4745,33 +4746,23 @@ MOZ_ARG_ENABLE_BOOL(static,
|
||||
BUILD_STATIC_LIBS=)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Link js shell to system readline
|
||||
dnl = Force JS to be a static lib
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(readline,
|
||||
[ --enable-readline Link js shell to system readline library],
|
||||
JS_WANT_READLINE=1,
|
||||
JS_WANT_READLINE= )
|
||||
MOZ_ARG_ENABLE_BOOL(js-static-build,
|
||||
[ --enable-js-static-build Force js to be a static lib],
|
||||
JS_STATIC_BUILD=1,
|
||||
JS_STATIC_BUILD= )
|
||||
|
||||
JS_NATIVE_EDITLINE=
|
||||
EDITLINE_LIBS=
|
||||
AC_SUBST(JS_STATIC_BUILD)
|
||||
|
||||
if test -n "$JS_STATIC_BUILD"; then
|
||||
AC_DEFINE(EXPORT_JS_API)
|
||||
|
||||
if test -z "$BUILD_STATIC_LIBS"; then
|
||||
AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
|
||||
fi
|
||||
|
||||
dnl Conveniently, Win32 sets SKIP_LIBRARY_CHECKS...
|
||||
if test -z "$SKIP_LIBRARY_CHECKS"; then
|
||||
if test -n "$JS_WANT_READLINE"; then
|
||||
AC_CHECK_LIB(readline, readline,
|
||||
EDITLINE_LIBS="-lreadline",
|
||||
AC_MSG_ERROR([No system readline library found.]))
|
||||
else
|
||||
dnl By default, we use editline
|
||||
JS_NATIVE_EDITLINE=1
|
||||
EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
|
||||
fi
|
||||
|
||||
dnl Either way, we want to build with line editing support.
|
||||
AC_DEFINE(EDITLINE)
|
||||
fi
|
||||
AC_SUBST(JS_NATIVE_EDITLINE)
|
||||
AC_SUBST(EDITLINE_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
@ -5156,18 +5147,11 @@ mv confdefs.h.save confdefs.h
|
||||
|
||||
MAKEFILES="
|
||||
Makefile
|
||||
shell/Makefile
|
||||
config/Makefile
|
||||
config/autoconf.mk
|
||||
config/mkdepend/Makefile
|
||||
"
|
||||
|
||||
if test -n "$JS_NATIVE_EDITLINE"; then
|
||||
MAKEFILES="$MAKEFILES
|
||||
editline/Makefile
|
||||
"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Run a perl script to quickly create the makefiles.
|
||||
dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
|
||||
|
@ -1,55 +0,0 @@
|
||||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# ***** 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 Spidermonkey build system.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2008
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ted Mielczarek <ted.mielczarek@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# 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
|
||||
|
||||
LIBRARY_NAME = editline
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
CSRCS = editline.c sysunix.c
|
||||
|
||||
DEFINES += -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX \
|
||||
-DHAVE_STDLIB -DUNIQUE_HISTORY
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -310,18 +310,10 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY)
|
||||
lineno++;
|
||||
} while (!JS_BufferIsCompilableUnit(cx, obj, buffer, strlen(buffer)));
|
||||
|
||||
/* Clear any pending exception from previous failed compiles. */
|
||||
/* Clear any pending exception from previous failed compiles. */
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
/* Even though we're interactive, we have a compile-n-go opportunity. */
|
||||
oldopts = JS_GetOptions(cx);
|
||||
if (!compileOnly)
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO);
|
||||
script = JS_CompileScript(cx, obj, buffer, strlen(buffer), "typein",
|
||||
startline);
|
||||
if (!compileOnly)
|
||||
JS_SetOptions(cx, oldopts);
|
||||
|
||||
if (script) {
|
||||
if (!compileOnly) {
|
||||
ok = JS_ExecuteScript(cx, obj, script, &result);
|
||||
@ -346,7 +338,7 @@ static int
|
||||
usage(void)
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: js [-zKPswWxCij] [-b branchlimit] [-c stackchunksize] [-o option] [-v version] [-f scriptfile] [-e script] [-S maxstacksize] "
|
||||
fprintf(gErrFile, "usage: js [-zKPswWxCi] [-b branchlimit] [-c stackchunksize] [-o option] [-v version] [-f scriptfile] [-e script] [-S maxstacksize] "
|
||||
#ifdef JS_GC_ZEAL
|
||||
"[-Z gczeal] "
|
||||
#endif
|
||||
@ -2909,130 +2901,6 @@ fail:
|
||||
JS_DEFINE_TRCINFO_1(Print, (2, (static, JSVAL_FAIL, Print_tn, CONTEXT, STRING, 0, 0)))
|
||||
JS_DEFINE_TRCINFO_1(ShapeOf, (1, (static, INT32, ShapeOf_tn, OBJECT, 0, 0)))
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/*
|
||||
* Returns a JS_malloc'd string (that the caller needs to JS_free)
|
||||
* containing the directory (non-leaf) part of |from| prepended to |leaf|.
|
||||
* If |from| is empty or a leaf, MakeAbsolutePathname returns a copy of leaf.
|
||||
* Returns NULL to indicate an error.
|
||||
*/
|
||||
static char *
|
||||
MakeAbsolutePathname(JSContext *cx, const char *from, const char *leaf)
|
||||
{
|
||||
size_t dirlen;
|
||||
char *dir;
|
||||
const char *slash = NULL, *cp;
|
||||
|
||||
cp = from;
|
||||
while (*cp) {
|
||||
if (*cp == '/'
|
||||
#ifdef XP_WIN
|
||||
|| *cp == '\\'
|
||||
#endif
|
||||
) {
|
||||
slash = cp;
|
||||
}
|
||||
|
||||
++cp;
|
||||
}
|
||||
|
||||
if (!slash) {
|
||||
/* We were given a leaf or |from| was empty. */
|
||||
return JS_strdup(cx, leaf);
|
||||
}
|
||||
|
||||
/* Else, we were given a real pathname, return that + the leaf. */
|
||||
dirlen = slash - from + 1;
|
||||
dir = (char*) JS_malloc(cx, dirlen + strlen(leaf) + 1);
|
||||
if (!dir)
|
||||
return NULL;
|
||||
|
||||
strncpy(dir, from, dirlen);
|
||||
strcpy(dir + dirlen, leaf); /* Note: we can't use strcat here. */
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
#endif // XP_UNIX
|
||||
|
||||
static JSBool
|
||||
Snarf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSString *str;
|
||||
const char *filename;
|
||||
const char *pathname;
|
||||
JSStackFrame *fp;
|
||||
JSBool ok;
|
||||
size_t cc, len;
|
||||
char *buf;
|
||||
FILE *file;
|
||||
|
||||
str = JS_ValueToString(cx, argv[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
filename = JS_GetStringBytes(str);
|
||||
|
||||
/* Get the currently executing script's name. */
|
||||
fp = JS_GetScriptedCaller(cx, NULL);
|
||||
JS_ASSERT(fp && fp->script->filename);
|
||||
#ifdef XP_UNIX
|
||||
pathname = MakeAbsolutePathname(cx, fp->script->filename, filename);
|
||||
if (!pathname)
|
||||
return JS_FALSE;
|
||||
#else
|
||||
pathname = filename;
|
||||
#endif
|
||||
|
||||
ok = JS_FALSE;
|
||||
len = 0;
|
||||
buf = NULL;
|
||||
file = fopen(pathname, "rb");
|
||||
if (!file) {
|
||||
JS_ReportError(cx, "can't open %s: %s", pathname, strerror(errno));
|
||||
} else {
|
||||
if (fseek(file, 0, SEEK_END) == EOF) {
|
||||
JS_ReportError(cx, "can't seek end of %s", pathname);
|
||||
} else {
|
||||
len = ftell(file);
|
||||
if (fseek(file, 0, SEEK_SET) == EOF) {
|
||||
JS_ReportError(cx, "can't seek start of %s", pathname);
|
||||
} else {
|
||||
buf = (char*) JS_malloc(cx, len + 1);
|
||||
if (buf) {
|
||||
cc = fread(buf, 1, len, file);
|
||||
if (cc != len) {
|
||||
JS_free(cx, buf);
|
||||
JS_ReportError(cx, "can't read %s: %s", pathname,
|
||||
(ptrdiff_t(cc) < 0) ? strerror(errno) : "short read");
|
||||
} else {
|
||||
len = (size_t)cc;
|
||||
ok = JS_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
JS_free(cx, (void*)pathname);
|
||||
if (!ok) {
|
||||
JS_free(cx, buf);
|
||||
return ok;
|
||||
}
|
||||
|
||||
buf[len] = '\0';
|
||||
str = JS_NewString(cx, buf, len);
|
||||
if (!str) {
|
||||
JS_free(cx, buf);
|
||||
return JS_FALSE;
|
||||
}
|
||||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/* We use a mix of JS_FS and JS_FN to test both kinds of natives. */
|
||||
static JSFunctionSpec shell_functions[] = {
|
||||
JS_FS("version", Version, 0,0,0),
|
||||
@ -3079,30 +2947,29 @@ static JSFunctionSpec shell_functions[] = {
|
||||
JS_FS("evalcx", EvalInContext, 1,0,0),
|
||||
JS_TN("shapeOf", ShapeOf, 1,0, ShapeOf_trcinfo),
|
||||
#ifdef MOZ_SHARK
|
||||
JS_FS("startShark", js_StartShark, 0,0,0),
|
||||
JS_FS("stopShark", js_StopShark, 0,0,0),
|
||||
JS_FS("connectShark", js_ConnectShark, 0,0,0),
|
||||
JS_FS("disconnectShark",js_DisconnectShark, 0,0,0),
|
||||
JS_FS("startShark", js_StartShark, 0,0,0),
|
||||
JS_FS("stopShark", js_StopShark, 0,0,0),
|
||||
JS_FS("connectShark", js_ConnectShark, 0,0,0),
|
||||
JS_FS("disconnectShark", js_DisconnectShark, 0,0,0),
|
||||
#endif
|
||||
#ifdef MOZ_CALLGRIND
|
||||
JS_FS("startCallgrind", js_StartCallgrind, 0,0,0),
|
||||
JS_FS("stopCallgrind", js_StopCallgrind, 0,0,0),
|
||||
JS_FS("dumpCallgrind", js_DumpCallgrind, 1,0,0),
|
||||
JS_FS("startCallgrind", js_StartCallgrind, 0,0,0),
|
||||
JS_FS("stopCallgrind", js_StopCallgrind, 0,0,0),
|
||||
JS_FS("dumpCallgrind", js_DumpCallgrind, 1,0,0),
|
||||
#endif
|
||||
#ifdef MOZ_VTUNE
|
||||
JS_FS("startVtune", js_StartVtune, 1,0,0),
|
||||
JS_FS("stopVtune", js_StopVtune, 0,0,0),
|
||||
JS_FS("pauseVtune", js_PauseVtune, 0,0,0),
|
||||
JS_FS("resumeVtune", js_ResumeVtune, 0,0,0),
|
||||
JS_FS("startVtune", js_StartVtune, 1,0,0),
|
||||
JS_FS("stopVtune", js_StopVtune, 0,0,0),
|
||||
JS_FS("pauseVtune", js_PauseVtune, 0,0,0),
|
||||
JS_FS("resumeVtune", js_ResumeVtune, 0,0,0),
|
||||
#endif
|
||||
#ifdef DEBUG_ARRAYS
|
||||
JS_FS("arrayInfo", js_ArrayInfo, 1,0,0),
|
||||
JS_FS("arrayInfo", js_ArrayInfo, 1,0,0),
|
||||
#endif
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_FN("sleep", Sleep_fn, 1,0),
|
||||
JS_FN("scatter", Scatter, 1,0),
|
||||
#endif
|
||||
JS_FS("snarf", Snarf, 0,0,0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
@ -3190,7 +3057,6 @@ static const char *const shell_help_messages[] = {
|
||||
"sleep(dt) Sleep for dt seconds",
|
||||
"scatter(fns) Call functions concurrently (ignoring errors)",
|
||||
#endif
|
||||
"snarf(filename) Read filename into returned string"
|
||||
};
|
||||
|
||||
/* Help messages must match shell functions. */
|
||||
@ -3954,6 +3820,123 @@ Evaluate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
return ok;
|
||||
}
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/*
|
||||
* Returns a JS_malloc'd string (that the caller needs to JS_free)
|
||||
* containing the directory (non-leaf) part of |from| prepended to |leaf|.
|
||||
* If |from| is empty or a leaf, MakeAbsolutePathname returns a copy of leaf.
|
||||
* Returns NULL to indicate an error.
|
||||
*/
|
||||
static char *
|
||||
MakeAbsolutePathname(JSContext *cx, const char *from, const char *leaf)
|
||||
{
|
||||
size_t dirlen;
|
||||
char *dir;
|
||||
const char *slash = NULL, *cp;
|
||||
|
||||
cp = from;
|
||||
while (*cp) {
|
||||
if (*cp == '/'
|
||||
#ifdef XP_WIN
|
||||
|| *cp == '\\'
|
||||
#endif
|
||||
) {
|
||||
slash = cp;
|
||||
}
|
||||
|
||||
++cp;
|
||||
}
|
||||
|
||||
if (!slash) {
|
||||
/* We were given a leaf or |from| was empty. */
|
||||
return JS_strdup(cx, leaf);
|
||||
}
|
||||
|
||||
/* Else, we were given a real pathname, return that + the leaf. */
|
||||
dirlen = slash - from + 1;
|
||||
dir = (char*) JS_malloc(cx, dirlen + strlen(leaf) + 1);
|
||||
if (!dir)
|
||||
return NULL;
|
||||
|
||||
strncpy(dir, from, dirlen);
|
||||
strcpy(dir + dirlen, leaf); /* Note: we can't use strcat here. */
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
snarf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSString *str;
|
||||
const char *filename;
|
||||
char *pathname;
|
||||
JSStackFrame *fp;
|
||||
JSBool ok;
|
||||
off_t cc, len;
|
||||
char *buf;
|
||||
FILE *file;
|
||||
|
||||
str = JS_ValueToString(cx, argv[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
filename = JS_GetStringBytes(str);
|
||||
|
||||
/* Get the currently executing script's name. */
|
||||
fp = JS_GetScriptedCaller(cx, NULL);
|
||||
JS_ASSERT(fp && fp->script->filename);
|
||||
pathname = MakeAbsolutePathname(cx, fp->script->filename, filename);
|
||||
if (!pathname)
|
||||
return JS_FALSE;
|
||||
|
||||
ok = JS_FALSE;
|
||||
len = 0;
|
||||
buf = NULL;
|
||||
file = fopen(pathname, "rb");
|
||||
if (!file) {
|
||||
JS_ReportError(cx, "can't open %s: %s", pathname, strerror(errno));
|
||||
} else {
|
||||
if (fseek(file, 0, SEEK_END) == EOF) {
|
||||
JS_ReportError(cx, "can't seek end of %s", pathname);
|
||||
} else {
|
||||
len = ftell(file);
|
||||
if (len == -1 || fseek(file, 0, SEEK_SET) == EOF) {
|
||||
JS_ReportError(cx, "can't seek start of %s", pathname);
|
||||
} else {
|
||||
buf = (char*) JS_malloc(cx, len + 1);
|
||||
if (buf) {
|
||||
cc = fread(buf, 1, len, file);
|
||||
if (cc != len) {
|
||||
JS_free(cx, buf);
|
||||
JS_ReportError(cx, "can't read %s: %s", pathname,
|
||||
(cc < 0) ? strerror(errno)
|
||||
: "short read");
|
||||
} else {
|
||||
len = (size_t)cc;
|
||||
ok = JS_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
JS_free(cx, pathname);
|
||||
if (!ok) {
|
||||
JS_free(cx, buf);
|
||||
return ok;
|
||||
}
|
||||
|
||||
buf[len] = '\0';
|
||||
str = JS_NewString(cx, buf, len);
|
||||
if (!str) {
|
||||
JS_free(cx, buf);
|
||||
return JS_FALSE;
|
||||
}
|
||||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#endif /* NARCISSUS */
|
||||
|
||||
static JSBool
|
||||
@ -4087,6 +4070,8 @@ main(int argc, char **argv, char **envp)
|
||||
jsval v;
|
||||
static const char Object_prototype[] = "Object.prototype";
|
||||
|
||||
if (!JS_DefineFunction(cx, glob, "snarf", snarf, 1, 0))
|
||||
return 1;
|
||||
if (!JS_DefineFunction(cx, glob, "evaluate", Evaluate, 3, 0))
|
||||
return 1;
|
||||
|
@ -1,60 +0,0 @@
|
||||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# ***** 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 Spidermonkey build system.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2008
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ted Mielczarek <ted.mielczarek@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# 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
|
||||
|
||||
PROGRAM = js$(BIN_SUFFIX)
|
||||
CPPSRCS = js.cpp
|
||||
|
||||
DEFINES += -DEXPORT_JS_API
|
||||
|
||||
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir) -I..
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# People expect the js shell to wind up in the top-level JS dir.
|
||||
libs::
|
||||
$(INSTALL) $(IFLAGS2) $(PROGRAM) $(DEPTH)
|
17
layout/base/crashtests/468645-1.xhtml
Normal file
17
layout/base/crashtests/468645-1.xhtml
Normal file
@ -0,0 +1,17 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-print">
|
||||
|
||||
<div style="-moz-binding: url(#xbl); display: table-cell;">
|
||||
<span style="display: inline-block;">
|
||||
<input style="page-break-after: right;"/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<bindings xmlns="http://www.mozilla.org/xbl">
|
||||
<binding id="xbl" inheritstyle="false">
|
||||
<resources>
|
||||
<stylesheet src="data:text/css;charset=utf-8,"/>
|
||||
</resources>
|
||||
</binding>
|
||||
</bindings>
|
||||
</html>
|
13
layout/base/crashtests/468645-2.xhtml
Normal file
13
layout/base/crashtests/468645-2.xhtml
Normal file
@ -0,0 +1,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-print">
|
||||
|
||||
<div style="-moz-binding:url(#xbl)"/>
|
||||
<input style="page-break-after: left;"/>
|
||||
|
||||
<bindings xmlns="http://www.mozilla.org/xbl">
|
||||
<binding id="xbl" inheritstyle="false">
|
||||
<resources>
|
||||
<stylesheet src="data:text/css;charset=utf-8,"/>
|
||||
</resources>
|
||||
</binding>
|
||||
</bindings>
|
||||
</html>
|
5
layout/base/crashtests/468645-3.xhtml
Normal file
5
layout/base/crashtests/468645-3.xhtml
Normal file
@ -0,0 +1,5 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" class="reftest-print">
|
||||
<popup xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>
|
||||
|
||||
<style>html::before, window::before { content:""; display: table; position: fixed;}</style>
|
||||
</html>
|
@ -132,3 +132,8 @@ load 455063-2.html
|
||||
load 455063-3.html
|
||||
load 455171-4.html
|
||||
load 466763-1.html
|
||||
# These three didn't actually crash without the resizing that the
|
||||
# browser does when setting up print preview, but adding them anyway.
|
||||
load 468645-1.xhtml
|
||||
load 468645-2.xhtml
|
||||
load 468645-3.xhtml
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user