mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Merge inbound to m-c.
This commit is contained in:
commit
febf24bb96
@ -233,6 +233,10 @@ var FullZoom = {
|
||||
* (optional) browser object displaying the document
|
||||
*/
|
||||
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
||||
// Bug 691614 - zooming support for electrolysis
|
||||
if (gMultiProcessBrowser)
|
||||
return;
|
||||
|
||||
// Ignore all pending async zoom accesses in the browser. Pending accesses
|
||||
// that started before the location change will be prevented from applying
|
||||
// to the new location.
|
||||
@ -435,9 +439,9 @@ var FullZoom = {
|
||||
* operations that access the given browser's zoom should use this method to
|
||||
* capture the token before starting and use token.isCurrent to determine if
|
||||
* it's safe to access the zoom when done. If token.isCurrent is false, then
|
||||
* the zoom of the browser was changed after the async operation started, and
|
||||
* depending on what the operation is doing, it may no longer be safe to set
|
||||
* the zoom or get it to then use in some manner.
|
||||
* after the async operation started, either the browser's zoom was changed or
|
||||
* the browser was destroyed, and depending on what the operation is doing, it
|
||||
* may no longer be safe to set and get its zoom.
|
||||
*
|
||||
* @param browser The token of this browser will be returned.
|
||||
* @return An object with an "isCurrent" getter.
|
||||
@ -450,7 +454,12 @@ var FullZoom = {
|
||||
return {
|
||||
token: map.get(outerID),
|
||||
get isCurrent() {
|
||||
return map.get(outerID) === this.token;
|
||||
// At this point, the browser may have been destructed and unbound but
|
||||
// its outer ID not removed from the map because outer-window-destroyed
|
||||
// hasn't been received yet. In that case, the browser is unusable, it
|
||||
// has no properties, so return false. Check for this case by getting a
|
||||
// property, say, docShell.
|
||||
return map.get(outerID) === this.token && browser.docShell;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
@ -84,6 +84,9 @@ this.__defineSetter__("PluralForm", function (val) {
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
|
||||
"resource:///modules/AboutHomeUtils.jsm");
|
||||
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Weave",
|
||||
"resource://services-sync/main.js");
|
||||
@ -732,9 +735,12 @@ var gBrowserInit = {
|
||||
|
||||
var mustLoadSidebar = false;
|
||||
|
||||
Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService)
|
||||
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
|
||||
if (!gMultiProcessBrowser) {
|
||||
// There is a Content:Click message manually sent from content.
|
||||
Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService)
|
||||
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
|
||||
}
|
||||
|
||||
gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver, false);
|
||||
|
||||
@ -2308,6 +2314,64 @@ function PageProxyClickHandler(aEvent)
|
||||
middleMousePaste(aEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle load of some pages (about:*) so that we can make modifications
|
||||
* to the DOM for unprivileged pages.
|
||||
*/
|
||||
function BrowserOnAboutPageLoad(doc) {
|
||||
if (doc.documentURI.toLowerCase() == "about:home") {
|
||||
// XXX bug 738646 - when Marketplace is launched, remove this statement and
|
||||
// the hidden attribute set on the apps button in aboutHome.xhtml
|
||||
if (getBoolPref("browser.aboutHome.apps", false))
|
||||
doc.getElementById("apps").removeAttribute("hidden");
|
||||
|
||||
let ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Components.interfaces.nsISessionStore);
|
||||
if (ss.canRestoreLastSession &&
|
||||
!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
doc.getElementById("launcher").setAttribute("session", "true");
|
||||
|
||||
// Inject search engine and snippets URL.
|
||||
let docElt = doc.documentElement;
|
||||
// set the following attributes BEFORE searchEngineURL, which triggers to
|
||||
// show the snippets when it's set.
|
||||
docElt.setAttribute("snippetsURL", AboutHomeUtils.snippetsURL);
|
||||
if (AboutHomeUtils.showKnowYourRights) {
|
||||
docElt.setAttribute("showKnowYourRights", "true");
|
||||
// Set pref to indicate we've shown the notification.
|
||||
let currentVersion = Services.prefs.getIntPref("browser.rights.version");
|
||||
Services.prefs.setBoolPref("browser.rights." + currentVersion + ".shown", true);
|
||||
}
|
||||
docElt.setAttribute("snippetsVersion", AboutHomeUtils.snippetsVersion);
|
||||
|
||||
let updateSearchEngine = function() {
|
||||
let engine = AboutHomeUtils.defaultSearchEngine;
|
||||
docElt.setAttribute("searchEngineName", engine.name);
|
||||
docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
|
||||
// Again, keep the searchEngineURL as the last attribute, because the
|
||||
// mutation observer in aboutHome.js is counting on that.
|
||||
docElt.setAttribute("searchEngineURL", engine.searchURL);
|
||||
};
|
||||
updateSearchEngine();
|
||||
|
||||
// Listen for the event that's triggered when the user changes search engine.
|
||||
// At this point we simply reload about:home to reflect the change.
|
||||
Services.obs.addObserver(updateSearchEngine, "browser-search-engine-modified", false);
|
||||
|
||||
// Remove the observer when the page is reloaded or closed.
|
||||
doc.defaultView.addEventListener("pagehide", function removeObserver() {
|
||||
doc.defaultView.removeEventListener("pagehide", removeObserver);
|
||||
Services.obs.removeObserver(updateSearchEngine, "browser-search-engine-modified");
|
||||
}, false);
|
||||
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
|
||||
BrowserSearch.recordSearchInHealthReport(e.detail, "abouthome");
|
||||
}, true, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle command events bubbling up from error page content
|
||||
*/
|
||||
@ -2332,6 +2396,9 @@ let BrowserOnClick = {
|
||||
else if (ownerDoc.documentURI.startsWith("about:neterror")) {
|
||||
this.onAboutNetError(originalTarget, ownerDoc);
|
||||
}
|
||||
else if (ownerDoc.documentURI.toLowerCase() == "about:home") {
|
||||
this.onAboutHome(originalTarget, ownerDoc);
|
||||
}
|
||||
},
|
||||
|
||||
onAboutCertError: function BrowserOnClick_onAboutCertError(aTargetElm, aOwnerDoc) {
|
||||
@ -2508,6 +2575,49 @@ let BrowserOnClick = {
|
||||
return;
|
||||
Services.io.offline = false;
|
||||
},
|
||||
|
||||
onAboutHome: function BrowserOnClick_onAboutHome(aTargetElm, aOwnerDoc) {
|
||||
let elmId = aTargetElm.getAttribute("id");
|
||||
|
||||
switch (elmId) {
|
||||
case "restorePreviousSession":
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Ci.nsISessionStore);
|
||||
if (ss.canRestoreLastSession) {
|
||||
ss.restoreLastSession();
|
||||
}
|
||||
aOwnerDoc.getElementById("launcher").removeAttribute("session");
|
||||
break;
|
||||
|
||||
case "downloads":
|
||||
BrowserDownloadsUI();
|
||||
break;
|
||||
|
||||
case "bookmarks":
|
||||
PlacesCommandHook.showPlacesOrganizer("AllBookmarks");
|
||||
break;
|
||||
|
||||
case "history":
|
||||
PlacesCommandHook.showPlacesOrganizer("History");
|
||||
break;
|
||||
|
||||
case "apps":
|
||||
openUILinkIn("https://marketplace.mozilla.org/", "tab");
|
||||
break;
|
||||
|
||||
case "addons":
|
||||
BrowserOpenAddonsMgr();
|
||||
break;
|
||||
|
||||
case "sync":
|
||||
openPreferences("paneSync");
|
||||
break;
|
||||
|
||||
case "settings":
|
||||
openPreferences();
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4187,7 +4297,6 @@ var TabsProgressListener = {
|
||||
Components.isSuccessCode(aStatus) &&
|
||||
doc.documentURI.startsWith("about:") &&
|
||||
!doc.documentURI.toLowerCase().startsWith("about:blank") &&
|
||||
!doc.documentURI.toLowerCase().startsWith("about:home") &&
|
||||
!doc.documentElement.hasAttribute("hasBrowserHandlers")) {
|
||||
// STATE_STOP may be received twice for documents, thus store an
|
||||
// attribute to ensure handling it just once.
|
||||
@ -4201,6 +4310,9 @@ var TabsProgressListener = {
|
||||
if (event.target.documentElement)
|
||||
event.target.documentElement.removeAttribute("hasBrowserHandlers");
|
||||
}, true);
|
||||
|
||||
// We also want to make changes to page UI for unprivileged about pages.
|
||||
BrowserOnAboutPageLoad(doc);
|
||||
}
|
||||
},
|
||||
|
||||
@ -4284,6 +4396,44 @@ function nsBrowserAccess() { }
|
||||
nsBrowserAccess.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]),
|
||||
|
||||
_openURIInNewTab: function(aURI, aOpener, aIsExternal) {
|
||||
let win, needToFocusWin;
|
||||
|
||||
// try the current window. if we're in a popup, fall back on the most recent browser window
|
||||
if (window.toolbar.visible)
|
||||
win = window;
|
||||
else {
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(aOpener || window);
|
||||
win = RecentWindow.getMostRecentBrowserWindow({private: isPrivate});
|
||||
needToFocusWin = true;
|
||||
}
|
||||
|
||||
if (!win) {
|
||||
// we couldn't find a suitable window, a new one needs to be opened.
|
||||
return null;
|
||||
}
|
||||
|
||||
if (aIsExternal && (!aURI || aURI.spec == "about:blank")) {
|
||||
win.BrowserOpenTab(); // this also focuses the location bar
|
||||
win.focus();
|
||||
return win.gBrowser.selectedBrowser;
|
||||
}
|
||||
|
||||
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
|
||||
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
|
||||
|
||||
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
|
||||
referrerURI: referrer,
|
||||
fromExternal: aIsExternal,
|
||||
inBackground: loadInBackground});
|
||||
let browser = win.gBrowser.getBrowserForTab(tab);
|
||||
|
||||
if (needToFocusWin || (!loadInBackground && aIsExternal))
|
||||
win.focus();
|
||||
|
||||
return browser;
|
||||
},
|
||||
|
||||
openURI: function (aURI, aOpener, aWhere, aContext) {
|
||||
var newWindow = null;
|
||||
var isExternal = (aContext == Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
@ -4310,41 +4460,8 @@ nsBrowserAccess.prototype = {
|
||||
newWindow = openDialog(getBrowserURL(), "_blank", "all,dialog=no", url, null, null, null);
|
||||
break;
|
||||
case Ci.nsIBrowserDOMWindow.OPEN_NEWTAB :
|
||||
let win, needToFocusWin;
|
||||
|
||||
// try the current window. if we're in a popup, fall back on the most recent browser window
|
||||
if (window.toolbar.visible)
|
||||
win = window;
|
||||
else {
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(aOpener || window);
|
||||
win = RecentWindow.getMostRecentBrowserWindow({private: isPrivate});
|
||||
needToFocusWin = true;
|
||||
}
|
||||
|
||||
if (!win) {
|
||||
// we couldn't find a suitable window, a new one needs to be opened.
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isExternal && (!aURI || aURI.spec == "about:blank")) {
|
||||
win.BrowserOpenTab(); // this also focuses the location bar
|
||||
win.focus();
|
||||
newWindow = win.content;
|
||||
break;
|
||||
}
|
||||
|
||||
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
|
||||
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
|
||||
|
||||
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
|
||||
referrerURI: referrer,
|
||||
fromExternal: isExternal,
|
||||
inBackground: loadInBackground});
|
||||
let browser = win.gBrowser.getBrowserForTab(tab);
|
||||
|
||||
let browser = this._openURIInNewTab(aURI, aOpener, isExternal);
|
||||
newWindow = browser.contentWindow;
|
||||
if (needToFocusWin || (!loadInBackground && isExternal))
|
||||
newWindow.focus();
|
||||
break;
|
||||
default : // OPEN_CURRENTWINDOW or an illegal value
|
||||
newWindow = content;
|
||||
@ -4361,6 +4478,17 @@ nsBrowserAccess.prototype = {
|
||||
return newWindow;
|
||||
},
|
||||
|
||||
openURIInFrame: function browser_openURIInFrame(aURI, aOpener, aWhere, aContext) {
|
||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||
dump("Error: openURIInFrame can only open in new tabs");
|
||||
return null;
|
||||
}
|
||||
|
||||
var isExternal = (aContext == Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
let browser = this._openURIInNewTab(aURI, aOpener, isExternal);
|
||||
return browser.QueryInterface(Ci.nsIFrameLoaderOwner);
|
||||
},
|
||||
|
||||
isTabContentWindow: function (aWindow) {
|
||||
return gBrowser.browsers.some(function (browser) browser.contentWindow == aWindow);
|
||||
},
|
||||
|
@ -13,8 +13,6 @@ XPCOMUtils.defineLazyModuleGetter(this,
|
||||
"LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this,
|
||||
"InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
// Bug 671101 - directly using webNavigation in this context
|
||||
// causes docshells to leak
|
||||
@ -57,141 +55,97 @@ if (Services.prefs.getBoolPref("browser.tabs.remote")) {
|
||||
});
|
||||
}
|
||||
|
||||
let AboutHomeListener = {
|
||||
init: function() {
|
||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
webProgress.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
|
||||
|
||||
addMessageListener("AboutHome:Update", this);
|
||||
var global = this;
|
||||
|
||||
let ClickEventHandler = {
|
||||
init: function init() {
|
||||
Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(Ci.nsIEventListenerService)
|
||||
.addSystemEventListener(global, "click", this, true);
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
switch (aMessage.name) {
|
||||
case "AboutHome:Update":
|
||||
this.onUpdate(aMessage.data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onUpdate: function(aData) {
|
||||
let doc = content.document;
|
||||
if (doc.documentURI.toLowerCase() != "about:home")
|
||||
handleEvent: function(event) {
|
||||
// Bug 903016: Most of this code is an unfortunate duplication from
|
||||
// contentAreaClick in browser.js.
|
||||
if (!event.isTrusted || event.defaultPrevented || event.button == 2)
|
||||
return;
|
||||
|
||||
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isWindowPrivate(content))
|
||||
doc.getElementById("launcher").setAttribute("session", "true");
|
||||
let [href, node] = this._hrefAndLinkNodeForClickEvent(event);
|
||||
|
||||
// Inject search engine and snippets URL.
|
||||
let docElt = doc.documentElement;
|
||||
// set the following attributes BEFORE searchEngineURL, which triggers to
|
||||
// show the snippets when it's set.
|
||||
docElt.setAttribute("snippetsURL", aData.snippetsURL);
|
||||
if (aData.showKnowYourRights)
|
||||
docElt.setAttribute("showKnowYourRights", "true");
|
||||
docElt.setAttribute("snippetsVersion", aData.snippetsVersion);
|
||||
let json = { button: event.button, shiftKey: event.shiftKey,
|
||||
ctrlKey: event.ctrlKey, metaKey: event.metaKey,
|
||||
altKey: event.altKey, href: null, title: null,
|
||||
bookmark: false };
|
||||
|
||||
let engine = aData.defaultSearchEngine;
|
||||
docElt.setAttribute("searchEngineName", engine.name);
|
||||
docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
|
||||
// Again, keep the searchEngineURL as the last attribute, because the
|
||||
// mutation observer in aboutHome.js is counting on that.
|
||||
docElt.setAttribute("searchEngineURL", engine.searchURL);
|
||||
},
|
||||
if (href) {
|
||||
json.href = href;
|
||||
if (node) {
|
||||
json.title = node.getAttribute("title");
|
||||
|
||||
onPageLoad: function(aDocument) {
|
||||
// XXX bug 738646 - when Marketplace is launched, remove this statement and
|
||||
// the hidden attribute set on the apps button in aboutHome.xhtml
|
||||
if (Services.prefs.getPrefType("browser.aboutHome.apps") == Services.prefs.PREF_BOOL &&
|
||||
Services.prefs.getBoolPref("browser.aboutHome.apps"))
|
||||
doc.getElementById("apps").removeAttribute("hidden");
|
||||
if (event.button == 0 && !event.ctrlKey && !event.shiftKey &&
|
||||
!event.altKey && !event.metaKey) {
|
||||
json.bookmark = node.getAttribute("rel") == "sidebar";
|
||||
if (json.bookmark)
|
||||
event.preventDefault(); // Need to prevent the pageload.
|
||||
}
|
||||
}
|
||||
|
||||
sendAsyncMessage("AboutHome:RequestUpdate");
|
||||
|
||||
aDocument.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
|
||||
sendAsyncMessage("AboutHome:Search", { engineName: e.detail });
|
||||
}, true, true);
|
||||
},
|
||||
|
||||
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
let doc = aWebProgress.DOMWindow.document;
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW &&
|
||||
Components.isSuccessCode(aStatus) &&
|
||||
doc.documentURI.toLowerCase() == "about:home" &&
|
||||
!doc.documentElement.hasAttribute("hasBrowserHandlers")) {
|
||||
// STATE_STOP may be received twice for documents, thus store an
|
||||
// attribute to ensure handling it just once.
|
||||
doc.documentElement.setAttribute("hasBrowserHandlers", "true");
|
||||
addEventListener("click", this.onClick, true);
|
||||
addEventListener("pagehide", function onPageHide(event) {
|
||||
if (event.target.defaultView.frameElement)
|
||||
return;
|
||||
removeEventListener("click", this.onClick, true);
|
||||
removeEventListener("pagehide", onPageHide, true);
|
||||
if (event.target.documentElement)
|
||||
event.target.documentElement.removeAttribute("hasBrowserHandlers");
|
||||
}, true);
|
||||
|
||||
// We also want to make changes to page UI for unprivileged about pages.
|
||||
this.onPageLoad(doc);
|
||||
}
|
||||
},
|
||||
|
||||
onClick: function(aEvent) {
|
||||
if (!aEvent.isTrusted || // Don't trust synthetic events
|
||||
aEvent.button == 2 || aEvent.target.localName != "button") {
|
||||
sendAsyncMessage("Content:Click", json);
|
||||
return;
|
||||
}
|
||||
|
||||
let originalTarget = aEvent.originalTarget;
|
||||
let ownerDoc = originalTarget.ownerDocument;
|
||||
let elmId = originalTarget.getAttribute("id");
|
||||
|
||||
switch (elmId) {
|
||||
case "restorePreviousSession":
|
||||
sendAsyncMessage("AboutHome:RestorePreviousSession");
|
||||
ownerDoc.getElementById("launcher").removeAttribute("session");
|
||||
break;
|
||||
|
||||
case "downloads":
|
||||
sendAsyncMessage("AboutHome:Downloads");
|
||||
break;
|
||||
|
||||
case "bookmarks":
|
||||
sendAsyncMessage("AboutHome:Bookmarks");
|
||||
break;
|
||||
|
||||
case "history":
|
||||
sendAsyncMessage("AboutHome:History");
|
||||
break;
|
||||
|
||||
case "apps":
|
||||
sendAsyncMessage("AboutHome:Apps");
|
||||
break;
|
||||
|
||||
case "addons":
|
||||
sendAsyncMessage("AboutHome:Addons");
|
||||
break;
|
||||
|
||||
case "sync":
|
||||
sendAsyncMessage("AboutHome:Sync");
|
||||
break;
|
||||
|
||||
case "settings":
|
||||
sendAsyncMessage("AboutHome:Settings");
|
||||
break;
|
||||
}
|
||||
// This might be middle mouse navigation.
|
||||
if (event.button == 1)
|
||||
sendAsyncMessage("Content:Click", json);
|
||||
},
|
||||
|
||||
QueryInterface: function QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIWebProgressListener) ||
|
||||
aIID.equals(Ci.nsISupportsWeakReference) ||
|
||||
aIID.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
/**
|
||||
* Extracts linkNode and href for the current click target.
|
||||
*
|
||||
* @param event
|
||||
* The click event.
|
||||
* @return [href, linkNode].
|
||||
*
|
||||
* @note linkNode will be null if the click wasn't on an anchor
|
||||
* element (or XLink).
|
||||
*/
|
||||
_hrefAndLinkNodeForClickEvent: function(event) {
|
||||
function isHTMLLink(aNode) {
|
||||
// Be consistent with what nsContextMenu.js does.
|
||||
return ((aNode instanceof content.HTMLAnchorElement && aNode.href) ||
|
||||
(aNode instanceof content.HTMLAreaElement && aNode.href) ||
|
||||
aNode instanceof content.HTMLLinkElement);
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
function makeURLAbsolute(aBase, aUrl) {
|
||||
// Note: makeURI() will throw if aUri is not a valid URI
|
||||
return makeURI(aUrl, null, makeURI(aBase)).spec;
|
||||
}
|
||||
|
||||
let node = event.target;
|
||||
while (node && !isHTMLLink(node)) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
if (node)
|
||||
return [node.href, node];
|
||||
|
||||
// If there is no linkNode, try simple XLink.
|
||||
let href, baseURI;
|
||||
node = event.target;
|
||||
while (node && !href) {
|
||||
if (node.nodeType == content.Node.ELEMENT_NODE) {
|
||||
href = node.getAttributeNS("http://www.w3.org/1999/xlink", "href");
|
||||
if (href)
|
||||
baseURI = node.baseURI;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
// In case of XLink, we don't return the node we got href from since
|
||||
// callers expect <a>-like elements.
|
||||
return [href ? makeURLAbsolute(baseURI, href) : null, null];
|
||||
}
|
||||
};
|
||||
AboutHomeListener.init();
|
||||
ClickEventHandler.init();
|
@ -7,7 +7,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
|
||||
"resource:///modules/AboutHome.jsm");
|
||||
"resource:///modules/AboutHomeUtils.jsm");
|
||||
|
||||
let gRightsVersion = Services.prefs.getIntPref("browser.rights.version");
|
||||
|
||||
@ -106,17 +106,14 @@ let gTests = [
|
||||
let doc = gBrowser.contentDocument;
|
||||
let engineName = doc.documentElement.getAttribute("searchEngineName");
|
||||
|
||||
// We rely on the listener in browser.js being installed and fired before
|
||||
// this one. If this ever changes, we should add an executeSoon() or similar.
|
||||
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
|
||||
is(e.detail, engineName, "Detail is search engine name");
|
||||
|
||||
// We use executeSoon() to ensure that this code runs after the
|
||||
// count has been updated in browser.js, since it uses the same
|
||||
// event.
|
||||
executeSoon(function () {
|
||||
getNumberOfSearches(engineName).then(num => {
|
||||
is(num, numSearchesBefore + 1, "One more search recorded.");
|
||||
deferred.resolve();
|
||||
});
|
||||
getNumberOfSearches(engineName).then(num => {
|
||||
is(num, numSearchesBefore + 1, "One more search recorded.");
|
||||
deferred.resolve();
|
||||
});
|
||||
}, true, true);
|
||||
|
||||
@ -278,35 +275,19 @@ let gTests = [
|
||||
if (engine.name != "POST Search")
|
||||
return;
|
||||
|
||||
// Ready to execute the tests!
|
||||
let needle = "Search for something awesome.";
|
||||
let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
|
||||
let searchText = document.getElementById("searchText");
|
||||
|
||||
// We're about to change the search engine. Once the change has
|
||||
// propagated to the about:home content, we want to perform a search.
|
||||
let mutationObserver = new MutationObserver(function (mutations) {
|
||||
for (let mutation of mutations) {
|
||||
if (mutation.attributeName == "searchEngineURL") {
|
||||
searchText.value = needle;
|
||||
searchText.focus();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
}
|
||||
}
|
||||
});
|
||||
mutationObserver.observe(document.documentElement, { attributes: true });
|
||||
|
||||
// Change the search engine, triggering the observer above.
|
||||
Services.search.defaultEngine = engine;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
mutationObserver.disconnect();
|
||||
Services.search.removeEngine(engine);
|
||||
Services.search.defaultEngine = currEngine;
|
||||
});
|
||||
|
||||
|
||||
// When the search results load, check them for correctness.
|
||||
// Ready to execute the tests!
|
||||
let needle = "Search for something awesome.";
|
||||
let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
|
||||
let searchText = document.getElementById("searchText");
|
||||
|
||||
waitForLoad(function() {
|
||||
let loadedText = gBrowser.contentDocument.body.textContent;
|
||||
ok(loadedText, "search page loaded");
|
||||
@ -314,6 +295,10 @@ let gTests = [
|
||||
"Search text should arrive correctly");
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
searchText.value = needle;
|
||||
searchText.focus();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
};
|
||||
Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
|
||||
registerCleanupFunction(function () {
|
||||
|
@ -14,12 +14,12 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/SignInToWebsite.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AboutHome",
|
||||
"resource:///modules/AboutHome.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ContentClick",
|
||||
"resource:///modules/ContentClick.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
@ -465,7 +465,9 @@ BrowserGlue.prototype = {
|
||||
SignInToWebsiteUX.init();
|
||||
PdfJs.init();
|
||||
webrtcUI.init();
|
||||
AboutHome.init();
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.tabs.remote"))
|
||||
ContentClick.init();
|
||||
|
||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
},
|
||||
|
@ -11,7 +11,7 @@ browser.jar:
|
||||
* content/browser/preferences/in-content/tabs.xul
|
||||
* content/browser/preferences/in-content/tabs.js
|
||||
content/browser/preferences/in-content/privacy.xul
|
||||
content/browser/preferences/in-content/privacy.js
|
||||
* content/browser/preferences/in-content/privacy.js
|
||||
* content/browser/preferences/in-content/advanced.xul
|
||||
* content/browser/preferences/in-content/advanced.js
|
||||
content/browser/preferences/in-content/applications.xul
|
||||
|
@ -178,8 +178,13 @@ var gPrivacyPane = {
|
||||
// select the remember forms history option
|
||||
document.getElementById("browser.formfill.enable").value = true;
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
// select the allow cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 0;
|
||||
#else
|
||||
// select the limit cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 3;
|
||||
#endif
|
||||
// select the cookie lifetime policy option
|
||||
document.getElementById("network.cookie.lifetimePolicy").value = 0;
|
||||
|
||||
@ -399,11 +404,19 @@ var gPrivacyPane = {
|
||||
var accept = document.getElementById("acceptCookies");
|
||||
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
// if we're enabling cookies, automatically select 'accept third party always'
|
||||
if (accept.checked)
|
||||
acceptThirdPartyMenu.selectedIndex = 0;
|
||||
|
||||
return accept.checked ? 0 : 2;
|
||||
#else
|
||||
// if we're enabling cookies, automatically select 'accept third party from visited'
|
||||
if (accept.checked)
|
||||
acceptThirdPartyMenu.selectedIndex = 1;
|
||||
|
||||
return accept.checked ? 3 : 2;
|
||||
#endif
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -18,12 +18,19 @@ MOCHITEST_BROWSER_FILES := \
|
||||
browser_connection.js \
|
||||
browser_privacypane_1.js \
|
||||
browser_privacypane_3.js \
|
||||
browser_privacypane_4.js \
|
||||
browser_privacypane_5.js \
|
||||
browser_privacypane_8.js \
|
||||
privacypane_tests_perwindow.js \
|
||||
$(NULL)
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
pp_mochitest_browser_files := \
|
||||
browser_privacypane_4.js \
|
||||
$(NULL)
|
||||
pp_mochitest_browser_files_PATH := $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
||||
PP_TARGETS += pp_mochitest_browser_files
|
||||
endif # ENABLE_TESTS
|
||||
|
||||
ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_healthreport.js \
|
||||
|
@ -15,8 +15,13 @@ function test() {
|
||||
run_test_subset([
|
||||
test_custom_retention("acceptCookies", "remember"),
|
||||
test_custom_retention("acceptCookies", "custom"),
|
||||
#ifdef RELEASE_BUILD
|
||||
test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
|
||||
test_custom_retention("acceptThirdPartyMenu", "custom", "always"),
|
||||
#else
|
||||
test_custom_retention("acceptThirdPartyMenu", "remember", "always"),
|
||||
test_custom_retention("acceptThirdPartyMenu", "custom", "visited"),
|
||||
#endif
|
||||
test_custom_retention("keepCookiesUntil", "remember", 1),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 2),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 0),
|
||||
|
@ -32,7 +32,7 @@ browser.jar:
|
||||
content/browser/preferences/permissions.js
|
||||
* content/browser/preferences/preferences.xul
|
||||
content/browser/preferences/privacy.xul
|
||||
content/browser/preferences/privacy.js
|
||||
* content/browser/preferences/privacy.js
|
||||
content/browser/preferences/sanitize.xul
|
||||
content/browser/preferences/sanitize.js
|
||||
content/browser/preferences/security.xul
|
||||
|
@ -180,8 +180,13 @@ var gPrivacyPane = {
|
||||
// select the remember forms history option
|
||||
document.getElementById("browser.formfill.enable").value = true;
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
// select the accept cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 0;
|
||||
#else
|
||||
// select the limit cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 3;
|
||||
#endif
|
||||
// select the cookie lifetime policy option
|
||||
document.getElementById("network.cookie.lifetimePolicy").value = 0;
|
||||
|
||||
@ -401,13 +406,21 @@ var gPrivacyPane = {
|
||||
var accept = document.getElementById("acceptCookies");
|
||||
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
|
||||
|
||||
#ifdef RELEASE_BUILD
|
||||
// if we're enabling cookies, automatically select 'accept third party always'
|
||||
if (accept.checked)
|
||||
acceptThirdPartyMenu.selectedIndex = 0;
|
||||
|
||||
return accept.checked ? 0 : 2;
|
||||
#else
|
||||
// if we're enabling cookies, automatically select 'accept third party from visited'
|
||||
if (accept.checked)
|
||||
acceptThirdPartyMenu.selectedIndex = 1;
|
||||
|
||||
return accept.checked ? 3 : 2;
|
||||
#endif
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
|
||||
*/
|
||||
|
@ -19,12 +19,19 @@ MOCHITEST_BROWSER_FILES := \
|
||||
browser_chunk_permissions.js \
|
||||
browser_privacypane_1.js \
|
||||
browser_privacypane_3.js \
|
||||
browser_privacypane_4.js \
|
||||
browser_privacypane_5.js \
|
||||
browser_privacypane_8.js \
|
||||
privacypane_tests_perwindow.js \
|
||||
$(NULL)
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
pp_mochitest_browser_files := \
|
||||
browser_privacypane_4.js \
|
||||
$(NULL)
|
||||
pp_mochitest_browser_files_PATH := $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
||||
PP_TARGETS += pp_mochitest_browser_files
|
||||
endif # ENABLE_TESTS
|
||||
|
||||
ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
MOCHITEST_BROWSER_FILES += browser_healthreport.js
|
||||
endif
|
||||
|
@ -16,8 +16,13 @@ function test() {
|
||||
run_test_subset([
|
||||
test_custom_retention("acceptCookies", "remember"),
|
||||
test_custom_retention("acceptCookies", "custom"),
|
||||
#ifdef RELEASE_BUILD
|
||||
test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
|
||||
test_custom_retention("acceptThirdPartyMenu", "custom", "always"),
|
||||
#else
|
||||
test_custom_retention("acceptThirdPartyMenu", "remember", "always"),
|
||||
test_custom_retention("acceptThirdPartyMenu", "custom", "visited"),
|
||||
#endif
|
||||
test_custom_retention("keepCookiesUntil", "remember", 1),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 2),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 0),
|
||||
|
@ -1,4 +1,4 @@
|
||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 0.8.377
|
||||
Current extension version is: 0.8.423
|
||||
|
||||
|
@ -720,6 +720,15 @@ PdfStreamConverter.prototype = {
|
||||
// Change the content type so we don't get stuck in a loop.
|
||||
aRequest.setProperty('contentType', aRequest.contentType);
|
||||
aRequest.contentType = 'text/html';
|
||||
if (isHttpRequest) {
|
||||
// We trust PDF viewer, using no CSP
|
||||
aRequest.setResponseHeader('Content-Security-Policy', '', false);
|
||||
aRequest.setResponseHeader('Content-Security-Policy-Report-Only', '',
|
||||
false);
|
||||
aRequest.setResponseHeader('X-Content-Security-Policy', '', false);
|
||||
aRequest.setResponseHeader('X-Content-Security-Policy-Report-Only', '',
|
||||
false);
|
||||
}
|
||||
|
||||
if (!rangeRequest) {
|
||||
// Creating storage for PDF data
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -220,26 +220,26 @@ var StepperManager = (function StepperManagerClosure() {
|
||||
|
||||
// The stepper for each page's IRQueue.
|
||||
var Stepper = (function StepperClosure() {
|
||||
// Shorter way to create element and optionally set textContent.
|
||||
function c(tag, textContent) {
|
||||
var d = document.createElement(tag);
|
||||
if (textContent)
|
||||
d.textContent = textContent;
|
||||
return d;
|
||||
}
|
||||
|
||||
function Stepper(panel, pageIndex, initialBreakPoints) {
|
||||
this.panel = panel;
|
||||
this.len = 0;
|
||||
this.breakPoint = 0;
|
||||
this.nextBreakPoint = null;
|
||||
this.pageIndex = pageIndex;
|
||||
this.breakPoints = initialBreakPoints;
|
||||
this.currentIdx = -1;
|
||||
this.operatorListIdx = 0;
|
||||
}
|
||||
Stepper.prototype = {
|
||||
init: function init(IRQueue) {
|
||||
// Shorter way to create element and optionally set textContent.
|
||||
function c(tag, textContent) {
|
||||
var d = document.createElement(tag);
|
||||
if (textContent)
|
||||
d.textContent = textContent;
|
||||
return d;
|
||||
}
|
||||
init: function init() {
|
||||
var panel = this.panel;
|
||||
this.len = IRQueue.fnArray.length;
|
||||
var content = c('div', 'c=continue, s=step');
|
||||
var table = c('table');
|
||||
content.appendChild(table);
|
||||
@ -250,15 +250,18 @@ var Stepper = (function StepperClosure() {
|
||||
headerRow.appendChild(c('th', 'Idx'));
|
||||
headerRow.appendChild(c('th', 'fn'));
|
||||
headerRow.appendChild(c('th', 'args'));
|
||||
|
||||
panel.appendChild(content);
|
||||
this.table = table;
|
||||
},
|
||||
updateOperatorList: function updateOperatorList(operatorList) {
|
||||
var self = this;
|
||||
for (var i = 0; i < IRQueue.fnArray.length; i++) {
|
||||
for (var i = this.operatorListIdx; i < operatorList.fnArray.length; i++) {
|
||||
var line = c('tr');
|
||||
line.className = 'line';
|
||||
line.dataset.idx = i;
|
||||
table.appendChild(line);
|
||||
this.table.appendChild(line);
|
||||
var checked = this.breakPoints.indexOf(i) != -1;
|
||||
var args = IRQueue.argsArray[i] ? IRQueue.argsArray[i] : [];
|
||||
var args = operatorList.argsArray[i] ? operatorList.argsArray[i] : [];
|
||||
|
||||
var breakCell = c('td');
|
||||
var cbox = c('input');
|
||||
@ -278,11 +281,9 @@ var Stepper = (function StepperClosure() {
|
||||
breakCell.appendChild(cbox);
|
||||
line.appendChild(breakCell);
|
||||
line.appendChild(c('td', i.toString()));
|
||||
line.appendChild(c('td', IRQueue.fnArray[i]));
|
||||
line.appendChild(c('td', operatorList.fnArray[i]));
|
||||
line.appendChild(c('td', args.join(', ')));
|
||||
}
|
||||
panel.appendChild(content);
|
||||
var self = this;
|
||||
},
|
||||
getNextBreakPoint: function getNextBreakPoint() {
|
||||
this.breakPoints.sort(function(a, b) { return a - b; });
|
||||
|
@ -105,8 +105,6 @@ limitations under the License.
|
||||
<span id="numPages" class="toolbarLabel"></span>
|
||||
</div>
|
||||
<div id="toolbarViewerRight">
|
||||
<input id="fileInput" class="fileInput" type="file" oncontextmenu="return false;" style="visibility: hidden; position: fixed; right: 0; top: 0" />
|
||||
|
||||
<button id="presentationMode" class="toolbarButton presentationMode hiddenSmallView" title="Switch to Presentation Mode" tabindex="12" data-l10n-id="presentation_mode">
|
||||
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||
</button>
|
||||
@ -137,7 +135,7 @@ limitations under the License.
|
||||
</button>
|
||||
</div>
|
||||
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
||||
<select id="scaleSelect" title="Zoom" oncontextmenu="return false;" tabindex="11" data-l10n-id="zoom">
|
||||
<select id="scaleSelect" title="Zoom" tabindex="11" data-l10n-id="zoom">
|
||||
<option id="pageAutoOption" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
|
||||
<option id="pageActualOption" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
|
||||
<option id="pageFitOption" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
|
||||
|
@ -17,7 +17,7 @@
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, PDFFindBar, CustomStyle,
|
||||
PDFFindController, ProgressBar, TextLayerBuilder, DownloadManager,
|
||||
getFileName, getOutputScale, scrollIntoView, getPDFFileNameFromURL,
|
||||
PDFHistory */
|
||||
PDFHistory, noContextMenuHandler */
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -154,6 +154,13 @@ function scrollIntoView(element, spot) {
|
||||
parent.scrollTop = offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to suppress context menu.
|
||||
*/
|
||||
function noContextMenuHandler(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filename or guessed filename from the url (see issue 3455).
|
||||
* url {String} The original PDF location.
|
||||
@ -920,9 +927,9 @@ var PDFHistory = {
|
||||
initialDestination: null,
|
||||
|
||||
initialize: function pdfHistoryInitialize(fingerprint) {
|
||||
if (PDFJS.disableHistory || window.parent !== window) {
|
||||
if (PDFJS.disableHistory || PDFView.isViewerEmbedded) {
|
||||
// The browsing history is only enabled when the viewer is standalone,
|
||||
// i.e. not when it is embedded in a page.
|
||||
// i.e. not when it is embedded in a web page.
|
||||
return;
|
||||
}
|
||||
this.initialized = true;
|
||||
@ -1258,6 +1265,7 @@ var PDFView = {
|
||||
mouseScrollDelta: 0,
|
||||
lastScroll: 0,
|
||||
previousPageNumber: 1,
|
||||
isViewerEmbedded: (window.parent !== window),
|
||||
|
||||
// called once when the document is loaded
|
||||
initialize: function pdfViewInitialize() {
|
||||
@ -1950,10 +1958,10 @@ var PDFView = {
|
||||
self.setInitialView(storedHash, scale);
|
||||
|
||||
// Make all navigation keys work on document load,
|
||||
// unless the viewer is embedded in another page.
|
||||
if (window.parent === window) {
|
||||
PDFView.container.focus();
|
||||
PDFView.container.blur();
|
||||
// unless the viewer is embedded in a web page.
|
||||
if (!self.isViewerEmbedded) {
|
||||
self.container.focus();
|
||||
self.container.blur();
|
||||
}
|
||||
});
|
||||
|
||||
@ -2030,6 +2038,11 @@ var PDFView = {
|
||||
// updated if the zoom level stayed the same.
|
||||
this.currentScale = 0;
|
||||
this.currentScaleValue = null;
|
||||
// When opening a new file (when one is already loaded in the viewer):
|
||||
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
|
||||
// if 'currentPageNumber' is larger than the number of pages in the file.
|
||||
document.getElementById('pageNumber').value = currentPageNumber = 1;
|
||||
|
||||
if (PDFHistory.initialDestination) {
|
||||
this.navigateTo(PDFHistory.initialDestination);
|
||||
PDFHistory.initialDestination = null;
|
||||
@ -2553,8 +2566,11 @@ var PageView = function pageView(container, id, scale,
|
||||
};
|
||||
|
||||
this.update = function pageViewUpdate(scale, rotation) {
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
if (this.renderTask) {
|
||||
this.renderTask.cancel();
|
||||
}
|
||||
this.resume = null;
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
|
||||
if (typeof rotation !== 'undefined') {
|
||||
this.rotation = rotation;
|
||||
@ -2816,9 +2832,15 @@ var PageView = function pageView(container, id, scale,
|
||||
// Rendering area
|
||||
|
||||
var self = this;
|
||||
var renderingWasReset = false;
|
||||
function pageViewDrawCallback(error) {
|
||||
if (renderingWasReset) {
|
||||
// The renderTask may have been replaced by a new one, so only remove the
|
||||
// reference to the renderTask if it matches the one that is triggering
|
||||
// this callback.
|
||||
if (renderTask === self.renderTask) {
|
||||
self.renderTask = null;
|
||||
}
|
||||
|
||||
if (error === 'cancelled') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2870,12 +2892,6 @@ var PageView = function pageView(container, id, scale,
|
||||
viewport: this.viewport,
|
||||
textLayer: textLayer,
|
||||
continueCallback: function pdfViewcContinueCallback(cont) {
|
||||
if (self.renderingState === RenderingStates.INITIAL) {
|
||||
// The page update() was called, we just need to abort any rendering.
|
||||
renderingWasReset = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PDFView.highestPriorityPage !== 'page' + self.id) {
|
||||
self.renderingState = RenderingStates.PAUSED;
|
||||
self.resume = function resumeCallback() {
|
||||
@ -2887,7 +2903,9 @@ var PageView = function pageView(container, id, scale,
|
||||
cont();
|
||||
}
|
||||
};
|
||||
this.pdfPage.render(renderContext).then(
|
||||
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
|
||||
|
||||
this.renderTask.then(
|
||||
function pdfPageRenderCallback() {
|
||||
pageViewDrawCallback(null);
|
||||
},
|
||||
@ -3553,9 +3571,8 @@ var DocumentOutlineView = function documentOutlineView(outline) {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
PDFView.initialize();
|
||||
var params = PDFView.parseQueryString(document.location.search.substring(1));
|
||||
|
||||
var file = window.location.toString()
|
||||
var file = window.location.href.split('#')[0];
|
||||
|
||||
document.getElementById('openFile').setAttribute('hidden', 'true');
|
||||
|
||||
@ -3629,6 +3646,9 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
}
|
||||
});
|
||||
|
||||
// Suppress context menus for some controls
|
||||
document.getElementById('scaleSelect').oncontextmenu = noContextMenuHandler;
|
||||
|
||||
var mainContainer = document.getElementById('mainContainer');
|
||||
var outerContainer = document.getElementById('outerContainer');
|
||||
mainContainer.addEventListener('transitionend', function(e) {
|
||||
@ -3684,10 +3704,6 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
PDFView.presentationMode();
|
||||
});
|
||||
|
||||
document.getElementById('openFile').addEventListener('click',
|
||||
function() {
|
||||
document.getElementById('fileInput').click();
|
||||
});
|
||||
|
||||
document.getElementById('print').addEventListener('click',
|
||||
function() {
|
||||
@ -3815,9 +3831,10 @@ function updateViewarea() {
|
||||
window.addEventListener('resize', function webViewerResize(evt) {
|
||||
if (PDFView.initialized &&
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected))
|
||||
PDFView.parseScale(document.getElementById('scaleSelect').value);
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
PDFView.parseScale(document.getElementById('scaleSelect').value);
|
||||
}
|
||||
updateViewarea();
|
||||
});
|
||||
|
||||
@ -3892,11 +3909,11 @@ window.addEventListener('scalechange', function scalechange(evt) {
|
||||
customScaleOption.selected = false;
|
||||
|
||||
if (!evt.resetAutoSettings &&
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
updateViewarea();
|
||||
return;
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
updateViewarea();
|
||||
return;
|
||||
}
|
||||
|
||||
var predefinedValueFound = selectScaleOption('' + evt.scale);
|
||||
|
@ -1,209 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "AboutHomeUtils", "AboutHome" ];
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
// Url to fetch snippets, in the urlFormatter service format.
|
||||
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
|
||||
|
||||
// Should be bumped up if the snippets content format changes.
|
||||
const STARTPAGE_VERSION = 4;
|
||||
|
||||
this.AboutHomeUtils = {
|
||||
get snippetsVersion() STARTPAGE_VERSION,
|
||||
|
||||
/**
|
||||
* Returns an object containing the name and searchURL of the original default
|
||||
* search engine.
|
||||
*/
|
||||
get defaultSearchEngine() {
|
||||
let defaultEngine = Services.search.defaultEngine;
|
||||
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
|
||||
|
||||
return Object.freeze({
|
||||
name: defaultEngine.name,
|
||||
searchURL: submission.uri.spec,
|
||||
postDataString: submission.postDataString
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* showKnowYourRights - Determines if the user should be shown the
|
||||
* about:rights notification. The notification should *not* be shown if
|
||||
* we've already shown the current version, or if the override pref says to
|
||||
* never show it. The notification *should* be shown if it's never been seen
|
||||
* before, if a newer version is available, or if the override pref says to
|
||||
* always show it.
|
||||
*/
|
||||
get showKnowYourRights() {
|
||||
// Look for an unconditional override pref. If set, do what it says.
|
||||
// (true --> never show, false --> always show)
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.rights.override");
|
||||
} catch (e) { }
|
||||
// Ditto, for the legacy EULA pref.
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.EULA.override");
|
||||
} catch (e) { }
|
||||
|
||||
#ifndef MOZILLA_OFFICIAL
|
||||
// Non-official builds shouldn't show the notification.
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Look to see if the user has seen the current version or not.
|
||||
var currentVersion = Services.prefs.getIntPref("browser.rights.version");
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.rights." + currentVersion + ".shown");
|
||||
} catch (e) { }
|
||||
|
||||
// Legacy: If the user accepted a EULA, we won't annoy them with the
|
||||
// equivalent about:rights page until the version changes.
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.EULA." + currentVersion + ".accepted");
|
||||
} catch (e) { }
|
||||
|
||||
// We haven't shown the notification before, so do so now.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the URL to fetch snippets from, in the urlFormatter service format.
|
||||
*/
|
||||
XPCOMUtils.defineLazyGetter(AboutHomeUtils, "snippetsURL", function() {
|
||||
let updateURL = Services.prefs
|
||||
.getCharPref(SNIPPETS_URL_PREF)
|
||||
.replace("%STARTPAGE_VERSION%", STARTPAGE_VERSION);
|
||||
return Services.urlFormatter.formatURL(updateURL);
|
||||
});
|
||||
|
||||
/**
|
||||
* This code provides services to the about:home page. Whenever
|
||||
* about:home needs to do something chrome-privileged, it sends a
|
||||
* message that's handled here.
|
||||
*/
|
||||
let AboutHome = {
|
||||
MESSAGES: [
|
||||
"AboutHome:RestorePreviousSession",
|
||||
"AboutHome:Downloads",
|
||||
"AboutHome:Bookmarks",
|
||||
"AboutHome:History",
|
||||
"AboutHome:Apps",
|
||||
"AboutHome:Addons",
|
||||
"AboutHome:Sync",
|
||||
"AboutHome:Settings",
|
||||
"AboutHome:RequestUpdate",
|
||||
"AboutHome:Search",
|
||||
],
|
||||
|
||||
init: function() {
|
||||
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
|
||||
|
||||
for (let msg of this.MESSAGES) {
|
||||
mm.addMessageListener(msg, this);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this, "browser-search-engine-modified", false);
|
||||
},
|
||||
|
||||
observe: function(aEngine, aTopic, aVerb) {
|
||||
switch (aTopic) {
|
||||
case "browser-search-engine-modified":
|
||||
this.sendAboutHomeData(null);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let window = aMessage.target.ownerDocument.defaultView;
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "AboutHome:RestorePreviousSession":
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Ci.nsISessionStore);
|
||||
if (ss.canRestoreLastSession) {
|
||||
ss.restoreLastSession();
|
||||
}
|
||||
break;
|
||||
|
||||
case "AboutHome:Downloads":
|
||||
window.BrowserDownloadsUI();
|
||||
break;
|
||||
|
||||
case "AboutHome:Bookmarks":
|
||||
window.PlacesCommandHook.showPlacesOrganizer("AllBookmarks");
|
||||
break;
|
||||
|
||||
case "AboutHome:History":
|
||||
window.PlacesCommandHook.showPlacesOrganizer("History");
|
||||
break;
|
||||
|
||||
case "AboutHome:Apps":
|
||||
window.openUILinkIn("https://marketplace.mozilla.org/", "tab");
|
||||
break;
|
||||
|
||||
case "AboutHome:Addons":
|
||||
window.BrowserOpenAddonsMgr();
|
||||
break;
|
||||
|
||||
case "AboutHome:Sync":
|
||||
window.openPreferences("paneSync");
|
||||
break;
|
||||
|
||||
case "AboutHome:Settings":
|
||||
window.openPreferences();
|
||||
break;
|
||||
|
||||
case "AboutHome:RequestUpdate":
|
||||
this.sendAboutHomeData(aMessage.target);
|
||||
break;
|
||||
|
||||
case "AboutHome:Search":
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
window.BrowserSearch.recordSearchInHealthReport(aMessage.data.engineName, "abouthome");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// Send all the chrome-privileged data needed by about:home. This
|
||||
// gets re-sent when the search engine changes.
|
||||
sendAboutHomeData: function(target) {
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Ci.nsISessionStore);
|
||||
let data = {
|
||||
showRestoreLastSession: ss.canRestoreLastSession,
|
||||
snippetsURL: AboutHomeUtils.snippetsURL,
|
||||
showKnowYourRights: AboutHomeUtils.showKnowYourRights,
|
||||
snippetsVersion: AboutHomeUtils.snippetsVersion,
|
||||
defaultSearchEngine: AboutHomeUtils.defaultSearchEngine
|
||||
};
|
||||
|
||||
if (AboutHomeUtils.showKnowYourRights) {
|
||||
// Set pref to indicate we've shown the notification.
|
||||
let currentVersion = Services.prefs.getIntPref("browser.rights.version");
|
||||
Services.prefs.setBoolPref("browser.rights." + currentVersion + ".shown", true);
|
||||
}
|
||||
|
||||
if (target) {
|
||||
target.messageManager.sendAsyncMessage("AboutHome:Update", data);
|
||||
} else {
|
||||
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
|
||||
mm.broadcastAsyncMessage("AboutHome:Update", data);
|
||||
}
|
||||
},
|
||||
};
|
85
browser/modules/AboutHomeUtils.jsm
Normal file
85
browser/modules/AboutHomeUtils.jsm
Normal file
@ -0,0 +1,85 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "AboutHomeUtils" ];
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// Url to fetch snippets, in the urlFormatter service format.
|
||||
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
|
||||
|
||||
// Should be bumped up if the snippets content format changes.
|
||||
const STARTPAGE_VERSION = 4;
|
||||
|
||||
this.AboutHomeUtils = {
|
||||
get snippetsVersion() STARTPAGE_VERSION,
|
||||
|
||||
/**
|
||||
* Returns an object containing the name and searchURL of the original default
|
||||
* search engine.
|
||||
*/
|
||||
get defaultSearchEngine() {
|
||||
let defaultEngine = Services.search.defaultEngine;
|
||||
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
|
||||
|
||||
return Object.freeze({
|
||||
name: defaultEngine.name,
|
||||
searchURL: submission.uri.spec,
|
||||
postDataString: submission.postDataString
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
* showKnowYourRights - Determines if the user should be shown the
|
||||
* about:rights notification. The notification should *not* be shown if
|
||||
* we've already shown the current version, or if the override pref says to
|
||||
* never show it. The notification *should* be shown if it's never been seen
|
||||
* before, if a newer version is available, or if the override pref says to
|
||||
* always show it.
|
||||
*/
|
||||
get showKnowYourRights() {
|
||||
// Look for an unconditional override pref. If set, do what it says.
|
||||
// (true --> never show, false --> always show)
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.rights.override");
|
||||
} catch (e) { }
|
||||
// Ditto, for the legacy EULA pref.
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.EULA.override");
|
||||
} catch (e) { }
|
||||
|
||||
#ifndef MOZILLA_OFFICIAL
|
||||
// Non-official builds shouldn't show the notification.
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Look to see if the user has seen the current version or not.
|
||||
var currentVersion = Services.prefs.getIntPref("browser.rights.version");
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.rights." + currentVersion + ".shown");
|
||||
} catch (e) { }
|
||||
|
||||
// Legacy: If the user accepted a EULA, we won't annoy them with the
|
||||
// equivalent about:rights page until the version changes.
|
||||
try {
|
||||
return !Services.prefs.getBoolPref("browser.EULA." + currentVersion + ".accepted");
|
||||
} catch (e) { }
|
||||
|
||||
// We haven't shown the notification before, so do so now.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the URL to fetch snippets from, in the urlFormatter service format.
|
||||
*/
|
||||
XPCOMUtils.defineLazyGetter(AboutHomeUtils, "snippetsURL", function() {
|
||||
let updateURL = Services.prefs
|
||||
.getCharPref(SNIPPETS_URL_PREF)
|
||||
.replace("%STARTPAGE_VERSION%", STARTPAGE_VERSION);
|
||||
return Services.urlFormatter.formatURL(updateURL);
|
||||
});
|
82
browser/modules/ContentClick.jsm
Normal file
82
browser/modules/ContentClick.jsm
Normal file
@ -0,0 +1,82 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "ContentClick" ];
|
||||
|
||||
Cu.import("resource:///modules/PlacesUIUtils.jsm");
|
||||
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let ContentClick = {
|
||||
init: function() {
|
||||
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
|
||||
mm.addMessageListener("Content:Click", this);
|
||||
},
|
||||
|
||||
receiveMessage: function (message) {
|
||||
switch (message.name) {
|
||||
case "Content:Click":
|
||||
this.contentAreaClick(message.json, message.target)
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
contentAreaClick: function (json, browser) {
|
||||
// This is heavily based on contentAreaClick from browser.js (Bug 903016)
|
||||
// The json is set up in a way to look like an Event.
|
||||
let window = browser.ownerDocument.defaultView;
|
||||
|
||||
if (!json.href) {
|
||||
// Might be middle mouse navigation.
|
||||
if (Services.prefs.getBoolPref("middlemouse.contentLoadURL") &&
|
||||
!Services.prefs.getBoolPref("general.autoScroll")) {
|
||||
window.middleMousePaste(json);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (json.bookmark) {
|
||||
// This is the Opera convention for a special link that, when clicked,
|
||||
// allows to add a sidebar panel. The link's title attribute contains
|
||||
// the title that should be used for the sidebar panel.
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||
, type: "bookmark"
|
||||
, uri: Services.io.newURI(json.href, null, null)
|
||||
, title: json.title
|
||||
, loadBookmarkInSidebar: true
|
||||
, hiddenRows: [ "description"
|
||||
, "location"
|
||||
, "keyword" ]
|
||||
}, window);
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: We don't need the sidebar code here.
|
||||
|
||||
// This part is based on handleLinkClick.
|
||||
var where = window.whereToOpenLink(json);
|
||||
if (where == "current")
|
||||
return false;
|
||||
|
||||
// Todo(903022): code for where == save
|
||||
|
||||
window.openLinkIn(json.href, where, { referrerURI: browser.documentURI,
|
||||
charset: browser.characterSet });
|
||||
|
||||
// Mark the page as a user followed link. This is done so that history can
|
||||
// distinguish automatic embed visits from user activated ones. For example
|
||||
// pages loaded in frames are embed visits and lost with the session, while
|
||||
// visits across frames should be preserved.
|
||||
try {
|
||||
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
PlacesUIUtils.markPageAsFollowedLink(href);
|
||||
} catch (ex) { /* Skip invalid URIs. */ }
|
||||
}
|
||||
};
|
@ -8,6 +8,7 @@ TEST_DIRS += ['test']
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'BrowserNewTabPreloader.jsm',
|
||||
'ContentClick.jsm',
|
||||
'NetworkPrioritizer.jsm',
|
||||
'SharedFrame.jsm',
|
||||
'SignInToWebsite.jsm',
|
||||
@ -26,7 +27,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
'AboutHome.jsm',
|
||||
'AboutHomeUtils.jsm',
|
||||
'RecentWindow.jsm',
|
||||
]
|
||||
|
||||
|
@ -117,7 +117,7 @@ def build_one_stage_aux(stage_dir, llvm_source_dir):
|
||||
"--enable-targets=" + ",".join(targets),
|
||||
"--disable-assertions",
|
||||
"--prefix=%s" % inst_dir,
|
||||
"--with-gcc-toolchain=/tools/gcc-4.7.2-0moz1"]
|
||||
"--with-gcc-toolchain=/tools/gcc-4.7.3-0moz1"]
|
||||
build_package(llvm_source_dir, build_dir, configure_opts, [])
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -1,7 +1,7 @@
|
||||
. "$topsrcdir/build/mozconfig.common"
|
||||
|
||||
CC="/tools/gcc-4.7.2-0moz1/bin/gcc"
|
||||
CXX="/tools/gcc-4.7.2-0moz1/bin/g++"
|
||||
CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
|
||||
CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
|
||||
|
||||
ac_add_options --enable-elf-hack
|
||||
|
||||
|
@ -13,7 +13,7 @@ class nsCString;
|
||||
|
||||
struct nsJSPrincipals : nsIPrincipal, JSPrincipals
|
||||
{
|
||||
static JSBool Subsume(JSPrincipals *jsprin, JSPrincipals *other);
|
||||
static bool Subsume(JSPrincipals *jsprin, JSPrincipals *other);
|
||||
static void Destroy(JSPrincipals *jsprin);
|
||||
|
||||
/*
|
||||
|
@ -371,13 +371,13 @@ private:
|
||||
|
||||
bool SubjectIsPrivileged();
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JSAccessMode mode,
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
// Decides, based on CSP, whether or not eval() and stuff can be executed.
|
||||
static JSBool
|
||||
static bool
|
||||
ContentSecurityPolicyPermitsJSAction(JSContext *cx);
|
||||
|
||||
// Returns null if a principal cannot be found; generally callers
|
||||
|
@ -20,7 +20,7 @@
|
||||
// for mozilla::dom::workers::kJSPrincipalsDebugToken
|
||||
#include "mozilla/dom/workers/Workers.h"
|
||||
|
||||
/* static */ JSBool
|
||||
/* static */ bool
|
||||
nsJSPrincipals::Subsume(JSPrincipals *jsprin, JSPrincipals *other)
|
||||
{
|
||||
bool result;
|
||||
|
@ -423,7 +423,7 @@ NS_IMPL_ISUPPORTS4(nsScriptSecurityManager,
|
||||
|
||||
///////////////// Security Checks /////////////////
|
||||
|
||||
JSBool
|
||||
bool
|
||||
nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
|
||||
{
|
||||
// Get the security manager
|
||||
@ -483,7 +483,7 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
|
||||
}
|
||||
|
||||
|
||||
JSBool
|
||||
bool
|
||||
nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JSAccessMode mode,
|
||||
JS::MutableHandle<JS::Value> vp)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
# We check the following things in all files.
|
||||
#
|
||||
# - #includes should have full paths, e.g. "ion/Ion.h", not "Ion.h".
|
||||
# - #includes should have full paths, e.g. "jit/Ion.h", not "Ion.h".
|
||||
#
|
||||
# - #includes should use the appropriate form for system headers (<...>) and
|
||||
# local headers ("...").
|
||||
|
@ -116,10 +116,21 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||
rv = docEncoder->EncodeToString(buf);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The mime type is ultimately text/html if the encoder successfully encoded
|
||||
// the selection as text/html.
|
||||
rv = docEncoder->GetMimeType(mimeType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!selForcedTextPlain && mimeType.EqualsLiteral(kTextMime)) {
|
||||
// SetSelection and EncodeToString use this case to signal that text/plain
|
||||
// was forced because the document is either not an nsIHTMLDocument or it's
|
||||
// XHTML. We want to pretty print XHTML but not non-nsIHTMLDocuments.
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDoc);
|
||||
if (!htmlDoc) {
|
||||
selForcedTextPlain = true;
|
||||
}
|
||||
}
|
||||
|
||||
// The mime type is ultimately text/html if the encoder successfully encoded
|
||||
// the selection as text/html.
|
||||
bool encodedTextHTML = mimeType.EqualsLiteral(kHTMLMime);
|
||||
|
||||
// First, prepare the text/plain clipboard flavor.
|
||||
|
@ -399,7 +399,7 @@ nsFrameMessageManager::GetDelayedFrameScripts(nsIDOMDOMStringList** aList)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData)
|
||||
{
|
||||
nsAString* result = static_cast<nsAString*>(aData);
|
||||
|
@ -327,6 +327,8 @@ MOCHITEST_FILES_B = \
|
||||
test_bug564863.xhtml \
|
||||
test_bug588990.html \
|
||||
test_copypaste.html \
|
||||
test_copypaste.xhtml \
|
||||
copypaste.js \
|
||||
test_bug503481.html \
|
||||
file_bug503481.sjs \
|
||||
test_bug503481b.html \
|
||||
@ -664,6 +666,7 @@ endif
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
test_bug357450.js \
|
||||
test_copypaste.xul \
|
||||
$(NULL)
|
||||
|
||||
# This test fails on the Mac for some reason
|
||||
|
269
content/base/test/copypaste.js
Normal file
269
content/base/test/copypaste.js
Normal file
@ -0,0 +1,269 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function modifySelection(s) {
|
||||
var g = window.getSelection();
|
||||
var l = g.getRangeAt(0);
|
||||
var d = document.createElement("p");
|
||||
d.innerHTML = s;
|
||||
d.appendChild(l.cloneContents());
|
||||
|
||||
var e = document.createElement("div");
|
||||
document.body.appendChild(e);
|
||||
e.appendChild(d);
|
||||
var a = document.createRange();
|
||||
a.selectNode(d);
|
||||
g.removeAllRanges();
|
||||
g.addRange(a);
|
||||
window.setTimeout(function () {
|
||||
e.parentNode.removeChild(e);
|
||||
g.removeAllRanges();
|
||||
g.addRange(l);
|
||||
}, 0)
|
||||
}
|
||||
|
||||
function getLoadContext() {
|
||||
var Ci = SpecialPowers.wrap(Components).interfaces;
|
||||
return SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
}
|
||||
|
||||
function testCopyPaste (isXHTML) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var suppressUnicodeCheckIfHidden = !!isXHTML;
|
||||
var suppressHTMLCheck = !!isXHTML;
|
||||
|
||||
var webnav = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
|
||||
var docShell = webnav.QueryInterface(Components.interfaces.nsIDocShell);
|
||||
|
||||
var documentViewer = docShell.contentViewer
|
||||
.QueryInterface(Components.interfaces.nsIContentViewerEdit);
|
||||
|
||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
var textarea = SpecialPowers.wrap(document.getElementById('input'));
|
||||
|
||||
function copySelectionToClipboard(suppressUnicodeCheck) {
|
||||
documentViewer.copySelection();
|
||||
if (!suppressUnicodeCheck)
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), "check text/unicode");
|
||||
if (!suppressHTMLCheck)
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), "check text/html");
|
||||
}
|
||||
function copyToClipboard(node, suppressUnicodeCheck) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
var r = document.createRange();
|
||||
r.selectNode(node);
|
||||
window.getSelection().addRange(r);
|
||||
copySelectionToClipboard(suppressUnicodeCheck);
|
||||
}
|
||||
function copyRangeToClipboard(startNode,startIndex,endNode,endIndex,suppressUnicodeCheck) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
var r = document.createRange();
|
||||
r.setStart(startNode,startIndex)
|
||||
r.setEnd(endNode,endIndex)
|
||||
window.getSelection().addRange(r);
|
||||
copySelectionToClipboard(suppressUnicodeCheck);
|
||||
}
|
||||
function copyChildrenToClipboard(id) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
window.getSelection().selectAllChildren(document.getElementById(id));
|
||||
copySelectionToClipboard();
|
||||
}
|
||||
function getClipboardData(mime) {
|
||||
var transferable = Components.classes['@mozilla.org/widget/transferable;1']
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
transferable.init(getLoadContext());
|
||||
transferable.addDataFlavor(mime);
|
||||
clipboard.getData(transferable, 1);
|
||||
var data = {};
|
||||
transferable.getTransferData(mime, data, {}) ;
|
||||
return data;
|
||||
}
|
||||
function testClipboardValue(mime, expected) {
|
||||
if (suppressHTMLCheck && mime == "text/html")
|
||||
return null;
|
||||
var data = getClipboardData(mime);
|
||||
is (data.value == null ? data.value :
|
||||
data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
|
||||
expected,
|
||||
mime + " value in the clipboard");
|
||||
return data.value;
|
||||
}
|
||||
function testPasteText(expected) {
|
||||
textarea.value="";
|
||||
textarea.focus();
|
||||
textarea.editor.paste(1);
|
||||
is(textarea.value, expected, "value of the textarea after the paste");
|
||||
}
|
||||
function testSelectionToString(expected) {
|
||||
is(window.getSelection().toString().replace(/\r\n/g,"\n"), expected, "Selection.toString");
|
||||
}
|
||||
function testInnerHTML(id, expected) {
|
||||
var value = document.getElementById(id).innerHTML;
|
||||
is(value, expected, id + ".innerHTML");
|
||||
}
|
||||
function testEmptyChildren(id) {
|
||||
copyChildrenToClipboard(id);
|
||||
testSelectionToString("");
|
||||
testClipboardValue("text/unicode", null);
|
||||
testClipboardValue("text/html", null);
|
||||
testPasteText("");
|
||||
}
|
||||
|
||||
copyChildrenToClipboard("draggable");
|
||||
testSelectionToString("This is a draggable bit of text.");
|
||||
testClipboardValue("text/unicode",
|
||||
"This is a draggable bit of text.");
|
||||
testClipboardValue("text/html",
|
||||
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em> bit of text.</div>");
|
||||
testPasteText("This is a draggable bit of text.");
|
||||
|
||||
copyChildrenToClipboard("alist");
|
||||
testSelectionToString(" bla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " bla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"alist\">\n bla\n <ul>\n <li>foo</li>\n \n <li>bar</li>\n </ul>\n </div>");
|
||||
testPasteText(" bla\n\n foo\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("blist");
|
||||
testSelectionToString(" mozilla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " mozilla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"blist\">\n mozilla\n <ol>\n <li>foo</li>\n \n <li>bar</li>\n </ol>\n </div>");
|
||||
testPasteText(" mozilla\n\n foo\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("clist");
|
||||
testSelectionToString(" mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"clist\">\n mzla\n <ul>\n <li>foo<ul>\n <li>bazzinga!</li>\n </ul></li>\n \n <li>bar</li>\n </ul>\n </div>");
|
||||
testPasteText(" mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("div4");
|
||||
testSelectionToString(" Tt t t ");
|
||||
testClipboardValue("text/unicode", " Tt t t ");
|
||||
if (isXHTML) {
|
||||
testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\">t t t</textarea>\n</div>");
|
||||
testInnerHTML("div4", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\">t t t</textarea>\n");
|
||||
}
|
||||
else {
|
||||
testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea>t t t</textarea>\n</div>");
|
||||
testInnerHTML("div4", "\n T<textarea>t t t</textarea>\n");
|
||||
}
|
||||
testPasteText(" Tt t t ");
|
||||
|
||||
copyChildrenToClipboard("div5");
|
||||
testSelectionToString(" T ");
|
||||
testClipboardValue("text/unicode", " T ");
|
||||
if (isXHTML) {
|
||||
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n</div>");
|
||||
testInnerHTML("div5", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n");
|
||||
}
|
||||
else {
|
||||
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>");
|
||||
testInnerHTML("div5", "\n T<textarea> </textarea>\n");
|
||||
}
|
||||
testPasteText(" T ");
|
||||
|
||||
copyRangeToClipboard($("div6").childNodes[0],0, $("div6").childNodes[1],1,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div6", "div6");
|
||||
|
||||
copyRangeToClipboard($("div7").childNodes[0],0, $("div7").childNodes[0],4,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div7", "div7");
|
||||
|
||||
copyRangeToClipboard($("div8").childNodes[0],0, $("div8").childNodes[0],4,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div8", "div8");
|
||||
|
||||
copyRangeToClipboard($("div9").childNodes[0],0, $("div9").childNodes[0],4,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("div9");
|
||||
testClipboardValue("text/unicode", "div9");
|
||||
testClipboardValue("text/html", "div9");
|
||||
testInnerHTML("div9", "div9");
|
||||
|
||||
copyToClipboard($("div10"), suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
testInnerHTML("div10", "div10");
|
||||
|
||||
copyToClipboard($("div10").firstChild, suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
|
||||
copyRangeToClipboard($("div10").childNodes[0],0, $("div10").childNodes[0],1,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
|
||||
copyRangeToClipboard($("div10").childNodes[1],0, $("div10").childNodes[1],1,suppressUnicodeCheckIfHidden);
|
||||
testSelectionToString("");
|
||||
|
||||
// ============ copy/paste test from/to a textarea
|
||||
|
||||
var val = "1\n 2\n 3";
|
||||
textarea.value=val;
|
||||
textarea.select();
|
||||
textarea.editor.copy();
|
||||
|
||||
textarea.value="";
|
||||
textarea.editor.paste(1);
|
||||
is(textarea.value, val);
|
||||
textarea.value="";
|
||||
|
||||
// ============ NOSCRIPT should not be copied
|
||||
|
||||
copyChildrenToClipboard("div13");
|
||||
testSelectionToString("__");
|
||||
testClipboardValue("text/unicode", "__");
|
||||
testClipboardValue("text/html", "<div id=\"div13\">__</div>");
|
||||
testPasteText("__");
|
||||
|
||||
// ============ converting cell boundaries to tabs in tables
|
||||
|
||||
copyToClipboard($("tr1"));
|
||||
testClipboardValue("text/unicode", "foo\tbar");
|
||||
|
||||
// ============ manipulating Selection in oncopy
|
||||
|
||||
copyRangeToClipboard($("div11").childNodes[0],0, $("div11").childNodes[1],2);
|
||||
testClipboardValue("text/unicode", "Xdiv11");
|
||||
testClipboardValue("text/html", "<div><p>X<span>div</span>11</p></div>");
|
||||
setTimeout(function(){testSelectionToString("div11")},0);
|
||||
|
||||
setTimeout(function(){
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
copyRangeToClipboard($("div12").childNodes[0],0, $("div12").childNodes[1],2);
|
||||
testClipboardValue("text/unicode", "Xdiv12");
|
||||
testClipboardValue("text/html", "<div><p>X<span>div</span>12</p></div>");
|
||||
setTimeout(function(){
|
||||
testSelectionToString("div12");
|
||||
setTimeout(SimpleTest.finish,0);
|
||||
},0);
|
||||
},0);
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
<head>
|
||||
<title>Test for copy/paste</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="copypaste.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
@ -14,258 +15,9 @@
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function modifySelection(s) {
|
||||
var g = window.getSelection();
|
||||
var l = g.getRangeAt(0);
|
||||
var d = document.createElement("p");
|
||||
d.innerHTML = s;
|
||||
d.appendChild(l.cloneContents());
|
||||
|
||||
var e = document.createElement("div");
|
||||
document.body.appendChild(e);
|
||||
e.appendChild(d);
|
||||
var a = document.createRange();
|
||||
a.selectNode(d);
|
||||
g.removeAllRanges();
|
||||
g.addRange(a);
|
||||
window.setTimeout(function () {
|
||||
e.parentNode.removeChild(e);
|
||||
g.removeAllRanges();
|
||||
g.addRange(l);
|
||||
}, 0)
|
||||
}
|
||||
|
||||
function getLoadContext() {
|
||||
var Ci = SpecialPowers.wrap(Components).interfaces;
|
||||
return SpecialPowers.wrap(window).QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
}
|
||||
|
||||
function testCopyPaste () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var webnav = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
|
||||
var docShell = webnav.QueryInterface(Components.interfaces.nsIDocShell);
|
||||
|
||||
var documentViewer = docShell.contentViewer
|
||||
.QueryInterface(Components.interfaces.nsIContentViewerEdit);
|
||||
|
||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
var textarea = SpecialPowers.wrap(document.getElementById('input'));
|
||||
|
||||
function copySelectionToClipboard() {
|
||||
documentViewer.copySelection();
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/unicode"], 1,1), "check text/unicode");
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/html"], 1,1), "check text/html");
|
||||
}
|
||||
function copyToClipboard(node) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
var r = document.createRange();
|
||||
r.selectNode(node);
|
||||
window.getSelection().addRange(r);
|
||||
copySelectionToClipboard();
|
||||
}
|
||||
function copyRangeToClipboard(startNode,startIndex,endNode,endIndex) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
var r = document.createRange();
|
||||
r.setStart(startNode,startIndex)
|
||||
r.setEnd(endNode,endIndex)
|
||||
window.getSelection().addRange(r);
|
||||
copySelectionToClipboard();
|
||||
}
|
||||
function copyChildrenToClipboard(id) {
|
||||
textarea.blur();
|
||||
clipboard.emptyClipboard(1);
|
||||
window.getSelection().selectAllChildren(document.getElementById(id));
|
||||
copySelectionToClipboard();
|
||||
}
|
||||
function getClipboardData(mime) {
|
||||
var transferable = Components.classes['@mozilla.org/widget/transferable;1']
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
transferable.init(getLoadContext());
|
||||
transferable.addDataFlavor(mime);
|
||||
clipboard.getData(transferable, 1);
|
||||
var data = {};
|
||||
transferable.getTransferData(mime, data, {}) ;
|
||||
return data;
|
||||
}
|
||||
function testClipboardValue(mime, expected) {
|
||||
var data = getClipboardData(mime);
|
||||
is (data.value == null ? data.value :
|
||||
data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
|
||||
expected,
|
||||
mime + " value in the clipboard");
|
||||
return data.value;
|
||||
}
|
||||
function testPasteText(expected) {
|
||||
textarea.value="";
|
||||
textarea.focus();
|
||||
textarea.editor.paste(1);
|
||||
is(textarea.value, expected, "value of the textarea after the paste");
|
||||
}
|
||||
function testSelectionToString(expected) {
|
||||
is(window.getSelection().toString().replace(/\r\n/g,"\n"), expected, "Selection.toString");
|
||||
}
|
||||
function testInnerHTML(id, expected) {
|
||||
var value = document.getElementById(id).innerHTML;
|
||||
is(value, expected, id + ".innerHTML");
|
||||
}
|
||||
function testEmptyChildren(id) {
|
||||
copyChildrenToClipboard(id);
|
||||
testSelectionToString("");
|
||||
testClipboardValue("text/unicode", null);
|
||||
testClipboardValue("text/html", null);
|
||||
testPasteText("");
|
||||
}
|
||||
|
||||
copyChildrenToClipboard("draggable");
|
||||
testSelectionToString("This is a draggable bit of text.");
|
||||
testClipboardValue("text/unicode",
|
||||
"This is a draggable bit of text.");
|
||||
testClipboardValue("text/html",
|
||||
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em> bit of text.</div>");
|
||||
testPasteText("This is a draggable bit of text.");
|
||||
|
||||
copyChildrenToClipboard("alist");
|
||||
testSelectionToString(" bla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " bla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"alist\">\n bla\n <ul>\n <li>foo</li>\n \n <li>bar</li>\n </ul>\n </div>");
|
||||
testPasteText(" bla\n\n foo\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("blist");
|
||||
testSelectionToString(" mozilla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " mozilla\n\n foo\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"blist\">\n mozilla\n <ol>\n <li>foo</li>\n \n <li>bar</li>\n </ol>\n </div>");
|
||||
testPasteText(" mozilla\n\n foo\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("clist");
|
||||
testSelectionToString(" mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
testClipboardValue("text/unicode", " mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
testClipboardValue("text/html", "<div id=\"clist\">\n mzla\n <ul>\n <li>foo<ul>\n <li>bazzinga!</li>\n </ul></li>\n \n <li>bar</li>\n </ul>\n </div>");
|
||||
testPasteText(" mzla\n\n foo\n bazzinga!\n bar\n\n");
|
||||
|
||||
copyChildrenToClipboard("div4");
|
||||
testSelectionToString(" Tt t t ");
|
||||
testClipboardValue("text/unicode", " Tt t t ");
|
||||
testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea>t t t</textarea>\n</div>");
|
||||
testInnerHTML("div4", "\n T<textarea>t t t</textarea>\n");
|
||||
testPasteText(" Tt t t ");
|
||||
|
||||
copyChildrenToClipboard("div5");
|
||||
testSelectionToString(" T ");
|
||||
testClipboardValue("text/unicode", " T ");
|
||||
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>");
|
||||
testInnerHTML("div5", "\n T<textarea> </textarea>\n");
|
||||
testPasteText(" T ");
|
||||
|
||||
copyRangeToClipboard($("div6").childNodes[0],0, $("div6").childNodes[1],1);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div6", "div6");
|
||||
|
||||
copyRangeToClipboard($("div7").childNodes[0],0, $("div7").childNodes[0],4);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div7", "div7");
|
||||
|
||||
copyRangeToClipboard($("div8").childNodes[0],0, $("div8").childNodes[0],4);
|
||||
testSelectionToString("");
|
||||
// START Disabled due to bug 564688
|
||||
if (false) {
|
||||
testClipboardValue("text/unicode", "");
|
||||
testClipboardValue("text/html", "");
|
||||
}
|
||||
// END Disabled due to bug 564688
|
||||
testInnerHTML("div8", "div8");
|
||||
|
||||
copyRangeToClipboard($("div9").childNodes[0],0, $("div9").childNodes[0],4);
|
||||
testSelectionToString("div9");
|
||||
testClipboardValue("text/unicode", "div9");
|
||||
testClipboardValue("text/html", "div9");
|
||||
testInnerHTML("div9", "div9");
|
||||
|
||||
copyToClipboard($("div10"));
|
||||
testSelectionToString("");
|
||||
testInnerHTML("div10", "div10");
|
||||
|
||||
copyToClipboard($("div10").firstChild);
|
||||
testSelectionToString("");
|
||||
|
||||
copyRangeToClipboard($("div10").childNodes[0],0, $("div10").childNodes[0],1);
|
||||
testSelectionToString("");
|
||||
|
||||
copyRangeToClipboard($("div10").childNodes[1],0, $("div10").childNodes[1],1);
|
||||
testSelectionToString("");
|
||||
|
||||
// ============ copy/paste test from/to a textarea
|
||||
|
||||
var val = "1\n 2\n 3";
|
||||
textarea.value=val;
|
||||
textarea.select();
|
||||
textarea.editor.copy();
|
||||
|
||||
textarea.value="";
|
||||
textarea.editor.paste(1);
|
||||
is(textarea.value, val);
|
||||
textarea.value="";
|
||||
|
||||
// ============ NOSCRIPT should not be copied
|
||||
|
||||
copyChildrenToClipboard("div13");
|
||||
testSelectionToString("__");
|
||||
testClipboardValue("text/unicode", "__");
|
||||
testClipboardValue("text/html", "<div id=\"div13\">__</div>");
|
||||
testPasteText("__");
|
||||
|
||||
// ============ converting cell boundaries to tabs in tables
|
||||
|
||||
copyToClipboard($("tr1"));
|
||||
testClipboardValue("text/unicode", "foo\tbar");
|
||||
|
||||
// ============ manipulating Selection in oncopy
|
||||
|
||||
copyRangeToClipboard($("div11").childNodes[0],0, $("div11").childNodes[1],2);
|
||||
testClipboardValue("text/unicode", "Xdiv11");
|
||||
testClipboardValue("text/html", "<div><p>X<span>div</span>11</p></div>");
|
||||
setTimeout(function(){testSelectionToString("div11")},0);
|
||||
|
||||
setTimeout(function(){
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
copyRangeToClipboard($("div12").childNodes[0],0, $("div12").childNodes[1],2);
|
||||
testClipboardValue("text/unicode", "Xdiv12");
|
||||
testClipboardValue("text/html", "<div><p>X<span>div</span>12</p></div>");
|
||||
setTimeout(function(){
|
||||
testSelectionToString("div12");
|
||||
setTimeout(SimpleTest.finish,0);
|
||||
},0);
|
||||
},0);
|
||||
}
|
||||
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(testCopyPaste);
|
||||
addLoadEvent(function () testCopyPaste(false));
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
108
content/base/test/test_copypaste.xhtml
Normal file
108
content/base/test/test_copypaste.xhtml
Normal file
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
This test is copied from test_copypaste.html, but it's XHTML instead of HTML.
|
||||
XHTML is encoded differently from HTML when copied; see bugs 888839 and 723163.
|
||||
This test is different from test_copypaste.html in two ways:
|
||||
|
||||
1. The text/html clipboard flavor isn't tested, since nsCopySupport doesn't
|
||||
produce it for XHTML.
|
||||
2. The text/unicode flavor isn't tested when the selection is in hidden
|
||||
elements, since nsCopySupport doesn't produce text/plain for hidden
|
||||
elements, and unlike HTML, neither does it produce text/_moz_htmlcontext
|
||||
and text/_moz_htmlinfo, which the clipboard converts to text/unicode.
|
||||
-->
|
||||
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Test for copy/paste with XHTML</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="copypaste.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=888839">Mozilla Bug 888839</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function modifySelectionDiv12() {
|
||||
modifySelection("X<b style='display:none'>Y</b>");
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function () testCopyPaste(true));
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
<div>
|
||||
|
||||
<div id="draggable" title="title to have a long HTML line">This is a <em>draggable</em> bit of text.</div>
|
||||
<textarea id="input" cols="40" rows="10"></textarea>
|
||||
|
||||
<div id="alist">
|
||||
bla
|
||||
<ul>
|
||||
<li>foo</li>
|
||||
<li style="display: none;">baz</li>
|
||||
<li>bar</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="blist">
|
||||
mozilla
|
||||
<ol>
|
||||
<li>foo</li>
|
||||
<li style="display: none;">baz</li>
|
||||
<li>bar</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div id="clist">
|
||||
mzla
|
||||
<ul>
|
||||
<li>foo<ul>
|
||||
<li>bazzinga!</li>
|
||||
</ul></li>
|
||||
<li style="display: none;">baz</li>
|
||||
<li>bar</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="div4">
|
||||
T<textarea>t t t</textarea>
|
||||
</div>
|
||||
|
||||
<div id="div5">
|
||||
T<textarea> </textarea>
|
||||
</div>
|
||||
|
||||
<div id="div6" style="display:none"></div>
|
||||
<script>
|
||||
var x = $("div6")
|
||||
x.appendChild(document.createTextNode('di'))
|
||||
x.appendChild(document.createTextNode('v6'))
|
||||
</script>
|
||||
|
||||
<div id="div7" style="display:none">div7</div>
|
||||
<div id="div8" style="visibility:hidden">div8</div>
|
||||
<div style="visibility:hidden"><div id="div9" style="visibility:visible">div9</div></div>
|
||||
<div style="visibility:hidden"><div><div><div id="div10"></div></div></div></div>
|
||||
<script>
|
||||
var x = $("div10")
|
||||
x.appendChild(document.createTextNode('div'))
|
||||
x.appendChild(document.createTextNode('10'))
|
||||
</script>
|
||||
|
||||
<div id="div11" oncopy="modifySelection('X')"><span>div</span>11</div>
|
||||
<div id="div12" oncopy="modifySelectionDiv12()"><span>div</span>12</div>
|
||||
|
||||
<div id="div13">_<noscript>FAIL</noscript>_</div>
|
||||
|
||||
<table><tr id="tr1"><td>foo</td><td>bar</td></tr></table>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
64
content/base/test/test_copypaste.xul
Normal file
64
content/base/test/test_copypaste.xul
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=888839
|
||||
-->
|
||||
<window title="Mozilla Bug 888839"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
let { classes: Cc, interfaces: Ci } = Components;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runTest);
|
||||
|
||||
function runTest() {
|
||||
let desc = document.querySelector("description");
|
||||
window.getSelection().selectAllChildren(desc);
|
||||
|
||||
let webnav = window.
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIWebNavigation);
|
||||
|
||||
webnav.
|
||||
QueryInterface(Ci.nsIDocShell).
|
||||
contentViewer.
|
||||
QueryInterface(Ci.nsIContentViewerEdit).
|
||||
copySelection();
|
||||
|
||||
let mime = "text/unicode";
|
||||
let whichClipboard = Ci.nsIClipboard.kGlobalClipboard;
|
||||
let clipboard = Cc["@mozilla.org/widget/clipboard;1"].
|
||||
getService(Ci.nsIClipboard);
|
||||
ok(clipboard.hasDataMatchingFlavors([mime], 1, whichClipboard),
|
||||
"Clipboard should have text/unicode");
|
||||
|
||||
let transferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Ci.nsITransferable);
|
||||
transferable.init(webnav.QueryInterface(Ci.nsILoadContext));
|
||||
transferable.addDataFlavor(mime);
|
||||
clipboard.getData(transferable, whichClipboard);
|
||||
var data = {};
|
||||
transferable.getTransferData(mime, data, {});
|
||||
is(data.value.QueryInterface(Ci.nsISupportsString).data,
|
||||
"\n hello\n world\n ",
|
||||
"Paste is not HTML, so it should not be pretty printed");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
]]></script>
|
||||
|
||||
<description style="-moz-user-focus: normal; -moz-user-select: text;"><![CDATA[
|
||||
hello
|
||||
world
|
||||
]]></description>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=888839"
|
||||
target="_blank">Mozilla Bug 888839</a>
|
||||
</body>
|
||||
</window>
|
@ -800,6 +800,13 @@ CanvasRenderingContext2D::AddDemotableContext(CanvasRenderingContext2D* context)
|
||||
DemotableContexts().push_back(context);
|
||||
}
|
||||
|
||||
#define MIN_SKIA_GL_DIMENSION 16
|
||||
|
||||
bool
|
||||
CheckSizeForSkiaGL(IntSize size) {
|
||||
return size.width > MIN_SKIA_GL_DIMENSION && size.height > MIN_SKIA_GL_DIMENSION;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
@ -845,10 +852,7 @@ CanvasRenderingContext2D::EnsureTarget()
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
nsString vendor;
|
||||
|
||||
if (!mForceSoftware &&
|
||||
gfxInfo &&
|
||||
NS_SUCCEEDED(gfxInfo->GetAdapterVendorID(vendor)) &&
|
||||
StringBeginsWith(vendor, NS_LITERAL_STRING("NVIDIA")))
|
||||
if (!mForceSoftware && CheckSizeForSkiaGL(size))
|
||||
{
|
||||
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
|
||||
caps, GLContext::ContextFlagsNone);
|
||||
@ -1042,7 +1046,8 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
|
||||
|
||||
nsresult rv;
|
||||
const char encoderPrefix[] = "@mozilla.org/image/encoder;2?type=";
|
||||
nsAutoArrayPtr<char> conid(new (std::nothrow) char[strlen(encoderPrefix) + strlen(aMimeType) + 1]);
|
||||
static const fallible_t fallible = fallible_t();
|
||||
nsAutoArrayPtr<char> conid(new (fallible) char[strlen(encoderPrefix) + strlen(aMimeType) + 1]);
|
||||
|
||||
if (!conid) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1056,7 +1061,7 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<uint8_t> imageBuffer(new (std::nothrow) uint8_t[mWidth * mHeight * 4]);
|
||||
nsAutoArrayPtr<uint8_t> imageBuffer(new (fallible) uint8_t[mWidth * mHeight * 4]);
|
||||
if (!imageBuffer) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -741,9 +741,6 @@ WebGLContext::GetInputStream(const char* aMimeType,
|
||||
const char encoderPrefix[] = "@mozilla.org/image/encoder;2?type=";
|
||||
nsAutoArrayPtr<char> conid(new char[strlen(encoderPrefix) + strlen(aMimeType) + 1]);
|
||||
|
||||
if (!conid)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
strcpy(conid, encoderPrefix);
|
||||
strcat(conid, aMimeType);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# WebGL Reftests!
|
||||
# If you add new tests, don't forget to add sanity (&nogl) tests! (if needed)
|
||||
default-preferences pref(webgl.force-enabled,true)
|
||||
|
||||
# Check that disabling works:
|
||||
== webgl-disable-test.html?nogl wrapper.html?green.png
|
||||
@ -8,179 +8,168 @@ pref(webgl.disabled,true) == webgl-disable-test.html wrapper.html?green.p
|
||||
# Basic WebGL tests:
|
||||
# Do we get pixels to the screen at all?
|
||||
# Try to just hit the different rendering paths here.
|
||||
|
||||
# Android 2.2 ARMv6 slaves can't seem to use WebGL, but we can't seem to
|
||||
# disable the ARMv6 runs without disabling ARMv7, which works fine.
|
||||
# For now, just mark versions <15 (<4.0) as random, so we still get
|
||||
# assert coverage.
|
||||
|
||||
# Test: {aa, alpha, preserve, readback} = 16
|
||||
== webgl-clear-test.html?nogl wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&_____&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&_____&________ wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&alpha&________ wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&alpha&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&_____&preserve wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&_____&preserve wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?__&alpha&preserve wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?aa&alpha&preserve wrapper.html?green.png
|
||||
|
||||
== webgl-clear-test.html?__&_____&________ wrapper.html?green.png
|
||||
== webgl-clear-test.html?aa&_____&________ wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) == webgl-clear-test.html?__&alpha&________ wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) == webgl-clear-test.html?aa&alpha&________ wrapper.html?green.png
|
||||
== webgl-clear-test.html?__&_____&preserve wrapper.html?green.png
|
||||
== webgl-clear-test.html?aa&_____&preserve wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) == webgl-clear-test.html?__&alpha&preserve wrapper.html?green.png
|
||||
fuzzy-if(B2G,256,83) == webgl-clear-test.html?aa&alpha&preserve wrapper.html?green.png
|
||||
|
||||
pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback&__&_____&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback&aa&_____&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-clear-test.html?readback&__&alpha&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-clear-test.html?readback&aa&alpha&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback&__&_____&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-clear-test.html?readback&aa&_____&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-clear-test.html?readback&__&alpha&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-clear-test.html?readback&aa&alpha&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&_____&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&_____&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&alpha&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&alpha&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&_____&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&_____&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&__&alpha&preserve wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-clear-test.html?readback&aa&alpha&preserve wrapper.html?green.png
|
||||
|
||||
# Check orientation:
|
||||
== webgl-orientation-test.html?nogl wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&_____&________ wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&_____&________ wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&alpha&________ wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&alpha&________ wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&_____&preserve wrapper.html?white-top-left.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&_____&preserve wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?__&alpha&preserve wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
|
||||
== webgl-orientation-test.html?__&_____&________ wrapper.html?white-top-left.png
|
||||
== webgl-orientation-test.html?aa&_____&________ wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) == webgl-orientation-test.html?__&alpha&________ wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) == webgl-orientation-test.html?aa&alpha&________ wrapper.html?white-top-left.png
|
||||
== webgl-orientation-test.html?__&_____&preserve wrapper.html?white-top-left.png
|
||||
== webgl-orientation-test.html?aa&_____&preserve wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) == webgl-orientation-test.html?__&alpha&preserve wrapper.html?white-top-left.png
|
||||
fuzzy-if(B2G,256,83) == webgl-orientation-test.html?aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
|
||||
pref(webgl.force-layers-readback,true) == webgl-orientation-test.html?readback&__&_____&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-orientation-test.html?readback&aa&_____&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-orientation-test.html?readback&__&alpha&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-orientation-test.html?readback&aa&alpha&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-orientation-test.html?readback&__&_____&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-orientation-test.html?readback&aa&_____&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-orientation-test.html?readback&__&alpha&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) == webgl-orientation-test.html?readback&aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&_____&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&_____&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&alpha&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&alpha&________ wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&_____&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&_____&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&__&alpha&preserve wrapper.html?white-top-left.png
|
||||
pref(webgl.force-layers-readback,true) fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-orientation-test.html?readback&aa&alpha&preserve wrapper.html?white-top-left.png
|
||||
|
||||
# Does we draw the correct color in the correct places with all context creation options?
|
||||
# (Note that our context creation option matrix is 2^6 = 64)
|
||||
random-if(B2G) == webgl-color-test.html?nogl wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&_______&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&premult&________&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&_______&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&premult&preserve&_______ wrapper.html?colors.png # Bug 844439
|
||||
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?__&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) == webgl-color-test.html?aa&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&________&stencil wrapper.html?colors.png # Bug 844439
|
||||
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&_______&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&_____&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&_____&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?__&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?aa&alpha&depth&premult&preserve&stencil wrapper.html?colors.png # Bug 844439
|
||||
|
||||
|
||||
# Check a smaller selection for readback:
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&__&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&aa&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&__&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&aa&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&__&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&aa&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&__&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) == webgl-color-test.html?readback&aa&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&_____&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&alpha&________ wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&_____&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&__&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
pref(webgl.force-layers-readback,true) random-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?readback&aa&alpha&preserve wrapper.html?colors.png # Bug 844439
|
||||
|
||||
|
||||
# Check alpha behavior:
|
||||
fuzzy-if(B2G,256,83) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0&nogl wrapper.html?colors.png
|
||||
fuzzy-if(B2G,256,83) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0 wrapper.html?colors.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0 wrapper.html?colors.png
|
||||
# These tests don't use wrapper.html, as there appear to be invalidation issues with black.png and async image decoding - Bug 803299
|
||||
== webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0&nogl black.html
|
||||
== webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0 black.html
|
||||
random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0 black.html
|
||||
|
||||
fuzzy-if(B2G,256,83) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&nogl wrapper.html?colors.png
|
||||
fuzzy-if(B2G,256,83) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0 wrapper.html?colors.png
|
||||
fuzzy-if(B2G,256,83) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha&nogl wrapper.html?white.png
|
||||
fails-if(B2G) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha wrapper.html?white.png
|
||||
fuzzy-if(B2G,256,83) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0 wrapper.html?colors.png
|
||||
fails-if(B2G) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha wrapper.html?white.png
|
||||
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0&nogl wrapper.html?half-colors.png
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0 wrapper.html?half-colors.png
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0 wrapper.html?half-colors.png
|
||||
|
||||
# Test premult:
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&nogl wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&nogl wrapper.html?half-colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) fails-if(cocoaWidget||Android) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha wrapper.html?half-colors-half-alpha.png
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult&nogl wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) fails-if(cocoaWidget||Android) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha wrapper.html?half-colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult wrapper.html?colors-half-alpha.png
|
||||
|
||||
# Test over-bright premult:
|
||||
fuzzy(1,65536) fuzzy-if(B2G,256,83) fuzzy-if(Android||B2G,9,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&premult&nogl wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&premult wrapper.html?colors-half-alpha.png
|
||||
fuzzy(1,65536) fails-if(B2G) fuzzy-if(Android,9,65536) random-if(Android&&AndroidVersion<15) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&premult wrapper.html?colors-half-alpha.png
|
||||
|
||||
|
||||
# Check for hanging framebuffer bindings:
|
||||
== webgl-hanging-fb-test.html?nogl wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-fb-test.html?aa&readback wrapper.html?green.png
|
||||
|
||||
== webgl-hanging-fb-test.html?__&________ wrapper.html?green.png
|
||||
== webgl-hanging-fb-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-fb-test.html?aa&readback wrapper.html?green.png
|
||||
|
||||
== webgl-hanging-scissor-test.html?__&________ wrapper.html?green.png
|
||||
== webgl-hanging-scissor-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-scissor-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-hanging-scissor-test.html?aa&readback wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?__&________ wrapper.html?green.png
|
||||
random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?aa&________ wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?__&readback wrapper.html?green.png
|
||||
pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-hanging-scissor-test.html?aa&readback wrapper.html?green.png
|
||||
|
||||
|
||||
# Check that our experimental prefs still work:
|
||||
|
||||
# 16bpp:
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) == webgl-color-test.html?16bpp wrapper.html?colors.png
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback wrapper.html?colors.png
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?16bpp wrapper.html?colors.png
|
||||
skip-if(winWidget) pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) random-if(Android&&AndroidVersion<15) == webgl-color-test.html?16bpp&readback wrapper.html?colors.png
|
||||
|
||||
# Force native GL (Windows):
|
||||
skip-if(!winWidget) pref(webgl.prefer-native-gl,true) == webgl-clear-test.html?native-gl wrapper.html?green.png
|
||||
|
@ -18,10 +18,10 @@ function renderGL(gl) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas) {
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(0, 255, 0, 1.0)";
|
||||
context.fillRect(0, 0, 256, 256);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -31,7 +31,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderBackup(canvas);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
@ -39,6 +39,7 @@ function runTest() {
|
||||
function testComplete() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -47,30 +47,10 @@ function renderGL(gl, value, alpha) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas, value, alpha) {
|
||||
if (!arg("alpha"))
|
||||
alpha = 1.0;
|
||||
|
||||
if (arg("alpha") && arg("premult")) {
|
||||
if (alpha == 0.0)
|
||||
value = 1.0;
|
||||
else
|
||||
value /= alpha;
|
||||
}
|
||||
|
||||
var intValue = (value * 255) | 0;
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(" + intValue + ", 0, 0, " + alpha + ")";
|
||||
context.fillRect(0, 0, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(0, " + intValue + ", 0, " + alpha + ")";
|
||||
context.fillRect(128, 0, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(0, 0, " + intValue + ", " + alpha + ")";
|
||||
context.fillRect(0, 128, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(" + intValue + ", " + intValue + ", " + intValue + ", " + alpha + ")";
|
||||
context.fillRect(128, 128, 128, 128);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -83,7 +63,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl, value, alpha);
|
||||
else
|
||||
renderBackup(canvas, value, alpha);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
|
@ -45,19 +45,10 @@ function renderGL(gl) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas) {
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(255, 0, 0, 1.0)";
|
||||
context.fillRect(0, 0, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(0, 255, 0, 1.0)";
|
||||
context.fillRect(128, 0, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(0, 0, 255, 1.0)";
|
||||
context.fillRect(0, 128, 128, 128);
|
||||
|
||||
context.fillStyle = "rgba(255, 255, 255, 1.0)";
|
||||
context.fillRect(128, 128, 128, 128);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -67,7 +58,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderBackup(canvas);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ function renderGL(gl) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas) {
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(0, 255, 0, 1.0)";
|
||||
context.fillRect(0, 0, 256, 256);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -40,7 +40,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderBackup(canvas);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ function renderGL(gl) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas) {
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(0, 255, 0, 1.0)";
|
||||
context.fillRect(0, 0, 256, 256);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -39,7 +39,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderBackup(canvas);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
|
@ -26,13 +26,10 @@ function renderGL(gl) {
|
||||
gl.finish();
|
||||
}
|
||||
|
||||
function renderBackup(canvas) {
|
||||
function renderFailure(canvas) {
|
||||
// This will also trigger RAF for us.
|
||||
var context = canvas.getContext("2d");
|
||||
context.fillStyle = "rgba(0, 0, 0, 1.0)";
|
||||
context.fillRect(0, 0, 256, 256);
|
||||
|
||||
context.fillStyle = "rgba(255, 255, 255, 1.0)";
|
||||
context.fillRect(0, 0, 128, 128);
|
||||
context.fillText('WebGL failed.', 64, 64);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
@ -42,7 +39,7 @@ function runTest() {
|
||||
if (gl)
|
||||
renderGL(gl);
|
||||
else
|
||||
renderBackup(canvas);
|
||||
renderFailure(canvas);
|
||||
|
||||
rAF(testComplete);
|
||||
}
|
||||
|
@ -1071,7 +1071,6 @@ nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
|
||||
|
||||
// Get range from offset and length
|
||||
nsRefPtr<nsRange> range = new nsRange(mRootContent);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = SetRangeFromFlatTextOffset(range, aEvent->mOffset, aEvent->mLength,
|
||||
aEvent->mExpandToClusterBoundary);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -33,9 +33,6 @@ nsresult NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
{
|
||||
nsDOMBeforeUnloadEvent* it =
|
||||
new nsDOMBeforeUnloadEvent(aOwner, aPresContext, aEvent);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -66,9 +66,6 @@ nsresult NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsCommandEvent* aEvent)
|
||||
{
|
||||
nsDOMCommandEvent* it = new nsDOMCommandEvent(aOwner, aPresContext, aEvent);
|
||||
if (nullptr == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -86,7 +86,6 @@ NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
{
|
||||
nsDOMDataContainerEvent* it =
|
||||
new nsDOMDataContainerEvent(aOwner, aPresContext, aEvent);
|
||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -232,7 +232,6 @@ nsDOMDataTransfer::GetFiles(nsIDOMFileList** aFileList)
|
||||
|
||||
if (!mFiles) {
|
||||
mFiles = new nsDOMFileList(static_cast<nsIDOMDataTransfer*>(this));
|
||||
NS_ENSURE_TRUE(mFiles, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
uint32_t count = mItems.Length();
|
||||
|
||||
@ -273,7 +272,6 @@ nsDOMDataTransfer::GetTypes(nsIDOMDOMStringList** aTypes)
|
||||
*aTypes = nullptr;
|
||||
|
||||
nsRefPtr<nsDOMStringList> types = new nsDOMStringList();
|
||||
NS_ENSURE_TRUE(types, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (mItems.Length()) {
|
||||
const nsTArray<TransferItem>& item = mItems[0];
|
||||
@ -423,7 +421,6 @@ nsDOMDataTransfer::MozTypesAt(uint32_t aIndex, nsIDOMDOMStringList** aTypes)
|
||||
}
|
||||
|
||||
nsRefPtr<nsDOMStringList> types = new nsDOMStringList();
|
||||
NS_ENSURE_TRUE(types, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (aIndex < mItems.Length()) {
|
||||
// note that you can retrieve the types regardless of their principal
|
||||
@ -657,7 +654,6 @@ nsDOMDataTransfer::Clone(uint32_t aEventType, bool aUserCancelled,
|
||||
new nsDOMDataTransfer(aEventType, mEffectAllowed, mCursorState,
|
||||
mIsExternal, aUserCancelled, aIsCrossDomainSubFrameDrop,
|
||||
mClipboardType, mItems, mDragImage, mDragImageX, mDragImageY);
|
||||
NS_ENSURE_TRUE(newDataTransfer, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNewDataTransfer = newDataTransfer;
|
||||
NS_ADDREF(*aNewDataTransfer);
|
||||
|
@ -523,7 +523,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_SCROLLBAR_EVENT:
|
||||
{
|
||||
newEvent = new nsScrollbarEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
static_cast<nsScrollbarEvent*>(newEvent)->position =
|
||||
static_cast<nsScrollbarEvent*>(mEvent)->position;
|
||||
break;
|
||||
@ -537,7 +536,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_KEY_EVENT:
|
||||
{
|
||||
nsKeyEvent* keyEvent = new nsKeyEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(keyEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsKeyEvent* oldKeyEvent = static_cast<nsKeyEvent*>(mEvent);
|
||||
isInputEvent = true;
|
||||
keyEvent->keyCode = oldKeyEvent->keyCode;
|
||||
@ -553,7 +551,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
nsMouseEvent* oldMouseEvent = static_cast<nsMouseEvent*>(mEvent);
|
||||
nsMouseEvent* mouseEvent =
|
||||
new nsMouseEvent(false, msg, nullptr, oldMouseEvent->reason);
|
||||
NS_ENSURE_TRUE(mouseEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
isInputEvent = true;
|
||||
mouseEvent->clickCount = oldMouseEvent->clickCount;
|
||||
mouseEvent->acceptActivation = oldMouseEvent->acceptActivation;
|
||||
@ -571,7 +568,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
nsDragEvent* oldDragEvent = static_cast<nsDragEvent*>(mEvent);
|
||||
nsDragEvent* dragEvent =
|
||||
new nsDragEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(dragEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
isInputEvent = true;
|
||||
dragEvent->dataTransfer = oldDragEvent->dataTransfer;
|
||||
dragEvent->clickCount = oldDragEvent->clickCount;
|
||||
@ -595,7 +591,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_SCRIPT_ERROR_EVENT:
|
||||
{
|
||||
newEvent = new nsScriptErrorEvent(false, msg);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
static_cast<nsScriptErrorEvent*>(newEvent)->lineNr =
|
||||
static_cast<nsScriptErrorEvent*>(mEvent)->lineNr;
|
||||
break;
|
||||
@ -663,7 +658,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
{
|
||||
newEvent = new nsScrollPortEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
static_cast<nsScrollPortEvent*>(newEvent)->orient =
|
||||
static_cast<nsScrollPortEvent*>(mEvent)->orient;
|
||||
break;
|
||||
@ -672,7 +666,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
{
|
||||
nsScrollAreaEvent *newScrollAreaEvent =
|
||||
new nsScrollAreaEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(newScrollAreaEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
newScrollAreaEvent->mArea =
|
||||
static_cast<nsScrollAreaEvent *>(mEvent)->mArea;
|
||||
newEvent = newScrollAreaEvent;
|
||||
@ -681,7 +674,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_MUTATION_EVENT:
|
||||
{
|
||||
nsMutationEvent* mutationEvent = new nsMutationEvent(false, msg);
|
||||
NS_ENSURE_TRUE(mutationEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsMutationEvent* oldMutationEvent =
|
||||
static_cast<nsMutationEvent*>(mEvent);
|
||||
mutationEvent->mRelatedNode = oldMutationEvent->mRelatedNode;
|
||||
@ -700,7 +692,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_FOCUS_EVENT:
|
||||
{
|
||||
nsFocusEvent* newFocusEvent = new nsFocusEvent(false, msg);
|
||||
NS_ENSURE_TRUE(newFocusEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsFocusEvent* oldFocusEvent = static_cast<nsFocusEvent*>(mEvent);
|
||||
newFocusEvent->fromRaise = oldFocusEvent->fromRaise;
|
||||
newFocusEvent->isRefocus = oldFocusEvent->isRefocus;
|
||||
@ -711,7 +702,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
{
|
||||
newEvent = new nsCommandEvent(false, mEvent->userType,
|
||||
static_cast<nsCommandEvent*>(mEvent)->command, nullptr);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
break;
|
||||
}
|
||||
case NS_UI_EVENT:
|
||||
@ -723,14 +713,12 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
case NS_SVGZOOM_EVENT:
|
||||
{
|
||||
newEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
newEvent->eventStructType = NS_SVGZOOM_EVENT;
|
||||
break;
|
||||
}
|
||||
case NS_SMIL_TIME_EVENT:
|
||||
{
|
||||
newEvent = new nsUIEvent(false, msg, 0);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
newEvent->eventStructType = NS_SMIL_TIME_EVENT;
|
||||
break;
|
||||
}
|
||||
@ -739,7 +727,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
nsSimpleGestureEvent* oldSimpleGestureEvent = static_cast<nsSimpleGestureEvent*>(mEvent);
|
||||
nsSimpleGestureEvent* simpleGestureEvent =
|
||||
new nsSimpleGestureEvent(false, msg, nullptr, 0, 0.0);
|
||||
NS_ENSURE_TRUE(simpleGestureEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
isInputEvent = true;
|
||||
simpleGestureEvent->direction = oldSimpleGestureEvent->direction;
|
||||
simpleGestureEvent->delta = oldSimpleGestureEvent->delta;
|
||||
@ -755,7 +742,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
oldTransitionEvent->propertyName,
|
||||
oldTransitionEvent->elapsedTime,
|
||||
oldTransitionEvent->pseudoElement);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
break;
|
||||
}
|
||||
case NS_ANIMATION_EVENT:
|
||||
@ -766,14 +752,12 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
oldAnimationEvent->animationName,
|
||||
oldAnimationEvent->elapsedTime,
|
||||
oldAnimationEvent->pseudoElement);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
break;
|
||||
}
|
||||
case NS_TOUCH_EVENT:
|
||||
{
|
||||
nsTouchEvent *oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
|
||||
newEvent = new nsTouchEvent(false, oldTouchEvent);
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
isInputEvent = true;
|
||||
break;
|
||||
}
|
||||
@ -784,8 +768,6 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (isInputEvent) {
|
||||
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
|
||||
nsInputEvent* newInputEvent = static_cast<nsInputEvent*>(newEvent);
|
||||
|
@ -102,9 +102,6 @@ nsresult NS_NewDOMMutationEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsMutationEvent *aEvent)
|
||||
{
|
||||
nsDOMMutationEvent* it = new nsDOMMutationEvent(aOwner, aPresContext, aEvent);
|
||||
if (nullptr == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -162,9 +162,6 @@ nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsDOMNotifyPaintEvent* it =
|
||||
new nsDOMNotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
aInvalidateRequests);
|
||||
if (nullptr == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
@ -1200,7 +1200,6 @@ nsEventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
|
||||
ls.mFlags.mCapture,
|
||||
ls.mFlags.mAllowUntrustedEvents,
|
||||
ls.mFlags.mInSystemGroup);
|
||||
NS_ENSURE_TRUE(info, NS_ERROR_OUT_OF_MEMORY);
|
||||
aList->AppendObject(info);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -300,7 +300,6 @@ nsresult
|
||||
NS_NewEventListenerService(nsIEventListenerService** aResult)
|
||||
{
|
||||
*aResult = new nsEventListenerService();
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
3
content/html/content/crashtests/903106.html
Normal file
3
content/html/content/crashtests/903106.html
Normal file
@ -0,0 +1,3 @@
|
||||
<script>
|
||||
document.createElement("tr").sectionRowIndex;
|
||||
</script>
|
@ -53,3 +53,4 @@ pref(dom.experimental_forms_range,true) load 838256-1.html
|
||||
load 862084.html
|
||||
load 865147.html
|
||||
load 877910.html
|
||||
load 903106.html
|
||||
|
@ -266,9 +266,6 @@ nsresult
|
||||
HTMLFormElement::Init()
|
||||
{
|
||||
mControls = new nsFormControlList(this);
|
||||
if (!mControls) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = mControls->Init();
|
||||
|
||||
|
@ -121,10 +121,6 @@ HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
|
||||
|
||||
if (!mRowSpecs) { // we may not have had an attr or had an empty attr
|
||||
mRowSpecs = new nsFramesetSpec[1];
|
||||
if (!mRowSpecs) {
|
||||
mNumRows = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mNumRows = 1;
|
||||
mRowSpecs[0].mUnit = eFramesetUnit_Relative;
|
||||
mRowSpecs[0].mValue = 1;
|
||||
@ -155,10 +151,6 @@ HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
|
||||
|
||||
if (!mColSpecs) { // we may not have had an attr or had an empty attr
|
||||
mColSpecs = new nsFramesetSpec[1];
|
||||
if (!mColSpecs) {
|
||||
mNumCols = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mNumCols = 1;
|
||||
mColSpecs[0].mUnit = eFramesetUnit_Relative;
|
||||
mColSpecs[0].mValue = 1;
|
||||
@ -239,7 +231,8 @@ HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
|
||||
commaX = spec.FindChar(sComma, commaX + 1);
|
||||
}
|
||||
|
||||
nsFramesetSpec* specs = new nsFramesetSpec[count];
|
||||
static const fallible_t fallible = fallible_t();
|
||||
nsFramesetSpec* specs = new (fallible) nsFramesetSpec[count];
|
||||
if (!specs) {
|
||||
*aSpecs = nullptr;
|
||||
aNumSpecs = 0;
|
||||
|
@ -49,9 +49,9 @@ HTMLTableSectionElement*
|
||||
HTMLTableRowElement::GetSection() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
if (parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
|
||||
parent->Tag() == nsGkAtoms::tbody ||
|
||||
parent->Tag() == nsGkAtoms::tfoot)) {
|
||||
if (parent && parent->IsHTML() && (parent->Tag() == nsGkAtoms::thead ||
|
||||
parent->Tag() == nsGkAtoms::tbody ||
|
||||
parent->Tag() == nsGkAtoms::tfoot)) {
|
||||
return static_cast<HTMLTableSectionElement*>(parent);
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -50,15 +50,9 @@ nsHTMLDNSPrefetch::Initialize()
|
||||
}
|
||||
|
||||
sPrefetches = new nsHTMLDNSPrefetch::nsDeferrals();
|
||||
if (!sPrefetches)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(sPrefetches);
|
||||
|
||||
sDNSListener = new nsHTMLDNSPrefetch::nsListener();
|
||||
if (!sDNSListener) {
|
||||
NS_IF_RELEASE(sPrefetches);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(sDNSListener);
|
||||
|
||||
sPrefetches->Activate();
|
||||
|
@ -1091,9 +1091,7 @@ nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame)
|
||||
|
||||
// Create a SelectionController
|
||||
mSelCon = new nsTextInputSelectionImpl(frameSel, shell, rootNode);
|
||||
NS_ENSURE_TRUE(mSelCon, NS_ERROR_OUT_OF_MEMORY);
|
||||
mTextListener = new nsTextInputListener(mTextCtrlElement);
|
||||
NS_ENSURE_TRUE(mTextListener, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(mTextListener);
|
||||
|
||||
mTextListener->SetFrame(mBoundFrame);
|
||||
|
@ -344,6 +344,11 @@ ImageDocument::ShrinkToFit()
|
||||
// origin now that we're showing a shrunk-to-window version.
|
||||
ScrollImageTo(0, 0, false);
|
||||
|
||||
if (!mImageContent) {
|
||||
// ScrollImageTo flush destroyed our content.
|
||||
return;
|
||||
}
|
||||
|
||||
SetModeClass(eShrinkToFit);
|
||||
|
||||
mImageIsResized = true;
|
||||
@ -375,7 +380,7 @@ ImageDocument::ScrollImageTo(int32_t aX, int32_t aY, bool restoreImage)
|
||||
FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsIPresShell *shell = GetShell();
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
|
@ -186,9 +186,6 @@ PluginDocument::StartDocumentLoad(const char* aCommand,
|
||||
MediaDocument::UpdateTitleAndCharset(mMimeType);
|
||||
|
||||
mStreamListener = new PluginStreamListener(this);
|
||||
if (!mStreamListener) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ASSERTION(aDocListener, "null aDocListener");
|
||||
NS_ADDREF(*aDocListener = mStreamListener);
|
||||
|
||||
@ -288,9 +285,6 @@ nsresult
|
||||
NS_NewPluginDocument(nsIDocument** aResult)
|
||||
{
|
||||
mozilla::dom::PluginDocument* doc = new mozilla::dom::PluginDocument();
|
||||
if (!doc) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(doc);
|
||||
nsresult rv = doc->Init();
|
||||
|
@ -933,9 +933,6 @@ SinkContext::GrowStack()
|
||||
}
|
||||
|
||||
Node* stack = new Node[newSize];
|
||||
if (!stack) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (mStackPos != 0) {
|
||||
memcpy(stack, mStack, sizeof(Node) * mStackPos);
|
||||
@ -967,9 +964,6 @@ SinkContext::AddText(const nsAString& aText)
|
||||
// Create buffer when we first need it
|
||||
if (mTextSize == 0) {
|
||||
mText = new PRUnichar[4096];
|
||||
if (!mText) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mTextSize = 4096;
|
||||
}
|
||||
|
||||
@ -1205,10 +1199,6 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult,
|
||||
|
||||
nsRefPtr<HTMLContentSink> it = new HTMLContentSink();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1402,7 +1392,6 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
||||
mRoot->AppendChildTo(mHead, false);
|
||||
|
||||
mCurrentContext = new SinkContext(this);
|
||||
NS_ENSURE_TRUE(mCurrentContext, NS_ERROR_OUT_OF_MEMORY);
|
||||
mCurrentContext->Begin(eHTMLTag_html, mRoot, 0, -1);
|
||||
mContextStack.AppendElement(mCurrentContext);
|
||||
|
||||
@ -1879,7 +1868,6 @@ HTMLContentSink::OpenHeadContext()
|
||||
|
||||
if (!mHeadContext) {
|
||||
mHeadContext = new SinkContext(this);
|
||||
NS_ENSURE_TRUE(mHeadContext, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = mHeadContext->Begin(eHTMLTag_head, mHead, 0, -1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -3751,7 +3751,6 @@ nsHTMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
"Can't import this document into another document!");
|
||||
|
||||
nsRefPtr<nsHTMLDocument> clone = new nsHTMLDocument();
|
||||
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsresult rv = CloneDocHelper(clone.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -14,7 +14,6 @@ NS_NewMathMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInf
|
||||
aNodeInfo.get()->SetIDAttributeAtom(nsGkAtoms::id);
|
||||
|
||||
nsMathMLElement* it = new nsMathMLElement(aNodeInfo);
|
||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aResult = it);
|
||||
return NS_OK;
|
||||
|
@ -160,7 +160,9 @@ class AudioEventTimeline
|
||||
{
|
||||
public:
|
||||
explicit AudioEventTimeline(float aDefaultValue)
|
||||
: mValue(aDefaultValue)
|
||||
: mValue(aDefaultValue),
|
||||
mComputedValue(aDefaultValue),
|
||||
mLastComputedValue(aDefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -186,7 +188,7 @@ public:
|
||||
{
|
||||
// Silently don't change anything if there are any events
|
||||
if (mEvents.IsEmpty()) {
|
||||
mValue = aValue;
|
||||
mLastComputedValue = mComputedValue = mValue = aValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,9 +239,29 @@ public:
|
||||
mEvents.Clear();
|
||||
}
|
||||
|
||||
static bool TimesEqual(int64_t aLhs, int64_t aRhs)
|
||||
{
|
||||
return aLhs == aRhs;
|
||||
}
|
||||
|
||||
// Since we are going to accumulate error by adding 0.01 multiple time in a
|
||||
// loop, we want to fuzz the equality check in GetValueAtTime.
|
||||
static bool TimesEqual(double aLhs, double aRhs)
|
||||
{
|
||||
const float kEpsilon = 0.0000000001f;
|
||||
return fabs(aLhs - aRhs) < kEpsilon;
|
||||
}
|
||||
|
||||
template<class TimeType>
|
||||
float GetValueAtTime(TimeType aTime)
|
||||
{
|
||||
mComputedValue = GetValueAtTimeHelper(aTime);
|
||||
return mComputedValue;
|
||||
}
|
||||
|
||||
// This method computes the AudioParam value at a given time based on the event timeline
|
||||
template<class TimeType>
|
||||
float GetValueAtTime(TimeType aTime) const
|
||||
float GetValueAtTimeHelper(TimeType aTime)
|
||||
{
|
||||
const AudioTimelineEvent* previous = nullptr;
|
||||
const AudioTimelineEvent* next = nullptr;
|
||||
@ -252,7 +274,8 @@ public:
|
||||
case AudioTimelineEvent::LinearRamp:
|
||||
case AudioTimelineEvent::ExponentialRamp:
|
||||
case AudioTimelineEvent::SetValueCurve:
|
||||
if (aTime == mEvents[i].template Time<TimeType>()) {
|
||||
if (TimesEqual(aTime, mEvents[i].template Time<TimeType>())) {
|
||||
mLastComputedValue = mComputedValue;
|
||||
// Find the last event with the same time
|
||||
do {
|
||||
++i;
|
||||
@ -261,13 +284,14 @@ public:
|
||||
|
||||
// SetTarget nodes can be handled no matter what their next node is (if they have one)
|
||||
if (mEvents[i - 1].mType == AudioTimelineEvent::SetTarget) {
|
||||
// Follow the curve, without regard to the next node
|
||||
// Follow the curve, without regard to the next event, starting at
|
||||
// the last value of the last event.
|
||||
return ExponentialApproach(mEvents[i - 1].template Time<TimeType>(),
|
||||
mValue, mEvents[i - 1].mValue,
|
||||
mLastComputedValue, mEvents[i - 1].mValue,
|
||||
mEvents[i - 1].mTimeConstant, aTime);
|
||||
}
|
||||
|
||||
// SetValueCurve events can be handled no mattar what their next node is (if they have one)
|
||||
// SetValueCurve events can be handled no matter what their event node is (if they have one)
|
||||
if (mEvents[i - 1].mType == AudioTimelineEvent::SetValueCurve) {
|
||||
return ExtractValueFromCurve(mEvents[i - 1].template Time<TimeType>(),
|
||||
mEvents[i - 1].mCurve,
|
||||
@ -306,8 +330,8 @@ public:
|
||||
|
||||
// SetTarget nodes can be handled no matter what their next node is (if they have one)
|
||||
if (previous->mType == AudioTimelineEvent::SetTarget) {
|
||||
// Follow the curve, without regard to the next node
|
||||
return ExponentialApproach(previous->template Time<TimeType>(), mValue, previous->mValue,
|
||||
return ExponentialApproach(previous->template Time<TimeType>(),
|
||||
mLastComputedValue, previous->mValue,
|
||||
previous->mTimeConstant, aTime);
|
||||
}
|
||||
|
||||
@ -540,6 +564,10 @@ private:
|
||||
// being a bottleneck.
|
||||
nsTArray<AudioTimelineEvent> mEvents;
|
||||
float mValue;
|
||||
// This is the value of this AudioParam we computed at the last call.
|
||||
float mComputedValue;
|
||||
// This is the value of this AudioParam at the last tick of the previous event.
|
||||
float mLastComputedValue;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,6 @@ public:
|
||||
|
||||
void SetStartTime(double aStartTime)
|
||||
{
|
||||
//XXXhumph: validate? bug 868519.
|
||||
if (mStartTime == aStartTime)
|
||||
return;
|
||||
|
||||
@ -101,7 +100,6 @@ public:
|
||||
|
||||
void SetEndTime(double aEndTime)
|
||||
{
|
||||
//XXXhumph: validate? bug 868519.
|
||||
if (mEndTime == aEndTime)
|
||||
return;
|
||||
|
||||
@ -128,11 +126,16 @@ public:
|
||||
aVertical = mVertical;
|
||||
}
|
||||
|
||||
void SetVertical(const nsAString& aVertical)
|
||||
void SetVertical(const nsAString& aVertical, ErrorResult& aRv)
|
||||
{
|
||||
if (mVertical == aVertical)
|
||||
return;
|
||||
|
||||
if (!aVertical.EqualsLiteral("rl") && !aVertical.EqualsLiteral("lr") && !aVertical.IsEmpty()){
|
||||
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
mVertical = aVertical;
|
||||
CueChanged();
|
||||
@ -160,7 +163,7 @@ public:
|
||||
|
||||
void SetLine(double aLine)
|
||||
{
|
||||
//XXX: validate? bug 868519.
|
||||
//XXX: TODO Line position can be a keyword auto. bug882299
|
||||
mReset = true;
|
||||
mLine = aLine;
|
||||
}
|
||||
@ -170,12 +173,17 @@ public:
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
void SetPosition(int32_t aPosition)
|
||||
void SetPosition(int32_t aPosition, ErrorResult& aRv)
|
||||
{
|
||||
// XXXhumph: validate? bug 868519.
|
||||
if (mPosition == aPosition)
|
||||
return;
|
||||
|
||||
if (aPosition > 100 || aPosition < 0){
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
mPosition = aPosition;
|
||||
CueChanged();
|
||||
@ -186,14 +194,15 @@ public:
|
||||
return mSize;
|
||||
}
|
||||
|
||||
void SetSize(int32_t aSize)
|
||||
void SetSize(int32_t aSize, ErrorResult& aRv)
|
||||
{
|
||||
if (mSize == aSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aSize < 0 || aSize > 100) {
|
||||
//XXX:throw IndexSizeError; bug 868519.
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
mReset = true;
|
||||
@ -223,7 +232,6 @@ public:
|
||||
|
||||
void SetText(const nsAString& aText)
|
||||
{
|
||||
// XXXhumph: validate? bug 868519.
|
||||
if (mText == aText)
|
||||
return;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "MediaStreamGraph.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/AudioContextBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// getting the value of an a-rate AudioParam for each tick inside an
|
||||
// AudioNodeEngine implementation.
|
||||
template<class TimeType>
|
||||
float GetValueAtTime(TimeType aTime, size_t aCounter = 0) const
|
||||
float GetValueAtTime(TimeType aTime, size_t aCounter = 0)
|
||||
{
|
||||
MOZ_ASSERT(aCounter < WEBAUDIO_BLOCK_SIZE);
|
||||
MOZ_ASSERT(!aCounter || !HasSimpleValue());
|
||||
|
@ -314,6 +314,15 @@ void TestAfterLastTargetValueEventWithValueSet()
|
||||
|
||||
timeline.SetValue(50.f);
|
||||
timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
|
||||
|
||||
// When using SetTargetValueAtTime, Timeline become stateful: the value for
|
||||
// time t may depend on the time t-1, so we can't just query the value at a
|
||||
// time and get the right value. We have to call GetValueAtTime for the
|
||||
// previous times.
|
||||
for (double i = 0.0; i < 9.99; i+=0.01) {
|
||||
timeline.GetValueAtTime(i);
|
||||
}
|
||||
|
||||
is(timeline.GetValueAtTime(10.), (20.f + (50.f - 20.f) * expf(-9.0f / 5.0f)), "Return the value after SetValue and the last SetTarget event based on the curve");
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var V0 = 0.1;
|
||||
var V1 = 0.9;
|
||||
var V0 = 0.9;
|
||||
var V1 = 0.1;
|
||||
var T0 = 0;
|
||||
var TimeConstant = 10;
|
||||
|
||||
|
@ -744,7 +744,6 @@ SVGSVGElement::BindToTree(nsIDocument* aDocument,
|
||||
// We'll be the outermost <svg> element. We'll need a time container.
|
||||
if (!mTimedDocumentRoot) {
|
||||
mTimedDocumentRoot = new nsSMILTimeContainer();
|
||||
NS_ENSURE_TRUE(mTimedDocumentRoot, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
} else {
|
||||
// We're a child of some other <svg> element, so we don't need our own
|
||||
|
@ -99,9 +99,6 @@ SVGUseElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
*aResult = nullptr;
|
||||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
SVGUseElement *it = new SVGUseElement(ni.forget());
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip(it);
|
||||
nsresult rv1 = it->Init();
|
||||
|
@ -62,7 +62,6 @@ SVGDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
"Can't import this document into another document!");
|
||||
|
||||
nsRefPtr<SVGDocument> clone = new SVGDocument();
|
||||
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsresult rv = CloneDocHelper(clone.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -219,7 +219,7 @@ DocumentInfoHashtableTraverser(nsIURI* key,
|
||||
nsCycleCollectionTraversalCallback *cb =
|
||||
static_cast<nsCycleCollectionTraversalCallback*>(userArg);
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, "mDocumentTable value");
|
||||
cb->NoteXPCOMChild(static_cast<nsIScriptGlobalObjectOwner*>(di));
|
||||
cb->NoteXPCOMChild(di);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
|
@ -74,13 +74,13 @@ XBLFinalize(JSFreeOp *fop, JSObject *obj)
|
||||
{
|
||||
nsXBLDocumentInfo* docInfo =
|
||||
static_cast<nsXBLDocumentInfo*>(::JS_GetPrivate(obj));
|
||||
nsContentUtils::DeferredFinalize(static_cast<nsIScriptGlobalObjectOwner*>(docInfo));
|
||||
nsContentUtils::DeferredFinalize(docInfo);
|
||||
|
||||
nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GetClass(obj));
|
||||
c->Drop();
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
XBLEnumerate(JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
nsXBLPrototypeBinding* protoBinding =
|
||||
@ -178,8 +178,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLBinding)
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
|
||||
"mPrototypeBinding->XBLDocumentInfo()");
|
||||
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObjectOwner*>(
|
||||
tmp->mPrototypeBinding->XBLDocumentInfo()));
|
||||
cb.NoteXPCOMChild(tmp->mPrototypeBinding->XBLDocumentInfo());
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNextBinding)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDefaultInsertionPoint)
|
||||
|
@ -41,56 +41,36 @@ static const char kXBLCachePrefix[] = "xblcache";
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
// An XBLDocumentInfo object has a special context associated with it which we can use to pre-compile
|
||||
// properties and methods of XBL bindings against.
|
||||
class nsXBLDocGlobalObject : public nsIScriptGlobalObject
|
||||
class nsXBLDocGlobalObject : public nsISupports
|
||||
{
|
||||
public:
|
||||
nsXBLDocGlobalObject(nsXBLDocumentInfo *aGlobalObjectOwner);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocGlobalObject)
|
||||
|
||||
// nsIGlobalObject methods
|
||||
virtual JSObject *GetGlobalJSObject();
|
||||
|
||||
// nsIScriptGlobalObject methods
|
||||
virtual nsresult EnsureScriptEnvironment();
|
||||
void ClearScriptContext()
|
||||
{
|
||||
mScriptContext = nullptr;
|
||||
}
|
||||
JSObject *GetCompilationGlobal();
|
||||
void UnmarkCompilationGlobal();
|
||||
void Destroy();
|
||||
nsIPrincipal* GetPrincipal();
|
||||
|
||||
virtual nsIScriptContext *GetContext();
|
||||
virtual void OnFinalize(JSObject* aObject);
|
||||
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
||||
|
||||
// nsIScriptObjectPrincipal methods
|
||||
virtual nsIPrincipal* GetPrincipal();
|
||||
|
||||
static JSBool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, uint32_t accessType);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXBLDocGlobalObject,
|
||||
nsIScriptGlobalObject)
|
||||
static bool doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, uint32_t accessType);
|
||||
|
||||
void ClearGlobalObjectOwner();
|
||||
|
||||
void UnmarkScriptContext();
|
||||
static JSClass gSharedGlobalClass;
|
||||
|
||||
protected:
|
||||
virtual ~nsXBLDocGlobalObject();
|
||||
|
||||
nsIScriptContext *GetScriptContext();
|
||||
|
||||
nsCOMPtr<nsIScriptContext> mScriptContext;
|
||||
JSObject *mJSObject;
|
||||
|
||||
JS::Heap<JSObject*> mJSObject;
|
||||
nsXBLDocumentInfo* mGlobalObjectOwner; // weak reference
|
||||
static JSClass gSharedGlobalClass;
|
||||
bool mDestroyed; // Probably not necessary, but let's be safe.
|
||||
};
|
||||
|
||||
JSBool
|
||||
bool
|
||||
nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, uint32_t accessType)
|
||||
{
|
||||
@ -118,7 +98,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
nsXBLDocGlobalObject_getProperty(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
@ -126,15 +106,15 @@ nsXBLDocGlobalObject_getProperty(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
nsXBLDocGlobalObject_setProperty(JSContext *cx, JS::Handle<JSObject*> obj,
|
||||
JS::Handle<jsid> id, JSBool strict, JS::MutableHandle<JS::Value> vp)
|
||||
JS::Handle<jsid> id, bool strict, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
return nsXBLDocGlobalObject::
|
||||
doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
nsXBLDocGlobalObject_checkAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JSAccessMode mode, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
@ -153,20 +133,20 @@ static void
|
||||
nsXBLDocGlobalObject_finalize(JSFreeOp *fop, JSObject *obj)
|
||||
{
|
||||
nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(obj);
|
||||
nsXBLDocGlobalObject* dgo = static_cast<nsXBLDocGlobalObject*>(nativeThis);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(nativeThis));
|
||||
if (dgo)
|
||||
dgo->Destroy();
|
||||
|
||||
if (sgo)
|
||||
sgo->OnFinalize(obj);
|
||||
|
||||
// The addref was part of JSObject construction
|
||||
NS_RELEASE(nativeThis);
|
||||
// The addref was part of JSObject construction. Note that this effectively
|
||||
// just calls release later on.
|
||||
nsContentUtils::DeferredFinalize(nativeThis);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
static bool
|
||||
nsXBLDocGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id)
|
||||
{
|
||||
JSBool did_resolve = false;
|
||||
bool did_resolve = false;
|
||||
return JS_ResolveStandardClass(cx, obj, id, &did_resolve);
|
||||
}
|
||||
|
||||
@ -189,107 +169,41 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
|
||||
//
|
||||
|
||||
nsXBLDocGlobalObject::nsXBLDocGlobalObject(nsXBLDocumentInfo *aGlobalObjectOwner)
|
||||
: mJSObject(nullptr),
|
||||
mGlobalObjectOwner(aGlobalObjectOwner) // weak reference
|
||||
: mJSObject(nullptr)
|
||||
, mGlobalObjectOwner(aGlobalObjectOwner) // weak reference
|
||||
, mDestroyed(false)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsXBLDocGlobalObject::~nsXBLDocGlobalObject()
|
||||
{}
|
||||
{
|
||||
MOZ_ASSERT(!mJSObject);
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsXBLDocGlobalObject, mScriptContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocGlobalObject)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXBLDocGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocGlobalObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mJSObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocGlobalObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocGlobalObject)
|
||||
tmp->Destroy();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXBLDocGlobalObject)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXBLDocGlobalObject)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsIScriptGlobalObject methods
|
||||
//
|
||||
|
||||
nsIScriptContext *
|
||||
nsXBLDocGlobalObject::GetScriptContext()
|
||||
{
|
||||
return GetContext();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLDocGlobalObject::EnsureScriptEnvironment()
|
||||
{
|
||||
if (mScriptContext) {
|
||||
// Already initialized.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptRuntime> scriptRuntime;
|
||||
NS_GetJSRuntime(getter_AddRefs(scriptRuntime));
|
||||
NS_ENSURE_TRUE(scriptRuntime, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIScriptContext> newCtx = scriptRuntime->CreateContext(false, nullptr);
|
||||
MOZ_ASSERT(newCtx);
|
||||
|
||||
newCtx->WillInitializeContext();
|
||||
// NOTE: We init this context with a nullptr global, so we automatically
|
||||
// hook up to the existing nsIScriptGlobalObject global setup by
|
||||
// nsGlobalWindow.
|
||||
DebugOnly<nsresult> rv = newCtx->InitContext();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Script Language's InitContext failed");
|
||||
newCtx->DidInitializeContext();
|
||||
|
||||
mScriptContext = newCtx;
|
||||
|
||||
AutoPushJSContext cx(mScriptContext->GetNativeContext());
|
||||
|
||||
JS_SetErrorReporter(cx, xpc::SystemErrorReporter);
|
||||
|
||||
JS::CompartmentOptions options;
|
||||
options.setZone(JS::SystemZone)
|
||||
.setInvisibleToDebugger(true);
|
||||
mJSObject = JS_NewGlobalObject(cx, &gSharedGlobalClass,
|
||||
nsJSPrincipals::get(GetPrincipal()),
|
||||
JS::DontFireOnNewGlobalHook,
|
||||
options);
|
||||
if (!mJSObject)
|
||||
return NS_OK;
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
nsIURI *ownerURI = mGlobalObjectOwner->DocumentURI();
|
||||
xpc::SetLocationForGlobal(mJSObject, ownerURI);
|
||||
|
||||
js::SetDefaultObjectForContext(cx, mJSObject);
|
||||
|
||||
// Add an owning reference from JS back to us. This'll be
|
||||
// released when the JSObject is finalized.
|
||||
::JS_SetPrivate(mJSObject, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScriptContext *
|
||||
nsXBLDocGlobalObject::GetContext()
|
||||
{
|
||||
// This whole fragile mess is predicated on the fact that
|
||||
// GetContext() will be called before GetScriptObject() is.
|
||||
if (! mScriptContext) {
|
||||
nsresult rv = EnsureScriptEnvironment();
|
||||
// JS is builtin so we make noise if it fails to initialize.
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to setup JS!?");
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
NS_ASSERTION(mScriptContext, "Failed to find a script context!?");
|
||||
}
|
||||
return mScriptContext;
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::ClearGlobalObjectOwner()
|
||||
{
|
||||
@ -297,42 +211,57 @@ nsXBLDocGlobalObject::ClearGlobalObjectOwner()
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::UnmarkScriptContext()
|
||||
nsXBLDocGlobalObject::UnmarkCompilationGlobal()
|
||||
{
|
||||
if (mScriptContext) {
|
||||
xpc_UnmarkGrayObject(mScriptContext->GetNativeGlobal());
|
||||
}
|
||||
xpc_UnmarkGrayObject(mJSObject);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
nsXBLDocGlobalObject::GetGlobalJSObject()
|
||||
nsXBLDocGlobalObject::GetCompilationGlobal()
|
||||
{
|
||||
// The prototype document has its own special secret script object
|
||||
// that can be used to compile scripts and event handlers.
|
||||
if (mJSObject || mDestroyed) {
|
||||
// We've been initialized before - what we have is what you get.
|
||||
return mJSObject;
|
||||
}
|
||||
|
||||
if (!mScriptContext)
|
||||
return nullptr;
|
||||
AutoSafeJSContext cx;
|
||||
JS::CompartmentOptions options;
|
||||
options.setZone(JS::SystemZone)
|
||||
.setInvisibleToDebugger(true);
|
||||
mJSObject = JS_NewGlobalObject(cx, &gSharedGlobalClass,
|
||||
nsJSPrincipals::get(GetPrincipal()),
|
||||
JS::DontFireOnNewGlobalHook,
|
||||
options);
|
||||
if (!mJSObject)
|
||||
return nullptr;
|
||||
|
||||
return mScriptContext->GetNativeGlobal();
|
||||
NS_HOLD_JS_OBJECTS(this, nsXBLDocGlobalObject);
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
nsIURI *ownerURI = mGlobalObjectOwner->DocumentURI();
|
||||
xpc::SetLocationForGlobal(mJSObject, ownerURI);
|
||||
|
||||
// Add an owning reference from JS back to us. This'll be
|
||||
// released when the JSObject is finalized.
|
||||
::JS_SetPrivate(mJSObject, this);
|
||||
NS_ADDREF(this);
|
||||
return mJSObject;
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::OnFinalize(JSObject* aObject)
|
||||
nsXBLDocGlobalObject::Destroy()
|
||||
{
|
||||
NS_ASSERTION(aObject == mJSObject, "Wrong object finalized!");
|
||||
// Maintain indempotence.
|
||||
mDestroyed = true;
|
||||
if (!mJSObject)
|
||||
return;
|
||||
mJSObject = nullptr;
|
||||
NS_DROP_JS_OBJECTS(this, nsXBLDocGlobalObject);
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::SetScriptsEnabled(bool aEnabled, bool aFireTimeouts)
|
||||
{
|
||||
// We don't care...
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsIScriptObjectPrincipal methods
|
||||
//
|
||||
|
||||
nsIPrincipal*
|
||||
nsXBLDocGlobalObject::GetPrincipal()
|
||||
@ -415,8 +344,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo)
|
||||
if (tmp->mBindingTable) {
|
||||
tmp->mBindingTable->Enumerate(TraverseProtos, &cb);
|
||||
}
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mGlobalObject");
|
||||
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObject*>(tmp->mGlobalObject));
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobalObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo)
|
||||
@ -451,14 +379,13 @@ nsXBLDocumentInfo::MarkInCCGeneration(uint32_t aGeneration)
|
||||
mBindingTable->Enumerate(UnmarkProtos, nullptr);
|
||||
}
|
||||
if (mGlobalObject) {
|
||||
mGlobalObject->UnmarkScriptContext();
|
||||
mGlobalObject->UnmarkCompilationGlobal();
|
||||
}
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXBLDocumentInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObjectOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObjectOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXBLDocumentInfo)
|
||||
@ -489,8 +416,6 @@ nsXBLDocumentInfo::~nsXBLDocumentInfo()
|
||||
{
|
||||
/* destructor code */
|
||||
if (mGlobalObject) {
|
||||
// remove circular reference
|
||||
mGlobalObject->ClearScriptContext();
|
||||
mGlobalObject->ClearGlobalObjectOwner(); // just in case
|
||||
}
|
||||
if (mBindingTable) {
|
||||
@ -694,21 +619,27 @@ nsXBLDocumentInfo::FlushSkinStylesheets()
|
||||
mBindingTable->Enumerate(FlushScopedSkinSheets);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsIScriptGlobalObjectOwner methods
|
||||
//
|
||||
JSObject*
|
||||
nsXBLDocumentInfo::GetCompilationGlobal()
|
||||
{
|
||||
EnsureGlobalObject();
|
||||
return mGlobalObject->GetCompilationGlobal();
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject*
|
||||
nsXBLDocumentInfo::GetScriptGlobalObject()
|
||||
void
|
||||
nsXBLDocumentInfo::EnsureGlobalObject()
|
||||
{
|
||||
if (!mGlobalObject) {
|
||||
nsXBLDocGlobalObject *global = new nsXBLDocGlobalObject(this);
|
||||
if (!global)
|
||||
return nullptr;
|
||||
|
||||
mGlobalObject = global;
|
||||
mGlobalObject = new nsXBLDocGlobalObject(this);
|
||||
}
|
||||
|
||||
return mGlobalObject;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
AssertInCompilationScope()
|
||||
{
|
||||
AutoJSContext cx;
|
||||
MOZ_ASSERT(JS_GetClass(JS::CurrentGlobalOrNull(cx)) ==
|
||||
&nsXBLDocGlobalObject::gSharedGlobalClass);
|
||||
}
|
||||
#endif
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIScriptGlobalObjectOwner.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -17,8 +16,7 @@ class nsXBLPrototypeBinding;
|
||||
class nsObjectHashtable;
|
||||
class nsXBLDocGlobalObject;
|
||||
|
||||
class nsXBLDocumentInfo : public nsIScriptGlobalObjectOwner,
|
||||
public nsSupportsWeakReference
|
||||
class nsXBLDocumentInfo : public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
@ -48,17 +46,16 @@ public:
|
||||
|
||||
bool IsChrome() { return mIsChrome; }
|
||||
|
||||
// nsIScriptGlobalObjectOwner methods
|
||||
virtual nsIScriptGlobalObject* GetScriptGlobalObject() MOZ_OVERRIDE;
|
||||
JSObject* GetCompilationGlobal();
|
||||
|
||||
void MarkInCCGeneration(uint32_t aGeneration);
|
||||
|
||||
static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsXBLDocumentInfo,
|
||||
nsIScriptGlobalObjectOwner)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
|
||||
|
||||
private:
|
||||
void EnsureGlobalObject();
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
bool mScriptAccess;
|
||||
bool mIsChrome;
|
||||
@ -70,4 +67,10 @@ private:
|
||||
nsRefPtr<nsXBLDocGlobalObject> mGlobalObject;
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertInCompilationScope();
|
||||
#else
|
||||
inline void AssertInCompilationScope() {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptGlobalObjectOwner.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -41,16 +40,17 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
||||
|
||||
nsCOMPtr<nsIScriptContext> context = global->GetContext();
|
||||
if (!context) return NS_OK;
|
||||
JSContext* cx = context->GetNativeContext();
|
||||
AutoCxPusher pusher(cx);
|
||||
|
||||
// InitTarget objects gives us back the JS object that represents the bound element and the
|
||||
// class object in the bound document that represents the concrete version of this implementation.
|
||||
// This function also has the side effect of building up the prototype implementation if it has
|
||||
// not been built already.
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
JSAutoRequest ar(context->GetNativeContext());
|
||||
JS::Rooted<JSObject*> targetClassObject(context->GetNativeContext(), nullptr);
|
||||
JS::Rooted<JSObject*> targetClassObject(cx, nullptr);
|
||||
bool targetObjectIsNew = false;
|
||||
nsresult rv = InitTargetObjects(aPrototypeBinding, context,
|
||||
nsresult rv = InitTargetObjects(aPrototypeBinding,
|
||||
aBinding->GetBoundElement(),
|
||||
getter_AddRefs(holder), &targetClassObject,
|
||||
&targetObjectIsNew);
|
||||
@ -64,10 +64,8 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
||||
if (!targetObjectIsNew)
|
||||
return NS_OK;
|
||||
|
||||
JS::Rooted<JSObject*> targetScriptObject(context->GetNativeContext(),
|
||||
holder->GetJSObject());
|
||||
JS::Rooted<JSObject*> targetScriptObject(cx, holder->GetJSObject());
|
||||
|
||||
AutoPushJSContext cx(context->GetNativeContext());
|
||||
JSAutoCompartment ac(cx, targetClassObject);
|
||||
|
||||
// Walk our member list and install each one in turn.
|
||||
@ -125,7 +123,6 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
|
||||
nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
nsIXPConnectJSObjectHolder** aScriptObjectHolder,
|
||||
JS::MutableHandle<JSObject*> aTargetClassObject,
|
||||
@ -153,7 +150,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
|
||||
|
||||
// Because our prototype implementation has a class, we need to build up a corresponding
|
||||
// class for the concrete implementation in the bound document.
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
@ -185,21 +182,14 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
|
||||
// We want to pre-compile our implementation's members against a "prototype context". Then when we actually
|
||||
// bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's
|
||||
// context.
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner(
|
||||
do_QueryObject(aBinding->XBLDocumentInfo()));
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> compilationGlobal(cx, aBinding->XBLDocumentInfo()->GetCompilationGlobal());
|
||||
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
|
||||
JSAutoCompartment ac(cx, compilationGlobal);
|
||||
|
||||
nsIScriptGlobalObject* globalObject = globalOwner->GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsIScriptContext *context = globalObject->GetContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
AutoPushJSContext cx(context->GetNativeContext());
|
||||
|
||||
JS::Rooted<JSObject*> global(cx, globalObject->GetGlobalJSObject());
|
||||
JS::Rooted<JSObject*> classObject(cx);
|
||||
bool classObjectIsNew = false;
|
||||
nsresult rv = aBinding->InitClass(mClassName, cx, global, global,
|
||||
nsresult rv = aBinding->InitClass(mClassName, cx, compilationGlobal, compilationGlobal,
|
||||
&classObject, &classObjectIsNew);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
@ -213,7 +203,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
|
||||
for (nsXBLProtoImplMember* curr = mMembers;
|
||||
curr;
|
||||
curr = curr->GetNext()) {
|
||||
nsresult rv = curr->CompileMember(context, mClassName, classObject);
|
||||
nsresult rv = curr->CompileMember(mClassName, classObject);
|
||||
if (NS_FAILED(rv)) {
|
||||
DestroyMembers();
|
||||
return rv;
|
||||
@ -300,7 +290,7 @@ nsXBLProtoImpl::UndefineFields(JSContext *cx, JS::Handle<JSObject*> obj) const
|
||||
nsDependentString name(f->GetName());
|
||||
|
||||
const jschar* s = reinterpret_cast<const jschar*>(name.get());
|
||||
JSBool hasProp;
|
||||
bool hasProp;
|
||||
if (::JS_AlreadyHasOwnUCProperty(cx, obj, s, name.Length(), &hasProp) &&
|
||||
hasProp) {
|
||||
bool dummy;
|
||||
@ -321,14 +311,13 @@ nsXBLProtoImpl::DestroyMembers()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding,
|
||||
nsIScriptGlobalObject* aGlobal)
|
||||
nsXBLProtoImpl::Read(nsIObjectInputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
AutoJSContext cx;
|
||||
// Set up a class object first so that deserialization is possible
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
JS::Rooted<JSObject*> global(cx, aGlobal->GetGlobalJSObject());
|
||||
JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
|
||||
|
||||
JS::Rooted<JSObject*> classObject(cx);
|
||||
bool classObjectIsNew = false;
|
||||
@ -355,7 +344,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
{
|
||||
nsXBLProtoImplField* field =
|
||||
new nsXBLProtoImplField(type & XBLBinding_Serialize_ReadOnly);
|
||||
rv = field->Read(aContext, aStream);
|
||||
rv = field->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete field;
|
||||
return rv;
|
||||
@ -381,7 +370,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
|
||||
nsXBLProtoImplProperty* prop =
|
||||
new nsXBLProtoImplProperty(name.get(), type & XBLBinding_Serialize_ReadOnly);
|
||||
rv = prop->Read(aContext, aStream, type & XBLBinding_Serialize_Mask);
|
||||
rv = prop->Read(aStream, type & XBLBinding_Serialize_Mask);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete prop;
|
||||
return rv;
|
||||
@ -397,7 +386,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXBLProtoImplMethod* method = new nsXBLProtoImplMethod(name.get());
|
||||
rv = method->Read(aContext, aStream);
|
||||
rv = method->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete method;
|
||||
return rv;
|
||||
@ -409,7 +398,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
case XBLBinding_Serialize_Constructor:
|
||||
{
|
||||
mConstructor = new nsXBLProtoImplAnonymousMethod();
|
||||
rv = mConstructor->Read(aContext, aStream);
|
||||
rv = mConstructor->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete mConstructor;
|
||||
mConstructor = nullptr;
|
||||
@ -422,7 +411,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
case XBLBinding_Serialize_Destructor:
|
||||
{
|
||||
mDestructor = new nsXBLProtoImplAnonymousMethod();
|
||||
rv = mDestructor->Read(aContext, aStream);
|
||||
rv = mDestructor->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete mDestructor;
|
||||
mDestructor = nullptr;
|
||||
@ -442,8 +431,7 @@ nsXBLProtoImpl::Read(nsIScriptContext* aContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImpl::Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
nsXBLProtoImpl::Write(nsIObjectOutputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding)
|
||||
{
|
||||
nsresult rv;
|
||||
@ -457,18 +445,18 @@ nsXBLProtoImpl::Write(nsIScriptContext* aContext,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (nsXBLProtoImplField* curr = mFields; curr; curr = curr->GetNext()) {
|
||||
rv = curr->Write(aContext, aStream);
|
||||
rv = curr->Write(aStream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
for (nsXBLProtoImplMember* curr = mMembers; curr; curr = curr->GetNext()) {
|
||||
if (curr == mConstructor) {
|
||||
rv = mConstructor->Write(aContext, aStream, XBLBinding_Serialize_Constructor);
|
||||
rv = mConstructor->Write(aStream, XBLBinding_Serialize_Constructor);
|
||||
}
|
||||
else if (curr == mDestructor) {
|
||||
rv = mDestructor->Write(aContext, aStream, XBLBinding_Serialize_Destructor);
|
||||
rv = mDestructor->Write(aStream, XBLBinding_Serialize_Destructor);
|
||||
}
|
||||
else {
|
||||
rv = curr->Write(aContext, aStream);
|
||||
rv = curr->Write(aStream);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
|
||||
nsresult InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding, nsXBLBinding* aBinding);
|
||||
nsresult InitTargetObjects(nsXBLPrototypeBinding* aBinding, nsIScriptContext* aContext,
|
||||
nsresult InitTargetObjects(nsXBLPrototypeBinding* aBinding,
|
||||
nsIContent* aBoundElement,
|
||||
nsIXPConnectJSObjectHolder** aScriptObjectHolder,
|
||||
JS::MutableHandle<JSObject*> aTargetClassObject,
|
||||
@ -77,12 +77,9 @@ public:
|
||||
return mClassObject != nullptr;
|
||||
}
|
||||
|
||||
nsresult Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding,
|
||||
nsIScriptGlobalObject* aGlobal);
|
||||
nsresult Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
nsresult Read(nsIObjectInputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding);
|
||||
nsresult Write(nsIObjectOutputStream* aStream,
|
||||
nsXBLPrototypeBinding* aBinding);
|
||||
|
||||
protected:
|
||||
|
@ -125,7 +125,7 @@ ValueHasISupportsPrivate(const JS::Value &v)
|
||||
// contents of the callee's reserved slots. If the property was defined,
|
||||
// *installed will be true, and idp will be set to the property name that was
|
||||
// defined.
|
||||
static JSBool
|
||||
static bool
|
||||
InstallXBLField(JSContext* cx,
|
||||
JS::Handle<JSObject*> callee, JS::Handle<JSObject*> thisObj,
|
||||
JS::MutableHandle<jsid> idp, bool* installed)
|
||||
@ -323,7 +323,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
|
||||
// Properties/Methods have historically taken precendence over fields. We
|
||||
// install members first, so just bounce here if the property is already
|
||||
// defined.
|
||||
JSBool found = false;
|
||||
bool found = false;
|
||||
if (!JS_AlreadyHasOwnPropertyById(aCx, aTargetClassObject, id, &found))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (found)
|
||||
@ -407,9 +407,6 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
|
||||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
"Shouldn't get here when an exception is pending!");
|
||||
|
||||
// compile the literal string
|
||||
nsCOMPtr<nsIScriptContext> context = aContext;
|
||||
|
||||
// First, enter the xbl scope, wrap the node, and use that as the scope for
|
||||
// the evaluation.
|
||||
JS::Rooted<JSObject*> scopeObject(cx, xpc::GetXBLScope(cx, aBoundNode));
|
||||
@ -424,11 +421,11 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
|
||||
JS::CompileOptions options(cx);
|
||||
options.setFileAndLine(uriSpec.get(), mLineNumber)
|
||||
.setVersion(JSVERSION_LATEST);
|
||||
rv = context->EvaluateString(nsDependentString(mFieldText,
|
||||
mFieldTextLength),
|
||||
wrappedNode, options,
|
||||
/* aCoerceToString = */ false,
|
||||
result.address());
|
||||
rv = aContext->EvaluateString(nsDependentString(mFieldText,
|
||||
mFieldTextLength),
|
||||
wrappedNode, options,
|
||||
/* aCoerceToString = */ false,
|
||||
result.address());
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -451,8 +448,7 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplField::Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream)
|
||||
nsXBLProtoImplField::Read(nsIObjectInputStream* aStream)
|
||||
{
|
||||
nsAutoString name;
|
||||
nsresult rv = aStream->ReadString(name);
|
||||
@ -473,8 +469,7 @@ nsXBLProtoImplField::Read(nsIScriptContext* aContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplField::Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream)
|
||||
nsXBLProtoImplField::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
XBLBindingSerializeDetails type = XBLBinding_Serialize_Field;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
class nsIScriptContext;
|
||||
class nsIURI;
|
||||
|
||||
class nsXBLProtoImplField
|
||||
@ -39,8 +40,8 @@ public:
|
||||
nsresult InstallAccessors(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aTargetClassObject);
|
||||
|
||||
nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream);
|
||||
nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream);
|
||||
nsresult Read(nsIObjectInputStream* aStream);
|
||||
nsresult Write(nsIObjectOutputStream* aStream);
|
||||
|
||||
const PRUnichar* GetName() const { return mName; }
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
class nsIContent;
|
||||
class nsIObjectOutputStream;
|
||||
class nsIScriptContext;
|
||||
|
||||
struct nsXBLTextWithLineNumber
|
||||
{
|
||||
@ -75,14 +74,12 @@ public:
|
||||
|
||||
virtual nsresult InstallMember(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aTargetClassObject) = 0;
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
virtual nsresult CompileMember(const nsCString& aClassStr,
|
||||
JS::Handle<JSObject*> aClassObject) = 0;
|
||||
|
||||
virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) = 0;
|
||||
|
||||
virtual nsresult Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream)
|
||||
virtual nsresult Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ nsXBLProtoImplMethod::InstallMember(JSContext* aCx,
|
||||
JS::Rooted<JSObject*> scopeObject(aCx, xpc::GetXBLScope(aCx, globalObject));
|
||||
NS_ENSURE_TRUE(scopeObject, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// now we want to reevaluate our property using aContext and the script object for this window...
|
||||
JS::Rooted<JSObject*> jsMethodObject(aCx, GetCompiledMethod());
|
||||
if (jsMethodObject) {
|
||||
nsDependentString name(mName);
|
||||
@ -137,9 +136,10 @@ nsXBLProtoImplMethod::InstallMember(JSContext* aCx,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr,
|
||||
nsXBLProtoImplMethod::CompileMember(const nsCString& aClassStr,
|
||||
JS::Handle<JSObject*> aClassObject)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
NS_PRECONDITION(!IsCompiled(),
|
||||
"Trying to compile an already-compiled method");
|
||||
NS_PRECONDITION(aClassObject,
|
||||
@ -199,7 +199,7 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
|
||||
functionUri.Truncate(hash);
|
||||
}
|
||||
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AutoJSContext cx;
|
||||
JSAutoCompartment ac(cx, aClassObject);
|
||||
JS::CompileOptions options(cx);
|
||||
options.setFileAndLine(functionUri.get(),
|
||||
@ -234,13 +234,14 @@ nsXBLProtoImplMethod::Trace(const TraceCallbacks& aCallbacks, void *aClosure)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplMethod::Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream)
|
||||
nsXBLProtoImplMethod::Read(nsIObjectInputStream* aStream)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
MOZ_ASSERT(!IsCompiled() && !GetUncompiledMethod());
|
||||
|
||||
JS::Rooted<JSObject*> methodObject(aContext->GetNativeContext());
|
||||
nsresult rv = XBL_DeserializeFunction(aContext, aStream, &methodObject);
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> methodObject(cx);
|
||||
nsresult rv = XBL_DeserializeFunction(aStream, &methodObject);
|
||||
if (NS_FAILED(rv)) {
|
||||
SetUncompiledMethod(nullptr);
|
||||
return rv;
|
||||
@ -252,9 +253,9 @@ nsXBLProtoImplMethod::Read(nsIScriptContext* aContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream)
|
||||
nsXBLProtoImplMethod::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
MOZ_ASSERT(IsCompiled());
|
||||
if (GetCompiledMethod()) {
|
||||
nsresult rv = aStream->Write8(XBLBinding_Serialize_Method);
|
||||
@ -268,7 +269,7 @@ nsXBLProtoImplMethod::Write(nsIScriptContext* aContext,
|
||||
// been set to a compiled method.
|
||||
JS::Handle<JSObject*> method =
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(mMethod.AsHeapObject().address());
|
||||
return XBL_SerializeFunction(aContext, aStream, method);
|
||||
return XBL_SerializeFunction(aStream, method);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -342,7 +343,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
|
||||
rv = nsContentUtils::GetSecurityManager()->CheckFunctionAccess(cx, method,
|
||||
thisObject);
|
||||
|
||||
JSBool ok = true;
|
||||
bool ok = true;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
JS::Rooted<JS::Value> retval(cx);
|
||||
ok = ::JS_CallFunctionValue(cx, thisObject, OBJECT_TO_JSVAL(method),
|
||||
@ -362,10 +363,10 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
nsXBLProtoImplAnonymousMethod::Write(nsIObjectOutputStream* aStream,
|
||||
XBLBindingSerializeDetails aType)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
MOZ_ASSERT(IsCompiled());
|
||||
if (GetCompiledMethod()) {
|
||||
nsresult rv = aStream->Write8(aType);
|
||||
@ -376,7 +377,7 @@ nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext,
|
||||
// been set to a compiled method.
|
||||
JS::Handle<JSObject*> method =
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(mMethod.AsHeapObject().address());
|
||||
rv = XBL_SerializeFunction(aContext, aStream, method);
|
||||
rv = XBL_SerializeFunction(aStream, method);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,13 @@ public:
|
||||
|
||||
virtual nsresult InstallMember(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aTargetClassObject) MOZ_OVERRIDE;
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
virtual nsresult CompileMember(const nsCString& aClassStr,
|
||||
JS::Handle<JSObject*> aClassObject) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Trace(const TraceCallbacks& aCallbacks, void *aClosure) MOZ_OVERRIDE;
|
||||
|
||||
nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream);
|
||||
virtual nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
|
||||
nsresult Read(nsIObjectInputStream* aStream);
|
||||
virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
|
||||
|
||||
bool IsCompiled() const
|
||||
{
|
||||
@ -147,8 +146,7 @@ public:
|
||||
}
|
||||
|
||||
using nsXBLProtoImplMethod::Write;
|
||||
nsresult Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
nsresult Write(nsIObjectOutputStream* aStream,
|
||||
XBLBindingSerializeDetails aType);
|
||||
};
|
||||
|
||||
|
@ -12,9 +12,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "xpcpublic.h"
|
||||
@ -135,7 +133,6 @@ nsXBLProtoImplProperty::InstallMember(JSContext *aCx,
|
||||
JS::Rooted<JSObject*> scopeObject(aCx, xpc::GetXBLScope(aCx, globalObject));
|
||||
NS_ENSURE_TRUE(scopeObject, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// now we want to reevaluate our property using aContext and the script object for this window...
|
||||
if (mGetter.GetJSFunction() || mSetter.GetJSFunction()) {
|
||||
// First, enter the compartment of the scope object and clone the functions.
|
||||
JSAutoCompartment ac(aCx, scopeObject);
|
||||
@ -170,9 +167,10 @@ nsXBLProtoImplProperty::InstallMember(JSContext *aCx,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCString& aClassStr,
|
||||
nsXBLProtoImplProperty::CompileMember(const nsCString& aClassStr,
|
||||
JS::Handle<JSObject*> aClassObject)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
NS_PRECONDITION(!mIsCompiled,
|
||||
"Trying to compile an already-compiled property");
|
||||
NS_PRECONDITION(aClassObject,
|
||||
@ -199,7 +197,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
|
||||
if (getterText && getterText->GetText()) {
|
||||
nsDependentString getter(getterText->GetText());
|
||||
if (!getter.IsEmpty()) {
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AutoJSContext cx;
|
||||
JSAutoCompartment ac(cx, aClassObject);
|
||||
JS::CompileOptions options(cx);
|
||||
options.setFileAndLine(functionUri.get(), getterText->GetLineNumber())
|
||||
@ -246,7 +244,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
|
||||
if (setterText && setterText->GetText()) {
|
||||
nsDependentString setter(setterText->GetText());
|
||||
if (!setter.IsEmpty()) {
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AutoJSContext cx;
|
||||
JSAutoCompartment ac(cx, aClassObject);
|
||||
JS::CompileOptions options(cx);
|
||||
options.setFileAndLine(functionUri.get(), setterText->GetLineNumber())
|
||||
@ -297,19 +295,18 @@ nsXBLProtoImplProperty::Trace(const TraceCallbacks& aCallbacks, void *aClosure)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplProperty::Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
nsXBLProtoImplProperty::Read(nsIObjectInputStream* aStream,
|
||||
XBLBindingSerializeDetails aType)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
MOZ_ASSERT(!mIsCompiled);
|
||||
MOZ_ASSERT(!mGetter.GetUncompiled() && !mSetter.GetUncompiled());
|
||||
|
||||
JSContext *cx = aContext->GetNativeContext();
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> getterObject(cx);
|
||||
if (aType == XBLBinding_Serialize_GetterProperty ||
|
||||
aType == XBLBinding_Serialize_GetterSetterProperty) {
|
||||
nsresult rv = XBL_DeserializeFunction(aContext, aStream, &getterObject);
|
||||
nsresult rv = XBL_DeserializeFunction(aStream, &getterObject);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
|
||||
@ -319,7 +316,7 @@ nsXBLProtoImplProperty::Read(nsIScriptContext* aContext,
|
||||
JS::Rooted<JSObject*> setterObject(cx);
|
||||
if (aType == XBLBinding_Serialize_SetterProperty ||
|
||||
aType == XBLBinding_Serialize_GetterSetterProperty) {
|
||||
nsresult rv = XBL_DeserializeFunction(aContext, aStream, &setterObject);
|
||||
nsresult rv = XBL_DeserializeFunction(aStream, &setterObject);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mJSAttributes |= JSPROP_SETTER | JSPROP_SHARED;
|
||||
@ -334,9 +331,9 @@ nsXBLProtoImplProperty::Read(nsIScriptContext* aContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImplProperty::Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream)
|
||||
nsXBLProtoImplProperty::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
XBLBindingSerializeDetails type;
|
||||
|
||||
if (mJSAttributes & JSPROP_GETTER) {
|
||||
@ -365,14 +362,14 @@ nsXBLProtoImplProperty::Write(nsIScriptContext* aContext,
|
||||
if (mJSAttributes & JSPROP_GETTER) {
|
||||
JS::Handle<JSObject*> function =
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(mGetter.AsHeapObject().address());
|
||||
rv = XBL_SerializeFunction(aContext, aStream, function);
|
||||
rv = XBL_SerializeFunction(aStream, function);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (mJSAttributes & JSPROP_SETTER) {
|
||||
JS::Handle<JSObject*> function =
|
||||
JS::Handle<JSObject*>::fromMarkedLocation(mSetter.AsHeapObject().address());
|
||||
rv = XBL_SerializeFunction(aContext, aStream, function);
|
||||
rv = XBL_SerializeFunction(aStream, function);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -36,17 +36,14 @@ public:
|
||||
|
||||
virtual nsresult InstallMember(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aTargetClassObject) MOZ_OVERRIDE;
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
virtual nsresult CompileMember(const nsCString& aClassStr,
|
||||
JS::Handle<JSObject*> aClassObject) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE;
|
||||
|
||||
nsresult Read(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
nsresult Read(nsIObjectInputStream* aStream,
|
||||
XBLBindingSerializeDetails aType);
|
||||
virtual nsresult Write(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
|
||||
virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
typedef JS::Heap<nsXBLMaybeCompiled<nsXBLTextWithLineNumber> > PropertyOp;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsTextNode.h"
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
@ -946,12 +945,10 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
mInterfaceTable.Put(iid, mBinding);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner(do_QueryObject(aDocInfo));
|
||||
nsIScriptGlobalObject* globalObject = globalOwner->GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsIScriptContext *context = globalObject->GetContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> compilationGlobal(cx, aDocInfo->GetCompilationGlobal());
|
||||
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
|
||||
JSAutoCompartment ac(cx, compilationGlobal);
|
||||
|
||||
bool isFirstBinding = aFlags & XBLBinding_Serialize_IsFirstBinding;
|
||||
rv = Init(id, aDocInfo, nullptr, isFirstBinding);
|
||||
@ -976,7 +973,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
// retrieve the mapped bindings from within here. However, if an error
|
||||
// occurs, the mapping should be removed again so that we don't keep an
|
||||
// invalid binding around.
|
||||
rv = mImplementation->Read(context, aStream, this, globalObject);
|
||||
rv = mImplementation->Read(aStream, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -995,7 +992,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
"invalid handler type");
|
||||
|
||||
nsXBLPrototypeHandler* handler = new nsXBLPrototypeHandler(this);
|
||||
rv = handler->Read(context, aStream);
|
||||
rv = handler->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete handler;
|
||||
return rv;
|
||||
@ -1054,12 +1051,10 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
||||
// mKeyHandlersRegistered and mKeyHandlers are not serialized as they are
|
||||
// computed on demand.
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner(do_QueryObject(mXBLDocInfoWeak));
|
||||
nsIScriptGlobalObject* globalObject = globalOwner->GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsIScriptContext *context = globalObject->GetContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> compilationGlobal(cx, mXBLDocInfoWeak->GetCompilationGlobal());
|
||||
NS_ENSURE_TRUE(compilationGlobal, NS_ERROR_UNEXPECTED);
|
||||
JSAutoCompartment ac(cx, compilationGlobal);
|
||||
|
||||
uint8_t flags = mInheritStyle ? XBLBinding_Serialize_InheritStyle : 0;
|
||||
|
||||
@ -1118,7 +1113,7 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
||||
|
||||
// Write out the implementation details.
|
||||
if (mImplementation) {
|
||||
rv = mImplementation->Write(context, aStream, this);
|
||||
rv = mImplementation->Write(aStream, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
@ -1131,7 +1126,7 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
||||
// Write out the handlers.
|
||||
nsXBLPrototypeHandler* handler = mPrototypeHandler;
|
||||
while (handler) {
|
||||
rv = handler->Write(context, aStream);
|
||||
rv = handler->Write(aStream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
handler = handler->GetNextHandler();
|
||||
|
@ -22,7 +22,6 @@
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIScriptContext;
|
||||
class nsSupportsHashtable;
|
||||
class nsXBLProtoImplField;
|
||||
class nsXBLBinding;
|
||||
|
@ -951,8 +951,9 @@ nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEvent* aEvent,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLPrototypeHandler::Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream)
|
||||
nsXBLPrototypeHandler::Read(nsIObjectInputStream* aStream)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
nsresult rv = aStream->Read8(&mPhase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mType);
|
||||
@ -985,8 +986,9 @@ nsXBLPrototypeHandler::Read(nsIScriptContext* aContext, nsIObjectInputStream* aS
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLPrototypeHandler::Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream)
|
||||
nsXBLPrototypeHandler::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
AssertInCompilationScope();
|
||||
// Make sure we don't write out NS_HANDLER_TYPE_XUL types, as they are used
|
||||
// for <keyset> elements.
|
||||
if ((mType & NS_HANDLER_TYPE_XUL) || !mEventName)
|
||||
|
@ -136,8 +136,8 @@ public:
|
||||
return (mType & NS_HANDLER_ALLOW_UNTRUSTED) != 0;
|
||||
}
|
||||
|
||||
nsresult Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream);
|
||||
nsresult Write(nsIScriptContext* aContext, nsIObjectOutputStream* aStream);
|
||||
nsresult Read(nsIObjectInputStream* aStream);
|
||||
nsresult Write(nsIObjectOutputStream* aStream);
|
||||
|
||||
public:
|
||||
static uint32_t gRefCnt;
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
class nsIContent;
|
||||
class nsIAtom;
|
||||
class nsIScriptContext;
|
||||
class nsSupportsHashtable;
|
||||
class nsXBLResourceLoader;
|
||||
class nsXBLPrototypeBinding;
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
class nsIContent;
|
||||
class nsIAtom;
|
||||
class nsIScriptContext;
|
||||
class nsSupportsHashtable;
|
||||
class nsXBLPrototypeResources;
|
||||
class nsXBLPrototypeBinding;
|
||||
|
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
@ -12,20 +13,21 @@
|
||||
using namespace mozilla;
|
||||
|
||||
nsresult
|
||||
XBL_SerializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
XBL_SerializeFunction(nsIObjectOutputStream* aStream,
|
||||
JS::Handle<JSObject*> aFunction)
|
||||
{
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AssertInCompilationScope();
|
||||
AutoJSContext cx;
|
||||
MOZ_ASSERT(js::GetContextCompartment(cx) == js::GetObjectCompartment(aFunction));
|
||||
return nsContentUtils::XPConnect()->WriteFunction(aStream, cx, aFunction);
|
||||
}
|
||||
|
||||
nsresult
|
||||
XBL_DeserializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
XBL_DeserializeFunction(nsIObjectInputStream* aStream,
|
||||
JS::MutableHandle<JSObject*> aFunctionObjectp)
|
||||
{
|
||||
AutoPushJSContext cx(aContext->GetNativeContext());
|
||||
AssertInCompilationScope();
|
||||
AutoJSContext cx;
|
||||
return nsContentUtils::XPConnect()->ReadFunction(aStream, cx,
|
||||
aFunctionObjectp.address());
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -77,13 +76,11 @@ typedef uint8_t XBLBindingSerializeDetails;
|
||||
PR_STATIC_ASSERT(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuiltin);
|
||||
|
||||
nsresult
|
||||
XBL_SerializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectOutputStream* aStream,
|
||||
XBL_SerializeFunction(nsIObjectOutputStream* aStream,
|
||||
JS::Handle<JSObject*> aFunctionObject);
|
||||
|
||||
nsresult
|
||||
XBL_DeserializeFunction(nsIScriptContext* aContext,
|
||||
nsIObjectInputStream* aStream,
|
||||
XBL_DeserializeFunction(nsIObjectInputStream* aStream,
|
||||
JS::MutableHandle<JSObject*> aFunctionObject);
|
||||
|
||||
#endif // nsXBLSerialize_h__
|
||||
|
@ -602,7 +602,6 @@ XMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
"Can't import this document into another document!");
|
||||
|
||||
nsRefPtr<XMLDocument> clone = new XMLDocument();
|
||||
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsresult rv = CloneDocHelper(clone);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -84,9 +84,6 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsXMLContentSink* it = new nsXMLContentSink();
|
||||
if (nullptr == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
|
||||
nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user