зеркало из https://github.com/mozilla/pjs.git
Merging with M-C.
Hand merged the following files: U chrome/src/nsChromeRegistry.cpp U chrome/src/nsChromeRegistry.h U content/base/src/nsFrameLoader.cpp U content/base/src/nsFrameLoader.h U dom/src/geolocation/nsGeolocation.cpp U dom/src/geolocation/nsGeolocation.h U netwerk/build/Makefile.in U netwerk/cookie/nsCookieService.cpp U netwerk/cookie/nsCookieService.h --HG-- rename : extensions/cookie/test/unit/test_cookies.js => extensions/cookie/test/unit/test_cookies_thirdparty.js rename : netwerk/cookie/src/nsCookieService.cpp => netwerk/cookie/nsCookieService.cpp rename : netwerk/cookie/src/nsCookieService.h => netwerk/cookie/nsCookieService.h rename : netwerk/dns/src/nsIDNKitInterface.h => netwerk/dns/nsIDNKitInterface.h rename : netwerk/protocol/http/src/nsHttp.h => netwerk/protocol/http/nsHttp.h rename : netwerk/protocol/http/src/nsHttpChannel.cpp => netwerk/protocol/http/nsHttpChannel.cpp rename : netwerk/protocol/http/src/nsHttpChannel.h => netwerk/protocol/http/nsHttpChannel.h rename : netwerk/protocol/http/src/nsHttpChunkedDecoder.h => netwerk/protocol/http/nsHttpChunkedDecoder.h rename : netwerk/protocol/http/src/nsHttpHandler.cpp => netwerk/protocol/http/nsHttpHandler.cpp rename : netwerk/protocol/http/src/nsHttpHeaderArray.h => netwerk/protocol/http/nsHttpHeaderArray.h rename : netwerk/protocol/http/src/nsHttpRequestHead.h => netwerk/protocol/http/nsHttpRequestHead.h rename : netwerk/protocol/http/src/nsHttpResponseHead.h => netwerk/protocol/http/nsHttpResponseHead.h rename : netwerk/protocol/http/src/nsHttpTransaction.cpp => netwerk/protocol/http/nsHttpTransaction.cpp rename : netwerk/protocol/res/src/nsResProtocolHandler.cpp => netwerk/protocol/res/nsResProtocolHandler.cpp rename : netwerk/protocol/res/src/nsResProtocolHandler.h => netwerk/protocol/res/nsResProtocolHandler.h
This commit is contained in:
Коммит
6e5944e4fe
|
@ -74,12 +74,6 @@ ifdef COMPILE_ENVIRONMENT
|
|||
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
||||
endif
|
||||
|
||||
TIERS += testharness
|
||||
|
||||
# test harnesses
|
||||
ifdef ENABLE_TESTS
|
||||
tier_testharness_dirs += testing/xpcshell
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
|
|
|
@ -314,11 +314,16 @@ nsAccReorderEvent::HasAccessibleInReasonSubtree()
|
|||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
|
||||
nsIAccessibleStateChangeEvent)
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't currently
|
||||
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsIAccessible *aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled):
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible),
|
||||
PRBool aIsEnabled, PRBool aIsAsynch,
|
||||
EIsFromUserInput aIsFromUserInput):
|
||||
nsAccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
@ -379,12 +384,20 @@ nsAccStateChangeEvent::IsEnabled(PRBool *aIsEnabled)
|
|||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTextChangeEvent)
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't support text
|
||||
// events coalescence. We fire delayed text change events in nsDocAccessible but
|
||||
// we continue to base the event off the accessible object rather than just the
|
||||
// node. This means we won't try to create an accessible based on the node when
|
||||
// we are ready to fire the event and so we will no longer assert at that point
|
||||
// if the node was removed from the document. Either way, the AT won't work with
|
||||
// a defunct accessible so the behaviour should be equivalent.
|
||||
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
|
||||
nsAccTextChangeEvent::
|
||||
nsAccTextChangeEvent(nsIAccessible *aAccessible,
|
||||
PRInt32 aStart, PRUint32 aLength, PRBool aIsInserted,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
|
||||
nsAccEvent(aIsInserted ? nsIAccessibleEvent::EVENT_TEXT_INSERTED : nsIAccessibleEvent::EVENT_TEXT_REMOVED,
|
||||
aAccessible, aIsAsynch, aIsFromUserInput),
|
||||
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes),
|
||||
mStart(aStart), mLength(aLength), mIsInserted(aIsInserted)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -198,7 +198,8 @@ class nsAccStateChangeEvent: public nsAccEvent,
|
|||
public:
|
||||
nsAccStateChangeEvent(nsIAccessible *aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled);
|
||||
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
nsAccStateChangeEvent(nsIDOMNode *aNode,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
|
|
|
@ -983,10 +983,13 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
|
|||
{
|
||||
if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {
|
||||
// State editable will now be set, readonly is now clear
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccStateChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE, PR_TRUE);
|
||||
nsEventShell::FireEvent(event);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1489,11 +1492,14 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccTextChangeEvent(accessible, offset,
|
||||
renderedEndOffset - renderedStartOffset,
|
||||
aIsInserted, PR_FALSE);
|
||||
nsEventShell::FireEvent(event);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
||||
FireValueChangeForTextFields(accessible);
|
||||
}
|
||||
|
@ -1991,11 +1997,14 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
// XXX Collate events when a range is deleted
|
||||
// XXX We need a way to ignore SplitNode and JoinNode() when they
|
||||
// do not affect the text within the hypertext
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> textChangeEvent =
|
||||
CreateTextChangeEventForNode(containerAccessible, childNode, childAccessible,
|
||||
PR_FALSE, isAsynch);
|
||||
if (textChangeEvent) {
|
||||
nsEventShell::FireEvent(textChangeEvent);
|
||||
FireDelayedAccessibleEvent(textChangeEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ _TEST_FILES =\
|
|||
test_focusdoc.html \
|
||||
test_mutation.html \
|
||||
test_scroll.xul \
|
||||
test_statechange.html \
|
||||
test_text.html \
|
||||
test_tree.xul \
|
||||
test_valuechange.html \
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Accessible state change event testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers
|
||||
|
||||
function makeEditableDoc(aDocNode, aIsEnabled)
|
||||
{
|
||||
this.DOMNode = aDocNode;
|
||||
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_STATE_CHANGE, getAccessible(this.DOMNode))
|
||||
];
|
||||
|
||||
this.invoke = function editabledoc_invoke() {
|
||||
// Note: this should fire an EVENT_STATE_CHANGE
|
||||
this.DOMNode.designMode = 'on';
|
||||
};
|
||||
|
||||
this.check = function editabledoc_check(aEvent) {
|
||||
|
||||
testStates(aDocNode, 0, EXT_STATE_EDITABLE);
|
||||
|
||||
var event = null;
|
||||
try {
|
||||
var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
||||
} catch (e) {
|
||||
ok(false, "State change event was expected");
|
||||
}
|
||||
|
||||
if (!event) { return; }
|
||||
|
||||
ok(event.isExtraState(), "Extra state change was expected");
|
||||
is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
|
||||
ok(event.isEnabled(), "Expected editable state to be enabled");
|
||||
}
|
||||
|
||||
this.getID = function editabledoc_getID() {
|
||||
return prettyName(aDocNode) + " editable state changed";
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
// var gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
// Test delayed editable state change
|
||||
var doc = document.getElementById("iframe").contentDocument;
|
||||
gQueue.push(new makeEditableDoc(doc));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=564471"
|
||||
title="Make state change events async">
|
||||
Mozilla Bug 564471
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="testContainer">
|
||||
<iframe id="iframe"></iframe>
|
||||
</div>
|
||||
<div id="eventdump"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -22,9 +22,13 @@
|
|||
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<ms_asmv3:security>
|
||||
<ms_asmv3:requestedPrivileges>
|
||||
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false">
|
||||
</ms_asmv3:requestedExecutionLevel>
|
||||
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</ms_asmv3:requestedPrivileges>
|
||||
</ms_asmv3:security>
|
||||
</ms_asmv3:trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
|
|
|
@ -908,5 +908,6 @@ pref("browser.taskbar.lists.frequent.enabled", true);
|
|||
pref("browser.taskbar.lists.recent.enabled", false);
|
||||
pref("browser.taskbar.lists.maxListItemCount", 7);
|
||||
pref("browser.taskbar.lists.tasks.enabled", true);
|
||||
pref("browser.taskbar.lists.refreshInSeconds", 30);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<description id="copyright">
|
||||
<label
|
||||
class="text-link" href="about:license"
|
||||
>&licenseLinkText;</label>&licenseLinkSuffix;&logoTrademark;
|
||||
>&licenseLinkText;</label>&licenseLinkSuffix;&trademarkInfo;
|
||||
</description>
|
||||
<textbox id="userAgent" multiline="true" readonly="true" flex="1"/>
|
||||
</vbox>
|
||||
|
|
|
@ -2728,9 +2728,11 @@ function FillInHTMLTooltip(tipElement)
|
|||
}
|
||||
|
||||
var browserDragAndDrop = {
|
||||
canDropLink: function (aEvent) Services.droppedLinkHandler.canDropLink(aEvent, true),
|
||||
|
||||
dragOver: function (aEvent, statusString)
|
||||
{
|
||||
if (Services.droppedLinkHandler.canDropLink(aEvent, true)) {
|
||||
if (this.canDropLink(aEvent)) {
|
||||
aEvent.preventDefault();
|
||||
|
||||
if (statusString) {
|
||||
|
@ -2872,8 +2874,6 @@ var newWindowButtonObserver = {
|
|||
}
|
||||
|
||||
var DownloadsButtonDNDObserver = {
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsDragAndDrop
|
||||
onDragOver: function (aEvent)
|
||||
{
|
||||
var statusTextFld = document.getElementById("statusbar-display");
|
||||
|
@ -6085,7 +6085,7 @@ var gPluginHandler = {
|
|||
let notifications = {
|
||||
PluginBlocklisted : {
|
||||
barID : "blocked-plugins",
|
||||
iconURL : "chrome://mozapps/skin/plugins/pluginBlocked-16.png",
|
||||
iconURL : "chrome://mozapps/skin/plugins/notifyPluginBlocked.png",
|
||||
message : gNavigatorBundle.getString("blockedpluginsMessage.title"),
|
||||
buttons : [{
|
||||
label : gNavigatorBundle.getString("blockedpluginsMessage.infoButton.label"),
|
||||
|
@ -6102,7 +6102,7 @@ var gPluginHandler = {
|
|||
},
|
||||
PluginOutdated : {
|
||||
barID : "outdated-plugins",
|
||||
iconURL : "chrome://mozapps/skin/plugins/pluginOutdated-16.png",
|
||||
iconURL : "chrome://mozapps/skin/plugins/notifyPluginOutdated.png",
|
||||
message : gNavigatorBundle.getString("outdatedpluginsMessage.title"),
|
||||
buttons : [{
|
||||
label : gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.label"),
|
||||
|
@ -6113,7 +6113,7 @@ var gPluginHandler = {
|
|||
},
|
||||
PluginNotFound : {
|
||||
barID : "missing-plugins",
|
||||
iconURL : "chrome://mozapps/skin/plugins/pluginGeneric-16.png",
|
||||
iconURL : "chrome://mozapps/skin/plugins/notifyPluginGeneric.png",
|
||||
message : gNavigatorBundle.getString("missingpluginsMessage.title"),
|
||||
buttons : [{
|
||||
label : gNavigatorBundle.getString("missingpluginsMessage.button.label"),
|
||||
|
@ -6314,7 +6314,7 @@ var gPluginHandler = {
|
|||
|
||||
// Configure the notification bar
|
||||
let priority = notificationBox.PRIORITY_WARNING_MEDIUM;
|
||||
let iconURL = "chrome://mozapps/skin/plugins/pluginGeneric-16.png";
|
||||
let iconURL = "chrome://mozapps/skin/plugins/notifyPluginCrashed.png";
|
||||
let reloadLabel = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.label");
|
||||
let reloadKey = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.accesskey");
|
||||
let submitLabel = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.label");
|
||||
|
|
|
@ -102,10 +102,6 @@
|
|||
|
||||
<script type="application/javascript" src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
||||
|
||||
<!-- This is still used for dragDropSecurityCheck and transferUtils. Since we
|
||||
rely on the new Drag and Drop API these dependencies should be removed. -->
|
||||
<script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
|
||||
# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the
|
||||
# browser-sets.inc file for sharing with hiddenWindow.xul.
|
||||
#include browser-sets.inc
|
||||
|
@ -471,10 +467,7 @@
|
|||
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
|
||||
title="&locationItem.title;" class="chromeclass-location" removable="true">
|
||||
<textbox id="urlbar" flex="1"
|
||||
bookmarkhistoryplaceholder="&urlbar.bookmarkhistory.emptyText;"
|
||||
bookmarkplaceholder="&urlbar.bookmark.emptyText;"
|
||||
historyplaceholder="&urlbar.history.emptyText;"
|
||||
noneplaceholder="&urlbar.none.emptyText;"
|
||||
placeholder="&urlbar.placeholder;"
|
||||
type="autocomplete"
|
||||
autocompletesearch="history"
|
||||
autocompletesearchparam="enable-actions"
|
||||
|
@ -640,6 +633,7 @@
|
|||
class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
label="&tabCmd.label;"
|
||||
command="cmd_newNavigatorTab"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
tooltiptext="&newTabButton.tooltip;"
|
||||
ondrop="newTabButtonObserver.onDrop(event)"
|
||||
ondragover="newTabButtonObserver.onDragOver(event)"
|
||||
|
|
|
@ -87,7 +87,7 @@ function nsContextMenu(aXulMenu, aBrowser) {
|
|||
this.isContentSelected = false;
|
||||
this.shouldDisplay = true;
|
||||
this.isDesignMode = false;
|
||||
this.possibleSpellChecking = false;
|
||||
this.onEditableArea = false;
|
||||
this.ellipsis = "\u2026";
|
||||
try {
|
||||
this.ellipsis = gPrefService.getComplexValue("intl.ellipsis",
|
||||
|
@ -367,7 +367,7 @@ nsContextMenu.prototype = {
|
|||
var canSpell = InlineSpellCheckerUI.canSpellCheck;
|
||||
var onMisspelling = InlineSpellCheckerUI.overMisspelling;
|
||||
this.showItem("spell-check-enabled", canSpell);
|
||||
this.showItem("spell-separator", canSpell || this.possibleSpellChecking);
|
||||
this.showItem("spell-separator", canSpell || this.onEditableArea);
|
||||
if (canSpell) {
|
||||
document.getElementById("spell-check-enabled")
|
||||
.setAttribute("checked", InlineSpellCheckerUI.enabled);
|
||||
|
@ -395,7 +395,7 @@ nsContextMenu.prototype = {
|
|||
InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep);
|
||||
this.showItem("spell-add-dictionaries-main", false);
|
||||
}
|
||||
else if (this.possibleSpellChecking) {
|
||||
else if (this.onEditableArea) {
|
||||
// when there is no spellchecker but we might be able to spellcheck
|
||||
// add the add to dictionaries item. This will ensure that people
|
||||
// with no dictionaries will be able to download them
|
||||
|
@ -503,7 +503,7 @@ nsContextMenu.prototype = {
|
|||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.bgImageURL = "";
|
||||
this.possibleSpellChecking = false;
|
||||
this.onEditableArea = false;
|
||||
|
||||
// Clear any old spellchecking items from the menu, this used to
|
||||
// be in the menu hiding code but wasn't getting called in all
|
||||
|
@ -552,7 +552,7 @@ nsContextMenu.prototype = {
|
|||
// allow spellchecking UI on all writable text boxes except passwords
|
||||
if (this.onTextInput && ! this.target.readOnly &&
|
||||
this.target.type != "password") {
|
||||
this.possibleSpellChecking = true;
|
||||
this.onEditableArea = true;
|
||||
InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
|
||||
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ nsContextMenu.prototype = {
|
|||
else if (this.target instanceof HTMLTextAreaElement) {
|
||||
this.onTextInput = true;
|
||||
if (!this.target.readOnly) {
|
||||
this.possibleSpellChecking = true;
|
||||
this.onEditableArea = true;
|
||||
InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
|
||||
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
|
||||
}
|
||||
|
@ -662,39 +662,41 @@ nsContextMenu.prototype = {
|
|||
this.inFrame = true;
|
||||
|
||||
// if the document is editable, show context menu like in text inputs
|
||||
var win = this.target.ownerDocument.defaultView;
|
||||
if (win) {
|
||||
var isEditable = false;
|
||||
try {
|
||||
var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession);
|
||||
if (editingSession.windowIsEditable(win) &&
|
||||
this.getComputedStyle(this.target, "-moz-user-modify") == "read-write") {
|
||||
isEditable = true;
|
||||
if (!this.onEditableArea) {
|
||||
var win = this.target.ownerDocument.defaultView;
|
||||
if (win) {
|
||||
var isEditable = false;
|
||||
try {
|
||||
var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession);
|
||||
if (editingSession.windowIsEditable(win) &&
|
||||
this.getComputedStyle(this.target, "-moz-user-modify") == "read-write") {
|
||||
isEditable = true;
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
// If someone built with composer disabled, we can't get an editing session.
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
// If someone built with composer disabled, we can't get an editing session.
|
||||
}
|
||||
|
||||
if (isEditable) {
|
||||
this.onTextInput = true;
|
||||
this.onKeywordField = false;
|
||||
this.onImage = false;
|
||||
this.onLoadedImage = false;
|
||||
this.onCompletedImage = false;
|
||||
this.onMathML = false;
|
||||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.isDesignMode = true;
|
||||
this.possibleSpellChecking = true;
|
||||
InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win));
|
||||
var canSpell = InlineSpellCheckerUI.canSpellCheck;
|
||||
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
|
||||
this.showItem("spell-check-enabled", canSpell);
|
||||
this.showItem("spell-separator", canSpell);
|
||||
if (isEditable) {
|
||||
this.onTextInput = true;
|
||||
this.onKeywordField = false;
|
||||
this.onImage = false;
|
||||
this.onLoadedImage = false;
|
||||
this.onCompletedImage = false;
|
||||
this.onMathML = false;
|
||||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.isDesignMode = true;
|
||||
this.onEditableArea = true;
|
||||
InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win));
|
||||
var canSpell = InlineSpellCheckerUI.canSpellCheck;
|
||||
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
|
||||
this.showItem("spell-check-enabled", canSpell);
|
||||
this.showItem("spell-separator", canSpell);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2152,17 +2152,6 @@
|
|||
onget="return this.mCurrentBrowser.securityUI;"
|
||||
readonly="true"/>
|
||||
|
||||
<method name="dragDropSecurityCheck">
|
||||
<parameter name="aEvent"/>
|
||||
<parameter name="aDragSession"/>
|
||||
<parameter name="aUri"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
nsDragAndDrop.dragDropSecurityCheck(aEvent, aDragSession, aUri);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_handleKeyEvent">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
|
@ -2174,6 +2163,23 @@
|
|||
if (aEvent.altKey)
|
||||
return;
|
||||
|
||||
// We need to take care of FAYT-watching as long as the findbar
|
||||
// isn't initialized. The checks on aEvent are copied from
|
||||
// _shouldFastFind (see findbar.xml).
|
||||
if (!gFindBarInitialized &&
|
||||
!(aEvent.ctrlKey || aEvent.metaKey) &&
|
||||
!aEvent.getPreventDefault()) {
|
||||
let charCode = aEvent.charCode;
|
||||
if (charCode) {
|
||||
let char = String.fromCharCode(charCode);
|
||||
if (char == "'" || char == "/" ||
|
||||
Services.prefs.getBoolPref("accessibility.typeaheadfind")) {
|
||||
gFindBar._onBrowserKeypress(aEvent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (!aEvent.metaKey)
|
||||
return;
|
||||
|
@ -2424,6 +2430,7 @@
|
|||
<children/>
|
||||
<xul:toolbarbutton class="tabs-newtab-button"
|
||||
command="cmd_newNavigatorTab"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
tooltiptext="&newTabButton.tooltip;"/>
|
||||
</xul:arrowscrollbox>
|
||||
</content>
|
||||
|
@ -2511,10 +2518,6 @@
|
|||
<field name="_dragOverDelay">350</field>
|
||||
<field name="_dragTime">0</field>
|
||||
|
||||
<field name="_supportedLinkDropTypes"><![CDATA[
|
||||
["text/x-moz-url", "text/uri-list", "text/plain", "application/x-moz-file"]
|
||||
]]></field>
|
||||
|
||||
<field name="_container" readonly="true"><![CDATA[
|
||||
this.parentNode && this.parentNode.localName == "toolbar" ? this.parentNode : this;
|
||||
]]></field>
|
||||
|
@ -2592,7 +2595,7 @@
|
|||
// of the tabstrip, we need to ensure that we stay
|
||||
// completely scrolled to the right side
|
||||
var tabStrip = this.mTabstrip;
|
||||
if (tabStrip.scrollPosition + tabStrip.scrollClientSize >=
|
||||
if (tabStrip.scrollPosition + tabStrip.scrollClientSize >
|
||||
tabStrip.scrollSize)
|
||||
tabStrip.scrollByPixels(-1);
|
||||
} catch (e) {}
|
||||
|
@ -2708,11 +2711,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this._supportedLinkDropTypes.length; i++) {
|
||||
if (types.contains(this._supportedLinkDropTypes[i])) {
|
||||
// Here we need to to do this manually
|
||||
return dt.effectAllowed = dt.dropEffect = "link";
|
||||
}
|
||||
if (browserDragAndDrop.canDropLink(event)) {
|
||||
// Here we need to do this manually
|
||||
return dt.effectAllowed = dt.dropEffect = "link";
|
||||
}
|
||||
return dt.effectAllowed = "none";
|
||||
]]></body>
|
||||
|
@ -2960,20 +2961,7 @@
|
|||
// it triggers will correctly update our URL bar.
|
||||
this.tabbrowser.selectedTab = newTab;
|
||||
} else {
|
||||
let url;
|
||||
for (let i = 0; i < this._supportedLinkDropTypes.length; i++) {
|
||||
let dataType = this._supportedLinkDropTypes[i];
|
||||
// uri-list: for now, support dropping of the first URL
|
||||
// only
|
||||
let isURLList = dataType == "text/uri-list";
|
||||
let urlData = isURLList ?
|
||||
dt.mozGetDataAt("URL", 0) : dt.mozGetDataAt(dataType, 0);
|
||||
if (urlData) {
|
||||
url = transferUtils.retrieveURLFromData(urlData, isURLList ? "text/plain" : dataType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_ASSERT(url, "In the drop event, at least one mime-type should match our supported types");
|
||||
let url = browserDragAndDrop.drop(event, { });
|
||||
|
||||
// valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
|
||||
// Also disallow dropping javascript: or data: urls--bail out
|
||||
|
@ -2981,13 +2969,6 @@
|
|||
/^\s*(javascript|data):/.test(url))
|
||||
return;
|
||||
|
||||
// XXXmano: temporary fix until dragDropSecurityCheck make the
|
||||
// drag-session an optional paramter
|
||||
let dragService = Cc["@mozilla.org/widget/dragservice;1"].
|
||||
getService(Ci.nsIDragService);
|
||||
let dragSession = dragService.getCurrentSession();
|
||||
nsDragAndDrop.dragDropSecurityCheck(event, dragSession, url);
|
||||
|
||||
let bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
|
||||
if (event.shiftKey)
|
||||
|
|
|
@ -70,6 +70,7 @@ _TEST_FILES = \
|
|||
gZipOfflineChild.html^headers^ \
|
||||
gZipOfflineChild.cacheManifest \
|
||||
gZipOfflineChild.cacheManifest^headers^ \
|
||||
test_bug452451.html \
|
||||
$(NULL)
|
||||
|
||||
# The following tests are disabled because they are unreliable:
|
||||
|
@ -81,6 +82,7 @@ _TEST_FILES = \
|
|||
# 480169)
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_typeAheadFind.js \
|
||||
browser_NetworkPrioritizer.js \
|
||||
browser_allTabsPanel.js \
|
||||
browser_alltabslistener.js \
|
||||
|
|
|
@ -63,62 +63,21 @@ var gTests = [
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Put a multi-line string in the clipboard.
|
||||
info("About to put a string in clipboard");
|
||||
Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper)
|
||||
.copyString(kTestString);
|
||||
let cbHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||
getService(Ci.nsIClipboardHelper);
|
||||
|
||||
// Put a multi-line string in the clipboard.
|
||||
// Setting the clipboard value is an async OS operation, so we need to poll
|
||||
// the clipboard for valid data before going on.
|
||||
setTimeout(poll_clipboard, 100);
|
||||
}
|
||||
|
||||
var runCount = 0;
|
||||
function poll_clipboard() {
|
||||
// Poll for a maximum of 5s (each run happens after 100ms).
|
||||
if (++runCount > 50) {
|
||||
// Log the failure.
|
||||
ok(false, "Timed out while polling clipboard for pasted data");
|
||||
// Cleanup and interrupt the test.
|
||||
finish_test();
|
||||
return;
|
||||
}
|
||||
|
||||
info("Polling clipboard cycle " + runCount);
|
||||
var clip = Cc["@mozilla.org/widget/clipboard;1"].
|
||||
getService(Ci.nsIClipboard);
|
||||
var trans = Cc["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Ci.nsITransferable);
|
||||
trans.addDataFlavor("text/unicode");
|
||||
var str = new Object();
|
||||
try {
|
||||
// This code could throw if the clipboard is not set yet.
|
||||
clip.getData(trans, clip.kGlobalClipboard);
|
||||
trans.getTransferData("text/unicode", str, {});
|
||||
str = str.value.QueryInterface(Ci.nsISupportsString);
|
||||
}
|
||||
catch(ex) {}
|
||||
|
||||
if (kTestString == str) {
|
||||
next_test();
|
||||
}
|
||||
else
|
||||
setTimeout(poll_clipboard, 100);
|
||||
waitForClipboard(kTestString, function() { cbHelper.copyString(kTestString); },
|
||||
next_test, finish);
|
||||
}
|
||||
|
||||
function next_test() {
|
||||
if (gTests.length) {
|
||||
var currentTest = gTests.shift();
|
||||
test_paste(currentTest);
|
||||
}
|
||||
else {
|
||||
// No more tests to run.
|
||||
// Clear the clipboard, emptyClipboard would not clear the native one, so
|
||||
// we are setting it to an empty string.
|
||||
Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper)
|
||||
.copyString("");
|
||||
if (gTests.length)
|
||||
test_paste(gTests.shift());
|
||||
else
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
function test_paste(aCurrentTest) {
|
||||
|
|
|
@ -35,53 +35,21 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
let cbSvc = Cc["@mozilla.org/widget/clipboard;1"].
|
||||
getService(Ci.nsIClipboard);
|
||||
|
||||
let testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
|
||||
let testActionURL = "moz-action:switchtab," + testURL;
|
||||
let testTab;
|
||||
let clipboardText = "";
|
||||
let currentClipboardText = null;
|
||||
let clipboardPolls = 0;
|
||||
|
||||
// The clipboard can have a string value without it being the one we expect, so
|
||||
// we'll check the current value against the previous value to see if it changed.
|
||||
// We can do this because our expected clipboard value should be different each
|
||||
// time we wait.
|
||||
function waitForClipboard() {
|
||||
// Poll for a maximum of 5s (each run happens after 100ms).
|
||||
if (++clipboardPolls > 50) {
|
||||
// Log the failure.
|
||||
ok(false, "Timed out while polling clipboard for pasted data");
|
||||
// Cleanup and interrupt the test.
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Ci.nsITransferable);
|
||||
xferable.addDataFlavor("text/unicode");
|
||||
cbSvc.getData(xferable, cbSvc.kGlobalClipboard);
|
||||
try {
|
||||
let data = {};
|
||||
xferable.getTransferData("text/unicode", data, {});
|
||||
currentClipboardText = data.value.QueryInterface(Ci.nsISupportsString).data;
|
||||
} catch (e) {}
|
||||
|
||||
if (currentClipboardText == clipboardText) {
|
||||
setTimeout(waitForClipboard, 100);
|
||||
} else {
|
||||
clipboardText = currentClipboardText;
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
// reset clipboard polling count
|
||||
clipboardPolls = 0;
|
||||
// run next test, just assume we won't call in here without more tests
|
||||
tests.shift()();
|
||||
if (tests.length) {
|
||||
let t = tests.shift();
|
||||
waitForClipboard(t.expected, t.setup, function() {
|
||||
t.success();
|
||||
runNextTest();
|
||||
}, cleanup);
|
||||
}
|
||||
else {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
|
@ -89,65 +57,64 @@ function cleanup() {
|
|||
finish();
|
||||
}
|
||||
|
||||
// Tests in order. Some tests setup for the next actual test...
|
||||
let tests = [
|
||||
function () {
|
||||
// Set the urlbar to include the moz-action
|
||||
gURLBar.value = testActionURL;
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
{
|
||||
expected: testURL,
|
||||
setup: function() {
|
||||
gURLBar.value = testActionURL;
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
|
||||
// Focus the urlbar so we can select it all & copy
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_copy");
|
||||
waitForClipboard();
|
||||
// Focus the urlbar so we can select it all & copy
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_copy");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
}
|
||||
},
|
||||
function () {
|
||||
is(clipboardText, testURL, "Clipboard has the correct value");
|
||||
// We shouldn't have changed the value of gURLBar
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
|
||||
// Set selectionStart/End manually and make sure it matches the substring
|
||||
gURLBar.selectionStart = 0;
|
||||
gURLBar.selectionEnd = 10;
|
||||
goDoCommand("cmd_copy");
|
||||
waitForClipboard();
|
||||
{
|
||||
expected: testURL.substring(0, 10),
|
||||
setup: function() {
|
||||
// Set selectionStart/End manually and make sure it matches the substring
|
||||
gURLBar.selectionStart = 0;
|
||||
gURLBar.selectionEnd = 10;
|
||||
goDoCommand("cmd_copy");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
}
|
||||
},
|
||||
function () {
|
||||
is(clipboardText, testURL.substring(0, 10), "Clipboard has the correct value");
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
|
||||
|
||||
// Setup for cut test...
|
||||
// Select all
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_cut");
|
||||
waitForClipboard();
|
||||
{
|
||||
expected: testURL,
|
||||
setup: function() {
|
||||
// Setup for cut test...
|
||||
// Select all
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_cut");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, "", "gURLBar.value is now empty");
|
||||
}
|
||||
},
|
||||
function () {
|
||||
is(clipboardText, testURL, "Clipboard has the correct value");
|
||||
is(gURLBar.value, "", "gURLBar.value is now empty");
|
||||
{
|
||||
expected: testURL.substring(testURL.length - 10, testURL.length),
|
||||
setup: function() {
|
||||
// Reset urlbar value
|
||||
gURLBar.value = testActionURL;
|
||||
// Sanity check that we have the right value
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
|
||||
// Reset urlbar value
|
||||
gURLBar.value = testActionURL;
|
||||
// Sanity check that we have the right value
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
|
||||
// Now just select part of the value & cut that.
|
||||
gURLBar.selectionStart = testURL.length - 10;
|
||||
gURLBar.selectionEnd = testURL.length;
|
||||
|
||||
goDoCommand("cmd_cut");
|
||||
waitForClipboard();
|
||||
},
|
||||
function () {
|
||||
is(clipboardText, testURL.substring(testURL.length - 10, testURL.length),
|
||||
"Clipboard has the correct value");
|
||||
is(gURLBar.value, testURL.substring(0, testURL.length - 10), "gURLBar.value has the correct value");
|
||||
|
||||
// We're done, so just finish up
|
||||
cleanup();
|
||||
// Now just select part of the value & cut that.
|
||||
gURLBar.selectionStart = testURL.length - 10;
|
||||
gURLBar.selectionEnd = testURL.length;
|
||||
goDoCommand("cmd_cut");
|
||||
},
|
||||
success: function() {
|
||||
is(gURLBar.value, testURL.substring(0, testURL.length - 10), "gURLBar.value has the correct value");
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
|
||||
// ---- Test dragging the proxy icon ---
|
||||
var value = content.location.href;
|
||||
var urlString = value + "\n" + content.document.title;
|
||||
|
@ -24,4 +26,22 @@ function test()
|
|||
// Now, the identity information panel is opened by the proxy icon click.
|
||||
// We need to close it for next tests.
|
||||
EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
|
||||
|
||||
// now test dragging onto a tab
|
||||
var tab1 = gBrowser.addTab();
|
||||
var browser1 = gBrowser.getBrowserForTab(tab1);
|
||||
|
||||
var tab2 = gBrowser.addTab();
|
||||
var browser2 = gBrowser.getBrowserForTab(tab2);
|
||||
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
||||
browser2.addEventListener("load", function () {
|
||||
is(browser2.contentWindow.location, "http://mochi.test:8888/", "drop on tab");
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}, true);
|
||||
|
||||
EventUtils.synthesizeDrop(tab2, [[{type: "text/uri-list", data: "http://mochi.test:8888/"}]], "copy", window);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/* ***** 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 typeaheadfind test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Gavin Sharp <gavin@gavinsharp.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ok(!gFindBarInitialized, "find bar is not yet initialized");
|
||||
|
||||
let tab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab;
|
||||
tab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
ok(true, "Load listener called");
|
||||
waitForFocus(onFocus, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,<h1>A Page</h1>";
|
||||
}
|
||||
|
||||
function onFocus() {
|
||||
EventUtils.synthesizeKey("/", {});
|
||||
ok(gFindBarInitialized, "find bar is now initialized");
|
||||
gFindBar.close();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
|
@ -18,6 +18,9 @@ Browser context menu subtest.
|
|||
<source src="bogus.duh" type="video/durrrr;">
|
||||
</video>
|
||||
<iframe id="test-iframe" width="98" height="98" style="border: 1px solid black"></iframe>
|
||||
<textarea id="test-textarea">chssseesbbbie</textarea> <!-- a weird word which generates only one suggestion -->
|
||||
<div id="test-contenteditable" contenteditable="true">chssseefsbbbie</div> <!-- a more weird word which generates no suggestions -->
|
||||
<input id="test-input-spellcheck" type="text" spellcheck="true" autofocus value="prodkjfgigrty"> <!-- this one also generates one suggestion -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=452451
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 452451</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452451">Mozilla Bug 452451</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 452451 **/
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
ok(prefs.getBoolPref("javascript.options.relimit"),
|
||||
"relimit should be enabled by default");
|
||||
|
||||
/**
|
||||
* Following tests are inspired from:
|
||||
* js/src/tests/js1_5/extensions/regress-330569.js
|
||||
*/
|
||||
|
||||
var s;
|
||||
const expected = 'InternalError: regular expression too complex';
|
||||
|
||||
s = '<!DOCTYPE HTML PUBLIC>' +
|
||||
'<html>\n' +
|
||||
'<head>\n' +
|
||||
'<meta http-equiv="content-type" content="text/html">\n' +
|
||||
'<title></title>\n'+
|
||||
'</head>\n' +
|
||||
'<body>\n' +
|
||||
'<!-- hello -->\n' +
|
||||
'<script language="JavaScript">\n' +
|
||||
'var s = document. body. innerHTML;\n' +
|
||||
'var d = s. replace (/<!--(.*|\n)*-->/, "");\n' +
|
||||
'<\/script>\n' +
|
||||
'<\/body>\n' +
|
||||
'<\/html>\n';
|
||||
|
||||
try {
|
||||
/<!--(.*|\n)*-->/.exec(s);
|
||||
}
|
||||
catch(ex) {
|
||||
actual = ex;
|
||||
}
|
||||
|
||||
is(actual, expected, "reg exp too complex error should have been thrown");
|
||||
|
||||
function testre( re, n )
|
||||
{
|
||||
var txt = '';
|
||||
for (var i= 0; i <= n; ++i) {
|
||||
txt += ',';
|
||||
re.test(txt);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
testre( /(?:,*)*x/, 22 );
|
||||
}
|
||||
catch(ex) {
|
||||
actual = ex;
|
||||
}
|
||||
|
||||
is(actual, expected, "reg exp too complex error should have been thrown");
|
||||
|
||||
try {
|
||||
testre( /(?:,|,)*x/, 22 );
|
||||
}
|
||||
catch(ex) {
|
||||
actual = ex;
|
||||
}
|
||||
|
||||
is(actual, expected, "reg exp too complex error should have been thrown");
|
||||
|
||||
try {
|
||||
testre( /(?:,|,|,|,|,)*x/, 10 );
|
||||
}
|
||||
catch(ex) {
|
||||
actual = ex;
|
||||
}
|
||||
|
||||
is(actual, expected, "reg exp too complex error should have been thrown");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -49,14 +49,27 @@ function getVisibleMenuItems(aMenu) {
|
|||
key = key.toLowerCase();
|
||||
|
||||
if (item.nodeName == "menuitem") {
|
||||
ok(item.id, "child menuitem #" + i + " has an ID");
|
||||
var isSpellSuggestion = item.className == "spell-suggestion";
|
||||
if (isSpellSuggestion) {
|
||||
is(item.id, "", "child menuitem #" + i + " is a spelling suggestion");
|
||||
} else {
|
||||
ok(item.id, "child menuitem #" + i + " has an ID");
|
||||
}
|
||||
ok(item.label.length, "menuitem " + item.id + " has a label");
|
||||
ok(key, "menuitem " + item.id + " has an access key");
|
||||
if (accessKeys[key])
|
||||
ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]);
|
||||
else
|
||||
accessKeys[key] = item.id;
|
||||
items.push(item.id);
|
||||
if (isSpellSuggestion) {
|
||||
is(key, "", "Spell suggestions shouldn't have an access key");
|
||||
items.push("*" + item.label);
|
||||
} else if (item.id.indexOf("spell-check-dictionary-") != 0 &&
|
||||
item.id != "spell-no-suggestions") {
|
||||
ok(key, "menuitem " + item.id + " has an access key");
|
||||
if (accessKeys[key])
|
||||
ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]);
|
||||
else
|
||||
accessKeys[key] = item.id;
|
||||
}
|
||||
if (!isSpellSuggestion) {
|
||||
items.push(item.id);
|
||||
}
|
||||
items.push(!item.disabled);
|
||||
} else if (item.nodeName == "menuseparator") {
|
||||
ok(true, "--- seperator id is " + item.id);
|
||||
|
@ -306,7 +319,78 @@ function runTest(testNum) {
|
|||
"context-viewsource", true,
|
||||
"context-viewinfo", true]);
|
||||
closeContextMenu();
|
||||
openContextMenuFor(textarea); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 12:
|
||||
// Context menu for textarea
|
||||
checkContextMenu(["*chubbiness", true, // spelling suggestion
|
||||
"spell-add-to-dictionary", true,
|
||||
"---", null,
|
||||
"context-undo", false,
|
||||
"---", null,
|
||||
"context-cut", false,
|
||||
"context-copy", false,
|
||||
"context-paste", null, // ignore clipboard state
|
||||
"context-delete", false,
|
||||
"---", null,
|
||||
"context-selectall", true,
|
||||
"---", null,
|
||||
"spell-check-enabled", true,
|
||||
"spell-dictionaries", true,
|
||||
["spell-check-dictionary-en-US", true,
|
||||
"---", null,
|
||||
"spell-add-dictionaries", true], null]);
|
||||
|
||||
closeContextMenu();
|
||||
openContextMenuFor(contenteditable); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 13:
|
||||
// Context menu for contenteditable
|
||||
checkContextMenu(["spell-no-suggestions", false,
|
||||
"spell-add-to-dictionary", true,
|
||||
"---", null,
|
||||
"context-undo", false,
|
||||
"---", null,
|
||||
"context-cut", false,
|
||||
"context-copy", false,
|
||||
"context-paste", null, // ignore clipboard state
|
||||
"context-delete", false,
|
||||
"---", null,
|
||||
"context-selectall", true,
|
||||
"---", null,
|
||||
"spell-check-enabled", true,
|
||||
"spell-dictionaries", true,
|
||||
["spell-check-dictionary-en-US", true,
|
||||
"---", null,
|
||||
"spell-add-dictionaries", true], null]);
|
||||
|
||||
closeContextMenu();
|
||||
openContextMenuFor(inputspell); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 14:
|
||||
// Context menu for spell-check input
|
||||
checkContextMenu(["*prodigality", true, // spelling suggestion
|
||||
"spell-add-to-dictionary", true,
|
||||
"---", null,
|
||||
"context-undo", false,
|
||||
"---", null,
|
||||
"context-cut", false,
|
||||
"context-copy", false,
|
||||
"context-paste", null, // ignore clipboard state
|
||||
"context-delete", false,
|
||||
"---", null,
|
||||
"context-selectall", true,
|
||||
"---", null,
|
||||
"spell-check-enabled", true,
|
||||
"spell-dictionaries", true,
|
||||
["spell-check-dictionary-en-US", true,
|
||||
"---", null,
|
||||
"spell-add-dictionaries", true], null]);
|
||||
|
||||
closeContextMenu();
|
||||
subwindow.close();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
|
@ -331,7 +415,8 @@ function runTest(testNum) {
|
|||
|
||||
var testNum = 1;
|
||||
var subwindow, chromeWin, contextMenu;
|
||||
var text, link, mailto, input, img, canvas, video, iframe;
|
||||
var text, link, mailto, input, img, canvas, video, iframe,
|
||||
textarea, contenteditable, inputspell;
|
||||
|
||||
function startTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
@ -356,6 +441,9 @@ function startTest() {
|
|||
video_bad = subwindow.document.getElementById("test-video-bad");
|
||||
video_bad2 = subwindow.document.getElementById("test-video-bad2");
|
||||
iframe = subwindow.document.getElementById("test-iframe");
|
||||
textarea = subwindow.document.getElementById("test-textarea");
|
||||
contenteditable = subwindow.document.getElementById("test-contenteditable");
|
||||
inputspell = subwindow.document.getElementById("test-input-spellcheck");
|
||||
|
||||
contextMenu.addEventListener("popupshown", function() { runTest(++testNum); }, false);
|
||||
runTest(1);
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
this.doubleClickSelectsAll = this._prefs.getBoolPref("doubleClickSelectsAll");
|
||||
this.completeDefaultIndex = this._prefs.getBoolPref("autoFill");
|
||||
this.timeout = this._prefs.getIntPref("delay");
|
||||
this._setPlaceholder();
|
||||
|
||||
this._urlTooltip = document.getElementById("urlTooltip");
|
||||
|
||||
|
@ -407,10 +406,6 @@
|
|||
case "delay":
|
||||
this.timeout = this._prefs.getIntPref(aData);
|
||||
break;
|
||||
case "autocomplete.enabled":
|
||||
case "default.behavior":
|
||||
this._setPlaceholder();
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
|
@ -466,27 +461,6 @@
|
|||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="_setPlaceholder">
|
||||
<body><![CDATA[
|
||||
var type = "none";
|
||||
if (this._prefs.getBoolPref("autocomplete.enabled")) {
|
||||
// Bottom 2 bits of default.behavior specify history/bookmark
|
||||
switch (this._prefs.getIntPref("default.behavior") & 3) {
|
||||
case 0:
|
||||
type = "bookmarkhistory";
|
||||
break;
|
||||
case 1:
|
||||
type = "history";
|
||||
break;
|
||||
case 2:
|
||||
type = "bookmark";
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.placeholder = this.getAttribute(type + "placeholder");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_parseActionUrl">
|
||||
<parameter name="aUrl"/>
|
||||
<body><![CDATA[
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
browser.jar:
|
||||
% content browser %content/browser/ xpcnativewrappers=yes contentaccessible=yes
|
||||
% content browser %content/browser/ contentaccessible=yes
|
||||
#ifdef XP_MACOSX
|
||||
% overlay chrome://mozapps/content/downloads/downloads.xul chrome://browser/content/downloadManagerOverlay.xul
|
||||
% overlay chrome://mozapps/content/extensions/extensions.xul chrome://browser/content/extensionsManagerOverlay.xul
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
browser.jar:
|
||||
% content branding %content/branding/ xpcnativewrappers=yes
|
||||
% content branding %content/branding/
|
||||
content/branding/about.png (about.png)
|
||||
content/branding/aboutCredits.png (aboutCredits.png)
|
||||
content/branding/aboutFooter.png (aboutFooter.png)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!ENTITY brandShortName "Minefield">
|
||||
<!ENTITY brandFullName "Minefield">
|
||||
<!ENTITY vendorShortName "Mozilla">
|
||||
<!ENTITY logoTrademark " ">
|
||||
<!ENTITY trademarkInfo " ">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
browser.jar:
|
||||
% content branding %content/branding/ xpcnativewrappers=yes
|
||||
% content branding %content/branding/
|
||||
content/branding/about.png (about.png)
|
||||
content/branding/aboutCredits.png (aboutCredits.png)
|
||||
content/branding/aboutFooter.png (aboutFooter.png)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!ENTITY brandShortName "Mozilla Developer Preview">
|
||||
<!ENTITY brandFullName "Mozilla Developer Preview">
|
||||
<!ENTITY vendorShortName "mozilla.org">
|
||||
<!ENTITY logoTrademark " ">
|
||||
<!ENTITY trademarkInfo " ">
|
||||
|
||||
<!-- LOCALIZATION NOTE (releaseBaseURL): The about: page appends __MOZ_APP_VERSION__.html, e.g. 2.0.html -->
|
||||
<!ENTITY releaseBaseURL "http://www.mozilla.org/projects/devpreview/releases/">
|
||||
|
|
|
@ -114,13 +114,6 @@
|
|||
<parameter name="queries"/>
|
||||
<parameter name="options"/>
|
||||
<body><![CDATA[
|
||||
// Cleanup old result if exists.
|
||||
let oldResult = this.result;
|
||||
if (oldResult) {
|
||||
oldResult.removeObserver(this.view);
|
||||
oldResult.root.containerOpen = false;
|
||||
}
|
||||
|
||||
let result = PlacesUtils.history
|
||||
.executeQueries(queries, queries.length,
|
||||
options);
|
||||
|
@ -132,6 +125,10 @@
|
|||
}
|
||||
|
||||
let treeView = new PlacesTreeView(this.flatList, callback);
|
||||
|
||||
// Observer removal is done within the view itself. When the tree
|
||||
// goes away, treeboxobject calls view.setTree(null), which then
|
||||
// calls removeObserver.
|
||||
result.addObserver(treeView, false);
|
||||
this.view = treeView;
|
||||
if (!this._controller) {
|
||||
|
|
|
@ -151,15 +151,15 @@ PlacesTreeView.prototype = {
|
|||
* If true, the row will be computed even if the node still isn't set
|
||||
* in our rows array.
|
||||
* @param [optional] aParentRow
|
||||
* The row of aNode's parent.
|
||||
* DO NOT compute this yourself for the purpose of calling this
|
||||
* function. However, do pass it if you have it handy.
|
||||
* Ignored for the root node.
|
||||
* The row of aNode's parent. Ignored for the root node.
|
||||
* @param [optional] aNodeIndex
|
||||
* The index of aNode in its parent. Only used if aParentRow is
|
||||
* set too.
|
||||
*
|
||||
* @throws if aNode is invisible.
|
||||
* @note If aParentRow and aNodeIndex are passed and parent is a plain
|
||||
* container, this method will just return a calculated row value, without
|
||||
* making assumptions on existence of the node at that position.
|
||||
* @return aNode's row if it's in the rows list or if aForceBuild is set, -1
|
||||
* otherwise.
|
||||
*/
|
||||
|
@ -168,11 +168,14 @@ PlacesTreeView.prototype = {
|
|||
if (aNode == this._rootNode)
|
||||
throw "The root node is never visible";
|
||||
|
||||
let parent = aNode.parent;
|
||||
if (!parent || !parent.containerOpen)
|
||||
throw "Invisible node passed to _getRowForNode";
|
||||
let ancestors = PlacesUtils.nodeAncestors(aNode);
|
||||
for (let ancestor in ancestors) {
|
||||
if (!ancestor.containerOpen)
|
||||
throw "Invisible node passed to _getRowForNode";
|
||||
}
|
||||
|
||||
// Non-plain containers are initially built with their contents.
|
||||
let parent = aNode.parent;
|
||||
let parentIsPlain = this._isPlainContainer(parent);
|
||||
if (!parentIsPlain) {
|
||||
if (parent == this._rootNode)
|
||||
|
@ -384,7 +387,7 @@ PlacesTreeView.prototype = {
|
|||
nodesInfo.push({
|
||||
node: this._rows[i],
|
||||
oldRow: i,
|
||||
wasVisbile: i >= firstVisibleRow && i <= lastVisibleRow
|
||||
wasVisible: i >= firstVisibleRow && i <= lastVisibleRow
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +683,9 @@ PlacesTreeView.prototype = {
|
|||
this._result.sortingMode != Ci.nsINavHistoryQueryOptions.SORT_BY_NONE)
|
||||
return;
|
||||
|
||||
let oldRow = this._getRowForNode(aNode, true);
|
||||
let parentRow = aParentNode == this._rootNode ?
|
||||
undefined : this._getRowForNode(aParentNode, true);
|
||||
let oldRow = this._getRowForNode(aNode, true, parentRow, aOldIndex);
|
||||
if (oldRow < 0)
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
@ -712,7 +717,7 @@ PlacesTreeView.prototype = {
|
|||
return;
|
||||
|
||||
// Restore selection.
|
||||
let rowToSelect = Math.min(oldRow, this._rows.length - 1);
|
||||
let rowToSelect = Math.min(oldRow, this._rows.length - 1);
|
||||
this.selection.rangedSelect(rowToSelect, rowToSelect, true);
|
||||
},
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ _CHROME_TEST_FILES = \
|
|||
test_bug427633_no_newfolder_if_noip.xul \
|
||||
test_0_multiple_left_pane.xul \
|
||||
test_0_bug510634.xul \
|
||||
test_bug549192.xul \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_CHROME_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="549192: History view not updated after deleting entry"
|
||||
onload="runTest();">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" />
|
||||
|
||||
<tree id="tree"
|
||||
type="places"
|
||||
flatList="true"
|
||||
flex="1">
|
||||
<treecols>
|
||||
<treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
|
||||
</treecols>
|
||||
<treechildren flex="1"/>
|
||||
</tree>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
/**
|
||||
* Bug 549192
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=549192
|
||||
*
|
||||
* Ensures that history views are updated after deleting entries.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// Cleanup.
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
|
||||
// Add some visits.
|
||||
let vtime = Date.now() * 1000;
|
||||
const ttype = PlacesUtils.history.TRANSITION_TYPED;
|
||||
PlacesUtils.history
|
||||
.addVisit(Services.io.newURI("http://example.tld/", null, null),
|
||||
vtime, null, ttype, false, 0);
|
||||
PlacesUtils.history
|
||||
.addVisit(Services.io.newURI("http://example2.tld/", null, null),
|
||||
vtime++, null, ttype, false, 0);
|
||||
PlacesUtils.history
|
||||
.addVisit(Services.io.newURI("http://exmample3.tld/", null, null),
|
||||
vtime++, null, ttype, false, 0);
|
||||
|
||||
// Make a history query.
|
||||
let query = PlacesUtils.history.getNewQuery();
|
||||
let opts = PlacesUtils.history.getNewQueryOptions();
|
||||
let queryURI = PlacesUtils.history.queriesToQueryString([query], 1, opts);
|
||||
|
||||
// Setup the places tree contents.
|
||||
var tree = document.getElementById("tree");
|
||||
tree.place = queryURI;
|
||||
|
||||
// loop through the rows and check formatting
|
||||
let treeView = tree.view;
|
||||
let rc = treeView.rowCount;
|
||||
ok(rc == 3, "Rows found.");
|
||||
let selection = treeView.selection;
|
||||
for (let i = 0; i < rc; i++) {
|
||||
selection.select(0);
|
||||
let node = tree.selectedNode;
|
||||
tree.controller.remove("Removing page");
|
||||
ok(treeView.treeIndexForNode(node) == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE,
|
||||
node.uri + " removed.");
|
||||
ok(treeView.rowCount == rc - i - 1, "Rows count decreased");
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
]]></script>
|
||||
</window>
|
|
@ -41,7 +41,6 @@ function test() {
|
|||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_locbar_placeholder,
|
||||
test_pane_visibility,
|
||||
test_dependent_elements,
|
||||
test_dependent_cookie_elements,
|
||||
|
|
|
@ -65,20 +65,6 @@ function controlChanged(element) {
|
|||
element.doCommand();
|
||||
}
|
||||
|
||||
function test_locbar_placeholder(win) {
|
||||
let texts = ["none", "bookmarkhistory", "history", "bookmark"];
|
||||
|
||||
let locbarlist = win.document.getElementById("locationBarSuggestion");
|
||||
ok(locbarlist, "location bar suggestion menulist should exist");
|
||||
|
||||
for (let level = -1; level <= 2; ++level) {
|
||||
locbarlist.value = level;
|
||||
controlChanged(locbarlist);
|
||||
is(gURLBar.placeholder, gURLBar.getAttribute(texts[level + 1] + "placeholder"),
|
||||
"location bar placeholder for for level " + level + " is correctly set");
|
||||
}
|
||||
}
|
||||
|
||||
function test_pane_visibility(win) {
|
||||
let modes = {
|
||||
"remember": "historyRememberPane",
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
<head>
|
||||
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all"/>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
|
||||
<style type="text/css"><![CDATA[
|
||||
body.normal .showPrivate,
|
||||
body.private .showNormal {
|
||||
display: none;
|
||||
}
|
||||
]]></style>
|
||||
<script type="application/javascript;version=1.7"><![CDATA[
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -96,19 +102,9 @@
|
|||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
let selector;
|
||||
if (!pb.privateBrowsingEnabled) {
|
||||
document.body.setAttribute("class", "normal");
|
||||
selector = ".showPrivate";
|
||||
}
|
||||
else {
|
||||
selector = ".showNormal";
|
||||
}
|
||||
|
||||
// Remove hidden elements to avoid bug 39098
|
||||
let elements = document.body.querySelectorAll(selector);
|
||||
for (let i = 0; i < elements.length; ++ i)
|
||||
elements[i].parentNode.removeChild(elements[i]);
|
||||
|
||||
// Set up the help link
|
||||
let moreInfoURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
|
|
|
@ -49,8 +49,19 @@ function test() {
|
|||
let panel = document.getElementById("download-monitor");
|
||||
waitForExplicitFinish();
|
||||
|
||||
let acceptDialog = 0;
|
||||
let confirmCalls = 0;
|
||||
function promptObserver(aSubject, aTopic, aData) {
|
||||
let dialogWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
confirmCalls++;
|
||||
if (acceptDialog-- > 0)
|
||||
dialogWin.document.documentElement.getButton("accept").click();
|
||||
}
|
||||
|
||||
Services.obs.addObserver(promptObserver, "common-dialog-loaded", false);
|
||||
|
||||
// Add a new download
|
||||
addDownload(dm, {
|
||||
let [file, persist] = addDownload(dm, {
|
||||
resultFileName: "pbtest-1",
|
||||
downloadName: "PB Test 1"
|
||||
});
|
||||
|
@ -63,16 +74,19 @@ function test() {
|
|||
ok(!panel.hidden, "The download panel should be successfully added initially");
|
||||
|
||||
// Enter the private browsing mode
|
||||
acceptDialog = 1;
|
||||
pb.privateBrowsingEnabled = true;
|
||||
is(confirmCalls, 1, "One prompt was accepted");
|
||||
ok(pb.privateBrowsingEnabled, "The private browsing transition was successful");
|
||||
|
||||
setTimeout(function () {
|
||||
executeSoon(function () {
|
||||
ok(panel.hidden, "The download panel should be hidden when entering the private browsing mode");
|
||||
|
||||
// Add a new download
|
||||
let file = addDownload(dm, {
|
||||
let [file2, persist2] = addDownload(dm, {
|
||||
resultFileName: "pbtest-2",
|
||||
downloadName: "PB Test 2"
|
||||
}).targetFile;
|
||||
});
|
||||
|
||||
// Update the panel
|
||||
DownloadMonitorPanel.updateStatus();
|
||||
|
@ -81,9 +95,12 @@ function test() {
|
|||
ok(!panel.hidden, "The download panel should show up when a new download is added");
|
||||
|
||||
// Exit the private browsing mode
|
||||
acceptDialog = 1;
|
||||
pb.privateBrowsingEnabled = false;
|
||||
is(confirmCalls, 2, "One prompt was accepted");
|
||||
ok(!pb.privateBrowsingEnabled, "The private browsing transition was successful");
|
||||
|
||||
setTimeout(function () {
|
||||
executeSoon(function () {
|
||||
ok(panel.hidden, "The download panel should be hidden when leaving the private browsing mode");
|
||||
|
||||
// cleanup
|
||||
|
@ -98,9 +115,10 @@ function test() {
|
|||
if (file.exists())
|
||||
file.remove(false);
|
||||
|
||||
Services.obs.removeObserver(promptObserver, "common-dialog-loaded", false);
|
||||
finish();
|
||||
}, 0);
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,7 +172,7 @@ function addDownload(dm, aParams)
|
|||
persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
|
||||
persist.saveURI(dl.source, null, null, null, null, dl.targetFile);
|
||||
|
||||
return dl;
|
||||
return [dl.targetFile, persist];
|
||||
}
|
||||
|
||||
function createURI(aObj) {
|
||||
|
|
|
@ -55,5 +55,6 @@ function handleRequest(request, response) {
|
|||
}
|
||||
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setHeader("Accept-Ranges", "none", false);
|
||||
stall();
|
||||
}
|
||||
|
|
|
@ -465,29 +465,8 @@ EngineView.prototype = {
|
|||
this.tree.ensureRowIsVisible(index);
|
||||
},
|
||||
|
||||
getSourceIndexFromDrag: function () {
|
||||
var dragService = Cc["@mozilla.org/widget/dragservice;1"].
|
||||
getService().QueryInterface(Ci.nsIDragService);
|
||||
var dragSession = dragService.getCurrentSession();
|
||||
var transfer = Cc["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Ci.nsITransferable);
|
||||
|
||||
transfer.addDataFlavor(ENGINE_FLAVOR);
|
||||
dragSession.getData(transfer, 0);
|
||||
|
||||
var dataObj = {};
|
||||
var len = {};
|
||||
var sourceIndex = -1;
|
||||
try {
|
||||
transfer.getAnyTransferData({}, dataObj, len);
|
||||
} catch (ex) {}
|
||||
|
||||
if (dataObj.value) {
|
||||
sourceIndex = dataObj.value.QueryInterface(Ci.nsISupportsString).data;
|
||||
sourceIndex = parseInt(sourceIndex.substring(0, len.value));
|
||||
}
|
||||
|
||||
return sourceIndex;
|
||||
getSourceIndexFromDrag: function (dataTransfer) {
|
||||
return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
|
||||
},
|
||||
|
||||
// nsITreeView
|
||||
|
@ -513,15 +492,15 @@ EngineView.prototype = {
|
|||
this.tree = tree;
|
||||
},
|
||||
|
||||
canDrop: function(targetIndex, orientation) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag();
|
||||
canDrop: function(targetIndex, orientation, dataTransfer) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
|
||||
return (sourceIndex != -1 &&
|
||||
sourceIndex != targetIndex &&
|
||||
sourceIndex != (targetIndex + orientation));
|
||||
},
|
||||
|
||||
drop: function(dropIndex, orientation) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag();
|
||||
drop: function(dropIndex, orientation, dataTransfer) {
|
||||
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
|
||||
var sourceEngine = this._engineStore.engines[sourceIndex];
|
||||
|
||||
if (dropIndex > sourceIndex) {
|
||||
|
|
|
@ -52,9 +52,7 @@ const PREF_TASKBAR_ITEMCOUNT = "maxListItemCount";
|
|||
const PREF_TASKBAR_FREQUENT = "frequent.enabled";
|
||||
const PREF_TASKBAR_RECENT = "recent.enabled";
|
||||
const PREF_TASKBAR_TASKS = "tasks.enabled";
|
||||
|
||||
// The amount of time between updates for jump lists
|
||||
const TIMER_TASKBAR_REFRESH = 1000*60*2; // 2 min.
|
||||
const PREF_TASKBAR_REFRESH = "refreshInSeconds";
|
||||
|
||||
/**
|
||||
* Exports
|
||||
|
@ -105,6 +103,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "_winShellService",
|
|||
"@mozilla.org/browser/shell-service;1",
|
||||
"nsIWindowsShellService");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "_privateBrowsingSvc",
|
||||
"@mozilla.org/privatebrowsing;1",
|
||||
"nsIPrivateBrowsingService");
|
||||
|
||||
/**
|
||||
* Global functions
|
||||
*/
|
||||
|
@ -147,6 +149,26 @@ var tasksCfg = [
|
|||
open: true,
|
||||
close: false, // no point
|
||||
},
|
||||
|
||||
// Privacy mode
|
||||
{
|
||||
get title() {
|
||||
if (_privateBrowsingSvc.privateBrowsingEnabled)
|
||||
return _getString("taskbar.tasks.exitPrivacyMode.label");
|
||||
else
|
||||
return _getString("taskbar.tasks.enterPrivacyMode.label");
|
||||
},
|
||||
get description() {
|
||||
if (_privateBrowsingSvc.privateBrowsingEnabled)
|
||||
return _getString("taskbar.tasks.exitPrivacyMode.description");
|
||||
else
|
||||
return _getString("taskbar.tasks.enterPrivacyMode.description");
|
||||
},
|
||||
args: "-private-toggle",
|
||||
iconIndex: 0, // Fx app icon
|
||||
open: true,
|
||||
close: true,
|
||||
},
|
||||
];
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -193,12 +215,6 @@ var WinTaskbarJumpList =
|
|||
if (!this._enabled)
|
||||
return;
|
||||
|
||||
// hide jump lists when we're enabled and in private browsing mode
|
||||
if (this._inPrivateBrowsing) {
|
||||
this._deleteActiveJumpList();
|
||||
return;
|
||||
}
|
||||
|
||||
// do what we came here to do, update the taskbar jumplist
|
||||
this._buildList();
|
||||
},
|
||||
|
@ -228,16 +244,15 @@ var WinTaskbarJumpList =
|
|||
if (!this._startBuild())
|
||||
return;
|
||||
|
||||
if (this._showTasks && !this._buildTasks())
|
||||
return;
|
||||
if (this._showTasks)
|
||||
this._buildTasks();
|
||||
|
||||
// Space for frequent items takes priority over recent.
|
||||
|
||||
if (this._showFrequent && !this._buildFrequent())
|
||||
return;
|
||||
if (this._showFrequent)
|
||||
this._buildFrequent();
|
||||
|
||||
if (this._showRecent && !this._buildRecent())
|
||||
return;
|
||||
if (this._showRecent)
|
||||
this._buildRecent();
|
||||
|
||||
this._commitBuild();
|
||||
},
|
||||
|
@ -274,16 +289,13 @@ var WinTaskbarJumpList =
|
|||
items.appendElement(item, false);
|
||||
}, this);
|
||||
|
||||
if (items.length == 0)
|
||||
return true;
|
||||
|
||||
return this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||
if (items.length > 0)
|
||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||
},
|
||||
|
||||
_buildCustom: function WTBJL__buildCustom(title, items) {
|
||||
if (items.length == 0)
|
||||
return true;
|
||||
return this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||
if (items.length > 0)
|
||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||
},
|
||||
|
||||
_buildFrequent: function WTBJL__buildFrequent() {
|
||||
|
@ -297,7 +309,7 @@ var WinTaskbarJumpList =
|
|||
var list = this._getNavFrequent(this._maxItemCount);
|
||||
|
||||
if (!list || list.length == 0)
|
||||
return true;
|
||||
return;
|
||||
|
||||
// track frequent items so that we don't add them to
|
||||
// the recent list.
|
||||
|
@ -308,7 +320,7 @@ var WinTaskbarJumpList =
|
|||
items.appendElement(shortcut, false);
|
||||
this._frequentHashList.push(entry.uri);
|
||||
}, this);
|
||||
return this._buildCustom(_getString("taskbar.frequent.label"), items);
|
||||
this._buildCustom(_getString("taskbar.frequent.label"), items);
|
||||
},
|
||||
|
||||
_buildRecent: function WTBJL__buildRecent() {
|
||||
|
@ -317,7 +329,7 @@ var WinTaskbarJumpList =
|
|||
var list = this._getNavRecent(this._maxItemCount*2);
|
||||
|
||||
if (!list || list.length == 0)
|
||||
return true;
|
||||
return;
|
||||
|
||||
let count = 0;
|
||||
for (let idx = 0; idx < list.length; idx++) {
|
||||
|
@ -333,11 +345,11 @@ var WinTaskbarJumpList =
|
|||
items.appendElement(shortcut, false);
|
||||
count++;
|
||||
}
|
||||
return this._buildCustom(_getString("taskbar.recent.label"), items);
|
||||
this._buildCustom(_getString("taskbar.recent.label"), items);
|
||||
},
|
||||
|
||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
||||
return this._builder.deleteActiveList();
|
||||
this._builder.deleteActiveList();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -444,7 +456,7 @@ var WinTaskbarJumpList =
|
|||
try { // in case we get a bad uri
|
||||
let uriSpec = oldItem.app.getParameter(0);
|
||||
_navHistoryService.QueryInterface(Ci.nsIBrowserHistory).removePage(
|
||||
_ioService.newURI(uriSpec));
|
||||
_ioService.newURI(uriSpec, null, null));
|
||||
} catch (err) { }
|
||||
}
|
||||
}
|
||||
|
@ -460,11 +472,6 @@ var WinTaskbarJumpList =
|
|||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||
this._showTasks = _prefs.getBoolPref(PREF_TASKBAR_TASKS);
|
||||
this._maxItemCount = _prefs.getIntPref(PREF_TASKBAR_ITEMCOUNT);
|
||||
|
||||
// retrieve the initial status of the Private Browsing mode.
|
||||
this._inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService).
|
||||
privateBrowsingEnabled;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -482,18 +489,22 @@ var WinTaskbarJumpList =
|
|||
_initObs: function WTBJL__initObs() {
|
||||
_observerService.addObserver(this, "private-browsing", false);
|
||||
_observerService.addObserver(this, "quit-application-granted", false);
|
||||
_observerService.addObserver(this, "browser:purge-session-history", false);
|
||||
_prefs.addObserver("", this, false);
|
||||
},
|
||||
|
||||
_freeObs: function WTBJL__freeObs() {
|
||||
_observerService.removeObserver(this, "private-browsing");
|
||||
_observerService.removeObserver(this, "quit-application-granted");
|
||||
_observerService.removeObserver(this, "browser:purge-session-history");
|
||||
_prefs.removeObserver("", this);
|
||||
},
|
||||
|
||||
_initTimer: function WTBJL__initTimer(aTimer) {
|
||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._timer.initWithCallback(this, TIMER_TASKBAR_REFRESH, this._timer.TYPE_REPEATING_SLACK);
|
||||
this._timer.initWithCallback(this,
|
||||
_prefs.getIntPref(PREF_TASKBAR_REFRESH)*1000,
|
||||
this._timer.TYPE_REPEATING_SLACK);
|
||||
},
|
||||
|
||||
_free: function WTBJL__free() {
|
||||
|
@ -513,6 +524,8 @@ var WinTaskbarJumpList =
|
|||
observe: function WTBJL_observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "nsPref:changed":
|
||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||
this._deleteActiveJumpList();
|
||||
this._refreshPrefs();
|
||||
this.update();
|
||||
break;
|
||||
|
@ -526,14 +539,6 @@ var WinTaskbarJumpList =
|
|||
break;
|
||||
|
||||
case "private-browsing":
|
||||
switch (aData) {
|
||||
case "enter":
|
||||
this._inPrivateBrowsing = true;
|
||||
break;
|
||||
case "exit":
|
||||
this._inPrivateBrowsing = false;
|
||||
break;
|
||||
}
|
||||
this.update();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,10 @@ ifdef MOZ_UPDATER
|
|||
DEFINES += -DMOZ_UPDATER=1
|
||||
endif
|
||||
|
||||
ifdef _MSC_VER
|
||||
DEFINES += -D_MSC_VER=$(_MSC_VER)
|
||||
endif
|
||||
|
||||
# Don't ifdef MOZ_IPC this because mac ppc needs it too.
|
||||
include $(topsrcdir)/ipc/app/defs.mk
|
||||
DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
|
|
|
@ -57,10 +57,20 @@
|
|||
@BINPATH@/mozce_shunt.dll
|
||||
#elifdef XP_WIN32
|
||||
#ifndef MOZ_MEMORY
|
||||
#if _MSC_VER == 1400
|
||||
@BINPATH@/Microsoft.VC80.CRT.manifest
|
||||
@BINPATH@/msvcm80.dll
|
||||
@BINPATH@/msvcp80.dll
|
||||
@BINPATH@/msvcr80.dll
|
||||
#elif _MSC_VER == 1500
|
||||
@BINPATH@/Microsoft.VC90.CRT.manifest
|
||||
@BINPATH@/msvcm90.dll
|
||||
@BINPATH@/msvcp90.dll
|
||||
@BINPATH@/msvcr90.dll
|
||||
#elif _MSC_VER == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
#endif
|
||||
#else
|
||||
@BINPATH@/mozcrt19.dll
|
||||
@BINPATH@/mozcpp19.dll
|
||||
|
@ -313,6 +323,7 @@
|
|||
@BINPATH@/components/nsWebHandlerApp.js
|
||||
@BINPATH@/components/nsBadCertHandler.js
|
||||
@BINPATH@/components/nsFormAutoComplete.js
|
||||
@BINPATH@/components/nsFormHistory.js
|
||||
@BINPATH@/components/contentSecurityPolicy.js
|
||||
@BINPATH@/components/contentAreaDropListener.js
|
||||
#ifdef XP_MACOSX
|
||||
|
|
|
@ -81,10 +81,15 @@ extensions/talkback@mozilla.org/components/qfaservices.xpt
|
|||
extensions/talkback@mozilla.org/install.rdf
|
||||
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/
|
||||
extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/install.rdf
|
||||
greprefs/all.js
|
||||
greprefs/security-prefs.js
|
||||
greprefs/xpinstall.js
|
||||
install.rdf
|
||||
modules/JSON.jsm
|
||||
mozilla-runtime@BIN_SUFFIX@
|
||||
old-homepage-default.properties
|
||||
res/arrow.gif
|
||||
res/arrowd.gif
|
||||
res/broken-image.gif
|
||||
res/broken-image.png
|
||||
res/charsetData.properties
|
||||
|
@ -699,9 +704,6 @@ xpicleanup@BIN_SUFFIX@
|
|||
components/xultmpl.xpt
|
||||
components/zipwriter.xpt
|
||||
extensions/inspector@mozilla.org/chrome/chromelist.txt
|
||||
greprefs/all.js
|
||||
greprefs/security-prefs.js
|
||||
greprefs/xpinstall.js
|
||||
init.d/README
|
||||
libwidget.rsrc
|
||||
plugins/Default Plugin.plugin/Contents/Info.plist
|
||||
|
|
|
@ -229,10 +229,7 @@
|
|||
<!ENTITY showAllHistoryCmd.commandkey "H">
|
||||
|
||||
<!ENTITY openCmd.commandkey "l">
|
||||
<!ENTITY urlbar.bookmarkhistory.emptyText "Search Bookmarks and History">
|
||||
<!ENTITY urlbar.bookmark.emptyText "Search Bookmarks">
|
||||
<!ENTITY urlbar.history.emptyText "Search History">
|
||||
<!ENTITY urlbar.none.emptyText "Type a Web address">
|
||||
<!ENTITY urlbar.placeholder "Go to a Web Site">
|
||||
<!ENTITY urlbar.accesskey "d">
|
||||
<!ENTITY urlbar.switchToTab.label "Switch to tab:">
|
||||
|
||||
|
|
|
@ -2,5 +2,9 @@ taskbar.tasks.newTab.label=Open new tab
|
|||
taskbar.tasks.newTab.description=Open a new browser tab.
|
||||
taskbar.tasks.newWindow.label=Open new window
|
||||
taskbar.tasks.newWindow.description=Open a new browser window.
|
||||
taskbar.tasks.enterPrivacyMode.label=Enter private browsing
|
||||
taskbar.tasks.enterPrivacyMode.description=Start private browsing. The current session will be saved.
|
||||
taskbar.tasks.exitPrivacyMode.label=Quit private browsing
|
||||
taskbar.tasks.exitPrivacyMode.description=Quit private browsing and restore the previous session.
|
||||
taskbar.frequent.label=Frequent
|
||||
taskbar.recent.label=Recent
|
||||
|
|
|
@ -1445,11 +1445,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
|||
color: MenuText;
|
||||
}
|
||||
|
||||
/* Bug 413060, comment 14: Match #identity-box's -moz-margin-start, less 1px */
|
||||
#identity-popup:-moz-locale-dir(ltr):-moz-system-metric(windows-default-theme) {
|
||||
-moz-margin-start: 3px;
|
||||
}
|
||||
|
||||
#identity-popup-container {
|
||||
min-width: 280px;
|
||||
padding: 9px;
|
||||
|
|
|
@ -18,14 +18,14 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r
|
|||
|
||||
if test x$libIDL_config_exec_prefix != x ; then
|
||||
libIDL_config_args="$libIDL_config_args --exec-prefix=$libIDL_config_exec_prefix"
|
||||
if test x${LIBIDL_CONFIG+set} != xset ; then
|
||||
LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config
|
||||
if test x${HOST_LIBIDL_CONFIG+set} != xset ; then
|
||||
HOST_LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config
|
||||
fi
|
||||
fi
|
||||
if test x$libIDL_config_prefix != x ; then
|
||||
libIDL_config_args="$libIDL_config_args --prefix=$libIDL_config_prefix"
|
||||
if test x${LIBIDL_CONFIG+set} != xset ; then
|
||||
LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config
|
||||
if test x${HOST_LIBIDL_CONFIG+set} != xset ; then
|
||||
HOST_LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -34,30 +34,26 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r
|
|||
dnl Force a version check to keep upgraded versions from being overridden by the cached value.
|
||||
unset ac_cv_path_LIBIDL_CONFIG
|
||||
|
||||
AC_PATH_PROG(LIBIDL_CONFIG, libIDL-config, no)
|
||||
AC_PATH_PROG(HOST_LIBIDL_CONFIG, libIDL-config, no)
|
||||
min_libIDL_version=ifelse([$1], ,0.6.0,$1)
|
||||
AC_MSG_CHECKING(for libIDL - version >= $min_libIDL_version)
|
||||
no_libIDL=""
|
||||
if test "$LIBIDL_CONFIG" = "no" ; then
|
||||
if test "$HOST_LIBIDL_CONFIG" = "no" ; then
|
||||
no_libIDL=yes
|
||||
else
|
||||
LIBIDL_CFLAGS=`$LIBIDL_CONFIG $libIDL_config_args --cflags`
|
||||
LIBIDL_LIBS=`$LIBIDL_CONFIG $libIDL_config_args --libs`
|
||||
# hack to allow us to keep using libIDL 0.6.3-0.6.7. Anyone may remove
|
||||
# this after we start requiring libIDL 0.6.8 or anything higher
|
||||
LIBIDL_CFLAGS="$GLIB_CFLAGS $LIBIDL_CFLAGS"
|
||||
LIBIDL_LIBS="$GLIB_LIBS $LIBIDL_LIBS"
|
||||
libIDL_config_major_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
HOST_LIBIDL_CFLAGS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --cflags`
|
||||
HOST_LIBIDL_LIBS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --libs`
|
||||
libIDL_config_major_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
libIDL_config_minor_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
libIDL_config_minor_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
libIDL_config_micro_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
libIDL_config_micro_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_libIDLtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $LIBIDL_CFLAGS"
|
||||
LIBS="$LIBIDL_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS"
|
||||
LIBS="$HOST_LIBIDL_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed LIBIDL is sufficiently new.
|
||||
dnl
|
||||
|
@ -154,7 +150,7 @@ main ()
|
|||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$LIBIDL_CONFIG" = "no" ; then
|
||||
if test "$HOST_LIBIDL_CONFIG" = "no" ; then
|
||||
echo "*** The libIDL-config script installed by libIDL could not be found"
|
||||
echo "*** If libIDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the LIBIDL_CONFIG environment variable to the"
|
||||
|
@ -164,8 +160,8 @@ main ()
|
|||
:
|
||||
else
|
||||
echo "*** Could not run libIDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $LIBIDL_CFLAGS"
|
||||
LIBS="$LIBS $LIBIDL_LIBS"
|
||||
CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS"
|
||||
LIBS="$LIBS $HOST_LIBIDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -188,11 +184,11 @@ main ()
|
|||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
LIBIDL_CFLAGS=""
|
||||
LIBIDL_LIBS=""
|
||||
HOST_LIBIDL_CFLAGS=""
|
||||
HOST_LIBIDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(LIBIDL_CFLAGS)
|
||||
AC_SUBST(LIBIDL_LIBS)
|
||||
AC_SUBST(HOST_LIBIDL_CFLAGS)
|
||||
AC_SUBST(HOST_LIBIDL_LIBS)
|
||||
rm -f conf.libIDLtest
|
||||
])
|
||||
|
|
|
@ -9,7 +9,7 @@ AC_DEFUN(AM_PATH_NSS,
|
|||
[dnl
|
||||
|
||||
AC_ARG_WITH(nss-prefix,
|
||||
[ --with-nss-prefix=PFX Prefix where NSS is installed],
|
||||
[ --with-nss-prefix=PFX Prefix where NSS is installed],
|
||||
nss_config_prefix="$withval",
|
||||
nss_config_prefix="")
|
||||
|
||||
|
|
|
@ -54,86 +54,25 @@ class FileError(Exception):
|
|||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
class myProc(Thread):
|
||||
def __init__(self, hostip, hostport, cmd, new_line = True, sleeptime = 0):
|
||||
self.cmdline = cmd
|
||||
self.newline = new_line
|
||||
self.sleep = sleeptime
|
||||
self.host = hostip
|
||||
self.port = hostport
|
||||
Thread.__init__(self)
|
||||
|
||||
def run(self):
|
||||
promptre =re.compile('.*\$\>.$')
|
||||
data = ""
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
except:
|
||||
return None
|
||||
|
||||
try:
|
||||
s.connect((self.host, int(self.port)))
|
||||
except:
|
||||
s.close()
|
||||
return None
|
||||
|
||||
try:
|
||||
s.recv(1024)
|
||||
except:
|
||||
s.close()
|
||||
return None
|
||||
|
||||
for cmd in self.cmdline:
|
||||
if (cmd == 'quit'): break
|
||||
if self.newline: cmd += '\r\n'
|
||||
try:
|
||||
s.send(cmd)
|
||||
except:
|
||||
s.close()
|
||||
return None
|
||||
|
||||
time.sleep(int(self.sleep))
|
||||
|
||||
found = False
|
||||
while (found == False):
|
||||
try:
|
||||
temp = s.recv(1024)
|
||||
except:
|
||||
s.close()
|
||||
return None
|
||||
|
||||
lines = temp.split('\n')
|
||||
for line in lines:
|
||||
if (promptre.match(line)):
|
||||
found = True
|
||||
data += temp
|
||||
|
||||
try:
|
||||
s.send('quit\r\n')
|
||||
except:
|
||||
s.close()
|
||||
return None
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
return None
|
||||
return data
|
||||
|
||||
class DeviceManager:
|
||||
host = ''
|
||||
port = 0
|
||||
debug = 3
|
||||
_redo = False
|
||||
deviceRoot = '/tests'
|
||||
deviceRoot = None
|
||||
tempRoot = os.getcwd()
|
||||
base_prompt = '\$\>'
|
||||
prompt_sep = '\x00'
|
||||
prompt_regex = '.*' + base_prompt + prompt_sep
|
||||
|
||||
def __init__(self, host, port = 27020):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self._sock = None
|
||||
self.getDeviceRoot()
|
||||
|
||||
def sendCMD(self, cmdline, newline = True, sleep = 0):
|
||||
promptre = re.compile('.*\$\>.$')
|
||||
promptre = re.compile(self.prompt_regex + '$')
|
||||
|
||||
# TODO: any commands that don't output anything and quit need to match this RE
|
||||
pushre = re.compile('^push .*$')
|
||||
|
@ -169,6 +108,7 @@ class DeviceManager:
|
|||
|
||||
try:
|
||||
self._sock.send(cmd)
|
||||
if (self.debug >= 4): print "send cmd: " + str(cmd)
|
||||
except:
|
||||
self._redo = True
|
||||
self._sock.close()
|
||||
|
@ -181,7 +121,7 @@ class DeviceManager:
|
|||
time.sleep(int(sleep))
|
||||
found = False
|
||||
while (found == False):
|
||||
if (self.debug >= 3): print "recv'ing..."
|
||||
if (self.debug >= 4): print "recv'ing..."
|
||||
|
||||
try:
|
||||
temp = self._sock.recv(1024)
|
||||
|
@ -211,16 +151,16 @@ class DeviceManager:
|
|||
|
||||
# take a data blob and strip instances of the prompt '$>\x00'
|
||||
def stripPrompt(self, data):
|
||||
promptre = re.compile('.*\$\>.*')
|
||||
promptre = re.compile(self.prompt_regex + '.*')
|
||||
retVal = []
|
||||
lines = data.split('\n')
|
||||
for line in lines:
|
||||
try:
|
||||
while (promptre.match(line)):
|
||||
pieces = line.split('\x00')
|
||||
index = pieces.index("$>")
|
||||
pieces = line.split(self.prompt_sep)
|
||||
index = pieces.index('$>')
|
||||
pieces.pop(index)
|
||||
line = '\x00'.join(pieces)
|
||||
line = self.prompt_sep.join(pieces)
|
||||
except(ValueError):
|
||||
pass
|
||||
retVal.append(line)
|
||||
|
@ -229,19 +169,16 @@ class DeviceManager:
|
|||
|
||||
|
||||
def pushFile(self, localname, destname):
|
||||
if (self.debug >= 2):
|
||||
print "in push file with: " + localname + ", and: " + destname
|
||||
if (self.debug >= 2): print "in push file with: " + localname + ", and: " + destname
|
||||
if (self.validateFile(destname, localname) == True):
|
||||
if (self.debug >= 2):
|
||||
print "files are validated"
|
||||
if (self.debug >= 2): print "files are validated"
|
||||
return ''
|
||||
|
||||
if self.mkDirs(destname) == None:
|
||||
print "unable to make dirs: " + destname
|
||||
return None
|
||||
|
||||
if (self.debug >= 2):
|
||||
print "sending: push " + destname
|
||||
if (self.debug >= 2): print "sending: push " + destname
|
||||
|
||||
# sleep 5 seconds / MB
|
||||
filesize = os.path.getsize(localname)
|
||||
|
@ -252,13 +189,11 @@ class DeviceManager:
|
|||
f.close()
|
||||
retVal = self.sendCMD(['push ' + destname + '\r\n', data], newline = False, sleep = sleepTime)
|
||||
if (retVal == None):
|
||||
if (self.debug >= 2):
|
||||
print "Error in sendCMD, not validating push"
|
||||
if (self.debug >= 2): print "Error in sendCMD, not validating push"
|
||||
return None
|
||||
|
||||
if (self.validateFile(destname, localname) == False):
|
||||
if (self.debug >= 2):
|
||||
print "file did not copy as expected"
|
||||
if (self.debug >= 2): print "file did not copy as expected"
|
||||
return None
|
||||
|
||||
return retVal
|
||||
|
@ -286,7 +221,6 @@ class DeviceManager:
|
|||
for root, dirs, files in os.walk(localDir):
|
||||
parts = root.split(localDir)
|
||||
for file in files:
|
||||
print "examining file: " + file
|
||||
remoteRoot = remoteDir + '/' + parts[1]
|
||||
remoteName = remoteRoot + '/' + file
|
||||
if (parts[1] == ""): remoteRoot = remoteDir
|
||||
|
@ -346,7 +280,7 @@ class DeviceManager:
|
|||
|
||||
|
||||
def getProcessList(self):
|
||||
data = self.sendCMD(['ps', 'quit'], sleep = 3)
|
||||
data = self.sendCMD(['ps'], sleep = 3)
|
||||
if (data == None):
|
||||
return None
|
||||
|
||||
|
@ -355,13 +289,14 @@ class DeviceManager:
|
|||
files = []
|
||||
for line in lines:
|
||||
if (line.strip() != ''):
|
||||
pidproc = line.strip().split(' ')
|
||||
pidproc = line.strip().split()
|
||||
if (len(pidproc) == 2):
|
||||
files += [[pidproc[0], pidproc[1]]]
|
||||
|
||||
elif (len(pidproc) == 3):
|
||||
#android returns <userID> <procID> <procName>
|
||||
files += [[pidproc[1], pidproc[2], pidproc[0]]]
|
||||
return files
|
||||
|
||||
|
||||
def getMemInfo(self):
|
||||
data = self.sendCMD(['mems', 'quit'])
|
||||
if (data == None):
|
||||
|
@ -375,29 +310,40 @@ class DeviceManager:
|
|||
|
||||
def fireProcess(self, appname):
|
||||
if (self.debug >= 2): print "FIRE PROC: '" + appname + "'"
|
||||
self.process = myProc(self.host, self.port, ['exec ' + appname, 'quit'])
|
||||
self.process.start()
|
||||
|
||||
if (self.processExist(appname) != ''):
|
||||
print "WARNING: process %s appears to be running already\n" % appname
|
||||
|
||||
self.sendCMD(['exec ' + appname])
|
||||
|
||||
#NOTE: we sleep for 30 seconds to allow the application to startup
|
||||
time.sleep(30)
|
||||
|
||||
self.process = self.processExist(appname)
|
||||
if (self.debug >= 4): print "got pid: " + str(self.process) + " for process: " + str(appname)
|
||||
|
||||
def launchProcess(self, cmd, outputFile = "process.txt", cwd = ''):
|
||||
if (outputFile == "process.txt"):
|
||||
outputFile = self.getDeviceRoot() + '/' + "process.txt"
|
||||
|
||||
|
||||
cmdline = subprocess.list2cmdline(cmd)
|
||||
self.fireProcess(cmdline + " > " + outputFile)
|
||||
handle = outputFile
|
||||
|
||||
|
||||
return handle
|
||||
|
||||
#hardcoded: sleep interval of 5 seconds, timeout of 10 minutes
|
||||
def communicate(self, process, timeout = 600):
|
||||
interval = 5
|
||||
timed_out = True
|
||||
if (timeout > 0):
|
||||
total_time = 0
|
||||
while total_time < timeout:
|
||||
time.sleep(1)
|
||||
time.sleep(interval)
|
||||
if (not self.poll(process)):
|
||||
timed_out = False
|
||||
break
|
||||
total_time += 1
|
||||
total_time += interval
|
||||
|
||||
if (timed_out == True):
|
||||
return None
|
||||
|
@ -407,7 +353,7 @@ class DeviceManager:
|
|||
|
||||
def poll(self, process):
|
||||
try:
|
||||
if (not self.process.isAlive()):
|
||||
if (self.processExist(process) == None):
|
||||
return None
|
||||
return 1
|
||||
except:
|
||||
|
@ -420,10 +366,11 @@ class DeviceManager:
|
|||
def processExist(self, appname):
|
||||
pid = ''
|
||||
|
||||
pieces = appname.split('/')
|
||||
app = pieces[-1]
|
||||
pieces = appname.split(' ')
|
||||
parts = pieces[0].split('/')
|
||||
app = parts[-1]
|
||||
procre = re.compile('.*' + app + '.*')
|
||||
|
||||
|
||||
procList = self.getProcessList()
|
||||
if (procList == None):
|
||||
return None
|
||||
|
@ -442,7 +389,6 @@ class DeviceManager:
|
|||
return True
|
||||
|
||||
def getTempDir(self):
|
||||
promptre = re.compile('.*\$\>\x00.*')
|
||||
retVal = ''
|
||||
data = self.sendCMD(['tmpd', 'quit'])
|
||||
if (data == None):
|
||||
|
@ -455,7 +401,7 @@ class DeviceManager:
|
|||
if localFile == '':
|
||||
localFile = os.path.join(self.tempRoot, "temp.txt")
|
||||
|
||||
promptre = re.compile('.*\$\>\x00.*')
|
||||
promptre = re.compile(self.prompt_regex + '.*')
|
||||
data = self.sendCMD(['cat ' + remoteFile, 'quit'], sleep = 5)
|
||||
if (data == None):
|
||||
return None
|
||||
|
@ -506,8 +452,7 @@ class DeviceManager:
|
|||
retVal = self.stripPrompt(data)
|
||||
if (retVal != None):
|
||||
retVal = retVal.strip('\n')
|
||||
if (self.debug >= 3):
|
||||
print "remote hash: '" + retVal + "'"
|
||||
if (self.debug >= 3): print "remote hash returned: '" + retVal + "'"
|
||||
return retVal
|
||||
|
||||
|
||||
|
@ -530,13 +475,14 @@ class DeviceManager:
|
|||
|
||||
file.close()
|
||||
hexval = mdsum.hexdigest()
|
||||
if (self.debug >= 3):
|
||||
print "local hash: '" + hexval + "'"
|
||||
if (self.debug >= 3): print "local hash returned: '" + hexval + "'"
|
||||
return hexval
|
||||
|
||||
# Gets the device root for the testing area on the device
|
||||
# For all devices we will use / type slashes and depend on the device-agent
|
||||
# to sort those out.
|
||||
# to sort those out. The agent will return us the device location where we
|
||||
# should store things, we will then create our /tests structure relative to
|
||||
# that returned path.
|
||||
# Structure on the device is as follows:
|
||||
# /tests
|
||||
# /<fennec>|<firefox> --> approot
|
||||
|
@ -546,11 +492,14 @@ class DeviceManager:
|
|||
# /mochitest
|
||||
def getDeviceRoot(self):
|
||||
if (not self.deviceRoot):
|
||||
if (self.dirExists('/tests')):
|
||||
self.deviceRoot = '/tests'
|
||||
else:
|
||||
self.mkDir('/tests')
|
||||
self.deviceRoot = '/tests'
|
||||
data = self.sendCMD(['testroot'], sleep = 1)
|
||||
if (data == None):
|
||||
return '/tests'
|
||||
self.deviceRoot = self.stripPrompt(data).strip('\n') + '/tests'
|
||||
|
||||
if (not self.dirExists(self.deviceRoot)):
|
||||
self.mkDir(self.deviceRoot)
|
||||
|
||||
return self.deviceRoot
|
||||
|
||||
# Either we will have /tests/fennec or /tests/firefox but we will never have
|
||||
|
@ -558,8 +507,10 @@ class DeviceManager:
|
|||
def getAppRoot(self):
|
||||
if (self.dirExists(self.getDeviceRoot() + '/fennec')):
|
||||
return self.getDeviceRoot() + '/fennec'
|
||||
else:
|
||||
elif (self.dirExists(self.getDeviceRoot() + '/firefox')):
|
||||
return self.getDeviceRoot() + '/firefox'
|
||||
else:
|
||||
return 'org.mozilla.fennec'
|
||||
|
||||
# Gets the directory location on the device for a specific test type
|
||||
# Type is one of: xpcshell|reftest|mochitest
|
||||
|
@ -592,8 +543,8 @@ class DeviceManager:
|
|||
dir = '/'.join(parts[:-1])
|
||||
elif self.fileExists('/' + filename):
|
||||
dir = '/' + filename
|
||||
elif self.fileExists('/tests/' + filename):
|
||||
dir = '/tests/' + filename
|
||||
elif self.fileExists(self.getDeviceRoot() + '/' + filename):
|
||||
dir = self.getDeviceRoot() + '/' + filename
|
||||
else:
|
||||
return None
|
||||
|
||||
|
@ -630,3 +581,71 @@ class DeviceManager:
|
|||
if (self.validateFile(remoteName, os.path.join(root, file)) <> True):
|
||||
return None
|
||||
return True
|
||||
|
||||
#TODO: make this simpler by doing a single directive at a time
|
||||
# Returns information about the device:
|
||||
# Directive indicates the information you want to get, your choices are:
|
||||
# os - name of the os
|
||||
# id - unique id of the device
|
||||
# uptime - uptime of the device
|
||||
# systime - system time of the device
|
||||
# screen - screen resolution
|
||||
# memory - memory stats
|
||||
# process - list of running processes (same as ps)
|
||||
# disk - total, free, available bytes on disk
|
||||
# power - power status (charge, battery temp)
|
||||
# all - all of them
|
||||
def getInfo(self, directive):
|
||||
data = None
|
||||
if (directive in ('os','id','uptime','systime','screen','memory','process',
|
||||
'disk','power')):
|
||||
data = self.sendCMD(['info ' + directive, 'quit'], sleep = 1)
|
||||
else:
|
||||
directive = None
|
||||
data = self.sendCMD(['info', 'quit'], sleep = 1)
|
||||
|
||||
if (data is None):
|
||||
return None
|
||||
|
||||
data = self.stripPrompt(data)
|
||||
result = {}
|
||||
|
||||
if directive:
|
||||
result[directive] = data.split('\n')
|
||||
for i in range(len(result[directive])):
|
||||
if (len(result[directive][i]) != 0):
|
||||
result[directive][i] = result[directive][i].strip()
|
||||
|
||||
# Get rid of any empty attributes
|
||||
result[directive].remove('')
|
||||
|
||||
else:
|
||||
lines = data.split('\n')
|
||||
result['id'] = lines[0]
|
||||
result['os'] = lines[1]
|
||||
result['systime'] = lines[2]
|
||||
result['uptime'] = lines[3]
|
||||
result['screen'] = lines[4]
|
||||
result['memory'] = lines[5]
|
||||
if (lines[6] == 'Power status'):
|
||||
tmp = []
|
||||
for i in range(4):
|
||||
tmp.append(line[7 + i])
|
||||
result['power'] = tmp
|
||||
tmp = []
|
||||
|
||||
# Linenum is the line where the process list begins
|
||||
linenum = 11
|
||||
for j in range(len(lines) - linenum):
|
||||
if (lines[j + linenum].strip() != ''):
|
||||
procline = lines[j + linenum].split('\t')
|
||||
|
||||
if len(procline) == 2:
|
||||
tmp.append([procline[0], procline[1]])
|
||||
elif len(procline) == 3:
|
||||
# Android has <userid> <procid> <procname>
|
||||
# We put the userid to achieve a common format
|
||||
tmp.append([procline[1], procline[2], procline[0]])
|
||||
result['process'] = tmp
|
||||
return result
|
||||
|
||||
|
|
|
@ -678,7 +678,10 @@ nsChromeRegistry::WrappersEnabled(nsIURI *aURI)
|
|||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
PRUint32 flags;
|
||||
rv = GetFlagsFromPackage(package, &flags);
|
||||
return NS_SUCCEEDED(rv) && (flags & XPCNATIVEWRAPPERS);
|
||||
PackageEntry* entry =
|
||||
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
|
||||
& (nsACString&) package,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
return PL_DHASH_ENTRY_IS_LIVE(entry);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,99 @@ protected:
|
|||
CONTENT_ACCESSIBLE = 1 << 2
|
||||
};
|
||||
|
||||
class nsProviderArray
|
||||
{
|
||||
public:
|
||||
nsProviderArray() :
|
||||
mArray(1) { }
|
||||
~nsProviderArray()
|
||||
{ Clear(); }
|
||||
|
||||
// When looking up locales and skins, the "selected" locale is not always
|
||||
// available. This enum identifies what kind of match is desired/found.
|
||||
enum MatchType {
|
||||
EXACT = 0,
|
||||
LOCALE = 1, // "en-GB" is selected, we found "en-US"
|
||||
ANY = 2
|
||||
};
|
||||
|
||||
nsIURI* GetBase(const nsACString& aPreferred, MatchType aType);
|
||||
const nsACString& GetSelected(const nsACString& aPreferred, MatchType aType);
|
||||
void SetBase(const nsACString& aProvider, nsIURI* base);
|
||||
void EnumerateToArray(nsTArray<nsCString> *a);
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
ProviderEntry* GetProvider(const nsACString& aPreferred, MatchType aType);
|
||||
|
||||
nsVoidArray mArray;
|
||||
};
|
||||
|
||||
struct PackageEntry : public PLDHashEntryHdr
|
||||
{
|
||||
PackageEntry(const nsACString& package);
|
||||
~PackageEntry() { }
|
||||
|
||||
// Available flags
|
||||
enum {
|
||||
// This is a "platform" package (e.g. chrome://global-platform/).
|
||||
// Appends one of win/ unix/ mac/ to the base URI.
|
||||
PLATFORM_PACKAGE = 1 << 0,
|
||||
|
||||
// Content script may access files in this package
|
||||
CONTENT_ACCESSIBLE = 1 << 1
|
||||
};
|
||||
|
||||
nsCString package;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
PRUint32 flags;
|
||||
nsProviderArray locales;
|
||||
nsProviderArray skins;
|
||||
};
|
||||
|
||||
private:
|
||||
static PLDHashNumber HashKey(PLDHashTable *table, const void *key);
|
||||
static PRBool MatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
|
||||
const void *key);
|
||||
static void ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry);
|
||||
static PRBool InitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
||||
const void *key);
|
||||
|
||||
static const PLDHashTableOps kTableOps;
|
||||
|
||||
public:
|
||||
class OverlayListEntry : public nsURIHashKey
|
||||
{
|
||||
public:
|
||||
typedef nsURIHashKey::KeyType KeyType;
|
||||
typedef nsURIHashKey::KeyTypePointer KeyTypePointer;
|
||||
|
||||
OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { }
|
||||
OverlayListEntry(OverlayListEntry& toCopy) : nsURIHashKey(toCopy),
|
||||
mArray(toCopy.mArray) { }
|
||||
~OverlayListEntry() { }
|
||||
|
||||
void AddURI(nsIURI* aURI);
|
||||
|
||||
nsCOMArray<nsIURI> mArray;
|
||||
};
|
||||
|
||||
class OverlayListHash
|
||||
{
|
||||
public:
|
||||
OverlayListHash() { }
|
||||
~OverlayListHash() { }
|
||||
|
||||
PRBool Init() { return mTable.Init(); }
|
||||
void Add(nsIURI* aBase, nsIURI* aOverlay);
|
||||
void Clear() { mTable.Clear(); }
|
||||
const nsCOMArray<nsIURI>* GetArray(nsIURI* aBase);
|
||||
|
||||
private:
|
||||
nsTHashtable<OverlayListEntry> mTable;
|
||||
};
|
||||
|
||||
private:
|
||||
PRBool mInitialized;
|
||||
|
||||
// "Override" table (chrome URI string -> real URI)
|
||||
|
|
|
@ -109,7 +109,11 @@ class Expression:
|
|||
rv = None
|
||||
word_len = re.match('[0-9]*', self.content).end()
|
||||
if word_len:
|
||||
rv = Expression.__ASTLeaf('int', int(self.content[:word_len]))
|
||||
if self.content[0] == '0':
|
||||
value = int(self.content[:word_len], 8)
|
||||
else:
|
||||
value = int(self.content[:word_len])
|
||||
rv = Expression.__ASTLeaf('int', value)
|
||||
else:
|
||||
word_len = re.match('\w*', self.content).end()
|
||||
if word_len:
|
||||
|
|
|
@ -149,14 +149,16 @@ endif
|
|||
endif
|
||||
|
||||
ifdef stl_compiler
|
||||
stl-wrappers-sentinel: $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
|
||||
STL_WRAPPERS_SENTINEL = $(DIST)/stl_wrappers/sentinel
|
||||
|
||||
$(STL_WRAPPERS_SENTINEL): $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
|
||||
$(PYTHON) $(srcdir)/make-stl-wrappers.py stl_wrappers $(stl_compiler) $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers
|
||||
$(PYTHON) $(srcdir)/nsinstall.py stl_wrappers $(DIST)
|
||||
touch stl-wrappers-sentinel
|
||||
touch $(STL_WRAPPERS_SENTINEL)
|
||||
|
||||
export:: stl-wrappers-sentinel
|
||||
export:: $(STL_WRAPPERS_SENTINEL)
|
||||
|
||||
GARBAGE += stl-wrappers-sentinel
|
||||
GARBAGE += $(STL_WRAPPERS_SENTINEL)
|
||||
GARBAGE_DIRS += stl_wrappers
|
||||
endif
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ class Preprocessor:
|
|||
|
||||
def getCommandLineParser(self, unescapeDefines = False):
|
||||
escapedValue = re.compile('".*"$')
|
||||
numberValue = re.compile('\d+$')
|
||||
def handleE(option, opt, value, parser):
|
||||
for k,v in os.environ.iteritems():
|
||||
self.context[k] = v
|
||||
|
@ -180,6 +181,11 @@ class Preprocessor:
|
|||
elif unescapeDefines and escapedValue.match(vals[1]):
|
||||
# strip escaped string values
|
||||
vals[1] = vals[1][1:-1]
|
||||
elif numberValue.match(vals[1]):
|
||||
if vals[1][0] == '0':
|
||||
vals[1] = int(vals[1], 8)
|
||||
else:
|
||||
vals[1] = int(vals[1])
|
||||
self.context[vals[0]] = vals[1]
|
||||
def handleU(option, opt, value, parser):
|
||||
del self.context[value]
|
||||
|
|
|
@ -512,6 +512,7 @@ MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
|
|||
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
|
||||
MOZ_ENABLE_DWRITE_FONT = @MOZ_ENABLE_DWRITE_FONT@
|
||||
MOZ_ENABLE_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
|
||||
MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@
|
||||
|
||||
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
|
||||
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
|
||||
|
@ -596,6 +597,7 @@ MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
|
|||
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
|
||||
WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
|
||||
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
|
||||
MOZ_CRT_CPU_ARCH = @MOZ_CRT_CPU_ARCH@
|
||||
|
||||
# This is for custom CRT building
|
||||
ifdef MOZ_MEMORY
|
||||
|
|
|
@ -10,8 +10,13 @@
|
|||
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<ms_asmv3:security>
|
||||
<ms_asmv3:requestedPrivileges>
|
||||
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false"></ms_asmv3:requestedExecutionLevel>
|
||||
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</ms_asmv3:requestedPrivileges>
|
||||
</ms_asmv3:security>
|
||||
</ms_asmv3:trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
content test chrome/test/one xpcnativewrappers=no
|
||||
content test chrome/test/one
|
||||
locale ab-X-stuff chrome/test/three
|
||||
overlay chrome://one/file.xml chrome://two/otherfile.xml
|
||||
skin test classic chrome/test/one
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
test.jar:
|
||||
# test chrome with flags and path expansion
|
||||
% content test %one xpcnativewrappers=no
|
||||
% content test %one
|
||||
# test locale with variable substitution and path expansion
|
||||
% locale @AB_CD@ %three
|
||||
# test overlays
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
content test test/one xpcnativewrappers=no
|
||||
content test test/one
|
||||
locale ab-X-stuff test/three
|
||||
overlay chrome://one/file.xml chrome://two/otherfile.xml
|
||||
skin test classic test/one
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
content test jar:test.jar!/one xpcnativewrappers=no
|
||||
content test jar:test.jar!/one
|
||||
locale ab-X-stuff jar:test.jar!/three
|
||||
overlay chrome://one/file.xml chrome://two/otherfile.xml
|
||||
skin test classic jar:test.jar!/one
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
content test test/one xpcnativewrappers=no
|
||||
content test test/one
|
||||
locale ab-X-stuff test/three
|
||||
overlay chrome://one/file.xml chrome://two/otherfile.xml
|
||||
skin test classic test/one
|
||||
|
|
|
@ -404,5 +404,49 @@ FAIL
|
|||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "first\rsecond\r")
|
||||
|
||||
def test_number_value_equals(self):
|
||||
f = NamedIO("number_value_equals.in", """#define FOO 1000
|
||||
#if FOO == 1000
|
||||
number value is equal
|
||||
#else
|
||||
number value is not equal
|
||||
#endif
|
||||
""")
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "number value is equal\n")
|
||||
|
||||
def test_number_value_equals_defines(self):
|
||||
f = NamedIO("number_value_equals_defines.in", """#if FOO == 1000
|
||||
number value is equal
|
||||
#else
|
||||
number value is not equal
|
||||
#endif
|
||||
""")
|
||||
self.pp.handleCommandLine(["-DFOO=1000"])
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "number value is equal\n")
|
||||
|
||||
def test_octal_value_equals(self):
|
||||
f = NamedIO("octal_value_equals.in", """#define FOO 0100
|
||||
#if FOO == 0100
|
||||
octal value is equal
|
||||
#else
|
||||
octal value is not equal
|
||||
#endif
|
||||
""")
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "octal value is equal\n")
|
||||
|
||||
def test_octal_value_equals_defines(self):
|
||||
f = NamedIO("octal_value_equals_defines.in", """#if FOO == 0100
|
||||
octal value is equal
|
||||
#else
|
||||
octal value is not equal
|
||||
#endif
|
||||
""")
|
||||
self.pp.handleCommandLine(["-DFOO=0100"])
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "octal value is equal\n")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
555
configure.in
555
configure.in
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,15 +1,18 @@
|
|||
<Html>
|
||||
<Html class="reftest-wait">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf8">
|
||||
</head>
|
||||
<body>
|
||||
<body onload="boom()">
|
||||
<iframe src="#" id="data"></iframe>
|
||||
<script>
|
||||
function boom() {
|
||||
var d=document.getElementById('data').contentDocument;
|
||||
d.clear()
|
||||
var text='Тест';
|
||||
d.write(text);
|
||||
d.close()
|
||||
d.close();
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1350,12 +1350,6 @@ public:
|
|||
*/
|
||||
static PRBool URIIsLocalFile(nsIURI *aURI);
|
||||
|
||||
/**
|
||||
* If aContent is an HTML element with a DOM level 0 'name', then
|
||||
* return the name. Otherwise return null.
|
||||
*/
|
||||
static nsIAtom* IsNamedItem(Element* aElement);
|
||||
|
||||
/**
|
||||
* Get the application manifest URI for this document. The manifest URI
|
||||
* is specified in the manifest= attribute of the root element of the
|
||||
|
@ -1621,6 +1615,14 @@ public:
|
|||
static already_AddRefed<mozilla::layers::LayerManager>
|
||||
LayerManagerForDocument(nsIDocument *aDoc);
|
||||
|
||||
/**
|
||||
* Determine whether a content node is focused or not,
|
||||
*
|
||||
* @param aContent the content node to check
|
||||
* @return true if the content node is focused, false otherwise.
|
||||
*/
|
||||
static PRBool IsFocusedContent(nsIContent *aContent);
|
||||
|
||||
private:
|
||||
|
||||
static PRBool InitializeEventTable();
|
||||
|
|
|
@ -71,8 +71,8 @@ enum nsLinkState {
|
|||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x9e3b1a15, 0x72d5, 0x4e4f, \
|
||||
{ 0x8f, 0x4b, 0x75, 0xde, 0x07, 0x9c, 0x16, 0xdc } }
|
||||
{ 0x1450010b, 0xcdca, 0x451c, \
|
||||
{ 0xba, 0xdc, 0x07, 0x90, 0x89, 0x7b, 0xce, 0xb8 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
|
@ -778,7 +778,12 @@ public:
|
|||
* value of the null-namespace attribute whose name is given by
|
||||
* GetIDAttributeName(). This may be null if there is no ID.
|
||||
*/
|
||||
virtual nsIAtom* GetID() const = 0;
|
||||
nsIAtom* GetID() const {
|
||||
if (HasFlag(NODE_HAS_ID)) {
|
||||
return DoGetID();
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class list of this content node (this corresponds to the
|
||||
|
@ -915,6 +920,13 @@ public:
|
|||
|
||||
virtual PRBool IsEqualNode(nsINode* aOther);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Hook for implementing GetID. This is guaranteed to only be
|
||||
* called if the NODE_HAS_ID flag is set.
|
||||
*/
|
||||
virtual nsIAtom* DoGetID() const = 0;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Hook for implementing GetClasses. This is guaranteed to only be
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#ifdef MOZ_SMIL
|
||||
#include "nsSMILAnimationController.h"
|
||||
#endif // MOZ_SMIL
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsPresContext;
|
||||
|
@ -72,7 +73,6 @@ class nsIStyleSheet;
|
|||
class nsIStyleRule;
|
||||
class nsCSSStyleSheet;
|
||||
class nsIViewManager;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMEventTarget;
|
||||
class nsIDeviceContext;
|
||||
|
@ -116,8 +116,8 @@ class Element;
|
|||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xeb847679, 0x3b48, 0x411c, \
|
||||
{ 0xa9, 0xb8, 0x8a, 0xdc, 0xdb, 0xc6, 0x47, 0xb8 } }
|
||||
{ 0x3ee6a14b, 0x83b5, 0x4629, \
|
||||
{ 0x96, 0x9b, 0xe9, 0x84, 0x7c, 0x57, 0x24, 0x3c } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -629,8 +629,13 @@ public:
|
|||
* for event/script handling. Do not process any events/script if the method
|
||||
* returns null, but aHasHadScriptHandlingObject is true.
|
||||
*/
|
||||
virtual nsIScriptGlobalObject*
|
||||
GetScriptHandlingObject(PRBool& aHasHadScriptHandlingObject) const = 0;
|
||||
nsIScriptGlobalObject*
|
||||
GetScriptHandlingObject(PRBool& aHasHadScriptHandlingObject) const
|
||||
{
|
||||
aHasHadScriptHandlingObject = mHasHadScriptHandlingObject;
|
||||
return mScriptGlobalObject ? mScriptGlobalObject.get() :
|
||||
GetScriptHandlingObjectInternal();
|
||||
}
|
||||
virtual void SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject) = 0;
|
||||
|
||||
/**
|
||||
|
@ -665,6 +670,17 @@ public:
|
|||
*/
|
||||
virtual nsScriptLoader* ScriptLoader() = 0;
|
||||
|
||||
/**
|
||||
* Add/Remove an element to the document's id and name hashes
|
||||
*/
|
||||
virtual void AddToIdTable(mozilla::dom::Element* aElement, nsIAtom* aId) = 0;
|
||||
virtual void RemoveFromIdTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aId) = 0;
|
||||
virtual void AddToNameTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aName) = 0;
|
||||
virtual void RemoveFromNameTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aName) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Document notification API's
|
||||
|
@ -797,6 +813,10 @@ public:
|
|||
{
|
||||
return mIsRegularHTML;
|
||||
}
|
||||
PRBool IsXUL() const
|
||||
{
|
||||
return mIsXUL;
|
||||
}
|
||||
|
||||
virtual PRBool IsScriptEnabled() = 0;
|
||||
|
||||
|
@ -1364,8 +1384,7 @@ public:
|
|||
* It prevents converting nsIDOMElement to mozill:dom::Element which is
|
||||
* already converted from mozilla::dom::Element.
|
||||
*/
|
||||
virtual mozilla::dom::Element* GetElementById(const nsAString& aElementId,
|
||||
nsresult* aResult) = 0;
|
||||
virtual mozilla::dom::Element* GetElementById(const nsAString& aElementId) = 0;
|
||||
|
||||
protected:
|
||||
~nsIDocument()
|
||||
|
@ -1384,6 +1403,9 @@ protected:
|
|||
// Never ever call this. Only call GetInnerWindow!
|
||||
virtual nsPIDOMWindow *GetInnerWindowInternal() = 0;
|
||||
|
||||
// Never ever call this. Only call GetScriptHandlingObject!
|
||||
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const = 0;
|
||||
|
||||
/**
|
||||
* These methods should be called before and after dispatching
|
||||
* a mutation event.
|
||||
|
@ -1454,6 +1476,7 @@ protected:
|
|||
PRPackedBool mShellIsHidden;
|
||||
|
||||
PRPackedBool mIsRegularHTML;
|
||||
PRPackedBool mIsXUL;
|
||||
|
||||
// True if we're loaded as data and therefor has any dangerous stuff, such
|
||||
// as scripts and plugins, disabled.
|
||||
|
@ -1488,6 +1511,14 @@ protected:
|
|||
// True while this document is being cloned to a static document.
|
||||
PRPackedBool mCreatingStaticClone;
|
||||
|
||||
// True if document has ever had script handling object.
|
||||
PRPackedBool mHasHadScriptHandlingObject;
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
// *inner* window object.
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
|
||||
// If mIsStaticDocument is true, mOriginalDocument points to the original
|
||||
// document.
|
||||
nsCOMPtr<nsIDocument> mOriginalDocument;
|
||||
|
|
|
@ -61,7 +61,7 @@ interface nsIDocumentEncoderNodeFixup : nsISupports
|
|||
nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids);
|
||||
};
|
||||
|
||||
[scriptable, uuid(196a3aee-006e-4f8f-a420-e1c1b0958a26)]
|
||||
[scriptable, uuid(794a81f6-bde6-4f76-9f5e-0ea0911a2d9f)]
|
||||
interface nsIDocumentEncoder : nsISupports
|
||||
{
|
||||
// Output methods flag bits. There are a frightening number of these,
|
||||
|
@ -214,7 +214,7 @@ interface nsIDocumentEncoder : nsISupports
|
|||
* This flag suppresses that behavior.
|
||||
*/
|
||||
const unsigned long OutputDontRewriteEncodingDeclaration = (1 << 18);
|
||||
|
||||
|
||||
/**
|
||||
* When using the HTML or XHTML serializer, skip elements that are not
|
||||
* visible when this flag is set. Elements are not visible when they
|
||||
|
@ -222,6 +222,13 @@ interface nsIDocumentEncoder : nsISupports
|
|||
*/
|
||||
const unsigned long SkipInvisibleContent = (1 << 19);
|
||||
|
||||
/**
|
||||
* Output for delsp=yes (RFC 3676). This is used with OutputFormatFlowed
|
||||
* when converting to text for mail sending.
|
||||
* PlainText output only.
|
||||
*/
|
||||
const unsigned long OutputFormatDelSp = (1 << 20);
|
||||
|
||||
/**
|
||||
* Initialize with a pointer to the document and the mime type.
|
||||
* @param aDocument Document to encode.
|
||||
|
|
|
@ -117,9 +117,10 @@ enum {
|
|||
|
||||
NODE_IS_EDITABLE = 0x00000100U,
|
||||
|
||||
// Optimizations to quickly check whether element may have ID, class or style
|
||||
// attributes. Not all element implementations may use these!
|
||||
NODE_MAY_HAVE_ID = 0x00000200U,
|
||||
// Set to true if the element has a non-empty id attribute. This can in rare
|
||||
// cases lie for nsXMLElement, such as when the node has been moved between
|
||||
// documents with different id mappings.
|
||||
NODE_HAS_ID = 0x00000200U,
|
||||
// For all Element nodes, NODE_MAY_HAVE_CLASS is guaranteed to be set if the
|
||||
// node in fact has a class, but may be set even if it doesn't.
|
||||
NODE_MAY_HAVE_CLASS = 0x00000400U,
|
||||
|
@ -170,9 +171,15 @@ enum {
|
|||
|
||||
// Set if the node is an element.
|
||||
NODE_IS_ELEMENT = 0x00200000U,
|
||||
|
||||
// Set if the node has the accesskey attribute set.
|
||||
NODE_HAS_ACCESSKEY = 0x00400000U,
|
||||
|
||||
// Set if the node has the accesskey attribute set.
|
||||
NODE_HAS_NAME = 0x00800000U,
|
||||
|
||||
// Four bits for the script-type ID
|
||||
NODE_SCRIPT_TYPE_OFFSET = 22,
|
||||
NODE_SCRIPT_TYPE_OFFSET = 24,
|
||||
|
||||
NODE_SCRIPT_TYPE_SIZE = 4,
|
||||
|
||||
|
@ -922,15 +929,6 @@ public:
|
|||
nsIContent* GetSelectionRootContent(nsIPresShell* aPresShell);
|
||||
|
||||
virtual nsINodeList* GetChildNodesList();
|
||||
nsIContent* GetSibling(PRInt32 aOffset)
|
||||
{
|
||||
nsINode *parent = GetNodeParent();
|
||||
if (!parent) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return parent->GetChildAt(parent->IndexOf(this) + aOffset);
|
||||
}
|
||||
nsIContent* GetFirstChild() const { return mFirstChild; }
|
||||
nsIContent* GetLastChild() const
|
||||
{
|
||||
|
|
|
@ -246,34 +246,31 @@ ContentSecurityPolicy.prototype = {
|
|||
var uriString = this._policy.getReportURIs();
|
||||
var uris = uriString.split(/\s+/);
|
||||
if (uris.length > 0) {
|
||||
// Generate report to send composed of:
|
||||
// <csp-report>
|
||||
// <request>GET /index.html HTTP/1.1</request>
|
||||
// <request-headers>Host: example.com
|
||||
// User-Agent: ...
|
||||
// ...
|
||||
// </request-headers>
|
||||
// <blocked-uri>...</blocked-uri>
|
||||
// <violated-directive>...</violated-directive>
|
||||
// </csp-report>
|
||||
//
|
||||
// Generate report to send composed of
|
||||
// {
|
||||
// csp-report: {
|
||||
// request: "GET /index.html HTTP/1.1",
|
||||
// request-headers: "Host: example.com
|
||||
// User-Agent: ...
|
||||
// ...",
|
||||
// blocked-uri: "...",
|
||||
// violated-directive: "..."
|
||||
// }
|
||||
// }
|
||||
var strHeaders = "";
|
||||
for (let i in this._requestHeaders) {
|
||||
strHeaders += this._requestHeaders[i] + "\n";
|
||||
}
|
||||
|
||||
var report = "<csp-report>\n" +
|
||||
" <request>" + this._request + "</request>\n" +
|
||||
" <request-headers><![CDATA[\n" +
|
||||
strHeaders +
|
||||
" ]]></request-headers>\n" +
|
||||
" <blocked-uri>" +
|
||||
(blockedUri instanceof Ci.nsIURI ? blockedUri.asciiSpec : blockedUri) +
|
||||
"</blocked-uri>\n" +
|
||||
" <violated-directive>" + violatedDirective + "</violated-directive>\n" +
|
||||
"</csp-report>\n";
|
||||
|
||||
CSPdebug("Constructed violation report:\n" + report);
|
||||
var report = {
|
||||
'csp-report': {
|
||||
'request': this._request,
|
||||
'request-headers': strHeaders,
|
||||
'blocked-uri': (blockedUri instanceof Ci.nsIURI ?
|
||||
blockedUri.asciiSpec : blockedUri),
|
||||
'violated-directive': violatedDirective
|
||||
}
|
||||
}
|
||||
CSPdebug("Constructed violation report:\n" + JSON.stringify(report));
|
||||
|
||||
// For each URI in the report list, send out a report.
|
||||
for (let i in uris) {
|
||||
|
@ -301,7 +298,7 @@ ContentSecurityPolicy.prototype = {
|
|||
// abused for CSRF.
|
||||
req.channel.loadFlags |= Ci.nsIChannel.LOAD_ANONYMOUS;
|
||||
|
||||
req.send(report);
|
||||
req.send(JSON.stringify(report));
|
||||
CSPdebug("Sent violation report to " + uris[i]);
|
||||
} catch(e) {
|
||||
// it's possible that the URI was invalid, just log a
|
||||
|
|
|
@ -1142,6 +1142,10 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
|
|||
{
|
||||
ResetIfSet();
|
||||
|
||||
// FIXME (partially, at least): HTML5's algorithm says we shouldn't do
|
||||
// the whitespace compression, trimming, or the test for emptiness.
|
||||
// (I'm a little skeptical that we shouldn't do the whitespace
|
||||
// trimming; WebKit also does it.)
|
||||
nsAutoString colorStr(aString);
|
||||
colorStr.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
if (colorStr.IsEmpty()) {
|
||||
|
@ -1152,8 +1156,8 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
|
|||
// No color names begin with a '#'; in standards mode, all acceptable
|
||||
// numeric colors do.
|
||||
if (colorStr.First() == '#') {
|
||||
colorStr.Cut(0, 1);
|
||||
if (NS_HexToRGB(colorStr, &color)) {
|
||||
nsDependentString withoutHash(colorStr.get() + 1, colorStr.Length() - 1);
|
||||
if (NS_HexToRGB(withoutHash, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1164,15 +1168,18 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
|
|||
}
|
||||
}
|
||||
|
||||
if (aDocument->GetCompatibilityMode() != eCompatibility_NavQuirks) {
|
||||
return PR_FALSE;
|
||||
// FIXME (maybe): HTML5 says we should handle system colors. This
|
||||
// means we probably need another storage type, since we'd need to
|
||||
// handle dynamic changes. However, I think this is a bad idea:
|
||||
// http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-May/026449.html
|
||||
|
||||
// Use NS_LooseHexToRGB as a fallback if nothing above worked.
|
||||
if (NS_LooseHexToRGB(colorStr, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// In compatibility mode, try LooseHexToRGB as a fallback for either
|
||||
// of the above two possibilities.
|
||||
NS_LooseHexToRGB(colorStr, &color);
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsAttrValue::ParseFloatValue(const nsAString& aString)
|
||||
|
|
|
@ -274,7 +274,8 @@ public:
|
|||
PRBool ParsePositiveIntValue(const nsAString& aString);
|
||||
|
||||
/**
|
||||
* Parse a string into a color.
|
||||
* Parse a string into a color. This implements what HTML5 calls the
|
||||
* "rules for parsing a legacy color value".
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @param aDocument the document (to find out whether we're in quirks mode)
|
||||
|
|
|
@ -458,7 +458,6 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
|||
nsCOMPtr<nsIFormControl> form(do_QueryInterface(findFormParent));
|
||||
if (form && form->GetType() != NS_FORM_OBJECT &&
|
||||
form->GetType() != NS_FORM_FIELDSET &&
|
||||
form->GetType() != NS_FORM_LEGEND &&
|
||||
form->GetType() != NS_FORM_LABEL &&
|
||||
form->GetType() != NS_FORM_OUTPUT)
|
||||
return NS_OK;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
// couple of utility static functs
|
||||
|
||||
|
@ -118,7 +119,8 @@ NodeIsInTraversalRange(nsINode *aNode, PRBool aIsPreMode,
|
|||
class nsContentIterator : public nsIContentIterator //, public nsIEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsContentIterator)
|
||||
|
||||
nsContentIterator();
|
||||
virtual ~nsContentIterator();
|
||||
|
@ -252,8 +254,20 @@ nsresult NS_NewPreContentIterator(nsIContentIterator** aInstancePtrResult)
|
|||
* XPCOM cruft
|
||||
******************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsContentIterator, nsIContentIterator)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsContentIterator)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsContentIterator)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsContentIterator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentIterator)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentIterator)
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsContentIterator)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_4(nsContentIterator,
|
||||
mCurNode,
|
||||
mFirst,
|
||||
mLast,
|
||||
mCommonParent)
|
||||
|
||||
/******************************************************
|
||||
* constructor/destructor
|
||||
|
|
|
@ -178,6 +178,8 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "BasicLayers.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsTextEditorState.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
@ -1047,6 +1049,8 @@ nsContentUtils::Shutdown()
|
|||
NS_IF_RELEASE(sSameOriginChecker);
|
||||
|
||||
nsAutoGCRoot::Shutdown();
|
||||
|
||||
nsTextEditorState::ShutDown();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -4896,35 +4900,6 @@ nsAutoGCRoot::Shutdown()
|
|||
NS_IF_RELEASE(sJSRuntimeService);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsContentUtils::IsNamedItem(Element* aElement)
|
||||
{
|
||||
// Only the content types reflected in Level 0 with a NAME
|
||||
// attribute are registered. Images, layers and forms always get
|
||||
// reflected up to the document. Applets and embeds only go
|
||||
// to the closest container (which could be a form).
|
||||
nsGenericHTMLElement* elm = nsGenericHTMLElement::FromContent(aElement);
|
||||
if (!elm) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAtom* tag = elm->Tag();
|
||||
if (tag != nsGkAtoms::img &&
|
||||
tag != nsGkAtoms::form &&
|
||||
tag != nsGkAtoms::applet &&
|
||||
tag != nsGkAtoms::embed &&
|
||||
tag != nsGkAtoms::object) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsAttrValue* val = elm->GetParsedAttr(nsGkAtoms::name);
|
||||
if (val && val->Type() == nsAttrValue::eAtom) {
|
||||
return val->GetAtomValue();
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsIInterfaceRequestor*
|
||||
nsContentUtils::GetSameOriginChecker()
|
||||
|
@ -5982,6 +5957,15 @@ mozAutoRemovableBlockerRemover::~mozAutoRemovableBlockerRemover()
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
PRBool
|
||||
nsContentUtils::IsFocusedContent(nsIContent* aContent)
|
||||
{
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
|
||||
return fm && fm->GetFocusedContent() == aContent;
|
||||
}
|
||||
|
||||
void nsContentUtils::RemoveNewlines(nsString &aString)
|
||||
{
|
||||
// strip CR/LF and null
|
||||
|
|
|
@ -73,6 +73,13 @@ nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
|
|||
|
||||
// We don't add a reference to our content. It will tell us
|
||||
// to drop our reference when it goes away.
|
||||
|
||||
EnsureChildState();
|
||||
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (content) {
|
||||
content->AddMutationObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
nsDOMAttribute::~nsDOMAttribute()
|
||||
|
@ -80,6 +87,12 @@ nsDOMAttribute::~nsDOMAttribute()
|
|||
if (mChild) {
|
||||
static_cast<nsTextNode*>(mChild)->UnbindFromAttribute();
|
||||
NS_RELEASE(mChild);
|
||||
mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (content) {
|
||||
content->RemoveMutationObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +118,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
|
|||
if (tmp->mChild) {
|
||||
static_cast<nsTextNode*>(tmp->mChild)->UnbindFromAttribute();
|
||||
NS_RELEASE(tmp->mChild);
|
||||
tmp->mFirstChild = nsnull;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
|
||||
|
@ -115,8 +129,8 @@ DOMCI_DATA(Attr, nsDOMAttribute)
|
|||
// QueryInterface implementation for nsDOMAttribute
|
||||
NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_NODE_INTERFACE_TABLE5(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
|
||||
nsIDOM3Attr, nsPIDOMEventTarget)
|
||||
NS_NODE_INTERFACE_TABLE6(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
|
||||
nsIDOM3Attr, nsPIDOMEventTarget, nsIMutationObserver)
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttribute)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
||||
new nsNodeSupportsWeakRefTearoff(this))
|
||||
|
@ -144,6 +158,11 @@ nsDOMAttribute::SetMap(nsDOMAttributeMap *aMap)
|
|||
// need to locally cache value. GetValue() does that.
|
||||
GetValue(mValue);
|
||||
}
|
||||
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (content) {
|
||||
content->RemoveMutationObserver(this);
|
||||
}
|
||||
|
||||
mAttrMap = aMap;
|
||||
}
|
||||
|
@ -306,11 +325,7 @@ nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
|||
NS_IMETHODIMP
|
||||
nsDOMAttribute::HasChildNodes(PRBool* aHasChildNodes)
|
||||
{
|
||||
PRBool hasChild;
|
||||
nsresult rv = EnsureChildState(PR_FALSE, hasChild);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aHasChildNodes = hasChild;
|
||||
*aHasChildNodes = mFirstChild != nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -330,12 +345,8 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
|||
{
|
||||
*aFirstChild = nsnull;
|
||||
|
||||
PRBool hasChild;
|
||||
nsresult rv = EnsureChildState(PR_TRUE, hasChild);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mChild) {
|
||||
CallQueryInterface(mChild, aFirstChild);
|
||||
if (mFirstChild) {
|
||||
CallQueryInterface(mFirstChild, aFirstChild);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -584,38 +595,30 @@ nsDOMAttribute::IsNodeOfType(PRUint32 aFlags) const
|
|||
PRUint32
|
||||
nsDOMAttribute::GetChildCount() const
|
||||
{
|
||||
return GetChildCount(PR_FALSE);
|
||||
return mFirstChild ? 1 : 0;
|
||||
}
|
||||
|
||||
nsIContent *
|
||||
nsDOMAttribute::GetChildAt(PRUint32 aIndex) const
|
||||
{
|
||||
// Don't need to check result of EnsureChildState since mChild will be null.
|
||||
PRBool hasChild;
|
||||
EnsureChildState(PR_TRUE, hasChild);
|
||||
|
||||
return aIndex == 0 && hasChild ? mChild : nsnull;
|
||||
return aIndex == 0 ? mFirstChild : nsnull;
|
||||
}
|
||||
|
||||
nsIContent * const *
|
||||
nsDOMAttribute::GetChildArray(PRUint32* aChildCount) const
|
||||
{
|
||||
*aChildCount = GetChildCount(PR_TRUE);
|
||||
return &mChild;
|
||||
*aChildCount = GetChildCount();
|
||||
return &mFirstChild;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsDOMAttribute::IndexOf(nsINode* aPossibleChild) const
|
||||
{
|
||||
// No need to call EnsureChildState here. If we don't already have a child
|
||||
// then aPossibleChild can't possibly be our child.
|
||||
if (!aPossibleChild || aPossibleChild != mChild) {
|
||||
if (!aPossibleChild || aPossibleChild != mFirstChild) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRBool hasChild;
|
||||
EnsureChildState(PR_FALSE, hasChild);
|
||||
return hasChild ? 0 : -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -659,8 +662,6 @@ nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationE
|
|||
if (guard.Mutated(0) && mChild != child) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_RELEASE(mChild);
|
||||
static_cast<nsTextNode*>(child.get())->UnbindFromAttribute();
|
||||
|
||||
nsString nullString;
|
||||
SetDOMStringToNull(nullString);
|
||||
|
@ -724,34 +725,52 @@ nsDOMAttribute::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
|
|||
return elm->GetSystemEventGroupLM(aGroup);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
|
||||
void
|
||||
nsDOMAttribute::EnsureChildState()
|
||||
{
|
||||
aHasChild = PR_FALSE;
|
||||
|
||||
nsDOMAttribute* mutableThis = const_cast<nsDOMAttribute*>(this);
|
||||
NS_PRECONDITION(!mChild, "Someone screwed up");
|
||||
|
||||
nsAutoString value;
|
||||
mutableThis->GetValue(value);
|
||||
GetValue(value);
|
||||
|
||||
if (!mChild && !value.IsEmpty()) {
|
||||
nsresult rv = NS_NewTextNode(&mutableThis->mChild,
|
||||
mNodeInfo->NodeInfoManager());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!value.IsEmpty()) {
|
||||
NS_NewTextNode(&mChild, mNodeInfo->NodeInfoManager());
|
||||
|
||||
static_cast<nsTextNode*>(mChild)->BindToAttribute(mutableThis);
|
||||
}
|
||||
static_cast<nsTextNode*>(mChild)->BindToAttribute(this);
|
||||
mFirstChild = mChild;
|
||||
|
||||
aHasChild = !value.IsEmpty();
|
||||
|
||||
if (aSetText && aHasChild) {
|
||||
// aNotify should probably be PR_TRUE sometimes, but it's unlikely that
|
||||
// anyone cares. And we aren't updating the node when the attribute changes
|
||||
// anyway so any notifications are way late.
|
||||
mChild->SetText(value, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
void
|
||||
nsDOMAttribute::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsIContent* content = GetContentInternal();
|
||||
if (aContent != content) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNameSpaceID != mNodeInfo->NamespaceID()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom = GetNameAtom(content);
|
||||
if (nameAtom != aAttribute) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Just blow away our mChild and recreate it if needed
|
||||
if (mChild) {
|
||||
static_cast<nsTextNode*>(mChild)->UnbindFromAttribute();
|
||||
NS_RELEASE(mChild);
|
||||
mFirstChild = nsnull;
|
||||
}
|
||||
EnsureChildState();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -53,12 +53,14 @@
|
|||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
// object that implements nsIDOMAttr, nsIDOM3Attr, nsIDOMNode, nsIDOM3Node
|
||||
class nsDOMAttribute : public nsIAttribute,
|
||||
public nsIDOMAttr,
|
||||
public nsIDOM3Attr
|
||||
public nsIDOM3Attr,
|
||||
public nsStubMutationObserver
|
||||
{
|
||||
public:
|
||||
nsDOMAttribute(nsDOMAttributeMap* aAttrMap, nsINodeInfo *aNodeInfo,
|
||||
|
@ -118,6 +120,8 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMAttribute,
|
||||
nsIAttribute)
|
||||
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
|
||||
protected:
|
||||
virtual mozilla::dom::Element* GetNameSpaceElement()
|
||||
{
|
||||
|
@ -129,15 +133,7 @@ protected:
|
|||
private:
|
||||
already_AddRefed<nsIAtom> GetNameAtom(nsIContent* aContent);
|
||||
|
||||
nsresult EnsureChildState(PRBool aSetText, PRBool &aHasChild) const;
|
||||
|
||||
PRUint32 GetChildCount(PRBool aSetText) const
|
||||
{
|
||||
PRBool hasChild;
|
||||
EnsureChildState(aSetText, hasChild);
|
||||
|
||||
return hasChild ? 1 : 0;
|
||||
}
|
||||
void EnsureChildState();
|
||||
|
||||
nsString mValue;
|
||||
// XXX For now, there's only a single child - a text element
|
||||
|
|
|
@ -193,6 +193,8 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
|||
|
||||
// FOR CSP (autogenerated by xpidl)
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsHTMLCSSStyleSheet.h"
|
||||
|
||||
#include "mozilla/dom/Link.h"
|
||||
using namespace mozilla::dom;
|
||||
|
@ -1452,7 +1454,7 @@ nsDocument::~nsDocument()
|
|||
|
||||
// Destroy link map now so we don't waste time removing
|
||||
// links one by one
|
||||
DestroyLinkMap();
|
||||
DestroyElementMaps();
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
||||
|
@ -1881,8 +1883,6 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
|||
}
|
||||
#endif
|
||||
|
||||
mIdentifierMap.Clear();
|
||||
|
||||
SetPrincipal(nsnull);
|
||||
mSecurityInfo = nsnull;
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
|||
|
||||
// Destroy link map now so we don't waste time removing
|
||||
// links one by one
|
||||
DestroyLinkMap();
|
||||
DestroyElementMaps();
|
||||
|
||||
PRUint32 count = mChildren.ChildCount();
|
||||
{ // Scope for update
|
||||
|
@ -2332,51 +2332,38 @@ nsDocument::GetLastModified(nsAString& aLastModified)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::UpdateNameTableEntry(Element *aElement)
|
||||
nsDocument::AddToNameTable(Element *aElement, nsIAtom* aName)
|
||||
{
|
||||
if (!mIsRegularHTML)
|
||||
return;
|
||||
|
||||
nsIAtom* name = nsContentUtils::IsNamedItem(aElement);
|
||||
if (!name)
|
||||
return;
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aName);
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(name);
|
||||
if (!entry) {
|
||||
// We're not tracking the elements with this name
|
||||
return;
|
||||
// entry is null if we're not tracking the elements with this name
|
||||
|
||||
if (entry) {
|
||||
entry->AddNameElement(aElement);
|
||||
}
|
||||
|
||||
entry->AddNameElement(aElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RemoveFromNameTable(Element *aElement)
|
||||
nsDocument::RemoveFromNameTable(Element *aElement, nsIAtom* aName)
|
||||
{
|
||||
if (!mIsRegularHTML)
|
||||
// Speed up document teardown
|
||||
if (!mIsRegularHTML || mIdentifierMap.Count() == 0)
|
||||
return;
|
||||
|
||||
nsIAtom* name = nsContentUtils::IsNamedItem(aElement);
|
||||
if (!name)
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aName);
|
||||
if (!entry) // Should never be false unless we had OOM when adding the entry
|
||||
return;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(name);
|
||||
if (!entry) {
|
||||
// We're not tracking the elements with this name
|
||||
return;
|
||||
}
|
||||
|
||||
entry->RemoveNameElement(aElement);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::UpdateIdTableEntry(Element *aElement)
|
||||
nsDocument::AddToIdTable(Element *aElement, nsIAtom* aId)
|
||||
{
|
||||
nsIAtom* id = aElement->GetID();
|
||||
if (!id)
|
||||
return;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(id);
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aId);
|
||||
|
||||
if (entry) { /* True except on OOM */
|
||||
entry->AddIdElement(aElement);
|
||||
|
@ -2384,127 +2371,21 @@ nsDocument::UpdateIdTableEntry(Element *aElement)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::RemoveFromIdTable(Element *aElement)
|
||||
nsDocument::RemoveFromIdTable(Element *aElement, nsIAtom* aId)
|
||||
{
|
||||
nsIAtom* id = aElement->GetID();
|
||||
if (!id)
|
||||
return;
|
||||
NS_ASSERTION(aId, "huhwhatnow?");
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(id);
|
||||
if (!entry) /* Should be false unless we had OOM when adding the entry */
|
||||
// Speed up document teardown
|
||||
if (mIdentifierMap.Count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aId);
|
||||
if (!entry) // Can be null for XML elements with changing ids.
|
||||
return;
|
||||
|
||||
if (entry->RemoveIdElement(aElement)) {
|
||||
mIdentifierMap.RemoveEntry(id);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::UnregisterNamedItems(nsIContent *aContent)
|
||||
{
|
||||
if (!aContent->IsElement()) {
|
||||
// non-element nodes are not named items nor can they have children.
|
||||
return;
|
||||
}
|
||||
|
||||
RemoveFromNameTable(aContent->AsElement());
|
||||
RemoveFromIdTable(aContent->AsElement());
|
||||
|
||||
for (nsINode::ChildIterator iter(aContent); !iter.IsDone(); iter.Next()) {
|
||||
UnregisterNamedItems(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RegisterNamedItems(nsIContent *aContent)
|
||||
{
|
||||
if (!aContent->IsElement()) {
|
||||
// non-element nodes are not named items nor can they have children.
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateNameTableEntry(aContent->AsElement());
|
||||
UpdateIdTableEntry(aContent->AsElement());
|
||||
|
||||
for (nsINode::ChildIterator iter(aContent); !iter.IsDone(); iter.Next()) {
|
||||
RegisterNamedItems(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ContentAppended(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
|
||||
for (nsINode::ChildIterator iter(aContainer, aNewIndexInContainer);
|
||||
!iter.IsDone();
|
||||
iter.Next()) {
|
||||
RegisterNamedItems(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ContentInserted(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
|
||||
NS_ABORT_IF_FALSE(aContent, "Null content!");
|
||||
|
||||
RegisterNamedItems(aContent);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ContentRemoved(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
|
||||
NS_ABORT_IF_FALSE(aChild, "Null content!");
|
||||
|
||||
UnregisterNamedItems(aChild);
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::AttributeWillChange(nsIDocument* aDocument,
|
||||
nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute, PRInt32 aModType)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aContent && aContent->IsElement(), "Null content!");
|
||||
NS_PRECONDITION(aAttribute, "Must have an attribute that's changing!");
|
||||
|
||||
if (aNameSpaceID != kNameSpaceID_None)
|
||||
return;
|
||||
if (aAttribute == nsGkAtoms::name) {
|
||||
RemoveFromNameTable(aContent->AsElement());
|
||||
} else if (aAttribute == aContent->GetIDAttributeName()) {
|
||||
RemoveFromIdTable(aContent->AsElement());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::AttributeChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute, PRInt32 aModType)
|
||||
{
|
||||
NS_ASSERTION(aDocument == this, "unexpected doc");
|
||||
|
||||
NS_ABORT_IF_FALSE(aContent && aContent->IsElement(), "Null content!");
|
||||
NS_PRECONDITION(aAttribute, "Must have an attribute that's changing!");
|
||||
|
||||
if (aNameSpaceID != kNameSpaceID_None)
|
||||
return;
|
||||
if (aAttribute == nsGkAtoms::name) {
|
||||
UpdateNameTableEntry(aContent->AsElement());
|
||||
} else if (aAttribute == aContent->GetIDAttributeName()) {
|
||||
UpdateIdTableEntry(aContent->AsElement());
|
||||
mIdentifierMap.RemoveEntry(aId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3323,7 +3204,7 @@ nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent
|
|||
|
||||
if (oldKid->IsElement()) {
|
||||
// Destroy the link map up front before we mess with the child list.
|
||||
DestroyLinkMap();
|
||||
DestroyElementMaps();
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
|
@ -3682,12 +3563,10 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
}
|
||||
|
||||
nsIScriptGlobalObject*
|
||||
nsDocument::GetScriptHandlingObject(PRBool& aHasHadScriptHandlingObject) const
|
||||
nsDocument::GetScriptHandlingObjectInternal() const
|
||||
{
|
||||
aHasHadScriptHandlingObject = mHasHadScriptHandlingObject;
|
||||
if (mScriptGlobalObject) {
|
||||
return mScriptGlobalObject;
|
||||
}
|
||||
NS_ASSERTION(!mScriptGlobalObject,
|
||||
"Do not call this when mScriptGlobalObject is set!");
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
|
@ -3859,80 +3738,35 @@ nsDocument::CheckGetElementByIdArg(const nsIAtom* aId)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsIdentifierMapEntry*
|
||||
nsDocument::GetElementByIdInternal(nsIAtom* aID)
|
||||
{
|
||||
// We don't have to flush before we do the initial hashtable lookup, since if
|
||||
// the id is already in the hashtable it couldn't have been removed without
|
||||
// us being notified (all removals notify immediately, as far as I can tell).
|
||||
// So do the lookup first.
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aID);
|
||||
NS_ENSURE_TRUE(entry, nsnull);
|
||||
|
||||
if (entry->GetIdElement())
|
||||
return entry;
|
||||
|
||||
// Now we have to flush. It could be that we know nothing about this ID yet
|
||||
// but more content has been added to the document since. Note that we have
|
||||
// to flush notifications, so that the entry will get updated properly.
|
||||
|
||||
// Make sure to stash away the current generation so we can check whether
|
||||
// the table changes when we flush.
|
||||
PRUint32 generation = mIdentifierMap.GetGeneration();
|
||||
|
||||
FlushPendingNotifications(Flush_ContentAndNotify);
|
||||
|
||||
if (generation != mIdentifierMap.GetGeneration()) {
|
||||
// Table changed, so the entry pointer is no longer valid; look up the
|
||||
// entry again, adding if necessary (the adding may be necessary in case
|
||||
// the flush actually deleted entries).
|
||||
entry = mIdentifierMap.PutEntry(aID);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsDocument::GetElementById(const nsAString& aElementId, nsresult *aResult)
|
||||
nsDocument::GetElementById(const nsAString& aElementId)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> idAtom(do_GetAtom(aElementId));
|
||||
if (!idAtom) {
|
||||
*aResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// This can only fail due to OOM when the atom doesn't exist, in which
|
||||
// case there can't be an entry for it.
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!CheckGetElementByIdArg(idAtom)) {
|
||||
*aResult = NS_OK;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIdentifierMapEntry *entry = GetElementByIdInternal(idAtom);
|
||||
if (!entry) {
|
||||
*aResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
*aResult = NS_OK;
|
||||
|
||||
return entry->GetIdElement();
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(idAtom);
|
||||
return entry ? entry->GetIdElement() : nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetElementById(const nsAString& aId, nsIDOMElement** aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
Element *content = GetElementById(aId, &rv);
|
||||
Element *content = GetElementById(aId);
|
||||
if (content) {
|
||||
rv = CallQueryInterface(content, aReturn);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
return CallQueryInterface(content, aReturn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
*aReturn = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
|
@ -3942,7 +3776,7 @@ nsDocument::AddIDTargetObserver(nsIAtom* aID, IDTargetObserver aObserver,
|
|||
if (!CheckGetElementByIdArg(aID))
|
||||
return nsnull;
|
||||
|
||||
nsIdentifierMapEntry *entry = GetElementByIdInternal(aID);
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aID);
|
||||
NS_ENSURE_TRUE(entry, nsnull);
|
||||
|
||||
entry->AddContentChangeCallback(aObserver, aData);
|
||||
|
@ -3958,9 +3792,6 @@ nsDocument::RemoveIDTargetObserver(nsIAtom* aID,
|
|||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aID);
|
||||
if (!entry) {
|
||||
// We don't need to do the stuff that GetElementByIdInternal does;
|
||||
// if there's no entry already in mIdentifierMap, then there's no
|
||||
// callback to remove.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7380,12 +7211,13 @@ nsDocument::ForgetLink(Link* aLink)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocument::DestroyLinkMap()
|
||||
nsDocument::DestroyElementMaps()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mStyledLinksCleared = true;
|
||||
#endif
|
||||
mStyledLinks.Clear();
|
||||
mIdentifierMap.Clear();
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
@ -95,13 +95,7 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsIApplicationCache.h"
|
||||
#include "nsIApplicationCacheContainer.h"
|
||||
|
||||
// Put these here so all document impls get them automatically
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsHTMLCSSStyleSheet.h"
|
||||
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsXMLEventsManager.h"
|
||||
#include "pldhash.h"
|
||||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
|
@ -135,6 +129,9 @@ struct nsRadioGroupStruct;
|
|||
class nsOnloadBlocker;
|
||||
class nsUnblockOnloadEvent;
|
||||
class nsChildContentList;
|
||||
class nsXMLEventsManager;
|
||||
class nsHTMLStyleSheet;
|
||||
class nsHTMLCSSStyleSheet;
|
||||
|
||||
/**
|
||||
* Right now our identifier map entries contain information for 'name'
|
||||
|
@ -644,8 +641,6 @@ public:
|
|||
virtual nsIScriptGlobalObject* GetScriptGlobalObject() const;
|
||||
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject);
|
||||
|
||||
virtual nsIScriptGlobalObject*
|
||||
GetScriptHandlingObject(PRBool& aHasHadScriptHandlingObject) const;
|
||||
virtual void SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject);
|
||||
|
||||
virtual nsIScriptGlobalObject* GetScopeObject();
|
||||
|
@ -655,6 +650,17 @@ public:
|
|||
*/
|
||||
virtual nsScriptLoader* ScriptLoader();
|
||||
|
||||
/**
|
||||
* Add/Remove an element to the document's id and name hashes
|
||||
*/
|
||||
virtual void AddToIdTable(mozilla::dom::Element* aElement, nsIAtom* aId);
|
||||
virtual void RemoveFromIdTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aId);
|
||||
virtual void AddToNameTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aName);
|
||||
virtual void RemoveFromNameTable(mozilla::dom::Element* aElement,
|
||||
nsIAtom* aName);
|
||||
|
||||
/**
|
||||
* Add a new observer of document change notifications. Whenever
|
||||
* content is changed, appended, inserted or removed the observers are
|
||||
|
@ -812,13 +818,6 @@ public:
|
|||
// nsIDOMNSEventTarget
|
||||
NS_DECL_NSIDOMNSEVENTTARGET
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE
|
||||
|
||||
// nsIScriptObjectPrincipal
|
||||
virtual nsIPrincipal* GetPrincipal();
|
||||
|
||||
|
@ -942,17 +941,10 @@ public:
|
|||
GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName);
|
||||
|
||||
virtual mozilla::dom::Element *GetElementById(const nsAString& aElementId,
|
||||
nsresult *aResult);
|
||||
virtual mozilla::dom::Element *GetElementById(const nsAString& aElementId);
|
||||
|
||||
protected:
|
||||
friend class nsNodeUtils;
|
||||
void RegisterNamedItems(nsIContent *aContent);
|
||||
void UnregisterNamedItems(nsIContent *aContent);
|
||||
void UpdateNameTableEntry(Element *aElement);
|
||||
void UpdateIdTableEntry(Element *aElement);
|
||||
void RemoveFromNameTable(Element *aElement);
|
||||
void RemoveFromIdTable(Element *aElement);
|
||||
|
||||
/**
|
||||
* Check that aId is not empty and log a message to the console
|
||||
|
@ -971,8 +963,8 @@ protected:
|
|||
nsACString& aCharset);
|
||||
|
||||
// Call this before the document does something that will unbind all content.
|
||||
// That will stop us from resolving URIs for all links as they are removed.
|
||||
void DestroyLinkMap();
|
||||
// That will stop us from doing a lot of work as each element is removed.
|
||||
void DestroyElementMaps();
|
||||
|
||||
// Refreshes the hrefs of all the links in the document.
|
||||
void RefreshLinkHrefs();
|
||||
|
@ -1011,6 +1003,7 @@ protected:
|
|||
|
||||
virtual nsPIDOMWindow *GetWindowInternal();
|
||||
virtual nsPIDOMWindow *GetInnerWindowInternal();
|
||||
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const;
|
||||
|
||||
#define NS_DOCUMENT_NOTIFY_OBSERVERS(func_, params_) \
|
||||
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(mObservers, nsIDocumentObserver, \
|
||||
|
@ -1050,11 +1043,6 @@ protected:
|
|||
// Array of observers
|
||||
nsTObserverArray<nsIDocumentObserver*> mObservers;
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
// *inner* window object.
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
|
||||
// If document is created for example using
|
||||
// document.implementation.createDocument(...), mScriptObject points to
|
||||
// the script global object of the original document.
|
||||
|
@ -1085,8 +1073,6 @@ protected:
|
|||
PRPackedBool mIsGoingAway:1;
|
||||
// True if the document is being destroyed.
|
||||
PRPackedBool mInDestructor:1;
|
||||
// True if document has ever had script handling object.
|
||||
PRPackedBool mHasHadScriptHandlingObject:1;
|
||||
|
||||
// True if this document has ever had an HTML or SVG <title> element
|
||||
// bound to it
|
||||
|
|
|
@ -154,6 +154,9 @@ public:
|
|||
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
virtual nsIAtom* DoGetID() const;
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
|
||||
protected:
|
||||
nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
};
|
||||
|
@ -195,6 +198,18 @@ nsDocumentFragment::IsNodeOfType(PRUint32 aFlags) const
|
|||
return !(aFlags & ~(eCONTENT | eDOCUMENT_FRAGMENT));
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsDocumentFragment::DoGetID() const
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsDocumentFragment::GetIDAttributeName() const
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
DOMCI_DATA(DocumentFragment, nsDocumentFragment)
|
||||
|
||||
// QueryInterface implementation for nsDocumentFragment
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "nsIDOMFormData.h"
|
||||
#include "nsIXMLHttpRequest.h"
|
||||
#include "nsIFormSubmission.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsFormData : public nsIDOMFormData,
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsInProcessTabChildGlobal.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include "mozcontainer.h"
|
||||
|
@ -620,16 +621,41 @@ AllDescendantsOfType(nsIDocShellTreeItem* aParentItem, PRInt32 aType)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
bool
|
||||
/**
|
||||
* A class that automatically sets mInShow to false when it goes
|
||||
* out of scope.
|
||||
*/
|
||||
class NS_STACK_CLASS AutoResetInShow {
|
||||
private:
|
||||
nsFrameLoader* mFrameLoader;
|
||||
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
public:
|
||||
AutoResetInShow(nsFrameLoader* aFrameLoader MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mFrameLoader(aFrameLoader)
|
||||
{
|
||||
MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
}
|
||||
~AutoResetInShow() { mFrameLoader->mInShow = PR_FALSE; }
|
||||
};
|
||||
|
||||
|
||||
PRBool
|
||||
nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
|
||||
nsIFrameFrame* frame)
|
||||
{
|
||||
if (mInShow) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
// Reset mInShow if we exit early.
|
||||
AutoResetInShow resetInShow(this);
|
||||
mInShow = PR_TRUE;
|
||||
|
||||
nsContentType contentType;
|
||||
|
||||
nsresult rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
|
@ -641,7 +667,6 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
{
|
||||
if (!mDocShell)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell)
|
||||
|
@ -677,7 +702,7 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
|
||||
nsIView* view = frame->CreateViewAndWidget(contentType);
|
||||
if (!view)
|
||||
return false;
|
||||
return PR_FALSE;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
|
@ -715,7 +740,13 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
mInShow = PR_FALSE;
|
||||
if (mHideCalled) {
|
||||
mHideCalled = PR_FALSE;
|
||||
Hide();
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
|
@ -805,6 +836,14 @@ nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
|
|||
void
|
||||
nsFrameLoader::Hide()
|
||||
{
|
||||
if (mHideCalled) {
|
||||
return;
|
||||
}
|
||||
if (mInShow) {
|
||||
mHideCalled = PR_TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mDocShell)
|
||||
return;
|
||||
|
||||
|
@ -828,6 +867,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
NS_PRECONDITION((aFirstToSwap == this && aSecondToSwap == aOther) ||
|
||||
(aFirstToSwap == aOther && aSecondToSwap == this),
|
||||
"Swapping some sort of random loaders?");
|
||||
NS_ENSURE_STATE(!mInShow && !aOther->mInShow);
|
||||
|
||||
nsIContent* ourContent = mOwnerContent;
|
||||
nsIContent* otherContent = aOther->mOwnerContent;
|
||||
|
|
|
@ -57,6 +57,7 @@ class nsIURI;
|
|||
class nsIFrameFrame;
|
||||
class nsIView;
|
||||
class nsIInProcessContentFrameMessageManager;
|
||||
class AutoResetInShow;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
namespace mozilla {
|
||||
|
@ -76,6 +77,8 @@ class QX11EmbedContainer;
|
|||
|
||||
class nsFrameLoader : public nsIFrameLoader
|
||||
{
|
||||
friend class AutoResetInShow;
|
||||
|
||||
protected:
|
||||
nsFrameLoader(nsIContent *aOwner) :
|
||||
mOwnerContent(aOwner),
|
||||
|
@ -83,7 +86,9 @@ protected:
|
|||
mIsTopLevelContent(PR_FALSE),
|
||||
mDestroyCalled(PR_FALSE),
|
||||
mNeedsAsyncDestroy(PR_FALSE),
|
||||
mInSwap(PR_FALSE)
|
||||
mInSwap(PR_FALSE),
|
||||
mInShow(PR_FALSE),
|
||||
mHideCalled(PR_FALSE)
|
||||
#ifdef MOZ_IPC
|
||||
, mDelayRemoteDialogs(PR_FALSE)
|
||||
, mRemoteWidgetCreated(PR_FALSE)
|
||||
|
@ -120,9 +125,9 @@ public:
|
|||
* Called from the layout frame associated with this frame loader;
|
||||
* this notifies us to hook up with the widget and view.
|
||||
*/
|
||||
bool Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
|
||||
nsIFrameFrame* frame);
|
||||
PRBool Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
||||
PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
|
||||
nsIFrameFrame* frame);
|
||||
|
||||
/**
|
||||
* Called from the layout frame associated with this frame loader, when
|
||||
|
@ -196,6 +201,8 @@ private:
|
|||
PRPackedBool mDestroyCalled : 1;
|
||||
PRPackedBool mNeedsAsyncDestroy : 1;
|
||||
PRPackedBool mInSwap : 1;
|
||||
PRPackedBool mInShow : 1;
|
||||
PRPackedBool mHideCalled : 1;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
PRPackedBool mDelayRemoteDialogs : 1;
|
||||
|
@ -211,6 +218,7 @@ private:
|
|||
QX11EmbedContainer* mRemoteSocket;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -565,7 +565,7 @@ nsGenericDOMDataNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
// Notify XBL- & nsIAnonymousContentCreator-generated
|
||||
// anonymous content that the document is changing.
|
||||
// This is needed to update the insertion point.
|
||||
document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
|
||||
document->BindingManager()->RemovedFromDocument(this, document);
|
||||
}
|
||||
|
||||
mParentPtrBits = aNullParent ? 0 : mParentPtrBits & ~PARENT_BIT_INDOCUMENT;
|
||||
|
@ -1108,7 +1108,7 @@ nsGenericDOMDataNode::GetCurrentValueAtom()
|
|||
}
|
||||
|
||||
nsIAtom*
|
||||
nsGenericDOMDataNode::GetID() const
|
||||
nsGenericDOMDataNode::DoGetID() const
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ public:
|
|||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual PRBool IsLink(nsIURI** aURI) const;
|
||||
|
||||
virtual nsIAtom* GetID() const;
|
||||
virtual nsIAtom* DoGetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
|
|
|
@ -514,7 +514,7 @@ nsINode::GetPreviousSibling(nsIDOMNode** aPrevSibling)
|
|||
{
|
||||
*aPrevSibling = nsnull;
|
||||
|
||||
nsIContent *sibling = GetSibling(-1);
|
||||
nsIContent *sibling = GetPreviousSibling();
|
||||
|
||||
return sibling ? CallQueryInterface(sibling, aPrevSibling) : NS_OK;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ nsINode::GetNextSibling(nsIDOMNode** aNextSibling)
|
|||
{
|
||||
*aNextSibling = nsnull;
|
||||
|
||||
nsIContent *sibling = GetSibling(1);
|
||||
nsIContent *sibling = GetNextSibling();
|
||||
|
||||
return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
|
||||
}
|
||||
|
@ -2969,7 +2969,7 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
if (document) {
|
||||
// Notify XBL- & nsIAnonymousContentCreator-generated
|
||||
// anonymous content that the document is changing.
|
||||
document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
|
||||
document->BindingManager()->RemovedFromDocument(this, document);
|
||||
|
||||
document->ClearBoxObjectFor(this);
|
||||
}
|
||||
|
@ -3249,38 +3249,6 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
|
|||
aPresContext, aEventStatus);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsGenericElement::GetID() const
|
||||
{
|
||||
if (!HasFlag(NODE_MAY_HAVE_ID)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIAtom* IDName = GetIDAttributeName();
|
||||
if (IDName) {
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
|
||||
if (attrVal){
|
||||
if (attrVal->Type() == nsAttrValue::eAtom) {
|
||||
return attrVal->GetAtomValue();
|
||||
}
|
||||
if(attrVal->IsEmptyString()){
|
||||
return nsnull;
|
||||
}
|
||||
// Check if the ID has been stored as a string.
|
||||
// This would occur if the ID attribute name changed after
|
||||
// the ID was parsed.
|
||||
if (attrVal->Type() == nsAttrValue::eString) {
|
||||
nsAutoString idVal(attrVal->GetStringValue());
|
||||
|
||||
// Create an atom from the value and set it into the attribute list.
|
||||
const_cast<nsAttrValue*>(attrVal)->ParseAtom(idVal);
|
||||
return attrVal->GetAtomValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsGenericElement::DoGetClasses() const
|
||||
{
|
||||
|
@ -3371,12 +3339,6 @@ nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
|||
return nsChangeHint(0);
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsGenericElement::GetIDAttributeName() const
|
||||
{
|
||||
return mNodeInfo->GetIDAttributeAtom();
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsGenericElement::GetClassAttributeName() const
|
||||
{
|
||||
|
@ -3804,7 +3766,7 @@ nsGenericElement::DestroyContent()
|
|||
{
|
||||
nsIDocument *document = GetOwnerDoc();
|
||||
if (document) {
|
||||
document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
|
||||
document->BindingManager()->RemovedFromDocument(this, document);
|
||||
document->ClearBoxObjectFor(this);
|
||||
}
|
||||
|
||||
|
@ -4365,9 +4327,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
|
|||
|
||||
{
|
||||
nsIDocument *doc;
|
||||
if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc()) &&
|
||||
tmp->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
|
||||
doc->BindingManager()->ChangeDocumentFor(tmp, doc, nsnull);
|
||||
if (!tmp->GetNodeParent() && (doc = tmp->GetOwnerDoc())) {
|
||||
doc->BindingManager()->RemovedFromDocument(tmp, doc);
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
@ -4733,15 +4694,6 @@ nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None &&
|
||||
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
|
||||
SetFlags(NODE_MAY_HAVE_ID);
|
||||
// Store id as an atom. id="" means that the element has no id,
|
||||
// not that it has an emptystring as the id.
|
||||
aResult.ParseAtom(aValue);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,6 @@ public:
|
|||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||
PRBool aNullParent = PR_TRUE);
|
||||
virtual already_AddRefed<nsINodeList> GetChildren(PRInt32 aChildType);
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
|
@ -451,7 +450,6 @@ public:
|
|||
void ListAttributes(FILE* out) const;
|
||||
#endif
|
||||
|
||||
virtual nsIAtom* GetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
|
@ -994,15 +992,29 @@ protected:
|
|||
}
|
||||
|
||||
/**
|
||||
* GetContentsAsText will take all the textnodes that are children
|
||||
* of |this| and concatenate the text in them into aText. It
|
||||
* completely ignores any non-text-node children of |this|; in
|
||||
* particular it does not descend into any children of |this| that
|
||||
* happen to be container elements.
|
||||
*
|
||||
* @param aText the resulting text [OUT]
|
||||
* Add/remove this element to the documents id cache
|
||||
*/
|
||||
void GetContentsAsText(nsAString& aText);
|
||||
void AddToIdTable(nsIAtom* aId) {
|
||||
NS_ASSERTION(HasFlag(NODE_HAS_ID), "Node lacking NODE_HAS_ID flag");
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
|
||||
doc->AddToIdTable(this, aId);
|
||||
}
|
||||
}
|
||||
void RemoveFromIdTable() {
|
||||
if (HasFlag(NODE_HAS_ID)) {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsIAtom* id = DoGetID();
|
||||
// id can be null during mutation events evilness. Also, XUL elements
|
||||
// loose their proto attributes during cc-unlink, so this can happen
|
||||
// during cc-unlink too.
|
||||
if (id) {
|
||||
doc->RemoveFromIdTable(this, DoGetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to carry out event default actions for links of all types
|
||||
|
|
|
@ -195,17 +195,16 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
mSheet = aSheet; // not ref counted
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (mRuleMapper) {
|
||||
(*mRuleMapper)(this, aRuleData);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
/* virtual */ void
|
||||
nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
nsAutoString buffer;
|
||||
|
@ -228,8 +227,6 @@ nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const
|
|||
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
|
||||
fputs("\n", out);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -103,9 +103,9 @@ public:
|
|||
|
||||
|
||||
// nsIStyleRule
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
#ifdef DEBUG
|
||||
NS_METHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
@ -269,8 +269,22 @@ nsNodeUtils::LastRelease(nsINode* aNode)
|
|||
|
||||
if (aNode->IsElement()) {
|
||||
nsIDocument* ownerDoc = aNode->GetOwnerDoc();
|
||||
Element* elem = aNode->AsElement();
|
||||
if (ownerDoc) {
|
||||
ownerDoc->ClearBoxObjectFor(aNode->AsElement());
|
||||
ownerDoc->ClearBoxObjectFor(elem);
|
||||
}
|
||||
|
||||
NS_ASSERTION(aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) ||
|
||||
!ownerDoc ||
|
||||
!ownerDoc->BindingManager() ||
|
||||
!ownerDoc->BindingManager()->GetBinding(elem),
|
||||
"Non-forced node has binding on destruction");
|
||||
|
||||
// if NODE_FORCE_XBL_BINDINGS is set, the node might still have a binding
|
||||
// attached
|
||||
if (aNode->HasFlag(NODE_FORCE_XBL_BINDINGS) &&
|
||||
ownerDoc && ownerDoc->BindingManager()) {
|
||||
ownerDoc->BindingManager()->RemovedFromDocument(elem, ownerDoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -564,13 +578,6 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
|
|||
aCx, aOldScope, aNewScope, aNodesWithProperties,
|
||||
clone, getter_AddRefs(child));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isDeepDocumentClone) {
|
||||
NS_ASSERTION(child->IsNodeOfType(nsINode::eCONTENT),
|
||||
"A clone of a child of a node is not nsIContent?");
|
||||
|
||||
nsIContent* content = static_cast<nsIContent*>(child.get());
|
||||
static_cast<nsDocument*>(clone.get())->RegisterNamedItems(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1411,8 +1411,10 @@ nsPlainTextSerializer::AddToLine(const PRUnichar * aLineFragment,
|
|||
else {
|
||||
mCurrentLine.Right(restOfLine, linelength-goodSpace);
|
||||
}
|
||||
// if breaker was U+0020, it has to consider for delsp=yes support
|
||||
PRBool breakBySpace = mCurrentLine.CharAt(goodSpace) == ' ';
|
||||
mCurrentLine.Truncate(goodSpace);
|
||||
EndLine(PR_TRUE);
|
||||
EndLine(PR_TRUE, breakBySpace);
|
||||
mCurrentLine.Truncate();
|
||||
// Space stuff new line?
|
||||
if(mFlags & nsIDocumentEncoder::OutputFormatFlowed) {
|
||||
|
@ -1450,7 +1452,7 @@ nsPlainTextSerializer::AddToLine(const PRUnichar * aLineFragment,
|
|||
* preformatted.
|
||||
*/
|
||||
void
|
||||
nsPlainTextSerializer::EndLine(PRBool aSoftlinebreak)
|
||||
nsPlainTextSerializer::EndLine(PRBool aSoftlinebreak, PRBool aBreakBySpace)
|
||||
{
|
||||
PRUint32 currentlinelength = mCurrentLine.Length();
|
||||
|
||||
|
@ -1482,7 +1484,13 @@ nsPlainTextSerializer::EndLine(PRBool aSoftlinebreak)
|
|||
// Add the soft part of the soft linebreak (RFC 2646 4.1)
|
||||
// We only do this when there is no indentation since format=flowed
|
||||
// lines and indentation doesn't work well together.
|
||||
mCurrentLine.Append(PRUnichar(' '));
|
||||
|
||||
// If breaker character is ASCII space with RFC 3676 support (delsp=yes),
|
||||
// add twice space.
|
||||
if (mFlags & nsIDocumentEncoder::OutputFormatDelSp && aBreakBySpace)
|
||||
mCurrentLine.Append(NS_LITERAL_STRING(" "));
|
||||
else
|
||||
mCurrentLine.Append(PRUnichar(' '));
|
||||
}
|
||||
|
||||
if(aSoftlinebreak) {
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
protected:
|
||||
nsresult GetAttributeValue(const nsIParserNode* node, nsIAtom* aName, nsString& aValueRet);
|
||||
void AddToLine(const PRUnichar* aStringToAdd, PRInt32 aLength);
|
||||
void EndLine(PRBool softlinebreak);
|
||||
void EndLine(PRBool softlinebreak, PRBool aBreakBySpace = PR_FALSE);
|
||||
void EnsureVerticalSpace(PRInt32 noOfRows);
|
||||
void FlushLine();
|
||||
void OutputQuotesAndIndent(PRBool stripTrailingSpaces=PR_FALSE);
|
||||
|
|
|
@ -71,6 +71,20 @@ nsStyledElement::GetIDAttributeName() const
|
|||
return nsGkAtoms::id;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsStyledElement::DoGetID() const
|
||||
{
|
||||
NS_ASSERTION(HasFlag(NODE_HAS_ID), "Unexpected call");
|
||||
|
||||
// The nullcheck here is needed because nsGenericElement::UnsetAttr calls
|
||||
// out to various code between removing the attribute and we get a chance to
|
||||
// clear the NODE_HAS_ID flag.
|
||||
|
||||
const nsAttrValue* attr = mAttrsAndChildren.GetAttr(nsGkAtoms::id);
|
||||
|
||||
return attr ? attr->GetAtomValue() : nsnull;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsStyledElement::DoGetClasses() const
|
||||
{
|
||||
|
@ -93,12 +107,45 @@ nsStyledElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
|||
aResult.ParseAtomArray(aValue);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::id) {
|
||||
// Store id as an atom. id="" means that the element has no id,
|
||||
// not that it has an emptystring as the id.
|
||||
RemoveFromIdTable();
|
||||
if (aValue.IsEmpty()) {
|
||||
UnsetFlags(NODE_HAS_ID);
|
||||
return PR_FALSE;
|
||||
}
|
||||
aResult.ParseAtom(aValue);
|
||||
SetFlags(NODE_HAS_ID);
|
||||
AddToIdTable(aResult.GetAtomValue());
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return nsStyledElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyledElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify)
|
||||
{
|
||||
PRBool isId = PR_FALSE;
|
||||
if (aAttribute == nsGkAtoms::id && aNameSpaceID == kNameSpaceID_None) {
|
||||
// Have to do this before clearing flag. See RemoveFromIdTable
|
||||
RemoveFromIdTable();
|
||||
isId = PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = nsGenericElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
|
||||
if (isId) {
|
||||
UnsetFlags(NODE_HAS_ID);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
|
||||
{
|
||||
|
@ -163,13 +210,28 @@ nsStyledElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// XXXbz if we already have a style attr parsed, this won't do
|
||||
// anything... need to fix that.
|
||||
ReparseStyleAttribute(PR_FALSE);
|
||||
if (aDocument && HasFlag(NODE_HAS_ID) && !GetBindingParent()) {
|
||||
aDocument->AddToIdTable(this, DoGetID());
|
||||
}
|
||||
|
||||
return rv;
|
||||
if (!IsXUL()) {
|
||||
// XXXbz if we already have a style attr parsed, this won't do
|
||||
// anything... need to fix that.
|
||||
ReparseStyleAttribute(PR_FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyledElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
||||
{
|
||||
RemoveFromIdTable();
|
||||
|
||||
nsStyledElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Others and helpers
|
||||
|
||||
|
|
|
@ -64,9 +64,10 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
// nsIContent interface methods for styling
|
||||
// nsIContent interface methods
|
||||
virtual nsIAtom* GetClassAttributeName() const;
|
||||
virtual nsIAtom* GetIDAttributeName() const;
|
||||
virtual nsIAtom* DoGetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
|
@ -75,6 +76,10 @@ public:
|
|||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
PRBool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(PRBool aDeep, PRBool aNullParent);
|
||||
|
||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -343,6 +343,7 @@ _TEST_FILES2 = \
|
|||
test_bug475156.html \
|
||||
bug475156.sjs \
|
||||
test_bug544642.html \
|
||||
test_bug564863.xhtml \
|
||||
test_copypaste.html \
|
||||
test_bug503481.html \
|
||||
file_bug503481.sjs \
|
||||
|
@ -388,6 +389,10 @@ _TEST_FILES2 = \
|
|||
test_bug562652.html \
|
||||
test_bug562137.html \
|
||||
file_bug562137.txt \
|
||||
test_bug548193.html \
|
||||
file_bug548193.sjs \
|
||||
test_html_colors_quirks.html \
|
||||
test_html_colors_standards.html \
|
||||
$(NULL)
|
||||
|
||||
# This test fails on the Mac for some reason
|
||||
|
|
|
@ -45,11 +45,12 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
void
|
||||
ConvertBufToPlainText(nsString &aConBuf)
|
||||
ConvertBufToPlainText(nsString &aConBuf, int aFlag)
|
||||
{
|
||||
nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID);
|
||||
if (parser) {
|
||||
|
@ -59,7 +60,7 @@ ConvertBufToPlainText(nsString &aConBuf)
|
|||
nsCOMPtr<nsIHTMLToTextSink> textSink(do_QueryInterface(sink));
|
||||
if (textSink) {
|
||||
nsAutoString convertedText;
|
||||
textSink->Initialize(&convertedText, 0, 72);
|
||||
textSink->Initialize(&convertedText, aFlag, 72);
|
||||
parser->SetContentSink(sink);
|
||||
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
|
||||
aConBuf = convertedText;
|
||||
|
@ -68,13 +69,87 @@ ConvertBufToPlainText(nsString &aConBuf)
|
|||
}
|
||||
}
|
||||
|
||||
// Test for ASCII with format=flowed; delsp=yes
|
||||
nsresult
|
||||
TestASCIIWithFlowedDelSp()
|
||||
{
|
||||
nsString test;
|
||||
nsString result;
|
||||
|
||||
test.AssignLiteral("<html><body>"
|
||||
"Firefox Firefox Firefox Firefox "
|
||||
"Firefox Firefox Firefox Firefox "
|
||||
"Firefox Firefox Firefox Firefox"
|
||||
"</body></html>");
|
||||
|
||||
ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted |
|
||||
nsIDocumentEncoder::OutputCRLineBreak |
|
||||
nsIDocumentEncoder::OutputLFLineBreak |
|
||||
nsIDocumentEncoder::OutputFormatFlowed |
|
||||
nsIDocumentEncoder::OutputFormatDelSp);
|
||||
|
||||
// create result case
|
||||
result.AssignLiteral("Firefox Firefox Firefox Firefox "
|
||||
"Firefox Firefox Firefox Firefox "
|
||||
"Firefox \r\nFirefox Firefox Firefox\r\n");
|
||||
|
||||
if (!test.Equals(result)) {
|
||||
fail("Wrong HTML to ASCII text serialization with format=flowed; delsp=yes");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
passed("HTML to ASCII text serialization with format=flowed; delsp=yes");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Test for CJK with format=flowed; delsp=yes
|
||||
nsresult
|
||||
TestCJKWithFlowedDelSp()
|
||||
{
|
||||
nsString test;
|
||||
nsString result;
|
||||
|
||||
test.AssignLiteral("<html><body>");
|
||||
for (PRUint32 i = 0; i < 40; i++) {
|
||||
// Insert Kanji (U+5341)
|
||||
test.Append(0x5341);
|
||||
}
|
||||
test.AppendLiteral("</body></html>");
|
||||
|
||||
ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted |
|
||||
nsIDocumentEncoder::OutputCRLineBreak |
|
||||
nsIDocumentEncoder::OutputLFLineBreak |
|
||||
nsIDocumentEncoder::OutputFormatFlowed |
|
||||
nsIDocumentEncoder::OutputFormatDelSp);
|
||||
|
||||
// create result case
|
||||
for (PRUint32 i = 0; i < 36; i++) {
|
||||
result.Append(0x5341);
|
||||
}
|
||||
result.Append(NS_LITERAL_STRING(" \r\n"));
|
||||
for (PRUint32 i = 0; i < 4; i++) {
|
||||
result.Append(0x5341);
|
||||
}
|
||||
result.Append(NS_LITERAL_STRING("\r\n"));
|
||||
|
||||
if (!test.Equals(result)) {
|
||||
fail("Wrong HTML to CJK text serialization with format=flowed; delsp=yes");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
passed("HTML to CJK text serialization with format=flowed; delsp=yes");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestPlainTextSerializer()
|
||||
{
|
||||
nsString test;
|
||||
test.AppendLiteral("<html><base>base</base><head><span>span</span></head>"
|
||||
"<body>body</body></html>");
|
||||
ConvertBufToPlainText(test);
|
||||
ConvertBufToPlainText(test, 0);
|
||||
if (!test.EqualsLiteral("basespanbody")) {
|
||||
fail("Wrong html to text serialization");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -82,6 +157,12 @@ TestPlainTextSerializer()
|
|||
|
||||
passed("HTML to text serialization test");
|
||||
|
||||
nsresult rv = TestASCIIWithFlowedDelSp();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = TestCJKWithFlowedDelSp();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Add new tests here...
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// SJS file for CSP violation report test
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
|
||||
// avoid confusing cache behaviors
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
|
||||
// set CSP header
|
||||
response.setHeader("X-Content-Security-Policy",
|
||||
"allow 'self'; report-uri http://mochi.test:8888/csp-report.cgi",
|
||||
false);
|
||||
|
||||
// content which will trigger a violation report
|
||||
response.write('<html><body>');
|
||||
response.write('<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png"> </img>');
|
||||
response.write('</body></html>');
|
||||
}
|
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493881
|
|||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body id="body">
|
||||
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=493881"
|
||||
target="_blank" >Mozilla Bug 493881</a>
|
||||
|
|
|
@ -10,7 +10,7 @@ var legacyProps = ["fgColor", "bgColor", "linkColor", "vlinkColor", "alinkColor"
|
|||
var testColors = ["blue", "silver", "green", "orange", "red"];
|
||||
var rgbTestColors = ["rgb(255, 0, 0)", "rgb(192, 192, 192)", "rgb(0, 128, 0)", "rgb(255, 165, 0)", "rgb(255, 0, 0)"];
|
||||
var idPropList = [ {id: "plaintext", prop: "color"},
|
||||
{id: "plaintext", prop: "background-color"},
|
||||
{id: "body", prop: "background-color"},
|
||||
{id: "nonvisitedlink", prop: "color"},
|
||||
{id: "visitedlink", prop: "color"} ];
|
||||
var initialValues = [];
|
||||
|
@ -58,13 +58,13 @@ addLoadEvent( function() {
|
|||
"Unexpected value of " + legacyProps[i] + " after setting to undefined");
|
||||
}
|
||||
|
||||
// Verify that setting legacy color props to undefined did not affect rendering
|
||||
// (computed styles).
|
||||
// Verify that setting legacy color props to undefined led to result
|
||||
// of parsing undefined as a color.
|
||||
for (i = 0; i < idPropList.length; i++) {
|
||||
var style = window.getComputedStyle(document.getElementById(idPropList[i].id), null);
|
||||
var color = style.getPropertyValue(idPropList[i].prop);
|
||||
is(color, idPropList[i].initialComputedColor,
|
||||
"element's style changed by setting legacy prop to undefined");
|
||||
is(color, "rgb(0, 239, 14)",
|
||||
"element's style should get result of parsing undefined as a color");
|
||||
}
|
||||
|
||||
// Mark the test as finished.
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for CSP JSON violation report</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<iframe style="width:200px;height:200px;" id='cspframe'></iframe>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
// This is used to watch requests go out so we can see if the report is
|
||||
// sent correctly
|
||||
function examiner() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var obsvc = Components.classes['@mozilla.org/observer-service;1']
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
obsvc.addObserver(this, "http-on-modify-request", false);
|
||||
}
|
||||
examiner.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
// subject should be an nsURI
|
||||
if(!subject.QueryInterface)
|
||||
return;
|
||||
|
||||
const reportURI = "http://mochi.test:8888/csp-report.cgi";
|
||||
|
||||
if (topic === "http-on-modify-request") {
|
||||
var uri = subject.QueryInterface(Components.interfaces.nsIHttpChannel).URI;
|
||||
if (uri.asciiSpec !== reportURI) return;
|
||||
|
||||
// Verify that the report was properly formatted.
|
||||
// We'll parse the report text as JSON and verify that the properties
|
||||
// have expected values.
|
||||
var reportText = "{}";
|
||||
try {
|
||||
var uploadStream = subject.QueryInterface(Components.interfaces.nsIUploadChannel).uploadStream;
|
||||
|
||||
if (uploadStream) {
|
||||
// get the bytes from the request body
|
||||
var binstream = Components.classes["@mozilla.org/binaryinputstream;1"]
|
||||
.createInstance(Components.interfaces.nsIBinaryInputStream);
|
||||
binstream.setInputStream(uploadStream);
|
||||
|
||||
var segments = [];
|
||||
for (var count = uploadStream.available(); count; count = uploadStream.available())
|
||||
segments.push(binstream.readBytes(count));
|
||||
|
||||
var reportText = segments.join("");
|
||||
}
|
||||
}
|
||||
catch(e) {}
|
||||
|
||||
var reportObj = JSON.parse(reportText);
|
||||
|
||||
// test for the proper values in the report object
|
||||
window.checkResults(reportObj);
|
||||
|
||||
// finish up
|
||||
window.examiner.remove();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
},
|
||||
|
||||
// remove the listener
|
||||
remove: function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var obsvc = Components.classes['@mozilla.org/observer-service;1']
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
obsvc.removeObserver(this, "http-on-modify-request");
|
||||
}
|
||||
}
|
||||
|
||||
// content file that triggers a violation report
|
||||
var testFile = "file_bug548193.sjs";
|
||||
|
||||
window.checkResults = function(reportObj) {
|
||||
var cspReport = reportObj["csp-report"];
|
||||
// correct violating request
|
||||
is(cspReport["request"],
|
||||
"GET http://mochi.test:8888/tests/content/base/test/" + testFile + " HTTP/1.1",
|
||||
"Incorrect violating request");
|
||||
// correct blocked-uri
|
||||
is(cspReport["blocked-uri"],
|
||||
"http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png",
|
||||
"Incorrect blocked uri");
|
||||
// correct violated-directive
|
||||
is(cspReport["violated-directive"], "allow http://mochi.test:8888",
|
||||
"Incorrect violated directive");
|
||||
// not practical to test request-headers as header names and values will
|
||||
// change with the trunk
|
||||
}
|
||||
|
||||
window.examiner = new examiner();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// load the resource which will generate a CSP violation report
|
||||
document.getElementById("cspframe").src = testFile;
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,328 @@
|
|||
<!DOCTYPE html [
|
||||
<!ATTLIST ns:x id ID #REQUIRED>
|
||||
<!ATTLIST ns2:x id_2 ID #REQUIRED>
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:ns="urn:namespace"
|
||||
xmlns:ns2="urn:namespace">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=564863
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 564863</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
#div_id {
|
||||
color: rgb(10, 10, 10);
|
||||
}
|
||||
#a_id {
|
||||
color: rgb(20, 20, 20);
|
||||
}
|
||||
#xul_id {
|
||||
color: rgb(30, 30, 30);
|
||||
}
|
||||
#svg_id {
|
||||
color: rgb(40, 40, 40);
|
||||
}
|
||||
#ns_id {
|
||||
color: rgb(50, 50, 50);
|
||||
}
|
||||
#ns2_id {
|
||||
color: rgb(60, 60, 60);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=564863">Mozilla Bug 564863</a>
|
||||
<!-- Elements to ensure we have nodeinfos with id-attribute set -->
|
||||
<div><ns:x id="ns-holder"/><ns2:x id_2="ns2-holder"/></div>
|
||||
|
||||
<!-- DOM to muck around with for tests -->
|
||||
<p id="root">
|
||||
<div id="div_id" />
|
||||
<a id="a_id" />
|
||||
<xul:button id="xul_id" />
|
||||
<svg:svg><svg:g id="svg_id" /></svg:svg>
|
||||
<ns:x id="ns_id" />
|
||||
</p>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
root = $('root');
|
||||
div = root.children[0];
|
||||
a = root.children[1];
|
||||
xul = root.children[2];
|
||||
svg = root.children[3].firstChild;
|
||||
nsx = root.children[4];
|
||||
|
||||
var div_cs = getComputedStyle(div, "");
|
||||
var a_cs = getComputedStyle(a, "");
|
||||
var xul_cs = getComputedStyle(xul, "");
|
||||
var svg_cs = getComputedStyle(svg, "");
|
||||
var nsx_cs = getComputedStyle(nsx, "");
|
||||
|
||||
function checkHasId(test) {
|
||||
// Check computed style first to avoid flushes from hiding problems
|
||||
checkHasIdNoGEBI(test);
|
||||
|
||||
is($("div_id"), div, "div getElementById " + test);
|
||||
is($("a_id"), a, "a getElementById " + test);
|
||||
is($("xul_id"), xul, "xul getElementById " + test);
|
||||
is($("svg_id"), svg, "svg getElementById " + test);
|
||||
is($("ns_id"), nsx, "ns getElementById " + test);
|
||||
}
|
||||
|
||||
function checkHasIdNoGEBI(test) {
|
||||
is(div_cs.color, "rgb(10, 10, 10)", "div color " + test);
|
||||
is(a_cs.color, "rgb(20, 20, 20)", "a color " + test);
|
||||
is(xul_cs.color, "rgb(30, 30, 30)", "xul color " + test);
|
||||
is(svg_cs.color, "rgb(40, 40, 40)", "svg color " + test);
|
||||
is(nsx_cs.color, "rgb(50, 50, 50)", "nsx color " + test);
|
||||
|
||||
is(div.id, "div_id", "div id " + test);
|
||||
is(a.id, "a_id", "a id " + test);
|
||||
is(xul.id, "xul_id", "xul id " + test);
|
||||
is(svg.id, "svg_id", "svg id " + test);
|
||||
is (nsx.getAttribute("id"), "ns_id", "ns id " + test);
|
||||
}
|
||||
|
||||
function checkHasNoId(removed, test) {
|
||||
is(div_cs.color, "rgb(0, 0, 0)", "div color " + test);
|
||||
is(a_cs.color, "rgb(0, 0, 0)", "a color " + test);
|
||||
is(xul_cs.color, "rgb(0, 0, 0)", "xul color " + test);
|
||||
is(svg_cs.color, "rgb(0, 0, 0)", "svg color " + test);
|
||||
is(nsx_cs.color, "rgb(0, 0, 0)", "nsx color " + test);
|
||||
|
||||
attrValue = removed ? null : "";
|
||||
|
||||
is(div.id, "", "div id " + test);
|
||||
is(a.id, "", "a id " + test);
|
||||
is(xul.id, "", "xul id " + test);
|
||||
is(svg.id, "", "svg id " + test);
|
||||
|
||||
is(div.getAttribute("id"), attrValue, "div getAttribute " + test);
|
||||
is(a.getAttribute("id"), attrValue, "a getAttribute " + test);
|
||||
is(xul.getAttribute("id"), "", "xul getAttribute " + test);
|
||||
is(svg.getAttribute("id"), attrValue, "svg getAttribute " + test);
|
||||
is(nsx.getAttribute("id"), attrValue, "ns getAttribute " + test);
|
||||
|
||||
is($("div_id"), null, "div getElementById " + test);
|
||||
is($("a_id"), null, "a getElementById " + test);
|
||||
is($("xul_id"), null, "xul getElementById " + test);
|
||||
is($("svg_id"), null, "svg getElementById " + test);
|
||||
is($("ns_id"), null, "ns getElementById " + test);
|
||||
}
|
||||
|
||||
// Check that dynamic modifications of attribute work
|
||||
|
||||
checkHasId("in markup");
|
||||
|
||||
div.id = "";
|
||||
a.id = "";
|
||||
xul.id = "";
|
||||
svg.id = "";
|
||||
nsx.setAttribute("id", "");
|
||||
|
||||
checkHasNoId(false, "set to empty");
|
||||
|
||||
div.id = "div_id";
|
||||
a.id = "a_id";
|
||||
xul.id = "xul_id";
|
||||
svg.id = "svg_id";
|
||||
nsx.setAttribute("id", "ns_id");
|
||||
|
||||
checkHasId("set using .id");
|
||||
|
||||
div.setAttribute("id", "");
|
||||
a.setAttribute("id", "");
|
||||
xul.setAttribute("id", "");
|
||||
svg.setAttribute("id", "");
|
||||
nsx.setAttribute("id", "");
|
||||
|
||||
checkHasNoId(false, "setAttribute to empty");
|
||||
|
||||
div.id = "div_id";
|
||||
a.id = "a_id";
|
||||
xul.id = "xul_id";
|
||||
svg.id = "svg_id";
|
||||
nsx.setAttribute("id", "ns_id");
|
||||
|
||||
checkHasId("set again using .id");
|
||||
|
||||
div.removeAttribute("id");
|
||||
a.removeAttribute("id");
|
||||
xul.removeAttribute("id");
|
||||
svg.removeAttribute("id");
|
||||
nsx.removeAttribute("id");
|
||||
|
||||
checkHasNoId(true, "removed attribute");
|
||||
|
||||
div.setAttribute("id", "div_id");
|
||||
a.setAttribute("id", "a_id");
|
||||
xul.setAttribute("id", "xul_id");
|
||||
svg.setAttribute("id", "svg_id");
|
||||
nsx.setAttribute("id", "ns_id");
|
||||
|
||||
checkHasId("set using setAttribute");
|
||||
|
||||
t1 = document.createElement("div");
|
||||
t1.id = "div_id";
|
||||
t2 = document.createElement("a");
|
||||
t2.id = "a_id";
|
||||
t3 = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "button");
|
||||
t3.id = "xul_id";
|
||||
t4 = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
||||
t4.id = "svg_id";
|
||||
t5 = document.createElementNS("urn:namespace", "ns:x");
|
||||
t5.setAttribute("id", "ns_id");
|
||||
|
||||
// Check that inserting elements before/after existing work
|
||||
|
||||
function insertAfter(newChild, existing) {
|
||||
existing.parentNode.insertBefore(newChild, existing.nextSibling);
|
||||
}
|
||||
function insertBefore(newChild, existing) {
|
||||
existing.parentNode.insertBefore(newChild, existing);
|
||||
}
|
||||
function removeNode(child) {
|
||||
child.parentNode.removeChild(child);
|
||||
}
|
||||
|
||||
insertAfter(t1, div);
|
||||
insertAfter(t2, a);
|
||||
insertAfter(t3, xul);
|
||||
insertAfter(t4, svg);
|
||||
insertAfter(t5, nsx);
|
||||
|
||||
checkHasId("inserted after");
|
||||
|
||||
insertBefore(t1, div);
|
||||
insertBefore(t2, a);
|
||||
insertBefore(t3, xul);
|
||||
insertBefore(t4, svg);
|
||||
insertBefore(t5, nsx);
|
||||
|
||||
checkHasIdNoGEBI("inserted before");
|
||||
is($("div_id"), t1, "div getElementById inserted before");
|
||||
is($("a_id"), t2, "a getElementById inserted before");
|
||||
is($("xul_id"), t3, "xul getElementById inserted before");
|
||||
is($("svg_id"), t4, "svg getElementById inserted before");
|
||||
is($("ns_id"), t5, "ns getElementById inserted before");
|
||||
|
||||
t1.removeAttribute("id");
|
||||
t2.removeAttribute("id");
|
||||
t3.removeAttribute("id");
|
||||
t4.removeAttribute("id");
|
||||
t5.removeAttribute("id");
|
||||
|
||||
checkHasId("removed tx attribute");
|
||||
|
||||
t1.setAttribute("id", "div_id");
|
||||
t2.setAttribute("id", "a_id");
|
||||
t3.setAttribute("id", "xul_id");
|
||||
t4.setAttribute("id", "svg_id");
|
||||
t5.setAttribute("id", "ns_id");
|
||||
|
||||
checkHasIdNoGEBI("setAttribute before");
|
||||
is($("div_id"), t1, "div getElementById setAttribute before");
|
||||
is($("a_id"), t2, "a getElementById setAttribute before");
|
||||
is($("xul_id"), t3, "xul getElementById setAttribute before");
|
||||
is($("svg_id"), t4, "svg getElementById setAttribute before");
|
||||
is($("ns_id"), t5, "ns getElementById setAttribute before");
|
||||
|
||||
removeNode(t1);
|
||||
removeNode(t2);
|
||||
removeNode(t3);
|
||||
removeNode(t4);
|
||||
removeNode(t5);
|
||||
|
||||
checkHasId("removed temporaries");
|
||||
|
||||
removeNode(div);
|
||||
removeNode(a);
|
||||
removeNode(xul);
|
||||
removeNode(svg);
|
||||
removeNode(nsx);
|
||||
|
||||
checkHasIdNoGEBI("removed node");
|
||||
|
||||
// Check that removing an element during UnsetAttr works
|
||||
is(div.id, "div_id", "div still has id set");
|
||||
var mutateFired = false;
|
||||
root.appendChild(div);
|
||||
var f = function(e) {
|
||||
div.removeEventListener("DOMAttrModified", f, false);
|
||||
is(e.target, div, "target is div");
|
||||
is(div.id, "", "div no longer has id");
|
||||
is(div.getAttribute("id"), null, "div no longer has id attr");
|
||||
removeNode(div);
|
||||
is(div.parentNode, null, "div was removed");
|
||||
mutateFired = true;
|
||||
}
|
||||
div.addEventListener("DOMAttrModified", f, false);
|
||||
div.removeAttribute("id");
|
||||
ok(mutateFired, "mutation event fired");
|
||||
|
||||
// Check same for XML elements
|
||||
is(nsx.getAttribute("id"), "ns_id", "nsx still has id set");
|
||||
mutateFired = false;
|
||||
root.appendChild(nsx);
|
||||
var f2 = function(e) {
|
||||
nsx.removeEventListener("DOMAttrModified", f2, false);
|
||||
is(e.target, nsx, "target is nsx");
|
||||
is(nsx.getAttribute("id"), null, "nsx no longer has id attr");
|
||||
removeNode(nsx);
|
||||
is(nsx.parentNode, null, "nsx was removed");
|
||||
mutateFired = true;
|
||||
}
|
||||
nsx.addEventListener("DOMAttrModified", f2, false);
|
||||
nsx.removeAttribute("id");
|
||||
ok(mutateFired, "mutation event fired");
|
||||
|
||||
|
||||
// Check that modifying the id-name of an XML element works
|
||||
ok($("ns-holder"), "ns-holder exists");
|
||||
ok($("ns2-holder"), "ns2-holder exists");
|
||||
root.appendChild(nsx);
|
||||
nsx.setAttribute("id", "ns_id");
|
||||
is(nsx_cs.color, "rgb(50, 50, 50)", "nsx has initial id");
|
||||
is($("ns_id"), nsx, "gEBI works on old id");
|
||||
nsx.setAttribute("id_2", "ns2_id");
|
||||
nsx.prefix = "ns2";
|
||||
removeNode(nsx);
|
||||
root.appendChild(nsx);
|
||||
is(nsx_cs.color, "rgb(60, 60, 60)", "nsx has new id");
|
||||
is($("ns2_id"), nsx, "gEBI works on new id");
|
||||
|
||||
// Need to change id and then CC to ensure that we don't end up with dangling pointers
|
||||
function gc() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.garbageCollect();
|
||||
}
|
||||
ok($("ns-holder"), "ns-holder exists");
|
||||
ok($("ns2-holder"), "ns2-holder exists");
|
||||
tempNode = document.createElementNS("urn:namespace", "ns:x");
|
||||
tempNode.setAttribute("id", "tempNode_id");
|
||||
document.body.appendChild(tempNode);
|
||||
is($("tempNode_id"), tempNode, "tempNode in gEBI table");
|
||||
tempNode.prefix = "ns2";
|
||||
removeNode(tempNode);
|
||||
tempNode = null;
|
||||
gc();
|
||||
$("tempNode_id");
|
||||
ok(true, "Didn't crash when accessing old id");
|
||||
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,712 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=121738
|
||||
-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Test for Bug 121738</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=121738">Mozilla Bug 121738</a>
|
||||
<table id="table0"></table>
|
||||
<table id="table1"></table>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 121738 **/
|
||||
|
||||
String.prototype.toAsciiLowerCase = function () {
|
||||
var output = "";
|
||||
for (var i = 0, len = this.length; i < len; ++i) {
|
||||
if (this.charCodeAt(i) >= 0x41 && this.charCodeAt(i) <= 0x5A) {
|
||||
output += String.fromCharCode(this.charCodeAt(i) + 0x20)
|
||||
} else {
|
||||
output += this.charAt(i);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
var tests = [
|
||||
"#135",
|
||||
" #135",
|
||||
"#135 ",
|
||||
" #135 ",
|
||||
"# 135",
|
||||
"# 135",
|
||||
"#123456",
|
||||
" #123456",
|
||||
"#123456 ",
|
||||
" #123456 ",
|
||||
"# 123456",
|
||||
"# 123456",
|
||||
"aliceblue",
|
||||
"ALICEBLUE",
|
||||
"alıceblue",
|
||||
"alİceblue",
|
||||
" aliceblue",
|
||||
"aliceblue ",
|
||||
" aliceblue ",
|
||||
"antiquewhite",
|
||||
"aqua",
|
||||
"aquamarine",
|
||||
"azure",
|
||||
"beige",
|
||||
"bisque",
|
||||
"black",
|
||||
"blanchedalmond",
|
||||
"blue",
|
||||
"blueviolet",
|
||||
"brown",
|
||||
"burlywood",
|
||||
"cadetblue",
|
||||
"chartreuse",
|
||||
"chocolate",
|
||||
"coral",
|
||||
"cornflowerblue",
|
||||
"cornsilk",
|
||||
"crimson",
|
||||
"cyan",
|
||||
"darkblue",
|
||||
"darkcyan",
|
||||
"darkgoldenrod",
|
||||
"darkgray",
|
||||
"darkgreen",
|
||||
"darkgrey",
|
||||
"darkkhaki",
|
||||
"darkmagenta",
|
||||
"darkolivegreen",
|
||||
"darkorange",
|
||||
"darkorchid",
|
||||
"darkred",
|
||||
"darksalmon",
|
||||
"darkseagreen",
|
||||
"darkslateblue",
|
||||
"darkslategray",
|
||||
"darkslategrey",
|
||||
"darkturquoise",
|
||||
"darkviolet",
|
||||
"deeppink",
|
||||
"deepskyblue",
|
||||
"dimgray",
|
||||
"dimgrey",
|
||||
"dodgerblue",
|
||||
"firebrick",
|
||||
"floralwhite",
|
||||
"forestgreen",
|
||||
"fuchsia",
|
||||
"gainsboro",
|
||||
"ghostwhite",
|
||||
"gold",
|
||||
"goldenrod",
|
||||
"gray",
|
||||
"green",
|
||||
"greenyellow",
|
||||
"grey",
|
||||
"honeydew",
|
||||
"hotpink",
|
||||
"indianred",
|
||||
"indigo",
|
||||
"ivory",
|
||||
"khaki",
|
||||
"lavender",
|
||||
"lavenderblush",
|
||||
"lawngreen",
|
||||
"lemonchiffon",
|
||||
"lightblue",
|
||||
"lightcoral",
|
||||
"lightcyan",
|
||||
"lightgoldenrodyellow",
|
||||
"lightgray",
|
||||
"lightgreen",
|
||||
"lightgrey",
|
||||
"lightpink",
|
||||
"lightsalmon",
|
||||
"lightseagreen",
|
||||
"lightskyblue",
|
||||
"lightslategray",
|
||||
"lightslategrey",
|
||||
"lightsteelblue",
|
||||
"lightyellow",
|
||||
"lime",
|
||||
"limegreen",
|
||||
"linen",
|
||||
"magenta",
|
||||
"maroon",
|
||||
"mediumaquamarine",
|
||||
"mediumblue",
|
||||
"mediumorchid",
|
||||
"mediumpurple",
|
||||
"mediumseagreen",
|
||||
"mediumslateblue",
|
||||
"mediumspringgreen",
|
||||
"mediumturquoise",
|
||||
"mediumvioletred",
|
||||
"midnightblue",
|
||||
"mintcream",
|
||||
"mistyrose",
|
||||
"moccasin",
|
||||
"navajowhite",
|
||||
"navy",
|
||||
"oldlace",
|
||||
"olive",
|
||||
"olivedrab",
|
||||
"orange",
|
||||
"orangered",
|
||||
"orchid",
|
||||
"palegoldenrod",
|
||||
"palegreen",
|
||||
"paleturquoise",
|
||||
"palevioletred",
|
||||
"papayawhip",
|
||||
"peachpuff",
|
||||
"peru",
|
||||
"pink",
|
||||
"plum",
|
||||
"powderblue",
|
||||
"purple",
|
||||
"red",
|
||||
"rosybrown",
|
||||
"royalblue",
|
||||
"saddlebrown",
|
||||
"salmon",
|
||||
"sandybrown",
|
||||
"seagreen",
|
||||
"seashell",
|
||||
"sienna",
|
||||
"silver",
|
||||
"skyblue",
|
||||
"slateblue",
|
||||
"slategray",
|
||||
"slategrey",
|
||||
"snow",
|
||||
"springgreen",
|
||||
"steelblue",
|
||||
"tan",
|
||||
"teal",
|
||||
"thistle",
|
||||
"tomato",
|
||||
"turquoise",
|
||||
"violet",
|
||||
"wheat",
|
||||
"white",
|
||||
"whitesmoke",
|
||||
"yellow",
|
||||
"yellowgreen",
|
||||
"transparent",
|
||||
"TRANSPARENT",
|
||||
"",
|
||||
"inherit",
|
||||
"INHERIT",
|
||||
"KQ@m?-ldxNK{zH+(FL_owz>YNH^]",
|
||||
"aj9c)r+J&3)0E,- Lzv6K6nT@6?I}BY^\\g",
|
||||
"Cf}qJN|3D>m:^[7B*fhu>lC[B3\"T_-F",
|
||||
"h<s1pMd-8H[,\\caWH1oW3%M",
|
||||
"z{y]VZj)%)ZV<OTbO9\\Nbc|YL}4BI<DlUBk$EV`EbN}x/@SDN0(",
|
||||
"PSX2Ol8@",
|
||||
"d+gYXKUM'&D'S]o<9T\\:hj_i!|l!)e6R4Bo)-(965rlK\"K01C68pgkJ] fx?kjT.O&sY4",
|
||||
"[4\"tk)a/v17?0W!F`AyI[='2~;:DF6I>_<O$ he213u",
|
||||
"F|r9T&N69MWq3Jrj6",
|
||||
"dYR7}n&:Rq[J",
|
||||
"M;Z]r@(R([6aT`<sN?uO'2Kb~3U\\\\tQUDxLN1f/D(,Q0w|K;,t`,tQ~[W/c!uQg)d|:D\\U33!DK&d*C`Zc'U#",
|
||||
"kV)DKUb~h{SQCM;T*g2!Rj?>Sl=jY;3W9M{Fliu!=>tDY]5",
|
||||
"y>X\\kKN|~=J+7Pqp|%9R!nZ,@>mUW9<o;|02LV<fxihsBSKVaTdcae",
|
||||
"Q>jc|/:#qwzHL`lL%e~DbhQ+d^tpf9sx%o)jC1Nm}`G;rT2jo+M$=$?BC'|O^]hW^BBo_J->bWG1",
|
||||
"OIxA\\5HB7g3Rv;PD)z?jGe?<x`4~9&D9dSDP=ilUauI'qb",
|
||||
"aND[Al/^#;n'|V\"Vl$bh5\\G#{%y4#\\W0:ZgXe73ZuXrWcL4gr|B7,ijZZi{p)M+R9{C/&249G",
|
||||
"7xK-d6Tx]BU|T,DY.qCwusmV%Ksset",
|
||||
"I=UwM''S",
|
||||
"w|_;Qw(R:>Clf[#3JFr_+?'1D&}WaY_xaRyTpwio>C;Pjf/kIW{]KK:R&ARiP=_g_UqRVvFKG(OQo6y'wF]Fc",
|
||||
"G:",
|
||||
"+XZ%s7L3FmGFn]Y!J;.vpAUoGU,&WY8eQeGWW?Jq7ANeM}[?gsV) H\\@{8z_t$oS(_jSq]|9?W*sG%' (d%",
|
||||
"*P\"?'?NHA \\!{.S=+LD8Ltr^'=,$4uQ=tVL/T_b6m!PJ8*s*v`;6kp(+8i.}T!9p6{",
|
||||
"_@(w<\\DjMk c8/\"/ifJNT_2R>V'}{&72C2+7otvd,$M@Yqc)L=O.muEp28m&AY",
|
||||
"J!M#$z|n:+:6@7n*v)UCbkVp0;\"1#}o:i4B9oh=%'I",
|
||||
"0",
|
||||
"Krq?xAul2cRe&`*Fg2)bV/r>oJ`Z(ae,z%+`E@VkWH&`-jMZ<UW~jxDek;^j2\\Uq;C,Ss",
|
||||
"#b\\l~=y5H=#Jy(6FwH5]jU;6D",
|
||||
"YO|tw;`E_'G<d~juVPCla%K]q x\"oA-aW|Y@P$_$",
|
||||
"}rI\\5x724b29MEauSSX&!AT[J1ce?,rtLAA8X",
|
||||
"hlo8jd$D-dI=I#Be:BATkZPR~%Vfe0g_Xw^+wwhHQhC1;sn+P<b&J:~HfxVBX}9b/#HHPS",
|
||||
"+#[?UFGUVFn0Zn7yE#TEo{FV\\{6*+s+a=fR",
|
||||
"lhv.f!ENs~)?5)z:1^i@BQ|ol}9Cnkw&yV.PPx |y]@,?IL]0L_# b1'wl-]",
|
||||
"&DhZ!g%v.sF}4NoP~4<vKpaM0[12!2K!ziYC3`505I*D*J6k\\skbXJ}44J#4y2",
|
||||
"oK][N&iIV\"AEs3rIT-::L3&J^Sn42_J2yL= 2xI4o!b\"#2JiAt=",
|
||||
"^c;C^{0wD%|y~Z1X'z\\o^gI8L=@2^p3g/L6G?]Nuif;Zf15dF`IPt8",
|
||||
"62t-!*`U\\l%BFxi5B~[^~G!}h]DtXrd}y}af3",
|
||||
"?N5d9ydHPi?IhwU=41'",
|
||||
"GSZeLtA3YahI@oLy/6vT_[B`[PRZ1^.(n8`,8TyqVoCzMd!=9 e",
|
||||
"Yck5`_#NgS",
|
||||
"K9?z&o",
|
||||
"Isl2>%RB8T+,9?B{~A2{fEb[%",
|
||||
"&fV(`<ha/(T7J&X\\{YHt+5 =>%SaJ&W0_j]]\"",
|
||||
">!sQ/IYU\"Ikc\\ei;HlCcVJ\":G2/m]h1,GvOmxFOOvTUHjHu:LWE\"QU=) ",
|
||||
"7Fyx#>\"(\"N",
|
||||
"MO6\"Hd2H]r8BJ}z)%J18b<VZ5lrhI",
|
||||
"BGQ|tqdwj4};#x@?%ka[`DwgFWg*J+q/}]-\\\\-y#T",
|
||||
"zZ=JrTPxh}.(%frt58Cy=C4(*,4]:Gnz5(~iv4@u4re~6yp:zbU0(o.S+qd9eB]A5",
|
||||
"n]V3}^{9O<0cO\"rtglDO4Wc)_7Nu_JnK2EBbzRMV3b.Mj\"$9#,+-T\"N=7iPdD F<9_YWw3ZN*V;??*8VN8z?^MXi",
|
||||
"fGRSl*i>^*uy|c;5B}tKXu>5hZX:>CB{oWIrxE8@B/f{:u9]:bLO0/ZWeHoNfCc|kSh{/fXs9Y:UKaJ95vFFtB2Y",
|
||||
".&-4UOcxR\"Tbgc--@& hoUavCcQW^^fT}:I(d%o}J2t*BRA1{YGXB9>AYu^Bv#rEu`pN65_-r.IQD.?Cc/B({YtK[2KMmVOC3*2J",
|
||||
"H3<MOq'81C#\\nUjQc xlsF@c2R<e);T~G]^N0_*M<j!jub~k,mgZ(.>GERhwS;kmmKC?1l} qQ&zcXK?g)S OmF^=E^TlTC)/",
|
||||
"8\\5tFz:sod",
|
||||
"ILUc5c!'K.7.P&=S,pSYB{",
|
||||
"%\\(6.jC\"C4\\2{TYdx,Ln^",
|
||||
"tL3HnWq q!'k!#R@2bkvIAI]hk)64-i?uk]oK(nQiKg$`m6tx|#l>m1bEK^&.X[o'b\"\\',A16n>9ZAPI9>",
|
||||
"{#Mn0,S~a\"!gw",
|
||||
"dv+6'7Dd)fz",
|
||||
"9o1*Q:{6#3f uHx\"_",
|
||||
".43_zr}X+BtruMV!H!xw 8!9I_}zlBT3W52)rh,9ngeu0o[V_s*z'8x9*yjF!",
|
||||
"y3Nm`>P:seF'V'?+<={oU5QQ",
|
||||
".#Os_jv,\"@-zsY8j'POOYnY?0ONn?i#d4tqp?~.OF#VC.=<t<+feuf{#@O7lXC@+#t_uKGue%Dk9z",
|
||||
"0Ep=zwydU-V<)9<9\\`[4,d^B&Gbo#'HTSEC;qU&1| ocNd69#{nbmYJMlj6Mfs3`w&pc(poie *ZOJIp7%}cVnfml",
|
||||
"746}e(rye4lT7#B.Or8j1->Xs@o8f0}/e>uvvkNS[3UC2F]#[>^f74jxoo&9{^ED#,CV\"k'0|xI",
|
||||
".D1{.:9gHW}]36RlUQ?!-\"0dn:+(/e@b)|'B",
|
||||
"!Nh9xY2y?5ku5f}%]JWw~OfeYdcgI#It` T)3VzYl5gChve[I'rEqyJ \"@(z.Y%fEJ:9k(",
|
||||
"J^$^L8:qI=yrerd0kxJBEwby6[>9[) NpqN%)h",
|
||||
"l&\\K{s9]aL(,dX?B\"1g1*@9BY~=UO+AWvVRI;ar4p8Tsy~Qk-=x(yp38:j|g'5H~e4",
|
||||
"(]Pe,1fTS_P%[xY96#,rwQz=P?z",
|
||||
")PC#?b'&|maJBt.6Izz%vV5e!9Sy|G!*Q",
|
||||
"pzAG^@/J&)Dc}GP*xO]ezW:*PV|Dt^fF<8GgF_1i=A\"@>nt?yOa|zS<8`/;uY~^ozjvX!K#%us!>2IYITh]Zy<^dq?&\"nqV]ZdZ",
|
||||
"T<xz*/H&}36<(4E^/Z1m<#_G0R:=qX?1`*6Y&r'SIO]9OR;m5-Zq?PU^jvLKPLW2wPf",
|
||||
")CLhmCI%TwB+t:h.@Vp-#({d0W/R_(^f34LC=V)A",
|
||||
"yCT_hl%fUL<T&e;ePsT.pJG@|jO,[pN]]Q<Yu=Lp6X6&$Ka#",
|
||||
" $4X",
|
||||
"rp",
|
||||
"t^(*U<Qdi$!vyg5D\"yQZd<K6<Qptsvzi~D}.Uf?P$E>}t8VP^;3Tamv2Z$1<",
|
||||
",",
|
||||
"EGCXZ_{eqIwfG-o7o\\\"!ZWTPLd,U-k$Cz]%:vNWdo}vDh!ONtM>mMP{/Cg+2<.J\"a*n#Rtnha",
|
||||
"LQ3sIr7Q_ wSD7Zzv$-vxr|3P`pas0#Ze/---{PSwJ3{!a*[k'nFgC\"W+@4URi?qJk&Tt@`abNms40#A^XcAt}",
|
||||
"^i356'hX\"hKaZGfTZ|C@#}b3LGz1\">qcH{L8{Fs?O5%:EqQWuro_lc=]gWLVR\\~!J\"[>,H",
|
||||
"i{*q<O{Dt^n|FY3,FG>WIRqPH.os$9^P=|yA9?P;MOw;VBwZ^>K=\"%J9SBlv%0+o5k73rW!`l_",
|
||||
"-PCM&!G~o#Za^s&)qJELr\\P^\\={_xTFp:%@JF.PeRX\\7b8K",
|
||||
"V_sFicB+wx5",
|
||||
"\"X^\\d}b9.W.2\"O!yAL21\"Ny5:)=Q3*D|TAzzr^0Yflzjdc!p*.yW,B",
|
||||
"kZ`wCP>9Bq5S!r!Vi|Uy/C&H[kz/f^{(Z[OGw'S0\"",
|
||||
"Jn%1^rUnNB|%=q%^v*bN|I40}#Htn{G!#~CNAN0KvZcB>Ita(,n",
|
||||
"-PlhE[^J55Ui",
|
||||
"z`h`uQJ{J",
|
||||
"eV\\q5Q4o@Y*,IRMcnpqj5>Id\\yBe?pKH3uF&c<c}:E9[uaH$ 8dXCmI+!C'q@PkE<NVRq~GRW<tfyt/i@%dwI&rL",
|
||||
"UGzLF+o3)Ezs=nMxqd^\"=q.Ik}Tk2I`X)R8]Zmy/WQp,|]TdbP)5 J+#Hm6SmWtQ+h?.MQ1W#oyp\\F,'JL>rLtjiHOA",
|
||||
"&joOSw7XZVvSt4ZCT*:aq:3ns!v|r);~7gN8'_D",
|
||||
"Y<q|Mhn5Nrcb+dR=10pQF5]r@/*7P`79w/htSm2,C~1&sUW{N@v:t9d;HPG&xrI\"YD;V9Y$'g,W'J=GV3,YK",
|
||||
"Gx&#{;]l/?[{SyX`kTeo",
|
||||
"30PU7@<'58.hRWsJTa9L.hVQ8}7=$}ih4|$Y*9z3[aooT!]}+>b{1JH^.jjEU{,dAXSCbtEh6",
|
||||
"%2~x8=A!RW@8N/`hQz`)gl}1DOU9{>Ie'L> 4e]m;kt =isEQ(\\TeI7hWgK-K! p^K'\":3;dxTLO",
|
||||
"\\ ):{Woay[4",
|
||||
"\\{Ih&}*8^x6@`V@DZB`rSuhYm4i@TW^t9Hx[^`IVumjXc1vA\"~wt8^Jf:US6Z\\xaS&",
|
||||
"lo $6<EP|=gAEpd\\M6YDg\"*0m",
|
||||
/*
|
||||
"ActiveBorder",
|
||||
"ActiveCaption",
|
||||
"AppWorkspace",
|
||||
"Background",
|
||||
"ButtonFace",
|
||||
"ButtonHighlight",
|
||||
"ButtonShadow",
|
||||
"ButtonText",
|
||||
"CaptionText",
|
||||
"GrayText",
|
||||
"Highlight",
|
||||
"HighlightText",
|
||||
"InactiveBorder",
|
||||
"InactiveCaption",
|
||||
"InactiveCaptionText",
|
||||
"InfoBackground",
|
||||
"InfoText",
|
||||
"Menu",
|
||||
"MenuText",
|
||||
"Scrollbar",
|
||||
"ThreeDDarkShadow",
|
||||
"ThreeDFace",
|
||||
"ThreeDHighlight",
|
||||
"ThreeDLightShadow",
|
||||
"ThreeDShadow",
|
||||
"Window",
|
||||
"WindowFrame",
|
||||
"WindowText",
|
||||
*/
|
||||
"currentColor",
|
||||
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f",
|
||||
"#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f",
|
||||
"#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f",
|
||||
"#",
|
||||
"#1",
|
||||
"#12",
|
||||
"#123",
|
||||
"#1234",
|
||||
"#12x",
|
||||
"abc",
|
||||
"123",
|
||||
"#0ab0cd0ef",
|
||||
"#0ab0cd0e",
|
||||
"#0ab0cd0",
|
||||
"#0ab0cdaef",
|
||||
"#0ab0cdae",
|
||||
"#0ab0cda"
|
||||
];
|
||||
|
||||
var references = [
|
||||
"#113355",
|
||||
"#001350",
|
||||
"#135000",
|
||||
"#001350",
|
||||
"#013500",
|
||||
"#000135",
|
||||
"#123456",
|
||||
"#002356",
|
||||
"#124500",
|
||||
"#002356",
|
||||
"#013460",
|
||||
"#001245",
|
||||
"#f0f8ff",
|
||||
"#f0f8ff",
|
||||
"#a0ce00",
|
||||
"#a0ce00",
|
||||
"#0ace0e",
|
||||
"#a0ebe0",
|
||||
"#00cee0",
|
||||
"#faebd7",
|
||||
"#00ffff",
|
||||
"#7fffd4",
|
||||
"#f0ffff",
|
||||
"#f5f5dc",
|
||||
"#ffe4c4",
|
||||
"#000000",
|
||||
"#ffebcd",
|
||||
"#0000ff",
|
||||
"#8a2be2",
|
||||
"#a52a2a",
|
||||
"#deb887",
|
||||
"#5f9ea0",
|
||||
"#7fff00",
|
||||
"#d2691e",
|
||||
"#ff7f50",
|
||||
"#6495ed",
|
||||
"#fff8dc",
|
||||
"#dc143c",
|
||||
"#00ffff",
|
||||
"#00008b",
|
||||
"#008b8b",
|
||||
"#b8860b",
|
||||
"#a9a9a9",
|
||||
"#006400",
|
||||
"#a9a9a9",
|
||||
"#bdb76b",
|
||||
"#8b008b",
|
||||
"#556b2f",
|
||||
"#ff8c00",
|
||||
"#9932cc",
|
||||
"#8b0000",
|
||||
"#e9967a",
|
||||
"#8fbc8f",
|
||||
"#483d8b",
|
||||
"#2f4f4f",
|
||||
"#2f4f4f",
|
||||
"#00ced1",
|
||||
"#9400d3",
|
||||
"#ff1493",
|
||||
"#00bfff",
|
||||
"#696969",
|
||||
"#696969",
|
||||
"#1e90ff",
|
||||
"#b22222",
|
||||
"#fffaf0",
|
||||
"#228b22",
|
||||
"#ff00ff",
|
||||
"#dcdcdc",
|
||||
"#f8f8ff",
|
||||
"#ffd700",
|
||||
"#daa520",
|
||||
"#808080",
|
||||
"#008000",
|
||||
"#adff2f",
|
||||
"#808080",
|
||||
"#f0fff0",
|
||||
"#ff69b4",
|
||||
"#cd5c5c",
|
||||
"#4b0082",
|
||||
"#fffff0",
|
||||
"#f0e68c",
|
||||
"#e6e6fa",
|
||||
"#fff0f5",
|
||||
"#7cfc00",
|
||||
"#fffacd",
|
||||
"#add8e6",
|
||||
"#f08080",
|
||||
"#e0ffff",
|
||||
"#fafad2",
|
||||
"#d3d3d3",
|
||||
"#90ee90",
|
||||
"#d3d3d3",
|
||||
"#ffb6c1",
|
||||
"#ffa07a",
|
||||
"#20b2aa",
|
||||
"#87cefa",
|
||||
"#778899",
|
||||
"#778899",
|
||||
"#b0c4de",
|
||||
"#ffffe0",
|
||||
"#00ff00",
|
||||
"#32cd32",
|
||||
"#faf0e6",
|
||||
"#ff00ff",
|
||||
"#800000",
|
||||
"#66cdaa",
|
||||
"#0000cd",
|
||||
"#ba55d3",
|
||||
"#9370db",
|
||||
"#3cb371",
|
||||
"#7b68ee",
|
||||
"#00fa9a",
|
||||
"#48d1cc",
|
||||
"#c71585",
|
||||
"#191970",
|
||||
"#f5fffa",
|
||||
"#ffe4e1",
|
||||
"#ffe4b5",
|
||||
"#ffdead",
|
||||
"#000080",
|
||||
"#fdf5e6",
|
||||
"#808000",
|
||||
"#6b8e23",
|
||||
"#ffa500",
|
||||
"#ff4500",
|
||||
"#da70d6",
|
||||
"#eee8aa",
|
||||
"#98fb98",
|
||||
"#afeeee",
|
||||
"#db7093",
|
||||
"#ffefd5",
|
||||
"#ffdab9",
|
||||
"#cd853f",
|
||||
"#ffc0cb",
|
||||
"#dda0dd",
|
||||
"#b0e0e6",
|
||||
"#800080",
|
||||
"#ff0000",
|
||||
"#bc8f8f",
|
||||
"#4169e1",
|
||||
"#8b4513",
|
||||
"#fa8072",
|
||||
"#f4a460",
|
||||
"#2e8b57",
|
||||
"#fff5ee",
|
||||
"#a0522d",
|
||||
"#c0c0c0",
|
||||
"#87ceeb",
|
||||
"#6a5acd",
|
||||
"#708090",
|
||||
"#708090",
|
||||
"#fffafa",
|
||||
"#00ff7f",
|
||||
"#4682b4",
|
||||
"#d2b48c",
|
||||
"#008080",
|
||||
"#d8bfd8",
|
||||
"#ff6347",
|
||||
"#40e0d0",
|
||||
"#ee82ee",
|
||||
"#f5deb3",
|
||||
"#ffffff",
|
||||
"#f5f5f5",
|
||||
"#ffff00",
|
||||
"#9acd32",
|
||||
"transparent",
|
||||
"transparent",
|
||||
"transparent",
|
||||
"#00e000",
|
||||
"#00e000",
|
||||
"#0df000",
|
||||
"#0000b0",
|
||||
"#007b30",
|
||||
"#008001",
|
||||
"#004b00",
|
||||
"#002080",
|
||||
"#099600",
|
||||
"#0120e2",
|
||||
"#f00630",
|
||||
"#d00000",
|
||||
"#200000",
|
||||
"#0c00d0",
|
||||
"#07900a",
|
||||
"#db020b",
|
||||
"#7000a0",
|
||||
"#b00c02",
|
||||
"#d6d000",
|
||||
"#000000",
|
||||
"#1d00f0",
|
||||
"#000000",
|
||||
"#a00000",
|
||||
"#00b600",
|
||||
"#007028",
|
||||
"#00b0b9",
|
||||
"#000000",
|
||||
"#f00000",
|
||||
"#b00005",
|
||||
"#0ea000",
|
||||
"#72000a",
|
||||
"#ba0c00",
|
||||
"#0fe000",
|
||||
"#50000b",
|
||||
"#000c44",
|
||||
"#ae4202",
|
||||
"#00005d",
|
||||
"#0000af",
|
||||
"#5d0041",
|
||||
"#a00000",
|
||||
"#c00000",
|
||||
"#090000",
|
||||
"#0209fe",
|
||||
"#a00500",
|
||||
"#c0100e",
|
||||
"#7f0000",
|
||||
"#600000",
|
||||
"#d00d00",
|
||||
"#0004d9",
|
||||
"#c00000",
|
||||
"#0500ff",
|
||||
"#0000c3",
|
||||
"#200000",
|
||||
"#80f00d",
|
||||
"#0c7000",
|
||||
"#00c4d0",
|
||||
"#a000a0",
|
||||
"#00a000",
|
||||
"#d0070f",
|
||||
"#900600",
|
||||
"#002090",
|
||||
"#30ef00",
|
||||
"#0000e0",
|
||||
"#b000c0",
|
||||
"#80c200",
|
||||
"#0900e0",
|
||||
"#0005e0",
|
||||
"#800b00",
|
||||
"#b0a000",
|
||||
"#e00000",
|
||||
"#000690",
|
||||
"#d00000",
|
||||
"#010020",
|
||||
"#0000c0",
|
||||
"#000060",
|
||||
"#004000",
|
||||
"#000000",
|
||||
"#000da0",
|
||||
"#000000",
|
||||
"#00d000",
|
||||
"#000fa0",
|
||||
"#0c5000",
|
||||
"#000030",
|
||||
"#a0007b",
|
||||
"#00cb05",
|
||||
"#023000",
|
||||
"#9bc000",
|
||||
"#b000b0",
|
||||
"#00e055",
|
||||
"#000000",
|
||||
"#0dc0d0",
|
||||
"#20600a",
|
||||
"#70a070",
|
||||
"#f50000",
|
||||
"#0000e0",
|
||||
"#a900cb",
|
||||
"#0000d0",
|
||||
"#000a40",
|
||||
"#d00060",
|
||||
"#000ad0",
|
||||
/*
|
||||
"ActiveBorder",
|
||||
"ActiveCaption",
|
||||
"AppWorkspace",
|
||||
"Background",
|
||||
"ButtonFace",
|
||||
"ButtonHighlight",
|
||||
"ButtonShadow",
|
||||
"ButtonText",
|
||||
"CaptionText",
|
||||
"GrayText",
|
||||
"Highlight",
|
||||
"HighlightText",
|
||||
"InactiveBorder",
|
||||
"InactiveCaption",
|
||||
"InactiveCaptionText",
|
||||
"InfoBackground",
|
||||
"InfoText",
|
||||
"Menu",
|
||||
"MenuText",
|
||||
"Scrollbar",
|
||||
"ThreeDDarkShadow",
|
||||
"ThreeDFace",
|
||||
"ThreeDHighlight",
|
||||
"ThreeDLightShadow",
|
||||
"ThreeDShadow",
|
||||
"Window",
|
||||
"WindowFrame",
|
||||
"WindowText",
|
||||
*/
|
||||
"#c0e000",
|
||||
"#0000f0",
|
||||
"#000000",
|
||||
"#0000f0",
|
||||
"#000000",
|
||||
"#000000",
|
||||
"#010000",
|
||||
"#010200",
|
||||
"#112233",
|
||||
"#123400",
|
||||
"#010200",
|
||||
"#0a0b0c",
|
||||
"#010203",
|
||||
"#abcdef",
|
||||
"#abcde0",
|
||||
"#abcd00",
|
||||
"#0a0cae",
|
||||
"#0a0cae",
|
||||
"#0a0ca0"
|
||||
];
|
||||
|
||||
var todos = {
|
||||
" #135": true,
|
||||
"#135 ": true,
|
||||
" #135 ": true,
|
||||
"# 135": true,
|
||||
" #123456": true,
|
||||
"#123456 ": true,
|
||||
" #123456 ": true,
|
||||
"# 123456": true,
|
||||
" aliceblue": true,
|
||||
"aliceblue ": true,
|
||||
" aliceblue ": true,
|
||||
"H3<MOq'81C#\\nUjQc xlsF@c2R<e);T~G]^N0_*M<j!jub~k,mgZ(.>GERhwS;kmmKC?1l} qQ&zcXK?g)S OmF^=E^TlTC)/": true,
|
||||
" $4X": true,
|
||||
"UGzLF+o3)Ezs=nMxqd^\"=q.Ik}Tk2I`X)R8]Zmy/WQp,|]TdbP)5 J+#Hm6SmWtQ+h?.MQ1W#oyp\\F,'JL>rLtjiHOA": true
|
||||
};
|
||||
|
||||
var table0 = document.getElementById("table0");
|
||||
var table1 = document.getElementById("table1");
|
||||
var cs0 = document.defaultView.getComputedStyle(table0, "");
|
||||
var cs1 = document.defaultView.getComputedStyle(table1, "");
|
||||
var result;
|
||||
var reference;
|
||||
var log = "";
|
||||
var len = tests.length;
|
||||
is(tests.length, references.length, "array length mismatch");
|
||||
for (var i = 0; i < len; ++i) {
|
||||
table0.setAttribute("bgColor", tests[i]);
|
||||
table1.style.backgroundColor = references[i];
|
||||
((tests[i] in todos) ? todo_is : is)(
|
||||
cs0.getPropertyValue("background-color"),
|
||||
cs1.getPropertyValue("background-color"),
|
||||
"html color '" + tests[i] + "' should match '" + references[i] + "'");
|
||||
}
|
||||
</script>
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче