This commit is contained in:
Philipp von Weitershausen 2011-08-29 12:58:49 -07:00
Родитель 1fecdbfa27 c97ad1dabe
Коммит 02e60c780b
1105 изменённых файлов: 111097 добавлений и 12835 удалений

Просмотреть файл

@ -56,7 +56,7 @@ interface nsIAccessibleRelation;
* Mozilla creates the implementations of nsIAccessible on demand.
* See http://www.mozilla.org/projects/ui/accessibility for more information.
*/
[scriptable, uuid(c81d8f8c-8585-4094-bc7c-71dd01494906)]
[scriptable, uuid(c7ac764a-b4c5-4479-9fb7-06e3c9f3db34)]
interface nsIAccessible : nsISupports
{
/**
@ -247,18 +247,6 @@ interface nsIAccessible : nsISupports
*/
nsIAccessibleRelation getRelationByType(in unsigned long aRelationType);
/**
* Returns the number of accessible relations for this object.
*/
readonly attribute unsigned long relationsCount;
/**
* Returns one accessible relation for this object.
*
* @param index - relation index (0-based)
*/
nsIAccessibleRelation getRelation(in unsigned long index);
/**
* Returns multiple accessible relations for this object.
*/

Просмотреть файл

@ -384,7 +384,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
// 3) for images and imagemaps, or anything else with a child frame
// we have the object frame, get the image frame
nsIFrame* frame = aFrame->GetFirstChild(nsnull);
nsIFrame* frame = aFrame->GetFirstPrincipalChild();
return frame ? frame->CreateAccessible() : nsnull;
}

Просмотреть файл

@ -945,7 +945,7 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame
nsAccessibilityAtoms::inlineFrame)) {
// Only do deeper bounds search if we're on an inline frame
// Inline frames can contain larger frames inside of them
iterNextFrame = iterFrame->GetFirstChild(nsnull);
iterNextFrame = iterFrame->GetFirstPrincipalChild();
}
if (iterNextFrame)
@ -2189,40 +2189,6 @@ nsAccessible::RelationByType(PRUint32 aType)
}
}
NS_IMETHODIMP
nsAccessible::GetRelationsCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIArray> relations;
nsresult rv = GetRelations(getter_AddRefs(relations));
NS_ENSURE_SUCCESS(rv, rv);
return relations->GetLength(aCount);
}
NS_IMETHODIMP
nsAccessible::GetRelation(PRUint32 aIndex, nsIAccessibleRelation** aRelation)
{
NS_ENSURE_ARG_POINTER(aRelation);
*aRelation = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIArray> relations;
nsresult rv= GetRelations(getter_AddRefs(relations));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessibleRelation> relation = do_QueryElementAt(relations,
aIndex, &rv);
NS_ADDREF(*aRelation = relation);
return rv;
}
NS_IMETHODIMP
nsAccessible::GetRelations(nsIArray **aRelations)
{

Просмотреть файл

@ -1707,7 +1707,7 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
break;
// Add lines for the sibling frames before the caret
nsIFrame *sibling = parentFrame->GetFirstChild(nsnull);
nsIFrame *sibling = parentFrame->GetFirstPrincipalChild();
while (sibling && sibling != caretFrame) {
nsAutoLineIterator lineIterForSibling = sibling->GetLineIterator();
if (lineIterForSibling) {

1
aclocal.m4 поставляемый
Просмотреть файл

@ -15,6 +15,7 @@ builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl
builtin(include, build/autoconf/acwinpaths.m4)dnl
builtin(include, build/autoconf/lto.m4)dnl
builtin(include, build/autoconf/gcc-pr49911.m4)dnl
MOZ_PROG_CHECKMSYS()

Просмотреть файл

@ -86,11 +86,11 @@ function init(aEvent)
#ifdef MOZ_UPDATER
gAppUpdater = new appUpdater();
#endif
let defaults = Services.prefs.getDefaultBranch("");
let channelLabel = document.getElementById("currentChannel");
channelLabel.value = defaults.getCharPref("app.update.channel");
#endif
#ifdef XP_MACOSX
// it may not be sized at this point, and we need its width to calculate its position

Просмотреть файл

@ -114,9 +114,11 @@
#endif
</vbox>
#ifdef MOZ_UPDATER
<description class="text-blurb" id="currentChannelText">
&channel.description.start;<label id="currentChannel"/>&channel.description.end;
</description>
#endif
<description class="text-blurb" id="communityDesc">
&community.start2;<label class="text-link" href="http://www.mozilla.org/">&community.mozillaLink;</label>&community.middle2;<label class="text-link" href="about:credits">&community.creditsLink;</label>&community.end2;
</description>

Просмотреть файл

@ -100,7 +100,11 @@ a:hover {
#searchContainer { height: 20% }
}
@media all and (max-height: 450px) {
@media all and (max-height: 500px) {
#searchContainer { height: 25% }
}
@media all and (max-height: 370px) {
#searchContainer { height: 30% }
}
@ -279,10 +283,10 @@ body[dir=rtl] #searchSubmit:active {
text-align: center;
}
@media all and (max-height: 370px) {
@media all and (max-height: 500px) {
#sessionRestoreContainer {
position: relative;
top: -5px;
top: -15px;
padding-top: 0;
}
}
@ -360,3 +364,9 @@ body[dir=rtl] #restorePreviousSession::before {
text-align: center;
bottom: 2%;
}
@media all and (max-height: 370px) {
#bottomSection {
visibility: hidden;
}
}

Просмотреть файл

@ -6285,14 +6285,15 @@ var IndexedDBPromptHelper = {
var contentDocument = contentWindow.document;
var browserWindow =
OfflineApps._getBrowserWindowForContentWindow(contentWindow);
var browser =
OfflineApps._getBrowserForContentWindow(browserWindow, contentWindow);
if (!browser) {
if (browserWindow != window) {
// Must belong to some other window.
return;
}
var browser =
OfflineApps._getBrowserForContentWindow(browserWindow, contentWindow);
var host = contentDocument.documentURIObject.asciiHost;
var message;

Просмотреть файл

@ -540,6 +540,7 @@ var InspectorUI = {
inspecting: false,
treeLoaded: false,
prefEnabledName: "devtools.inspector.enabled",
isDirty: false,
/**
* Toggle the inspector interface elements on or off.
@ -585,7 +586,7 @@ var InspectorUI = {
get defaultSelection()
{
let doc = this.win.document;
return doc.documentElement.lastElementChild;
return doc.documentElement ? doc.documentElement.lastElementChild : null;
},
initializeTreePanel: function IUI_initializeTreePanel()
@ -779,6 +780,8 @@ var InspectorUI = {
this.toolbar.hidden = false;
this.inspectCmd.setAttribute("checked", true);
gBrowser.addProgressListener(InspectorProgressListener);
},
/**
@ -838,6 +841,8 @@ var InspectorUI = {
this.closing = true;
this.toolbar.hidden = true;
gBrowser.removeProgressListener(InspectorProgressListener);
if (!aKeepStore) {
InspectorStore.deleteStore(this.winID);
this.win.removeEventListener("pagehide", this, true);
@ -1315,6 +1320,8 @@ var InspectorUI = {
// update the HTML tree attribute value
this.editingContext.attrObj.innerHTML = editorInput.value;
this.isDirty = true;
// event notification
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.EDITOR_SAVED,
null);
@ -1741,9 +1748,122 @@ var InspectorStore = {
}
};
/**
* The InspectorProgressListener object is an nsIWebProgressListener which
* handles onStateChange events for the inspected browser. If the user makes
* changes to the web page and he tries to navigate away, he is prompted to
* confirm page navigation, such that he's given the chance to prevent the loss
* of edits.
*/
var InspectorProgressListener = {
onStateChange:
function IPL_onStateChange(aProgress, aRequest, aFlag, aStatus)
{
// Remove myself if the Inspector is no longer open.
if (!InspectorUI.isTreePanelOpen) {
gBrowser.removeProgressListener(InspectorProgressListener);
return;
}
// Skip non-start states.
if (!(aFlag & Ci.nsIWebProgressListener.STATE_START)) {
return;
}
// If the request is about to happen in a new window, we are not concerned
// about the request.
if (aProgress.DOMWindow != InspectorUI.win) {
return;
}
if (InspectorUI.isDirty) {
this.showNotification(aRequest);
} else {
InspectorUI.closeInspectorUI();
}
},
/**
* Show an asynchronous notification which asks the user to confirm or cancel
* the page navigation request.
*
* @param nsIRequest aRequest
* The request initiated by the user or by the page itself.
* @returns void
*/
showNotification: function IPL_showNotification(aRequest)
{
aRequest.suspend();
let notificationBox = gBrowser.getNotificationBox(InspectorUI.browser);
let notification = notificationBox.
getNotificationWithValue("inspector-page-navigation");
if (notification) {
notificationBox.removeNotification(notification, true);
}
let cancelRequest = function onCancelRequest() {
if (aRequest) {
aRequest.cancel(Cr.NS_BINDING_ABORTED);
aRequest.resume(); // needed to allow the connection to be cancelled.
aRequest = null;
}
};
let eventCallback = function onNotificationCallback(aEvent) {
if (aEvent == "removed") {
cancelRequest();
}
};
let buttons = [
{
id: "inspector.confirmNavigationAway.buttonLeave",
label: InspectorUI.strings.
GetStringFromName("confirmNavigationAway.buttonLeave"),
accessKey: InspectorUI.strings.
GetStringFromName("confirmNavigationAway.buttonLeaveAccesskey"),
callback: function onButtonLeave() {
if (aRequest) {
aRequest.resume();
aRequest = null;
InspectorUI.closeInspectorUI();
}
},
},
{
id: "inspector.confirmNavigationAway.buttonStay",
label: InspectorUI.strings.
GetStringFromName("confirmNavigationAway.buttonStay"),
accessKey: InspectorUI.strings.
GetStringFromName("confirmNavigationAway.buttonStayAccesskey"),
callback: cancelRequest
},
];
let message = InspectorUI.strings.
GetStringFromName("confirmNavigationAway.message");
notification = notificationBox.appendNotification(message,
"inspector-page-navigation", "chrome://browser/skin/Info.png",
notificationBox.PRIORITY_WARNING_HIGH, buttons, eventCallback);
// Make sure this not a transient notification, to avoid the automatic
// transient notification removal.
notification.persistence = -1;
},
};
/////////////////////////////////////////////////////////////////////////
//// Initializors
//// Initializers
XPCOMUtils.defineLazyGetter(InspectorUI, "inspectCmd", function () {
return document.getElementById("Tools:Inspect");
});
XPCOMUtils.defineLazyGetter(InspectorUI, "strings", function () {
return Services.strings.
createBundle("chrome://browser/locale/inspector.properties");
});

Просмотреть файл

@ -542,6 +542,8 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
let $tabEl = this.$container;
let $canvas = this.$canvas;
hideSearch();
UI.setActive(this);
TabItems._update(this.tab, {force: true});

Просмотреть файл

@ -713,7 +713,6 @@ let UI = {
if (data == "enter" || data == "exit") {
hideSearch();
self._privateBrowsing.transitionMode = data;
self.storageBusy();
}
} else if (topic == "private-browsing-transition-complete") {
// We use .transitionMode here, as aData is empty.
@ -722,7 +721,6 @@ let UI = {
self.showTabView(false);
self._privateBrowsing.transitionMode = "";
self.storageReady();
}
}
@ -869,8 +867,12 @@ let UI = {
this._currentTab = tab;
if (this.isTabViewVisible()) {
if (!this.restoredClosedTab && this._lastOpenedTab == tab &&
tab._tabViewTabItem) {
// We want to zoom in if:
// 1) we didn't just restore a tab via Ctrl+Shift+T
// 2) we're not in the middle of switching from/to private browsing
// 3) the currently selected tab is the last created tab and has a tabItem
if (!this.restoredClosedTab && !this._privateBrowsing.transitionMode &&
this._lastOpenedTab == tab && tab._tabViewTabItem) {
tab._tabViewTabItem.zoomIn(true);
this._lastOpenedTab = null;
return;
@ -1130,18 +1132,26 @@ let UI = {
function getClosestTabBy(norm) {
if (!self.getActiveTab())
return null;
let centers =
[[item.bounds.center(), item]
for each(item in TabItems.getItems()) if (!item.parent || !item.parent.hidden)];
let myCenter = self.getActiveTab().bounds.center();
let matches = centers
.filter(function(item){return norm(item[0], myCenter)})
.sort(function(a,b){
return myCenter.distance(a[0]) - myCenter.distance(b[0]);
});
if (matches.length > 0)
return matches[0][1];
return null;
let activeTab = self.getActiveTab();
let activeTabGroup = activeTab.parent;
let myCenter = activeTab.bounds.center();
let match;
TabItems.getItems().forEach(function (item) {
if (!item.parent.hidden &&
(!activeTabGroup.expanded || activeTabGroup.id == item.parent.id)) {
let itemCenter = item.bounds.center();
if (norm(itemCenter, myCenter)) {
let itemDist = myCenter.distance(itemCenter);
if (!match || match[0] > itemDist)
match = [itemDist, item];
}
}
});
return match && match[1];
}
let preventDefault = true;
@ -1502,7 +1512,7 @@ let UI = {
matches[0].zoomIn();
zoomedIn = true;
}
hideSearch(null);
hideSearch();
}
if (!zoomedIn) {
@ -1613,11 +1623,15 @@ let UI = {
getFavIconUrlForTab: function UI_getFavIconUrlForTab(tab) {
let url;
// use the tab image if it doesn't start with http e.g. data:image/png, chrome://
if (tab.image && !(/^https?:/.test(tab.image)))
url = tab.image;
else
if (tab.image) {
// if starts with http/https, fetch icon from favicon service via the moz-anno protocal
if (/^https?:/.test(tab.image))
url = gFavIconService.getFaviconLinkForIcon(gWindow.makeURI(tab.image)).spec;
else
url = tab.image;
} else {
url = gFavIconService.getFaviconImageForPage(tab.linkedBrowser.currentURI).spec;
}
return url;
},

Просмотреть файл

@ -57,6 +57,7 @@ _BROWSER_FILES = \
browser_inspector_registertools.js \
browser_inspector_bug_665880.js \
browser_inspector_editor.js \
browser_inspector_bug_566084_location_changed.js \
$(NULL)
libs:: $(_BROWSER_FILES)

Просмотреть файл

@ -0,0 +1,121 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let notificationBox = null;
function startLocationTests() {
ok(window.InspectorUI, "InspectorUI variable exists");
Services.obs.addObserver(runInspectorTests, INSPECTOR_NOTIFICATIONS.OPENED, null);
InspectorUI.toggleInspectorUI();
}
function runInspectorTests() {
Services.obs.removeObserver(runInspectorTests, INSPECTOR_NOTIFICATIONS.OPENED, null);
let para = content.document.querySelector("p");
ok(para, "found the paragraph element");
is(para.textContent, "init", "paragraph content is correct");
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Panel is open");
InspectorUI.isDirty = true;
notificationBox = gBrowser.getNotificationBox(gBrowser.selectedBrowser);
notificationBox.addEventListener("AlertActive", alertActive1, false);
gBrowser.selectedBrowser.addEventListener("load", onPageLoad, true);
content.location = "data:text/html,<div>location change test 1 for " +
"inspector</div><p>test1</p>";
}
function alertActive1() {
notificationBox.removeEventListener("AlertActive", alertActive1, false);
let notification = notificationBox.
getNotificationWithValue("inspector-page-navigation");
ok(notification, "found the inspector-page-navigation notification");
// By closing the notification it is expected that page navigation is
// canceled.
executeSoon(function() {
notification.close();
locationTest2();
});
}
function onPageLoad() {
gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
isnot(content.location.href.indexOf("test2"), -1,
"page navigated to the correct location");
let para = content.document.querySelector("p");
ok(para, "found the paragraph element, third time");
is(para.textContent, "test2", "paragraph content is correct");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isTreePanelOpen, "Inspector Panel is not open");
testEnd();
}
function locationTest2() {
// Location did not change.
let para = content.document.querySelector("p");
ok(para, "found the paragraph element, second time");
is(para.textContent, "init", "paragraph content is correct");
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Panel is open");
notificationBox.addEventListener("AlertActive", alertActive2, false);
content.location = "data:text/html,<div>location change test 2 for " +
"inspector</div><p>test2</p>";
}
function alertActive2() {
notificationBox.removeEventListener("AlertActive", alertActive2, false);
let notification = notificationBox.
getNotificationWithValue("inspector-page-navigation");
ok(notification, "found the inspector-page-navigation notification");
let buttons = notification.querySelectorAll("button");
let buttonLeave = null;
for (let i = 0; i < buttons.length; i++) {
if (buttons[i].buttonInfo.id == "inspector.confirmNavigationAway.buttonLeave") {
buttonLeave = buttons[i];
break;
}
}
ok(buttonLeave, "the Leave page button was found");
// Accept page navigation.
executeSoon(function(){
buttonLeave.doCommand();
});
}
function testEnd() {
notificationBox = null;
InspectorUI.isDirty = false;
gBrowser.removeCurrentTab();
executeSoon(finish);
}
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
waitForFocus(startLocationTests, content);
}, true);
content.location = "data:text/html,<div>location change tests for " +
"inspector.</div><p>init</p>";
}

Просмотреть файл

@ -120,6 +120,7 @@ _BROWSER_FILES = \
browser_tabview_bug628061.js \
browser_tabview_bug628165.js \
browser_tabview_bug628270.js \
browser_tabview_bug628887.js \
browser_tabview_bug629189.js \
browser_tabview_bug629195.js \
browser_tabview_bug630102.js \
@ -154,6 +155,8 @@ _BROWSER_FILES = \
browser_tabview_bug669694.js \
browser_tabview_bug673196.js \
browser_tabview_bug673729.js \
browser_tabview_bug679853.js \
browser_tabview_bug681599.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

Просмотреть файл

@ -40,8 +40,18 @@ function onTabViewWindowLoaded() {
// fired, a delay is used here to avoid the test code run before the browser
// code.
executeSoon(function() {
is($icon.attr("src"), fi.defaultFavicon.spec,
"The icon is showing the default fav icon");
let iconSrc = $icon.attr("src");
let hasData = true;
try {
fi.getFaviconDataAsDataURL(iconSrc);
} catch(e) {
hasData = false;
}
ok(!hasData, "The icon src doesn't return any data");
// with moz-anno:favicon automatically redirects to the default favIcon
// if the given url is invalid
ok(/^moz-anno:favicon:/.test(iconSrc),
"The icon url starts with moz-anno:favicon so the default fav icon would be displayed");
// clean up
gBrowser.removeTab(newTab);

Просмотреть файл

@ -0,0 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
newWindowWithTabView(function(win) {
registerCleanupFunction(function() win.close());
let cw = win.TabView.getContentWindow();
let groupItemOne = cw.GroupItems.groupItems[0];
let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2);
ok(groupItemTwo.isStacked(), "groupItem is now stacked");
is(win.gBrowser.tabs.length, 3, "There are three tabs");
// the focus should remain within the group after it's expanded
groupItemTwo.addSubscriber("expanded", function onExpanded() {
groupItemTwo.removeSubscriber("expanded", onExpanded);
ok(groupItemTwo.expanded, "groupItemTwo is expanded");
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item in group item two is active in expanded mode");
EventUtils.synthesizeKey("VK_DOWN", {}, cw);
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item is still active after pressing down key");
// the focus should goes to other group if the down arrow is pressed
groupItemTwo.addSubscriber("collapsed", function onExpanded() {
groupItemTwo.removeSubscriber("collapsed", onExpanded);
ok(!groupItemTwo.expanded, "groupItemTwo is not expanded");
is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
"The first tab item is active in group item two in collapsed mode");
EventUtils.synthesizeKey("VK_DOWN", {}, cw);
is(cw.UI.getActiveTab(), groupItemOne.getChild(0),
"The first tab item in group item one is active after pressing down key");
finish();
});
groupItemTwo.collapse();
});
groupItemTwo.expand();
});
}

Просмотреть файл

@ -0,0 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
// clean up after ourselves
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView();
});
// select the new tab
gBrowser.selectedTab = gBrowser.addTab();
showTabView(function () {
// enter private browsing mode
togglePrivateBrowsing(function () {
ok(!TabView.isVisible(), "tabview is hidden");
showTabView(function () {
// leave private browsing mode
togglePrivateBrowsing(function () {
ok(TabView.isVisible(), "tabview is visible");
hideTabView(finish);
});
});
});
});
}

Просмотреть файл

@ -0,0 +1,31 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
showTabView(function() {
let cw = TabView.getContentWindow();
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView();
})
whenSearchIsEnabled(function() {
ok(cw.isSearchEnabled(), "The search is enabled before creating a new tab");
whenTabViewIsHidden(function() {
showTabView(function() {
ok(!cw.isSearchEnabled(), "The search is disabled when entering Tabview");
hideTabView(finish);
})
});
EventUtils.synthesizeKey("t", { accelKey: true }, cw);
});
EventUtils.synthesizeKey("VK_SLASH", {}, cw);
});
}

Просмотреть файл

@ -1376,15 +1376,23 @@ let PlacesControllerDragHelper = {
},
/**
* Extract the first accepted flavor from a flavors array.
* Extract the first accepted flavor from a list of flavors.
* @param aFlavors
* The flavors array.
* The flavors list of type nsIDOMDOMStringList.
*/
getFirstValidFlavor: function PCDH_getFirstValidFlavor(aFlavors) {
for (let i = 0; i < aFlavors.length; i++) {
if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1)
return aFlavors[i];
}
// If no supported flavor is found, check if data includes text/plain
// contents. If so, request them as text/unicode, a conversion will happen
// automatically.
if (aFlavors.contains("text/plain")) {
return PlacesUtils.TYPE_UNICODE;
}
return null;
},

Просмотреть файл

@ -48,6 +48,7 @@ _BROWSER_TEST_FILES = \
browser_0_library_left_pane_migration.js \
browser_library_left_pane_fixnames.js \
browser_425884.js \
browser_475045.js \
browser_423515.js \
browser_410196_paste_into_tags.js \
browser_457473_no_copy_guid.js \

Просмотреть файл

@ -0,0 +1,59 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
// Make sure the bookmarks bar is visible and restore its state on cleanup.
let toolbar = document.getElementById("PersonalToolbar");
ok(toolbar, "PersonalToolbar should not be null");
if (toolbar.collapsed) {
setToolbarVisibility(toolbar, true);
registerCleanupFunction(function() {
setToolbarVisibility(toolbar, false);
});
}
// Setup the node we will use to be dropped. The actual node used does not
// matter because we will set its data, effect, and mimeType manually.
let placesItems = document.getElementById("PlacesToolbarItems");
ok(placesItems, "PlacesToolbarItems should not be null");
ok(placesItems.localName == "scrollbox", "PlacesToolbarItems should not be null");
ok(placesItems.childNodes[0], "PlacesToolbarItems must have at least one child");
/**
* Simulates a drop of a URI onto the bookmarks bar.
*
* @param aEffect
* The effect to use for the drop operation: move, copy, or link.
* @param aMimeType
* The mime type to use for the drop operation.
*/
let simulateDragDrop = function(aEffect, aMimeType) {
const uriSpec = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
let uri = makeURI(uriSpec);
EventUtils.synthesizeDrop(placesItems.childNodes[0],
placesItems,
[[{type: aMimeType,
data: uriSpec}]],
aEffect, window);
// Verify that the drop produces exactly one bookmark.
let bookmarkIds = PlacesUtils.bookmarks
.getBookmarkIdsForURI(uri);
ok(bookmarkIds.length == 1, "There should be exactly one bookmark");
PlacesUtils.bookmarks.removeItem(bookmarkIds[0]);
// Verify that we removed the bookmark successfully.
ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed");
}
// Simulate a bookmark drop for all of the mime types and effects.
let mimeTypes = ["text/plain", "text/unicode", "text/x-moz-url"];
let effects = ["move", "copy", "link"];
effects.forEach(function (effect) {
mimeTypes.forEach(function (mimeType) {
simulateDragDrop(effect, mimeType);
});
});
}

Просмотреть файл

@ -280,7 +280,7 @@ var Scratchpad = {
scriptError.initWithWindowID(ex.message + "\n" + ex.stack, ex.fileName,
"", ex.lineNumber, 0, scriptError.errorFlag,
"content javascript",
this.getWindowId(contentWindow));
this.getInnerWindowId(contentWindow));
Services.console.logMessage(scriptError);
}
@ -633,16 +633,16 @@ var Scratchpad = {
},
/**
* Gets the ID of the outer window of the given DOM window object.
* Gets the ID of the inner window of the given DOM window object.
*
* @param nsIDOMWindow aWindow
* @return integer
* the outer window ID
* the inner window ID
*/
getWindowId: function SP_getWindowId(aWindow)
getInnerWindowId: function SP_getInnerWindowId(aWindow)
{
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
},
/**

Просмотреть файл

@ -90,7 +90,7 @@ XPCOMUtils.defineLazyGetter(this, "PropertyPanel", function () {
XPCOMUtils.defineLazyGetter(this, "AutocompletePopup", function () {
var obj = {};
try {
Cu.import("resource://gre/modules/AutocompletePopup.jsm", obj);
Cu.import("resource:///modules/AutocompletePopup.jsm", obj);
}
catch (err) {
Cu.reportError(err);

Просмотреть файл

@ -6,7 +6,7 @@
// Tests that document.body autocompletes in the web console.
Cu.import("resource://gre/modules/PropertyPanel.jsm");
Cu.import("resource:///modules/PropertyPanel.jsm");
function test() {
addTab("data:text/html,Web Console autocompletion bug in document.body");

Просмотреть файл

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
Cu.import("resource://gre/modules/HUDService.jsm");
Cu.import("resource:///modules/HUDService.jsm");
function log(aMsg)
{

Просмотреть файл

@ -0,0 +1,9 @@
# LOCALIZATION NOTE (confirmNavigationAway): Used in the Inspector tool, when
# the user tries to navigate away from a web page, to confirm the change of
# page.
confirmNavigationAway.message=Leaving this page will close the Inspector and the changes you have made will be lost.
confirmNavigationAway.buttonLeave=Leave Page
confirmNavigationAway.buttonLeaveAccesskey=L
confirmNavigationAway.buttonStay=Stay on Page
confirmNavigationAway.buttonStayAccesskey=S

Просмотреть файл

@ -16,6 +16,7 @@
locale/browser/browser.properties (%chrome/browser/browser.properties)
locale/browser/scratchpad.properties (%chrome/browser/scratchpad.properties)
locale/browser/scratchpad.dtd (%chrome/browser/scratchpad.dtd)
locale/browser/inspector.properties (%chrome/browser/inspector.properties)
locale/browser/openLocation.dtd (%chrome/browser/openLocation.dtd)
locale/browser/openLocation.properties (%chrome/browser/openLocation.properties)
* locale/browser/pageInfo.dtd (%chrome/browser/pageInfo.dtd)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.3 KiB

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Двоичные данные
browser/themes/pinstripe/browser/Toolbar.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 11 KiB

После

Ширина:  |  Высота:  |  Размер: 5.5 KiB

Просмотреть файл

@ -369,6 +369,27 @@ toolbar:not([mode="icons"]) #restore-button {
opacity: .4;
}
@media (-moz-mac-lion-theme) {
.toolbarbutton-1[disabled="true"] > .toolbarbutton-icon,
.toolbarbutton-1[type="menu-button"] > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon,
#restore-button[disabled="true"] > .toolbarbutton-icon,
.toolbarbutton-1[disabled="true"] > .toolbarbutton-menu-dropmarker,
.toolbarbutton-1[disabled="true"] > .toolbarbutton-menubutton-dropmarker,
.toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-icon,
.toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-icon,
#restore-button:not(:hover):-moz-window-inactive > .toolbarbutton-icon,
.toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-menu-dropmarker,
.toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-menubutton-dropmarker {
opacity: .5;
}
.toolbarbutton-1:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon,
.toolbarbutton-1:-moz-window-inactive[type="menu-button"] > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon,
#restore-button:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon {
opacity: .25;
}
}
.toolbarbutton-1 > .toolbarbutton-menu-dropmarker,
.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker {
list-style-image: url(chrome://browser/skin/toolbarbutton-dropmarker.png);
@ -640,10 +661,6 @@ toolbar[mode="icons"] #forward-button:-moz-lwtheme {
-moz-image-region: rect(20px, 160px, 40px, 140px);
}
#history-button[checked="true"]:active:hover {
-moz-image-region: rect(40px, 160px, 60px, 140px);
}
/* bookmark sidebar & menu buttons */
#bookmarks-button,
@ -655,10 +672,6 @@ toolbar[mode="icons"] #forward-button:-moz-lwtheme {
-moz-image-region: rect(20px, 180px, 40px, 160px);
}
#bookmarks-button[checked="true"]:active:hover {
-moz-image-region: rect(40px, 180px, 60px, 160px);
}
#bookmarks-menu-button.bookmark-item {
-moz-image-region: rect(2px, 178px, 18px, 162px);
list-style-image: url("chrome://browser/skin/Toolbar.png");
@ -1884,7 +1897,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
-moz-image-region: rect(0, 11px, 17px, 0);
-moz-image-region: rect(0, 13px, 20px, 0);
margin: 0;
padding: 0 4px;
border: none;
@ -1923,17 +1936,18 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
.tabbrowser-arrowscrollbox > .scrollbutton-up:hover,
.tabbrowser-arrowscrollbox > .scrollbutton-down:hover {
-moz-image-region: rect(0, 22px, 17px, 11px);
-moz-image-region: rect(0, 26px, 20px, 13px);
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:hover:active,
.tabbrowser-arrowscrollbox > .scrollbutton-down:hover:active {
-moz-image-region: rect(0, 44px, 17px, 33px);
-moz-image-region: rect(0, 39px, 20px, 26px);
}
.tabbrowser-arrowscrollbox > .scrollbutton-up[disabled],
.tabbrowser-arrowscrollbox > .scrollbutton-down[disabled] {
-moz-image-region: rect(0, 33px, 17px, 22px) !important;
.tabbrowser-arrowscrollbox > .scrollbutton-up[disabled] > .toolbarbutton-icon,
.tabbrowser-arrowscrollbox > .scrollbutton-down[disabled] > .toolbarbutton-icon {
-moz-image-region: rect(0, 13px, 20px, 0) !important;
opacity: .5;
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled]):-moz-locale-dir(ltr),

Просмотреть файл

@ -137,6 +137,14 @@ browser.jar:
#endif
skin/classic/browser/lion/keyhole-circle.png (keyhole-circle-lion.png)
skin/classic/browser/lion/Toolbar.png (Toolbar-lion.png)
skin/classic/browser/lion/toolbarbutton-dropmarker.png (toolbarbutton-dropmarker-lion.png)
skin/classic/browser/lion/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon-lion.png)
skin/classic/browser/lion/tabview/tabview.png (tabview/tabview-lion.png)
skin/classic/browser/lion/places/toolbar.png (places/toolbar-lion.png)
% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7
% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7
% override chrome://browser/skin/toolbarbutton-dropmarker.png chrome://browser/skin/lion/toolbarbutton-dropmarker.png os=Darwin osversion>=10.7
% override chrome://browser/skin/tabbrowser/alltabs-box-bkgnd-icon.png chrome://browser/skin/lion/tabbrowser/alltabs-box-bkgnd-icon.png os=Darwin osversion>=10.7
% override chrome://browser/skin/tabview/tabview.png chrome://browser/skin/lion/tabview/tabview.png os=Darwin osversion>=10.7
% override chrome://browser/skin/places/toolbar.png chrome://browser/skin/lion/places/toolbar.png os=Darwin osversion>=10.7

Просмотреть файл

@ -104,6 +104,20 @@
-moz-margin-end: 2px;
}
@media (-moz-mac-lion-theme) {
#placesToolbar > toolbarbutton[disabled="true"] > .toolbarbutton-icon,
#placesToolbar > toolbarbutton:not(:hover):-moz-window-inactive > .toolbarbutton-icon,
#placesToolbar > toolbarbutton[type="menu"][disabled="true"] > .toolbarbutton-menu-dropmarker,
#placesToolbar > toolbarbutton:not(:hover):-moz-window-inactive[type="menu"] > .toolbarbutton-menu-dropmarker {
opacity: .5;
}
#placesToolbar > toolbarbutton:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon,
#placesToolbar > toolbarbutton:-moz-window-inactive[type="menu"][disabled="true"] > .toolbarbutton-menu-dropmarker {
opacity: .25;
}
}
#placesToolbar > toolbarbutton > menupopup {
margin-top: 1px;
}

Двоичные данные
browser/themes/pinstripe/browser/places/toolbar-lion.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 538 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 757 B

После

Ширина:  |  Высота:  |  Размер: 568 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 924 B

После

Ширина:  |  Высота:  |  Размер: 947 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 934 B

После

Ширина:  |  Высота:  |  Размер: 996 B

Двоичные данные
browser/themes/pinstripe/browser/tabview/tabview-lion.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 516 B

Двоичные данные
browser/themes/pinstripe/browser/toolbarbutton-dropmarker-lion.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 150 B

Просмотреть файл

@ -0,0 +1,67 @@
dnl Check if the compiler is gcc and has PR49911. If so
dnl disable vrp.
AC_DEFUN([MOZ_GCC_PR49911],
[
if test "$GNU_CC"; then
AC_MSG_CHECKING(for gcc PR49911)
ac_have_gcc_pr49911="no"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-O2"
AC_TRY_RUN([
extern "C" void abort(void);
typedef enum {
eax, ecx, edx, ebx, esp, ebp,
esi, edi }
RegisterID;
union StateRemat {
RegisterID reg_;
int offset_;
};
static StateRemat FromRegister(RegisterID reg) {
StateRemat sr;
sr.reg_ = reg;
return sr;
}
static StateRemat FromAddress3(int address) {
StateRemat sr;
sr.offset_ = address;
if (address < 46 && address >= 0) {
abort();
}
return sr;
}
struct FrameState {
StateRemat dataRematInfo2(bool y, int z) {
if (y) return FromRegister(RegisterID(1));
return FromAddress3(z);
}
};
FrameState frame;
StateRemat x;
__attribute__((noinline)) void jsop_setelem(bool y, int z) {
x = frame.dataRematInfo2(y, z);
}
int main(void) {
jsop_setelem(0, 47);
}
], true,
ac_have_gcc_pr49911="yes",
true)
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
if test "$ac_have_gcc_pr49911" == "yes"; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -fno-tree-vrp"
CXXFLAGS="$CXXFLAGS -fno-tree-vrp"
else
AC_MSG_RESULT(no)
fi
fi
])

Просмотреть файл

@ -101,11 +101,6 @@ do
CPP_SRC="$i"
if [ "${PLATFORM}" = "SCO_SV" ]; then
OPTS="${OPTS} +.cpp $i"
elif [ "${PLATFORM}" = "IRIX" ]; then
NEW_i=`basename ${CPP_SRC} .cpp`.C
rm -f ${NEW_i}
cp $i ${NEW_i}
OPTS="${OPTS} ${NEW_i}"
else
OPTS="${OPTS} $i"
fi
@ -135,11 +130,6 @@ done
${CXX} ${OPTS} || exit $?
rm -f ${NEW_i}
# Really only needed for NSPR now.
if [ "${PLATFORM}" = "IRIX" -a "$OBJ" != "$OBJECT" ]; then
OBJ=$OBJECT
fi
# LAME!!!
if [ -f -O ]; then
mv -f -- -O ${OBJECT}

Просмотреть файл

@ -6,9 +6,30 @@ if test -z "$CXX" ; then
CXX=g++-4.2
fi
# Mac builds don't nomally have to be handled as cross
# compilation, but some of the libraries on the bots
# (IDL for example) are built only for one arch.
HOST_CC=$CC
HOST_CXX=$CXX
# These must be set for cross builds, and don't hurt straight builds.
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
# We do 32 bit builds for leopard
CC="$CC -arch i386"
CXX="$CXX -arch i386"
TARGET_CPU=i386
CC="$CC -arch $TARGET_CPU"
CXX="$CXX -arch $TARGET_CPU"
NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
CROSS_COMPILE=1
fi
# Note, the version (10) is used by libffi's configure.
ac_add_options --target=i386-apple-darwin10

Просмотреть файл

@ -13,6 +13,7 @@ class DeviceManagerADB(DeviceManager):
self.retries = 0
self._sock = None
self.useRunAs = False
self.packageName = None
if packageName == None:
if os.getenv('USER'):
packageName = 'org.mozilla.fennec_' + os.getenv('USER')

Просмотреть файл

@ -5,7 +5,7 @@ parsing command lines into argv and making sure that no shell magic is being use
#TODO: ship pyprocessing?
import multiprocessing, multiprocessing.dummy
import subprocess, shlex, re, logging, sys, traceback, os, imp
import subprocess, shlex, re, logging, sys, traceback, os, imp, glob
# XXXkhuey Work around http://bugs.python.org/issue1731717
subprocess._cleanup = lambda: None
import command, util
@ -15,7 +15,8 @@ if sys.platform=='win32':
_log = logging.getLogger('pymake.process')
_escapednewlines = re.compile(r'\\\n')
_blacklist = re.compile(r'[$><;*?[{~`|&]')
_blacklist = re.compile(r'[$><;[{~`|&]')
_needsglob = re.compile(r'[\*\?]')
def clinetoargv(cline):
"""
If this command line can safely skip the shell, return an argv array.
@ -34,6 +35,19 @@ def clinetoargv(cline):
return args, None
def doglobbing(args, cwd):
"""
Perform any needed globbing on the argument list passed in
"""
globbedargs = []
for arg in args:
if _needsglob.search(arg):
globbedargs.extend(glob.glob(os.path.join(cwd, arg)))
else:
globbedargs.append(arg)
return globbedargs
shellwords = (':', '.', 'break', 'cd', 'continue', 'exec', 'exit', 'export',
'getopts', 'hash', 'pwd', 'readonly', 'return', 'shift',
'test', 'times', 'trap', 'umask', 'unset', 'alias',
@ -55,6 +69,8 @@ def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
shellreason = "command contains shell-special character '%s'" % (badchar,)
elif len(argv) and argv[0] in shellwords:
shellreason = "command starts with shell primitive '%s'" % (argv[0],)
else:
argv = doglobbing(argv, cwd)
if shellreason is not None:
_log.debug("%s: using shell: %s: '%s'", loc, shellreason, cline)
@ -89,6 +105,7 @@ def call(cline, env, cwd, loc, cb, context, echo, justprint=False):
def call_native(module, method, argv, env, cwd, loc, cb, context, echo, justprint=False,
pycommandpath=None):
argv = doglobbing(argv, cwd)
context.call_native(module, method, argv, env=env, cwd=cwd, cb=cb,
echo=echo, justprint=justprint, pycommandpath=pycommandpath)
@ -199,6 +216,7 @@ class PythonJob(Job):
return e.exitcode
except:
print >>sys.stderr, sys.exc_info()[1]
print >>sys.stderr, traceback.print_exc()
return -127
finally:
os.environ = oldenv

Просмотреть файл

@ -0,0 +1,11 @@
#T gmake skip
all:
mkdir shell-glob-test
touch shell-glob-test/foo.txt
touch shell-glob-test/bar.txt
touch shell-glob-test/a.foo
touch shell-glob-test/b.foo
$(RM) shell-glob-test/*.txt
$(RM) shell-glob-test/?.foo
rmdir shell-glob-test
@echo TEST-PASS

Просмотреть файл

@ -69,14 +69,6 @@
#include "nsString.h"
#include "prlog.h"
#ifdef MOZ_XUL
#include "nsIXULPrototypeCache.h"
#endif
//----------------------------------------------------------------------
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_THREADSAFE_ISUPPORTS2(nsChromeProtocolHandler,

Просмотреть файл

@ -361,7 +361,7 @@ USE_N32 = @USE_N32@
HAVE_64BIT_OS = @HAVE_64BIT_OS@
# Temp hack. It is not my intention to leave this crap in here for ever.
# Im talking to fur right now to solve the problem without introducing
# Im talking to fur right now to solve the problem without introducing
# NS_USE_NATIVE to the build system -ramiro.
NS_USE_NATIVE = @NS_USE_NATIVE@
@ -629,7 +629,6 @@ MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
WIN32_CRT_LIBS = @WIN32_CRT_LIBS@
MOZ_CRT_CPU_ARCH = @MOZ_CRT_CPU_ARCH@
# This is for custom CRT building
ifdef MOZ_MEMORY

Просмотреть файл

@ -129,7 +129,7 @@ endif
# but save the version to allow multiple versions of the same base
# platform to be built in the same tree.
#
ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
OS_RELEASE := $(basename $(OS_RELEASE))
# Allow the user to ignore the OS_VERSION, which is usually irrelevant.
@ -259,7 +259,7 @@ endif # WINNT && !GNU_CC
#
_ENABLE_PIC=1
# Determine if module being compiled is destined
# Determine if module being compiled is destined
# to be merged into libxul
ifdef LIBXUL_LIBRARY
@ -415,7 +415,7 @@ INCLUDES = \
-I$(DIST)/include -I$(DIST)/include/nsprpub \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include -I$(LIBXUL_SDK)/include/nsprpub) \
$(OS_INCLUDES) \
$(NULL)
$(NULL)
include $(topsrcdir)/config/static-checking-config.mk
@ -513,7 +513,7 @@ RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
ifndef MOZ_NO_DEBUG_RTL
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
endif
endif
endif # MOZ_DEBUG || NS_TRACE_MALLOC
endif # USE_STATIC_LIBS
endif # WINNT && !GNU_CC

Просмотреть файл

@ -526,7 +526,7 @@ TAG_PROGRAM = xargs etags -a
#
# Turn on C++ linking if we have any .cpp or .mm files
# (moved this from config.mk so that config.mk can be included
# (moved this from config.mk so that config.mk can be included
# before the CPPSRCS are defined)
#
ifneq ($(CPPSRCS)$(CMMSRCS),)
@ -537,7 +537,7 @@ HOST_CPP_PROG_LINK = 1
endif
#
# This will strip out symbols that the component should not be
# This will strip out symbols that the component should not be
# exporting from the .dynsym section.
#
ifdef IS_COMPONENT
@ -545,7 +545,7 @@ EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
endif # IS_COMPONENT
#
# Enforce the requirement that MODULE_NAME must be set
# Enforce the requirement that MODULE_NAME must be set
# for components in static builds
#
ifdef IS_COMPONENT
@ -635,18 +635,18 @@ ifeq ($(OS_ARCH),OSF1)
ifdef IS_COMPONENT
ifeq ($(GNU_CC)$(GNU_CXX),)
EXTRA_DSO_LDOPTS += -B symbolic
endif
endif
endif
endif
endif
#
# Linux: add -Bsymbolic flag for components
#
#
ifeq ($(OS_ARCH),Linux)
ifdef IS_COMPONENT
EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
endif
endif
endif
#
# GNU doesn't have path length limitation
@ -681,6 +681,12 @@ else
OUTOPTION = -o # eol
endif # WINNT && !GNU_CC
ifneq (,$(filter ml%,$(AS)))
ASOUTOPTION = -Fo# eol
else
ASOUTOPTION = -o # eol
endif
ifeq (,$(CROSS_COMPILE))
HOST_OUTOPTION = $(OUTOPTION)
else
@ -711,7 +717,7 @@ endif
$(MAKE) tools
# Do depend as well
alldep::
alldep::
$(MAKE) export
$(MAKE) depend
$(MAKE) libs
@ -959,7 +965,7 @@ clean clobber realclean clobber_all:: $(SUBMAKEFILES)
distclean:: $(SUBMAKEFILES)
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
-$(RM) -r $(ALL_TRASH_DIRS)
-$(RM) -r $(ALL_TRASH_DIRS)
-$(RM) $(ALL_TRASH) \
Makefile .HSancillary \
$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
@ -1087,7 +1093,7 @@ endif
#
# Purify target. Solaris/sparc only to start.
# Purify does not recognize "egcs" or "c++" so we go with
# Purify does not recognize "egcs" or "c++" so we go with
# "gcc" and "g++" for now.
#
pure: $(PROGRAM)
@ -1273,10 +1279,10 @@ host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
# 'moc' only knows about #defines it gets on the command line (-D...), not in
# 'moc' only knows about #defines it gets on the command line (-D...), not in
# included headers like mozilla-config.h
moc_%.cpp: %.h $(GLOBAL_DEPS)
$(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
$(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
moc_%.cc: %.cc $(GLOBAL_DEPS)
$(REPORT_BUILD)
@ -1286,7 +1292,7 @@ ifdef ASFILES
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
# a '-c' flag.
%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
endif
%.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
@ -1529,7 +1535,7 @@ export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
$(INSTALL) $(IFLAGS1) $^
endif
endif
endif
################################################################################
# Export the elements of $(XPIDLSRCS)
# generating .h and .xpt files and moving them to the appropriate places.
@ -1552,7 +1558,7 @@ export:: FORCE
endif
# generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
# warn against overriding existing .h file.
# warn against overriding existing .h file.
$(XPIDL_GEN_DIR)/.done:
$(MKDIR) -p $(XPIDL_GEN_DIR)
@$(TOUCH) $@
@ -1614,7 +1620,7 @@ export:: $(XPIDLSRCS) $(IDL_DIR)
$(INSTALL) $(IFLAGS1) $^
export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(DIST)/include
$(INSTALL) $(IFLAGS1) $^
$(INSTALL) $(IFLAGS1) $^
endif # NO_DIST_INSTALL
endif # XPIDLSRCS
@ -1978,7 +1984,7 @@ FORCE:
.DELETE_ON_ERROR:
# Properly set LIBPATTERNS for the platform
.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
tags: TAGS

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -186,10 +186,6 @@
#define NS_XULDOCUMENT_CID \
{ 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {3A0A0FC1-8349-11d3-BE47-00104BDE6048}
#define NS_XULPROTOTYPECACHE_CID \
{ 0x3a0a0fc1, 0x8349, 0x11d3, { 0xbe, 0x47, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
// {a6cf9126-15b3-11d2-932e-00805f8add32}
#define NS_RANGEUTILS_CID \
{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }

Просмотреть файл

@ -743,8 +743,8 @@ public:
* @param aColumnNumber Column number within resource containing error.
* @param aErrorFlags See nsIScriptError.
* @param aCategory Name of module reporting error.
* @param [aWindowId=0] (Optional) The window ID of the outer window the
* message originates from.
* @param [aInnerWindowId=0] (Optional) The window ID of the inner window
* the message originates from.
*/
enum PropertiesFile {
eCSS_PROPERTIES,
@ -769,7 +769,7 @@ public:
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
const char *aCategory,
PRUint64 aWindowId = 0);
PRUint64 aInnerWindowId = 0);
/**
* Report a localized error message to the error console.
@ -1662,6 +1662,13 @@ public:
const nsAString& aClasses,
nsIDOMNodeList** aReturn);
/**
* Returns the widget for this document if there is one. Looks at all ancestor
* documents to try to find a widget, so for example this can still find a
* widget for documents in display:none frames that have no presentation.
*/
static nsIWidget *WidgetForDocument(nsIDocument *aDoc);
/**
* Returns a layer manager to use for the given document. Basically we
* look up the document hierarchy for the first document which has

Просмотреть файл

@ -1027,28 +1027,4 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
// Some cycle-collecting helper macros for nsIContent subclasses
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER \
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) { \
nsContentUtils::TraverseListenerManager(tmp, cb); \
}
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA \
if (tmp->HasProperties()) { \
nsNodeUtils::TraverseUserData(tmp, cb); \
}
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER \
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) { \
nsContentUtils::RemoveListenerManager(tmp); \
tmp->UnsetFlags(NODE_HAS_LISTENERMANAGER); \
}
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA \
if (tmp->HasProperties()) { \
nsNodeUtils::UnlinkUserData(tmp); \
}
#endif /* nsIContent_h___ */

Просмотреть файл

@ -720,6 +720,15 @@ public:
return window ? window->WindowID() : 0;
}
/**
* Return the inner window ID.
*/
PRUint64 InnerWindowID()
{
nsPIDOMWindow *window = GetInnerWindow();
return window ? window->WindowID() : 0;
}
/**
* Get the script loader for this document
*/

Просмотреть файл

@ -48,6 +48,8 @@
#include "nsIProgrammingLanguage.h" // for ::JAVASCRIPT
#include "nsDOMError.h"
#include "nsDOMString.h"
#include "jspubtd.h"
#include "nsDOMMemoryReporter.h"
class nsIContent;
class nsIDocument;
@ -280,8 +282,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0xc7abbb40, 0x2571, 0x4d12, \
{ 0x8f, 0x89, 0x0d, 0x4f, 0x55, 0xc0, 0x92, 0xf6 } }
{ 0x5572c8a9, 0xbda9, 0x4b78, \
{ 0xb4, 0x1a, 0xdb, 0x1a, 0x83, 0xef, 0x53, 0x7e } }
/**
* An internal interface that abstracts some DOMNode-related parts that both
@ -294,9 +296,7 @@ class nsINode : public nsIDOMEventTarget,
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODE_IID)
virtual PRInt64 SizeOf() const {
return sizeof(*this);
}
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
friend class nsNodeUtils;
friend class nsNodeWeakReference;
@ -801,6 +801,9 @@ public:
// putting a DestroySlots function on nsINode
virtual ~nsSlots();
void Traverse(nsCycleCollectionTraversalCallback &cb);
void Unlink();
/**
* A list of mutation observers
*/
@ -932,42 +935,6 @@ public:
*/
nsIDocument* GetOwnerDocument() const;
/**
* Iterator that can be used to easily iterate over the children. This has
* the same restrictions on its use as GetChildArray does.
*/
class ChildIterator {
public:
ChildIterator(const nsINode* aNode) { Init(aNode); }
ChildIterator(const nsINode* aNode, PRUint32 aOffset) {
Init(aNode);
Advance(aOffset);
}
~ChildIterator() {
NS_ASSERTION(!mGuard.Mutated(0), "Unexpected mutations happened");
}
PRBool IsDone() const { return mCur == mEnd; }
operator nsIContent*() const { return *mCur; }
void Next() { NS_PRECONDITION(mCur != mEnd, "Check IsDone"); ++mCur; }
void Advance(PRUint32 aOffset) {
NS_ASSERTION(mCur + aOffset <= mEnd, "Unexpected offset");
mCur += aOffset;
}
private:
void Init(const nsINode* aNode) {
NS_PRECONDITION(aNode, "Must have node here!");
PRUint32 childCount;
mCur = aNode->GetChildArray(&childCount);
mEnd = mCur + childCount;
}
#ifdef DEBUG
nsMutationGuard mGuard;
#endif
nsIContent* const * mCur;
nsIContent* const * mEnd;
};
/**
* The default script type (language) ID for this node.
* All nodes must support fetching the default script language.
@ -1366,6 +1333,22 @@ protected:
nsresult doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify, nsAttrAndChildArray& aChildArray);
/* Event stuff that documents and elements share. This needs to be
NS_IMETHOD because some subclasses implement DOM methods with
this exact name and signature and then the calling convention
needs to match. */
#define EVENT(name_, id_, type_, struct_) \
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
#define TOUCH_EVENT EVENT
#include "nsEventNameList.h"
#undef TOUCH_EVENT
#undef EVENT
static void Trace(nsINode *tmp, TraceCallback cb, void *closure);
static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
static void Unlink(nsINode *tmp);
nsCOMPtr<nsINodeInfo> mNodeInfo;
nsINode* mParent;

Просмотреть файл

@ -51,7 +51,7 @@ interface nsIDOMClientRect;
/**
* This interface represents a content node that loads objects.
*/
[scriptable, uuid(107e8048-d00f-4711-bd21-97184ccae0b1)]
[scriptable, uuid(6D8914C7-0E22-4452-8962-11B69BBE84D7)]
interface nsIObjectLoadingContent : nsISupports
{
const unsigned long TYPE_LOADING = 0;
@ -86,24 +86,6 @@ interface nsIObjectLoadingContent : nsISupports
*/
[noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance;
/**
* Makes sure that a frame for this object exists, and that the plugin is
* instantiated. This method does nothing if the type is not #TYPE_PLUGIN.
* There is no guarantee that there will be a frame after this method is
* called; for example, the node may have a display:none style. If plugin
* instantiation is possible, it will be done synchronously by this method,
* and the plugin instance will be returned. A success return value does not
* necessarily mean that the instance is nonnull.
*
* This is a noscript method because it is internal and will go away once
* plugin loading moves to content.
*
* @note If there is an error instantiating the plugin, this method will
* trigger fallback to replacement content, and the type will change (and
* this method will return a failure code)
*/
[noscript] nsNPAPIPluginInstancePtr ensureInstantiation();
/**
* Tells the content about an associated object frame.
* This can be called multiple times for different frames.
@ -113,6 +95,8 @@ interface nsIObjectLoadingContent : nsISupports
*/
[noscript] void hasNewFrame(in nsIObjectFrame aFrame);
[noscript] void disconnectFrame();
/**
* If this object is in going to be printed, this method
* returns the nsIObjectFrame object which should be used when
@ -125,4 +109,8 @@ interface nsIObjectLoadingContent : nsISupports
in AString pluginDumpID,
in AString browserDumpID,
in boolean submittedCrashReport);
[noscript] void stopPluginInstance();
[noscript] void startPluginInstance();
};

Просмотреть файл

@ -153,14 +153,14 @@ interface nsISelectionPrivate : nsISelection
void GetRangesForInterval(
in nsIDOMNode beginNode, in PRInt32 beginOffset,
in nsIDOMNode endNode, in PRInt32 endOffset,
in PRBool allowAdjacent,
in boolean allowAdjacent,
out PRUint32 resultCount,
[retval, array, size_is(resultCount)] out nsIDOMRange results);
[noscript] void GetRangesForIntervalCOMArray(
in nsIDOMNode beginNode, in PRInt32 beginOffset,
in nsIDOMNode endNode, in PRInt32 endOffset,
in PRBool allowAdjacent,
in boolean allowAdjacent,
in RangeArray results);
/**

Просмотреть файл

@ -575,7 +575,13 @@ nsAttrAndChildArray::SetAndTakeMappedAttr(nsIAtom* aLocalName,
nsHTMLStyleSheet* aSheet)
{
nsRefPtr<nsMappedAttributes> mapped;
nsresult rv = GetModifiableMapped(aContent, aSheet, PR_TRUE,
PRBool willAdd = PR_TRUE;
if (mImpl && mImpl->mMappedAttrs) {
willAdd = mImpl->mMappedAttrs->GetAttr(aLocalName) == nsnull;
}
nsresult rv = GetModifiableMapped(aContent, aSheet, willAdd,
getter_AddRefs(mapped));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -46,7 +46,6 @@
// Interfaces needed to be included
#include "nsCopySupport.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMUIEvent.h"
#include "nsISelection.h"
#include "nsIDOMNode.h"

Просмотреть файл

@ -141,7 +141,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsUnicharUtilCIID.h"
#include "nsCompressedCharMap.h"
#include "nsINativeKeyBindings.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsXULPopupManager.h"
@ -2734,7 +2733,7 @@ nsContentUtils::ReportToConsole(PropertiesFile aFile,
PRUint32 aColumnNumber,
PRUint32 aErrorFlags,
const char *aCategory,
PRUint64 aWindowId)
PRUint64 aInnerWindowId)
{
NS_ASSERTION((aParams && aParamsLength) || (!aParams && !aParamsLength),
"Supply either both parameters and their number or no"
@ -2768,7 +2767,8 @@ nsContentUtils::ReportToConsole(PropertiesFile aFile,
NS_ConvertUTF8toUTF16(spec).get(), // file name
aSourceLine.get(),
aLineNumber, aColumnNumber,
aErrorFlags, aCategory, aWindowId);
aErrorFlags, aCategory,
aInnerWindowId);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errorObject);
@ -2789,17 +2789,17 @@ nsContentUtils::ReportToConsole(PropertiesFile aFile,
nsIDocument* aDocument)
{
nsIURI* uri = aURI;
PRUint64 windowID = 0;
PRUint64 innerWindowID = 0;
if (aDocument) {
if (!uri) {
uri = aDocument->GetDocumentURI();
}
windowID = aDocument->OuterWindowID();
innerWindowID = aDocument->InnerWindowID();
}
return ReportToConsole(aFile, aMessageName, aParams, aParamsLength, uri,
aSourceLine, aLineNumber, aColumnNumber, aErrorFlags,
aCategory, windowID);
aCategory, innerWindowID);
}
PRBool
@ -4137,13 +4137,12 @@ nsContentUtils::DOMEventToNativeKeyEvent(nsIDOMKeyEvent* aKeyEvent,
nsNativeKeyEvent* aNativeEvent,
PRBool aGetCharCode)
{
nsCOMPtr<nsIDOMNSUIEvent> uievent = do_QueryInterface(aKeyEvent);
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aKeyEvent);
PRBool defaultPrevented;
uievent->GetPreventDefault(&defaultPrevented);
nsevent->GetPreventDefault(&defaultPrevented);
if (defaultPrevented)
return PR_FALSE;
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aKeyEvent);
PRBool trusted = PR_FALSE;
nsevent->GetIsTrusted(&trusted);
if (!trusted)
@ -5518,9 +5517,8 @@ nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
}
}
static already_AddRefed<LayerManager>
LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
bool* aAllowRetaining)
nsIWidget *
nsContentUtils::WidgetForDocument(nsIDocument *aDoc)
{
nsIDocument* doc = aDoc;
nsIDocument* displayDoc = doc->GetDisplayDocument();
@ -5555,15 +5553,7 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
if (rootView) {
nsIView* displayRoot = nsIViewManager::GetDisplayRootFor(rootView);
if (displayRoot) {
nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);
if (widget) {
nsRefPtr<LayerManager> manager =
widget->
GetLayerManager(aRequirePersistent ? nsIWidget::LAYER_MANAGER_PERSISTENT :
nsIWidget::LAYER_MANAGER_CURRENT,
aAllowRetaining);
return manager.forget();
}
return displayRoot->GetNearestWidget(nsnull);
}
}
}
@ -5572,6 +5562,22 @@ LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
return nsnull;
}
static already_AddRefed<LayerManager>
LayerManagerForDocumentInternal(nsIDocument *aDoc, bool aRequirePersistent,
bool* aAllowRetaining)
{
nsIWidget *widget = nsContentUtils::WidgetForDocument(aDoc);
if (widget) {
nsRefPtr<LayerManager> manager =
widget->GetLayerManager(aRequirePersistent ? nsIWidget::LAYER_MANAGER_PERSISTENT :
nsIWidget::LAYER_MANAGER_CURRENT,
aAllowRetaining);
return manager.forget();
}
return nsnull;
}
already_AddRefed<LayerManager>
nsContentUtils::LayerManagerForDocument(nsIDocument *aDoc, bool *aAllowRetaining)
{

Просмотреть файл

@ -60,7 +60,6 @@
#include "mozAutoDocUpdate.h"
#include "nsMutationEvent.h"
#include "nsPLDOMEvent.h"
#include "nsContentUtils.h" // NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
using namespace mozilla::dom;
@ -105,25 +104,25 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
if (!nsINode::Traverse(tmp, cb)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mChild)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMAttribute)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
nsINode::Trace(tmp, aCallback, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMAttribute)
nsINode::Unlink(tmp);
if (tmp->mChild) {
static_cast<nsTextNode*>(tmp->mChild)->UnbindFromAttribute();
NS_RELEASE(tmp->mChild);
tmp->mFirstChild = nsnull;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
DOMCI_NODE_DATA(Attr, nsDOMAttribute)

Просмотреть файл

@ -173,6 +173,7 @@
#include "nsIDOMPageTransitionEvent.h"
#include "nsFrameLoader.h"
#include "nsEscape.h"
#include "nsObjectLoadingContent.h"
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#endif // MOZ_MEDIA
@ -1701,6 +1702,8 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentTouch)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsITouchEventReceiver)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIInlineEventHandlers)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDocument)
@ -1823,7 +1826,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
// if we're uncollectable.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
if (nsCCUncollectableMarker::InGeneration(cb, tmp->GetMarkedCCGeneration())) {
if (!nsINode::Traverse(tmp, cb)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
@ -1831,16 +1834,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
tmp->mExternalResourceMap.Traverse(&cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
// Traverse the mChildren nsAttrAndChildArray.
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()); indx > 0; --indx) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildren[i]");
cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1));
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
// Traverse all nsIDocument pointer members.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedRootElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSecurityInfo)
@ -1899,7 +1898,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
nsINode::Trace(tmp, aCallback, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
@ -1911,6 +1910,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
nsAutoScriptBlocker scriptBlocker;
nsINode::Unlink(tmp);
// Unlink the mChildren nsAttrAndChildArray.
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()) - 1;
indx >= 0; --indx) {
@ -1928,9 +1929,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
tmp->mParentDocument = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages)
@ -3750,6 +3748,11 @@ NotifyActivityChanged(nsIContent *aContent, void *aUnused)
mediaElem->NotifyOwnerDocumentActivityChanged();
}
#endif
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aContent));
if (objectLoadingContent) {
nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
olc->NotifyOwnerDocumentActivityChanged();
}
}
void
@ -8453,7 +8456,7 @@ nsDocument::CaretPositionFromPoint(float aX, float aY, nsIDOMCaretPosition** aCa
PRInt64
nsIDocument::SizeOf() const
{
PRInt64 size = sizeof(*this);
PRInt64 size = MemoryReporter::GetBasicSize<nsIDocument, nsINode>(this);
for (nsIContent* node = GetFirstChild(); node;
node = node->GetNextNode(this)) {
@ -8471,3 +8474,14 @@ nsDocument::SizeOf() const
return size;
}
#define EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsDocument::GetOn##name_(JSContext *cx, jsval *vp) { \
return nsINode::GetOn##name_(cx, vp); \
} \
NS_IMETHODIMP nsDocument::SetOn##name_(JSContext *cx, const jsval &v) { \
return nsINode::SetOn##name_(cx, v); \
}
#define TOUCH_EVENT EVENT
#include "nsEventNameList.h"
#undef TOUCH_EVENT
#undef EVENT

Просмотреть файл

@ -98,6 +98,7 @@
#include "imgIRequest.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMTouchEvent.h"
#include "nsIInlineEventHandlers.h"
#include "nsDataHashtable.h"
#include "TimeStamp.h"
@ -492,7 +493,8 @@ class nsDocument : public nsIDocument,
public nsIRadioGroupContainer,
public nsIApplicationCacheContainer,
public nsStubMutationObserver,
public nsIDOMDocumentTouch
public nsIDOMDocumentTouch,
public nsIInlineEventHandlers
{
public:
typedef mozilla::dom::Element Element;
@ -781,9 +783,15 @@ public:
// nsIApplicationCacheContainer
NS_DECL_NSIAPPLICATIONCACHECONTAINER
// nsITouchEventReceiver
NS_DECL_NSITOUCHEVENTRECEIVER
// nsIDOMDocumentTouch
NS_DECL_NSIDOMDOCUMENTTOUCH
// nsIInlineEventHandlers
NS_DECL_NSIINLINEEVENTHANDLERS
virtual nsresult Init();
virtual void AddXMLEventsContent(nsIContent * aXMLEventsElement);

Просмотреть файл

@ -85,7 +85,7 @@ nsEventSource::nsEventSource() :
mLastConvertionResult(NS_OK),
mReadyState(nsIEventSource::CONNECTING),
mScriptLine(0),
mWindowID(0)
mInnerWindowID(0)
{
}
@ -253,7 +253,7 @@ nsEventSource::Init(nsIPrincipal* aPrincipal,
mScriptFile.AssignASCII(filename);
}
mWindowID = nsJSUtils::GetCurrentlyRunningCodeWindowID(cx);
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
}
// Get the load group for the page. When requesting we'll add ourselves to it.
@ -1072,7 +1072,7 @@ nsEventSource::PrintErrorOnConsole(const char *aBundleURI,
nsnull,
mScriptLine, 0,
nsIScriptError::errorFlag,
"Event Source", mWindowID);
"Event Source", mInnerWindowID);
// print the error message directly to the JS console
nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errObj);

Просмотреть файл

@ -252,12 +252,12 @@ protected:
// Event Source owner information:
// - the script file name
// - source code line number where the Event Source object was constructed.
// - the window ID of the outer window where the script lives. Note that this
// may not be the same as the Event Source owner window.
// - the ID of the inner window where the script lives. Note that this may not
// be the same as the Event Source owner window.
// These attributes are used for error reporting.
nsString mScriptFile;
PRUint32 mScriptLine;
PRUint64 mWindowID;
PRUint64 mInnerWindowID;
private:
nsEventSource(const nsEventSource& x); // prevent bad usage

Просмотреть файл

@ -93,7 +93,7 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericDOMDataNode)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
nsINode::Trace(tmp, aCallback, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
@ -101,28 +101,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericDOMDataNode)
// if we're uncollectable.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
nsIDocument* currentDoc = tmp->GetCurrentDoc();
if (currentDoc && nsCCUncollectableMarker::InGeneration(
cb, currentDoc->GetMarkedCCGeneration())) {
if (!nsINode::Traverse(tmp, cb)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
if (ownerDoc) {
ownerDoc->BindingManager()->Traverse(tmp, cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericDOMDataNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
nsINode::Unlink(tmp);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)

Просмотреть файл

@ -147,6 +147,8 @@
#include "nsSVGFeatures.h"
#include "nsDOMMemoryReporter.h"
#include "xpcpublic.h"
using namespace mozilla::dom;
namespace css = mozilla::css;
@ -172,6 +174,22 @@ nsINode::nsSlots::~nsSlots()
}
}
void
nsINode::nsSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildNodes");
cb.NoteXPCOMChild(mChildNodes);
}
void
nsINode::nsSlots::Unlink()
{
if (mChildNodes) {
mChildNodes->DropReference();
NS_RELEASE(mChildNodes);
}
}
//----------------------------------------------------------------------
nsINode::~nsINode()
@ -1140,6 +1158,63 @@ nsINode::GetContextForEventHandlers(nsresult* aRv)
return nsContentUtils::GetContextForEventHandlers(this, aRv);
}
/* static */
void
nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
{
nsContentUtils::TraceWrapper(tmp, cb, closure);
}
/* static */
bool
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
{
nsIDocument *currentDoc = tmp->GetCurrentDoc();
if (currentDoc &&
nsCCUncollectableMarker::InGeneration(cb, currentDoc->GetMarkedCCGeneration())) {
return false;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
nsSlots *slots = tmp->GetExistingSlots();
if (slots) {
slots->Traverse(cb);
}
if (tmp->HasProperties()) {
nsNodeUtils::TraverseUserData(tmp, cb);
}
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
nsContentUtils::TraverseListenerManager(tmp, cb);
}
return true;
}
/* static */
void
nsINode::Unlink(nsINode *tmp)
{
nsContentUtils::ReleaseWrapper(tmp, tmp);
nsSlots *slots = tmp->GetExistingSlots();
if (slots) {
slots->Unlink();
}
if (tmp->HasFlag(NODE_HAS_LISTENERMANAGER)) {
nsContentUtils::RemoveListenerManager(tmp);
tmp->UnsetFlags(NODE_HAS_LISTENERMANAGER);
}
if (tmp->HasProperties()) {
nsNodeUtils::UnlinkUserData(tmp);
}
}
//----------------------------------------------------------------------
nsEventStates
@ -2149,6 +2224,28 @@ nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
return nsGenericElement::doQuerySelectorAll(mNode, aSelector, aReturn);
}
//----------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_1(nsTouchEventReceiverTearoff, mElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTouchEventReceiverTearoff)
NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTouchEventReceiverTearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTouchEventReceiverTearoff)
//----------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_1(nsInlineEventHandlersTearoff, mElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInlineEventHandlersTearoff)
NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsInlineEventHandlersTearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsInlineEventHandlersTearoff)
//----------------------------------------------------------------------
nsGenericElement::nsDOMSlots::nsDOMSlots()
: nsINode::nsSlots(),
@ -2168,6 +2265,45 @@ nsGenericElement::nsDOMSlots::~nsDOMSlots()
}
}
void
nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
cb.NoteXPCOMChild(mStyle.get());
#ifdef MOZ_SMIL
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
cb.NoteXPCOMChild(mSMILOverrideStyle.get());
#endif // MOZ_SMIL
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
cb.NoteXPCOMChild(mAttributeMap.get());
if (aIsXUL) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mControllers");
cb.NoteXPCOMChild(mControllers);
}
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
}
void
nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
{
mStyle = nsnull;
#ifdef MOZ_SMIL
mSMILOverrideStyle = nsnull;
#endif // MOZ_SMIL
if (mAttributeMap) {
mAttributeMap->DropReference();
mAttributeMap = nsnull;
}
if (aIsXUL)
NS_IF_RELEASE(mControllers);
mChildrenList = nsnull;
}
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: Element(aNodeInfo)
{
@ -3617,7 +3753,7 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
pressure = static_cast<nsMouseEvent*>(aSourceEvent)->pressure;
inputSource = static_cast<nsMouseEvent*>(aSourceEvent)->inputSource;
} else if (aSourceEvent->eventStructType == NS_KEY_EVENT) {
inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_KEYBOARD;
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
}
event.pressure = pressure;
event.clickCount = clickCount;
@ -4086,9 +4222,7 @@ nsINode::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
nsINode::Unlink(tmp);
if (tmp->HasProperties() && tmp->IsXUL()) {
tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
@ -4116,17 +4250,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
slots->mStyle = nsnull;
#ifdef MOZ_SMIL
slots->mSMILOverrideStyle = nsnull;
#endif // MOZ_SMIL
if (slots->mAttributeMap) {
slots->mAttributeMap->DropReference();
slots->mAttributeMap = nsnull;
}
if (tmp->IsXUL())
NS_IF_RELEASE(slots->mControllers);
slots->mChildrenList = nsnull;
slots->Unlink(tmp->IsXUL());
}
}
@ -4139,7 +4263,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
nsINode::Trace(tmp, aCallback, aClosure);
NS_IMPL_CYCLE_COLLECTION_TRACE_END
static const char* kNSURIs[] = {
@ -4180,9 +4304,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
// if we're uncollectable.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
nsIDocument* currentDoc = tmp->GetCurrentDoc();
if (currentDoc && nsCCUncollectableMarker::InGeneration(
cb, currentDoc->GetMarkedCCGeneration())) {
if (!nsINode::Traverse(tmp, cb)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
@ -4191,9 +4313,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
ownerDoc->BindingManager()->Traverse(tmp, cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_LISTENERMANAGER
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_USERDATA
if (tmp->HasProperties() && tmp->IsXUL()) {
nsISupports* property =
static_cast<nsISupports*>
@ -4224,31 +4343,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
}
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
// Traverse any DOM slots of interest.
{
nsDOMSlots *slots = tmp->GetExistingDOMSlots();
if (slots) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mStyle");
cb.NoteXPCOMChild(slots->mStyle.get());
#ifdef MOZ_SMIL
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mSMILOverrideStyle");
cb.NoteXPCOMChild(slots->mSMILOverrideStyle.get());
#endif // MOZ_SMIL
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "slots mAttributeMap");
cb.NoteXPCOMChild(slots->mAttributeMap.get());
if (tmp->IsXUL())
cb.NoteXPCOMChild(slots->mControllers);
cb.NoteXPCOMChild(
static_cast<nsIDOMNodeList*>(slots->mChildrenList.get()));
slots->Traverse(cb, tmp->IsXUL());
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -4265,6 +4366,10 @@ NS_INTERFACE_MAP_BEGIN(nsGenericElement)
new nsNodeSelectorTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsITouchEventReceiver,
new nsTouchEventReceiverTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIInlineEventHandlers,
new nsInlineEventHandlersTearoff(this))
// nsNodeSH::PreCreate() depends on the identity pointer being the
// same as nsINode (which nsIContent inherits), so if you change the
// below line, make sure nsNodeSH::PreCreate() still does the right
@ -5374,6 +5479,20 @@ nsNSElementTearoff::MozMatchesSelector(const nsAString& aSelector, PRBool* aRetu
return rv;
}
PRInt64
nsINode::SizeOf() const
{
PRInt64 size = sizeof(*this);
nsEventListenerManager* elm =
const_cast<nsINode*>(this)->GetListenerManager(PR_FALSE);
if (elm) {
size += elm->SizeOf();
}
return size;
}
PRInt64
nsGenericElement::SizeOf() const
{
@ -5385,3 +5504,30 @@ nsGenericElement::SizeOf() const
return size;
}
#define EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsINode::GetOn##name_(JSContext *cx, jsval *vp) { \
nsEventListenerManager *elm = GetListenerManager(PR_FALSE); \
if (elm) { \
elm->GetJSEventListener(nsGkAtoms::on##name_, vp); \
} else { \
*vp = JSVAL_NULL; \
} \
return NS_OK; \
} \
NS_IMETHODIMP nsINode::SetOn##name_(JSContext *cx, const jsval &v) { \
nsEventListenerManager *elm = GetListenerManager(PR_TRUE); \
if (!elm) { \
return NS_ERROR_OUT_OF_MEMORY; \
} \
\
JSObject *obj = GetWrapper(); \
if (!obj) { \
/* Just silently do nothing */ \
return NS_OK; \
} \
return elm->SetJSEventListenerToJsval(nsGkAtoms::on##name_, cx, obj, v); \
}
#define TOUCH_EVENT EVENT
#include "nsEventNameList.h"
#undef TOUCH_EVENT
#undef EVENT

Просмотреть файл

@ -64,6 +64,8 @@
#include "nsIDOMDOMStringMap.h"
#include "nsContentList.h"
#include "nsDOMClassInfoID.h" // DOMCI_DATA
#include "nsIDOMTouchEvent.h"
#include "nsIInlineEventHandlers.h"
#ifdef MOZ_SMIL
#include "nsISMILAttr.h"
@ -199,8 +201,6 @@ private:
nsCOMPtr<nsINode> mNode;
};
#define NS_EVENT_TEAROFF_CACHE_SIZE 4
/**
* A tearoff class for nsGenericElement to implement NodeSelector
*/
@ -226,6 +226,8 @@ private:
// Forward declare to allow being a friend
class nsNSElementTearoff;
class nsTouchEventReceiverTearoff;
class nsInlineEventHandlersTearoff;
/**
* A generic base class for DOM elements, implementing many nsIContent,
@ -238,6 +240,8 @@ public:
virtual ~nsGenericElement();
friend class nsNSElementTearoff;
friend class nsTouchEventReceiverTearoff;
friend class nsInlineEventHandlersTearoff;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -822,6 +826,9 @@ public:
nsDOMSlots();
virtual ~nsDOMSlots();
void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
void Unlink(bool aIsXUL);
/**
* The .style attribute (an interface that forwards to the actual
* style rules)
@ -1057,6 +1064,46 @@ private:
nsRefPtr<nsGenericElement> mContent;
};
/**
* Tearoff class to implement nsITouchEventReceiver
*/
class nsTouchEventReceiverTearoff : public nsITouchEventReceiver
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_FORWARD_NSITOUCHEVENTRECEIVER(mElement->)
NS_DECL_CYCLE_COLLECTION_CLASS(nsTouchEventReceiverTearoff)
nsTouchEventReceiverTearoff(nsGenericElement *aElement) : mElement(aElement)
{
}
private:
nsRefPtr<nsGenericElement> mElement;
};
/**
* Tearoff class to implement nsIInlineEventHandlers
*/
class nsInlineEventHandlersTearoff : public nsIInlineEventHandlers
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_FORWARD_NSIINLINEEVENTHANDLERS(mElement->)
NS_DECL_CYCLE_COLLECTION_CLASS(nsInlineEventHandlersTearoff)
nsInlineEventHandlersTearoff(nsGenericElement *aElement) : mElement(aElement)
{
}
private:
nsRefPtr<nsGenericElement> mElement;
};
#define NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE \
rv = nsGenericElement::QueryInterface(aIID, aInstancePtr); \
if (NS_SUCCEEDED(rv)) \

Просмотреть файл

@ -80,7 +80,6 @@ GK_ATOM(a, "a")
GK_ATOM(abbr, "abbr")
GK_ATOM(abort, "abort")
GK_ATOM(above, "above")
GK_ATOM(absoluteList, "Absolute-list")
GK_ATOM(acceltext, "acceltext")
GK_ATOM(accept, "accept")
GK_ATOM(acceptcharset, "accept-charset")
@ -167,14 +166,12 @@ GK_ATOM(broadcast, "broadcast")
GK_ATOM(broadcaster, "broadcaster")
GK_ATOM(broadcasterset, "broadcasterset")
GK_ATOM(browser, "browser")
GK_ATOM(bulletList, "Bullet-list")
GK_ATOM(bulletinboard, "bulletinboard")
GK_ATOM(button, "button")
GK_ATOM(callTemplate, "call-template")
GK_ATOM(cancel, "cancel")
GK_ATOM(canvas, "canvas")
GK_ATOM(caption, "caption")
GK_ATOM(captionList, "Caption-list")
GK_ATOM(capture, "capture")
GK_ATOM(caseOrder, "case-order")
GK_ATOM(cdataSectionElements, "cdata-section-elements")
@ -215,7 +212,6 @@ GK_ATOM(codebase, "codebase")
GK_ATOM(codetype, "codetype")
GK_ATOM(col, "col")
GK_ATOM(colgroup, "colgroup")
GK_ATOM(colGroupList, "ColGroup-list")
GK_ATOM(collapse, "collapse")
GK_ATOM(collapsed, "collapsed")
GK_ATOM(color, "color")
@ -360,7 +356,6 @@ GK_ATOM(error, "error")
GK_ATOM(even, "even")
GK_ATOM(event, "event")
GK_ATOM(events, "events")
GK_ATOM(excessOverflowContainersList, "ExcessOverflowContainers-list")
GK_ATOM(excludeResultPrefixes, "exclude-result-prefixes")
GK_ATOM(excludes, "excludes")
GK_ATOM(expr, "expr")
@ -375,13 +370,11 @@ GK_ATOM(fieldset, "fieldset")
GK_ATOM(figcaption, "figcaption")
GK_ATOM(figure, "figure")
GK_ATOM(fixed, "fixed")
GK_ATOM(fixedList, "Fixed-list")
GK_ATOM(flags, "flags")
GK_ATOM(flex, "flex")
GK_ATOM(flexgroup, "flexgroup")
GK_ATOM(flip, "flip")
GK_ATOM(floating, "floating")
GK_ATOM(floatList, "Float-list")
GK_ATOM(floor, "floor")
GK_ATOM(flowlength, "flowlength")
GK_ATOM(focus, "focus")
@ -749,10 +742,7 @@ GK_ATOM(orientation, "orientation")
GK_ATOM(otherwise, "otherwise")
GK_ATOM(output, "output")
GK_ATOM(overflow, "overflow")
GK_ATOM(overflowList, "Overflow-list")
GK_ATOM(overflowchanged, "overflowchanged")
GK_ATOM(overflowContainersList, "OverflowContainers-list")
GK_ATOM(overflowOutOfFlowList, "OverflowOutOfFlow-list")
GK_ATOM(overlay, "overlay")
GK_ATOM(overlap, "overlap")
GK_ATOM(p, "p")
@ -787,7 +777,6 @@ GK_ATOM(pointSize, "point-size")
GK_ATOM(poly, "poly")
GK_ATOM(polygon, "polygon")
GK_ATOM(popup, "popup")
GK_ATOM(popupList, "Popup-list")
GK_ATOM(popupalign, "popupalign")
GK_ATOM(popupanchor, "popupanchor")
GK_ATOM(popupgroup, "popupgroup")
@ -828,7 +817,6 @@ GK_ATOM(propagate, "propagate")
GK_ATOM(properties, "properties")
GK_ATOM(property, "property")
GK_ATOM(pubdate, "pubdate")
GK_ATOM(pushedFloatsList, "PushedFloats-list")
GK_ATOM(q, "q")
GK_ATOM(query, "query")
GK_ATOM(queryset, "queryset")
@ -893,7 +881,6 @@ GK_ATOM(scrollcorner, "scrollcorner")
GK_ATOM(scrolling, "scrolling")
GK_ATOM(section, "section")
GK_ATOM(select, "select")
GK_ATOM(selectPopupList, "selectPopupList")
GK_ATOM(selectable, "selectable")
GK_ATOM(selected, "selected")
GK_ATOM(selectedIndex, "selectedIndex")

Просмотреть файл

@ -66,6 +66,7 @@
#include "jsobj.h"
#include "jsgc.h"
#include "xpcpublic.h"
#include "nsObjectLoadingContent.h"
using namespace mozilla::dom;
@ -575,15 +576,20 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
}
}
#ifdef MOZ_MEDIA
if (wasRegistered && oldDoc != newDoc) {
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aNode));
if (domMediaElem) {
nsHTMLMediaElement* mediaElem = static_cast<nsHTMLMediaElement*>(aNode);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
}
#endif
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));
if (objectLoadingContent) {
nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
olc->NotifyOwnerDocumentActivityChanged();
}
}
// nsImageLoadingContent needs to know when its document changes
if (oldDoc != newDoc) {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -53,11 +53,15 @@
#include "nsIObjectLoadingContent.h"
#include "nsIRunnable.h"
#include "nsIFrame.h"
#include "nsPluginInstanceOwner.h"
#include "nsIThreadInternal.h"
class nsAsyncInstantiateEvent;
class nsStopPluginRunnable;
class AutoNotifier;
class AutoFallback;
class AutoSetInstantiatingToFalse;
class nsObjectFrame;
enum PluginSupportState {
ePluginUnsupported, // The plugin is not supported (e.g. not installed)
@ -96,6 +100,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
friend class AutoNotifier;
friend class AutoFallback;
friend class AutoSetInstantiatingToFalse;
friend class nsStopPluginRunnable;
friend class nsAsyncInstantiateEvent;
public:
// This enum's values must be the same as the constants on
@ -138,7 +144,16 @@ class nsObjectLoadingContent : public nsImageLoadingContent
{
mNetworkCreated = aNetworkCreated;
}
// Both "InstantiatePluginInstance" methods can flush layout.
nsresult InstantiatePluginInstance(nsIChannel* aChannel,
nsIStreamListener** aStreamListener);
nsresult InstantiatePluginInstance(const char* aMimeType, nsIURI* aURI);
void NotifyOwnerDocumentActivityChanged();
protected:
/**
* Load the object from the given URI.
* @param aURI The URI to load.
@ -222,10 +237,18 @@ class nsObjectLoadingContent : public nsImageLoadingContent
*/
void RemovedFromDocument();
void Traverse(nsCycleCollectionTraversalCallback &cb);
static void Traverse(nsObjectLoadingContent *tmp,
nsCycleCollectionTraversalCallback &cb);
void CreateStaticClone(nsObjectLoadingContent* aDest) const;
static void DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop);
private:
void TryNotifyContentObjectWrapper();
void NotifyContentObjectWrapper();
/**
* Check whether the given request represents a successful load.
*/
@ -304,7 +327,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
eFlushLayout,
eDontFlush
};
nsIObjectFrame* GetExistingFrame(FlushType aFlushType);
nsObjectFrame* GetExistingFrame(FlushType aFlushType);
/**
* Handle being blocked by a content policy. aStatus is the nsresult
@ -314,22 +337,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void HandleBeingBlockedByContentPolicy(nsresult aStatus,
PRInt16 aRetval);
/**
* Checks if we have a frame that's ready for instantiation, and
* if so, calls Instantiate(). Note that this can cause the frame
* to be deleted while we're instantiating the plugin.
*/
nsresult TryInstantiate(const nsACString& aMIMEType, nsIURI* aURI);
/**
* Instantiates the plugin. This differs from
* GetFrame()->Instantiate() in that it ensures that the URI will
* be non-null, and that a MIME type will be passed. Note that
* this can cause the frame to be deleted while we're
* instantiating the plugin.
*/
nsresult Instantiate(nsIObjectFrame* aFrame, const nsACString& aMIMEType, nsIURI* aURI);
/**
* Get the plugin support state for the given content node and MIME type.
* This is used for purposes of determining whether to fire PluginNotFound
@ -413,8 +420,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
nsWeakFrame mPrintFrame;
friend class nsAsyncInstantiateEvent;
nsRefPtr<nsPluginInstanceOwner> mInstanceOwner;
};
#endif

Просмотреть файл

@ -357,7 +357,7 @@ nsWebSocketEstablishedConnection::PrintErrorOnConsole(const char *aBundleURI,
NS_ConvertUTF8toUTF16(mOwner->GetScriptFile()).get(),
nsnull,
mOwner->GetScriptLine(), 0, nsIScriptError::errorFlag,
"Web Socket", mOwner->WindowID()
"Web Socket", mOwner->InnerWindowID()
);
// print the error message directly to the JS console
@ -631,7 +631,7 @@ nsWebSocket::nsWebSocket() : mKeepingAlive(PR_FALSE),
mReadyState(nsIMozWebSocket::CONNECTING),
mOutgoingBufferedAmount(0),
mScriptLine(0),
mWindowID(0)
mInnerWindowID(0)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
}
@ -1428,7 +1428,7 @@ nsWebSocket::Init(nsIPrincipal* aPrincipal,
}
}
mWindowID = nsJSUtils::GetCurrentlyRunningCodeWindowID(cx);
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
}
// parses the url

Просмотреть файл

@ -99,7 +99,7 @@ public:
// Determine if preferences allow WebSocket
static PRBool PrefEnabled();
const PRUint64 WindowID() const { return mWindowID; }
const PRUint64 InnerWindowID() const { return mInnerWindowID; }
const nsCString& GetScriptFile() const { return mScriptFile; }
const PRUint32 GetScriptLine() const { return mScriptLine; }
@ -164,12 +164,12 @@ protected:
// Web Socket owner information:
// - the script file name, UTF8 encoded.
// - source code line number where the Web Socket object was constructed.
// - the window ID of the outer window where the script lives. Note that this
// may not be the same as the Web Socket owner window.
// - the ID of the inner window where the script lives. Note that this may not
// be the same as the Web Socket owner window.
// These attributes are used for error reporting.
nsCString mScriptFile;
PRUint32 mScriptLine;
PRUint64 mWindowID;
PRUint64 mInnerWindowID;
private:
nsWebSocket(const nsWebSocket& x); // prevent bad usage

Просмотреть файл

@ -1230,23 +1230,20 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
return rv;
}
nsresult
nsXMLHttpRequest::GetLoadGroup(nsILoadGroup **aLoadGroup)
already_AddRefed<nsILoadGroup>
nsXMLHttpRequest::GetLoadGroup() const
{
NS_ENSURE_ARG_POINTER(aLoadGroup);
*aLoadGroup = nsnull;
if (mState & XML_HTTP_REQUEST_BACKGROUND) {
return NS_OK;
return nsnull;
}
nsCOMPtr<nsIDocument> doc =
nsContentUtils::GetDocumentFromScriptContext(mScriptContext);
if (doc) {
*aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed
return doc->GetDocumentLoadGroup();
}
return NS_OK;
return nsnull;
}
nsresult
@ -1493,8 +1490,7 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
// When we are called from JS we can find the load group for the page,
// and add ourselves to it. This way any pending requests
// will be automatically aborted if the user leaves the page.
nsCOMPtr<nsILoadGroup> loadGroup;
GetLoadGroup(getter_AddRefs(loadGroup));
nsCOMPtr<nsILoadGroup> loadGroup = GetLoadGroup();
// get Content Security Policy from principal to pass into channel
nsCOMPtr<nsIChannelPolicy> channelPolicy;
@ -1728,6 +1724,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
mResponseBody.Truncate();
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
mResponseBlob = nsnull;
mResultArrayBuffer = nsnull;
// Set up responseXML
PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
@ -2075,7 +2072,7 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult,
// nsIInputStream?
nsCOMPtr<nsIInputStream> stream = do_QueryInterface(supports);
if (stream) {
*aResult = stream.forget().get();
stream.forget(aResult);
aCharset.Truncate();
return NS_OK;

Просмотреть файл

@ -214,7 +214,7 @@ protected:
// Change the state of the object with this. The broadcast argument
// determines if the onreadystatechange listener should be called.
nsresult ChangeState(PRUint32 aState, PRBool aBroadcast = PR_TRUE);
nsresult GetLoadGroup(nsILoadGroup **aLoadGroup);
already_AddRefed<nsILoadGroup> GetLoadGroup() const;
nsIURI *GetBaseURI();
nsresult RemoveAddEventListener(const nsAString& aType,

Просмотреть файл

@ -121,6 +121,17 @@ ab = xhr.response;
ok(ab != null, "should have a non-null arraybuffer");
arraybuffer_equals_to(ab, "hello pass\n");
// test reusing the same XHR (Bug 680816)
xhr.open("GET", 'file_XHR_binary1.bin', false);
xhr.responseType = 'arraybuffer';
xhr.send(null);
is(xhr.status, 200, "wrong status");
ab2 = xhr.response;
ok(ab2 != null, "should have a non-null arraybuffer");
ok(ab2 != ab, "arraybuffer on XHR reuse should be distinct");
arraybuffer_equals_to(ab, "hello pass\n");
arraybuffer_equals_to(ab2, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
// with a binary file
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_binary1.bin', false);

Просмотреть файл

@ -492,7 +492,9 @@ protected:
PRBool ValidateAttribIndex(WebGLuint index, const char *info);
PRBool ValidateStencilParamsForDrawCall();
bool ValidateGLSLIdentifier(const nsAString& name, const char *info);
bool ValidateGLSLVariableName(const nsAString& name, const char *info);
bool ValidateGLSLCharacter(PRUnichar c);
bool ValidateGLSLString(const nsAString& string, const char *info);
static PRUint32 GetTexelSize(WebGLenum format, WebGLenum type);

Просмотреть файл

@ -62,6 +62,7 @@
#endif
#include "WebGLTexelConversions.h"
#include "WebGLValidateStrings.h"
using namespace mozilla;
@ -182,8 +183,8 @@ WebGLContext::BindAttribLocation(nsIWebGLProgram *pobj, WebGLuint location, cons
if (!GetGLName<WebGLProgram>("bindAttribLocation: program", pobj, &progname))
return NS_OK;
if (name.IsEmpty())
return ErrorInvalidValue("BindAttribLocation: name can't be null or empty");
if (!ValidateGLSLVariableName(name, "bindAttribLocation"))
return NS_OK;
if (!ValidateAttribIndex(location, "bindAttribLocation"))
return NS_OK;
@ -1839,7 +1840,7 @@ WebGLContext::GetAttribLocation(nsIWebGLProgram *pobj,
if (!GetGLName<WebGLProgram>("getAttribLocation: program", pobj, &progname))
return NS_OK;
if (!ValidateGLSLIdentifier(name, "getAttribLocation"))
if (!ValidateGLSLVariableName(name, "getAttribLocation"))
return NS_OK;
MakeContextCurrent();
@ -2664,7 +2665,7 @@ WebGLContext::GetUniformLocation(nsIWebGLProgram *pobj, const nsAString& name, n
if (!GetConcreteObjectAndGLName("getUniformLocation: program", pobj, &prog, &progname))
return NS_OK;
if (!ValidateGLSLIdentifier(name, "getUniformLocation"))
if (!ValidateGLSLVariableName(name, "getUniformLocation"))
return NS_OK;
MakeContextCurrent();
@ -3166,8 +3167,8 @@ WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, We
if (target != LOCAL_GL_RENDERBUFFER)
return ErrorInvalidEnumInfo("renderbufferStorage: target", target);
if (width <= 0 || height <= 0)
return ErrorInvalidValue("renderbufferStorage: width and height must be > 0");
if (width < 0 || height < 0)
return ErrorInvalidValue("renderbufferStorage: width and height must be >= 0");
if (!mBoundRenderbuffer || !mBoundRenderbuffer->GLName())
return ErrorInvalidOperation("renderbufferStorage called on renderbuffer 0");
@ -4131,7 +4132,10 @@ WebGLContext::ShaderSource(nsIWebGLShader *sobj, const nsAString& source)
WebGLuint shadername;
if (!GetConcreteObjectAndGLName("shaderSource: shader", sobj, &shader, &shadername))
return NS_OK;
if (!ValidateGLSLString(source, "shaderSource"))
return NS_OK;
const nsPromiseFlatString& flatSource = PromiseFlatString(source);
if (!NS_IsAscii(flatSource.get()))

Просмотреть файл

@ -328,14 +328,31 @@ PRBool WebGLContext::ValidateDrawModeEnum(WebGLenum mode, const char *info)
}
}
bool WebGLContext::ValidateGLSLIdentifier(const nsAString& name, const char *info)
bool WebGLContext::ValidateGLSLVariableName(const nsAString& name, const char *info)
{
const PRUint32 maxSize = 4095;
const PRUint32 maxSize = 255;
if (name.Length() > maxSize) {
ErrorInvalidValue("%s: identifier is %d characters long, exceeds the maximum allowed length of %d characters",
info, name.Length(), maxSize);
return false;
}
if (!ValidateGLSLString(name, info)) {
return false;
}
return true;
}
bool WebGLContext::ValidateGLSLString(const nsAString& string, const char *info)
{
for (PRUint32 i = 0; i < string.Length(); ++i) {
if (!ValidateGLSLCharacter(string.CharAt(i))) {
ErrorInvalidValue("%s: string contains the illegal character '%d'", info, string.CharAt(i));
return false;
}
}
return true;
}

Просмотреть файл

@ -0,0 +1,58 @@
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
* Copyright (C) 2011 Mozilla Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WEBGLVALIDATESTRINGS_H_
#define WEBGLVALIDATESTRINGS_H_
#include "WebGLContext.h"
namespace mozilla {
// The following function was taken from the WebKit WebGL implementation,
// which can be found here:
// http://trac.webkit.org/browser/trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp#L123
/****** BEGIN CODE TAKEN FROM WEBKIT ******/
bool WebGLContext::ValidateGLSLCharacter(PRUnichar c)
{
// Printing characters are valid except " $ ` @ \ ' DEL.
if (c >= 32 && c <= 126 &&
c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'')
{
return true;
}
// Horizontal tab, line feed, vertical tab, form feed, carriage return are also valid.
if (c >= 9 && c <= 13) {
return true;
}
return false;
}
/****** END CODE TAKEN FROM WEBKIT ******/
} // end namespace mozilla
#endif // WEBGLVALIDATESTRINGS_H_

Просмотреть файл

@ -13,7 +13,6 @@ conformance/gl-getshadersource.html
conformance/gl-uniform-bool.html
conformance/glsl-conformance.html
conformance/glsl-long-variable-names.html
conformance/invalid-passed-params.html
conformance/object-deletion-behaviour.html
conformance/premultiplyalpha-test.html
conformance/read-pixels-test.html

Просмотреть файл

@ -7,7 +7,6 @@ conformance/gl-getshadersource.html
conformance/gl-object-get-calls.html
conformance/glsl-conformance.html
conformance/glsl-long-variable-names.html
conformance/invalid-passed-params.html
conformance/object-deletion-behaviour.html
conformance/premultiplyalpha-test.html
conformance/program-test.html

Просмотреть файл

@ -5,7 +5,6 @@ conformance/framebuffer-object-attachment.html
conformance/gl-getshadersource.html
conformance/glsl-conformance.html
conformance/glsl-long-variable-names.html
conformance/invalid-passed-params.html
conformance/object-deletion-behaviour.html
conformance/premultiplyalpha-test.html
conformance/read-pixels-test.html

Просмотреть файл

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var frame = document.getElementById("f");
var frameWin = frame.contentWindow;
frame.parentNode.removeChild(frame);
frameWin.onmouseover = function(){};
}
</script>
</head>
<body onload="boom();">
<iframe id="f" src="data:text/html,1"></iframe>
</body>
</html>

Просмотреть файл

@ -4,5 +4,6 @@ load 135345-1.html
load 422009-1.xhtml
load 457776-1.html
load 496308-1.html
load 682637-1.html
load recursive-onload.html
load recursive-DOMNodeInserted.html

Просмотреть файл

@ -54,7 +54,7 @@ nsDOMDragEvent::nsDOMDragEvent(nsPresContext* aPresContext,
mEventIsInternal = PR_TRUE;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_UNKNOWN;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
}

Просмотреть файл

@ -144,8 +144,9 @@ nsDOMKeyboardEvent::GetKeyCode(PRUint32* aKeyCode)
return NS_OK;
}
NS_IMETHODIMP
nsDOMKeyboardEvent::GetWhich(PRUint32* aWhich)
/* virtual */
nsresult
nsDOMKeyboardEvent::Which(PRUint32* aWhich)
{
NS_ENSURE_ARG_POINTER(aWhich);

Просмотреть файл

@ -57,8 +57,9 @@ public:
// Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT
protected:
// Specific implementation for a keyboard event.
NS_IMETHOD GetWhich(PRUint32 *aWhich);
virtual nsresult Which(PRUint32* aWhich);
};

Просмотреть файл

@ -59,7 +59,7 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
mEventIsInternal = PR_TRUE;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_UNKNOWN;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
switch (mEvent->eventStructType)
@ -98,7 +98,6 @@ DOMCI_DATA(MouseEvent, nsDOMMouseEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSMouseEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MouseEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
@ -282,8 +281,9 @@ nsDOMMouseEvent::GetMetaKey(PRBool* aIsDown)
return NS_OK;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetWhich(PRUint32* aWhich)
/* virtual */
nsresult
nsDOMMouseEvent::Which(PRUint32* aWhich)
{
NS_ENSURE_ARG_POINTER(aWhich);
PRUint16 button;

Просмотреть файл

@ -41,13 +41,12 @@
#include "nsIDOMMouseEvent.h"
#include "nsDOMUIEvent.h"
#include "nsIDOMNSMouseEvent.h"
class nsIContent;
class nsEvent;
class nsDOMMouseEvent : public nsDOMUIEvent,
public nsIDOMNSMouseEvent
public nsIDOMMouseEvent
{
public:
nsDOMMouseEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);
@ -58,14 +57,12 @@ public:
// nsIDOMMouseEvent Interface
NS_DECL_NSIDOMMOUSEEVENT
// nsIDOMNSMouseEvent Interface
NS_DECL_NSIDOMNSMOUSEEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMUIEVENT
protected:
// Specific implementation for a mouse event.
NS_IMETHOD GetWhich(PRUint32 *aWhich);
virtual nsresult Which(PRUint32* aWhich);
};
#define NS_FORWARD_TO_NSDOMMOUSEEVENT \

Просмотреть файл

@ -51,7 +51,7 @@ nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(nsPresContext* aPresContext,
mEventIsInternal = PR_TRUE;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_UNKNOWN;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
if(mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {

Просмотреть файл

@ -51,7 +51,7 @@ nsDOMSimpleGestureEvent::nsDOMSimpleGestureEvent(nsPresContext* aPresContext, ns
mEventIsInternal = PR_TRUE;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_UNKNOWN;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
}

Просмотреть файл

@ -119,7 +119,6 @@ DOMCI_DATA(UIEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSUIEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(UIEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
@ -249,10 +248,7 @@ nsDOMUIEvent::GetPageY(PRInt32* aPageY)
NS_IMETHODIMP
nsDOMUIEvent::GetWhich(PRUint32* aWhich)
{
NS_ENSURE_ARG_POINTER(aWhich);
// Usually we never reach here, as this is reimplemented for mouse and keyboard events.
*aWhich = 0;
return NS_OK;
return Which(aWhich);
}
NS_IMETHODIMP

Просмотреть файл

@ -40,12 +40,10 @@
#define nsDOMUIEvent_h
#include "nsIDOMUIEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsDOMEvent.h"
class nsDOMUIEvent : public nsDOMEvent,
public nsIDOMUIEvent,
public nsIDOMNSUIEvent
public nsIDOMUIEvent
{
public:
nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent);
@ -56,9 +54,6 @@ public:
// nsIDOMUIEvent Interface
NS_DECL_NSIDOMUIEVENT
// nsIDOMNSUIEvent Interface
NS_DECL_NSIDOMNSUIEVENT
// nsIPrivateDOMEvent interface
NS_IMETHOD DuplicatePrivateData();
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
@ -68,15 +63,23 @@ public:
NS_FORWARD_TO_NSDOMEVENT
NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::)
protected:
protected:
// Internal helper functions
nsIntPoint GetClientPoint();
nsIntPoint GetScreenPoint();
nsIntPoint GetLayerPoint();
nsIntPoint GetPagePoint();
protected:
// Allow specializations.
virtual nsresult Which(PRUint32* aWhich)
{
NS_ENSURE_ARG_POINTER(aWhich);
// Usually we never reach here, as this is reimplemented for mouse and keyboard events.
*aWhich = 0;
return NS_OK;
}
nsCOMPtr<nsIDOMWindow> mView;
PRInt32 mDetail;
nsIntPoint mClientPoint;

Просмотреть файл

@ -81,6 +81,7 @@
#include "nsEventListenerService.h"
#include "nsDOMEvent.h"
#include "nsIContentSecurityPolicy.h"
#include "nsJSEnvironment.h"
using namespace mozilla::dom;
@ -166,7 +167,6 @@ nsEventListenerManager::RemoveAllListeners()
void
nsEventListenerManager::Shutdown()
{
sAddListenerID = JSID_VOID;
nsDOMEvent::Shutdown();
}
@ -377,8 +377,9 @@ nsresult
nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
void *aScopeObject,
nsIAtom* aName,
PRBool aIsString,
PRBool aPermitUntrustedEvents)
JSObject *aHandler,
PRBool aPermitUntrustedEvents,
nsListenerStruct **aListenerStruct)
{
nsresult rv = NS_OK;
PRUint32 eventType = nsContentUtils::GetEventId(aName);
@ -389,22 +390,27 @@ nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
// create and add a new one.
nsCOMPtr<nsIDOMEventListener> scriptListener;
rv = NS_NewJSEventListener(aContext, aScopeObject, mTarget, aName,
getter_AddRefs(scriptListener));
aHandler, getter_AddRefs(scriptListener));
if (NS_SUCCEEDED(rv)) {
AddEventListener(scriptListener, eventType, aName,
NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT);
ls = FindJSEventListener(eventType, aName);
}
} else {
ls->GetJSListener()->SetHandler(aHandler);
}
if (NS_SUCCEEDED(rv) && ls) {
// Set flag to indicate possible need for compilation later
ls->mHandlerIsString = aIsString;
ls->mHandlerIsString = !aHandler;
if (aPermitUntrustedEvents) {
ls->mFlags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
}
*aListenerStruct = ls;
} else {
*aListenerStruct = nsnull;
}
return rv;
@ -516,81 +522,16 @@ nsEventListenerManager::AddScriptEventListener(nsIAtom *aName,
void *scope = global->GetScriptGlobal(aLanguage);
nsListenerStruct *ls;
rv = SetJSEventListener(context, scope, aName, nsnull,
aPermitUntrustedEvents, &ls);
NS_ENSURE_SUCCESS(rv, rv);
if (!aDeferCompilation) {
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
do_QueryInterface(mTarget);
nsScriptObjectHolder handler(context);
PRBool done = PR_FALSE;
if (handlerOwner) {
rv = handlerOwner->GetCompiledEventHandler(aName, handler);
if (NS_SUCCEEDED(rv) && handler) {
rv = context->BindCompiledEventHandler(mTarget, scope, aName, handler);
if (NS_FAILED(rv))
return rv;
done = PR_TRUE;
}
}
if (!done) {
PRUint32 lineNo = 0;
nsCAutoString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
if (doc) {
nsIURI *uri = doc->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
}
}
if (handlerOwner) {
// Always let the handler owner compile the event handler, as
// it may want to use a special context or scope object.
rv = handlerOwner->CompileEventHandler(context, mTarget, aName,
aBody, url.get(), lineNo, handler);
}
else {
PRInt32 nameSpace = kNameSpaceID_Unknown;
if (node && node->IsNodeOfType(nsINode::eCONTENT)) {
nsIContent* content = static_cast<nsIContent*>(node.get());
nameSpace = content->GetNameSpaceID();
}
else if (doc) {
Element* root = doc->GetRootElement();
if (root)
nameSpace = root->GetNameSpaceID();
}
PRUint32 argCount;
const char **argNames;
nsContentUtils::GetEventArgNames(nameSpace, aName, &argCount,
&argNames);
nsCxPusher pusher;
if (!pusher.Push((JSContext*)context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}
rv = context->CompileEventHandler(aName, argCount, argNames,
aBody,
url.get(), lineNo,
SCRIPTVERSION_DEFAULT, // for now?
handler);
if (rv == NS_ERROR_ILLEGAL_VALUE) {
NS_WARNING("Probably a syntax error in the event handler!");
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
}
NS_ENSURE_SUCCESS(rv, rv);
// And bind it.
rv = context->BindCompiledEventHandler(mTarget, scope,
aName, handler);
}
if (NS_FAILED(rv)) return rv;
}
return CompileEventHandlerInternal(ls, PR_TRUE, &aBody);
}
return SetJSEventListener(context, scope, aName, aDeferCompilation,
aPermitUntrustedEvents);
return NS_OK;
}
void
@ -606,211 +547,153 @@ nsEventListenerManager::RemoveScriptEventListener(nsIAtom* aName)
}
}
jsid
nsEventListenerManager::sAddListenerID = JSID_VOID;
nsresult
nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext,
void *aScope,
nsIAtom *aName)
nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerStruct,
PRBool aNeedsCxPush,
const nsAString* aBody)
{
// Check that we have access to set an event listener. Prevents
// snooping attacks across domains by setting onkeypress handlers,
// for instance.
// You'd think it'd work just to get the JSContext from aContext,
// but that's actually the JSContext whose private object parents
// the object in mTarget.
nsresult rv;
nsCOMPtr<nsIJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
if (NS_FAILED(rv))
return rv;
JSContext *cx;
if (NS_FAILED(rv = stack->Peek(&cx)))
return rv;
NS_PRECONDITION(aListenerStruct->GetJSListener(),
"Why do we not have a JS listener?");
NS_PRECONDITION(aListenerStruct->mHandlerIsString,
"Why are we compiling a non-string JS listener?");
if (cx) {
if (sAddListenerID == JSID_VOID) {
JSAutoRequest ar(cx);
sAddListenerID =
INTERNED_STRING_TO_JSID(cx, ::JS_InternString(cx, "addEventListener"));
}
if (aContext->GetScriptTypeID() == nsIProgrammingLanguage::JAVASCRIPT) {
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
jsval v;
rv = nsContentUtils::WrapNative(cx, (JSObject *)aScope, mTarget, &v,
getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);
rv = nsContentUtils::GetSecurityManager()->
CheckPropertyAccess(cx, JSVAL_TO_OBJECT(v),
"EventTarget",
sAddListenerID,
nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
if (NS_FAILED(rv)) {
// XXX set pending exception on the native call context?
return rv;
}
} else {
NS_WARNING("Skipping CheckPropertyAccess for non JS language");
}
}
// Untrusted events are always permitted for non-chrome script
// handlers.
return SetJSEventListener(aContext, aScope, aName, PR_FALSE,
!nsContentUtils::IsCallerChrome());
}
nsresult
nsEventListenerManager::CompileScriptEventListener(nsIScriptContext *aContext,
void *aScope,
nsIAtom *aName,
PRBool *aDidCompile)
{
nsresult rv = NS_OK;
*aDidCompile = PR_FALSE;
PRUint32 eventType = nsContentUtils::GetEventId(aName);
nsListenerStruct* ls = FindJSEventListener(eventType, aName);
if (!ls) {
//nothing to compile
return NS_OK;
}
if (ls->mHandlerIsString) {
rv = CompileEventHandlerInternal(aContext, aScope, mTarget, aName,
ls, /*XXX fixme*/nsnull, PR_TRUE);
}
// Set *aDidCompile to true even if we didn't really compile
// anything right now, if we get here it means that this event
// handler has been compiled at some point, that's good enough for
// us.
*aDidCompile = PR_TRUE;
return rv;
}
nsresult
nsEventListenerManager::CompileEventHandlerInternal(nsIScriptContext *aContext,
void *aScope,
nsISupports *aObject,
nsIAtom *aName,
nsListenerStruct *aListenerStruct,
nsISupports* aCurrentTarget,
PRBool aNeedsCxPush)
{
nsresult result = NS_OK;
nsIJSEventListener *listener = aListenerStruct->GetJSListener();
NS_ASSERTION(!listener->GetHandler(), "What is there to compile?");
nsIScriptContext *context = listener->GetEventContext();
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
do_QueryInterface(aObject);
nsScriptObjectHolder handler(aContext);
do_QueryInterface(mTarget);
nsScriptObjectHolder handler(context);
if (handlerOwner) {
result = handlerOwner->GetCompiledEventHandler(aName,
result = handlerOwner->GetCompiledEventHandler(aListenerStruct->mTypeAtom,
handler);
if (NS_SUCCEEDED(result) && handler) {
// XXXmarkh - why do we bind here, but not after compilation below?
result = aContext->BindCompiledEventHandler(aObject, aScope, aName, handler);
aListenerStruct->mHandlerIsString = PR_FALSE;
} else {
// Make sure there's nothing in the holder in the failure case
handler.set(nsnull);
}
}
if (aListenerStruct->mHandlerIsString) {
// This should never happen for anything but content
// XXX I don't like that we have to reference content
// from here. The alternative is to store the event handler
// string on the JS object itself.
nsCOMPtr<nsIContent> content = do_QueryInterface(aObject);
NS_ASSERTION(content, "only content should have event handler attributes");
if (content) {
nsAutoString handlerBody;
nsIAtom* attrName = aName;
if (aName == nsGkAtoms::onSVGLoad)
// OK, we didn't find an existing compiled event handler. Flag us
// as not a string so we don't keep trying to compile strings
// which can't be compiled
aListenerStruct->mHandlerIsString = PR_FALSE;
// mTarget may not be an nsIContent if it's a window and we're
// getting an inline event listener forwarded from <html:body> or
// <html:frameset> or <xul:window> or the like.
// XXX I don't like that we have to reference content from
// here. The alternative is to store the event handler string on
// the nsIJSEventListener itself, and that still doesn't address
// the arg names issue.
nsCOMPtr<nsIContent> content = do_QueryInterface(mTarget);
nsAutoString handlerBody;
const nsAString* body = aBody;
if (content && !aBody) {
nsIAtom* attrName = aListenerStruct->mTypeAtom;
if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGLoad)
attrName = nsGkAtoms::onload;
else if (aName == nsGkAtoms::onSVGUnload)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGUnload)
attrName = nsGkAtoms::onunload;
else if (aName == nsGkAtoms::onSVGAbort)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGAbort)
attrName = nsGkAtoms::onabort;
else if (aName == nsGkAtoms::onSVGError)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGError)
attrName = nsGkAtoms::onerror;
else if (aName == nsGkAtoms::onSVGResize)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGResize)
attrName = nsGkAtoms::onresize;
else if (aName == nsGkAtoms::onSVGScroll)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGScroll)
attrName = nsGkAtoms::onscroll;
else if (aName == nsGkAtoms::onSVGZoom)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onSVGZoom)
attrName = nsGkAtoms::onzoom;
#ifdef MOZ_SMIL
else if (aName == nsGkAtoms::onbeginEvent)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onbeginEvent)
attrName = nsGkAtoms::onbegin;
else if (aName == nsGkAtoms::onrepeatEvent)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onrepeatEvent)
attrName = nsGkAtoms::onrepeat;
else if (aName == nsGkAtoms::onendEvent)
else if (aListenerStruct->mTypeAtom == nsGkAtoms::onendEvent)
attrName = nsGkAtoms::onend;
#endif // MOZ_SMIL
content->GetAttr(kNameSpaceID_None, attrName, handlerBody);
body = &handlerBody;
}
PRUint32 lineNo = 0;
nsCAutoString url (NS_LITERAL_CSTRING("javascript:alert('TODO: FIXME')"));
nsIDocument* doc = nsnull;
nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentTarget);
if (node) {
doc = node->GetOwnerDoc();
}
if (doc) {
nsIURI *uri = doc->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
}
}
nsCxPusher pusher;
if (aNeedsCxPush &&
!pusher.Push((JSContext*)aContext->GetNativeContext())) {
return NS_ERROR_FAILURE;
}
if (handlerOwner) {
// Always let the handler owner compile the event
// handler, as it may want to use a special
// context or scope object.
result = handlerOwner->CompileEventHandler(aContext, aObject, aName,
handlerBody,
url.get(), lineNo,
handler);
}
else {
PRUint32 argCount;
const char **argNames;
nsContentUtils::GetEventArgNames(content->GetNameSpaceID(), aName,
&argCount, &argNames);
result = aContext->CompileEventHandler(aName,
argCount, argNames,
handlerBody,
url.get(), lineNo,
SCRIPTVERSION_DEFAULT, // for now?
handler);
NS_ENSURE_SUCCESS(result, result);
// And bind it.
result = aContext->BindCompiledEventHandler(aObject, aScope,
aName, handler);
NS_ENSURE_SUCCESS(result, result);
}
if (NS_SUCCEEDED(result)) {
aListenerStruct->mHandlerIsString = PR_FALSE;
PRUint32 lineNo = 0;
nsCAutoString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
nsCOMPtr<nsIDocument> doc;
if (content) {
doc = content->GetOwnerDoc();
} else {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget);
if (win) {
doc = do_QueryInterface(win->GetExtantDocument());
}
}
if (doc) {
nsIURI *uri = doc->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
}
}
nsCxPusher pusher;
if (aNeedsCxPush &&
!pusher.Push((JSContext*)context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}
if (handlerOwner) {
// Always let the handler owner compile the event
// handler, as it may want to use a special
// context or scope object.
result = handlerOwner->CompileEventHandler(context,
aListenerStruct->mTypeAtom,
*body,
url.get(), lineNo,
handler);
} else {
PRUint32 argCount;
const char **argNames;
// If no content, then just use kNameSpaceID_None for the
// namespace ID. In practice, it doesn't matter since SVG is
// the only thing with weird arg names and SVG doesn't map event
// listeners to the window.
nsContentUtils::GetEventArgNames(content ?
content->GetNameSpaceID() :
kNameSpaceID_None,
aListenerStruct->mTypeAtom,
&argCount, &argNames);
result = context->CompileEventHandler(aListenerStruct->mTypeAtom,
argCount, argNames,
*body,
url.get(), lineNo,
SCRIPTVERSION_DEFAULT, // for now?
handler);
if (result == NS_ERROR_ILLEGAL_VALUE) {
NS_WARNING("Probably a syntax error in the event handler!");
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
}
NS_ENSURE_SUCCESS(result, result);
}
}
if (handler) {
// Bind it
nsScriptObjectHolder boundHandler(context);
context->BindCompiledEventHandler(mTarget, listener->GetEventScope(),
handler, boundHandler);
listener->SetHandler(boundHandler);
}
return result;
}
@ -828,34 +711,11 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
// compiled the event handler itself
if ((aListenerStruct->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) &&
aListenerStruct->mHandlerIsString) {
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(aListener);
if (jslistener) {
// We probably have the atom already.
nsCOMPtr<nsIAtom> atom = aListenerStruct->mTypeAtom;
if (!atom) {
nsAutoString eventString;
if (NS_SUCCEEDED(aDOMEvent->GetType(eventString))) {
atom = do_GetAtom(NS_LITERAL_STRING("on") + eventString);
}
}
if (atom) {
#ifdef DEBUG
nsAutoString type;
aDOMEvent->GetType(type);
nsCOMPtr<nsIAtom> eventAtom = do_GetAtom(NS_LITERAL_STRING("on") + type);
NS_ASSERTION(eventAtom == atom, "Something wrong with event atoms!");
#endif
result = CompileEventHandlerInternal(jslistener->GetEventContext(),
jslistener->GetEventScope(),
jslistener->GetEventTarget(),
atom, aListenerStruct,
aCurrentTarget,
!jslistener->GetEventContext() ||
jslistener->GetEventContext() !=
aPusher->GetCurrentScriptContext());
}
}
nsIJSEventListener *jslistener = aListenerStruct->GetJSListener();
result = CompileEventHandlerInternal(aListenerStruct,
jslistener->GetEventContext() !=
aPusher->GetCurrentScriptContext(),
nsnull);
}
if (NS_SUCCEEDED(result)) {
@ -1040,18 +900,10 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
PRBool systemGroup = !!(ls.mFlags & NS_EVENT_FLAG_SYSTEM_EVENT);
PRBool allowsUntrusted = !!(ls.mFlags & NS_PRIV_EVENT_UNTRUSTED_PERMITTED);
// If this is a script handler and we haven't yet
// compiled the event handler itself
// compiled the event handler itself go ahead and compile it
if ((ls.mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) && ls.mHandlerIsString) {
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(ls.mListener);
if (jslistener) {
CompileEventHandlerInternal(jslistener->GetEventContext(),
jslistener->GetEventScope(),
jslistener->GetEventTarget(),
ls.mTypeAtom,
const_cast<nsListenerStruct*>(&ls),
mTarget,
PR_TRUE);
}
CompileEventHandlerInternal(const_cast<nsListenerStruct*>(&ls),
PR_TRUE, nsnull);
}
const nsDependentSubstring& eventType =
Substring(nsDependentAtomString(ls.mTypeAtom), 2);
@ -1077,3 +929,71 @@ nsEventListenerManager::HasUnloadListeners()
}
return PR_FALSE;
}
nsresult
nsEventListenerManager::SetJSEventListenerToJsval(nsIAtom *aEventName,
JSContext *cx,
JSObject* aScope,
const jsval & v)
{
JSObject *handler;
if (JSVAL_IS_PRIMITIVE(v) ||
!JS_ObjectIsCallable(cx, handler = JSVAL_TO_OBJECT(v))) {
RemoveScriptEventListener(aEventName);
return NS_OK;
}
// We might not have a script context, e.g. if we're setting a listener
// on a dead Window.
nsIScriptContext *context = nsJSUtils::GetStaticScriptContext(cx, aScope);
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
JSObject *scope = ::JS_GetGlobalForObject(cx, aScope);
// Untrusted events are always permitted for non-chrome script
// handlers.
nsListenerStruct *ignored;
return SetJSEventListener(context, scope, aEventName, handler,
!nsContentUtils::IsCallerChrome(), &ignored);
}
void
nsEventListenerManager::GetJSEventListener(nsIAtom *aEventName, jsval *vp)
{
PRUint32 eventType = nsContentUtils::GetEventId(aEventName);
nsListenerStruct* ls = FindJSEventListener(eventType, aEventName);
*vp = JSVAL_NULL;
if (!ls) {
return;
}
nsIJSEventListener *listener = ls->GetJSListener();
if (listener->GetEventContext()->GetScriptTypeID() !=
nsIProgrammingLanguage::JAVASCRIPT) {
// Not JS, so no point doing anything with it.
return;
}
if (ls->mHandlerIsString) {
CompileEventHandlerInternal(ls, PR_TRUE, nsnull);
}
*vp = OBJECT_TO_JSVAL(static_cast<JSObject*>(listener->GetHandler()));
}
PRInt64
nsEventListenerManager::SizeOf() const
{
PRInt64 size = sizeof(*this);
PRUint32 count = mListeners.Length();
for (PRUint32 i = 0; i < count; ++i) {
const nsListenerStruct& ls = mListeners.ElementAt(i);
size += sizeof(ls);
nsIJSEventListener* jsl = ls.GetJSListener();
if (jsl) {
size += jsl->SizeOf();
}
}
return size;
}

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsTObserverArray.h"
#include "nsGUIEvent.h"
#include "nsIJSEventListener.h"
class nsIDOMEvent;
class nsIAtom;
@ -60,13 +61,19 @@ class nsEventTargetChainItem;
class nsPIDOMWindow;
class nsCxPusher;
class nsIEventListenerInfo;
class nsIDocument;
typedef struct {
nsRefPtr<nsIDOMEventListener> mListener;
PRUint32 mEventType;
nsCOMPtr<nsIAtom> mTypeAtom;
PRUint16 mFlags;
PRBool mHandlerIsString;
PRPackedBool mHandlerIsString;
nsIJSEventListener* GetJSListener() const {
return (mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) ?
static_cast<nsIJSEventListener *>(mListener.get()) : nsnull;
}
} nsListenerStruct;
/*
@ -102,18 +109,24 @@ public:
void RemoveEventListenerByType(nsIDOMEventListener *aListener,
const nsAString& type,
PRInt32 aFlags);
/**
* Sets the current "inline" event listener for aName to be a
* function compiled from aFunc if !aDeferCompilation. If
* aDeferCompilation, then we assume that we can get the string from
* mTarget later and compile lazily.
*/
// XXXbz does that play correctly with nodes being adopted across
// documents? Need to double-check the spec here.
nsresult AddScriptEventListener(nsIAtom *aName,
const nsAString& aFunc,
PRUint32 aLanguage,
PRBool aDeferCompilation,
PRBool aPermitUntrustedEvents);
nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
void *aScopeObject,
nsIAtom* aName);
/**
* Remove the current "inline" event listener for aName.
*/
void RemoveScriptEventListener(nsIAtom *aName);
nsresult CompileScriptEventListener(nsIScriptContext *aContext,
void *aScopeObject,
nsIAtom* aName, PRBool *aDidCompile);
void HandleEvent(nsPresContext* aPresContext,
nsEvent* aEvent,
@ -155,18 +168,46 @@ public:
nsEventStatus* aEventStatus,
nsCxPusher* aPusher);
/**
* Tells the event listener manager that its target (which owns it) is
* no longer using it (and could go away).
*/
void Disconnect();
/**
* Allows us to quickly determine if we have mutation listeners registered.
*/
PRBool HasMutationListeners();
/**
* Allows us to quickly determine whether we have unload or beforeunload
* listeners registered.
*/
PRBool HasUnloadListeners();
/**
* Returns the mutation bits depending on which mutation listeners are
* registered to this listener manager.
* @note If a listener is an nsIDOMMutationListener, all possible mutation
* event bits are returned. All bits are also returned if one of the
* event listeners is registered to handle DOMSubtreeModified events.
*/
PRUint32 MutationListenerBits();
/**
* Returns PR_TRUE if there is at least one event listener for aEventName.
*/
PRBool HasListenersFor(const nsAString& aEventName);
/**
* Returns PR_TRUE if there is at least one event listener.
*/
PRBool HasListeners();
/**
* Sets aList to the list of nsIEventListenerInfo objects representing the
* listeners managed by this listener manager.
*/
nsresult GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList);
PRUint32 GetIdentifierForEvent(nsIAtom* aEvent);
@ -191,6 +232,7 @@ public:
*/
PRBool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
PRInt64 SizeOf() const;
protected:
nsresult HandleEventSubType(nsListenerStruct* aListenerStruct,
nsIDOMEventListener* aListener,
@ -198,18 +240,49 @@ protected:
nsIDOMEventTarget* aCurrentTarget,
PRUint32 aPhaseFlags,
nsCxPusher* aPusher);
nsresult CompileEventHandlerInternal(nsIScriptContext *aContext,
void *aScopeObject,
nsISupports *aObject,
nsIAtom *aName,
nsListenerStruct *aListenerStruct,
nsISupports* aCurrentTarget,
PRBool aNeedsCxPush);
/**
* Compile the "inline" event listener for aListenerStruct. The
* body of the listener can be provided in aBody; if this is null we
* will look for it on mTarget.
*/
nsresult CompileEventHandlerInternal(nsListenerStruct *aListenerStruct,
PRBool aNeedsCxPush,
const nsAString* aBody);
/**
* Find the nsListenerStruct for the "inline" event listener for aTypeAtom.
*/
nsListenerStruct* FindJSEventListener(PRUint32 aEventType, nsIAtom* aTypeAtom);
/**
* Set the "inline" event listener for aName to aHandler. aHandler
* may be null to indicate that we should lazily get and compile the
* string for this listener. The nsListenerStruct that results, if
* any, is returned in aListenerStruct.
*/
nsresult SetJSEventListener(nsIScriptContext *aContext,
void *aScopeGlobal,
nsIAtom* aName, PRBool aIsString,
PRBool aPermitUntrustedEvents);
nsIAtom* aName,
JSObject *aHandler,
PRBool aPermitUntrustedEvents,
nsListenerStruct **aListenerStruct);
public:
/**
* Set the "inline" event listener for aEventName to |v|. This
* might actually remove the event listener, depending on the value
* of |v|.
*/
nsresult SetJSEventListenerToJsval(nsIAtom *aEventName, JSContext *cx,
JSObject *aScope, const jsval &v);
/**
* Get the value of the "inline" event listener for aEventName.
* This may cause lazy compilation if the listener is uncompiled.
*/
void GetJSEventListener(nsIAtom *aEventName, jsval *vp);
protected:
void AddEventListener(nsIDOMEventListener *aListener,
PRUint32 aType,
nsIAtom* aTypeAtom,

Просмотреть файл

@ -112,8 +112,9 @@ nsEventListenerInfo::GetJSVal(jsval* aJSVal)
nsCOMPtr<nsIJSEventListener> jsl = do_QueryInterface(mListener);
if (jsl) {
nsresult rv = jsl->GetJSVal(mType, aJSVal);
if (NS_SUCCEEDED(rv)) {
void *handler = jsl->GetHandler();
if (handler) {
*aJSVal = OBJECT_TO_JSVAL(static_cast<JSObject*>(handler));
return PR_TRUE;
}
}

Просмотреть файл

@ -99,7 +99,7 @@
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMUIEvent.h"
#include "nsDOMDragEvent.h"
#include "nsIDOMNSEditableElement.h"
@ -2645,8 +2645,8 @@ nsEventStateManager::ComputeWheelDeltaFor(nsMouseScrollEvent* aMouseEvent)
}
if (ComputeWheelActionFor(aMouseEvent, useSysNumLines) == MOUSE_SCROLL_PAGE) {
delta = (delta > 0) ? PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_DOWN) :
PRInt32(nsIDOMNSUIEvent::SCROLL_PAGE_UP);
delta = (delta > 0) ? PRInt32(nsIDOMUIEvent::SCROLL_PAGE_DOWN) :
PRInt32(nsIDOMUIEvent::SCROLL_PAGE_UP);
}
return delta;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше