merge m-c to devtools

This commit is contained in:
Rob Campbell 2011-05-30 11:46:04 -04:00
commit d3e703ea34
830 changed files with 42477 additions and 28740 deletions

View File

@ -63,3 +63,6 @@ a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE
a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE_20110406
a95d426422816513477e5863add1b00ac7041dcb AURORA_BASE_20110412
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R14
9eae975b3d6fb7748fe5a3c0113d449b1c7cc0b2 AURORA_BASE_20110524
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R14
462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R14

View File

@ -55,9 +55,6 @@
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
@ -135,6 +132,12 @@ void nsAccessNode::LastRelease()
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public
bool
nsAccessNode::IsDefunct() const
{
return !mContent;
}
PRBool
nsAccessNode::Init()
{

View File

@ -120,11 +120,6 @@ public:
*/
already_AddRefed<nsINode> GetCurrentFocus();
/**
* Returns true when the accessible is defunct.
*/
virtual PRBool IsDefunct() { return !mContent; }
/**
* Initialize the access node object, add it to the cache.
*/
@ -135,6 +130,11 @@ public:
*/
virtual void Shutdown();
/**
* Returns true when the accessible is defunct.
*/
virtual bool IsDefunct() const;
/**
* Return frame for the given access node object.
*/

View File

@ -107,7 +107,6 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
#include "nsImageMapUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService
@ -275,8 +274,10 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
aContent->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::usemap,
mapElmName);
nsCOMPtr<nsIDOMHTMLMapElement> mapElm =
nsImageMapUtils::FindImageMap(aContent->GetCurrentDoc(), mapElmName);
nsCOMPtr<nsIDOMHTMLMapElement> mapElm;
if (nsIDocument* document = aContent->GetCurrentDoc()) {
mapElm = do_QueryInterface(document->FindImageMap(mapElmName));
}
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
nsAccessible* accessible = mapElm ?

View File

@ -332,8 +332,8 @@ nsApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public methods
PRBool
nsApplicationAccessible::IsDefunct()
bool
nsApplicationAccessible::IsDefunct() const
{
return nsAccessibilityService::IsShutdown();
}

View File

@ -115,7 +115,7 @@ public:
NS_DECL_NSIACCESSIBLEAPPLICATION
// nsAccessNode
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual PRBool Init();
virtual void Shutdown();
virtual bool IsPrimaryForNode() const;

View File

@ -141,7 +141,7 @@ nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions)
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = mActionAcc ? 1 : 0;
*aNumActions = (mIsOnclick || mIsLink) ? 1 : 0;
return NS_OK;
}
@ -228,7 +228,6 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
mIsOnclick = PR_FALSE;
if (nsCoreUtils::HasClickListener(mContent)) {
mActionAcc = this;
mIsOnclick = PR_TRUE;
return;
}

View File

@ -54,8 +54,6 @@
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMMutationEvent.h"
#include "nsPIDOMWindow.h"
@ -411,22 +409,24 @@ NS_IMETHODIMP nsDocAccessible::GetURL(nsAString& aURL)
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::GetTitle(nsAString& aTitle)
NS_IMETHODIMP
nsDocAccessible::GetTitle(nsAString& aTitle)
{
nsCOMPtr<nsIDOMNSDocument> domnsDocument(do_QueryInterface(mDocument));
if (domnsDocument) {
return domnsDocument->GetTitle(aTitle);
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(mDocument);
if (!domDocument) {
return NS_ERROR_FAILURE;
}
return NS_ERROR_FAILURE;
return domDocument->GetTitle(aTitle);
}
NS_IMETHODIMP nsDocAccessible::GetMimeType(nsAString& aMimeType)
NS_IMETHODIMP
nsDocAccessible::GetMimeType(nsAString& aMimeType)
{
nsCOMPtr<nsIDOMNSDocument> domnsDocument(do_QueryInterface(mDocument));
if (domnsDocument) {
return domnsDocument->GetContentType(aMimeType);
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(mDocument);
if (!domDocument) {
return NS_ERROR_FAILURE;
}
return NS_ERROR_FAILURE;
return domDocument->GetContentType(aMimeType);
}
NS_IMETHODIMP nsDocAccessible::GetDocType(nsAString& aDocType)
@ -607,6 +607,12 @@ nsDocAccessible::Init()
if (!mNotificationController)
return PR_FALSE;
// Mark the document accessible as loaded if its DOM document was loaded at
// this point (this can happen because a11y is started late or DOM document
// having no container was loaded.
if (mDocument->GetReadyStateEnum() == nsIDocument::READYSTATE_COMPLETE)
mIsLoaded = PR_TRUE;
AddEventListeners();
return PR_TRUE;
}
@ -670,8 +676,8 @@ nsDocAccessible::GetFrame() const
return root;
}
PRBool
nsDocAccessible::IsDefunct()
bool
nsDocAccessible::IsDefunct() const
{
return nsHyperTextAccessibleWrap::IsDefunct() || !mDocument;
}

View File

@ -108,7 +108,7 @@ public:
virtual PRBool Init();
virtual void Shutdown();
virtual nsIFrame* GetFrame() const;
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual nsINode* GetNode() const { return mDocument; }
virtual nsIDocument* GetDocumentNode() const { return mDocument; }

View File

@ -59,7 +59,6 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMDataContainerEvent.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
@ -139,7 +138,7 @@ nsRootAccessible::GetName(nsAString& aName)
}
}
nsCOMPtr<nsIDOMNSDocument> document(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
return document->GetTitle(aName);
}

View File

@ -156,8 +156,8 @@ nsXULTreeAccessible::GetValue(nsAString& aValue)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible: nsAccessNode implementation
PRBool
nsXULTreeAccessible::IsDefunct()
bool
nsXULTreeAccessible::IsDefunct() const
{
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView;
}
@ -834,8 +834,8 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsAccessNode implementation
PRBool
nsXULTreeItemAccessibleBase::IsDefunct()
bool
nsXULTreeItemAccessibleBase::IsDefunct() const
{
if (nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0)
return PR_TRUE;
@ -1091,8 +1091,8 @@ nsXULTreeItemAccessible::GetName(nsAString& aName)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsAccessNode implementation
PRBool
nsXULTreeItemAccessible::IsDefunct()
bool
nsXULTreeItemAccessible::IsDefunct() const
{
return nsXULTreeItemAccessibleBase::IsDefunct() || !mColumn;
}

View File

@ -80,7 +80,7 @@ public:
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
// nsAccessNode
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual void Shutdown();
// nsAccessible
@ -201,7 +201,7 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessNode
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual void Shutdown();
virtual bool IsPrimaryForNode() const;
@ -266,7 +266,7 @@ public:
NS_IMETHOD GetName(nsAString& aName);
// nsAccessNode
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual PRBool Init();
virtual void Shutdown();

View File

@ -1087,8 +1087,8 @@ nsXULTreeGridCellAccessible::IsSelected(PRBool *aIsSelected)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsAccessNode implementation
PRBool
nsXULTreeGridCellAccessible::IsDefunct()
bool
nsXULTreeGridCellAccessible::IsDefunct() const
{
return nsLeafAccessible::IsDefunct() || !mParent || !mTree || !mTreeView ||
!mColumn;

View File

@ -155,7 +155,7 @@ public:
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessNode
virtual PRBool IsDefunct();
virtual bool IsDefunct() const;
virtual PRBool Init();
virtual bool IsPrimaryForNode() const;

View File

@ -90,16 +90,14 @@ _TEST_FILES =\
test_aria_roles.xul \
test_aria_token_attrs.html \
test_bug420863.html \
$(warning test_childAtPoint.html temporarily disabled) \
$(warning test_childAtPoint.xul temporarily disabled) \
test_childAtPoint.html \
test_childAtPoint.xul \
test_descr.html \
test_elm_landmarks.html \
test_elm_listbox.xul \
$(warning test_elm_media.html temporarily disabled) \
test_elm_nsApplicationAcc.html \
test_elm_plugin.html \
test_keys.html \
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
test_nsIAccessible_selects.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \

View File

@ -52,6 +52,7 @@ _TEST_FILES =\
test_general.xul \
test_inputs.html \
test_link.html \
test_media.html \
test_tree.xul \
test_treegrid.xul \
$(NULL)

View File

@ -36,9 +36,19 @@
ID: "li_clickable3",
actionName: "click",
events: CLICK_EVENTS
},
{
ID: "onclick_img",
actionName: "click",
events: CLICK_EVENTS
}
];
testActions(actionsArray);
getAccessible("onclick_img").takeFocus();
is(getAccessible("link1").numActions, 1, "links should have one action");
is(getAccessible("link2").numActions, 1, "link with onclick handler should have 1 action");
}
SimpleTest.waitForExplicitFinish();
@ -58,6 +68,11 @@
title="Expose click action if mouseup and mousedown are registered">
Mozilla Bug 423409
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=659620"
title="hang when trying to edit a page on wikimo with NVDA running">
Mozilla Bug 659620
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -68,5 +83,11 @@
<li id="li_clickable2" onmousedown="">Clickable list item</li>
<li id="li_clickable3" onmouseup="">Clickable list item</li>
</ul>
<!-- linkable accessibles -->
<img id="onclick_img" onclick="" src="../moz.png">
<a id="link1" href="www">linkable textleaf accessible</a>
<div id="link2" onclick="">linkable textleaf accessible</div>
</body>
</html>

View File

@ -13,15 +13,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
src="../common.js"></script>
<script type="application/javascript"
src="events.js"></script>
src="../events.js"></script>
<script type="application/javascript"
src="actions.js"></script>
src="../actions.js"></script>
<script type="application/javascript"
src="role.js"></script>
src="../role.js"></script>
<script type="application/javascript"
src="states.js"></script>
src="../states.js"></script>
<script type="application/javascript">
@ -58,49 +58,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// test the accessible tree
var accTree = {
role: ROLE_GROUPING,
children: [
{ // start/stop button
role: ROLE_PUSHBUTTON,
name: "Play",
states: {
states: STATE_FOCUSABLE
}
},
{ // buffer bar
role: ROLE_PROGRESSBAR
},
{ // progress bar
role: ROLE_PROGRESSBAR
},
{ // slider of progress bar
role: ROLE_SLIDER,
name: "0:00 of 0:01 elapsed",
states: {
states: STATE_FOCUSABLE
}
},
{ // duration label, role="presentation"
role: ROLE_NOTHING
},
{ // mute button
role: ROLE_PUSHBUTTON,
name: "Mute",
states: {
states: STATE_FOCUSABLE
}
}
]
};
testAccessibleTree("audio", accTree);
//////////////////////////////////////////////////////////////////////////
// test actions of audio controls
todo(false, "Focus test are disabled until bug 494175 is fixed.");
var audioElm = getAccessible("audio");
var playBtn = audioElm.firstChild;
var scrubber = playBtn.nextSibling.nextSibling.nextSibling;
@ -112,24 +74,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [
new focusChecker(muteBtn),
// new focusChecker(muteBtn),
new nameChecker(muteBtn, "Unmute"),
]
},
{
ID: scrubber,
actionName: "activate",
events: null,
eventSeq: [
new focusChecker(scrubber)
]
},
// {
// ID: scrubber,
// actionName: "activate",
// events: null,
// eventSeq: [
// new focusChecker(scrubber)
// ]
// },
{
ID: playBtn,
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [
new focusChecker(playBtn),
// new focusChecker(playBtn),
new nameChecker(playBtn, "Pause"),
]
}
@ -152,7 +114,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
<pre id="test">
</pre>
<audio id="audio" src="bug461281.ogg"
<audio id="audio" src="../bug461281.ogg"
controls="true"></audio>
<div id="eventDump"></div>

View File

@ -30,11 +30,11 @@
var menu1 = document.getElementById("menu_item1");
menu1.open = true;
window.setTimeout(function() {
menu1.addEventListener("popupshown", function() {
var menu2 = document.getElementById("menu_item2");
menu2.open = true;
window.setTimeout(function() {
menu2.addEventListener("popupshown", function() {
testGroupAttrs("menu_item1.1", 1, 1);
testGroupAttrs("menu_item1.2", 1, 3);
testGroupAttrs("menu_item1.4", 2, 3);
@ -42,9 +42,12 @@
testGroupAttrs("menu_item2.1", 1, 2, 1);
testGroupAttrs("menu_item2.2", 2, 2, 1);
menu1.open = false;
menu2.open = false;
SimpleTest.finish();
}, 200);
}, 200);
}, false);
}, false);
//////////////////////////////////////////////////////////////////////////
// xul:tab

View File

@ -93,7 +93,7 @@ function addA11yLoadEvent(aFunc)
if (state.value & STATE_BUSY)
return waitForDocLoad();
window.setTimeout(aFunc, 150);
window.setTimeout(aFunc, 0);
},
0
);

View File

@ -118,6 +118,25 @@
}
}
function makeIFrameVisible(aID)
{
this.DOMNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, this.DOMNode.parentNode)
];
this.invoke = function makeIFrameVisible_invoke()
{
this.DOMNode.style.visibility = "visible";
}
this.getID = function makeIFrameVisible_getID()
{
return "The accessible for DOM document loaded before it's shown shouldn't have busy state.";
}
}
function openDialogWnd(aURL)
{
// Get application root accessible.
@ -224,7 +243,7 @@
// Debug stuff.
// gA11yEventDumpID = "eventdump";
// gA11yEventDumpToConsole = true;
//gA11yEventDumpToConsole = true;
function doTests()
{
@ -235,12 +254,30 @@
gQueue.push(new morphIFrame("iframe", kHide));
gQueue.push(new morphIFrame("iframe", kShow));
gQueue.push(new morphIFrame("iframe", kRemove));
gQueue.push(new makeIFrameVisible("iframe2"));
gQueue.push(new openDialogWnd("about:"));
gQueue.push(new openWndShutdownDoc());
gQueue.onFinish = doLastCallTests;
gQueue.invoke(); // Will call SimpleTest.finish();
}
function doLastCallTests()
{
//////////////////////////////////////////////////////////////////////////
// makeIFrameVisible() test, part2
// The document shouldn't have busy state (the DOM document was loaded
// before its accessible was created). Do this test lately to make sure
// the content of document accessible was created initially, prior to this
// the document accessible keeps busy state. The initial creation happens
// asynchronously after document creation, there are no events we could
// use to catch it.
var iframeDoc = getAccessible("iframe2").firstChild;
testStates(iframeDoc, 0, 0, STATE_BUSY);
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
@ -268,6 +305,11 @@
title="Shutdown document accessible when presshell goes away">
Mozilla Bug 571459
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=658185"
title="The DOM document loaded before it's shown shouldn't have busy state">
Mozilla Bug 658185
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -275,6 +317,7 @@
</pre>
<div id="testContainer"><iframe id="iframe"></iframe></div>
<div id="testContainer2"><iframe id="iframe2" src="about:" style="visibility: hidden;"></iframe></div>
<div id="eventdump"></div>
</body>
</html>

View File

@ -49,6 +49,7 @@ _TEST_FILES =\
test_aria.html \
test_aria_imgmap.html \
test_aria_tabs.html \
test_comboboxes.xul \
test_doc.html \
test_docarticle.html \
test_editablebody.html \

View File

@ -16,9 +16,9 @@
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
<script type="application/javascript"
src="common.js" />
src="../common.js" />
<script type="application/javascript"
src="events.js" />
src="../events.js" />
<script type="application/javascript">
<![CDATA[
@ -64,6 +64,7 @@
//var searchbar = document.getElementById("searchbar");
//gQueue.push(new openHideCombobox(searchbar, true));
//gQueue.push(new openHideCombobox(searchbar, false));
todo(false, "Enable states test for XUL searchbar widget!");
gQueue.invoke(); // Will call SimpleTest.finish();
}

View File

@ -25,19 +25,19 @@
testChildAtPoint(list, 1, 1, true, image.firstChild);
// ::MustPrune case (in this case childAtPoint doesn't look inside a
// button), point is inside of button.
var btn = getAccessible("btn");
testChildAtPoint(btn, 1, 1, false, btn);
testChildAtPoint(btn, 1, 1, true, btn);
// textbox), point is inside of textbox.
var txt = getAccessible("txt");
testChildAtPoint(txt, 1, 1, false, txt);
testChildAtPoint(txt, 1, 1, true, txt);
// ::MustPrune case, point is outside of button accessible but is in
// ::MustPrune case, point is outside of textbox accessible but is in
// document.
testChildAtPoint(btn, -1, 1, false, null);
testChildAtPoint(btn, -1, 1, true, null);
testChildAtPoint(txt, -1, 1, false, null);
testChildAtPoint(txt, -1, 1, true, null);
// ::MustPrune case, point is outside of root accessible.
testChildAtPoint(btn, -10000, 10000, false, null);
testChildAtPoint(btn, -10000, 10000, true, null);
testChildAtPoint(txt, -10000, 10000, false, null);
testChildAtPoint(txt, -10000, 10000, true, null);
// Not specific case, point is inside of label accessible.
var label = getAccessible("label");
@ -82,7 +82,7 @@
<span role="label">label1</span><span role="label" id="label">label2</span>
<span role="button">btn1</span><span role="button" id="btn">btn2</span>
<span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span>
<div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;">
</div>

View File

@ -24,8 +24,7 @@
function doTest()
{
// Initialize the tree
var view = new inTreeView();
view.mRowCount = 5;
var view = new nsTableTreeView(5);
var tree = getNode("tree");
var treeBox = tree.treeBoxObject;

View File

@ -30,24 +30,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
role: ROLE_GROUPING,
children: [
{ // start/stop button
role: ROLE_PUSHBUTTON
role: ROLE_PUSHBUTTON,
name: "Play",
children: []
},
{ // buffer bar
role: ROLE_PROGRESSBAR
role: ROLE_PROGRESSBAR,
children: []
},
{ // progress bar
role: ROLE_PROGRESSBAR
role: ROLE_PROGRESSBAR,
children: []
},
{ // slider of progress bar
role: ROLE_SLIDER
role: ROLE_SLIDER,
//name: "0:00 of 0:02 elapsed",
children: []
},
{ // mute button
role: ROLE_PUSHBUTTON
role: ROLE_PUSHBUTTON,
name: "Mute",
children: []
}
]
};
testAccessibleTree("audio", accTree);
todo(false, "Enable name test for slider. Fail on Linux.");
SimpleTest.finish();
}

View File

@ -15,6 +15,8 @@
src="../common.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript">
<![CDATA[
@ -108,6 +110,11 @@
]
};
function test_txc7() {
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
// XPFE and Toolkit autocomplete widgets differ.
var txc7 = document.getElementById("txc7");
if ("clearResults" in txc7) {
@ -139,11 +146,14 @@
}
]
}
);
);
test_txc7();
} else {
SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
// Dumb access to trigger popup lazy creation. (See code below.)
// Dumb access to trigger popup lazy creation.
waitForEvent(EVENT_REORDER, txc7, test_txc7);
txc7.popup;
accTree.children.push(
@ -161,17 +171,8 @@
}
]
}
);
);
}
// Delay txc7 test a bit, to let Toolkit popup lazy creation complete.
function test_txc7() {
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
// SimpleTest.executeSoon() doesn't help here: use setTimeout() with a little delay.
setTimeout(test_txc7, 25);
}
SimpleTest.waitForExplicitFinish();

