mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Merge m-c again to pick up 75deec1f1a7b
This commit is contained in:
commit
1847cf91b3
@ -871,10 +871,11 @@ refChildCB(AtkObject *aAtkObj, gint aChildIndex)
|
||||
if (!childAtkObj)
|
||||
return nsnull;
|
||||
g_object_ref(childAtkObj);
|
||||
|
||||
//this will addref parent
|
||||
|
||||
if (aAtkObj != childAtkObj->accessible_parent)
|
||||
atk_object_set_parent(childAtkObj, aAtkObj);
|
||||
return childAtkObj;
|
||||
|
||||
return childAtkObj;
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -110,3 +110,16 @@ StyleInfo::Margin(css::Side aSide, nsAString& aValue)
|
||||
aValue.AppendFloat(nsPresContext::AppUnitsToFloatCSSPixels(coordVal));
|
||||
aValue.AppendLiteral("px");
|
||||
}
|
||||
|
||||
void
|
||||
StyleInfo::Format(const nscolor& aValue, nsString& aFormattedValue)
|
||||
{
|
||||
// Combine the string like rgb(R, G, B) from nscolor.
|
||||
aFormattedValue.AppendLiteral("rgb(");
|
||||
aFormattedValue.AppendInt(NS_GET_R(aValue));
|
||||
aFormattedValue.AppendLiteral(", ");
|
||||
aFormattedValue.AppendInt(NS_GET_G(aValue));
|
||||
aFormattedValue.AppendLiteral(", ");
|
||||
aFormattedValue.AppendInt(NS_GET_B(aValue));
|
||||
aFormattedValue.Append(')');
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
void MarginTop(nsAString& aValue) { Margin(css::eSideTop, aValue); }
|
||||
void MarginBottom(nsAString& aValue) { Margin(css::eSideBottom, aValue); }
|
||||
|
||||
static void Format(const nscolor& aValue, nsString& aFormattedValue);
|
||||
|
||||
private:
|
||||
StyleInfo() MOZ_DELETE;
|
||||
StyleInfo(const StyleInfo&) MOZ_DELETE;
|
||||
|
@ -364,9 +364,9 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
||||
aDocument->IsResourceDoc() || !aDocument->IsActive())
|
||||
return nsnull;
|
||||
|
||||
// Ignore documents without presshell.
|
||||
nsIPresShell *presShell = aDocument->GetShell();
|
||||
if (!presShell)
|
||||
// Ignore documents without presshell and not having root frame.
|
||||
nsIPresShell* presShell = aDocument->GetShell();
|
||||
if (!presShell || !presShell->GetRootFrame())
|
||||
return nsnull;
|
||||
|
||||
// Do not create document accessible until role content is loaded, otherwise
|
||||
|
@ -41,12 +41,16 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
#include "StyleInfo.h"
|
||||
|
||||
#include "gfxFont.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "nsFontMetrics.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constants and structures
|
||||
|
||||
@ -70,7 +74,6 @@ const char* const kCopyValue = nsnull;
|
||||
static nsCSSTextAttrMapItem gCSSTextAttrsMap[] =
|
||||
{
|
||||
// CSS name CSS value Attribute name Attribute value
|
||||
{ "color", kAnyValue, &nsGkAtoms::color, kCopyValue },
|
||||
{ "font-family", kAnyValue, &nsGkAtoms::font_family, kCopyValue },
|
||||
{ "font-style", kAnyValue, &nsGkAtoms::font_style, kCopyValue },
|
||||
{ "text-decoration", "line-through", &nsGkAtoms::textLineThroughStyle, "solid" },
|
||||
@ -154,34 +157,34 @@ nsTextAttrsMgr::GetAttributes(nsIPersistentProperties *aAttributes,
|
||||
nsLangTextAttr langTextAttr(mHyperTextAcc, hyperTextElm, offsetNode);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&langTextAttr));
|
||||
|
||||
// "color" text attribute
|
||||
nsCSSTextAttr colorTextAttr(0, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&colorTextAttr));
|
||||
|
||||
// "font-family" text attribute
|
||||
nsCSSTextAttr fontFamilyTextAttr(1, hyperTextElm, offsetElm);
|
||||
nsCSSTextAttr fontFamilyTextAttr(0, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&fontFamilyTextAttr));
|
||||
|
||||
// "font-style" text attribute
|
||||
nsCSSTextAttr fontStyleTextAttr(2, hyperTextElm, offsetElm);
|
||||
nsCSSTextAttr fontStyleTextAttr(1, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&fontStyleTextAttr));
|
||||
|
||||
// "text-line-through-style" text attribute
|
||||
nsCSSTextAttr lineThroughTextAttr(3, hyperTextElm, offsetElm);
|
||||
nsCSSTextAttr lineThroughTextAttr(2, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&lineThroughTextAttr));
|
||||
|
||||
// "text-underline-style" text attribute
|
||||
nsCSSTextAttr underlineTextAttr(4, hyperTextElm, offsetElm);
|
||||
nsCSSTextAttr underlineTextAttr(3, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&underlineTextAttr));
|
||||
|
||||
// "text-position" text attribute
|
||||
nsCSSTextAttr posTextAttr(5, hyperTextElm, offsetElm);
|
||||
nsCSSTextAttr posTextAttr(4, hyperTextElm, offsetElm);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&posTextAttr));
|
||||
|
||||
// "background-color" text attribute
|
||||
nsBGColorTextAttr bgColorTextAttr(rootFrame, frame);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&bgColorTextAttr));
|
||||
|
||||
// "color" text attribute
|
||||
ColorTextAttr colorTextAttr(rootFrame, frame);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&colorTextAttr));
|
||||
|
||||
// "font-size" text attribute
|
||||
nsFontSizeTextAttr fontSizeTextAttr(rootFrame, frame);
|
||||
textAttrArray.AppendElement(static_cast<nsITextAttr*>(&fontSizeTextAttr));
|
||||
@ -363,7 +366,7 @@ nsCSSTextAttr::Format(const nsAutoString& aValue, nsAString& aFormattedValue)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBackgroundTextAttr
|
||||
// nsBGColorTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsBGColorTextAttr::nsBGColorTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
||||
@ -387,16 +390,8 @@ nsBGColorTextAttr::GetValueFor(nsIContent *aContent, nscolor *aValue)
|
||||
void
|
||||
nsBGColorTextAttr::Format(const nscolor& aValue, nsAString& aFormattedValue)
|
||||
{
|
||||
// Combine the string like rgb(R, G, B) from nscolor.
|
||||
nsAutoString value;
|
||||
value.AppendLiteral("rgb(");
|
||||
value.AppendInt(NS_GET_R(aValue));
|
||||
value.AppendLiteral(", ");
|
||||
value.AppendInt(NS_GET_G(aValue));
|
||||
value.AppendLiteral(", ");
|
||||
value.AppendInt(NS_GET_B(aValue));
|
||||
value.Append(')');
|
||||
|
||||
StyleInfo::Format(aValue, value);
|
||||
aFormattedValue = value;
|
||||
}
|
||||
|
||||
@ -426,6 +421,43 @@ nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ColorTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorTextAttr::ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame) :
|
||||
nsTextAttr<nscolor>(!aFrame)
|
||||
{
|
||||
mRootNativeValue = aRootFrame->GetStyleColor()->mColor;
|
||||
mIsRootDefined = true;
|
||||
|
||||
if (aFrame) {
|
||||
mNativeValue = aFrame->GetStyleColor()->mColor;
|
||||
mIsDefined = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ColorTextAttr::GetValueFor(nsIContent* aContent, nscolor* aValue)
|
||||
{
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
*aValue = frame->GetStyleColor()->mColor;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ColorTextAttr::Format(const nscolor& aValue, nsAString& aFormattedValue)
|
||||
{
|
||||
nsAutoString value;
|
||||
StyleInfo::Format(aValue, value);
|
||||
aFormattedValue = value;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFontSizeTextAttr
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -307,6 +307,25 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class is used for the work with 'color' text attribute in nsTextAttrsMgr
|
||||
* class.
|
||||
*/
|
||||
class ColorTextAttr : public nsTextAttr<nscolor>
|
||||
{
|
||||
public:
|
||||
ColorTextAttr(nsIFrame* aRootFrame, nsIFrame* aFrame);
|
||||
|
||||
// nsITextAttr
|
||||
virtual nsIAtom* GetName() const { return nsGkAtoms::color; }
|
||||
|
||||
protected:
|
||||
// nsTextAttr
|
||||
virtual bool GetValueFor(nsIContent* aContent, nscolor* aValue);
|
||||
virtual void Format(const nscolor& aValue, nsAString& aFormattedValue);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class is used for the work with "font-size" text attribute in nsTextAttrsMgr
|
||||
* class.
|
||||
|
@ -192,6 +192,7 @@
|
||||
@BINPATH@/components/find.xpt
|
||||
@BINPATH@/components/fuel.xpt
|
||||
@BINPATH@/components/gfx.xpt
|
||||
@BINPATH@/components/html5.xpt
|
||||
@BINPATH@/components/htmlparser.xpt
|
||||
@BINPATH@/components/imglib2.xpt
|
||||
@BINPATH@/components/imgicon.xpt
|
||||
|
@ -1681,11 +1681,16 @@ SessionStoreService.prototype = {
|
||||
// If we're still here, then the window is usable. Look at the open tabs in
|
||||
// comparison to home pages. If all the tabs are home pages then we'll end
|
||||
// up overwriting all of them. Otherwise we'll just close the tabs that
|
||||
// match home pages.
|
||||
let homePages = aWindow.gHomeButton.getHomePage().split("|");
|
||||
// match home pages. Tabs with the about:blank URI will always be
|
||||
// overwritten.
|
||||
let homePages = ["about:blank"];
|
||||
let removableTabs = [];
|
||||
let tabbrowser = aWindow.gBrowser;
|
||||
let normalTabsLen = tabbrowser.tabs.length - tabbrowser._numPinnedTabs;
|
||||
let startupPref = this._prefBranch.getIntPref("startup.page");
|
||||
if (startupPref == 1)
|
||||
homePages = homePages.concat(aWindow.gHomeButton.getHomePage().split("|"));
|
||||
|
||||
for (let i = tabbrowser._numPinnedTabs; i < tabbrowser.tabs.length; i++) {
|
||||
let tab = tabbrowser.tabs[i];
|
||||
if (homePages.indexOf(tab.linkedBrowser.currentURI.spec) != -1) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -1,5 +1,6 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -7,6 +7,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --disable-install-strip
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -7,6 +7,7 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --disable-install-strip
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -1,6 +1,7 @@
|
||||
. $topsrcdir/build/macosx/mozconfig.leopard
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j12"
|
||||
|
@ -1,6 +1,7 @@
|
||||
. $topsrcdir/build/macosx/mozconfig.leopard
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j4"
|
||||
|
@ -3,6 +3,7 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-accessibility
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j12"
|
||||
|
@ -3,6 +3,7 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-accessibility
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Enable parallel compiling
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j4"
|
||||
|
@ -1,5 +1,6 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
@ -4,6 +4,7 @@ mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profiles
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-jemalloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -3,6 +3,7 @@ ac_add_options --host=x86_64-pc-mingw32
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-trace-malloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
@ -7,6 +7,7 @@ mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profiles
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-jemalloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
@ -75,6 +75,8 @@ const BUTTON_POSITION_DONT_SAVE = 2;
|
||||
* The scratchpad object handles the Scratchpad window functionality.
|
||||
*/
|
||||
var Scratchpad = {
|
||||
_initialWindowTitle: document.title,
|
||||
|
||||
/**
|
||||
* The script execution context. This tells Scratchpad in which context the
|
||||
* script shall execute.
|
||||
@ -151,7 +153,22 @@ var Scratchpad = {
|
||||
*/
|
||||
setFilename: function SP_setFilename(aFilename)
|
||||
{
|
||||
document.title = this.filename = aFilename;
|
||||
this.filename = aFilename;
|
||||
this._updateTitle();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the Scratchpad window title based on the current state.
|
||||
* @private
|
||||
*/
|
||||
_updateTitle: function SP__updateTitle()
|
||||
{
|
||||
if (this.filename) {
|
||||
document.title = (this.editor && this.editor.dirty ? "*" : "") +
|
||||
this.filename;
|
||||
} else {
|
||||
document.title = this._initialWindowTitle;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -168,7 +185,7 @@ var Scratchpad = {
|
||||
filename: this.filename,
|
||||
text: this.getText(),
|
||||
executionContext: this.executionContext,
|
||||
saved: this.saved
|
||||
saved: !this.editor.dirty,
|
||||
};
|
||||
},
|
||||
|
||||
@ -184,7 +201,9 @@ var Scratchpad = {
|
||||
if (aState.filename) {
|
||||
this.setFilename(aState.filename);
|
||||
}
|
||||
this.saved = aState.saved;
|
||||
if (this.editor) {
|
||||
this.editor.dirty = !aState.saved;
|
||||
}
|
||||
|
||||
if (aState.executionContext == SCRATCHPAD_CONTEXT_BROWSER) {
|
||||
this.setBrowserContext();
|
||||
@ -638,7 +657,7 @@ var Scratchpad = {
|
||||
fp.defaultString = "";
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
this.setFilename(fp.file.path);
|
||||
this.importFromFile(fp.file, false, this.onTextSaved.bind(this));
|
||||
this.importFromFile(fp.file, false);
|
||||
}
|
||||
},
|
||||
|
||||
@ -658,7 +677,9 @@ var Scratchpad = {
|
||||
file.initWithPath(this.filename);
|
||||
|
||||
this.exportToFile(file, true, false, function(aStatus) {
|
||||
this.onTextSaved();
|
||||
if (Components.isSuccessCode(aStatus)) {
|
||||
this.editor.dirty = false;
|
||||
}
|
||||
if (aCallback) {
|
||||
aCallback(aStatus);
|
||||
}
|
||||
@ -681,7 +702,9 @@ var Scratchpad = {
|
||||
this.setFilename(fp.file.path);
|
||||
|
||||
this.exportToFile(fp.file, true, false, function(aStatus) {
|
||||
this.onTextSaved();
|
||||
if (Components.isSuccessCode(aStatus)) {
|
||||
this.editor.dirty = false;
|
||||
}
|
||||
if (aCallback) {
|
||||
aCallback(aStatus);
|
||||
}
|
||||
@ -783,7 +806,6 @@ var Scratchpad = {
|
||||
if (aEvent.target != document) {
|
||||
return;
|
||||
}
|
||||
|
||||
let chrome = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED);
|
||||
if (chrome) {
|
||||
let environmentMenu = document.getElementById("sp-environment-menu");
|
||||
@ -794,10 +816,11 @@ var Scratchpad = {
|
||||
errorConsoleCommand.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
let state = null;
|
||||
let initialText = this.strings.GetStringFromName("scratchpadIntro");
|
||||
if ("arguments" in window &&
|
||||
window.arguments[0] instanceof Ci.nsIDialogParamBlock) {
|
||||
let state = JSON.parse(window.arguments[0].GetString(0));
|
||||
state = JSON.parse(window.arguments[0].GetString(0));
|
||||
this.setState(state);
|
||||
initialText = state.text;
|
||||
}
|
||||
@ -808,32 +831,34 @@ var Scratchpad = {
|
||||
mode: SourceEditor.MODES.JAVASCRIPT,
|
||||
showLineNumbers: true,
|
||||
initialText: initialText,
|
||||
contextMenu: "scratchpad-text-popup",
|
||||
};
|
||||
|
||||
let editorPlaceholder = document.getElementById("scratchpad-editor");
|
||||
this.editor.init(editorPlaceholder, config, this.onEditorLoad.bind(this));
|
||||
this.editor.init(editorPlaceholder, config,
|
||||
this._onEditorLoad.bind(this, state));
|
||||
},
|
||||
|
||||
/**
|
||||
* The load event handler for the source editor. This method does post-load
|
||||
* editor initialization.
|
||||
*
|
||||
* @private
|
||||
* @param object aState
|
||||
* The initial Scratchpad state object.
|
||||
*/
|
||||
onEditorLoad: function SP_onEditorLoad()
|
||||
_onEditorLoad: function SP__onEditorLoad(aState)
|
||||
{
|
||||
this.editor.addEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
|
||||
this.onContextMenu);
|
||||
this.editor.addEventListener(SourceEditor.EVENTS.DIRTY_CHANGED,
|
||||
this._onDirtyChanged);
|
||||
this.editor.focus();
|
||||
this.editor.setCaretOffset(this.editor.getCharCount());
|
||||
if (aState) {
|
||||
this.editor.dirty = !aState.saved;
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
|
||||
if (this.filename && !this.saved) {
|
||||
this.onTextChanged();
|
||||
}
|
||||
else if (this.filename && this.saved) {
|
||||
this.onTextSaved();
|
||||
}
|
||||
|
||||
this._triggerObservers("Ready");
|
||||
},
|
||||
|
||||
@ -851,36 +876,17 @@ var Scratchpad = {
|
||||
},
|
||||
|
||||
/**
|
||||
* The contextmenu event handler for the source editor. This method opens the
|
||||
* Scratchpad context menu popup at the pointer location.
|
||||
* The Source Editor DirtyChanged event handler. This function updates the
|
||||
* Scratchpad window title to show an asterisk when there are unsaved changes.
|
||||
*
|
||||
* @private
|
||||
* @see SourceEditor.EVENTS.DIRTY_CHANGED
|
||||
* @param object aEvent
|
||||
* An event object coming from the SourceEditor. This object needs to
|
||||
* hold the screenX and screenY properties.
|
||||
* The DirtyChanged event object.
|
||||
*/
|
||||
onContextMenu: function SP_onContextMenu(aEvent)
|
||||
_onDirtyChanged: function SP__onDirtyChanged(aEvent)
|
||||
{
|
||||
let menu = document.getElementById("scratchpad-text-popup");
|
||||
if (menu.state == "closed") {
|
||||
menu.openPopupAtScreen(aEvent.screenX, aEvent.screenY, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The popupshowing event handler for the Edit menu. This method updates the
|
||||
* enabled/disabled state of the Undo and Redo commands, based on the editor
|
||||
* state such that the menu items render correctly for the user when the menu
|
||||
* shows.
|
||||
*/
|
||||
onEditPopupShowing: function SP_onEditPopupShowing()
|
||||
{
|
||||
goUpdateGlobalEditMenuItems();
|
||||
|
||||
let undo = document.getElementById("sp-cmd-undo");
|
||||
undo.setAttribute("disabled", !this.editor.canUndo());
|
||||
|
||||
let redo = document.getElementById("sp-cmd-redo");
|
||||
redo.setAttribute("disabled", !this.editor.canRedo());
|
||||
Scratchpad._updateTitle();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -899,36 +905,6 @@ var Scratchpad = {
|
||||
this.editor.redo();
|
||||
},
|
||||
|
||||
/**
|
||||
* This method adds a listener to the editor for text changes. Called when
|
||||
* a scratchpad is saved, opened from file, or restored from a saved file.
|
||||
*/
|
||||
onTextSaved: function SP_onTextSaved(aStatus)
|
||||
{
|
||||
if (aStatus && !Components.isSuccessCode(aStatus)) {
|
||||
return;
|
||||
}
|
||||
if (!document || !this.initialized) {
|
||||
return; // file saved to disk after window has closed
|
||||
}
|
||||
document.title = document.title.replace(/^\*/, "");
|
||||
this.saved = true;
|
||||
this.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
this.onTextChanged);
|
||||
},
|
||||
|
||||
/**
|
||||
* The scratchpad handler for editor text change events. This handler
|
||||
* indicates that there are unsaved changes in the UI.
|
||||
*/
|
||||
onTextChanged: function SP_onTextChanged()
|
||||
{
|
||||
document.title = "*" + document.title;
|
||||
Scratchpad.saved = false;
|
||||
Scratchpad.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
Scratchpad.onTextChanged);
|
||||
},
|
||||
|
||||
/**
|
||||
* The Scratchpad window unload event handler. This method unloads/destroys
|
||||
* the source editor.
|
||||
@ -942,8 +918,8 @@ var Scratchpad = {
|
||||
}
|
||||
|
||||
this.resetContext();
|
||||
this.editor.removeEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
|
||||
this.onContextMenu);
|
||||
this.editor.removeEventListener(SourceEditor.EVENTS.DIRTY_CHANGED,
|
||||
this._onDirtyChanged);
|
||||
this.editor.destroy();
|
||||
this.editor = null;
|
||||
this.initialized = false;
|
||||
@ -953,13 +929,18 @@ var Scratchpad = {
|
||||
* Prompt to save scratchpad if it has unsaved changes.
|
||||
*
|
||||
* @param function aCallback
|
||||
* Optional function you want to call when file is saved
|
||||
* Optional function you want to call when file is saved. The callback
|
||||
* receives three arguments:
|
||||
* - toClose (boolean) - tells if the window should be closed.
|
||||
* - saved (boolen) - tells if the file has been saved.
|
||||
* - status (number) - the file save status result (if the file was
|
||||
* saved).
|
||||
* @return boolean
|
||||
* Whether the window should be closed
|
||||
*/
|
||||
promptSave: function SP_promptSave(aCallback)
|
||||
{
|
||||
if (this.filename && !this.saved) {
|
||||
if (this.filename && this.editor.dirty) {
|
||||
let ps = Services.prompt;
|
||||
let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_SAVE +
|
||||
ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL +
|
||||
@ -971,12 +952,25 @@ var Scratchpad = {
|
||||
flags, null, null, null, null, {});
|
||||
|
||||
if (button == BUTTON_POSITION_CANCEL) {
|
||||
if (aCallback) {
|
||||
aCallback(false, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (button == BUTTON_POSITION_SAVE) {
|
||||
this.saveFile(aCallback);
|
||||
this.saveFile(function(aStatus) {
|
||||
if (aCallback) {
|
||||
aCallback(true, true, aStatus);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (aCallback) {
|
||||
aCallback(true, false);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -988,10 +982,22 @@ var Scratchpad = {
|
||||
*/
|
||||
onClose: function SP_onClose(aEvent)
|
||||
{
|
||||
let toClose = this.promptSave();
|
||||
if (!toClose) {
|
||||
aEvent.preventDefault();
|
||||
if (this._skipClosePrompt) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.promptSave(function(aShouldClose, aSaved, aStatus) {
|
||||
let shouldClose = aShouldClose;
|
||||
if (aSaved && !Components.isSuccessCode(aStatus)) {
|
||||
shouldClose = false;
|
||||
}
|
||||
|
||||
if (shouldClose) {
|
||||
this._skipClosePrompt = true;
|
||||
window.close();
|
||||
}
|
||||
}.bind(this));
|
||||
aEvent.preventDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1003,10 +1009,20 @@ var Scratchpad = {
|
||||
*/
|
||||
close: function SP_close(aCallback)
|
||||
{
|
||||
let toClose = this.promptSave(aCallback);
|
||||
if (toClose) {
|
||||
window.close();
|
||||
}
|
||||
this.promptSave(function(aShouldClose, aSaved, aStatus) {
|
||||
let shouldClose = aShouldClose;
|
||||
if (aSaved && !Components.isSuccessCode(aStatus)) {
|
||||
shouldClose = false;
|
||||
}
|
||||
|
||||
if (shouldClose) {
|
||||
this._skipClosePrompt = true;
|
||||
window.close();
|
||||
}
|
||||
if (aCallback) {
|
||||
aCallback();
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
_observers: [],
|
||||
|
@ -81,11 +81,11 @@
|
||||
<command id="sp-cmd-resetContext" oncommand="Scratchpad.resetContext();"/>
|
||||
<command id="sp-cmd-errorConsole" oncommand="Scratchpad.openErrorConsole();" disabled="true"/>
|
||||
<command id="sp-cmd-webConsole" oncommand="Scratchpad.openWebConsole();"/>
|
||||
<command id="sp-cmd-undo" oncommand="Scratchpad.undo();" disabled="true"/>
|
||||
<command id="sp-cmd-redo" oncommand="Scratchpad.redo();" disabled="true"/>
|
||||
<command id="sp-cmd-documentationLink" oncommand="Scratchpad.openDocumentationPage();"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="sourceEditorKeys"/>
|
||||
|
||||
<keyset id="sp-keyset">
|
||||
<key id="sp-key-window"
|
||||
key="&newWindowCmd.commandkey;"
|
||||
@ -123,9 +123,9 @@
|
||||
modifiers="accel"/>
|
||||
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
|
||||
<key id="key_undo" key="&undoCmd.key;" modifiers="accel"
|
||||
oncommand="Scratchpad.undo();"/>
|
||||
command="se-cmd-undo"/>
|
||||
<key id="key_redo" key="&undoCmd.key;" modifiers="accel,shift"
|
||||
oncommand="Scratchpad.redo();"/>
|
||||
command="se-cmd-redo"/>
|
||||
<key id="sp-key-run"
|
||||
key="&run.key;"
|
||||
command="sp-cmd-run"
|
||||
@ -168,10 +168,6 @@
|
||||
command="cmd_findPrevious"
|
||||
modifiers="shift"/>
|
||||
#endif
|
||||
<key id="key_gotoLine"
|
||||
key="&gotoLineCmd.key;"
|
||||
command="cmd_gotoLine"
|
||||
modifiers="accel"/>
|
||||
<key id="key_openHelp"
|
||||
keycode="VK_F1"
|
||||
command="sp-cmd-documentationLink"/>
|
||||
@ -223,17 +219,17 @@
|
||||
<menu id="sp-edit-menu" label="&editMenu.label;"
|
||||
accesskey="&editMenu.accesskey;">
|
||||
<menupopup id="sp-menu_editpopup"
|
||||
onpopupshowing="Scratchpad.onEditPopupShowing()">
|
||||
onpopupshowing="goUpdateGlobalEditMenuItems()">
|
||||
<menuitem id="sp-menu-undo"
|
||||
label="&undoCmd.label;"
|
||||
key="key_undo"
|
||||
accesskey="&undoCmd.accesskey;"
|
||||
command="sp-cmd-undo"/>
|
||||
command="se-cmd-undo"/>
|
||||
<menuitem id="sp-menu-redo"
|
||||
label="&redoCmd.label;"
|
||||
key="key_redo"
|
||||
accesskey="&redoCmd.accesskey;"
|
||||
command="sp-cmd-redo"/>
|
||||
command="se-cmd-redo"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="sp-menu-cut"
|
||||
label="&cutCmd.label;"
|
||||
|
@ -46,9 +46,10 @@ function test()
|
||||
function testNew()
|
||||
{
|
||||
openScratchpad(function(win) {
|
||||
win.Scratchpad.close();
|
||||
ok(win.closed, "new scratchpad window should close without prompting")
|
||||
done();
|
||||
win.Scratchpad.close(function() {
|
||||
ok(win.closed, "new scratchpad window should close without prompting")
|
||||
done();
|
||||
});
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
@ -56,11 +57,11 @@ function testSavedFile()
|
||||
{
|
||||
openScratchpad(function(win) {
|
||||
win.Scratchpad.filename = "test.js";
|
||||
win.Scratchpad.saved = true;
|
||||
win.Scratchpad.close();
|
||||
|
||||
ok(win.closed, "scratchpad from file with no changes should close")
|
||||
done();
|
||||
win.Scratchpad.editor.dirty = false;
|
||||
win.Scratchpad.close(function() {
|
||||
ok(win.closed, "scratchpad from file with no changes should close")
|
||||
done();
|
||||
});
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
@ -74,17 +75,16 @@ function testUnsaved()
|
||||
function testUnsavedFileCancel()
|
||||
{
|
||||
openScratchpad(function(win) {
|
||||
win.Scratchpad.filename = "test.js";
|
||||
win.Scratchpad.saved = false;
|
||||
win.Scratchpad.setFilename("test.js");
|
||||
win.Scratchpad.editor.dirty = true;
|
||||
|
||||
promptButton = win.BUTTON_POSITION_CANCEL;
|
||||
|
||||
win.Scratchpad.close();
|
||||
|
||||
ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
|
||||
|
||||
win.close();
|
||||
done();
|
||||
win.Scratchpad.close(function() {
|
||||
ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
|
||||
win.close();
|
||||
done();
|
||||
});
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
@ -92,8 +92,7 @@ function testUnsavedFileSave()
|
||||
{
|
||||
openScratchpad(function(win) {
|
||||
win.Scratchpad.importFromFile(gFile, true, function(status, content) {
|
||||
win.Scratchpad.filename = gFile.path;
|
||||
win.Scratchpad.onTextSaved();
|
||||
win.Scratchpad.setFilename(gFile.path);
|
||||
|
||||
let text = "new text";
|
||||
win.Scratchpad.setText(text);
|
||||
@ -101,13 +100,12 @@ function testUnsavedFileSave()
|
||||
promptButton = win.BUTTON_POSITION_SAVE;
|
||||
|
||||
win.Scratchpad.close(function() {
|
||||
ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
|
||||
readFile(gFile, function(savedContent) {
|
||||
is(savedContent, text, 'prompted "Save" worked when closing scratchpad');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
|
||||
});
|
||||
}, {noFocus: true});
|
||||
}
|
||||
@ -115,15 +113,15 @@ function testUnsavedFileSave()
|
||||
function testUnsavedFileDontSave()
|
||||
{
|
||||
openScratchpad(function(win) {
|
||||
win.Scratchpad.filename = gFile.path;
|
||||
win.Scratchpad.saved = false;
|
||||
win.Scratchpad.setFilename(gFile.path);
|
||||
win.Scratchpad.editor.dirty = true;
|
||||
|
||||
promptButton = win.BUTTON_POSITION_DONT_SAVE;
|
||||
|
||||
win.Scratchpad.close();
|
||||
|
||||
ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
|
||||
done();
|
||||
win.Scratchpad.close(function() {
|
||||
ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
|
||||
done();
|
||||
});
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// only finish() when correct number of tests are done
|
||||
const expected = 5;
|
||||
const expected = 4;
|
||||
var count = 0;
|
||||
function done()
|
||||
{
|
||||
@ -20,7 +20,6 @@ function test()
|
||||
waitForExplicitFinish();
|
||||
|
||||
testListeners();
|
||||
testErrorStatus();
|
||||
testRestoreNotFromFile();
|
||||
testRestoreFromFileSaved();
|
||||
testRestoreFromFileUnsaved();
|
||||
@ -34,36 +33,30 @@ function testListeners()
|
||||
aScratchpad.setText("new text");
|
||||
ok(!isStar(aWin), "no star if scratchpad isn't from a file");
|
||||
|
||||
aScratchpad.onTextSaved();
|
||||
aScratchpad.editor.dirty = false;
|
||||
ok(!isStar(aWin), "no star before changing text");
|
||||
|
||||
aScratchpad.setFilename("foo.js");
|
||||
aScratchpad.setText("new text2");
|
||||
ok(isStar(aWin), "shows star if scratchpad text changes");
|
||||
|
||||
aScratchpad.onTextSaved();
|
||||
aScratchpad.editor.dirty = false;
|
||||
ok(!isStar(aWin), "no star if scratchpad was just saved");
|
||||
|
||||
aScratchpad.setText("new text3");
|
||||
ok(isStar(aWin), "shows star if scratchpad has more changes");
|
||||
|
||||
aScratchpad.undo();
|
||||
ok(isStar(aWin), "star if scratchpad undo");
|
||||
ok(!isStar(aWin), "no star if scratchpad undo to save point");
|
||||
|
||||
aScratchpad.undo();
|
||||
ok(isStar(aWin), "star if scratchpad undo past save point");
|
||||
|
||||
aWin.close();
|
||||
done();
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
function testErrorStatus()
|
||||
{
|
||||
openScratchpad(function(aWin, aScratchpad) {
|
||||
aScratchpad.onTextSaved(Components.results.NS_ERROR_FAILURE);
|
||||
aScratchpad.setText("new text");
|
||||
ok(!isStar(aWin), "no star if file save failed");
|
||||
|
||||
aWin.close();
|
||||
done();
|
||||
}, {noFocus: true});
|
||||
}
|
||||
|
||||
|
||||
function testRestoreNotFromFile()
|
||||
{
|
||||
let session = [{
|
||||
|
@ -32,8 +32,6 @@ function runTests()
|
||||
"sp-text-resetContext": "resetContext",
|
||||
"sp-menu-content": "setContentContext",
|
||||
"sp-menu-browser": "setBrowserContext",
|
||||
"sp-menu-undo": "undo",
|
||||
"sp-menu-redo": "redo",
|
||||
};
|
||||
|
||||
let lastMethodCalled = null;
|
||||
|
@ -146,6 +146,8 @@ function SourceEditor() {
|
||||
Services.prefs.getBoolPref(SourceEditor.PREFS.EXPAND_TAB);
|
||||
|
||||
this._onOrionSelection = this._onOrionSelection.bind(this);
|
||||
this._onTextChanged = this._onTextChanged.bind(this);
|
||||
this._onOrionContextMenu = this._onOrionContextMenu.bind(this);
|
||||
|
||||
this._eventTarget = {};
|
||||
this._eventListenersQueue = [];
|
||||
@ -172,6 +174,8 @@ SourceEditor.prototype = {
|
||||
_iframeWindow: null,
|
||||
_eventTarget: null,
|
||||
_eventListenersQueue: null,
|
||||
_contextMenu: null,
|
||||
_dirty: false,
|
||||
|
||||
/**
|
||||
* The Source Editor user interface manager.
|
||||
@ -279,7 +283,21 @@ SourceEditor.prototype = {
|
||||
|
||||
this._view.addEventListener("Load", onOrionLoad);
|
||||
if (config.highlightCurrentLine || Services.appinfo.OS == "Linux") {
|
||||
this._view.addEventListener("Selection", this._onOrionSelection);
|
||||
this.addEventListener(SourceEditor.EVENTS.SELECTION,
|
||||
this._onOrionSelection);
|
||||
}
|
||||
this.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
this._onTextChanged);
|
||||
|
||||
if (typeof config.contextMenu == "string") {
|
||||
let chromeDocument = this.parentElement.ownerDocument;
|
||||
this._contextMenu = chromeDocument.getElementById(config.contextMenu);
|
||||
} else if (typeof config.contextMenu == "object" ) {
|
||||
this._contextMenu = config._contextMenu;
|
||||
}
|
||||
if (this._contextMenu) {
|
||||
this.addEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
|
||||
this._onOrionContextMenu);
|
||||
}
|
||||
|
||||
let KeyBinding = window.require("orion/textview/keyBinding").KeyBinding;
|
||||
@ -587,6 +605,44 @@ SourceEditor.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The TextChanged event handler which tracks the dirty state of the editor.
|
||||
*
|
||||
* @see SourceEditor.EVENTS.TEXT_CHANGED
|
||||
* @see SourceEditor.EVENTS.DIRTY_CHANGED
|
||||
* @see SourceEditor.dirty
|
||||
* @private
|
||||
*/
|
||||
_onTextChanged: function SE__onTextChanged()
|
||||
{
|
||||
this._updateDirty();
|
||||
},
|
||||
|
||||
/**
|
||||
* The Orion contextmenu event handler. This method opens the default or
|
||||
* the custom context menu popup at the pointer location.
|
||||
*
|
||||
* @param object aEvent
|
||||
* The contextmenu event object coming from Orion. This object should
|
||||
* hold the screenX and screenY properties.
|
||||
*/
|
||||
_onOrionContextMenu: function SE__onOrionContextMenu(aEvent)
|
||||
{
|
||||
if (this._contextMenu.state == "closed") {
|
||||
this._contextMenu.openPopupAtScreen(aEvent.screenX || 0,
|
||||
aEvent.screenY || 0, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the dirty state of the editor based on the undo stack.
|
||||
* @private
|
||||
*/
|
||||
_updateDirty: function SE__updateDirty()
|
||||
{
|
||||
this.dirty = !this._undoStack.isClean();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the X11 PRIMARY buffer to hold the current selection.
|
||||
* @private
|
||||
@ -866,18 +922,28 @@ SourceEditor.prototype = {
|
||||
|
||||
/**
|
||||
* Undo a change in the editor.
|
||||
*
|
||||
* @return boolean
|
||||
* True if there was a change undone, false otherwise.
|
||||
*/
|
||||
undo: function SE_undo()
|
||||
{
|
||||
return this._undoStack.undo();
|
||||
let result = this._undoStack.undo();
|
||||
this.ui._onUndoRedo();
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Redo a change in the editor.
|
||||
*
|
||||
* @return boolean
|
||||
* True if there was a change redone, false otherwise.
|
||||
*/
|
||||
redo: function SE_redo()
|
||||
{
|
||||
return this._undoStack.redo();
|
||||
let result = this._undoStack.redo();
|
||||
this.ui._onUndoRedo();
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -903,11 +969,54 @@ SourceEditor.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset the Undo stack
|
||||
* Reset the Undo stack.
|
||||
*/
|
||||
resetUndo: function SE_resetUndo()
|
||||
{
|
||||
this._undoStack.reset();
|
||||
this._updateDirty();
|
||||
this.ui._onUndoRedo();
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the "dirty" state of the editor. Set this to false when you save the
|
||||
* text being edited. The dirty state will become true once the user makes
|
||||
* changes to the text.
|
||||
*
|
||||
* @param boolean aNewValue
|
||||
* The new dirty state: true if the text is not saved, false if you
|
||||
* just saved the text.
|
||||
*/
|
||||
set dirty(aNewValue)
|
||||
{
|
||||
if (aNewValue == this._dirty) {
|
||||
return;
|
||||
}
|
||||
|
||||
let event = {
|
||||
type: SourceEditor.EVENTS.DIRTY_CHANGED,
|
||||
oldValue: this._dirty,
|
||||
newValue: aNewValue,
|
||||
};
|
||||
|
||||
this._dirty = aNewValue;
|
||||
if (!this._dirty && !this._undoStack.isClean()) {
|
||||
this._undoStack.markClean();
|
||||
}
|
||||
this._dispatchEvent(event);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the editor "dirty" state. This tells if the text is considered saved or
|
||||
* not.
|
||||
*
|
||||
* @see SourceEditor.EVENTS.DIRTY_CHANGED
|
||||
* @return boolean
|
||||
* True if there are changes which are not saved, false otherwise.
|
||||
*/
|
||||
get dirty()
|
||||
{
|
||||
return this._dirty;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1326,10 +1435,22 @@ SourceEditor.prototype = {
|
||||
destroy: function SE_destroy()
|
||||
{
|
||||
if (this._config.highlightCurrentLine || Services.appinfo.OS == "Linux") {
|
||||
this._view.removeEventListener("Selection", this._onOrionSelection);
|
||||
this.removeEventListener(SourceEditor.EVENTS.SELECTION,
|
||||
this._onOrionSelection);
|
||||
}
|
||||
this._onOrionSelection = null;
|
||||
|
||||
this.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
this._onTextChanged);
|
||||
this._onTextChanged = null;
|
||||
|
||||
if (this._contextMenu) {
|
||||
this.removeEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
|
||||
this._onOrionContextMenu);
|
||||
this._contextMenu = null;
|
||||
}
|
||||
this._onOrionContextMenu = null;
|
||||
|
||||
if (this._primarySelectionTimeout) {
|
||||
let window = this.parentElement.ownerDocument.defaultView;
|
||||
window.clearTimeout(this._primarySelectionTimeout);
|
||||
|
@ -35,13 +35,80 @@
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://browser/locale/devtools/sourceeditor.dtd">
|
||||
<overlay id="sourceEditorOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- This Source Editor overlay requires the editMenuOverlay.xul to be loaded.
|
||||
The globalOverlay.js script is also required in the XUL document where
|
||||
the source-editor-overlay.xul is loaded. -->
|
||||
|
||||
<commandset id="sourceEditorCommands">
|
||||
<command id="cmd_find" oncommand="goDoCommand('cmd_find')"/>
|
||||
<command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
|
||||
<command id="cmd_findPrevious" oncommand="goDoCommand('cmd_findPrevious')" disabled="true"/>
|
||||
<command id="cmd_gotoLine" oncommand="goDoCommand('cmd_gotoLine')"/>
|
||||
<command id="se-cmd-undo" oncommand="goDoCommand('se-cmd-undo')" disabled="true"/>
|
||||
<command id="se-cmd-redo" oncommand="goDoCommand('se-cmd-redo')" disabled="true"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="sourceEditorKeys">
|
||||
<key id="key_gotoLine"
|
||||
key="&gotoLineCmd.key;"
|
||||
command="cmd_gotoLine"
|
||||
modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<menupopup id="sourceEditorContextMenu"
|
||||
onpopupshowing="goUpdateGlobalEditMenuItems()">
|
||||
<menuitem id="se-menu-undo"
|
||||
label="&undoCmd.label;"
|
||||
key="key_undo"
|
||||
accesskey="&undoCmd.accesskey;"
|
||||
command="se-cmd-undo"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="se-menu-cut"
|
||||
label="&cutCmd.label;"
|
||||
key="key_cut"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
command="cmd_cut"/>
|
||||
<menuitem id="se-menu-copy"
|
||||
label="©Cmd.label;"
|
||||
key="key_copy"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
command="cmd_copy"/>
|
||||
<menuitem id="se-menu-paste"
|
||||
label="&pasteCmd.label;"
|
||||
key="key_paste"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
command="cmd_paste"/>
|
||||
<menuitem id="se-menu-delete"
|
||||
label="&deleteCmd.label;"
|
||||
key="key_delete"
|
||||
accesskey="&deleteCmd.accesskey;"
|
||||
command="cmd_delete"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="se-menu-selectAll"
|
||||
label="&selectAllCmd.label;"
|
||||
key="key_selectAll"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="se-menu-find"
|
||||
label="&findCmd.label;"
|
||||
accesskey="&findCmd.accesskey;"
|
||||
key="key_find"
|
||||
command="cmd_find"/>
|
||||
<menuitem id="se-menu-findAgain"
|
||||
label="&findAgainCmd.label;"
|
||||
accesskey="&findAgainCmd.accesskey;"
|
||||
key="key_findAgain"
|
||||
command="cmd_findAgain"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="se-menu-gotoLine"
|
||||
label="&gotoLineCmd.label;"
|
||||
accesskey="&gotoLineCmd.accesskey;"
|
||||
key="key_gotoLine"
|
||||
command="cmd_gotoLine"/>
|
||||
</menupopup>
|
||||
</overlay>
|
||||
|
@ -50,6 +50,7 @@ var EXPORTED_SYMBOLS = ["SourceEditorUI"];
|
||||
function SourceEditorUI(aEditor)
|
||||
{
|
||||
this.editor = aEditor;
|
||||
this._onDirtyChanged = this._onDirtyChanged.bind(this);
|
||||
}
|
||||
|
||||
SourceEditorUI.prototype = {
|
||||
@ -72,6 +73,8 @@ SourceEditorUI.prototype = {
|
||||
if (this._ownerWindow.controllers) {
|
||||
this._controller = new SourceEditorController(this.editor);
|
||||
this._ownerWindow.controllers.insertControllerAt(0, this._controller);
|
||||
this.editor.addEventListener(this.editor.EVENTS.DIRTY_CHANGED,
|
||||
this._onDirtyChanged);
|
||||
}
|
||||
},
|
||||
|
||||
@ -177,12 +180,40 @@ SourceEditorUI.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This is executed after each undo/redo operation.
|
||||
* @private
|
||||
*/
|
||||
_onUndoRedo: function SEU__onUndoRedo()
|
||||
{
|
||||
if (this._ownerWindow.goUpdateCommand) {
|
||||
this._ownerWindow.goUpdateCommand("se-cmd-undo");
|
||||
this._ownerWindow.goUpdateCommand("se-cmd-redo");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The DirtyChanged event handler for the editor. This tracks the editor state
|
||||
* changes to make sure the Source Editor overlay Undo/Redo commands are kept
|
||||
* up to date.
|
||||
* @private
|
||||
*/
|
||||
_onDirtyChanged: function SEU__onDirtyChanged()
|
||||
{
|
||||
this._onUndoRedo();
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the SourceEditorUI instance. This is called by the
|
||||
* SourceEditor.destroy() method.
|
||||
*/
|
||||
destroy: function SEU_destroy()
|
||||
{
|
||||
if (this._ownerWindow.controllers) {
|
||||
this.editor.removeEventListener(this.editor.EVENTS.DIRTY_CHANGED,
|
||||
this._onDirtyChanged);
|
||||
}
|
||||
|
||||
this._ownerWindow = null;
|
||||
this.editor = null;
|
||||
this._controller = null;
|
||||
@ -220,6 +251,8 @@ SourceEditorController.prototype = {
|
||||
case "cmd_findAgain":
|
||||
case "cmd_findPrevious":
|
||||
case "cmd_gotoLine":
|
||||
case "se-cmd-undo":
|
||||
case "se-cmd-redo":
|
||||
result = true;
|
||||
break;
|
||||
default:
|
||||
@ -251,6 +284,12 @@ SourceEditorController.prototype = {
|
||||
case "cmd_findPrevious":
|
||||
result = this._editor.lastFind && this._editor.lastFind.lastFound != -1;
|
||||
break;
|
||||
case "se-cmd-undo":
|
||||
result = this._editor.canUndo();
|
||||
break;
|
||||
case "se-cmd-redo":
|
||||
result = this._editor.canRedo();
|
||||
break;
|
||||
default:
|
||||
result = false;
|
||||
break;
|
||||
@ -281,6 +320,12 @@ SourceEditorController.prototype = {
|
||||
case "cmd_gotoLine":
|
||||
this._editor.ui.gotoLine();
|
||||
break;
|
||||
case "se-cmd-undo":
|
||||
this._editor.undo();
|
||||
break;
|
||||
case "se-cmd-redo":
|
||||
this._editor.redo();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -199,6 +199,22 @@ SourceEditor.DEFAULTS = {
|
||||
* @type array
|
||||
*/
|
||||
keys: null,
|
||||
|
||||
/**
|
||||
* The editor context menu you want to display when the user right-clicks
|
||||
* within the editor. This property can be:
|
||||
* - a string that tells the ID of the xul:menupopup you want. This needs to
|
||||
* be available within the editor parentElement.ownerDocument.
|
||||
* - an nsIDOMElement object reference pointing to the xul:menupopup you
|
||||
* want to open when the contextmenu event is fired.
|
||||
*
|
||||
* Set this property to a falsey value to disable the default context menu.
|
||||
*
|
||||
* @see SourceEditor.EVENTS.CONTEXT_MENU for more control over the contextmenu
|
||||
* event.
|
||||
* @type string|nsIDOMElement
|
||||
*/
|
||||
contextMenu: "sourceEditorContextMenu",
|
||||
};
|
||||
|
||||
/**
|
||||
@ -216,6 +232,8 @@ SourceEditor.EVENTS = {
|
||||
* This value comes from the DOM contextmenu event.screenX property.
|
||||
* - screenY - the pointer location on the y axis, relative to the screen.
|
||||
* This value comes from the DOM contextmenu event.screenY property.
|
||||
*
|
||||
* @see SourceEditor.DEFAULTS.contextMenu
|
||||
*/
|
||||
CONTEXT_MENU: "ContextMenu",
|
||||
|
||||
@ -282,6 +300,15 @@ SourceEditor.EVENTS = {
|
||||
* condition.
|
||||
*/
|
||||
BREAKPOINT_CHANGE: "BreakpointChange",
|
||||
|
||||
/**
|
||||
* The DirtyChanged event is fired when the dirty state of the editor is
|
||||
* changed. The dirty state of the editor tells if the are text changes that
|
||||
* have not been saved yet. Event object properties: oldValue and newValue.
|
||||
* Both are booleans telling the old dirty state and the new state,
|
||||
* respectively.
|
||||
*/
|
||||
DIRTY_CHANGED: "DirtyChanged",
|
||||
};
|
||||
|
||||
/**
|
||||
@ -303,6 +330,12 @@ function extend(aDestination, aSource)
|
||||
* Add methods common to all components.
|
||||
*/
|
||||
extend(SourceEditor.prototype, {
|
||||
// Expose the static constants on the SourceEditor instances.
|
||||
EVENTS: SourceEditor.EVENTS,
|
||||
MODES: SourceEditor.MODES,
|
||||
THEMES: SourceEditor.THEMES,
|
||||
DEFAULTS: SourceEditor.DEFAULTS,
|
||||
|
||||
_lastFind: null,
|
||||
|
||||
/**
|
||||
|
@ -58,6 +58,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_bug725388_mouse_events.js \
|
||||
browser_bug707987_debugger_breakpoints.js \
|
||||
browser_bug712982_line_ruler_click.js \
|
||||
browser_bug700893_dirty_state.js \
|
||||
head.js \
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
|
@ -0,0 +1,94 @@
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
|
||||
let temp = {};
|
||||
Cu.import("resource:///modules/source-editor.jsm", temp);
|
||||
let SourceEditor = temp.SourceEditor;
|
||||
|
||||
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
|
||||
if (component == "textarea") {
|
||||
ok(true, "skip test for bug 700893: only applicable for non-textarea components");
|
||||
return;
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let editor;
|
||||
|
||||
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
|
||||
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
|
||||
" title='test for bug 700893' width='600' height='500'><hbox flex='1'/></window>";
|
||||
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
|
||||
|
||||
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
|
||||
testWin.addEventListener("load", function onWindowLoad() {
|
||||
testWin.removeEventListener("load", onWindowLoad, false);
|
||||
waitForFocus(initEditor, testWin);
|
||||
}, false);
|
||||
|
||||
function initEditor()
|
||||
{
|
||||
let hbox = testWin.document.querySelector("hbox");
|
||||
editor = new SourceEditor();
|
||||
editor.init(hbox, {initialText: "foobar"}, editorLoaded);
|
||||
}
|
||||
|
||||
function editorLoaded()
|
||||
{
|
||||
editor.focus();
|
||||
|
||||
is(editor.dirty, false, "editory is not dirty");
|
||||
|
||||
let event = null;
|
||||
let eventHandler = function(aEvent) {
|
||||
event = aEvent;
|
||||
};
|
||||
editor.addEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
|
||||
|
||||
editor.setText("omg");
|
||||
|
||||
is(editor.dirty, true, "editor is dirty");
|
||||
ok(event, "DirtyChanged event fired")
|
||||
is(event.oldValue, false, "event.oldValue is correct");
|
||||
is(event.newValue, true, "event.newValue is correct");
|
||||
|
||||
event = null;
|
||||
editor.setText("foo 2");
|
||||
ok(!event, "no DirtyChanged event fired");
|
||||
|
||||
editor.dirty = false;
|
||||
|
||||
is(editor.dirty, false, "editor marked as clean");
|
||||
ok(event, "DirtyChanged event fired")
|
||||
is(event.oldValue, true, "event.oldValue is correct");
|
||||
is(event.newValue, false, "event.newValue is correct");
|
||||
|
||||
event = null;
|
||||
editor.setText("foo 3");
|
||||
|
||||
is(editor.dirty, true, "editor is dirty after changes");
|
||||
ok(event, "DirtyChanged event fired")
|
||||
is(event.oldValue, false, "event.oldValue is correct");
|
||||
is(event.newValue, true, "event.newValue is correct");
|
||||
|
||||
editor.undo();
|
||||
is(editor.dirty, false, "editor is not dirty after undo");
|
||||
ok(event, "DirtyChanged event fired")
|
||||
is(event.oldValue, true, "event.oldValue is correct");
|
||||
is(event.newValue, false, "event.newValue is correct");
|
||||
|
||||
editor.removeEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
|
||||
|
||||
editor.destroy();
|
||||
|
||||
testWin.close();
|
||||
testWin = editor = null;
|
||||
|
||||
waitForFocus(finish, window);
|
||||
}
|
||||
}
|
@ -45,6 +45,8 @@
|
||||
<?xml-stylesheet href="chrome://browser/skin/devtools/splitview.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/styleeditor.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/devtools/styleeditor.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/source-editor-overlay.xul"?>
|
||||
<xul:window xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
id="style-editor-chrome-window"
|
||||
@ -54,10 +56,18 @@
|
||||
persist="screenX screenY width height sizemode">
|
||||
<xul:script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<xul:popupset id="style-editor-popups">
|
||||
<xul:menupopup id="sourceEditorContextMenu"/>
|
||||
</xul:popupset>
|
||||
|
||||
<xul:commandset id="editMenuCommands"/>
|
||||
<xul:commandset id="sourceEditorCommands"/>
|
||||
<xul:commandset id="style-editor-commandset">
|
||||
<xul:command id="style-editor-cmd-close" oncommand="window.close();"/>
|
||||
</xul:commandset>
|
||||
|
||||
<xul:keyset id="editMenuKeys"/>
|
||||
<xul:keyset id="sourceEditorKeys"/>
|
||||
<xul:keyset id="style-editor-keyset">
|
||||
<xul:key id="style-editor-key-close"
|
||||
key="&closeCmd.key;"
|
||||
|
@ -190,6 +190,7 @@
|
||||
@BINPATH@/components/find.xpt
|
||||
@BINPATH@/components/fuel.xpt
|
||||
@BINPATH@/components/gfx.xpt
|
||||
@BINPATH@/components/html5.xpt
|
||||
@BINPATH@/components/htmlparser.xpt
|
||||
@BINPATH@/components/imglib2.xpt
|
||||
@BINPATH@/components/imgicon.xpt
|
||||
|
@ -1191,6 +1191,7 @@ xpicleanup@BIN_SUFFIX@
|
||||
components/fuel.xpt
|
||||
components/gfx.xpt
|
||||
components/gksvgrenderer.xpt
|
||||
components/html5.xpt
|
||||
components/htmlparser.xpt
|
||||
components/imgicon.xpt
|
||||
components/imglib2.xpt
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!-- LOCALIZATION NOTE : FILE This file contains the Source Editor component
|
||||
- strings. The source editor component is used within the Scratchpad and
|
||||
- Style Editor tools. -->
|
||||
|
||||
<!-- LOCALIZATION NOTE : FILE Do not translate commandkeys -->
|
||||
|
||||
<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
|
||||
- keep it in English, or another language commonly spoken among web developers.
|
||||
- You want to make that choice consistent across the developer tools.
|
||||
- A good criteria is the language in which you'd find the best
|
||||
- documentation on web development on the web. -->
|
||||
|
||||
<!ENTITY undoCmd.label "Undo">
|
||||
<!ENTITY undoCmd.accesskey "U">
|
||||
<!ENTITY cutCmd.label "Cut">
|
||||
<!ENTITY cutCmd.accesskey "t">
|
||||
<!ENTITY copyCmd.label "Copy">
|
||||
<!ENTITY copyCmd.accesskey "C">
|
||||
<!ENTITY pasteCmd.label "Paste">
|
||||
<!ENTITY pasteCmd.accesskey "P">
|
||||
<!ENTITY deleteCmd.label "Delete">
|
||||
<!ENTITY deleteCmd.accesskey "D">
|
||||
<!ENTITY selectAllCmd.label "Select All">
|
||||
<!ENTITY selectAllCmd.accesskey "A">
|
||||
<!ENTITY findCmd.label "Find…">
|
||||
<!ENTITY findCmd.accesskey "F">
|
||||
<!ENTITY findAgainCmd.label "Find Again…">
|
||||
<!ENTITY findAgainCmd.accesskey "g">
|
||||
<!ENTITY gotoLineCmd.label "Jump to line…">
|
||||
<!ENTITY gotoLineCmd.key "J">
|
||||
<!ENTITY gotoLineCmd.accesskey "J">
|
||||
|
@ -30,6 +30,7 @@
|
||||
locale/browser/devtools/styleinspector.dtd (%chrome/browser/devtools/styleinspector.dtd)
|
||||
locale/browser/devtools/webConsole.dtd (%chrome/browser/devtools/webConsole.dtd)
|
||||
locale/browser/devtools/sourceeditor.properties (%chrome/browser/devtools/sourceeditor.properties)
|
||||
locale/browser/devtools/sourceeditor.dtd (%chrome/browser/devtools/sourceeditor.dtd)
|
||||
locale/browser/newTab.dtd (%chrome/browser/newTab.dtd)
|
||||
locale/browser/newTab.properties (%chrome/browser/newTab.properties)
|
||||
locale/browser/openLocation.dtd (%chrome/browser/openLocation.dtd)
|
||||
|
@ -181,8 +181,4 @@ radio[pane=paneSync] {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#syncEnginesList {
|
||||
height: 10em;
|
||||
}
|
||||
|
||||
%endif
|
||||
|
@ -239,8 +239,4 @@ caption {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#syncEnginesList {
|
||||
height: 10em;
|
||||
}
|
||||
|
||||
%endif
|
||||
|
@ -169,10 +169,6 @@ radio[pane=paneSync] {
|
||||
#syncAddDeviceLabel {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#syncEnginesList {
|
||||
height: 11em;
|
||||
}
|
||||
|
||||
%endif
|
||||
|
@ -99,6 +99,33 @@ def build_linux_headers(inst_dir):
|
||||
build_linux_headers_aux(inst_dir)
|
||||
with_env({"PATH" : aux_inst_dir + "/bin:%s" % os.environ["PATH"]}, f)
|
||||
|
||||
def build_gcc(stage_dir, is_stage_one):
|
||||
gcc_build_dir = stage_dir + '/gcc'
|
||||
tool_inst_dir = stage_dir + '/inst'
|
||||
lib_inst_dir = stage_dir + '/libinst'
|
||||
gcc_configure_args = ["--prefix=%s" % tool_inst_dir,
|
||||
"--enable-__cxa_atexit",
|
||||
"--with-gmp=%s" % lib_inst_dir,
|
||||
"--with-mpfr=%s" % lib_inst_dir,
|
||||
"--with-mpc=%s" % lib_inst_dir,
|
||||
"--enable-languages=c,c++",
|
||||
"--disable-multilib",
|
||||
"--disable-bootstrap"]
|
||||
if is_stage_one:
|
||||
# We build the stage1 gcc without shared libraries. Otherwise its
|
||||
# libgcc.so would depend on the system libc.so, which causes problems
|
||||
# when it tries to use that libgcc.so and the libc we are about to
|
||||
# build.
|
||||
gcc_configure_args.append("--disable-shared")
|
||||
|
||||
build_package(gcc_source_dir, gcc_build_dir, gcc_configure_args)
|
||||
|
||||
if is_stage_one:
|
||||
# The glibc build system uses -lgcc_eh, but at least in this setup
|
||||
# libgcc.a has all it needs.
|
||||
d = tool_inst_dir + "/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/"
|
||||
os.symlink(d + "libgcc.a", d + "libgcc_eh.a")
|
||||
|
||||
def build_one_stage(env, stage_dir, is_stage_one):
|
||||
def f():
|
||||
build_one_stage_aux(stage_dir, is_stage_one)
|
||||
@ -129,33 +156,18 @@ def build_one_stage_aux(stage_dir, is_stage_one):
|
||||
build_package(binutils_source_dir, binutils_build_dir,
|
||||
["--prefix=%s" % tool_inst_dir])
|
||||
|
||||
gcc_build_dir = stage_dir + '/gcc'
|
||||
gcc_configure_args = ["--prefix=%s" % tool_inst_dir,
|
||||
"--enable-__cxa_atexit",
|
||||
"--with-gmp=%s" % lib_inst_dir,
|
||||
"--with-mpfr=%s" % lib_inst_dir,
|
||||
"--with-mpc=%s" % lib_inst_dir,
|
||||
"--enable-languages=c,c++",
|
||||
"--disable-multilib",
|
||||
"--disable-bootstrap"]
|
||||
# During stage one we have to build gcc first, this glibc doesn't even
|
||||
# build with gcc 4.6. During stage two, we have to build glibc first.
|
||||
# The problem is that libstdc++ is built with xgcc and if glibc has
|
||||
# not been built yet xgcc will use the system one.
|
||||
if is_stage_one:
|
||||
# We build the stage1 gcc without shared libraries. Otherwise its
|
||||
# libgcc.so would depend on the system libc.so, which causes problems
|
||||
# when it tries to use that libgcc.so and the libc we are about to
|
||||
# build.
|
||||
gcc_configure_args.append("--disable-shared")
|
||||
|
||||
build_package(gcc_source_dir, gcc_build_dir, gcc_configure_args)
|
||||
|
||||
if is_stage_one:
|
||||
# The glibc build system uses -lgcc_eh, but at least in this setup
|
||||
# libgcc.a has all it needs.
|
||||
d = tool_inst_dir + "/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/"
|
||||
os.symlink(d + "libgcc.a", d + "libgcc_eh.a")
|
||||
|
||||
build_glibc({"CC" : tool_inst_dir + "/bin/gcc",
|
||||
"CXX" : tool_inst_dir + "/bin/g++"},
|
||||
stage_dir, tool_inst_dir)
|
||||
build_gcc(stage_dir, is_stage_one)
|
||||
build_glibc({"CC" : tool_inst_dir + "/bin/gcc",
|
||||
"CXX" : tool_inst_dir + "/bin/g++"},
|
||||
stage_dir, tool_inst_dir)
|
||||
else:
|
||||
build_glibc({}, stage_dir, tool_inst_dir)
|
||||
build_gcc(stage_dir, is_stage_one)
|
||||
|
||||
def build_tar_package(tar, name, base, directory):
|
||||
name = os.path.realpath(name)
|
||||
|
@ -143,6 +143,7 @@ XPCOM_USE_LEA = @XPCOM_USE_LEA@
|
||||
MOZ_INSTALLER = @MOZ_INSTALLER@
|
||||
MOZ_MAINTENANCE_SERVICE = @MOZ_MAINTENANCE_SERVICE@
|
||||
MOZ_VERIFY_MAR_SIGNATURE = @MOZ_VERIFY_MAR_SIGNATURE@
|
||||
MOZ_ENABLE_SIGNMAR = @MOZ_ENABLE_SIGNMAR@
|
||||
MOZ_UPDATER = @MOZ_UPDATER@
|
||||
MOZ_UPDATE_CHANNEL = @MOZ_UPDATE_CHANNEL@
|
||||
MOZ_UPDATE_PACKAGING = @MOZ_UPDATE_PACKAGING@
|
||||
|
20
configure.in
20
configure.in
@ -318,7 +318,7 @@ if test -n "$gonkdir" ; then
|
||||
STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
|
||||
STLPORT_LIBS="-lstlport"
|
||||
|
||||
CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/arch-arm/include -isystem $gonkdir/bionic/libc/kernel/arch-arm -isystem $gonkdir/bionic/libm/include -isystem $gonkdir/frameworks/base/opengl/include -isystem $gonkdir/frameworks/base/native/include -isystem $gonkdir/hardware/libhardware/include -isystem $gonkdir/hardware/libhardware_legacy/include -isystem $gonkdir/system/core/include -isystem $gonkdir/bionic -isystem $gonkdir/frameworks/base/include $STLPORT_CPPFLAGS $CPPFLAGS -isystem $gonkdir/frameworks/base/services/sensorservice"
|
||||
CPPFLAGS="-DANDROID -I$gonkdir/bionic/libc/include/ -I$gonkdir/bionic/libc/kernel/common -I$gonkdir/bionic/libc/arch-arm/include -I$gonkdir/bionic/libc/kernel/arch-arm -I$gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system/core/include -I$gonkdir/bionic -I$gonkdir/frameworks/base/include $STLPORT_CPPFLAGS $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
|
||||
CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
|
||||
CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
|
||||
LIBS="$LIBS $STLPORT_LIBS"
|
||||
@ -6499,6 +6499,23 @@ if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Enable building the signmar program.
|
||||
dnl This option is much different than the --enable-verify-mar option.
|
||||
dnl --enable-verify-mar is for enabling the verification check on MAR
|
||||
dnl files in the updater. The --enable-signmar option is for building
|
||||
dnl the signmar program.
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(sign-mar,
|
||||
[ --enable-signmar Enable building the signmar program],
|
||||
MOZ_ENABLE_SIGNMAR=1,
|
||||
MOZ_ENABLE_SIGNMAR= )
|
||||
|
||||
if test -n "$MOZ_ENABLE_SIGNMAR"; then
|
||||
AC_DEFINE(MOZ_ENABLE_SIGNMAR)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Updater
|
||||
dnl ========================================================
|
||||
@ -8601,6 +8618,7 @@ AC_SUBST(MOZ_USER_DIR)
|
||||
AC_SUBST(MOZ_CRASHREPORTER)
|
||||
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
|
||||
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
|
||||
AC_SUBST(MOZ_ENABLE_SIGNMAR)
|
||||
AC_SUBST(MOZ_UPDATER)
|
||||
AC_SUBST(MOZ_ANGLE)
|
||||
AC_SUBST(MOZ_DIRECTX_SDK_PATH)
|
||||
|
@ -1144,12 +1144,34 @@ public:
|
||||
* @param aSourceBuffer the string to parse as an HTML document
|
||||
* @param aTargetDocument the document object to parse into. Must not have
|
||||
* child nodes.
|
||||
* @param aScriptingEnabledForNoscriptParsing whether <noscript> is parsed
|
||||
* as if scripting was enabled
|
||||
* @return NS_ERROR_DOM_INVALID_STATE_ERR if a re-entrant attempt to parse
|
||||
* fragments is made, NS_ERROR_OUT_OF_MEMORY if aSourceBuffer is too
|
||||
* long and NS_OK otherwise.
|
||||
*/
|
||||
static nsresult ParseDocumentHTML(const nsAString& aSourceBuffer,
|
||||
nsIDocument* aTargetDocument);
|
||||
nsIDocument* aTargetDocument,
|
||||
bool aScriptingEnabledForNoscriptParsing);
|
||||
|
||||
/**
|
||||
* Converts HTML source to plain text by parsing the source and using the
|
||||
* plain text serializer on the resulting tree.
|
||||
*
|
||||
* @param aSourceBuffer the string to parse as an HTML document
|
||||
* @param aResultBuffer the string where the plain text result appears;
|
||||
* may be the same string as aSourceBuffer
|
||||
* @param aFlags Flags from nsIDocumentEncoder.
|
||||
* @param aWrapCol Number of columns after which to line wrap; 0 for no
|
||||
* auto-wrapping
|
||||
* @return NS_ERROR_DOM_INVALID_STATE_ERR if a re-entrant attempt to parse
|
||||
* fragments is made, NS_ERROR_OUT_OF_MEMORY if aSourceBuffer is too
|
||||
* long and NS_OK otherwise.
|
||||
*/
|
||||
static nsresult ConvertToPlainText(const nsAString& aSourceBuffer,
|
||||
nsAString& aResultBuffer,
|
||||
PRUint32 aFlags,
|
||||
PRUint32 aWrapCol);
|
||||
|
||||
/**
|
||||
* Creates a new XML document, which is marked to be loaded as data.
|
||||
@ -1941,6 +1963,32 @@ public:
|
||||
*/
|
||||
static bool URIIsChromeOrInPref(nsIURI *aURI, const char *aPref);
|
||||
|
||||
/**
|
||||
* This will parse aSource, to extract the value of the pseudo attribute
|
||||
* with the name specified in aName. See
|
||||
* http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
|
||||
* which is used to parse aSource.
|
||||
*
|
||||
* @param aSource the string to parse
|
||||
* @param aName the name of the attribute to get the value for
|
||||
* @param aValue [out] the value for the attribute with name specified in
|
||||
* aAttribute. Empty if the attribute isn't present.
|
||||
* @return true if the attribute exists and was successfully parsed.
|
||||
* false if the attribute doesn't exist, or has a malformed
|
||||
* value, such as an unknown or unterminated entity.
|
||||
*/
|
||||
static bool GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
|
||||
nsAString& aValue);
|
||||
|
||||
/**
|
||||
* Returns true if the language name is a version of JavaScript and
|
||||
* false otherwise
|
||||
*/
|
||||
static bool IsJavaScriptLanguage(const nsString& aName, PRUint32 *aVerFlags);
|
||||
|
||||
static void SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams);
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
|
@ -172,7 +172,8 @@ interface nsIDocumentEncoder : nsISupports
|
||||
|
||||
/**
|
||||
* Output the content of noframes elements (only for serializing
|
||||
* to plaintext).
|
||||
* to plaintext). (Used only internally in the plain text serializer;
|
||||
* ignored if passed by the caller.)
|
||||
*/
|
||||
const unsigned long OutputNoFramesContent = (1 << 12);
|
||||
|
||||
|
@ -127,7 +127,6 @@ CPPSRCS = \
|
||||
nsNodeIterator.cpp \
|
||||
nsNodeUtils.cpp \
|
||||
nsObjectLoadingContent.cpp \
|
||||
nsParserUtils.cpp \
|
||||
nsPlainTextSerializer.cpp \
|
||||
nsPropertyTable.cpp \
|
||||
nsRange.cpp \
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsWeakReference.h"
|
||||
@ -712,7 +711,7 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||
|
||||
nsAutoString mimeType;
|
||||
nsAutoString params;
|
||||
nsParserUtils::SplitMimeType(aType, mimeType, params);
|
||||
nsContentUtils::SplitMimeType(aType, mimeType, params);
|
||||
|
||||
// see bug 18817
|
||||
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
|
||||
|
@ -180,6 +180,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsParserConstants.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
@ -720,6 +721,185 @@ nsContentUtils::URIIsChromeOrInPref(nsIURI *aURI, const char *aPref)
|
||||
return false;
|
||||
}
|
||||
|
||||
#define SKIP_WHITESPACE(iter, end_iter, end_res) \
|
||||
while ((iter) != (end_iter) && nsCRT::IsAsciiSpace(*(iter))) { \
|
||||
++(iter); \
|
||||
} \
|
||||
if ((iter) == (end_iter)) { \
|
||||
return (end_res); \
|
||||
}
|
||||
|
||||
#define SKIP_ATTR_NAME(iter, end_iter) \
|
||||
while ((iter) != (end_iter) && !nsCRT::IsAsciiSpace(*(iter)) && \
|
||||
*(iter) != '=') { \
|
||||
++(iter); \
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
|
||||
nsAString& aValue)
|
||||
{
|
||||
aValue.Truncate();
|
||||
|
||||
const PRUnichar *start = aSource.get();
|
||||
const PRUnichar *end = start + aSource.Length();
|
||||
const PRUnichar *iter;
|
||||
|
||||
while (start != end) {
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
iter = start;
|
||||
SKIP_ATTR_NAME(iter, end)
|
||||
|
||||
if (start == iter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remember the attr name.
|
||||
const nsDependentSubstring & attrName = Substring(start, iter);
|
||||
|
||||
// Now check whether this is a valid name="value" pair.
|
||||
start = iter;
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
if (*start != '=') {
|
||||
// No '=', so this is not a name="value" pair. We don't know
|
||||
// what it is, and we have no way to handle it.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Have to skip the value.
|
||||
++start;
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
PRUnichar q = *start;
|
||||
if (q != kQuote && q != kApostrophe) {
|
||||
// Not a valid quoted value, so bail.
|
||||
return false;
|
||||
}
|
||||
|
||||
++start; // Point to the first char of the value.
|
||||
iter = start;
|
||||
|
||||
while (iter != end && *iter != q) {
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end) {
|
||||
// Oops, unterminated quoted string.
|
||||
return false;
|
||||
}
|
||||
|
||||
// At this point attrName holds the name of the "attribute" and
|
||||
// the value is between start and iter.
|
||||
|
||||
if (aName->Equals(attrName)) {
|
||||
nsIParserService* parserService = nsContentUtils::GetParserService();
|
||||
NS_ENSURE_TRUE(parserService, false);
|
||||
|
||||
// We'll accumulate as many characters as possible (until we hit either
|
||||
// the end of the string or the beginning of an entity). Chunks will be
|
||||
// delimited by start and chunkEnd.
|
||||
const PRUnichar *chunkEnd = start;
|
||||
while (chunkEnd != iter) {
|
||||
if (*chunkEnd == kLessThan) {
|
||||
aValue.Truncate();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*chunkEnd == kAmpersand) {
|
||||
aValue.Append(start, chunkEnd - start);
|
||||
|
||||
// Point to first character after the ampersand.
|
||||
++chunkEnd;
|
||||
|
||||
const PRUnichar *afterEntity;
|
||||
PRUnichar result[2];
|
||||
PRUint32 count =
|
||||
parserService->DecodeEntity(chunkEnd, iter, &afterEntity, result);
|
||||
if (count == 0) {
|
||||
aValue.Truncate();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
aValue.Append(result, count);
|
||||
|
||||
// Advance to after the entity and begin a new chunk.
|
||||
start = chunkEnd = afterEntity;
|
||||
}
|
||||
else {
|
||||
++chunkEnd;
|
||||
}
|
||||
}
|
||||
|
||||
// Append remainder.
|
||||
aValue.Append(start, iter - start);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Resume scanning after the end of the attribute value (past the quote
|
||||
// char).
|
||||
start = iter + 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::IsJavaScriptLanguage(const nsString& aName, PRUint32 *aFlags)
|
||||
{
|
||||
JSVersion version = JSVERSION_UNKNOWN;
|
||||
|
||||
if (aName.LowerCaseEqualsLiteral("javascript") ||
|
||||
aName.LowerCaseEqualsLiteral("livescript") ||
|
||||
aName.LowerCaseEqualsLiteral("mocha")) {
|
||||
version = JSVERSION_DEFAULT;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.0")) {
|
||||
version = JSVERSION_1_0;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.1")) {
|
||||
version = JSVERSION_1_1;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.2")) {
|
||||
version = JSVERSION_1_2;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.3")) {
|
||||
version = JSVERSION_1_3;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.4")) {
|
||||
version = JSVERSION_1_4;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.5")) {
|
||||
version = JSVERSION_1_5;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.6")) {
|
||||
version = JSVERSION_1_6;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.7")) {
|
||||
version = JSVERSION_1_7;
|
||||
} else if (aName.LowerCaseEqualsLiteral("javascript1.8")) {
|
||||
version = JSVERSION_1_8;
|
||||
}
|
||||
|
||||
if (version == JSVERSION_UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
*aFlags = version;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams)
|
||||
{
|
||||
aType.Truncate();
|
||||
aParams.Truncate();
|
||||
PRInt32 semiIndex = aValue.FindChar(PRUnichar(';'));
|
||||
if (-1 != semiIndex) {
|
||||
aType = Substring(aValue, 0, semiIndex);
|
||||
aParams = Substring(aValue, semiIndex + 1,
|
||||
aValue.Length() - (semiIndex + 1));
|
||||
aParams.StripWhitespace();
|
||||
}
|
||||
else {
|
||||
aType = aValue;
|
||||
}
|
||||
aType.StripWhitespace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Access a cached parser service. Don't addref. We need only one
|
||||
* reference to it and this class has that one.
|
||||
@ -3747,7 +3927,8 @@ nsContentUtils::ParseFragmentHTML(const nsAString& aSourceBuffer,
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::ParseDocumentHTML(const nsAString& aSourceBuffer,
|
||||
nsIDocument* aTargetDocument)
|
||||
nsIDocument* aTargetDocument,
|
||||
bool aScriptingEnabledForNoscriptParsing)
|
||||
{
|
||||
if (nsContentUtils::sFragmentParsingActive) {
|
||||
NS_NOTREACHED("Re-entrant fragment parsing attempted.");
|
||||
@ -3761,7 +3942,8 @@ nsContentUtils::ParseDocumentHTML(const nsAString& aSourceBuffer,
|
||||
}
|
||||
nsresult rv =
|
||||
sHTMLFragmentParser->ParseDocument(aSourceBuffer,
|
||||
aTargetDocument);
|
||||
aTargetDocument,
|
||||
aScriptingEnabledForNoscriptParsing);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -3812,6 +3994,44 @@ nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::ConvertToPlainText(const nsAString& aSourceBuffer,
|
||||
nsAString& aResultBuffer,
|
||||
PRUint32 aFlags,
|
||||
PRUint32 aWrapCol)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), "about:blank");
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
nsresult rv = nsContentUtils::CreateDocument(EmptyString(),
|
||||
EmptyString(),
|
||||
nsnull,
|
||||
uri,
|
||||
uri,
|
||||
principal,
|
||||
nsnull,
|
||||
DocumentFlavorHTML,
|
||||
getter_AddRefs(domDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(domDocument);
|
||||
rv = nsContentUtils::ParseDocumentHTML(aSourceBuffer, document,
|
||||
!(aFlags & nsIDocumentEncoder::OutputNoScriptContent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> encoder = do_CreateInstance(
|
||||
"@mozilla.org/layout/documentEncoder;1?type=text/plain");
|
||||
|
||||
rv = encoder->Init(domDocument, NS_LITERAL_STRING("text/plain"), aFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
encoder->SetWrapColumn(aWrapCol);
|
||||
|
||||
return encoder->EncodeToString(aResultBuffer);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
|
@ -102,7 +102,7 @@ nsDOMParser::ParseFromString(const PRUnichar *str,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(domDocument);
|
||||
nsDependentString sourceBuffer(str);
|
||||
rv = nsContentUtils::ParseDocumentHTML(sourceBuffer, document);
|
||||
rv = nsContentUtils::ParseDocumentHTML(sourceBuffer, document, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Keep the XULXBL state, base URL and principal setting in sync with the
|
||||
|
@ -2901,6 +2901,14 @@ nsGenericElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
|
||||
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
|
||||
|
||||
return GetAttributeNodeNSInternal(aNamespaceURI, aLocalName, aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMAttr** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> map;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(map));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -5208,8 +5216,8 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||
nsCOMPtr<nsIDOMAttr> attrNode;
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
|
||||
GetAttributeNodeNS(ns, nsDependentAtomString(aName),
|
||||
getter_AddRefs(attrNode));
|
||||
GetAttributeNodeNSInternal(ns, nsDependentAtomString(aName),
|
||||
getter_AddRefs(attrNode));
|
||||
mutation.mRelatedNode = attrNode;
|
||||
|
||||
mutation.mAttrName = aName;
|
||||
@ -5388,8 +5396,8 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
if (hasMutationListeners) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
GetAttributeNodeNS(ns, nsDependentAtomString(aName),
|
||||
getter_AddRefs(attrNode));
|
||||
GetAttributeNodeNSInternal(ns, nsDependentAtomString(aName),
|
||||
getter_AddRefs(attrNode));
|
||||
}
|
||||
|
||||
// Clear binding to nsIDOMNamedNodeMap
|
||||
|
@ -794,6 +794,10 @@ protected:
|
||||
return this;
|
||||
}
|
||||
|
||||
nsresult GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName,
|
||||
nsIDOMAttr** aReturn);
|
||||
|
||||
public:
|
||||
// Because of a bug in MS C++ compiler nsDOMSlots must be declared public,
|
||||
// otherwise nsXULElement::nsXULSlots doesn't compile.
|
||||
|
@ -556,7 +556,7 @@ nsObjectLoadingContent::nsObjectLoadingContent()
|
||||
, mNetworkCreated(true)
|
||||
// If plugins.click_to_play is false, plugins should always play
|
||||
, mShouldPlay(!mozilla::Preferences::GetBool("plugins.click_to_play", false))
|
||||
, mSrcStreamLoadInitiated(false)
|
||||
, mSrcStreamLoading(false)
|
||||
, mFallbackReason(ePluginOtherState)
|
||||
{
|
||||
}
|
||||
@ -692,8 +692,6 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
||||
{
|
||||
SAMPLE_LABEL("nsObjectLoadingContent", "OnStartRequest");
|
||||
|
||||
mSrcStreamLoadInitiated = true;
|
||||
|
||||
if (aRequest != mChannel || !aRequest) {
|
||||
// This is a bit of an edge case - happens when a new load starts before the
|
||||
// previous one got here
|
||||
@ -883,7 +881,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
||||
if (!pluginHost) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
pluginHost->InstantiatePluginForChannel(chan, this, getter_AddRefs(mFinalListener));
|
||||
pluginHost->CreateListenerForChannel(chan, this, getter_AddRefs(mFinalListener));
|
||||
break;
|
||||
}
|
||||
case eType_Loading:
|
||||
@ -906,20 +904,25 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
||||
|
||||
if (mFinalListener) {
|
||||
mType = newType;
|
||||
|
||||
mSrcStreamLoading = true;
|
||||
rv = mFinalListener->OnStartRequest(aRequest, aContext);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef XP_MACOSX
|
||||
// Shockwave on Mac is special and returns an error here even when it
|
||||
// handles the content
|
||||
if (mContentType.EqualsLiteral("application/x-director")) {
|
||||
rv = NS_OK; // otherwise, the AutoFallback will make us fall back
|
||||
mSrcStreamLoading = false;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Plugins need to set up for NPRuntime.
|
||||
if (mType == eType_Plugin) {
|
||||
NotifyContentObjectWrapper();
|
||||
}
|
||||
} else {
|
||||
// Plugins don't fall back if there is an error here.
|
||||
if (mType == eType_Plugin) {
|
||||
rv = NS_OK; // this is necessary to avoid auto-fallback
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
#endif
|
||||
Fallback(false);
|
||||
} else if (mType == eType_Plugin) {
|
||||
NotifyContentObjectWrapper();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -2111,7 +2114,6 @@ nsObjectLoadingContent::PlayPlugin()
|
||||
if (!nsContentUtils::IsCallerChrome())
|
||||
return NS_OK;
|
||||
|
||||
mSrcStreamLoadInitiated = false;
|
||||
mShouldPlay = true;
|
||||
return LoadObject(mURI, true, mContentType, true);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
|
||||
void NotifyOwnerDocumentActivityChanged();
|
||||
|
||||
bool SrcStreamLoadInitiated() { return mSrcStreamLoadInitiated; };
|
||||
bool SrcStreamLoading() { return mSrcStreamLoading; };
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -401,9 +401,12 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
// This is used for click-to-play plugins.
|
||||
bool mShouldPlay : 1;
|
||||
|
||||
// Used to indicate that a stream for a src/data attribute has been
|
||||
// initiated so that we don't do it twice.
|
||||
bool mSrcStreamLoadInitiated;
|
||||
// Used to track when we might try to instantiate a plugin instance based on
|
||||
// a src data stream being delivered to this object. When this is true we don't
|
||||
// want plugin instance instantiation code to attempt to load src data again or
|
||||
// we'll deliver duplicate streams. Should be cleared when we are not loading
|
||||
// src data.
|
||||
bool mSrcStreamLoading;
|
||||
|
||||
// A specific state that caused us to fallback
|
||||
PluginSupportState mFallbackReason;
|
||||
|
@ -1,236 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Namespace class for some static parsing-related methods.
|
||||
*/
|
||||
|
||||
#include "nsParserUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsParserConstants.h"
|
||||
|
||||
#define SKIP_WHITESPACE(iter, end_iter, end_res) \
|
||||
while ((iter) != (end_iter) && nsCRT::IsAsciiSpace(*(iter))) { \
|
||||
++(iter); \
|
||||
} \
|
||||
if ((iter) == (end_iter)) { \
|
||||
return (end_res); \
|
||||
}
|
||||
|
||||
#define SKIP_ATTR_NAME(iter, end_iter) \
|
||||
while ((iter) != (end_iter) && !nsCRT::IsAsciiSpace(*(iter)) && \
|
||||
*(iter) != '=') { \
|
||||
++(iter); \
|
||||
}
|
||||
|
||||
bool
|
||||
nsParserUtils::GetQuotedAttributeValue(const nsString& aSource, nsIAtom *aName,
|
||||
nsAString& aValue)
|
||||
{
|
||||
aValue.Truncate();
|
||||
|
||||
const PRUnichar *start = aSource.get();
|
||||
const PRUnichar *end = start + aSource.Length();
|
||||
const PRUnichar *iter;
|
||||
|
||||
while (start != end) {
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
iter = start;
|
||||
SKIP_ATTR_NAME(iter, end)
|
||||
|
||||
if (start == iter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remember the attr name.
|
||||
const nsDependentSubstring & attrName = Substring(start, iter);
|
||||
|
||||
// Now check whether this is a valid name="value" pair.
|
||||
start = iter;
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
if (*start != '=') {
|
||||
// No '=', so this is not a name="value" pair. We don't know
|
||||
// what it is, and we have no way to handle it.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Have to skip the value.
|
||||
++start;
|
||||
SKIP_WHITESPACE(start, end, false)
|
||||
PRUnichar q = *start;
|
||||
if (q != kQuote && q != kApostrophe) {
|
||||
// Not a valid quoted value, so bail.
|
||||
return false;
|
||||
}
|
||||
|
||||
++start; // Point to the first char of the value.
|
||||
iter = start;
|
||||
|
||||
while (iter != end && *iter != q) {
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end) {
|
||||
// Oops, unterminated quoted string.
|
||||
return false;
|
||||
}
|
||||
|
||||
// At this point attrName holds the name of the "attribute" and
|
||||
// the value is between start and iter.
|
||||
|
||||
if (aName->Equals(attrName)) {
|
||||
nsIParserService* parserService = nsContentUtils::GetParserService();
|
||||
NS_ENSURE_TRUE(parserService, false);
|
||||
|
||||
// We'll accumulate as many characters as possible (until we hit either
|
||||
// the end of the string or the beginning of an entity). Chunks will be
|
||||
// delimited by start and chunkEnd.
|
||||
const PRUnichar *chunkEnd = start;
|
||||
while (chunkEnd != iter) {
|
||||
if (*chunkEnd == kLessThan) {
|
||||
aValue.Truncate();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*chunkEnd == kAmpersand) {
|
||||
aValue.Append(start, chunkEnd - start);
|
||||
|
||||
// Point to first character after the ampersand.
|
||||
++chunkEnd;
|
||||
|
||||
const PRUnichar *afterEntity;
|
||||
PRUnichar result[2];
|
||||
PRUint32 count =
|
||||
parserService->DecodeEntity(chunkEnd, iter, &afterEntity, result);
|
||||
if (count == 0) {
|
||||
aValue.Truncate();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
aValue.Append(result, count);
|
||||
|
||||
// Advance to after the entity and begin a new chunk.
|
||||
start = chunkEnd = afterEntity;
|
||||
}
|
||||
else {
|
||||
++chunkEnd;
|
||||
}
|
||||
}
|
||||
|
||||
// Append remainder.
|
||||
aValue.Append(start, iter - start);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Resume scanning after the end of the attribute value (past the quote
|
||||
// char).
|
||||
start = iter + 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true if the language name is a version of JavaScript and
|
||||
// false otherwise
|
||||
bool
|
||||
nsParserUtils::IsJavaScriptLanguage(const nsString& aName, PRUint32 *aFlags)
|
||||
{
|
||||
JSVersion version = JSVERSION_UNKNOWN;
|
||||
|
||||
if (aName.LowerCaseEqualsLiteral("javascript") ||
|
||||
aName.LowerCaseEqualsLiteral("livescript") ||
|
||||
aName.LowerCaseEqualsLiteral("mocha")) {
|
||||
version = JSVERSION_DEFAULT;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.0")) {
|
||||
version = JSVERSION_1_0;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.1")) {
|
||||
version = JSVERSION_1_1;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.2")) {
|
||||
version = JSVERSION_1_2;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.3")) {
|
||||
version = JSVERSION_1_3;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.4")) {
|
||||
version = JSVERSION_1_4;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.5")) {
|
||||
version = JSVERSION_1_5;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.6")) {
|
||||
version = JSVERSION_1_6;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.7")) {
|
||||
version = JSVERSION_1_7;
|
||||
}
|
||||
else if (aName.LowerCaseEqualsLiteral("javascript1.8")) {
|
||||
version = JSVERSION_1_8;
|
||||
}
|
||||
if (version == JSVERSION_UNKNOWN)
|
||||
return false;
|
||||
*aFlags = version;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsParserUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams)
|
||||
{
|
||||
aType.Truncate();
|
||||
aParams.Truncate();
|
||||
PRInt32 semiIndex = aValue.FindChar(PRUnichar(';'));
|
||||
if (-1 != semiIndex) {
|
||||
aType = Substring(aValue, 0, semiIndex);
|
||||
aParams = Substring(aValue, semiIndex + 1,
|
||||
aValue.Length() - (semiIndex + 1));
|
||||
aParams.StripWhitespace();
|
||||
}
|
||||
else {
|
||||
aType = aValue;
|
||||
}
|
||||
aType.StripWhitespace();
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Namespace class for some static parsing-related methods.
|
||||
*/
|
||||
|
||||
#ifndef nsParserUtils_h__
|
||||
#define nsParserUtils_h__
|
||||
|
||||
#include "nsString.h"
|
||||
class nsIAtom;
|
||||
|
||||
class nsParserUtils {
|
||||
public:
|
||||
/**
|
||||
* This will parse aSource, to extract the value of the pseudo attribute
|
||||
* with the name specified in aName. See
|
||||
* http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
|
||||
* which is used to parse aSource.
|
||||
*
|
||||
* @param aSource the string to parse
|
||||
* @param aName the name of the attribute to get the value for
|
||||
* @param aValue [out] the value for the attribute with name specified in
|
||||
* aAttribute. Empty if the attribute isn't present.
|
||||
* @return true if the attribute exists and was successfully parsed.
|
||||
* false if the attribute doesn't exist, or has a malformed
|
||||
* value, such as an unknown or unterminated entity.
|
||||
*/
|
||||
static bool
|
||||
GetQuotedAttributeValue(const nsString& aSource, nsIAtom *aName,
|
||||
nsAString& aValue);
|
||||
|
||||
static bool
|
||||
IsJavaScriptLanguage(const nsString& aName, PRUint32 *aVerFlags);
|
||||
|
||||
static void
|
||||
SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams);
|
||||
};
|
||||
|
||||
#endif // nsParserUtils_h__
|
||||
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsScriptLoader.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIContent.h"
|
||||
@ -509,14 +508,14 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
if (scriptContent->IsHTML()) {
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
|
||||
if (!language.IsEmpty()) {
|
||||
if (nsParserUtils::IsJavaScriptLanguage(language, &version))
|
||||
if (nsContentUtils::IsJavaScriptLanguage(language, &version))
|
||||
typeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
else
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
// IE, Opera, etc. do not respect language version, so neither should
|
||||
// we at this late date in the browser wars saga. Note that this change
|
||||
// affects HTML but not XUL or SVG (but note also that XUL has its own
|
||||
// code to check nsParserUtils::IsJavaScriptLanguage -- that's probably
|
||||
// code to check nsContentUtils::IsJavaScriptLanguage -- that's probably
|
||||
// a separate bug, one we may not be able to fix short of XUL2). See
|
||||
// bug 255895 (https://bugzilla.mozilla.org/show_bug.cgi?id=255895).
|
||||
NS_ASSERTION(JSVERSION_DEFAULT == 0,
|
||||
|
@ -37,37 +37,18 @@
|
||||
|
||||
#include "TestHarness.h"
|
||||
|
||||
#include "nsIParser.h"
|
||||
#include "nsIHTMLToTextSink.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIContentSink.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
#include "nsIParserUtils.h"
|
||||
|
||||
void
|
||||
ConvertBufToPlainText(nsString &aConBuf, int aFlag)
|
||||
{
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID);
|
||||
if (parser) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
sink = do_CreateInstance(NS_PLAINTEXTSINK_CONTRACTID);
|
||||
if (sink) {
|
||||
nsCOMPtr<nsIHTMLToTextSink> textSink(do_QueryInterface(sink));
|
||||
if (textSink) {
|
||||
nsAutoString convertedText;
|
||||
textSink->Initialize(&convertedText, aFlag, 72);
|
||||
parser->SetContentSink(sink);
|
||||
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), true);
|
||||
aConBuf = convertedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIParserUtils> utils =
|
||||
do_GetService(NS_PARSERUTILS_CONTRACTID);
|
||||
utils->ConvertToPlainText(aConBuf, aFlag, 72, aConBuf);
|
||||
}
|
||||
|
||||
// Test for ASCII with format=flowed; delsp=yes
|
||||
|
@ -71,6 +71,7 @@ _CHROME_FILES = \
|
||||
test_bug574596.html \
|
||||
test_bug683852.xul \
|
||||
test_bug599295.html \
|
||||
test_bug650784.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
43
content/base/test/chrome/test_bug650784.html
Normal file
43
content/base/test/chrome/test_bug650784.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=650776
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 650776</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650776">Mozilla Bug 650776</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 650776 **/
|
||||
|
||||
var c = Components.interfaces.nsIDocumentEncoder;
|
||||
var s = Components.classes["@mozilla.org/parserutils;1"]
|
||||
.getService(Components.interfaces.nsIParserUtils);
|
||||
|
||||
is(s.convertToPlainText("foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 1");
|
||||
is(s.convertToPlainText("foo foo foo", c.OutputWrap | c.OutputLFLineBreak, 7), "foo foo\nfoo", "Wrong conversion result 2");
|
||||
is(s.convertToPlainText("<body><noscript>b<span>a</span>r</noscript>foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 3");
|
||||
is(s.convertToPlainText("<body><noscript>b<span>a</span>r</noscript>foo", c.OutputNoScriptContent, 0), "barfoo", "Wrong conversion result 4");
|
||||
is(s.convertToPlainText("foo\u00A0bar", c.OutputPersistNBSP | c.OutputLFLineBreak, 0), "foo\u00A0bar", "Wrong conversion result 5");
|
||||
is(s.convertToPlainText("foo\u00A0bar", c.OutputLFLineBreak, 0), "foo bar", "Wrong conversion result 6");
|
||||
is(s.convertToPlainText("<body><noframes>bar</noframes>foo", c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 7");
|
||||
// OutputNoFramesContent doesn't actually work, because the flag gets overridden by
|
||||
// the browser.frames.enabled pref in all cases.
|
||||
is(s.convertToPlainText("<body><noframes>bar</noframes>foo", c.OutputNoFramesContent | c.OutputLFLineBreak, 0), "foo", "Wrong conversion result 8");
|
||||
is(s.convertToPlainText("<i>foo</i> <b>bar</b>", c.OutputFormatted | c.OutputLFLineBreak, 0), "/foo/ *bar*\n", "Wrong conversion result 9");
|
||||
is(s.convertToPlainText("<p>foo</p> <p>bar</p>", c.OutputLFLineBreak, 0), "foo\n\nbar", "Wrong conversion result 10");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
18
content/canvas/crashtests/729116.html
Normal file
18
content/canvas/crashtests/729116.html
Normal file
@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<script language=javascript>
|
||||
|
||||
function draw() {
|
||||
var canv = document.getElementById("canv");
|
||||
var ctx = canv.getContext("2d");
|
||||
try {
|
||||
canv.width = 50000;
|
||||
} catch (e) { }
|
||||
|
||||
ctx.clearRect(0, 0, 10, 10);
|
||||
}
|
||||
|
||||
</script>
|
||||
<body onload="draw()">
|
||||
<canvas id="canv" width="5" height="5"></canvas>
|
||||
</body>
|
||||
</html>
|
@ -3,3 +3,4 @@ load 421715-1.html
|
||||
load 553938-1.html
|
||||
load 647480.html
|
||||
load 0px-size-font-667225.html
|
||||
skip-if(cocoaWidget&&layersGPUAccelerated) load 729116.html # bug 731117
|
||||
|
@ -362,8 +362,6 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
|
||||
/*** end of early success return cases ***/
|
||||
|
||||
ScopedGfxFeatureReporter reporter("WebGL");
|
||||
|
||||
// At this point we know that the old context is not going to survive, even though we still don't
|
||||
// know if creating the new context will succeed.
|
||||
DestroyResourcesAndContext();
|
||||
@ -386,6 +384,8 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
bool verbose =
|
||||
Preferences::GetBool("webgl.verbose", false);
|
||||
|
||||
ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
|
||||
|
||||
if (disabled)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
using namespace mozilla;
|
||||
|
||||
|
||||
class WebGLMemoryMultiReporter : public nsIMemoryMultiReporter
|
||||
class WebGLMemoryMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -1306,6 +1306,10 @@ nsCanvasRenderingContext2DAzure::InitializeWithTarget(DrawTarget *target, PRInt3
|
||||
mTarget = target;
|
||||
} else {
|
||||
mValid = false;
|
||||
// Create a dummy target in the hopes that it will help us deal with users
|
||||
// calling into us after having changed the size where the size resulted
|
||||
// in an inability to create a correct DrawTarget.
|
||||
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
|
||||
}
|
||||
|
||||
mResetLayer = true;
|
||||
|
@ -42,6 +42,8 @@ var OPTIONS = {
|
||||
return request.responseText;
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function start() {
|
||||
|
||||
var kIsWindows = false;
|
||||
@ -62,6 +64,34 @@ function start() {
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
kIsWindowsVistaOrHigher = (parseFloat(version) >= 6.0);
|
||||
// Workaround for Windows 2000 (driver?) which may crash itself.
|
||||
if (parseFloat(version) <= 5.0) {
|
||||
todo(false, "Test disabled on Windows 2000 and older. (To prevent possible system crash.)");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// we currently disable this test on version of Mac OSX older than 10.6,
|
||||
// due to various weird failures, including one making getRenderbufferParameter tests
|
||||
// on DEPTH_STENCIL fail
|
||||
var kDarwinVersion = 0;
|
||||
if (kIsMac) {
|
||||
// code borrowed from browser/modules/test/browser_taskbar_preview.js
|
||||
var is106orHigher = false;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
kDarwinVersion = parseFloat(Components.classes["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version"));
|
||||
// the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
|
||||
// Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
|
||||
// is the Darwin version.
|
||||
is106orHigher = (kDarwinVersion >= 10.0);
|
||||
if (!is106orHigher) {
|
||||
dump("WebGL mochitest disabled on Mac OSX versions older than 10.6\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function getEnv(env) {
|
||||
@ -343,37 +373,18 @@ function start() {
|
||||
} else {
|
||||
var errmsg = "Can't create a WebGL context";
|
||||
reporter.fullResultsNode.textContent = errmsg;
|
||||
ok(false, errmsg);
|
||||
// Workaround for SeaMonkey tinderboxes which don't support WebGL.
|
||||
if (navigator.userAgent.match(/ SeaMonkey\//))
|
||||
todo(false, errmsg + " (This is expected on SeaMonkey (tinderboxes).)");
|
||||
else
|
||||
ok(false, errmsg);
|
||||
dump("WebGL mochitest failed: " + errmsg + "\n");
|
||||
reporter.finishedTestSuite();
|
||||
}
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
// we currently disable this test on version of Mac OSX older than 10.6,
|
||||
// due to various weird failures, including one making getRenderbufferParameter tests
|
||||
// on DEPTH_STENCIL fail
|
||||
var kDarwinVersion = 0;
|
||||
if (kIsMac) {
|
||||
// code borrowed from browser/modules/test/browser_taskbar_preview.js
|
||||
var is106orHigher = false;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
kDarwinVersion = parseFloat(Components.classes["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version"));
|
||||
// the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
|
||||
// Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
|
||||
// is the Darwin version.
|
||||
is106orHigher = (kDarwinVersion >= 10.0);
|
||||
if (!is106orHigher) {
|
||||
dump("WebGL mochitest disabled on Mac OSX versions older than 10.6\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var statusElem = document.getElementById("status");
|
||||
var statusTextNode = document.createTextNode('');
|
||||
statusElem.appendChild(statusTextNode);
|
||||
@ -431,7 +442,7 @@ function start() {
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="start()">
|
||||
<body onload="start();">
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
@ -439,7 +438,7 @@ nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
|
||||
nsAutoString mimeType;
|
||||
nsAutoString notUsed;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
|
||||
nsParserUtils::SplitMimeType(aType, mimeType, notUsed);
|
||||
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
|
||||
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
|
||||
return;
|
||||
}
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
@ -347,7 +346,7 @@ nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
|
||||
|
||||
nsAutoString mimeType;
|
||||
nsAutoString notUsed;
|
||||
nsParserUtils::SplitMimeType(aType, mimeType, notUsed);
|
||||
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
|
||||
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsScriptLoader.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -146,6 +146,11 @@ nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
aValue, aResult);
|
||||
}
|
||||
|
||||
static nsGenericElement::MappedAttributeEntry sMtableStyles[] = {
|
||||
{ &nsGkAtoms::width },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
static nsGenericElement::MappedAttributeEntry sTokenStyles[] = {
|
||||
{ &nsGkAtoms::mathsize_ },
|
||||
{ &nsGkAtoms::fontsize_ },
|
||||
@ -171,6 +176,10 @@ static nsGenericElement::MappedAttributeEntry sCommonPresStyles[] = {
|
||||
bool
|
||||
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const mtableMap[] = {
|
||||
sMtableStyles,
|
||||
sCommonPresStyles
|
||||
};
|
||||
static const MappedAttributeEntry* const tokenMap[] = {
|
||||
sTokenStyles,
|
||||
sCommonPresStyles
|
||||
@ -194,6 +203,9 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
tag == nsGkAtoms::math)
|
||||
return FindAttributeDependence(aAttribute, mstyleMap);
|
||||
|
||||
if (tag == nsGkAtoms::mtable_)
|
||||
return FindAttributeDependence(aAttribute, mtableMap);
|
||||
|
||||
if (tag == nsGkAtoms::maction_ ||
|
||||
tag == nsGkAtoms::maligngroup_ ||
|
||||
tag == nsGkAtoms::malignmark_ ||
|
||||
@ -211,7 +223,6 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
tag == nsGkAtoms::msub_ ||
|
||||
tag == nsGkAtoms::msubsup_ ||
|
||||
tag == nsGkAtoms::msup_ ||
|
||||
tag == nsGkAtoms::mtable_ ||
|
||||
tag == nsGkAtoms::mtd_ ||
|
||||
tag == nsGkAtoms::mtr_ ||
|
||||
tag == nsGkAtoms::munder_ ||
|
||||
@ -459,6 +470,19 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
colorValue->SetColorValue(color);
|
||||
}
|
||||
}
|
||||
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
|
||||
// width: value
|
||||
nsCSSValue* width = aData->ValueForWidth();
|
||||
if (width->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
// This does not handle auto and unitless values
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
ParseNumericValue(value->GetStringValue(), *width, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -39,8 +39,8 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsXMLProcessingInstruction.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
nsresult
|
||||
NS_NewXMLProcessingInstruction(nsIContent** aInstancePtrResult,
|
||||
@ -129,7 +129,7 @@ nsXMLProcessingInstruction::GetAttrValue(nsIAtom *aName, nsAString& aValue)
|
||||
nsAutoString data;
|
||||
|
||||
GetData(data);
|
||||
return nsParserUtils::GetQuotedAttributeValue(data, aName, aValue);
|
||||
return nsContentUtils::GetPseudoAttributeValue(data, aName, aValue);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsXMLProcessingInstruction.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -209,10 +208,12 @@ nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle,
|
||||
nsAutoString data;
|
||||
GetData(data);
|
||||
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::title, aTitle);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::title, aTitle);
|
||||
|
||||
nsAutoString alternate;
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::alternate, alternate);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::alternate,
|
||||
alternate);
|
||||
|
||||
// if alternate, does it have title?
|
||||
if (alternate.EqualsLiteral("yes")) {
|
||||
@ -223,13 +224,13 @@ nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle,
|
||||
*aIsAlternate = true;
|
||||
}
|
||||
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::media, aMedia);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::media, aMedia);
|
||||
|
||||
nsAutoString type;
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::type, type);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::type, type);
|
||||
|
||||
nsAutoString mimeType, notUsed;
|
||||
nsParserUtils::SplitMimeType(type, mimeType, notUsed);
|
||||
nsContentUtils::SplitMimeType(type, mimeType, notUsed);
|
||||
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
|
||||
aType.Assign(type);
|
||||
return;
|
||||
|
@ -68,7 +68,6 @@
|
||||
#include "prtime.h"
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
@ -265,11 +264,11 @@ CheckXSLTParamPI(nsIDOMProcessingInstruction* aPi,
|
||||
if (target.EqualsLiteral("xslt-param-namespace")) {
|
||||
aPi->GetData(data);
|
||||
nsAutoString prefix, namespaceAttr;
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::prefix,
|
||||
prefix);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::prefix,
|
||||
prefix);
|
||||
if (!prefix.IsEmpty() &&
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::_namespace,
|
||||
namespaceAttr)) {
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::_namespace,
|
||||
namespaceAttr)) {
|
||||
aProcessor->AddXSLTParamNamespace(prefix, namespaceAttr);
|
||||
}
|
||||
}
|
||||
@ -278,14 +277,14 @@ CheckXSLTParamPI(nsIDOMProcessingInstruction* aPi,
|
||||
else if (target.EqualsLiteral("xslt-param")) {
|
||||
aPi->GetData(data);
|
||||
nsAutoString name, namespaceAttr, select, value;
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::name,
|
||||
name);
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::_namespace,
|
||||
namespaceAttr);
|
||||
if (!nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::select, select)) {
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::name,
|
||||
name);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::_namespace,
|
||||
namespaceAttr);
|
||||
if (!nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::select, select)) {
|
||||
select.SetIsVoid(true);
|
||||
}
|
||||
if (!nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::value, value)) {
|
||||
if (!nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::value, value)) {
|
||||
value.SetIsVoid(true);
|
||||
}
|
||||
if (!name.IsEmpty()) {
|
||||
@ -1340,7 +1339,7 @@ nsXMLContentSink::HandleProcessingInstruction(const PRUnichar *aTarget,
|
||||
|
||||
// If it's not a CSS stylesheet PI...
|
||||
nsAutoString type;
|
||||
nsParserUtils::GetQuotedAttributeValue(data, nsGkAtoms::type, type);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::type, type);
|
||||
|
||||
if (mState != eXMLContentSinkState_InProlog ||
|
||||
!target.EqualsLiteral("xml-stylesheet") ||
|
||||
@ -1368,16 +1367,18 @@ nsXMLContentSink::ParsePIData(const nsString &aData, nsString &aHref,
|
||||
bool &aIsAlternate)
|
||||
{
|
||||
// If there was no href, we can't do anything with this PI
|
||||
if (!nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::href, aHref)) {
|
||||
if (!nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::href, aHref)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::title, aTitle);
|
||||
nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::title, aTitle);
|
||||
|
||||
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::media, aMedia);
|
||||
nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::media, aMedia);
|
||||
|
||||
nsAutoString alternate;
|
||||
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::alternate, alternate);
|
||||
nsContentUtils::GetPseudoAttributeValue(aData,
|
||||
nsGkAtoms::alternate,
|
||||
alternate);
|
||||
|
||||
aIsAlternate = alternate.EqualsLiteral("yes");
|
||||
|
||||
|
@ -1368,7 +1368,8 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, bool aNotify)
|
||||
if (hasMutationListeners) {
|
||||
nsAutoString ns;
|
||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||
GetAttributeNodeNS(ns, nsDependentAtomString(aName), getter_AddRefs(attrNode));
|
||||
GetAttributeNodeNSInternal(ns, nsDependentAtomString(aName),
|
||||
getter_AddRefs(attrNode));
|
||||
}
|
||||
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXULElement.h"
|
||||
@ -1079,7 +1078,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
||||
// various version strings anyway. So we make no attempt to support
|
||||
// languages other than JS for language=
|
||||
nsAutoString lang(aAttributes[1]);
|
||||
if (nsParserUtils::IsJavaScriptLanguage(lang, &version)) {
|
||||
if (nsContentUtils::IsJavaScriptLanguage(lang, &version)) {
|
||||
langID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
|
||||
// Even when JS version < 1.6 is specified, E4X is
|
||||
|
@ -84,7 +84,6 @@
|
||||
#include "nsXULContentUtils.h"
|
||||
#include "nsIXULOverlayProvider.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "nsRDFCID.h"
|
||||
@ -2545,9 +2544,9 @@ nsXULDocument::InsertXULOverlayPI(const nsXULPrototypePI* aProtoPI,
|
||||
}
|
||||
|
||||
nsAutoString href;
|
||||
nsParserUtils::GetQuotedAttributeValue(aProtoPI->mData,
|
||||
nsGkAtoms::href,
|
||||
href);
|
||||
nsContentUtils::GetPseudoAttributeValue(aProtoPI->mData,
|
||||
nsGkAtoms::href,
|
||||
href);
|
||||
|
||||
// If there was no href, we can't do anything with this PI
|
||||
if (href.IsEmpty()) {
|
||||
|
@ -7667,19 +7667,8 @@ void nsGlobalWindow::MaybeUpdateTouchState()
|
||||
if(this == focusedWindow) {
|
||||
UpdateTouchState();
|
||||
}
|
||||
}
|
||||
|
||||
void nsGlobalWindow::UpdateTouchState()
|
||||
{
|
||||
FORWARD_TO_INNER_VOID(UpdateTouchState, ());
|
||||
|
||||
nsCOMPtr<nsIWidget> mainWidget = GetMainWidget();
|
||||
if (!mainWidget)
|
||||
return;
|
||||
|
||||
if (mMayHaveTouchEventListener) {
|
||||
mainWidget->RegisterTouchWindow();
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
|
||||
@ -7688,6 +7677,20 @@ void nsGlobalWindow::UpdateTouchState()
|
||||
DOM_TOUCH_LISTENER_ADDED,
|
||||
nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsGlobalWindow::UpdateTouchState()
|
||||
{
|
||||
FORWARD_TO_INNER_VOID(UpdateTouchState, ());
|
||||
|
||||
nsCOMPtr<nsIWidget> mainWidget = GetMainWidget();
|
||||
if (!mainWidget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMayHaveTouchEventListener) {
|
||||
mainWidget->RegisterTouchWindow();
|
||||
} else {
|
||||
mainWidget->UnregisterTouchWindow();
|
||||
}
|
||||
|
@ -932,9 +932,9 @@ nsPluginHost::GetPluginTempDir(nsIFile **aDir)
|
||||
return sPluginTempDir->Clone(aDir);
|
||||
}
|
||||
|
||||
nsresult nsPluginHost::InstantiatePluginForChannel(nsIChannel* aChannel,
|
||||
nsObjectLoadingContent* aContent,
|
||||
nsIStreamListener** aListener)
|
||||
nsresult nsPluginHost::CreateListenerForChannel(nsIChannel* aChannel,
|
||||
nsObjectLoadingContent* aContent,
|
||||
nsIStreamListener** aListener)
|
||||
{
|
||||
NS_PRECONDITION(aChannel && aContent,
|
||||
"Invalid arguments to InstantiatePluginForChannel");
|
||||
@ -1068,7 +1068,7 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
||||
// if we don't have a MIME type at this point, we still have one more chance by
|
||||
// opening the stream and seeing if the server hands one back
|
||||
if (!aMimeType) {
|
||||
if (bCanHandleInternally && !aContent->SrcStreamLoadInitiated()) {
|
||||
if (bCanHandleInternally && !aContent->SrcStreamLoading()) {
|
||||
NewEmbeddedPluginStream(aURL, aContent, nsnull);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1096,7 +1096,7 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
||||
// no need to check for "data" as it would have been converted to "src"
|
||||
const char *value;
|
||||
bool havedata = NS_SUCCEEDED(pti->GetAttribute("SRC", &value));
|
||||
if (havedata && !isJava && bCanHandleInternally && !aContent->SrcStreamLoadInitiated()) {
|
||||
if (havedata && !isJava && bCanHandleInternally && !aContent->SrcStreamLoading()) {
|
||||
NewEmbeddedPluginStream(aURL, nsnull, instance.get());
|
||||
}
|
||||
}
|
||||
|
@ -113,9 +113,9 @@ public:
|
||||
nsresult Init();
|
||||
nsresult Destroy();
|
||||
nsresult LoadPlugins();
|
||||
nsresult InstantiatePluginForChannel(nsIChannel* aChannel,
|
||||
nsObjectLoadingContent* aContent,
|
||||
nsIStreamListener** aListener);
|
||||
nsresult CreateListenerForChannel(nsIChannel* aChannel,
|
||||
nsObjectLoadingContent* aContent,
|
||||
nsIStreamListener** aListener);
|
||||
nsresult SetUpPluginInstance(const char *aMimeType,
|
||||
nsIURI *aURL,
|
||||
nsIPluginInstanceOwner *aOwner);
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
/**
|
||||
* Simple object that holds a single point in space.
|
||||
*/
|
||||
class nsGeoPositionCoords : public nsIDOMGeoPositionCoords
|
||||
class nsGeoPositionCoords MOZ_FINAL : public nsIDOMGeoPositionCoords
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -96,8 +96,8 @@ public:
|
||||
double aAlt, double aHError,
|
||||
double aVError, double aHeading,
|
||||
double aSpeed);
|
||||
private:
|
||||
~nsGeoPositionCoords();
|
||||
private:
|
||||
const double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "nsIDOMGeoPosition.h"
|
||||
|
||||
typedef nsIDOMGeoPositionAddress *GeoPositionAddress;
|
||||
typedef nsIDOMGeoPositionCoords *GeoPositionCoords;
|
||||
typedef nsGeoPositionCoords *GeoPositionCoords;
|
||||
typedef nsIDOMGeoPosition *GeoPosition;
|
||||
|
||||
namespace IPC {
|
||||
@ -233,7 +233,7 @@ struct ParamTraits<GeoPosition>
|
||||
|
||||
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
||||
aParam->GetCoords(getter_AddRefs(coords));
|
||||
GeoPositionCoords simpleCoords = coords.get();
|
||||
GeoPositionCoords simpleCoords = static_cast<GeoPositionCoords>(coords.get());
|
||||
WriteParam(aMsg, simpleCoords);
|
||||
|
||||
nsCOMPtr<nsIDOMGeoPositionAddress> address;
|
||||
|
@ -262,10 +262,12 @@ function checkChangeIsEnabled(aWindow, aNext)
|
||||
});
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_move_resize", false]]}, function() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
if (screen.width <= 200 || screen.height <= 200) {
|
||||
todo(false, "The screen is too small to run this test.");
|
||||
todo(false, "The screen needs to be bigger than 200px*200px to run this test.");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
backValues();
|
||||
@ -318,6 +320,7 @@ SimpleTest.waitForFocus(function() {
|
||||
}, w, false);
|
||||
});
|
||||
});
|
||||
}); // SpecialPowers.pushPrefEnv()
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -792,8 +792,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Create transaction manager instance ... ");
|
||||
|
||||
nsCOMPtr<nsITransactionManager> mgr =
|
||||
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mgr) {
|
||||
@ -801,7 +799,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Create transaction manager instance");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -809,7 +807,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call DoTransaction() with null transaction ... ");
|
||||
result = mgr->DoTransaction(0);
|
||||
|
||||
if (result != NS_ERROR_NULL_POINTER) {
|
||||
@ -817,7 +814,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call DoTransaction() with null transaction");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -825,7 +822,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call UndoTransaction() with empty undo stack ... ");
|
||||
result = mgr->UndoTransaction();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -833,7 +829,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call UndoTransaction() with empty undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -841,7 +837,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call RedoTransaction() with empty redo stack ... ");
|
||||
result = mgr->RedoTransaction();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -849,7 +844,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call RedoTransaction() with empty redo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -857,7 +852,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call SetMaxTransactionCount(-1) with empty undo and redo stacks ... ");
|
||||
result = mgr->SetMaxTransactionCount(-1);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -865,7 +859,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call SetMaxTransactionCount(-1) with empty undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -873,7 +867,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call SetMaxTransactionCount(0) with empty undo and redo stacks ... ");
|
||||
result = mgr->SetMaxTransactionCount(0);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -881,7 +874,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call SetMaxTransactionCount(0) with empty undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -889,7 +882,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call SetMaxTransactionCount(10) with empty undo and redo stacks ... ");
|
||||
result = mgr->SetMaxTransactionCount(10);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -897,7 +889,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call SetMaxTransactionCount(10) with empty undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -905,15 +897,13 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call Clear() with empty undo and redo stack ... ");
|
||||
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear on empty undo and redo stack failed. (%d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call Clear() with empty undo and redo stack");
|
||||
|
||||
PRInt32 numitems;
|
||||
|
||||
@ -923,7 +913,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call GetNumberOfUndoItems() with empty undo stack ... ");
|
||||
result = mgr->GetNumberOfUndoItems(&numitems);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -938,7 +927,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call GetNumberOfUndoItems() with empty undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -946,7 +935,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call GetNumberOfRedoItems() with empty redo stack ... ");
|
||||
result = mgr->GetNumberOfRedoItems(&numitems);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -961,7 +949,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call GetNumberOfRedoItems() with empty redo stack");
|
||||
|
||||
nsITransaction *tx;
|
||||
|
||||
@ -971,8 +959,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call PeekUndoStack() with empty undo stack ... ");
|
||||
|
||||
tx = 0;
|
||||
result = mgr->PeekUndoStack(&tx);
|
||||
|
||||
@ -988,7 +974,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call PeekUndoStack() with empty undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -996,8 +982,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call PeekRedoStack() with empty undo stack ... ");
|
||||
|
||||
tx = 0;
|
||||
result = mgr->PeekRedoStack(&tx);
|
||||
|
||||
@ -1013,7 +997,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call PeekRedoStack() with empty undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1021,8 +1005,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call AddListener() with null listener ... ");
|
||||
|
||||
result = mgr->AddListener(0);
|
||||
|
||||
if (result != NS_ERROR_NULL_POINTER) {
|
||||
@ -1030,7 +1012,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call AddListener() with null listener");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1038,8 +1020,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call RemoveListener() with null listener ... ");
|
||||
|
||||
result = mgr->RemoveListener(0);
|
||||
|
||||
if (result != NS_ERROR_NULL_POINTER) {
|
||||
@ -1047,7 +1027,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call RemoveListener() with null listener");
|
||||
|
||||
PRInt32 i;
|
||||
TestTransaction *tximpl;
|
||||
@ -1063,8 +1043,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test coalescing of transactions ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(10);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -1211,7 +1189,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test coalescing of transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1220,8 +1198,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Execute 20 transactions ... ");
|
||||
|
||||
for (i = 1; i <= 20; i++) {
|
||||
tximpl = factory->create(mgr, NONE_FLAG);
|
||||
|
||||
@ -1275,7 +1251,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Execute 20 transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1284,8 +1260,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Execute 20 transient transactions ... ");
|
||||
|
||||
u1 = u2 = r1 = r2 = 0;
|
||||
|
||||
result = mgr->PeekUndoStack(&u1);
|
||||
@ -1387,7 +1361,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Execute 20 transient transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1396,8 +1370,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Undo 4 transactions ... ");
|
||||
|
||||
for (i = 1; i <= 4; i++) {
|
||||
result = mgr->UndoTransaction();
|
||||
if (NS_FAILED(result)) {
|
||||
@ -1434,7 +1406,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Undo 4 transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1443,8 +1415,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Redo 2 transactions ... ");
|
||||
|
||||
for (i = 1; i <= 2; ++i) {
|
||||
result = mgr->RedoTransaction();
|
||||
if (NS_FAILED(result)) {
|
||||
@ -1481,7 +1451,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Redo 2 transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1489,8 +1459,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Check if new transactions prune the redo stack ... ");
|
||||
|
||||
tximpl = factory->create(mgr, NONE_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -1543,7 +1511,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Check if new transactions prune the redo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1551,8 +1519,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Undo 4 transactions then clear the undo and redo stacks ... ");
|
||||
|
||||
for (i = 1; i <= 4; ++i) {
|
||||
result = mgr->UndoTransaction();
|
||||
if (NS_FAILED(result)) {
|
||||
@ -1624,7 +1590,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Undo 4 transactions then clear the undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1632,8 +1598,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Execute 5 transactions ... ");
|
||||
|
||||
for (i = 1; i <= 5; i++) {
|
||||
tximpl = factory->create(mgr, NONE_FLAG);
|
||||
|
||||
@ -1687,7 +1651,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Execute 5 transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1695,8 +1659,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction DoTransaction() error ... ");
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_DO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -1798,7 +1760,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction DoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1806,8 +1768,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction UndoTransaction() error ... ");
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_UNDO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -1916,7 +1876,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction UndoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1924,8 +1884,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction RedoTransaction() error ... ");
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_REDO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -2080,7 +2038,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction RedoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2090,8 +2048,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test max transaction count of zero ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(0);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2180,7 +2136,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
}
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test max transaction count of zero");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2190,8 +2146,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test SetMaxTransactionCount() greater than num stack items ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(-1);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2373,7 +2327,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test SetMaxTransactionCount() greater than num stack items");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2383,8 +2337,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test SetMaxTransactionCount() pruning undo stack ... ");
|
||||
|
||||
u1 = u2 = r1 = r2 = 0;
|
||||
|
||||
result = mgr->PeekUndoStack(&u1);
|
||||
@ -2468,7 +2420,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test SetMaxTransactionCount() pruning undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2478,8 +2430,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test SetMaxTransactionCount() pruning redo stack ... ");
|
||||
|
||||
u1 = u2 = r1 = r2 = 0;
|
||||
|
||||
result = mgr->PeekUndoStack(&u1);
|
||||
@ -2563,7 +2513,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test SetMaxTransactionCount() pruning redo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2572,8 +2522,6 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Release the transaction manager ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(-1);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2678,7 +2626,7 @@ quick_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Release the transaction manager");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2687,16 +2635,14 @@ quick_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Number of transactions created and destroyed match ... ");
|
||||
|
||||
if (sConstructorCount != sDestructorCount) {
|
||||
printf("ERROR: Transaction constructor count (%d) != destructor count (%d).\n",
|
||||
sConstructorCount, sDestructorCount);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
printf("%d transactions processed during quick test.\n", sConstructorCount);
|
||||
passed("Number of transactions created and destroyed match");
|
||||
passed("%d transactions processed during quick test", sConstructorCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2774,8 +2720,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Create transaction manager instance ... ");
|
||||
|
||||
nsCOMPtr<nsITransactionManager> mgr =
|
||||
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mgr) {
|
||||
@ -2783,7 +2727,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Create transaction manager instance");
|
||||
|
||||
PRInt32 numitems;
|
||||
|
||||
@ -2794,8 +2738,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test unbalanced EndBatch() with empty undo stack ... ");
|
||||
|
||||
result = mgr->GetNumberOfUndoItems(&numitems);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2831,8 +2773,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
passed("Test unbalanced EndBatch() with empty undo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -2841,8 +2782,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test empty batch ... ");
|
||||
|
||||
result = mgr->GetNumberOfUndoItems(&numitems);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2899,7 +2838,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test empty batch");
|
||||
|
||||
PRInt32 i;
|
||||
TestTransaction *tximpl;
|
||||
@ -2912,8 +2851,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Execute 20 batched transactions ... ");
|
||||
|
||||
result = mgr->BeginBatch();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -2981,7 +2918,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Execute 20 batched transactions");
|
||||
|
||||
nsITransaction *u1, *u2;
|
||||
nsITransaction *r1, *r2;
|
||||
@ -2993,8 +2930,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Execute 20 batched transient transactions ... ");
|
||||
|
||||
u1 = u2 = r1 = r2 = 0;
|
||||
|
||||
result = mgr->PeekUndoStack(&u1);
|
||||
@ -3110,7 +3045,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Execute 20 batched transient transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3119,8 +3054,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test nested batched transactions ... ");
|
||||
|
||||
result = mgr->BeginBatch();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3285,7 +3218,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test nested batched transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3294,8 +3227,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Undo 2 batch transactions ... ");
|
||||
|
||||
for (i = 1; i <= 2; ++i) {
|
||||
result = mgr->UndoTransaction();
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3332,7 +3263,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Undo 2 batch transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3341,9 +3272,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
|
||||
printf("Redo 2 batch transactions ... ");
|
||||
|
||||
for (i = 1; i <= 2; ++i) {
|
||||
result = mgr->RedoTransaction();
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3380,7 +3308,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Redo 2 batch transactions");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3389,8 +3317,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Undo a batched transaction that was redone ... ");
|
||||
|
||||
result = mgr->UndoTransaction();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3426,7 +3352,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Undo a batched transaction that was redone");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3435,8 +3361,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test effect of unbalanced EndBatch() on undo and redo stacks ... ");
|
||||
|
||||
result = mgr->EndBatch();
|
||||
|
||||
if (result != NS_ERROR_FAILURE) {
|
||||
@ -3472,7 +3396,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test effect of unbalanced EndBatch() on undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3482,8 +3406,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test effect of empty batch on undo and redo stacks ... ");
|
||||
|
||||
result = mgr->BeginBatch();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3554,9 +3476,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
passed("Test effect of empty batch on undo and redo stacks");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3564,8 +3484,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Check if new batched transactions prune the redo stack ... ");
|
||||
|
||||
result = mgr->BeginBatch();
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -3661,7 +3579,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Check if new batched transactions prune the redo stack");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3669,8 +3587,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Call undo ... ");
|
||||
|
||||
// Move a transaction over to the redo stack, so that we have one
|
||||
// transaction on the undo stack, and one on the redo stack!
|
||||
|
||||
@ -3709,7 +3625,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Call undo");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3717,9 +3633,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction DoTransaction() error ... ");
|
||||
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_DO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -3835,7 +3748,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction DoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3843,8 +3756,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction UndoTransaction() error ... ");
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_UNDO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -3967,7 +3878,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction UndoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -3975,8 +3886,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test transaction RedoTransaction() error ... ");
|
||||
|
||||
tximpl = factory->create(mgr, THROWS_REDO_ERROR_FLAG);
|
||||
|
||||
if (!tximpl) {
|
||||
@ -4145,7 +4054,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test transaction RedoTransaction() error");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -4155,8 +4064,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Test max transaction count of zero ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(0);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -4259,7 +4166,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
}
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Test max transaction count of zero");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -4268,8 +4175,6 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Release the transaction manager ... ");
|
||||
|
||||
result = mgr->SetMaxTransactionCount(-1);
|
||||
|
||||
if (NS_FAILED(result)) {
|
||||
@ -4388,7 +4293,7 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
return result;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
passed("Release the transaction manager");
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -4397,16 +4302,14 @@ quick_batch_test(TestTransactionFactory *factory)
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
printf("Number of transactions created and destroyed match ... ");
|
||||
|
||||
if (sConstructorCount != sDestructorCount) {
|
||||
printf("ERROR: Transaction constructor count (%d) != destructor count (%d).\n",
|
||||
sConstructorCount, sDestructorCount);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
printf("%d transactions processed during quick batch test.\n",
|
||||
passed("Number of transactions created and destroyed match");
|
||||
passed("%d transactions processed during quick batch test",
|
||||
sConstructorCount);
|
||||
|
||||
return NS_OK;
|
||||
@ -4581,6 +4484,8 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
|
||||
printf("%i ", j);
|
||||
} // for, iterations.
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
result = mgr->Clear();
|
||||
if (NS_FAILED(result)) {
|
||||
printf("ERROR: Clear() failed. (%d)\n", result);
|
||||
@ -4593,9 +4498,7 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
printf("passed\n");
|
||||
|
||||
printf("%d transactions processed during stress test.\n", sConstructorCount);
|
||||
passed("%d transactions processed during stress test", sConstructorCount);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include "nsISHEntry.h"
|
||||
#include "nsIWebPageDescriptor.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsIDOMProcessingInstruction.h"
|
||||
@ -2604,72 +2605,6 @@ nsWebBrowserPersist::EnumCleanupUploadList(nsHashKey *aKey, void *aData, void* c
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
nsWebBrowserPersist::GetQuotedAttributeValue(
|
||||
const nsAString &aSource, const nsAString &aAttribute, nsAString &aValue)
|
||||
{
|
||||
// NOTE: This code was lifted verbatim from nsParserUtils.cpp
|
||||
aValue.Truncate();
|
||||
nsAString::const_iterator start, end;
|
||||
aSource.BeginReading(start);
|
||||
aSource.EndReading(end);
|
||||
nsAString::const_iterator iter(end);
|
||||
|
||||
while (start != end) {
|
||||
if (FindInReadable(aAttribute, start, iter))
|
||||
{
|
||||
// walk past any whitespace
|
||||
while (iter != end && nsCRT::IsAsciiSpace(*iter))
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end)
|
||||
break;
|
||||
|
||||
// valid name="value" pair?
|
||||
if (*iter != '=')
|
||||
{
|
||||
start = iter;
|
||||
iter = end;
|
||||
continue;
|
||||
}
|
||||
// move past the =
|
||||
++iter;
|
||||
|
||||
while (iter != end && nsCRT::IsAsciiSpace(*iter))
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end)
|
||||
break;
|
||||
|
||||
PRUnichar q = *iter;
|
||||
if (q != '"' && q != '\'')
|
||||
{
|
||||
start = iter;
|
||||
iter = end;
|
||||
continue;
|
||||
}
|
||||
|
||||
// point to the first char of the value
|
||||
++iter;
|
||||
start = iter;
|
||||
if (FindCharInReadable(q, iter, end))
|
||||
{
|
||||
aValue = Substring(start, iter);
|
||||
return true;
|
||||
}
|
||||
|
||||
// we've run out of string. Just return...
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult nsWebBrowserPersist::FixupXMLStyleSheetLink(nsIDOMProcessingInstruction *aPI, const nsAString &aHref)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPI);
|
||||
@ -2680,7 +2615,9 @@ nsresult nsWebBrowserPersist::FixupXMLStyleSheetLink(nsIDOMProcessingInstruction
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString href;
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("href"), href);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::href,
|
||||
href);
|
||||
|
||||
// Construct and set a new data value for the xml-stylesheet
|
||||
if (!aHref.IsEmpty() && !href.IsEmpty())
|
||||
@ -2691,11 +2628,21 @@ nsresult nsWebBrowserPersist::FixupXMLStyleSheetLink(nsIDOMProcessingInstruction
|
||||
nsAutoString type;
|
||||
nsAutoString media;
|
||||
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("alternate"), alternate);
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("charset"), charset);
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("title"), title);
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("type"), type);
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("media"), media);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::alternate,
|
||||
alternate);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::charset,
|
||||
charset);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::title,
|
||||
title);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::type,
|
||||
type);
|
||||
nsContentUtils::GetPseudoAttributeValue(data,
|
||||
nsGkAtoms::media,
|
||||
media);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kCloseAttr, "\" ");
|
||||
nsAutoString newData;
|
||||
@ -2736,7 +2683,7 @@ nsresult nsWebBrowserPersist::GetXMLStyleSheetLink(nsIDOMProcessingInstruction *
|
||||
rv = aPI->GetData(data);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
GetQuotedAttributeValue(data, NS_LITERAL_STRING("href"), aHref);
|
||||
nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::href, aHref);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -152,8 +152,6 @@ private:
|
||||
{
|
||||
return StoreURIAttributeNS(aNode, "", aAttribute, aNeedsPersisting, aData);
|
||||
}
|
||||
bool GetQuotedAttributeValue(
|
||||
const nsAString &aSource, const nsAString &aAttribute, nsAString &aValue);
|
||||
bool DocumentEncoderExists(const PRUnichar *aContentType);
|
||||
|
||||
nsresult GetNodeToFixup(nsIDOMNode *aNodeIn, nsIDOMNode **aNodeOut);
|
||||
|
@ -125,9 +125,9 @@ LayerManagerD3D10::~LayerManagerD3D10()
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerD3D10::Initialize()
|
||||
LayerManagerD3D10::Initialize(bool force)
|
||||
{
|
||||
ScopedGfxFeatureReporter reporter("D3D10 Layers");
|
||||
ScopedGfxFeatureReporter reporter("D3D10 Layers", force);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
*
|
||||
* \return True is initialization was succesful, false when it was not.
|
||||
*/
|
||||
bool Initialize();
|
||||
bool Initialize(bool force = false);
|
||||
|
||||
/*
|
||||
* LayerManager implementation.
|
||||
|
@ -70,9 +70,9 @@ LayerManagerD3D9::~LayerManagerD3D9()
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerD3D9::Initialize()
|
||||
LayerManagerD3D9::Initialize(bool force)
|
||||
{
|
||||
ScopedGfxFeatureReporter reporter("D3D9 Layers");
|
||||
ScopedGfxFeatureReporter reporter("D3D9 Layers", force);
|
||||
|
||||
/* XXX: this preference and blacklist code should move out of the layer manager */
|
||||
bool forceAccelerate =
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
*
|
||||
* \return True is initialization was succesful, false when it was not.
|
||||
*/
|
||||
bool Initialize();
|
||||
bool Initialize(bool force = false);
|
||||
|
||||
/*
|
||||
* Sets the clipping region for this layer manager. This is important on
|
||||
|
@ -177,9 +177,9 @@ LayerManagerOGL::CreateContext()
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerOGL::Initialize(nsRefPtr<GLContext> aContext)
|
||||
LayerManagerOGL::Initialize(nsRefPtr<GLContext> aContext, bool force)
|
||||
{
|
||||
ScopedGfxFeatureReporter reporter("GL Layers");
|
||||
ScopedGfxFeatureReporter reporter("GL Layers", force);
|
||||
|
||||
// Do not allow double intiailization
|
||||
NS_ABORT_IF_FALSE(mGLContext == nsnull, "Don't reiniailize layer managers");
|
||||
|
@ -106,11 +106,11 @@ public:
|
||||
*
|
||||
* \return True is initialization was succesful, false when it was not.
|
||||
*/
|
||||
bool Initialize() {
|
||||
return Initialize(CreateContext());
|
||||
bool Initialize(bool force = false) {
|
||||
return Initialize(CreateContext(), force);
|
||||
}
|
||||
|
||||
bool Initialize(nsRefPtr<GLContext> aContext);
|
||||
bool Initialize(nsRefPtr<GLContext> aContext, bool force = false);
|
||||
|
||||
/**
|
||||
* Sets the clipping region for this layer manager. This is important on
|
||||
|
@ -103,10 +103,9 @@ ScopedGfxFeatureReporter::WriteAppNote(char statusChar)
|
||||
}
|
||||
|
||||
nsCAutoString featureString;
|
||||
featureString.AppendPrintf("%s%c%c",
|
||||
featureString.AppendPrintf("%s%c ",
|
||||
mFeature,
|
||||
statusChar,
|
||||
statusChar == '?' ? ' ' : '\n');
|
||||
statusChar);
|
||||
|
||||
if (!gFeaturesAlreadyReported->Contains(featureString)) {
|
||||
gFeaturesAlreadyReported->AppendElement(featureString);
|
||||
|
@ -53,9 +53,10 @@ namespace mozilla {
|
||||
class NS_GFX ScopedGfxFeatureReporter
|
||||
{
|
||||
public:
|
||||
ScopedGfxFeatureReporter(const char *aFeature) : mFeature(aFeature), mStatusChar('-')
|
||||
ScopedGfxFeatureReporter(const char *aFeature, bool force = false)
|
||||
: mFeature(aFeature), mStatusChar('-')
|
||||
{
|
||||
WriteAppNote('?');
|
||||
WriteAppNote(force ? '!' : '?');
|
||||
}
|
||||
~ScopedGfxFeatureReporter() {
|
||||
WriteAppNote(mStatusChar);
|
||||
|
@ -501,7 +501,7 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
||||
mD2DDevice = nsnull;
|
||||
}
|
||||
|
||||
mozilla::ScopedGfxFeatureReporter reporter("D2D");
|
||||
mozilla::ScopedGfxFeatureReporter reporter("D2D", aAttemptForce);
|
||||
|
||||
HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
|
||||
D3D10CreateDevice1Func createD3DDevice = (D3D10CreateDevice1Func)
|
||||
|
@ -128,6 +128,7 @@ struct RuntimeStats
|
||||
, runtimeTemporary(0)
|
||||
, runtimeRegexpCode(0)
|
||||
, runtimeStackCommitted(0)
|
||||
, runtimeGCMarker(0)
|
||||
, gcHeapChunkTotal(0)
|
||||
, gcHeapChunkCleanUnused(0)
|
||||
, gcHeapChunkDirtyUnused(0)
|
||||
@ -159,6 +160,7 @@ struct RuntimeStats
|
||||
size_t runtimeTemporary;
|
||||
size_t runtimeRegexpCode;
|
||||
size_t runtimeStackCommitted;
|
||||
size_t runtimeGCMarker;
|
||||
size_t gcHeapChunkTotal;
|
||||
size_t gcHeapChunkCleanUnused;
|
||||
size_t gcHeapChunkDirtyUnused;
|
||||
|
@ -499,6 +499,17 @@ class Vector : private AllocPolicy
|
||||
* shifting existing elements from |t + 1| onward one position lower.
|
||||
*/
|
||||
void erase(T *t);
|
||||
|
||||
/*
|
||||
* Measure the size of the Vector's heap-allocated storage.
|
||||
*/
|
||||
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const;
|
||||
|
||||
/*
|
||||
* Like sizeOfExcludingThis, but also measures the size of the Vector
|
||||
* object (which must be heap-allocated) itself.
|
||||
*/
|
||||
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const;
|
||||
};
|
||||
|
||||
/* This does the re-entrancy check plus several other sanity checks. */
|
||||
@ -996,6 +1007,20 @@ Vector<T,N,AP>::replaceRawBuffer(T *p, size_t length)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T, size_t N, class AP>
|
||||
inline size_t
|
||||
Vector<T,N,AP>::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const
|
||||
{
|
||||
return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck());
|
||||
}
|
||||
|
||||
template <class T, size_t N, class AP>
|
||||
inline size_t
|
||||
Vector<T,N,AP>::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const
|
||||
{
|
||||
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -211,10 +211,9 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats)
|
||||
&rtStats->runtimeNormal,
|
||||
&rtStats->runtimeTemporary,
|
||||
&rtStats->runtimeRegexpCode,
|
||||
&rtStats->runtimeStackCommitted);
|
||||
&rtStats->runtimeStackCommitted,
|
||||
&rtStats->runtimeGCMarker);
|
||||
|
||||
// Nb: we use sizeOfExcludingThis() because atomState.atoms is within
|
||||
// JSRuntime, and so counted when JSRuntime is counted.
|
||||
rtStats->runtimeAtomsTable =
|
||||
rt->atomState.atoms.sizeOfExcludingThis(rtStats->mallocSizeOf);
|
||||
|
||||
@ -335,7 +334,8 @@ GetExplicitNonHeapForRuntime(JSRuntime *rt, int64_t *amount,
|
||||
NULL,
|
||||
NULL,
|
||||
®expCode,
|
||||
&stackCommitted);
|
||||
&stackCommitted,
|
||||
NULL);
|
||||
|
||||
*amount += regexpCode;
|
||||
*amount += stackCommitted;
|
||||
|
@ -243,6 +243,8 @@ UpdateDecomposeLength(BytecodeEmitter *bce, uintN start)
|
||||
ptrdiff_t
|
||||
frontend::Emit1(JSContext *cx, BytecodeEmitter *bce, JSOp op)
|
||||
{
|
||||
JS_ASSERT_IF(op == JSOP_ARGUMENTS, !bce->mayOverwriteArguments());
|
||||
|
||||
ptrdiff_t offset = EmitCheck(cx, bce, 1);
|
||||
|
||||
if (offset >= 0) {
|
||||
@ -983,6 +985,14 @@ EmitSlotObjectOp(JSContext *cx, JSOp op, uintN slot, uint32_t index, BytecodeEmi
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EmitArguments(JSContext *cx, BytecodeEmitter *bce)
|
||||
{
|
||||
if (!bce->mayOverwriteArguments())
|
||||
return Emit1(cx, bce, JSOP_ARGUMENTS) >= 0;
|
||||
return EmitAtomOp(cx, cx->runtime->atomState.argumentsAtom, JSOP_NAME, bce);
|
||||
}
|
||||
|
||||
bool
|
||||
BytecodeEmitter::shouldNoteClosedName(ParseNode *pn)
|
||||
{
|
||||
@ -1833,7 +1843,10 @@ EmitNameOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSBool callContex
|
||||
}
|
||||
}
|
||||
|
||||
if (op == JSOP_ARGUMENTS || op == JSOP_CALLEE) {
|
||||
if (op == JSOP_ARGUMENTS) {
|
||||
if (!EmitArguments(cx, bce))
|
||||
return JS_FALSE;
|
||||
} else if (op == JSOP_CALLEE) {
|
||||
if (Emit1(cx, bce, op) < 0)
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
@ -3589,7 +3602,7 @@ EmitVariables(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (op == JSOP_ARGUMENTS) {
|
||||
if (Emit1(cx, bce, op) < 0)
|
||||
if (!EmitArguments(cx, bce))
|
||||
return JS_FALSE;
|
||||
} else if (!pn2->pn_cookie.isFree()) {
|
||||
EMIT_UINT16_IMM_OP(op, atomIndex);
|
||||
@ -3700,7 +3713,7 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
|
||||
if (lhs->isOp(JSOP_CALLEE)) {
|
||||
if (Emit1(cx, bce, JSOP_CALLEE) < 0)
|
||||
return false;
|
||||
} else if (lhs->isOp(JSOP_NAME)) {
|
||||
} else if (lhs->isOp(JSOP_NAME) || lhs->isOp(JSOP_GETGNAME)) {
|
||||
if (!EmitIndex32(cx, lhs->getOp(), atomIndex, bce))
|
||||
return false;
|
||||
} else {
|
||||
|
@ -168,21 +168,20 @@ struct StmtInfo {
|
||||
#define TCF_IN_FOR_INIT 0x10 /* parsing init expr of for; exclude 'in' */
|
||||
#define TCF_FUN_SETS_OUTER_NAME 0x20 /* function set outer name (lexical or free) */
|
||||
#define TCF_FUN_PARAM_ARGUMENTS 0x40 /* function has parameter named arguments */
|
||||
#define TCF_FUN_USES_ARGUMENTS 0x80 /* function uses arguments except as a
|
||||
#define TCF_FUN_LOCAL_ARGUMENTS 0x80 /* function has local named arguments */
|
||||
#define TCF_FUN_USES_ARGUMENTS 0x100 /* function uses arguments except as a
|
||||
parameter name */
|
||||
#define TCF_FUN_HEAVYWEIGHT 0x100 /* function needs Call object per call */
|
||||
#define TCF_FUN_IS_GENERATOR 0x200 /* parsed yield statement in function */
|
||||
#define TCF_FUN_USES_OWN_NAME 0x400 /* named function expression that uses its
|
||||
#define TCF_FUN_HEAVYWEIGHT 0x200 /* function needs Call object per call */
|
||||
#define TCF_FUN_IS_GENERATOR 0x400 /* parsed yield statement in function */
|
||||
#define TCF_FUN_USES_OWN_NAME 0x800 /* named function expression that uses its
|
||||
own name */
|
||||
#define TCF_HAS_FUNCTION_STMT 0x800 /* block contains a function statement */
|
||||
#define TCF_GENEXP_LAMBDA 0x1000 /* flag lambda from generator expression */
|
||||
#define TCF_COMPILE_N_GO 0x2000 /* compile-and-go mode of script, can
|
||||
#define TCF_HAS_FUNCTION_STMT 0x1000 /* block contains a function statement */
|
||||
#define TCF_GENEXP_LAMBDA 0x2000 /* flag lambda from generator expression */
|
||||
#define TCF_COMPILE_N_GO 0x4000 /* compile-and-go mode of script, can
|
||||
optimize name references based on scope
|
||||
chain */
|
||||
#define TCF_NO_SCRIPT_RVAL 0x4000 /* API caller does not want result value
|
||||
#define TCF_NO_SCRIPT_RVAL 0x8000 /* API caller does not want result value
|
||||
from global script */
|
||||
/* bit 0x8000 is unused */
|
||||
|
||||
/*
|
||||
* Set when parsing a declaration-like destructuring pattern. This
|
||||
* flag causes PrimaryExpr to create PN_NAME parse nodes for variable
|
||||
@ -273,6 +272,7 @@ struct StmtInfo {
|
||||
#define TCF_FUN_FLAGS (TCF_FUN_SETS_OUTER_NAME | \
|
||||
TCF_FUN_USES_ARGUMENTS | \
|
||||
TCF_FUN_PARAM_ARGUMENTS | \
|
||||
TCF_FUN_LOCAL_ARGUMENTS | \
|
||||
TCF_FUN_HEAVYWEIGHT | \
|
||||
TCF_FUN_IS_GENERATOR | \
|
||||
TCF_FUN_USES_OWN_NAME | \
|
||||
@ -434,6 +434,15 @@ struct TreeContext { /* tree context for semantic checks */
|
||||
return flags & TCF_FUN_MUTATES_PARAMETER;
|
||||
}
|
||||
|
||||
bool mayOverwriteArguments() const {
|
||||
JS_ASSERT(inFunction());
|
||||
JS_ASSERT_IF(inStrictMode(),
|
||||
!(flags & (TCF_FUN_PARAM_ARGUMENTS | TCF_FUN_LOCAL_ARGUMENTS)));
|
||||
return !inStrictMode() &&
|
||||
(callsEval() ||
|
||||
flags & (TCF_FUN_PARAM_ARGUMENTS | TCF_FUN_LOCAL_ARGUMENTS));
|
||||
}
|
||||
|
||||
void noteArgumentsNameUse(ParseNode *node) {
|
||||
JS_ASSERT(inFunction());
|
||||
JS_ASSERT(node->isKind(PNK_NAME));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user