Merge last green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2011-10-07 11:37:04 +01:00
commit 1c81e94b72
267 changed files with 6132 additions and 3191 deletions

View File

@ -181,6 +181,7 @@ _BROWSER_FILES = \
browser_getshortcutoruri.js \
browser_hide_removing.js \
browser_overflowScroll.js \
browser_locationBarCommand.js \
browser_locationBarExternalLoad.js \
browser_pageInfo.js \
browser_page_style_menu.js \

View File

@ -4,6 +4,7 @@
function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
@ -26,6 +27,7 @@ function testBackButton() {
ok(true, "history menu opened");
event.target.hidePopup();
gBrowser.removeTab(gBrowser.selectedTab);
finish();
}, false);

View File

@ -0,0 +1,188 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_VALUE = "example.com";
const START_VALUE = "example.org";
let gFocusManager = Cc["@mozilla.org/focus-manager;1"].
getService(Ci.nsIFocusManager);
function test() {
waitForExplicitFinish();
runAltLeftClickTest();
}
// Monkey patch saveURL to avoid dealing with file save code paths
var oldSaveURL = saveURL;
saveURL = function() {
ok(true, "SaveURL was called");
is(gURLBar.value, "", "Urlbar reverted to original value");
saveURL = oldSaveURL;
runShiftLeftClickTest();
}
function runAltLeftClickTest() {
info("Running test: Alt left click");
triggerCommand(true, { altKey: true });
}
function runShiftLeftClickTest() {
let listener = new WindowListener("chrome://browser/content/browser.xul", function(aWindow) {
Services.wm.removeListener(listener);
addPageShowListener(aWindow.gBrowser, function() {
info("URL should be loaded in a new window");
is(gURLBar.value, "", "Urlbar reverted to original value");
is(gFocusManager.focusedElement, null, "There should be no focused element");
is(gFocusManager.focusedWindow, aWindow.gBrowser.contentWindow, "Content window should be focused");
is(aWindow.gURLBar.value, TEST_VALUE, "New URL is loaded in new window");
aWindow.close();
runNextTest();
});
});
Services.wm.addListener(listener);
info("Running test: Shift left click");
triggerCommand(true, { shiftKey: true });
}
function runNextTest() {
let test = gTests.shift();
if (!test) {
finish();
return;
}
info("Running test: " + test.desc);
// Tab will be blank if test.startValue is null
let tab = gBrowser.selectedTab = gBrowser.addTab(test.startValue);
addPageShowListener(gBrowser, function() {
triggerCommand(test.click, test.event);
test.check(tab);
// Clean up
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.selectedTab)
runNextTest();
});
}
let gTests = [
{ desc: "Right click on go button",
click: true,
event: { button: 2 },
check: function(aTab) {
// Right click should do nothing (context menu will be shown)
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
ok(gURLBar.focused, "Urlbar is still focused after click");
}
},
{ desc: "Left click on go button",
click: true,
event: {},
check: checkCurrent
},
{ desc: "Ctrl/Cmd left click on go button",
click: true,
event: { accelKey: true },
check: checkNewTab
},
{ desc: "Shift+Ctrl/Cmd left click on go button",
click: true,
event: { accelKey: true, shiftKey: true },
check: function(aTab) {
info("URL should be loaded in a new background tab");
is(gURLBar.value, "", "Urlbar reverted to original value");
ok(!gURLBar.focused, "Urlbar is no longer focused after urlbar command");
is(gBrowser.selectedTab, aTab, "Focus did not change to the new tab");
// Select the new background tab
gBrowser.selectedTab = gBrowser.selectedTab.nextSibling;
is(gURLBar.value, TEST_VALUE, "New URL is loaded in new tab");
}
},
{ desc: "Simple return keypress",
event: {},
check: checkCurrent
},
{ desc: "Alt+Return keypress in a blank tab",
event: { altKey: true },
check: checkCurrent
},
{ desc: "Alt+Return keypress in a dirty tab",
event: { altKey: true },
check: checkNewTab,
startValue: START_VALUE
},
{ desc: "Ctrl/Cmd+Return keypress",
event: { accelKey: true },
check: checkCurrent
}
]
let gGoButton = document.getElementById("urlbar-go-button");
function triggerCommand(aClick, aEvent) {
gURLBar.value = TEST_VALUE;
gURLBar.focus();
if (aClick)
EventUtils.synthesizeMouseAtCenter(gGoButton, aEvent);
else
EventUtils.synthesizeKey("VK_RETURN", aEvent);
}
/* Checks that the URL was loaded in the current tab */
function checkCurrent(aTab) {
info("URL should be loaded in the current tab");
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
is(gFocusManager.focusedElement, null, "There should be no focused element");
is(gFocusManager.focusedWindow, gBrowser.contentWindow, "Content window should be focused");
is(gBrowser.selectedTab, aTab, "New URL was loaded in the current tab");
}
/* Checks that the URL was loaded in a new focused tab */
function checkNewTab(aTab) {
info("URL should be loaded in a new focused tab");
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
is(gFocusManager.focusedElement, null, "There should be no focused element");
is(gFocusManager.focusedWindow, gBrowser.contentWindow, "Content window should be focused");
isnot(gBrowser.selectedTab, aTab, "New URL was loaded in a new tab");
}
function addPageShowListener(aBrowser, aFunc) {
aBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
aBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
aFunc();
});
}
function WindowListener(aURL, aCallback) {
this.callback = aCallback;
this.url = aURL;
}
WindowListener.prototype = {
onOpenWindow: function(aXULWindow) {
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
var self = this;
domwindow.addEventListener("load", function() {
domwindow.removeEventListener("load", arguments.callee, false);
if (domwindow.document.location.href != self.url)
return;
// Allow other window load listeners to execute before passing to callback
executeSoon(function() {
self.callback(domwindow);
});
}, false);
},
onCloseWindow: function(aXULWindow) {},
onWindowTitleChange: function(aXULWindow, aNewTitle) {}
}

View File

@ -334,26 +334,35 @@
// area when the current tab is re-selected.
gBrowser.selectedBrowser.focus();
if (aTriggeringEvent instanceof MouseEvent) {
// We have a mouse event (from the go button), so use the standard
// UI link behaviors
let where = whereToOpenLink(aTriggeringEvent, false, false);
let isMouseEvent = aTriggeringEvent instanceof MouseEvent;
let altEnter = !isMouseEvent && aTriggeringEvent && aTriggeringEvent.altKey;
if (altEnter) {
// XXX This was added a long time ago, and I'm not sure why it is
// necessary. Alt+Enter's default action might cause a system beep,
// or something like that?
aTriggeringEvent.preventDefault();
aTriggeringEvent.stopPropagation();
}
// If the current tab is empty, ignore Alt+Enter (just reuse this tab)
altEnter = altEnter && !isTabEmpty(gBrowser.selectedTab);
if (isMouseEvent || altEnter) {
// Use the standard UI link behaviors for clicks or Alt+Enter
let where = "tab";
if (isMouseEvent)
where = whereToOpenLink(aTriggeringEvent, false, false);
if (where == "current") {
loadCurrent();
} else {
this.handleRevert();
openUILinkIn(url, where,
{ allowThirdPartyFixup: true, postData: postData });
let params = { allowThirdPartyFixup: true, postData: postData };
if (altEnter)
params.inBackground = false;
openUILinkIn(url, where, params);
}
} else if (aTriggeringEvent && aTriggeringEvent.altKey &&
!isTabEmpty(gBrowser.selectedTab)) {
this.handleRevert();
gBrowser.loadOneTab(url, {
postData: postData,
inBackground: false,
allowThirdPartyFixup: true});
aTriggeringEvent.preventDefault();
aTriggeringEvent.stopPropagation();
} else {
loadCurrent();
}

View File

@ -195,6 +195,7 @@ function openLinkIn(url, where, params) {
var aCharset = params.charset;
var aReferrerURI = params.referrerURI;
var aRelatedToCurrent = params.relatedToCurrent;
var aInBackground = params.inBackground;
if (where == "save") {
saveURL(url, null, null, true, null, aReferrerURI);
@ -240,9 +241,12 @@ function openLinkIn(url, where, params) {
return;
}
var loadInBackground = aFromChrome ?
let loadInBackground = aInBackground;
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
getBoolPref("browser.tabs.loadBookmarksInBackground") :
getBoolPref("browser.tabs.loadInBackground");
}
if (where == "current" && w.gBrowser.selectedTab.pinned) {
try {

View File

@ -69,7 +69,7 @@ PARALLEL_DIRS = \
search \
sessionstore \
shell \
sidebar \
sidebar/src \
migration \
$(NULL)
@ -82,7 +82,7 @@ PARALLEL_DIRS += safebrowsing
endif
ifdef ENABLE_TESTS
DIRS += test
DIRS += test/browser
endif
DIRS += build

View File

@ -365,6 +365,12 @@ let AboutPermissions = {
*/
PLACES_SITES_LIMIT: 50,
/**
* When adding sites to the dom sites-list, divide workload into intervals.
*/
LIST_BUILD_CHUNK: 5, // interval size
LIST_BUILD_DELAY: 100, // delay between intervals
/**
* Stores a mapping of host strings to Site objects.
*/
@ -373,6 +379,12 @@ let AboutPermissions = {
sitesList: null,
_selectedSite: null,
/**
* For testing, track initializations so we can send notifications
*/
_initPlacesDone: false,
_initServicesDone: false,
/**
* This reflects the permissions that we expose in the UI. These correspond
* to permission type strings in the permission manager, PermissionDefaults,
@ -397,7 +409,9 @@ let AboutPermissions = {
this.sitesList = document.getElementById("sites-list");
this.getSitesFromPlaces();
this.enumerateServices();
this.enumerateServicesGenerator = this.getEnumerateServicesGenerator();
setTimeout(this.enumerateServicesDriver.bind(this), this.LIST_BUILD_DELAY);
// Attach observers in case data changes while the page is open.
Services.prefs.addObserver("signon.rememberSignons", this, false);
@ -412,6 +426,7 @@ let AboutPermissions = {
Services.obs.addObserver(this, "browser:purge-domain-data", false);
this._observersInitialized = true;
Services.obs.notifyObservers(null, "browser-permissions-preinit", null);
},
/**
@ -501,20 +516,43 @@ let AboutPermissions = {
},
handleCompletion: function(aReason) {
// Notify oberservers for testing purposes.
Services.obs.notifyObservers(null, "browser-permissions-initialized", null);
AboutPermissions._initPlacesDone = true;
if (AboutPermissions._initServicesDone) {
Services.obs.notifyObservers(null, "browser-permissions-initialized", null);
}
}
});
},
/**
* Drives getEnumerateServicesGenerator to work in intervals.
*/
enumerateServicesDriver: function() {
if (this.enumerateServicesGenerator.next()) {
// Build top sitesList items faster so that the list never seems sparse
let delay = Math.min(this.sitesList.itemCount * 5, this.LIST_BUILD_DELAY);
setTimeout(this.enumerateServicesDriver.bind(this), delay);
} else {
this.enumerateServicesGenerator.close();
this._initServicesDone = true;
if (this._initPlacesDone) {
Services.obs.notifyObservers(null, "browser-permissions-initialized", null);
}
}
},
/**
* Finds sites that have non-default permissions and creates Site objects for
* them if they are not already stored in _sites.
*/
enumerateServices: function() {
this.startSitesListBatch();
getEnumerateServicesGenerator: function() {
let itemCnt = 1;
let logins = Services.logins.getAllLogins();
logins.forEach(function(aLogin) {
if (itemCnt % this.LIST_BUILD_CHUNK == 0) {
yield true;
}
try {
// aLogin.hostname is a string in origin URL format (e.g. "http://foo.com")
let uri = NetUtil.newURI(aLogin.hostname);
@ -522,10 +560,14 @@ let AboutPermissions = {
} catch (e) {
// newURI will throw for add-ons logins stored in chrome:// URIs
}
itemCnt++;
}, this);
let disabledHosts = Services.logins.getAllDisabledHosts();
disabledHosts.forEach(function(aHostname) {
if (itemCnt % this.LIST_BUILD_CHUNK == 0) {
yield true;
}
try {
// aHostname is a string in origin URL format (e.g. "http://foo.com")
let uri = NetUtil.newURI(aHostname);
@ -533,19 +575,24 @@ let AboutPermissions = {
} catch (e) {
// newURI will throw for add-ons logins stored in chrome:// URIs
}
itemCnt++;
}, this);
let (enumerator = Services.perms.enumerator) {
while (enumerator.hasMoreElements()) {
if (itemCnt % this.LIST_BUILD_CHUNK == 0) {
yield true;
}
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
// Only include sites with exceptions set for supported permission types.
if (this._supportedPermissions.indexOf(permission.type) != -1) {
this.addHost(permission.host);
}
itemCnt++;
}
}
this.endSitesListBatch();
yield false;
},
/**
@ -579,7 +626,11 @@ let AboutPermissions = {
});
aSite.listitem = item;
(this._listFragment || this.sitesList).appendChild(item);
// Make sure to only display relevant items when list is filtered
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
item.collapsed = aSite.host.toLowerCase().indexOf(filterValue) == -1;
this.sitesList.appendChild(item);
},
startSitesListBatch: function () {
@ -640,7 +691,7 @@ let AboutPermissions = {
this.sitesList.removeChild(site.listitem);
delete this._sites[site.host];
}
}
}
},
/**

View File

@ -56,6 +56,7 @@ _BROWSER_FILES = \
browser_privacypane_7.js \
browser_privacypane_8.js \
browser_permissions.js \
browser_chunk_permissions.js \
$(NULL)
libs:: $(_BROWSER_FILES)

View File

@ -0,0 +1,151 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
const TEST_URI_3 = NetUtil.newURI("http://wikipedia.org/");
// values from DefaultPermissions object
const PERM_UNKNOWN = 0;
const PERM_ALLOW = 1;
const PERM_DENY = 2;
const PERM_SESION = 8;
// used to set permissions on test sites
const TEST_PERMS = {
"password": PERM_ALLOW,
"cookie": PERM_ALLOW,
"geo": PERM_UNKNOWN,
"indexedDB": PERM_UNKNOWN,
"popup": PERM_DENY
};
function test() {
waitForExplicitFinish();
registerCleanupFunction(cleanUp);
setup();
runNextTest();
}
function setup() {
// add test history visit
PlacesUtils.history.addVisit(TEST_URI_1, Date.now() * 1000, null,
Ci.nsINavHistoryService.TRANSITION_LINK, false, 0);
// set permissions ourselves to avoid problems with different defaults
// from test harness configuration
for (let type in TEST_PERMS) {
if (type == "password") {
Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
} else {
// set permissions on a site without history visits to test enumerateServices
Services.perms.add(TEST_URI_2, type, TEST_PERMS[type]);
}
}
Services.perms.add(TEST_URI_3, "popup", TEST_PERMS["popup"]);
}
function cleanUp() {
for (let type in TEST_PERMS) {
if (type != "password") {
Services.perms.remove(TEST_URI_1.host, type);
Services.perms.remove(TEST_URI_2.host, type);
Services.perms.remove(TEST_URI_3.host, type);
}
}
}
function runNextTest() {
if (gTestIndex == tests.length) {
waitForClearHistory(finish);
return;
}
let nextTest = tests[gTestIndex++];
info(nextTest.desc);
function preinit_observer() {
Services.obs.removeObserver(preinit_observer, "browser-permissions-preinit", false);
nextTest.preInit();
}
Services.obs.addObserver(preinit_observer, "browser-permissions-preinit", false);
function init_observer() {
Services.obs.removeObserver(init_observer, "browser-permissions-initialized", false);
nextTest.run();
}
Services.obs.addObserver(init_observer, "browser-permissions-initialized", false);
// open about:permissions
let tab = gBrowser.selectedTab = gBrowser.addTab("about:permissions");
registerCleanupFunction(function() {
gBrowser.removeTab(tab);
});
}
var gSitesList;
var gTestIndex = 0;
var tests = [
// 'preInit' occurs after opening about:permissions, before sites-list is populated
// 'run' occurs after sites-list is populated
{
desc: "test filtering before sites-list is fully constructed.",
preInit: function() {
let sitesFilter = gBrowser.contentDocument.getElementById("sites-filter");
sitesFilter.value = TEST_URI_2.host;
sitesFilter.doCommand();
},
run: function() {
let testSite1 = getSiteItem(TEST_URI_1.host);
ok(testSite1.collapsed, "test site 1 is collapsed after early filtering");
let testSite2 = getSiteItem(TEST_URI_2.host);
ok(!testSite2.collapsed, "test site 2 is not collapsed after early filtering");
let testSite3 = getSiteItem(TEST_URI_3.host);
ok(testSite3.collapsed, "test site 3 is collapsed after early filtering");
runNextTest();
}
},
{
desc: "test removing from sites-list before it is fully constructed.",
preInit: function() {
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
pb.removeDataFromDomain(TEST_URI_2.host);
},
run: function() {
let testSite1 = getSiteItem(TEST_URI_1.host);
ok(!testSite2, "test site 1 was not removed from sites list");
let testSite2 = getSiteItem(TEST_URI_2.host);
ok(!testSite2, "test site 2 was pre-removed from sites list");
let testSite3 = getSiteItem(TEST_URI_3.host);
ok(!testSite2, "test site 3 was not removed from sites list");
runNextTest();
}
}
];
function getSiteItem(aHost) {
return gBrowser.contentDocument.
querySelector(".site[value='" + aHost + "']");
}
// copied from toolkit/components/places/tests/head_common.js
function waitForClearHistory(aCallback) {
let observer = {
observe: function(aSubject, aTopic, aData) {
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
aCallback();
}
};
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
PlacesUtils.bhistory.removeAllPages();
}

View File

@ -43,8 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
ifdef ENABLE_TESTS
DIRS += content/test
endif

View File

@ -1,44 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk

View File

@ -51,7 +51,7 @@ XPIDLSRCS = \
DIRS = src
ifdef ENABLE_TESTS
DIRS += test
DIRS += test/browser
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,49 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS += browser \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org Code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Robert Strong <robert.bugzilla@gmail.com> (Original Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

View File

@ -49,14 +49,13 @@ include $(topsrcdir)/config/config.mk
DIRS = \
highlighter \
webconsole \
scratchpad \
sourceeditor \
styleinspector \
shared \
$(NULL)
ifdef ENABLE_TESTS
# DIRS += test # no tests yet
DIRS += scratchpad/test
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,50 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Scratchpad Build Code.
#
# The Initial Developer of the Original Code is The Mozilla Foundation.
#
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Rob Campbell <rcampbell@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
DIRS += test
endif
include $(topsrcdir)/config/rules.mk

View File

@ -45,11 +45,11 @@ include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
DIRS += test/browser
endif
endif
include $(topsrcdir)/config/rules.mk
libs::
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Style Inspector code.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Ratcliffe <mratcliffe@mozilla.com> (Original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

View File

@ -57,7 +57,7 @@ EXTRA_PP_JS_MODULES = \
ifdef ENABLE_TESTS
ifneq (mobile,$(MOZ_BUILD_APP))
DIRS += test
DIRS += test/browser
endif
endif

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is HUDService code.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# David Dahl <ddahl@mozilla.com> (Original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = browser
include $(topsrcdir)/config/rules.mk

View File

@ -56,11 +56,9 @@ browser/components/preferences/Makefile
browser/components/privatebrowsing/Makefile
browser/components/privatebrowsing/src/Makefile
browser/components/safebrowsing/Makefile
browser/components/safebrowsing/src/Makefile
browser/components/search/Makefile
browser/components/sessionstore/Makefile
browser/components/sessionstore/src/Makefile
browser/components/sidebar/Makefile
browser/components/sidebar/src/Makefile
browser/components/shell/Makefile
browser/components/shell/public/Makefile
@ -90,7 +88,6 @@ if [ "$ENABLE_TESTS" ]; then
browser/components/certerror/test/Makefile
browser/components/preferences/tests/Makefile
browser/components/search/test/Makefile
browser/components/sessionstore/test/Makefile
browser/components/sessionstore/test/browser/Makefile
browser/components/shell/test/Makefile
browser/components/feeds/test/Makefile

View File

@ -684,7 +684,7 @@ class DeviceManagerSUT(DeviceManager):
return None
# prompt should follow
read_exact(len(prompt), buffer, 'could not find prompt')
print 'DeviceManager: error pulling file: %s' % error_str
print "DeviceManager: error pulling file '%s': %s" % (remoteFile, error_str)
return None
# read file data

View File

@ -40,6 +40,9 @@ import time
import sys
import os
import socket
import automationutils
import tempfile
import shutil
from automation import Automation
from devicemanager import DeviceManager, NetworkTools
@ -105,6 +108,15 @@ class RemoteAutomation(Automation):
return status
def checkForCrashes(self, directory, symbolsPath):
dumpDir = tempfile.mkdtemp()
self._devicemanager.getDirectory(self._remoteProfile + '/minidumps/', dumpDir)
automationutils.checkForCrashes(dumpDir, symbolsPath, self.lastTestSeen)
try:
shutil.rmtree(dumpDir)
except:
print "WARNING: unable to remove directory: %s" % (dumpDir)
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# If remote profile is specified, use that instead
if (self._remoteProfile):

View File

@ -46,7 +46,7 @@ MODULE = caps
DIRS = idl include src
ifdef ENABLE_TESTS
DIRS += tests
DIRS += tests/mochitest
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Mike Shaver <shaver@mozilla.com> (original cutter and paster)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = mochitest
include $(topsrcdir)/config/rules.mk

View File

@ -43,7 +43,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = content
PARALLEL_DIRS = base canvas events html mathml smil svg xml xul xbl xslt
PARALLEL_DIRS = base canvas events html mathml/content/src smil svg xml xul xbl xslt
ifdef MOZ_MEDIA
PARALLEL_DIRS += media

View File

@ -333,6 +333,11 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
mListeners.RemoveElementAt(i);
mNoListenerForEvent = NS_EVENT_TYPE_NULL;
mNoListenerForEventAtom = nsnull;
if (aType == NS_DEVICE_ORIENTATION) {
nsPIDOMWindow* window = GetInnerWindowForTarget();
if (window)
window->RemoveOrientationEventListener();
}
break;
}
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
-->
<head>
<title>Test for Bug 648573</title>
@ -19,7 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=648573
/** Test for Bug 648573 **/
ok(!SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners,
var utils = SpecialPowers.getDOMWindowUtils(window);
ok(!utils.mayHaveTouchEventListeners,
"There shouldn't be any touch event listeners yet.");
ok("createTouch" in document, "Should have createTouch function");
@ -101,7 +103,7 @@ for (var i = 0; i < events.length; ++i) {
runEventTest(events[i]);
}
ok(SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners,
ok(utils.mayHaveTouchEventListeners,
"There should be touch event listeners.");
</script>
</pre>

View File

@ -18,8 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=662678
<script type="application/javascript">
/** Test for Bug 662678 **/
SimpleTest.waitForExplicitFinish();
var checkMotion = function(event) {
window.removeEventListener("devicemotion", checkMotion, true);
window.addEventListener("devicemotion", function(event) {
is(event.acceleration.x, 1.5);
is(event.acceleration.y, 1.5);
is(event.acceleration.z, 1.5);
@ -32,7 +35,9 @@ window.addEventListener("devicemotion", function(event) {
is(event.rotationRate.beta, 1.5);
is(event.rotationRate.gamma, 1.5);
SimpleTest.finish();
}, true);
};
window.addEventListener("devicemotion", checkMotion, true);
var event = DeviceMotionEvent;
ok(!!event, "Should have seen DeviceMotionEvent!");
@ -44,7 +49,6 @@ event.initDeviceMotionEvent('devicemotion', true, true,
{alpha:1.5,beta:1.5,gamma:1.5},
0);
window.dispatchEvent(event);
SimpleTest.waitForExplicitFinish();
</script>
</pre>

View File

@ -1,47 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = content
include $(topsrcdir)/config/rules.mk

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -42,6 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = document content
PARALLEL_DIRS = document/src content
include $(topsrcdir)/config/rules.mk

View File

@ -64,8 +64,8 @@ nsSVGString::SetBaseValue(const nsAString& aValue,
{
NS_ASSERTION(aSVGElement, "Null element passed to SetBaseValue");
mIsBaseSet = PR_TRUE;
if (aDoSetAttr) {
mIsBaseSet = PR_TRUE;
aSVGElement->SetStringBaseValue(mAttrEnum, aValue);
}
#ifdef MOZ_SMIL

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the mozilla svg code.
#
# The Initial Developer of the Original Code is
# Bradley Baetz.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -42,7 +42,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = content document
PARALLEL_DIRS = content/src document
include $(topsrcdir)/config/rules.mk

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -46,7 +46,7 @@ MODULE = xultmpl
PARALLEL_DIRS = public src
ifdef ENABLE_TESTS
TOOL_DIRS += tests
TOOL_DIRS += tests/chrome
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,49 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla.org.
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = content/xul/templates/tests
include $(DEPTH)/config/autoconf.mk
DIRS = chrome
include $(topsrcdir)/config/rules.mk

View File

@ -48,7 +48,7 @@ DIRS = \
base \
shistory \
build \
resources \
resources/content \
$(NULL)
ifdef ENABLE_TESTS

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla browser.
#
# The Initial Developer of the Original Code is
# Netscape Communications, Inc.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Adam Lock <adamlock@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS=content
include $(topsrcdir)/config/rules.mk

View File

@ -8,13 +8,19 @@
onload="setTimeout(nextTest,0);"
title="bug 293235 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="application/javascript"><![CDATA[
const Ci = Components.interfaces;
const Cc = Components.classes;
var Ci = Components.interfaces;
var Cc = Components.classes;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// Define the generator-iterator for the tests.

View File

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 298622 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src= "docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

View File

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 301397 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

View File

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 321671 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

View File

@ -8,6 +8,12 @@
onload="setTimeout(nextTest,0);"
title="bug 396649 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

View File

@ -8,6 +8,12 @@
onload="nextTestAsync();"
title="bug 582176 test">
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="application/javascript" src="docshell_helpers.js" />
<script type="application/javascript"><![CDATA[

View File

@ -9,6 +9,12 @@
title="bug 89419 test">
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
<script type="application/javascript" src="docshell_helpers.js" />
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>

View File

@ -10178,6 +10178,11 @@ nsGlobalWindow::SetHasOrientationEventListener()
EnableDeviceMotionUpdates();
}
void
nsGlobalWindow::RemoveOrientationEventListener() {
DisableDeviceMotionUpdates();
}
NS_IMETHODIMP
nsGlobalWindow::GetURL(nsIDOMMozURLProperty** aURL)
{

View File

@ -384,6 +384,7 @@ public:
virtual NS_HIDDEN_(nsresult) ForceClose();
virtual NS_HIDDEN_(void) SetHasOrientationEventListener();
virtual NS_HIDDEN_(void) RemoveOrientationEventListener();
virtual NS_HIDDEN_(void) MaybeUpdateTouchState();
virtual NS_HIDDEN_(void) UpdateTouchState();
virtual NS_HIDDEN_(bool) DispatchCustomEvent(const char *aEventName);

View File

@ -1873,8 +1873,8 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
#ifdef NS_FUNCTION_TIMER
{
JSObject *obj = static_cast<JSObject *>(aHandler);
if (obj->isFunctionProxy())
obj = obj->unwrap(NULL);
if (js::IsFunctionProxy(obj))
obj = js::UnwrapObject(obj);
JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(mContext, obj)));
JSAutoByteString bytes;
const char *name = !id ? "anonymous" : bytes.encode(mContext, id) ? bytes.ptr() : "<error>";

View File

@ -576,6 +576,11 @@ public:
*/
virtual void SetHasOrientationEventListener() = 0;
/**
* Tell this window that we remove an orientation listener
*/
virtual void RemoveOrientationEventListener() = 0;
/**
* Set a arguments for this window. This will be set on the window
* right away (if there's an existing document) and it will also be

View File

@ -50,7 +50,7 @@
function testSteps() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri = SpecialPowers.getDocumentURIObject(window.document);
let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document);
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.add(uri, "indexedDB",

View File

@ -89,7 +89,7 @@
function testSteps() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri = SpecialPowers.getDocumentURIObject(window.document);
let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document);
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.add(uri, "indexedDB",

View File

@ -46,7 +46,7 @@ include $(DEPTH)/config/autoconf.mk
DIRS = \
lib \
src \
test \
test/unit \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,50 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/ajax/scriptaculous/test
include $(DEPTH)/config/autoconf.mk
DIRS = \
unit \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -87,7 +87,7 @@ abstract public class GeckoApp
private IntentFilter mConnectivityFilter;
private BroadcastReceiver mConnectivityReceiver;
enum LaunchState {PreLaunch, Launching, WaitButton,
enum LaunchState {PreLaunch, Launching, WaitForDebugger,
Launched, GeckoRunning, GeckoExiting};
private static LaunchState sLaunchState = LaunchState.PreLaunch;
private static boolean sTryCatchAttached = false;
@ -427,21 +427,19 @@ abstract public class GeckoApp
}
final String action = intent.getAction();
if (ACTION_DEBUG.equals(action) &&
checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitButton)) {
final Button launchButton = new Button(this);
launchButton.setText("Launch"); // don't need to localize
launchButton.setOnClickListener(new Button.OnClickListener() {
public void onClick (View v) {
// hide the button so we can't be launched again
mainLayout.removeView(launchButton);
checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) {
mMainHandler.postDelayed(new Runnable() {
public void run() {
Log.i(LOG_FILE_NAME, "Launching from debug intent after 5s wait");
setLaunchState(LaunchState.Launching);
launch(null);
}
});
mainLayout.addView(launchButton, 300, 200);
}, 1000 * 5 /* 5 seconds */);
Log.i(LOG_FILE_NAME, "Intent : ACTION_DEBUG - waiting 5s before launching");
return;
}
if (checkLaunchState(LaunchState.WaitButton) || launch(intent))
if (checkLaunchState(LaunchState.WaitForDebugger) || launch(intent))
return;
if (Intent.ACTION_MAIN.equals(action)) {
@ -608,16 +606,6 @@ abstract public class GeckoApp
unpackFile(zip, buf, entry, entry.getName());
}
}
// copy any hyphenation dictionaries file into a hyphenation/ directory
Enumeration<? extends ZipEntry> hyphenEntries = zip.entries();
while (hyphenEntries.hasMoreElements()) {
ZipEntry entry = hyphenEntries.nextElement();
if (entry.getName().startsWith("hyphenation/")) {
Log.i("GeckoAppJava", "installing hyphenation : " + entry.getName());
unpackFile(zip, buf, entry, entry.getName());
}
}
}
void removeFiles() throws IOException {

View File

@ -279,6 +279,11 @@ public class GeckoInputConnection
if (req == null)
return null;
// Bail out here if gecko isn't running, otherwise we deadlock
// below when waiting for the reply to IME_GET_SELECTION.
if (!GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning))
return null;
//Log.d("GeckoAppJava", "IME: getExtractedText");
ExtractedText extract = new ExtractedText();

View File

@ -45,11 +45,11 @@ include $(DEPTH)/config/autoconf.mk
# You'd think we could skip building ui if XUL is disabled,
# but we need to export interface headers from those directories.
DIRS = windowwatcher appstartup find webbrowserpersist commandhandler
DIRS = windowwatcher appstartup/src find webbrowserpersist commandhandler
ifdef MOZ_XUL
ifdef NS_PRINTING
DIRS += printingui
DIRS += printingui/src
endif
endif

View File

@ -1,47 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications, Inc.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -1,50 +0,0 @@
#! gmake
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk

View File

@ -1,42 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: Mozilla-sample-code 1.0
#
# Copyright (c) 2002 Netscape Communications Corporation and
# other contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this Mozilla sample software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Contributor(s):
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifeq ($(OS_ARCH),WINNT)
DIRS = winEmbed
endif
include $(topsrcdir)/config/rules.mk

View File

@ -45,7 +45,7 @@ MODULE = spellchecker
DIRS = idl locales hunspell src
ifdef ENABLE_TESTS
DIRS += tests
DIRS += tests/chrome
endif
include $(topsrcdir)/config/rules.mk

View File

@ -128,6 +128,7 @@ mozHunspell::Init()
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->AddObserver(this, "profile-do-change", PR_TRUE);
obs->AddObserver(this, "profile-after-change", PR_TRUE);
}
mHunspellReporter = new NS_MEMORY_REPORTER_NAME(Hunspell);
@ -593,7 +594,8 @@ NS_IMETHODIMP
mozHunspell::Observe(nsISupports* aSubj, const char *aTopic,
const PRUnichar *aData)
{
NS_ASSERTION(!strcmp(aTopic, "profile-do-change"),
NS_ASSERTION(!strcmp(aTopic, "profile-do-change")
|| !strcmp(aTopic, "profile-after-change"),
"Unexpected observer topic");
LoadDictionaryList();

View File

@ -1,48 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = extensions/spellcheck/tests
include $(DEPTH)/config/autoconf.mk
DIRS = chrome
include $(topsrcdir)/config/rules.mk

148
gfx/layers/DirectedGraph.h Normal file
View File

@ -0,0 +1,148 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Matt Woodrow <mwoodrow@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_DIRECTEDGRAPH_H
#define GFX_DIRECTEDGRAPH_H
#include "gfxTypes.h"
#include "nsTArray.h"
namespace mozilla {
namespace layers {
template <typename T>
class DirectedGraph {
public:
class Edge {
public:
Edge(T aFrom, T aTo) : mFrom(aFrom), mTo(aTo) {}
bool operator==(const Edge& aOther) const
{
return mFrom == aOther.mFrom && mTo == aOther.mTo;
}
T mFrom;
T mTo;
};
class RemoveEdgesToComparator
{
public:
PRBool Equals(const Edge& a, T const& b) const { return a.mTo == b; }
};
/**
* Add a new edge to the graph.
*/
void AddEdge(Edge aEdge)
{
NS_ASSERTION(!mEdges.Contains(aEdge), "Adding a duplicate edge!");
mEdges.AppendElement(aEdge);
}
void AddEdge(T aFrom, T aTo)
{
AddEdge(Edge(aFrom, aTo));
}
/**
* Get the list of edges.
*/
const nsTArray<Edge>& GetEdgeList() const
{
return mEdges;
}
/**
* Remove the given edge from the graph.
*/
void RemoveEdge(Edge aEdge)
{
mEdges.RemoveElement(aEdge);
}
/**
* Remove all edges going into aNode.
*/
void RemoveEdgesTo(T aNode)
{
RemoveEdgesToComparator c;
while (mEdges.RemoveElement(aNode, c)) {}
}
/**
* Get the number of edges going into aNode.
*/
unsigned int NumEdgesTo(T aNode)
{
unsigned int count = 0;
for (unsigned int i = 0; i < mEdges.Length(); i++) {
if (mEdges.ElementAt(i).mTo == aNode) {
count++;
}
}
return count;
}
/**
* Get the list of all edges going from aNode
*/
void GetEdgesFrom(T aNode, nsTArray<Edge>& aResult)
{
for (unsigned int i = 0; i < mEdges.Length(); i++) {
if (mEdges.ElementAt(i).mFrom == aNode) {
aResult.AppendElement(mEdges.ElementAt(i));
}
}
}
/**
* Get the total number of edges.
*/
unsigned int GetEdgeCount() { return mEdges.Length(); }
private:
nsTArray<Edge> mEdges;
};
}
}
#endif // GFX_DIRECTEDGRAPH_H

258
gfx/layers/LayerSorter.cpp Normal file
View File

@ -0,0 +1,258 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Matt Woodrow <mwoodrow@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "LayerSorter.h"
#include "DirectedGraph.h"
#include "limits.h"
namespace mozilla {
namespace layers {
enum LayerSortOrder {
Undefined,
ABeforeB,
BBeforeA,
};
/**
* Recover the z component from a 2d transformed point by finding the intersection
* of a line through the point in the z direction and the transformed plane.
*
* We want to solve:
*
* point = normal . (p0 - l0) / normal . l
*/
static gfxFloat RecoverZDepth(const gfx3DMatrix& aTransform, const gfxPoint& aPoint)
{
const gfxPoint3D l(0, 0, 1);
gfxPoint3D l0 = gfxPoint3D(aPoint.x, aPoint.y, 0);
gfxPoint3D p0 = aTransform.Transform3D(gfxPoint3D(0, 0, 0));
gfxPoint3D normal = aTransform.GetNormalVector();
gfxFloat n = normal.DotProduct(p0 - l0);
gfxFloat d = normal.DotProduct(l);
if (!d) {
return 0;
}
return n/d;
}
/**
* Determine if this transform layer should be drawn before another when they
* are both preserve-3d children.
*
* We want to find the relative z depths of the 2 layers at points where they
* intersect when projected onto the 2d screen plane.
*
* If the ordering is consistent at all intersection points, then we have
* a definitive order, otherwise the 2 layers must actually intersect in 3d
* space, and we just order these arbitrarily.
*/
static LayerSortOrder CompareDepth(Layer* aOne, Layer* aTwo) {
gfxRect ourRect = aOne->GetEffectiveVisibleRegion().GetBounds();
gfxRect otherRect = aTwo->GetEffectiveVisibleRegion().GetBounds();
gfx3DMatrix ourTransform = aOne->GetTransform();
gfx3DMatrix otherTransform = aTwo->GetTransform();
// Transform both rectangles and project into 2d space.
gfxQuad ourTransformedRect = ourTransform.TransformRect(ourRect);
gfxQuad otherTransformedRect = otherTransform.TransformRect(otherRect);
// Make a list of all points that are within the other rect.
nsTArray<gfxPoint> points;
for (PRUint32 i=0; i<4; i++) {
if (ourTransformedRect.Contains(otherTransformedRect.mPoints[i])) {
points.AppendElement(otherTransformedRect.mPoints[i]);
}
if (otherTransformedRect.Contains(ourTransformedRect.mPoints[i])) {
points.AppendElement(ourTransformedRect.mPoints[i]);
}
}
// No intersections, no defined order between these layers.
if (points.IsEmpty()) {
return Undefined;
}
// Find the relative Z depths of each intersection point and check that the layers are in the same order.
bool drawBefore = false;
for (PRUint32 i = 0; i < points.Length(); i++) {
bool temp = RecoverZDepth(ourTransform, points.ElementAt(i)) <= RecoverZDepth(otherTransform, points.ElementAt(i));
if (i == 0) {
drawBefore = temp;
} else if (drawBefore != temp) {
// Mixed ordering means an intersection in 3d space that we can't resolve without plane splitting
// or depth buffering. Store this as having no defined order for now.
return Undefined;
}
}
if (drawBefore) {
return ABeforeB;
}
return BBeforeA;
}
#ifdef DEBUG
static bool gDumpLayerSortList = getenv("MOZ_DUMP_LAYER_SORT_LIST") != 0;
static void DumpLayerList(nsTArray<Layer*>& aLayers)
{
for (PRUint32 i = 0; i < aLayers.Length(); i++) {
fprintf(stderr, "%p, ", aLayers.ElementAt(i));
}
fprintf(stderr, "\n");
}
static void DumpEdgeList(DirectedGraph<Layer*>& aGraph)
{
nsTArray<DirectedGraph<Layer*>::Edge> edges = aGraph.GetEdgeList();
for (PRUint32 i = 0; i < edges.Length(); i++) {
fprintf(stderr, "From: %p, To: %p\n", edges.ElementAt(i).mFrom, edges.ElementAt(i).mTo);
}
}
#endif
// The maximum number of layers that we will attempt to sort. Anything
// greater than this will be left unsorted. We should consider enabling
// depth buffering for the scene in this case.
#define MAX_SORTABLE_LAYERS 100
void SortLayersBy3DZOrder(nsTArray<Layer*>& aLayers)
{
PRUint32 nodeCount = aLayers.Length();
if (nodeCount > MAX_SORTABLE_LAYERS) {
return;
}
DirectedGraph<Layer*> graph;
#ifdef DEBUG
if (gDumpLayerSortList) {
fprintf(stderr, " --- Layers before sorting: --- \n");
DumpLayerList(aLayers);
}
#endif
// Iterate layers and determine edges.
for (PRUint32 i = 0; i < nodeCount; i++) {
for (PRUint32 j = i + 1; j < nodeCount; j++) {
Layer* a = aLayers.ElementAt(i);
Layer* b = aLayers.ElementAt(j);
LayerSortOrder order = CompareDepth(a, b);
if (order == ABeforeB) {
graph.AddEdge(a, b);
} else if (order == BBeforeA) {
graph.AddEdge(b, a);
}
}
}
#ifdef DEBUG
if (gDumpLayerSortList) {
fprintf(stderr, " --- Edge List: --- \n");
DumpEdgeList(graph);
}
#endif
// Build a new array using the graph.
nsTArray<Layer*> noIncoming;
nsTArray<Layer*> sortedList;
// Make a list of all layers with no incoming edges.
noIncoming.AppendElements(aLayers);
const nsTArray<DirectedGraph<Layer*>::Edge>& edges = graph.GetEdgeList();
for (PRUint32 i = 0; i < edges.Length(); i++) {
noIncoming.RemoveElement(edges.ElementAt(i).mTo);
}
// Move each item without incoming edges into the sorted list,
// and remove edges from it.
while (!noIncoming.IsEmpty()) {
PRUint32 last = noIncoming.Length() - 1;
Layer* layer = noIncoming.ElementAt(last);
noIncoming.RemoveElementAt(last);
sortedList.AppendElement(layer);
nsTArray<DirectedGraph<Layer*>::Edge> outgoing;
graph.GetEdgesFrom(layer, outgoing);
for (PRUint32 i = 0; i < outgoing.Length(); i++) {
DirectedGraph<Layer*>::Edge edge = outgoing.ElementAt(i);
graph.RemoveEdge(edge);
if (!graph.NumEdgesTo(edge.mTo)) {
// If this node also has no edges now, add it to the list
noIncoming.AppendElement(edge.mTo);
}
}
// If there are no nodes without incoming edges, but there
// are still edges, then we have a cycle.
if (noIncoming.IsEmpty() && graph.GetEdgeCount()) {
// Find the node with the least incoming edges.
PRUint32 minEdges = UINT_MAX;
Layer* minNode = nsnull;
for (PRUint32 i = 0; i < aLayers.Length(); i++) {
PRUint32 edgeCount = graph.NumEdgesTo(aLayers.ElementAt(i));
if (edgeCount && edgeCount < minEdges) {
minEdges = edgeCount;
minNode = aLayers.ElementAt(i);
}
}
// Remove all of them!
graph.RemoveEdgesTo(minNode);
noIncoming.AppendElement(minNode);
}
}
NS_ASSERTION(!graph.GetEdgeCount(), "Cycles detected!");
#ifdef DEBUG
if (gDumpLayerSortList) {
fprintf(stderr, " --- Layers after sorting: --- \n");
DumpLayerList(sortedList);
}
#endif
aLayers.Clear();
aLayers.AppendElements(sortedList);
}
}
}

50
gfx/layers/LayerSorter.h Normal file
View File

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Matt Woodrow <mwoodrow@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_LAYERSORTER_H
#define GFX_LAYERSORTER_H
#include "Layers.h"
namespace mozilla {
namespace layers {
void SortLayersBy3DZOrder(nsTArray<Layer*>& aLayers);
}
}
#endif /* GFX_LAYERSORTER_H */

View File

@ -48,6 +48,7 @@
#include "gfxUtils.h"
#include "nsPrintfCString.h"
#include "mozilla/Util.h"
#include "LayerSorter.h"
using namespace mozilla::layers;
using namespace mozilla::gfx;
@ -415,11 +416,35 @@ ContainerLayer::HasMultipleChildren()
return PR_FALSE;
}
void
ContainerLayer::SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray)
{
nsAutoTArray<Layer*, 10> toSort;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
ContainerLayer* container = l->AsContainerLayer();
if (container && container->GetContentFlags() & CONTENT_PRESERVE_3D) {
toSort.AppendElement(l);
} else {
if (toSort.Length() > 0) {
SortLayersBy3DZOrder(toSort);
aArray.MoveElementsFrom(toSort);
}
aArray.AppendElement(l);
}
}
if (toSort.Length() > 0) {
SortLayersBy3DZOrder(toSort);
aArray.MoveElementsFrom(toSort);
}
}
void
ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
gfxMatrix residual;
gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface;
idealTransform.ProjectTo2D();
mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), &residual);
bool useIntermediateSurface;
@ -429,9 +454,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT
} else {
useIntermediateSurface = PR_FALSE;
gfxMatrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform)) {
useIntermediateSurface = PR_TRUE;
} else if (
if (!mEffectiveTransform.Is2D(&contTransform) ||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
!contTransform.PreservesAxisAlignedRectangles()) {
#else

View File

@ -48,6 +48,7 @@
#include "gfx3DMatrix.h"
#include "gfxColor.h"
#include "gfxPattern.h"
#include "nsTArray.h"
#include "mozilla/gfx/2D.h"
@ -577,7 +578,13 @@ public:
* paint time.
* This should never be set at the same time as CONTENT_OPAQUE.
*/
CONTENT_COMPONENT_ALPHA = 0x02
CONTENT_COMPONENT_ALPHA = 0x02,
/**
* If this is set then this layer is part of a preserve-3d group, and should
* be sorted with sibling layers that are also part of the same group.
*/
CONTENT_PRESERVE_3D = 0x04
};
/**
* CONSTRUCTION PHASE ONLY
@ -1095,6 +1102,8 @@ public:
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
void SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray);
// These getters can be used anytime.
virtual ContainerLayer* AsContainerLayer() { return this; }

View File

@ -66,6 +66,7 @@ EXPORTS = \
LayerManagerOGL.h \
LayerManagerOGLProgram.h \
ReadbackLayer.h \
LayerSorter.h \
$(NULL)
CPPSRCS = \
@ -80,6 +81,7 @@ CPPSRCS = \
ImageLayerOGL.cpp \
LayerManagerOGL.cpp \
ThebesLayerOGL.cpp \
LayerSorter.cpp \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)

View File

@ -532,6 +532,9 @@ public:
ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface);
}
// Sync front/back buffers content
virtual void SyncFrontBufferToBackBuffer() {}
protected:
BasicLayerManager* BasicManager()
{
@ -656,6 +659,7 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
if (aReadback && UsedForReadback()) {
aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
}
SyncFrontBufferToBackBuffer();
bool canUseOpaqueSurface = CanUseOpaqueSurface();
Buffer::ContentType contentType =
@ -1887,13 +1891,16 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
}
} else {
ReadbackProcessor readback;
ContainerLayer* container = static_cast<ContainerLayer*>(aLayer);
if (IsRetained()) {
ContainerLayer* container = static_cast<ContainerLayer*>(aLayer);
readback.BuildUpdates(container);
}
nsAutoTArray<Layer*, 12> children;
container->SortChildrenBy3DZOrder(children);
for (; child; child = child->GetNextSibling()) {
PaintLayer(groupTarget, child, aCallback, aCallbackData, &readback);
for (PRUint32 i = 0; i < children.Length(); i++) {
PaintLayer(groupTarget, children.ElementAt(i), aCallback, aCallbackData, &readback);
if (mTransactionIncomplete)
break;
}
@ -2154,13 +2161,13 @@ public:
BasicShadowableThebesLayer(BasicShadowLayerManager* aManager)
: BasicThebesLayer(aManager)
, mIsNewBuffer(false)
, mFrontAndBackBufferDiffer(false)
{
MOZ_COUNT_CTOR(BasicShadowableThebesLayer);
}
virtual ~BasicShadowableThebesLayer()
{
if (IsSurfaceDescriptorValid(mBackBuffer))
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
DestroyBackBuffer();
MOZ_COUNT_DTOR(BasicShadowableThebesLayer);
}
@ -2173,7 +2180,7 @@ public:
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual bool MustRetainContent() { return HasShadow(); }
void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
void SetBackBufferAndAttrs(const OptionalThebesBuffer& aBuffer,
const nsIntRegion& aValidRegion,
const OptionalThebesBuffer& aReadOnlyFrontBuffer,
const nsIntRegion& aFrontUpdatedRegion);
@ -2186,6 +2193,8 @@ public:
virtual BasicShadowableThebesLayer* AsThebes() { return this; }
virtual void SyncFrontBufferToBackBuffer();
private:
BasicShadowLayerManager* BasicManager()
{
@ -2204,46 +2213,89 @@ private:
NS_OVERRIDE virtual already_AddRefed<gfxASurface>
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize);
void DestroyBackBuffer()
{
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
}
}
// This describes the gfxASurface we hand to mBuffer. We keep a
// copy of the descriptor here so that we can call
// DestroySharedSurface() on the descriptor.
SurfaceDescriptor mBackBuffer;
nsIntRect mBackBufferRect;
nsIntPoint mBackBufferRectRotation;
bool mIsNewBuffer;
OptionalThebesBuffer mROFrontBuffer;
nsIntRegion mFrontUpdatedRegion;
nsIntRegion mFrontValidRegion;
PRPackedBool mFrontAndBackBufferDiffer;
};
void
BasicShadowableThebesLayer::SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
BasicShadowableThebesLayer::SetBackBufferAndAttrs(const OptionalThebesBuffer& aBuffer,
const nsIntRegion& aValidRegion,
const OptionalThebesBuffer& aReadOnlyFrontBuffer,
const nsIntRegion& aFrontUpdatedRegion)
{
mBackBuffer = aBuffer.buffer();
nsRefPtr<gfxASurface> backBuffer = BasicManager()->OpenDescriptor(mBackBuffer);
if (OptionalThebesBuffer::Tnull_t == aBuffer.type()) {
mBackBuffer = SurfaceDescriptor();
} else {
mBackBuffer = aBuffer.get_ThebesBuffer().buffer();
mBackBufferRect = aBuffer.get_ThebesBuffer().rect();
mBackBufferRectRotation = aBuffer.get_ThebesBuffer().rotation();
}
mFrontAndBackBufferDiffer = true;
mROFrontBuffer = aReadOnlyFrontBuffer;
mFrontUpdatedRegion = aFrontUpdatedRegion;
mFrontValidRegion = aValidRegion;
}
if (OptionalThebesBuffer::Tnull_t == aReadOnlyFrontBuffer.type()) {
void
BasicShadowableThebesLayer::SyncFrontBufferToBackBuffer()
{
if (!mFrontAndBackBufferDiffer) {
return;
}
nsRefPtr<gfxASurface> backBuffer;
if (!IsSurfaceDescriptorValid(mBackBuffer)) {
NS_ABORT_IF_FALSE(mROFrontBuffer.type() == OptionalThebesBuffer::TThebesBuffer,
"should have a front RO buffer by now");
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
nsRefPtr<gfxASurface> roFrontBuffer = BasicManager()->OpenDescriptor(roFront.buffer());
backBuffer = CreateBuffer(roFrontBuffer->GetContentType(), roFrontBuffer->GetSize());
} else {
backBuffer = BasicManager()->OpenDescriptor(mBackBuffer);
}
mFrontAndBackBufferDiffer = false;
if (OptionalThebesBuffer::Tnull_t == mROFrontBuffer.type()) {
// We didn't get back a read-only ref to our old back buffer (the
// parent's new front buffer). If the parent is pushing updates
// to a texture it owns, then we probably got back the same buffer
// we pushed in the update and all is well. If not, ...
mValidRegion = aValidRegion;
mBuffer.SetBackingBuffer(backBuffer, aBuffer.rect(), aBuffer.rotation());
mValidRegion = mFrontValidRegion;
mBuffer.SetBackingBuffer(backBuffer, mBackBufferRect, mBackBufferRectRotation);
return;
}
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
this,
aFrontUpdatedRegion.GetBounds().x,
aFrontUpdatedRegion.GetBounds().y,
aFrontUpdatedRegion.GetBounds().width,
aFrontUpdatedRegion.GetBounds().height));
mFrontUpdatedRegion.GetBounds().x,
mFrontUpdatedRegion.GetBounds().y,
mFrontUpdatedRegion.GetBounds().width,
mFrontUpdatedRegion.GetBounds().height));
const ThebesBuffer roFront = aReadOnlyFrontBuffer.get_ThebesBuffer();
const ThebesBuffer roFront = mROFrontBuffer.get_ThebesBuffer();
nsRefPtr<gfxASurface> roFrontBuffer = BasicManager()->OpenDescriptor(roFront.buffer());
mBuffer.SetBackingBufferAndUpdateFrom(
backBuffer,
roFrontBuffer, roFront.rect(), roFront.rotation(),
aFrontUpdatedRegion);
mFrontUpdatedRegion);
mIsNewBuffer = false;
// Now the new back buffer has the same (interesting) pixels as the
// new front buffer, and mValidRegion et al. are correct wrt the new
// back buffer (i.e. as they were for the old back buffer)
@ -2305,36 +2357,21 @@ BasicShadowableThebesLayer::CreateBuffer(Buffer::ContentType aType,
aSize.width, aSize.height));
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->DestroyedThebesBuffer(BasicManager()->Hold(this),
mBackBuffer);
mBackBuffer = SurfaceDescriptor();
}
// XXX error handling
SurfaceDescriptor tmpFront;
if (BasicManager()->ShouldDoubleBuffer()) {
if (!BasicManager()->AllocDoubleBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&tmpFront,
&mBackBuffer)) {
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&mBackBuffer)) {
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
}
} else {
if (!BasicManager()->AllocBuffer(gfxIntSize(aSize.width, aSize.height),
aType,
&mBackBuffer)) {
NS_RUNTIMEABORT("creating ThebesLayer 'back buffer' failed!");
}
}
NS_ABORT_IF_FALSE(!mIsNewBuffer,
"Bad! Did we create a buffer twice without painting?");
mIsNewBuffer = true;
BasicManager()->CreatedThebesBuffer(BasicManager()->Hold(this),
nsIntRegion(),
nsIntRect(),
tmpFront);
return BasicManager()->OpenDescriptor(mBackBuffer);
}
@ -2681,9 +2718,6 @@ public:
MOZ_COUNT_DTOR(BasicShadowThebesLayer);
}
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void SetValidRegion(const nsIntRegion& aRegion)
{
mOldValidRegion = mValidRegion;
@ -2698,7 +2732,7 @@ public:
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer()
@ -2709,6 +2743,7 @@ public:
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
mAllocator->DestroySharedSurface(&mFrontBufferDescriptor);
mFrontBufferDescriptor = SurfaceDescriptor();
}
}
@ -2733,48 +2768,46 @@ private:
nsIntRegion mOldValidRegion;
};
void
BasicShadowThebesLayer::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
mValidRegion = mOldValidRegion = aValidRegion;
NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t != aNewFront.type(),
"aNewFront must be valid here!");
const ThebesBuffer newFront = aNewFront.get_ThebesBuffer();
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(newFront.buffer());
nsRefPtr<gfxASurface> unused;
nsIntRect unusedRect;
nsIntPoint unusedRotation;
mFrontBuffer.Swap(newFrontBuffer, newFront.rect(), newFront.rotation(),
getter_AddRefs(unused), &unusedRect, &unusedRotation);
mFrontBufferDescriptor = newFront.buffer();
}
void
BasicShadowThebesLayer::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(aNewFront.buffer());
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
nsRefPtr<gfxASurface> currentFront = BasicManager()->OpenDescriptor(mFrontBufferDescriptor);
if (currentFront->GetSize() != newFrontBuffer->GetSize()) {
// Current front buffer is obsolete
DestroyFrontBuffer();
}
}
// This code relies on Swap() arriving *after* attribute mutations.
aNewBack->buffer() = mFrontBufferDescriptor;
if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
*aNewBack = ThebesBuffer();
aNewBack->get_ThebesBuffer().buffer() = mFrontBufferDescriptor;
} else {
*aNewBack = null_t();
}
// We have to invalidate the pixels painted into the new buffer.
// They might overlap with our old pixels.
aNewBackValidRegion->Sub(mOldValidRegion, aUpdatedRegion);
nsRefPtr<gfxASurface> newFrontBuffer =
BasicManager()->OpenDescriptor(aNewFront.buffer());
nsRefPtr<gfxASurface> unused;
nsIntRect backRect;
nsIntPoint backRotation;
mFrontBuffer.Swap(
newFrontBuffer, aNewFront.rect(), aNewFront.rotation(),
getter_AddRefs(unused), &aNewBack->rect(), &aNewBack->rotation());
getter_AddRefs(unused), &backRect, &backRotation);
if (aNewBack->type() != OptionalThebesBuffer::Tnull_t) {
aNewBack->get_ThebesBuffer().rect() = backRect;
aNewBack->get_ThebesBuffer().rotation() = backRotation;
}
mFrontBufferDescriptor = aNewFront.buffer();

View File

@ -265,12 +265,14 @@ ContainerLayerD3D10::RenderLayer()
oldD3D10Scissor.right - oldD3D10Scissor.left,
oldD3D10Scissor.bottom - oldD3D10Scissor.top);
nsAutoTArray<Layer*, 12> children;
SortChildrenBy3DZOrder(children);
/*
* Render this container's contents.
*/
for (LayerD3D10* layerToRender = GetFirstChildD3D10();
layerToRender != nsnull;
layerToRender = GetNextSiblingD3D10(layerToRender)) {
for (PRUint32 i = 0; i < children.Length(); i++) {
LayerD3D10* layerToRender = static_cast<LayerD3D10*>(children.ElementAt(i)->ImplData());
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;

View File

@ -729,11 +729,6 @@ LayerManagerD3D10::Render()
windowLayer = new WindowLayer(this);
windowLayer->SetShadow(ConstructShadowFor(windowLayer));
CreatedThebesLayer(windowLayer);
ShadowLayerForwarder::CreatedThebesBuffer(windowLayer,
contentRect,
contentRect,
SurfaceDescriptor());
mRootForShadowTree->InsertAfter(windowLayer, nsnull);
ShadowLayerForwarder::InsertAfter(mRootForShadowTree, windowLayer);
}

View File

@ -469,18 +469,10 @@ ShadowThebesLayerD3D10::~ShadowThebesLayerD3D10()
{
}
void
ShadowThebesLayerD3D10::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
NS_ABORT_IF_FALSE(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Expected dummy front buffer initially");
}
void
ShadowThebesLayerD3D10::Swap(
const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion)
{
nsRefPtr<ID3D10Texture2D> newBackBuffer = mTexture;
@ -490,7 +482,7 @@ ShadowThebesLayerD3D10::Swap(
// The content process tracks back/front buffers on its own, so
// the newBack is in essence unused.
aNewBack->buffer() = aNewFront.buffer();
aNewBack->get_ThebesBuffer().buffer() = aNewFront.buffer();
// The content process doesn't need to read back from the front
// buffer (yet).

View File

@ -108,12 +108,9 @@ public:
ShadowThebesLayerD3D10(LayerManagerD3D10* aManager);
virtual ~ShadowThebesLayerD3D10();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

View File

@ -247,12 +247,14 @@ ContainerRender(Container* aContainer,
aContainer->mParent->SupportsComponentAlphaChildren());
}
nsAutoTArray<Layer*, 12> children;
aContainer->SortChildrenBy3DZOrder(children);
/*
* Render this container's contents.
*/
for (LayerD3D9* layerToRender = aContainer->GetFirstChildD3D9();
layerToRender != nsnull;
layerToRender = GetNextSiblingD3D9(layerToRender)) {
for (PRUint32 i = 0; i < children.Length(); i++) {
LayerD3D9* layerToRender = static_cast<LayerD3D9*>(children.ElementAt(i)->ImplData());
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;

View File

@ -619,25 +619,17 @@ ShadowThebesLayerD3D9::~ShadowThebesLayerD3D9()
{}
void
ShadowThebesLayerD3D9::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (!mBuffer) {
mBuffer = new ShadowBufferD3D9(this);
}
NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Only one system-memory buffer expected");
}
void
ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (mBuffer) {
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer());
mBuffer->Upload(surf, GetVisibleRegion().GetBounds());

View File

@ -120,12 +120,9 @@ public:
ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager);
virtual ~ShadowThebesLayerD3D9();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

View File

@ -109,17 +109,6 @@ union CanvasSurface {
null_t;
};
// For the "buffer creation" operations, we send an initial front
// buffer that only contains (transparent) black pixels just so that
// we can swap it back after the first OpPaint without a special case.
struct OpCreateThebesBuffer {
PLayer layer;
OptionalThebesBuffer initialFront;
nsIntRegion frontValidRegion;
};
struct OpDestroyThebesFrontBuffer { PLayer layer; };
// Change a layer's attributes
struct CommonLayerAttributes {
nsIntRegion visibleRegion;
@ -194,8 +183,6 @@ union Edit {
OpCreateImageLayer;
OpCreateColorLayer;
OpCreateCanvasLayer;
OpCreateThebesBuffer;
OpDestroyThebesFrontBuffer;
OpSetLayerAttributes;
@ -217,7 +204,7 @@ struct OpImageSwap { PLayer layer; SharedImage newBackImage; };
struct OpThebesBufferSwap {
PLayer layer;
ThebesBuffer newBackBuffer;
OptionalThebesBuffer newBackBuffer;
nsIntRegion newValidRegion;
// If the parent took the child's old back buffer and returned its
// old front buffer, |readOnlyFrontBuffer| may (if non-null) contain

View File

@ -184,31 +184,6 @@ ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
}
void
ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
const nsIntRegion& aFrontValidRegion,
const nsIntRect& aBufferRect,
const SurfaceDescriptor& aTempFrontBuffer)
{
OptionalThebesBuffer buffer = null_t();
if (IsSurfaceDescriptorValid(aTempFrontBuffer)) {
buffer = ThebesBuffer(aTempFrontBuffer,
aBufferRect,
nsIntPoint(0, 0));
}
mTxn->AddEdit(OpCreateThebesBuffer(NULL, Shadow(aThebes),
buffer,
aFrontValidRegion));
}
void
ShadowLayerForwarder::DestroyedThebesBuffer(ShadowableLayer* aThebes,
const SurfaceDescriptor& aBackBufferToDestroy)
{
mTxn->AddEdit(OpDestroyThebesFrontBuffer(NULL, Shadow(aThebes)));
mTxn->AddBufferToDestroy(aBackBufferToDestroy);
}
void
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
{

View File

@ -140,38 +140,6 @@ public:
void CreatedColorLayer(ShadowableLayer* aColor);
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
/**
* Notify the shadow manager that a buffer has been created for the
* specificed layer. |aInitialFrontSurface| is one of the newly
* created, transparent black buffers for the layer; the "real"
* layer holds on to the other as its back buffer. We send it
* across on buffer creation to avoid special cases in the buffer
* swapping logic for Painted*() operations.
*
* It is expected that Created*Buffer() will be followed by a
* Painted*Buffer() in the same transaction, so that
* |aInitialFrontBuffer| is never actually drawn to screen. It is
* OK if it is drawn though.
*/
/**
* |aBufferRect| is the screen rect covered by |aInitialFrontBuffer|.
*/
void CreatedThebesBuffer(ShadowableLayer* aThebes,
const nsIntRegion& aFrontValidRegion,
const nsIntRect& aBufferRect,
const SurfaceDescriptor& aInitialFrontBuffer);
/**
* The specified layer is destroying its buffers.
* |aBackBufferToDestroy| is deallocated when this transaction is
* posted to the parent. During the parent-side transaction, the
* shadow is told to destroy its front buffer. This can happen when
* a new front/back buffer pair have been created because of a layer
* resize, e.g.
*/
void DestroyedThebesBuffer(ShadowableLayer* aThebes,
const SurfaceDescriptor& aBackBufferToDestroy);
/**
* At least one attribute of |aMutant| has changed, and |aMutant|
* needs to sync to its shadow layer. This initial implementation
@ -506,15 +474,6 @@ class ShadowThebesLayer : public ShadowLayer,
public ThebesLayer
{
public:
/**
* CONSTRUCTION PHASE ONLY
*
* Override the front buffer and its valid region with the specified
* values. This is called when a new buffer has been created.
*/
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion) = 0;
virtual void InvalidateRegion(const nsIntRegion& aRegion)
{
NS_RUNTIMEABORT("ShadowThebesLayers can't fill invalidated regions");
@ -538,7 +497,7 @@ public:
*/
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion) = 0;
/**

View File

@ -203,29 +203,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
AsShadowLayer(edit.get_OpCreateCanvasLayer())->Bind(layer);
break;
}
case Edit::TOpCreateThebesBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateThebesBuffer"));
const OpCreateThebesBuffer& otb = edit.get_OpCreateThebesBuffer();
ShadowThebesLayer* thebes = static_cast<ShadowThebesLayer*>(
AsShadowLayer(otb)->AsLayer());
thebes->SetFrontBuffer(otb.initialFront(), otb.frontValidRegion());
break;
}
case Edit::TOpDestroyThebesFrontBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] DestroyThebesFrontBuffer"));
const OpDestroyThebesFrontBuffer& odfb =
edit.get_OpDestroyThebesFrontBuffer();
ShadowThebesLayer* thebes = static_cast<ShadowThebesLayer*>(
AsShadowLayer(odfb)->AsLayer());
thebes->DestroyFrontBuffer();
break;
}
// Attributes
case Edit::TOpSetLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
@ -339,7 +317,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
static_cast<ShadowThebesLayer*>(shadow->AsLayer());
const ThebesBuffer& newFront = op.newFrontBuffer();
ThebesBuffer newBack;
OptionalThebesBuffer newBack;
nsIntRegion newValidRegion;
OptionalThebesBuffer readonlyFront;
nsIntRegion frontUpdatedRegion;

View File

@ -175,7 +175,6 @@ ContainerRender(Container* aContainer,
float opacity = aContainer->GetEffectiveOpacity();
const gfx3DMatrix& transform = aContainer->GetEffectiveTransform();
bool needsFramebuffer = aContainer->UseIntermediateSurface();
gfxMatrix contTransform;
if (needsFramebuffer) {
LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear;
nsIntRect framebufferRect = visibleRect;
@ -213,19 +212,16 @@ ContainerRender(Container* aContainer,
frameBuffer = aPreviousFrameBuffer;
aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) ||
(aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren());
#ifdef DEBUG
bool is2d =
#endif
transform.Is2D(&contTransform);
NS_ASSERTION(is2d, "Transform must be 2D");
}
nsAutoTArray<Layer*, 12> children;
aContainer->SortChildrenBy3DZOrder(children);
/**
* Render this container's contents.
*/
for (LayerOGL* layerToRender = aContainer->GetFirstChildOGL();
layerToRender != nsnull;
layerToRender = GetNextSibling(layerToRender)) {
for (PRUint32 i = 0; i < children.Length(); i++) {
LayerOGL* layerToRender = static_cast<LayerOGL*>(children.ElementAt(i)->ImplData());
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;

View File

@ -878,31 +878,18 @@ ShadowThebesLayerOGL::ShadowThebesLayerOGL(LayerManagerOGL *aManager)
ShadowThebesLayerOGL::~ShadowThebesLayerOGL()
{}
void
ShadowThebesLayerOGL::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
if (mDestroyed) {
return;
}
if (!mBuffer) {
mBuffer = new ShadowBufferOGL(this);
}
NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Only one system-memory buffer expected");
}
void
ShadowThebesLayerOGL::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
OptionalThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (!mDestroyed && mBuffer) {
if (!mDestroyed) {
if (!mBuffer) {
mBuffer = new ShadowBufferOGL(this);
}
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer());
mBuffer->Upload(surf, aUpdatedRegion, aNewFront.rect(), aNewFront.rotation());
}

View File

@ -91,12 +91,9 @@ public:
ShadowThebesLayerOGL(LayerManagerOGL *aManager);
virtual ~ShadowThebesLayerOGL();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();

View File

@ -34,6 +34,7 @@ EXPORTS = \
gfxPoint.h \
gfxPoint3D.h \
gfxPointH3D.h \
gfxQuad.h \
gfxQuaternion.h \
gfxRect.h \
gfxSkipChars.h \

View File

@ -667,6 +667,22 @@ gfx3DMatrix::TransformBounds(const gfxRect& rect) const
return gfxRect(min_x, min_y, max_x - min_x, max_y - min_y);
}
gfxQuad
gfx3DMatrix::TransformRect(const gfxRect& aRect) const
{
gfxPoint points[4];
points[0] = Transform(aRect.TopLeft());
points[1] = Transform(gfxPoint(aRect.X() + aRect.Width(), aRect.Y()));
points[2] = Transform(gfxPoint(aRect.X() + aRect.Width(),
aRect.Y() + aRect.Height()));
points[3] = Transform(gfxPoint(aRect.X(), aRect.Y() + aRect.Height()));
// Could this ever result in lines that intersect? I don't think so.
return gfxQuad(points[0], points[1], points[2], points[3]);
}
bool
gfx3DMatrix::Is2D() const
{
@ -714,6 +730,19 @@ gfx3DMatrix::CanDraw2D(gfxMatrix* aMatrix) const
return PR_TRUE;
}
gfx3DMatrix&
gfx3DMatrix::ProjectTo2D()
{
_31 = 0.0f;
_32 = 0.0f;
_13 = 0.0f;
_23 = 0.0f;
_33 = 1.0f;
_43 = 0.0f;
_34 = 0.0f;
return *this;
}
gfxPoint gfx3DMatrix::ProjectPoint(const gfxPoint& aPoint) const
{
// Define a ray of the form P + Ut where t is a real number

View File

@ -43,6 +43,7 @@
#include <gfxPoint3D.h>
#include <gfxPointH3D.h>
#include <gfxMatrix.h>
#include <gfxQuad.h>
/**
* This class represents a 3D transformation. The matrix is laid
@ -120,6 +121,12 @@ public:
*/
bool CanDraw2D(gfxMatrix* aMatrix = nsnull) const;
/**
* Converts the matrix to one that doesn't modify the z coordinate of points,
* but leaves the rest of the transformation unchanged.
*/
gfx3DMatrix& ProjectTo2D();
/**
* Returns true if the matrix is the identity matrix. The most important
* property we require is that gfx3DMatrix().IsIdentity() returns true.
@ -247,6 +254,9 @@ public:
*/
gfxRect TransformBounds(const gfxRect& rect) const;
gfxQuad TransformRect(const gfxRect& aRect) const;
/**
* Transforms a 3D vector according to this matrix.
*/

87
gfx/thebes/gfxQuad.h Normal file
View File

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Oracle Corporation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Matt Woodrow <mwoodrow@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_QUAD_H
#define GFX_QUAD_H
#include "nsMathUtils.h"
#include "mozilla/gfx/BaseSize.h"
#include "mozilla/gfx/BasePoint.h"
#include "nsSize.h"
#include "nsPoint.h"
#include "gfxTypes.h"
static PRBool SameSideOfLine(const gfxPoint& aPoint1, const gfxPoint& aPoint2, const gfxPoint& aTest, const gfxPoint& aRef)
{
// Solve the equation y - aPoint1.y - ((aPoint2.y - aPoint1.y)/(aPoint2.x - aPoint1.x))(x - aPoint1.x) for both test and ref
gfxFloat deltaY = (aPoint2.y - aPoint1.y);
gfxFloat deltaX = (aPoint2.x - aPoint1.x);
gfxFloat test = deltaX * (aTest.y - aPoint1.y) - deltaY * (aTest.x - aPoint1.x);
gfxFloat ref = deltaX * (aRef.y - aPoint1.y) - deltaY * (aRef.x - aPoint1.x);
// If both results have the same sign, then we're on the correct side of the line.
// 0 (on the line) is always considered in.
if ((test >= 0 && ref >= 0) || (test <= 0 && ref <= 0))
return PR_TRUE;
return PR_FALSE;
}
struct THEBES_API gfxQuad {
gfxQuad(const gfxPoint& aOne, const gfxPoint& aTwo, const gfxPoint& aThree, const gfxPoint& aFour)
{
mPoints[0] = aOne;
mPoints[1] = aTwo;
mPoints[2] = aThree;
mPoints[3] = aFour;
}
PRBool Contains(const gfxPoint& aPoint)
{
return (SameSideOfLine(mPoints[0], mPoints[1], aPoint, mPoints[2]) &&
SameSideOfLine(mPoints[1], mPoints[2], aPoint, mPoints[3]) &&
SameSideOfLine(mPoints[2], mPoints[3], aPoint, mPoints[0]) &&
SameSideOfLine(mPoints[3], mPoints[0], aPoint, mPoints[1]));
}
gfxPoint mPoints[4];
};
#endif /* GFX_QUAD_H */

View File

@ -41,9 +41,11 @@
#include "nsInterfaceHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsHashKeys.h"
#include "mozilla/Omnijar.h"
class nsHyphenator;
class nsIAtom;
class nsIURI;
class nsHyphenationManager
{
@ -61,11 +63,12 @@ private:
protected:
void LoadPatternList();
void LoadPatternListFromOmnijar(mozilla::Omnijar::Type aType);
void LoadPatternListFromDir(nsIFile *aDir);
void LoadAliases();
nsInterfaceHashtable<nsISupportsHashKey,nsIAtom> mHyphAliases;
nsInterfaceHashtable<nsISupportsHashKey,nsIFile> mPatternFiles;
nsInterfaceHashtable<nsISupportsHashKey,nsIURI> mPatternFiles;
nsRefPtrHashtable<nsISupportsHashKey,nsHyphenator> mHyphenators;
static nsHyphenationManager *sInstance;

View File

@ -42,12 +42,13 @@
#include "nsString.h"
#include "nsTArray.h"
class nsIURI;
class nsIUGenCategory;
class nsHyphenator
{
public:
nsHyphenator(nsIFile *aFile);
nsHyphenator(nsIURI *aURI);
NS_INLINE_DECL_REFCOUNTING(nsHyphenator)

View File

@ -39,12 +39,15 @@
#include "nsHyphenator.h"
#include "nsIAtom.h"
#include "nsIFile.h"
#include "nsIURI.h"
#include "nsIProperties.h"
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h"
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "nsZipArchive.h"
using namespace mozilla;
@ -89,20 +92,20 @@ nsHyphenationManager::GetHyphenator(nsIAtom *aLocale)
if (hyph) {
return hyph.forget();
}
nsCOMPtr<nsIFile> file = mPatternFiles.Get(aLocale);
if (!file) {
nsCOMPtr<nsIURI> uri = mPatternFiles.Get(aLocale);
if (!uri) {
nsCOMPtr<nsIAtom> alias = mHyphAliases.Get(aLocale);
if (alias) {
mHyphenators.Get(alias, getter_AddRefs(hyph));
if (hyph) {
return hyph.forget();
}
file = mPatternFiles.Get(alias);
if (file) {
uri = mPatternFiles.Get(alias);
if (uri) {
aLocale = alias;
}
}
if (!file) {
if (!uri) {
// In the case of a locale such as "de-DE-1996", we try replacing
// successive trailing subtags with "-*" to find fallback patterns,
// so "de-DE-1996" -> "de-DE-*" (and then recursively -> "de-*")
@ -120,14 +123,14 @@ nsHyphenationManager::GetHyphenator(nsIAtom *aLocale)
}
}
}
hyph = new nsHyphenator(file);
hyph = new nsHyphenator(uri);
if (hyph->IsValid()) {
mHyphenators.Put(aLocale, hyph);
return hyph.forget();
}
#ifdef DEBUG
nsCString msg;
file->GetNativePath(msg);
uri->GetSpec(msg);
msg.Insert("failed to load patterns from ", 0);
NS_WARNING(msg.get());
#endif
@ -140,15 +143,17 @@ nsHyphenationManager::LoadPatternList()
{
mPatternFiles.Clear();
mHyphenators.Clear();
nsresult rv;
LoadPatternListFromOmnijar(Omnijar::GRE);
LoadPatternListFromOmnijar(Omnijar::APP);
nsCOMPtr<nsIProperties> dirSvc =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
if (!dirSvc) {
return;
}
nsresult rv;
nsCOMPtr<nsIFile> greDir;
rv = dirSvc->Get(NS_GRE_DIR,
NS_GET_IID(nsIFile), getter_AddRefs(greDir));
@ -156,7 +161,7 @@ nsHyphenationManager::LoadPatternList()
greDir->AppendNative(NS_LITERAL_CSTRING("hyphenation"));
LoadPatternListFromDir(greDir);
}
nsCOMPtr<nsIFile> appDir;
rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile), getter_AddRefs(appDir));
@ -169,17 +174,72 @@ nsHyphenationManager::LoadPatternList()
}
}
void
nsHyphenationManager::LoadPatternListFromOmnijar(Omnijar::Type aType)
{
nsCString base;
nsresult rv = Omnijar::GetURIString(aType, base);
if (NS_FAILED(rv)) {
return;
}
nsZipArchive *zip = Omnijar::GetReader(aType);
if (!zip) {
return;
}
nsZipFind *find;
zip->FindInit("hyphenation/hyph_*.dic", &find);
if (!find) {
return;
}
const char *result;
PRUint16 len;
while (NS_SUCCEEDED(find->FindNext(&result, &len))) {
nsCString uriString(base);
uriString.Append(result, len);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), uriString);
if (NS_FAILED(rv)) {
continue;
}
nsCString locale;
rv = uri->GetPath(locale);
if (NS_FAILED(rv)) {
continue;
}
ToLowerCase(locale);
locale.SetLength(locale.Length() - 4); // strip ".dic"
locale.Cut(0, locale.RFindChar('/') + 1); // strip directory
if (StringBeginsWith(locale, NS_LITERAL_CSTRING("hyph_"))) {
locale.Cut(0, 5);
}
for (PRUint32 i = 0; i < locale.Length(); ++i) {
if (locale[i] == '_') {
locale.Replace(i, 1, '-');
}
}
nsCOMPtr<nsIAtom> localeAtom = do_GetAtom(locale);
if (NS_SUCCEEDED(rv)) {
mPatternFiles.Put(localeAtom, uri);
}
}
delete find;
}
void
nsHyphenationManager::LoadPatternListFromDir(nsIFile *aDir)
{
nsresult rv;
bool check = false;
rv = aDir->Exists(&check);
if (NS_FAILED(rv) || !check) {
return;
}
rv = aDir->IsDirectory(&check);
if (NS_FAILED(rv) || !check) {
return;
@ -190,12 +250,12 @@ nsHyphenationManager::LoadPatternListFromDir(nsIFile *aDir)
if (NS_FAILED(rv)) {
return;
}
nsCOMPtr<nsIDirectoryEnumerator> files(do_QueryInterface(e));
if (!files) {
return;
}
nsCOMPtr<nsIFile> file;
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(file))) && file){
nsAutoString dictName;
@ -219,7 +279,11 @@ nsHyphenationManager::LoadPatternListFromDir(nsIFile *aDir)
NS_ConvertUTF16toUTF8(dictName).get());
#endif
nsCOMPtr<nsIAtom> localeAtom = do_GetAtom(locale);
mPatternFiles.Put(localeAtom, file);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewFileURI(getter_AddRefs(uri), file);
if (NS_SUCCEEDED(rv)) {
mPatternFiles.Put(localeAtom, uri);
}
}
}

View File

@ -40,22 +40,22 @@
#include "nsUTF8Utils.h"
#include "nsIUGenCategory.h"
#include "nsUnicharUtilCIID.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "hyphen.h"
nsHyphenator::nsHyphenator(nsIFile *aFile)
nsHyphenator::nsHyphenator(nsIURI *aURI)
: mDict(nsnull)
{
nsCString urlSpec;
nsresult rv = NS_GetURLSpecFromFile(aFile, urlSpec);
nsCString uriSpec;
nsresult rv = aURI->GetSpec(uriSpec);
if (NS_FAILED(rv)) {
return;
}
mDict = hnj_hyphen_load(urlSpec.get());
mDict = hnj_hyphen_load(uriSpec.get());
#ifdef DEBUG
if (mDict) {
printf("loaded hyphenation patterns from %s\n", urlSpec.get());
printf("loaded hyphenation patterns from %s\n", uriSpec.get());
}
#endif
mCategories = do_GetService(NS_UNICHARCATEGORY_CONTRACTID, &rv);

View File

@ -1,49 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla Browser code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jason Orendorff <jorendorff@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(topsrcdir)/config/config.mk
PARALLEL_DIRS += \
debugger \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,12 @@
done = false;
try {
function x() {}
print(this.watch("d", Object.create))
var d = <x></x>
} catch (e) {}
try {
eval("d = ''")
done = true;
} catch (e) {}
assertEq(done, false);

View File

@ -0,0 +1,15 @@
function NPList() {}
NPList.prototype = new Array;
var list = new NPList();
list.push('a');
var cut = list.splice(0, 1);
assertEq(cut[0], 'a');
assertEq(cut.length, 1);
assertEq(list.length, 0);
var desc = Object.getOwnPropertyDescriptor(list, "0");
assertEq(desc, undefined);
assertEq("0" in list, false);

View File

@ -0,0 +1,8 @@
var o = { 0: 1, 1: 2, 2: 3, length: 3 };
Array.prototype.splice.call(o, 0, 1);
assertEq(o[0], 2);
assertEq(o[1], 3);
assertEq(Object.getOwnPropertyDescriptor(o, 2), undefined);
assertEq("2" in o, false);
assertEq(o.length, 2);

View File

@ -0,0 +1,327 @@
/*
* Check the order of splice's internal operations, because the ordering is
* visible externally.
*/
function handlerMaker(obj, expected_exceptions) {
var order = [];
function note(trap, name)
{
order.push(trap + '-' + name);
if (expected_exceptions[trap] === name) {
throw ("fail");
}
}
return [{
/* this is the only trap we care about */
delete: function(name) {
note("del", name);
return delete obj[name];
},
// Fundamental traps
getOwnPropertyDescriptor: function(name) {
var desc = Object.getOwnPropertyDescriptor(obj, name);
// a trapping proxy's properties must always be configurable
if (desc !== undefined)
desc.configurable = true;
return desc;
},
getPropertyDescriptor: function(name) {
var desc = Object.getPropertyDescriptor(obj, name); // not in ES5
// a trapping proxy's properties must always be configurable
if (desc !== undefined)
desc.configurable = true;
return desc;
},
getOwnPropertyNames: function() {
return Object.getOwnPropertyNames(obj);
},
getPropertyNames: function() {
return Object.getPropertyNames(obj); // not in ES5
},
defineProperty: function(name, desc) {
note("def", name);
Object.defineProperty(obj, name, desc);
},
fix: function() {
if (Object.isFrozen(obj)) {
return Object.getOwnPropertyNames(obj).map(function(name) {
return Object.getOwnPropertyDescriptor(obj, name);
});
}
// As long as obj is not frozen, the proxy won't allow itself to be fixed
return undefined; // will cause a TypeError to be thrown
},
// derived traps
has: function(name) {
note("has", name);
return name in obj;
},
hasOwn: function(name) { return Object.prototype.hasOwnProperty.call(obj, name); },
get: function(receiver, name) {
note("get", name);
return obj[name];
},
set: function(receiver, name, val) {
note("set", name);
obj[name] = val;
return true; // bad behavior when set fails in non-strict mode
},
enumerate: function() {
var result = [];
for (name in obj)
result.push(name);
return result;
},
keys: function() { return Object.keys(obj) }
}, order];
}
// arr: the array to splice
// expected_order: the expected order of operations on arr, stringified
function check_splice_proxy(arr, expected_order, expected_exceptions, expected_array, expected_result) {
print (arr);
var [handler, store] = handlerMaker(arr, expected_exceptions);
var proxy = Proxy.create(handler);
try {
var args = Array.prototype.slice.call(arguments, 5);
var result = Array.prototype.splice.apply(proxy, args);
assertEq(Object.keys(expected_exceptions).length, 0);
} catch (e) {
assertEq(Object.keys(expected_exceptions).length > 0, true);
}
// check the order of the property accesses, etc
assertEq(store.toString(), expected_order);
// The deleted elements are returned in an object that's always an Array.
assertEq(Array.isArray(result) || result === undefined, true);
// check the return value
for (var i in expected_result) {
assertEq(result[i], expected_result[i]);
}
for (var i in result) {
assertEq(result[i], expected_result[i]);
}
// check the value of arr
for (var i in expected_array) {
assertEq(arr[i], expected_array[i]);
}
for (var i in arr) {
assertEq(arr[i], expected_array[i]);
}
return result;
}
// Shrinking array
check_splice_proxy(
[10,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4,get-4,set-1,has-5,get-5,set-2," +
"del-5,del-4,del-3," +
"set-length",
{},
[3,4,5],
[10,1,2],
0, 3
);
// Growing array
check_splice_proxy(
[11,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-9,has-4,get-4,set-8,has-3,get-3,set-7," +
"set-0,set-1,set-2,set-3,set-4,set-5,set-6," +
"set-length",
{},
[9,9,9,9,9,9,9,3,4,5],
[11,1,2],
0, 3, 9, 9, 9, 9, 9, 9, 9
);
// Same sized array
check_splice_proxy(
[12,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"set-0,set-1,set-2," +
"set-length",
{},
[9,9,9,3,4,5],
[12,1,2],
0, 3, 9, 9, 9
);
/*
* Check that if we fail at a particular step in the algorithm, we don't
* continue with the algorithm beyond that step.
*/
// Step 3: fail when getting length
check_splice_proxy(
[13,1,2,3,4,5],
"get-length",
{get: 'length'},
[13,1,2,3,4,5],
undefined,
0, 3, 9, 9, 9
);
// Step 9b: fail when [[HasProperty]]
check_splice_proxy(
[14,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1",
{has: '1'},
[14,1,2,3,4,5],
undefined,
0, 3, 9, 9, 9
);
// Step 9c(i): fail when [[Get]]
check_splice_proxy(
[15,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1",
{get: '1'},
[15,1,2,3,4,5],
undefined,
0, 3, 9, 9, 9
);
// Step 12b(iii): fail when [[HasProperty]]
check_splice_proxy(
[16,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4",
{has: '4'},
[3,1,2,3,4,5],
undefined,
0, 3
);
// Step 12b(iv)1: fail when [[Get]]
check_splice_proxy(
[17,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4,get-4",
{get: '4'},
[3,1,2,3,4,5],
undefined,
0, 3
);
// Step 12b(iv)2: fail when [[Put]]
check_splice_proxy(
[18,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4,get-4,set-1",
{set: '1'},
[3,1,2,3,4,5],
undefined,
0, 3
);
// Step 12b(v)1: fail when [[Delete]]
check_splice_proxy(
[19,1,2,3,,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4,del-1",
{del: '1'},
[3,1,2,3,,5],
undefined,
0, 3
);
// Step 12d(i): fail when [[Delete]]
check_splice_proxy(
[20,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-3,get-3,set-0,has-4,get-4,set-1,has-5,get-5,set-2," +
"del-5,del-4",
{del: '4'},
[3,4,5,3,4],
undefined,
0, 3
);
// Step 13b(iii): fail when [[HasProperty]]
check_splice_proxy(
[21,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-8,has-4",
{has: '4'},
[21,1,2,3,4,5,,,5],
undefined,
0, 3, 9,9,9,9,9,9
);
// Step 13b(iv)1: fail when [[Get]]
check_splice_proxy(
[22,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-8,has-4,get-4",
{get: '4'},
[22,1,2,3,4,5,,,5],
undefined,
0, 3, 9,9,9,9,9,9
);
// Step 13b(iv)2: fail when [[Put]]
check_splice_proxy(
[23,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-8,has-4,get-4,set-7",
{set: '7'},
[23,1,2,3,4,5,,,5],
undefined,
0, 3, 9,9,9,9,9,9
);
// Step 13b(v)1: fail when [[Delete]]
check_splice_proxy(
[24,1,2,3,,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-8,has-4,del-7",
{del: '7'},
[24,1,2,3,,5,,,5],
undefined,
0, 3, 9,9,9,9,9,9
);
// Step 15b: fail when [[Put]]
check_splice_proxy(
[25,1,2,3,4,5],
"get-length," +
"has-0,get-0,has-1,get-1,has-2,get-2," +
"has-5,get-5,set-8,has-4,get-4,set-7,has-3,get-3,set-6," +
"set-0,set-1,set-2",
{set: '2'},
[9,9,2,3,4,5,3,4,5],
undefined,
0, 3, 9,9,9,9,9,9
);

View File

@ -0,0 +1,26 @@
/* Test that splice causing deletion of a non-configurable property stops at exactly step 12(v) of ES5 15.4.4.12 */
var O = [1,2,3,4,5,6];
var A = undefined;
Object.defineProperty(O, 3, { configurable: false });
try
{
A = O.splice(0, 6);
throw new Error("didn't throw, returned " + A);
}
catch (e)
{
assertEq(e instanceof TypeError, true,
"deleting O[3] should have caused a TypeError");
}
assertEq(O.length, 6); // setting length not reached
assertEq(A, undefined); // return value not reached
assertEq(O[5], undefined); // deletion reached
assertEq(O[4], undefined); // deletion reached
assertEq(O[3], 4); // deletion caused exception
assertEq(O[2], 3); // deletion not reached
assertEq(O[1], 2); // deletion not reached
assertEq(O[0], 1); // deletion not reached

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