View File

@ -97,6 +97,11 @@
<versionRange minVersion="3.7a1" maxVersion="*"/>
</targetApplication>
</versionRange>
<versionRange minVersion="3.3.1" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="5.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="{E8E88AB0-7182-11DF-904E-6045E0D72085}"/>
</emItems>

View File

@ -92,6 +92,55 @@
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>oga</string>
<string>ogg</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>document.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/ogg</string>
</array>
<key>CFBundleTypeName</key>
<string>HTML5 Audio (Ogg)</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogv</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>document.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/ogg</string>
</array>
<key>CFBundleTypeName</key>
<string>HTML5 Video (Ogg)</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>webm</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>document.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>video/webm</string>
</array>
<key>CFBundleTypeName</key>
<string>HTML5 Video (WebM)</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>firefox-bin</string>

View File

@ -123,7 +123,7 @@ var stringBundle;
// and targets
let io = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
let source = io.newURI(canvas.toDataURL("image/png", ""), "UTF8", null);
let source = io.newURI(canvas.toDataURL("image/png"), "UTF8", null);
let target = io.newFileURI(file);
// prepare to save the canvas data

View File

@ -4,7 +4,7 @@
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>testpilot@labs.mozilla.com</em:id>
<em:version>1.1.1</em:version>
<em:version>1.1.2</em:version>
<em:type>2</em:type>
<!-- Target Application this extension can install into,
@ -13,7 +13,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
<em:maxVersion>5.0</em:maxVersion>
<em:maxVersion>6.0</em:maxVersion>
</Description>
</em:targetApplication>

View File

@ -43,8 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
DEFINES += -DFIREFOX_VERSION=$(FIREFOX_VERSION)
FILES := \
install.rdf \
$(NULL)

View File

@ -70,6 +70,7 @@ pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.level", 2);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/");
pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");
pref("extensions.update.autoUpdateDefault", true);
@ -264,7 +265,7 @@ pref("browser.urlbar.doubleClickSelectsAll", true);
#else
pref("browser.urlbar.doubleClickSelectsAll", false);
#endif
pref("browser.urlbar.autoFill", true);
pref("browser.urlbar.autoFill", false);
// 0: Match anywhere (e.g., middle of words)
// 1: Match on word boundaries and then try matching anywhere
// 2: Match only on word boundaries (e.g., after / or .)

View File

@ -48,6 +48,7 @@ let TabView = {
PREF_STARTUP_PAGE: "browser.startup.page",
PREF_RESTORE_ENABLED_ONCE: "browser.panorama.session_restore_enabled_once",
VISIBILITY_IDENTIFIER: "tabview-visibility",
GROUPS_IDENTIFIER: "tabview-groups",
// ----------
get windowTitle() {
@ -95,14 +96,21 @@ let TabView = {
// ___ visibility
let sessionstore =
Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
if (data && data == "true") {
this.show();
} else {
let self = this;
try {
data = sessionstore.getWindowValue(window, this.GROUPS_IDENTIFIER);
if (data) {
let parsedData = JSON.parse(data);
this.updateGroupNumberBroadcaster(parsedData.totalNumber || 0);
}
} catch (e) { }
// if a tab is changed from hidden to unhidden and the iframe is not
let self = this;
// if a tab is changed from hidden to unhidden and the iframe is not
// initialized, load the iframe and setup the tab.
this._tabShowEventListener = function (event) {
if (!self._window)
@ -380,6 +388,14 @@ let TabView = {
document.persist(toolbar.id, "currentset");
},
// ----------
// Function: updateGroupNumberBroadcaster
// Updates the group number broadcaster.
updateGroupNumberBroadcaster: function TabView_updateGroupNumberBroadcaster(number) {
let groupsNumber = document.getElementById("tabviewGroupsNumber");
groupsNumber.setAttribute("groups", number);
},
// ----------
// Function: enableSessionRestore
// Enables automatic session restore when the browser is started. Does

View File

@ -2964,11 +2964,6 @@ function FillInHTMLTooltip(tipElement)
var titleText = null;
var XLinkTitleText = null;
var SVGTitleText = null;
#ifdef MOZ_SVG
var lookingForSVGTitle = true;
#else
var lookingForSVGTitle = false;
#endif // MOZ_SVG
var direction = tipElement.ownerDocument.dir;
// If the element is invalid per HTML5 Forms specifications and has no title,
@ -2989,20 +2984,14 @@ function FillInHTMLTooltip(tipElement)
titleText = tipElement.getAttribute("title");
if ((tipElement instanceof HTMLAnchorElement && tipElement.href) ||
(tipElement instanceof HTMLAreaElement && tipElement.href) ||
(tipElement instanceof HTMLLinkElement && tipElement.href)
#ifdef MOZ_SVG
|| (tipElement instanceof SVGAElement && tipElement.hasAttributeNS(XLinkNS, "href"))
#endif // MOZ_SVG
) {
(tipElement instanceof HTMLLinkElement && tipElement.href) ||
(tipElement instanceof SVGAElement && tipElement.hasAttributeNS(XLinkNS, "href"))) {
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
}
if (lookingForSVGTitle &&
!(tipElement instanceof SVGElement &&
tipElement.parentNode instanceof SVGElement &&
!(tipElement.parentNode instanceof SVGForeignObjectElement))) {
lookingForSVGTitle = false;
}
if (lookingForSVGTitle) {
if (tipElement instanceof SVGElement &&
tipElement.parentNode instanceof SVGElement &&
!(tipElement.parentNode instanceof SVGForeignObjectElement)) {
// Looking for SVG title
let length = tipElement.childNodes.length;
for (let i = 0; i < length; i++) {
let childNode = tipElement.childNodes[i];
@ -3346,7 +3335,7 @@ const BrowserSearch = {
var win = getTopWin();
if (win) {
// If there's an open browser window, it should handle this command
win.focus()
win.focus();
win.BrowserSearch.webSearch();
} else {
// If there are no open browser windows, open a new one
@ -3356,7 +3345,7 @@ const BrowserSearch = {
Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
}
}
win = window.openDialog("chrome://browser/content/", "_blank",
win = window.openDialog(getBrowserURL(), "_blank",
"chrome,all,dialog=no", "about:blank");
Services.obs.addObserver(observer, "browser-delayed-startup-finished", false);
}

View File

@ -626,7 +626,6 @@ function grabAll(elem)
if (elem instanceof HTMLImageElement)
addImage(elem.src, gStrings.mediaImg,
(elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false);
#ifdef MOZ_SVG
else if (elem instanceof SVGImageElement) {
try {
// Note: makeURLAbsolute will throw if either the baseURI is not a valid URI
@ -635,7 +634,6 @@ function grabAll(elem)
addImage(href, gStrings.mediaImg, "", elem, false);
} catch (e) { }
}
#endif
#ifdef MOZ_MEDIA
else if (elem instanceof HTMLVideoElement) {
addImage(elem.currentSrc, gStrings.mediaVideo, "", elem, false);
@ -841,9 +839,7 @@ function makePreview(row)
var imageText;
if (!isBG &&
#ifdef MOZ_SVG
!(item instanceof SVGImageElement) &&
#endif
!(gDocument instanceof ImageDocument)) {
imageText = item.title || item.alt;
@ -941,9 +937,7 @@ function makePreview(row)
if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement ||
item instanceof HTMLImageElement ||
#ifdef MOZ_SVG
item instanceof SVGImageElement ||
#endif
(item instanceof HTMLObjectElement && /^image\//.test(mimeType)) || isBG) && isProtocolAllowed) {
newImage.setAttribute("src", url);
physWidth = newImage.width || 0;
@ -963,12 +957,10 @@ function makePreview(row)
newImage.height = newImage.naturalHeight;
}
#ifdef MOZ_SVG
if (item instanceof SVGImageElement) {
newImage.width = item.width.baseVal.value;
newImage.height = item.height.baseVal.value;
}
#endif
width = newImage.width;
height = newImage.height;

View File

@ -95,7 +95,7 @@
<property name="visibleTabs" readonly="true">
<getter><![CDATA[
return Array.filter(this.tabs, function(tab) {
return !tab.hidden && this._removingTabs.indexOf(tab) == -1;
return !tab.hidden && !tab.closing;
}, this);
]]></getter>
</property>
@ -208,7 +208,7 @@
//
// Fixing bug 630826 could make that happen automatically.
// Fixing bug 630830 could avoid the ugly hack below.
let closeMenuItem = document.getElementById("menu_close");
let parentPopup = closeMenuItem.parentNode;
let nextItem = closeMenuItem.nextSibling;
@ -963,6 +963,10 @@
// if the tab is a blank one.
oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused);
if (newBrowser._urlbarFocused && gURLBar) {
// Explicitly close the popup if the URL bar retains focus
gURLBar.closePopup();
if (!window.fullScreen) {
gURLBar.focus();
break;
@ -999,7 +1003,7 @@
<method name="_tabAttrModified">
<parameter name="aTab"/>
<body><![CDATA[
if (this._removingTabs.indexOf(aTab) > -1)
if (aTab.closing)
return;
// This event should be dispatched when any of these attributes change:
@ -1455,7 +1459,7 @@
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate &&
this._removingTabs.indexOf(aTab) > -1) {
aTab.closing) {
this._endRemoveTab(aTab);
return;
}
@ -1509,7 +1513,7 @@
<parameter name="aCloseWindowFastpath"/>
<body>
<![CDATA[
if (this._removingTabs.indexOf(aTab) > -1 || this._windowIsClosing)
if (aTab.closing || this._windowIsClosing)
return false;
var browser = this.getBrowserForTab(aTab);
@ -1539,6 +1543,7 @@
newTab = true;
}
aTab.closing = true;
this._removingTabs.push(aTab);
if (newTab)
this.addTab("about:blank", {skipAnimation: true});
@ -1707,7 +1712,7 @@
if (aTab.owner &&
!aTab.owner.hidden &&
this._removingTabs.indexOf(aTab.owner) == -1 &&
!aTab.owner.closing &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")) {
this.selectedTab = aTab.owner;
return;
@ -1718,7 +1723,7 @@
let numTabs = remainingTabs.length;
if (numTabs == 0 || numTabs == 1 && remainingTabs[0] == aTab) {
remainingTabs = Array.filter(this.tabs, function(tab) {
return this._removingTabs.indexOf(tab) == -1;
return !tab.closing;
}, this);
}
@ -1933,7 +1938,7 @@
<body>
<![CDATA[
if (!aTab.hidden && !aTab.pinned && !aTab.selected &&
this._removingTabs.indexOf(aTab) == -1) {
!aTab.closing) {
aTab.setAttribute("hidden", "true");
this.tabContainer.adjustTabstrip();
let event = document.createEvent("Events");
@ -2948,8 +2953,7 @@
<body><![CDATA[
var numPinned = this.tabbrowser._numPinnedTabs;
var doPosition = this.getAttribute("overflow") == "true" &&
numPinned > 0 &&
numPinned < this.tabbrowser.visibleTabs.length;
numPinned > 0;
if (doPosition) {
this.setAttribute("positionpinnedtabs", "true");
@ -3077,7 +3081,7 @@
var tab = this._getDragTargetTab(event);
if (window.getComputedStyle(this, null).direction == "ltr") {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
return i;
} else {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
@ -3171,7 +3175,7 @@
<parameter name="aTab"/>
<body>
<![CDATA[
return this.tabbrowser._removingTabs.indexOf(aTab) == -1;
return !aTab.closing;
]]>
</body>
</method>
@ -3194,7 +3198,7 @@
if (tab.getAttribute("fadein") == "true")
this._handleNewTab(tab);
else if (this.tabbrowser._removingTabs.indexOf(tab) > -1)
else if (tab.closing)
this.tabbrowser._endRemoveTab(tab);
]]></handler>
@ -3337,7 +3341,7 @@
var scrollRect = tabStrip.scrollClientRect;
var rect = this.getBoundingClientRect();
var minMargin = scrollRect.left - rect.left;
var maxMargin = Math.min(minMargin + scrollRect.width,
var maxMargin = Math.min(minMargin + scrollRect.width,
scrollRect.right);
if (!ltr)
[minMargin, maxMargin] = [this.clientWidth - maxMargin,
@ -3635,6 +3639,7 @@
<field name="mOverCloseButton">false</field>
<field name="mCorrespondingMenuitem">null</field>
<field name="_fullyOpen">false</field>
<field name="closing">false</field>
</implementation>
<handlers>
@ -3746,7 +3751,7 @@
continue;
if (curTabBO.screenX >= tabstripBO.screenX &&
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
this.childNodes[i].setAttribute("tabIsVisible", "true");
this.childNodes[i].setAttribute("tabIsVisible", "true");
else
this.childNodes[i].removeAttribute("tabIsVisible");
}
@ -3757,7 +3762,7 @@
<parameter name="aTab"/>
<body><![CDATA[
var menuItem = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item menuitem-with-favicon");

View File

@ -2107,7 +2107,9 @@ let GroupItems = {
let activeGroupId = this._activeGroupItem ? this._activeGroupItem.id : null;
Storage.saveGroupItemsData(
gWindow, { nextID: this.nextID, activeGroupId: activeGroupId });
gWindow,
{ nextID: this.nextID, activeGroupId: activeGroupId,
totalNumber: this.groupItems.length });
},
// ----------

View File

@ -1558,6 +1558,6 @@ TabCanvas.prototype = {
// ----------
// Function: toImageData
toImageData: function TabCanvas_toImageData() {
return this.canvas.toDataURL("image/png", "");
return this.canvas.toDataURL("image/png");
}
};

View File

@ -956,12 +956,11 @@ let UI = {
// ----------
updateTabButton: function UI__updateTabButton() {
let groupsNumber = gWindow.document.getElementById("tabviewGroupsNumber");
let exitButton = document.getElementById("exit-button");
let numberOfGroups = GroupItems.groupItems.length;
groupsNumber.setAttribute("groups", numberOfGroups);
exitButton.setAttribute("groups", numberOfGroups);
gTabView.updateGroupNumberBroadcaster(numberOfGroups);
},
// ----------
@ -995,7 +994,8 @@ let UI = {
#ifdef XP_MACOSX
"preferencesCmdMac", "minimizeWindow",
#endif
"newNavigator", "newNavigatorTab", "find"
"newNavigator", "newNavigatorTab", "undo", "cut", "copy", "paste",
"selectAll", "find"
].forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
keys[key] = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
@ -1004,7 +1004,7 @@ let UI = {
// for key combinations with shift key, the charCode of upper case letters
// are different to the lower case ones so need to handle them differently.
["closeWindow", "tabview", "undoCloseTab", "undoCloseWindow",
"privatebrowsing"].forEach(function(key) {
"privatebrowsing", "redo"].forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
keys[key] = element.getAttribute("key").toLocaleUpperCase().charCodeAt(0);
});
@ -1043,6 +1043,7 @@ let UI = {
case self._browserKeys.undoCloseTab:
case self._browserKeys.undoCloseWindow:
case self._browserKeys.closeWindow:
case self._browserKeys.redo:
preventDefault = false;
break;
case self._browserKeys.tabview:
@ -1056,6 +1057,11 @@ let UI = {
break;
case self._browserKeys.newNavigator:
case self._browserKeys.newNavigatorTab:
case self._browserKeys.undo:
case self._browserKeys.cut:
case self._browserKeys.copy:
case self._browserKeys.paste:
case self._browserKeys.selectAll:
preventDefault = false;
break;
#ifdef XP_UNIX

View File

@ -171,6 +171,7 @@ _BROWSER_FILES = \
browser_bug623893.js \
browser_bug624734.js \
browser_bug647886.js \
browser_bug655584.js \
browser_findbarClose.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \

View File

@ -0,0 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 655584 - awesomebar suggestions don't update after tab is closed
function test() {
var tab1 = gBrowser.addTab();
var tab2 = gBrowser.addTab();
// When urlbar in a new tab is focused, and a tab switch occurs,
// the urlbar popup should be closed
gBrowser.selectedTab = tab2;
gURLBar.focus(); // focus the urlbar in the tab we will switch to
gBrowser.selectedTab = tab1;
gURLBar.openPopup();
gBrowser.selectedTab = tab2;
ok(!gURLBar.popupOpen, "urlbar focused in tab to switch to, close popup");
// cleanup
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
}

View File

@ -54,6 +54,9 @@ function test() {
testVal("<http://sub.>mozilla.org<:666/file.ext>");
testVal("<http://>[fe80::222:19ff:fe11:8c76]</file.ext>");
testVal("<http://user:pass@>[fe80::222:19ff:fe11:8c76]<:666/file.ext>");
testVal("mailto:admin@mozilla.org");
testVal("gopher://mozilla.org/");
testVal("about:config");

View File

@ -115,6 +115,7 @@ _BROWSER_FILES = \
browser_tabview_bug626791.js \
browser_tabview_bug627288.js \
browser_tabview_bug627736.js \
browser_tabview_bug628061.js \
browser_tabview_bug628165.js \
browser_tabview_bug628270.js \
browser_tabview_bug629189.js \

View File

@ -19,15 +19,6 @@ function test() {
is(gBrowser.visibleTabs.length, numTabs, 'There should be ' + numTabs + ' visible tabs');
}
let restoreTab = function (callback) {
let tab = undoCloseTab(0);
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
afterAllTabsLoaded(callback);
});
}
let next = function () {
while (gBrowser.tabs.length-1)
gBrowser.removeTab(gBrowser.tabs[1]);
@ -86,7 +77,7 @@ function test() {
let tab = gBrowser.loadOneTab('http://mochi.test:8888/#1', {inBackground: true});
gBrowser.selectedTab = tab;
let continueTest = function () {
afterAllTabsLoaded(function () {
tab.linkedBrowser.loadURI('http://mochi.test:8888/#2');
afterAllTabsLoaded(function () {
@ -106,13 +97,7 @@ function test() {
});
});
});
}
// The executeSoon() call is really needed here because there's probably
// some callback waiting to be fired after gBrowser.loadOneTab(). After
// that the browser is in a state where loadURI() will create a new entry
// in the session history (that is vital for back/forward functionality).
afterAllTabsLoaded(function () executeSoon(continueTest));
});
}
// ----------
@ -156,45 +141,30 @@ function test() {
// ----------
function loadTabView(callback) {
window.addEventListener('tabviewshown', function () {
window.removeEventListener('tabviewshown', arguments.callee, false);
hideTabView(function () {
window.removeEventListener('tabviewhidden', arguments.callee, false);
callback();
});
}, false);
TabView.show();
}
// ----------
function hideTabView(callback) {
if (!TabView.isVisible())
return callback();
window.addEventListener('tabviewhidden', function () {
window.removeEventListener('tabviewhidden', arguments.callee, false);
callback();
}, false);
TabView.hide();
showTabView(function () {
hideTabView(callback);
});
}
// ----------
function enterAndLeavePrivateBrowsing(callback) {
togglePrivateBrowsing(function () {
togglePrivateBrowsing(callback);
});
}
// ----------
function togglePrivateBrowsing(callback) {
let topic = "private-browsing-transition-complete";
function pbObserver(aSubject, aTopic, aData) {
if (aTopic != "private-browsing-transition-complete")
if (aTopic != topic)
return;
if (pb.privateBrowsingEnabled)
pb.privateBrowsingEnabled = false;
else {
Services.obs.removeObserver(pbObserver, "private-browsing-transition-complete");
afterAllTabsLoaded(function () executeSoon(callback));
}
Services.obs.removeObserver(pbObserver, topic, false);
afterAllTabsLoaded(callback);
}
Services.obs.addObserver(pbObserver, "private-browsing-transition-complete", false);
pb.privateBrowsingEnabled = true;
Services.obs.addObserver(pbObserver, topic, false);
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
}

View File

@ -0,0 +1,37 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let state = {
windows: [{
tabs: [{
entries: [{ url: "about:blank" }],
hidden: true,
extData: {"tabview-tab": '{"url":"about:blank","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}
},{
entries: [{ url: "about:blank" }],
hidden: false,
extData: {"tabview-tab": '{"url":"about:blank","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
}],
selected: 2,
extData: {
"tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
"tabview-group":
'{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
'"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
}
}]
};
function test() {
waitForExplicitFinish();
newWindowWithState(state, function(win) {
registerCleanupFunction(function() win.close());
is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
"2", "There are two groups");
waitForFocus(finish);
});
}

View File

@ -105,7 +105,7 @@ function afterAllTabsLoaded(callback, win) {
this.removeEventListener("load", onLoad, true);
stillToLoad--;
if (!stillToLoad)
callback();
executeSoon(callback);
}
for (let a = 0; a < win.gBrowser.tabs.length; a++) {
@ -301,3 +301,21 @@ function newWindowWithState(state, callback) {
afterAllTabsLoaded(function () callback(win), win);
});
}
// ----------
function restoreTab(callback, index, win) {
win = win || window;
let tab = win.undoCloseTab(index || 0);
let tabItem = tab._tabViewTabItem;
if (tabItem._reconnected) {
afterAllTabsLoaded(callback, win);
return;
}
tab._tabViewTabItem.addSubscriber(tab, "reconnected", function onReconnected() {
tab._tabViewTabItem.removeSubscriber(tab, "reconnected");
afterAllTabsLoaded(callback, win);
});
}

View File

@ -192,7 +192,7 @@
let textNode = this.editor.rootElement.firstChild;
let value = textNode.textContent;
let matchedURL = value.match(/^((?:http|https|ftp):\/\/(?:[^\/]+@)?)([^\/:]+)/);
let matchedURL = value.match(/^((?:http|https|ftp):\/\/(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
if (!matchedURL)
return;

View File

@ -5,9 +5,7 @@ component {47cd0651-b1be-4a0f-b5c4-10e5a573ef71} nsBrowserContentHandler.js appl
contract @mozilla.org/browser/final-clh;1 {47cd0651-b1be-4a0f-b5c4-10e5a573ef71} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
contract @mozilla.org/uriloader/content-handler;1?type=text/html {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
contract @mozilla.org/uriloader/content-handler;1?type=application/vnd.mozilla.xul+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
#ifdef MOZ_SVG
contract @mozilla.org/uriloader/content-handler;1?type=image/svg+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
#endif
contract @mozilla.org/uriloader/content-handler;1?type=text/rdf {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
contract @mozilla.org/uriloader/content-handler;1?type=text/xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
contract @mozilla.org/uriloader/content-handler;1?type=application/xhtml+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}

View File

@ -221,6 +221,19 @@
accesskey="&cmd.new_separator.accesskey;"/>
#ifndef XP_MACOSX
<menuseparator id="orgUndoSeparator"/>
<menuitem id="orgUndo"
command="cmd_undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"/>
<menuitem id="orgRedo"
command="cmd_redo"
label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"/>
<menuseparator id="orgCutSeparator"/>
<menuitem id="orgCut"
@ -241,19 +254,14 @@
key="key_paste"
accesskey="&pasteCmd.accesskey;"
selection="mutable"/>
<menuitem id="orgUndo"
command="cmd_undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"/>
<menuitem id="orgRedo"
command="cmd_redo"
label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"/>
<menuitem id="orgDelete"
command="cmd_delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"/>
<menuseparator id="selectAllSeparator"/>
<menuitem id="orgSelectAll"
command="cmd_selectAll"
label="&selectAllCmd.label;"
@ -262,16 +270,18 @@
#endif
<menuseparator id="orgMoveSeparator"/>
<menuitem id="orgMoveBookmarks"
command="placesCmd_moveBookmarks"
label="&cmd.moveBookmarks.label;"
accesskey="&cmd.moveBookmarks.accesskey;"/>
#ifdef XP_MACOSX
<menuitem id="orgDelete"
command="cmd_delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"/>
#ifndef XP_MACOSX
#else
<menuseparator id="orgCloseSeparator"/>
<menuitem id="orgClose"
@ -369,12 +379,12 @@
<hbox flex="1" id="placesView">
<tree id="placesList"
class="placesTree"
class="plain placesTree"
type="places"
hidecolumnpicker="true" context="placesContext"
onselect="PlacesOrganizer.onPlaceSelected(true);"
onclick="PlacesOrganizer.onTreeClick(event);"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onfocus="PlacesOrganizer.onTreeFocus(event);"
seltype="single"
persist="width"
width="200"
@ -387,116 +397,112 @@
</tree>
<splitter collapse="none" persist="state"></splitter>
<vbox id="contentView" flex="4">
<deck id="contentDeck" flex="1">
<vbox id="defaultView" flex="1">
<vbox id="searchModifiers" hidden="true">
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
<label id="scopeBarTitle" value="&search.in.label;"/>
<toolbarbutton id="scopeBarAll" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeBookmarks.label;"
accesskey="&search.scopeBookmarks.accesskey;"/>
<!--
<toolbarbutton id="scopeBarDownloads" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeDownloads.label;"
accesskey="&search.scopeDownloads.accesskey;"/>
-->
<toolbarbutton id="scopeBarHistory" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeHistory.label;"
accesskey="&search.scopeHistory.accesskey;"/>
<toolbarbutton id="scopeBarFolder" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
accesskey="&search.scopeFolder.accesskey;"
emptytitle="&search.scopeFolder.label;" flex="1"/>
<!-- The folder scope button should flex but not take up more room
than its label needs. The only simple way to do that is to
set a really big flex on the spacer, e.g., 2^31 - 1. -->
<spacer flex="2147483647"/>
<button id="saveSearch" class="small"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="OrganizerCommand_search:save"/>
</toolbar>
<toolbox id="searchModifiers" hidden="true">
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
<label id="scopeBarTitle" value="&search.in.label;"/>
<toolbarbutton id="scopeBarAll" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeBookmarks.label;"
accesskey="&search.scopeBookmarks.accesskey;"/>
<!--
<toolbarbutton id="scopeBarDownloads" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeDownloads.label;"
accesskey="&search.scopeDownloads.accesskey;"/>
-->
<toolbarbutton id="scopeBarHistory" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeHistory.label;"
accesskey="&search.scopeHistory.accesskey;"/>
<toolbarbutton id="scopeBarFolder" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
accesskey="&search.scopeFolder.accesskey;"
emptytitle="&search.scopeFolder.label;" flex="1"/>
<!-- The folder scope button should flex but not take up more room
than its label needs. The only simple way to do that is to
set a really big flex on the spacer, e.g., 2^31 - 1. -->
<spacer flex="2147483647"/>
<button id="saveSearch" class="small-margin"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="OrganizerCommand_search:save"/>
</toolbar>
</toolbox>
<tree id="placeContent"
class="plain placesTree"
context="placesContext"
hidecolumnpicker="true"
flex="1"
type="places"
flatList="true"
enableColumnDrag="true"
onkeypress="if (event.keyCode == KeyEvent.DOM_VK_RETURN) PlacesOrganizer.openSelectedNode(event);"
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"
onselect="PlacesOrganizer.onContentTreeSelect();"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onclick="PlacesOrganizer.onTreeClick(event);">
<treecols id="placeContentColumns" context="placesColumnsContext">
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
</treecols>
<treechildren flex="1"/>
</tree>
<deck id="detailsDeck" style="height: 11em;">
<vbox id="itemsCountBox" align="center">
<spacer flex="3"/>
<label id="itemsCountText"/>
<spacer flex="1"/>
<description id="selectItemDescription">
&detailsPane.selectAnItemText.description;
</description>
<spacer flex="3"/>
</vbox>
<vbox id="infoBox" minimal="true">
<vbox id="editBookmarkPanelContent" flex="1"/>
<hbox id="infoBoxExpanderWrapper" align="center">
</vbox>
<vbox flex="1">
<tree id="placeContent" class="placesTree" context="placesContext"
hidecolumnpicker="true"
flex="1" type="places"
flatList="true"
enableColumnDrag="true"
onkeypress="if (event.keyCode == KeyEvent.DOM_VK_RETURN) PlacesOrganizer.openSelectedNode(event);"
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"
onselect="PlacesOrganizer.onContentTreeSelect();"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onclick="PlacesOrganizer.onTreeClick(event);">
<treecols id="placeContentColumns" context="placesColumnsContext">
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
</treecols>
<treechildren flex="1"/>
</tree>
<hbox id="infoPaneBox" style="height: 11em;">
<deck flex="1" id="detailsDeck">
<vbox id="itemsCountBox" align="center">
<spacer flex="3"/>
<label id="itemsCountText"/>
<spacer flex="1"/>
<description id="selectItemDescription">
&detailsPane.selectAnItemText.description;
</description>
<spacer flex="3"/>
</vbox>
<vbox id="infoBox" minimal="true">
<vbox id="editBookmarkPanelContent"/>
<spacer flex="1"/>
<hbox id="infoBoxExpanderWrapper" align="center">
<button type="image" id="infoBoxExpander"
class="expander-down"
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
observes="paneElementsBroadcaster"/>
<button type="image" id="infoBoxExpander"
class="expander-down"
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
observes="paneElementsBroadcaster"/>
<label id="infoBoxExpanderLabel"
lesslabel="&detailsPane.less.label;"
lessaccesskey="&detailsPane.less.accesskey;"
morelabel="&detailsPane.more.label;"
moreaccesskey="&detailsPane.more.accesskey;"
value="&detailsPane.more.label;"
accesskey="&detailsPane.more.accesskey;"
control="infoBoxExpander"/>
<label id="infoBoxExpanderLabel"
lesslabel="&detailsPane.less.label;"
lessaccesskey="&detailsPane.less.accesskey;"
morelabel="&detailsPane.more.label;"
moreaccesskey="&detailsPane.more.accesskey;"
value="&detailsPane.more.label;"
accesskey="&detailsPane.more.accesskey;"
control="infoBoxExpander"/>
<spacer flex="1"/>
</hbox>
</vbox>
</deck>
</hbox>
</vbox>
</hbox>
</vbox>
</deck>
</vbox>

View File

@ -81,29 +81,29 @@ function Site(host) {
this.httpURI = NetUtil.newURI("http://" + this.host);
this.httpsURI = NetUtil.newURI("https://" + this.host);
this._favicon = "";
}
Site.prototype = {
/**
* Gets the favicon to use for the site. This will return the default favicon
* if there is no favicon stored for the site.
* Gets the favicon to use for the site. The callback only gets called if
* a favicon is found for either the http URI or the https URI.
*
* @return A favicon image URL.
* @param aCallback
* A callback function that takes a favicon image URL as a parameter.
*/
get favicon() {
if (!this._favicon) {
// TODO: Bug 657961: Make this async when bug 655270 is fixed.
getFavicon: function Site_getFavicon(aCallback) {
function faviconDataCallback(aURI, aDataLen, aData, aMimeType) {
try {
// First try to see if a favicon is stored for the http URI.
this._favicon = gFaviconService.getFaviconForPage(this.httpURI).spec;
aCallback(aURI.spec);
} catch (e) {
// getFaviconImageForPage returns the default favicon if no stored favicon is found.
this._favicon = gFaviconService.getFaviconImageForPage(this.httpsURI).spec;
Cu.reportError("AboutPermissions: " + e);
}
}
return this._favicon;
// Try to find favicion for both URIs. Callback will only be called if a
// favicon URI is found, so this means we'll always prefer the https favicon.
gFaviconService.getFaviconURLForPage(this.httpURI, faviconDataCallback);
gFaviconService.getFaviconURLForPage(this.httpsURI, faviconDataCallback);
},
/**
@ -265,7 +265,7 @@ let PermissionDefaults = {
return this.DENY;
},
set password(aValue) {
let value = (aValue == this.ALLOW);
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("signon.rememberSignons", value);
},
@ -280,7 +280,7 @@ let PermissionDefaults = {
return this.DENY;
}
if (Services.prefs.getIntPref("network.cookie.lifetimePolicy") == this.COOKIE_DENY) {
if (Services.prefs.getIntPref("network.cookie.lifetimePolicy") == this.COOKIE_SESSION) {
return this.SESSION;
}
return this.ALLOW;
@ -303,7 +303,7 @@ let PermissionDefaults = {
return this.UNKNOWN;
},
set geo(aValue) {
let value = (aValue == this.ALLOW);
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("geo.enabled", value);
},
@ -316,7 +316,7 @@ let PermissionDefaults = {
return this.UNKNOWN;
},
set indexedDB(aValue) {
let value = (aValue == this.ALLOW);
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("dom.indexedDB.enabled", value);
},
@ -542,7 +542,10 @@ let AboutPermissions = {
let item = document.createElement("richlistitem");
item.setAttribute("class", "site");
item.setAttribute("value", aSite.host);
item.setAttribute("favicon", aSite.favicon);
aSite.getFavicon(function(aURL) {
item.setAttribute("favicon", aURL);
});
aSite.listitem = item;
this.sitesList.appendChild(item);

View File

@ -41,6 +41,7 @@
#
# ***** END LICENSE BLOCK *****
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const DEBUG = false; /* set to false to suppress debug messages */
@ -56,15 +57,6 @@ const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
function nsSidebar()
{
const PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
const nsIPromptService = Components.interfaces.nsIPromptService;
this.promptService =
Components.classes[PROMPTSERVICE_CONTRACTID].getService(nsIPromptService);
const SEARCHSERVICE_CONTRACTID = "@mozilla.org/browser/search-service;1";
const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
this.searchService =
Components.classes[SEARCHSERVICE_CONTRACTID].getService(nsIBrowserSearchService);
}
nsSidebar.prototype.classID = SIDEBAR_CID;
@ -102,20 +94,15 @@ function(aTitle, aContentURL, aCustomizeURL)
nsSidebar.prototype.addPanelInternal =
function (aTitle, aContentURL, aCustomizeURL, aPersist)
{
var WINMEDSVC = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
// XXX Bug 620418: We shouldn't do this anymore. Instead, we should find the
// global object for our caller and use it.
var win = WINMEDSVC.getMostRecentWindow( "navigator:browser" );
var win = Services.wm.getMostRecentWindow("navigator:browser");
if (!sidebarURLSecurityCheck(aContentURL))
return;
var uri = null;
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
try {
uri = ioService.newURI(aContentURL, null, null);
uri = Services.io.newURI(aContentURL, null, null);
}
catch(ex) { return; }
@ -141,7 +128,7 @@ function (engineURL, iconURL)
if (!isWeb.test(engineURL))
throw "Unsupported search engine URL";
if (iconURL && !isWeb.test(iconURL))
throw "Unsupported search icon URL.";
}
@ -149,19 +136,17 @@ function (engineURL, iconURL)
{
debug(ex);
Components.utils.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
var searchBundle = srGetStrBundle("chrome://global/locale/search/search.properties");
var brandBundle = srGetStrBundle("chrome://branding/locale/brand.properties");
var searchBundle = Services.strings.createBundle("chrome://global/locale/search/search.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var brandName = brandBundle.GetStringFromName("brandShortName");
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
getService(Components.interfaces.nsIWindowWatcher);
ww.getNewPrompter(null).alert(title, msg);
Services.ww.getNewPrompter(null).alert(title, msg);
return false;
}
return true;
}
@ -185,7 +170,7 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
else
dataType = Components.interfaces.nsISearchEngine.DATA_XML;
this.searchService.addEngine(engineURL, dataType, iconURL, true);
Services.search.addEngine(engineURL, dataType, iconURL, true);
}
// This function exists largely to implement window.external.AddSearchProvider(),
@ -198,23 +183,21 @@ function (aDescriptionURL)
// page since we don't have easy access to the active document. Most search
// engines will override this with an icon specified in the OpenSearch
// description anyway.
var WINMEDSVC = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
var win = WINMEDSVC.getMostRecentWindow("navigator:browser");
var browser = win.document.getElementById("content");
var win = Services.wm.getMostRecentWindow("navigator:browser");
var browser = win.gBrowser;
var iconURL = "";
// Use documentURIObject in the check for shouldLoadFavIcon so that we
// do the right thing with about:-style error pages. Bug 453442
if (browser.shouldLoadFavIcon(browser.selectedBrowser
.contentDocument
.documentURIObject))
iconURL = win.gBrowser.getIcon();
iconURL = browser.getIcon();
if (!this.validateSearchEngine(aDescriptionURL, iconURL))
return;
const typeXML = Components.interfaces.nsISearchEngine.DATA_XML;
this.searchService.addEngine(aDescriptionURL, typeXML, iconURL, true);
Services.search.addEngine(aDescriptionURL, typeXML, iconURL, true);
}
// This function exists to implement window.external.IsSearchProviderInstalled(),
@ -265,16 +248,3 @@ if (DEBUG)
debug = function (s) { dump("-*- sidebar component: " + s + "\n"); }
else
debug = function (s) {}
// String bundle service
var gStrBundleService = null;
function srGetStrBundle(path)
{
if (!gStrBundleService)
gStrBundleService =
Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
return gStrBundleService.createBundle(path);
}

View File

@ -1 +1 @@
6.0a1
7.0a1

View File

@ -138,7 +138,6 @@
@BINPATH@/components/content_canvas.xpt
@BINPATH@/components/content_htmldoc.xpt
@BINPATH@/components/content_html.xpt
@BINPATH@/components/content_xmldoc.xpt
@BINPATH@/components/content_xslt.xpt
@BINPATH@/components/content_xtf.xpt
@BINPATH@/components/cookie.xpt

View File

@ -1697,6 +1697,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Sidebar */
#sidebar-header > .tabs-closebutton {
margin-bottom: 0px !important;

View File

@ -64,38 +64,11 @@
background-color: Window;
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
margin: 0px;
border: none;
padding: 0;
}
#placeContent {
border: 0px;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
padding: 5px;
}
.small, .small[disabled="true"] {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}

View File

@ -32,6 +32,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("moz-icon://stock/gtk-file?size=menu");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -2006,6 +2006,11 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-padding-end: 4px;

View File

@ -2,12 +2,6 @@
/* Places Organizer Sidebars */
#placesList {
-moz-appearance: none;
border: none;
margin: 0;
}
#placesList > treechildren::-moz-tree-row {
background-color: transparent;
border-color: transparent;
@ -179,23 +173,17 @@
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
-moz-appearance: none;
background-color: #d2d8e2;
width: 160px;
margin: 0px;
border: 0px;
}
#placesList:-moz-window-inactive {
background-color: #e8e8e8;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
border-top: 1px solid #919191;
background-color: #f0f0f0;
padding: 10px;
@ -235,19 +223,6 @@
border-color: transparent;
}
.small {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
/* Scope Bar */
#advancedSearch > hbox,

View File

@ -34,6 +34,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -1881,6 +1881,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-appearance: none;

View File

@ -65,7 +65,7 @@
border: none;
}
#infoPaneBox {
#detailsDeck {
border-top-color: #A9B7C9;
}

View File

@ -110,47 +110,17 @@
border-top: 1px solid ThreeDDarkShadow;
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
-moz-appearance: none;
margin: 0px;
border: none;
padding: 0;
}
#placeContent {
-moz-appearance: none;
border: 0px;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
border-top: 1px solid ThreeDShadow;
padding: 5px;
}
.small, .small[disabled="true"] {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}
#organizerScopeBar {
-moz-appearance: toolbox;
padding: 2px 0;
-moz-padding-end: 3px;
}

View File

@ -37,6 +37,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -123,11 +123,11 @@ libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
# Basic unit tests for some stuff in the unify script
check::
# build ppc/i386 binaries, and unify them
rm -f unify-test-ppc unify-test-i386 unify-test-universal
$(HOST_CC) -arch ppc $(srcdir)/unify-test.c -o unify-test-ppc
# build x64/i386 binaries, and unify them
rm -f unify-test-x64 unify-test-i386 unify-test-universal
$(HOST_CC) -arch x86_64 $(srcdir)/unify-test.c -o unify-test-x64
$(HOST_CC) -arch i386 $(srcdir)/unify-test.c -o unify-test-i386
@if ! $(srcdir)/macosx/universal/unify ./unify-test-ppc ./unify-test-i386 \
@if ! $(srcdir)/macosx/universal/unify ./unify-test-x64 ./unify-test-i386 \
./unify-test-universal; then \
echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary!"; \
false; \

View File

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2009-12-04'
timestamp='2011-01-03'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -1432,6 +1432,9 @@ case $os in
-dicos*)
os=-dicos
;;
-android*)
os=android
;;
-none)
;;
*)
@ -1686,6 +1689,9 @@ case $basic_machine in
-vos*)
vendor=stratus
;;
*-android*|*-linuxandroid*)
vendor=linux-
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;

View File

@ -55,7 +55,6 @@ MOZ_APP_VENDOR = @MOZ_APP_VENDOR@
MOZ_APP_PROFILE = @MOZ_APP_PROFILE@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_UA_FIREFOX_VERSION = @FIREFOX_VERSION@
MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
@ -258,7 +257,7 @@ MOZ_MATHML = @MOZ_MATHML@
MOZ_CSS_ANIMATIONS = @MOZ_CSS_ANIMATIONS@
MOZ_PERMISSIONS = @MOZ_PERMISSIONS@
MOZ_XTF = @MOZ_XTF@
MOZ_SVG = @MOZ_SVG@
MOZ_SVG_DLISTS = @MOZ_SVG_DLISTS@
MOZ_CAIRO_CFLAGS = @MOZ_CAIRO_CFLAGS@
MOZ_SMIL = @MOZ_SMIL@
MOZ_XSLT_STANDALONE = @MOZ_XSLT_STANDALONE@
@ -549,6 +548,7 @@ MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
MOZ_QT_CFLAGS = @MOZ_QT_CFLAGS@
MOZ_QT_LIBS = @MOZ_QT_LIBS@
MOZ_ENABLE_QTNETWORK = @MOZ_ENABLE_QTNETWORK@
MOZ_ENABLE_QMSYSTEM2 = @MOZ_ENABLE_QMSYSTEM2@
MOZ_ENABLE_QTMOBILITY = @MOZ_ENABLE_QTMOBILITY@
MOZ_ENABLE_CONTENTACTION = @MOZ_ENABLE_CONTENTACTION@
MOZ_ENABLE_MEEGOTOUCHSHARE = @MOZ_ENABLE_MEEGOTOUCHSHARE@

View File

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
6.0a1
7.0a1

View File

@ -264,7 +264,25 @@ MOZ_ARG_WITH_STRING(android-sdk,
location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
android_sdk=$withval)
if test "$target" = "arm-android-eabi" ; then
MOZ_ARG_WITH_STRING(android-platform,
[ --with-android-platform=DIR
location of platform dir, default NDK/build/platforms/android-5/arch-arm],
android_platform=$withval)
case "$target" in
arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
arm-android-eabi)
android_tool_prefix="arm-eabi"
;;
*)
android_tool_prefix="$target_os"
;;
esac
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_ndk" ; then
AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
fi
@ -287,24 +305,30 @@ if test "$target" = "arm-android-eabi" ; then
fi
dnl set up compilers
AS="$android_toolchain"/bin/arm-eabi-as
CC="$android_toolchain"/bin/arm-eabi-gcc
CXX="$android_toolchain"/bin/arm-eabi-g++
CPP="$android_toolchain"/bin/arm-eabi-cpp
LD="$android_toolchain"/bin/arm-eabi-ld
AR="$android_toolchain"/bin/arm-eabi-ar
RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
STRIP="$android_toolchain"/bin/arm-eabi-strip
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
if test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/ -lstlport_static"
fi
CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
LIBS="$LIBS $STLPORT_LDFLAGS"
dnl Add -llog by default, since we use it all over the place.
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
dnl undefined symbol (present on the hardware, just not in the
dnl NDK.)
LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
LDFLAGS="-mandroid -L$android_platform/usr/lib -L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
dnl prevent cross compile section from using these flags as host flags
if test -z "$HOST_CPPFLAGS" ; then
@ -336,7 +360,8 @@ if test "$target" = "arm-android-eabi" ; then
CROSS_COMPILE=1
MOZ_CHROME_FILE_FORMAT=omni
ZLIB_DIR=yes
fi
;;
esac
AC_SUBST(ANDROID_NDK)
AC_SUBST(ANDROID_TOOLCHAIN)
@ -1223,7 +1248,7 @@ if test -n "$CROSS_COMPILE"; then
darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
esac
case "${target}" in
arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
*-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
esac
else
OS_TARGET=`uname -s`
@ -2171,6 +2196,23 @@ ia64*-hpux*)
fi
;;
*-android*|*-linuxandroid*)
AC_DEFINE(NO_PW_GECOS)
no_x=yes
_PLATFORM_DEFAULT_TOOLKIT=cairo-android
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
*-*linux*)
# Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
# Similarly for GNU_CXX and INTEL_CXX.
@ -2690,23 +2732,6 @@ alpha*-*-osf*)
HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
;;
*-android*)
AC_DEFINE(NO_PW_GECOS)
no_x=yes
_PLATFORM_DEFAULT_TOOLKIT=cairo-android
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
esac
dnl Only one oddball right now (QNX), but this gives us flexibility
@ -3323,25 +3348,6 @@ case $target in
AC_CHECK_LIB(socket, socket)
esac
dnl ========================================================
dnl Check whether we can compile code for Core Text
dnl (available on Mac OS X 10.5 or later)
dnl ========================================================
case "$target" in
*-darwin*)
AC_MSG_CHECKING([for Core Text])
AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
[CTLineRef lineRef;],
ac_cv_have_core_text="yes",
ac_cv_have_core_text="no")
AC_MSG_RESULT([$ac_cv_have_core_text])
if test "$ac_cv_have_core_text" = "no"; then
AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
fi
;;
esac
XLDFLAGS="$X_LIBS"
XLIBS="$X_EXTRA_LIBS"
@ -4299,7 +4305,7 @@ if test "$ac_cv_thread_keyword" = yes; then
mips*-*)
:
;;
*-android*)
*-android*|*-linuxandroid*)
:
;;
*)
@ -4835,7 +4841,7 @@ MOZ_HELP_VIEWER=
MOZ_SPELLCHECK=1
MOZ_SPLASHSCREEN=
MOZ_STORAGE=1
MOZ_SVG=1
MOZ_SVG_DLISTS=
MOZ_THUMB2=
MOZ_TIMELINE=
MOZ_TOOLKIT_SEARCH=1
@ -4883,7 +4889,7 @@ case "$target_os" in
esac
case "${target}" in
arm-android-eabi)
*-android*|*-linuxandroid*)
NSS_DISABLE_DBM=1
USE_ARM_KUSER=1
MOZ_INSTALLER=
@ -5251,6 +5257,18 @@ incorrect])
fi
MOC=$HOST_MOC
MOZ_ENABLE_QMSYSTEM2=
PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
MOZ_ENABLE_QMSYSTEM2=1,
MOZ_ENABLE_QMSYSTEM2=)
if test "$MOZ_ENABLE_QMSYSTEM2"; then
MOZ_ENABLE_QMSYSTEM2=1
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
fi
MOZ_ENABLE_QTNETWORK=
PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
MOZ_ENABLE_QTNETWORK=1,
@ -5290,6 +5308,7 @@ AC_SUBST(MOZ_ENABLE_GTK2)
AC_SUBST(MOZ_ENABLE_PHOTON)
AC_SUBST(MOZ_ENABLE_QT)
AC_SUBST(MOZ_ENABLE_QTNETWORK)
AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
AC_SUBST(MOZ_ENABLE_QTMOBILITY)
AC_SUBST(MOZ_ENABLE_XREMOTE)
AC_SUBST(MOZ_GTK2_CFLAGS)
@ -6196,7 +6215,7 @@ i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
MOZ_CRASHREPORTER=1
fi
;;
arm-android-eabi)
*-android*|*-linuxandroid*)
MOZ_CRASHREPORTER=1
;;
*solaris*)
@ -6403,9 +6422,11 @@ fi
AC_DEFINE(MOZ_CSS_ANIMATIONS)
dnl ========================================================
dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
dnl SVG Display Lists
dnl ========================================================
AC_DEFINE(MOZ_SVG)
if test -n "$MOZ_SVG_DLISTS"; then
AC_DEFINE(MOZ_SVG_DLISTS)
fi
dnl ========================================================
dnl SMIL
@ -7324,6 +7345,13 @@ else
*-*freebsd*)
AC_DEFINE(MOZ_MEMORY_BSD)
;;
*-android*|*-linuxandroid*)
AC_DEFINE(MOZ_MEMORY_LINUX)
AC_DEFINE(MOZ_MEMORY_ANDROID)
_WRAP_MALLOC=1
export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
;;
*-*linux*)
AC_DEFINE(MOZ_MEMORY_LINUX)
;;
@ -7372,13 +7400,6 @@ else
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
export DLLFLAGS
;;
*-android*)
AC_DEFINE(MOZ_MEMORY_LINUX)
AC_DEFINE(MOZ_MEMORY_ANDROID)
_WRAP_MALLOC=1
export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
;;
@ -8380,6 +8401,7 @@ if test "$MOZ_TREE_CAIRO"; then
AC_DEFINE(HAVE_UINT64_T)
# Define macros for cairo-features.h
TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
if test "$MOZ_X11"; then
XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
@ -8462,6 +8484,7 @@ if test "$MOZ_TREE_CAIRO"; then
AC_SUBST(QUARTZ_FONT_FEATURE)
AC_SUBST(PNG_FUNCTIONS_FEATURE)
AC_SUBST(QT_SURFACE_FEATURE)
AC_SUBST(TEE_SURFACE_FEATURE)
MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
@ -8731,7 +8754,6 @@ AC_SUBST(MOZ_CSS_ANIMATIONS)
AC_SUBST(MOZ_PERMISSIONS)
AC_SUBST(MOZ_XTF)
AC_SUBST(MOZ_PREF_EXTENSIONS)
AC_SUBST(MOZ_SVG)
AC_SUBST(MOZ_SMIL)
AC_SUBST(MOZ_XSLT_STANDALONE)
AC_SUBST(MOZ_JS_LIBS)
@ -8841,7 +8863,7 @@ AC_SUBST(MOZ_APP_UA_NAME)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(MOZ_APP_VERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_SUBST(MOZ_UA_FIREFOX_VERSION)
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
AC_SUBST(MOZ_UA_BUILDID)

View File

@ -43,16 +43,12 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = content
PARALLEL_DIRS = base canvas events html smil xml xul xbl xslt
PARALLEL_DIRS = base canvas events html smil svg xml xul xbl xslt
ifdef MOZ_MEDIA
PARALLEL_DIRS += media
endif
ifdef MOZ_SVG
PARALLEL_DIRS += svg
endif
ifdef MOZ_XTF
PARALLEL_DIRS += xtf
endif

View File

@ -9,14 +9,12 @@ function testCancel() {
xhr.addEventListener("readystatechange", function(e) {
if (xhr.readyState == 3) // NOTE : only leaks for state == 3
xhr.abort();
else if (xhr.readyState == 4)
document.documentElement.className = "";
}, false);
xhr.open("GET", "552651.xml", true);
xhr.send();
setTimeout(function f() {
document.documentElement.className = "";
}, 1000);
}
</script>
</head>

View File

@ -214,15 +214,11 @@
#define NS_RANGEUTILS_CID \
{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#ifdef MOZ_SVG
#define NS_SVGDOCUMENT_CID \
{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \
0xb7f44954, 0x11d1, 0x11b2, \
{0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}}
#endif // MOZ_SVG
#ifdef MOZ_MEDIA
// {d899a152-9412-46b2-b651-2e71c5c2f05f}

View File

@ -125,11 +125,9 @@ void
NS_TrustedNewXULElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
#endif
#ifdef MOZ_SVG
nsresult
NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
#endif
nsresult
NS_NewGenConImageContent(nsIContent** aResult,

View File

@ -51,6 +51,17 @@
#include <ieeefp.h>
#endif
//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
#ifdef __FreeBSD__
#include <ieeefp.h>
#ifdef __alpha__
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
#else
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
#endif
static fp_except_t oldmask = fpsetmask(~allmask);
#endif
#include "nsAString.h"
#include "nsIStatefulFrame.h"
#include "nsINodeInfo.h"
@ -66,7 +77,6 @@
#include "nsTArray.h"
#include "nsTextFragment.h"
#include "nsReadableUtils.h"
#include "nsIPrefBranch2.h"
#include "mozilla/AutoRestore.h"
#include "nsINode.h"
#include "nsHashtable.h"
@ -93,7 +103,6 @@ class imgIDecoderObserver;
class imgIRequest;
class imgILoader;
class imgICache;
class nsIPrefBranch2;
class nsIImageLoadingContent;
class nsIDOMHTMLFormElement;
class nsIDOMDocument;
@ -118,8 +127,6 @@ class nsPIDOMWindow;
class nsPIDOMEventTarget;
class nsIPresShell;
class nsIXPConnectJSObjectHolder;
class nsPrefOldCallback;
class nsPrefObserverHashKey;
#ifdef MOZ_XTF
class nsIXTFService;
#endif
@ -135,11 +142,6 @@ struct nsIntMargin;
class nsPIDOMWindow;
class nsIDocumentLoaderFactory;
#ifndef have_PrefChangedFunc_typedef
typedef int (*PR_CALLBACK PrefChangedFunc)(const char *, void *);
#define have_PrefChangedFunc_typedef
#endif
namespace mozilla {
namespace layers {
@ -214,7 +216,8 @@ public:
* When a document's scope changes (e.g., from document.open(), call this
* function to move all content wrappers from the old scope to the new one.
*/
static nsresult ReparentContentWrappersInScope(nsIScriptGlobalObject *aOldScope,
static nsresult ReparentContentWrappersInScope(JSContext *cx,
nsIScriptGlobalObject *aOldScope,
nsIScriptGlobalObject *aNewScope);
static PRBool IsCallerChrome();
@ -550,27 +553,6 @@ public:
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
static nsAdoptingCString GetCharPref(const char *aPref);
static PRPackedBool GetBoolPref(const char *aPref,
PRBool aDefault = PR_FALSE);
static PRInt32 GetIntPref(const char *aPref, PRInt32 aDefault = 0);
static nsAdoptingString GetLocalizedStringPref(const char *aPref);
static nsAdoptingString GetStringPref(const char *aPref);
static void RegisterPrefCallback(const char *aPref,
PrefChangedFunc aCallback,
void * aClosure);
static void UnregisterPrefCallback(const char *aPref,
PrefChangedFunc aCallback,
void * aClosure);
static void AddBoolPrefVarCache(const char* aPref, PRBool* aVariable,
PRBool aDefault = PR_FALSE);
static void AddIntPrefVarCache(const char* aPref, PRInt32* aVariable,
PRInt32 aDefault = 0);
static nsIPrefBranch2 *GetPrefBranch()
{
return sPrefBranch;
}
// Get a permission-manager setting for the given uri and type.
// If the pref doesn't exist or if it isn't ALLOW_ACTION, PR_FALSE is
// returned, otherwise PR_TRUE is returned.
@ -770,9 +752,7 @@ public:
eFORMS_PROPERTIES,
ePRINTING_PROPERTIES,
eDOM_PROPERTIES,
#ifdef MOZ_SVG
eSVG_PROPERTIES,
#endif
eBRAND_PROPERTIES,
eCOMMON_DIALOG_PROPERTIES,
PropertiesFile_COUNT
@ -865,16 +845,6 @@ public:
*/
static PRBool IsInChromeDocshell(nsIDocument *aDocument);
/**
* Release *aSupportsPtr when the shutdown notification is received
*/
static nsresult ReleasePtrOnShutdown(nsISupports** aSupportsPtr) {
NS_ASSERTION(aSupportsPtr, "Expect to crash!");
NS_ASSERTION(*aSupportsPtr, "Expect to crash!");
return sPtrsToPtrsToRelease->AppendElement(aSupportsPtr) != nsnull ? NS_OK :
NS_ERROR_OUT_OF_MEMORY;
}
/**
* Return the content policy service
*/
@ -1491,29 +1461,6 @@ public:
return sScriptBlockerCount == 0;
}
/**
* Get/Set the current number of removable updates. Currently only
* UPDATE_CONTENT_MODEL updates are removable, and only when firing mutation
* events. These functions should only be called by mozAutoDocUpdateRemover.
* The count is also adjusted by the normal calls to BeginUpdate/EndUpdate.
*/
static void AddRemovableScriptBlocker()
{
AddScriptBlocker();
++sRemovableScriptBlockerCount;
}
static void RemoveRemovableScriptBlocker()
{
NS_ASSERTION(sRemovableScriptBlockerCount != 0,
"Number of removable blockers should never go below zero");
--sRemovableScriptBlockerCount;
RemoveScriptBlocker();
}
static PRUint32 GetRemovableScriptBlockerLevel()
{
return sRemovableScriptBlockerCount;
}
/* Process viewport META data. This gives us information for the scale
* and zoom of a page on mobile devices. We stick the information in
* the document header and use it later on after rendering.
@ -1823,11 +1770,6 @@ private:
static nsIXTFService *sXTFService;
#endif
static nsIPrefBranch2 *sPrefBranch;
// For old compatibility of RegisterPrefCallback
static nsRefPtrHashtable<nsPrefObserverHashKey, nsPrefOldCallback>
*sPrefCallbackTable;
static bool sImgLoaderInitialized;
static void InitImgLoader();
@ -1851,9 +1793,6 @@ private:
static nsIWordBreaker* sWordBreaker;
static nsIUGenCategory* sGenCat;
// Holds pointers to nsISupports* that should be released at shutdown
static nsTArray<nsISupports**>* sPtrsToPtrsToRelease;
static nsIScriptRuntime* sScriptRuntimes[NS_STID_ARRAY_UBOUND];
static PRInt32 sScriptRootCount[NS_STID_ARRAY_UBOUND];
static PRUint32 sJSGCThingRootCount;
@ -1864,7 +1803,6 @@ private:
static PRBool sInitialized;
static PRUint32 sScriptBlockerCount;
static PRUint32 sRemovableScriptBlockerCount;
#ifdef DEBUG
static PRUint32 sDOMNodeRemovedSuppressCount;
#endif
@ -1932,33 +1870,6 @@ private:
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class NS_STACK_CLASS nsAutoRemovableScriptBlocker {
public:
nsAutoRemovableScriptBlocker(MOZILLA_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
nsContentUtils::AddRemovableScriptBlocker();
}
~nsAutoRemovableScriptBlocker() {
nsContentUtils::RemoveRemovableScriptBlocker();
}
private:
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class NS_STACK_CLASS mozAutoRemovableBlockerRemover
{
public:
mozAutoRemovableBlockerRemover(nsIDocument* aDocument
MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM);
~mozAutoRemovableBlockerRemover();
private:
PRUint32 mNestingLevel;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsIDocumentObserver> mObserver;
MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class NS_STACK_CLASS nsAutoScriptBlockerSuppressNodeRemoved :
public nsAutoScriptBlocker {
public:
@ -1983,6 +1894,88 @@ public:
} \
} else
/**
* Macros to workaround math-bugs bugs in various platforms
*/
/**
* Stefan Hanske <sh990154@mail.uni-greifswald.de> reports:
* ARM is a little endian architecture but 64 bit double words are stored
* differently: the 32 bit words are in little endian byte order, the two words
* are stored in big endian`s way.
*/
#if defined(__arm) || defined(__arm32__) || defined(__arm26__) || defined(__arm__)
#if !defined(__VFP_FP__)
#define FPU_IS_ARM_FPA
#endif
#endif
typedef union dpun {
struct {
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
PRUint32 lo, hi;
#else
PRUint32 hi, lo;
#endif
} s;
PRFloat64 d;
public:
operator double() const {
return d;
}
} dpun;
/**
* Utility class for doubles
*/
#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
/**
* This version of the macros is safe for the alias optimizations
* that gcc does, but uses gcc-specific extensions.
*/
#define DOUBLE_HI32(x) (__extension__ ({ dpun u; u.d = (x); u.s.hi; }))
#define DOUBLE_LO32(x) (__extension__ ({ dpun u; u.d = (x); u.s.lo; }))
#else // __GNUC__
/* We don't know of any non-gcc compilers that perform alias optimization,
* so this code should work.
*/
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
#define DOUBLE_HI32(x) (((PRUint32 *)&(x))[1])
#define DOUBLE_LO32(x) (((PRUint32 *)&(x))[0])
#else
#define DOUBLE_HI32(x) (((PRUint32 *)&(x))[0])
#define DOUBLE_LO32(x) (((PRUint32 *)&(x))[1])
#endif
#endif // __GNUC__
#define DOUBLE_HI32_SIGNBIT 0x80000000
#define DOUBLE_HI32_EXPMASK 0x7ff00000
#define DOUBLE_HI32_MANTMASK 0x000fffff
#define DOUBLE_IS_NaN(x) \
((DOUBLE_HI32(x) & DOUBLE_HI32_EXPMASK) == DOUBLE_HI32_EXPMASK && \
(DOUBLE_LO32(x) || (DOUBLE_HI32(x) & DOUBLE_HI32_MANTMASK)))
#ifdef IS_BIG_ENDIAN
#define DOUBLE_NaN {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK, \
0xffffffff}}
#else
#define DOUBLE_NaN {{0xffffffff, \
DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK}}
#endif
#if defined(XP_WIN)
#define DOUBLE_COMPARE(LVAL, OP, RVAL) \
(!DOUBLE_IS_NaN(LVAL) && !DOUBLE_IS_NaN(RVAL) && (LVAL) OP (RVAL))
#else
#define DOUBLE_COMPARE(LVAL, OP, RVAL) ((LVAL) OP (RVAL))
#endif
/*
* Check whether a floating point number is finite (not +/-infinity and not a
* NaN value).

View File

@ -82,7 +82,7 @@ interface nsIDOMFile : nsIDOMBlob
};
[scriptable, uuid(c4a77171-039b-4f84-97f9-820fb51626af)]
interface nsIDOMBlobBuilder : nsISupports
interface nsIDOMMozBlobBuilder : nsISupports
{
nsIDOMBlob getBlob([optional] in DOMString contentType);
[implicit_jscontext] void append(in jsval data);

View File

@ -124,8 +124,8 @@ class Element;
#define NS_IDOCUMENT_IID \
{ 0x26ef6218, 0xcd5e, 0x4953, \
{ 0xbb, 0x57, 0xb8, 0x50, 0x29, 0xa1, 0xae, 0x40 } }
{ 0x2ec7872f, 0x97c3, 0x43de, \
{ 0x81, 0x0a, 0x8f, 0x18, 0xa0, 0xa0, 0xdf, 0x30 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -361,7 +361,7 @@ public:
/**
* Get the Content-Type of this document.
* (This will always return NS_OK, but has this signature to be compatible
* with nsIDOMNSDocument::GetContentType())
* with nsIDOMDocument::GetContentType())
*/
NS_IMETHOD GetContentType(nsAString& aContentType) = 0;
@ -479,8 +479,6 @@ public:
void SetBFCacheEntry(nsISHEntry* aSHEntry) {
mSHEntry = aSHEntry;
// Doing this just to keep binary compat for the gecko 2.0 release
mShellIsHidden = !!aSHEntry;
}
nsISHEntry* GetBFCacheEntry() const { return mSHEntry; }
@ -1079,7 +1077,7 @@ public:
nsIDOMNodeList** aResult) = 0;
/**
* Helper for nsIDOMNSDocument::elementFromPoint implementation that allows
* Helper for nsIDOMDocument::elementFromPoint implementation that allows
* ignoring the scroll frame and/or avoiding layout flushes.
*
* @see nsIDOMWindowUtils::elementFromPoint
@ -1519,6 +1517,8 @@ public:
virtual nsresult GetStateObject(nsIVariant** aResult) = 0;
virtual Element* FindImageMap(const nsAString& aNormalizedMapName) = 0;
protected:
~nsIDocument()
{
@ -1621,10 +1621,6 @@ protected:
// document in it.
PRPackedBool mIsInitialDocumentInWindow;
// True if we're currently bfcached. This is only here for binary compat.
// Remove once the gecko 2.0 has branched and just use mSHEntry instead.
PRPackedBool mShellIsHidden;
PRPackedBool mIsRegularHTML;
PRPackedBool mIsXUL;
@ -1796,10 +1792,8 @@ NS_NewHTMLDocument(nsIDocument** aInstancePtrResult);
nsresult
NS_NewXMLDocument(nsIDocument** aInstancePtrResult);
#ifdef MOZ_SVG
nsresult
NS_NewSVGDocument(nsIDocument** aInstancePtrResult);
#endif
nsresult
NS_NewImageDocument(nsIDocument** aInstancePtrResult);

View File

@ -514,8 +514,7 @@ public:
* Note: If there is no child at aIndex, this method will simply do nothing.
*/
virtual nsresult RemoveChildAt(PRUint32 aIndex,
PRBool aNotify,
PRBool aMutationEvent = PR_TRUE) = 0;
PRBool aNotify) = 0;
/**
* Get a property associated with this node.
@ -1295,8 +1294,7 @@ protected:
* @param aMutationEvent whether to fire a mutation event for this removal.
*/
nsresult doRemoveChildAt(PRUint32 aIndex, PRBool aNotify, nsIContent* aKid,
nsAttrAndChildArray& aChildArray,
PRBool aMutationEvent);
nsAttrAndChildArray& aChildArray);
/**
* Most of the implementation of the nsINode InsertChildAt method.

View File

@ -52,9 +52,6 @@ public:
if (mDocument) {
mDocument->BeginUpdate(mUpdateType);
}
else if (aUpdateType == UPDATE_CONTENT_MODEL) {
nsContentUtils::AddRemovableScriptBlocker();
}
else {
nsContentUtils::AddScriptBlocker();
}
@ -65,9 +62,6 @@ public:
if (mDocument) {
mDocument->EndUpdate(mUpdateType);
}
else if (mUpdateType == UPDATE_CONTENT_MODEL) {
nsContentUtils::RemoveRemovableScriptBlocker();
}
else {
nsContentUtils::RemoveScriptBlocker();
}

View File

@ -52,9 +52,7 @@
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
#include "prprf.h"
#ifdef MOZ_SVG
#include "nsISVGValue.h"
#endif
namespace css = mozilla::css;
@ -86,13 +84,11 @@ nsAttrValue::nsAttrValue(css::StyleRule* aValue, const nsAString* aSerialized)
SetTo(aValue, aSerialized);
}
#ifdef MOZ_SVG
nsAttrValue::nsAttrValue(nsISVGValue* aValue)
: mBits(0)
{
SetTo(aValue);
}
#endif
nsAttrValue::nsAttrValue(const nsIntMargin& aValue)
: mBits(0)
@ -255,13 +251,11 @@ nsAttrValue::SetTo(const nsAttrValue& aOther)
}
break;
}
#ifdef MOZ_SVG
case eSVGValue:
{
NS_ADDREF(cont->mSVGValue = otherCont->mSVGValue);
break;
}
#endif
case eDoubleValue:
{
cont->mDoubleValue = otherCont->mDoubleValue;
@ -323,7 +317,6 @@ nsAttrValue::SetTo(css::StyleRule* aValue, const nsAString* aSerialized)
}
}
#ifdef MOZ_SVG
void
nsAttrValue::SetTo(nsISVGValue* aValue)
{
@ -333,7 +326,6 @@ nsAttrValue::SetTo(nsISVGValue* aValue)
cont->mType = eSVGValue;
}
}
#endif
void
nsAttrValue::SetTo(const nsIntMargin& aValue)
@ -436,13 +428,11 @@ nsAttrValue::ToString(nsAString& aResult) const
break;
}
#ifdef MOZ_SVG
case eSVGValue:
{
GetMiscContainer()->mSVGValue->GetValueString(aResult);
break;
}
#endif
case eDoubleValue:
{
aResult.Truncate();
@ -601,12 +591,10 @@ nsAttrValue::HashValue() const
}
return retval;
}
#ifdef MOZ_SVG
case eSVGValue:
{
return NS_PTR_TO_INT32(cont->mSVGValue);
}
#endif
case eDoubleValue:
{
// XXX this is crappy, but oh well
@ -700,12 +688,10 @@ nsAttrValue::Equals(const nsAttrValue& aOther) const
needsStringComparison = PR_TRUE;
break;
}
#ifdef MOZ_SVG
case eSVGValue:
{
return thisCont->mSVGValue == otherCont->mSVGValue;
}
#endif
case eDoubleValue:
{
return thisCont->mDoubleValue == otherCont->mDoubleValue;
@ -1309,13 +1295,11 @@ nsAttrValue::EnsureEmptyMiscContainer()
delete cont->mAtomArray;
break;
}
#ifdef MOZ_SVG
case eSVGValue:
{
NS_RELEASE(cont->mSVGValue);
break;
}
#endif
case eIntMarginValue:
{
delete cont->mIntMargin;

View File

@ -105,9 +105,7 @@ public:
nsAttrValue(const nsAttrValue& aOther);
explicit nsAttrValue(const nsAString& aValue);
nsAttrValue(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
#ifdef MOZ_SVG
explicit nsAttrValue(nsISVGValue* aValue);
#endif
explicit nsAttrValue(const nsIntMargin& aValue);
~nsAttrValue();
@ -127,9 +125,7 @@ public:
// struct.
eCSSStyleRule = 0x10,
eAtomArray = 0x11
#ifdef MOZ_SVG
,eSVGValue = 0x12
#endif
,eDoubleValue = 0x13
,eIntMarginValue = 0x14
};
@ -142,9 +138,7 @@ public:
void SetTo(const nsAString& aValue);
void SetTo(PRInt16 aInt);
void SetTo(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
#ifdef MOZ_SVG
void SetTo(nsISVGValue* aValue);
#endif
void SetTo(const nsIntMargin& aValue);
void SwapValueWith(nsAttrValue& aOther);
@ -162,9 +156,7 @@ public:
inline float GetPercentValue() const;
inline AtomArray* GetAtomArrayValue() const;
inline mozilla::css::StyleRule* GetCSSStyleRuleValue() const;
#ifdef MOZ_SVG
inline nsISVGValue* GetSVGValue() const;
#endif
inline double GetDoubleValue() const;
PRBool GetIntMarginValue(nsIntMargin& aMargin) const;
@ -343,9 +335,7 @@ private:
PRInt32 mPercent;
mozilla::css::StyleRule* mCSSStyleRule;
AtomArray* mAtomArray;
#ifdef MOZ_SVG
nsISVGValue* mSVGValue;
#endif
double mDoubleValue;
nsIntMargin* mIntMargin;
};
@ -449,14 +439,12 @@ nsAttrValue::GetCSSStyleRuleValue() const
return GetMiscContainer()->mCSSStyleRule;
}
#ifdef MOZ_SVG
inline nsISVGValue*
nsAttrValue::GetSVGValue() const
{
NS_PRECONDITION(Type() == eSVGValue, "wrong type");
return GetMiscContainer()->mSVGValue;
}
#endif
inline double
nsAttrValue::GetDoubleValue() const

View File

@ -44,7 +44,6 @@
#include "nsIObserver.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "nsCSPService.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIChannelPolicy.h"
@ -55,6 +54,9 @@
#include "nsChannelProperties.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
/* Keeps track of whether or not CSP is enabled */
PRBool CSPService::sCSPEnabled = PR_TRUE;
@ -65,7 +67,7 @@ static PRLogModuleInfo* gCspPRLog;
CSPService::CSPService()
{
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &sCSPEnabled);
Preferences::AddBoolVarCache(&sCSPEnabled, "security.csp.enable");
#ifdef PR_LOGGING
if (!gCspPRLog)

View File

@ -89,7 +89,6 @@
#include "nsIAppShell.h"
#include "nsIWidget.h"
#include "nsWidgetsCID.h"
#include "nsIDOMNSDocument.h"
#include "nsIRequest.h"
#include "nsNodeUtils.h"
#include "nsIDOMNode.h"
@ -103,6 +102,9 @@
#include "nsGenericHTMLElement.h"
#include "nsHTMLDNSPrefetch.h"
#include "nsISupportsPrimitives.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
PRLogModuleInfo* gContentSinkLogModuleInfo;
@ -233,11 +235,11 @@ PRBool nsContentSink::sCanInterruptParser;
void
nsContentSink::InitializeStatics()
{
nsContentUtils::AddBoolPrefVarCache("content.notify.ontimer",
&sNotifyOnTimer, PR_TRUE);
Preferences::AddBoolVarCache(&sNotifyOnTimer,
"content.notify.ontimer", PR_TRUE);
// -1 means never.
nsContentUtils::AddIntPrefVarCache("content.notify.backoffcount",
&sBackoffCount, -1);
Preferences::AddIntVarCache(&sBackoffCount,
"content.notify.backoffcount", -1);
// The gNotificationInterval has a dramatic effect on how long it
// takes to initially display content for slow connections.
// The current value provides good
@ -245,29 +247,28 @@ nsContentSink::InitializeStatics()
// in page load time. If this value is set below 1/10 of second
// it starts to impact page load performance.
// see bugzilla bug 72138 for more info.
nsContentUtils::AddIntPrefVarCache("content.notify.interval",
&sNotificationInterval,
120000);
nsContentUtils::AddIntPrefVarCache("content.sink.interactive_deflect_count",
&sInteractiveDeflectCount, 0);
nsContentUtils::AddIntPrefVarCache("content.sink.perf_deflect_count",
&sPerfDeflectCount, 200);
nsContentUtils::AddIntPrefVarCache("content.sink.pending_event_mode",
&sPendingEventMode, 1);
nsContentUtils::AddIntPrefVarCache("content.sink.event_probe_rate",
&sEventProbeRate, 1);
nsContentUtils::AddIntPrefVarCache("content.sink.interactive_parse_time",
&sInteractiveParseTime, 3000);
nsContentUtils::AddIntPrefVarCache("content.sink.perf_parse_time",
&sPerfParseTime, 360000);
nsContentUtils::AddIntPrefVarCache("content.sink.interactive_time",
&sInteractiveTime, 750000);
nsContentUtils::AddIntPrefVarCache("content.sink.initial_perf_time",
&sInitialPerfTime, 2000000);
nsContentUtils::AddIntPrefVarCache("content.sink.enable_perf_mode",
&sEnablePerfMode, 0);
nsContentUtils::AddBoolPrefVarCache("content.interrupt.parsing",
&sCanInterruptParser, PR_TRUE);
Preferences::AddIntVarCache(&sNotificationInterval,
"content.notify.interval", 120000);
Preferences::AddIntVarCache(&sInteractiveDeflectCount,
"content.sink.interactive_deflect_count", 0);
Preferences::AddIntVarCache(&sPerfDeflectCount,
"content.sink.perf_deflect_count", 200);
Preferences::AddIntVarCache(&sPendingEventMode,
"content.sink.pending_event_mode", 1);
Preferences::AddIntVarCache(&sEventProbeRate,
"content.sink.event_probe_rate", 1);
Preferences::AddIntVarCache(&sInteractiveParseTime,
"content.sink.interactive_parse_time", 3000);
Preferences::AddIntVarCache(&sPerfParseTime,
"content.sink.perf_parse_time", 360000);
Preferences::AddIntVarCache(&sInteractiveTime,
"content.sink.interactive_time", 750000);
Preferences::AddIntVarCache(&sInitialPerfTime,
"content.sink.initial_perf_time", 2000000);
Preferences::AddIntVarCache(&sEnablePerfMode,
"content.sink.enable_perf_mode", 0);
Preferences::AddBoolVarCache(&sCanInterruptParser,
"content.interrupt.parsing", PR_TRUE);
}
nsresult

View File

@ -49,9 +49,6 @@
#include "nsAString.h"
#include "nsPrintfCString.h"
#include "nsUnicharUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefLocalizedString.h"
#include "nsServiceManagerUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
@ -211,8 +208,11 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla;
const char kLoadAsData[] = "loadAsData";
@ -230,7 +230,6 @@ nsIIOService *nsContentUtils::sIOService;
#ifdef MOZ_XTF
nsIXTFService *nsContentUtils::sXTFService = nsnull;
#endif
nsIPrefBranch2 *nsContentUtils::sPrefBranch = nsnull;
imgILoader *nsContentUtils::sImgLoader;
imgICache *nsContentUtils::sImgCache;
nsIConsoleService *nsContentUtils::sConsoleService;
@ -244,7 +243,6 @@ PRBool nsContentUtils::sTriedToGetContentPolicy = PR_FALSE;
nsILineBreaker *nsContentUtils::sLineBreaker;
nsIWordBreaker *nsContentUtils::sWordBreaker;
nsIUGenCategory *nsContentUtils::sGenCat;
nsTArray<nsISupports**> *nsContentUtils::sPtrsToPtrsToRelease;
nsIScriptRuntime *nsContentUtils::sScriptRuntimes[NS_STID_ARRAY_UBOUND];
PRInt32 nsContentUtils::sScriptRootCount[NS_STID_ARRAY_UBOUND];
PRUint32 nsContentUtils::sJSGCThingRootCount;
@ -252,7 +250,6 @@ PRUint32 nsContentUtils::sJSGCThingRootCount;
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nsnull;
#endif
PRUint32 nsContentUtils::sScriptBlockerCount = 0;
PRUint32 nsContentUtils::sRemovableScriptBlockerCount = 0;
#ifdef DEBUG
PRUint32 nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
#endif
@ -266,9 +263,6 @@ PRBool nsContentUtils::sAllowXULXBL_for_file = PR_FALSE;
PRBool nsContentUtils::sInitialized = PR_FALSE;
nsRefPtrHashtable<nsPrefObserverHashKey, nsPrefOldCallback>
*nsContentUtils::sPrefCallbackTable = nsnull;
static PLDHashTable sEventListenerManagersHash;
class EventListenerManagerMapEntry : public PLDHashEntryHdr
@ -318,110 +312,6 @@ class nsSameOriginChecker : public nsIChannelEventSink,
NS_DECL_NSIINTERFACEREQUESTOR
};
class nsPrefObserverHashKey : public PLDHashEntryHdr {
public:
typedef nsPrefObserverHashKey* KeyType;
typedef const nsPrefObserverHashKey* KeyTypePointer;
static const nsPrefObserverHashKey* KeyToPointer(nsPrefObserverHashKey *aKey)
{
return aKey;
}
static PLDHashNumber HashKey(const nsPrefObserverHashKey *aKey)
{
PRUint32 strHash = nsCRT::HashCode(aKey->mPref.BeginReading(),
aKey->mPref.Length());
return PR_ROTATE_LEFT32(strHash, 4) ^
NS_PTR_TO_UINT32(aKey->mCallback);
}
nsPrefObserverHashKey(const char *aPref, PrefChangedFunc aCallback) :
mPref(aPref), mCallback(aCallback) { }
nsPrefObserverHashKey(const nsPrefObserverHashKey *aOther) :
mPref(aOther->mPref), mCallback(aOther->mCallback)
{ }
PRBool KeyEquals(const nsPrefObserverHashKey *aOther) const
{
return mCallback == aOther->mCallback &&
mPref.Equals(aOther->mPref);
}
nsPrefObserverHashKey *GetKey() const
{
return const_cast<nsPrefObserverHashKey*>(this);
}
enum { ALLOW_MEMMOVE = PR_TRUE };
public:
nsCString mPref;
PrefChangedFunc mCallback;
};
// For nsContentUtils::RegisterPrefCallback/UnregisterPrefCallback
class nsPrefOldCallback : public nsIObserver,
public nsPrefObserverHashKey
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
public:
nsPrefOldCallback(const char *aPref, PrefChangedFunc aCallback)
: nsPrefObserverHashKey(aPref, aCallback) { }
~nsPrefOldCallback() {
nsIPrefBranch2 *prefBranch = nsContentUtils::GetPrefBranch();
if(prefBranch)
prefBranch->RemoveObserver(mPref.get(), this);
}
void AppendClosure(void *aClosure) {
mClosures.AppendElement(aClosure);
}
void RemoveClosure(void *aClosure) {
mClosures.RemoveElement(aClosure);
}
PRBool HasNoClosures() {
return mClosures.Length() == 0;
}
public:
nsTArray<void *> mClosures;
};
NS_IMPL_ISUPPORTS1(nsPrefOldCallback, nsIObserver)
NS_IMETHODIMP
nsPrefOldCallback::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *aData)
{
NS_ASSERTION(!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID),
"invalid topic");
NS_LossyConvertUTF16toASCII data(aData);
for (PRUint32 i = 0; i < mClosures.Length(); i++) {
mCallback(data.get(), mClosures.ElementAt(i));
}
return NS_OK;
}
struct PrefCacheData {
void* cacheLocation;
union {
PRBool defaultValueBool;
PRInt32 defaultValueInt;
};
};
nsTArray<nsAutoPtr<PrefCacheData> >* sPrefCacheData = nsnull;
// static
nsresult
nsContentUtils::Init()
@ -432,11 +322,6 @@ nsContentUtils::Init()
return NS_OK;
}
sPrefCacheData = new nsTArray<nsAutoPtr<PrefCacheData> >();
// It's ok to not have a pref service.
CallGetService(NS_PREFSERVICE_CONTRACTID, &sPrefBranch);
nsresult rv = NS_GetNameSpaceManager(&sNameSpaceManager);
NS_ENSURE_SUCCESS(rv, rv);
@ -467,11 +352,6 @@ nsContentUtils::Init()
rv = CallGetService(NS_UNICHARCATEGORY_CONTRACTID, &sGenCat);
NS_ENSURE_SUCCESS(rv, rv);
sPtrsToPtrsToRelease = new nsTArray<nsISupports**>();
if (!sPtrsToPtrsToRelease) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!InitializeEventTable())
return NS_ERROR_FAILURE;
@ -499,8 +379,8 @@ nsContentUtils::Init()
sBlockedScriptRunners = new nsCOMArray<nsIRunnable>;
NS_ENSURE_TRUE(sBlockedScriptRunners, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddBoolPrefVarCache("dom.allow_XUL_XBL_for_file",
&sAllowXULXBL_for_file);
Preferences::AddBoolVarCache(&sAllowXULXBL_for_file,
"dom.allow_XUL_XBL_for_file");
sInitialized = PR_TRUE;
@ -627,7 +507,6 @@ nsContentUtils::InitializeEventTable() {
{ nsGkAtoms::onoverflow, NS_SCROLLPORT_OVERFLOW, EventNameType_XUL, NS_EVENT_NULL},
{ nsGkAtoms::onunderflow, NS_SCROLLPORT_UNDERFLOW, EventNameType_XUL, NS_EVENT_NULL},
#ifdef MOZ_SVG
{ nsGkAtoms::onSVGLoad, NS_SVG_LOAD, EventNameType_None, NS_SVG_EVENT },
{ nsGkAtoms::onSVGUnload, NS_SVG_UNLOAD, EventNameType_None, NS_SVG_EVENT },
{ nsGkAtoms::onSVGAbort, NS_SVG_ABORT, EventNameType_None, NS_SVG_EVENT },
@ -639,7 +518,6 @@ nsContentUtils::InitializeEventTable() {
// This is a bit hackish, but SVG's event names are weird.
{ nsGkAtoms::onzoom, NS_SVG_ZOOM, EventNameType_SVGSVG, NS_EVENT_NULL },
#endif // MOZ_SVG
#ifdef MOZ_SMIL
{ nsGkAtoms::onbegin, NS_SMIL_BEGIN, EventNameType_SMIL, NS_EVENT_NULL },
{ nsGkAtoms::onbeginEvent, NS_SMIL_BEGIN, EventNameType_None, NS_SMIL_TIME_EVENT },
@ -1129,9 +1007,10 @@ nsContentUtils::OfflineAppAllowed(nsIURI *aURI)
}
PRBool allowed;
nsresult rv = updateService->OfflineAppAllowedForURI(aURI,
sPrefBranch,
&allowed);
nsresult rv =
updateService->OfflineAppAllowedForURI(aURI,
Preferences::GetRootBranch(),
&allowed);
return NS_SUCCEEDED(rv) && allowed;
}
@ -1147,7 +1026,7 @@ nsContentUtils::OfflineAppAllowed(nsIPrincipal *aPrincipal)
PRBool allowed;
nsresult rv = updateService->OfflineAppAllowed(aPrincipal,
sPrefBranch,
Preferences::GetRootBranch(),
&allowed);
return NS_SUCCEEDED(rv) && allowed;
}
@ -1167,15 +1046,6 @@ nsContentUtils::Shutdown()
for (i = 0; i < PropertiesFile_COUNT; ++i)
NS_IF_RELEASE(sStringBundles[i]);
// Clean up c-style's observer
if (sPrefCallbackTable) {
delete sPrefCallbackTable;
sPrefCallbackTable = nsnull;
}
delete sPrefCacheData;
sPrefCacheData = nsnull;
NS_IF_RELEASE(sStringBundleService);
NS_IF_RELEASE(sConsoleService);
NS_IF_RELEASE(sDOMScriptObjectFactory);
@ -1193,7 +1063,6 @@ nsContentUtils::Shutdown()
#endif
NS_IF_RELEASE(sImgLoader);
NS_IF_RELEASE(sImgCache);
NS_IF_RELEASE(sPrefBranch);
#ifdef IBMBIDI
NS_IF_RELEASE(sBidiKeyboard);
#endif
@ -1205,15 +1074,6 @@ nsContentUtils::Shutdown()
delete sUserDefinedEvents;
sUserDefinedEvents = nsnull;
if (sPtrsToPtrsToRelease) {
for (i = 0; i < sPtrsToPtrsToRelease->Length(); ++i) {
nsISupports** ptrToPtr = sPtrsToPtrsToRelease->ElementAt(i);
NS_RELEASE(*ptrToPtr);
}
delete sPtrsToPtrsToRelease;
sPtrsToPtrsToRelease = nsnull;
}
if (sEventListenerManagersHash.ops) {
NS_ASSERTION(sEventListenerManagersHash.entryCount == 0,
"Event listener manager hash not empty at shutdown!");
@ -1476,42 +1336,10 @@ nsContentUtils::GetContextAndScope(nsIDocument *aOldDocument,
}
nsresult
nsContentUtils::ReparentContentWrappersInScope(nsIScriptGlobalObject *aOldScope,
nsContentUtils::ReparentContentWrappersInScope(JSContext *cx,
nsIScriptGlobalObject *aOldScope,
nsIScriptGlobalObject *aNewScope)
{
JSContext *cx = nsnull;
// Try really hard to find a context to work on.
nsIScriptContext *context = aOldScope->GetContext();
if (context) {
cx = static_cast<JSContext *>(context->GetNativeContext());
}
if (!cx) {
context = aNewScope->GetContext();
if (context) {
cx = static_cast<JSContext *>(context->GetNativeContext());
}
if (!cx) {
sThreadJSContextStack->Peek(&cx);
if (!cx) {
sThreadJSContextStack->GetSafeJSContext(&cx);
if (!cx) {
// Wow, this is really bad!
NS_WARNING("No context reachable in ReparentContentWrappers()!");
return NS_ERROR_NOT_AVAILABLE;
}
}
}
}
// Now that we have a context, let's get the global objects from the two
// scopes and ask XPConnect to do the rest of the work.
JSObject *oldScopeObj = aOldScope->GetGlobalJSObject();
JSObject *newScopeObj = aNewScope->GetGlobalJSObject();
@ -2595,186 +2423,6 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
return aContent->IsLink(getter_AddRefs(absURI));
}
// static
nsAdoptingCString
nsContentUtils::GetCharPref(const char *aPref)
{
nsAdoptingCString result;
if (sPrefBranch) {
sPrefBranch->GetCharPref(aPref, getter_Copies(result));
}
return result;
}
// static
PRPackedBool
nsContentUtils::GetBoolPref(const char *aPref, PRBool aDefault)
{
PRBool result;
if (!sPrefBranch ||
NS_FAILED(sPrefBranch->GetBoolPref(aPref, &result))) {
result = aDefault;
}
return (PRPackedBool)result;
}
// static
PRInt32
nsContentUtils::GetIntPref(const char *aPref, PRInt32 aDefault)
{
PRInt32 result;
if (!sPrefBranch ||
NS_FAILED(sPrefBranch->GetIntPref(aPref, &result))) {
result = aDefault;
}
return result;
}
// static
nsAdoptingString
nsContentUtils::GetLocalizedStringPref(const char *aPref)
{
nsAdoptingString result;
if (sPrefBranch) {
nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(prefLocalString));
if (prefLocalString) {
prefLocalString->GetData(getter_Copies(result));
}
}
return result;
}
// static
nsAdoptingString
nsContentUtils::GetStringPref(const char *aPref)
{
nsAdoptingString result;
if (sPrefBranch) {
nsCOMPtr<nsISupportsString> theString;
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsISupportsString),
getter_AddRefs(theString));
if (theString) {
theString->ToString(getter_Copies(result));
}
}
return result;
}
// RegisterPrefCallback/UnregisterPrefCallback are for backward compatiblity
// with c-style observers.
// static
void
nsContentUtils::RegisterPrefCallback(const char *aPref,
PrefChangedFunc aCallback,
void * aClosure)
{
if (sPrefBranch) {
if (!sPrefCallbackTable) {
sPrefCallbackTable =
new nsRefPtrHashtable<nsPrefObserverHashKey, nsPrefOldCallback>();
sPrefCallbackTable->Init();
}
nsPrefObserverHashKey hashKey(aPref, aCallback);
nsRefPtr<nsPrefOldCallback> callback;
sPrefCallbackTable->Get(&hashKey, getter_AddRefs(callback));
if (callback) {
callback->AppendClosure(aClosure);
return;
}
callback = new nsPrefOldCallback(aPref, aCallback);
callback->AppendClosure(aClosure);
if (NS_SUCCEEDED(sPrefBranch->AddObserver(aPref, callback, PR_FALSE))) {
sPrefCallbackTable->Put(callback, callback);
}
}
}
// static
void
nsContentUtils::UnregisterPrefCallback(const char *aPref,
PrefChangedFunc aCallback,
void * aClosure)
{
if (sPrefBranch) {
if (!sPrefCallbackTable) {
return;
}
nsPrefObserverHashKey hashKey(aPref, aCallback);
nsRefPtr<nsPrefOldCallback> callback;
sPrefCallbackTable->Get(&hashKey, getter_AddRefs(callback));
if (callback) {
callback->RemoveClosure(aClosure);
if (callback->HasNoClosures()) {
// Delete the callback since its list of closures is empty.
sPrefCallbackTable->Remove(callback);
}
}
}
}
static int
BoolVarChanged(const char *aPref, void *aClosure)
{
PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
*((PRBool*)cache->cacheLocation) =
nsContentUtils::GetBoolPref(aPref, cache->defaultValueBool);
return 0;
}
void
nsContentUtils::AddBoolPrefVarCache(const char *aPref,
PRBool* aCache,
PRBool aDefault)
{
*aCache = GetBoolPref(aPref, aDefault);
PrefCacheData* data = new PrefCacheData;
data->cacheLocation = aCache;
data->defaultValueBool = aDefault;
sPrefCacheData->AppendElement(data);
RegisterPrefCallback(aPref, BoolVarChanged, data);
}
static int
IntVarChanged(const char *aPref, void *aClosure)
{
PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
*((PRInt32*)cache->cacheLocation) =
nsContentUtils::GetIntPref(aPref, cache->defaultValueInt);
return 0;
}
void
nsContentUtils::AddIntPrefVarCache(const char *aPref,
PRInt32* aCache,
PRInt32 aDefault)
{
*aCache = GetIntPref(aPref, aDefault);
PrefCacheData* data = new PrefCacheData;
data->cacheLocation = aCache;
data->defaultValueInt = aDefault;
sPrefCacheData->AppendElement(data);
RegisterPrefCallback(aPref, IntVarChanged, data);
}
PRBool
nsContentUtils::IsSitePermAllow(nsIURI* aURI, const char* aType)
{
@ -3031,9 +2679,7 @@ static const char gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT][56] = {
"chrome://global/locale/layout/HtmlForm.properties",
"chrome://global/locale/printing.properties",
"chrome://global/locale/dom/dom.properties",
#ifdef MOZ_SVG
"chrome://global/locale/svg/svg.properties",
#endif
"chrome://branding/locale/brand.properties",
"chrome://global/locale/commonDialogs.properties"
};
@ -4501,7 +4147,7 @@ nsContentUtils::GetLocalizedEllipsis()
{
static PRUnichar sBuf[4] = { 0, 0, 0, 0 };
if (!sBuf[0]) {
nsAutoString tmp(GetLocalizedStringPref("intl.ellipsis"));
nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis");
PRUint32 len = NS_MIN(PRUint32(tmp.Length()),
PRUint32(NS_ARRAY_LENGTH(sBuf) - 1));
CopyUnicodeTo(tmp, 0, sBuf, len);
@ -6193,35 +5839,6 @@ nsContentUtils::CheckCCWrapperTraversal(nsISupports* aScriptObjectHolder,
}
#endif
mozAutoRemovableBlockerRemover::mozAutoRemovableBlockerRemover(nsIDocument* aDocument MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
{
MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
mNestingLevel = nsContentUtils::GetRemovableScriptBlockerLevel();
mDocument = aDocument;
nsISupports* sink = aDocument ? aDocument->GetCurrentContentSink() : nsnull;
mObserver = do_QueryInterface(sink);
for (PRUint32 i = 0; i < mNestingLevel; ++i) {
if (mObserver) {
mObserver->EndUpdate(mDocument, UPDATE_CONTENT_MODEL);
}
nsContentUtils::RemoveRemovableScriptBlocker();
}
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(), "killing mutation events");
}
mozAutoRemovableBlockerRemover::~mozAutoRemovableBlockerRemover()
{
NS_ASSERTION(nsContentUtils::GetRemovableScriptBlockerLevel() == 0,
"Should have had none");
for (PRUint32 i = 0; i < mNestingLevel; ++i) {
nsContentUtils::AddRemovableScriptBlocker();
if (mObserver) {
mObserver->BeginUpdate(mDocument, UPDATE_CONTENT_MODEL);
}
}
}
// static
PRBool
nsContentUtils::IsFocusedContent(const nsIContent* aContent)
@ -6322,21 +5939,6 @@ nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
}
}
static nsIView* GetDisplayRootFor(nsIView* aView)
{
nsIView *displayRoot = aView;
for (;;) {
nsIView *displayParent = displayRoot->GetParent();
if (!displayParent)
return displayRoot;
if (displayRoot->GetFloating() && !displayParent->GetFloating())
return displayRoot;
displayRoot = displayParent;
}
return nsnull;
}
static already_AddRefed<LayerManager>
LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
bool* aAllowRetaining)
@ -6372,7 +5974,7 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
if (VM) {
nsIView* rootView = VM->GetRootView();
if (rootView) {
nsIView* displayRoot = GetDisplayRootFor(rootView);
nsIView* displayRoot = nsIViewManager::GetDisplayRootFor(rootView);
if (displayRoot) {
nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);
if (widget) {

View File

@ -60,6 +60,9 @@
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "nsStreamUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define PREFLIGHT_CACHE_SIZE 100
@ -369,8 +372,10 @@ NS_IMPL_ISUPPORTS5(nsCORSListenerProxy, nsIStreamListener,
void
nsCORSListenerProxy::Startup()
{
nsContentUtils::AddBoolPrefVarCache("content.cors.disable", &gDisableCORS);
nsContentUtils::AddBoolPrefVarCache("content.cors.no_private_data", &gDisableCORSPrivateData);
Preferences::AddBoolVarCache(&gDisableCORS,
"content.cors.disable");
Preferences::AddBoolVarCache(&gDisableCORSPrivateData,
"content.cors.no_private_data");
}
/* static */

View File

@ -610,9 +610,8 @@ nsDOMAttribute::AppendChildTo(nsIContent* aKid, PRBool aNotify)
}
nsresult
nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
nsDOMAttribute::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on attribute child removal.");
if (aIndex != 0 || !mChild) {
return NS_OK;
}

View File

@ -94,7 +94,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,

View File

@ -221,7 +221,7 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aStart, PRInt64 aEnd,
return NS_OK;
}
class nsDOMBlobBuilder : public nsIDOMBlobBuilder
class nsDOMBlobBuilder : public nsIDOMMozBlobBuilder
{
public:
nsDOMBlobBuilder()
@ -229,7 +229,7 @@ public:
{}
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMBLOBBUILDER
NS_DECL_NSIDOMMOZBLOBBUILDER
protected:
nsresult AppendVoidPtr(void* aData, PRUint32 aLength);
nsresult AppendString(JSString* aString, JSContext* aCx);
@ -287,7 +287,7 @@ DOMCI_DATA(MozBlobBuilder, nsDOMBlobBuilder)
NS_IMPL_ADDREF(nsDOMBlobBuilder)
NS_IMPL_RELEASE(nsDOMBlobBuilder)
NS_INTERFACE_MAP_BEGIN(nsDOMBlobBuilder)
NS_INTERFACE_MAP_ENTRY(nsIDOMBlobBuilder)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozBlobBuilder)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozBlobBuilder)
NS_INTERFACE_MAP_END

View File

@ -64,6 +64,7 @@
#include "nsStringStream.h"
#include "CheckedInt.h"
#include "nsJSUtils.h"
#include "mozilla/Preferences.h"
#include "plbase64.h"
#include "prmem.h"
@ -499,12 +500,12 @@ nsDOMFile::GuessCharset(nsIInputStream *aStream,
"universal_charset_detector");
if (!detector) {
// No universal charset detector, try the default charset detector
const nsAdoptingString& detectorName =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detectorName =
Preferences::GetLocalizedCString("intl.charset.detector");
if (!detectorName.IsEmpty()) {
nsCAutoString detectorContractID;
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
AppendUTF16toUTF8(detectorName, detectorContractID);
detectorContractID += detectorName;
detector = do_CreateInstance(detectorContractID.get());
}
}

View File

@ -77,6 +77,9 @@
#include "nsLayoutStatics.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsFileDataProtocolHandler.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define LOAD_STR "load"
#define ERROR_STR "error"
@ -684,12 +687,12 @@ nsDOMFileReader::GuessCharset(const char *aFileData,
"universal_charset_detector");
if (!detector) {
// No universal charset detector, try the default charset detector
const nsAdoptingString& detectorName =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detectorName =
Preferences::GetLocalizedCString("intl.charset.detector");
if (!detectorName.IsEmpty()) {
nsCAutoString detectorContractID;
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
AppendUTF16toUTF8(detectorName, detectorContractID);
detectorContractID += detectorName;
detector = do_CreateInstance(detectorContractID.get());
}
}

View File

@ -203,6 +203,9 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "nsXULAppAPI.h"
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
typedef nsTArray<Link*> LinkArray;
@ -1685,8 +1688,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3EventTarget)
@ -1870,6 +1871,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnloadBlocker)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mImageMaps,
nsIDOMNodeList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedEncoder)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStateObjectCached)
@ -1922,6 +1925,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDisplayDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mImageMaps)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
@ -3446,9 +3450,8 @@ nsDocument::AppendChildTo(nsIContent* aKid, PRBool aNotify)
}
nsresult
nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{
NS_ASSERTION(aMutationEvent, "Someone tried to inhibit mutations on document child removal.");
nsCOMPtr<nsIContent> oldKid = GetChildAt(aIndex);
if (!oldKid) {
return NS_OK;
@ -3460,7 +3463,7 @@ nsDocument::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent
}
nsresult rv =
doRemoveChildAt(aIndex, aNotify, oldKid, mChildren, aMutationEvent);
doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
mCachedRootElement = nsnull;
return rv;
}
@ -3949,12 +3952,7 @@ nsDocument::BeginUpdate(nsUpdateType aUpdateType)
}
++mUpdateNestLevel;
if (aUpdateType == UPDATE_CONTENT_MODEL) {
nsContentUtils::AddRemovableScriptBlocker();
}
else {
nsContentUtils::AddScriptBlocker();
}
nsContentUtils::AddScriptBlocker();
NS_DOCUMENT_NOTIFY_OBSERVERS(BeginUpdate, (this, aUpdateType));
}
@ -3963,12 +3961,7 @@ nsDocument::EndUpdate(nsUpdateType aUpdateType)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(EndUpdate, (this, aUpdateType));
if (aUpdateType == UPDATE_CONTENT_MODEL) {
nsContentUtils::RemoveRemovableScriptBlocker();
}
else {
nsContentUtils::RemoveScriptBlocker();
}
nsContentUtils::RemoveScriptBlocker();
--mUpdateNestLevel;
@ -4542,20 +4535,6 @@ nsDocument::CreateAttributeNS(const nsAString & aNamespaceURI,
return CallQueryInterface(attribute, aResult);
}
NS_IMETHODIMP
nsDocument::CreateEntityReference(const nsAString& aName,
nsIDOMEntityReference** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
if (IsHTML()) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetElementsByTagName(const nsAString& aTagname,
nsIDOMNodeList** aReturn)
@ -5162,13 +5141,11 @@ nsDocument::GetTitle(nsAString& aTitle)
rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, tmp);
break;
#endif
#ifdef MOZ_SVG
case kNameSpaceID_SVG:
if (rootElement->Tag() == nsGkAtoms::svg) {
GetTitleFromElement(kNameSpaceID_SVG, tmp);
break;
} // else fall through
#endif
default:
GetTitleFromElement(kNameSpaceID_XHTML, tmp);
break;
@ -5187,10 +5164,8 @@ nsDocument::SetTitle(const nsAString& aTitle)
return NS_OK;
switch (rootElement->GetNameSpaceID()) {
#ifdef MOZ_SVG
case kNameSpaceID_SVG:
return NS_OK; // SVG doesn't support setting a title
#endif
#ifdef MOZ_XUL
case kNameSpaceID_XUL:
return rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::title,
@ -6152,12 +6127,6 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
return CallQueryInterface(adoptedNode, aResult);
}
NS_IMETHODIMP
nsDocument::NormalizeDocument()
{
return Normalize();
}
NS_IMETHODIMP
nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
@ -8163,6 +8132,48 @@ nsDocument::GetStateObject(nsIVariant** aState)
return NS_OK;
}
Element*
nsDocument::FindImageMap(const nsAString& aUseMapValue)
{
if (aUseMapValue.IsEmpty()) {
return nsnull;
}
nsAString::const_iterator start, end;
aUseMapValue.BeginReading(start);
aUseMapValue.EndReading(end);
PRInt32 hash = aUseMapValue.FindChar('#');
if (hash < 0) {
return nsnull;
}
// aUsemap contains a '#', set start to point right after the '#'
start.advance(hash + 1);
if (start == end) {
return nsnull; // aUsemap == "#"
}
const nsAString& mapName = Substring(start, end);
if (!mImageMaps) {
mImageMaps = new nsContentList(this, kNameSpaceID_XHTML, nsGkAtoms::map, nsGkAtoms::map);
}
PRUint32 i, n = mImageMaps->Length(PR_TRUE);
for (i = 0; i < n; ++i) {
nsIContent* map = mImageMaps->GetNodeAt(i);
if (map->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id, mapName,
eCaseMatters) ||
map->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, mapName,
eIgnoreCase)) {
return map->AsElement();
}
}
return nsnull;
}
nsresult
nsDocument::AddImage(imgIRequest* aImage)
{
@ -8261,7 +8272,7 @@ nsresult
nsDocument::SetImageLockingState(PRBool aLocked)
{
if (XRE_GetProcessType() == GeckoProcessType_Content &&
!nsContentUtils::GetBoolPref("content.image.allow_locking", PR_TRUE)) {
!Preferences::GetBool("content.image.allow_locking", PR_TRUE)) {
return NS_OK;
}

View File

@ -53,8 +53,6 @@
#include "nsHashSets.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
@ -490,8 +488,6 @@ protected:
// the interface.
class nsDocument : public nsIDocument,
public nsIDOMXMLDocument, // inherits nsIDOMDocument
public nsIDOMNSDocument,
public nsIDOMNSDocumentStyle,
public nsIDOMDocumentXBL,
public nsSupportsWeakReference,
public nsIDOMEventTarget,
@ -540,7 +536,7 @@ public:
* Get the Content-Type of this document.
*/
// NS_IMETHOD GetContentType(nsAString& aContentType);
// Already declared in nsIDOMNSDocument
// Already declared in nsIDOMDocument
/**
* Set the Content-Type of this document.
@ -730,7 +726,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
@ -791,15 +787,6 @@ public:
// nsIDOMXMLDocument
NS_DECL_NSIDOMXMLDOCUMENT
// nsIDOMNSDocument
NS_DECL_NSIDOMNSDOCUMENT
// nsIDOMDocumentStyle
NS_DECL_NSIDOMDOCUMENTSTYLE
// nsIDOMNSDocumentStyle
NS_DECL_NSIDOMNSDOCUMENTSTYLE
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL
@ -961,6 +948,8 @@ public:
virtual nsresult GetStateObject(nsIVariant** aResult);
virtual Element* FindImageMap(const nsAString& aNormalizedMapName);
protected:
friend class nsNodeUtils;
@ -1225,6 +1214,8 @@ private:
nsCOMPtr<nsIDOMDOMImplementation> mDOMImplementation;
nsRefPtr<nsContentList> mImageMaps;
nsCString mScrollToRef;
PRUint8 mScrolledToRefAlready : 1;
PRUint8 mChangeScrollPosWhenScrollingToRef : 1;
@ -1241,7 +1232,6 @@ protected:
#define NS_DOCUMENT_INTERFACE_TABLE_BEGIN(_class) \
NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNSDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNode, nsDocument)

View File

@ -57,6 +57,9 @@
#include "nsICharsetConverterManager.h"
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define REPLACEMENT_CHAR (PRUnichar)0xFFFD
#define BOM_CHAR (PRUnichar)0xFEFF
@ -296,8 +299,8 @@ nsEventSource::Init(nsIPrincipal* aPrincipal,
mOrigin = origin;
mReconnectionTime =
nsContentUtils::GetIntPref("dom.server-events.default-reconnection-time",
DEFAULT_RECONNECTION_TIME_VALUE);
Preferences::GetInt("dom.server-events.default-reconnection-time",
DEFAULT_RECONNECTION_TIME_VALUE);
nsCOMPtr<nsICharsetConverterManager> convManager =
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
@ -775,7 +778,7 @@ nsEventSource::GetInterface(const nsIID & aIID,
PRBool
nsEventSource::PrefEnabled()
{
return nsContentUtils::GetBoolPref("dom.server-events.enabled", PR_FALSE);
return Preferences::GetBool("dom.server-events.enabled", PR_FALSE);
}
nsresult

View File

@ -161,12 +161,23 @@ public:
nsCOMPtr<nsIPrincipal> mPrincipal;
};
static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
NS_IMPL_ADDREF_INHERITED(nsFileDataURI, nsSimpleURI)
NS_IMPL_RELEASE_INHERITED(nsFileDataURI, nsSimpleURI)
NS_INTERFACE_MAP_BEGIN(nsFileDataURI)
NS_INTERFACE_MAP_ENTRY(nsIURIWithPrincipal)
if (aIID.Equals(kFILEDATAURICID))
foundInterface = static_cast<nsIURI*>(this);
foundInterface = static_cast<nsIURI*>(this);
else if (aIID.Equals(kThisSimpleURIImplementationCID)) {
// Need to return explicitly here, because if we just set foundInterface
// to null the NS_INTERFACE_MAP_END_INHERITING will end up calling into
// nsSimplURI::QueryInterface and finding something for this CID.
*aInstancePtr = nsnull;
return NS_NOINTERFACE;
}
else
NS_INTERFACE_MAP_END_INHERITING(nsSimpleURI)
@ -257,15 +268,20 @@ nsFileDataURI::EqualsInternal(nsIURI* aOther,
return NS_OK;
}
nsresult rv = mPrincipal->Equals(otherFileDataUri->mPrincipal, aResult);
NS_ENSURE_SUCCESS(rv, rv);
if (!*aResult) {
// Compare the member data that our base class knows about.
if (!nsSimpleURI::EqualsInternal(otherFileDataUri, aRefHandlingMode)) {
*aResult = PR_FALSE;
return NS_OK;
}
}
return nsSimpleURI::EqualsInternal(otherFileDataUri, aRefHandlingMode,
aResult);
// Compare the piece of additional member data that we add to base class.
if (mPrincipal && otherFileDataUri->mPrincipal) {
// Both of us have mPrincipals. Compare them.
return mPrincipal->Equals(otherFileDataUri->mPrincipal, aResult);
}
// else, at least one of us lacks a principal; only equal if *both* lack it.
*aResult = (!mPrincipal && !otherFileDataUri->mPrincipal);
return NS_OK;
}
// nsIClassInfo methods:

View File

@ -83,7 +83,7 @@
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
#include "nsIDocShellHistory.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIXULWindow.h"
#include "nsIEditor.h"
#include "nsIEditorDocShell.h"
@ -114,6 +114,8 @@
#include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -818,7 +820,7 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIDOMNSHTMLDocument> doc =
nsCOMPtr<nsIDOMHTMLDocument> doc =
do_QueryInterface(presShell->GetDocument());
if (doc) {
@ -836,7 +838,7 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
doc->SetDesignMode(NS_LITERAL_STRING("off"));
doc->SetDesignMode(NS_LITERAL_STRING("on"));
} else {
// Re-initialie the presentation for contenteditable documents
// Re-initialize the presentation for contenteditable documents
nsCOMPtr<nsIEditorDocShell> editorDocshell = do_QueryInterface(mDocShell);
if (editorDocshell) {
PRBool editable = PR_FALSE,
@ -1346,8 +1348,8 @@ nsFrameLoader::ShouldUseRemoteProcess()
return false;
}
PRBool remoteDisabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.disabled",
PR_FALSE);
PRBool remoteDisabled =
Preferences::GetBool("dom.ipc.tabs.disabled", PR_FALSE);
if (remoteDisabled) {
return false;
}
@ -1366,8 +1368,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
return true;
}
PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
PR_FALSE);
PRBool remoteEnabled = Preferences::GetBool("dom.ipc.tabs.enabled", PR_FALSE);
return (bool) remoteEnabled;
}

View File

@ -723,7 +723,7 @@ nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
}
nsresult
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{
return NS_OK;
}
@ -846,52 +846,6 @@ nsGenericDOMDataNode::SplitText(PRUint32 aOffset, nsIDOMText** aReturn)
return rv;
}
//----------------------------------------------------------------------
// Implementation of the nsGenericDOMDataNode nsIDOM3Text tearoff
NS_IMPL_CYCLE_COLLECTION_CLASS(nsText3Tearoff)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsText3Tearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Text)
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mNode, nsIContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsText3Tearoff)
NS_IMETHODIMP
nsText3Tearoff::GetIsElementContentWhitespace(PRBool *aReturn)
{
*aReturn = mNode->IsElementContentWhitespace();
return NS_OK;
}
NS_IMETHODIMP
nsText3Tearoff::GetWholeText(nsAString& aWholeText)
{
return mNode->GetWholeText(aWholeText);
}
NS_IMETHODIMP
nsText3Tearoff::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aReturn)
{
nsresult rv;
nsIContent* result = mNode->ReplaceWholeText(PromiseFlatString(aContent),
&rv);
return result ? CallQueryInterface(result, aReturn) : rv;
}
// Implementation of the nsIDOM3Text interface
/* static */ PRInt32
nsGenericDOMDataNode::FirstLogicallyAdjacentTextNode(nsIContent* aParent,
PRInt32 aIndex)
@ -918,7 +872,7 @@ nsGenericDOMDataNode::LastLogicallyAdjacentTextNode(nsIContent* aParent,
}
nsresult
nsGenericTextNode::GetWholeText(nsAString& aWholeText)
nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
{
nsIContent* parent = GetParent();
@ -949,21 +903,21 @@ nsGenericTextNode::GetWholeText(nsAString& aWholeText)
return NS_OK;
}
nsIContent*
nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
nsresult* aResult)
nsresult
nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aResult)
{
*aResult = NS_OK;
*aResult = nsnull;
// Handle parent-less nodes
nsCOMPtr<nsIContent> parent = GetParent();
if (!parent) {
if (aContent.IsEmpty()) {
return nsnull;
return NS_OK;
}
SetNodeValue(aContent);
return this;
return CallQueryInterface(this, aResult);
}
// We're relying on mozAutoSubtreeModified to keep the doc alive here.
@ -976,8 +930,7 @@ nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
if (index < 0) {
NS_WARNING("Trying to use .replaceWholeText with an anonymous text node "
"child of a binding parent?");
*aResult = NS_ERROR_DOM_NOT_SUPPORTED_ERR;
return nsnull;
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
// We don't support entity references or read-only nodes, so remove the
@ -1016,11 +969,11 @@ nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
// Empty string means we removed this node too.
if (aContent.IsEmpty()) {
return nsnull;
return NS_OK;
}
SetText(aContent.get(), aContent.Length(), PR_TRUE);
return this;
SetText(aContent.BeginReading(), aContent.Length(), PR_TRUE);
return CallQueryInterface(this, aResult);
}
//----------------------------------------------------------------------

View File

@ -46,7 +46,6 @@
#include "nsIContent.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3Text.h"
#include "nsTextFragment.h"
#include "nsDOMError.h"
#include "nsIEventListenerManager.h"
@ -155,7 +154,7 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
@ -328,7 +327,15 @@ protected:
nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);
friend class nsText3Tearoff;
nsresult GetWholeText(nsAString& aWholeText);
nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
nsresult GetIsElementContentWhitespace(PRBool *aReturn)
{
*aReturn = TextIsOnlyWhitespace();
return NS_OK;
}
static PRInt32 FirstLogicallyAdjacentTextNode(nsIContent* aParent,
PRInt32 aIndex);
@ -360,45 +367,6 @@ private:
already_AddRefed<nsIAtom> GetCurrentValueAtom();
};
class nsGenericTextNode : public nsGenericDOMDataNode
{
public:
nsGenericTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
}
PRBool IsElementContentWhitespace()
{
return TextIsOnlyWhitespace();
}
nsresult GetWholeText(nsAString& aWholeText);
nsIContent* ReplaceWholeText(const nsAFlatString& aContent,
nsresult *aResult);
};
/** Tearoff class for the nsIDOM3Text portion of nsGenericDOMDataNode. */
class nsText3Tearoff : public nsIDOM3Text
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOM3TEXT
NS_DECL_CYCLE_COLLECTION_CLASS(nsText3Tearoff)
nsText3Tearoff(nsGenericTextNode *aNode) : mNode(aNode)
{
}
protected:
virtual ~nsText3Tearoff() {}
private:
nsRefPtr<nsGenericTextNode> mNode;
};
//----------------------------------------------------------------------
/**

View File

@ -94,14 +94,10 @@
#include "nsXBLBinding.h"
#include "nsIXBLService.h"
#include "nsPIDOMWindow.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSElement.h"
#include "nsClientRect.h"
#ifdef MOZ_SVG
#include "nsSVGUtils.h"
#endif
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
@ -149,9 +145,7 @@
#include "nsTPtrArray.h"
#include "prprf.h"
#ifdef MOZ_SVG
#include "nsSVGFeatures.h"
#endif /* MOZ_SVG */
using namespace mozilla::dom;
namespace css = mozilla::css;
@ -3663,14 +3657,13 @@ nsINode::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
}
nsresult
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
if (oldKid) {
return doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren,
aMutationEvent);
return doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
}
return NS_OK;
@ -3678,8 +3671,7 @@ nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutatio
nsresult
nsINode::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
nsIContent* aKid, nsAttrAndChildArray& aChildArray,
PRBool aMutationEvent)
nsIContent* aKid, nsAttrAndChildArray& aChildArray)
{
NS_PRECONDITION(aKid && aKid->GetNodeParent() == this &&
aKid == GetChildAt(aIndex) &&
@ -3991,10 +3983,10 @@ PRBool IsAllowedAsChild(nsIContent* aNewChild, PRUint16 aNewNodeType,
void
nsGenericElement::FireNodeInserted(nsIDocument* aDoc,
nsINode* aParent,
nsCOMArray<nsIContent>& aNodes)
nsTArray<nsCOMPtr<nsIContent> >& aNodes)
{
PRInt32 count = aNodes.Count();
for (PRInt32 i = 0; i < count; ++i) {
PRUint32 count = aNodes.Length();
for (PRUint32 i = 0; i < count; ++i) {
nsIContent* childContent = aNodes[i];
if (nsContentUtils::HasMutationListeners(childContent,
@ -4159,57 +4151,18 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
// Copy the children into a separate array to avoid having to deal with
// mutations to the fragment while we're inserting.
nsCOMArray<nsIContent> fragChildren;
if (!fragChildren.SetCapacity(count)) {
return NS_ERROR_OUT_OF_MEMORY;
}
PRUint32 i;
for (i = 0; i < count; i++) {
nsAutoTArray<nsCOMPtr<nsIContent>, 50> fragChildren;
fragChildren.SetCapacity(count);
for (PRUint32 i = 0; i < count; i++) {
nsIContent* child = newContent->GetChildAt(i);
NS_ASSERTION(child->GetCurrentDoc() == nsnull,
"How did we get a child with a current doc?");
fragChildren.AppendObject(child);
fragChildren.AppendElement(child);
}
// Remove the children from the fragment and flag for possible mutations.
PRBool mutated = PR_FALSE;
for (i = count; i > 0;) {
// We don't need to update i if someone mutates the DOM. The only thing
// that'd happen is that the resulting child list might be unexpected,
// but we should never crash since RemoveChildAt is out-of-bounds safe.
nsMutationGuard guard;
// Remove the children from the fragment.
for (PRUint32 i = count; i > 0;) {
newContent->RemoveChildAt(--i, PR_TRUE);
mutated = mutated || guard.Mutated(1);
}
// If we've had any unexpected mutations so far we need to recheck that
// the child can still be inserted.
if (mutated) {
for (i = 0; i < count; ++i) {
// Get the n:th child from the array.
nsIContent* childContent = fragChildren[i];
if (!HasSameOwnerDoc(childContent) ||
doc != childContent->GetOwnerDoc()) {
return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
}
nsCOMPtr<nsIDOMNode> tmpNode = do_QueryInterface(childContent);
PRUint16 tmpType = 0;
tmpNode->GetNodeType(&tmpType);
if (childContent->GetNodeParent() ||
!IsAllowedAsChild(childContent, tmpType, this, PR_FALSE,
refContent)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
}
insPos = refContent ? IndexOf(refContent) : GetChildCount();
if (insPos < 0) {
// Someone seriously messed up the childlist. We have no idea
// where to insert the remaining children, so just bail.
return NS_ERROR_DOM_NOT_FOUND_ERR;
}
}
PRBool appending =
@ -4219,12 +4172,10 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
// Iterate through the fragment's children, and insert them in the new
// parent
for (i = 0; i < count; ++i, ++insPos) {
nsIContent* childContent = fragChildren[i];
for (PRUint32 i = 0; i < count; ++i, ++insPos) {
// XXXbz how come no reparenting here? That seems odd...
// Insert the child.
res = InsertChildAt(childContent, insPos, PR_FALSE);
res = InsertChildAt(fragChildren[i], insPos, !appending);
if (NS_FAILED(res)) {
// Make sure to notify on any children that we did succeed to insert
if (appending && i != 0) {
@ -4234,22 +4185,17 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,
}
return res;
}
if (!appending) {
nsNodeUtils::ContentInserted(this, childContent, insPos);
}
}
// Notify
// Notify and fire mutation events when appending
if (appending) {
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
firstInsertedContent, firstInsPos);
}
// Fire mutation events. Optimize for the case when there are no listeners
if (nsContentUtils::
HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
nsGenericElement::FireNodeInserted(doc, this, fragChildren);
// Optimize for the case when there are no listeners
if (nsContentUtils::
HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
nsGenericElement::FireNodeInserted(doc, this, fragChildren);
}
}
}
else {
@ -4629,7 +4575,7 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
// Hold a script blocker while calling ParseAttribute since that can call
// out to id-observers
nsAutoRemovableScriptBlocker scriptBlocker;
nsAutoScriptBlocker scriptBlocker;
nsAttrValue attrValue;
if (!ParseAttribute(aNamespaceID, aName, aValue, attrValue)) {

View File

@ -329,7 +329,7 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent = PR_TRUE);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
@ -596,7 +596,7 @@ public:
*/
static void FireNodeInserted(nsIDocument* aDoc,
nsINode* aParent,
nsCOMArray<nsIContent>& aNodes);
nsTArray<nsCOMPtr<nsIContent> >& aNodes);
/**
* Helper methods for implementing querySelector/querySelectorAll

View File

@ -1097,7 +1097,6 @@ GK_ATOM(z_index, "z-index")
GK_ATOM(zeroDigit, "zero-digit")
#ifdef MOZ_SVG
GK_ATOM(percentage, "%")
GK_ATOM(A, "A")
GK_ATOM(alignment_baseline, "alignment-baseline")
@ -1347,13 +1346,13 @@ GK_ATOM(x, "x")
GK_ATOM(x1, "x1")
GK_ATOM(x2, "x2")
GK_ATOM(xChannelSelector, "xChannelSelector")
GK_ATOM(xor_, "xor")
GK_ATOM(y, "y")
GK_ATOM(y1, "y1")
GK_ATOM(y2, "y2")
GK_ATOM(yChannelSelector, "yChannelSelector")
GK_ATOM(z, "z")
GK_ATOM(zoomAndPan, "zoomAndPan")
#endif
#ifdef MOZ_SMIL
GK_ATOM(accumulate, "accumulate")
@ -1670,10 +1669,6 @@ GK_ATOM(xref_, "xref")
GK_ATOM(math, "math") // the only one without an underscore
#endif
#if defined(MOZ_SVG) || defined(MOZ_MATHML)
GK_ATOM(xor_, "xor")
#endif
#ifndef DISABLE_XFORMS_HOOKS
GK_ATOM(avg, "avg")
GK_ATOM(booleanFromString, "boolean-from-string")
@ -1774,7 +1769,6 @@ GK_ATOM(viewportFrame, "ViewportFrame")
#ifdef MOZ_XUL
GK_ATOM(XULLabelFrame, "XULLabelFrame")
#endif
#ifdef MOZ_SVG
GK_ATOM(svgAFrame, "SVGAFrame")
GK_ATOM(svgClipPathFrame, "SVGClipPathFrame")
GK_ATOM(svgDefsFrame, "SVGDefsFrame")
@ -1799,7 +1793,6 @@ GK_ATOM(svgTextFrame, "SVGTextFrame")
GK_ATOM(svgTextPathFrame, "SVGTextPathFrame")
GK_ATOM(svgTSpanFrame, "SVGTSpanFrame")
GK_ATOM(svgUseFrame, "SVGUseFrame")
#endif
#ifdef MOZ_MEDIA
GK_ATOM(HTMLVideoFrame, "VideoFrame")
GK_ATOM(onloadstart, "onloadstart")

View File

@ -76,9 +76,7 @@
#include "nsContentPolicyUtils.h"
#include "nsEventDispatcher.h"
#include "nsDOMClassInfo.h"
#ifdef MOZ_SVG
#include "nsSVGEffects.h"
#endif
#include "mozAutoDocUpdate.h"
@ -358,10 +356,8 @@ nsImageLoadingContent::OnStopDecode(imgIRequest* aRequest,
FireEvent(NS_LITERAL_STRING("error"));
}
#ifdef MOZ_SVG
nsCOMPtr<nsINode> thisNode = do_QueryInterface(this);
nsSVGEffects::InvalidateDirectRenderingObservers(thisNode->AsElement());
#endif
return NS_OK;
}

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