зеркало из https://github.com/mozilla/pjs.git
Merge m-c to bs.
This commit is contained in:
Коммит
3f3bf2bbc2
2
.hgtags
2
.hgtags
|
@ -55,3 +55,5 @@ dba2abb7db57078c5a4810884834d3056a5d56c2 last-mozilla-central
|
|||
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R12
|
||||
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R13
|
||||
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R11_1_MU
|
||||
e56ecd8b3a68c158025207c5fd081d043e28f5ce GECKO_2_0_BASE
|
||||
e273946b74c8d631ed86bd74ba9afe0e67b12378 GECKO_2_1_BASE
|
||||
|
|
|
@ -3297,7 +3297,7 @@ nsAccessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
|
|||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
double value = attrValue.ToFloat(&error);
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ nsXFormsRangeAccessible::GetMaximumValue(double *aMaximumValue)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
*aMaximumValue = value.ToFloat(&error);
|
||||
*aMaximumValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
*aMinimumValue = value.ToFloat(&error);
|
||||
*aMinimumValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
*aMinimumIncrement = value.ToFloat(&error);
|
||||
*aMinimumIncrement = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
*aCurrentValue = value.ToFloat(&error);
|
||||
*aCurrentValue = value.ToDouble(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@ nsXULProgressMeterAccessible::GetMaximumValue(double *aMaximumValue)
|
|||
nsAutoString value;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::max, value)) {
|
||||
PRInt32 result = NS_OK;
|
||||
*aMaximumValue = value.ToFloat(&result);
|
||||
*aMaximumValue = value.ToDouble(&result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ nsXULProgressMeterAccessible::GetCurrentValue(double *aCurrentValue)
|
|||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
double value = attrValue.ToFloat(&error);
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_FAILED(error))
|
||||
return NS_OK; // Zero value because of wrong markup.
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ nsXULSliderAccessible::GetSliderAttr(nsIAtom *aName, double *aValue)
|
|||
return NS_OK;
|
||||
|
||||
PRInt32 error = NS_OK;
|
||||
double value = attrValue.ToFloat(&error);
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
<head>
|
||||
<title>Text attributes tests</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
|
@ -190,43 +191,43 @@
|
|||
testDefaultTextAttrs(ID, defAttrs);
|
||||
|
||||
attrs = {"language": "ru"};
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 12);
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 6);
|
||||
|
||||
attrs = {};
|
||||
testTextAttrs(ID, 12, attrs, defAttrs, 12, 13);
|
||||
testTextAttrs(ID, 6, attrs, defAttrs, 6, 7);
|
||||
|
||||
tempElem = getNode(ID).firstChild.nextSibling.nextSibling.nextSibling;
|
||||
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
||||
attrs = { "background-color": gComputedStyle.backgroundColor};
|
||||
testTextAttrs(ID, 13, attrs, defAttrs, 13, 26);
|
||||
testTextAttrs(ID, 13, attrs, defAttrs, 7, 20);
|
||||
|
||||
attrs = {};
|
||||
testTextAttrs(ID, 26, attrs, defAttrs, 26, 27);
|
||||
testTextAttrs(ID, 20, attrs, defAttrs, 20, 21);
|
||||
|
||||
attrs = {"language": "de"};
|
||||
testTextAttrs(ID, 27, attrs, defAttrs, 27, 42);
|
||||
testTextAttrs(ID, 21, attrs, defAttrs, 21, 36);
|
||||
|
||||
attrs = {};
|
||||
testTextAttrs(ID, 42, attrs, defAttrs, 42, 50);
|
||||
testTextAttrs(ID, 36, attrs, defAttrs, 36, 44);
|
||||
|
||||
attrs = {};
|
||||
testTextAttrs(ID, 43, attrs, defAttrs, 42, 50);
|
||||
testTextAttrs(ID, 37, attrs, defAttrs, 36, 44);
|
||||
|
||||
tempElem = tempElem.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;
|
||||
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
||||
attrs = {"color": gComputedStyle.color};
|
||||
testTextAttrs(ID, 50, attrs, defAttrs, 50, 57);
|
||||
testTextAttrs(ID, 44, attrs, defAttrs, 44, 51);
|
||||
|
||||
tempElem = tempElem.firstChild.nextSibling;
|
||||
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
||||
attrs = {"font-weight": kBoldFontWeight,
|
||||
"color": gComputedStyle.color};
|
||||
testTextAttrs(ID, 57, attrs, defAttrs, 57, 61);
|
||||
testTextAttrs(ID, 51, attrs, defAttrs, 51, 55);
|
||||
|
||||
tempElem = tempElem.parentNode;
|
||||
gComputedStyle = document.defaultView.getComputedStyle(tempElem, "");
|
||||
attrs = {"color": gComputedStyle.color};
|
||||
testTextAttrs(ID, 61, attrs, defAttrs, 61, 68);
|
||||
testTextAttrs(ID, 55, attrs, defAttrs, 55, 62);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// area9, different single style spans in styled paragraph
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<script type="application/javascript"
|
||||
src="../relations.js" />
|
||||
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,8 +61,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
tabBrowser.addProgressListener(progressListener,
|
||||
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
|
||||
tabBrowser.addProgressListener(progressListener);
|
||||
|
||||
tabBrowser.loadTabs(["about:", "about:mozilla"], false, true);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@
|
|||
testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]);
|
||||
testRelation(tabs[1], RELATION_LABEL_FOR, panels[1]);
|
||||
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>nsIAccessibleText getText related function tests for html:input,html:div and html:textarea</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
|
@ -65,7 +66,7 @@
|
|||
testWords("div12", ["4,261.01"], kTodo);
|
||||
|
||||
// "カタカナ"
|
||||
testWords("div13", ["カタカナ"], kTodo);
|
||||
testWords("div13", ["カタカナ"], kOk);
|
||||
|
||||
// "Peter's car"
|
||||
testWords("div14", ["Peter's", "car"], kTodo);
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
new invokerChecker(EVENT_FOCUS, getAccessible, this.linkNode)
|
||||
];
|
||||
|
||||
this.unexpectedEventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, this.linkNode.parentNode)
|
||||
];
|
||||
|
||||
this.invoke = function focusAnchor_invoke()
|
||||
{
|
||||
this.linkNode.focus();
|
||||
|
@ -44,8 +48,8 @@
|
|||
|
||||
this.check = function focusAnchor_check(aEvent)
|
||||
{
|
||||
isnot(this.link, aEvent.accessible,
|
||||
"Focus should be fired against new link accessible!");
|
||||
is(this.link, aEvent.accessible,
|
||||
"The link accessible shouldn't be recreated!");
|
||||
}
|
||||
|
||||
this.getID = function focusAnchor_getID()
|
||||
|
@ -63,6 +67,10 @@
|
|||
new invokerChecker(EVENT_FOCUS, getAccessible, this.linkNode)
|
||||
];
|
||||
|
||||
this.unexpectedEventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, this.linkNode.parentNode)
|
||||
];
|
||||
|
||||
this.invoke = function tabAnchor_invoke()
|
||||
{
|
||||
synthesizeKey("VK_TAB", { shiftKey: false });
|
||||
|
@ -70,8 +78,8 @@
|
|||
|
||||
this.check = function tabAnchor_check(aEvent)
|
||||
{
|
||||
isnot(this.link, aEvent.accessible,
|
||||
"Focus should be fired against new link accessible!");
|
||||
is(this.link, aEvent.accessible,
|
||||
"The link accessible shouldn't be recreated!");
|
||||
}
|
||||
|
||||
this.getID = function tabAnchor_getID()
|
||||
|
@ -119,6 +127,11 @@
|
|||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=570275">
|
||||
Mozilla Bug 570275
|
||||
</a><br>
|
||||
<a target="_blank"
|
||||
title="Don't recreate frames for inlines with overflow style applied"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=606087">
|
||||
Mozilla Bug 606087
|
||||
</a><br>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<script type="application/javascript"
|
||||
src="../role.js" />
|
||||
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,8 +61,7 @@
|
|||
}
|
||||
}
|
||||
};
|
||||
tabBrowser.addProgressListener(progressListener,
|
||||
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
|
||||
tabBrowser.addProgressListener(progressListener);
|
||||
|
||||
// Test XUL and HTML documents.
|
||||
tabBrowser.loadTabs(["about:", "about:mozilla"], false, true);
|
||||
|
@ -206,7 +206,7 @@
|
|||
|
||||
testAccessibleTree(tabBrowser.mTabBox.tabpanels, tabboxAccTree);
|
||||
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="firefox@bandoo.com">
|
||||
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="3.7a1pre" maxVersion="*"/>
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="langpack-vi-VN@firefox.mozilla.org">
|
||||
<versionRange minVersion="2.0" maxVersion="2.0"/>
|
||||
</emItem>
|
||||
|
@ -70,13 +77,27 @@
|
|||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="{6E19037A-12E3-4295-8915-ED48BC341614}">
|
||||
<versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="3.7a1pre" maxVersion="*"/>
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="{8CE11043-9A15-4207-A565-0C94C42D590D}"/>
|
||||
<emItem id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
|
||||
<versionRange severity="1"/>
|
||||
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1"/>
|
||||
</emItem>
|
||||
<emItem id="{B13721C7-F507-4982-B2E5-502A71474FED}">
|
||||
<versionRange severity="1"/>
|
||||
</emItem>
|
||||
<emItem id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
|
||||
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<versionRange minVersion="3.7a1" maxVersion="*"/>
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem id="{E8E88AB0-7182-11DF-904E-6045E0D72085}"/>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
|
@ -132,4 +153,36 @@
|
|||
</versionRange>
|
||||
</pluginItem>
|
||||
</pluginItems>
|
||||
<gfxItems>
|
||||
<gfxBlacklistEntry>
|
||||
<os>WINNT 6.1</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<devices>
|
||||
<device>0x0a6c</device>
|
||||
</devices>
|
||||
<feature>DIRECT2D</feature>
|
||||
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
|
||||
<driverVersion>8.17.12.5896</driverVersion>
|
||||
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>WINNT 6.1</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<devices>
|
||||
<device>0x0a6c</device>
|
||||
</devices>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
|
||||
<driverVersion>8.17.12.5896</driverVersion>
|
||||
<driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
<gfxBlacklistEntry>
|
||||
<os>WINNT 5.1</os>
|
||||
<vendor>0x10de</vendor>
|
||||
<feature>DIRECT3D_9_LAYERS</feature>
|
||||
<featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
|
||||
<driverVersion>7.0.0.0</driverVersion>
|
||||
<driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
|
||||
</gfxBlacklistEntry>
|
||||
</gfxItems>
|
||||
</blocklist>
|
||||
|
|
|
@ -171,6 +171,9 @@ var StarUI = {
|
|||
_anchorElement: aAnchorElement,
|
||||
_position: aPosition,
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
//XXX We just caused localstore.rdf to be re-applied (bug 640158)
|
||||
retrieveToolbarIconsizesFromTheme();
|
||||
|
||||
this._self._overlayLoading = false;
|
||||
this._self._overlayLoaded = true;
|
||||
this._self._doShowEditBookmarkPanel(this._itemId, this._anchorElement,
|
||||
|
|
|
@ -1396,6 +1396,7 @@ function prepareForStartup() {
|
|||
|
||||
// initialize observers and listeners
|
||||
// and give C++ access to gBrowser
|
||||
gBrowser.init();
|
||||
XULBrowserWindow.init();
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(nsIWebNavigation)
|
||||
|
@ -1438,7 +1439,7 @@ function prepareForStartup() {
|
|||
}
|
||||
|
||||
// hook up UI through progress listener
|
||||
gBrowser.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
gBrowser.addProgressListener(window.XULBrowserWindow);
|
||||
gBrowser.addTabsProgressListener(window.TabsProgressListener);
|
||||
|
||||
// setup our common DOMLinkAdded listener
|
||||
|
@ -3351,12 +3352,10 @@ const BrowserSearch = {
|
|||
if (!submission)
|
||||
return;
|
||||
|
||||
if (useNewTab) {
|
||||
gBrowser.loadOneTab(submission.uri.spec, {
|
||||
postData: submission.postData,
|
||||
relatedToCurrent: true});
|
||||
} else
|
||||
loadURI(submission.uri.spec, null, submission.postData, false);
|
||||
openLinkIn(submission.uri.spec,
|
||||
useNewTab ? "tab" : "current",
|
||||
{ postData: submission.postData,
|
||||
relatedToCurrent: true });
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -4256,14 +4255,10 @@ var XULBrowserWindow = {
|
|||
}
|
||||
}
|
||||
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
if (aWebProgress.DOMWindow == content) {
|
||||
if (aRequest)
|
||||
this.endDocumentLoad(aRequest, aStatus);
|
||||
if (!gBrowser.mTabbedMode && !gBrowser.getIcon())
|
||||
gBrowser.useDefaultIcon(gBrowser.selectedTab);
|
||||
}
|
||||
}
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
|
||||
aWebProgress.DOMWindow == content &&
|
||||
aRequest)
|
||||
this.endDocumentLoad(aRequest, aStatus);
|
||||
|
||||
// This (thanks to the filter) is a network stop or the last
|
||||
// request stop outside of loading the document, stop throbbers
|
||||
|
@ -4399,9 +4394,6 @@ var XULBrowserWindow = {
|
|||
this.reloadCommand.removeAttribute("disabled");
|
||||
}
|
||||
|
||||
if (!gBrowser.mTabbedMode && aWebProgress.isLoadingDocument)
|
||||
gBrowser.setIcon(gBrowser.selectedTab, null);
|
||||
|
||||
if (gURLBar) {
|
||||
// Strip off "wyciwyg://" and passwords for the location bar
|
||||
let uri = aLocationURI;
|
||||
|
@ -8518,8 +8510,17 @@ function safeModeRestart()
|
|||
let promptTitle = gNavigatorBundle.getString("safeModeRestartPromptTitle");
|
||||
let promptMessage =
|
||||
gNavigatorBundle.getString("safeModeRestartPromptMessage");
|
||||
let rv = Services.prompt.confirm(window, promptTitle, promptMessage);
|
||||
if (rv) {
|
||||
let restartText = gNavigatorBundle.getString("safeModeRestartButton");
|
||||
let buttonFlags = (Services.prompt.BUTTON_POS_0 *
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING) +
|
||||
(Services.prompt.BUTTON_POS_1 *
|
||||
Services.prompt.BUTTON_TITLE_CANCEL) +
|
||||
Services.prompt.BUTTON_POS_0_DEFAULT;
|
||||
|
||||
let rv = Services.prompt.confirmEx(window, promptTitle, promptMessage,
|
||||
buttonFlags, restartText, null, null,
|
||||
null, {});
|
||||
if (rv == 0) {
|
||||
let environment = Components.classes["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
environment.set("MOZ_SAFE_MODE_RESTART", "1");
|
||||
|
|
|
@ -134,13 +134,10 @@
|
|||
[]
|
||||
</field>
|
||||
<field name="mTabListeners">
|
||||
new Array()
|
||||
[]
|
||||
</field>
|
||||
<field name="mTabFilters">
|
||||
new Array()
|
||||
</field>
|
||||
<field name="mTabbedMode">
|
||||
false
|
||||
[]
|
||||
</field>
|
||||
<field name="mIsBusy">
|
||||
false
|
||||
|
@ -1064,47 +1061,6 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="enterTabbedMode">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.mTabbedMode)
|
||||
return;
|
||||
|
||||
this.mTabbedMode = true; // Welcome to multi-tabbed mode.
|
||||
|
||||
if (XULBrowserWindow.isBusy) {
|
||||
this.mCurrentTab.setAttribute("busy", "true");
|
||||
this.mIsBusy = true;
|
||||
this.setTabTitleLoading(this.mCurrentTab);
|
||||
} else {
|
||||
this.setIcon(this.mCurrentTab, this.mCurrentBrowser.mIconURL);
|
||||
}
|
||||
|
||||
var filter;
|
||||
if (this.mTabFilters.length > 0) {
|
||||
// Use the filter hooked up in our addProgressListener
|
||||
filter = this.mTabFilters[0];
|
||||
} else {
|
||||
// create a filter and hook it up to our first browser
|
||||
filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
||||
.createInstance(Components.interfaces.nsIWebProgress);
|
||||
this.mTabFilters[0] = filter;
|
||||
this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
}
|
||||
|
||||
// Remove all our progress listeners from the active browser's filter.
|
||||
this.mProgressListeners.forEach(filter.removeProgressListener, filter);
|
||||
|
||||
// Wire up a progress listener to our filter.
|
||||
const listener = this.mTabProgressListener(this.mCurrentTab,
|
||||
this.mCurrentBrowser,
|
||||
false);
|
||||
filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
this.mTabListeners[0] = listener;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="loadOneTab">
|
||||
<parameter name="aURI"/>
|
||||
<parameter name="aReferrerURI"/>
|
||||
|
@ -1228,8 +1184,6 @@
|
|||
|
||||
this._browsers = null; // invalidate cache
|
||||
|
||||
this.enterTabbedMode();
|
||||
|
||||
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
||||
if (this.mCurrentTab.owner)
|
||||
this.mCurrentTab.owner = null;
|
||||
|
@ -1866,38 +1820,21 @@
|
|||
|
||||
<method name="addProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<parameter name="aMask"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (arguments.length != 1) {
|
||||
Components.utils.reportError("gBrowser.addProgressListener was " +
|
||||
"called with a second argument, " +
|
||||
"which is not supported. See bug " +
|
||||
"608628.");
|
||||
}
|
||||
|
||||
if (!this.mAddProgressListenerWasCalled) {
|
||||
this.mAddProgressListenerWasCalled = true;
|
||||
this.tabContainer.updateVisibility();
|
||||
}
|
||||
|
||||
if (this.mProgressListeners.length == 1) {
|
||||
// If we are adding a 2nd progress listener, we need to enter tabbed mode
|
||||
// because the browser status filter can only handle one progress listener.
|
||||
// In tabbed mode, mTabProgressListener is used which will iterate over all listeners.
|
||||
this.enterTabbedMode();
|
||||
}
|
||||
|
||||
this.mProgressListeners.push(aListener);
|
||||
|
||||
if (!this.mTabbedMode) {
|
||||
// If someone does this:
|
||||
// addProgressListener, removeProgressListener, addProgressListener
|
||||
// don't create a new filter; reuse the existing filter.
|
||||
if (this.mTabFilters.length == 0) {
|
||||
// hook a filter up to our first browser
|
||||
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
||||
.createInstance(Components.interfaces.nsIWebProgress);
|
||||
this.mTabFilters[0] = filter;
|
||||
this.mCurrentBrowser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
}
|
||||
|
||||
// Directly hook the listener up to the filter for better performance
|
||||
this.mTabFilters[0].addProgressListener(aListener, aMask);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -1908,10 +1845,6 @@
|
|||
<![CDATA[
|
||||
this.mProgressListeners =
|
||||
this.mProgressListeners.filter(function (l) l != aListener);
|
||||
|
||||
if (!this.mTabbedMode)
|
||||
// Don't forget to remove it from the filter we hooked it up to
|
||||
this.mTabFilters[0].removeProgressListener(aListener);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -1919,7 +1852,6 @@
|
|||
<method name="addTabsProgressListener">
|
||||
<parameter name="aListener"/>
|
||||
<body>
|
||||
this.enterTabbedMode();
|
||||
this.mTabsProgressListeners.push(aListener);
|
||||
</body>
|
||||
</method>
|
||||
|
@ -2489,9 +2421,33 @@
|
|||
this.mCurrentBrowser.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
||||
this.mCurrentBrowser.droppedLinkHandler = handleDroppedLink;
|
||||
this.updateWindowResizers();
|
||||
|
||||
// Hook up the event listeners to the first browser
|
||||
var tabListener = this.mTabProgressListener(this.mCurrentTab, this.mCurrentBrowser, true);
|
||||
const nsIWebProgress = Components.interfaces.nsIWebProgress;
|
||||
const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
|
||||
.createInstance(nsIWebProgress);
|
||||
filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL);
|
||||
this.mTabListeners[0] = tabListener;
|
||||
this.mTabFilters[0] = filter;
|
||||
this.init();
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="init">
|
||||
<body><![CDATA[
|
||||
if (!this._initialProgressListenerAdded) {
|
||||
this._initialProgressListenerAdded = true;
|
||||
try {
|
||||
this.webProgress.addProgressListener(this.mTabFilters[0], Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
} catch (e) {
|
||||
// The binding was constructed too early, need to try this again later. See bug 463384.
|
||||
this._initialProgressListenerAdded = false;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
for (var i = 0; i < this.mTabListeners.length; ++i) {
|
||||
|
@ -2511,6 +2467,13 @@
|
|||
</destructor>
|
||||
|
||||
<!-- Deprecated stuff, implemented for backwards compatibility. -->
|
||||
<method name="enterTabbedMode">
|
||||
<body>
|
||||
Application.console.log("enterTabbedMode is an obsolete method and " +
|
||||
"will be removed in a future release.");
|
||||
</body>
|
||||
</method>
|
||||
<field name="mTabbedMode" readonly="true">true</field>
|
||||
<method name="setStripVisibilityTo">
|
||||
<parameter name="aShow"/>
|
||||
<body>
|
||||
|
@ -2767,9 +2730,6 @@
|
|||
|
||||
this._container.collapsed = !val;
|
||||
|
||||
if (val)
|
||||
this.tabbrowser.enterTabbedMode();
|
||||
|
||||
document.getElementById("menu_closeWindow").hidden = !val;
|
||||
document.getElementById("menu_close").setAttribute("label",
|
||||
this.tabbrowser.mStringBundle.getString(val ? "tabs.closeTab" : "tabs.close"));
|
||||
|
|
|
@ -672,6 +672,8 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
let transform = this.getZoomTransform();
|
||||
TabItems.pausePainting();
|
||||
|
||||
if (this.parent && this.parent.expanded)
|
||||
$tabEl.removeClass("stack-trayed");
|
||||
$tabEl.addClass("front");
|
||||
$canvas
|
||||
.css({ '-moz-transform-origin': transform.transformOrigin })
|
||||
|
|
|
@ -123,6 +123,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_dragdrop.js \
|
||||
browser_tabview_exit_button.js \
|
||||
browser_tabview_expander.js \
|
||||
browser_tabview_firstrun_pref.js \
|
||||
browser_tabview_group.js \
|
||||
browser_tabview_launch.js \
|
||||
browser_tabview_multiwindow_search.js \
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let handleDialog;
|
||||
let timer; // keep in outer scope so it's not GC'd before firing
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
@ -124,7 +125,7 @@ function startCallbackTimer() {
|
|||
const dialogDelay = 10;
|
||||
|
||||
// Use a timer to invoke a callback to twiddle the authentication dialog
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.init(observer, dialogDelay, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,28 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var prefsBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
let prefsBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService).
|
||||
getBranch("browser.panorama.");
|
||||
let originalPrefState;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
ok(!TabView.isVisible(), "Main window TabView is hidden");
|
||||
|
||||
ok(experienced(), "should start as experienced");
|
||||
originalPrefState = experienced();
|
||||
|
||||
prefsBranch.setBoolPref("experienced_first_run", false);
|
||||
ok(!experienced(), "set to not experienced");
|
||||
|
||||
newWindowWithTabView(checkFirstRun, part2);
|
||||
newWindowWithTabView(checkFirstRun, function() {
|
||||
// open tabview doesn't count as first use experience so setting it manually
|
||||
prefsBranch.setBoolPref("experienced_first_run", true);
|
||||
ok(experienced(), "we're now experienced");
|
||||
|
||||
newWindowWithTabView(checkNotFirstRun, endGame);
|
||||
});
|
||||
}
|
||||
|
||||
function experienced() {
|
||||
|
@ -27,7 +34,7 @@ function checkFirstRun(win) {
|
|||
let contentWindow = win.document.getElementById("tab-view").contentWindow;
|
||||
|
||||
// Welcome tab disabled by bug 626754. To be fixed via bug 626926.
|
||||
todo_is(win.gBrowser.tabs.length, 2, "There should be two tabs");
|
||||
is(win.gBrowser.tabs.length, 1, "There should be one tab");
|
||||
|
||||
let groupItems = contentWindow.GroupItems.groupItems;
|
||||
is(groupItems.length, 1, "There should be one group");
|
||||
|
@ -35,13 +42,9 @@ function checkFirstRun(win) {
|
|||
|
||||
let orphanTabCount = contentWindow.GroupItems.getOrphanedTabs().length;
|
||||
// Welcome tab disabled by bug 626754. To be fixed via bug 626926.
|
||||
todo_is(orphanTabCount, 1, "There should also be an orphaned tab");
|
||||
|
||||
ok(experienced(), "we're now experienced");
|
||||
}
|
||||
is(orphanTabCount, 0, "There should also be no orphaned tabs");
|
||||
|
||||
function part2() {
|
||||
newWindowWithTabView(checkNotFirstRun, endGame);
|
||||
ok(!experienced(), "we're not experienced");
|
||||
}
|
||||
|
||||
function checkNotFirstRun(win) {
|
||||
|
@ -60,6 +63,9 @@ function checkNotFirstRun(win) {
|
|||
function endGame() {
|
||||
ok(!TabView.isVisible(), "Main window TabView is still hidden");
|
||||
ok(experienced(), "should finish as experienced");
|
||||
|
||||
prefsBranch.setBoolPref("experienced_first_run", originalPrefState);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1143,19 +1143,20 @@
|
|||
|
||||
<handlers>
|
||||
<handler event="mouseover"><![CDATA[
|
||||
if (this.getAttribute("active") != "true" &&
|
||||
this.getAttribute("disabled") != "true") {
|
||||
if (this.getAttribute("active") != "true") {
|
||||
this.setAttribute("active", "true");
|
||||
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("DOMMenuItemActive", true, false);
|
||||
this.dispatchEvent(event);
|
||||
|
||||
let self = this;
|
||||
setTimeout(function () {
|
||||
if (self.getAttribute("active") == "true")
|
||||
self.menu.open = true;
|
||||
}, this._menuDelay);
|
||||
if (this.getAttribute("disabled") != "true") {
|
||||
let self = this;
|
||||
setTimeout(function () {
|
||||
if (self.getAttribute("active") == "true")
|
||||
self.menu.open = true;
|
||||
}, this._menuDelay);
|
||||
}
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pref("startup.homepage_override_url","http://www.mozilla.org/projects/%APP%/%VERSION%/whatsnew/");
|
||||
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/%APP%/%VERSION%/firstrun/");
|
||||
pref("browser.panorama.welcome_url", "http://www.mozilla.com/firefox/panorama/");
|
||||
// The time interval between checks for a new version (in seconds)
|
||||
// nightly=8 hours, official=24 hours
|
||||
pref("app.update.interval", 28800);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
pref("startup.homepage_override_url","http://www.mozilla.org/projects/%APP%/%VERSION%/whatsnew/");
|
||||
pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/%APP%/%VERSION%/firstrun/");
|
||||
pref("browser.panorama.welcome_url", "http://www.mozilla.com/firefox/panorama/");
|
||||
// The time interval between checks for a new version (in seconds)
|
||||
// nightly=8 hours, official=24 hours
|
||||
pref("app.update.interval", 28800);
|
||||
|
|
|
@ -467,7 +467,7 @@ PlacesViewBase.prototype = {
|
|||
nodeAnnotationChanged:
|
||||
function PVB_nodeAnnotationChanged(aPlacesNode, aAnno) {
|
||||
// All livemarks have a feedURI, so use it as our indicator.
|
||||
if (aAnno == "livemark/feedURI") {
|
||||
if (aAnno == PlacesUtils.LMANNO_FEEDURI) {
|
||||
let elt = aPlacesNode._DOMElement;
|
||||
if (!elt)
|
||||
throw "aPlacesNode must have _DOMElement set";
|
||||
|
@ -1160,7 +1160,7 @@ PlacesToolbar.prototype = {
|
|||
// Node is on the toolbar.
|
||||
|
||||
// All livemarks have a feedURI, so use it as our indicator.
|
||||
if (aAnno == "livemark/feedURI") {
|
||||
if (aAnno == PlacesUtils.LMANNO_FEEDURI) {
|
||||
elt.setAttribute("livemark", true);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -841,8 +841,12 @@ PlacesTreeView.prototype = {
|
|||
},
|
||||
|
||||
nodeAnnotationChanged: function PTV_nodeAnnotationChanged(aNode, aAnno) {
|
||||
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO)
|
||||
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) {
|
||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION);
|
||||
} else if (aAnno == PlacesUtils.LMANNO_FEEDURI) {
|
||||
// The livemark attribute is set as a cell property on the title cell.
|
||||
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
|
||||
}
|
||||
},
|
||||
|
||||
nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode, aNewValue) {
|
||||
|
|
|
@ -78,8 +78,9 @@ function test() {
|
|||
*/
|
||||
function startTest() {
|
||||
var bs = PlacesUtils.bookmarks;
|
||||
// Add bookmarks observer.
|
||||
// Add observers.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
PlacesUtils.annotations.addObserver(bookmarksObserver, false);
|
||||
var addedBookmarks = [];
|
||||
|
||||
// MENU
|
||||
|
@ -108,6 +109,11 @@ function startTest() {
|
|||
"bmf1");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.bookmarksMenuFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.bookmarksMenuFolder, "bml",
|
||||
PlacesUtils._uri("http://bml.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://bml.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// TOOLBAR
|
||||
ok(true, "*** Acting on toolbar bookmarks");
|
||||
|
@ -136,6 +142,10 @@ function startTest() {
|
|||
"bmf1");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.toolbarFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.toolbarFolder, "tbl", PlacesUtils._uri("http://tbl.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://tbl.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// UNSORTED
|
||||
ok(true, "*** Acting on unsorted bookmarks");
|
||||
|
@ -164,6 +174,11 @@ function startTest() {
|
|||
"ubf1");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.unfiledBookmarksFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.unfiledBookmarksFolder, "bubl",
|
||||
PlacesUtils._uri("http://bubl.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://bubl.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// Remove all added bookmarks.
|
||||
addedBookmarks.forEach(function (aItem) {
|
||||
|
@ -174,8 +189,9 @@ function startTest() {
|
|||
} catch (ex) {}
|
||||
});
|
||||
|
||||
// Remove bookmarks observer.
|
||||
// Remove observers.
|
||||
bs.removeObserver(bookmarksObserver);
|
||||
PlacesUtils.annotations.removeObserver(bookmarksObserver);
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
@ -193,12 +209,36 @@ function finishTest() {
|
|||
* nodes positions in the affected views.
|
||||
*/
|
||||
var bookmarksObserver = {
|
||||
QueryInterface: function PSB_QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsINavBookmarkObserver) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_NOINTERFACE;
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavBookmarkObserver
|
||||
, Ci.nsIAnnotationObserver
|
||||
]),
|
||||
|
||||
// nsIAnnotationObserver
|
||||
onItemAnnotationSet: function(aItemId, aAnnotationName) {
|
||||
if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) {
|
||||
// Check that item is recognized as a livemark.
|
||||
let validator = function(aTreeRowIndex) {
|
||||
let tree = gLibrary.PlacesOrganizer._places;
|
||||
let livemarkAtom = Cc["@mozilla.org/atom-service;1"].
|
||||
getService(Ci.nsIAtomService).
|
||||
getAtom("livemark");
|
||||
let properties = Cc["@mozilla.org/supports-array;1"].
|
||||
createInstance(Ci.nsISupportsArray);
|
||||
tree.view.getCellProperties(aTreeRowIndex,
|
||||
tree.columns.getColumnAt(0),
|
||||
properties);
|
||||
return properties.GetIndexOf(livemarkAtom) != -1;
|
||||
};
|
||||
|
||||
var [node, index, valid] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places, validator);
|
||||
isnot(node, null, "Found new Places node in left pane at " + index);
|
||||
ok(valid, "Node is recognized as a livemark");
|
||||
}
|
||||
},
|
||||
onItemAnnotationRemoved: function() {},
|
||||
onPageAnnotationSet: function() {},
|
||||
onPageAnnotationRemoved: function() {},
|
||||
|
||||
// nsINavBookmarkObserver
|
||||
onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex, aItemType,
|
||||
|
|
|
@ -85,8 +85,9 @@ function fakeOpenPopup(aPopup) {
|
|||
*/
|
||||
function startTest() {
|
||||
var bs = PlacesUtils.bookmarks;
|
||||
// Add bookmarks observer.
|
||||
// Add observers.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
PlacesUtils.annotations.addObserver(bookmarksObserver, false);
|
||||
var addedBookmarks = [];
|
||||
|
||||
// MENU
|
||||
|
@ -117,6 +118,11 @@ function startTest() {
|
|||
bs.setItemTitle(id, "bmf1_edited");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.bookmarksMenuFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.bookmarksMenuFolder, "bml",
|
||||
PlacesUtils._uri("http://bml.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://bml.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// TOOLBAR
|
||||
info("*** Acting on toolbar bookmarks");
|
||||
|
@ -148,6 +154,10 @@ function startTest() {
|
|||
bs.setItemTitle(id, "tbf1_edited");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.toolbarFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.toolbarFolder, "tbl", PlacesUtils._uri("http://tbl.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://tbl.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// UNSORTED
|
||||
info("*** Acting on unsorted bookmarks");
|
||||
|
@ -177,6 +187,11 @@ function startTest() {
|
|||
bs.setItemTitle(id, "bubf1_edited");
|
||||
addedBookmarks.push(id);
|
||||
bs.moveItem(id, bs.unfiledBookmarksFolder, 0);
|
||||
id = PlacesUtils.livemarks.createLivemarkFolderOnly(
|
||||
bs.unfiledBookmarksFolder, "bubl",
|
||||
PlacesUtils._uri("http://bubl.siteuri.mozilla.org/"),
|
||||
PlacesUtils._uri("http://bubl.feeduri.mozilla.org/"), bs.DEFAULT_INDEX);
|
||||
addedBookmarks.push(id);
|
||||
|
||||
// Remove all added bookmarks.
|
||||
addedBookmarks.forEach(function (aItem) {
|
||||
|
@ -187,8 +202,9 @@ function startTest() {
|
|||
} catch (ex) {}
|
||||
});
|
||||
|
||||
// Remove bookmarks observer.
|
||||
// Remove observers.
|
||||
bs.removeObserver(bookmarksObserver);
|
||||
PlacesUtils.annotations.removeObserver(bookmarksObserver);
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
@ -211,12 +227,47 @@ function finishTest() {
|
|||
* nodes positions in the affected views.
|
||||
*/
|
||||
var bookmarksObserver = {
|
||||
QueryInterface: function PSB_QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsINavBookmarkObserver) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_NOINTERFACE;
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavBookmarkObserver
|
||||
, Ci.nsIAnnotationObserver
|
||||
]),
|
||||
|
||||
// nsIAnnotationObserver
|
||||
onItemAnnotationSet: function(aItemId, aAnnotationName) {
|
||||
if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) {
|
||||
var views = getViewsForFolder(PlacesUtils.bookmarks.getFolderIdForItem(aItemId));
|
||||
ok(views.length > 0, "Found affected views (" + views.length + "): " + views);
|
||||
|
||||
// Check that item is recognized as a livemark.
|
||||
let validator = function(aElementOrTreeIndex) {
|
||||
if (typeof(aElementOrTreeIndex) == "number") {
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
var tree = sidebar.contentDocument.getElementById("bookmarks-view");
|
||||
let livemarkAtom = Cc["@mozilla.org/atom-service;1"].
|
||||
getService(Ci.nsIAtomService).
|
||||
getAtom("livemark");
|
||||
let properties = Cc["@mozilla.org/supports-array;1"].
|
||||
createInstance(Ci.nsISupportsArray);
|
||||
tree.view.getCellProperties(aElementOrTreeIndex,
|
||||
tree.columns.getColumnAt(0),
|
||||
properties);
|
||||
return properties.GetIndexOf(livemarkAtom) != -1;
|
||||
}
|
||||
else {
|
||||
return aElementOrTreeIndex.hasAttribute("livemark");
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < views.length; i++) {
|
||||
var [node, index, valid] = searchItemInView(aItemId, views[i], validator);
|
||||
isnot(node, null, "Found new Places node in " + views[i] + " at " + index);
|
||||
ok(valid, "Node is recognized as a livemark");
|
||||
}
|
||||
}
|
||||
},
|
||||
onItemAnnotationRemoved: function() {},
|
||||
onPageAnnotationSet: function() {},
|
||||
onPageAnnotationRemoved: function() {},
|
||||
|
||||
// nsINavBookmarkObserver
|
||||
onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex,
|
||||
|
|
|
@ -345,18 +345,6 @@ var gMainPane = {
|
|||
var downloadFolder = document.getElementById("downloadFolder");
|
||||
var currentDirPref = document.getElementById("browser.download.dir");
|
||||
|
||||
// The user's download folder is based on the preferences listed above.
|
||||
// However, if the system does not support a download folder, the
|
||||
// actual path returned will be the system's desktop or home folder.
|
||||
// If this is the case, skip off displaying the Download label and
|
||||
// display Desktop, even though folderList might be 1.
|
||||
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var desk = fileLocator.get("Desk", Components.interfaces.nsILocalFile);
|
||||
var dnldMgr = Components.classes["@mozilla.org/download-manager;1"]
|
||||
.getService(Components.interfaces.nsIDownloadManager);
|
||||
var supportDownloadLabel = !dnldMgr.defaultDownloadsDirectory.equals(desk);
|
||||
|
||||
// Used in defining the correct path to the folder icon.
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
@ -369,7 +357,7 @@ var gMainPane = {
|
|||
// Custom path selected and is configured
|
||||
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
|
||||
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
|
||||
} else if (folderListPref.value == 1 && supportDownloadLabel) {
|
||||
} else if (folderListPref.value == 1) {
|
||||
// 'Downloads'
|
||||
// In 1.5, this pointed to a folder we created called 'My Downloads'
|
||||
// and was available as an option in the 1.5 drop down. On XP this
|
||||
|
|
|
@ -152,6 +152,25 @@ function debug(aMsg) {
|
|||
/* :::::::: The Service ::::::::::::::: */
|
||||
|
||||
function SessionStoreService() {
|
||||
XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
|
||||
return Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService).getBranch("browser.").
|
||||
QueryInterface(Ci.nsIPrefBranch2);
|
||||
});
|
||||
|
||||
// minimal interval between two save operations (in milliseconds)
|
||||
XPCOMUtils.defineLazyGetter(this, "_interval", function () {
|
||||
// used often, so caching/observing instead of fetching on-demand
|
||||
this._prefBranch.addObserver("sessionstore.interval", this, true);
|
||||
return this._prefBranch.getIntPref("sessionstore.interval");
|
||||
});
|
||||
|
||||
// when crash recovery is disabled, session data is not written to disk
|
||||
XPCOMUtils.defineLazyGetter(this, "_resume_from_crash", function () {
|
||||
// get crash recovery state from prefs and allow for proper reaction to state changes
|
||||
this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true);
|
||||
return this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
|
||||
});
|
||||
}
|
||||
|
||||
SessionStoreService.prototype = {
|
||||
|
@ -168,12 +187,6 @@ SessionStoreService.prototype = {
|
|||
// set default load state
|
||||
_loadState: STATE_STOPPED,
|
||||
|
||||
// minimal interval between two save operations (in milliseconds)
|
||||
_interval: 15000,
|
||||
|
||||
// when crash recovery is disabled, session data is not written to disk
|
||||
_resume_from_crash: true,
|
||||
|
||||
// During the initial restore and setBrowserState calls tracks the number of
|
||||
// windows yet to be restored
|
||||
_restoreCount: 0,
|
||||
|
@ -248,9 +261,6 @@ SessionStoreService.prototype = {
|
|||
* Initialize the component
|
||||
*/
|
||||
initService: function() {
|
||||
this._prefBranch = Services.prefs.getBranch("browser.");
|
||||
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
|
||||
|
||||
OBSERVING.forEach(function(aTopic) {
|
||||
Services.obs.addObserver(this, aTopic, true);
|
||||
}, this);
|
||||
|
@ -258,14 +268,6 @@ SessionStoreService.prototype = {
|
|||
var pbs = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
this._inPrivateBrowsing = pbs.privateBrowsingEnabled;
|
||||
|
||||
// get interval from prefs - used often, so caching/observing instead of fetching on-demand
|
||||
this._interval = this._prefBranch.getIntPref("sessionstore.interval");
|
||||
this._prefBranch.addObserver("sessionstore.interval", this, true);
|
||||
|
||||
// get crash recovery state from prefs and allow for proper reaction to state changes
|
||||
this._resume_from_crash = this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
|
||||
this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true);
|
||||
|
||||
// observe prefs changes so we can modify stored data to match
|
||||
this._prefBranch.addObserver("sessionstore.max_tabs_undo", this, true);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function test() {
|
||||
var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup_MOZILLA_2_0).getStartupInfo();
|
||||
var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup).getStartupInfo();
|
||||
// No .process info on mac
|
||||
ok(startup_info.process <= startup_info.main, "process created before main is run " + uneval(startup_info));
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
4.0b13pre
|
||||
4.2a1pre
|
||||
|
|
|
@ -306,6 +306,7 @@ extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description=The default theme.
|
|||
# safeModeRestart
|
||||
safeModeRestartPromptTitle=Restart with Add-ons Disabled
|
||||
safeModeRestartPromptMessage=Are you sure you want to disable all add-ons and restart?
|
||||
safeModeRestartButton=Restart
|
||||
|
||||
# LOCALIZATION NOTE (browser.menu.showCharacterEncoding): Set to the string
|
||||
# "true" (spelled and capitalized exactly that way) to show the "Character
|
||||
|
|
|
@ -1389,6 +1389,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
#TabsToolbar[tabsontop=true]:not(:-moz-lwtheme) {
|
||||
-moz-appearance: menubar;
|
||||
color: -moz-menubartext;
|
||||
box-shadow: 0 -1px 0 rgba(0,0,0,.1) inset;
|
||||
}
|
||||
|
||||
#TabsToolbar[tabsontop=true]:not(:-moz-lwtheme):-moz-system-metric(menubar-drag) {
|
||||
|
|
|
@ -179,10 +179,11 @@
|
|||
}
|
||||
|
||||
#navigator-toolbox[tabsontop=false] > #PersonalToolbar {
|
||||
margin-top: 2px;
|
||||
border-top: 1px solid @toolbarShadowColor@;
|
||||
margin-top: 3px;
|
||||
}
|
||||
#navigator-toolbox[tabsontop=false] > #PersonalToolbar:not(:-moz-lwtheme) {
|
||||
margin-top: 2px;
|
||||
border-top: 1px solid @toolbarShadowColor@;
|
||||
background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
|
||||
}
|
||||
|
||||
|
@ -327,6 +328,12 @@
|
|||
-moz-image-region: rect(32px, 49px, 48px, 32px);
|
||||
}
|
||||
|
||||
#minimize-button:-moz-locale-dir(rtl),
|
||||
#restore-button:-moz-locale-dir(rtl),
|
||||
#close-button:-moz-locale-dir(rtl) {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
/* ::::: splitmenu highlight style that imitates Windows 7 start menu ::::: */
|
||||
@media all and (-moz-windows-default-theme) {
|
||||
.splitmenu-menuitem,
|
||||
|
|
|
@ -1552,8 +1552,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
background-size: -moz-calc(100% - 2px) -moz-calc(100% - 2px);
|
||||
background-repeat: no-repeat;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-border-image: url(tabbrowser/tab.png) 6 3 4 / 6px 3px 4px repeat stretch;
|
||||
padding: 2px 0 4px;
|
||||
-moz-border-image: url(tabbrowser/tab.png) 4 3 0 / 4px 3px 0 repeat stretch;
|
||||
border-radius: 7px 7px 0 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,10 @@ https://expired.example.com:443 privileged,cert=expired
|
|||
https://requestclientcert.example.com:443 privileged,clientauth=request
|
||||
https://requireclientcert.example.com:443 privileged,clientauth=require
|
||||
|
||||
# This is here so that we don't load the default live bookmark over
|
||||
# the network in every test suite.
|
||||
http://fxfeeds.mozilla.com:80
|
||||
|
||||
#
|
||||
# These are subdomains of <ält.example.org>.
|
||||
#
|
||||
|
|
|
@ -53,8 +53,3 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
libs:: $(srcdir)/run-mozilla.sh
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
ifeq ($(OS_ARCH),OpenVMS)
|
||||
libs:: vms/mozilla.com vms/install.com vms/getinfo.com
|
||||
$(INSTALL) $? $(DIST)/bin
|
||||
endif
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
! Component global symbol file, used for all true XPCOM components (those
|
||||
! which have IS_COMPONENT defined in their Makefile.
|
||||
!
|
||||
GSMATCH=LEQUAL,1,1
|
||||
case_sensitive=YES
|
||||
SYMBOL_VECTOR=(NSGetModule=PROCEDURE)
|
|
@ -1,36 +0,0 @@
|
|||
$ verify = 'f$verify(0)
|
||||
$ if p1 .eqs. "DECW" then goto decw
|
||||
$!
|
||||
$! This command file in not used by the Mozilla/CSWB software.
|
||||
$! It is here because if you report a software problem you may be asked
|
||||
$! to run it and send the output back to the support specialist.
|
||||
$!
|
||||
$ set verify
|
||||
$ set noon
|
||||
$ show process /quota
|
||||
$ show display
|
||||
$ write sys$output f$environment("procedure")
|
||||
$ show log /ful sys$disk,sys$login,tmp,home
|
||||
$ show log /ful decc*
|
||||
$ dir sys$login.;
|
||||
$ run sys$common:[syshlp.examples.decw.utils]xdpyinfo.exe
|
||||
$ show system /noprocess
|
||||
$ ucx show version
|
||||
$ type sys$sysroot:[sysmgr]decw$private_server_setup.com
|
||||
$ set noverify
|
||||
$ @sys$update:decw$versions all
|
||||
$decw:
|
||||
$ c = ""
|
||||
$f_loop:
|
||||
$ pid = f$pid(c)
|
||||
$ if pid .eqs. ""
|
||||
$ then
|
||||
$ write sys$output "Unable to find DECW$SERVER process"
|
||||
$ exit
|
||||
$ endif
|
||||
$ if f$getjpi(pid,"prcnam") .nes. "DECW$SERVER_0" then goto f_loop
|
||||
$loop:
|
||||
$ quota = f$getjpi(pid,"pgflquota")
|
||||
$ inuse = f$getjpi(pid,"pagfilcnt")
|
||||
$ write sys$output f$fao("!UL remaining out of !UL at !%D",inuse,quota,0)
|
||||
$ if verify then set verify
|
|
@ -1,52 +0,0 @@
|
|||
$! Command file to install/deinstall Mozilla image.
|
||||
$! This command file must exist in the root Mozilla directory (where the main
|
||||
$! images and shareables reside).
|
||||
$!
|
||||
$! P1 = INSTALL command to use.
|
||||
$! Default is "ADD /OPEN /HEADER_RESIDENT /SHARE"
|
||||
$! To remove previously installed images pass REMOVE as P1.
|
||||
$!
|
||||
$ saved_dir = f$environment("default")
|
||||
$!
|
||||
$ if p1 .eqs. "" then p1 = "add /open /head /share"
|
||||
$ me = f$envir("procedure")
|
||||
$ here = f$parse(me,,,"device") + f$parse(me,,,"directory")
|
||||
$!
|
||||
$! Main image(s).
|
||||
$!
|
||||
$ call do_many "''p1'" "''here'*-bin."
|
||||
$!
|
||||
$! All the .so files in the main directory.
|
||||
$!
|
||||
$ call do_many "''p1'" "''here'*.so"
|
||||
$!
|
||||
$! All the .so files in the components directory.
|
||||
$!
|
||||
$ set default 'here'
|
||||
$ set default [.components]
|
||||
$ me = f$envir("default")
|
||||
$ here = f$parse(me,,,"device") + f$parse(me,,,"directory")
|
||||
$ call do_many "''p1'" "''here'*.so"
|
||||
$!
|
||||
$ set default 'saved_dir'
|
||||
$ exit
|
||||
$!
|
||||
$do_one:
|
||||
$ subroutine
|
||||
$ write sys$output "Doing ",p2
|
||||
$ install 'p1' 'p2'
|
||||
$ endsubroutine
|
||||
$!
|
||||
$!
|
||||
$do_many:
|
||||
$ subroutine
|
||||
$loop:
|
||||
$ f=f$search(p2)
|
||||
$ if f .nes. ""
|
||||
$ then
|
||||
$ v=f$parse(f,,,"version")
|
||||
$ f=f-v
|
||||
$ call do_one "''p1'" "''f'"
|
||||
$ goto loop
|
||||
$ endif
|
||||
$ endsubroutine
|
|
@ -1,26 +0,0 @@
|
|||
! Fixed section of symbol vector for LIBXPCOM (debug)
|
||||
!
|
||||
GSMATCH=LEQUAL,2,2
|
||||
case_sensitive=YES
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! Ident 2,1 introduced for M0.9.4
|
||||
! --------------------------------------------------------------------------
|
||||
!
|
||||
SYMBOL_VECTOR=(CXX$assgnfrmhlpr13nsCMPt3okfmbt=PROCEDURE)
|
||||
SYMBOL_VECTOR=(CXX$clk16nsQeryntrfcxnk434ulf1t=PROCEDURE)
|
||||
SYMBOL_VECTOR=(CXX$clk17nsGtSrvcByCDxnk20ffnk0=PROCEDURE)
|
||||
SYMBOL_VECTOR=(SPARE) ! __dt__13nsCOMPtr_basexv not present in debug
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! Ident 2,2 introduced for Mozilla 1.1 (and hence CSWB post 1.0).
|
||||
! --------------------------------------------------------------------------
|
||||
!
|
||||
SYMBOL_VECTOR=(iid__L0__GetIID__9nsIModulexv=DATA)
|
||||
SYMBOL_VECTOR=(iid__L0__GetIID__10nsIFactoryxv=DATA)
|
||||
SYMBOL_VECTOR=(CXX$iidL0GtID11nsRnnblxv3t05kum=DATA)
|
||||
SYMBOL_VECTOR=(CXX$GtGlblSrvcMngr16nsSr1vcg2p7=PROCEDURE)
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! End of fixed section
|
||||
! --------------------------------------------------------------------------
|
|
@ -1,26 +0,0 @@
|
|||
! Fixed section of symbol vector for LIBXPCOM (non-debug)
|
||||
!
|
||||
GSMATCH=LEQUAL,2,2
|
||||
case_sensitive=YES
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! Ident 2,1 introduced for M0.9.4
|
||||
! --------------------------------------------------------------------------
|
||||
!
|
||||
SYMBOL_VECTOR=(CXX$assgnfrmhlpr13nsCMPt3okfmbt=PROCEDURE)
|
||||
SYMBOL_VECTOR=(CXX$clk16nsQeryntrfcxnk434ulf1t=PROCEDURE)
|
||||
SYMBOL_VECTOR=(CXX$clk17nsGtSrvcByCDxnk20ffnk0=PROCEDURE)
|
||||
SYMBOL_VECTOR=(__dt__13nsCOMPtr_basexv=PROCEDURE)
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! Ident 2,2 introduced for Mozilla 1.1 (and hence CSWB post 1.0).
|
||||
! --------------------------------------------------------------------------
|
||||
!
|
||||
SYMBOL_VECTOR=(iid__L0__GetIID__9nsIModulexv=DATA)
|
||||
SYMBOL_VECTOR=(iid__L0__GetIID__10nsIFactoryxv=DATA)
|
||||
SYMBOL_VECTOR=(CXX$iidL0GtID11nsRnnblxv3t05kum=DATA)
|
||||
SYMBOL_VECTOR=(CXX$GtGlblSrvcMngr16nsSr1vcg2p7=PROCEDURE)
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! End of fixed section
|
||||
! --------------------------------------------------------------------------
|
|
@ -1,172 +0,0 @@
|
|||
$! Command file to run Mozilla.
|
||||
$! This command file must exist in the root Mozilla directory (where the main
|
||||
$! images and shareables reside).
|
||||
$!
|
||||
$ moz_self = f$envir("procedure")
|
||||
$ moz_dir = f$parse(moz_self,,,"device") + f$parse(moz_self,,,"directory")
|
||||
$!
|
||||
$ moz_user = f$edit(f$getjpi("","username"),"trim")
|
||||
$ moz_cwd = f$environment("default")
|
||||
$ moz_image = f$trnlnm("MOZILLA_IMAGE")
|
||||
$ if moz_image .eqs. ""
|
||||
$ then
|
||||
$ moz_image = f$search("''moz_dir'*-bin.;")
|
||||
$ if moz_image .nes. ""
|
||||
$ then
|
||||
$ moz_image = f$parse(moz_image,,,"name")
|
||||
$ else
|
||||
$ moz_image = "mozilla-bin"
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$ moz_gblpages_needed = (336 * 120/100)
|
||||
$ moz_gblsects_needed = (1 * 120/100)
|
||||
$ moz_gblpages_actual = f$getsyi("free_gblpages")
|
||||
$ moz_gblsects_actual = f$getsyi("free_gblsects")
|
||||
$ moz_wait = 0
|
||||
$ if moz_gblpages_actual .lt. moz_gblpages_needed
|
||||
$ then
|
||||
$ write sys$output -
|
||||
f$fao("WARNING, estimated global pages needed=!UL, available=!UL",-
|
||||
moz_gblpages_needed, moz_gblpages_actual)
|
||||
$ moz_wait = 1
|
||||
$ endif
|
||||
$ if moz_gblsects_actual .lt. moz_gblsects_needed
|
||||
$ then
|
||||
$ write sys$output -
|
||||
f$fao("WARNING, estimated global sections needed=!UL, available=!UL",-
|
||||
moz_gblsects_needed, moz_gblsects_actual)
|
||||
$ moz_wait = 1
|
||||
$ endif
|
||||
$ if moz_wait .and. (f$mode() .eqs. "INTERACTIVE")
|
||||
$ then
|
||||
$ type sys$input
|
||||
|
||||
The above system parameter(s) may not be sufficient to
|
||||
successfully run Mozilla.
|
||||
|
||||
$ read/prompt="Do you wish to continue [NO]: " sys$command moz_ans
|
||||
$ if .not. moz_ans then exit
|
||||
$ endif
|
||||
$!
|
||||
$! We need the directory as a unix-style spec.
|
||||
$!
|
||||
$ moz_unix = "/" + f$parse(moz_self,,,"device") - ":"
|
||||
$ moz_self_dir = f$parse(moz_self,,,"directory") - "[" - "]" - "<" - ">"
|
||||
$ i=0
|
||||
$uloop:
|
||||
$ e=f$element(i,".",moz_self_dir)
|
||||
$ if e .nes. "."
|
||||
$ then
|
||||
$ moz_unix = moz_unix + "/" + e
|
||||
$ i=i+1
|
||||
$ goto uloop
|
||||
$ endif
|
||||
$ moz_unix = f$edit(moz_unix,"lowercase")
|
||||
$!
|
||||
$ moz_found_one = 0
|
||||
$so_loop:
|
||||
$ moz_so_file = f$search("''moz_dir'*.so")
|
||||
$ if moz_so_file .nes. ""
|
||||
$ then
|
||||
$ name = f$parse(moz_so_file,,,"name")
|
||||
$ define /user 'name' 'moz_dir''name'.so
|
||||
$ moz_found_one = 1
|
||||
$ goto so_loop
|
||||
$ endif
|
||||
$ if .not. moz_found_one
|
||||
$ then
|
||||
$ write sys$output "Unable to locate Mozilla images. Most likely reason is"
|
||||
$ write sys$output "because the protection on the directory"
|
||||
$ write sys$output moz_dir
|
||||
$ write sys$output "does not allow you READ access."
|
||||
$ exit
|
||||
$ endif
|
||||
$!
|
||||
$ ipc_shr = f$trnlnm("ucx$ipc_shr") - ".EXE" + ".EXE"
|
||||
$ if (f$locate("MULTINET",ipc_shr) .ne. f$length(ipc_shr)) .or. -
|
||||
(f$locate("TCPWARE",ipc_shr) .ne. f$length(ipc_shr))
|
||||
$ then
|
||||
$ define /user VMS_NULL_DL_NAME 'ipc_shr'
|
||||
$ else
|
||||
$ define /user VMS_NULL_DL_NAME SYS$SHARE:TCPIP$IPC_SHR.EXE
|
||||
$ endif
|
||||
$ define /user GETADDRINFO TCPIP$GETADDRINFO
|
||||
$ define /user FREEADDRINFO TCPIP$FREEADDRINFO
|
||||
$ define /user GETNAMEINFO TCPIP$GETNAMEINFO
|
||||
$ define /user GETIPNODEBYNAME TCPIP$GETIPNODEBYNAME
|
||||
$ define /user GETIPNODEBYADDR TCPIP$GETIPNODEBYADDR
|
||||
$ define /user FREEHOSTENT TCPIP$FREEHOSTENT
|
||||
$!
|
||||
$! A networking problem which is still unresolved means that by default
|
||||
$! the IPv6 support is disabled. If you want to turn it back on define
|
||||
$! the logical MOZILLA_IPV6 (to anything), but beware that you may
|
||||
$! encounter hangs.
|
||||
$!
|
||||
$ if f$trnlnm("MOZILLA_IPV6") .eqs. ""
|
||||
$ then
|
||||
$ define /user /nolog GETIPNODEBYNAME NO_SUCH_NAME
|
||||
$ endif
|
||||
$!
|
||||
$! These logicals define how files are created/opened.
|
||||
$! The old code used: "shr=get,put", "rfm=stmlf", "deq=500", "fop=dfw,tef"
|
||||
$!
|
||||
$! Executables
|
||||
$ define /user VMS_OPEN_ARGS_1 ".EXE.SO.SFX_AXPEXE.SFX_VAXEXE", -
|
||||
"ctx=stm", "rfm=fix", "rat=none", "mrs=512"
|
||||
$!
|
||||
$! VMS savesets
|
||||
$ define /user VMS_OPEN_ARGS_2 ".BCK.SAV", -
|
||||
"ctx=stm", "rfm=fix", "rat=none", "mrs=32256"
|
||||
$!
|
||||
$! Binary files. STM doesn't work, needs to be STMLF.
|
||||
$ define /user VMS_OPEN_ARGS_3 "..DB.GIF.JAR.JPG.MAB.MFASL.MSF.WAV.XPM.XPT", -
|
||||
"ctx=stm", "rfm=stmlf", "rat=none"
|
||||
$!
|
||||
$! Text files - covered by the catchall
|
||||
$! ".BAK.COM.CSS.DAT.DTD.HTM.HTML.JS.RDF.NET.ORG.SH.SRC.TBL.TXT.XML.XUL"
|
||||
$!
|
||||
$ define /user VMS_OPEN_ARGS_4 " ",-
|
||||
"rfm=stmlf", "rat=cr"
|
||||
$!
|
||||
$ if f$trnlnm("USER") .eqs. "" then define /user user "''moz_user'"
|
||||
$ if f$trnlnm("LOGNAME") .eqs. "" then define /user logname "''moz_user'"
|
||||
$ define /user MOZILLA_FIVE_HOME "''moz_unix'"
|
||||
$ define /user VMS_USE_VMS_DEF_PROT 1
|
||||
$ define /user VMS_ACCESS_FIX_WOK 1
|
||||
$! define /user VMS_FILE_OPEN_MODE 3
|
||||
$! define /user VMS_POLL_TIMER_MIN 10
|
||||
$! define /user VMS_POLL_TIMER_DELTA 0
|
||||
$! define /user VMS_POLL_TIMER_MAX 200
|
||||
$! define /user NSPR_LOG_MODULES "all:5"
|
||||
$! define /user NSPR_LOG_FILE dkb100:[work]log.log
|
||||
$! define /user VMS_TRACE_FILENAMES 1
|
||||
$!
|
||||
$ define /user DECC$EFS_CASE_PRESERVE 0
|
||||
$!
|
||||
$! GTK key mapping mode: 0=none, 1=LK, 2=PC
|
||||
$ if f$trnlnm("GTK_KEY_MAPPING_MODE") .eqs. "" then -
|
||||
define /user GTK_KEY_MAPPING_MODE 1
|
||||
$!
|
||||
$ write sys$output "Starting ''moz_image'..."
|
||||
$ mcr 'moz_dir''moz_image'. 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
|
||||
$ set default 'moz_dir'
|
||||
$ if f$search("[.chrome]*.*;-1") .nes. ""
|
||||
$ then
|
||||
$ set default [.chrome]
|
||||
$ moz_chrome = f$environment("default")
|
||||
$ purge 'moz_chrome'
|
||||
$ moz_ver = f$parse(f$search("''moz_chrome'all-skins.rdf"),,,"version") - ";"
|
||||
$ if moz_ver .gt. 10000 then rename 'moz_chrome'*.rdf *.*;1
|
||||
$ endif
|
||||
$!
|
||||
$ moz_keep = f$trnlnm("MOZILLA_PURGE_KEEP")
|
||||
$ if moz_keep .eqs. "" then moz_keep = "5"
|
||||
$ set default sys$login
|
||||
$ if f$search("[._MOZILLA.*]*.*") .nes. ""
|
||||
$ then
|
||||
$ purge /keep='moz_keep' [._mozilla.*...]
|
||||
$ endif
|
||||
$ set default 'moz_cwd'
|
||||
$!
|
||||
$ exit
|
24
client.mk
24
client.mk
|
@ -171,9 +171,11 @@ CONFIGURES += $(TOPSRCDIR)/js/src/configure
|
|||
|
||||
# The default rule is build
|
||||
build::
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild)
|
||||
|
||||
|
||||
# Print out any options loaded from mozconfig.
|
||||
all build clean depend distclean export libs install realclean::
|
||||
all realbuild clean depend distclean export libs install realclean::
|
||||
@if test -f .mozconfig.out; then \
|
||||
cat .mozconfig.out; \
|
||||
rm -f .mozconfig.out; \
|
||||
|
@ -207,11 +209,11 @@ else
|
|||
endif
|
||||
|
||||
profiledbuild::
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_GENERATE=1
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
|
||||
$(MAKE) -C $(PGO_OBJDIR) package
|
||||
OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_USE=1
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
|
||||
|
||||
#####################################################
|
||||
# Build date unification
|
||||
|
@ -228,7 +230,7 @@ endif
|
|||
#####################################################
|
||||
# Preflight, before building any project
|
||||
|
||||
build alldep preflight_all::
|
||||
realbuild alldep preflight_all::
|
||||
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
|
||||
# Don't run preflight_all for individual projects in multi-project builds
|
||||
# (when MOZ_CURRENT_PROJECT is set.)
|
||||
|
@ -252,7 +254,7 @@ endif
|
|||
# loop through them.
|
||||
|
||||
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
|
||||
configure depend build install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
|
||||
configure depend realbuild install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
|
||||
set -e; \
|
||||
for app in $(MOZ_BUILD_PROJECTS); do \
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
|
||||
|
@ -285,6 +287,8 @@ CONFIG_STATUS_DEPS := \
|
|||
$(TOPSRCDIR)/.mozconfig.mk \
|
||||
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/config/milestone.txt) \
|
||||
$(wildcard $(TOPSRCDIR)/js/src/config/milestone.txt) \
|
||||
$(wildcard $(TOPSRCDIR)/browser/config/version.txt) \
|
||||
$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -330,7 +334,7 @@ depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
|||
####################################
|
||||
# Preflight
|
||||
|
||||
build alldep preflight::
|
||||
realbuild alldep preflight::
|
||||
ifdef MOZ_PREFLIGHT
|
||||
set -e; \
|
||||
for mkfile in $(MOZ_PREFLIGHT); do \
|
||||
|
@ -341,7 +345,7 @@ endif
|
|||
####################################
|
||||
# Build it
|
||||
|
||||
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
|
@ -354,7 +358,7 @@ install export libs clean realclean distclean alldep maybe_clobber_profiledbuild
|
|||
####################################
|
||||
# Postflight
|
||||
|
||||
build alldep postflight::
|
||||
realbuild alldep postflight::
|
||||
ifdef MOZ_POSTFLIGHT
|
||||
set -e; \
|
||||
for mkfile in $(MOZ_POSTFLIGHT); do \
|
||||
|
@ -367,7 +371,7 @@ endif # MOZ_CURRENT_PROJECT
|
|||
####################################
|
||||
# Postflight, after building all projects
|
||||
|
||||
build alldep postflight_all::
|
||||
realbuild alldep postflight_all::
|
||||
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
|
||||
# Don't run postflight_all for individual projects in multi-project builds
|
||||
# (when MOZ_CURRENT_PROJECT is set.)
|
||||
|
@ -407,4 +411,4 @@ echo-variable-%:
|
|||
# in parallel.
|
||||
.NOTPARALLEL:
|
||||
|
||||
.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
|
||||
.PHONY: checkout real_checkout depend realbuild build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
|
||||
|
|
|
@ -121,7 +121,6 @@ USE_ELF_HACK = @USE_ELF_HACK@
|
|||
INCREMENTAL_LINKER = @INCREMENTAL_LINKER@
|
||||
MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
|
||||
MOZ_MAIL_NEWS = @MOZ_MAIL_NEWS@
|
||||
MOZ_PLAINTEXT_EDITOR_ONLY = @MOZ_PLAINTEXT_EDITOR_ONLY@
|
||||
BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
|
||||
MOZ_ENABLE_LIBXUL = @MOZ_ENABLE_LIBXUL@
|
||||
ENABLE_TESTS = @ENABLE_TESTS@
|
||||
|
|
|
@ -63,6 +63,29 @@ from __future__ import with_statement
|
|||
import sys, os
|
||||
import expandlibs_config as conf
|
||||
|
||||
def relativize(path):
|
||||
'''Returns a path relative to the current working directory, if it is
|
||||
shorter than the given path'''
|
||||
def splitpath(path):
|
||||
dir, file = os.path.split(path)
|
||||
if os.path.splitdrive(dir)[1] == os.sep:
|
||||
return [file]
|
||||
return splitpath(dir) + [file]
|
||||
|
||||
if not os.path.exists(path):
|
||||
return path
|
||||
curdir = splitpath(os.path.abspath(os.curdir))
|
||||
abspath = splitpath(os.path.abspath(path))
|
||||
while curdir and abspath and curdir[0] == abspath[0]:
|
||||
del curdir[0]
|
||||
del abspath[0]
|
||||
if not curdir and not abspath:
|
||||
return '.'
|
||||
relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
|
||||
if len(path) > len(relpath):
|
||||
return relpath
|
||||
return path
|
||||
|
||||
class LibDescriptor(dict):
|
||||
KEYS = ['OBJS', 'LIBS']
|
||||
|
||||
|
@ -99,15 +122,15 @@ class ExpandArgs(list):
|
|||
'''Internal function doing the actual work'''
|
||||
(root, ext) = os.path.splitext(arg)
|
||||
if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
|
||||
return [arg]
|
||||
return [relativize(arg)]
|
||||
if len(conf.IMPORT_LIB_SUFFIX):
|
||||
dll = root + conf.IMPORT_LIB_SUFFIX
|
||||
else:
|
||||
dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
|
||||
if os.path.exists(dll):
|
||||
return [dll]
|
||||
return [relativize(dll)]
|
||||
if os.path.exists(arg):
|
||||
return [arg]
|
||||
return [relativize(arg)]
|
||||
return self._expand_desc(arg)
|
||||
|
||||
def _expand_desc(self, arg):
|
||||
|
@ -115,7 +138,7 @@ class ExpandArgs(list):
|
|||
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||
with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
|
||||
desc = LibDescriptor(f.readlines())
|
||||
objs = desc['OBJS']
|
||||
objs = [relativize(o) for o in desc['OBJS']]
|
||||
for lib in desc['LIBS']:
|
||||
objs += self._expand(lib)
|
||||
return objs
|
||||
|
|
|
@ -52,7 +52,7 @@ See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
|
|||
from __future__ import with_statement
|
||||
import sys
|
||||
import os
|
||||
from expandlibs import ExpandArgs
|
||||
from expandlibs import ExpandArgs, relativize
|
||||
import expandlibs_config as conf
|
||||
from optparse import OptionParser
|
||||
import subprocess
|
||||
|
@ -93,7 +93,7 @@ class ExpandArgsMore(ExpandArgs):
|
|||
subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
|
||||
objs = []
|
||||
for root, dirs, files in os.walk(tmp):
|
||||
objs += [os.path.join(root, f) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
|
||||
objs += [relativize(os.path.join(root, f)) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
|
||||
newlist += objs
|
||||
else:
|
||||
newlist += [arg]
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
2.0b13pre
|
||||
2.2a1pre
|
||||
|
|
|
@ -434,23 +434,6 @@ ifeq ($(SOLARIS_SUNPRO_CXX),1)
|
|||
GARBAGE_DIRS += SunWS_cache
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OpenVMS)
|
||||
GARBAGE += $(wildcard *.*_defines)
|
||||
ifdef SHARED_LIBRARY
|
||||
VMS_SYMVEC_FILE = $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)
|
||||
ifdef MOZ_DEBUG
|
||||
VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt))
|
||||
else
|
||||
VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt))
|
||||
endif
|
||||
VMS_SYMVEC_FILE_COMP = $(topsrcdir)/build/unix/vms/component_symvec.opt
|
||||
GARBAGE += $(VMS_SYMVEC_FILE)
|
||||
ifdef IS_COMPONENT
|
||||
DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
XPIDL_GEN_DIR = _xpidlgen
|
||||
|
||||
ifdef MOZ_UPDATE_XTERM
|
||||
|
@ -1180,20 +1163,6 @@ $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS
|
|||
ifndef INCREMENTAL_LINKER
|
||||
rm -f $@
|
||||
endif
|
||||
ifeq ($(OS_ARCH),OpenVMS)
|
||||
@if test ! -f $(VMS_SYMVEC_FILE); then \
|
||||
if test -f $(VMS_SYMVEC_FILE_MODULE); then \
|
||||
echo Creating specific component options file $(VMS_SYMVEC_FILE); \
|
||||
cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
|
||||
fi; \
|
||||
fi
|
||||
ifdef IS_COMPONENT
|
||||
@if test ! -f $(VMS_SYMVEC_FILE); then \
|
||||
echo Creating generic component options file $(VMS_SYMVEC_FILE); \
|
||||
cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
|
||||
fi
|
||||
endif
|
||||
endif # OpenVMS
|
||||
ifdef DTRACE_LIB_DEPENDENT
|
||||
ifndef XP_MACOSX
|
||||
dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
|
||||
|
|
|
@ -7,6 +7,7 @@ import imp
|
|||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
from mozunit import MozTestRunner
|
||||
|
||||
from UserString import UserString
|
||||
# Create a controlled configuration for use by expandlibs
|
||||
|
@ -35,7 +36,7 @@ config_unix = {
|
|||
|
||||
config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config')
|
||||
|
||||
from expandlibs import LibDescriptor, ExpandArgs
|
||||
from expandlibs import LibDescriptor, ExpandArgs, relativize
|
||||
from expandlibs_gen import generate
|
||||
from expandlibs_exec import ExpandArgsMore
|
||||
|
||||
|
@ -52,6 +53,21 @@ def ImportLib(name):
|
|||
if not len(config.IMPORT_LIB_SUFFIX): return Dll(name)
|
||||
return config.LIB_PREFIX + name + config.IMPORT_LIB_SUFFIX
|
||||
|
||||
class TestRelativize(unittest.TestCase):
|
||||
def test_relativize(self):
|
||||
'''Test relativize()'''
|
||||
os_path_exists = os.path.exists
|
||||
def exists(path):
|
||||
return True
|
||||
os.path.exists = exists
|
||||
self.assertEqual(relativize(os.path.abspath(os.curdir)), os.curdir)
|
||||
self.assertEqual(relativize(os.path.abspath(os.pardir)), os.pardir)
|
||||
self.assertEqual(relativize(os.path.join(os.curdir, 'a')), 'a')
|
||||
self.assertEqual(relativize(os.path.join(os.path.abspath(os.curdir), 'a')), 'a')
|
||||
# relativize is expected to return the absolute path if it is shorter
|
||||
self.assertEqual(relativize(os.sep), os.sep)
|
||||
os.path.exists = os.path.exists
|
||||
|
||||
class TestLibDescriptor(unittest.TestCase):
|
||||
def test_serialize(self):
|
||||
'''Test LibDescriptor's serialization'''
|
||||
|
@ -83,8 +99,12 @@ def wrap_method(conf, wrapped_method):
|
|||
for key in conf:
|
||||
setattr(config, key, conf[key])
|
||||
self.init()
|
||||
wrapped_method(self)
|
||||
self.cleanup()
|
||||
try:
|
||||
wrapped_method(self)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
self.cleanup()
|
||||
return _method
|
||||
|
||||
class ReplicateTests(type):
|
||||
|
@ -101,7 +121,7 @@ class ReplicateTests(type):
|
|||
class TestCaseWithTmpDir(unittest.TestCase):
|
||||
__metaclass__ = ReplicateTests
|
||||
def init(self):
|
||||
self.tmpdir = mkdtemp()
|
||||
self.tmpdir = os.path.abspath(mkdtemp(dir=os.curdir))
|
||||
|
||||
def cleanup(self):
|
||||
rmtree(self.tmpdir)
|
||||
|
@ -149,6 +169,9 @@ class TestExpandInit(TestCaseWithTmpDir):
|
|||
self.arg_files += [self.tmpfile(Lib('f'))]
|
||||
self.touch(self.files)
|
||||
|
||||
def assertRelEqual(self, args1, args2):
|
||||
self.assertEqual(args1, [relativize(a) for a in args2])
|
||||
|
||||
class TestExpandArgs(TestExpandInit):
|
||||
def test_expand(self):
|
||||
'''Test library expansion'''
|
||||
|
@ -156,44 +179,45 @@ class TestExpandArgs(TestExpandInit):
|
|||
# with the descriptor content, and import libraries are used when
|
||||
# a library doesn't exist
|
||||
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
|
||||
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
|
||||
|
||||
# When a library exists at the same time as a descriptor, we just use
|
||||
# the library
|
||||
self.touch([self.tmpfile('libx', Lib('x'))])
|
||||
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
|
||||
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))])
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))])
|
||||
|
||||
self.touch([self.tmpfile('liby', Lib('y'))])
|
||||
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
|
||||
self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
|
||||
|
||||
class TestExpandArgsMore(TestExpandInit):
|
||||
def test_makelist(self):
|
||||
'''Test grouping object files in lists'''
|
||||
# ExpandArgsMore does the same as ExpandArgs
|
||||
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
|
||||
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
|
||||
|
||||
# But also has an extra method replacing object files with a list
|
||||
args.makelist()
|
||||
# self.files has objects at #1, #2, #4
|
||||
self.assertEqual(args[:3], ['foo', '-bar'] + self.files[:1])
|
||||
self.assertEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
|
||||
self.assertRelEqual(args[:3], ['foo', '-bar'] + self.files[:1])
|
||||
self.assertRelEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
|
||||
|
||||
# Check the list file content
|
||||
objs = [f for f in self.files + self.liby_files + self.libx_files if f.endswith(config.OBJ_SUFFIX)]
|
||||
if config.EXPAND_LIBS_LIST_STYLE == "linkerscript":
|
||||
self.assertNotEqual(args[3][0], '@')
|
||||
filename = args[3]
|
||||
content = ["INPUT(%s)" % f for f in objs]
|
||||
content = ["INPUT(%s)" % relativize(f) for f in objs]
|
||||
with open(filename, 'r') as f:
|
||||
self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
|
||||
elif config.EXPAND_LIBS_LIST_STYLE == "list":
|
||||
self.assertEqual(args[3][0], '@')
|
||||
filename = args[3][1:]
|
||||
content = objs
|
||||
|
||||
with open(filename, 'r') as f:
|
||||
self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
|
||||
with open(filename, 'r') as f:
|
||||
self.assertRelEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
|
||||
|
||||
tmp = args.tmp
|
||||
# Check that all temporary files are properly removed
|
||||
|
@ -207,9 +231,9 @@ class TestExpandArgsMore(TestExpandInit):
|
|||
def call(args, **kargs):
|
||||
# The command called is always AR_EXTRACT
|
||||
ar_extract = config.AR_EXTRACT.split()
|
||||
self.assertEqual(args[:len(ar_extract)], ar_extract)
|
||||
self.assertRelEqual(args[:len(ar_extract)], ar_extract)
|
||||
# Remaining argument is always one library
|
||||
self.assertEqual([os.path.splitext(arg)[1] for arg in args[len(ar_extract):]], [config.LIB_SUFFIX])
|
||||
self.assertRelEqual([os.path.splitext(arg)[1] for arg in args[len(ar_extract):]], [config.LIB_SUFFIX])
|
||||
# Simulate AR_EXTRACT extracting one object file for the library
|
||||
lib = os.path.splitext(os.path.basename(args[len(ar_extract)]))[0]
|
||||
extracted[lib] = os.path.join(kargs['cwd'], "%s" % Obj(lib))
|
||||
|
@ -219,7 +243,7 @@ class TestExpandArgsMore(TestExpandInit):
|
|||
# ExpandArgsMore does the same as ExpandArgs
|
||||
self.touch([self.tmpfile('liby', Lib('y'))])
|
||||
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
|
||||
self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
|
||||
|
||||
# ExpandArgsMore also has an extra method extracting static libraries
|
||||
# when possible
|
||||
|
@ -230,11 +254,11 @@ class TestExpandArgsMore(TestExpandInit):
|
|||
# If we don't have an AR_EXTRACT, extract() expands libraries with a
|
||||
# descriptor when the corresponding library exists (which ExpandArgs
|
||||
# alone doesn't)
|
||||
self.assertEqual(args, ['foo', '-bar'] + files)
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + files)
|
||||
else:
|
||||
# With AR_EXTRACT, it uses the descriptors when there are, and actually
|
||||
# extracts the remaining libraries
|
||||
self.assertEqual(args, ['foo', '-bar'] + [extracted[os.path.splitext(os.path.basename(f))[0]] if f.endswith(config.LIB_SUFFIX) else f for f in files])
|
||||
self.assertRelEqual(args, ['foo', '-bar'] + [extracted[os.path.splitext(os.path.basename(f))[0]] if f.endswith(config.LIB_SUFFIX) else f for f in files])
|
||||
|
||||
tmp = args.tmp
|
||||
# Check that all temporary files are properly removed
|
||||
|
@ -244,4 +268,4 @@ class TestExpandArgsMore(TestExpandInit):
|
|||
subprocess.call = subprocess_call
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main(testRunner=MozTestRunner())
|
||||
|
|
54
configure.in
54
configure.in
|
@ -1343,9 +1343,6 @@ UNIX_SYSTEM_V)
|
|||
;;
|
||||
OSF1)
|
||||
;;
|
||||
*OpenVMS*)
|
||||
HOST_OS_ARCH=OpenVMS
|
||||
;;
|
||||
OS_2)
|
||||
HOST_OS_ARCH=OS2
|
||||
;;
|
||||
|
@ -1434,11 +1431,6 @@ OSF1)
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
*OpenVMS*)
|
||||
OS_ARCH=OpenVMS
|
||||
OS_RELEASE=`uname -v`
|
||||
OS_TEST=`uname -p`
|
||||
;;
|
||||
OS_2)
|
||||
OS_ARCH=OS2
|
||||
OS_TARGET=OS2
|
||||
|
@ -2614,25 +2606,6 @@ ia64*-hpux*)
|
|||
fi
|
||||
;;
|
||||
|
||||
*-openvms*)
|
||||
AC_DEFINE(NO_PW_GECOS)
|
||||
AC_DEFINE(NO_UDSOCK)
|
||||
AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
|
||||
USE_PTHREADS=1
|
||||
MKSHLIB_FORCE_ALL='-all'
|
||||
MKSHLIB_UNFORCE_ALL='-none'
|
||||
AS='as'
|
||||
AS_DASH_C_FLAG='-Wc/names=as_is'
|
||||
AR_FLAGS='c $@'
|
||||
DSO_LDOPTS='-shared -auto_symvec'
|
||||
DSO_PIC_CFLAGS=
|
||||
MOZ_DEBUG_LDFLAGS='-g'
|
||||
COMPAQ_CXX=1
|
||||
CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
|
||||
CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
|
||||
;;
|
||||
|
||||
|
||||
*-os2*)
|
||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
|
@ -2895,9 +2868,6 @@ case "$target" in
|
|||
*-aix4.3*|*-aix5*)
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
;;
|
||||
*-openvms*)
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
;;
|
||||
*-mingw*|*-wince|*-winmo)
|
||||
if test -z "$GNU_CC"; then
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
|
@ -4982,7 +4952,6 @@ VPX_ARM_ASM=
|
|||
MOZ_PANGO=1
|
||||
MOZ_PERMISSIONS=1
|
||||
MOZ_PLACES=1
|
||||
MOZ_PLAINTEXT_EDITOR_ONLY=
|
||||
MOZ_PLUGINS=1
|
||||
MOZ_PREF_EXTENSIONS=1
|
||||
MOZ_PROFILELOCKING=1
|
||||
|
@ -5926,19 +5895,6 @@ if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV
|
|||
fi
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl Libeditor can be build as plaintext-only,
|
||||
dnl or as a full html and text editing component.
|
||||
dnl We build both by default.
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
|
||||
[ --enable-plaintext-editor-only
|
||||
Allow only plaintext editing],
|
||||
MOZ_PLAINTEXT_EDITOR_ONLY=1,
|
||||
MOZ_PLAINTEXT_EDITOR_ONLY= )
|
||||
dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
|
||||
AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Disable Fast Load
|
||||
dnl ========================================================
|
||||
|
@ -8264,11 +8220,7 @@ MOZ_ARG_DISABLE_BOOL(md,
|
|||
fi])
|
||||
if test "$_cpp_md_flag"; then
|
||||
COMPILER_DEPEND=1
|
||||
if test "$OS_ARCH" = "OpenVMS"; then
|
||||
_DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
|
||||
else
|
||||
_DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
|
||||
fi
|
||||
_DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
|
||||
dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
|
||||
if test "$SOLARIS_SUNPRO_CC"; then
|
||||
_DEPEND_CFLAGS=
|
||||
|
@ -9316,8 +9268,6 @@ dnl ========================================================
|
|||
if test "$OS_ARCH" = "Darwin"; then
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(UNIX_ASYNC_DNS)
|
||||
elif test "$OS_ARCH" = "OpenVMS"; then
|
||||
AC_DEFINE(XP_UNIX)
|
||||
elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(UNIX_ASYNC_DNS)
|
||||
|
@ -9454,8 +9404,6 @@ dnl If it fails, nothing is set and config.status will run as usual.
|
|||
dnl
|
||||
dnl This does not change the $MAKEFILES variable.
|
||||
dnl
|
||||
dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
|
||||
dnl
|
||||
echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
|
||||
. ./conftest.sh
|
||||
rm conftest.sh
|
||||
|
|
|
@ -50,7 +50,6 @@ class nsIDOMEvent;
|
|||
class nsIContent;
|
||||
class nsIEventListenerManager;
|
||||
class nsIURI;
|
||||
class nsICSSStyleRule;
|
||||
class nsRuleWalker;
|
||||
class nsAttrValue;
|
||||
class nsAttrName;
|
||||
|
@ -62,6 +61,12 @@ class nsISMILAttr;
|
|||
class nsIDOMCSSStyleDeclaration;
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
class StyleRule;
|
||||
}
|
||||
}
|
||||
|
||||
enum nsLinkState {
|
||||
eLinkState_Unknown = 0,
|
||||
eLinkState_Unvisited = 1,
|
||||
|
@ -71,8 +76,8 @@ enum nsLinkState {
|
|||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x71afb9e6, 0xe8a7, 0x475d, \
|
||||
{ 0x89, 0xc4, 0xe4, 0x62, 0x21, 0xeb, 0xe1, 0xa4 } }
|
||||
{ 0x8331ca9f, 0x8717, 0x4ab4, \
|
||||
{ 0xad, 0x17, 0xb4, 0x9d, 0xdc, 0xe8, 0xb6, 0x77 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
|
@ -823,13 +828,13 @@ public:
|
|||
/**
|
||||
* Get the inline style rule, if any, for this content node
|
||||
*/
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule() = 0;
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule() = 0;
|
||||
|
||||
/**
|
||||
* Set the inline style rule for this node. This will send an
|
||||
* appropriate AttributeChanged notification if aNotify is true.
|
||||
*/
|
||||
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify) = 0;
|
||||
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Is the attribute named stored in the mapped attributes?
|
||||
|
@ -916,14 +921,14 @@ public:
|
|||
* hasn't been created (or if this nsIContent object doesn't support SMIL
|
||||
* override style), this method simply returns null.
|
||||
*/
|
||||
virtual nsICSSStyleRule* GetSMILOverrideStyleRule() = 0;
|
||||
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule() = 0;
|
||||
|
||||
/**
|
||||
* Set the SMIL override style rule for this node. If aNotify is true, this
|
||||
* method will notify the document's pres context, so that the style changes
|
||||
* will be noticed.
|
||||
*/
|
||||
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||
PRBool aNotify) = 0;
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ interface nsIDOMEventListener;
|
|||
interface nsIDOMBlob;
|
||||
interface nsIDOMFileError;
|
||||
|
||||
[scriptable, uuid(71c32f16-ea5d-415e-9303-0db981c17bed)]
|
||||
[scriptable, uuid(f186170f-f07c-4f0b-9e3c-08f7dd496e74)]
|
||||
interface nsIDOMFileReader : nsISupports
|
||||
{
|
||||
void readAsBinaryString(in nsIDOMBlob filedata);
|
||||
|
@ -57,9 +57,6 @@ interface nsIDOMFileReader : nsISupports
|
|||
|
||||
readonly attribute DOMString result;
|
||||
readonly attribute nsIDOMFileError error;
|
||||
|
||||
// event handler attributes
|
||||
attribute nsIDOMEventListener onloadend;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
|
|
@ -689,7 +689,7 @@ public:
|
|||
/**
|
||||
* Return the window containing the document (the outer window).
|
||||
*/
|
||||
nsPIDOMWindow *GetWindow()
|
||||
nsPIDOMWindow *GetWindow() const
|
||||
{
|
||||
return mWindow ? mWindow->GetOuterWindow() : GetWindowInternal();
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ public:
|
|||
/**
|
||||
* Return the outer window ID.
|
||||
*/
|
||||
PRUint64 OuterWindowID()
|
||||
PRUint64 OuterWindowID() const
|
||||
{
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
return window ? window->WindowID() : 0;
|
||||
|
@ -1517,6 +1517,8 @@ public:
|
|||
// state is unlocked/false.
|
||||
virtual nsresult SetImageLockingState(PRBool aLocked) = 0;
|
||||
|
||||
virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult) = 0;
|
||||
|
||||
protected:
|
||||
~nsIDocument()
|
||||
{
|
||||
|
@ -1529,7 +1531,7 @@ protected:
|
|||
nsPropertyTable* GetExtraPropertyTable(PRUint16 aCategory);
|
||||
|
||||
// Never ever call this. Only call GetWindow!
|
||||
virtual nsPIDOMWindow *GetWindowInternal() = 0;
|
||||
virtual nsPIDOMWindow *GetWindowInternal() const = 0;
|
||||
|
||||
// Never ever call this. Only call GetInnerWindow!
|
||||
virtual nsPIDOMWindow *GetInnerWindowInternal() = 0;
|
||||
|
|
|
@ -141,7 +141,7 @@ interface nsIContentViewManager : nsISupports
|
|||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, uuid(50a67436-bb44-11df-8d9a-001e37d2764a)]
|
||||
[scriptable, uuid(13c512d6-fba0-402a-9244-fe7941c43965)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -217,16 +217,23 @@ interface nsIFrameLoader : nsISupports
|
|||
|
||||
attribute boolean delayRemoteDialogs;
|
||||
|
||||
/**
|
||||
* The default rendering mode is synchronous scrolling. In this
|
||||
* mode, it's an error to try to set a target viewport.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
|
||||
|
||||
/**
|
||||
* DEPRECATED. Please QI to nsIContentViewManager.
|
||||
* FIXME 615368
|
||||
* When asynchronous scrolling is enabled, a target viewport can be
|
||||
* set to transform content pixels wrt its CSS viewport.
|
||||
*
|
||||
* NB: when async scrolling is enabled, it's the *user's*
|
||||
* responsibility to update the target scroll offset. In effect,
|
||||
* the platform hands over control of scroll offset to the user.
|
||||
*/
|
||||
void scrollViewportTo(in float xPx, in float yPx);
|
||||
void scrollViewportBy(in float dxPx, in float dyPx);
|
||||
void setViewportScale(in float xScale, in float yScale);
|
||||
readonly attribute float viewportScrollX;
|
||||
readonly attribute float viewportScrollY;
|
||||
const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
|
||||
|
||||
attribute unsigned long renderMode;
|
||||
};
|
||||
|
||||
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
|
||||
|
@ -252,25 +259,3 @@ interface nsIFrameLoaderOwner : nsISupports
|
|||
*/
|
||||
void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner);
|
||||
};
|
||||
|
||||
/** Please merge me into something else after 2.0 branches. */
|
||||
[scriptable, uuid(e3e2d3f8-1397-4984-abb3-435c29a1ca55)]
|
||||
interface nsIFrameLoader_MOZILLA_2_0_BRANCH : nsISupports
|
||||
{
|
||||
/**
|
||||
* The default rendering mode is synchronous scrolling. In this
|
||||
* mode, it's an error to try to set a target viewport.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
|
||||
/**
|
||||
* When asynchronous scrolling is enabled, a target viewport can be
|
||||
* set to transform content pixels wrt its CSS viewport.
|
||||
*
|
||||
* NB: when async scrolling is enabled, it's the *user's*
|
||||
* responsibility to update the target scroll offset. In effect,
|
||||
* the platform hands over control of scroll offset to the user.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
|
||||
|
||||
attribute unsigned long renderMode;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ interface nsIInputStream;
|
|||
#include "jsapi.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(6ce0a193-b033-4c3d-b748-f851b09261f5)]
|
||||
[scriptable, uuid(dea238a1-240f-45f4-9f07-7769bc69eb76)]
|
||||
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
|
||||
// event handler attributes
|
||||
attribute nsIDOMEventListener onabort;
|
||||
|
@ -60,6 +60,7 @@ interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
|
|||
attribute nsIDOMEventListener onload;
|
||||
attribute nsIDOMEventListener onloadstart;
|
||||
attribute nsIDOMEventListener onprogress;
|
||||
attribute nsIDOMEventListener onloadend;
|
||||
};
|
||||
|
||||
[scriptable, uuid(09ff3682-7759-4441-a765-f70e1a1fabcf)]
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsAttrValue.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -80,7 +80,7 @@ nsAttrValue::nsAttrValue(const nsAString& aValue)
|
|||
SetTo(aValue);
|
||||
}
|
||||
|
||||
nsAttrValue::nsAttrValue(nsICSSStyleRule* aValue, const nsAString* aSerialized)
|
||||
nsAttrValue::nsAttrValue(css::StyleRule* aValue, const nsAString* aSerialized)
|
||||
: mBits(0)
|
||||
{
|
||||
SetTo(aValue, aSerialized);
|
||||
|
@ -262,9 +262,9 @@ nsAttrValue::SetTo(const nsAttrValue& aOther)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
case eFloatValue:
|
||||
case eDoubleValue:
|
||||
{
|
||||
cont->mFloatValue = otherCont->mFloatValue;
|
||||
cont->mDoubleValue = otherCont->mDoubleValue;
|
||||
break;
|
||||
}
|
||||
case eIntMarginValue:
|
||||
|
@ -313,7 +313,7 @@ nsAttrValue::SetTo(PRInt16 aInt)
|
|||
}
|
||||
|
||||
void
|
||||
nsAttrValue::SetTo(nsICSSStyleRule* aValue, const nsAString* aSerialized)
|
||||
nsAttrValue::SetTo(css::StyleRule* aValue, const nsAString* aSerialized)
|
||||
{
|
||||
if (EnsureEmptyMiscContainer()) {
|
||||
MiscContainer* cont = GetMiscContainer();
|
||||
|
@ -443,10 +443,10 @@ nsAttrValue::ToString(nsAString& aResult) const
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
case eFloatValue:
|
||||
case eDoubleValue:
|
||||
{
|
||||
aResult.Truncate();
|
||||
aResult.AppendFloat(GetFloatValue());
|
||||
aResult.AppendFloat(GetDoubleValue());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -607,10 +607,10 @@ nsAttrValue::HashValue() const
|
|||
return NS_PTR_TO_INT32(cont->mSVGValue);
|
||||
}
|
||||
#endif
|
||||
case eFloatValue:
|
||||
case eDoubleValue:
|
||||
{
|
||||
// XXX this is crappy, but oh well
|
||||
return cont->mFloatValue;
|
||||
return cont->mDoubleValue;
|
||||
}
|
||||
case eIntMarginValue:
|
||||
{
|
||||
|
@ -706,9 +706,9 @@ nsAttrValue::Equals(const nsAttrValue& aOther) const
|
|||
return thisCont->mSVGValue == otherCont->mSVGValue;
|
||||
}
|
||||
#endif
|
||||
case eFloatValue:
|
||||
case eDoubleValue:
|
||||
{
|
||||
return thisCont->mFloatValue == otherCont->mFloatValue;
|
||||
return thisCont->mDoubleValue == otherCont->mDoubleValue;
|
||||
}
|
||||
case eIntMarginValue:
|
||||
{
|
||||
|
@ -1206,19 +1206,19 @@ nsAttrValue::ParseColor(const nsAString& aString)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsAttrValue::ParseFloatValue(const nsAString& aString)
|
||||
PRBool nsAttrValue::ParseDoubleValue(const nsAString& aString)
|
||||
{
|
||||
ResetIfSet();
|
||||
|
||||
PRInt32 ec;
|
||||
float val = PromiseFlatString(aString).ToFloat(&ec);
|
||||
double val = PromiseFlatString(aString).ToDouble(&ec);
|
||||
if (NS_FAILED(ec)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (EnsureEmptyMiscContainer()) {
|
||||
MiscContainer* cont = GetMiscContainer();
|
||||
cont->mFloatValue = val;
|
||||
cont->mType = eFloatValue;
|
||||
cont->mDoubleValue = val;
|
||||
cont->mType = eDoubleValue;
|
||||
nsAutoString serializedFloat;
|
||||
serializedFloat.AppendFloat(val);
|
||||
SetMiscAtomOrString(serializedFloat.Equals(aString) ? nsnull : &aString);
|
||||
|
|
|
@ -55,13 +55,18 @@
|
|||
typedef PRUptrdiff PtrBits;
|
||||
class nsAString;
|
||||
class nsIAtom;
|
||||
class nsICSSStyleRule;
|
||||
class nsISVGValue;
|
||||
class nsIDocument;
|
||||
template<class E, class A> class nsTArray;
|
||||
template<class E, class A> class nsTPtrArray;
|
||||
struct nsTArrayDefaultAllocator;
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
class StyleRule;
|
||||
}
|
||||
}
|
||||
|
||||
#define NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM 12
|
||||
|
||||
#define NS_ATTRVALUE_BASETYPE_MASK (PtrBits(3))
|
||||
|
@ -99,7 +104,7 @@ public:
|
|||
nsAttrValue();
|
||||
nsAttrValue(const nsAttrValue& aOther);
|
||||
explicit nsAttrValue(const nsAString& aValue);
|
||||
nsAttrValue(nsICSSStyleRule* aValue, const nsAString* aSerialized);
|
||||
nsAttrValue(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
|
||||
#ifdef MOZ_SVG
|
||||
explicit nsAttrValue(nsISVGValue* aValue);
|
||||
#endif
|
||||
|
@ -125,7 +130,7 @@ public:
|
|||
#ifdef MOZ_SVG
|
||||
,eSVGValue = 0x12
|
||||
#endif
|
||||
,eFloatValue = 0x13
|
||||
,eDoubleValue = 0x13
|
||||
,eIntMarginValue = 0x14
|
||||
};
|
||||
|
||||
|
@ -136,7 +141,7 @@ public:
|
|||
void SetTo(const nsAttrValue& aOther);
|
||||
void SetTo(const nsAString& aValue);
|
||||
void SetTo(PRInt16 aInt);
|
||||
void SetTo(nsICSSStyleRule* aValue, const nsAString* aSerialized);
|
||||
void SetTo(mozilla::css::StyleRule* aValue, const nsAString* aSerialized);
|
||||
#ifdef MOZ_SVG
|
||||
void SetTo(nsISVGValue* aValue);
|
||||
#endif
|
||||
|
@ -156,11 +161,11 @@ public:
|
|||
inline PRInt16 GetEnumValue() const;
|
||||
inline float GetPercentValue() const;
|
||||
inline AtomArray* GetAtomArrayValue() const;
|
||||
inline nsICSSStyleRule* GetCSSStyleRuleValue() const;
|
||||
inline mozilla::css::StyleRule* GetCSSStyleRuleValue() const;
|
||||
#ifdef MOZ_SVG
|
||||
inline nsISVGValue* GetSVGValue() const;
|
||||
#endif
|
||||
inline float GetFloatValue() const;
|
||||
inline double GetDoubleValue() const;
|
||||
PRBool GetIntMarginValue(nsIntMargin& aMargin) const;
|
||||
|
||||
/**
|
||||
|
@ -292,12 +297,12 @@ public:
|
|||
PRBool ParseColor(const nsAString& aString);
|
||||
|
||||
/**
|
||||
* Parse a string value into a float.
|
||||
* Parse a string value into a double-precision floating point value.
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @return whether the value could be parsed
|
||||
*/
|
||||
PRBool ParseFloatValue(const nsAString& aString);
|
||||
PRBool ParseDoubleValue(const nsAString& aString);
|
||||
|
||||
/**
|
||||
* Parse a lazy URI. This just sets up the storage for the URI; it
|
||||
|
@ -336,12 +341,12 @@ private:
|
|||
nscolor mColor;
|
||||
PRUint32 mEnumValue;
|
||||
PRInt32 mPercent;
|
||||
nsICSSStyleRule* mCSSStyleRule;
|
||||
mozilla::css::StyleRule* mCSSStyleRule;
|
||||
AtomArray* mAtomArray;
|
||||
#ifdef MOZ_SVG
|
||||
nsISVGValue* mSVGValue;
|
||||
#endif
|
||||
float mFloatValue;
|
||||
double mDoubleValue;
|
||||
nsIntMargin* mIntMargin;
|
||||
};
|
||||
};
|
||||
|
@ -437,7 +442,7 @@ nsAttrValue::GetAtomArrayValue() const
|
|||
return GetMiscContainer()->mAtomArray;
|
||||
}
|
||||
|
||||
inline nsICSSStyleRule*
|
||||
inline mozilla::css::StyleRule*
|
||||
nsAttrValue::GetCSSStyleRuleValue() const
|
||||
{
|
||||
NS_PRECONDITION(Type() == eCSSStyleRule, "wrong type");
|
||||
|
@ -453,11 +458,11 @@ nsAttrValue::GetSVGValue() const
|
|||
}
|
||||
#endif
|
||||
|
||||
inline float
|
||||
nsAttrValue::GetFloatValue() const
|
||||
inline double
|
||||
nsAttrValue::GetDoubleValue() const
|
||||
{
|
||||
NS_PRECONDITION(Type() == eFloatValue, "wrong type");
|
||||
return GetMiscContainer()->mFloatValue;
|
||||
NS_PRECONDITION(Type() == eDoubleValue, "wrong type");
|
||||
return GetMiscContainer()->mDoubleValue;
|
||||
}
|
||||
|
||||
inline PRBool
|
||||
|
|
|
@ -442,11 +442,9 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
|||
nsIContent* findFormParent = findFormNode->GetParent();
|
||||
while (findFormParent) {
|
||||
nsCOMPtr<nsIFormControl> form(do_QueryInterface(findFormParent));
|
||||
if (form && form->GetType() != NS_FORM_OBJECT &&
|
||||
form->GetType() != NS_FORM_FIELDSET &&
|
||||
form->GetType() != NS_FORM_LABEL &&
|
||||
form->GetType() != NS_FORM_OUTPUT)
|
||||
if (form && !form->AllowDraggableChildren()) {
|
||||
return NS_OK;
|
||||
}
|
||||
findFormParent = findFormParent->GetParent();
|
||||
}
|
||||
|
||||
|
|
|
@ -203,24 +203,20 @@ ContentListHashtableMatchEntry(PLDHashTable *table,
|
|||
{
|
||||
const ContentListHashEntry *e =
|
||||
static_cast<const ContentListHashEntry *>(entry);
|
||||
const nsContentListKey* list1 = e->mContentList->GetKey();
|
||||
const nsContentListKey* list2 = static_cast<const nsContentListKey *>(key);
|
||||
const nsContentList* list = e->mContentList;
|
||||
const nsContentListKey* ourKey = static_cast<const nsContentListKey *>(key);
|
||||
|
||||
return list1->Equals(*list2);
|
||||
return list->MatchesKey(*ourKey);
|
||||
}
|
||||
|
||||
already_AddRefed<nsContentList>
|
||||
NS_GetContentList(nsINode* aRootNode,
|
||||
PRInt32 aMatchNameSpaceId,
|
||||
nsIAtom* aHTMLMatchAtom,
|
||||
nsIAtom* aXMLMatchAtom)
|
||||
const nsAString& aTagname)
|
||||
|
||||
{
|
||||
NS_ASSERTION(aRootNode, "content list has to have a root");
|
||||
|
||||
if(!aXMLMatchAtom)
|
||||
aXMLMatchAtom = aHTMLMatchAtom;
|
||||
|
||||
nsContentList* list = nsnull;
|
||||
|
||||
static PLDHashTableOps hash_table_ops =
|
||||
|
@ -249,15 +245,14 @@ NS_GetContentList(nsINode* aRootNode,
|
|||
ContentListHashEntry *entry = nsnull;
|
||||
// First we look in our hashtable. Then we create a content list if needed
|
||||
if (gContentListHashTable.ops) {
|
||||
nsContentListKey hashKey(aRootNode, aHTMLMatchAtom,
|
||||
aXMLMatchAtom, aMatchNameSpaceId);
|
||||
nsContentListKey hashKey(aRootNode, aMatchNameSpaceId, aTagname);
|
||||
|
||||
// A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases
|
||||
// when the entry is already in the hashtable.
|
||||
entry = static_cast<ContentListHashEntry *>
|
||||
(PL_DHashTableOperate(&gContentListHashTable,
|
||||
&hashKey,
|
||||
PL_DHASH_ADD));
|
||||
&hashKey,
|
||||
PL_DHASH_ADD));
|
||||
if (entry)
|
||||
list = entry->mContentList;
|
||||
}
|
||||
|
@ -265,8 +260,17 @@ NS_GetContentList(nsINode* aRootNode,
|
|||
if (!list) {
|
||||
// We need to create a ContentList and add it to our new entry, if
|
||||
// we have an entry
|
||||
nsCOMPtr<nsIAtom> xmlAtom = do_GetAtom(aTagname);
|
||||
nsCOMPtr<nsIAtom> htmlAtom;
|
||||
if (aMatchNameSpaceId == kNameSpaceID_Unknown) {
|
||||
nsAutoString lowercaseName;
|
||||
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
|
||||
htmlAtom = do_GetAtom(lowercaseName);
|
||||
} else {
|
||||
htmlAtom = xmlAtom;
|
||||
}
|
||||
list = new nsContentList(aRootNode, aMatchNameSpaceId,
|
||||
aHTMLMatchAtom, aXMLMatchAtom);
|
||||
htmlAtom, xmlAtom);
|
||||
if (entry) {
|
||||
entry->mContentList = list;
|
||||
}
|
||||
|
@ -391,7 +395,10 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
|||
nsIAtom* aXMLMatchAtom,
|
||||
PRBool aDeep)
|
||||
: nsBaseContentList(),
|
||||
nsContentListKey(aRootNode, aHTMLMatchAtom, aXMLMatchAtom, aMatchNameSpaceId),
|
||||
mRootNode(aRootNode),
|
||||
mMatchNameSpaceId(aMatchNameSpaceId),
|
||||
mHTMLMatchAtom(aHTMLMatchAtom),
|
||||
mXMLMatchAtom(aXMLMatchAtom),
|
||||
mFunc(nsnull),
|
||||
mDestroyFunc(nsnull),
|
||||
mData(nsnull),
|
||||
|
@ -408,6 +415,14 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
|||
mMatchAll = PR_FALSE;
|
||||
}
|
||||
mRootNode->AddMutationObserver(this);
|
||||
|
||||
// We only need to flush if we're in an non-HTML document, since the
|
||||
// HTML5 parser doesn't need flushing. Further, if we're not in a
|
||||
// document at all right now (in the GetCurrentDoc() sense), we're
|
||||
// not parser-created and don't need to be flushing stuff under us
|
||||
// to get our kids right.
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
mFlushesNeeded = doc && !doc->IsHTML();
|
||||
}
|
||||
|
||||
nsContentList::nsContentList(nsINode* aRootNode,
|
||||
|
@ -419,12 +434,15 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
|||
PRInt32 aMatchNameSpaceId,
|
||||
PRBool aFuncMayDependOnAttr)
|
||||
: nsBaseContentList(),
|
||||
nsContentListKey(aRootNode, aMatchAtom, aMatchAtom, aMatchNameSpaceId),
|
||||
mRootNode(aRootNode),
|
||||
mMatchNameSpaceId(aMatchNameSpaceId),
|
||||
mHTMLMatchAtom(aMatchAtom),
|
||||
mXMLMatchAtom(aMatchAtom),
|
||||
mFunc(aFunc),
|
||||
mDestroyFunc(aDestroyFunc),
|
||||
mData(aData),
|
||||
mMatchAll(PR_FALSE),
|
||||
mState(LIST_DIRTY),
|
||||
mMatchAll(PR_FALSE),
|
||||
mDeep(aDeep),
|
||||
mFuncMayDependOnAttr(aFuncMayDependOnAttr)
|
||||
{
|
||||
|
@ -475,7 +493,7 @@ nsContentList::Length(PRBool aDoFlush)
|
|||
nsIContent *
|
||||
nsContentList::Item(PRUint32 aIndex, PRBool aDoFlush)
|
||||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
if (mRootNode && aDoFlush && mFlushesNeeded) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
@ -907,8 +925,10 @@ nsContentList::RemoveFromHashtable()
|
|||
if (!gContentListHashTable.ops)
|
||||
return;
|
||||
|
||||
nsDependentAtomString str(mXMLMatchAtom);
|
||||
nsContentListKey key(mRootNode, mMatchNameSpaceId, str);
|
||||
PL_DHashTableOperate(&gContentListHashTable,
|
||||
GetKey(),
|
||||
&key,
|
||||
PL_DHASH_REMOVE);
|
||||
|
||||
if (gContentListHashTable.entryCount == 0) {
|
||||
|
@ -920,7 +940,7 @@ nsContentList::RemoveFromHashtable()
|
|||
void
|
||||
nsContentList::BringSelfUpToDate(PRBool aDoFlush)
|
||||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
if (mRootNode && aDoFlush && mFlushesNeeded) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
|
|
@ -140,53 +140,35 @@ public:
|
|||
* Class that's used as the key to hash nsContentList implementations
|
||||
* for fast retrieval
|
||||
*/
|
||||
class nsContentListKey
|
||||
struct nsContentListKey
|
||||
{
|
||||
public:
|
||||
nsContentListKey(nsINode* aRootNode,
|
||||
nsIAtom* aHTMLMatchAtom,
|
||||
nsIAtom* aXMLMatchAtom,
|
||||
PRInt32 aMatchNameSpaceId)
|
||||
: mHTMLMatchAtom(aHTMLMatchAtom),
|
||||
mXMLMatchAtom(aXMLMatchAtom),
|
||||
PRInt32 aMatchNameSpaceId,
|
||||
const nsAString& aTagname)
|
||||
: mRootNode(aRootNode),
|
||||
mMatchNameSpaceId(aMatchNameSpaceId),
|
||||
mRootNode(aRootNode)
|
||||
mTagname(aTagname)
|
||||
{
|
||||
NS_ASSERTION(!aXMLMatchAtom == !aHTMLMatchAtom, "Either neither or both atoms should be null");
|
||||
}
|
||||
|
||||
|
||||
nsContentListKey(const nsContentListKey& aContentListKey)
|
||||
: mHTMLMatchAtom(aContentListKey.mHTMLMatchAtom),
|
||||
mXMLMatchAtom(aContentListKey.mXMLMatchAtom),
|
||||
: mRootNode(aContentListKey.mRootNode),
|
||||
mMatchNameSpaceId(aContentListKey.mMatchNameSpaceId),
|
||||
mRootNode(aContentListKey.mRootNode)
|
||||
mTagname(aContentListKey.mTagname)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool Equals(const nsContentListKey& aContentListKey) const
|
||||
{
|
||||
NS_ASSERTION(mHTMLMatchAtom == aContentListKey.mHTMLMatchAtom
|
||||
|| mXMLMatchAtom != aContentListKey.mXMLMatchAtom, "HTML atoms should match if XML atoms match");
|
||||
|
||||
return
|
||||
mXMLMatchAtom == aContentListKey.mXMLMatchAtom &&
|
||||
mMatchNameSpaceId == aContentListKey.mMatchNameSpaceId &&
|
||||
mRootNode == aContentListKey.mRootNode;
|
||||
}
|
||||
|
||||
inline PRUint32 GetHash(void) const
|
||||
{
|
||||
return
|
||||
NS_PTR_TO_INT32(mXMLMatchAtom.get()) ^
|
||||
HashString(mTagname) ^
|
||||
(NS_PTR_TO_INT32(mRootNode) << 12) ^
|
||||
(mMatchNameSpaceId << 24);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAtom> mHTMLMatchAtom;
|
||||
nsCOMPtr<nsIAtom> mXMLMatchAtom;
|
||||
PRInt32 mMatchNameSpaceId;
|
||||
nsINode* mRootNode; // Weak ref
|
||||
nsINode* const mRootNode; // Weak ref
|
||||
const PRInt32 mMatchNameSpaceId;
|
||||
const nsAString& mTagname;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -214,7 +196,6 @@ protected:
|
|||
* tree based on some criterion.
|
||||
*/
|
||||
class nsContentList : public nsBaseContentList,
|
||||
protected nsContentListKey,
|
||||
public nsIHTMLCollection,
|
||||
public nsStubMutationObserver,
|
||||
public nsWrapperCache
|
||||
|
@ -290,11 +271,6 @@ public:
|
|||
NS_HIDDEN_(nsIContent*) Item(PRUint32 aIndex, PRBool aDoFlush);
|
||||
NS_HIDDEN_(nsIContent*) NamedItem(const nsAString& aName, PRBool aDoFlush);
|
||||
|
||||
nsContentListKey* GetKey() {
|
||||
return static_cast<nsContentListKey*>(this);
|
||||
}
|
||||
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||
|
@ -318,6 +294,19 @@ public:
|
|||
return static_cast<nsContentList*>(list);
|
||||
}
|
||||
|
||||
PRBool MatchesKey(const nsContentListKey& aKey) const
|
||||
{
|
||||
// The root node is most commonly the same: the document. And the
|
||||
// most common namespace id is kNameSpaceID_Unknown. So check the
|
||||
// string first.
|
||||
NS_PRECONDITION(mXMLMatchAtom,
|
||||
"How did we get here with a null match atom on our list?");
|
||||
return
|
||||
mXMLMatchAtom->Equals(aKey.mTagname) &&
|
||||
mRootNode == aKey.mRootNode &&
|
||||
mMatchNameSpaceId == aKey.mMatchNameSpaceId;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns whether the element matches our criterion
|
||||
|
@ -388,6 +377,11 @@ protected:
|
|||
RemoveFromHashtable();
|
||||
}
|
||||
|
||||
nsINode* mRootNode; // Weak ref
|
||||
PRInt32 mMatchNameSpaceId;
|
||||
nsCOMPtr<nsIAtom> mHTMLMatchAtom;
|
||||
nsCOMPtr<nsIAtom> mXMLMatchAtom;
|
||||
|
||||
/**
|
||||
* Function to use to determine whether a piece of content matches
|
||||
* our criterion
|
||||
|
@ -401,25 +395,35 @@ protected:
|
|||
* Closure data to pass to mFunc when we call it
|
||||
*/
|
||||
void* mData;
|
||||
/**
|
||||
* True if we are looking for elements named "*"
|
||||
*/
|
||||
PRPackedBool mMatchAll;
|
||||
/**
|
||||
* The current state of the list (possible values are:
|
||||
* LIST_UP_TO_DATE, LIST_LAZY, LIST_DIRTY
|
||||
*/
|
||||
PRUint8 mState;
|
||||
|
||||
// The booleans have to use PRUint8 to pack with mState, because MSVC won't
|
||||
// pack different typedefs together. Once we no longer have to worry about
|
||||
// flushes in XML documents, we can go back to using PRPackedBool for the
|
||||
// booleans.
|
||||
|
||||
/**
|
||||
* True if we are looking for elements named "*"
|
||||
*/
|
||||
PRUint8 mMatchAll : 1;
|
||||
/**
|
||||
* Whether to actually descend the tree. If this is false, we won't
|
||||
* consider grandkids of mRootNode.
|
||||
*/
|
||||
PRPackedBool mDeep;
|
||||
PRUint8 mDeep : 1;
|
||||
/**
|
||||
* Whether the return value of mFunc could depend on the values of
|
||||
* attributes.
|
||||
*/
|
||||
PRPackedBool mFuncMayDependOnAttr;
|
||||
PRUint8 mFuncMayDependOnAttr : 1;
|
||||
/**
|
||||
* Whether we actually need to flush to get our state correct.
|
||||
*/
|
||||
PRUint8 mFlushesNeeded : 1;
|
||||
|
||||
#ifdef DEBUG_CONTENT_LIST
|
||||
void AssertInSync();
|
||||
|
@ -494,11 +498,15 @@ protected:
|
|||
nsString mString;
|
||||
};
|
||||
|
||||
// If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a
|
||||
// content list which matches ASCIIToLower(aTagname) against HTML
|
||||
// elements in HTML documents and aTagname against everything else.
|
||||
// For any other value of aMatchNameSpaceId, the list will match
|
||||
// aTagname against all elements.
|
||||
already_AddRefed<nsContentList>
|
||||
NS_GetContentList(nsINode* aRootNode,
|
||||
PRInt32 aMatchNameSpaceId,
|
||||
nsIAtom* aHTMLMatchAtom,
|
||||
nsIAtom* aXMLMatchAtom = nsnull);
|
||||
const nsAString& aTagname);
|
||||
|
||||
already_AddRefed<nsContentList>
|
||||
NS_GetFuncStringContentList(nsINode* aRootNode,
|
||||
|
|
|
@ -535,24 +535,6 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
|
|||
}
|
||||
}
|
||||
}
|
||||
// Don't report "refresh" headers back to necko, since our document handles
|
||||
// them
|
||||
else if (aHeader != nsGkAtoms::refresh && mParser) {
|
||||
// we also need to report back HTTP-EQUIV headers to the channel
|
||||
// so that it can process things like pragma: no-cache or other
|
||||
// cache-control headers. Ideally this should also be the way for
|
||||
// cookies to be set! But we'll worry about that in the next
|
||||
// iteration
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
if (NS_SUCCEEDED(mParser->GetChannel(getter_AddRefs(channel)))) {
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
|
||||
if (httpChannel) {
|
||||
httpChannel->SetResponseHeader(nsAtomCString(aHeader),
|
||||
NS_ConvertUTF16toUTF8(aValue),
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -5504,7 +5504,7 @@ nsContentUtils::WrapNative(JSContext *cx, JSObject *scope, nsISupports *native,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject *wrapper = xpc_GetCachedSlimWrapper(cache, scope, vp);
|
||||
JSObject *wrapper = xpc_FastGetCachedWrapper(cache, scope, vp);
|
||||
if (wrapper) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6393,9 +6393,9 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
|
|||
nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);
|
||||
if (widget) {
|
||||
nsRefPtr<LayerManager> manager =
|
||||
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget)->
|
||||
GetLayerManager(aRequirePersistent ? nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_PERSISTENT :
|
||||
nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_CURRENT,
|
||||
widget->
|
||||
GetLayerManager(aRequirePersistent ? nsIWidget::LAYER_MANAGER_PERSISTENT :
|
||||
nsIWidget::LAYER_MANAGER_CURRENT,
|
||||
aAllowRetaining);
|
||||
return manager.forget();
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMFileReader)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMFileReader,
|
||||
nsXHREventTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadEndListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFile)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mProgressNotifier)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrincipal)
|
||||
|
@ -103,7 +102,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMFileReader,
|
||||
nsXHREventTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadEndListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFile)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mProgressNotifier)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPrincipal)
|
||||
|
@ -126,19 +124,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
|
|||
NS_IMPL_ADDREF_INHERITED(nsDOMFileReader, nsXHREventTarget)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMFileReader, nsXHREventTarget)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileReader::GetOnloadend(nsIDOMEventListener** aOnloadend)
|
||||
{
|
||||
return GetInnerEventListener(mOnLoadEndListener, aOnloadend);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileReader::SetOnloadend(nsIDOMEventListener* aOnloadend)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(LOADEND_STR),
|
||||
mOnLoadEndListener, aOnloadend);
|
||||
}
|
||||
|
||||
//nsICharsetDetectionObserver
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -152,8 +152,6 @@ protected:
|
|||
|
||||
PRUint64 mReadTotal;
|
||||
PRUint64 mReadTransferred;
|
||||
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadEndListener;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -108,7 +108,6 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsIXPointer.h"
|
||||
#include "nsIFileChannel.h"
|
||||
#include "nsIMultiPartChannel.h"
|
||||
#include "nsIRefreshURI.h"
|
||||
|
@ -1736,7 +1735,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
|||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer_MOZILLA_2_0_BRANCH)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocument_MOZILLA_2_0_BRANCH)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDocument)
|
||||
|
@ -3240,6 +3238,18 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
|||
|
||||
mExternalResourceMap.ShowViewers();
|
||||
|
||||
if (mScriptGlobalObject) {
|
||||
RescheduleAnimationFrameNotifications();
|
||||
}
|
||||
|
||||
shell.swap(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RescheduleAnimationFrameNotifications()
|
||||
{
|
||||
nsRefreshDriver* rd = mPresShell->GetPresContext()->RefreshDriver();
|
||||
if (mHavePendingPaint) {
|
||||
rd->ScheduleBeforePaintEvent(this);
|
||||
|
@ -3247,10 +3257,6 @@ nsDocument::doCreateShell(nsPresContext* aContext,
|
|||
if (!mAnimationFrameListeners.IsEmpty()) {
|
||||
rd->ScheduleAnimationFrameListeners(this);
|
||||
}
|
||||
|
||||
shell.swap(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3264,6 +3270,15 @@ void
|
|||
nsDocument::DeleteShell()
|
||||
{
|
||||
mExternalResourceMap.HideViewers();
|
||||
if (mScriptGlobalObject) {
|
||||
RevokeAnimationFrameNotifications();
|
||||
}
|
||||
mPresShell = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RevokeAnimationFrameNotifications()
|
||||
{
|
||||
if (mHavePendingPaint) {
|
||||
mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this);
|
||||
}
|
||||
|
@ -3271,7 +3286,6 @@ nsDocument::DeleteShell()
|
|||
mPresShell->GetPresContext()->RefreshDriver()->
|
||||
RevokeAnimationFrameListeners(this);
|
||||
}
|
||||
mPresShell = nsnull;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3793,6 +3807,10 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
// our layout history state now.
|
||||
mLayoutHistoryState = GetLayoutHistoryState();
|
||||
|
||||
if (mPresShell) {
|
||||
RevokeAnimationFrameNotifications();
|
||||
}
|
||||
|
||||
// Also make sure to remove our onload blocker now if we haven't done it yet
|
||||
if (mOnloadBlockCount != 0) {
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup();
|
||||
|
@ -3849,6 +3867,10 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
mAllowDNSPrefetch = allowDNSPrefetch;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPresShell) {
|
||||
RescheduleAnimationFrameNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
// Remember the pointer to our window (or lack there of), to avoid
|
||||
|
@ -3891,7 +3913,7 @@ nsDocument::SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject)
|
|||
}
|
||||
|
||||
nsPIDOMWindow *
|
||||
nsDocument::GetWindowInternal()
|
||||
nsDocument::GetWindowInternal() const
|
||||
{
|
||||
NS_ASSERTION(!mWindow, "This should not be called when mWindow is not null!");
|
||||
|
||||
|
@ -4125,7 +4147,7 @@ nsDocument::LookupImageElement(const nsAString& aId)
|
|||
if (aId.IsEmpty())
|
||||
return nsnull;
|
||||
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.PutEntry(aId);
|
||||
nsIdentifierMapEntry *entry = mIdentifierMap.GetEntry(aId);
|
||||
return entry ? entry->GetImageIdElement() : nsnull;
|
||||
}
|
||||
|
||||
|
@ -4579,17 +4601,6 @@ nsDocument::CreateEntityReference(const nsAString& aName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsContentList>
|
||||
nsDocument::GetElementsByTagName(const nsAString& aTagname)
|
||||
{
|
||||
nsAutoString lowercaseName;
|
||||
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
|
||||
nsCOMPtr<nsIAtom> xmlAtom = do_GetAtom(aTagname);
|
||||
nsCOMPtr<nsIAtom> htmlAtom = do_GetAtom(lowercaseName);
|
||||
|
||||
return NS_GetContentList(this, kNameSpaceID_Unknown, htmlAtom, xmlAtom);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn)
|
||||
|
@ -4615,9 +4626,9 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
NS_ASSERTION(nameSpaceId != kNameSpaceID_Unknown, "Unexpected namespace ID!");
|
||||
|
||||
return NS_GetContentList(this, nameSpaceId, nameAtom);
|
||||
return NS_GetContentList(this, nameSpaceId, aLocalName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -4658,23 +4669,6 @@ nsDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::EvaluateFIXptr(const nsAString& aExpression, nsIDOMRange **aRange)
|
||||
{
|
||||
NS_ERROR("nsDocument::EvaluateFIXptr() should be overriden by subclass!");
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::EvaluateXPointer(const nsAString& aExpression,
|
||||
nsIXPointerResult **aResult)
|
||||
{
|
||||
NS_ERROR("nsDocument::EvaluateXPointer() should be overriden by subclass!");
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
|
||||
{
|
||||
|
@ -5184,7 +5178,7 @@ nsDocument::GetTitleContent(PRUint32 aNamespace)
|
|||
return nsnull;
|
||||
|
||||
nsRefPtr<nsContentList> list =
|
||||
NS_GetContentList(this, aNamespace, nsGkAtoms::title);
|
||||
NS_GetContentList(this, aNamespace, NS_LITERAL_STRING("title"));
|
||||
|
||||
return list->Item(0, PR_FALSE);
|
||||
}
|
||||
|
@ -6432,7 +6426,8 @@ nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult)
|
|||
void
|
||||
nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
if (mParser || mWeakSink) {
|
||||
if ((!IsHTML() || aType > Flush_ContentAndNotify) &&
|
||||
(mParser || mWeakSink)) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
if (mParser) {
|
||||
sink = mParser->GetContentSink();
|
||||
|
@ -7473,7 +7468,7 @@ nsDocument::OnPageShow(PRBool aPersisted,
|
|||
// Send out notifications that our <link> elements are attached.
|
||||
nsRefPtr<nsContentList> links = NS_GetContentList(root,
|
||||
kNameSpaceID_Unknown,
|
||||
nsGkAtoms::link);
|
||||
NS_LITERAL_STRING("link"));
|
||||
|
||||
PRUint32 linkCount = links->Length(PR_TRUE);
|
||||
for (PRUint32 i = 0; i < linkCount; ++i) {
|
||||
|
@ -7525,7 +7520,7 @@ nsDocument::OnPageHide(PRBool aPersisted,
|
|||
if (aPersisted && root) {
|
||||
nsRefPtr<nsContentList> links = NS_GetContentList(root,
|
||||
kNameSpaceID_Unknown,
|
||||
nsGkAtoms::link);
|
||||
NS_LITERAL_STRING("link"));
|
||||
|
||||
PRUint32 linkCount = links->Length(PR_TRUE);
|
||||
for (PRUint32 i = 0; i < linkCount; ++i) {
|
||||
|
@ -8216,7 +8211,7 @@ nsIDocument::ScheduleBeforePaintEvent(nsIAnimationFrameListener* aListener)
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsDocument::GetMozCurrentStateObject(nsIVariant** aState)
|
||||
{
|
||||
// Get the document's current state object. This is the object returned form
|
||||
|
|
|
@ -517,8 +517,7 @@ class nsDocument : public nsIDocument,
|
|||
public nsIScriptObjectPrincipal,
|
||||
public nsIRadioGroupContainer_MOZILLA_2_0_BRANCH,
|
||||
public nsIApplicationCacheContainer,
|
||||
public nsStubMutationObserver,
|
||||
public nsIDOMNSDocument_MOZILLA_2_0_BRANCH
|
||||
public nsStubMutationObserver
|
||||
{
|
||||
public:
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
@ -814,7 +813,6 @@ public:
|
|||
|
||||
// nsIDOMNSDocument
|
||||
NS_DECL_NSIDOMNSDOCUMENT
|
||||
NS_DECL_NSIDOMNSDOCUMENT_MOZILLA_2_0_BRANCH
|
||||
|
||||
// nsIDOMDocumentEvent
|
||||
NS_DECL_NSIDOMDOCUMENTEVENT
|
||||
|
@ -978,7 +976,9 @@ public:
|
|||
virtual void SetChangeScrollPosWhenScrollingToRef(PRBool aValue);
|
||||
|
||||
already_AddRefed<nsContentList>
|
||||
GetElementsByTagName(const nsAString& aTagName);
|
||||
GetElementsByTagName(const nsAString& aTagName) {
|
||||
return NS_GetContentList(this, kNameSpaceID_Unknown, aTagName);
|
||||
}
|
||||
already_AddRefed<nsContentList>
|
||||
GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName);
|
||||
|
@ -991,6 +991,8 @@ public:
|
|||
virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
|
||||
virtual NS_HIDDEN_(nsresult) SetImageLockingState(PRBool aLocked);
|
||||
|
||||
virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult);
|
||||
|
||||
protected:
|
||||
friend class nsNodeUtils;
|
||||
|
||||
|
@ -1056,7 +1058,7 @@ protected:
|
|||
const nsAString& aType,
|
||||
PRBool aPersisted);
|
||||
|
||||
virtual nsPIDOMWindow *GetWindowInternal();
|
||||
virtual nsPIDOMWindow *GetWindowInternal() const;
|
||||
virtual nsPIDOMWindow *GetInnerWindowInternal();
|
||||
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const;
|
||||
virtual PRBool InternalAllowXULXBL();
|
||||
|
@ -1205,6 +1207,11 @@ private:
|
|||
void EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
|
||||
PRBool aUpdateCSSLoader);
|
||||
|
||||
// Revoke any pending notifications due to mozRequestAnimationFrame calls
|
||||
void RevokeAnimationFrameNotifications();
|
||||
// Reschedule any notifications we need to handle mozRequestAnimationFrame
|
||||
void RescheduleAnimationFrameNotifications();
|
||||
|
||||
// These are not implemented and not supported.
|
||||
nsDocument(const nsDocument& aOther);
|
||||
nsDocument& operator=(const nsDocument& aOther);
|
||||
|
|
|
@ -1471,7 +1471,7 @@ nsHTMLCopyEncoder::IncludeInContext(nsINode *aNode)
|
|||
tag == nsGkAtoms::dfn ||
|
||||
tag == nsGkAtoms::code ||
|
||||
tag == nsGkAtoms::cite ||
|
||||
tag == nsGkAtoms::variable ||
|
||||
tag == nsGkAtoms::var ||
|
||||
tag == nsGkAtoms::abbr ||
|
||||
tag == nsGkAtoms::font ||
|
||||
tag == nsGkAtoms::script ||
|
||||
|
|
|
@ -310,7 +310,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader_MOZILLA_2_0_BRANCH)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentViewManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -854,6 +853,20 @@ 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
|
||||
nsCOMPtr<nsIEditorDocShell> editorDocshell = do_QueryInterface(mDocShell);
|
||||
if (editorDocshell) {
|
||||
PRBool editable = PR_FALSE,
|
||||
hasEditingSession = PR_FALSE;
|
||||
editorDocshell->GetEditable(&editable);
|
||||
editorDocshell->GetHasEditingSession(&hasEditingSession);
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocshell->GetEditor(getter_AddRefs(editor));
|
||||
if (editable && hasEditingSession && editor) {
|
||||
editor->PostCreate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1670,36 +1683,6 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ScrollViewportTo(float aXpx, float aYpx)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ScrollViewportBy(float aDXpx, float aDYpx)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SetViewportScale(float aXScale, float aYScale)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetViewportScrollX(float* aViewportScrollX)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetViewportScrollY(float* aViewportScrollY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetRenderMode(PRUint32* aRenderMode)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,6 @@ private:
|
|||
|
||||
|
||||
class nsFrameLoader : public nsIFrameLoader,
|
||||
public nsIFrameLoader_MOZILLA_2_0_BRANCH,
|
||||
public nsIContentViewManager
|
||||
{
|
||||
friend class AutoResetInShow;
|
||||
|
@ -196,7 +195,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
|
||||
NS_DECL_NSIFRAMELOADER
|
||||
NS_DECL_NSIFRAMELOADER_MOZILLA_2_0_BRANCH
|
||||
NS_DECL_NSICONTENTVIEWMANAGER
|
||||
NS_HIDDEN_(nsresult) CheckForRecursiveLoad(nsIURI* aURI);
|
||||
nsresult ReallyStartLoading();
|
||||
|
|
|
@ -627,10 +627,9 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
JSObject* global = nsnull;
|
||||
mGlobal->GetJSObject(&global);
|
||||
if (global) {
|
||||
jsval val;
|
||||
JS_ExecuteScript(mCx, global,
|
||||
(JSScript*)JS_GetPrivate(mCx, holder->mObject),
|
||||
&val);
|
||||
nsnull);
|
||||
}
|
||||
}
|
||||
JSContext* unused;
|
||||
|
@ -682,12 +681,18 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
JSPrincipals* jsprin = nsnull;
|
||||
mPrincipal->GetJSPrincipals(mCx, &jsprin);
|
||||
nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
|
||||
|
||||
uint32 oldopts = JS_GetOptions(mCx);
|
||||
JS_SetOptions(mCx, oldopts | JSOPTION_NO_SCRIPT_RVAL);
|
||||
|
||||
JSScript* script =
|
||||
JS_CompileUCScriptForPrincipals(mCx, nsnull, jsprin,
|
||||
(jschar*)dataString.get(),
|
||||
dataString.Length(),
|
||||
url.get(), 1);
|
||||
|
||||
JS_SetOptions(mCx, oldopts);
|
||||
|
||||
if (script) {
|
||||
JSObject* scriptObj = JS_NewScriptObject(mCx, script);
|
||||
JS_AddObjectRoot(mCx, &scriptObj);
|
||||
|
@ -702,9 +707,8 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
"Cached message manager script");
|
||||
sCachedScripts->Put(aURL, holder);
|
||||
}
|
||||
jsval val;
|
||||
JS_ExecuteScript(mCx, global,
|
||||
(JSScript*)JS_GetPrivate(mCx, scriptObj), &val);
|
||||
(JSScript*)JS_GetPrivate(mCx, scriptObj), nsnull);
|
||||
JS_RemoveObjectRoot(mCx, &scriptObj);
|
||||
}
|
||||
//XXX Argh, JSPrincipals are manually refcounted!
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
#include "pldhash.h"
|
||||
#include "prprf.h"
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
||||
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsIContent(aNodeInfo)
|
||||
{
|
||||
|
@ -1120,14 +1122,14 @@ nsGenericDOMDataNode::GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsICSSStyleRule*
|
||||
css::StyleRule*
|
||||
nsGenericDOMDataNode::GetSMILOverrideStyleRule()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
nsGenericDOMDataNode::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
|
||||
PRBool aNotify)
|
||||
{
|
||||
NS_NOTREACHED("How come we're setting SMILOverrideStyle on a non-element?");
|
||||
|
@ -1135,14 +1137,14 @@ nsGenericDOMDataNode::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
|||
}
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
nsICSSStyleRule*
|
||||
css::StyleRule*
|
||||
nsGenericDOMDataNode::GetInlineStyleRule()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMDataNode::SetInlineStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
nsGenericDOMDataNode::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||
PRBool aNotify)
|
||||
{
|
||||
NS_NOTREACHED("How come we're setting inline style on a non-element?");
|
||||
|
|
|
@ -235,8 +235,8 @@ public:
|
|||
return nsnull;
|
||||
}
|
||||
virtual nsresult GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle);
|
||||
virtual nsICSSStyleRule* GetSMILOverrideStyleRule();
|
||||
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
|
||||
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||
PRBool aNotify);
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
|
@ -252,8 +252,8 @@ public:
|
|||
virtual nsIAtom* DoGetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType) const;
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsXBLInsertionPoint.h"
|
||||
#include "nsICSSStyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsRuleProcessorData.h"
|
||||
|
||||
|
@ -155,6 +155,7 @@
|
|||
#endif /* MOZ_SVG */
|
||||
|
||||
using namespace mozilla::dom;
|
||||
namespace css = mozilla::css;
|
||||
|
||||
NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
|
||||
|
||||
|
@ -2558,13 +2559,8 @@ nsresult
|
|||
nsGenericElement::GetElementsByTagName(const nsAString& aTagname,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
nsAutoString lowercaseName;
|
||||
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
|
||||
nsCOMPtr<nsIAtom> XMLAtom = do_GetAtom(aTagname);
|
||||
nsCOMPtr<nsIAtom> HTMLAtom = do_GetAtom(lowercaseName);
|
||||
|
||||
nsContentList *list = NS_GetContentList(this, kNameSpaceID_Unknown,
|
||||
HTMLAtom, XMLAtom).get();
|
||||
aTagname).get();
|
||||
|
||||
// transfer ref to aReturn
|
||||
*aReturn = list;
|
||||
|
@ -2690,9 +2686,9 @@ nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aLocalName);
|
||||
NS_ASSERTION(nameSpaceId != kNameSpaceID_Unknown, "Unexpected namespace ID!");
|
||||
|
||||
nsContentList *list = NS_GetContentList(this, nameSpaceId, nameAtom).get();
|
||||
nsContentList *list = NS_GetContentList(this, nameSpaceId, aLocalName).get();
|
||||
|
||||
// transfer ref to aReturn
|
||||
*aReturn = list;
|
||||
|
@ -3368,7 +3364,7 @@ nsGenericElement::GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsICSSStyleRule*
|
||||
css::StyleRule*
|
||||
nsGenericElement::GetSMILOverrideStyleRule()
|
||||
{
|
||||
nsGenericElement::nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
|
@ -3376,7 +3372,7 @@ nsGenericElement::GetSMILOverrideStyleRule()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
nsGenericElement::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
|
||||
PRBool aNotify)
|
||||
{
|
||||
nsGenericElement::nsDOMSlots *slots = DOMSlots();
|
||||
|
@ -3400,14 +3396,14 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
|||
}
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
nsICSSStyleRule*
|
||||
css::StyleRule*
|
||||
nsGenericElement::GetInlineStyleRule()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||
PRBool aNotify)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("nsGenericElement::SetInlineStyleRule");
|
||||
|
|
|
@ -456,8 +456,8 @@ public:
|
|||
return nsnull;
|
||||
}
|
||||
virtual nsresult GetSMILOverrideStyle(nsIDOMCSSStyleDeclaration** aStyle);
|
||||
virtual nsICSSStyleRule* GetSMILOverrideStyleRule();
|
||||
virtual nsresult SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
|
||||
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
|
||||
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||
PRBool aNotify);
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
|
@ -473,8 +473,8 @@ public:
|
|||
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
|
||||
NS_IMETHOD_(PRBool)
|
||||
IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
|
@ -961,7 +961,7 @@ public:
|
|||
/**
|
||||
* Holds any SMIL override style rules for this element.
|
||||
*/
|
||||
nsCOMPtr<nsICSSStyleRule> mSMILOverrideStyleRule;
|
||||
nsRefPtr<mozilla::css::StyleRule> mSMILOverrideStyleRule;
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMNamedNodeMap for this content (attributes)
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor_MOZILLA_2_0_BRANCH.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
|
||||
static const PRInt32 kLongLineLen = 128;
|
||||
|
||||
|
@ -105,7 +105,7 @@ IsInvisibleBreak(nsIContent *aNode, nsIAtom *aTag) {
|
|||
if (editorDocShell) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
nsCOMPtr<nsIHTMLEditor_MOZILLA_2_0_BRANCH> htmlEditor = do_QueryInterface(editor);
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
|
||||
if (htmlEditor) {
|
||||
PRBool isVisible = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
|
||||
|
|
|
@ -120,6 +120,10 @@ nsInProcessTabChildGlobal::nsInProcessTabChildGlobal(nsIDocShell* aShell,
|
|||
nsInProcessTabChildGlobal::~nsInProcessTabChildGlobal()
|
||||
{
|
||||
NS_ASSERTION(!mCx, "Couldn't release JSContext?!?");
|
||||
|
||||
if (mListenerManager) {
|
||||
mListenerManager->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -1450,18 +1450,6 @@ nsresult nsRange::CutContents(nsIDOMDocumentFragment** aFragment)
|
|||
}
|
||||
}
|
||||
|
||||
// XXX_kin: At this point we should be checking for the case
|
||||
// XXX_kin: where we have 2 adjacent text nodes left, each
|
||||
// XXX_kin: containing one of the range end points. The spec
|
||||
// XXX_kin: says the 2 nodes should be merged in that case,
|
||||
// XXX_kin: and to use Normalize() to do the merging, but
|
||||
// XXX_kin: calling Normalize() on the common parent to accomplish
|
||||
// XXX_kin: this might also normalize nodes that are outside the
|
||||
// XXX_kin: range but under the common parent. Need to verify
|
||||
// XXX_kin: with the range commitee members that this was the
|
||||
// XXX_kin: desired behavior. For now we don't merge anything!
|
||||
// XXX ajvincent Filed as https://bugzilla.mozilla.org/show_bug.cgi?id=401276
|
||||
|
||||
rv = CollapseRangeAfterDelete(this);
|
||||
if (NS_SUCCEEDED(rv) && aFragment) {
|
||||
NS_ADDREF(*aFragment = retval);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsDOMCSSAttrDeclaration.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
|
@ -57,6 +57,8 @@
|
|||
#include "nsIDOMSVGStylable.h"
|
||||
#endif
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
@ -157,7 +159,7 @@ nsStyledElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
|
||||
nsStyledElement::SetInlineStyleRule(css::StyleRule* aStyleRule, PRBool aNotify)
|
||||
{
|
||||
SetFlags(NODE_MAY_HAVE_STYLE);
|
||||
PRBool modification = PR_FALSE;
|
||||
|
@ -195,7 +197,7 @@ nsStyledElement::SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify)
|
|||
aNotify, nsnull);
|
||||
}
|
||||
|
||||
nsICSSStyleRule*
|
||||
css::StyleRule*
|
||||
nsStyledElement::GetInlineStyleRule()
|
||||
{
|
||||
if (!HasFlag(NODE_MAY_HAVE_STYLE)) {
|
||||
|
@ -320,12 +322,12 @@ nsStyledElement::ParseStyleAttribute(const nsAString& aValue,
|
|||
}
|
||||
|
||||
if (isCSS) {
|
||||
mozilla::css::Loader* cssLoader = doc->CSSLoader();
|
||||
css::Loader* cssLoader = doc->CSSLoader();
|
||||
nsCSSParser cssParser(cssLoader);
|
||||
if (cssParser) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> rule;
|
||||
nsRefPtr<css::StyleRule> rule;
|
||||
cssParser.ParseStyleAttribute(aValue, doc->GetDocumentURI(),
|
||||
baseURI,
|
||||
NodePrincipal(),
|
||||
|
|
|
@ -49,7 +49,11 @@
|
|||
#include "nsString.h"
|
||||
#include "nsGenericElement.h"
|
||||
|
||||
class nsICSSStyleRule;
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
class StyleRule;
|
||||
}
|
||||
}
|
||||
|
||||
typedef nsGenericElement nsStyledElementBase;
|
||||
|
||||
|
@ -70,8 +74,8 @@ public:
|
|||
virtual nsIAtom* DoGetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule, PRBool aNotify);
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
|
|
|
@ -147,8 +147,10 @@ NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
|
|||
nsresult rv = nsContentUtils::CheckSameOrigin(mRoot, aCurrentNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mCurrentNode = do_QueryInterface(aCurrentNode);
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
|
||||
mCurrentNode.swap(node);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
#define PROGRESS_STR "progress"
|
||||
#define UPLOADPROGRESS_STR "uploadprogress"
|
||||
#define READYSTATE_STR "readystatechange"
|
||||
#define LOADEND_STR "loadend"
|
||||
|
||||
// CIDs
|
||||
|
||||
|
@ -125,19 +126,16 @@
|
|||
#define XML_HTTP_REQUEST_ABORTED (1 << 7) // Internal
|
||||
#define XML_HTTP_REQUEST_ASYNC (1 << 8) // Internal
|
||||
#define XML_HTTP_REQUEST_PARSEBODY (1 << 9) // Internal
|
||||
#define XML_HTTP_REQUEST_XSITEENABLED (1 << 10) // Internal, Is any cross-site request allowed?
|
||||
// Even if this is false the
|
||||
// access-control spec is supported
|
||||
#define XML_HTTP_REQUEST_SYNCLOOPING (1 << 11) // Internal
|
||||
#define XML_HTTP_REQUEST_MULTIPART (1 << 12) // Internal
|
||||
#define XML_HTTP_REQUEST_GOT_FINAL_STOP (1 << 13) // Internal
|
||||
#define XML_HTTP_REQUEST_BACKGROUND (1 << 14) // Internal
|
||||
#define XML_HTTP_REQUEST_SYNCLOOPING (1 << 10) // Internal
|
||||
#define XML_HTTP_REQUEST_MULTIPART (1 << 11) // Internal
|
||||
#define XML_HTTP_REQUEST_GOT_FINAL_STOP (1 << 12) // Internal
|
||||
#define XML_HTTP_REQUEST_BACKGROUND (1 << 13) // Internal
|
||||
// This is set when we've got the headers for a multipart XMLHttpRequest,
|
||||
// but haven't yet started to process the first part.
|
||||
#define XML_HTTP_REQUEST_MPART_HEADERS (1 << 15) // Internal
|
||||
#define XML_HTTP_REQUEST_USE_XSITE_AC (1 << 16) // Internal
|
||||
#define XML_HTTP_REQUEST_NEED_AC_PREFLIGHT (1 << 17) // Internal
|
||||
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 18) // Internal
|
||||
#define XML_HTTP_REQUEST_MPART_HEADERS (1 << 14) // Internal
|
||||
#define XML_HTTP_REQUEST_USE_XSITE_AC (1 << 15) // Internal
|
||||
#define XML_HTTP_REQUEST_NEED_AC_PREFLIGHT (1 << 16) // Internal
|
||||
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 17) // Internal
|
||||
|
||||
#define XML_HTTP_REQUEST_LOADSTATES \
|
||||
(XML_HTTP_REQUEST_UNINITIALIZED | \
|
||||
|
@ -518,6 +516,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXHREventTarget,
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnAbortListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadStartListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnLoadendListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXHREventTarget,
|
||||
|
@ -527,6 +526,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXHREventTarget,
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnAbortListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadStartListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnLoadendListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXHREventTarget)
|
||||
|
@ -601,6 +601,19 @@ nsXHREventTarget::SetOnprogress(nsIDOMEventListener* aOnprogress)
|
|||
mOnProgressListener, aOnprogress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::GetOnloadend(nsIDOMEventListener** aOnLoadend)
|
||||
{
|
||||
return GetInnerEventListener(mOnLoadendListener, aOnLoadend);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXHREventTarget::SetOnloadend(nsIDOMEventListener* aOnLoadend)
|
||||
{
|
||||
return RemoveAddEventListener(NS_LITERAL_STRING(LOADEND_STR),
|
||||
mOnLoadendListener, aOnLoadend);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsXMLHttpRequestUpload::~nsXMLHttpRequestUpload()
|
||||
|
@ -1561,6 +1574,10 @@ nsXMLHttpRequest::DispatchProgressEvent(nsPIDOMEventTarget* aTarget,
|
|||
return;
|
||||
}
|
||||
|
||||
PRBool dispatchLoadend = aType.EqualsLiteral(LOAD_STR) ||
|
||||
aType.EqualsLiteral(ERROR_STR) ||
|
||||
aType.EqualsLiteral(ABORT_STR);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsresult rv = nsEventDispatcher::CreateEvent(nsnull, nsnull,
|
||||
NS_LITERAL_STRING("ProgressEvent"),
|
||||
|
@ -1592,8 +1609,14 @@ nsXMLHttpRequest::DispatchProgressEvent(nsPIDOMEventTarget* aTarget,
|
|||
event = xhrprogressEvent;
|
||||
}
|
||||
aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
|
||||
|
||||
if (dispatchLoadend) {
|
||||
DispatchProgressEvent(aTarget, NS_LITERAL_STRING(LOADEND_STR),
|
||||
aUseLSEventWrapper, aLengthComputable,
|
||||
aLoaded, aTotal, aPosition, aTotalSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
already_AddRefed<nsIHttpChannel>
|
||||
nsXMLHttpRequest::GetCurrentHttpChannel()
|
||||
{
|
||||
|
@ -1613,14 +1636,12 @@ nsXMLHttpRequest::GetCurrentHttpChannel()
|
|||
nsresult
|
||||
nsXMLHttpRequest::CheckChannelForCrossSiteRequest(nsIChannel* aChannel)
|
||||
{
|
||||
// First check if cross-site requests are enabled
|
||||
if ((mState & XML_HTTP_REQUEST_XSITEENABLED)) {
|
||||
// First check if cross-site requests are enabled...
|
||||
if (IsSystemXHR()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// or if this is a same-origin request.
|
||||
NS_ASSERTION(!nsContentUtils::IsSystemPrincipal(mPrincipal),
|
||||
"Shouldn't get here!");
|
||||
// ...or if this is a same-origin request.
|
||||
if (nsContentUtils::CheckMayLoad(mPrincipal, aChannel)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1771,12 +1792,6 @@ nsXMLHttpRequest::OpenRequest(const nsACString& method,
|
|||
channelPolicy);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Check if we're doing a cross-origin request.
|
||||
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
|
||||
// Chrome callers are always allowed to read from different origins.
|
||||
mState |= XML_HTTP_REQUEST_XSITEENABLED;
|
||||
}
|
||||
|
||||
mState &= ~(XML_HTTP_REQUEST_USE_XSITE_AC |
|
||||
XML_HTTP_REQUEST_NEED_AC_PREFLIGHT);
|
||||
|
||||
|
@ -1797,17 +1812,6 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
|
|||
PRBool async, const nsAString& user,
|
||||
const nsAString& password, PRUint8 optional_argc)
|
||||
{
|
||||
if (nsContentUtils::GetCurrentJSContext()) {
|
||||
// We're (likely) called from JS
|
||||
|
||||
// Find out if UniversalBrowserRead privileges are enabled
|
||||
if (nsContentUtils::IsCallerTrustedForRead()) {
|
||||
mState |= XML_HTTP_REQUEST_XSITEENABLED;
|
||||
} else {
|
||||
mState &= ~XML_HTTP_REQUEST_XSITEENABLED;
|
||||
}
|
||||
}
|
||||
|
||||
if (!optional_argc) {
|
||||
// No optional arguments were passed in. Default async to true.
|
||||
async = PR_TRUE;
|
||||
|
@ -1928,8 +1932,8 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
NS_ENSURE_TRUE(channel, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> documentPrincipal = mPrincipal;
|
||||
if (nsContentUtils::IsSystemPrincipal(documentPrincipal)) {
|
||||
nsCOMPtr<nsIPrincipal> documentPrincipal;
|
||||
if (IsSystemXHR()) {
|
||||
// Don't give this document the system principal. We need to keep track of
|
||||
// mPrincipal being system because we use it for various security checks
|
||||
// that should be passing, but the document data shouldn't get a system
|
||||
|
@ -1937,6 +1941,8 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
nsresult rv;
|
||||
documentPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
documentPrincipal = mPrincipal;
|
||||
}
|
||||
|
||||
channel->SetOwner(documentPrincipal);
|
||||
|
@ -2014,7 +2020,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
nsCOMPtr<nsIDocument> responseDoc = do_QueryInterface(mResponseXML);
|
||||
responseDoc->SetPrincipal(documentPrincipal);
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
|
||||
if (IsSystemXHR()) {
|
||||
responseDoc->ForceEnableXULXBL();
|
||||
}
|
||||
|
||||
|
@ -2394,7 +2400,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
|||
if (httpChannel) {
|
||||
httpChannel->GetRequestMethod(method); // If GET, method name will be uppercase
|
||||
|
||||
if (!nsContentUtils::IsSystemPrincipal(mPrincipal)) {
|
||||
if (!IsSystemXHR()) {
|
||||
// Get the referrer for the request.
|
||||
//
|
||||
// If it weren't for history.push/replaceState, we could just use the
|
||||
|
@ -2630,7 +2636,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_XSITEENABLED)) {
|
||||
if (!IsSystemXHR()) {
|
||||
// Always create a nsCrossSiteListenerProxy here even if it's
|
||||
// a same-origin request right now, since it could be redirected.
|
||||
listener = new nsCrossSiteListenerProxy(listener, mPrincipal, mChannel,
|
||||
|
@ -2827,7 +2833,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
}
|
||||
|
||||
// Check for dangerous cross-site headers
|
||||
PRBool safeHeader = !!(mState & XML_HTTP_REQUEST_XSITEENABLED);
|
||||
bool safeHeader = IsSystemXHR();
|
||||
if (!safeHeader) {
|
||||
// Content-Type isn't always safe, but we'll deal with it in Send()
|
||||
const char *kCrossOriginSafeHeaders[] = {
|
||||
|
@ -2836,7 +2842,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
};
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(kCrossOriginSafeHeaders); ++i) {
|
||||
if (header.LowerCaseEqualsASCII(kCrossOriginSafeHeaders[i])) {
|
||||
safeHeader = PR_TRUE;
|
||||
safeHeader = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsDOMProgressEvent.h"
|
||||
#include "nsDOMEventTargetWrapperCache.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
class nsILoadGroup;
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
|
@ -157,6 +158,7 @@ protected:
|
|||
nsRefPtr<nsDOMEventListenerWrapper> mOnAbortListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadStartListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnProgressListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnLoadendListener;
|
||||
};
|
||||
|
||||
class nsXMLHttpRequestUpload : public nsXHREventTarget,
|
||||
|
@ -332,6 +334,10 @@ protected:
|
|||
|
||||
already_AddRefed<nsIHttpChannel> GetCurrentHttpChannel();
|
||||
|
||||
bool IsSystemXHR() {
|
||||
return !!nsContentUtils::IsSystemPrincipal(mPrincipal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if aChannel is ok for a cross-site request by making sure no
|
||||
* inappropriate headers are set, and no username/password is set.
|
||||
|
|
|
@ -249,6 +249,8 @@ _TEST_FILES1 = test_bug5141.html \
|
|||
test_bug454325.html \
|
||||
file_bug391728_2.html \
|
||||
test_bug456262.html \
|
||||
test_bug482935.html \
|
||||
bug482935.sjs \
|
||||
test_bug590870.html \
|
||||
file_bug590870.html \
|
||||
test_bug590812.html \
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
function handleRequest(request, response) {
|
||||
var body = "initial";
|
||||
|
||||
try {
|
||||
body = request.getHeader("X-Request");
|
||||
} catch(e) {
|
||||
body = "request.getHeader() failed! Exception: " + e;
|
||||
}
|
||||
|
||||
response.setHeader("Cache-Control", "max-age=3600");
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
}
|
|
@ -59,6 +59,7 @@ _CHROME_FILES = \
|
|||
file_bug549682.xul \
|
||||
test_bug616841.xul \
|
||||
file_bug616841.xul \
|
||||
test_bug635835.xul \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=635835
|
||||
-->
|
||||
<window title="Mozilla Bug 635835"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=635835"
|
||||
target="_blank">Mozilla Bug 635835</a>
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const SHOW_ALL = Components.interfaces.nsIDOMNodeFilter.SHOW_ALL;
|
||||
|
||||
addLoadEvent(function() {
|
||||
var walker = document.createTreeWalker(document, SHOW_ALL, null, true);
|
||||
try {
|
||||
walker.currentNode = {};
|
||||
walker.nextNode();
|
||||
}
|
||||
catch (e) {
|
||||
// do nothing - this is a crash test
|
||||
}
|
||||
ok(true, "Crash test passed");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
]]></script>
|
||||
</window>
|
|
@ -1,4 +1,4 @@
|
|||
<?xml-stylesheet type="text/xsl" href="http://www.mozilla.com/whatever.xsl"?>
|
||||
<?xml-stylesheet type="text/xsl" href="http://example.com/whatever.xsl"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body id='body' onload="if (document.getElementById('body')) parent.iframe1Loaded = true;"/>
|
||||
</html>
|
||||
|
|
|
@ -22,9 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=426308
|
|||
|
||||
const SJS_URL = "http://example.org:80/tests/content/base/test/bug426308-redirect.sjs";
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
||||
|
||||
var req = new XMLHttpRequest();
|
||||
var req = SpecialPowers.createSystemXHR();
|
||||
req.open("GET", SJS_URL + "?" + window.location.href, false);
|
||||
req.send(null);
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ var iframe2Loaded = false;
|
|||
|
||||
function runtests()
|
||||
{
|
||||
//is(iframe1Loaded, true,
|
||||
// "Iframe with cross-origin xslt stylesheet failed to load");
|
||||
todo(iframe1Loaded, true,
|
||||
"Iframe with cross-origin xslt stylesheet failed to load");
|
||||
is(iframe2Loaded, false,
|
||||
"Iframe with invalid xslt stylesheet URI didn't fail to load");
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ function createDoc() {
|
|||
function xhrDoc(idx) {
|
||||
return function() {
|
||||
// Defy same-origin restrictions!
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var xhr = new XMLHttpRequest();
|
||||
var xhr = SpecialPowers.createSystemXHR();
|
||||
xhr.open("GET", docSources[idx], false);
|
||||
xhr.send();
|
||||
return xhr.responseXML;
|
||||
|
|
|
@ -72,17 +72,20 @@ function start(obj) {
|
|||
if (expectedResponseText) {
|
||||
is(evt.target.responseText, expectedResponseText, "Wrong responseText");
|
||||
}
|
||||
stop(evt);
|
||||
logEvent(evt);
|
||||
}
|
||||
xhr.onerror =
|
||||
function(evt) {
|
||||
stop(evt);
|
||||
logEvent(evt);
|
||||
}
|
||||
xhr.onabort =
|
||||
function(evt) {
|
||||
logEvent(evt);
|
||||
}
|
||||
xhr.onloadend =
|
||||
function (evt) {
|
||||
stop(evt);
|
||||
}
|
||||
|
||||
xhr.onloadstart =
|
||||
function (evt) {
|
||||
logEvent(evt);
|
||||
|
@ -117,6 +120,10 @@ function start(obj) {
|
|||
function (evt) {
|
||||
logEvent(evt);
|
||||
}
|
||||
xhr.upload.onloadend =
|
||||
function (evt) {
|
||||
logEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -170,72 +177,92 @@ var tests =
|
|||
{ method: "GET", withUpload: none, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: none, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: none, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: none, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "GET", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: small, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: small, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "GET", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: mid, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: mid, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "GET", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: large, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: large, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "GET", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "POST", withUpload: none, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: none, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: none, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: none, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "error", optional: false}]},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
|
@ -243,27 +270,35 @@ var tests =
|
|||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: small, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
|
@ -271,27 +306,35 @@ var tests =
|
|||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: mid, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
|
@ -299,27 +342,35 @@ var tests =
|
|||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
{target: XHR, type: "progress", optional: true},
|
||||
{target: XHR, type: "load", optional: false}]},
|
||||
{target: XHR, type: "load", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: large, testAbort: true, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "abort", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false}]},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
{target: UPLOAD, type: "error", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false}]},
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test bug 482935</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href=" /tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="onWindowLoad()">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var url = "bug482935.sjs";
|
||||
|
||||
function clearCache() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
Components.classes["@mozilla.org/network/cache-service;1"].
|
||||
getService(Components.interfaces.nsICacheService).
|
||||
evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
|
||||
netscape.security.PrivilegeManager.disablePrivilege("UniversalXPConnect");
|
||||
}
|
||||
|
||||
// Tests that the response is cached if the request is cancelled
|
||||
// after it has reached state 4
|
||||
function testCancelInPhase4() {
|
||||
|
||||
clearCache();
|
||||
|
||||
// First request - should be loaded from server
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("readystatechange", function(e) {
|
||||
if (xhr.readyState >= 4) {
|
||||
xhr.abort();
|
||||
setTimeout(function() {
|
||||
// This request was cancelled, so the responseText should be empty string
|
||||
is(xhr.responseText, "", "Expected empty response to cancelled request");
|
||||
|
||||
// Second request - should be found in cache
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open("GET", url, false); // note : synch-request
|
||||
xhr2.setRequestHeader("X-Request", "1", false);
|
||||
|
||||
try { xhr2.send(); }
|
||||
catch(e) {
|
||||
is(xhr2.status, "200", "Exception!");
|
||||
}
|
||||
|
||||
is(xhr2.responseText, "0", "Received fresh value for second request");
|
||||
|
||||
testCancelBeforePhase4();
|
||||
}, 100);
|
||||
}
|
||||
}, false);
|
||||
|
||||
xhr.open("GET", url, true);
|
||||
xhr.setRequestHeader("X-Request", "0", false);
|
||||
try { xhr.send(); }
|
||||
catch(e) {
|
||||
is("Nothing", "Exception", "Boom: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that response is NOT cached if the request is cancelled
|
||||
// before it has reached state 4
|
||||
function testCancelBeforePhase4() {
|
||||
|
||||
clearCache();
|
||||
|
||||
// First request - should be loaded from server
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("readystatechange", function(e) {
|
||||
if (xhr.readyState == 3) {
|
||||
xhr.abort();
|
||||
setTimeout(function() {
|
||||
// This request was cancelled, so the responseText should be empty string
|
||||
is(xhr.responseText, "", "Expected empty response to cancelled request");
|
||||
|
||||
// Second request - should be found in cache
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open("GET", url, false); // note : synch-request
|
||||
xhr2.setRequestHeader("X-Request", "1", false);
|
||||
|
||||
try { xhr2.send(); }
|
||||
catch(e) {
|
||||
is(xhr2.status, "200", "Exception!");
|
||||
}
|
||||
|
||||
is(xhr2.responseText, "1", "Received cached value for second request");
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 100);
|
||||
}
|
||||
}, false);
|
||||
|
||||
xhr.open("GET", url, true);
|
||||
xhr.setRequestHeader("X-Request", "0", false);
|
||||
try { xhr.send(); }
|
||||
catch(e) {
|
||||
is("Nothing", "Exception", "Boom: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
function onWindowLoad() {
|
||||
testCancelInPhase4();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,196 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert O'Callahan <robert@ocallahan.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "CanvasImageCache.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "gfxASurface.h"
|
||||
#include "gfxPoint.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHTMLCanvasElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct ImageCacheKey {
|
||||
ImageCacheKey(nsIDOMElement* aImage, nsHTMLCanvasElement* aCanvas)
|
||||
: mImage(aImage), mCanvas(aCanvas) {}
|
||||
nsIDOMElement* mImage;
|
||||
nsHTMLCanvasElement* mCanvas;
|
||||
};
|
||||
|
||||
struct ImageCacheEntryData {
|
||||
ImageCacheEntryData(const ImageCacheEntryData& aOther)
|
||||
: mImage(aOther.mImage)
|
||||
, mILC(aOther.mILC)
|
||||
, mCanvas(aOther.mCanvas)
|
||||
, mRequest(aOther.mRequest)
|
||||
, mSurface(aOther.mSurface)
|
||||
, mSize(aOther.mSize)
|
||||
{}
|
||||
ImageCacheEntryData(const ImageCacheKey& aKey)
|
||||
: mImage(aKey.mImage)
|
||||
, mILC(nsnull)
|
||||
, mCanvas(aKey.mCanvas)
|
||||
{}
|
||||
|
||||
nsExpirationState* GetExpirationState() { return &mState; }
|
||||
|
||||
// Key
|
||||
nsCOMPtr<nsIDOMElement> mImage;
|
||||
nsIImageLoadingContent* mILC;
|
||||
nsRefPtr<nsHTMLCanvasElement> mCanvas;
|
||||
// Value
|
||||
nsCOMPtr<imgIRequest> mRequest;
|
||||
nsRefPtr<gfxASurface> mSurface;
|
||||
gfxIntSize mSize;
|
||||
nsExpirationState mState;
|
||||
};
|
||||
|
||||
class ImageCacheEntry : public PLDHashEntryHdr {
|
||||
public:
|
||||
typedef ImageCacheKey KeyType;
|
||||
typedef const ImageCacheKey* KeyTypePointer;
|
||||
|
||||
ImageCacheEntry(const KeyType *key) :
|
||||
mData(new ImageCacheEntryData(*key)) {}
|
||||
ImageCacheEntry(const ImageCacheEntry &toCopy) :
|
||||
mData(new ImageCacheEntryData(*toCopy.mData)) {}
|
||||
~ImageCacheEntry() {}
|
||||
|
||||
PRBool KeyEquals(KeyTypePointer key) const
|
||||
{
|
||||
return mData->mImage == key->mImage && mData->mCanvas == key->mCanvas;
|
||||
}
|
||||
|
||||
static KeyTypePointer KeyToPointer(KeyType& key) { return &key; }
|
||||
static PLDHashNumber HashKey(KeyTypePointer key)
|
||||
{
|
||||
return (NS_PTR_TO_INT32(key->mImage) ^ NS_PTR_TO_INT32(key->mCanvas)) >> 2;
|
||||
}
|
||||
enum { ALLOW_MEMMOVE = PR_TRUE };
|
||||
|
||||
nsAutoPtr<ImageCacheEntryData> mData;
|
||||
};
|
||||
|
||||
class ImageCache : public nsExpirationTracker<ImageCacheEntryData,4> {
|
||||
public:
|
||||
// We use 3 generations of 1 second each to get a 2-3 seconds timeout.
|
||||
enum { GENERATION_MS = 1000 };
|
||||
ImageCache()
|
||||
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS)
|
||||
{
|
||||
mCache.Init();
|
||||
}
|
||||
~ImageCache() {
|
||||
AgeAllGenerations();
|
||||
}
|
||||
|
||||
virtual void NotifyExpired(ImageCacheEntryData* aObject)
|
||||
{
|
||||
RemoveObject(aObject);
|
||||
// Deleting the entry will delete aObject since the entry owns aObject
|
||||
mCache.RemoveEntry(ImageCacheKey(aObject->mImage, aObject->mCanvas));
|
||||
}
|
||||
|
||||
nsTHashtable<ImageCacheEntry> mCache;
|
||||
};
|
||||
|
||||
static ImageCache* gImageCache = nsnull;
|
||||
|
||||
void
|
||||
CanvasImageCache::NotifyDrawImage(nsIDOMElement* aImage,
|
||||
nsHTMLCanvasElement* aCanvas,
|
||||
imgIRequest* aRequest,
|
||||
gfxASurface* aSurface,
|
||||
const gfxIntSize& aSize)
|
||||
{
|
||||
if (!gImageCache) {
|
||||
gImageCache = new ImageCache();
|
||||
}
|
||||
|
||||
ImageCacheEntry* entry = gImageCache->mCache.PutEntry(ImageCacheKey(aImage, aCanvas));
|
||||
if (entry) {
|
||||
if (entry->mData->mSurface) {
|
||||
// We are overwriting an existing entry.
|
||||
gImageCache->RemoveObject(entry->mData);
|
||||
}
|
||||
gImageCache->AddObject(entry->mData);
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> ilc = do_QueryInterface(aImage);
|
||||
if (ilc) {
|
||||
ilc->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
|
||||
getter_AddRefs(entry->mData->mRequest));
|
||||
}
|
||||
entry->mData->mILC = ilc;
|
||||
entry->mData->mSurface = aSurface;
|
||||
entry->mData->mSize = aSize;
|
||||
}
|
||||
}
|
||||
|
||||
gfxASurface*
|
||||
CanvasImageCache::Lookup(nsIDOMElement* aImage,
|
||||
nsHTMLCanvasElement* aCanvas,
|
||||
gfxIntSize* aSize)
|
||||
{
|
||||
if (!gImageCache)
|
||||
return nsnull;
|
||||
|
||||
ImageCacheEntry* entry = gImageCache->mCache.GetEntry(ImageCacheKey(aImage, aCanvas));
|
||||
if (!entry || !entry->mData->mILC)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<imgIRequest> request;
|
||||
entry->mData->mILC->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST, getter_AddRefs(request));
|
||||
if (request != entry->mData->mRequest)
|
||||
return nsnull;
|
||||
|
||||
gImageCache->MarkUsed(entry->mData);
|
||||
|
||||
*aSize = entry->mData->mSize;
|
||||
return entry->mData->mSurface;
|
||||
}
|
||||
|
||||
void
|
||||
CanvasImageCache::Shutdown()
|
||||
{
|
||||
delete gImageCache;
|
||||
gImageCache = nsnull;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,56 +1,77 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Heikki Toivonen <heikki@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* This file implements the xpath1 XPointer scheme.
|
||||
*/
|
||||
|
||||
#ifndef __nsXPath1Scheme_h__
|
||||
#define __nsXPath1Scheme_h__
|
||||
|
||||
#include "nsIXPointer.h"
|
||||
|
||||
class nsXPath1SchemeProcessor : public nsIXPointerSchemeProcessor
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIXPOINTERSCHEMEPROCESSOR
|
||||
};
|
||||
|
||||
#endif
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert O'Callahan <robert@ocallahan.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef CANVASIMAGECACHE_H_
|
||||
#define CANVASIMAGECACHE_H_
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsHTMLCanvasElement;
|
||||
class imgIRequest;
|
||||
class gfxASurface;
|
||||
struct gfxIntSize;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class CanvasImageCache {
|
||||
public:
|
||||
/**
|
||||
* Notify that image element aImage was (or is about to be) drawn to aCanvas
|
||||
* using the first frame of aRequest's image. The data for the surface is
|
||||
* in aSurface, and the image size is in aSize.
|
||||
*/
|
||||
static void NotifyDrawImage(nsIDOMElement* aImage,
|
||||
nsHTMLCanvasElement* aCanvas,
|
||||
imgIRequest* aRequest,
|
||||
gfxASurface* aSurface,
|
||||
const gfxIntSize& aSize);
|
||||
|
||||
/**
|
||||
* Check whether aImage has recently been drawn into aCanvas. If we return
|
||||
* a non-null surface, then the image was recently drawn into the canvas
|
||||
* (with the same image request) and the returned surface contains the image
|
||||
* data, and the image size will be returned in aSize.
|
||||
*/
|
||||
static gfxASurface* Lookup(nsIDOMElement* aImage,
|
||||
nsHTMLCanvasElement* aCanvas,
|
||||
gfxIntSize* aSize);
|
||||
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* CANVASIMAGECACHE_H_ */
|
|
@ -83,16 +83,13 @@ CanvasUtils::DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
|
|||
if (aPrincipal == nsnull)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsINode> elem = do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(aCanvasElement));
|
||||
if (elem) { // XXXbz How could this actually be null?
|
||||
PRBool subsumes;
|
||||
nsresult rv =
|
||||
elem->NodePrincipal()->Subsumes(aPrincipal, &subsumes);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && subsumes) {
|
||||
// This canvas has access to that image anyway
|
||||
return;
|
||||
}
|
||||
PRBool subsumes;
|
||||
nsresult rv =
|
||||
aCanvasElement->NodePrincipal()->Subsumes(aPrincipal, &subsumes);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && subsumes) {
|
||||
// This canvas has access to that image anyway
|
||||
return;
|
||||
}
|
||||
|
||||
aCanvasElement->SetWriteOnly();
|
||||
|
|
|
@ -52,6 +52,7 @@ EXPORTS = \
|
|||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
CanvasImageCache.cpp \
|
||||
CanvasUtils.cpp \
|
||||
nsCanvasRenderingContext2D.cpp \
|
||||
$(NULL)
|
||||
|
|
|
@ -749,7 +749,6 @@ DOMCI_DATA(WebGLRenderingContext, WebGLContext)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWebGLRenderingContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWebGLRenderingContext_MOZILLA_2_0_BRANCH)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext)
|
||||
|
|
|
@ -315,7 +315,6 @@ struct WebGLContextOptions {
|
|||
|
||||
class WebGLContext :
|
||||
public nsIDOMWebGLRenderingContext,
|
||||
public nsIDOMWebGLRenderingContext_MOZILLA_2_0_BRANCH,
|
||||
public nsICanvasRenderingContextInternal,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
|
@ -328,7 +327,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(WebGLContext, nsIDOMWebGLRenderingContext)
|
||||
|
||||
NS_DECL_NSIDOMWEBGLRENDERINGCONTEXT
|
||||
NS_DECL_NSIDOMWEBGLRENDERINGCONTEXT_MOZILLA_2_0_BRANCH
|
||||
|
||||
// nsICanvasRenderingContextInternal
|
||||
NS_IMETHOD SetCanvasElement(nsHTMLCanvasElement* aParentCanvas);
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
#include "nsIScriptError.h"
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
@ -111,18 +111,13 @@
|
|||
#include "gfxUtils.h"
|
||||
|
||||
#include "nsFrameManager.h"
|
||||
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
|
||||
#include "CanvasUtils.h"
|
||||
|
||||
#include "nsIMemoryReporter.h"
|
||||
|
||||
#include "nsStyleUtil.h"
|
||||
#include "CanvasImageCache.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
# include <algorithm>
|
||||
|
@ -416,8 +411,10 @@ public:
|
|||
LayerManager *aManager);
|
||||
void MarkContextClean();
|
||||
NS_IMETHOD SetIsIPC(PRBool isIPC);
|
||||
// this rect is in CSS pixels
|
||||
// this rect is in canvas device space
|
||||
NS_IMETHOD Redraw(const gfxRect &r);
|
||||
// this rect is in mThebes's current user space
|
||||
NS_IMETHOD RedrawUser(const gfxRect &r);
|
||||
|
||||
// nsISupports interface + CC
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
@ -434,6 +431,29 @@ public:
|
|||
STYLE_MAX
|
||||
};
|
||||
|
||||
class PathAutoSaveRestore
|
||||
{
|
||||
public:
|
||||
PathAutoSaveRestore(nsCanvasRenderingContext2D* aCtx) :
|
||||
mContext(aCtx->mThebes)
|
||||
{
|
||||
if (aCtx->mHasPath) {
|
||||
mPath = mContext->CopyPath();
|
||||
}
|
||||
}
|
||||
~PathAutoSaveRestore()
|
||||
{
|
||||
mContext->NewPath();
|
||||
if (mPath) {
|
||||
mContext->AppendPath(mPath);
|
||||
}
|
||||
}
|
||||
private:
|
||||
gfxContext *mContext;
|
||||
nsRefPtr<gfxPath> mPath;
|
||||
};
|
||||
friend class PathAutoSaveRestore;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
@ -508,7 +528,17 @@ protected:
|
|||
* Flag to avoid duplicate calls to InvalidateFrame. Set to true whenever
|
||||
* Redraw is called, reset to false when Render is called.
|
||||
*/
|
||||
PRBool mIsEntireFrameInvalid;
|
||||
PRPackedBool mIsEntireFrameInvalid;
|
||||
/**
|
||||
* When this is set, the first call to Redraw(gfxRect) should set
|
||||
* mIsEntireFrameInvalid since we expect it will be followed by
|
||||
* many more Redraw calls.
|
||||
*/
|
||||
PRPackedBool mPredictManyRedrawCalls;
|
||||
/**
|
||||
* This is set whenever there's a nonempty path set by the API user.
|
||||
*/
|
||||
PRPackedBool mHasPath;
|
||||
|
||||
/**
|
||||
* Number of times we've invalidated before calling redraw
|
||||
|
@ -608,7 +638,7 @@ protected:
|
|||
* Draws the current path in the given style. Takes care of
|
||||
* any shadow drawing and will use intermediate surfaces as needed.
|
||||
*
|
||||
* If dirtyRect is given, it will contain the device-space dirty
|
||||
* If dirtyRect is given, it will contain the user-space dirty
|
||||
* rectangle of the draw operation.
|
||||
*/
|
||||
nsresult DrawPath(Style style, gfxRect *dirtyRect = nsnull);
|
||||
|
@ -826,7 +856,8 @@ nsCanvasRenderingContext2D::nsCanvasRenderingContext2D()
|
|||
: mValid(PR_FALSE), mOpaque(PR_FALSE), mResetLayer(PR_TRUE)
|
||||
, mIPC(PR_FALSE)
|
||||
, mCanvasElement(nsnull)
|
||||
, mSaveCount(0), mIsEntireFrameInvalid(PR_FALSE), mInvalidateCount(0)
|
||||
, mSaveCount(0), mIsEntireFrameInvalid(PR_FALSE)
|
||||
, mPredictManyRedrawCalls(PR_FALSE), mHasPath(PR_FALSE), mInvalidateCount(0)
|
||||
, mLastStyle(STYLE_MAX), mStyleStack(20)
|
||||
{
|
||||
sNumLivingContexts++;
|
||||
|
@ -856,6 +887,7 @@ nsCanvasRenderingContext2D::Reset()
|
|||
mThebes = nsnull;
|
||||
mValid = PR_FALSE;
|
||||
mIsEntireFrameInvalid = PR_FALSE;
|
||||
mPredictManyRedrawCalls = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1019,6 +1051,10 @@ nsCanvasRenderingContext2D::ApplyStyle(Style aWhichStyle,
|
|||
nsresult
|
||||
nsCanvasRenderingContext2D::Redraw()
|
||||
{
|
||||
if (mIsEntireFrameInvalid)
|
||||
return NS_OK;
|
||||
mIsEntireFrameInvalid = PR_TRUE;
|
||||
|
||||
if (!mCanvasElement) {
|
||||
NS_ASSERTION(mDocShell, "Redraw with no canvas element or docshell!");
|
||||
return NS_OK;
|
||||
|
@ -1028,11 +1064,6 @@ nsCanvasRenderingContext2D::Redraw()
|
|||
nsSVGEffects::InvalidateDirectRenderingObservers(HTMLCanvasElement());
|
||||
#endif
|
||||
|
||||
if (mIsEntireFrameInvalid)
|
||||
return NS_OK;
|
||||
|
||||
mIsEntireFrameInvalid = PR_TRUE;
|
||||
|
||||
HTMLCanvasElement()->InvalidateFrame();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1041,6 +1072,16 @@ nsCanvasRenderingContext2D::Redraw()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Redraw(const gfxRect& r)
|
||||
{
|
||||
++mInvalidateCount;
|
||||
|
||||
if (mIsEntireFrameInvalid)
|
||||
return NS_OK;
|
||||
|
||||
if (mPredictManyRedrawCalls ||
|
||||
mInvalidateCount > kCanvasMaxInvalidateCount) {
|
||||
return Redraw();
|
||||
}
|
||||
|
||||
if (!mCanvasElement) {
|
||||
NS_ASSERTION(mDocShell, "Redraw with no canvas element or docshell!");
|
||||
return NS_OK;
|
||||
|
@ -1050,17 +1091,22 @@ nsCanvasRenderingContext2D::Redraw(const gfxRect& r)
|
|||
nsSVGEffects::InvalidateDirectRenderingObservers(HTMLCanvasElement());
|
||||
#endif
|
||||
|
||||
if (mIsEntireFrameInvalid)
|
||||
return NS_OK;
|
||||
|
||||
if (++mInvalidateCount > kCanvasMaxInvalidateCount)
|
||||
return Redraw();
|
||||
|
||||
HTMLCanvasElement()->InvalidateFrame(&r);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::RedrawUser(const gfxRect& r)
|
||||
{
|
||||
if (mIsEntireFrameInvalid) {
|
||||
++mInvalidateCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return Redraw(mThebes->UserToDevice(r));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
{
|
||||
|
@ -1919,8 +1965,6 @@ nsCanvasRenderingContext2D::DrawPath(Style style, gfxRect *dirtyRect)
|
|||
// just use the clip extents
|
||||
*dirtyRect = mThebes->GetClipExtents();
|
||||
}
|
||||
|
||||
*dirtyRect = mThebes->UserToDevice(*dirtyRect);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1936,7 +1980,7 @@ nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
|||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
gfxContextPathAutoSaveRestore pathSR(mThebes);
|
||||
PathAutoSaveRestore pathSR(this);
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
|
||||
mThebes->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||
|
@ -1944,8 +1988,7 @@ nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
|||
mThebes->Rectangle(gfxRect(x, y, w, h));
|
||||
mThebes->Fill();
|
||||
|
||||
gfxRect dirty = mThebes->UserToDevice(mThebes->GetUserPathExtent());
|
||||
return Redraw(dirty);
|
||||
return RedrawUser(mThebes->GetUserPathExtent());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1954,7 +1997,7 @@ nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
|
|||
if (!FloatValidate(rect.pos.x, rect.pos.y, rect.size.width, rect.size.height))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
gfxContextPathAutoSaveRestore pathSR(mThebes);
|
||||
PathAutoSaveRestore pathSR(this);
|
||||
|
||||
mThebes->NewPath();
|
||||
mThebes->Rectangle(rect);
|
||||
|
@ -1964,7 +2007,7 @@ nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return Redraw(dirty);
|
||||
return RedrawUser(dirty);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1986,6 +2029,7 @@ nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::BeginPath()
|
||||
{
|
||||
mHasPath = PR_FALSE;
|
||||
mThebes->NewPath();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2004,7 +2048,7 @@ nsCanvasRenderingContext2D::Fill()
|
|||
nsresult rv = DrawPath(STYLE_FILL, &dirty);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return Redraw(dirty);
|
||||
return RedrawUser(dirty);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2014,7 +2058,7 @@ nsCanvasRenderingContext2D::Stroke()
|
|||
nsresult rv = DrawPath(STYLE_STROKE, &dirty);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return Redraw(dirty);
|
||||
return RedrawUser(dirty);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2030,6 +2074,7 @@ nsCanvasRenderingContext2D::MoveTo(float x, float y)
|
|||
if (!FloatValidate(x,y))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
mThebes->MoveTo(gfxPoint(x, y));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2040,6 +2085,7 @@ nsCanvasRenderingContext2D::LineTo(float x, float y)
|
|||
if (!FloatValidate(x,y))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
mThebes->LineTo(gfxPoint(x, y));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2056,6 +2102,7 @@ nsCanvasRenderingContext2D::QuadraticCurveTo(float cpx, float cpy, float x, floa
|
|||
gfxPoint p(x,y);
|
||||
gfxPoint cp(cpx, cpy);
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
mThebes->CurveTo((c+cp*2)/3.0, (p+cp*2)/3.0, p);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -2069,6 +2116,7 @@ nsCanvasRenderingContext2D::BezierCurveTo(float cp1x, float cp1y,
|
|||
if (!FloatValidate(cp1x,cp1y,cp2x,cp2y,x,y))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
mThebes->CurveTo(gfxPoint(cp1x, cp1y),
|
||||
gfxPoint(cp2x, cp2y),
|
||||
gfxPoint(x, y));
|
||||
|
@ -2085,6 +2133,8 @@ nsCanvasRenderingContext2D::ArcTo(float x1, float y1, float x2, float y2, float
|
|||
if (radius < 0)
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
|
||||
gfxPoint p0 = mThebes->CurrentPoint();
|
||||
|
||||
double dir, a2, b2, c2, cosx, sinx, d, anx, any, bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1;
|
||||
|
@ -2144,6 +2194,7 @@ nsCanvasRenderingContext2D::Arc(float x, float y, float r, float startAngle, flo
|
|||
|
||||
gfxPoint p(x,y);
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
if (ccw)
|
||||
mThebes->NegativeArc(p, r, startAngle, endAngle);
|
||||
else
|
||||
|
@ -2157,6 +2208,7 @@ nsCanvasRenderingContext2D::Rect(float x, float y, float w, float h)
|
|||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
mHasPath = PR_TRUE;
|
||||
mThebes->Rectangle(gfxRect(x, y, w, h));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2175,9 +2227,9 @@ nsCanvasRenderingContext2D::Rect(float x, float y, float w, float h)
|
|||
static nsresult
|
||||
CreateFontStyleRule(const nsAString& aFont,
|
||||
nsINode* aNode,
|
||||
nsICSSStyleRule** aResult)
|
||||
css::StyleRule** aResult)
|
||||
{
|
||||
nsCOMPtr<nsICSSStyleRule> rule;
|
||||
nsRefPtr<css::StyleRule> rule;
|
||||
PRBool changed;
|
||||
|
||||
nsIPrincipal* principal = aNode->NodePrincipal();
|
||||
|
@ -2241,7 +2293,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
|||
|
||||
nsCOMArray<nsIStyleRule> rules;
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> rule;
|
||||
nsRefPtr<css::StyleRule> rule;
|
||||
rv = CreateFontStyleRule(font, document, getter_AddRefs(rule));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -2278,7 +2330,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
|||
presShell);
|
||||
} else {
|
||||
// otherwise inherit from default (10px sans-serif)
|
||||
nsCOMPtr<nsICSSStyleRule> parentRule;
|
||||
nsRefPtr<css::StyleRule> parentRule;
|
||||
rv = CreateFontStyleRule(NS_LITERAL_STRING("10px sans-serif"),
|
||||
document,
|
||||
getter_AddRefs(parentRule));
|
||||
|
@ -2320,7 +2372,6 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
|
|||
language,
|
||||
fontStyle->mFont.sizeAdjust,
|
||||
fontStyle->mFont.systemFont,
|
||||
fontStyle->mFont.familyNameQuirks,
|
||||
printerFont,
|
||||
fontStyle->mFont.featureSettings,
|
||||
fontStyle->mFont.languageOverride);
|
||||
|
@ -2724,21 +2775,20 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
|
||||
switch (CurrentState().textBaseline)
|
||||
{
|
||||
case TEXT_BASELINE_HANGING:
|
||||
// fall through; best we can do with the information available
|
||||
case TEXT_BASELINE_TOP:
|
||||
anchorY = fontMetrics.emAscent;
|
||||
break;
|
||||
case TEXT_BASELINE_HANGING:
|
||||
anchorY = 0; // currently unavailable
|
||||
break;
|
||||
case TEXT_BASELINE_MIDDLE:
|
||||
anchorY = (fontMetrics.emAscent - fontMetrics.emDescent) * .5f;
|
||||
break;
|
||||
case TEXT_BASELINE_IDEOGRAPHIC:
|
||||
// fall through; best we can do with the information available
|
||||
case TEXT_BASELINE_ALPHABETIC:
|
||||
anchorY = 0;
|
||||
break;
|
||||
case TEXT_BASELINE_IDEOGRAPHIC:
|
||||
anchorY = 0; // currently unvailable
|
||||
break;
|
||||
case TEXT_BASELINE_BOTTOM:
|
||||
anchorY = -fontMetrics.emDescent;
|
||||
break;
|
||||
|
@ -2855,7 +2905,7 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
mThebes->Paint(CurrentState().StyleIsColor(STYLE_FILL) ? 1.0 : CurrentState().globalAlpha);
|
||||
|
||||
if (aOp == nsCanvasRenderingContext2D::TEXT_DRAW_OPERATION_FILL && !doDrawShadow)
|
||||
return Redraw(mThebes->UserToDevice(boundingBox));
|
||||
return RedrawUser(boundingBox);
|
||||
|
||||
return Redraw();
|
||||
}
|
||||
|
@ -3013,21 +3063,23 @@ nsCanvasRenderingContext2D::MozTextAlongPath(const nsAString& textToDraw, PRBool
|
|||
|
||||
gfxPoint position(0.0,0.0);
|
||||
gfxFloat x = position.x;
|
||||
for (PRUint32 i = 0; i < strLength; i++)
|
||||
{
|
||||
gfxFloat halfAdvance = textRun->GetAdvanceWidth(i, 1, nsnull) / (2.0 * aupdp);
|
||||
|
||||
// Check for end of path
|
||||
if(x + halfAdvance > length)
|
||||
gfxTextRun::ClusterIterator iter(textRun.get());
|
||||
while (iter.NextCluster()) {
|
||||
gfxFloat halfAdvance = iter.ClusterAdvance(nsnull) / (2.0 * aupdp);
|
||||
if (x + halfAdvance > length) {
|
||||
break;
|
||||
|
||||
if(x + halfAdvance >= 0)
|
||||
{
|
||||
cp[i].draw = PR_TRUE;
|
||||
gfxPoint pt = path->FindPoint(gfxPoint(x + halfAdvance, position.y), &(cp[i].angle));
|
||||
|
||||
cp[i].pos = pt - gfxPoint(cos(cp[i].angle), sin(cp[i].angle)) * halfAdvance;
|
||||
}
|
||||
|
||||
if (x + halfAdvance >= 0) {
|
||||
cp[iter.Position()].draw = PR_TRUE;
|
||||
gfxPoint pt = path->FindPoint(gfxPoint(x + halfAdvance, position.y),
|
||||
&(cp[iter.Position()].angle));
|
||||
cp[iter.Position()].pos =
|
||||
pt - gfxPoint(cos(cp[iter.Position()].angle),
|
||||
sin(cp[iter.Position()].angle)) * halfAdvance;
|
||||
}
|
||||
|
||||
x += 2 * halfAdvance;
|
||||
}
|
||||
|
||||
|
@ -3038,25 +3090,30 @@ nsCanvasRenderingContext2D::MozTextAlongPath(const nsAString& textToDraw, PRBool
|
|||
ApplyStyle(STYLE_FILL);
|
||||
}
|
||||
|
||||
for(PRUint32 i = 0; i < strLength; i++)
|
||||
{
|
||||
iter.Reset();
|
||||
while (iter.NextCluster()) {
|
||||
// Skip non-visible characters
|
||||
if(!cp[i].draw) continue;
|
||||
if (!cp[iter.Position()].draw) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gfxMatrix matrix = mThebes->CurrentMatrix();
|
||||
|
||||
gfxMatrix rot;
|
||||
rot.Rotate(cp[i].angle);
|
||||
rot.Rotate(cp[iter.Position()].angle);
|
||||
mThebes->Multiply(rot);
|
||||
|
||||
rot.Invert();
|
||||
rot.Scale(aupdp,aupdp);
|
||||
gfxPoint pt = rot.Transform(cp[i].pos);
|
||||
gfxPoint pt = rot.Transform(cp[iter.Position()].pos);
|
||||
|
||||
if(stroke) {
|
||||
textRun->DrawToPath(mThebes, pt, i, 1, nsnull, nsnull);
|
||||
if (stroke) {
|
||||
textRun->DrawToPath(mThebes, pt,
|
||||
iter.Position(), iter.ClusterLength(),
|
||||
nsnull, nsnull);
|
||||
} else {
|
||||
textRun->Draw(mThebes, pt, i, 1, nsnull, nsnull);
|
||||
textRun->Draw(mThebes, pt, iter.Position(), iter.ClusterLength(),
|
||||
nsnull, nsnull);
|
||||
}
|
||||
mThebes->SetMatrix(matrix);
|
||||
}
|
||||
|
@ -3310,48 +3367,50 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
{
|
||||
NS_ENSURE_ARG(imgElt);
|
||||
|
||||
nsresult rv;
|
||||
gfxRect dirty(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
double sx,sy,sw,sh;
|
||||
double dx,dy,dw,dh;
|
||||
|
||||
gfxMatrix matrix;
|
||||
nsRefPtr<gfxPattern> pattern;
|
||||
nsRefPtr<gfxPath> path;
|
||||
gfxIntSize imgSize;
|
||||
nsRefPtr<gfxASurface> imgsurf =
|
||||
CanvasImageCache::Lookup(imgElt, HTMLCanvasElement(), &imgSize);
|
||||
|
||||
// The canvas spec says that drawImage should draw the first frame
|
||||
// of animated images
|
||||
PRUint32 sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME;
|
||||
nsLayoutUtils::SurfaceFromElementResult res =
|
||||
nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
|
||||
if (!res.mSurface) {
|
||||
// Spec says to silently do nothing if the element is still loading.
|
||||
return res.mIsStillLoading ? NS_OK : NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
if (!imgsurf) {
|
||||
// The canvas spec says that drawImage should draw the first frame
|
||||
// of animated images
|
||||
PRUint32 sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME;
|
||||
nsLayoutUtils::SurfaceFromElementResult res =
|
||||
nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
|
||||
if (!res.mSurface) {
|
||||
// Spec says to silently do nothing if the element is still loading.
|
||||
return res.mIsStillLoading ? NS_OK : NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
// On non-CE, force a copy if we're using drawImage with our destination
|
||||
// as a source to work around some Cairo self-copy semantics issues.
|
||||
if (res.mSurface == mSurface) {
|
||||
sfeFlags |= nsLayoutUtils::SFE_WANT_NEW_SURFACE;
|
||||
res = nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
|
||||
if (!res.mSurface)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
// On non-CE, force a copy if we're using drawImage with our destination
|
||||
// as a source to work around some Cairo self-copy semantics issues.
|
||||
if (res.mSurface == mSurface) {
|
||||
sfeFlags |= nsLayoutUtils::SFE_WANT_NEW_SURFACE;
|
||||
res = nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
|
||||
if (!res.mSurface)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsRefPtr<gfxASurface> imgsurf = res.mSurface;
|
||||
nsCOMPtr<nsIPrincipal> principal = res.mPrincipal;
|
||||
gfxIntSize imgSize = res.mSize;
|
||||
PRBool forceWriteOnly = res.mIsWriteOnly;
|
||||
imgsurf = res.mSurface.forget();
|
||||
imgSize = res.mSize;
|
||||
|
||||
if (mCanvasElement)
|
||||
CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(), principal, forceWriteOnly);
|
||||
if (mCanvasElement) {
|
||||
CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(),
|
||||
res.mPrincipal, res.mIsWriteOnly);
|
||||
}
|
||||
|
||||
gfxContextPathAutoSaveRestore pathSR(mThebes, PR_FALSE);
|
||||
|
||||
rv = NS_OK;
|
||||
if (res.mImageRequest) {
|
||||
CanvasImageCache::NotifyDrawImage(imgElt, HTMLCanvasElement(),
|
||||
res.mImageRequest, imgsurf, imgSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_argc == 0) {
|
||||
dx = a1;
|
||||
|
@ -3378,20 +3437,17 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
dh = a8;
|
||||
} else {
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
rv = NS_ERROR_INVALID_ARG;
|
||||
goto FINISH;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (dw == 0.0 || dh == 0.0) {
|
||||
rv = NS_OK;
|
||||
// not really failure, but nothing to do --
|
||||
// and noone likes a divide-by-zero
|
||||
goto FINISH;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!FloatValidate(sx, sy, sw, sh) || !FloatValidate(dx, dy, dw, dh)) {
|
||||
rv = NS_ERROR_DOM_SYNTAX_ERR;
|
||||
goto FINISH;
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
// check args
|
||||
|
@ -3401,8 +3457,7 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
dw < 0.0 || dh < 0.0)
|
||||
{
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
rv = NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
goto FINISH;
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
matrix.Translate(gfxPoint(sx, sy));
|
||||
|
@ -3429,8 +3484,7 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
|
||||
if (opaque && unscaled) {
|
||||
bitblt(surf, sx, sy, sw, sh, dx, dy);
|
||||
rv = NS_OK;
|
||||
goto FINISH;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3445,15 +3499,17 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
else
|
||||
pattern->SetFilter(gfxPattern::FILTER_NEAREST);
|
||||
|
||||
pathSR.Save();
|
||||
PathAutoSaveRestore pathSR(this);
|
||||
|
||||
// Clear the surface if we need to simulate unbounded SOURCE operator
|
||||
ClearSurfaceForUnboundedSource();
|
||||
|
||||
{
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
gfxContextMatrixAutoSaveRestore autoMatrixSR(mThebes);
|
||||
|
||||
mThebes->Translate(gfxPoint(dx, dy));
|
||||
mThebes->SetPattern(pattern);
|
||||
DirtyAllStyles();
|
||||
|
||||
gfxRect clip(0, 0, dw, dh);
|
||||
|
||||
|
@ -3474,11 +3530,9 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
}
|
||||
|
||||
PRBool doUseIntermediateSurface = NeedToUseIntermediateSurface();
|
||||
|
||||
mThebes->SetPattern(pattern);
|
||||
DirtyAllStyles();
|
||||
|
||||
if (doUseIntermediateSurface) {
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
|
||||
// draw onto a pushed group
|
||||
mThebes->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
||||
mThebes->Clip(clip);
|
||||
|
@ -3496,18 +3550,17 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
mThebes->Rectangle(clip);
|
||||
mThebes->Fill();
|
||||
} else {
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
|
||||
/* we need to use to clip instead of fill for globalAlpha */
|
||||
mThebes->Clip(clip);
|
||||
mThebes->Paint(CurrentState().globalAlpha);
|
||||
}
|
||||
dirty = mThebes->UserToDevice(clip);
|
||||
|
||||
RedrawUser(clip);
|
||||
}
|
||||
|
||||
FINISH:
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = Redraw(dirty);
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3658,9 +3711,7 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
|
|||
// note that aX and aY are coordinates in the document that
|
||||
// we're drawing; aX and aY are drawn to 0,0 in current user
|
||||
// space.
|
||||
gfxRect damageRect = mThebes->UserToDevice(gfxRect(0, 0, aW, aH));
|
||||
|
||||
Redraw(damageRect);
|
||||
RedrawUser(gfxRect(0, 0, aW, aH));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -3991,7 +4042,7 @@ nsCanvasRenderingContext2D::PutImageData_explicit(PRInt32 x, PRInt32 y, PRUint32
|
|||
}
|
||||
}
|
||||
|
||||
gfxContextPathAutoSaveRestore pathSR(mThebes);
|
||||
PathAutoSaveRestore pathSR(this);
|
||||
gfxContextAutoSaveRestore autoSR(mThebes);
|
||||
|
||||
// ignore clipping region, as per spec
|
||||
|
@ -4096,6 +4147,9 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
|
|||
void
|
||||
nsCanvasRenderingContext2D::MarkContextClean()
|
||||
{
|
||||
if (mInvalidateCount > 0) {
|
||||
mPredictManyRedrawCalls = mInvalidateCount > kCanvasMaxInvalidateCount;
|
||||
}
|
||||
mIsEntireFrameInvalid = PR_FALSE;
|
||||
mInvalidateCount = 0;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ _TEST_FILES_0 = \
|
|||
test_mozGetAsFile.html \
|
||||
test_canvas_strokeStyle_getter.html \
|
||||
test_bug613794.html \
|
||||
test_drawImage_edge_cases.html \
|
||||
$(NULL)
|
||||
|
||||
ifneq (1_Linux,$(MOZ_SUITE)_$(OS_ARCH))
|
||||
|
|
|
@ -25,8 +25,6 @@ c.width = c.height = 1;
|
|||
|
||||
c = c.getContext("2d");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var threw = true;
|
||||
try {
|
||||
c.putImageData({ width: 1, height: 1, data: [ 0, 0, 0, 0] }, 0, 0);
|
||||
|
@ -47,8 +45,6 @@ try {
|
|||
|
||||
is(threw, DOMException.TYPE_MISMATCH_ERR,
|
||||
"Should throw type error when data is not an array");
|
||||
SimpleTest.finish();
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче